Commit d7027336 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

ntdll/tests: Add RtlFirstFreeAce tests.

parent 0cc26c12
......@@ -3682,6 +3682,54 @@ static void test_RtlDestroyHeap(void)
RtlRemoveVectoredExceptionHandler( handler );
}
static void test_RtlFirstFreeAce(void)
{
PACL acl;
PACE_HEADER first;
BOOL ret;
DWORD size;
BOOLEAN found;
size = sizeof(ACL) + (sizeof(ACCESS_ALLOWED_ACE));
acl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
ret = InitializeAcl(acl, sizeof(ACL), ACL_REVISION);
ok(ret, "InitializeAcl failed with error %ld\n", GetLastError());
/* AceCount = 0 */
first = (ACE_HEADER *)0xdeadbeef;
found = RtlFirstFreeAce(acl, &first);
ok(found, "RtlFirstFreeAce failed\n");
ok(first == (PACE_HEADER)(acl + 1), "Failed to find ACL\n");
acl->AclSize = sizeof(ACL) - 1;
first = (ACE_HEADER *)0xdeadbeef;
found = RtlFirstFreeAce(acl, &first);
ok(found, "RtlFirstFreeAce failed\n");
ok(first == NULL, "Found FirstAce = %p\n", first);
/* AceCount = 1 */
acl->AceCount = 1;
acl->AclSize = size;
first = (ACE_HEADER *)0xdeadbeef;
found = RtlFirstFreeAce(acl, &first);
ok(found, "RtlFirstFreeAce failed\n");
ok(first == (PACE_HEADER)(acl + 1), "Failed to find ACL %p, %p\n", first, (PACE_HEADER)(acl + 1));
acl->AclSize = sizeof(ACL) - 1;
first = (ACE_HEADER *)0xdeadbeef;
found = RtlFirstFreeAce(acl, &first);
ok(!found, "RtlFirstFreeAce failed\n");
ok(first == NULL, "Found FirstAce = %p\n", first);
acl->AclSize = sizeof(ACL);
first = (ACE_HEADER *)0xdeadbeef;
found = RtlFirstFreeAce(acl, &first);
ok(!found, "RtlFirstFreeAce failed\n");
ok(first == NULL, "Found FirstAce = %p\n", first);
HeapFree(GetProcessHeap(), 0, acl);
}
START_TEST(rtl)
{
InitFunctionPtrs();
......@@ -3725,4 +3773,5 @@ START_TEST(rtl)
test_LdrRegisterDllNotification();
test_DbgPrint();
test_RtlDestroyHeap();
test_RtlFirstFreeAce();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment