阅读:4052回复:1
文件名重定向新办法
大家知道,过去,文件(目录)名重定向只能是STATUS_REPARSE,重发IO请求,我曾经异想天开直接替换文件对象中的文件名,现在还真有这么一回事:(来源win7rc WDK)
The Simulate Reparse Sample demonstrates how to return STATUS_REPARSE on precreates. This allows the filter to redirect opens down one path to another path. The Precreate path is complicated by network query opens which come down as Fast IO. Fast IO cannot be redirected with Status Reparse because reparse only works on IRP based IO. 这个模拟解析例子演示在前打开文件是返回重解析,这样允许过滤器将打开一个路径重新定向到另外一个路径。 但网络查询打开由Fast IO,这是不能被重新定向的,重定向只能在基本的IRP IO工作。 Simulating reparse points requires that the filter replace the name in the file object. This will cause Driver Verifier to complain that the filter is leaking pool and will prevent it from being unloaded. To solve this issue SimRep attempts to use a Windows 7 Function called IoReplaceFileObjectName which will allow IO Mgr to replace the name for us with the correct pool tag. However, on downlevel OS Versions SimRep will go ahead and replace the name itself. 模拟解析点需要过滤器文件对象中替换名称,这将导致驱动校验抱怨过滤器导致池泄漏因此 卸载过滤器。为了解决这个问题,SimRep使用了windows7中才支持的函数IoReplaceFileObjectName, 这个函数允许设置正确的池标签,在IO管理器中替换名称,但是,在更低的OS中,SimRep自己处理更换名称。 It is important to note that SimRep only demonstrates how to return STATUS_REPARSE, not how to deal with file names on NT. SimRep uses two strings to act as a mapping. When the file open name starts with the "old name mapping" string the filter replaces it with the "new name mapping" string. This does not take short names into accound. Additionally we do not filter renames, so renames around the mapping will not work correctly. Finially, SimRep does not munge directory enumeration queries, which will break so name normalization, 要指出的是:SimRep仅仅演示了返回STATUS_REPARSE,不是怎么在NT中分派文件名,SimRep使用两个字符串作为活动映射, 当一个文件以“老文件名视图”字符串,过滤器使用“新文件名视图”字符串替换,不处理短文件名。另外,不处理文件改名, 因此文件改名将不能正常工作,最后,SimRep不处理目录查询。 |
|
沙发#
发布于:2009-06-08 09:52
看了一下,这种办法好像只能在一个卷不同目录中实现重定向,不能重定向到另外卷。
|
|