Author: tfaber
Date: Sat Feb 4 13:47:16 2012
New Revision: 55410
URL:
http://svn.reactos.org/svn/reactos?rev=55410&view=rev
Log:
[RTL]
- Work around Wine's misuse of critical section debug flags. Hopefully fixes KVM
Modified:
trunk/reactos/lib/rtl/critical.c
Modified: trunk/reactos/lib/rtl/critical.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/critical.c?rev=554…
==============================================================================
--- trunk/reactos/lib/rtl/critical.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/critical.c [iso-8859-1] Sat Feb 4 13:47:16 2012
@@ -200,7 +200,7 @@
DPRINT1("Signaling Failed for: %p, %p, 0x%08lx\n",
CriticalSection,
CriticalSection->LockSemaphore,
- Status);
+ Status);
RtlRaiseStatus(Status);
}
}
@@ -316,7 +316,7 @@
NtCurrentTeb()->ClientId.UniqueProcess);
RtlpDebugInfoFreeList[EntryId] = FALSE;
- } else {
+ } else if (!DebugInfo->Flags) {
/* It's a dynamic one, so free from the heap */
DPRINT("Freeing from Heap: %p inside Process: %p\n",
@@ -324,6 +324,13 @@
NtCurrentTeb()->ClientId.UniqueProcess);
RtlFreeHeap(NtCurrentPeb()->ProcessHeap, 0, DebugInfo);
+ } else {
+
+ /* Wine stores a section name pointer in the Flags member */
+ DPRINT("Assuming static: %p inside Process: %p\n",
+ DebugInfo,
+ NtCurrentTeb()->ClientId.UniqueProcess);
+
}
}
@@ -365,7 +372,9 @@
{
/* Remove it from the list */
RemoveEntryList(&CriticalSection->DebugInfo->ProcessLocksList);
+#if 0 /* We need to preserve Flags for RtlpFreeDebugInfo */
RtlZeroMemory(CriticalSection->DebugInfo,
sizeof(RTL_CRITICAL_SECTION_DEBUG));
+#endif
}
/* Unprotect */
@@ -546,6 +555,7 @@
CritcalSectionDebugData->ContentionCount = 0;
CritcalSectionDebugData->EntryCount = 0;
CritcalSectionDebugData->CriticalSection = CriticalSection;
+ CritcalSectionDebugData->Flags = 0;
CriticalSection->DebugInfo = CritcalSectionDebugData;
/*