Commit ea5924c0 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Return the correct value for dwTotalVirtual.

Return a more plausible value for dwAvailVirtual.
parent bec545ae
...@@ -1501,6 +1501,7 @@ VOID WINAPI GlobalMemoryStatus( ...@@ -1501,6 +1501,7 @@ VOID WINAPI GlobalMemoryStatus(
) { ) {
static MEMORYSTATUS cached_memstatus; static MEMORYSTATUS cached_memstatus;
static int cache_lastchecked = 0; static int cache_lastchecked = 0;
SYSTEM_INFO si;
#ifdef linux #ifdef linux
FILE *f; FILE *f;
#endif #endif
...@@ -1553,10 +1554,10 @@ VOID WINAPI GlobalMemoryStatus( ...@@ -1553,10 +1554,10 @@ VOID WINAPI GlobalMemoryStatus(
if (lpmem->dwTotalPhys) if (lpmem->dwTotalPhys)
{ {
lpmem->dwTotalVirtual = lpmem->dwTotalPhys+lpmem->dwTotalPageFile; DWORD TotalPhysical = lpmem->dwTotalPhys+lpmem->dwTotalPageFile;
lpmem->dwAvailVirtual = lpmem->dwAvailPhys+lpmem->dwAvailPageFile; DWORD AvailPhysical = lpmem->dwAvailPhys+lpmem->dwAvailPageFile;
lpmem->dwMemoryLoad = (lpmem->dwTotalVirtual-lpmem->dwAvailVirtual) lpmem->dwMemoryLoad = (TotalPhysical-AvailPhysical)
/ (lpmem->dwTotalVirtual / 100); / (TotalPhysical / 100);
} }
} else } else
#endif #endif
...@@ -1567,9 +1568,11 @@ VOID WINAPI GlobalMemoryStatus( ...@@ -1567,9 +1568,11 @@ VOID WINAPI GlobalMemoryStatus(
lpmem->dwAvailPhys = 16*1024*1024; lpmem->dwAvailPhys = 16*1024*1024;
lpmem->dwTotalPageFile = 16*1024*1024; lpmem->dwTotalPageFile = 16*1024*1024;
lpmem->dwAvailPageFile = 16*1024*1024; lpmem->dwAvailPageFile = 16*1024*1024;
lpmem->dwTotalVirtual = 32*1024*1024;
lpmem->dwAvailVirtual = 32*1024*1024;
} }
GetSystemInfo(&si);
lpmem->dwTotalVirtual = si.lpMaximumApplicationAddress-si.lpMinimumApplicationAddress;
/* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */
lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024;
memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS)); memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment