Commit eba81476 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

advapi32: Return the computer name as referenced domain name in LookupAccountName.

parent b0c925cd
...@@ -2629,9 +2629,8 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo ...@@ -2629,9 +2629,8 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo
HANDLE token; HANDLE token;
BOOL ret; BOOL ret;
PSID pSid; PSID pSid;
static const WCHAR dm[] = {'D','O','M','A','I','N',0}; WCHAR domainName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD nameLen; DWORD nameLen;
LPCWSTR domainName;
if (!OpenThreadToken(GetCurrentThread(), TOKEN_READ, TRUE, &token)) if (!OpenThreadToken(GetCurrentThread(), TOKEN_READ, TRUE, &token))
{ {
...@@ -2655,9 +2654,12 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo ...@@ -2655,9 +2654,12 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo
} }
*cbSid = GetLengthSid(pSid); *cbSid = GetLengthSid(pSid);
domainName = dm; nameLen = MAX_COMPUTERNAME_LENGTH + 1;
nameLen = strlenW(domainName); if (!GetComputerNameW(domainName, &nameLen))
{
domainName[0] = 0;
nameLen = 0;
}
if (*cchReferencedDomainName <= nameLen || !ret) if (*cchReferencedDomainName <= nameLen || !ret)
{ {
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
...@@ -2683,9 +2685,8 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc ...@@ -2683,9 +2685,8 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc
{ {
MAX_SID local; MAX_SID local;
BOOL ret; BOOL ret;
static const WCHAR dm[] = {'D','O','M','A','I','N',0}; WCHAR domainName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD nameLen; DWORD nameLen;
LPCWSTR domainName;
if ((ret = ADVAPI_GetComputerSid(&local))) if ((ret = ADVAPI_GetComputerSid(&local)))
{ {
...@@ -2699,9 +2700,12 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc ...@@ -2699,9 +2700,12 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc
*cbSid = GetLengthSid(&local); *cbSid = GetLengthSid(&local);
} }
domainName = dm; nameLen = MAX_COMPUTERNAME_LENGTH + 1;
nameLen = strlenW(domainName); if (!GetComputerNameW(domainName, &nameLen))
{
domainName[0] = 0;
nameLen = 0;
}
if (*cchReferencedDomainName <= nameLen || !ret) if (*cchReferencedDomainName <= nameLen || !ret)
{ {
SetLastError(ERROR_INSUFFICIENT_BUFFER); SetLastError(ERROR_INSUFFICIENT_BUFFER);
...@@ -2898,11 +2902,12 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI ...@@ -2898,11 +2902,12 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
BOOL ret, handled; BOOL ret, handled;
LSA_UNICODE_STRING account; LSA_UNICODE_STRING account;
FIXME("%s %s %p %p %p %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpAccountName), TRACE("%s %s %p %p %p %p %p\n", debugstr_w(lpSystemName), debugstr_w(lpAccountName),
Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse); Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse);
if (!ADVAPI_IsLocalComputer( lpSystemName )) if (!ADVAPI_IsLocalComputer( lpSystemName ))
{ {
FIXME("remote computer not supported\n");
SetLastError( RPC_S_SERVER_UNAVAILABLE ); SetLastError( RPC_S_SERVER_UNAVAILABLE );
return FALSE; return FALSE;
} }
......
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