Commit f0085e63 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

advapi32: Fix LookupAccountSid and tests to pass on windows and wine.

parent ee32bd99
...@@ -1854,14 +1854,14 @@ LookupAccountSidA( ...@@ -1854,14 +1854,14 @@ LookupAccountSidA(
WideCharToMultiByte( CP_ACP, 0, accountW, -1, account, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, accountW, -1, account, len, NULL, NULL );
*accountSize = len; *accountSize = len;
} else } else
*accountSize = accountSizeW; *accountSize = accountSizeW + 1;
if (domainW && *domainSize) { if (domainW && *domainSize) {
len = WideCharToMultiByte( CP_ACP, 0, domainW, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, domainW, -1, NULL, 0, NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, domainW, -1, domain, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, domainW, -1, domain, len, NULL, NULL );
*domainSize = len; *domainSize = len;
} else } else
*domainSize = domainSizeW; *domainSize = domainSizeW + 1;
} }
HeapFree( GetProcessHeap(), 0, systemW ); HeapFree( GetProcessHeap(), 0, systemW );
...@@ -2007,10 +2007,16 @@ LookupAccountSidW( ...@@ -2007,10 +2007,16 @@ LookupAccountSidW(
} }
if (((*accountSize != 0) && (*accountSize < strlenW(ac))) || if (((*accountSize != 0) && (*accountSize < strlenW(ac))) ||
((*domainSize != 0) && (*domainSize < strlenW(dm)))) { ((*domainSize != 0) && (*domainSize < strlenW(dm)))) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_INSUFFICIENT_BUFFER);
status = FALSE; status = FALSE;
} }
if (*domainSize)
*domainSize = strlenW(dm);
else
*domainSize = strlenW(dm) + 1; *domainSize = strlenW(dm) + 1;
if (*accountSize)
*accountSize = strlenW(ac);
else
*accountSize = strlenW(ac) + 1; *accountSize = strlenW(ac) + 1;
*name_use = use; *name_use = use;
HeapFree(GetProcessHeap(), 0, computer_name); HeapFree(GetProcessHeap(), 0, computer_name);
......
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