advapi32: remove duplicate ADVAPI_IsLocalComputer

Robert Reif reif at earthlink.net
Fri Jul 28 21:23:40 CDT 2006


Make ADVAPI_IsLocalComputer global and remove duplicate copy.
Make debugstr_sid global.
-------------- next part --------------
diff -puN wine.cvs/dlls/advapi32/lsa.c wine/dlls/advapi32/lsa.c
--- wine.cvs/dlls/advapi32/lsa.c	2006-07-15 07:06:19.000000000 -0400
+++ wine/dlls/advapi32/lsa.c	2006-07-28 22:06:31.000000000 -0400
@@ -33,6 +33,8 @@
 
 #include "wine/debug.h"
 
+#include "security.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
 
 #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \
@@ -54,30 +56,6 @@ static void dumpLsaAttributes(PLSA_OBJEC
     }
 }
 
-/************************************************************
- * ADVAPI_IsLocalComputer
- *
- * Checks whether the server name indicates local machine.
- */
-static BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
-{
-    DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
-    BOOL Result;
-    LPWSTR 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;
-}
-
 /******************************************************************************
  * LsaAddAccountRights [ADVAPI32.@]
  *
diff -puN wine.cvs/dlls/advapi32/security.c wine/dlls/advapi32/security.c
--- wine.cvs/dlls/advapi32/security.c	2006-07-22 13:15:26.000000000 -0400
+++ wine/dlls/advapi32/security.c	2006-07-28 22:06:16.000000000 -0400
@@ -39,6 +39,8 @@
 #include "wine/debug.h"
 #include "wine/unicode.h"
 
+#include "security.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
 
 static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes);
@@ -235,7 +237,7 @@ static const WCHAR SDDL_INHERITED[]     
 static const WCHAR SDDL_AUDIT_SUCCESS[]      = {'S','A',0};
 static const WCHAR SDDL_AUDIT_FAILURE[]      = {'F','A',0};
 
-static const char * debugstr_sid(PSID sid)
+const char * debugstr_sid(PSID sid)
 {
     int auth = 0;
     SID * psid = (SID *)sid;
@@ -318,7 +320,7 @@ static void GetWorldAccessACL(PACL pACL)
  *
  * Checks whether the server name indicates local machine.
  */
-static BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
+BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName)
 {
     DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
     BOOL Result;
diff -puN wine.cvs/dlls/advapi32/security.h wine/dlls/advapi32/security.h
--- wine.cvs/dlls/advapi32/security.h	1969-12-31 19:00:00.000000000 -0500
+++ wine/dlls/advapi32/security.h	2006-07-28 22:04:44.000000000 -0400
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2006 Robert Reif
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#ifndef __WINE_SECURITY_H
+#define __WINE_SECURITY_H
+
+const char * debugstr_sid(PSID sid);
+BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName);
+
+#endif /* __WINE_SECURITY_H */


More information about the wine-patches mailing list