Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top