Windows Service + CreateWindowEx

Andrew Eikum aeikum at codeweavers.com
Wed Aug 19 12:29:34 CDT 2015


On Wed, Aug 19, 2015 at 01:21:32PM -0400, Robert D Kocisko wrote:
> I am attempting to make some tweaks to Wine so it can run a (3rd party)
> windows service that uses CreateWindowEx, and I'm not sure whether I'm on
> the right track or not.   What is happening is that when the service calls
> CreateWindowEx, I get this error:
> 
> Application tried to create a window, but no driver could be loaded.
> The explorer process failed to start.
> 
> I traced it down to the following source code line in
> wine/dlls/user32/driver.c:
> 
> UINT guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW
> ));
> 
> What is happening is that guid_atom returns 0 which ultimately ends up
> disallowing any connection to a graphics driver.
> 
> Now it seems to me that the explorer.exe process is supposed to be
> providing a desktop window and setting that atom value.  But if I try to
> run wine explorer.exe it  doesn't make any difference.  I am keeping Wine
> alive by running wine notepad & and I am also running wine services to make
> sure that the SCM is alive and available for the services.
> 
> OS: Elementary OS Freya 0.3
> 
> 
> Is this something that Wine should support?  I have had success getting
> other 3rd party services to work so it seems that it shouldn't be too
> difficult to make this work.  Could anyone provide guidance on how I should
> proceed to tweak the code to support this?  Or if this is going to be a
> huge project to make this work I would appreciate knowing that too :).
> 

I've run into the same issue with the MSOffice 2013 installer. Your
diagnosis is correct. I'm not aware of a proper fix.

There is an ugly hack that will work around the bug. At the beginning
of <dlls/user32/user_main.c:winstation_init>, set "info.lpDesktop" to
NULL just after the GetStartupInfo() call.  This will force Wine to
create a new desktop for your service's winstation, which should then
load the graphics driver.

Again, this is just a crummy hack to work around the issue. If you'd
like to dig into Wine's desktop and winstation implementations further
and find a correct fix for this, it would be appreciated.

Andrew



More information about the wine-devel mailing list