winebus.sys: Avoid IoCreateDriver().

This is not a documented function, and anyway we don't need separate driver
objects.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-05-29 23:02:30 -05:00 committed by Alexandre Julliard
parent d525c736b9
commit 9af088243c
5 changed files with 12 additions and 23 deletions

View File

@ -19,9 +19,9 @@
typedef int(*enum_func)(DEVICE_OBJECT *device, void *context);
/* Buses */
NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path) DECLSPEC_HIDDEN;
NTSTATUS WINAPI iohid_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path) DECLSPEC_HIDDEN;
NTSTATUS WINAPI sdl_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path) DECLSPEC_HIDDEN;
NTSTATUS udev_driver_init(void) DECLSPEC_HIDDEN;
NTSTATUS iohid_driver_init(void) DECLSPEC_HIDDEN;
NTSTATUS sdl_driver_init(void) DECLSPEC_HIDDEN;
void udev_driver_unload( void ) DECLSPEC_HIDDEN;
void iohid_driver_unload( void ) DECLSPEC_HIDDEN;
void sdl_driver_unload( void ) DECLSPEC_HIDDEN;

View File

@ -399,10 +399,8 @@ static DWORD CALLBACK runloop_thread(void *args)
}
NTSTATUS WINAPI iohid_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path)
NTSTATUS iohid_driver_init(void)
{
TRACE("(%p, %s)\n", driver, debugstr_w(registry_path->Buffer));
hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, 0L);
if (!(run_loop_handle = CreateThread(NULL, 0, runloop_thread, NULL, 0, NULL)))
{
@ -429,7 +427,7 @@ void iohid_driver_unload( void )
#else
NTSTATUS WINAPI iohid_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path)
NTSTATUS iohid_driver_init(void)
{
WARN("IOHID Support not compiled into Wine.\n");
return STATUS_NOT_IMPLEMENTED;

View File

@ -1067,7 +1067,7 @@ void sdl_driver_unload( void )
TRACE("Unload Driver\n");
}
NTSTATUS WINAPI sdl_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path)
NTSTATUS sdl_driver_init(void)
{
static const WCHAR controller_modeW[] = {'M','a','p',' ','C','o','n','t','r','o','l','l','e','r','s',0};
static const UNICODE_STRING controller_mode = {sizeof(controller_modeW) - sizeof(WCHAR), sizeof(controller_modeW), (WCHAR*)controller_modeW};
@ -1075,7 +1075,6 @@ NTSTATUS WINAPI sdl_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_
HANDLE events[2];
DWORD result;
TRACE("(%p, %s)\n", driver, debugstr_w(registry_path->Buffer));
if (sdl_handle == NULL)
{
sdl_handle = wine_dlopen(SONAME_LIBSDL2, RTLD_NOW, NULL, 0);
@ -1151,7 +1150,7 @@ sym_not_found:
#else
NTSTATUS WINAPI sdl_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path)
NTSTATUS sdl_driver_init(void)
{
WARN("compiled without SDL support\n");
return STATUS_NOT_IMPLEMENTED;

View File

@ -1451,7 +1451,7 @@ void udev_driver_unload( void )
TRACE("Unload Driver\n");
}
NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path)
NTSTATUS udev_driver_init(void)
{
HANDLE events[2];
DWORD result;
@ -1460,8 +1460,6 @@ NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry
static const WCHAR input_disabledW[] = {'D','i','s','a','b','l','e','I','n','p','u','t',0};
static const UNICODE_STRING input_disabled = {sizeof(input_disabledW) - sizeof(WCHAR), sizeof(input_disabledW), (WCHAR*)input_disabledW};
TRACE("(%p, %s)\n", driver, debugstr_w(registry_path->Buffer));
if (!(udev_context = udev_new()))
{
ERR("Can't create udev object\n");
@ -1504,7 +1502,7 @@ error:
#else
NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_path)
NTSTATUS udev_driver_init(void)
{
WARN("Wine was compiled without UDEV support\n");
return STATUS_NOT_IMPLEMENTED;

View File

@ -778,12 +778,6 @@ static void WINAPI driver_unload(DRIVER_OBJECT *driver)
NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
{
static const WCHAR udevW[] = {'\\','D','r','i','v','e','r','\\','U','D','E','V',0};
static UNICODE_STRING udev = {sizeof(udevW) - sizeof(WCHAR), sizeof(udevW), (WCHAR *)udevW};
static const WCHAR iohidW[] = {'\\','D','r','i','v','e','r','\\','I','O','H','I','D',0};
static UNICODE_STRING iohid = {sizeof(iohidW) - sizeof(WCHAR), sizeof(iohidW), (WCHAR *)iohidW};
static const WCHAR sdlW[] = {'\\','D','r','i','v','e','r','\\','S','D','L','J','O','Y',0};
static UNICODE_STRING sdl = {sizeof(sdlW) - sizeof(WCHAR), sizeof(sdlW), (WCHAR *)sdlW};
static const WCHAR SDL_enabledW[] = {'E','n','a','b','l','e',' ','S','D','L',0};
static const UNICODE_STRING SDL_enabled = {sizeof(SDL_enabledW) - sizeof(WCHAR), sizeof(SDL_enabledW), (WCHAR*)SDL_enabledW};
OBJECT_ATTRIBUTES attr = {0};
@ -805,11 +799,11 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
if (check_bus_option(&SDL_enabled, 1))
{
if (IoCreateDriver(&sdl, sdl_driver_init) == STATUS_SUCCESS)
if (sdl_driver_init() == STATUS_SUCCESS)
return STATUS_SUCCESS;
}
IoCreateDriver(&udev, udev_driver_init);
IoCreateDriver(&iohid, iohid_driver_init);
udev_driver_init();
iohid_driver_init();
return STATUS_SUCCESS;
}