Make ADVAPI_IsLocalComputer static and simplify it a little.

This commit is contained in:
Mike McCormack 2005-06-09 09:44:44 +00:00 committed by Alexandre Julliard
parent 4fd603607f
commit a46a159be9
1 changed files with 14 additions and 22 deletions

View File

@ -137,31 +137,23 @@ static void GetWorldAccessACL(PACL pACL)
* *
* Checks whether the server name indicates local machine. * Checks whether the server name indicates local machine.
*/ */
BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) static BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
{ {
if (!ServerName) DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
{ BOOL Result;
return TRUE; LPWSTR buf;
}
else if (!ServerName[0])
{
return TRUE;
}
else
{
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
BOOL Result;
LPWSTR buf;
buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); if (!ServerName || !ServerName[0])
Result = GetComputerNameW(buf, &dwSize); return TRUE;
if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
ServerName += 2; buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
Result = Result && !lstrcmpW(ServerName, buf); Result = GetComputerNameW(buf, &dwSize);
HeapFree(GetProcessHeap(), 0, buf); if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
ServerName += 2;
Result = Result && !lstrcmpW(ServerName, buf);
HeapFree(GetProcessHeap(), 0, buf);
return Result; return Result;
}
} }
#define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \ #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \