阅读:1255回复:2
关于shadow device的问题
参考tooflat 大牛的代码
在sfilter中增加shadow device 在 status = IoCreateDevice( gSFilterDriverObject, sizeof( SFILTER_DEVICE_EXTENSION ), NULL, DeviceObject->DeviceType, 0, FALSE, &newDeviceObject ); 之后加上 status = IoCreateDevice( gSFilterDriverObject, sizeof( SFILTER_DEVICE_EXTENSION ), &ShadowDeviceName, DeviceObject->DeviceType, 0, FALSE, &ShadowDeviceObject); 在确定成功后 用类似 WCHAR wszFile[MAX_PATH] = {0}; // FilterDevice // 我们需要再次打开该文件,为了避免重入... GetFileNameFromFileObject(IrpSp->FileObject, wszFile); // 假设 wszFile 里面原来内容为 L"1.txt" // 修改为 L"\\Device\\FDFilterShadowA\\1.txt" // 然后... OBJECT_ATTRIBUTES oa; InitializeObjectAttributes(&oa, wszFile, ...); ZwCreateFile(..., &oa, ...); // 不会再有重入的问题了,:))) // 因为会进入ShadowDevice's DispatchCreate 这样语句打开设备返回 STATUS_NO_SUCH_DEVICE 想问问大牛们打开设备返 STATUS_NO_SUCH_DEVICE有什么解决方法 谢谢 |
|
沙发#
发布于:2007-05-30 17:45
你的shadow device创建了L"\\Device\\FDFilterShadowA"的symbol了吗
|
|
板凳#
发布于:2007-05-31 10:11
谢谢tooflat的回复以上的问题解决了
是没有对ShadowDeviceName->type设备 |
|