阅读:1320回复:3
禁止操作某个文件
如果我想禁止操作某个文件,在IRP_MJ_CREATE直接返回STATUS_UNSUCCESSFUL,这样行吗?
能不能给个代码示例!! :P |
|
最新喜欢:![]()
|
驱动老牛
![]() |
沙发#
发布于:2005-02-18 12:49
也可以
|
|
板凳#
发布于:2005-02-18 13:08
可以的
应该很简单 filename匹配。 |
|
|
地板#
发布于:2005-02-18 13:28
这是在filemon中的例子代码,希望有用:
// // If mathe then complete the current IRP // if (match) { Irp->IoStatus.Status = STATUS_ACCESS_DENIED; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_ACCESS_DENIED; } // // Copy parameters down to next level in the stack for the driver below us // *nextIrpStack = *currentIrpStack; IoSetCompletionRoutine( Irp, FprotectDefaultDone, NULL, FALSE, FALSE, FALSE ); // // Return the results of the call to the caller // return IoCallDriver( hookExt->FileSystem, Irp ); |
|
|