537{
553 struct
554 {
558 } *UserStruct;
561
563 if (
skip(MyPage !=
NULL,
"Out of memory\n"))
564 return;
570
572 if (
skip(ZeroPageContents !=
NULL,
"Out of memory\n"))
573 {
575 return;
576 }
578
581 {
584 return;
585 }
586
589
591 &SectionName,
592 0,
598 {
599
602 Status = ZwMapViewOfSection(SectionHandle,
605 0,
606 0,
607 &ZeroPagePhysical,
610 0,
614 {
617 ZeroPageContents,
622 }
623
624
627 Status = ZwMapViewOfSection(SectionHandle,
630 0,
631 0,
632 &ZeroPagePhysical,
635 0,
639 {
642 ZeroPageContents,
647 }
648
649
652 Status = ZwMapViewOfSection(SectionHandle,
655 0,
656 0,
657 &ZeroPagePhysical,
660 0,
664 {
667 ZeroPageContents,
672 }
673
674
677 Status = ZwMapViewOfSection(SectionHandle,
680 0,
681 0,
682 &MyPagePhysical,
685 0,
689 {
692 MyPage,
695
697 ok(MappingBytes[5] == 0x23,
"Mapping[5] = 0x%x\n", MappingBytes[5]);
698 ok(MyPage[5] == 0x23,
"MyPage[5] = 0x%x\n", MyPage[5]);
699
700 MyPage[5] = 0x44;
701 ok(MappingBytes[5] == 0x44,
"Mapping[5] = 0x%x\n", MappingBytes[5]);
702 ok(MyPage[5] == 0x44,
"MyPage[5] = 0x%x\n", MyPage[5]);
703
704 MappingBytes[5] = 0x88;
705 ok(MappingBytes[5] == 0x88,
"Mapping[5] = 0x%x\n", MappingBytes[5]);
706 ok(MyPage[5] == 0x88,
"MyPage[5] = 0x%x\n", MyPage[5]);
707
710 }
711
712
716 Status = ZwMapViewOfSection(SectionHandle,
719 0,
720 0,
724 0,
728 {
733
735 MyPage,
738
741 }
742
743
748 &UserMem,
749 0,
750 &UserSize,
755 UserStruct = UserMem;
756
757
759 &BasicInfo,
760 sizeof(BasicInfo),
764
765
769 Status = ZwMapViewOfSection(SectionHandle,
772 0,
773 0,
777 0,
782
783
784 if (!
skip(UserStruct !=
NULL,
"No user memory\n"))
785 {
791
795 0,
796 0,
800 0,
804 {
808 }
809 }
810
811
815 Status = ZwMapViewOfSection(SectionHandle,
818 0,
819 0,
823 0,
828
829
831 {
837
841 0,
842 0,
846 0,
853 {
857 }
858 }
859
860
864 Status = ZwMapViewOfSection(SectionHandle,
867 0,
868 0,
872 0,
877
878
880 {
886
890 0,
891 0,
895 0,
902 {
906 }
907 }
908
909
911 {
912 UserSize = 0;
914 &UserMem,
915 &UserSize,
918 }
919
922 }
923
924
930 Status = ZwCreateSection(&SectionHandle,
935 0x80000000,
940
941
943 {
954 0x80000000,
960 }
961
963 {
980 }
981
984}
NTSTATUS NTAPI 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)
#define ok_eq_ulong(value, expected)
#define ok_eq_size(value, expected)
void user(int argc, const char *argv[])
_In_ ULONG _In_ MEMORY_CACHING_TYPE _Out_ PPHYSICAL_ADDRESS PhysicalAddress
static PVOID Mapping[EMS_PHYSICAL_PAGES]
#define ExAllocatePoolWithTag(hernya, size, tag)
#define RtlCompareMemory(s1, s2, l)
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
#define ExFreePoolWithTag(_P, _T)
static char memory[1024 *256]
NTSYSAPI NTSTATUS NTAPI ZwOpenSection(_Out_ PHANDLE SectionHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
#define SECTION_ALL_ACCESS
#define NtCurrentProcess()
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
#define RtlFillMemory(Dest, Length, Fill)
#define RtlCopyMemory(Destination, Source, Length)
#define PAGE_WRITECOMBINE
#define ZwCurrentProcess()