On Thu, Nov 08, 2007 at 12:21:42PM -0800, Roy Shea wrote:
On Thu, Nov 08, 2007 at 12:00:28PM +0000, Robert Shearman wrote:
Roy Shea wrote:
Howdy All,
I'm developing missing services in Wine and am running into problems with how Wine starts services. In Windows a service can be started using "net start <service name>", assuming that the service is properly added to the registry. In Wine it appears that the user must manually start the service before calling "net start <service name>", or the service fails to start.
What makes you think that? There are quite a few programs, including InstallShield, that start their own services without the process being started beforehand. You could start with pulling +advapi,+relay log of "net start" executing to try to figure out what is going wrong. My guess would be that either svchost or the DLL isn't notifying the SCM of its started status.
-- Rob Shearman
Further testing shows that a server process actually is started by Wine. Good! What set me off on this goose chase was the output generated when I tried to start a process:
$ ./programs/net/net start count_server The count_server service is starting. The count_server service failed to start.
Despite the notice that the service failed to start, it is happily up and running. A similar test for services started via svchost reveal the same behavior; the service starts but "net" says that it did not start.
Debug logs with +advapi,+relay looked odd. In particular, StartServiceW returns 0 (failure) triggering the error message from net. I dug into this and it looks like the problem is in either "service_start_process" in dlls/advapi32/service.c or "CreateProcessW" in dlls/kernel32/process.c.
The call to WaitForMultilpeObjectsEx from service_start_process fails because the handle for the freshly created process is invalid. This triggers the error message from net. This invalid process handle is the result of CreateProcessW not setting process information when a process started is a BINARY_UNIX_EXE.
Should process info be set when a BINARY_UNIX_EXE processes is created?
Peace, -Roy
Okay, a little more information on this. The above email is specific to registry settings using the "wrapped" version of the executable. Ie. Specifying the symbolic link to winewrapper (named after the executable and created by make) in the reigstry rather than test_service.exe. Specifying test_service.exe in the registry causes the service to fail since CreateProcessW is unable to locate the file. Finally, setting the registry value to svchost.exe.so works without any errors. Unfortunately, this last version is not compatible with Windows registry configurations.
CreateProcessW already preforms a search for the binary it is starting. Perhaps we could have it also look for a binary ending in ".so".
Peace, -Roy