Commit Graph

38 Commits

Author SHA1 Message Date
Zebediah Figura c18f8e4c32 winedevice: Reimplement (un)loading drivers on top of ZwLoadDriver()/ZwUnloadDriver().
We can't implement ZwLoadDriver() on top of StartService(), since the latter
takes the service database lock. Instead simply move the entire body of
create_driver()/unload_driver() into ZwLoadDriver()/ZwUnloadDriver().
Similarly, clean up the list of loaded drivers in ntoskrnl rather than
winedevice.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45084
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-29 22:01:38 +02:00
Zebediah Figura 44e7943274 winedevice: Make driver (un)loading synchronous.
This essentially reverts 440482d2ef.

440482d was aimed towards making it possible to load multiple drivers
asynchronously, as well as to allow reentrancy. Unfortunately, asynchronicity
is incorrect, as demonstrated by bug 38836, and some trivial testing shows
that the SCM database lock is held for the entirety of the driver entry and
exit routines, and that StartService() and ControlService() block until they
complete. 5726824 and dd2624a nullified the effects of 440482d, making driver
loading all but synchronous (with the exception of the added 30 second
timeout, but this is actually incorrect: drivers can block indefinitely).

This patch therefore does not change any behaviour, but rather removes the
use of threadpools and "async" functions, essentially reverting back to the
implementation prior to 440482d. The incidental change to unload_driver()
made by that patch (viz. never to unload a driver without a DriverUnload()
routine) is kept.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-29 22:01:38 +02:00
Alistair Leslie-Hughes dd2624a24f winedevice: Improve error handling when a driver fails to load.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-09 19:59:11 +02:00
Alistair Leslie-Hughes 57268241f7 winedevice: Wait until driver has started before returning.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-26 11:34:51 +02:00
Alexandre Julliard 7ca2a1ade5 winedevice: Use the magic format string prefix for relay traces.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-25 12:05:41 +01:00
Jacek Caban d29e59a145 rbtree.h: Take wine_rb_entry as wine_rb_remove argument type and add new wine_rb_remove_key helper using key.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-14 00:01:53 +09:00
Sebastian Lackner f628cbbaa1 services: Add a separate winedevice service for each kernel driver.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-01 21:21:29 +09:00
Jacek Caban f40a9d6172 winedevice: Use static initializer for wine_drivers.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-31 22:22:57 +09:00
Sebastian Lackner 09f9986ea1 winedevice: Avoid memory leak when driver cannot be unloaded.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-29 21:01:43 +09:00
Sebastian Lackner 440482d2ef winedevice: Add support for loading/unloading drivers asynchronously.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-25 20:11:48 +09:00
Sebastian Lackner aab54da669 winedevice: Track loaded drivers and update their status on load/unload.
Based on a patch by Aric Stewart.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-19 15:31:45 +09:00
Aric Stewart 92ce6e6bab winedevice: Remove static driver_obj variable.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-09 11:59:42 +09:00
Sebastian Lackner e3321faf14 winedevice: Get rid of static driver_module variable.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-04 13:19:29 -05:00
Aric Stewart 3b37db88e9 winedevice: Use IoCreateDriver and IoDeleteDriver.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-04 13:19:25 -05:00
Alexandre Julliard f21cb01aa4 makefiles: Don't allow import libraries to have an extension.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-06-14 14:04:20 +09:00
Sebastian Lackner e931f0e83d winedevice: Get rid of global driver_hkey variable and fix some leaks.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-26 18:41:38 +09:00
Sebastian Lackner 4bed3d231e winedevice: Use LdrFindEntryForAddress to find LDR_MODULE address.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-26 18:40:21 +09:00
Sebastian Lackner c16f0644be winedevice: Do not omit mandatory argument for VirtualProtect. 2015-05-04 20:08:00 +09:00
Michael Müller a8b000c54d winedevice: Call DriverUnload function when unloading a driver.
Based on a patch by Alexander Morozov.
2015-02-24 21:55:48 +09:00
Alexandre Julliard 86b1f94d28 makefiles: Get rid of the MAKE_PROG_RULES variable. 2014-01-02 12:12:57 +01:00
Alexandre Julliard 58176bba10 winedevice: Retrieve the page size from ntdll. 2013-01-09 12:15:21 +01:00
Alexandre Julliard da35622b83 makefiles: Disable use of Unicode macros globally for all the programs. 2012-01-20 13:14:16 +01:00
Bernhard Loos 6840a9273c winedevice: A driver path can also start with \systemroot\. 2011-11-23 18:10:17 +01:00
Alexandre Julliard 81b8ee863e makefiles: Add a standard header for all makefiles to replace the common variable initializations. 2010-09-19 12:36:48 +02:00
Alexandre Julliard 6fb39dfe4a programs: Remove explicit imports of kernel32 and ntdll. 2010-07-21 17:38:37 +02:00
Alessandro Pignotti 58f36e863e winedevice: Use 64-bit wide delta when relocating. 2010-06-23 15:30:13 +02:00
Alexandre Julliard fe1360252f winedevice: Fix up protections before writing to the NT header. 2010-06-15 18:29:08 +02:00
Alexandre Julliard bef5645eb1 makefiles: Remove the no longer needed explicit separators for dependencies. 2010-03-16 13:28:19 +01:00
Alexandre Julliard 0115fdb6f4 winedevice: Make sure that all dependencies of the driver are relocated too. 2008-12-22 15:51:25 +01:00
Maarten Lankhorst f00beab5c4 ntoskrnl.exe/winedevice: Make wine_ntoskrnl_main_loop CDECL. 2008-12-17 15:02:26 +01:00
Peter Dons Tychsen bc7b194bf9 winedevice: Fix problems with driver entries without the "ImagePath" entry in registry. 2008-09-17 10:58:46 +02:00
Dmitry Timoshkov a2a3c59a45 winedevice: Wine PE loader is able to resolve forwards to not yet loaded modules. 2008-09-11 11:46:07 +02:00
Alexandre Julliard b66685cdd8 programs: Build the programs that support it with -DWINE_NO_UNICODE_MACROS. 2008-09-03 14:21:41 +02:00
Alexandre Julliard 52ca8cd3ce winedevice: Apply relocations to the driver in cases where the loader doesn't do it. 2008-04-02 20:40:27 +02:00
Rob Shearman ee811d89a8 winedevice: Handle failure of RegisterServiceCtrlHandlerExW. 2008-03-28 21:42:15 +01:00
Lionel Debroux 6ac689368a winedevice: Fix memory leak (found by Smatch). 2007-12-17 12:30:23 +01:00
Alexandre Julliard c2fed1752d winedevice: Accept the shutdown service control. 2007-06-07 11:20:49 +02:00
Alexandre Julliard c81d099503 winedevice: Add a service process that loads and runs a kernel driver. 2007-05-17 16:51:44 +02:00