http://bugs.winehq.org/show_bug.cgi?id=8671
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net
--- Comment #12 from Anastasius Focht focht@gmx.net 2007-10-25 18:22:04 --- Hello,
the installation of bounjour service fails due to an oversight in CreateServiceA/W(). The installer writes registry keys at some point, like:
"SYSTEM\CurrentControlSet\Services\Bonjour Service\Parameters"
and later does explicit installation/creation of service using CreateServiceA/W() API call:
--- quote --- 003d:trace:advapi:CreateServiceW 0x1cded8 L"Bonjour Service" L"Bonjour Service" 003d:trace:reg:RegEnumKeyExW (0x9c,0,0x34f51c,0x34f7d0(520),(nil),(nil),(nil),(nil)) 003d:trace:advapi:CloseServiceHandle (nil) 003d:trace:advapi:CloseServiceHandle 0x1cded8 003d:trace:advapi:sc_handle_destroy_manager destroying SC Manager 0x1cded8 003d:trace:advapi:OpenSCManagerW ((null),(null),0x00000001) 003d:trace:advapi:sc_handle_alloc sc_handle type=0 -> 0x5922e0 003d:trace:reg:RegConnectRegistryW ((null),0x80000002,0x34f818): stub 003d:trace:reg:NtCreateKey (0x2c,L"System\CurrentControlSet\Services",(null),0,f003f,0x5922ec) 003d:trace:reg:NtCreateKey <- 0x9c 003d:trace:advapi:OpenSCManagerW returning 0x5922e0 (access : 0x00000001) 003d:trace:advapi:OpenServiceW 0x5922e0 L"Bonjour Service" 16 003d:trace:reg:NtOpenKey (0x9c,L"Bonjour Service",f003f,0x34f818) 003d:trace:reg:NtOpenKey <- 0xa8 003d:trace:advapi:sc_handle_alloc sc_handle type=1 -> 0x592ab0 003d:trace:advapi:OpenServiceW returning 0x592ab0 003d:trace:advapi:StartServiceW 0x592ab0 0 (nil) 003d:trace:advapi:LockServiceDatabase 0x5922e0 003d:trace:advapi:LockServiceDatabase returning 0xac 003d:trace:reg:RegQueryValueExW (0xa8,L"Type",(nil),0x34f818,0x34f814,0x34f810=4) 003d:trace:reg:NtQueryValueKey (0xa8,L"Type",2,0x34f620,16) 003d:trace:reg:RegQueryValueExW (0xa8,L"ImagePath",(nil),0x34f818,(nil),0x34f810=0) 003d:trace:reg:NtQueryValueKey (0xa8,L"ImagePath",2,0x34f620,12) 003d:trace:advapi:UnlockServiceDatabase 0xac 003d:trace:advapi:StartServiceW returning 0 003d:err:msi:ITERATE_StartService Failed to start service L"Bonjour Service" 003d:trace:advapi:CloseServiceHandle 0x592ab0 003d:trace:advapi:sc_handle_destroy_service destroying service 0x592ab0 003d:trace:advapi:CloseServiceHandle 0x5922e0 003d:trace:advapi:sc_handle_destroy_manager destroying SC Manager 0x5922e0 003d:err:msi:ITERATE_Actions Execution halted, action L"InstallFinalize" returned 1627 003d:err:msi:ITERATE_Actions Execution halted, action L"ExecuteAction" returned 1627 --- quote ---
offending code:
--- snip dlls/advapi32/service.c --- SC_HANDLE WINAPI CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, LPCWSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword ) { ... /* Loop through the registry to check if the service already exists and to * check if we can use the given displayname. * FIXME: Should we use EnumServicesStatusEx? */ len = sizeof(buffer); while (RegEnumKeyExW(hscm->hkey, index, buffer, &len, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { HKEY service_key;
/* The service already exists, so bail out */ if(!lstrcmpiW(lpServiceName, buffer)) { SetLastError(ERROR_SERVICE_EXISTS); return NULL; } ... } --- snip dlls/advapi32/service.c ---
The service does not really exist prior the call because only the "Parameters" subkey was written by installer. The function makes incorrect assumption if the service name subkey exists under "SYSTEM\CurrentControlSet\Services" all other service config data exists too and returns with ERROR_SERVICE_EXISTS without updating the data.
The code following the call assumes "ok" and tries to start the service. Due to missing service data (like binary path) it fails.
Solution: overwrite/update service registry data even if some partial data exist.
Regards