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