1*c2c66affSColin Finck /* 2*c2c66affSColin Finck psapi.h - Include file for PSAPI.DLL APIs 3*c2c66affSColin Finck 4*c2c66affSColin Finck Written by Mumit Khan <khan@nanotech.wisc.edu> 5*c2c66affSColin Finck 6*c2c66affSColin Finck This file is part of a free library for the Win32 API. 7*c2c66affSColin Finck 8*c2c66affSColin Finck NOTE: This strictly does not belong in the Win32 API since it's 9*c2c66affSColin Finck really part of Platform SDK. However,GDB needs it and we might 10*c2c66affSColin Finck as well provide it here. 11*c2c66affSColin Finck 12*c2c66affSColin Finck This library is distributed in the hope that it will be useful, 13*c2c66affSColin Finck but WITHOUT ANY WARRANTY; without even the implied warranty of 14*c2c66affSColin Finck MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15*c2c66affSColin Finck 16*c2c66affSColin Finck */ 17*c2c66affSColin Finck #ifndef _PSAPI_H 18*c2c66affSColin Finck #define _PSAPI_H 19*c2c66affSColin Finck 20*c2c66affSColin Finck #ifdef __cplusplus 21*c2c66affSColin Finck extern "C" { 22*c2c66affSColin Finck #endif 23*c2c66affSColin Finck 24*c2c66affSColin Finck #ifndef RC_INVOKED 25*c2c66affSColin Finck 26*c2c66affSColin Finck typedef struct _MODULEINFO { 27*c2c66affSColin Finck LPVOID lpBaseOfDll; 28*c2c66affSColin Finck DWORD SizeOfImage; 29*c2c66affSColin Finck LPVOID EntryPoint; 30*c2c66affSColin Finck } MODULEINFO,*LPMODULEINFO; 31*c2c66affSColin Finck 32*c2c66affSColin Finck typedef struct _PSAPI_WS_WATCH_INFORMATION { 33*c2c66affSColin Finck LPVOID FaultingPc; 34*c2c66affSColin Finck LPVOID FaultingVa; 35*c2c66affSColin Finck } PSAPI_WS_WATCH_INFORMATION,*PPSAPI_WS_WATCH_INFORMATION; 36*c2c66affSColin Finck 37*c2c66affSColin Finck typedef struct _PROCESS_MEMORY_COUNTERS { 38*c2c66affSColin Finck DWORD cb; 39*c2c66affSColin Finck DWORD PageFaultCount; 40*c2c66affSColin Finck SIZE_T PeakWorkingSetSize; 41*c2c66affSColin Finck SIZE_T WorkingSetSize; 42*c2c66affSColin Finck SIZE_T QuotaPeakPagedPoolUsage; 43*c2c66affSColin Finck SIZE_T QuotaPagedPoolUsage; 44*c2c66affSColin Finck SIZE_T QuotaPeakNonPagedPoolUsage; 45*c2c66affSColin Finck SIZE_T QuotaNonPagedPoolUsage; 46*c2c66affSColin Finck SIZE_T PagefileUsage; 47*c2c66affSColin Finck SIZE_T PeakPagefileUsage; 48*c2c66affSColin Finck } PROCESS_MEMORY_COUNTERS, *PPROCESS_MEMORY_COUNTERS; 49*c2c66affSColin Finck 50*c2c66affSColin Finck typedef struct _PROCESS_MEMORY_COUNTERS_EX { 51*c2c66affSColin Finck DWORD cb; 52*c2c66affSColin Finck DWORD PageFaultCount; 53*c2c66affSColin Finck SIZE_T PeakWorkingSetSize; 54*c2c66affSColin Finck SIZE_T WorkingSetSize; 55*c2c66affSColin Finck SIZE_T QuotaPeakPagedPoolUsage; 56*c2c66affSColin Finck SIZE_T QuotaPagedPoolUsage; 57*c2c66affSColin Finck SIZE_T QuotaPeakNonPagedPoolUsage; 58*c2c66affSColin Finck SIZE_T QuotaNonPagedPoolUsage; 59*c2c66affSColin Finck SIZE_T PagefileUsage; 60*c2c66affSColin Finck SIZE_T PeakPagefileUsage; 61*c2c66affSColin Finck SIZE_T PrivateUsage; 62*c2c66affSColin Finck } PROCESS_MEMORY_COUNTERS_EX, *PPROCESS_MEMORY_COUNTERS_EX; 63*c2c66affSColin Finck 64*c2c66affSColin Finck typedef struct _PERFORMANCE_INFORMATION { 65*c2c66affSColin Finck DWORD cb; 66*c2c66affSColin Finck SIZE_T CommitTotal; 67*c2c66affSColin Finck SIZE_T CommitLimit; 68*c2c66affSColin Finck SIZE_T CommitPeak; 69*c2c66affSColin Finck SIZE_T PhysicalTotal; 70*c2c66affSColin Finck SIZE_T PhysicalAvailable; 71*c2c66affSColin Finck SIZE_T SystemCache; 72*c2c66affSColin Finck SIZE_T KernelTotal; 73*c2c66affSColin Finck SIZE_T KernelPaged; 74*c2c66affSColin Finck SIZE_T KernelNonpaged; 75*c2c66affSColin Finck SIZE_T PageSize; 76*c2c66affSColin Finck DWORD HandleCount; 77*c2c66affSColin Finck DWORD ProcessCount; 78*c2c66affSColin Finck DWORD ThreadCount; 79*c2c66affSColin Finck } PERFORMANCE_INFORMATION, *PPERFORMANCE_INFORMATION; 80*c2c66affSColin Finck 81*c2c66affSColin Finck typedef struct _ENUM_PAGE_FILE_INFORMATION { 82*c2c66affSColin Finck DWORD cb; 83*c2c66affSColin Finck DWORD Reserved; 84*c2c66affSColin Finck SIZE_T TotalSize; 85*c2c66affSColin Finck SIZE_T TotalInUse; 86*c2c66affSColin Finck SIZE_T PeakUsage; 87*c2c66affSColin Finck } ENUM_PAGE_FILE_INFORMATION, *PENUM_PAGE_FILE_INFORMATION; 88*c2c66affSColin Finck 89*c2c66affSColin Finck typedef BOOL (CALLBACK *PENUM_PAGE_FILE_CALLBACKA)(LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR); 90*c2c66affSColin Finck typedef BOOL (CALLBACK *PENUM_PAGE_FILE_CALLBACKW)(LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR); 91*c2c66affSColin Finck 92*c2c66affSColin Finck /* Grouped by application,not in alphabetical order. */ 93*c2c66affSColin Finck BOOL WINAPI EnumProcesses(DWORD *,DWORD,DWORD *); 94*c2c66affSColin Finck BOOL WINAPI EnumProcessModules(HANDLE,HMODULE *,DWORD,LPDWORD); 95*c2c66affSColin Finck BOOL WINAPI EnumPageFilesA(PENUM_PAGE_FILE_CALLBACKA,LPVOID); 96*c2c66affSColin Finck BOOL WINAPI EnumPageFilesW(PENUM_PAGE_FILE_CALLBACKW,LPVOID); 97*c2c66affSColin Finck DWORD WINAPI GetModuleBaseNameA(HANDLE,HMODULE,LPSTR,DWORD); 98*c2c66affSColin Finck DWORD WINAPI GetModuleBaseNameW(HANDLE,HMODULE,LPWSTR,DWORD); 99*c2c66affSColin Finck DWORD WINAPI GetModuleFileNameExA(HANDLE,HMODULE,LPSTR,DWORD); 100*c2c66affSColin Finck DWORD WINAPI GetModuleFileNameExW(HANDLE,HMODULE,LPWSTR,DWORD); 101*c2c66affSColin Finck BOOL WINAPI GetModuleInformation(HANDLE,HMODULE,LPMODULEINFO,DWORD); 102*c2c66affSColin Finck BOOL WINAPI EmptyWorkingSet(HANDLE); 103*c2c66affSColin Finck BOOL WINAPI QueryWorkingSet(HANDLE,PVOID,DWORD); 104*c2c66affSColin Finck BOOL WINAPI InitializeProcessForWsWatch(HANDLE); 105*c2c66affSColin Finck BOOL WINAPI GetWsChanges(HANDLE,PPSAPI_WS_WATCH_INFORMATION,DWORD); 106*c2c66affSColin Finck DWORD WINAPI GetMappedFileNameW(HANDLE,LPVOID,LPWSTR,DWORD); 107*c2c66affSColin Finck DWORD WINAPI GetMappedFileNameA(HANDLE,LPVOID,LPSTR,DWORD); 108*c2c66affSColin Finck BOOL WINAPI EnumDeviceDrivers(LPVOID *,DWORD,LPDWORD); 109*c2c66affSColin Finck DWORD WINAPI GetDeviceDriverBaseNameA(LPVOID,LPSTR,DWORD); 110*c2c66affSColin Finck DWORD WINAPI GetDeviceDriverBaseNameW(LPVOID,LPWSTR,DWORD); 111*c2c66affSColin Finck DWORD WINAPI GetDeviceDriverFileNameA(LPVOID,LPSTR,DWORD); 112*c2c66affSColin Finck DWORD WINAPI GetDeviceDriverFileNameW(LPVOID,LPWSTR,DWORD); 113*c2c66affSColin Finck BOOL WINAPI GetProcessMemoryInfo(HANDLE,PPROCESS_MEMORY_COUNTERS,DWORD); 114*c2c66affSColin Finck BOOL WINAPI GetPerformanceInfo(PPERFORMANCE_INFORMATION,DWORD); 115*c2c66affSColin Finck DWORD WINAPI GetProcessImageFileNameW(HANDLE,LPWSTR,DWORD); 116*c2c66affSColin Finck DWORD WINAPI GetProcessImageFileNameA(HANDLE,LPSTR,DWORD); 117*c2c66affSColin Finck 118*c2c66affSColin Finck #endif /* not RC_INVOKED */ 119*c2c66affSColin Finck 120*c2c66affSColin Finck #ifdef UNICODE 121*c2c66affSColin Finck #define PENUM_PAGE_FILE_CALLBACK PENUM_PAGE_FILE_CALLBACKW 122*c2c66affSColin Finck #define EnumPageFiles EnumPageFilesW 123*c2c66affSColin Finck #define GetModuleBaseName GetModuleBaseNameW 124*c2c66affSColin Finck #define GetModuleFileNameEx GetModuleFileNameExW 125*c2c66affSColin Finck #define GetMappedFilenameEx GetMappedFilenameExW 126*c2c66affSColin Finck #define GetDeviceDriverBaseName GetDeviceDriverBaseNameW 127*c2c66affSColin Finck #define GetDeviceDriverFileName GetDeviceDriverFileNameW 128*c2c66affSColin Finck #define GetProcessImageFileName GetProcessImageFileNameW 129*c2c66affSColin Finck #else 130*c2c66affSColin Finck #define PENUM_PAGE_FILE_CALLBACK PENUM_PAGE_FILE_CALLBACKA 131*c2c66affSColin Finck #define EnumPageFiles EnumPageFilesA 132*c2c66affSColin Finck #define GetModuleBaseName GetModuleBaseNameA 133*c2c66affSColin Finck #define GetModuleFileNameEx GetModuleFileNameExA 134*c2c66affSColin Finck #define GetMappedFilenameEx GetMappedFilenameExA 135*c2c66affSColin Finck #define GetDeviceDriverBaseName GetDeviceDriverBaseNameA 136*c2c66affSColin Finck #define GetDeviceDriverFileName GetDeviceDriverFileNameA 137*c2c66affSColin Finck #define GetProcessImageFileName GetProcessImageFileNameA 138*c2c66affSColin Finck #endif 139*c2c66affSColin Finck 140*c2c66affSColin Finck #ifdef __cplusplus 141*c2c66affSColin Finck } 142*c2c66affSColin Finck #endif 143*c2c66affSColin Finck 144*c2c66affSColin Finck #endif /* _PSAPI_H */ 145*c2c66affSColin Finck 146