Nikolay Sivov : advapi32: Forward to CreateServiceWOW64W() when appropriate.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 27 08:00:16 CST 2015


Module: wine
Branch: master
Commit: daf0af431310f647d1849cb15f4f237f22cc9cfa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=daf0af431310f647d1849cb15f4f237f22cc9cfa

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Feb 27 01:20:48 2015 +0300

advapi32: Forward to CreateServiceWOW64W() when appropriate.

---

 dlls/advapi32/service.c | 21 ++++++++++++++++-----
 programs/services/rpc.c | 34 ++++++++++++++++++++++++++++++----
 2 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index 8e4dda8..f9b370b 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -1057,11 +1057,22 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
 
     __TRY
     {
-        err = svcctl_CreateServiceW(hSCManager, lpServiceName,
-                lpDisplayName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl,
-                lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, (const BYTE*)lpDependencies,
-                multisz_cb(lpDependencies), lpServiceStartName, (const BYTE*)lpPassword, passwdlen,
-                (SC_RPC_HANDLE *)&handle);
+        BOOL is_wow64;
+
+        IsWow64Process(GetCurrentProcess(), &is_wow64);
+
+        if (is_wow64)
+            err = svcctl_CreateServiceWOW64W(hSCManager, lpServiceName,
+                    lpDisplayName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl,
+                    lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, (const BYTE*)lpDependencies,
+                    multisz_cb(lpDependencies), lpServiceStartName, (const BYTE*)lpPassword, passwdlen,
+                    (SC_RPC_HANDLE *)&handle);
+        else
+            err = svcctl_CreateServiceW(hSCManager, lpServiceName,
+                    lpDisplayName, dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl,
+                    lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, (const BYTE*)lpDependencies,
+                    multisz_cb(lpDependencies), lpServiceStartName, (const BYTE*)lpPassword, passwdlen,
+                    (SC_RPC_HANDLE *)&handle);
     }
     __EXCEPT(rpc_filter)
     {
diff --git a/programs/services/rpc.c b/programs/services/rpc.c
index d8ae117..43eb3cd 100644
--- a/programs/services/rpc.c
+++ b/programs/services/rpc.c
@@ -463,7 +463,7 @@ static DWORD parse_dependencies(const WCHAR *dependencies, struct service_entry
     return ERROR_SUCCESS;
 }
 
-DWORD __cdecl svcctl_CreateServiceW(
+static DWORD create_serviceW(
     SC_RPC_HANDLE hSCManager,
     LPCWSTR lpServiceName,
     LPCWSTR lpDisplayName,
@@ -479,7 +479,8 @@ DWORD __cdecl svcctl_CreateServiceW(
     LPCWSTR lpServiceStartName,
     const BYTE *lpPassword,
     DWORD dwPasswordSize,
-    SC_RPC_HANDLE *phService)
+    SC_RPC_HANDLE *phService,
+    BOOL is_wow64)
 {
     struct service_entry *entry, *found;
     struct sc_manager_handle *manager;
@@ -562,6 +563,30 @@ DWORD __cdecl svcctl_CreateServiceW(
     return create_handle_for_service(entry, dwDesiredAccess, phService);
 }
 
+DWORD __cdecl svcctl_CreateServiceW(
+    SC_RPC_HANDLE hSCManager,
+    LPCWSTR lpServiceName,
+    LPCWSTR lpDisplayName,
+    DWORD dwDesiredAccess,
+    DWORD dwServiceType,
+    DWORD dwStartType,
+    DWORD dwErrorControl,
+    LPCWSTR lpBinaryPathName,
+    LPCWSTR lpLoadOrderGroup,
+    DWORD *lpdwTagId,
+    const BYTE *lpDependencies,
+    DWORD dwDependenciesSize,
+    LPCWSTR lpServiceStartName,
+    const BYTE *lpPassword,
+    DWORD dwPasswordSize,
+    SC_RPC_HANDLE *phService)
+{
+    WINE_TRACE("(%s, %s, 0x%x, %s)\n", wine_dbgstr_w(lpServiceName), wine_dbgstr_w(lpDisplayName), dwDesiredAccess, wine_dbgstr_w(lpBinaryPathName));
+    return create_serviceW(hSCManager, lpServiceName, lpDisplayName, dwDesiredAccess, dwServiceType, dwStartType,
+        dwErrorControl, lpBinaryPathName, lpLoadOrderGroup, lpdwTagId, lpDependencies, dwDependenciesSize, lpServiceStartName,
+        lpPassword, dwPasswordSize, phService, FALSE);
+}
+
 DWORD __cdecl svcctl_DeleteService(
     SC_RPC_HANDLE hService)
 {
@@ -1521,8 +1546,9 @@ DWORD __cdecl svcctl_CreateServiceWOW64W(
     DWORD password_size,
     SC_RPC_HANDLE *service)
 {
-    WINE_FIXME("\n");
-    return ERROR_CALL_NOT_IMPLEMENTED;
+    WINE_TRACE("(%s, %s, 0x%x, %s)\n", wine_dbgstr_w(servicename), wine_dbgstr_w(displayname), accessmask, wine_dbgstr_w(imagepath));
+    return create_serviceW(scmanager, servicename, displayname, accessmask, service_type, start_type, error_control, imagepath,
+        loadordergroup, tagid, dependencies, depend_size, start_name, password, password_size, service, TRUE);
 }
 
 DWORD __cdecl svcctl_unknown46(void)




More information about the wine-cvs mailing list