Aric Stewart : ntoskrnl.exe: Implement DevicePropertyEnumeratorName for IoGetDeviceProperty.

Alexandre Julliard julliard at winehq.org
Mon Sep 19 10:32:13 CDT 2016


Module: wine
Branch: master
Commit: 2abe5573526b8a05daea1136981cea844fc78c76
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2abe5573526b8a05daea1136981cea844fc78c76

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Sep 19 15:13:58 2016 +0200

ntoskrnl.exe: Implement DevicePropertyEnumeratorName for IoGetDeviceProperty.

Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntoskrnl.exe/ntoskrnl.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index bc7ac86..93029a4 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -94,6 +94,8 @@ struct wine_driver
     DRIVER_EXTENSION driver_extension;
 };
 
+static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCHAR **id );
+
 static int wine_drivers_rb_compare( const void *key, const struct wine_rb_entry *entry )
 {
     const struct wine_driver *driver = WINE_RB_ENTRY_VALUE( entry, const struct wine_driver, entry );
@@ -1132,6 +1134,30 @@ NTSTATUS WINAPI IoGetDeviceProperty( DEVICE_OBJECT *device, DEVICE_REGISTRY_PROP
            property_buffer, result_length );
     switch (device_property)
     {
+        case DevicePropertyEnumeratorName:
+        {
+            WCHAR *id, *ptr;
+
+            status = get_device_id( device, BusQueryInstanceID, &id );
+            if (status != STATUS_SUCCESS)
+            {
+                ERR( "Failed to get device id\n" );
+                break;
+            }
+
+            struprW( id );
+            ptr = strchrW( id, '\\' );
+            if (ptr) *ptr = 0;
+
+            *result_length = sizeof(WCHAR) * (strlenW(id) + 1);
+            if (buffer_length >= *result_length)
+                memcpy( property_buffer, id, *result_length );
+            else
+                status = STATUS_BUFFER_TOO_SMALL;
+
+            HeapFree( GetProcessHeap(), 0, id );
+            break;
+        }
         case DevicePropertyPhysicalDeviceObjectName:
         {
             ULONG used_len, len = buffer_length + sizeof(OBJECT_NAME_INFORMATION);




More information about the wine-cvs mailing list