I need to hook 10/20 functions like these:
static void* __cdecl HookFunction1(char *FileName, int a2, int a3, int a4);
__declspec(naked) void HookFunction2(char *Src, int pedx, int
a3, int a4, int a5, int a6);
static BOOL HookFunction3(int a1, DWORD *a2, DWORD *a3, int a4, char a5, int a6);
and I use this code:
switch (int iD)
{
case 1
DetourAttach(&(LPVOID&)AddressOfHook, &HookFunction1);
case 2
DetourAttach(&(LPVOID&)AddressOfHook, &HookFunction2);
case 3
DetourAttach(&(LPVOID&)AddressOfHook, &HookFunction3);
.....
}
but I like to not repeat x times "DetourAttach" and I like do to something like this:
switch (int iD)
{
case 1
HookFunction = &HookFunction1;
case 2
HookFunction = &HookFunction2;
case 3
HookFunction = &HookFunction3;
.....
}
DetourAttach(&(LPVOID&)AddressOfHook, &HookFunction);
I ask if there is a easy way to do this becouse is more flexible.
Thanks !!