Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
db6c5b59
Commit
db6c5b59
authored
Sep 12, 2018
by
Aric Stewart
Committed by
Alexandre Julliard
Sep 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Improve unloading the winebus driver.
Signed-off-by:
Aric Stewart
<
aric@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bfe48889
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
9 deletions
+57
-9
bus.h
dlls/winebus.sys/bus.h
+3
-0
bus_iohid.c
dlls/winebus.sys/bus_iohid.c
+25
-9
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+10
-0
bus_udev.c
dlls/winebus.sys/bus_udev.c
+10
-0
main.c
dlls/winebus.sys/main.c
+9
-0
No files found.
dlls/winebus.sys/bus.h
View file @
db6c5b59
...
...
@@ -22,6 +22,9 @@ typedef int(*enum_func)(DEVICE_OBJECT *device, void *context);
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
;
void
udev_driver_unload
(
void
)
DECLSPEC_HIDDEN
;
void
iohid_driver_unload
(
void
)
DECLSPEC_HIDDEN
;
void
sdl_driver_unload
(
void
)
DECLSPEC_HIDDEN
;
/* Native device function table */
typedef
struct
...
...
dlls/winebus.sys/bus_iohid.c
View file @
db6c5b59
...
...
@@ -98,6 +98,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
static
DRIVER_OBJECT
*
iohid_driver_obj
=
NULL
;
static
IOHIDManagerRef
hid_manager
;
static
CFRunLoopRef
run_loop
;
static
HANDLE
run_loop_handle
;
static
const
WCHAR
busidW
[]
=
{
'I'
,
'O'
,
'H'
,
'I'
,
'D'
,
0
};
...
...
@@ -372,7 +374,7 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender,
/* This puts the relevant run loop for event handling into a WINE thread */
static
DWORD
CALLBACK
runloop_thread
(
void
*
args
)
{
CFRunLoopRef
run_loop
=
CFRunLoopGetCurrent
();
run_loop
=
CFRunLoopGetCurrent
();
IOHIDManagerSetDeviceMatching
(
hid_manager
,
NULL
);
IOHIDManagerRegisterDeviceMatchingCallback
(
hid_manager
,
handle_DeviceMatchingCallback
,
NULL
);
...
...
@@ -388,18 +390,12 @@ static DWORD CALLBACK runloop_thread(void *args)
CFRunLoopRun
();
TRACE
(
"Run Loop exiting
\n
"
);
IOHIDManagerRegisterDeviceMatchingCallback
(
hid_manager
,
NULL
,
NULL
);
IOHIDManagerRegisterDeviceRemovalCallback
(
hid_manager
,
NULL
,
NULL
);
IOHIDManagerUnscheduleFromRunLoop
(
hid_manager
,
run_loop
,
kCFRunLoopDefaultMode
);
CFRelease
(
hid_manager
);
return
1
;
}
NTSTATUS
WINAPI
iohid_driver_init
(
DRIVER_OBJECT
*
driver
,
UNICODE_STRING
*
registry_path
)
{
HANDLE
run_loop_handle
;
TRACE
(
"(%p, %s)
\n
"
,
driver
,
debugstr_w
(
registry_path
->
Buffer
));
iohid_driver_obj
=
driver
;
...
...
@@ -414,10 +410,25 @@ NTSTATUS WINAPI iohid_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registr
return
STATUS_UNSUCCESSFUL
;
}
CloseHandle
(
run_loop_handle
);
return
STATUS_SUCCESS
;
}
void
iohid_driver_unload
(
void
)
{
TRACE
(
"Unloading Driver
\n
"
);
if
(
iohid_driver_obj
!=
NULL
)
{
IOHIDManagerUnscheduleFromRunLoop
(
hid_manager
,
run_loop
,
kCFRunLoopDefaultMode
);
CFRunLoopStop
(
run_loop
);
WaitForSingleObject
(
run_loop_handle
,
INFINITE
);
CloseHandle
(
run_loop_handle
);
IOHIDManagerRegisterDeviceMatchingCallback
(
hid_manager
,
NULL
,
NULL
);
IOHIDManagerRegisterDeviceRemovalCallback
(
hid_manager
,
NULL
,
NULL
);
CFRelease
(
hid_manager
);
}
TRACE
(
"Driver Unloaded
\n
"
);
}
#else
NTSTATUS
WINAPI
iohid_driver_init
(
DRIVER_OBJECT
*
driver
,
UNICODE_STRING
*
registry_path
)
...
...
@@ -426,4 +437,9 @@ NTSTATUS WINAPI iohid_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registr
return
STATUS_NOT_IMPLEMENTED
;
}
void
iohid_driver_unload
(
void
)
{
TRACE
(
"Stub: Unload Driver
\n
"
);
}
#endif
/* HAVE_IOHIDMANAGERCREATE */
dlls/winebus.sys/bus_sdl.c
View file @
db6c5b59
...
...
@@ -927,6 +927,11 @@ static DWORD CALLBACK deviceloop_thread(void *args)
return
0
;
}
void
sdl_driver_unload
(
void
)
{
TRACE
(
"Unload Driver
\n
"
);
}
NTSTATUS
WINAPI
sdl_driver_init
(
DRIVER_OBJECT
*
driver
,
UNICODE_STRING
*
registry_path
)
{
static
const
WCHAR
controller_modeW
[]
=
{
'M'
,
'a'
,
'p'
,
' '
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'l'
,
'e'
,
'r'
,
's'
,
0
};
...
...
@@ -1023,4 +1028,9 @@ NTSTATUS WINAPI sdl_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry_
return
STATUS_NOT_IMPLEMENTED
;
}
void
sdl_driver_unload
(
void
)
{
TRACE
(
"Stub: Unload Driver
\n
"
);
}
#endif
/* SONAME_LIBSDL2 */
dlls/winebus.sys/bus_udev.c
View file @
db6c5b59
...
...
@@ -1418,6 +1418,11 @@ static DWORD CALLBACK deviceloop_thread(void *args)
return
0
;
}
void
udev_driver_unload
(
void
)
{
TRACE
(
"Unload Driver
\n
"
);
}
NTSTATUS
WINAPI
udev_driver_init
(
DRIVER_OBJECT
*
driver
,
UNICODE_STRING
*
registry_path
)
{
HANDLE
events
[
2
];
...
...
@@ -1482,4 +1487,9 @@ NTSTATUS WINAPI udev_driver_init(DRIVER_OBJECT *driver, UNICODE_STRING *registry
return
STATUS_NOT_IMPLEMENTED
;
}
void
udev_driver_unload
(
void
)
{
TRACE
(
"Stub: Unload Driver
\n
"
);
}
#endif
/* HAVE_UDEV */
dlls/winebus.sys/main.c
View file @
db6c5b59
...
...
@@ -699,6 +699,13 @@ BOOL is_xbox_gamepad(WORD vid, WORD pid)
return
FALSE
;
}
static
void
WINAPI
driver_unload
(
DRIVER_OBJECT
*
driver
)
{
udev_driver_unload
();
iohid_driver_unload
();
sdl_driver_unload
();
}
NTSTATUS
WINAPI
DriverEntry
(
DRIVER_OBJECT
*
driver
,
UNICODE_STRING
*
path
)
{
static
const
WCHAR
udevW
[]
=
{
'\\'
,
'D'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
'\\'
,
'U'
,
'D'
,
'E'
,
'V'
,
0
};
...
...
@@ -720,5 +727,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
IoCreateDriver
(
&
udev
,
udev_driver_init
);
IoCreateDriver
(
&
iohid
,
iohid_driver_init
);
driver
->
DriverUnload
=
driver_unload
;
return
STATUS_SUCCESS
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment