Author: mjmartin Date: Wed Apr 7 13:09:36 2010 New Revision: 46761
URL: http://svn.reactos.org/svn/reactos?rev=46761&view=rev Log: [usb/usbehci] - Instead of converting GUID to UNICODE_STRING and comparing, use IsEqualGUIDAligned. Thanks Ged. - Remove a unneeded header.
Modified: trunk/reactos/drivers/usb/usbehci/pdo.c
Modified: trunk/reactos/drivers/usb/usbehci/pdo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/pdo.c?r... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/pdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/pdo.c [iso-8859-1] Wed Apr 7 13:09:36 2010 @@ -17,7 +17,6 @@ #include <wdmguid.h> #include <stdio.h> #include <debug.h> -#include <guiddef.h>
/* Lifted from Linux with slight changes */ const UCHAR ROOTHUB2_DEVICE_DESCRIPTOR [] = @@ -540,39 +539,29 @@ case IRP_MN_QUERY_INTERFACE: { UNICODE_STRING GuidString; - UNICODE_STRING InterfacMatchString; PUSB_BUS_INTERFACE_HUB_V5 InterfaceHub; PUSB_BUS_INTERFACE_USBDI_V2 InterfaceDI; PPDO_DEVICE_EXTENSION PdoDeviceExtension; PFDO_DEVICE_EXTENSION FdoDeviceExtension; - NTSTATUS CompareStatus;
PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension; + + Status = RtlStringFromGUID(Stack->Parameters.QueryInterface.InterfaceType, &GuidString); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create string from GUID!\n"); + } + + DPRINT1("Interface GUID requested %wZ\n", &GuidString); + DPRINT1("QueryInterface.Size %x\n", Stack->Parameters.QueryInterface.Size); + DPRINT1("QueryInterface.Version %x\n", Stack->Parameters.QueryInterface.Version);
/* Assume success */ Status = STATUS_SUCCESS; Information = 0;
- CompareStatus = RtlStringFromGUID(Stack->Parameters.QueryInterface.InterfaceType, &GuidString); - if (!NT_SUCCESS(CompareStatus)) - { - DPRINT1("Failed to create string from GUID!\n"); - } - - DPRINT1("Interface GUID requested %wZ\n", &GuidString); - DPRINT1("QueryInterface.Size %x\n", Stack->Parameters.QueryInterface.Size); - DPRINT1("QueryInterface.Version %x\n", Stack->Parameters.QueryInterface.Version); - - CompareStatus = RtlStringFromGUID(&USB_BUS_INTERFACE_HUB_GUID, &InterfacMatchString); - if (!NT_SUCCESS(CompareStatus)) - { - DPRINT1("Failed to create string from GUID!\n"); - } - - CompareStatus = RtlCompareUnicodeString(&InterfacMatchString, &GuidString, TRUE); - - if (NT_SUCCESS(CompareStatus)) + if (IsEqualGUIDAligned(Stack->Parameters.QueryInterface.InterfaceType, &USB_BUS_INTERFACE_HUB_GUID)) { InterfaceHub = (PUSB_BUS_INTERFACE_HUB_V5)Stack->Parameters.QueryInterface.Interface; InterfaceHub->Version = Stack->Parameters.QueryInterface.Version; @@ -622,15 +611,7 @@ break; }
- CompareStatus = RtlStringFromGUID(&USB_BUS_INTERFACE_USBDI_GUID, &InterfacMatchString); - if (!NT_SUCCESS(CompareStatus)) - { - DPRINT1("Failed to create string from GUID!\n"); - } - - CompareStatus = RtlCompareUnicodeString(&InterfacMatchString, &GuidString, TRUE); - - if (NT_SUCCESS(CompareStatus)) + if (IsEqualGUIDAligned(Stack->Parameters.QueryInterface.InterfaceType, &USB_BUS_INTERFACE_USBDI_GUID)) { InterfaceDI = (PUSB_BUS_INTERFACE_USBDI_V2) Stack->Parameters.QueryInterface.Interface; InterfaceDI->Version = Stack->Parameters.QueryInterface.Version;