advapi32: remove duplicate ADVAPI_IsLocalComputer (revised)

Robert Reif reif at earthlink.net
Sat Jul 29 07:12:58 CDT 2006


Robert Reif wrote:

> Make ADVAPI_IsLocalComputer global and remove duplicate copy.
> Make debugstr_sid global.

Changed new header file name to advapi32_misc.h.
-------------- next part --------------
diff -puN wine.cvs/dlls/advapi32/advapi32_misc.h wine/dlls/advapi32/advapi32_misc.h
--- wine.cvs/dlls/advapi32/advapi32_misc.h	1969-12-31 19:00:00.000000000 -0500
+++ wine/dlls/advapi32/advapi32_misc.h	2006-07-29 08:00:48.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_ADVAPI32MISC_H
+#define __WINE_ADVAPI32MISC_H
+
+const char * debugstr_sid(PSID sid);
+BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName);
+
+#endif /* __WINE_ADVAPI32MISC_H */
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-29 07:59:45.000000000 -0400
@@ -30,6 +30,7 @@
 #include "winreg.h"
 #include "winternl.h"
 #include "ntsecapi.h"
+#include "advapi32_misc.h"
 
 #include "wine/debug.h"
 
@@ -54,30 +55,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-29 08:07:01.000000000 -0400
+++ wine/dlls/advapi32/security.c	2006-07-29 07:59:27.000000000 -0400
@@ -35,6 +35,7 @@
 #include "sddl.h"
 #include "winsvc.h"
 #include "aclapi.h"
+#include "advapi32_misc.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
@@ -239,7 +240,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;
@@ -322,7 +323,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;


More information about the wine-patches mailing list