Commit 9bf4de22 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Moved MemManInfo16 to toolhelp16.c.

parent 2e1b87d5
......@@ -1063,39 +1063,13 @@ BOOL16 WINAPI GlobalEntryModule16( GLOBALENTRY *pGlobal, HMODULE16 hModule,
/***********************************************************************
* MemManInfo (TOOLHELP.72)
*/
BOOL16 WINAPI MemManInfo16( MEMMANINFO *info )
{
MEMORYSTATUS status;
/*
* Not unsurprisingly although the documentation says you
* _must_ provide the size in the dwSize field, this function
* (under Windows) always fills the structure and returns true.
*/
GlobalMemoryStatus( &status );
info->wPageSize = getpagesize();
info->dwLargestFreeBlock = status.dwAvailVirtual;
info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize;
info->dwMaxPagesLockable = info->dwMaxPagesAvailable;
info->dwTotalLinearSpace = status.dwTotalVirtual / info->wPageSize;
info->dwTotalUnlockedPages = info->dwTotalLinearSpace;
info->dwFreePages = info->dwMaxPagesAvailable;
info->dwTotalPages = info->dwTotalLinearSpace;
info->dwFreeLinearSpace = info->dwMaxPagesAvailable;
info->dwSwapFilePages = status.dwTotalPageFile / info->wPageSize;
return TRUE;
}
/***********************************************************************
* GetFreeMemInfo (KERNEL.316)
*/
DWORD WINAPI GetFreeMemInfo16(void)
{
MEMMANINFO info;
MemManInfo16( &info );
return MAKELONG( info.dwTotalLinearSpace, info.dwMaxPagesAvailable );
MEMORYSTATUS status;
GlobalMemoryStatus( &status );
return MAKELONG( status.dwTotalVirtual/getpagesize(), status.dwAvailVirtual/getpagesize() );
}
/***********************************************************************
......
......@@ -64,6 +64,31 @@ BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask )
return TaskNext16( lpte );
}
/***********************************************************************
* MemManInfo (TOOLHELP.72)
*/
BOOL16 WINAPI MemManInfo16( MEMMANINFO *info )
{
MEMORYSTATUS status;
/*
* Not unsurprisingly although the documentation says you
* _must_ provide the size in the dwSize field, this function
* (under Windows) always fills the structure and returns true.
*/
GlobalMemoryStatus( &status );
info->wPageSize = getpagesize();
info->dwLargestFreeBlock = status.dwAvailVirtual;
info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize;
info->dwMaxPagesLockable = info->dwMaxPagesAvailable;
info->dwTotalLinearSpace = status.dwTotalVirtual / info->wPageSize;
info->dwTotalUnlockedPages = info->dwTotalLinearSpace;
info->dwFreePages = info->dwMaxPagesAvailable;
info->dwTotalPages = info->dwTotalLinearSpace;
info->dwFreeLinearSpace = info->dwMaxPagesAvailable;
info->dwSwapFilePages = status.dwTotalPageFile / info->wPageSize;
return TRUE;
}
/***********************************************************************
* NotifyRegister (TOOLHELP.73)
......
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