Commit ac531963 authored by Alexandre Julliard's avatar Alexandre Julliard

krnl386.exe: Retrieve the page size from ntdll.

parent 90e90e3b
......@@ -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 );
}
/***********************************************************************
......
......@@ -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;
......
......@@ -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;
......
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