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

View File

@ -137,22 +137,15 @@ 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)
{
return TRUE;
}
else if (!ServerName[0])
{
return TRUE;
}
else
{ {
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
BOOL Result; BOOL Result;
LPWSTR buf; LPWSTR buf;
if (!ServerName || !ServerName[0])
return TRUE;
buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR));
Result = GetComputerNameW(buf, &dwSize); Result = GetComputerNameW(buf, &dwSize);
if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\')) if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
@ -162,7 +155,6 @@ BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
return Result; return Result;
} }
}
#define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \ #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \
if (!ADVAPI_IsLocalComputer(ServerName)) \ if (!ADVAPI_IsLocalComputer(ServerName)) \