반응형

IoCallDriver in ReactOS

 

 

NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)

{

           /* Call fastcall */

           return IofCallDriver(DeviceObject, Irp);

}

 

NTSTATUS FASTCALL IofCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)

{

           PDRIVER_OBJECT DriverObject;

           PIO_STACK_LOCATION StackPtr;

 

           /* Get the Driver Object */

           DriverObject = DeviceObject->DriverObject;

 

           /* Decrease the current location and check if */

           Irp->CurrentLocation--;

           if ( Irp->CurrentLocation <= 0 )

           {

                     /* This IRP ran out of stack, bugcheck */

                     KeBugCheckEx(NO_MORE_IRP_STACK_LOCATIONS, (ULONG_PTR)Irp, 0, 0, 0);

           }

 

           /* Now update the stack location */

           StackPtr = IoGetNextIrpStackLocation(Irp);

           Irp->Tail.Overlay.CurrentStackLocation = StackPtr;

 

           /* Get the Device Object */

           StackPtr->DeviceObject = DeviceObject;

 

           /* Call it */

           return DriverObject->MajorFunction[StackPtr->MajorFunction](DeviceObject,   Irp);

}

 

반응형

+ Recent posts