Thanks for your quick reply, unfortunately it is too late too.
There are 2 threads in the DLL, at cleaning up, main thread sends an event to ask sub-thread to exit, and main thread is waiting for it died. But the sub-thread will be deadklock in _endthreadex or more directly in System Call ExitThread.
I do not want to somebody else to cleanup for it, I would like to do it by itself.
MS mentioned that "Warning There are serious limits on what you can do in a DLL entry point." I do not know it is only in Initialization or also includes the "Cleanup" stage, if it does, then the way I did is not correct.
Thanks a lot,