15 #ifndef GAUDI_SYSTEM_WIN32PSAPI_H 16 #define GAUDI_SYSTEM_WIN32PSAPI_H 18 typedef struct _MODULEINFO {
22 } MODULEINFO, *LPMODULEINFO;
23 typedef struct _PSAPI_WS_WATCH_INFORMATION {
26 } PSAPI_WS_WATCH_INFORMATION, *PPSAPI_WS_WATCH_INFORMATION;
27 typedef struct _PROCESS_MEMORY_COUNTERS {
30 DWORD PeakWorkingSetSize;
32 DWORD QuotaPeakPagedPoolUsage;
33 DWORD QuotaPagedPoolUsage;
34 DWORD QuotaPeakNonPagedPoolUsage;
35 DWORD QuotaNonPagedPoolUsage;
37 DWORD PeakPagefileUsage;
38 } PROCESS_MEMORY_COUNTERS;
39 typedef PROCESS_MEMORY_COUNTERS* PPROCESS_MEMORY_COUNTERS;
45 BOOL( WINAPI* EnumProcesses )( DWORD* lpidProcess, DWORD cb, DWORD* cbNeeded );
46 BOOL( WINAPI* EnumProcessModules )( HANDLE hProcess, HINSTANCE* lphModule, DWORD cb, LPDWORD lpcbNeeded );
47 DWORD( WINAPI* GetModuleBaseNameA )( HANDLE hProcess, HINSTANCE hModule, LPSTR lpBaseName, DWORD nSize );
48 DWORD( WINAPI* GetModuleFileNameExA )( HANDLE hProcess, HINSTANCE hModule, LPSTR lpFilename, DWORD nSize );
49 BOOL( WINAPI* GetModuleInformation )( HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb );
50 BOOL( WINAPI* EmptyWorkingSet )( HANDLE hProcess );
51 BOOL( WINAPI* QueryWorkingSet )( HANDLE hProcess, PVOID pv, DWORD cb );
52 BOOL( WINAPI* InitializeProcessForWsWatch )( HANDLE hProcess );
53 BOOL( WINAPI* GetWsChanges )( HANDLE hProcess, PPSAPI_WS_WATCH_INFORMATION lpWatchInfo, DWORD cb );
54 DWORD( WINAPI* GetMappedFileNameA )( HANDLE hProcess, LPVOID lpv, LPSTR lpFilename, DWORD nSize );
55 BOOL( WINAPI* EnumDeviceDrivers )( LPVOID* lpImageBase, DWORD cb, LPDWORD lpcbNeeded );
56 DWORD( WINAPI* GetDeviceDriverBaseNameA )( LPVOID ImageBase, LPSTR lpBaseName, DWORD nSize );
57 DWORD( WINAPI* GetDeviceDriverFileNameA )( LPVOID ImageBase, LPSTR lpFilename, DWORD nSize );
58 BOOL( WINAPI* GetProcessMemoryInfo )( HANDLE Process, PPROCESS_MEMORY_COUNTERS ppsmemCounters, DWORD cb );
59 void load( HINSTANCE handle,
const char*
name,
void** pFunction )
61 *pFunction = (
void*)::GetProcAddress( handle, name );
62 if ( 0 == *pFunction ) m_isValid =
false;
64 bool isValid()
const {
return m_isValid; }
68 HINSTANCE mh = ::LoadLibrary(
"PSAPI.DLL" );
72 load( mh,
"EnumProcesses", (
void**)&EnumProcesses );
73 load( mh,
"EnumProcessModules", (
void**)&EnumProcessModules );
74 load( mh,
"GetModuleBaseNameA", (
void**)&GetModuleBaseNameA );
75 load( mh,
"GetModuleFileNameExA", (
void**)&GetModuleFileNameExA );
76 load( mh,
"GetModuleInformation", (
void**)&GetModuleInformation );
77 load( mh,
"EmptyWorkingSet", (
void**)&EmptyWorkingSet );
78 load( mh,
"QueryWorkingSet", (
void**)&QueryWorkingSet );
79 load( mh,
"InitializeProcessForWsWatch", (
void**)&InitializeProcessForWsWatch );
80 load( mh,
"GetWsChanges", (
void**)&GetWsChanges );
81 load( mh,
"GetMappedFileNameA", (
void**)&GetMappedFileNameA );
82 load( mh,
"EnumDeviceDrivers", (
void**)&EnumDeviceDrivers );
83 load( mh,
"GetDeviceDriverBaseNameA", (
void**)&GetDeviceDriverBaseNameA );
84 load( mh,
"GetDeviceDriverFileNameA", (
void**)&GetDeviceDriverFileNameA );
85 load( mh,
"GetProcessMemoryInfo", (
void**)&GetProcessMemoryInfo );
91 #endif // GAUDI_SYSTEM_WIN32PSAPI_H
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.