From daf0af431310f647d1849cb15f4f237f22cc9cfa Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 27 Feb 2015 01:20:48 +0300 Subject: [PATCH] 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 8e4dda89dec..f9b370bdc3d 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 d8ae11759e3..43eb3cdca5b 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)