[PATCH 09/11] kernel32/heap: Emulate Win9x if appropriate in GlobalMemoryStatusEx().
Adam Martinson
amartinson at codeweavers.com
Wed May 25 16:29:20 CDT 2011
---
dlls/kernel32/heap.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c
index 7be9172..9234b3b 100644
--- a/dlls/kernel32/heap.c
+++ b/dlls/kernel32/heap.c
@@ -4,6 +4,7 @@
* Copyright 1995, 1996 Alexandre Julliard
* Copyright 1996 Huw Davies
* Copyright 1998 Ulrich Weigand
+ * Copyright 2011 Adam Martinson for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1140,6 +1141,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
static MEMORYSTATUSEX cached_memstatus;
static int cache_lastchecked = 0;
SYSTEM_INFO si;
+ OSVERSIONINFOW osver;
#ifdef linux
FILE *f;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)
@@ -1168,6 +1170,9 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
}
cache_lastchecked = time(NULL);
+ osver.dwOSVersionInfoSize = sizeof(osver);
+ GetVersionExW(&osver);
+
lpmemex->dwMemoryLoad = 0;
lpmemex->ullTotalPhys = 16*1024*1024;
lpmemex->ullAvailPhys = 16*1024*1024;
@@ -1257,17 +1262,19 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
/* Win98 returns only the swapsize in ullTotalPageFile/ullAvailPageFile,
WinXP returns the size of physical memory + swapsize;
- mimic the behavior of XP.
Note: Project2k refuses to start if it sees less than 1Mb of free swap.
*/
- lpmemex->ullTotalPageFile += lpmemex->ullTotalPhys;
- lpmemex->ullAvailPageFile += lpmemex->ullAvailPhys;
-
- /* Titan Quest refuses to run if TotalPageFile <= ullTotalPhys */
- if(lpmemex->ullTotalPageFile == lpmemex->ullTotalPhys)
+ if (osver.dwMajorVersion >= 5)
{
- lpmemex->ullTotalPhys -= 1;
- lpmemex->ullAvailPhys -= 1;
+ 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 */
--
1.7.1
--------------030509010600050309010609
Content-Type: text/x-patch;
name="0010-kernel32-heap-Fix-some-hacks-in-GlobalMemoryStatus.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0010-kernel32-heap-Fix-some-hacks-in-GlobalMemoryStatus.patc";
filename*1="h"
More information about the wine-devel
mailing list