advapi32: add testcases for GetNamedSecurityInfo

Austin English austinenglish at gmail.com
Thu Apr 16 11:33:31 CDT 2009


Testing for bug 18071. Passes under Wine/2k.

-- 
-Austin
-------------- next part --------------
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index f8715e0..b26ff70 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -5053,6 +5053,8 @@ DWORD WINAPI GetNamedSecurityInfoA(LPSTR pObjectName,
     TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo,
         ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor);
 
+    if (!pObjectName || !ppSecurityDescriptor) return ERROR_INVALID_PARAMETER;
+
     if( pObjectName )
     {
         len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 );
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index ac848bb..7da546a 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -2548,6 +2548,30 @@ static void test_GetNamedSecurityInfoA(void)
     }
     ok(!error, "GetNamedSecurityInfo failed with error %d\n", error);
 
+    /* Test with a NULL descriptor */
+    SetLastError(0xdeadbeef);
+    error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,
+        OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION,
+        NULL, NULL, NULL, NULL, NULL);
+    if (error != ERROR_SUCCESS && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
+    {
+        win_skip("GetNamedSecurityInfoA is not implemented\n");
+        return;
+    }
+    ok(error == ERROR_INVALID_PARAMETER, "GetNamedSecurityInfoA should've returned ERROR_INVALID PARAMETER, got %d\n", error);
+
+    /* Test with descriptor = 0 */
+    SetLastError(0xdeadbeef);
+    error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,
+        OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION,
+        NULL, NULL, NULL, NULL, 0);
+    if (error != ERROR_SUCCESS && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
+    {
+        win_skip("GetNamedSecurityInfoA is not implemented\n");
+        return;
+    }
+    ok(error == ERROR_INVALID_PARAMETER, "GetNamedSecurityInfoA should've returned ERROR_INVALID PARAMETER, got %d\n", error);
+
     ret = GetSecurityDescriptorControl(pSecDesc, &control, &revision);
     ok(ret, "GetSecurityDescriptorControl failed with error %d\n", GetLastError());
     ok((control & (SE_SELF_RELATIVE|SE_DACL_PRESENT)) == (SE_SELF_RELATIVE|SE_DACL_PRESENT) ||


More information about the wine-patches mailing list