[NTOS][NDK][RTL] A bunch of 'wrong size' fixes
[reactos.git] / ntoskrnl / io / pnpmgr / pnpreport.c
index 3f324d9..9252320 100644 (file)
@@ -108,6 +108,7 @@ IopGetInterfaceTypeString(INTERFACE_TYPE IfType)
 }
 
 VOID
+NTAPI
 IopReportTargetDeviceChangeAsyncWorker(PVOID Context)
 {
   PINTERNAL_WORK_QUEUE_ITEM Item;
@@ -180,12 +181,7 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
     DPRINT("IoReportDetectedDevice (DeviceObject %p, *DeviceObject %p)\n",
       DeviceObject, DeviceObject ? *DeviceObject : NULL);
 
-    /* Create the service name (eg. ACPI_HAL) */
-    ServiceName.Buffer = DriverObject->DriverName.Buffer +
-       sizeof(DRIVER_ROOT_NAME) / sizeof(WCHAR) - 1;
-    ServiceName.Length = DriverObject->DriverName.Length -
-       sizeof(DRIVER_ROOT_NAME) + sizeof(WCHAR);
-    ServiceName.MaximumLength = ServiceName.Length;
+    ServiceName = DriverObject->DriverExtension->ServiceKeyName;
 
     /* If the interface type is unknown, treat it as internal */
     if (LegacyBusType == InterfaceTypeUndefined)
@@ -429,7 +425,7 @@ IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject,
     /* Check for valid PDO */
     if (!IopIsValidPhysicalDeviceObject(PhysicalDeviceObject))
     {
-        KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG)PhysicalDeviceObject, 0, 0);
+        KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG_PTR)PhysicalDeviceObject, 0, 0);
     }
 
     /* FileObject must be null. PnP will fill in it */
@@ -480,7 +476,7 @@ IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject,
     /* Check for valid PDO */
     if (!IopIsValidPhysicalDeviceObject(PhysicalDeviceObject))
     {
-        KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG)PhysicalDeviceObject, 0, 0);
+        KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, 0x2, (ULONG_PTR)PhysicalDeviceObject, 0, 0);
     }
 
     /* FileObject must be null. PnP will fill in it */
@@ -509,7 +505,7 @@ IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject,
     Item->PhysicalDeviceObject = PhysicalDeviceObject;
     Item->Callback = Callback;
     Item->Context = Context;
-    ExInitializeWorkItem(&(Item->WorkItem), (PWORKER_THREAD_ROUTINE)IopReportTargetDeviceChangeAsyncWorker, Item);
+    ExInitializeWorkItem(&(Item->WorkItem), IopReportTargetDeviceChangeAsyncWorker, Item);
 
     /* Finally, queue the item, our work here is done */
     ExQueueWorkItem(&(Item->WorkItem), DelayedWorkQueue);