Author: jgardou
Date: Mon Jun 30 19:50:28 2014
New Revision: 63678
URL:
http://svn.reactos.org/svn/reactos?rev=63678&view=rev
Log:
[NTDLL_APITEST]
- Add a test showing that memory content is still available after changing protection to
PAGE_NOACCESS
Modified:
trunk/rostests/apitests/ntdll/NtProtectVirtualMemory.c
Modified: trunk/rostests/apitests/ntdll/NtProtectVirtualMemory.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/NtProtectV…
==============================================================================
--- trunk/rostests/apitests/ntdll/NtProtectVirtualMemory.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/NtProtectVirtualMemory.c [iso-8859-1] Mon Jun 30
19:50:28 2014
@@ -89,6 +89,27 @@
{
ok(*allocationStart == 0, "Test should not go as far as this.\n");
} EndSeh(STATUS_ACCESS_VIOLATION);
+
+ /* Set it as readable again */
+ status = NtProtectVirtualMemory(NtCurrentProcess(),
+ (void**)&allocationStart,
+ &allocationSize,
+ PAGE_READONLY,
+ &oldProtection);
+ ok(NT_SUCCESS(status), "NtProtectVirtualMemory failed.\n");
+ ok(oldProtection == PAGE_NOACCESS, "Expected PAGE_READONLY, got %08lx.\n",
oldProtection);
+
+ /* Try writing it */
+ StartSeh()
+ {
+ *allocationStart = 0xAA;
+ } EndSeh(STATUS_ACCESS_VIOLATION);
+
+ /* Try reading it */
+ StartSeh()
+ {
+ ok(*allocationStart == 0xFF, "Memory content was not preserved.\n");
+ } EndSeh(STATUS_SUCCESS);
/* Free memory */
status = NtFreeVirtualMemory(NtCurrentProcess(),
@@ -96,4 +117,4 @@
&allocationSize,
MEM_RELEASE);
ok(NT_SUCCESS(status), "Failed freeing memory.\n");
-}
+}