I'm trying to make a small proxy dll that will be able to print out all the files that a game tries to access from disk.
I'm using a dinput8 wrapper dll as my proxy dll, from where I've managed to attach a console and print out stuff. But I think I don't understand how exactly I am supposed to hook the ReadFile function.
First of all I am not sure if this is possible at all, considering that I want to create and export a wrapper function for ReadFile, whose declaration is in a completely different dll from the one I'm wrapping.
What I'm trying right now (and its not working) is to declare a ReadFile_wrapper function, which is practically calling the original function right now:
extern "C" BOOL WINAPI ReadFile_wrapper(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
MessageBoxA(NULL, "Reading", "", 0);
return ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
Also I'm declaring a definition in the .def file, so that the export function is named like the original ReadFile function
I'm obviously missing something critical here, so any help is highly appreciated.