[FORMATTING]

No code changes.

svn path=/trunk/; revision=48146
This commit is contained in:
Eric Kohl 2010-07-20 20:48:11 +00:00
parent a9b1042fdf
commit 924ee8d9ef

View file

@ -812,6 +812,7 @@ GetUserNameW(LPWSTR lpszName,
as OpenThreadToken() ought to have set one */
return FALSE;
}
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
{
/* don't call SetLastError(),
@ -819,6 +820,7 @@ GetUserNameW(LPWSTR lpszName,
return FALSE;
}
}
tu_buf = LocalAlloc(LMEM_FIXED, 36);
if (!tu_buf)
{
@ -826,6 +828,7 @@ GetUserNameW(LPWSTR lpszName,
CloseHandle(hToken);
return FALSE;
}
if (!GetTokenInformation(hToken, TokenUser, tu_buf, 36, &tu_len) || tu_len > 36)
{
LocalFree(tu_buf);
@ -836,6 +839,7 @@ GetUserNameW(LPWSTR lpszName,
CloseHandle(hToken);
return FALSE;
}
if (!GetTokenInformation(hToken, TokenUser, tu_buf, tu_len, &tu_len))
{
/* don't call SetLastError(),
@ -845,6 +849,7 @@ GetUserNameW(LPWSTR lpszName,
return FALSE;
}
}
CloseHandle(hToken);
token_user = (TOKEN_USER*)tu_buf;
@ -857,6 +862,7 @@ GetUserNameW(LPWSTR lpszName,
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
if (!LookupAccountSidW(NULL, token_user->User.Sid, lpszName, &an_len, domain_name, &dn_len, &snu)
|| dn_len > 32)
{
@ -871,6 +877,7 @@ GetUserNameW(LPWSTR lpszName,
return FALSE;
}
}
an_len = *lpSize;
if (!LookupAccountSidW(NULL, token_user->User.Sid, lpszName, &an_len, domain_name, &dn_len, &snu))
{
@ -918,10 +925,7 @@ LookupAccountSidA(LPCSTR lpSystemName,
dwName = *cchName;
dwReferencedDomainName = *cchReferencedDomainName;
/*
* allocate buffers for the unicode strings to receive
*/
/* allocate buffers for the unicode strings to receive */
if (dwName > 0)
{
NameBuffer = (PWSTR)LocalAlloc(LMEM_FIXED, dwName);
@ -943,6 +947,7 @@ LookupAccountSidA(LPCSTR lpSystemName,
{
LocalFree(NameBuffer);
}
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
@ -950,10 +955,8 @@ LookupAccountSidA(LPCSTR lpSystemName,
else
ReferencedDomainNameBuffer = NULL;
/*
* convert the system name to unicode - if present
*/
/* convert the system name to unicode - if present */
if (lpSystemName != NULL)
{
ANSI_STRING SystemNameA;
@ -964,10 +967,7 @@ LookupAccountSidA(LPCSTR lpSystemName,
else
SystemNameW.Buffer = NULL;
/*
* it's time to call the unicode version
*/
/* it's time to call the unicode version */
Ret = LookupAccountSidW(SystemNameW.Buffer,
lpSid,
NameBuffer,
@ -1010,18 +1010,17 @@ LookupAccountSidA(LPCSTR lpSystemName,
}
}
/*
* free previously allocated buffers
*/
/* free previously allocated buffers */
if (SystemNameW.Buffer != NULL)
{
RtlFreeUnicodeString(&SystemNameW);
}
if (NameBuffer != NULL)
{
LocalFree(NameBuffer);
}
if (ReferencedDomainNameBuffer != NULL)
{
LocalFree(ReferencedDomainNameBuffer);
@ -1061,6 +1060,7 @@ LookupAccountSidW(LPCWSTR pSystemName,
SetLastError(LsaNtStatusToWinError(Status));
return FALSE;
}
Status = LsaLookupSids(PolicyHandle, 1, &pSid, &ReferencedDomain, &TranslatedName);
LsaClose(PolicyHandle);
@ -1086,7 +1086,8 @@ LookupAccountSidW(LPCWSTR pSystemName,
*pdwAccountName = dwAccountName + 1;
*pdwDomainName = dwDomainName + 1;
ret = FALSE;
} else
}
else
{
/* Lengths are sufficient, copy the data */
if (dwAccountName)
@ -1110,6 +1111,7 @@ LookupAccountSidW(LPCWSTR pSystemName,
if (ReferencedDomain)
LsaFreeMemory(ReferencedDomain);
if (TranslatedName)
LsaFreeMemory(TranslatedName);
@ -1117,7 +1119,6 @@ LookupAccountSidW(LPCWSTR pSystemName,
}
/******************************************************************************
* LookupAccountNameA [ADVAPI32.@]
*