{
PIO_STACK_LOCATION IoStackLocation;
//PPDO_EXTENSION PdoExtension;
PFDO_EXTENSION FdoExtension;
NTSTATUSStatus;
UCHARMinor;
/* Get the device extension and stack location */
FdoExtension = DeviceObject->DeviceExtension;
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
Minor = IoStackLocation->MinorFunction;
/* FDO? */if (FdoExtension->ExtensionType == FdoExtensionType)
{
/* Query the IRP type */switch (Minor)
{
caseIRP_MN_QUERY_DEVICE_RELATIONS:
/* Call the worker */DPRINT("Querying device relations for FDO\n");
Status = HalpQueryDeviceRelations(DeviceObject,
IoStackLocation->Parameters.QueryDeviceRelations.Type,
(PVOID)&Irp->IoStatus.Information);
break;
caseIRP_MN_QUERY_INTERFACE:
/* Call the worker */DPRINT("Querying interface for FDO\n");
Status = HalpQueryInterface(DeviceObject,
IoStackLocation->Parameters.QueryInterface.InterfaceType,
IoStackLocation->Parameters.QueryInterface.Size,
IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
IoStackLocation->Parameters.QueryInterface.Version,
IoStackLocation->Parameters.QueryInterface.Interface,
(PVOID)&Irp->IoStatus.Information);
break;
caseIRP_MN_QUERY_ID:
/* Call the worker */DPRINT("Querying ID for FDO\n");
Status = HalpQueryIdFdo(DeviceObject,
IoStackLocation->Parameters.QueryId.IdType,
(PVOID)&Irp->IoStatus.Information);
break;
caseIRP_MN_QUERY_CAPABILITIES:
/* Call the worker */DPRINT("Querying the capabilities for the FDO\n");
Status = HalpQueryCapabilities(DeviceObject,
IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
break;
default:
DPRINT("Other IRP: %lx\n", Minor);
Status = Irp->IoStatus.Status;
break;
}
/* Nowhere for the IRP to go since we also own the PDO */Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
returnStatus;
}
else
{
/* This is a PDO instead */ASSERT(FdoExtension->ExtensionType == PdoExtensionType);
//PdoExtension = (PPDO_EXTENSION)FdoExtension;/* Query the IRP type */
Status = STATUS_SUCCESS;
switch (Minor)
{
caseIRP_MN_START_DEVICE:
/* We only care about a PCI PDO */DPRINT1("Start device received\n");
/* Complete the IRP normally */break;
caseIRP_MN_REMOVE_DEVICE:
/* Check if this is a PCI device */DPRINT1("Remove device received\n");
/* We're done */
Status = STATUS_SUCCESS;
break;
caseIRP_MN_SURPRISE_REMOVAL:
/* Inherit whatever status we had */DPRINT1("Surprise removal IRP\n");
Status = Irp->IoStatus.Status;
break;
caseIRP_MN_QUERY_DEVICE_RELATIONS:
/* Query the device relations */DPRINT("Querying PDO relations\n");
Status = HalpQueryDeviceRelations(DeviceObject,
IoStackLocation->Parameters.QueryDeviceRelations.Type,
(PVOID)&Irp->IoStatus.Information);
break;
caseIRP_MN_QUERY_INTERFACE:
/* Call the worker */DPRINT("Querying interface for PDO\n");
Status = HalpQueryInterface(DeviceObject,
IoStackLocation->Parameters.QueryInterface.InterfaceType,
IoStackLocation->Parameters.QueryInterface.Size,
IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
IoStackLocation->Parameters.QueryInterface.Version,
IoStackLocation->Parameters.QueryInterface.Interface,
(PVOID)&Irp->IoStatus.Information);
break;
caseIRP_MN_QUERY_CAPABILITIES:
/* Call the worker */DPRINT("Querying the capabilities for the PDO\n");
Status = HalpQueryCapabilities(DeviceObject,
IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
break;
caseIRP_MN_QUERY_RESOURCES:
/* Call the worker */DPRINT("Querying the resources for the PDO\n");
Status = HalpQueryResources(DeviceObject, (PVOID)&Irp->IoStatus.Information);
break;
caseIRP_MN_QUERY_RESOURCE_REQUIREMENTS:
/* Call the worker */DPRINT("Querying the resource requirements for the PDO\n");
Status = HalpQueryResourceRequirements(DeviceObject,
(PVOID)&Irp->IoStatus.Information);
break;
caseIRP_MN_QUERY_ID:
/* Call the worker */DPRINT("Query the ID for the PDO\n");
Status = HalpQueryIdPdo(DeviceObject,
IoStackLocation->Parameters.QueryId.IdType,
(PVOID)&Irp->IoStatus.Information);
break;
default:
/* We don't handle anything else, so inherit the old state */DPRINT("Illegal IRP: %lx\n", Minor);
Status = Irp->IoStatus.Status;
break;
}
/* If it's not supported, inherit the old status */if (Status == STATUS_NOT_SUPPORTED) Status = Irp->IoStatus.Status;
/* Complete the IRP */DPRINT("IRP completed with status: %lx\n", Status);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
returnStatus;
}
}
Generated on Sun May 27 2012 05:27:25 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.