TsudaKageyu/minhook — pull request #4 by RaMMicHaeL (2014-07-28 11:07:16+00:00)
Title: Simplify initialization check check

Simplifies initialization check by using a global flag. Depends on https://github.com/TsudaKageyu/minhook/pull/3.

The drawback of this approach is that the `MH_Initialize`, `MH_Uninitialize` functions are not thread safe anymore, and the user has to guarantee that those functions are called alone, without other functions of the library racing around.

On the other hand, the previous implementation wasn't completely thread safe either, and the method of detecting uninitialization by catching `EnterCriticalSection` exceptions was ugly and AFAIK undocumented.

The C++ version solved the issue nicely by initializing the critical section in the module constructor, but there's no such luxury in C.