1

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 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?

Paul Manta
  • 30,618
  • 31
  • 128
  • 208

1 Answers1

1

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).

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
  • It's not a problem per se, just that it would make the code a lot nicer. But it seems the effort required to do this isn't justified in my case. – Paul Manta Sep 27 '11 at 18:08