Rob Shearman : advapi32: Add some tests for ACL functions.

Alexandre Julliard julliard at winehq.org
Tue Oct 23 13:14:38 CDT 2007


Module: wine
Branch: master
Commit: 866ec270444ccb1f1cc53ca052a02388fdea4844
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=866ec270444ccb1f1cc53ca052a02388fdea4844

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Oct 23 13:38:47 2007 +0100

advapi32: Add some tests for ACL functions.

---

 dlls/advapi32/tests/security.c |   44 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 7f5728e..62463a7 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -2272,6 +2272,49 @@ static void test_PrivateObjectSecurity(void)
 #undef CHECK_RESULT_AND_FREE
 #undef CHECK_ONE_OF_AND_FREE
 
+static void test_acls(void)
+{
+    char buffer[256];
+    PACL pAcl = (PACL)buffer;
+    BOOL ret;
+
+    SetLastError(0xdeadbeef);
+    ret = InitializeAcl(pAcl, sizeof(ACL) - 1, ACL_REVISION);
+    ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InitializeAcl with too small a buffer should have failed with ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = InitializeAcl(pAcl, 0xffffffff, ACL_REVISION);
+    ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "InitializeAcl with too large a buffer should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION1);
+    ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "InitializeAcl(ACL_REVISION1) should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
+
+    ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION2);
+    ok(ret, "InitializeAcl(ACL_REVISION2) failed with error %d\n", GetLastError());
+
+    ret = IsValidAcl(pAcl);
+    ok(ret, "IsValidAcl failed with error %d\n", GetLastError());
+
+    ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION3);
+    ok(ret, "InitializeAcl(ACL_REVISION3) failed with error %d\n", GetLastError());
+
+    ret = IsValidAcl(pAcl);
+    todo_wine
+    ok(ret, "IsValidAcl failed with error %d\n", GetLastError());
+
+    ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION4);
+    ok(ret, "InitializeAcl(ACL_REVISION4) failed with error %d\n", GetLastError());
+
+    ret = IsValidAcl(pAcl);
+    todo_wine
+    ok(ret, "IsValidAcl failed with error %d\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    ret = InitializeAcl(pAcl, sizeof(buffer), -1);
+    ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "InitializeAcl(-1) failed with error %d\n", GetLastError());
+}
+
 START_TEST(security)
 {
     init();
@@ -2299,4 +2342,5 @@ START_TEST(security)
     test_ConvertStringSecurityDescriptor();
     test_ConvertSecurityDescriptorToString();
     test_PrivateObjectSecurity();
+    test_acls();
 }




More information about the wine-cvs mailing list