[APITESTS] Centrally define AllocateGuarded/FreeGuarded instead of duplicating them.
[reactos.git] / modules / rostests / apitests / ntdll / RtlBitmap.c
index e524872..355ccee 100644 (file)
@@ -4,53 +4,6 @@
 
 static BOOL IsBroken = FALSE;
 
-static
-PVOID
-AllocateGuarded(
-    _In_ SIZE_T SizeRequested)
-{
-    NTSTATUS Status;
-    SIZE_T Size = PAGE_ROUND_UP(SizeRequested + PAGE_SIZE);
-    PVOID VirtualMemory = NULL;
-    PCHAR StartOfBuffer;
-
-    Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_RESERVE, PAGE_NOACCESS);
-
-    if (!NT_SUCCESS(Status))
-        return NULL;
-
-    Size -= PAGE_SIZE;
-    if (Size)
-    {
-        Status = NtAllocateVirtualMemory(NtCurrentProcess(), &VirtualMemory, 0, &Size, MEM_COMMIT, PAGE_READWRITE);
-        if (!NT_SUCCESS(Status))
-        {
-            Size = 0;
-            Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE);
-            ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
-            return NULL;
-        }
-    }
-
-    StartOfBuffer = VirtualMemory;
-    StartOfBuffer += Size - SizeRequested;
-
-    return StartOfBuffer;
-}
-
-static
-VOID
-FreeGuarded(
-    _In_ PVOID Pointer)
-{
-    NTSTATUS Status;
-    PVOID VirtualMemory = (PVOID)PAGE_ROUND_DOWN((SIZE_T)Pointer);
-    SIZE_T Size = 0;
-
-    Status = NtFreeVirtualMemory(NtCurrentProcess(), &VirtualMemory, &Size, MEM_RELEASE);
-    ok(Status == STATUS_SUCCESS, "Status = %lx\n", Status);
-}
-
 void
 Test_RtlFindMostSignificantBit(void)
 {