mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
- Implement VirtualMemoryInformationClass of MemorySectionName for NtQueryVirtualMemory.
svn path=/trunk/; revision=37073
This commit is contained in:
parent
dfaa1abe89
commit
2964e2ab1a
1 changed files with 55 additions and 7 deletions
|
@ -947,6 +947,9 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
SIZE_T ResultLength = 0;
|
SIZE_T ResultLength = 0;
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
|
WCHAR ModuleFileNameBuffer[MAX_PATH] = {0};
|
||||||
|
UNICODE_STRING ModuleFileName;
|
||||||
|
PMEMORY_SECTION_NAME SectionName = NULL;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
MEMORY_BASIC_INFORMATION BasicInfo;
|
MEMORY_BASIC_INFORMATION BasicInfo;
|
||||||
|
@ -985,13 +988,58 @@ NtQueryVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = MiQueryVirtualMemory(ProcessHandle,
|
/* FIXME: Move this inside MiQueryVirtualMemory */
|
||||||
Address,
|
if (VirtualMemoryInformationClass == MemorySectionName)
|
||||||
VirtualMemoryInformationClass,
|
{
|
||||||
&VirtualMemoryInfo,
|
RtlInitEmptyUnicodeString(&ModuleFileName, ModuleFileNameBuffer, sizeof(ModuleFileNameBuffer));
|
||||||
Length,
|
Status = MmGetFileNameForAddress(Address, &ModuleFileName);
|
||||||
&ResultLength );
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SectionName = VirtualMemoryInformation;
|
||||||
|
if (PreviousMode != KernelMode)
|
||||||
|
{
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
|
RtlInitUnicodeString(&SectionName->SectionFileName, SectionName->NameBuffer);
|
||||||
|
SectionName->SectionFileName.MaximumLength = Length;
|
||||||
|
RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName);
|
||||||
|
|
||||||
|
if (UnsafeResultLength != NULL)
|
||||||
|
{
|
||||||
|
*UnsafeResultLength = ModuleFileName.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RtlInitUnicodeString(&SectionName->SectionFileName, SectionName->NameBuffer);
|
||||||
|
SectionName->SectionFileName.MaximumLength = Length;
|
||||||
|
RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName);
|
||||||
|
|
||||||
|
if (UnsafeResultLength != NULL)
|
||||||
|
{
|
||||||
|
*UnsafeResultLength = ModuleFileName.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = MiQueryVirtualMemory(ProcessHandle,
|
||||||
|
Address,
|
||||||
|
VirtualMemoryInformationClass,
|
||||||
|
&VirtualMemoryInfo,
|
||||||
|
Length,
|
||||||
|
&ResultLength);
|
||||||
|
}
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if (PreviousMode != KernelMode)
|
if (PreviousMode != KernelMode)
|
||||||
|
|
Loading…
Reference in a new issue