mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
[NTDLL_APITEST]
- Add a test showing that memory content is still available after changing protection to PAGE_NOACCESS svn path=/trunk/; revision=63678
This commit is contained in:
parent
0f7a53e999
commit
265497886f
|
@ -90,6 +90,27 @@ START_TEST(NtProtectVirtualMemory)
|
|||
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(),
|
||||
(void**)&allocationStart,
|
||||
|
|
Loading…
Reference in a new issue