Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- #include <string>
- #include "FuncHook.h"
- #include "headers/CapstoneDisassembler.hpp"
- #include "headers/Detour/x64Detour.hpp"
- #define offset_somme_func 0x140013B40
- int *p_offset_som = (int*)offset_somme_func;
- typedef int(*sum)(int x, int y);
- sum originalSum = (sum)offset_somme_func;
- PLH::x64Detour* PLHhk;
- uint64_t hookPrintfTramp = NULL;
- NOINLINE int __cdecl h_hookPrintf(const char* format, ...){
- //return PLH::FnCast(hookPrintfTramp, originalSum)(12, 80);
- return 14;
- }
- void Main(LPVOID pParam){
- std::cout << "new thread" << std::endl;
- PLH::CapstoneDisassembler dis(PLH::Mode::x64);
- PLHhk = new PLH::x64Detour((char*)&p_offset_som, (char*)&h_hookPrintf, &hookPrintfTramp, dis);
- PLHhk->hook();
- }
- BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID lpReserved){
- if (ul_reason_for_call == DLL_PROCESS_ATTACH){
- DisableThreadLibraryCalls(hinstDLL);
- CreateRemoteThread(GetCurrentProcess(), 0, 0, (LPTHREAD_START_ROUTINE)Main, hinstDLL, 0, 0);
- std::cout << "injected" << std::endl;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement