PATCH:

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I had a stubborn NT app that was refusing to run because it thought Wine's critical section objects were incorrect. Wine was leaving the DebugInfo field NULL except for internally used sections where it contained the name for debugging purposes. I just changed it to allocate DebugInfo structures for all sections and put the names in one of the "spare" entries in the DebugInfo structure.


Changelog:
- Allocate DebugInfo field for all critical sections

Index: dlls/dinput/keyboard/main.c
===================================================================
RCS file: /home/wine/wine/dlls/dinput/keyboard/main.c,v
retrieving revision 1.25
diff -u -r1.25 main.c
--- dlls/dinput/keyboard/main.c	16 Jun 2003 20:22:13 -0000	1.25
+++ dlls/dinput/keyboard/main.c	26 Jul 2003 02:33:40 -0000
@@ -72,7 +72,7 @@
 
 static BYTE DInputKeyState[256]; /* array for 'GetDeviceState' */
 
-static CRITICAL_SECTION keyboard_crit = CRITICAL_SECTION_INIT("dinput_keyboard");
+CRITICAL_SECTION_INIT_S( keyboard_crit );
 static DWORD keyboard_users;
 static HHOOK keyboard_hook;
 
Index: dlls/gdi/driver.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/driver.c,v
retrieving revision 1.24
diff -u -r1.24 driver.c
--- dlls/gdi/driver.c	23 Jun 2003 20:51:41 -0000	1.24
+++ dlls/gdi/driver.c	26 Jul 2003 02:33:41 -0000
@@ -41,7 +41,7 @@
 
 static struct graphics_driver *first_driver;
 static struct graphics_driver *display_driver;
-static CRITICAL_SECTION driver_section = CRITICAL_SECTION_INIT( "driver_section" );
+CRITICAL_SECTION_INIT_S( driver_section );
 
 /**********************************************************************
  *	     create_driver
Index: dlls/kernel/console.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/console.c,v
retrieving revision 1.18
diff -u -r1.18 console.c
--- dlls/kernel/console.c	23 Jun 2003 18:12:28 -0000	1.18
+++ dlls/kernel/console.c	26 Jul 2003 02:33:43 -0000
@@ -1274,7 +1274,7 @@
 static unsigned int             CONSOLE_IgnoreCtrlC = 0; /* FIXME: this should be inherited somehow */
 static struct ConsoleHandler    CONSOLE_DefaultConsoleHandler = {CONSOLE_DefaultHandler, NULL};
 static struct ConsoleHandler*   CONSOLE_Handlers = &CONSOLE_DefaultConsoleHandler;
-static CRITICAL_SECTION         CONSOLE_CritSect = CRITICAL_SECTION_INIT("console_ctrl_section");
+CRITICAL_SECTION_INIT_S( CONSOLE_CritSect );
 
 /*****************************************************************************/
 
Index: dlls/kernel/kernel_main.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/kernel_main.c,v
retrieving revision 1.45
diff -u -r1.45 kernel_main.c
--- dlls/kernel/kernel_main.c	23 Jun 2003 18:12:28 -0000	1.45
+++ dlls/kernel/kernel_main.c	26 Jul 2003 02:33:43 -0000
@@ -53,7 +53,7 @@
 
 extern int main_create_flags;
 
-static CRITICAL_SECTION ldt_section = CRITICAL_SECTION_INIT("ldt_section");
+CRITICAL_SECTION_INIT_S( ldt_section );
 
 /***********************************************************************
  *           locking for LDT routines
Index: dlls/ntdll/critsection.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/critsection.c,v
retrieving revision 1.20
diff -u -r1.20 critsection.c
--- dlls/ntdll/critsection.c	16 Jun 2003 19:36:22 -0000	1.20
+++ dlls/ntdll/critsection.c	26 Jul 2003 02:33:43 -0000
@@ -27,6 +27,7 @@
 #include "winerror.h"
 #include "winternl.h"
 #include "wine/debug.h"
+#include "ntdll_misc.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 WINE_DECLARE_DEBUG_CHANNEL(relay);
@@ -73,7 +74,19 @@
  */
 NTSTATUS WINAPI RtlInitializeCriticalSection( RTL_CRITICAL_SECTION *crit )
 {
-    crit->DebugInfo      = NULL;
+    crit->DebugInfo      = RtlAllocateHeap(ntdll_get_process_heap(), 0, sizeof(CRITICAL_SECTION_DEBUG));
+    if (crit->DebugInfo)
+    {
+        crit->DebugInfo->Type = 0;
+        crit->DebugInfo->CreatorBackTraceIndex = 0;
+        crit->DebugInfo->CriticalSection = crit;
+        crit->DebugInfo->ProcessLocksList.Blink = &(crit->DebugInfo->ProcessLocksList);
+        crit->DebugInfo->ProcessLocksList.Flink = &(crit->DebugInfo->ProcessLocksList);
+        crit->DebugInfo->EntryCount = 0;
+        crit->DebugInfo->ContentionCount = 0;
+        crit->DebugInfo->Spare[0] = 0;
+        crit->DebugInfo->Spare[1] = 0;
+    }
     crit->LockCount      = -1;
     crit->RecursionCount = 0;
     crit->OwningThread   = 0;
@@ -125,6 +138,16 @@
     crit->OwningThread   = 0;
     if (crit->LockSemaphore) NtClose( crit->LockSemaphore );
     crit->LockSemaphore  = 0;
+    if (crit->DebugInfo)
+    {
+        /* only free the ones we made in here */
+        if (!crit->DebugInfo->Spare[1])
+        {
+            
+            RtlFreeHeap( ntdll_get_process_heap(), 0, crit->DebugInfo );
+            crit->DebugInfo = NULL;
+        }
+    }
     return STATUS_SUCCESS;
 }
 
@@ -153,7 +176,8 @@
         status = NtWaitForSingleObject( sem, FALSE, &time );
         if ( status == WAIT_TIMEOUT )
         {
-            const char *name = (char *)crit->DebugInfo;
+            const char *name = NULL;
+            if (crit->DebugInfo) name = (char *)crit->DebugInfo->Spare[1];
             if (!name) name = "?";
             ERR( "section %p %s wait timed out in thread %04lx, blocked by %04lx, retrying (60 sec)\n",
                  crit, debugstr_a(name), GetCurrentThreadId(), (DWORD)crit->OwningThread );
@@ -170,7 +194,7 @@
         if (status == STATUS_WAIT_0) return STATUS_SUCCESS;
 
         /* Throw exception only for Wine internal locks */
-        if (!crit->DebugInfo) continue;
+        if ((!crit->DebugInfo) || (!crit->DebugInfo->Spare[1])) continue;
 
         rec.ExceptionCode    = STATUS_POSSIBLE_DEADLOCK;
         rec.ExceptionFlags   = 0;
Index: dlls/ntdll/loader.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/loader.c,v
retrieving revision 1.31
diff -u -r1.31 loader.c
--- dlls/ntdll/loader.c	18 Jul 2003 23:00:49 -0000	1.31
+++ dlls/ntdll/loader.c	26 Jul 2003 02:33:44 -0000
@@ -64,7 +64,7 @@
 static UINT tls_total_size;        /* total size of TLS storage */
 static const IMAGE_TLS_DIRECTORY **tls_dirs;  /* array of TLS directories */
 
-static CRITICAL_SECTION loader_section = CRITICAL_SECTION_INIT( "loader_section" );
+CRITICAL_SECTION_INIT_S( loader_section );
 static WINE_MODREF *cached_modref;
 static WINE_MODREF *current_modref;
 
Index: dlls/ntdll/rtl.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/rtl.c,v
retrieving revision 1.62
diff -u -r1.62 rtl.c
--- dlls/ntdll/rtl.c	15 May 2003 04:20:43 -0000	1.62
+++ dlls/ntdll/rtl.c	26 Jul 2003 02:33:45 -0000
@@ -40,7 +40,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 
 
-static RTL_CRITICAL_SECTION peb_lock = CRITICAL_SECTION_INIT("peb_lock");
+CRITICAL_SECTION_INIT_S( peb_lock );
 
 /* CRC polynomial 0xedb88320 */
 static const DWORD CRC_table[256] =
Index: dlls/ntdll/virtual.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/virtual.c,v
retrieving revision 1.8
diff -u -r1.8 virtual.c
--- dlls/ntdll/virtual.c	8 Jul 2003 21:18:45 -0000	1.8
+++ dlls/ntdll/virtual.c	26 Jul 2003 02:33:46 -0000
@@ -95,7 +95,7 @@
 
 
 static FILE_VIEW *VIRTUAL_FirstView;
-static CRITICAL_SECTION csVirtual = CRITICAL_SECTION_INIT("csVirtual");
+CRITICAL_SECTION_INIT_S( csVirtual );
 
 #ifdef __i386__
 /* These are always the same on an i386, and it will be faster this way */
Index: dlls/ole32/compobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.c,v
retrieving revision 1.79
diff -u -r1.79 compobj.c
--- dlls/ole32/compobj.c	9 Jul 2003 19:49:12 -0000	1.79
+++ dlls/ole32/compobj.c	26 Jul 2003 02:33:47 -0000
@@ -65,7 +65,7 @@
 
 
 APARTMENT MTA, *apts;
-static CRITICAL_SECTION csApartment = CRITICAL_SECTION_INIT("csApartment");
+CRITICAL_SECTION_INIT_S( csApartment );
 
 /*
  * This lock count counts the number of times CoInitialize is called. It is
@@ -93,7 +93,7 @@
   struct tagRegisteredClass* nextClass;
 } RegisteredClass;
 
-static CRITICAL_SECTION csRegisteredClassList = CRITICAL_SECTION_INIT("csRegisteredClassList");
+CRITICAL_SECTION_INIT_S( csRegisteredClassList );
 static RegisteredClass* firstRegisteredClass = NULL;
 
 /*****************************************************************************
@@ -112,7 +112,7 @@
   struct tagOpenDll *next;
 } OpenDll;
 
-static CRITICAL_SECTION csOpenDllList = CRITICAL_SECTION_INIT("csOpenDllList");
+CRITICAL_SECTION_INIT_S( csOpenDllList );
 static OpenDll *openDllList = NULL; /* linked list of open dlls */
 
 static const char aptWinClass[] = "WINE_OLE32_APT_CLASS";
Index: dlls/ole32/ifs.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ifs.c,v
retrieving revision 1.27
diff -u -r1.27 ifs.c
--- dlls/ole32/ifs.c	22 Jul 2003 01:01:06 -0000	1.27
+++ dlls/ole32/ifs.c	26 Jul 2003 02:33:48 -0000
@@ -59,7 +59,7 @@
 _Malloc32 Malloc32 = {&VT_IMalloc32, 0, NULL, 0, 0, NULL, 0};
 
 /* with a spy active all calls from pre to post methods are threadsave */
-static CRITICAL_SECTION IMalloc32_SpyCS = CRITICAL_SECTION_INIT("IMalloc32_SpyCS");
+CRITICAL_SECTION_INIT_S( IMalloc32_SpyCS );
 
 /* resize the old table */
 static int SetSpyedBlockTableLength ( int NewLength )
Index: dlls/rpcrt4/rpc_binding.c
===================================================================
RCS file: /home/wine/wine/dlls/rpcrt4/rpc_binding.c,v
retrieving revision 1.12
diff -u -r1.12 rpc_binding.c
--- dlls/rpcrt4/rpc_binding.c	19 Apr 2003 20:06:42 -0000	1.12
+++ dlls/rpcrt4/rpc_binding.c	26 Jul 2003 02:33:49 -0000
@@ -41,7 +41,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
 static RpcConnection* conn_cache;
-static CRITICAL_SECTION conn_cache_cs = CRITICAL_SECTION_INIT("conn_cache_cs");
+CRITICAL_SECTION_INIT_S( conn_cache_cs );
 
 LPSTR RPCRT4_strndupA(LPSTR src, INT slen)
 {
Index: dlls/rpcrt4/rpc_server.c
===================================================================
RCS file: /home/wine/wine/dlls/rpcrt4/rpc_server.c,v
retrieving revision 1.17
diff -u -r1.17 rpc_server.c
--- dlls/rpcrt4/rpc_server.c	22 May 2003 03:36:00 -0000	1.17
+++ dlls/rpcrt4/rpc_server.c	26 Jul 2003 02:33:49 -0000
@@ -55,13 +55,13 @@
 static RpcServerProtseq* protseqs;
 static RpcServerInterface* ifs;
 
-static CRITICAL_SECTION server_cs = CRITICAL_SECTION_INIT("RpcServer");
-static CRITICAL_SECTION listen_cs = CRITICAL_SECTION_INIT("RpcListen");
+CRITICAL_SECTION_INIT_S( server_cs );
+CRITICAL_SECTION_INIT_S( listen_cs );
 static BOOL std_listen;
 static LONG listen_count = -1;
 static HANDLE mgr_event, server_thread;
 
-static CRITICAL_SECTION spacket_cs = CRITICAL_SECTION_INIT("RpcServerPacket");
+CRITICAL_SECTION_INIT_S( spacket_cs );
 static RpcPacket* spacket_head;
 static RpcPacket* spacket_tail;
 static HANDLE server_sem;
Index: dlls/shell32/changenotify.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/changenotify.c,v
retrieving revision 1.22
diff -u -r1.22 changenotify.c
--- dlls/shell32/changenotify.c	15 Jul 2003 20:53:40 -0000	1.22
+++ dlls/shell32/changenotify.c	26 Jul 2003 02:33:49 -0000
@@ -27,7 +27,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
-static CRITICAL_SECTION SHELL32_ChangenotifyCS = CRITICAL_SECTION_INIT("SHELL32_ChangenotifyCS");
+CRITICAL_SECTION_INIT_S( SHELL32_ChangenotifyCS );
 
 /* internal list of notification clients (internal) */
 typedef struct _NOTIFICATIONLIST
Index: dlls/shell32/iconcache.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/iconcache.c,v
retrieving revision 1.65
diff -u -r1.65 iconcache.c
--- dlls/shell32/iconcache.c	10 Dec 2002 19:10:11 -0000	1.65
+++ dlls/shell32/iconcache.c	26 Jul 2003 02:33:50 -0000
@@ -58,7 +58,7 @@
 } SIC_ENTRY, * LPSIC_ENTRY;
 
 static HDPA		sic_hdpa = 0;
-static CRITICAL_SECTION SHELL32_SicCS = CRITICAL_SECTION_INIT("SHELL32_SicCS");
+CRITICAL_SECTION_INIT_S( SHELL32_SicCS );
 
 /*****************************************************************************
  * SIC_CompareEntries
Index: dlls/user/message.c
===================================================================
RCS file: /home/wine/wine/dlls/user/message.c,v
retrieving revision 1.41
diff -u -r1.41 message.c
--- dlls/user/message.c	11 Jul 2003 21:55:59 -0000	1.41
+++ dlls/user/message.c	26 Jul 2003 02:33:52 -0000
@@ -1126,7 +1126,7 @@
 static      struct DDE_pair*    dde_pairs;
 static      int                 dde_num_alloc;
 static      int                 dde_num_used;
-static      CRITICAL_SECTION    dde_crst = CRITICAL_SECTION_INIT("Raw_DDE_CritSect");
+CRITICAL_SECTION_INIT_S ( dde_crst );
 
 static BOOL dde_add_pair(HGLOBAL chm, HGLOBAL shm)
 {
Index: dlls/user/dde/misc.c
===================================================================
RCS file: /home/wine/wine/dlls/user/dde/misc.c,v
retrieving revision 1.19
diff -u -r1.19 misc.c
--- dlls/user/dde/misc.c	7 Jun 2003 00:33:53 -0000	1.19
+++ dlls/user/dde/misc.c	26 Jul 2003 02:33:53 -0000
@@ -49,7 +49,7 @@
 static WDML_INSTANCE*	WDML_InstanceList = NULL;
 static DWORD		WDML_MaxInstanceID = 0;  /* OK for present, have to worry about wrap-around later */
 const char		WDML_szEventClass[] = "DdeEventClass";
-CRITICAL_SECTION	WDML_CritSect = CRITICAL_SECTION_INIT("WDML_CritSect");
+CRITICAL_SECTION_INIT_NS( WDML_CritSect );
 
 /* ================================================================
  *
Index: dlls/winaspi/winaspi32.c
===================================================================
RCS file: /home/wine/wine/dlls/winaspi/winaspi32.c,v
retrieving revision 1.27
diff -u -r1.27 winaspi32.c
--- dlls/winaspi/winaspi32.c	30 Jun 2003 20:53:49 -0000	1.27
+++ dlls/winaspi/winaspi32.c	26 Jul 2003 02:33:54 -0000
@@ -51,7 +51,7 @@
 #ifdef linux
 
 static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
-static CRITICAL_SECTION ASPI_CritSection = CRITICAL_SECTION_INIT("ASPI_CritSection");
+CRITICAL_SECTION_INIT_S( ASPI_CritSection );
 
 #endif /* defined(linux) */
 
Index: dlls/winedos/dosvm.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosvm.c,v
retrieving revision 1.45
diff -u -r1.45 dosvm.c
--- dlls/winedos/dosvm.c	8 Jul 2003 21:11:52 -0000	1.45
+++ dlls/winedos/dosvm.c	26 Jul 2003 02:33:54 -0000
@@ -76,7 +76,7 @@
   struct _DOSEVENT *next;
 } DOSEVENT, *LPDOSEVENT;
 
-static CRITICAL_SECTION qcrit = CRITICAL_SECTION_INIT("DOSVM");
+CRITICAL_SECTION_INIT_S( qcrit );
 static struct _DOSEVENT *pending_event, *current_event;
 static HANDLE event_notifier;
 
Index: dlls/winedos/vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.37
diff -u -r1.37 vga.c
--- dlls/winedos/vga.c	8 Jul 2003 21:11:52 -0000	1.37
+++ dlls/winedos/vga.c	26 Jul 2003 02:33:55 -0000
@@ -131,7 +131,7 @@
  * tries to modify VGA state. This is not how real VGA adapters work,
  * but it makes timing and correctness issues much easier to deal with.
  */
-static CRITICAL_SECTION vga_lock = CRITICAL_SECTION_INIT("VGA");
+CRITICAL_SECTION_INIT_S( vga_lock );
 
 typedef HRESULT (WINAPI *DirectDrawCreateProc)(LPGUID,LPDIRECTDRAW *,LPUNKNOWN);
 static DirectDrawCreateProc pDirectDrawCreate;
Index: dlls/winsock/async.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/async.c,v
retrieving revision 1.28
diff -u -r1.28 async.c
--- dlls/winsock/async.c	30 Oct 2002 20:26:32 -0000	1.28
+++ dlls/winsock/async.c	26 Jul 2003 02:33:56 -0000
@@ -112,7 +112,7 @@
 
 
 /* critical section to protect some non-rentrant net function */
-CRITICAL_SECTION csWSgetXXXbyYYY = CRITICAL_SECTION_INIT("csWSgetXXXbyYYY");
+CRITICAL_SECTION_INIT_NS( csWSgetXXXbyYYY );
 
 /* protoptypes of some functions in socket.c
  */
Index: dlls/x11drv/x11drv_main.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11drv_main.c,v
retrieving revision 1.70
diff -u -r1.70 x11drv_main.c
--- dlls/x11drv/x11drv_main.c	23 Jun 2003 23:02:03 -0000	1.70
+++ dlls/x11drv/x11drv_main.c	26 Jul 2003 02:33:56 -0000
@@ -52,7 +52,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
 
-static CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT("X11DRV_CritSection");
+CRITICAL_SECTION_INIT_S( X11DRV_CritSection );
 
 Screen *screen;
 Visual *visual;
Index: dlls/x11drv/xrender.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/xrender.c,v
retrieving revision 1.20
diff -u -r1.20 xrender.c
--- dlls/x11drv/xrender.c	8 Jan 2003 21:09:26 -0000	1.20
+++ dlls/x11drv/xrender.c	26 Jul 2003 02:33:57 -0000
@@ -120,7 +120,7 @@
 MAKE_FUNCPTR(XRenderQueryExtension)
 #undef MAKE_FUNCPTR
 
-static CRITICAL_SECTION xrender_cs = CRITICAL_SECTION_INIT("xrender_cs");
+CRITICAL_SECTION_INIT_S( xrender_cs );
 
 
 /***********************************************************************
Index: files/profile.c
===================================================================
RCS file: /home/wine/wine/files/profile.c,v
retrieving revision 1.89
diff -u -r1.89 profile.c
--- files/profile.c	27 Jun 2003 19:40:56 -0000	1.89
+++ files/profile.c	26 Jul 2003 02:33:59 -0000
@@ -90,7 +90,7 @@
 static const WCHAR emptystringW[] = {0};
 static const WCHAR wininiW[] = { 'w','i','n','.','i','n','i',0 };
 
-static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect");
+CRITICAL_SECTION_INIT_S( PROFILE_CritSect );
 
 static const char hex[16] = "0123456789ABCDEF";
 
Index: graphics/x11drv/xfont.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/xfont.c,v
retrieving revision 1.116
diff -u -r1.116 xfont.c
--- graphics/x11drv/xfont.c	9 Jul 2003 04:18:22 -0000	1.116
+++ graphics/x11drv/xfont.c	26 Jul 2003 02:34:01 -0000
@@ -322,7 +322,7 @@
 
 static int		DefResolution = 0;
 
-static CRITICAL_SECTION crtsc_fonts_X11 = CRITICAL_SECTION_INIT("crtsc_fonts_X11");
+CRITICAL_SECTION_INIT_S( crtsc_fonts_X11 );
 
 static fontResource*	fontList = NULL;
 static fontObject*      fontCache = NULL;		/* array */
Index: include/winbase.h
===================================================================
RCS file: /home/wine/wine/include/winbase.h,v
retrieving revision 1.187
diff -u -r1.187 winbase.h
--- include/winbase.h	24 Jul 2003 00:03:45 -0000	1.187
+++ include/winbase.h	26 Jul 2003 02:34:03 -0000
@@ -840,7 +840,22 @@
 #define	FORMAT_MESSAGE_MAX_WIDTH_MASK	0x000000FF
 
 #ifdef __WINESRC__
-#define CRITICAL_SECTION_INIT(name) { (void *)(__FILE__ ": " name), -1, 0, 0, 0, 0 }
+#define SYSLEVEL_INIT_S(name, lvl) \
+static CRITICAL_SECTION_DEBUG name##_debug = { 0, 0, NULL, { NULL, NULL }, 0, 0, { 0, (DWORD) ((void *) (__FILE__ ": " #name)) } }; \
+static SYSLEVEL name = { { &name##_debug, -1, 0, 0, 0, 0 }, lvl }; \
+
+#define CRITICAL_SECTION_INIT_S(name) \
+static CRITICAL_SECTION_DEBUG name##_debug = { 0, 0, NULL, { NULL, NULL }, 0, 0, { 0, (DWORD) ((void *) (__FILE__ ": " #name)) } }; \
+static CRITICAL_SECTION name = { &name##_debug, -1, 0, 0, 0, 0 }; \
+
+#define SYSLEVEL_INIT_NS(name, lvl) \
+CRITICAL_SECTION_DEBUG name##_debug = { 0, 0, NULL, { NULL, NULL }, 0, 0, { 0, (DWORD) ((void *) (__FILE__ ": " #name)) } }; \
+SYSLEVEL name = { { &name##_debug, -1, 0, 0, 0, 0 }, lvl }; \
+
+#define CRITICAL_SECTION_INIT_NS(name) \
+CRITICAL_SECTION_DEBUG name##_debug = { 0, 0, NULL, { NULL, NULL }, 0, 0, { 0, (DWORD) ((void *) (__FILE__ ": " #name)) } }; \
+CRITICAL_SECTION name = { &name##_debug, -1, 0, 0, 0, 0 }; \
+
 #endif
 
 typedef struct {
Index: objects/gdiobj.c
===================================================================
RCS file: /home/wine/wine/objects/gdiobj.c,v
retrieving revision 1.87
diff -u -r1.87 gdiobj.c
--- objects/gdiobj.c	21 May 2003 18:28:49 -0000	1.87
+++ objects/gdiobj.c	26 Jul 2003 02:34:04 -0000
@@ -66,7 +66,7 @@
 
 static HGDIOBJ stock_objects[NB_STOCK_OBJECTS];
 
-static SYSLEVEL GDI_level = { CRITICAL_SECTION_INIT("GDI_level"), 3 };
+SYSLEVEL_INIT_S( GDI_level, 3 );
 static WORD GDI_HeapSel;
 
 inline static BOOL get_bool(char *buffer)
Index: scheduler/pthread.c
===================================================================
RCS file: /home/wine/wine/scheduler/pthread.c,v
retrieving revision 1.33
diff -u -r1.33 pthread.c
--- scheduler/pthread.c	23 Jun 2003 18:12:28 -0000	1.33
+++ scheduler/pthread.c	26 Jul 2003 02:34:05 -0000
@@ -225,7 +225,7 @@
 
 #define MAX_ATFORK 8  /* libc doesn't need that many anyway */
 
-static CRITICAL_SECTION atfork_section = CRITICAL_SECTION_INIT("atfork_section");
+CRITICAL_SECTION_INIT_S( atfork_section );
 typedef void (*atfork_handler)();
 static atfork_handler atfork_prepare[MAX_ATFORK];
 static atfork_handler atfork_parent[MAX_ATFORK];
Index: scheduler/syslevel.c
===================================================================
RCS file: /home/wine/wine/scheduler/syslevel.c,v
retrieving revision 1.36
diff -u -r1.36 syslevel.c
--- scheduler/syslevel.c	23 Jun 2003 18:12:28 -0000	1.36
+++ scheduler/syslevel.c	26 Jul 2003 02:34:05 -0000
@@ -32,7 +32,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(win32);
 
-static SYSLEVEL Win16Mutex = { CRITICAL_SECTION_INIT("Win16Mutex"), 1 };
+SYSLEVEL_INIT_S( Win16Mutex, 1 );
 
 /* Global variable to save current TEB while in 16-bit code */
 WORD SYSLEVEL_Win16CurrentTeb = 0;
Index: windows/cursoricon.c
===================================================================
RCS file: /home/wine/wine/windows/cursoricon.c,v
retrieving revision 1.65
diff -u -r1.65 cursoricon.c
--- windows/cursoricon.c	19 May 2003 19:01:31 -0000	1.65
+++ windows/cursoricon.c	26 Jul 2003 02:34:06 -0000
@@ -93,7 +93,7 @@
 } ICONCACHE;
 
 static ICONCACHE *IconAnchor = NULL;
-static CRITICAL_SECTION IconCrst = CRITICAL_SECTION_INIT("IconCrst");
+CRITICAL_SECTION_INIT_S( IconCrst );
 static WORD ICON_HOTSPOT = 0x4242;
 
 
Index: windows/timer.c
===================================================================
RCS file: /home/wine/wine/windows/timer.c,v
retrieving revision 1.41
diff -u -r1.41 timer.c
--- windows/timer.c	3 Dec 2002 23:34:52 -0000	1.41
+++ windows/timer.c	26 Jul 2003 02:34:07 -0000
@@ -50,7 +50,7 @@
 
 static TIMER TimersArray[NB_TIMERS];
 
-static CRITICAL_SECTION csTimer = CRITICAL_SECTION_INIT("csTimer");
+CRITICAL_SECTION_INIT_S( csTimer );
 
 
 /***********************************************************************
Index: windows/user.c
===================================================================
RCS file: /home/wine/wine/windows/user.c,v
retrieving revision 1.94
diff -u -r1.94 user.c
--- windows/user.c	15 May 2003 23:11:00 -0000	1.94
+++ windows/user.c	26 Jul 2003 02:34:07 -0000
@@ -42,7 +42,7 @@
 WINE_DECLARE_DEBUG_CHANNEL(win);
 WINE_DECLARE_DEBUG_CHANNEL(win32);
 
-SYSLEVEL USER_SysLevel = { CRITICAL_SECTION_INIT("USER_SysLevel"), 2 };
+SYSLEVEL_INIT_NS( USER_SysLevel, 2 );
 
 
 /* USER signal proc flags and codes */
Index: windows/winproc.c
===================================================================
RCS file: /home/wine/wine/windows/winproc.c,v
retrieving revision 1.104
diff -u -r1.104 winproc.c
--- windows/winproc.c	9 Jul 2003 22:31:34 -0000	1.104
+++ windows/winproc.c	26 Jul 2003 02:34:09 -0000
@@ -114,7 +114,7 @@
 static WINDOWPROC winproc_array[MAX_WINPROCS];
 static WINDOWPROC *winproc_first_free;
 static UINT winproc_used;
-static CRITICAL_SECTION winproc_cs = CRITICAL_SECTION_INIT("winproc_cs");
+CRITICAL_SECTION_INIT_S( winproc_cs );
 
 /* allocate a window procedure from the global array */
 static WINDOWPROC *alloc_winproc(void)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux