[3/3] kernel32: GlobalMemoryStatusEx: always report at least 1 byte of virtual memory even if none is available

Fabian Bieler der.fabe at gmx.net
Wed Mar 14 18:41:07 CDT 2007


This patch decreases the amount of physical memory reported by 1 byte.

Titan Quest refuses to start if TotalPageFile <= ullTotalPhys with the error 
message: "Virtual memory must be enabled to run Titan Quest."

This is a work-around for users unwilling to add swap space.

If this patch won't go into the master, please apply the previous two patches 
alone.
-------------- next part --------------
From f986a60cf0b21db81233059b6c3ee73f4ad585ca Mon Sep 17 00:00:00 2001
From: Fabian Bieler <der.fabe at gmx.net>
Date: Thu, 15 Mar 2007 00:22:53 +0100
Subject: [PATCH] kernel32: GlobalMemoryStatusEx: always report at least 1 byte of virtual memory even if none is available

---
 dlls/kernel32/heap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c
index 996a7e4..68bfe43 100644
--- a/dlls/kernel32/heap.c
+++ b/dlls/kernel32/heap.c
@@ -1311,6 +1311,13 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
     lpmemex->ullTotalPageFile += lpmemex->ullTotalPhys;
     lpmemex->ullAvailPageFile += lpmemex->ullAvailPhys;
 
+    /* Titan Quest refuses to run if TotalPageFile <= ullTotalPhys */
+    if(lpmemex->ullTotalPageFile == lpmemex->ullTotalPhys)
+    {
+        lpmemex->ullTotalPhys -= 1;
+        lpmemex->ullAvailPhys -= 1;
+    }
+
     /* FIXME: should do something for other systems */
     GetSystemInfo(&si);
     lpmemex->ullTotalVirtual  = (char*)si.lpMaximumApplicationAddress-(char*)si.lpMinimumApplicationAddress;
-- 
1.4.4.1



More information about the wine-patches mailing list