LookupAccountNameW() null account name handled
Paul Bryan Roberts
pbronline-wine at yahoo.co.uk
Thu Sep 25 18:18:28 CDT 2008
---
dlls/advapi32/security.c | 18 +++++++++++++++++-
dlls/advapi32/tests/security.c | 13 +++++--------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 8ab198f..9db49db 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -2528,11 +2528,27 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
FIXME("%s %s %p %p %p %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpAccountName),
Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse);
+ if (!lpAccountName || !strcmpW(lpAccountName, Blank))
+ {
+ lpAccountName = BUILTIN;
+ }
+
for (i = 0; i < (sizeof(ACCOUNT_SIDS) / sizeof(ACCOUNT_SIDS[0])); i++)
{
if (!strcmpW(lpAccountName, ACCOUNT_SIDS[i].account))
{
- ret = CreateWellKnownSid(ACCOUNT_SIDS[i].type, NULL, Sid, cbSid);
+ char sidBuffer [SECURITY_MAX_SID_SIZE];
+
+ size_t sidLen = SECURITY_MAX_SID_SIZE;
+
+ ret = CreateWellKnownSid(ACCOUNT_SIDS[i].type, NULL, sidBuffer, &sidLen);
+
+ if (ret && *cbSid >= sidLen)
+ {
+ CopySid(*cbSid, Sid, sidBuffer);
+ }
+
+ *cbSid = sidLen;
domainName = ACCOUNT_SIDS[i].domain;
nameLen = strlenW(domainName);
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index f46f89c..87fe422 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -1628,14 +1628,11 @@ static void test_LookupAccountName(void)
ret = LookupAccountNameA(NULL, NULL, psid, &sid_size, domain, &domain_size, &sid_use);
get_sid_info(psid, &account, &sid_dom);
ok(ret, "Failed to lookup account name\n");
- todo_wine
- {
- /* Using a fixed string will not work on different locales */
- ok(!lstrcmp(account, domain),
- "Got %s for account and %s for domain, these should be the same\n",
- account, domain);
- ok(sid_use == SidTypeDomain, "Expected SidTypeDomain, got %d\n", SidTypeDomain);
- }
+ /* Using a fixed string will not work on different locales */
+ ok(!lstrcmp(account, domain),
+ "Got %s for account and %s for domain, these should be the same\n",
+ account, domain);
+ ok(sid_use == SidTypeDomain, "Expected SidTypeDomain, got %d\n", SidTypeDomain);
/* try an invalid account name */
SetLastError(0xdeadbeef);
--
1.5.4.3
--------------040107070706070309020809--
More information about the wine-patches
mailing list