kernel32: Moved MemManInfo16 to toolhelp16.c.

This commit is contained in:
Alexandre Julliard 2009-09-28 19:57:28 +02:00
parent 2e1b87d547
commit 9bf4de22f4
2 changed files with 28 additions and 29 deletions

View File

@ -1062,40 +1062,14 @@ 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) * GetFreeMemInfo (KERNEL.316)
*/ */
DWORD WINAPI GetFreeMemInfo16(void) DWORD WINAPI GetFreeMemInfo16(void)
{ {
MEMMANINFO info; MEMORYSTATUS status;
MemManInfo16( &info ); GlobalMemoryStatus( &status );
return MAKELONG( info.dwTotalLinearSpace, info.dwMaxPagesAvailable ); return MAKELONG( status.dwTotalVirtual/getpagesize(), status.dwAvailVirtual/getpagesize() );
} }
/*********************************************************************** /***********************************************************************

View File

@ -64,6 +64,31 @@ BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask )
return TaskNext16( lpte ); 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) * NotifyRegister (TOOLHELP.73)