Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HINSTANCE hInjectionMod = LoadLibrary(GH_INJ_MOD_PATH);
- ValidateInjectionFunctions = (f_ValidateInjectionFunctions)GetProcAddress(hInjectionMod, "ValidateInjectionFunctions");
- RestoreInjectionFunctions = (f_RestoreInjectionFunctions)GetProcAddress(hInjectionMod, "RestoreInjectionFunctions");
- HANDLE hProc = GetProcessByName(TARGET);
- DWORD TargetProcessId = GetProcessId(hProc);
- HookInfo info[30];
- DWORD err1, err2;
- UINT CountOut = 0;
- auto val_ret = ValidateInjectionFunctions(TargetProcessId, err1, err2, info, 30, &CountOut);
- if (!val_ret)
- {
- printf("ValidateInjectionFunctions failed:\n\t%08X\n\t%08X\n", err1, err2);
- return false;
- }
- printf("Injection functions validated\n");
- UINT Changed = 0;
- for (UINT i = 0; i != CountOut; ++i)
- {
- if (info[i].ChangeCount && !info[i].ErrorCode)
- {
- printf("Hook detected: %s->%s (%d)\n", info[i].ModuleName, info[i].FunctionName, info[i].ChangeCount);
- ++Changed;
- }
- }
- if (Changed)
- {
- printf("Restoring hooks\n");
- auto res_ret = RestoreInjectionFunctions(TargetProcessId, err1, err2, info, CountOut, &CountOut);
- if (!res_ret)
- {
- printf("RestoreInjectionFunctions failed:\n\t%08X\n\t%08X\n", err1, err2);
- return false;
- }
- printf("Hooks restored\n");
- }
- else
- {
- printf("No hooks found\n");
- }
Add Comment
Please, Sign In to add comment