static BOOLEAN RtlpDebugInfoFreeList[MAX_STATIC_CS_DEBUG_OBJECTS];
LARGE_INTEGER RtlpTimeout;
+extern BOOLEAN LdrpShutdownInProgress;
+extern HANDLE LdrpShutdownThreadId;
+
/* FUNCTIONS *****************************************************************/
/*++
if (CriticalSection->DebugInfo)
CriticalSection->DebugInfo->EntryCount++;
+ /*
+ * If we're shutting down the process, we're allowed to acquire any
+ * critical sections by force (the loader lock in particular)
+ */
+ if (LdrpShutdownInProgress &&
+ LdrpShutdownThreadId == NtCurrentTeb()->RealClientId.UniqueThread)
+ {
+ DPRINT("Forcing ownership of critical section %p\n", CriticalSection);
+ CriticalSection->LockCount = 0;
+ return STATUS_SUCCESS;
+ }
+
for (;;)
{
/* Increase the number of times we've had contention */