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 | #if __GNUC__ >=3
|
---|
20 | #pragma GCC system_header
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #ifdef __cplusplus
|
---|
24 | extern "C" {
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #ifndef RC_INVOKED
|
---|
28 |
|
---|
29 | typedef struct _MODULEINFO {
|
---|
30 | LPVOID lpBaseOfDll;
|
---|
31 | DWORD SizeOfImage;
|
---|
32 | LPVOID EntryPoint;
|
---|
33 | } MODULEINFO,*LPMODULEINFO;
|
---|
34 |
|
---|
35 | typedef struct _PSAPI_WS_WATCH_INFORMATION {
|
---|
36 | LPVOID FaultingPc;
|
---|
37 | LPVOID FaultingVa;
|
---|
38 | } PSAPI_WS_WATCH_INFORMATION,*PPSAPI_WS_WATCH_INFORMATION;
|
---|
39 |
|
---|
40 | typedef struct _PROCESS_MEMORY_COUNTERS {
|
---|
41 | DWORD cb;
|
---|
42 | DWORD PageFaultCount;
|
---|
43 | DWORD PeakWorkingSetSize;
|
---|
44 | DWORD WorkingSetSize;
|
---|
45 | DWORD QuotaPeakPagedPoolUsage;
|
---|
46 | DWORD QuotaPagedPoolUsage;
|
---|
47 | DWORD QuotaPeakNonPagedPoolUsage;
|
---|
48 | DWORD QuotaNonPagedPoolUsage;
|
---|
49 | DWORD PagefileUsage;
|
---|
50 | DWORD PeakPagefileUsage;
|
---|
51 | } PROCESS_MEMORY_COUNTERS,*PPROCESS_MEMORY_COUNTERS;
|
---|
52 |
|
---|
53 | typedef struct _PROCESS_MEMORY_COUNTERS_EX {
|
---|
54 | DWORD cb;
|
---|
55 | DWORD PageFaultCount;
|
---|
56 | DWORD PeakWorkingSetSize;
|
---|
57 | DWORD WorkingSetSize;
|
---|
58 | DWORD QuotaPeakPagedPoolUsage;
|
---|
59 | DWORD QuotaPagedPoolUsage;
|
---|
60 | DWORD QuotaPeakNonPagedPoolUsage;
|
---|
61 | DWORD QuotaNonPagedPoolUsage;
|
---|
62 | DWORD PagefileUsage;
|
---|
63 | DWORD PeakPagefileUsage;
|
---|
64 | DWORD PrivateUsage;
|
---|
65 | } PROCESS_MEMORY_COUNTERS_EX,*PPROCESS_MEMORY_COUNTERS_EX;
|
---|
66 |
|
---|
67 | typedef struct _PERFORMANCE_INFORMATION {
|
---|
68 | DWORD cb;
|
---|
69 | DWORD CommitTotal;
|
---|
70 | DWORD CommitLimit;
|
---|
71 | DWORD CommitPeak;
|
---|
72 | DWORD PhysicalTotal;
|
---|
73 | DWORD PhysicalAvailable;
|
---|
74 | DWORD SystemCache;
|
---|
75 | DWORD KernelTotal;
|
---|
76 | DWORD KernelPaged;
|
---|
77 | DWORD KernelNonpaged;
|
---|
78 | DWORD PageSize;
|
---|
79 | DWORD HandleCount;
|
---|
80 | DWORD ProcessCount;
|
---|
81 | DWORD ThreadCount;
|
---|
82 | } PERFORMANCE_INFORMATION, *PPERFORMANCE_INFORMATION;
|
---|
83 |
|
---|
84 | typedef union _PSAPI_WORKING_SET_BLOCK {
|
---|
85 | ULONG_PTR Flags;
|
---|
86 | struct {
|
---|
87 | ULONG_PTR Protection :5;
|
---|
88 | ULONG_PTR ShareCount :3;
|
---|
89 | ULONG_PTR Shared :1;
|
---|
90 | ULONG_PTR Reserved :3;
|
---|
91 | ULONG_PTR VirtualPage :20;
|
---|
92 | } ;
|
---|
93 | } PSAPI_WORKING_SET_BLOCK, *PPSAPI_WORKING_SET_BLOCK;
|
---|
94 |
|
---|
95 | typedef struct _PSAPI_WORKING_SET_INFORMATION {
|
---|
96 | ULONG_PTR NumberOfEntries;
|
---|
97 | PSAPI_WORKING_SET_BLOCK WorkingSetInfo[1];
|
---|
98 | } PSAPI_WORKING_SET_INFORMATION, *PPSAPI_WORKING_SET_INFORMATION;
|
---|
99 |
|
---|
100 | /* Grouped by application,not in alphabetical order. */
|
---|
101 | BOOL WINAPI EnumProcesses(DWORD *,DWORD,DWORD *);
|
---|
102 | BOOL WINAPI EnumProcessModules(HANDLE,HMODULE *,DWORD,LPDWORD);
|
---|
103 | DWORD WINAPI GetModuleBaseNameA(HANDLE,HMODULE,LPSTR,DWORD);
|
---|
104 | DWORD WINAPI GetModuleBaseNameW(HANDLE,HMODULE,LPWSTR,DWORD);
|
---|
105 | DWORD WINAPI GetModuleFileNameExA(HANDLE,HMODULE,LPSTR,DWORD);
|
---|
106 | DWORD WINAPI GetModuleFileNameExW(HANDLE,HMODULE,LPWSTR,DWORD);
|
---|
107 | BOOL WINAPI GetModuleInformation(HANDLE,HMODULE,LPMODULEINFO,DWORD);
|
---|
108 | BOOL WINAPI EmptyWorkingSet(HANDLE);
|
---|
109 | BOOL WINAPI QueryWorkingSet(HANDLE,PVOID,DWORD);
|
---|
110 | BOOL WINAPI InitializeProcessForWsWatch(HANDLE);
|
---|
111 | BOOL WINAPI GetWsChanges(HANDLE,PPSAPI_WS_WATCH_INFORMATION,DWORD);
|
---|
112 | DWORD WINAPI GetMappedFileNameW(HANDLE,LPVOID,LPWSTR,DWORD);
|
---|
113 | DWORD WINAPI GetMappedFileNameA(HANDLE,LPVOID,LPSTR,DWORD);
|
---|
114 | BOOL WINAPI EnumDeviceDrivers(LPVOID *,DWORD,LPDWORD);
|
---|
115 | DWORD WINAPI GetDeviceDriverBaseNameA(LPVOID,LPSTR,DWORD);
|
---|
116 | DWORD WINAPI GetDeviceDriverBaseNameW(LPVOID,LPWSTR,DWORD);
|
---|
117 | DWORD WINAPI GetDeviceDriverFileNameA(LPVOID,LPSTR,DWORD);
|
---|
118 | DWORD WINAPI GetDeviceDriverFileNameW(LPVOID,LPWSTR,DWORD);
|
---|
119 | BOOL WINAPI GetProcessMemoryInfo(HANDLE,PPROCESS_MEMORY_COUNTERS,DWORD);
|
---|
120 | BOOL WINAPI GetPerformanceInfo(PPERFORMANCE_INFORMATION,DWORD);
|
---|
121 | #if (_WIN32_WINNT >= 0x0501)
|
---|
122 | DWORD WINAPI GetProcessImageFileNameA(HANDLE,LPSTR,DWORD);
|
---|
123 | DWORD WINAPI GetProcessImageFileNameW(HANDLE,LPWSTR,DWORD);
|
---|
124 | #endif
|
---|
125 |
|
---|
126 | #endif /* not RC_INVOKED */
|
---|
127 |
|
---|
128 | #ifdef UNICODE
|
---|
129 | #define GetModuleBaseName GetModuleBaseNameW
|
---|
130 | #define GetModuleFileNameEx GetModuleFileNameExW
|
---|
131 | #define GetMappedFileName GetMappedFileNameW
|
---|
132 | #define GetDeviceDriverBaseName GetDeviceDriverBaseNameW
|
---|
133 | #define GetDeviceDriverFileName GetDeviceDriverFileNameW
|
---|
134 | #if (_WIN32_WINNT >= 0x0501)
|
---|
135 | #define GetProcessImageFileName GetProcessImageFileNameW
|
---|
136 | #endif
|
---|
137 | #else
|
---|
138 | #define GetModuleBaseName GetModuleBaseNameA
|
---|
139 | #define GetModuleFileNameEx GetModuleFileNameExA
|
---|
140 | #define GetMappedFileName GetMappedFileNameA
|
---|
141 | #define GetDeviceDriverBaseName GetDeviceDriverBaseNameA
|
---|
142 | #define GetDeviceDriverFileName GetDeviceDriverFileNameA
|
---|
143 | #if (_WIN32_WINNT >= 0x0501)
|
---|
144 | #define GetProcessImageFileName GetProcessImageFileNameA
|
---|
145 | #endif
|
---|
146 | #endif
|
---|
147 |
|
---|
148 | #ifdef __cplusplus
|
---|
149 | }
|
---|
150 | #endif
|
---|
151 |
|
---|
152 | #endif /* _PSAPI_H */
|
---|
153 |
|
---|