Simple question, complex answer :) The following applies to unmanaged C++, nothing in .NET or managed code. However, please consider that I am completely inexperienced in unmanaged C++, and i would be grateful if you explained your answer :)
1. How can I know when a random library is loaded in the system (XP/Vista)? Can be system32 library, can be my library, but ANY library. I can not rely on any standards or hardcode anything, this HAS TO work across all the cases.
2. When the above happens for some certain library, how can I make it so that instead of loading the original library, system loads my library. I already know all about wrappers and how the signature of methods must be the same and all that and have a wrapper for this.
Now.... You may ask, what is all this about. I didn't want to go into detail at the beginning but now here it goes....
I am trying to write something that does what FRAPS do. Except video recording feature, I want to display various things in game (both as an overlay or just a regular text within game's code). FPS, current memory usage, snapshots of desktop are some of them.
I did over 2 months long research. And from my understanding, the popular method of IAT does NOT work anymore all the time. If you read this you will see why:
http://www.codeproject.com/dll/Win32APIHooking_Trouble.asp
Basically, the old fasion model included to get a pointer to a "method" in a library and overwrite it with yours (redirect). Now the safe method is pretty much loading YOUR library (before any load happens) instead of original ones and reroute the calls over your library (you have a proxy dll basically that works better).
The problem is i don't know how to do #1 and #2 above.
Any help will be greatly appreciated, please do post some code samples as I am very very new to unmanaged C++ and the whole idea of WIN API.