Rob Shearman : advapi32: Implement LookupAccountNameW for well-known groups .

Alexandre Julliard julliard at winehq.org
Wed Jan 23 05:25:03 CST 2008


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Jan 22 15:37:01 2008 +0000

advapi32: Implement LookupAccountNameW for well-known groups.

---

 dlls/advapi32/security.c       |   13 +++++++++++++
 dlls/advapi32/tests/security.c |   17 ++++++-----------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index d51a22a..b8c0a31 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -2478,10 +2478,23 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
     BOOL ret;
     PSID pSid;
     static const WCHAR dm[] = {'D','O','M','A','I','N',0};
+    unsigned int i;
 
     FIXME("%s %s %p %p %p %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpAccountName),
           Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse);
 
+    for (i = 0; i < (sizeof(ACCOUNT_SIDS) / sizeof(ACCOUNT_SIDS[0])); i++)
+    {
+        if (!strcmpW(lpAccountName, ACCOUNT_SIDS[i].account))
+        {
+            if (*cchReferencedDomainName)
+                *ReferencedDomainName = '\0';
+            *cchReferencedDomainName = 0;
+            *peUse = SidTypeWellKnownGroup;
+            return CreateWellKnownSid(ACCOUNT_SIDS[i].type, NULL, Sid, cbSid);
+        }
+    }
+
     ret = AllocateAndInitializeSid(&identifierAuthority,
         2,
         SECURITY_BUILTIN_DOMAIN_RID,
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 4476c3a..6b43cb3 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -1547,14 +1547,13 @@ static void test_LookupAccountName(void)
     get_sid_info(psid, &account, &sid_dom);
     ok(ret, "Failed to lookup account name\n");
     ok(sid_size != 0, "sid_size was zero\n");
+    ok(!lstrcmp(account, "Everyone"), "Expected Everyone, got %s\n", account);
     todo_wine
-    {
-        ok(!lstrcmp(account, "Everyone"), "Expected %s, got %s\n", user_name, account);
-        ok(!lstrcmp(domain, sid_dom), "Expected %s, got %s\n", sid_dom, domain);
-        ok(domain_size == 0, "Expected %d, got %d\n", domain_save - 1, domain_size);
-        ok(lstrlen(domain) == domain_size, "Expected %d\n", lstrlen(domain));
-        ok(sid_use == SidTypeWellKnownGroup, "Expected SidTypeUser, got %d\n", sid_use);
-    }
+    ok(!lstrcmp(domain, sid_dom), "Expected %s, got %s\n", sid_dom, domain);
+    ok(domain_size == 0, "Expected 0, got %d\n", domain_size);
+    todo_wine
+    ok(lstrlen(domain) == domain_size, "Expected %d, got %d\n", lstrlen(domain), domain_size);
+    ok(sid_use == SidTypeWellKnownGroup, "Expected SidTypeUser, got %d\n", sid_use);
     domain_size = domain_save;
 
     /* NULL Sid with zero sid size */
@@ -2048,9 +2047,7 @@ static void test_SetEntriesInAcl(void)
     ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_USER;
     ExplicitAccess.Trustee.ptstrName = (LPWSTR)wszEveryone;
     res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl);
-    todo_wine
     ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res);
-    todo_wine
     ok(NewAcl != NULL, "returned acl was NULL\n");
     LocalFree(NewAcl);
 
@@ -2070,9 +2067,7 @@ static void test_SetEntriesInAcl(void)
     ExplicitAccess.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
     ExplicitAccess.grfAccessMode = SET_ACCESS;
     res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl);
-    todo_wine
     ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res);
-    todo_wine
     ok(NewAcl != NULL, "returned acl was NULL\n");
     LocalFree(NewAcl);
 




More information about the wine-cvs mailing list