Rémi Bernon : ntoskrnl.exe: Update the interface if it is already in the tree.
Alexandre Julliard
julliard at winehq.org
Fri Sep 20 15:54:42 CDT 2019
Module: wine
Branch: master
Commit: 8db70e92a899fea6711c4f4fa3fa45adf1574fe8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8db70e92a899fea6711c4f4fa3fa45adf1574fe8
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Sep 20 10:31:40 2019 +0200
ntoskrnl.exe: Update the interface if it is already in the tree.
As we are going to reuse the same device id when re-plugging a
previously plugged SDL controller, the device interfaces are still
present in the tree and IoRegisterDeviceInterface was not updating the
device pointer.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntoskrnl.exe/pnp.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c
index 03c4c401f9..17d61a096a 100644
--- a/dlls/ntoskrnl.exe/pnp.c
+++ b/dlls/ntoskrnl.exe/pnp.c
@@ -622,7 +622,9 @@ NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *cla
WCHAR device_instance_id[MAX_DEVICE_ID_LEN];
SP_DEVICE_INTERFACE_DETAIL_DATA_W *data;
NTSTATUS status = STATUS_SUCCESS;
+ UNICODE_STRING device_path;
struct device_interface *iface;
+ struct wine_rb_entry *entry;
DWORD required;
HDEVINFO set;
@@ -660,19 +662,32 @@ NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *cla
data->DevicePath[1] = '?';
TRACE("Returning path %s.\n", debugstr_w(data->DevicePath));
+ RtlCreateUnicodeString( &device_path, data->DevicePath);
+
+ entry = wine_rb_get( &device_interfaces, &device_path );
+ if (entry)
+ {
+ iface = WINE_RB_ENTRY_VALUE( entry, struct device_interface, entry );
+ if (iface->enabled)
+ ERR("Device interface %s is still enabled.\n", debugstr_us(&iface->symbolic_link));
+ }
+ else
+ {
+ iface = heap_alloc_zero( sizeof(struct device_interface) );
+ RtlCreateUnicodeString(&iface->symbolic_link, data->DevicePath);
+ if (wine_rb_put( &device_interfaces, &iface->symbolic_link, &iface->entry ))
+ ERR("Failed to insert interface %s into tree.\n", debugstr_us(&iface->symbolic_link));
+ }
- iface = heap_alloc_zero( sizeof(struct device_interface) );
iface->device = device;
iface->interface_class = *class_guid;
- RtlCreateUnicodeString(&iface->symbolic_link, data->DevicePath);
if (symbolic_link)
RtlCreateUnicodeString( symbolic_link, data->DevicePath);
- if (wine_rb_put( &device_interfaces, &iface->symbolic_link, &iface->entry ))
- ERR("Failed to insert interface %s into tree.\n", debugstr_us(&iface->symbolic_link));
-
HeapFree( GetProcessHeap(), 0, data );
+ RtlFreeUnicodeString( &device_path );
+
return status;
}
More information about the wine-cvs
mailing list