[NETAPI32]
[reactos.git] / reactos / dll / win32 / netapi32 / wksta.c
index 4cef46c..4e5d8d6 100644 (file)
@@ -30,29 +30,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
  *
  * Checks whether the server name indicates local machine.
  */
-BOOL NETAPI_IsLocalComputer(LMCSTR ServerName)
+DECLSPEC_HIDDEN BOOL NETAPI_IsLocalComputer( LMCSTR name )
 {
-    if (!ServerName)
-    {
-        return TRUE;
-    }
-    else if (ServerName[0] == '\0')
-        return TRUE;
-    else
-    {
-        DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
-        BOOL Result;
-        LPWSTR buf;
-
-        NetApiBufferAllocate(dwSize * sizeof(WCHAR), (LPVOID *) &buf);
-        Result = GetComputerNameW(buf,  &dwSize);
-        if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
-            ServerName += 2;
-        Result = Result && !lstrcmpW(ServerName, buf);
-        NetApiBufferFree(buf);
-
-        return Result;
-    }
+    WCHAR buf[MAX_COMPUTERNAME_LENGTH + 1];
+    DWORD size = sizeof(buf) / sizeof(buf[0]);
+    BOOL ret;
+
+    if (!name || !name[0]) return TRUE;
+
+    ret = GetComputerNameW( buf,  &size );
+    if (ret && name[0] == '\\' && name[1] == '\\') name += 2;
+    return ret && !strcmpiW( name, buf );
 }
 
 static void wprint_mac(WCHAR* buffer, int len, const MIB_IFROW *ifRow)