Hi ,
I am using ZwQueryInformationProcess() for getting process path/name.
I got access violation.
OS: XP SP2
Check the following code:
PVOID pvProcessPath = ExAllocatePoolWithTag(
NonPagedPool,
ulSizeOfProcessPath,
‘aaa’
);
if (NULL == pvProcessPath)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
ntStatus = ZwQueryInformationProcess(
hProcess,
(PROCESSINFOCLASS)27,
pvProcessPath,
ulSizeOfProcessPath,
&ulRetLen
);
if (!NT_SUCCESS(ntStatus))
{
ExFreePool(pvProcessPath);
return ntStatus;
}
pwszTempFilePath = (WCHAR *)ExAllocatePoolWithTag(
NonPagedPool,
500 * sizeof(WCHAR),
‘aaa’
);
if (NULL == pwszTempFilePath)
{
ExFreePool(pvProcessPath);
return STATUS_INSUFFICIENT_RESOURCES;
}
pwszFilePath = ((PUNICODE_STRING)pvProcessPath)->Buffer;
Any help will be appreciated.
Regards,
Sachin.