开发者

Redirect all file IO in Windows

开发者 https://www.devze.com 2023-04-08 15:12 出处:网络
I\'m using a virtual file system (PhysFS) and I\'d like the entire application to do file IO through this VFS (that includes third-party libraries).

I'm using a virtual file system (PhysFS) and I'd like the entire application to do file IO through this VFS (that includes third-party libraries).

How can I redirect all file IO operations (C FILE* objects and开发者_如何学JAVA C++ streams) through this VFS in Windows?

Also, a related question. Is file IO redirection a common feature of OS APIs? Will it be easy for me to port my application?


API hooking is probably the only way to address the problem. Hooking can be done using third-party helper libraries such as Detours and some other. This method is both non-trivial and not portable. In theory you could use a filesystem filter driver, but this way is much more complicated and requires a kernel-mode driver (which is a PITA to develop).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号