Alistair Leslie-Hughes : ntdll/tests: Add RtlFirstFreeAce tests.
Alexandre Julliard
julliard at winehq.org
Tue Jul 19 15:55:02 CDT 2022
Module: wine
Branch: master
Commit: d70273363be2e2abc5d5af17341a7e6a31156abb
URL: https://gitlab.winehq.org/wine/wine/-/commit/d70273363be2e2abc5d5af17341a7e6a31156abb
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon Jul 11 14:19:41 2022 +1000
ntdll/tests: Add RtlFirstFreeAce tests.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/ntdll/tests/rtl.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index aeae4e8adf3..2e0bfb650e4 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -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();
}
More information about the wine-cvs
mailing list