martona / mhook

A Windows API hooking library
Other
728 stars 326 forks source link

Potential deadlock in debug build #31

Open kdbghelp opened 5 years ago

kdbghelp commented 5 years ago

When build mhook in debug mode, in function SuspendOneThread: ODPRINTF((L"mhooks: SuspendOneThread: Successfully suspended thread %d - IP is at %p", dwThreadId, pIp)); break; and in ODPRINTF will call _vscwprintf, in _vscwprintf it potential call _free_dbg, this will acquire the VCRuntime lock. At the meantime, if the suspended thread is doing some malloc or free and hold the runtime lock, the program will hang.