Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
23081e8e
Commit
23081e8e
authored
Apr 24, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineusb.sys: Correctly implement device removal.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3e8bca0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
wineusb.c
dlls/wineusb.sys/wineusb.c
+35
-4
No files found.
dlls/wineusb.sys/wineusb.c
View file @
23081e8e
...
...
@@ -69,6 +69,7 @@ static struct list device_list = LIST_INIT(device_list);
struct
usb_device
{
struct
list
entry
;
BOOL
removed
;
DEVICE_OBJECT
*
device_obj
;
...
...
@@ -126,6 +127,7 @@ static void add_usb_device(libusb_device *libusb_device)
EnterCriticalSection
(
&
wineusb_cs
);
list_add_tail
(
&
device_list
,
&
device
->
entry
);
device
->
removed
=
FALSE
;
LeaveCriticalSection
(
&
wineusb_cs
);
IoInvalidateDeviceRelations
(
bus_pdo
,
BusRelations
);
...
...
@@ -142,15 +144,14 @@ static void remove_usb_device(libusb_device *libusb_device)
{
if
(
device
->
libusb_device
==
libusb_device
)
{
libusb_unref_device
(
device
->
libusb_device
);
libusb_close
(
device
->
handle
);
list_remove
(
&
device
->
entry
);
IoInvalidateDeviceRelations
(
bus_pdo
,
BusRelations
);
IoDeleteDevice
(
device
->
device_obj
);
device
->
removed
=
TRUE
;
break
;
}
}
LeaveCriticalSection
(
&
wineusb_cs
);
IoInvalidateDeviceRelations
(
bus_pdo
,
BusRelations
);
}
static
BOOL
thread_shutdown
;
...
...
@@ -378,8 +379,38 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp)
case
IRP_MN_START_DEVICE
:
case
IRP_MN_QUERY_CAPABILITIES
:
case
IRP_MN_SURPRISE_REMOVAL
:
ret
=
STATUS_SUCCESS
;
break
;
case
IRP_MN_REMOVE_DEVICE
:
{
LIST_ENTRY
*
entry
;
EnterCriticalSection
(
&
wineusb_cs
);
while
((
entry
=
RemoveHeadList
(
&
device
->
irp_list
))
!=
&
device
->
irp_list
)
{
irp
=
CONTAINING_RECORD
(
entry
,
IRP
,
Tail
.
Overlay
.
ListEntry
);
irp
->
IoStatus
.
Status
=
STATUS_CANCELLED
;
irp
->
IoStatus
.
Information
=
0
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
}
LeaveCriticalSection
(
&
wineusb_cs
);
if
(
device
->
removed
)
{
libusb_unref_device
(
device
->
libusb_device
);
libusb_close
(
device
->
handle
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
IoDeleteDevice
(
device
->
device_obj
);
return
STATUS_SUCCESS
;
}
ret
=
STATUS_SUCCESS
;
break
;
}
default:
FIXME
(
"Unhandled minor function %#x.
\n
"
,
stack
->
MinorFunction
);
...
...
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