Windows内核代码片段
+ -

IoCallDriver函数源代码

2022-05-07 81 0

#define IoCallDriver   IofCallDriver


NTSTATUS FASTCALL IofCallDriver    (    IN PDEVICE_OBJECT     DeviceObject,
IN PIRP     Irp 
)    
{
     PDRIVER_OBJECT DriverObject;
     PIO_STACK_LOCATION StackPtr;

     /* Make sure this is a valid IRP */
     ASSERT(Irp->Type == IO_TYPE_IRP);

     /* 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);
 }
 `

0 篇笔记 写笔记

IoCallDriver函数源代码
#define IoCallDriver IofCallDriverNTSTATUS FASTCALL IofCallDriver ( IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp ) { PDRI......
IRP调用IoSkipCurrentIrpStackLocation与IoCopyCurrentIrpStackLocationToNext的区别
当IPR需要传递给下层设备时,一般的操作有两种。第一种是直接下传: IoCopyCurrentIrpStackLocationToNext(irp); status = IoCallDriver(parentFdoExt->fdo, irp);这种情况下是保留当前驱动栈对该IRP的IO_......
作者信息
我爱内核
Windows驱动开发,网站开发
好好学习,天天向上。
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

您的支持,是我们前进的动力!