[EMAIL PROTECTED] writes: > However as far as I can see Wine does not yet have a full definition of the > RtlEnterCriticalSection and RtlLeaveCriticalSection functions either. Do > you have them? I think they are basically the slow part of Enter/LeaveCriticalSection. Something like this should work: Index: scheduler/critsection.c =================================================================== RCS file: /opt/cvs-commit/wine/scheduler/critsection.c,v retrieving revision 1.20 diff -u -r1.20 critsection.c --- scheduler/critsection.c 2000/06/07 02:15:40 1.20 +++ scheduler/critsection.c 2000/09/08 19:07:33 @@ -65,6 +65,50 @@ /*********************************************************************** + * RtlpWaitForCriticalSection (NTDLL.@) + */ +void WINAPI RtlpWaitForCriticalSection( CRITICAL_SECTION *crit ) +{ + for (;;) + { + EXCEPTION_RECORD rec; + HANDLE sem = get_semaphore( crit ); + + DWORD res = WaitForSingleObject( sem, 5000L ); + if ( res == WAIT_TIMEOUT ) + { + ERR("Critical section %p wait timed out, retrying (60 sec)\n", crit ); + res = WaitForSingleObject( sem, 60000L ); + if ( res == WAIT_TIMEOUT && TRACE_ON(relay) ) + { + ERR("Critical section %p wait timed out, retrying (5 min)\n", crit ); + res = WaitForSingleObject( sem, 300000L ); + } + } + if (res == STATUS_WAIT_0) break; + + rec.ExceptionCode = EXCEPTION_CRITICAL_SECTION_WAIT; + rec.ExceptionFlags = 0; + rec.ExceptionRecord = NULL; + rec.ExceptionAddress = RtlRaiseException; /* sic */ + rec.NumberParameters = 1; + rec.ExceptionInformation[0] = (DWORD)crit; + RtlRaiseException( &rec ); + } +} + + +/*********************************************************************** + * RtlpUnWaitCriticalSection (NTDLL.@) + */ +void WINAPI RtlpUnWaitCriticalSection( CRITICAL_SECTION *crit ) +{ + HANDLE sem = get_semaphore( crit ); + ReleaseSemaphore( sem, 1, NULL ); +} + + +/*********************************************************************** * EnterCriticalSection (KERNEL32.195) (NTDLL.344) */ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit ) @@ -78,32 +122,7 @@ } /* Now wait for it */ - for (;;) - { - EXCEPTION_RECORD rec; - HANDLE sem = get_semaphore( crit ); - - DWORD res = WaitForSingleObject( sem, 5000L ); - if ( res == WAIT_TIMEOUT ) - { - ERR("Critical section %p wait timed out, retrying (60 sec)\n", crit ); - res = WaitForSingleObject( sem, 60000L ); - if ( res == WAIT_TIMEOUT && TRACE_ON(relay) ) - { - ERR("Critical section %p wait timed out, retrying (5 min)\n", crit ); - res = WaitForSingleObject( sem, 300000L ); - } - } - if (res == STATUS_WAIT_0) break; - - rec.ExceptionCode = EXCEPTION_CRITICAL_SECTION_WAIT; - rec.ExceptionFlags = 0; - rec.ExceptionRecord = NULL; - rec.ExceptionAddress = RtlRaiseException; /* sic */ - rec.NumberParameters = 1; - rec.ExceptionInformation[0] = (DWORD)crit; - RtlRaiseException( &rec ); - } + RtlpWaitForCriticalSection( crit ); } crit->OwningThread = GetCurrentThreadId(); crit->RecursionCount = 1; @@ -149,8 +168,7 @@ if (InterlockedDecrement( &crit->LockCount ) >= 0) { /* Someone is waiting */ - HANDLE sem = get_semaphore( crit ); - ReleaseSemaphore( sem, 1, NULL ); + RtlpUnWaitCriticalSection( crit ); } } Index: dlls/ntdll/ntdll.spec =================================================================== RCS file: /opt/cvs-commit/wine/dlls/ntdll/ntdll.spec,v retrieving revision 1.22 diff -u -r1.22 ntdll.spec --- dlls/ntdll/ntdll.spec 2000/08/25 22:12:42 1.22 +++ dlls/ntdll/ntdll.spec 2000/09/08 19:07:34 @@ -550,8 +550,8 @@ @ stub RtlpNtOpenKey @ stub RtlpNtQueryValueKey @ stub RtlpNtSetValueKey -@ stub RtlpUnWaitCriticalSection -@ stub RtlpWaitForCriticalSection +@ stdcall RtlpUnWaitCriticalSection(ptr) RtlpUnWaitCriticalSection +@ stdcall RtlpWaitForCriticalSection(ptr) RtlpWaitForCriticalSection @ stdcall RtlxAnsiStringToUnicodeSize(ptr) RtlAnsiStringToUnicodeSize @ stdcall RtlxOemStringToUnicodeSize(ptr) RtlOemStringToUnicodeSize @ stdcall RtlxUnicodeStringToAnsiSize(ptr) RtlUnicodeStringToAnsiSize -- Alexandre Julliard [EMAIL PROTECTED]