Implemented GlobalMemoryStatusEx().

oldstable
Mike Hearn 2003-02-26 04:35:36 +00:00 committed by Alexandre Julliard
parent 37f08173b5
commit 7aa04f2744
3 changed files with 48 additions and 1 deletions

View File

@ -533,7 +533,7 @@
@ stdcall GlobalHandle(ptr) GlobalHandle
@ stdcall GlobalLock(long) GlobalLock
@ stdcall GlobalMemoryStatus(ptr) GlobalMemoryStatus
@ stub GlobalMemoryStatusEx
@ stdcall GlobalMemoryStatusEx(ptr) GlobalMemoryStatusEx
@ stdcall GlobalReAlloc(long long long) GlobalReAlloc
@ stdcall GlobalSize(long) GlobalSize
@ stdcall GlobalUnWire(long) GlobalUnWire

View File

@ -460,6 +460,18 @@ typedef struct tagMEMORYSTATUS
SIZE_T dwAvailVirtual;
} MEMORYSTATUS, *LPMEMORYSTATUS;
typedef struct tagMEMORYSTATUSEX {
DWORD dwLength;
DWORD dwMemoryLoad;
DWORDLONG ullTotalPhys;
DWORDLONG ullAvailPhys;
DWORDLONG ullTotalPageFile;
DWORDLONG ullAvailPageFile;
DWORDLONG ullTotalVirtual;
DWORDLONG ullAvailVirtual;
DWORDLONG ullAvailExtendedVirtual;
} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
typedef struct _SYSTEMTIME{
WORD wYear;

View File

@ -1558,6 +1558,9 @@ SIZE_T WINAPI GlobalCompact( DWORD minfree )
/***********************************************************************
* GlobalMemoryStatus (KERNEL32.@)
* Provides information about the status of the memory, so apps can tell
* roughly how much they are able to allocate
*
* RETURNS
* None
*/
@ -1692,6 +1695,38 @@ VOID WINAPI GlobalMemoryStatus(
lpmem->dwAvailVirtual);
}
/***********************************************************************
* GlobalMemoryStatusEx (KERNEL32.@)
* A version of GlobalMemoryStatus that can deal with memory over 4GB
*
* RETURNS
* None
*/
BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer ) {
MEMORYSTATUS memstatus;
/* Because GlobalMemoryStatusEx is identical to GlobalMemoryStatus save
for one extra field in the struct, and the lack of a bug, we simply
call GlobalMemoryStatus and copy the values across. */
FIXME("we should emulate the 4GB bug here, as per MSDN\n");
GlobalMemoryStatus(&memstatus);
lpBuffer->dwMemoryLoad = memstatus.dwMemoryLoad;
lpBuffer->ullTotalPhys = memstatus.dwTotalPhys;
lpBuffer->ullAvailPhys = memstatus.dwAvailPhys;
lpBuffer->ullTotalPageFile = memstatus.dwTotalPageFile;
lpBuffer->ullAvailPageFile = memstatus.dwAvailPageFile;
lpBuffer->ullTotalVirtual = memstatus.dwTotalVirtual;
lpBuffer->ullAvailVirtual = memstatus.dwAvailVirtual;
/* MSDN says about AvailExtendedVirtual: Size of unreserved and uncommitted
memory in the extended portion of the virtual address space of the calling
process, in bytes.
However, I don't know what this means, so set it to zero :(
*/
lpBuffer->ullAvailExtendedVirtual = 0;
return 1;
}
/***********************************************************************
* A20Proc (KERNEL.165)
* A20_Proc (SYSTEM.20)