I used MadCodeHook V3.1.6, licensed version, Link 32bit madCodeHook static library in WIN32 MFC APP on Windows 7 64 bits English OS.
run GetCurrentSessionId as this sequence case: GetCurrentSessionId _1, InitializeMadCHook(), HookAPI ..., FinalizeMadCHook(), GetCurrentSessionId _2.
The GetCurrentSessionId _2 got a 0xC0000005: Access violation writing location 0xffffffff.
if GetCurrentSessionId _2 run before FinalizeMadCHook(), then runs ok.
GetCurrentSessionId _1 always runs ok.
report: GetCurrentSessionId get exception
Re: report: GetCurrentSessionId get exception
You should never call any madCodeHook APIs outside of InitializeMadCHook()/FinalizeMadCHook(). Some of the APIs might succeed, some might silently fail, some might crash, if you call them before InitializeMadCHook() or after "FinalizeMadCHook()".
Or is there a specific situation where you can't avoid having to call some APIs after FinalizeMadCHook()? I don't see why that should happen.
Or is there a specific situation where you can't avoid having to call some APIs after FinalizeMadCHook()? I don't see why that should happen.
Re: report: GetCurrentSessionId get exception
thanks, I never paid that much attention to call any madCodeHook APIs must inside of InitializeMadCHook()/FinalizeMadCHook().
sometime I call some API e.g. GetCurrentSessionId directly without InitializeMadCHook() before, I should check that code now .
sometime I call some API e.g. GetCurrentSessionId directly without InitializeMadCHook() before, I should check that code now .
Re: report: GetCurrentSessionId get exception
Hi Madshi, is enough using a pair of InitializeMadCHook on begin /FinalizeMadCHook on end for a multi-thread MS VC application or dll?
Re: report: GetCurrentSessionId get exception
Sorry for the late reply. Yes, one pair of InitializeMadCHook()/FinalizeMadCHook() is enough. Actually, please do not call it more than once.