[PATCH v2 1/8] advapi32: Replace usage of internal SERV_ functions with exported functions

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Sep 11 17:46:38 CDT 2019


-DWORD SERV_OpenServiceW(SC_HANDLE, LPCWSTR, DWORD, SC_HANDLE*) DECLSPEC_HIDDEN;
Now you have remove it from the header, it would make sense making it static in the file it's defined.

Regards
Alistair.






From: wine-devel <wine-devel-bounces at winehq.org> on behalf of Micah N Gorrell <mgorrell at codeweavers.com>

Sent: Wednesday, 11 September 2019 7:59 AM

To: wine-devel at winehq.org <wine-devel at winehq.org>

Subject: [PATCH v2 1/8] advapi32: Replace usage of internal SERV_ functions with exported functions

 


This is in preparation for moving the services RPC functions into

sechost.



Signed-off-by: Micah N Gorrell <mgorrell at codeweavers.com>

---

 dlls/advapi32/advapi32_misc.h |  3 ---

 dlls/advapi32/security.c      | 32 +++++++++++++++++++++++++-------

 2 files changed, 25 insertions(+), 10 deletions(-)



diff --git a/dlls/advapi32/advapi32_misc.h b/dlls/advapi32/advapi32_misc.h

index 4ced1e8a64..77b56420ba 100644

--- a/dlls/advapi32/advapi32_misc.h

+++ b/dlls/advapi32/advapi32_misc.h

@@ -32,9 +32,6 @@ BOOL ADVAPI_GetComputerSid(PSID sid) DECLSPEC_HIDDEN;

 BOOL lookup_local_wellknown_name(const LSA_UNICODE_STRING*, PSID, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE, BOOL*) DECLSPEC_HIDDEN;

 BOOL lookup_local_user_name(const LSA_UNICODE_STRING*, PSID, LPDWORD, LPWSTR, LPDWORD, PSID_NAME_USE, BOOL*) DECLSPEC_HIDDEN;

 WCHAR *SERV_dup(const char *str) DECLSPEC_HIDDEN;

-DWORD SERV_OpenSCManagerW(LPCWSTR, LPCWSTR, DWORD, SC_HANDLE*) DECLSPEC_HIDDEN;

-DWORD SERV_OpenServiceW(SC_HANDLE, LPCWSTR, DWORD, SC_HANDLE*) DECLSPEC_HIDDEN;

-NTSTATUS SERV_QueryServiceObjectSecurity(SC_HANDLE, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR, DWORD, LPDWORD) DECLSPEC_HIDDEN;

 const WCHAR *get_wellknown_privilege_name(const LUID *) DECLSPEC_HIDDEN;

 

 /* memory allocation functions */

diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c

index a7707f15d3..74eda93282 100644

--- a/dlls/advapi32/security.c

+++ b/dlls/advapi32/security.c

@@ -416,15 +416,19 @@ static inline DWORD get_security_file( LPCWSTR full_file_name, DWORD access, HAN

 static inline DWORD get_security_service( LPWSTR full_service_name, DWORD access, HANDLE *service )

 {

     SC_HANDLE manager = 0;

-    DWORD err;

 

-    err = SERV_OpenSCManagerW( NULL, NULL, access, (SC_HANDLE *)&manager );

-    if (err == ERROR_SUCCESS)

+    manager = OpenSCManagerW( NULL, NULL, access );

+    if (manager)

     {

-        err = SERV_OpenServiceW( manager, full_service_name, access, (SC_HANDLE *)service );

+        *service = OpenServiceW( manager, full_service_name, access);

         CloseServiceHandle( manager );

+

+        if (*service)

+        {

+            return ERROR_SUCCESS;

+        }

     }

-    return err;

+    return GetLastError();

 }

 

 /* helper function for SE_REGISTRY_KEY objects in [Get|Set]NamedSecurityInfo */

@@ -1804,7 +1808,14 @@ DWORD WINAPI GetSecurityInfo(

     switch (ObjectType)

     {

     case SE_SERVICE:

-        status = SERV_QueryServiceObjectSecurity(hObject, SecurityInfo, NULL, 0, &n1);

+        if (QueryServiceObjectSecurity(hObject, SecurityInfo, NULL, 0, &n1))

+        {

+            status = STATUS_SUCCESS;

+        }

+        else

+        {

+            status = RtlGetLastNtStatus();

+        }

         break;

     default:

         status = NtQuerySecurityObject(hObject, SecurityInfo, NULL, 0, &n1);

@@ -1820,7 +1831,14 @@ DWORD WINAPI GetSecurityInfo(

     switch (ObjectType)

     {

     case SE_SERVICE:

-        status = SERV_QueryServiceObjectSecurity(hObject, SecurityInfo, sd, n1, &n2);

+        if (QueryServiceObjectSecurity(hObject, SecurityInfo, sd, n1, &n2))

+        {

+            status = STATUS_SUCCESS;

+        }

+        else

+        {

+            status = RtlGetLastNtStatus();

+        }

         break;

     default:

         status = NtQuerySecurityObject(hObject, SecurityInfo, sd, n1, &n2);

-- 

2.23.0








More information about the wine-devel mailing list