> "First I would try to hook dx or opengl or win32 functions and then maybe see if you can hook functions in an .exe."
That is exactly what I'm trying first, before stepping deeper into hooking. I've tried in my above example to catch the WM_DESTROY Message of Notepad.exe, but without success...
Furthermore I don't want to post the exact game titel at this moment to prevent spreading OT Posts. First I want to create a step by step how to do it with actuall technologies.
Codeproject and co have many examples... I have allready installed the detours library and also have older versions of that dll. the problem with detours is, that i have to inject this dll with WINJECT, which is IMHO not the best way, if you want to setup an easy to use solution for everyone. I've seen the examples of Muhammad Haggag, but that is not exactly what I call a good tutorial... on the other hand he did a very good job, by writing all the needed directX functionality into one C++ Project, but that is useless for me at all if I try to understand, whats happening in detail...
So I'm going to post some more content to discuss.
I've created a Win 32 C++ Programm (not that hard with VS 2010), which should inject itself into the notepad.exe... but there are some problems, maybe i can start at this point, by getting some help of the codegurus.
so here it is: the Winmain.cpp consists of the following relevant code:
but it always returns me a 0. Does anyone know why? Oh Yes, here is the injector.h file:
#define INJECTIONDLL_API __declspec(dllexport)
INJECTIONDLL_API int fnSetMyHook(DWORD dwThreadId);
Any Help would be appreciated. Also I don't know how to go on then, which methods should be called in the injector.cpp next, if I wan't to catch the WM_Quit Message from Notepad.exe? And how can I use non standard Windows API functions? Like functions that only are implemented in Notepad.exe?
Anyone? Please, I really want to solve, understand and document this kind of problems.
Edit: Tools Available to use: OllyDB and Visual Studio 2010 or Visual Studio 11 developers preview.