krnl386.exe: Retrieve the page size from ntdll.
This commit is contained in:
parent
90e90e3b6a
commit
ac5319630d
|
@ -963,9 +963,12 @@ WORD WINAPI GlobalHandleToSel16( HGLOBAL16 handle )
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI GetFreeMemInfo16(void)
|
DWORD WINAPI GetFreeMemInfo16(void)
|
||||||
{
|
{
|
||||||
|
SYSTEM_BASIC_INFORMATION info;
|
||||||
MEMORYSTATUS status;
|
MEMORYSTATUS status;
|
||||||
|
|
||||||
|
NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL );
|
||||||
GlobalMemoryStatus( &status );
|
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");
|
TRACE("get free memory information\n");
|
||||||
{
|
{
|
||||||
MEMORYSTATUS status;
|
MEMORYSTATUS status;
|
||||||
|
SYSTEM_BASIC_INFORMATION sbi;
|
||||||
|
|
||||||
/* the layout is just the same as MEMMANINFO, but without
|
/* the layout is just the same as MEMMANINFO, but without
|
||||||
* the dwSize entry.
|
* the dwSize entry.
|
||||||
|
@ -1331,7 +1332,9 @@ void WINAPI DOSVM_Int31Handler( CONTEXT *context )
|
||||||
} *info = CTX_SEG_OFF_TO_LIN( context, context->SegEs, context->Edi );
|
} *info = CTX_SEG_OFF_TO_LIN( context, context->SegEs, context->Edi );
|
||||||
|
|
||||||
GlobalMemoryStatus( &status );
|
GlobalMemoryStatus( &status );
|
||||||
info->wPageSize = getpagesize();
|
NtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), NULL );
|
||||||
|
|
||||||
|
info->wPageSize = sbi.PageSize;
|
||||||
info->dwLargestFreeBlock = status.dwAvailVirtual;
|
info->dwLargestFreeBlock = status.dwAvailVirtual;
|
||||||
info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize;
|
info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize;
|
||||||
info->dwMaxPagesLockable = info->dwMaxPagesAvailable;
|
info->dwMaxPagesLockable = info->dwMaxPagesAvailable;
|
||||||
|
@ -1418,11 +1421,14 @@ void WINAPI DOSVM_Int31Handler( CONTEXT *context )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0604: /* Get page size */
|
case 0x0604: /* Get page size */
|
||||||
|
{
|
||||||
|
SYSTEM_BASIC_INFORMATION info;
|
||||||
TRACE("get pagesize\n");
|
TRACE("get pagesize\n");
|
||||||
SET_BX( context, HIWORD(getpagesize()) );
|
NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL );
|
||||||
SET_CX( context, LOWORD(getpagesize()) );
|
SET_BX( context, HIWORD(info.PageSize) );
|
||||||
|
SET_CX( context, LOWORD(info.PageSize) );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 0x0700: /* Mark pages as paging candidates */
|
case 0x0700: /* Mark pages as paging candidates */
|
||||||
TRACE( "mark pages as paging candidates - ignored (no paging)\n" );
|
TRACE( "mark pages as paging candidates - ignored (no paging)\n" );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -491,6 +491,7 @@ BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask )
|
||||||
*/
|
*/
|
||||||
BOOL16 WINAPI MemManInfo16( MEMMANINFO *info )
|
BOOL16 WINAPI MemManInfo16( MEMMANINFO *info )
|
||||||
{
|
{
|
||||||
|
SYSTEM_BASIC_INFORMATION sbi;
|
||||||
MEMORYSTATUS status;
|
MEMORYSTATUS status;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -498,8 +499,9 @@ BOOL16 WINAPI MemManInfo16( MEMMANINFO *info )
|
||||||
* _must_ provide the size in the dwSize field, this function
|
* _must_ provide the size in the dwSize field, this function
|
||||||
* (under Windows) always fills the structure and returns true.
|
* (under Windows) always fills the structure and returns true.
|
||||||
*/
|
*/
|
||||||
|
NtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), NULL );
|
||||||
GlobalMemoryStatus( &status );
|
GlobalMemoryStatus( &status );
|
||||||
info->wPageSize = getpagesize();
|
info->wPageSize = sbi.PageSize;
|
||||||
info->dwLargestFreeBlock = status.dwAvailVirtual;
|
info->dwLargestFreeBlock = status.dwAvailVirtual;
|
||||||
info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize;
|
info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize;
|
||||||
info->dwMaxPagesLockable = info->dwMaxPagesAvailable;
|
info->dwMaxPagesLockable = info->dwMaxPagesAvailable;
|
||||||
|
|
Loading…
Reference in New Issue