This commit is contained in:
Serge Gautherie 2024-05-14 11:54:28 -06:00 committed by GitHub
commit 86c1cc8b71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 75 additions and 63 deletions

View file

@ -1261,17 +1261,18 @@ MiLoadUserSymbols(IN PCONTROL_AREA ControlArea,
NTSTATUS
NTAPI
MiMapViewOfDataSection(IN PCONTROL_AREA ControlArea,
IN PEPROCESS Process,
IN PVOID *BaseAddress,
IN PLARGE_INTEGER SectionOffset,
IN PSIZE_T ViewSize,
IN PSECTION Section,
IN SECTION_INHERIT InheritDisposition,
IN ULONG ProtectionMask,
IN SIZE_T CommitSize,
IN ULONG_PTR ZeroBits,
IN ULONG AllocationType)
MiMapViewOfDataSection(
_In_ PCONTROL_AREA ControlArea,
_In_ PEPROCESS Process,
_Outptr_result_bytebuffer_(*ViewSize) _Pre_opt_valid_ PVOID *BaseAddress,
_Inout_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_ PSECTION Section,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG ProtectionMask,
_In_ SIZE_T CommitSize,
_In_ ULONG_PTR ZeroBits,
_In_ ULONG AllocationType)
{
PMMVAD_LONG Vad;
ULONG_PTR StartAddress;
@ -2893,16 +2894,20 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
*/
NTSTATUS
NTAPI
MmMapViewOfArm3Section(IN PVOID SectionObject,
IN PEPROCESS Process,
IN OUT PVOID *BaseAddress,
IN ULONG_PTR ZeroBits,
IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN ULONG AllocationType,
IN ULONG Protect)
MmMapViewOfArm3Section(
_In_ PVOID SectionObject,
_In_ PEPROCESS Process,
_Outptr_result_bytebuffer_(*ViewSize)
_When_(*ViewSize != 0, _Pre_opt_valid_)
_When_(*ViewSize == 0, _Pre_valid_)
PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG Protect)
{
KAPC_STATE ApcState;
BOOLEAN Attached = FALSE;
@ -3619,16 +3624,17 @@ NtOpenSection(OUT PHANDLE SectionHandle,
NTSTATUS
NTAPI
NtMapViewOfSection(IN HANDLE SectionHandle,
IN HANDLE ProcessHandle,
IN OUT PVOID* BaseAddress,
IN ULONG_PTR ZeroBits,
IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN ULONG AllocationType,
IN ULONG Protect)
NtMapViewOfSection(
_In_ HANDLE SectionHandle,
_In_ HANDLE ProcessHandle,
_Outptr_result_bytebuffer_(*ViewSize) _Pre_valid_ PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_opt_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG Win32Protect)
{
PVOID SafeBaseAddress;
LARGE_INTEGER SafeSectionOffset;
@ -3662,7 +3668,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
}
/* Convert the protection mask, and validate it */
ProtectionMask = MiMakeProtectionMask(Protect);
ProtectionMask = MiMakeProtectionMask(Win32Protect);
if (ProtectionMask == MM_INVALID_PROTECTION)
{
DPRINT1("Invalid page protection\n");
@ -3805,7 +3811,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
&SafeViewSize,
InheritDisposition,
AllocationType,
Protect);
Win32Protect);
/* Return data only on success */
if (NT_SUCCESS(Status))

View file

@ -144,16 +144,20 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
NTSTATUS
NTAPI
MmMapViewOfArm3Section(IN PVOID SectionObject,
IN PEPROCESS Process,
IN OUT PVOID *BaseAddress,
IN ULONG_PTR ZeroBits,
IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN ULONG AllocationType,
IN ULONG Protect);
MmMapViewOfArm3Section(
_In_ PVOID SectionObject,
_In_ PEPROCESS Process,
_Outptr_result_bytebuffer_(*ViewSize)
_When_(*ViewSize != 0, _Pre_opt_valid_)
_When_(*ViewSize == 0, _Pre_valid_)
PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG Protect);
//
// PeFmtCreateSection depends on the following:
@ -3993,16 +3997,17 @@ NtQuerySection(
* @implemented
*/
NTSTATUS NTAPI
MmMapViewOfSection(IN PVOID SectionObject,
IN PEPROCESS Process,
IN OUT PVOID *BaseAddress,
IN ULONG_PTR ZeroBits,
IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN ULONG AllocationType,
IN ULONG Protect)
MmMapViewOfSection(
_In_ PVOID SectionObject,
_In_ PEPROCESS Process,
_Outptr_result_bytebuffer_(*ViewSize) _Pre_opt_valid_ PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_opt_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG Protect)
{
PSECTION Section;
PMMSUPPORT AddressSpace;
@ -4014,6 +4019,7 @@ MmMapViewOfSection(IN PVOID SectionObject,
if (MiIsRosSectionObject(SectionObject) == FALSE)
{
DPRINT("Mapping ARM3 section into %s\n", Process->ImageFileName);
ASSERT(SectionOffset != NULL);
return MmMapViewOfArm3Section(SectionObject,
Process,
BaseAddress,

View file

@ -48,12 +48,12 @@ NTAPI
MmMapViewOfSection(
_In_ PVOID SectionObject,
_In_ PEPROCESS Process,
_Inout_ PVOID *BaseAddress,
_Outptr_result_bytebuffer_(*ViewSize) _Pre_opt_valid_ PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_opt_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_ SECTION_INHERIT InheritDisposition,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG Protect
);
@ -217,14 +217,14 @@ NTAPI
NtMapViewOfSection(
_In_ HANDLE SectionHandle,
_In_ HANDLE ProcessHandle,
_Inout_ PVOID *BaseAddress,
_Outptr_result_bytebuffer_(*ViewSize) _Pre_valid_ PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_opt_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_ SECTION_INHERIT InheritDisposition,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG AccessProtection
_In_ ULONG Win32Protect
);
NTSYSCALLAPI
@ -401,12 +401,12 @@ NTAPI
ZwMapViewOfSection(
_In_ HANDLE SectionHandle,
_In_ HANDLE ProcessHandle,
_Outptr_result_bytebuffer_(*ViewSize) PVOID *BaseAddress,
_Outptr_result_bytebuffer_(*ViewSize) _Pre_valid_ PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_opt_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_ SECTION_INHERIT InheritDisposition,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG Win32Protect
);

View file

@ -211,14 +211,14 @@ NTAPI
ZwMapViewOfSection(
_In_ HANDLE SectionHandle,
_In_ HANDLE ProcessHandle,
_Outptr_result_bytebuffer_(*ViewSize) PVOID *BaseAddress,
_Outptr_result_bytebuffer_(*ViewSize) _Pre_valid_ PVOID *BaseAddress,
_In_ ULONG_PTR ZeroBits,
_In_ SIZE_T CommitSize,
_Inout_opt_ PLARGE_INTEGER SectionOffset,
_Inout_ PSIZE_T ViewSize,
_In_ SECTION_INHERIT InheritDisposition,
_In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition,
_In_ ULONG AllocationType,
_In_ ULONG Protect);
_In_ ULONG Win32Protect);
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSYSAPI