驱动中的小技巧

从对象指针得到名称

RtlInitUnicodeString( &nameString, L"\\Device\\RawCdRom" );

status = IoGetDeviceObjectPointer(
            &nameString,
            FILE_READ_ATTRIBUTES,
            &fileObject,
            &rawDeviceObject );

从名称得到对象指针

用NLGetAndAllocateObjectName

    devName = NLGetAndAllocateObjectName( DeviceObject,
                                          &gSfNameBufferLookasideList );



NLGetAndAllocateObjectName需要namelookup库.新版的sfilter带

转载于:https://www.cnblogs.com/fanzi2009/archive/2009/05/07/1452100.html

猜你喜欢

转载自blog.csdn.net/weixin_34177064/article/details/94192489