From d8822cf3d2708dccb3e04d72ddf73662e7992f85 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Tue, 10 Apr 2012 22:04:30 +0200 Subject: [PATCH] kernel32: Limit dwTotalPageFile in GlobalMemoryStatus to 4Gb minus 512kb for apps that do not expect so much memory. --- dlls/kernel32/heap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index db21b7ad8c..d730a8aee3 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -1305,7 +1305,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex ) * roughly how much they are able to allocate * * RETURNS - * None + * None */ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) { @@ -1333,13 +1333,14 @@ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) { lpBuffer->dwTotalPhys = min( memstatus.ullTotalPhys, MAXDWORD ); lpBuffer->dwAvailPhys = min( memstatus.ullAvailPhys, MAXDWORD ); - lpBuffer->dwTotalPageFile = min( memstatus.ullTotalPageFile, MAXDWORD ); + /* Limit value for apps that do not expect so much memory. Remove last 512 kb to make Sacrifice demo happy. */ + lpBuffer->dwTotalPageFile = min( memstatus.ullTotalPageFile, 0xfff7ffff ); lpBuffer->dwAvailPageFile = min( memstatus.ullAvailPageFile, MAXDWORD ); lpBuffer->dwTotalVirtual = min( memstatus.ullTotalVirtual, MAXDWORD ); lpBuffer->dwAvailVirtual = min( memstatus.ullAvailVirtual, MAXDWORD ); } - else /* duplicate NT bug */ + else /* duplicate NT bug */ { lpBuffer->dwTotalPhys = memstatus.ullTotalPhys; lpBuffer->dwAvailPhys = memstatus.ullAvailPhys;