Fix a bug reported by EDK940 "The main thread has not LeaveCriticalSection when be...