I am writing a global hook to correct for triple head monitor window positioning on platforms such as the Matrox TripleHead2Go which so far works very well for 32bit programs, but now I need to build the 64bit version I need some assistance in translating my x86 opcodes for the wndproc thunk I install on each window class.
The thunk adds an extra argument to the wndproc call, which is the original wndproc address, so that then my wndproc handler can call it at the end.
#ifdef _WIN64
//TODO: figure out the WIN64 instructions
#else
const unsigned char PatchTemplate[] =
{
0x90, // nop, will become int3 if debug = true
0x58, // pop eax (get the return address)
0x68, 0x00, 0x00, 0x00, 0x00, // push imm32, original wndproc address
0x50, // push eax (restore the return address)
0x68, 0x00, 0x00, 0x00, 0x00, // push imm32, our wndproc address
0xC3 // retn
};
#define PATCH_ORIG_OFFSET 3
#define PATCH_NEW_OFFSET 9
#endif