advapi32: add testcases for GetNamedSecurityInfo (try 2)

Austin English austinenglish at gmail.com
Fri Apr 17 11:11:07 CDT 2009


On Fri, Apr 17, 2009 at 4:24 AM, Paul Vriens <paul.vriens.wine at gmail.com> wrote:
> Austin English wrote:
>>
>> Changelog: Fixed Paul's concerns.
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
> Implementation piece is not needed as GetNamedSecurityInfoW already takes
> care of those parameters.
>
> The second test crashes on NT4. Instead of surrounding that with an if(0) I
> suggest to surround it with an if(pCreateWellKnownSid). That function is
> available as of W2K so we skip on NT4 (and we already skip on Win9x). I also
> suggest to add a win_skip() if you decide to take that route.
>
> --
> Cheers,
>
> Paul.
>



-- 
-Austin
-------------- next part --------------
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index f775d10..cb612ba 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -2569,6 +2569,25 @@ static void test_GetNamedSecurityInfoA(void)
     }
     ok(!error, "GetNamedSecurityInfo failed with error %d\n", error);
 
+    /* Test with a NULL ObjectName */
+    SetLastError(0xdeadbeef);
+    error = pGetNamedSecurityInfoA(NULL, SE_FILE_OBJECT,
+        OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION,
+        NULL, NULL, NULL, NULL, &pSecDesc);
+    ok(error == ERROR_INVALID_PARAMETER, "GetNamedSecurityInfoA should've returned ERROR_INVALID PARAMETER, got %d\n", error);
+
+    /* Test with a NULL descriptor */
+    if(!pCreateWellKnownSid) /* NT4 */
+    {
+        win_skip("CreateWellKnownSid is not present, skipping test\n");
+        return;
+    }
+    SetLastError(0xdeadbeef);
+    error = pGetNamedSecurityInfoA(windows_dir, SE_FILE_OBJECT,
+        OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION,
+        NULL, NULL, NULL, NULL, NULL);
+    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-devel mailing list