blob: d0f67f803f019f49909361618aa27184013e4bb2 [file] [log] [blame]
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00001/*
2 * PSAPI library
3 *
4 * Copyright 1998 Patrik Stridvall
5 */
6
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00007#include "winbase.h"
Jim Aston2e1cafa1999-03-14 16:35:05 +00008#include "windef.h"
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00009#include "winerror.h"
Alexandre Julliard9fe7a251999-05-14 08:17:14 +000010#include "debugtools.h"
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000011#include "psapi.h"
12
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000013DEFAULT_DEBUG_CHANNEL(psapi)
14
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000015#include <string.h>
16
17/***********************************************************************
18 * EmptyWorkingSet (PSAPI.1)
19 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000020BOOL WINAPI EmptyWorkingSet(HANDLE hProcess)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000021{
22 return SetProcessWorkingSetSize(hProcess, 0xFFFFFFFF, 0xFFFFFFFF);
23}
24
25/***********************************************************************
26 * EnumDeviceDrivers (PSAPI.2)
27 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000028BOOL WINAPI EnumDeviceDrivers(
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000029 LPVOID *lpImageBase, DWORD cb, LPDWORD lpcbNeeded)
30{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +000031 FIXME("(%p, %ld, %p): stub\n", lpImageBase, cb, lpcbNeeded);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000032
33 if(lpcbNeeded)
34 *lpcbNeeded = 0;
35
36 return TRUE;
37}
38
39
40/***********************************************************************
41 * EnumProcesses (PSAPI.3)
42 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000043BOOL WINAPI EnumProcesses(DWORD *lpidProcess, DWORD cb, DWORD *lpcbNeeded)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000044{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +000045 FIXME("(%p, %ld, %p): stub\n", lpidProcess,cb, lpcbNeeded);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000046
47 if(lpcbNeeded)
48 *lpcbNeeded = 0;
49
50 return TRUE;
51}
52
53/***********************************************************************
54 * EnumProcessModules (PSAPI.4)
55 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000056BOOL WINAPI EnumProcessModules(
57 HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000058{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +000059 FIXME("(hProcess=0x%08x, %p, %ld, %p): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000060 hProcess, lphModule, cb, lpcbNeeded
61 );
62
63 if(lpcbNeeded)
64 *lpcbNeeded = 0;
65
66 return TRUE;
67}
68
69/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000070 * GetDeviceDriverBaseNameA (PSAPI.5)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000071 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000072DWORD WINAPI GetDeviceDriverBaseNameA(
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000073 LPVOID ImageBase, LPSTR lpBaseName, DWORD nSize)
74{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +000075 FIXME("(%p, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000076 ImageBase, debugstr_a(lpBaseName), nSize
77 );
78
79 if(lpBaseName && nSize)
80 lpBaseName[0] = '\0';
81
82 return 0;
83}
84
85/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000086 * GetDeviceDriverBaseNameW (PSAPI.6)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000087 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000088DWORD WINAPI GetDeviceDriverBaseNameW(
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000089 LPVOID ImageBase, LPWSTR lpBaseName, DWORD nSize)
90{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +000091 FIXME("(%p, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +000092 ImageBase, debugstr_w(lpBaseName), nSize
93 );
94
95 if(lpBaseName && nSize)
96 lpBaseName[0] = '\0';
97
98 return 0;
99}
100
101/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000102 * GetDeviceDriverFileNameA (PSAPI.7)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000103 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000104DWORD WINAPI GetDeviceDriverFileNameA(
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000105 LPVOID ImageBase, LPSTR lpFilename, DWORD nSize)
106{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000107 FIXME("(%p, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000108 ImageBase, debugstr_a(lpFilename), nSize
109 );
110
111 if(lpFilename && nSize)
112 lpFilename[0] = '\0';
113
114 return 0;
115}
116
117/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000118 * GetDeviceDriverFileNameW (PSAPI.8)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000119 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000120DWORD WINAPI GetDeviceDriverFileNameW(
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000121 LPVOID ImageBase, LPWSTR lpFilename, DWORD nSize)
122{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000123 FIXME("(%p, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000124 ImageBase, debugstr_w(lpFilename), nSize
125 );
126
127 if(lpFilename && nSize)
128 lpFilename[0] = '\0';
129
130 return 0;
131}
132
133/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000134 * GetMappedFileNameA (PSAPI.9)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000135 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000136DWORD WINAPI GetMappedFileNameA(
137 HANDLE hProcess, LPVOID lpv, LPSTR lpFilename, DWORD nSize)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000138{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000139 FIXME("(hProcess=0x%08x, %p, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000140 hProcess, lpv, debugstr_a(lpFilename), nSize
141 );
142
143 if(lpFilename && nSize)
144 lpFilename[0] = '\0';
145
146 return 0;
147}
148
149/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000150 * GetMappedFileNameW (PSAPI.10)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000151 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000152DWORD WINAPI GetMappedFileNameW(
153 HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename, DWORD nSize)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000154{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000155 FIXME("(hProcess=0x%08x, %p, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000156 hProcess, lpv, debugstr_w(lpFilename), nSize
157 );
158
159 if(lpFilename && nSize)
160 lpFilename[0] = '\0';
161
162 return 0;
163}
164
165/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000166 * GetModuleBaseNameA (PSAPI.11)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000167 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000168DWORD WINAPI GetModuleBaseNameA(
169 HANDLE hProcess, HMODULE hModule, LPSTR lpBaseName, DWORD nSize)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000170{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000171 FIXME("(hProcess=0x%08x, hModule=0x%08x, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000172 hProcess, hModule, debugstr_a(lpBaseName), nSize
173 );
174
175 if(lpBaseName && nSize)
176 lpBaseName[0] = '\0';
177
178 return 0;
179}
180
181/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000182 * GetModuleBaseNameW (PSAPI.12)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000183 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000184DWORD WINAPI GetModuleBaseNameW(
185 HANDLE hProcess, HMODULE hModule, LPWSTR lpBaseName, DWORD nSize)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000186{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000187 FIXME("(hProcess=0x%08x, hModule=0x%08x, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000188 hProcess, hModule, debugstr_w(lpBaseName), nSize);
189
190 if(lpBaseName && nSize)
191 lpBaseName[0] = '\0';
192
193 return 0;
194}
195
196/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000197 * GetModuleFileNameExA (PSAPI.13)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000198 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000199DWORD WINAPI GetModuleFileNameExA(
200 HANDLE hProcess, HMODULE hModule, LPSTR lpFilename, DWORD nSize)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000201{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000202 FIXME("(hProcess=0x%08x,hModule=0x%08x, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000203 hProcess, hModule, debugstr_a(lpFilename), nSize
204 );
205
206 if(lpFilename&&nSize)
207 lpFilename[0]='\0';
208
209 return 0;
210}
211
212/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000213 * GetModuleFileNameExW (PSAPI.14)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000214 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000215DWORD WINAPI GetModuleFileNameExW(
216 HANDLE hProcess, HMODULE hModule, LPWSTR lpFilename, DWORD nSize)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000217{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000218 FIXME("(hProcess=0x%08x,hModule=0x%08x, %s, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000219 hProcess, hModule, debugstr_w(lpFilename), nSize
220 );
221
222 if(lpFilename && nSize)
223 lpFilename[0] = '\0';
224
225 return 0;
226}
227
228/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000229 * GetModuleInformation (PSAPI.15)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000230 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000231BOOL WINAPI GetModuleInformation(
232 HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000233{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000234 FIXME("(hProcess=0x%08x, hModule=0x%08x, %p, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000235 hProcess, hModule, lpmodinfo, cb
236 );
237
238 memset(lpmodinfo, 0, cb);
239
240 return TRUE;
241}
242
243/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000244 * GetProcessMemoryInfo (PSAPI.16)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000245 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000246BOOL WINAPI GetProcessMemoryInfo(
247 HANDLE Process, PPROCESS_MEMORY_COUNTERS ppsmemCounters, DWORD cb)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000248{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000249 FIXME("(hProcess=0x%08x, %p, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000250 Process, ppsmemCounters, cb
251 );
252
253 memset(ppsmemCounters, 0, cb);
254
255 return TRUE;
256}
257
258/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000259 * GetWsChanges (PSAPI.17)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000260 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000261BOOL WINAPI GetWsChanges(
262 HANDLE hProcess, PPSAPI_WS_WATCH_INFORMATION lpWatchInfo, DWORD cb)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000263{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000264 FIXME("(hProcess=0x%08x, %p, %ld): stub\n",
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000265 hProcess, lpWatchInfo, cb
266 );
267
268 memset(lpWatchInfo, 0, cb);
269
270 return TRUE;
271}
272
273/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000274 * InitializeProcessForWsWatch (PSAPI.18)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000275 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000276BOOL WINAPI InitializeProcessForWsWatch(HANDLE hProcess)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000277{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000278 FIXME("(hProcess=0x%08x): stub\n", hProcess);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000279
280 return TRUE;
281}
282
283/***********************************************************************
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000284 * QueryWorkingSet (PSAPI.?)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000285 * FIXME
286 * I haven't been able to find the ordinal for this function,
287 * This means it can't be called from outside the DLL.
288 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000289BOOL WINAPI QueryWorkingSet(HANDLE hProcess, LPVOID pv, DWORD cb)
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000290{
Alexandre Julliard9fe7a251999-05-14 08:17:14 +0000291 FIXME("(hProcess=0x%08x, %p, %ld)", hProcess, pv, cb);
Alexandre Julliardd30dfd21998-09-27 18:28:36 +0000292
293 if(pv && cb)
294 ((DWORD *) pv)[0] = 0; /* Empty WorkingSet */
295
296 return TRUE;
297}
298
299
300
301
302