From 3f000d8c717bca14310871f8ea1119154f5bae09 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sat, 29 Jul 2006 08:12:58 -0400 Subject: [PATCH] advapi32: Make ADVAPI_IsLocalComputer global and remove duplicate copy. Make debugstr_sid global. --- dlls/advapi32/advapi32_misc.h | 26 ++++++++++++++++++++++++++ dlls/advapi32/lsa.c | 25 +------------------------ dlls/advapi32/security.c | 5 +++-- 3 files changed, 30 insertions(+), 26 deletions(-) create mode 100644 dlls/advapi32/advapi32_misc.h diff --git a/dlls/advapi32/advapi32_misc.h b/dlls/advapi32/advapi32_misc.h new file mode 100644 index 00000000000..436c0fe46fc --- /dev/null +++ b/dlls/advapi32/advapi32_misc.h @@ -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 --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c index 6e703451063..62b20757d09 100644 --- a/dlls/advapi32/lsa.c +++ b/dlls/advapi32/lsa.c @@ -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_OBJECT_ATTRIBUTES oa) } } -/************************************************************ - * 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 --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 658fa446d7a..d2a5d810e37 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -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[] = {'I','D',0}; 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; -- 2.11.4.GIT