#include <stdlib.h>
#include <string.h>
#include <ddk/ntddk.h>
-#include <internal/psapi.h>
+#include <epsapi.h>
/* EmptyWorkingSet */
BOOL STDCALL EmptyWorkingSet(HANDLE hProcess)
/* callback routine */
NTSTATUS STDCALL EnumDeviceDriversCallback
(
- IN ULONG ModuleCount,
- IN PSYSTEM_MODULE_ENTRY CurrentModule,
+ IN PSYSTEM_MODULE_INFORMATION CurrentModule,
IN OUT PVOID CallbackContext
)
{
return STATUS_INFO_LENGTH_MISMATCH;
/* return current module */
- *(peddcContext->lpImageBase) = CurrentModule->BaseAddress;
+ *(peddcContext->lpImageBase) = CurrentModule->Base;
/* go to next array slot */
(peddcContext->lpImageBase) ++;
/* callback routine */
NTSTATUS STDCALL EnumProcessesCallback
(
- IN PSYSTEM_PROCESS_INFORMATION CurrentProcess,
+ IN PSYSTEM_PROCESSES CurrentProcess,
IN OUT PVOID CallbackContext
)
{
}
/* exported interface */
-/*
+/*!
@brief Enumerate the process identifiers of the currently active processes
@param lpidProcess Array that receives the list of process identifiers
}
/* enumerate the process ids */
- nErrCode = PsaEnumerateProcesses(&EnumProcessesCallback, &epcContext);
+ nErrCode = PsaEnumerateProcesses
+ (
+ &EnumProcessesCallback,
+ &epcContext
+ );
*lpcbNeeded = (cb - epcContext.nCount) * sizeof(DWORD);
/* common callback routine */
NTSTATUS STDCALL GetDeviceDriverNameCallback
(
- IN ULONG ModuleCount,
- IN PSYSTEM_MODULE_ENTRY CurrentModule,
+ IN PSYSTEM_MODULE_INFORMATION CurrentModule,
IN OUT PVOID CallbackContext
)
{
(PGET_DEVICE_DRIVER_NAME_CONTEXT) CallbackContext;
/* module found */
- if(pgddncContext->ImageBase == CurrentModule->BaseAddress)
+ if(pgddncContext->ImageBase == CurrentModule->Base)
{
register PCHAR pcModuleName;
register ULONG l;
/* get the full name or just the filename part */
if(pgddncContext->bFullName)
- pcModuleName = &CurrentModule->Name[0];
+ pcModuleName = &CurrentModule->ImageName[0];
else
- pcModuleName = &CurrentModule->Name[CurrentModule->PathLength];
+ pcModuleName = &CurrentModule->ImageName[CurrentModule->ModuleNameOffset];
/* get the length of the name */
l = strlen(pcModuleName);
nBufSize = nSize * sizeof(WCHAR);
/* allocate the memory */
- pmsnName = malloc(nBufSize + offsetof(MEMORY_SECTION_NAME, NameBuffer));
+ pmsnName = PsaiMalloc(nBufSize + offsetof(MEMORY_SECTION_NAME, NameBuffer));
if(pmsnName == NULL)
{
#if 0
#else
/* free the buffer */
- free(pmsnName);
+ PsaiFree(pmsnName);
#endif
return 0;
}
#if 0
#else
/* free the buffer */
- free(pmsnName);
+ PsaiFree(pmsnName);
#endif
if(pmsnName->SectionFileName.Length < nSize)
#if 0
#else
/* free the buffer */
- free(pmsnName);
+ PsaiFree(pmsnName);
#endif
if(strAnsi.Length < nSize)
}
__finally
{
- free(pmsnName);
+ PsaiFree(pmsnName);
}
#endif
}
UNICODE_STRING wstrUnicodeBuf;
/* allocate the local buffer */
- pwcUnicodeBuf = malloc(pwstrSource->Length);
+ pwcUnicodeBuf = PsaiMalloc(pwstrSource->Length);
#if 0
__try
__finally
{
/* free the buffer */
- free(pwcUnicodeBuf);
+ PsaiFree(pwcUnicodeBuf);
}
#else
/* success */
exitWithStatus:
/* free the buffer */
- free(pwcUnicodeBuf);
+ PsaiFree(pwcUnicodeBuf);
return nErrCode;
#endif
}