Author: jgardou
Date: Fri Aug 26 21:08:24 2016
New Revision: 72468
URL:
http://svn.reactos.org/svn/reactos?rev=72468&view=rev
Log:
[NTDLL_APITEST]
- Add some tests which show how Windows handles the ZeroBits argument
Modified:
trunk/rostests/apitests/ntdll/NtMapViewOfSection.c
Modified: trunk/rostests/apitests/ntdll/NtMapViewOfSection.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/NtMapViewO…
==============================================================================
--- trunk/rostests/apitests/ntdll/NtMapViewOfSection.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/NtMapViewOfSection.c [iso-8859-1] Fri Aug 26 21:08:24
2016
@@ -81,6 +81,88 @@
MEM_COMMIT,
PAGE_READWRITE);
ok_ntstatus(Status, STATUS_INVALID_PARAMETER_9);
+
+ /* Try to map 1 page, with free base address and zero bits compatible with 64k
granularity */
+ BaseAddress = NULL;
+ SectionOffset.QuadPart = 0;
+ ViewSize = 0x1000;
+ Status = NtMapViewOfSection(SectionHandle,
+ NtCurrentProcess(),
+ &BaseAddress,
+ 10,
+ 0,
+ &SectionOffset,
+ &ViewSize,
+ ViewShare,
+ 0,
+ PAGE_READWRITE);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+
+{
+ ULONG_PTR gran = 64 * 1024;
+ ULONG_PTR ZeroBits = 11;
+
+ ok_hex(gran, 0x10000);
+ gran <<= ZeroBits;
+ ok_hex(gran, 0x8000000);
+ gran >>= ZeroBits;
+ ok_hex(gran, 0x10000);
+
+ ok_hex((gran << ZeroBits) >> ZeroBits, gran);
+
+}
+
+ /* Try to map 1 page, with free base address and zero bits incompatible with 64k
granularity */
+ BaseAddress = NULL;
+ SectionOffset.QuadPart = 0;
+ ViewSize = 0x1000;
+ Status = NtMapViewOfSection(SectionHandle,
+ NtCurrentProcess(),
+ &BaseAddress,
+ 11,
+ 0,
+ &SectionOffset,
+ &ViewSize,
+ ViewShare,
+ 0,
+ PAGE_READWRITE);
+ ok_ntstatus(Status, STATUS_NO_MEMORY);
+
+ /* Try to map 1 page, with base address and zero bits being compatible */
+ BaseAddress = (PVOID)0x30000000;
+ SectionOffset.QuadPart = 0;
+ ViewSize = 0x1000;
+ Status = NtMapViewOfSection(SectionHandle,
+ NtCurrentProcess(),
+ &BaseAddress,
+ 2,
+ 0,
+ &SectionOffset,
+ &ViewSize,
+ ViewShare,
+ 0,
+ PAGE_READWRITE);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+
+ /* Try to map 1 page, with base address and zero bits being incompatible */
+ BaseAddress = (PVOID)0x30000000;
+ SectionOffset.QuadPart = 0;
+ ViewSize = 0x1000;
+ Status = NtMapViewOfSection(SectionHandle,
+ NtCurrentProcess(),
+ &BaseAddress,
+ 3,
+ 0,
+ &SectionOffset,
+ &ViewSize,
+ ViewShare,
+ 0,
+ PAGE_READWRITE);
+ ok_ntstatus(Status, STATUS_INVALID_PARAMETER_4);
/* Map 2 pages, without MEM_COMMIT */
BaseAddress = (PVOID)0x30000000;