Commit b503bcf6 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

advapi32: Implement LookupAccountNameW for well-known groups.

parent 28cabdfe
...@@ -2478,10 +2478,23 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI ...@@ -2478,10 +2478,23 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
BOOL ret; BOOL ret;
PSID pSid; PSID pSid;
static const WCHAR dm[] = {'D','O','M','A','I','N',0}; 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), FIXME("%s %s %p %p %p %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpAccountName),
Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse); 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, ret = AllocateAndInitializeSid(&identifierAuthority,
2, 2,
SECURITY_BUILTIN_DOMAIN_RID, SECURITY_BUILTIN_DOMAIN_RID,
......
...@@ -1547,14 +1547,13 @@ static void test_LookupAccountName(void) ...@@ -1547,14 +1547,13 @@ static void test_LookupAccountName(void)
get_sid_info(psid, &account, &sid_dom); get_sid_info(psid, &account, &sid_dom);
ok(ret, "Failed to lookup account name\n"); ok(ret, "Failed to lookup account name\n");
ok(sid_size != 0, "sid_size was zero\n"); ok(sid_size != 0, "sid_size was zero\n");
ok(!lstrcmp(account, "Everyone"), "Expected Everyone, got %s\n", account);
todo_wine 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(!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(domain_size == 0, "Expected 0, got %d\n", domain_size);
ok(lstrlen(domain) == domain_size, "Expected %d\n", lstrlen(domain)); 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); ok(sid_use == SidTypeWellKnownGroup, "Expected SidTypeUser, got %d\n", sid_use);
}
domain_size = domain_save; domain_size = domain_save;
/* NULL Sid with zero sid size */ /* NULL Sid with zero sid size */
...@@ -2048,9 +2047,7 @@ static void test_SetEntriesInAcl(void) ...@@ -2048,9 +2047,7 @@ static void test_SetEntriesInAcl(void)
ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_USER; ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_USER;
ExplicitAccess.Trustee.ptstrName = (LPWSTR)wszEveryone; ExplicitAccess.Trustee.ptstrName = (LPWSTR)wszEveryone;
res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl); res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl);
todo_wine
ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res);
todo_wine
ok(NewAcl != NULL, "returned acl was NULL\n"); ok(NewAcl != NULL, "returned acl was NULL\n");
LocalFree(NewAcl); LocalFree(NewAcl);
...@@ -2070,9 +2067,7 @@ static void test_SetEntriesInAcl(void) ...@@ -2070,9 +2067,7 @@ static void test_SetEntriesInAcl(void)
ExplicitAccess.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; ExplicitAccess.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
ExplicitAccess.grfAccessMode = SET_ACCESS; ExplicitAccess.grfAccessMode = SET_ACCESS;
res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl); res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl);
todo_wine
ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res);
todo_wine
ok(NewAcl != NULL, "returned acl was NULL\n"); ok(NewAcl != NULL, "returned acl was NULL\n");
LocalFree(NewAcl); LocalFree(NewAcl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment