mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:43:00 +00:00
[NTOSKRNL] Simplify buffer definition in MiQueryMemorySectionName().
Also take into account the UNICODE_STRING structure while computing whole size This is based on Thomas' patch. CORE-12043
This commit is contained in:
parent
ad547c960f
commit
3b78ca210e
1 changed files with 8 additions and 6 deletions
|
@ -1923,11 +1923,12 @@ MiQueryMemorySectionName(IN HANDLE ProcessHandle,
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&SectionName->SectionFileName, SectionName->NameBuffer);
|
RtlInitEmptyUnicodeString(&SectionName->SectionFileName,
|
||||||
SectionName->SectionFileName.MaximumLength = (USHORT)MemoryInformationLength;
|
(PWSTR)(SectionName + 1),
|
||||||
|
MemoryInformationLength - sizeof(MEMORY_SECTION_NAME));
|
||||||
RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName);
|
RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName);
|
||||||
|
|
||||||
if (ReturnLength) *ReturnLength = ModuleFileName.Length;
|
if (ReturnLength) *ReturnLength = ModuleFileName.Length + sizeof(MEMORY_SECTION_NAME);
|
||||||
|
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
@ -1938,11 +1939,12 @@ MiQueryMemorySectionName(IN HANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&SectionName->SectionFileName, SectionName->NameBuffer);
|
RtlInitEmptyUnicodeString(&SectionName->SectionFileName,
|
||||||
SectionName->SectionFileName.MaximumLength = (USHORT)MemoryInformationLength;
|
(PWSTR)(SectionName + 1),
|
||||||
|
MemoryInformationLength - sizeof(MEMORY_SECTION_NAME));
|
||||||
RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName);
|
RtlCopyUnicodeString(&SectionName->SectionFileName, &ModuleFileName);
|
||||||
|
|
||||||
if (ReturnLength) *ReturnLength = ModuleFileName.Length;
|
if (ReturnLength) *ReturnLength = ModuleFileName.Length + sizeof(MEMORY_SECTION_NAME);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue