Commit 161693e4 authored by James Abbatiello's avatar James Abbatiello Committed by Alexandre Julliard

Addresses issues with multiple processes accessing non-global critical

sections.
parent 942010a7
......@@ -519,8 +519,10 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
/* Initialize critical section */
InitializeCriticalSection( &heap->critSection );
if (!SystemHeap) /* System heap critical section has to be global */
MakeCriticalSectionGlobal( &heap->critSection );
/* FIXME: once separate address spaces are implemented, only */
/* the SystemHeap critical section should be global */
/* if (!SystemHeap) */
MakeCriticalSectionGlobal( &heap->critSection );
}
/* Create the first free block */
......
......@@ -64,6 +64,12 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
FIXME_(win32)("entering uninitialized section(%p)?\n",crit);
InitializeCriticalSection(crit);
}
if ( crit->Reserved && crit->Reserved != GetCurrentProcessId() )
{
FIXME_(win32)("Crst %p belongs to process %ld, current is %ld!\n",
crit, crit->Reserved, GetCurrentProcessId() );
return;
}
if (InterlockedIncrement( &crit->LockCount ))
{
if (crit->OwningThread == GetCurrentThreadId())
......@@ -71,15 +77,8 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
crit->RecursionCount++;
return;
}
/* Now wait for it */
if ( crit->Reserved && crit->Reserved != GetCurrentProcessId() )
{
FIXME_(win32)("Crst %p belongs to process %ld, current is %ld!\n",
crit, crit->Reserved, GetCurrentProcessId() );
return;
}
/* Now wait for it */
res = WaitForSingleObject( crit->LockSemaphore, 5000L );
if ( res == WAIT_TIMEOUT )
{
......
......@@ -85,6 +85,8 @@ PERQUEUEDATA * PERQDATA_CreateInstance( )
* since this may be shared by different threads. see AttachThreadInput()
*/
InitializeCriticalSection( &pQData->cSection );
/* FIXME: not all per queue data critical sections should be global */
MakeCriticalSectionGlobal( &pQData->cSection );
/* Save perQData globally for 16 bit tasks */
if ( bIsWin16 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment