advapi32: Return the computer name as referenced domain name in LookupAccountName.
Hans Leidekker
hans at codeweavers.com
Fri Dec 10 05:53:25 CST 2010
This is what native does when the computer is not joined to a domain.
---
dlls/advapi32/security.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 0458033..e24d90f 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -2629,9 +2629,8 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo
HANDLE token;
BOOL ret;
PSID pSid;
- static const WCHAR dm[] = {'D','O','M','A','I','N',0};
+ WCHAR domainName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD nameLen;
- LPCWSTR domainName;
if (!OpenThreadToken(GetCurrentThread(), TOKEN_READ, TRUE, &token))
{
@@ -2655,9 +2654,12 @@ static BOOL lookup_user_account_name(PSID Sid, PDWORD cbSid, LPWSTR ReferencedDo
}
*cbSid = GetLengthSid(pSid);
- domainName = dm;
- nameLen = strlenW(domainName);
-
+ nameLen = MAX_COMPUTERNAME_LENGTH + 1;
+ if (!GetComputerNameW(domainName, &nameLen))
+ {
+ domainName[0] = 0;
+ nameLen = 0;
+ }
if (*cchReferencedDomainName <= nameLen || !ret)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
@@ -2683,9 +2685,8 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc
{
MAX_SID local;
BOOL ret;
- static const WCHAR dm[] = {'D','O','M','A','I','N',0};
+ WCHAR domainName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD nameLen;
- LPCWSTR domainName;
if ((ret = ADVAPI_GetComputerSid(&local)))
{
@@ -2699,9 +2700,12 @@ static BOOL lookup_computer_account_name(PSID Sid, PDWORD cbSid, LPWSTR Referenc
*cbSid = GetLengthSid(&local);
}
- domainName = dm;
- nameLen = strlenW(domainName);
-
+ nameLen = MAX_COMPUTERNAME_LENGTH + 1;
+ if (!GetComputerNameW(domainName, &nameLen))
+ {
+ domainName[0] = 0;
+ nameLen = 0;
+ }
if (*cchReferencedDomainName <= nameLen || !ret)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
@@ -2898,11 +2902,12 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI
BOOL ret, handled;
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);
if (!ADVAPI_IsLocalComputer( lpSystemName ))
{
+ FIXME("remote computer not supported\n");
SetLastError( RPC_S_SERVER_UNAVAILABLE );
return FALSE;
}
--
1.7.1
More information about the wine-patches
mailing list