~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/base/winunits/jwapsapi.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{******************************************************************************}
 
2
{                                                                              }
 
3
{ Process Status API interface Unit for Object Pascal                          }
 
4
{                                                                              }
 
5
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
 
6
{ Corporation. All Rights Reserved.                                            }
 
7
{                                                                              }
 
8
{ The original file is: psapi.h, released June 2000. The original Pascal       }
 
9
{ code is: PsApi.pas, released December 2000. The initial developer of the     }
 
10
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
 
11
{                                                                              }
 
12
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
 
13
{ Marcel van Brakel. All Rights Reserved.                                      }
 
14
{                                                                              }
 
15
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
 
16
{                                                                              }
 
17
{ You may retrieve the latest version of this file at the Project JEDI         }
 
18
{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
 
19
{                                                                              }
 
20
{ The contents of this file are used with permission, subject to the Mozilla   }
 
21
{ Public License Version 1.1 (the "License"); you may not use this file except }
 
22
{ in compliance with the License. You may obtain a copy of the License at      }
 
23
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
 
24
{                                                                              }
 
25
{ Software distributed under the License is distributed on an "AS IS" basis,   }
 
26
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
 
27
{ the specific language governing rights and limitations under the License.    }
 
28
{                                                                              }
 
29
{ Alternatively, the contents of this file may be used under the terms of the  }
 
30
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
 
31
{ provisions of the LGPL License are applicable instead of those above.        }
 
32
{ If you wish to allow use of your version of this file only under the terms   }
 
33
{ of the LGPL License and not to allow others to use your version of this file }
 
34
{ under the MPL, indicate your decision by deleting  the provisions above and  }
 
35
{ replace  them with the notice and other provisions required by the LGPL      }
 
36
{ License.  If you do not delete the provisions above, a recipient may use     }
 
37
{ your version of this file under either the MPL or the LGPL License.          }
 
38
{                                                                              }
 
39
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
 
40
{                                                                              }
 
41
{******************************************************************************}
 
42
 
 
43
// $Id: JwaPsApi.pas,v 1.10 2005/09/06 16:36:50 marquardt Exp $
 
44
 
 
45
unit JwaPsApi;
 
46
 
 
47
{$WEAKPACKAGEUNIT}
 
48
 
 
49
{$HPPEMIT ''}
 
50
{$HPPEMIT '#include <psapi.h>'}
 
51
{$HPPEMIT ''}
 
52
 
 
53
{$I jediapilib.inc}
 
54
 
 
55
interface
 
56
 
 
57
uses
 
58
  JwaWindows;
 
59
 
 
60
function EnumProcesses(lpidProcess: LPDWORD; cb: DWORD; var cbNeeded: DWORD): BOOL; stdcall;
 
61
{$EXTERNALSYM EnumProcesses}
 
62
 
 
63
function EnumProcessModules(hProcess: HANDLE; lphModule: PHMODULE; cb: DWORD;
 
64
  var lpcbNeeded: DWORD): BOOL; stdcall;
 
65
{$EXTERNALSYM EnumProcessModules}
 
66
 
 
67
function GetModuleBaseNameA(hProcess: HANDLE; hModule: HMODULE; lpBaseName: LPSTR;
 
68
  nSize: DWORD): DWORD; stdcall;
 
69
{$EXTERNALSYM GetModuleBaseNameA}
 
70
function GetModuleBaseNameW(hProcess: HANDLE; hModule: HMODULE; lpBaseName: LPWSTR;
 
71
  nSize: DWORD): DWORD; stdcall;
 
72
{$EXTERNALSYM GetModuleBaseNameW}
 
73
function GetModuleBaseName(hProcess: HANDLE; hModule: HMODULE; lpBaseName: LPTSTR;
 
74
  nSize: DWORD): DWORD; stdcall;
 
75
{$EXTERNALSYM GetModuleBaseName}
 
76
 
 
77
function GetModuleFileNameExA(hProcess: HANDLE; hModule: HMODULE; lpFilename: LPSTR;
 
78
  nSize: DWORD): DWORD; stdcall;
 
79
{$EXTERNALSYM GetModuleFileNameExA}
 
80
function GetModuleFileNameExW(hProcess: HANDLE; hModule: HMODULE; lpFilename: LPWSTR;
 
81
  nSize: DWORD): DWORD; stdcall;
 
82
{$EXTERNALSYM GetModuleFileNameExW}
 
83
function GetModuleFileNameEx(hProcess: HANDLE; hModule: HMODULE; lpFilename: LPTSTR;
 
84
  nSize: DWORD): DWORD; stdcall;
 
85
{$EXTERNALSYM GetModuleFileNameEx}
 
86
 
 
87
type
 
88
  LPMODULEINFO = ^MODULEINFO;
 
89
  {$EXTERNALSYM LPMODULEINFO}
 
90
  _MODULEINFO = packed record
 
91
    lpBaseOfDll: LPVOID;
 
92
    SizeOfImage: DWORD;
 
93
    EntryPoint: LPVOID;
 
94
  end;
 
95
  {$EXTERNALSYM _MODULEINFO}
 
96
  MODULEINFO = _MODULEINFO;
 
97
  {$EXTERNALSYM MODULEINFO}
 
98
  TModuleInfo = MODULEINFO;
 
99
  PModuleInfo = LPMODULEINFO;
 
100
 
 
101
function GetModuleInformation(hProcess: HANDLE; hModule: HMODULE;
 
102
  var lpmodinfo: MODULEINFO; cb: DWORD): BOOL; stdcall;
 
103
{$EXTERNALSYM GetModuleInformation}
 
104
 
 
105
function EmptyWorkingSet(hProcess: HANDLE): BOOL; stdcall;
 
106
{$EXTERNALSYM EmptyWorkingSet}
 
107
 
 
108
function QueryWorkingSet(hProcess: HANDLE; pv: PVOID; cb: DWORD): BOOL; stdcall;
 
109
{$EXTERNALSYM QueryWorkingSet}
 
110
 
 
111
function InitializeProcessForWsWatch(hProcess: HANDLE): BOOL; stdcall;
 
112
{$EXTERNALSYM InitializeProcessForWsWatch}
 
113
 
 
114
type
 
115
  PPSAPI_WS_WATCH_INFORMATION = ^PSAPI_WS_WATCH_INFORMATION;
 
116
  {$EXTERNALSYM PPSAPI_WS_WATCH_INFORMATION}
 
117
  _PSAPI_WS_WATCH_INFORMATION = packed record
 
118
    FaultingPc: LPVOID;
 
119
    FaultingVa: LPVOID;
 
120
  end;
 
121
  {$EXTERNALSYM _PSAPI_WS_WATCH_INFORMATION}
 
122
  PSAPI_WS_WATCH_INFORMATION = _PSAPI_WS_WATCH_INFORMATION;
 
123
  {$EXTERNALSYM PSAPI_WS_WATCH_INFORMATION}
 
124
  TPsApiWsWatchInformation = PSAPI_WS_WATCH_INFORMATION;
 
125
  PPsApiWsWatchInformation = PPSAPI_WS_WATCH_INFORMATION;
 
126
 
 
127
function GetWsChanges(hProcess: HANDLE; var lpWatchInfo: PSAPI_WS_WATCH_INFORMATION;
 
128
  cb: DWORD): BOOL; stdcall;
 
129
{$EXTERNALSYM GetWsChanges}
 
130
 
 
131
function GetMappedFileNameW(hProcess: HANDLE; lpv: LPVOID; lpFilename: LPWSTR;
 
132
  nSize: DWORD): DWORD; stdcall;
 
133
{$EXTERNALSYM GetMappedFileNameW}
 
134
function GetMappedFileNameA(hProcess: HANDLE; lpv: LPVOID; lpFilename: LPSTR;
 
135
  nSize: DWORD): DWORD; stdcall;
 
136
{$EXTERNALSYM GetMappedFileNameA}
 
137
function GetMappedFileName(hProcess: HANDLE; lpv: LPVOID; lpFilename: LPTSTR;
 
138
  nSize: DWORD): DWORD; stdcall;
 
139
{$EXTERNALSYM GetMappedFileName}
 
140
 
 
141
function EnumDeviceDrivers(lpImageBase: LPLPVOID; cb: DWORD; var lpcbNeeded: DWORD): BOOL; stdcall;
 
142
{$EXTERNALSYM EnumDeviceDrivers}
 
143
 
 
144
function GetDeviceDriverBaseNameA(ImageBase: LPVOID; lpBaseName: LPSTR;
 
145
  nSize: DWORD): DWORD; stdcall;
 
146
{$EXTERNALSYM GetDeviceDriverBaseNameA}
 
147
function GetDeviceDriverBaseNameW(ImageBase: LPVOID; lpBaseName: LPWSTR;
 
148
  nSize: DWORD): DWORD; stdcall;
 
149
{$EXTERNALSYM GetDeviceDriverBaseNameW}
 
150
function GetDeviceDriverBaseName(ImageBase: LPVOID; lpBaseName: LPTSTR;
 
151
  nSize: DWORD): DWORD; stdcall;
 
152
{$EXTERNALSYM GetDeviceDriverBaseName}
 
153
 
 
154
function GetDeviceDriverFileNameA(ImageBase: LPVOID; lpFilename: LPSTR;
 
155
  nSize: DWORD): DWORD; stdcall;
 
156
{$EXTERNALSYM GetDeviceDriverFileNameA}
 
157
function GetDeviceDriverFileNameW(ImageBase: LPVOID; lpFilename: LPWSTR;
 
158
  nSize: DWORD): DWORD; stdcall;
 
159
{$EXTERNALSYM GetDeviceDriverFileNameW}
 
160
function GetDeviceDriverFileName(ImageBase: LPVOID; lpFilename: LPTSTR;
 
161
  nSize: DWORD): DWORD; stdcall;
 
162
{$EXTERNALSYM GetDeviceDriverFileName}
 
163
 
 
164
// Structure for GetProcessMemoryInfo()
 
165
 
 
166
type
 
167
  PPROCESS_MEMORY_COUNTERS = ^PROCESS_MEMORY_COUNTERS;
 
168
  {$EXTERNALSYM PPROCESS_MEMORY_COUNTERS}
 
169
  _PROCESS_MEMORY_COUNTERS = packed record
 
170
    cb: DWORD;
 
171
    PageFaultCount: DWORD;
 
172
    PeakWorkingSetSize: SIZE_T;
 
173
    WorkingSetSize: SIZE_T;
 
174
    QuotaPeakPagedPoolUsage: SIZE_T;
 
175
    QuotaPagedPoolUsage: SIZE_T;
 
176
    QuotaPeakNonPagedPoolUsage: SIZE_T;
 
177
    QuotaNonPagedPoolUsage: SIZE_T;
 
178
    PagefileUsage: SIZE_T;
 
179
    PeakPagefileUsage: SIZE_T;
 
180
  end;
 
181
  {$EXTERNALSYM _PROCESS_MEMORY_COUNTERS}
 
182
  PROCESS_MEMORY_COUNTERS = _PROCESS_MEMORY_COUNTERS;
 
183
  {$EXTERNALSYM PROCESS_MEMORY_COUNTERS}
 
184
  TProcessMemoryCounters = PROCESS_MEMORY_COUNTERS;
 
185
  PProcessMemoryCounters = PPROCESS_MEMORY_COUNTERS;
 
186
 
 
187
  _PROCESS_MEMORY_COUNTERS_EX = record
 
188
    cb: DWORD;
 
189
    PageFaultCount: DWORD;
 
190
    PeakWorkingSetSize: SIZE_T;
 
191
    WorkingSetSize: SIZE_T;
 
192
    QuotaPeakPagedPoolUsage: SIZE_T;
 
193
    QuotaPagedPoolUsage: SIZE_T;
 
194
    QuotaPeakNonPagedPoolUsage: SIZE_T;
 
195
    QuotaNonPagedPoolUsage: SIZE_T;
 
196
    PagefileUsage: SIZE_T;
 
197
    PeakPagefileUsage: SIZE_T;
 
198
    PrivateUsage: SIZE_T;
 
199
  end;
 
200
  {$EXTERNALSYM _PROCESS_MEMORY_COUNTERS_EX}
 
201
  PROCESS_MEMORY_COUNTERS_EX = _PROCESS_MEMORY_COUNTERS_EX;
 
202
  {$EXTERNALSYM PROCESS_MEMORY_COUNTERS_EX}
 
203
  PPROCESS_MEMORY_COUNTERS_EX = ^PROCESS_MEMORY_COUNTERS_EX;
 
204
  {$EXTERNALSYM PPROCESS_MEMORY_COUNTERS_EX}
 
205
  TProcessMemoryCountersEx = PROCESS_MEMORY_COUNTERS_EX;
 
206
 
 
207
function GetProcessMemoryInfo(Process: HANDLE;
 
208
  var ppsmemCounters: PROCESS_MEMORY_COUNTERS; cb: DWORD): BOOL; stdcall;
 
209
{$EXTERNALSYM GetProcessMemoryInfo}
 
210
 
 
211
type
 
212
  _PERFORMANCE_INFORMATION = record
 
213
    cb: DWORD;
 
214
    CommitTotal: SIZE_T;
 
215
    CommitLimit: SIZE_T;
 
216
    CommitPeak: SIZE_T;
 
217
    PhysicalTotal: SIZE_T;
 
218
    PhysicalAvailable: SIZE_T;
 
219
    SystemCache: SIZE_T;
 
220
    KernelTotal: SIZE_T;
 
221
    KernelPaged: SIZE_T;
 
222
    KernelNonpaged: SIZE_T;
 
223
    PageSize: SIZE_T;
 
224
    HandleCount: DWORD;
 
225
    ProcessCount: DWORD;
 
226
    ThreadCount: DWORD;
 
227
  end;
 
228
  {$EXTERNALSYM _PERFORMANCE_INFORMATION}
 
229
  PERFORMANCE_INFORMATION = _PERFORMANCE_INFORMATION;
 
230
  {$EXTERNALSYM PERFORMANCE_INFORMATION}
 
231
  PPERFORMANCE_INFORMATION = ^PERFORMANCE_INFORMATION;
 
232
  {$EXTERNALSYM PPERFORMANCE_INFORMATION}
 
233
  TPerformanceInformation = PERFORMANCE_INFORMATION;
 
234
  PPerformanceInformation = PPERFORMANCE_INFORMATION;
 
235
 
 
236
{ MVB:
 
237
 
 
238
  Please note that this function, unlike what the Platform SDK documents, is _not_ available for Windows 2000!!!
 
239
  It is available starting with Windows XP and Windows.NET Server.
 
240
  If needed, you can relatively easily clone the functionality of this function by using the performance monitor
 
241
  API (either through the HKEY_PERFORMANCE_DATA registry interface or using the Performance Data Helper API)
 
242
}
 
243
 
 
244
function GetPerformanceInfo(pPerformanceInformation: PPERFORMANCE_INFORMATION;
 
245
  cb: DWORD): BOOL; stdcall;
 
246
{$EXTERNALSYM GetPerformanceInfo}
 
247
 
 
248
type
 
249
  _ENUM_PAGE_FILE_INFORMATION = record
 
250
    cb: DWORD;
 
251
    Reserved: DWORD;
 
252
    TotalSize: SIZE_T;
 
253
    TotalInUse: SIZE_T;
 
254
    PeakUsage: SIZE_T;
 
255
  end;
 
256
  {$EXTERNALSYM _ENUM_PAGE_FILE_INFORMATION}
 
257
  ENUM_PAGE_FILE_INFORMATION = _ENUM_PAGE_FILE_INFORMATION;
 
258
  {$EXTERNALSYM ENUM_PAGE_FILE_INFORMATION}
 
259
  PENUM_PAGE_FILE_INFORMATION = ^ENUM_PAGE_FILE_INFORMATION;
 
260
  TEnumPageFileInformation = ENUM_PAGE_FILE_INFORMATION;
 
261
  PEnumPageFileInformation = PENUM_PAGE_FILE_INFORMATION;
 
262
 
 
263
type
 
264
  PENUM_PAGE_FILE_CALLBACKW = function(pContext: LPVOID;
 
265
    pPageFileInfo: PENUM_PAGE_FILE_INFORMATION; lpFilename: LPCWSTR): BOOL; stdcall;
 
266
  {$EXTERNALSYM PENUM_PAGE_FILE_CALLBACKW}
 
267
  PENUM_PAGE_FILE_CALLBACKA = function(pContext: LPVOID;
 
268
    pPageFileInfo: PENUM_PAGE_FILE_INFORMATION; lpFilename: LPCSTR): BOOL; stdcall;
 
269
  {$EXTERNALSYM PENUM_PAGE_FILE_CALLBACKA}
 
270
  {$IFDEF UNICODE}
 
271
  PENUM_PAGE_FILE_CALLBACK = PENUM_PAGE_FILE_CALLBACKW;
 
272
  {$EXTERNALSYM PENUM_PAGE_FILE_CALLBACK}
 
273
  {$ELSE}
 
274
  PENUM_PAGE_FILE_CALLBACK = PENUM_PAGE_FILE_CALLBACKA;
 
275
  {$EXTERNALSYM PENUM_PAGE_FILE_CALLBACK}
 
276
  {$ENDIF UNICODE}
 
277
 
 
278
function EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW; pContext: LPVOID): BOOL; stdcall;
 
279
{$EXTERNALSYM EnumPageFilesW}
 
280
function EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA; pContext: LPVOID): BOOL; stdcall;
 
281
{$EXTERNALSYM EnumPageFilesA}
 
282
function EnumPageFiles(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACK; pContext: LPVOID): BOOL; stdcall;
 
283
{$EXTERNALSYM EnumPageFiles}
 
284
 
 
285
function GetProcessImageFileNameA(hProcess: HANDLE; lpImageFileName: LPSTR;
 
286
  nSize: DWORD): DWORD; stdcall;
 
287
{$EXTERNALSYM GetProcessImageFileNameA}
 
288
function GetProcessImageFileNameW(hProcess: HANDLE; lpImageFileName: LPWSTR;
 
289
  nSize: DWORD): DWORD; stdcall;
 
290
{$EXTERNALSYM GetProcessImageFileNameW}
 
291
function GetProcessImageFileName(hProcess: HANDLE; lpImageFileName: LPTSTR;
 
292
  nSize: DWORD): DWORD; stdcall;
 
293
{$EXTERNALSYM GetProcessImageFileName}
 
294
 
 
295
implementation
 
296
 
 
297
uses
 
298
  JwaWinDLLNames;
 
299
 
 
300
{$IFDEF DYNAMIC_LINK}
 
301
 
 
302
var
 
303
  _EnumProcesses: Pointer;
 
304
 
 
305
function EnumProcesses;
 
306
begin
 
307
  GetProcedureAddress(_EnumProcesses, PsapiLib, 'EnumProcesses');
 
308
  asm
 
309
        MOV     ESP, EBP
 
310
        POP     EBP
 
311
        JMP     [_EnumProcesses]
 
312
  end;
 
313
end;
 
314
 
 
315
var
 
316
  _EnumProcessModules: Pointer;
 
317
 
 
318
function EnumProcessModules;
 
319
begin
 
320
  GetProcedureAddress(_EnumProcessModules, PsapiLib, 'EnumProcessModules');
 
321
  asm
 
322
        MOV     ESP, EBP
 
323
        POP     EBP
 
324
        JMP     [_EnumProcessModules]
 
325
  end;
 
326
end;
 
327
 
 
328
var
 
329
  _GetModuleBaseNameA: Pointer;
 
330
 
 
331
function GetModuleBaseNameA;
 
332
begin
 
333
  GetProcedureAddress(_GetModuleBaseNameA, PsapiLib, 'GetModuleBaseNameA');
 
334
  asm
 
335
        MOV     ESP, EBP
 
336
        POP     EBP
 
337
        JMP     [_GetModuleBaseNameA]
 
338
  end;
 
339
end;
 
340
 
 
341
var
 
342
  _GetModuleBaseNameW: Pointer;
 
343
 
 
344
function GetModuleBaseNameW;
 
345
begin
 
346
  GetProcedureAddress(_GetModuleBaseNameW, PsapiLib, 'GetModuleBaseNameW');
 
347
  asm
 
348
        MOV     ESP, EBP
 
349
        POP     EBP
 
350
        JMP     [_GetModuleBaseNameW]
 
351
  end;
 
352
end;
 
353
 
 
354
var
 
355
  _GetModuleBaseName: Pointer;
 
356
 
 
357
function GetModuleBaseName;
 
358
begin
 
359
  GetProcedureAddress(_GetModuleBaseName, PsapiLib, 'GetModuleBaseName' + AWSuffix);
 
360
  asm
 
361
        MOV     ESP, EBP
 
362
        POP     EBP
 
363
        JMP     [_GetModuleBaseName]
 
364
  end;
 
365
end;
 
366
 
 
367
var
 
368
  _GetModuleFileNameExA: Pointer;
 
369
 
 
370
function GetModuleFileNameExA;
 
371
begin
 
372
  GetProcedureAddress(_GetModuleFileNameExA, PsapiLib, 'GetModuleFileNameExA');
 
373
  asm
 
374
        MOV     ESP, EBP
 
375
        POP     EBP
 
376
        JMP     [_GetModuleFileNameExA]
 
377
  end;
 
378
end;
 
379
 
 
380
var
 
381
  _GetModuleFileNameExW: Pointer;
 
382
 
 
383
function GetModuleFileNameExW;
 
384
begin
 
385
  GetProcedureAddress(_GetModuleFileNameExW, PsapiLib, 'GetModuleFileNameExW');
 
386
  asm
 
387
        MOV     ESP, EBP
 
388
        POP     EBP
 
389
        JMP     [_GetModuleFileNameExW]
 
390
  end;
 
391
end;
 
392
 
 
393
var
 
394
  _GetModuleFileNameEx: Pointer;
 
395
 
 
396
function GetModuleFileNameEx;
 
397
begin
 
398
  GetProcedureAddress(_GetModuleFileNameEx, PsapiLib, 'GetModuleFileNameEx' + AWSuffix);
 
399
  asm
 
400
        MOV     ESP, EBP
 
401
        POP     EBP
 
402
        JMP     [_GetModuleFileNameEx]
 
403
  end;
 
404
end;
 
405
 
 
406
var
 
407
  _GetModuleInformation: Pointer;
 
408
 
 
409
function GetModuleInformation;
 
410
begin
 
411
  GetProcedureAddress(_GetModuleInformation, PsapiLib, 'GetModuleInformation');
 
412
  asm
 
413
        MOV     ESP, EBP
 
414
        POP     EBP
 
415
        JMP     [_GetModuleInformation]
 
416
  end;
 
417
end;
 
418
 
 
419
var
 
420
  _EmptyWorkingSet: Pointer;
 
421
 
 
422
function EmptyWorkingSet;
 
423
begin
 
424
  GetProcedureAddress(_EmptyWorkingSet, PsapiLib, 'EmptyWorkingSet');
 
425
  asm
 
426
        MOV     ESP, EBP
 
427
        POP     EBP
 
428
        JMP     [_EmptyWorkingSet]
 
429
  end;
 
430
end;
 
431
 
 
432
var
 
433
  _QueryWorkingSet: Pointer;
 
434
 
 
435
function QueryWorkingSet;
 
436
begin
 
437
  GetProcedureAddress(_QueryWorkingSet, PsapiLib, 'QueryWorkingSet');
 
438
  asm
 
439
        MOV     ESP, EBP
 
440
        POP     EBP
 
441
        JMP     [_QueryWorkingSet]
 
442
  end;
 
443
end;
 
444
 
 
445
var
 
446
  _InitializeProcessForWsWatch: Pointer;
 
447
 
 
448
function InitializeProcessForWsWatch;
 
449
begin
 
450
  GetProcedureAddress(_InitializeProcessForWsWatch, PsapiLib, 'InitializeProcessForWsWatch');
 
451
  asm
 
452
        MOV     ESP, EBP
 
453
        POP     EBP
 
454
        JMP     [_InitializeProcessForWsWatch]
 
455
  end;
 
456
end;
 
457
 
 
458
var
 
459
  _GetWsChanges: Pointer;
 
460
 
 
461
function GetWsChanges;
 
462
begin
 
463
  GetProcedureAddress(_GetWsChanges, PsapiLib, 'GetWsChanges');
 
464
  asm
 
465
        MOV     ESP, EBP
 
466
        POP     EBP
 
467
        JMP     [_GetWsChanges]
 
468
  end;
 
469
end;
 
470
 
 
471
var
 
472
  _GetMappedFileNameW: Pointer;
 
473
 
 
474
function GetMappedFileNameW;
 
475
begin
 
476
  GetProcedureAddress(_GetMappedFileNameW, PsapiLib, 'GetMappedFileNameW');
 
477
  asm
 
478
        MOV     ESP, EBP
 
479
        POP     EBP
 
480
        JMP     [_GetMappedFileNameW]
 
481
  end;
 
482
end;
 
483
 
 
484
var
 
485
  _GetMappedFileNameA: Pointer;
 
486
 
 
487
function GetMappedFileNameA;
 
488
begin
 
489
  GetProcedureAddress(_GetMappedFileNameA, PsapiLib, 'GetMappedFileNameA');
 
490
  asm
 
491
        MOV     ESP, EBP
 
492
        POP     EBP
 
493
        JMP     [_GetMappedFileNameA]
 
494
  end;
 
495
end;
 
496
 
 
497
var
 
498
  _GetMappedFileName: Pointer;
 
499
 
 
500
function GetMappedFileName;
 
501
begin
 
502
  GetProcedureAddress(_GetMappedFileName, PsapiLib, 'GetMappedFileName' + AWSuffix);
 
503
  asm
 
504
        MOV     ESP, EBP
 
505
        POP     EBP
 
506
        JMP     [_GetMappedFileName]
 
507
  end;
 
508
end;
 
509
 
 
510
var
 
511
  _EnumDeviceDrivers: Pointer;
 
512
 
 
513
function EnumDeviceDrivers;
 
514
begin
 
515
  GetProcedureAddress(_EnumDeviceDrivers, PsapiLib, 'EnumDeviceDrivers');
 
516
  asm
 
517
        MOV     ESP, EBP
 
518
        POP     EBP
 
519
        JMP     [_EnumDeviceDrivers]
 
520
  end;
 
521
end;
 
522
 
 
523
var
 
524
  _GetDeviceDriverBaseNameA: Pointer;
 
525
 
 
526
function GetDeviceDriverBaseNameA;
 
527
begin
 
528
  GetProcedureAddress(_GetDeviceDriverBaseNameA, PsapiLib, 'GetDeviceDriverBaseNameA');
 
529
  asm
 
530
        MOV     ESP, EBP
 
531
        POP     EBP
 
532
        JMP     [_GetDeviceDriverBaseNameA]
 
533
  end;
 
534
end;
 
535
 
 
536
var
 
537
  _GetDeviceDriverBaseNameW: Pointer;
 
538
 
 
539
function GetDeviceDriverBaseNameW;
 
540
begin
 
541
  GetProcedureAddress(_GetDeviceDriverBaseNameW, PsapiLib, 'GetDeviceDriverBaseNameW');
 
542
  asm
 
543
        MOV     ESP, EBP
 
544
        POP     EBP
 
545
        JMP     [_GetDeviceDriverBaseNameW]
 
546
  end;
 
547
end;
 
548
 
 
549
var
 
550
  _GetDeviceDriverBaseName: Pointer;
 
551
 
 
552
function GetDeviceDriverBaseName;
 
553
begin
 
554
  GetProcedureAddress(_GetDeviceDriverBaseName, PsapiLib, 'GetDeviceDriverBaseName' + AWSuffix);
 
555
  asm
 
556
        MOV     ESP, EBP
 
557
        POP     EBP
 
558
        JMP     [_GetDeviceDriverBaseName]
 
559
  end;
 
560
end;
 
561
 
 
562
var
 
563
  _GetDeviceDriverFileNameA: Pointer;
 
564
 
 
565
function GetDeviceDriverFileNameA;
 
566
begin
 
567
  GetProcedureAddress(_GetDeviceDriverFileNameA, PsapiLib, 'GetDeviceDriverFileNameA');
 
568
  asm
 
569
        MOV     ESP, EBP
 
570
        POP     EBP
 
571
        JMP     [_GetDeviceDriverFileNameA]
 
572
  end;
 
573
end;
 
574
 
 
575
var
 
576
  _GetDeviceDriverFileNameW: Pointer;
 
577
 
 
578
function GetDeviceDriverFileNameW;
 
579
begin
 
580
  GetProcedureAddress(_GetDeviceDriverFileNameW, PsapiLib, 'GetDeviceDriverFileNameW');
 
581
  asm
 
582
        MOV     ESP, EBP
 
583
        POP     EBP
 
584
        JMP     [_GetDeviceDriverFileNameW]
 
585
  end;
 
586
end;
 
587
 
 
588
var
 
589
  _GetDeviceDriverFileName: Pointer;
 
590
 
 
591
function GetDeviceDriverFileName;
 
592
begin
 
593
  GetProcedureAddress(_GetDeviceDriverFileName, PsapiLib, 'GetDeviceDriverFileName' + AWSuffix);
 
594
  asm
 
595
        MOV     ESP, EBP
 
596
        POP     EBP
 
597
        JMP     [_GetDeviceDriverFileName]
 
598
  end;
 
599
end;
 
600
 
 
601
var
 
602
  _GetProcessMemoryInfo: Pointer;
 
603
 
 
604
function GetProcessMemoryInfo;
 
605
begin
 
606
  GetProcedureAddress(_GetProcessMemoryInfo, PsapiLib, 'GetProcessMemoryInfo');
 
607
  asm
 
608
        MOV     ESP, EBP
 
609
        POP     EBP
 
610
        JMP     [_GetProcessMemoryInfo]
 
611
  end;
 
612
end;
 
613
 
 
614
var
 
615
  _GetPerformanceInfo: Pointer;
 
616
 
 
617
function GetPerformanceInfo;
 
618
begin
 
619
  GetProcedureAddress(_GetPerformanceInfo, PsapiLib, 'GetPerformanceInfo');
 
620
  asm
 
621
        MOV     ESP, EBP
 
622
        POP     EBP
 
623
        JMP     [_GetPerformanceInfo]
 
624
  end;
 
625
end;
 
626
 
 
627
var
 
628
  _EnumPageFilesW: Pointer;
 
629
 
 
630
function EnumPageFilesW;
 
631
begin
 
632
  GetProcedureAddress(_EnumPageFilesW, PsapiLib, 'EnumPageFilesA');
 
633
  asm
 
634
        MOV     ESP, EBP
 
635
        POP     EBP
 
636
        JMP     [_EnumPageFilesW]
 
637
  end;
 
638
end;
 
639
 
 
640
var
 
641
  _EnumPageFilesA: Pointer;
 
642
 
 
643
function EnumPageFilesA;
 
644
begin
 
645
  GetProcedureAddress(_EnumPageFilesA, PsapiLib, 'EnumPageFilesW');
 
646
  asm
 
647
        MOV     ESP, EBP
 
648
        POP     EBP
 
649
        JMP     [_EnumPageFilesA]
 
650
  end;
 
651
end;
 
652
 
 
653
var
 
654
  _EnumPageFiles: Pointer;
 
655
 
 
656
function EnumPageFiles;
 
657
begin
 
658
  GetProcedureAddress(_EnumPageFiles, PsapiLib, 'EnumPageFiles' + AWSuffix);
 
659
  asm
 
660
        MOV     ESP, EBP
 
661
        POP     EBP
 
662
        JMP     [_EnumPageFiles]
 
663
  end;
 
664
end;
 
665
 
 
666
var
 
667
  _GetProcessImageFileNameA: Pointer;
 
668
 
 
669
function GetProcessImageFileNameA;
 
670
begin
 
671
  GetProcedureAddress(_GetProcessImageFileNameA, PsapiLib, 'GetProcessImageFileNameA');
 
672
  asm
 
673
        MOV     ESP, EBP
 
674
        POP     EBP
 
675
        JMP     [_GetProcessImageFileNameA]
 
676
  end;
 
677
end;
 
678
 
 
679
var
 
680
  _GetProcessImageFileNameW: Pointer;
 
681
 
 
682
function GetProcessImageFileNameW;
 
683
begin
 
684
  GetProcedureAddress(_GetProcessImageFileNameW, PsapiLib, 'GetProcessImageFileNameW');
 
685
  asm
 
686
        MOV     ESP, EBP
 
687
        POP     EBP
 
688
        JMP     [_GetProcessImageFileNameW]
 
689
  end;
 
690
end;
 
691
 
 
692
var
 
693
  _GetProcessImageFileName: Pointer;
 
694
 
 
695
function GetProcessImageFileName;
 
696
begin
 
697
  GetProcedureAddress(_GetProcessImageFileName, PsapiLib, 'GetProcessImageFileName' + AWSuffix);
 
698
  asm
 
699
        MOV     ESP, EBP
 
700
        POP     EBP
 
701
        JMP     [_GetProcessImageFileName]
 
702
  end;
 
703
end;
 
704
 
 
705
{$ELSE}
 
706
 
 
707
function EnumProcesses; external PsapiLib name 'EnumProcesses';
 
708
function EnumProcessModules; external PsapiLib name 'EnumProcessModules';
 
709
function GetModuleBaseNameA; external PsapiLib name 'GetModuleBaseNameA';
 
710
function GetModuleBaseNameW; external PsapiLib name 'GetModuleBaseNameW';
 
711
function GetModuleBaseName; external PsapiLib name 'GetModuleBaseName' + AWSuffix;
 
712
function GetModuleFileNameExA; external PsapiLib name 'GetModuleFileNameExA';
 
713
function GetModuleFileNameExW; external PsapiLib name 'GetModuleFileNameExW';
 
714
function GetModuleFileNameEx; external PsapiLib name 'GetModuleFileNameEx' + AWSuffix;
 
715
function GetModuleInformation; external PsapiLib name 'GetModuleInformation';
 
716
function EmptyWorkingSet; external PsapiLib name 'EmptyWorkingSet';
 
717
function QueryWorkingSet; external PsapiLib name 'QueryWorkingSet';
 
718
function InitializeProcessForWsWatch; external PsapiLib name 'InitializeProcessForWsWatch';
 
719
function GetWsChanges; external PsapiLib name 'GetWsChanges';
 
720
function GetMappedFileNameW; external PsapiLib name 'GetMappedFileNameW';
 
721
function GetMappedFileNameA; external PsapiLib name 'GetMappedFileNameA';
 
722
function GetMappedFileName; external PsapiLib name 'GetMappedFileName' + AWSuffix;
 
723
function EnumDeviceDrivers; external PsapiLib name 'EnumDeviceDrivers';
 
724
function GetDeviceDriverBaseNameA; external PsapiLib name 'GetDeviceDriverBaseNameA';
 
725
function GetDeviceDriverBaseNameW; external PsapiLib name 'GetDeviceDriverBaseNameW';
 
726
function GetDeviceDriverBaseName; external PsapiLib name 'GetDeviceDriverBaseName' + AWSuffix;
 
727
function GetDeviceDriverFileNameA; external PsapiLib name 'GetDeviceDriverFileNameA';
 
728
function GetDeviceDriverFileNameW; external PsapiLib name 'GetDeviceDriverFileNameW';
 
729
function GetDeviceDriverFileName; external PsapiLib name 'GetDeviceDriverFileName' + AWSuffix;
 
730
function GetProcessMemoryInfo; external PsapiLib name 'GetProcessMemoryInfo';
 
731
function GetPerformanceInfo; external PsapiLib name 'GetPerformanceInfo';
 
732
function EnumPageFilesW; external PsapiLib name 'EnumPageFilesA';
 
733
function EnumPageFilesA; external PsapiLib name 'EnumPageFilesW';
 
734
function EnumPageFiles; external PsapiLib name 'EnumPageFiles' + AWSuffix;
 
735
function GetProcessImageFileNameA; external PsapiLib name 'GetProcessImageFileNameA';
 
736
function GetProcessImageFileNameW; external PsapiLib name 'GetProcessImageFileNameW';
 
737
function GetProcessImageFileName; external PsapiLib name 'GetProcessImageFileName' + AWSuffix;
 
738
 
 
739
{$ENDIF DYNAMIC_LINK}
 
740
 
 
741
end.