// count length of string
//
String = DeviceId;
- while(*String)
+ while (*String)
{
StringLength = wcslen(String) + 1;
Length += StringLength;
//
*OutString = String;
- while(*DeviceId)
+ while (*DeviceId)
{
StringLength = swprintf(String, L"%s&MI_%02x", DeviceId, InterfaceNumber) + 1;
Length = wcslen(DeviceId) + 1;
DPRINT("BusQueryDeviceID %S\n", Buffer);
ExFreePool((PVOID)Irp->IoStatus.Information);
- Irp->IoStatus .Information = (ULONG_PTR)Buffer;
+ Irp->IoStatus.Information = (ULONG_PTR)Buffer;
}
else
{
switch(IoStack->MinorFunction)
{
- case IRP_MN_QUERY_DEVICE_RELATIONS:
- {
- //
- // handle device relations
- //
- Status = USBCCGP_PdoHandleDeviceRelations(DeviceObject, Irp);
- break;
- }
- case IRP_MN_QUERY_DEVICE_TEXT:
- {
- //
- // handle query device text
- //
- Status = USBCCGP_PdoHandleQueryDeviceText(DeviceObject, Irp);
- break;
- }
- case IRP_MN_QUERY_ID:
- {
- //
- // handle request
- //
- Status = USBCCGP_PdoHandleQueryId(DeviceObject, Irp);
- break;
- }
- case IRP_MN_REMOVE_DEVICE:
- {
- //
- // remove us from the fdo's pdo list
- //
- bFound = FALSE;
- for(Index = 0; Index < PDODeviceExtension->FDODeviceExtension->FunctionDescriptorCount; Index++)
- {
- if (PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] == DeviceObject)
- {
- //
- // remove us
- //
- PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] = NULL;
- bFound = TRUE;
- break;
- }
- }
-
- //
- // Complete the IRP
- //
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- if (bFound)
- {
- //
- // Delete the device object
- //
- IoDeleteDevice(DeviceObject);
- }
- return STATUS_SUCCESS;
- }
- case IRP_MN_QUERY_CAPABILITIES:
- {
- //
- // copy device capabilities
- //
- RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities, &PDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
-
- /* Complete the IRP */
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_SUCCESS;
- }
+ case IRP_MN_QUERY_DEVICE_RELATIONS:
+ {
+ //
+ // handle device relations
+ //
+ Status = USBCCGP_PdoHandleDeviceRelations(DeviceObject, Irp);
+ break;
+ }
+ case IRP_MN_QUERY_DEVICE_TEXT:
+ {
+ //
+ // handle query device text
+ //
+ Status = USBCCGP_PdoHandleQueryDeviceText(DeviceObject, Irp);
+ break;
+ }
+ case IRP_MN_QUERY_ID:
+ {
+ //
+ // handle request
+ //
+ Status = USBCCGP_PdoHandleQueryId(DeviceObject, Irp);
+ break;
+ }
+ case IRP_MN_REMOVE_DEVICE:
+ {
+ //
+ // remove us from the fdo's pdo list
+ //
+ bFound = FALSE;
+ for(Index = 0; Index < PDODeviceExtension->FDODeviceExtension->FunctionDescriptorCount; Index++)
+ {
+ if (PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] == DeviceObject)
+ {
+ //
+ // remove us
+ //
+ PDODeviceExtension->FDODeviceExtension->ChildPDO[Index] = NULL;
+ bFound = TRUE;
+ break;
+ }
+ }
+
+ //
+ // Complete the IRP
+ //
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ if (bFound)
+ {
+ //
+ // Delete the device object
+ //
+ IoDeleteDevice(DeviceObject);
+ }
+ return STATUS_SUCCESS;
+ }
+ case IRP_MN_QUERY_CAPABILITIES:
+ {
+ //
+ // copy device capabilities
+ //
+ RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities, &PDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
+
+ /* Complete the IRP */
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_SUCCESS;
+ }
case IRP_MN_QUERY_REMOVE_DEVICE:
case IRP_MN_QUERY_STOP_DEVICE:
{
Status = STATUS_SUCCESS;
break;
}
- case IRP_MN_START_DEVICE:
- {
- //
- // no-op for PDO
- //
- DPRINT("[USBCCGP] PDO IRP_MN_START\n");
- Status = STATUS_SUCCESS;
- break;
- }
- case IRP_MN_QUERY_INTERFACE:
- {
- //
- // forward to lower device object
- //
- IoSkipCurrentIrpStackLocation(Irp);
- return IoCallDriver(PDODeviceExtension->NextDeviceObject, Irp);
- }
- default:
+ case IRP_MN_START_DEVICE:
+ {
+ //
+ // no-op for PDO
+ //
+ DPRINT("[USBCCGP] PDO IRP_MN_START\n");
+ Status = STATUS_SUCCESS;
+ break;
+ }
+ case IRP_MN_QUERY_INTERFACE:
+ {
+ //
+ // forward to lower device object
+ //
+ IoSkipCurrentIrpStackLocation(Irp);
+ return IoCallDriver(PDODeviceExtension->NextDeviceObject, Irp);
+ }
+ default:
{
//
// do nothing
NTSTATUS
USBCCGP_BuildConfigurationDescriptor(
- PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
//
TotalSize = sizeof(USB_CONFIGURATION_DESCRIPTOR);
- for(Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++)
+ for (Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++)
{
//
// get current interface descriptor
// move to next descriptor
//
InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength);
- }while(TRUE);
+ } while(TRUE);
}
//
RtlCopyMemory(Buffer, ConfigurationDescriptor, sizeof(USB_CONFIGURATION_DESCRIPTOR));
BufferPtr = (PUCHAR)((ULONG_PTR)Buffer + ConfigurationDescriptor->bLength);
- for(Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++)
+ for (Index = 0; Index < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; Index++)
{
//
// get current interface descriptor
// move to next descriptor
//
InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength);
- }while(TRUE);
+ } while(TRUE);
}
//
NTSTATUS
USBCCGP_PDOSelectConfiguration(
- PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
// search for the interface in the local interface list
//
FoundInterface = FALSE;
- for(InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; InterfaceIndex++)
+ for (InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->FunctionDescriptor->NumberOfInterfaces; InterfaceIndex++)
{
if (PDODeviceExtension->FunctionDescriptor->InterfaceDescriptorList[InterfaceIndex]->bInterfaceNumber == InterfaceInformation->InterfaceNumber)
{
// now query the total interface list
//
Entry = NULL;
- for(InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->InterfaceListCount; InterfaceIndex++)
+ for (InterfaceIndex = 0; InterfaceIndex < PDODeviceExtension->InterfaceListCount; InterfaceIndex++)
{
if (PDODeviceExtension->InterfaceList[InterfaceIndex].Interface->InterfaceNumber == InterfaceInformation->InterfaceNumber)
{
NeedSelect = FALSE;
if (Entry->InterfaceDescriptor->bAlternateSetting == InterfaceInformation->AlternateSetting)
{
-
for(InterfaceIndex = 0; InterfaceIndex < InterfaceInformation->NumberOfPipes; InterfaceIndex++)
{
if (InterfaceInformation->Pipes[InterfaceIndex].MaximumTransferSize != Entry->Interface->Pipes[InterfaceIndex].MaximumTransferSize)
FreeItem(NewUrb);
}
- }while(Length);
+ } while(Length);
//
// store configuration handle
NTSTATUS
PDO_HandleInternalDeviceControl(
- PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
}
else if (Urb->UrbHeader.Function == URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE)
{
- if(Urb->UrbControlDescriptorRequest.DescriptorType == USB_DEVICE_DESCRIPTOR_TYPE)
+ if (Urb->UrbControlDescriptorRequest.DescriptorType == USB_DEVICE_DESCRIPTOR_TYPE)
{
//
// is the buffer big enough
return Status;
}
-
-
DPRINT1("IOCTL %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
DPRINT1("InputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.InputBufferLength);
DPRINT1("OutputBufferLength %lu\n", IoStack->Parameters.DeviceIoControl.OutputBufferLength);
NTSTATUS
PDO_Dispatch(
- PDEVICE_OBJECT DeviceObject,
+ PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
-
}