advapi32: LookupAccountSidW() - handle first user account.

This commit is contained in:
Paul Bryan Roberts 2008-10-18 21:53:24 +01:00 committed by Alexandre Julliard
parent 0e6626958f
commit 2981650435
1 changed files with 14 additions and 6 deletions

View File

@ -38,6 +38,7 @@
#include "objbase.h"
#include "iads.h"
#include "advapi32_misc.h"
#include "lmcons.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@ -1953,12 +1954,6 @@ LookupAccountSidA(
DWORD accountSizeW = *accountSize;
DWORD domainSizeW = *domainSize;
TRACE("(%s,sid=%s,%p,%p(%u),%p,%p(%u),%p)\n",
debugstr_a(system),debugstr_sid(sid),
account,accountSize,accountSize?*accountSize:0,
domain,domainSize,domainSize?*domainSize:0,
name_use);
if (system) {
len = MultiByteToWideChar( CP_ACP, 0, system, -1, NULL, 0 );
systemW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
@ -2022,6 +2017,7 @@ LookupAccountSidW(
const WCHAR * dm = NULL;
SID_NAME_USE use = 0;
LPWSTR computer_name = NULL;
LPWSTR account_name = NULL;
TRACE("(%s,sid=%s,%p,%p(%u),%p,%p(%u),%p)\n",
debugstr_w(system),debugstr_sid(sid),
@ -2107,6 +2103,16 @@ LookupAccountSidW(
break;
case DOMAIN_ALIAS_RID_RAS_SERVERS:
ac = RAS_and_IAS_Servers;
break;
case 1000: /* first user account */
size = UNLEN + 1;
account_name = HeapAlloc(
GetProcessHeap(), 0, size * sizeof(WCHAR));
if (GetUserNameW(account_name, &size))
ac = account_name;
else
dm = NULL;
break;
default:
dm = NULL;
@ -2145,10 +2151,12 @@ LookupAccountSidW(
else
*accountSize = ac_len + 1;
*name_use = use;
HeapFree(GetProcessHeap(), 0, account_name);
HeapFree(GetProcessHeap(), 0, computer_name);
return status;
}
HeapFree(GetProcessHeap(), 0, account_name);
HeapFree(GetProcessHeap(), 0, computer_name);
SetLastError(ERROR_NONE_MAPPED);
return FALSE;