23 (
void**)&allocationStart,
32 (
void**)&allocationStart,
42 *allocationStart = 0xFF;
48 ok(*allocationStart == 0xFF,
"Memory was not written\n");
53 (
void**)&allocationStart,
58 ok(oldProtection ==
PAGE_READWRITE,
"Expected PAGE_READWRITE, got %08lx.\n", oldProtection);
63 *allocationStart = 0xAA;
69 ok(*allocationStart == 0xFF,
"read-only memory were changed.\n");
74 (
void**)&allocationStart,
79 ok(oldProtection ==
PAGE_READONLY,
"Expected PAGE_READONLY, got %08lx.\n", oldProtection);
84 *allocationStart = 0xAA;
90 ok(*allocationStart == 0,
"Test should not go as far as this.\n");
95 (
void**)&allocationStart,
100 ok(oldProtection ==
PAGE_NOACCESS,
"Expected PAGE_READONLY, got %08lx.\n", oldProtection);
105 *allocationStart = 0xAA;
111 ok(*allocationStart == 0xFF,
"Memory content was not preserved.\n");
116 (
void**)&allocationStart,
130 ULONG Iteration, PageNumber;
134 for (Iteration = 0; Iteration < 50000; Iteration++)
150 for (PageNumber = 0; PageNumber < 16; PageNumber++)
155 "[%lu, %lu] Got non-zero memory. %x at %p\n",
156 Iteration, PageNumber, *
Page,
Page);
static void TestReadWrite(void)
static void TestFreeNoAccess(void)
#define EndSeh(ExpectedStatus)
#define ok_hex(expression, result)
#define ok_ntstatus(status, expected)
#define NT_SUCCESS(StatCode)
#define NtCurrentProcess()
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
NTSTATUS NTAPI NtFreeVirtualMemory(IN HANDLE ProcessHandle, IN PVOID *UBaseAddress, IN PSIZE_T URegionSize, IN ULONG FreeType)
NTSTATUS NTAPI NtProtectVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UnsafeBaseAddress, IN OUT SIZE_T *UnsafeNumberOfBytesToProtect, IN ULONG NewAccessProtection, OUT PULONG UnsafeOldAccessProtection)
NTSTATUS NTAPI NtAllocateVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UBaseAddress, IN ULONG_PTR ZeroBits, IN OUT PSIZE_T URegionSize, IN ULONG AllocationType, IN ULONG Protect)
#define STATUS_ACCESS_VIOLATION
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size