source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/psapi.h@ 1172

Last change on this file since 1172 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 9.1 KB
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _PSAPI_H_
7#define _PSAPI_H_
8
9#include <_mingw_unicode.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#ifndef PSAPI_VERSION
16#if NTDDI_VERSION >= NTDDI_WIN7
17#define PSAPI_VERSION 2
18#else
19#define PSAPI_VERSION 1
20#endif
21#endif
22
23#if PSAPI_VERSION > 1
24#define EnumProcesses K32EnumProcesses
25#define EnumProcessModules K32EnumProcessModules
26#define EnumProcessModulesEx K32EnumProcessModulesEx
27#define GetModuleBaseNameA K32GetModuleBaseNameA
28#define GetModuleBaseNameW K32GetModuleBaseNameW
29#define GetModuleFileNameExA K32GetModuleFileNameExA
30#define GetModuleFileNameExW K32GetModuleFileNameExW
31#define GetModuleInformation K32GetModuleInformation
32#define EmptyWorkingSet K32EmptyWorkingSet
33#define QueryWorkingSet K32QueryWorkingSet
34#define QueryWorkingSetEx K32QueryWorkingSetEx
35#define InitializeProcessForWsWatch K32InitializeProcessForWsWatch
36#define GetWsChanges K32GetWsChanges
37#define GetWsChangesEx K32GetWsChangesEx
38#define GetMappedFileNameW K32GetMappedFileNameW
39#define GetMappedFileNameA K32GetMappedFileNameA
40#define EnumDeviceDrivers K32EnumDeviceDrivers
41#define GetDeviceDriverBaseNameA K32GetDeviceDriverBaseNameA
42#define GetDeviceDriverBaseNameW K32GetDeviceDriverBaseNameW
43#define GetDeviceDriverFileNameA K32GetDeviceDriverFileNameA
44#define GetDeviceDriverFileNameW K32GetDeviceDriverFileNameW
45#define GetProcessMemoryInfo K32GetProcessMemoryInfo
46#define GetPerformanceInfo K32GetPerformanceInfo
47#define EnumPageFilesW K32EnumPageFilesW
48#define EnumPageFilesA K32EnumPageFilesA
49#define GetProcessImageFileNameA K32GetProcessImageFileNameA
50#define GetProcessImageFileNameW K32GetProcessImageFileNameW
51#endif
52
53#define GetModuleBaseName __MINGW_NAME_AW(GetModuleBaseName)
54#define GetModuleFileNameEx __MINGW_NAME_AW(GetModuleFileNameEx)
55#define GetMappedFileName __MINGW_NAME_AW(GetMappedFileName)
56#define GetDeviceDriverBaseName __MINGW_NAME_AW(GetDeviceDriverBaseName)
57#define GetDeviceDriverFileName __MINGW_NAME_AW(GetDeviceDriverFileName)
58#define PENUM_PAGE_FILE_CALLBACK __MINGW_NAME_AW(PENUM_PAGE_FILE_CALLBACK)
59#define EnumPageFiles __MINGW_NAME_AW(EnumPageFiles)
60#define GetProcessImageFileName __MINGW_NAME_AW(GetProcessImageFileName)
61
62#ifndef LIST_MODULES_DEFAULT
63#define LIST_MODULES_DEFAULT 0x0
64#endif
65#ifndef LIST_MODULES_32BIT
66#define LIST_MODULES_32BIT 0x01
67#endif
68#ifndef LIST_MODULES_64BIT
69#define LIST_MODULES_64BIT 0x02
70#endif
71#ifndef LIST_MODULES_ALL
72#define LIST_MODULES_ALL (LIST_MODULES_32BIT|LIST_MODULES_64BIT)
73#endif
74
75 WINBOOL WINAPI EnumProcesses(DWORD *lpidProcess,DWORD cb,DWORD *cbNeeded);
76 WINBOOL WINAPI EnumProcessModules(HANDLE hProcess,HMODULE *lphModule,DWORD cb,LPDWORD lpcbNeeded);
77 DWORD WINAPI GetModuleBaseNameA(HANDLE hProcess,HMODULE hModule,LPSTR lpBaseName,DWORD nSize);
78 DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess,HMODULE hModule,LPWSTR lpBaseName,DWORD nSize);
79 DWORD WINAPI GetModuleFileNameExA(HANDLE hProcess,HMODULE hModule,LPSTR lpFilename,DWORD nSize);
80 DWORD WINAPI GetModuleFileNameExW(HANDLE hProcess,HMODULE hModule,LPWSTR lpFilename,DWORD nSize);
81
82 typedef struct _MODULEINFO {
83 LPVOID lpBaseOfDll;
84 DWORD SizeOfImage;
85 LPVOID EntryPoint;
86 } MODULEINFO,*LPMODULEINFO;
87
88 WINBOOL WINAPI GetModuleInformation(HANDLE hProcess,HMODULE hModule,LPMODULEINFO lpmodinfo,DWORD cb);
89 WINBOOL WINAPI EmptyWorkingSet(HANDLE hProcess);
90 WINBOOL WINAPI QueryWorkingSet(HANDLE hProcess,PVOID pv,DWORD cb);
91 WINBOOL WINAPI QueryWorkingSetEx(HANDLE hProcess,PVOID pv,DWORD cb);
92 WINBOOL WINAPI InitializeProcessForWsWatch(HANDLE hProcess);
93
94 typedef struct _PSAPI_WS_WATCH_INFORMATION {
95 LPVOID FaultingPc;
96 LPVOID FaultingVa;
97 } PSAPI_WS_WATCH_INFORMATION,*PPSAPI_WS_WATCH_INFORMATION;
98
99 WINBOOL WINAPI GetWsChanges(HANDLE hProcess,PPSAPI_WS_WATCH_INFORMATION lpWatchInfo,DWORD cb);
100 DWORD WINAPI GetMappedFileNameW(HANDLE hProcess,LPVOID lpv,LPWSTR lpFilename,DWORD nSize);
101 DWORD WINAPI GetMappedFileNameA(HANDLE hProcess,LPVOID lpv,LPSTR lpFilename,DWORD nSize);
102 WINBOOL WINAPI EnumDeviceDrivers(LPVOID *lpImageBase,DWORD cb,LPDWORD lpcbNeeded);
103 DWORD WINAPI GetDeviceDriverBaseNameA(LPVOID ImageBase,LPSTR lpBaseName,DWORD nSize);
104 DWORD WINAPI GetDeviceDriverBaseNameW(LPVOID ImageBase,LPWSTR lpBaseName,DWORD nSize);
105 DWORD WINAPI GetDeviceDriverFileNameA(LPVOID ImageBase,LPSTR lpFilename,DWORD nSize);
106 DWORD WINAPI GetDeviceDriverFileNameW(LPVOID ImageBase,LPWSTR lpFilename,DWORD nSize);
107
108 typedef struct _PROCESS_MEMORY_COUNTERS {
109 DWORD cb;
110 DWORD PageFaultCount;
111 SIZE_T PeakWorkingSetSize;
112 SIZE_T WorkingSetSize;
113 SIZE_T QuotaPeakPagedPoolUsage;
114 SIZE_T QuotaPagedPoolUsage;
115 SIZE_T QuotaPeakNonPagedPoolUsage;
116 SIZE_T QuotaNonPagedPoolUsage;
117 SIZE_T PagefileUsage;
118 SIZE_T PeakPagefileUsage;
119 } PROCESS_MEMORY_COUNTERS;
120 typedef PROCESS_MEMORY_COUNTERS *PPROCESS_MEMORY_COUNTERS;
121
122 typedef struct _PROCESS_MEMORY_COUNTERS_EX {
123 DWORD cb;
124 DWORD PageFaultCount;
125 SIZE_T PeakWorkingSetSize;
126 SIZE_T WorkingSetSize;
127 SIZE_T QuotaPeakPagedPoolUsage;
128 SIZE_T QuotaPagedPoolUsage;
129 SIZE_T QuotaPeakNonPagedPoolUsage;
130 SIZE_T QuotaNonPagedPoolUsage;
131 SIZE_T PagefileUsage;
132 SIZE_T PeakPagefileUsage;
133 SIZE_T PrivateUsage;
134 } PROCESS_MEMORY_COUNTERS_EX;
135 typedef PROCESS_MEMORY_COUNTERS_EX *PPROCESS_MEMORY_COUNTERS_EX;
136
137 WINBOOL WINAPI GetProcessMemoryInfo(HANDLE Process,PPROCESS_MEMORY_COUNTERS ppsmemCounters,DWORD cb);
138
139 typedef struct _PERFORMANCE_INFORMATION {
140 DWORD cb;
141 SIZE_T CommitTotal;
142 SIZE_T CommitLimit;
143 SIZE_T CommitPeak;
144 SIZE_T PhysicalTotal;
145 SIZE_T PhysicalAvailable;
146 SIZE_T SystemCache;
147 SIZE_T KernelTotal;
148 SIZE_T KernelPaged;
149 SIZE_T KernelNonpaged;
150 SIZE_T PageSize;
151 DWORD HandleCount;
152 DWORD ProcessCount;
153 DWORD ThreadCount;
154 } PERFORMANCE_INFORMATION,*PPERFORMANCE_INFORMATION,PERFORMACE_INFORMATION,*PPERFORMACE_INFORMATION;
155
156 WINBOOL WINAPI GetPerformanceInfo (PPERFORMACE_INFORMATION pPerformanceInformation,DWORD cb);
157
158 typedef struct _ENUM_PAGE_FILE_INFORMATION {
159 DWORD cb;
160 DWORD Reserved;
161 SIZE_T TotalSize;
162 SIZE_T TotalInUse;
163 SIZE_T PeakUsage;
164 } ENUM_PAGE_FILE_INFORMATION,*PENUM_PAGE_FILE_INFORMATION;
165
166 typedef WINBOOL (*PENUM_PAGE_FILE_CALLBACKW) (LPVOID pContext,PENUM_PAGE_FILE_INFORMATION pPageFileInfo,LPCWSTR lpFilename);
167 typedef WINBOOL (*PENUM_PAGE_FILE_CALLBACKA) (LPVOID pContext,PENUM_PAGE_FILE_INFORMATION pPageFileInfo,LPCSTR lpFilename);
168
169 WINBOOL WINAPI EnumPageFilesW (PENUM_PAGE_FILE_CALLBACKW pCallBackRoutine,LPVOID pContext);
170 WINBOOL WINAPI EnumPageFilesA (PENUM_PAGE_FILE_CALLBACKA pCallBackRoutine,LPVOID pContext);
171 DWORD WINAPI GetProcessImageFileNameA(HANDLE hProcess,LPSTR lpImageFileName,DWORD nSize);
172 DWORD WINAPI GetProcessImageFileNameW(HANDLE hProcess,LPWSTR lpImageFileName,DWORD nSize);
173
174typedef struct _PSAPI_WS_WATCH_INFORMATION_EX {
175 PSAPI_WS_WATCH_INFORMATION BasicInfo;
176 ULONG_PTR FaultingThreadId;
177 ULONG_PTR Flags;
178} PSAPI_WS_WATCH_INFORMATION_EX, *PPSAPI_WS_WATCH_INFORMATION_EX;
179
180WINBOOL WINAPI GetWsChangesEx(
181 HANDLE hProcess,
182 PPSAPI_WS_WATCH_INFORMATION_EX lpWatchInfoEx,
183 DWORD cb
184);
185
186WINBOOL WINAPI EnumProcessModulesEx(
187 HANDLE hProcess,
188 HMODULE *lphModule,
189 DWORD cb,
190 LPDWORD lpcbNeeded,
191 DWORD dwFilterFlag
192);
193
194typedef union _PSAPI_WORKING_SET_BLOCK {
195 ULONG_PTR Flags;
196 __C89_NAMELESS struct {
197 ULONG_PTR Protection :5;
198 ULONG_PTR ShareCount :3;
199 ULONG_PTR Shared :1;
200 ULONG_PTR Reserved :3;
201#ifdef _WIN64
202 ULONG_PTR VirtualPage :52;
203#else
204 ULONG_PTR VirtualPage :20;
205#endif
206 } ;
207} PSAPI_WORKING_SET_BLOCK, *PPSAPI_WORKING_SET_BLOCK;
208
209typedef struct _PSAPI_WORKING_SET_INFORMATION {
210 ULONG_PTR NumberOfEntries;
211 PSAPI_WORKING_SET_BLOCK WorkingSetInfo[1];
212} PSAPI_WORKING_SET_INFORMATION, *PPSAPI_WORKING_SET_INFORMATION;
213
214typedef union _PSAPI_WORKING_SET_EX_BLOCK {
215 ULONG_PTR Flags;
216 __C89_NAMELESS union {
217 __C89_NAMELESS struct {
218 ULONG_PTR Valid : 1;
219 ULONG_PTR ShareCount : 3;
220 ULONG_PTR Win32Protection : 11;
221 ULONG_PTR Shared : 1;
222 ULONG_PTR Node : 6;
223 ULONG_PTR Locked : 1;
224 ULONG_PTR LargePage : 1;
225 ULONG_PTR Reserved : 7;
226 ULONG_PTR Bad : 1;
227#ifdef _WIN64
228 ULONG_PTR ReservedUlong : 32;
229#endif
230 };
231 struct {
232 ULONG_PTR Valid : 1;
233 ULONG_PTR Reserved0 : 14;
234 ULONG_PTR Shared : 1;
235 ULONG_PTR Reserved1 : 15;
236 ULONG_PTR Bad : 1;
237#ifdef _WIN64
238 ULONG_PTR ReservedUlong : 32;
239#endif
240 } Invalid;
241 };
242} PSAPI_WORKING_SET_EX_BLOCK, *PPSAPI_WORKING_SET_EX_BLOCK;
243
244typedef struct _PSAPI_WORKING_SET_EX_INFORMATION {
245 PVOID VirtualAddress;
246 PSAPI_WORKING_SET_EX_BLOCK VirtualAttributes;
247} PSAPI_WORKING_SET_EX_INFORMATION, *PPSAPI_WORKING_SET_EX_INFORMATION;
248
249#ifdef __cplusplus
250}
251#endif
252#endif
Note: See TracBrowser for help on using the repository browser.