zoukankan      html  css  js  c++  java
  • 获得FDO by name

        NTSTATUS            ntStatus = STATUS_SUCCESS;  
        PDEVICE_OBJECT  DeviceObject = NULL;  
        PFILE_OBJECT        FileObject = NULL;    
        ntStatus = IoGetDeviceObjectPointer(pObjectName,FILE_ALL_ACCESS,&FileObject,&DeviceObject);  
        if(!NT_SUCCESS(ntStatus))  
        {  
            KdPrint(("IoGetDeviceObjectPointer Failed,ntStatus = 0x%08lX\n",ntStatus));  
            goto _EXIT0_;  
        }  
        KdPrint(("IoGetDeviceObjectPointer succeed!\n"));  
     
        DeviceObject = IoGetLowerDeviceObject(DeviceObject);  
        if(!DeviceObject)  
        {  
            KdPrint(("IoGetLowerDeviceObject Failed,ntStatus = 0x%08lX!\n",ntStatus));  
            ntStatus = STATUS_UNSUCCESSFUL;  
            goto _EXIT1_;  
        }  
     
        while(!(DeviceObject->Flags & DO_BUS_ENUMERATED_DEVICE))  
        {  
            ObDereferenceObject(DeviceObject);  
            DeviceObject = IoGetLowerDeviceObject(DeviceObject);  
            if(!DeviceObject)  
            {  
                ObDereferenceObject(FileObject);  
                ntStatus = STATUS_UNSUCCESSFUL;  
                goto _EXIT1_;  
            }   
        }

    照例pdo设备都会在Flags中设置DO_BUS_ENUMERATED_DEVICE,这也是判断PDO和FDO的标准之一

    The IoGetLowerDeviceObject routine returns a pointer to the next-lower-level device object on the driver stack.

    Ntifs.h (include Ntifs.h)

    <= DISPATCH_LEVEL

  • 相关阅读:
    tcpdump命令详解
    Python isdecimal()方法
    Python-Tkinter几何布局管理
    Python choice() 函数
    Python中的join()函数的用法
    PLSQL连接虚拟机中的Oracle数据库
    卸载oracle
    teradata学习
    teradata在虚拟机安装客户端sql Assistant
    oracle面试
  • 原文地址:https://www.cnblogs.com/ahuo/p/2011449.html
Copyright © 2011-2022 走看看