martona/mhook

Potential deadlock in debug build

kdbghelp opened this issue · 0 comments

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.