From a46a159be9df2c427dd65b2830fa7b276727dbd6 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Thu, 9 Jun 2005 09:44:44 +0000 Subject: [PATCH] Make ADVAPI_IsLocalComputer static and simplify it a little. --- dlls/advapi32/security.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 5bbb4eaf300..2b073575c4a 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -137,31 +137,23 @@ static void GetWorldAccessACL(PACL pACL) * * 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; - BOOL Result; - LPWSTR buf; + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + BOOL Result; + LPWSTR buf; - buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); - Result = GetComputerNameW(buf, &dwSize); - if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\')) - ServerName += 2; - Result = Result && !lstrcmpW(ServerName, buf); - HeapFree(GetProcessHeap(), 0, buf); + if (!ServerName || !ServerName[0]) + return TRUE; + + buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); + Result = GetComputerNameW(buf, &dwSize); + 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) \