Module: wine Branch: master Commit: ac5319630d7882bb1380240ba1bc3d89314b2416 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ac5319630d7882bb1380240ba1...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jan 8 14:00:44 2013 +0100
krnl386.exe: Retrieve the page size from ntdll.
---
dlls/krnl386.exe16/global.c | 5 ++++- dlls/krnl386.exe16/int31.c | 14 ++++++++++---- dlls/toolhelp.dll16/toolhelp.c | 4 +++- 3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/krnl386.exe16/global.c b/dlls/krnl386.exe16/global.c index d9dcb1b..699463c 100644 --- a/dlls/krnl386.exe16/global.c +++ b/dlls/krnl386.exe16/global.c @@ -963,9 +963,12 @@ WORD WINAPI GlobalHandleToSel16( HGLOBAL16 handle ) */ DWORD WINAPI GetFreeMemInfo16(void) { + SYSTEM_BASIC_INFORMATION info; MEMORYSTATUS status; + + NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL ); GlobalMemoryStatus( &status ); - return MAKELONG( status.dwTotalVirtual/getpagesize(), status.dwAvailVirtual/getpagesize() ); + return MAKELONG( status.dwTotalVirtual / info.PageSize, status.dwAvailVirtual / info.PageSize ); }
/*********************************************************************** diff --git a/dlls/krnl386.exe16/int31.c b/dlls/krnl386.exe16/int31.c index ac9ae1f..5eddcca 100644 --- a/dlls/krnl386.exe16/int31.c +++ b/dlls/krnl386.exe16/int31.c @@ -1312,6 +1312,7 @@ void WINAPI DOSVM_Int31Handler( CONTEXT *context ) TRACE("get free memory information\n"); { MEMORYSTATUS status; + SYSTEM_BASIC_INFORMATION sbi;
/* the layout is just the same as MEMMANINFO, but without * the dwSize entry. @@ -1331,7 +1332,9 @@ void WINAPI DOSVM_Int31Handler( CONTEXT *context ) } *info = CTX_SEG_OFF_TO_LIN( context, context->SegEs, context->Edi );
GlobalMemoryStatus( &status ); - info->wPageSize = getpagesize(); + NtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), NULL ); + + info->wPageSize = sbi.PageSize; info->dwLargestFreeBlock = status.dwAvailVirtual; info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize; info->dwMaxPagesLockable = info->dwMaxPagesAvailable; @@ -1418,11 +1421,14 @@ void WINAPI DOSVM_Int31Handler( CONTEXT *context ) break;
case 0x0604: /* Get page size */ + { + SYSTEM_BASIC_INFORMATION info; TRACE("get pagesize\n"); - SET_BX( context, HIWORD(getpagesize()) ); - SET_CX( context, LOWORD(getpagesize()) ); + NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL ); + SET_BX( context, HIWORD(info.PageSize) ); + SET_CX( context, LOWORD(info.PageSize) ); break; - + } case 0x0700: /* Mark pages as paging candidates */ TRACE( "mark pages as paging candidates - ignored (no paging)\n" ); break; diff --git a/dlls/toolhelp.dll16/toolhelp.c b/dlls/toolhelp.dll16/toolhelp.c index fb001ea..4fa1500 100644 --- a/dlls/toolhelp.dll16/toolhelp.c +++ b/dlls/toolhelp.dll16/toolhelp.c @@ -491,6 +491,7 @@ BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask ) */ BOOL16 WINAPI MemManInfo16( MEMMANINFO *info ) { + SYSTEM_BASIC_INFORMATION sbi; MEMORYSTATUS status;
/* @@ -498,8 +499,9 @@ BOOL16 WINAPI MemManInfo16( MEMMANINFO *info ) * _must_ provide the size in the dwSize field, this function * (under Windows) always fills the structure and returns true. */ + NtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), NULL ); GlobalMemoryStatus( &status ); - info->wPageSize = getpagesize(); + info->wPageSize = sbi.PageSize; info->dwLargestFreeBlock = status.dwAvailVirtual; info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize; info->dwMaxPagesLockable = info->dwMaxPagesAvailable;