ReactOS  0.4.15-dev-2155-g06f57e1
psapi.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _MODULEINFO
 
struct  _PSAPI_WS_WATCH_INFORMATION
 
struct  _PROCESS_MEMORY_COUNTERS
 
struct  _PROCESS_MEMORY_COUNTERS_EX
 
struct  _PERFORMANCE_INFORMATION
 
struct  _ENUM_PAGE_FILE_INFORMATION
 

Macros

#define PENUM_PAGE_FILE_CALLBACK   PENUM_PAGE_FILE_CALLBACKA
 
#define EnumPageFiles   EnumPageFilesA
 
#define GetModuleBaseName   GetModuleBaseNameA
 
#define GetModuleFileNameEx   GetModuleFileNameExA
 
#define GetMappedFilenameEx   GetMappedFilenameExA
 
#define GetDeviceDriverBaseName   GetDeviceDriverBaseNameA
 
#define GetDeviceDriverFileName   GetDeviceDriverFileNameA
 
#define GetProcessImageFileName   GetProcessImageFileNameA
 

Typedefs

typedef struct _MODULEINFO MODULEINFO
 
typedef struct _MODULEINFOLPMODULEINFO
 
typedef struct _PSAPI_WS_WATCH_INFORMATION PSAPI_WS_WATCH_INFORMATION
 
typedef struct _PSAPI_WS_WATCH_INFORMATIONPPSAPI_WS_WATCH_INFORMATION
 
typedef struct _PROCESS_MEMORY_COUNTERS PROCESS_MEMORY_COUNTERS
 
typedef struct _PROCESS_MEMORY_COUNTERSPPROCESS_MEMORY_COUNTERS
 
typedef struct _PROCESS_MEMORY_COUNTERS_EX PROCESS_MEMORY_COUNTERS_EX
 
typedef struct _PROCESS_MEMORY_COUNTERS_EXPPROCESS_MEMORY_COUNTERS_EX
 
typedef struct _PERFORMANCE_INFORMATION PERFORMANCE_INFORMATION
 
typedef struct _PERFORMANCE_INFORMATIONPPERFORMANCE_INFORMATION
 
typedef struct _ENUM_PAGE_FILE_INFORMATION ENUM_PAGE_FILE_INFORMATION
 
typedef struct _ENUM_PAGE_FILE_INFORMATIONPENUM_PAGE_FILE_INFORMATION
 
typedef BOOL(CALLBACKPENUM_PAGE_FILE_CALLBACKA) (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR)
 
typedef BOOL(CALLBACKPENUM_PAGE_FILE_CALLBACKW) (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR)
 

Functions

BOOL WINAPI EnumProcesses (DWORD *, DWORD, DWORD *)
 
BOOL WINAPI EnumProcessModules (HANDLE, HMODULE *, DWORD, LPDWORD)
 
BOOL WINAPI EnumPageFilesA (PENUM_PAGE_FILE_CALLBACKA, LPVOID)
 
BOOL WINAPI EnumPageFilesW (PENUM_PAGE_FILE_CALLBACKW, LPVOID)
 
DWORD WINAPI GetModuleBaseNameA (HANDLE, HMODULE, LPSTR, DWORD)
 
DWORD WINAPI GetModuleBaseNameW (HANDLE, HMODULE, LPWSTR, DWORD)
 
DWORD WINAPI GetModuleFileNameExA (HANDLE, HMODULE, LPSTR, DWORD)
 
DWORD WINAPI GetModuleFileNameExW (HANDLE, HMODULE, LPWSTR, DWORD)
 
BOOL WINAPI GetModuleInformation (HANDLE, HMODULE, LPMODULEINFO, DWORD)
 
BOOL WINAPI EmptyWorkingSet (HANDLE)
 
BOOL WINAPI QueryWorkingSet (HANDLE, PVOID, DWORD)
 
BOOL WINAPI InitializeProcessForWsWatch (HANDLE)
 
BOOL WINAPI GetWsChanges (HANDLE, PPSAPI_WS_WATCH_INFORMATION, DWORD)
 
DWORD WINAPI GetMappedFileNameW (HANDLE, LPVOID, LPWSTR, DWORD)
 
DWORD WINAPI GetMappedFileNameA (HANDLE, LPVOID, LPSTR, DWORD)
 
BOOL WINAPI EnumDeviceDrivers (LPVOID *, DWORD, LPDWORD)
 
DWORD WINAPI GetDeviceDriverBaseNameA (LPVOID, LPSTR, DWORD)
 
DWORD WINAPI GetDeviceDriverBaseNameW (LPVOID, LPWSTR, DWORD)
 
DWORD WINAPI GetDeviceDriverFileNameA (LPVOID, LPSTR, DWORD)
 
DWORD WINAPI GetDeviceDriverFileNameW (LPVOID, LPWSTR, DWORD)
 
BOOL WINAPI GetProcessMemoryInfo (HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD)
 
BOOL WINAPI GetPerformanceInfo (PPERFORMANCE_INFORMATION, DWORD)
 
DWORD WINAPI GetProcessImageFileNameW (HANDLE, LPWSTR, DWORD)
 
DWORD WINAPI GetProcessImageFileNameA (HANDLE, LPSTR, DWORD)
 

Macro Definition Documentation

◆ EnumPageFiles

#define EnumPageFiles   EnumPageFilesA

Definition at line 131 of file psapi.h.

◆ GetDeviceDriverBaseName

#define GetDeviceDriverBaseName   GetDeviceDriverBaseNameA

Definition at line 135 of file psapi.h.

◆ GetDeviceDriverFileName

#define GetDeviceDriverFileName   GetDeviceDriverFileNameA

Definition at line 136 of file psapi.h.

◆ GetMappedFilenameEx

#define GetMappedFilenameEx   GetMappedFilenameExA

Definition at line 134 of file psapi.h.

◆ GetModuleBaseName

#define GetModuleBaseName   GetModuleBaseNameA

Definition at line 132 of file psapi.h.

◆ GetModuleFileNameEx

#define GetModuleFileNameEx   GetModuleFileNameExA

Definition at line 133 of file psapi.h.

◆ GetProcessImageFileName

#define GetProcessImageFileName   GetProcessImageFileNameA

Definition at line 137 of file psapi.h.

◆ PENUM_PAGE_FILE_CALLBACK

#define PENUM_PAGE_FILE_CALLBACK   PENUM_PAGE_FILE_CALLBACKA

Definition at line 130 of file psapi.h.

Typedef Documentation

◆ ENUM_PAGE_FILE_INFORMATION

◆ LPMODULEINFO

◆ MODULEINFO

◆ PENUM_PAGE_FILE_CALLBACKA

typedef BOOL(CALLBACK * PENUM_PAGE_FILE_CALLBACKA) (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR)

Definition at line 89 of file psapi.h.

◆ PENUM_PAGE_FILE_CALLBACKW

typedef BOOL(CALLBACK * PENUM_PAGE_FILE_CALLBACKW) (LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR)

Definition at line 90 of file psapi.h.

◆ PENUM_PAGE_FILE_INFORMATION

◆ PERFORMANCE_INFORMATION

◆ PPERFORMANCE_INFORMATION

◆ PPROCESS_MEMORY_COUNTERS

◆ PPROCESS_MEMORY_COUNTERS_EX

◆ PPSAPI_WS_WATCH_INFORMATION

◆ PROCESS_MEMORY_COUNTERS

◆ PROCESS_MEMORY_COUNTERS_EX

◆ PSAPI_WS_WATCH_INFORMATION

Function Documentation

◆ EmptyWorkingSet()

BOOL WINAPI EmptyWorkingSet ( HANDLE  )

Definition at line 313 of file psapi.c.

314 {
315  SYSTEM_INFO SystemInfo;
316  QUOTA_LIMITS QuotaLimits;
318 
319  GetSystemInfo(&SystemInfo);
320 
321  /* Query the working set */
324  &QuotaLimits,
325  sizeof(QuotaLimits),
326  NULL);
327 
328  if (!NT_SUCCESS(Status))
329  {
331  return FALSE;
332  }
333 
334  /* Empty the working set */
335  QuotaLimits.MinimumWorkingSetSize = -1;
336  QuotaLimits.MaximumWorkingSetSize = -1;
337 
338  /* Set the working set */
341  &QuotaLimits,
342  sizeof(QuotaLimits));
344  {
346  return FALSE;
347  }
348 
349  return TRUE;
350 }
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:611
INT64 MinimumWorkingSetSize
Definition: lsa.idl:289
NTSTATUS NTAPI NtSetInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength)
Definition: query.c:1107
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
#define NULL
Definition: types.h:112
INT64 MaximumWorkingSetSize
Definition: lsa.idl:290

Referenced by test_ws_functions().

◆ EnumDeviceDrivers()

BOOL WINAPI EnumDeviceDrivers ( LPVOID ,
DWORD  ,
LPDWORD   
)

Definition at line 358 of file psapi.c.

361 {
365  /* By default, to prevent too many reallocations, we already make room for 4 modules */
367 
368  do
369  {
370  /* Allocate a buffer to hold modules information */
372  if (!Information)
373  {
375  return FALSE;
376  }
377 
378  /* Query information */
380  /* In case of an error */
381  if (!NT_SUCCESS(Status))
382  {
383  /* Save the amount of output modules */
384  NewSize = Information->NumberOfModules;
385  /* And free buffer */
387 
388  /* If it was not a length mismatch (ie, buffer too small), just leave */
390  {
392  return FALSE;
393  }
394 
395  /* Compute new size length */
396  ASSERT(Size >= sizeof(RTL_PROCESS_MODULES));
398  NewSize += sizeof(ULONG);
399  ASSERT(NewSize >= sizeof(RTL_PROCESS_MODULES));
400  /* Check whether it is really bigger - otherwise, leave */
401  if (NewSize < Size)
402  {
403  ASSERT(NewSize > Size);
405  return FALSE;
406  }
407 
408  /* Loop again with that new buffer */
409  Size = NewSize;
410  continue;
411  }
412 
413  /* End of allocation loop */
414  break;
415  } while (TRUE);
416 
417  _SEH2_TRY
418  {
419  for (Count = 0; Count < Information->NumberOfModules && Count < cb / sizeof(LPVOID); ++Count)
420  {
421  lpImageBase[Count] = Information->Modules[Count].ImageBase;
422  }
423 
424  *lpcbNeeded = Information->NumberOfModules * sizeof(LPVOID);
425  }
427  {
429  _SEH2_YIELD(return FALSE);
430  }
431  _SEH2_END;
432 
433  return TRUE;
434 }
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1044
#define ERROR_NO_SYSTEM_RESOURCES
Definition: winerror.h:931
struct _RTL_PROCESS_MODULES RTL_PROCESS_MODULES
_SEH2_TRY
Definition: create.c:4226
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define LMEM_FIXED
Definition: winbase.h:365
Status
Definition: gdiplustypes.h:24
int Count
Definition: noreturn.cpp:7
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
#define LPVOID
Definition: nt_native.h:45
struct _RTL_PROCESS_MODULE_INFORMATION RTL_PROCESS_MODULE_INFORMATION
_Must_inspect_result_ _In_ USHORT NewSize
Definition: fltkernel.h:975
_SEH2_END
Definition: create.c:4400
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
unsigned int ULONG
Definition: retypes.h:1
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12

◆ EnumPageFilesA()

BOOL WINAPI EnumPageFilesA ( PENUM_PAGE_FILE_CALLBACKA  ,
LPVOID   
)

Definition at line 1270 of file psapi.c.

1272 {
1273  BOOL Ret;
1275 
1276  Context.dwErrCode = ERROR_SUCCESS;
1277  Context.lpContext = lpContext;
1278  Context.pCallbackRoutine = pCallbackRoutine;
1279 
1280  /* Call W with our own callback for W -> A conversions */
1282  /* If we succeed but we have error code, fail and set error */
1283  if (Ret && Context.dwErrCode != ERROR_SUCCESS)
1284  {
1285  Ret = FALSE;
1286  SetLastError(Context.dwErrCode);
1287  }
1288 
1289  return Ret;
1290 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI EnumPageFilesW(PENUM_PAGE_FILE_CALLBACKW pCallbackRoutine, LPVOID lpContext)
Definition: psapi.c:1298
static BOOL CALLBACK CallBackConvertToAscii(LPVOID pContext, PENUM_PAGE_FILE_INFORMATION pPageFileInfo, LPCWSTR lpFilename)
Definition: psapi.c:213
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SetLastError(x)
Definition: compat.h:611
struct tagContext Context
Definition: acpixf.h:1034

◆ EnumPageFilesW()

BOOL WINAPI EnumPageFilesW ( PENUM_PAGE_FILE_CALLBACKW  ,
LPVOID   
)

Definition at line 1298 of file psapi.c.

1300 {
1301  PWSTR Colon;
1302  NTSTATUS Status;
1303  DWORD Size = INIT_MEMORY_SIZE, Needed;
1305  PSYSTEM_PAGEFILE_INFORMATION PageFileInfoArray, PageFileInfo;
1306 
1307  /* First loop till we have all the information about page files */
1308  do
1309  {
1310  PageFileInfoArray = LocalAlloc(LMEM_FIXED, Size);
1311  if (PageFileInfoArray == NULL)
1312  {
1314  return FALSE;
1315  }
1316 
1317  Status = NtQuerySystemInformation(SystemPageFileInformation, PageFileInfoArray, Size, &Needed);
1318  if (NT_SUCCESS(Status))
1319  {
1320  break;
1321  }
1322 
1323  LocalFree(PageFileInfoArray);
1324 
1325  /* In case we have unexpected status, quit */
1327  {
1329  return FALSE;
1330  }
1331 
1332  /* If needed size is smaller than actual size, guess it's something to add to our current size */
1333  if (Needed <= Size)
1334  {
1335  Size += Needed;
1336  }
1337  /* Otherwise, take it as size to allocate */
1338  else
1339  {
1340  Size = Needed;
1341  }
1342  }
1343  while (TRUE);
1344 
1345  /* Start browsing all our entries */
1346  PageFileInfo = PageFileInfoArray;
1347  do
1348  {
1349  /* Ensure we really have an entry */
1350  if (Needed < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1351  {
1352  break;
1353  }
1354 
1355  /* Prepare structure to hand to the user */
1356  Information.Reserved = 0;
1357  Information.cb = sizeof(Information);
1358  Information.TotalSize = PageFileInfo->TotalSize;
1359  Information.TotalInUse = PageFileInfo->TotalInUse;
1360  Information.PeakUsage = PageFileInfo->PeakUsage;
1361 
1362  /* Search for colon */
1363  Colon = wcschr(PageFileInfo->PageFileName.Buffer, L':');
1364  /* If it's found and not at the begin of the string */
1365  if (Colon != 0 && Colon != PageFileInfo->PageFileName.Buffer)
1366  {
1367  /* We can call the user callback routine with the colon */
1368  --Colon;
1369  pCallbackRoutine(lpContext, &Information, Colon);
1370  }
1371 
1372  /* If no next entry, then, it's over */
1373  if (PageFileInfo->NextEntryOffset == 0 || PageFileInfo->NextEntryOffset > Needed)
1374  {
1375  break;
1376  }
1377 
1378  /* Jump to next entry while keeping accurate bytes left count */
1379  Needed -= PageFileInfo->NextEntryOffset;
1380  PageFileInfo = (PSYSTEM_PAGEFILE_INFORMATION)((ULONG_PTR)PageFileInfo + PageFileInfo->NextEntryOffset);
1381  }
1382  while (TRUE);
1383 
1384  LocalFree(PageFileInfoArray);
1385  return TRUE;
1386 }
#define INIT_MEMORY_SIZE
Definition: psapi.c:34
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1044
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _SYSTEM_PAGEFILE_INFORMATION * PSYSTEM_PAGEFILE_INFORMATION
UNICODE_STRING PageFileName
Definition: extypes.h:1067
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
#define LMEM_FIXED
Definition: winbase.h:365
Status
Definition: gdiplustypes.h:24
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
static const WCHAR L[]
Definition: oid.c:1250
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by EnumPageFilesA().

◆ EnumProcesses()

BOOL WINAPI EnumProcesses ( DWORD ,
DWORD  ,
DWORD  
)

◆ EnumProcessModules()

BOOL WINAPI EnumProcessModules ( HANDLE  ,
HMODULE ,
DWORD  ,
LPDWORD   
)

Definition at line 526 of file psapi.c.

530 {
532  DWORD NbOfModules, Count;
533  PPEB_LDR_DATA LoaderData;
534  PLIST_ENTRY ListHead, ListEntry;
535  PROCESS_BASIC_INFORMATION ProcInfo;
537 
538  /* Query the process information to get its PEB address */
539  Status = NtQueryInformationProcess(hProcess, ProcessBasicInformation, &ProcInfo, sizeof(ProcInfo), NULL);
540  if (!NT_SUCCESS(Status))
541  {
543  return FALSE;
544  }
545 
546  if (ProcInfo.PebBaseAddress == NULL)
547  {
549  return FALSE;
550  }
551 
552  /* Read loader data address from PEB */
553  if (!ReadProcessMemory(hProcess, &ProcInfo.PebBaseAddress->Ldr, &LoaderData, sizeof(LoaderData), NULL))
554  {
555  return FALSE;
556  }
557 
558  /* Store list head address */
559  ListHead = &LoaderData->InLoadOrderModuleList;
560 
561  /* Read first element in the modules list */
562  if (!ReadProcessMemory(hProcess, &LoaderData->InLoadOrderModuleList.Flink, &ListEntry, sizeof(ListEntry), NULL))
563  {
564  return FALSE;
565  }
566 
567  NbOfModules = cb / sizeof(HMODULE);
568  Count = 0;
569 
570  /* Loop on the modules */
571  while (ListEntry != ListHead)
572  {
573  /* Load module data */
575  CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks),
576  &CurrentModule,
577  sizeof(CurrentModule),
578  NULL))
579  {
580  return FALSE;
581  }
582 
583  /* Check if we can output module, do it if so */
584  if (Count < NbOfModules)
585  {
586  _SEH2_TRY
587  {
588  lphModule[Count] = CurrentModule.DllBase;
589  }
591  {
593  _SEH2_YIELD(return FALSE);
594  }
595  _SEH2_END;
596  }
597 
598  ++Count;
599  if (Count > MAX_MODULES)
600  {
602  return FALSE;
603  }
604 
605  /* Get to next listed module */
606  ListEntry = CurrentModule.InLoadOrderLinks.Flink;
607  }
608 
609  _SEH2_TRY
610  {
611  *lpcbNeeded = Count * sizeof(HMODULE);
612  }
614  {
616  _SEH2_YIELD(return FALSE);
617  }
618  _SEH2_END;
619 
620  return TRUE;
621 }
LIST_ENTRY InLoadOrderModuleList
Definition: ldrtypes.h:120
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:617
_SEH2_TRY
Definition: create.c:4226
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PLOADER_MODULE CurrentModule
Definition: mboot.c:66
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
int Count
Definition: noreturn.cpp:7
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
Definition: btrfs_drv.h:1922
Definition: typedefs.h:119
HANDLE HMODULE
Definition: typedefs.h:77
_SEH2_END
Definition: create.c:4400
PPEB_LDR_DATA Ldr
Definition: btrfs_drv.h:1958
#define NULL
Definition: types.h:112
#define STATUS_PARTIAL_COPY
Definition: ntstatus.h:193
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define MAX_MODULES
Definition: psapi.c:33

Referenced by debug_target_init_modules_info(), DllMain(), EnumerateLoadedModulesW64(), get_process_name_from_pid(), and test_EnumProcessModules().

◆ GetDeviceDriverBaseNameA()

DWORD WINAPI GetDeviceDriverBaseNameA ( LPVOID  ,
LPSTR  ,
DWORD   
)

Definition at line 629 of file psapi.c.

632 {
633  SIZE_T Len, LenWithNull;
635 
636  /* Get the associated device driver to the base address */
637  if (!FindDeviceDriver(ImageBase, &Module))
638  {
639  return 0;
640  }
641 
642  /* And copy as much as possible to output buffer.
643  * Try to add 1 to the len, to copy the null char as well.
644  */
645  Len =
646  LenWithNull = strlen(&Module.FullPathName[Module.OffsetToFileName]) + 1;
647  if (Len > nSize)
648  {
649  Len = nSize;
650  }
651 
652  memcpy(lpBaseName, &Module.FullPathName[Module.OffsetToFileName], Len);
653  /* In case we copied null char, remove it from final len */
654  if (Len == LenWithNull)
655  {
656  --Len;
657  }
658 
659  return Len;
660 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
static BOOL NTAPI FindDeviceDriver(IN PVOID ImageBase, OUT PRTL_PROCESS_MODULE_INFORMATION MatchingModule)
Definition: psapi.c:42
#define Len
Definition: deflate.h:82
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by GetDeviceDriverBaseNameW(), and START_TEST().

◆ GetDeviceDriverBaseNameW()

DWORD WINAPI GetDeviceDriverBaseNameW ( LPVOID  ,
LPWSTR  ,
DWORD   
)

Definition at line 707 of file psapi.c.

710 {
711  DWORD Len;
712  LPSTR BaseName;
713 
714  /* Allocate internal buffer for conversion */
715  BaseName = LocalAlloc(LMEM_FIXED, nSize);
716  if (BaseName == 0)
717  {
718  return 0;
719  }
720 
721  /* Call A API */
722  Len = GetDeviceDriverBaseNameA(ImageBase, BaseName, nSize);
723  if (Len == 0)
724  {
725  LocalFree(BaseName);
726  return 0;
727  }
728 
729  /* And convert output */
730  if (MultiByteToWideChar(CP_ACP, 0, BaseName, (Len < nSize) ? Len + 1 : Len, lpBaseName, nSize) == 0)
731  {
732  LocalFree(BaseName);
733  return 0;
734  }
735 
736  LocalFree(BaseName);
737  return Len;
738 }
#define CP_ACP
Definition: compat.h:109
DWORD WINAPI GetDeviceDriverBaseNameA(LPVOID ImageBase, LPSTR lpBaseName, DWORD nSize)
Definition: psapi.c:629
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
char * LPSTR
Definition: xmlstorage.h:182
#define LMEM_FIXED
Definition: winbase.h:365
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define MultiByteToWideChar
Definition: compat.h:110
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

◆ GetDeviceDriverFileNameA()

DWORD WINAPI GetDeviceDriverFileNameA ( LPVOID  ,
LPSTR  ,
DWORD   
)

Definition at line 668 of file psapi.c.

671 {
672  SIZE_T Len, LenWithNull;
674 
675  /* Get the associated device driver to the base address */
676  if (!FindDeviceDriver(ImageBase, &Module))
677  {
678  return 0;
679  }
680 
681  /* And copy as much as possible to output buffer.
682  * Try to add 1 to the len, to copy the null char as well.
683  */
684  Len =
685  LenWithNull = strlen(Module.FullPathName) + 1;
686  if (Len > nSize)
687  {
688  Len = nSize;
689  }
690 
691  memcpy(lpFilename, Module.FullPathName, Len);
692  /* In case we copied null char, remove it from final len */
693  if (Len == LenWithNull)
694  {
695  --Len;
696  }
697 
698  return Len;
699 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
static BOOL NTAPI FindDeviceDriver(IN PVOID ImageBase, OUT PRTL_PROCESS_MODULE_INFORMATION MatchingModule)
Definition: psapi.c:42
#define Len
Definition: deflate.h:82
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by GetDeviceDriverFileNameW(), and START_TEST().

◆ GetDeviceDriverFileNameW()

DWORD WINAPI GetDeviceDriverFileNameW ( LPVOID  ,
LPWSTR  ,
DWORD   
)

Definition at line 746 of file psapi.c.

749 {
750  DWORD Len;
751  LPSTR FileName;
752 
753  /* Allocate internal buffer for conversion */
755  if (FileName == 0)
756  {
757  return 0;
758  }
759 
760  /* Call A API */
762  if (Len == 0)
763  {
765  return 0;
766  }
767 
768  /* And convert output */
769  if (MultiByteToWideChar(CP_ACP, 0, FileName, (Len < nSize) ? Len + 1 : Len, lpFilename, nSize) == 0)
770  {
772  return 0;
773  }
774 
776  return Len;
777 }
#define CP_ACP
Definition: compat.h:109
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
DWORD WINAPI GetDeviceDriverFileNameA(LPVOID ImageBase, LPSTR lpFilename, DWORD nSize)
Definition: psapi.c:668
char * LPSTR
Definition: xmlstorage.h:182
#define LMEM_FIXED
Definition: winbase.h:365
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
struct _FileName FileName
Definition: fatprocs.h:893
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define MultiByteToWideChar
Definition: compat.h:110
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

◆ GetMappedFileNameA()

DWORD WINAPI GetMappedFileNameA ( HANDLE  ,
LPVOID  ,
LPSTR  ,
DWORD   
)

Definition at line 785 of file psapi.c.

789 {
790  DWORD Len;
792 
793  DPRINT("GetMappedFileNameA(%p, %p, %p, %lu)\n", hProcess, lpv, lpFilename, nSize);
794 
795  /* Allocate internal buffer for conversion */
796  FileName = LocalAlloc(LMEM_FIXED, nSize * sizeof(WCHAR));
797  if (FileName == NULL)
798  {
799  return 0;
800  }
801 
802  /* Call W API */
804 
805  /* And convert output */
806  if (WideCharToMultiByte(CP_ACP, 0, FileName, (Len < nSize) ? Len + 1 : Len, lpFilename, nSize, NULL, NULL) == 0)
807  {
808  Len = 0;
809  }
810 
812  return Len;
813 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define LMEM_FIXED
Definition: winbase.h:365
DWORD WINAPI GetMappedFileNameW(HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename, DWORD nSize)
Definition: psapi.c:821
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
struct _FileName FileName
Definition: fatprocs.h:893
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define DPRINT
Definition: sndvol32.h:71
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by test_GetMappedFileName(), and test_GetProcessImageFileName().

◆ GetMappedFileNameW()

DWORD WINAPI GetMappedFileNameW ( HANDLE  ,
LPVOID  ,
LPWSTR  ,
DWORD   
)

Definition at line 821 of file psapi.c.

825 {
826  DWORD Len;
827  SIZE_T OutSize;
829  struct
830  {
832  WCHAR CharBuffer[MAX_PATH];
833  } SectionName;
834 
835  DPRINT("GetMappedFileNameW(%p, %p, %p, %lu)\n", hProcess, lpv, lpFilename, nSize);
836 
837  /* If no buffer, no need to keep going on */
838  if (nSize == 0)
839  {
841  return 0;
842  }
843 
844  /* Query section name */
846  &SectionName, sizeof(SectionName), &OutSize);
847  if (!NT_SUCCESS(Status))
848  {
850  return 0;
851  }
852 
853  /* Prepare to copy file name */
854  Len =
855  OutSize = SectionName.SectionFileName.Length / sizeof(WCHAR);
856  if (OutSize + 1 > nSize)
857  {
858  Len = nSize - 1;
859  OutSize = nSize;
861  }
862  else
863  {
865  }
866 
867  /* Copy, zero and return */
868  memcpy(lpFilename, SectionName.SectionFileName.Buffer, Len * sizeof(WCHAR));
869  lpFilename[Len] = 0;
870 
871  return OutSize;
872 }
#define ERROR_SUCCESS
Definition: deptool.c:10
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN MEMORY_INFORMATION_CLASS MemoryInformationClass, OUT PVOID MemoryInformation, IN SIZE_T MemoryInformationLength, OUT PSIZE_T ReturnLength)
Definition: virtual.c:4320
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
#define SetLastError(x)
Definition: compat.h:611
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:80
struct _MEMORY_SECTION_NAME MEMORY_SECTION_NAME
#define DPRINT
Definition: sndvol32.h:71
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by GetMappedFileNameA(), and test_GetMappedFileName().

◆ GetModuleBaseNameA()

DWORD WINAPI GetModuleBaseNameA ( HANDLE  ,
HMODULE  ,
LPSTR  ,
DWORD   
)

Definition at line 880 of file psapi.c.

884 {
885  DWORD Len;
886  PWSTR BaseName;
887 
888  /* Allocate internal buffer for conversion */
889  BaseName = LocalAlloc(LMEM_FIXED, nSize * sizeof(WCHAR));
890  if (BaseName == NULL)
891  {
892  return 0;
893  }
894 
895  /* Call W API */
897  /* And convert output */
898  if (WideCharToMultiByte(CP_ACP, 0, BaseName, (Len < nSize) ? Len + 1 : Len, lpBaseName, nSize, NULL, NULL) == 0)
899  {
900  Len = 0;
901  }
902 
903  LocalFree(BaseName);
904 
905  return Len;
906 }
#define WideCharToMultiByte
Definition: compat.h:111
uint16_t * PWSTR
Definition: typedefs.h:56
#define CP_ACP
Definition: compat.h:109
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
DWORD WINAPI GetModuleBaseNameW(HANDLE hProcess, HMODULE hModule, LPWSTR lpBaseName, DWORD nSize)
Definition: psapi.c:914
#define LMEM_FIXED
Definition: winbase.h:365
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
HMODULE hModule
Definition: animate.c:44

Referenced by test_EnumProcessModules(), and test_GetModuleBaseName().

◆ GetModuleBaseNameW()

DWORD WINAPI GetModuleBaseNameW ( HANDLE  ,
HMODULE  ,
LPWSTR  ,
DWORD   
)

Definition at line 914 of file psapi.c.

918 {
919  DWORD Len;
920  LDR_DATA_TABLE_ENTRY Module;
921 
922  /* Get the matching module */
923  if (!FindModule(hProcess, hModule, &Module))
924  {
925  return 0;
926  }
927 
928  /* Get the maximum len we have/can write in given size */
929  Len = Module.BaseDllName.Length + sizeof(UNICODE_NULL);
930  if (nSize * sizeof(WCHAR) < Len)
931  {
932  Len = nSize * sizeof(WCHAR);
933  }
934 
935  /* Read string */
936  if (!ReadProcessMemory(hProcess, (&Module.BaseDllName)->Buffer, lpBaseName, Len, NULL))
937  {
938  return 0;
939  }
940 
941  /* If we are at the end of the string, prepare to override to nullify string */
942  if (Len == Module.BaseDllName.Length + sizeof(UNICODE_NULL))
943  {
944  Len -= sizeof(UNICODE_NULL);
945  }
946 
947  /* Nullify at the end if needed */
948  if (Len >= nSize * sizeof(WCHAR))
949  {
950  if (nSize)
951  {
952  ASSERT(nSize >= sizeof(UNICODE_NULL));
953  lpBaseName[nSize - 1] = UNICODE_NULL;
954  }
955  }
956  /* Otherwise, nullify at last written char */
957  else
958  {
959  ASSERT(Len + sizeof(UNICODE_NULL) <= nSize * sizeof(WCHAR));
960  lpBaseName[Len / sizeof(WCHAR)] = UNICODE_NULL;
961  }
962 
963  return Len / sizeof(WCHAR);
964 }
static BOOL NTAPI FindModule(IN HANDLE hProcess, IN HMODULE hModule OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY Module)
Definition: psapi.c:115
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:617
#define UNICODE_NULL
#define ASSERT(a)
Definition: mode.c:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
Definition: btrfs_drv.h:1922
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:145
#define NULL
Definition: types.h:112
HMODULE hModule
Definition: animate.c:44

Referenced by EnumerateLoadedModulesW64(), get_process_name_from_pid(), GetModuleBaseNameA(), and GetOwnerModuleFromPidEntry().

◆ GetModuleFileNameExA()

DWORD WINAPI GetModuleFileNameExA ( HANDLE  ,
HMODULE  ,
LPSTR  ,
DWORD   
)

Definition at line 972 of file psapi.c.

976 {
977  DWORD Len;
978  PWSTR Filename;
979 
980  /* Allocate internal buffer for conversion */
981  Filename = LocalAlloc(LMEM_FIXED, nSize * sizeof(WCHAR));
982  if (Filename == NULL)
983  {
984  return 0;
985  }
986 
987  /* Call W API */
989  /* And convert output */
990  if (WideCharToMultiByte(CP_ACP, 0, Filename, (Len < nSize) ? Len + 1 : Len, lpFilename, nSize, NULL, NULL) == 0)
991  {
992  Len = 0;
993  }
994 
996 
997  return Len;
998 }
#define WideCharToMultiByte
Definition: compat.h:111
uint16_t * PWSTR
Definition: typedefs.h:56
#define CP_ACP
Definition: compat.h:109
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:934
#define LMEM_FIXED
Definition: winbase.h:365
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD WINAPI GetModuleFileNameExW(HANDLE hProcess, HMODULE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: psapi.c:1006
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
HMODULE hModule
Definition: animate.c:44

Referenced by debug_target_init_modules_info(), test_EnumProcessModules(), test_GetModuleFileNameEx(), and ModuleData::Update().

◆ GetModuleFileNameExW()

DWORD WINAPI GetModuleFileNameExW ( HANDLE  ,
HMODULE  ,
LPWSTR  ,
DWORD   
)

Definition at line 1006 of file psapi.c.

1010 {
1011  DWORD Len;
1012  LDR_DATA_TABLE_ENTRY Module;
1013 
1014  /* Get the matching module */
1015  if (!FindModule(hProcess, hModule, &Module))
1016  {
1017  return 0;
1018  }
1019 
1020  /* Get the maximum len we have/can write in given size */
1021  Len = Module.FullDllName.Length + sizeof(UNICODE_NULL);
1022  if (nSize * sizeof(WCHAR) < Len)
1023  {
1024  Len = nSize * sizeof(WCHAR);
1025  }
1026 
1027  /* Read string */
1028  if (!ReadProcessMemory(hProcess, (&Module.FullDllName)->Buffer, lpFilename, Len, NULL))
1029  {
1030  return 0;
1031  }
1032 
1033  /* If we are at the end of the string, prepare to override to nullify string */
1034  if (Len == Module.FullDllName.Length + sizeof(UNICODE_NULL))
1035  {
1036  Len -= sizeof(UNICODE_NULL);
1037  }
1038 
1039  /* Nullify at the end if needed */
1040  if (Len >= nSize * sizeof(WCHAR))
1041  {
1042  if (nSize)
1043  {
1044  ASSERT(nSize >= sizeof(UNICODE_NULL));
1045  lpFilename[nSize - 1] = UNICODE_NULL;
1046  }
1047  }
1048  /* Otherwise, nullify at last written char */
1049  else
1050  {
1051  ASSERT(Len + sizeof(UNICODE_NULL) <= nSize * sizeof(WCHAR));
1052  lpFilename[Len / sizeof(WCHAR)] = UNICODE_NULL;
1053  }
1054 
1055  return Len / sizeof(WCHAR);
1056 }
static BOOL NTAPI FindModule(IN HANDLE hProcess, IN HMODULE hModule OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY Module)
Definition: psapi.c:115
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:617
#define UNICODE_NULL
#define ASSERT(a)
Definition: mode.c:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
Definition: btrfs_drv.h:1922
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1928
#define NULL
Definition: types.h:112
HMODULE hModule
Definition: animate.c:44

Referenced by GetModuleFileNameExA().

◆ GetModuleInformation()

BOOL WINAPI GetModuleInformation ( HANDLE  ,
HMODULE  ,
LPMODULEINFO  ,
DWORD   
)

Definition at line 1064 of file psapi.c.

1068 {
1069  MODULEINFO LocalInfo;
1070  LDR_DATA_TABLE_ENTRY Module;
1071 
1072  /* Check output size */
1073  if (cb < sizeof(MODULEINFO))
1074  {
1076  return FALSE;
1077  }
1078 
1079  /* Get the matching module */
1080  if (!FindModule(hProcess, hModule, &Module))
1081  {
1082  return FALSE;
1083  }
1084 
1085  /* Get a local copy first, to check for valid pointer once */
1086  LocalInfo.lpBaseOfDll = hModule;
1087  LocalInfo.SizeOfImage = Module.SizeOfImage;
1088  LocalInfo.EntryPoint = Module.EntryPoint;
1089 
1090  /* Attempt to copy to output */
1091  _SEH2_TRY
1092  {
1093  memcpy(lpmodinfo, &LocalInfo, sizeof(LocalInfo));
1094  }
1096  {
1098  _SEH2_YIELD(return FALSE);
1099  }
1100  _SEH2_END;
1101 
1102  return TRUE;
1103 }
DWORD SizeOfImage
Definition: compat.h:778
static BOOL NTAPI FindModule(IN HANDLE hProcess, IN HMODULE hModule OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY Module)
Definition: psapi.c:115
#define TRUE
Definition: types.h:120
ULONG SizeOfImage
Definition: ldrtypes.h:143
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
_SEH2_TRY
Definition: create.c:4226
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
LPVOID EntryPoint
Definition: compat.h:779
PVOID EntryPoint
Definition: ntddk_ex.h:203
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LPVOID lpBaseOfDll
Definition: compat.h:777
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define SetLastError(x)
Definition: compat.h:611
Definition: btrfs_drv.h:1922
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_SEH2_END
Definition: create.c:4400
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
HMODULE hModule
Definition: animate.c:44
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by debug_target_init_modules_info(), EnumerateLoadedModulesW64(), test_EnumProcessModules(), test_GetModuleInformation(), and ModuleData::Update().

◆ GetPerformanceInfo()

BOOL WINAPI GetPerformanceInfo ( PPERFORMANCE_INFORMATION  ,
DWORD   
)

Definition at line 1394 of file psapi.c.

1396 {
1397  NTSTATUS Status;
1400  SYSTEM_FILECACHE_INFORMATION SystemFileCacheInfo;
1401  PSYSTEM_PROCESS_INFORMATION ProcInfoArray, SystemProcInfo;
1402  DWORD Size = INIT_MEMORY_SIZE, Needed, ProcCount, ThreadsCount, HandleCount;
1403 
1404  /* Validate output buffer */
1405  if (cb < sizeof(PERFORMANCE_INFORMATION))
1406  {
1408  return FALSE;
1409  }
1410 
1411  /* First, gather as many information about the system as possible */
1413  &SystemBasicInfo,
1414  sizeof(SystemBasicInfo),
1415  NULL);
1416  if (!NT_SUCCESS(Status))
1417  {
1419  return FALSE;
1420  }
1421 
1423  &SystemPerfInfo,
1424  sizeof(SystemPerfInfo),
1425  NULL);
1426  if (!NT_SUCCESS(Status))
1427  {
1429  return FALSE;
1430  }
1431 
1433  &SystemFileCacheInfo,
1434  sizeof(SystemFileCacheInfo),
1435  NULL);
1436  if (!NT_SUCCESS(Status))
1437  {
1439  return FALSE;
1440  }
1441 
1442  /* Then loop till we have all the information about processes */
1443  do
1444  {
1445  ProcInfoArray = LocalAlloc(LMEM_FIXED, Size);
1446  if (ProcInfoArray == NULL)
1447  {
1449  return FALSE;
1450  }
1451 
1453  ProcInfoArray,
1454  Size,
1455  &Needed);
1456  if (NT_SUCCESS(Status))
1457  {
1458  break;
1459  }
1460 
1461  LocalFree(ProcInfoArray);
1462 
1463  /* In case we have unexpected status, quit */
1465  {
1467  return FALSE;
1468  }
1469 
1470  /* If needed size is smaller than actual size, guess it's something to add to our current size */
1471  if (Needed <= Size)
1472  {
1473  Size += Needed;
1474  }
1475  /* Otherwise, take it as size to allocate */
1476  else
1477  {
1478  Size = Needed;
1479  }
1480  } while (TRUE);
1481 
1482  /* Start browsing all our entries */
1483  ProcCount = 0;
1484  HandleCount = 0;
1485  ThreadsCount = 0;
1486  SystemProcInfo = ProcInfoArray;
1487  do
1488  {
1489  /* Ensure we really have an entry */
1490  if (Needed < sizeof(SYSTEM_PROCESS_INFORMATION))
1491  {
1492  break;
1493  }
1494 
1495  /* Sum procs, threads and handles */
1496  ++ProcCount;
1497  ThreadsCount += SystemProcInfo->NumberOfThreads;
1498  HandleCount += SystemProcInfo->HandleCount;
1499 
1500  /* If no next entry, then, it's over */
1501  if (SystemProcInfo->NextEntryOffset == 0 || SystemProcInfo->NextEntryOffset > Needed)
1502  {
1503  break;
1504  }
1505 
1506  /* Jump to next entry while keeping accurate bytes left count */
1507  Needed -= SystemProcInfo->NextEntryOffset;
1508  SystemProcInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)SystemProcInfo + SystemProcInfo->NextEntryOffset);
1509  }
1510  while (TRUE);
1511 
1512  LocalFree(ProcInfoArray);
1513 
1514  /* Output data */
1515  pPerformanceInformation->CommitTotal = SystemPerfInfo.CommittedPages;
1516  pPerformanceInformation->CommitLimit = SystemPerfInfo.CommitLimit;
1517  pPerformanceInformation->CommitPeak = SystemPerfInfo.PeakCommitment;
1518  pPerformanceInformation->PhysicalTotal = SystemBasicInfo.NumberOfPhysicalPages;
1519  pPerformanceInformation->PhysicalAvailable = SystemPerfInfo.AvailablePages;
1520  pPerformanceInformation->SystemCache = SystemFileCacheInfo.CurrentSizeIncludingTransitionInPages;
1521  pPerformanceInformation->KernelNonpaged = SystemPerfInfo.NonPagedPoolPages;
1522  pPerformanceInformation->PageSize = SystemBasicInfo.PageSize;
1523  pPerformanceInformation->cb = sizeof(PERFORMANCE_INFORMATION);
1524  pPerformanceInformation->KernelTotal = SystemPerfInfo.PagedPoolPages + SystemPerfInfo.NonPagedPoolPages;
1525  pPerformanceInformation->KernelPaged = SystemPerfInfo.PagedPoolPages;
1526  pPerformanceInformation->HandleCount = HandleCount;
1527  pPerformanceInformation->ProcessCount = ProcCount;
1528  pPerformanceInformation->ThreadCount = ThreadsCount;
1529 
1530  return TRUE;
1531 }
#define INIT_MEMORY_SIZE
Definition: psapi.c:34
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
uint32_t ULONG_PTR
Definition: typedefs.h:65
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1119
#define SystemPerformanceInformation
Definition: memtest.h:87
SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo
Definition: perfdata.c:44
#define LMEM_FIXED
Definition: winbase.h:365
Status
Definition: gdiplustypes.h:24
struct _PERFORMANCE_INFORMATION PERFORMANCE_INFORMATION
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
SYSTEM_BASIC_INFORMATION SystemBasicInfo
Definition: perfdata.c:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by test_GetPerformanceInfo().

◆ GetProcessImageFileNameA()

DWORD WINAPI GetProcessImageFileNameA ( HANDLE  ,
LPSTR  ,
DWORD   
)

Definition at line 1216 of file psapi.c.

1219 {
1220  PUNICODE_STRING ImageFileName;
1222  NTSTATUS Status;
1223  DWORD Len;
1224 
1225  /* Allocate string big enough to hold name */
1226  BufferSize = sizeof(UNICODE_STRING) + (nSize * sizeof(WCHAR));
1227  ImageFileName = LocalAlloc(LMEM_FIXED, BufferSize);
1228  if (ImageFileName == NULL)
1229  {
1230  return 0;
1231  }
1232 
1233  /* Query name */
1236  ImageFileName,
1237  BufferSize,
1238  NULL);
1239  /* Len mismatch => buffer too small */
1241  {
1243  }
1244  if (!NT_SUCCESS(Status))
1245  {
1247  LocalFree(ImageFileName);
1248  return 0;
1249  }
1250 
1251  /* Copy name */
1252  Len = WideCharToMultiByte(CP_ACP, 0, ImageFileName->Buffer,
1253  ImageFileName->Length, lpImageFileName, nSize, NULL, NULL);
1254  /* If conversion was successful, don't return len with added \0 */
1255  if (Len != 0)
1256  {
1257  Len -= sizeof(ANSI_NULL);
1258  }
1259 
1260  LocalFree(ImageFileName);
1261  return Len;
1262 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ANSI_NULL
#define LMEM_FIXED
Definition: winbase.h:365
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
#define SetLastError(x)
Definition: compat.h:611
ULONG_PTR SIZE_T
Definition: typedefs.h:80
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
struct _UNICODE_STRING UNICODE_STRING
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by test_GetProcessImageFileName().

◆ GetProcessImageFileNameW()

DWORD WINAPI GetProcessImageFileNameW ( HANDLE  ,
LPWSTR  ,
DWORD   
)

Definition at line 1163 of file psapi.c.

1166 {
1167  PUNICODE_STRING ImageFileName;
1169  NTSTATUS Status;
1170  DWORD Len;
1171 
1172  /* Allocate string big enough to hold name */
1173  BufferSize = sizeof(UNICODE_STRING) + (nSize * sizeof(WCHAR));
1174  ImageFileName = LocalAlloc(LMEM_FIXED, BufferSize);
1175  if (ImageFileName == NULL)
1176  {
1177  return 0;
1178  }
1179 
1180  /* Query name */
1183  ImageFileName,
1184  BufferSize,
1185  NULL);
1186  /* Len mismatch => buffer too small */
1188  {
1190  }
1191  if (!NT_SUCCESS(Status))
1192  {
1194  LocalFree(ImageFileName);
1195  return 0;
1196  }
1197 
1198  /* Copy name and null-terminate if possible */
1199  memcpy(lpImageFileName, ImageFileName->Buffer, ImageFileName->Length);
1200  Len = ImageFileName->Length / sizeof(WCHAR);
1201  if (Len < nSize)
1202  {
1203  lpImageFileName[Len] = UNICODE_NULL;
1204  }
1205 
1206  LocalFree(ImageFileName);
1207  return Len;
1208 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2053
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define UNICODE_NULL
#define LMEM_FIXED
Definition: winbase.h:365
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
#define SetLastError(x)
Definition: compat.h:611
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:80
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
struct _UNICODE_STRING UNICODE_STRING
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by NonConsoleProcessShutdown(), test_GetProcessImageFileName(), and UserClientShutdown().

◆ GetProcessMemoryInfo()

BOOL WINAPI GetProcessMemoryInfo ( HANDLE  ,
PPROCESS_MEMORY_COUNTERS  ,
DWORD   
)

Definition at line 1539 of file psapi.c.

1542 {
1543  NTSTATUS Status;
1544  VM_COUNTERS_EX Counters;
1545 
1546  /* Validate output size
1547  * It can be either PROCESS_MEMORY_COUNTERS or PROCESS_MEMORY_COUNTERS_EX
1548  */
1549  if (cb < sizeof(PROCESS_MEMORY_COUNTERS))
1550  {
1552  return FALSE;
1553  }
1554 
1555  _SEH2_TRY
1556  {
1557  ppsmemCounters->PeakPagefileUsage = 0;
1558 
1559  /* Query counters */
1562  &Counters,
1563  sizeof(Counters),
1564  NULL);
1565  if (!NT_SUCCESS(Status))
1566  {
1568  _SEH2_YIELD(return FALSE);
1569  }
1570 
1571  /* Properly set cb, according to what we received */
1572  if (cb >= sizeof(PROCESS_MEMORY_COUNTERS_EX))
1573  {
1574  ppsmemCounters->cb = sizeof(PROCESS_MEMORY_COUNTERS_EX);
1575  }
1576  else
1577  {
1578  ppsmemCounters->cb = sizeof(PROCESS_MEMORY_COUNTERS);
1579  }
1580 
1581  /* Output data */
1582  ppsmemCounters->PageFaultCount = Counters.PageFaultCount;
1583  ppsmemCounters->PeakWorkingSetSize = Counters.PeakWorkingSetSize;
1584  ppsmemCounters->WorkingSetSize = Counters.WorkingSetSize;
1585  ppsmemCounters->QuotaPeakPagedPoolUsage = Counters.QuotaPeakPagedPoolUsage;
1586  ppsmemCounters->QuotaPagedPoolUsage = Counters.QuotaPagedPoolUsage;
1587  ppsmemCounters->QuotaPeakNonPagedPoolUsage = Counters.QuotaPeakNonPagedPoolUsage;
1588  ppsmemCounters->QuotaNonPagedPoolUsage = Counters.QuotaNonPagedPoolUsage;
1589  ppsmemCounters->PagefileUsage = Counters.PagefileUsage;
1590  ppsmemCounters->PeakPagefileUsage = Counters.PeakPagefileUsage;
1591  /* And if needed, additional field for _EX version */
1592  if (cb >= sizeof(PROCESS_MEMORY_COUNTERS_EX))
1593  {
1594  ((PPROCESS_MEMORY_COUNTERS_EX)ppsmemCounters)->PrivateUsage = Counters.PrivateUsage;
1595  }
1596  }
1598  {
1600  _SEH2_YIELD(return FALSE);
1601  }
1602  _SEH2_END;
1603 
1604  return TRUE;
1605 }
ULONG PageFaultCount
Definition: pstypes.h:108
#define TRUE
Definition: types.h:120
SIZE_T PeakPagefileUsage
Definition: pstypes.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
SIZE_T WorkingSetSize
Definition: pstypes.h:110
SIZE_T QuotaNonPagedPoolUsage
Definition: pstypes.h:114
_SEH2_TRY
Definition: create.c:4226
struct _PROCESS_MEMORY_COUNTERS_EX PROCESS_MEMORY_COUNTERS_EX
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
SIZE_T QuotaPeakNonPagedPoolUsage
Definition: pstypes.h:113
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
SIZE_T PrivateUsage
Definition: pstypes.h:117
Status
Definition: gdiplustypes.h:24
SIZE_T QuotaPagedPoolUsage
Definition: pstypes.h:112
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:611
struct _PROCESS_MEMORY_COUNTERS_EX * PPROCESS_MEMORY_COUNTERS_EX
_SEH2_END
Definition: create.c:4400
#define NULL
Definition: types.h:112
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
struct _PROCESS_MEMORY_COUNTERS PROCESS_MEMORY_COUNTERS
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
SIZE_T PeakWorkingSetSize
Definition: pstypes.h:109
SIZE_T PagefileUsage
Definition: pstypes.h:115
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
SIZE_T QuotaPeakPagedPoolUsage
Definition: pstypes.h:111
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by test_GetProcessMemoryInfo().

◆ GetWsChanges()

BOOL WINAPI GetWsChanges ( HANDLE  ,
PPSAPI_WS_WATCH_INFORMATION  ,
DWORD   
)

Definition at line 1136 of file psapi.c.

1139 {
1140  NTSTATUS Status;
1141 
1142  /* Simply forward the call */
1145  lpWatchInfo,
1146  cb,
1147  NULL);
1148  if(!NT_SUCCESS(Status))
1149  {
1151  return FALSE;
1152  }
1153 
1154  return TRUE;
1155 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:611
#define NULL
Definition: types.h:112
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

Referenced by test_ws_functions().

◆ InitializeProcessForWsWatch()

BOOL WINAPI InitializeProcessForWsWatch ( HANDLE  )

Definition at line 1111 of file psapi.c.

1112 {
1113  NTSTATUS Status;
1114 
1115  /* Simply forward the call */
1118  NULL,
1119  0);
1120  /* In case the function returns this, MS considers the call as a success */
1122  {
1123  return TRUE;
1124  }
1125 
1127  return FALSE;
1128 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define SetLastError(x)
Definition: compat.h:611
NTSTATUS NTAPI NtSetInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength)
Definition: query.c:1107
#define NULL
Definition: types.h:112
#define STATUS_PORT_ALREADY_SET
Definition: ntstatus.h:308

Referenced by test_ws_functions().

◆ QueryWorkingSet()

BOOL WINAPI QueryWorkingSet ( HANDLE  ,
PVOID  ,
DWORD   
)

Definition at line 1613 of file psapi.c.

1616 {
1617  NTSTATUS Status;
1618 
1619  /* Simply forward the call */
1621  NULL,
1623  pv,
1624  cb,
1625  NULL);
1626  if (!NT_SUCCESS(Status))
1627  {
1629  return FALSE;
1630  }
1631 
1632  return TRUE;
1633 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtQueryVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN MEMORY_INFORMATION_CLASS MemoryInformationClass, OUT PVOID MemoryInformation, IN SIZE_T MemoryInformationLength, OUT PSIZE_T ReturnLength)
Definition: virtual.c:4320
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:611
#define NULL
Definition: types.h:112
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

Referenced by test_ws_functions().