c++11 - Is there a way to detour a c++ constructor? -



c++11 - Is there a way to detour a c++ constructor? -

funny thing is, answered question not long ago getting address of c++ constructor saying can't done utilize perfect forwarding instead. however, in terms of detouring using microsoft's detour library, isn't option. address is required in order detour call. have inquire question, if there no address of constructor, possible detour one? , if so, how?

not sure ms detour, hooking detour manually inline assembly in c++. if code (constructor instance) mapped in memory, , can write memory region, detouring is possible.

the basic mechanism of hooking detour find place replace original opcode jump code cave. if jump code doesn't match size of original opcode, fill nops. execute original opcode in code cave pushad & pushfd doing want using global variables (recommended) call custom function without params popfd & popad jump patched opcode (skill bytes of nops)

for first step, obtain address of constructor instance, need search dynamic address either readprocessmemory or method. did detour function dll load dynamically. obtain function, utilize handle temphandle = getmodulehandle((lpcwstr)"dllfilename.dll"); , go offset of dll handle.

c++ c++11 detours

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -