Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/ntoskrnl.exe/ntoskrnl.c | 27 +++------------------------ dlls/ntoskrnl.exe/sync.c | 9 +-------- include/winnt.h | 9 +++++++++ 3 files changed, 13 insertions(+), 32 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index cf5cde9a82..4daacfaad3 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -137,14 +137,7 @@ static int interface_rb_compare( const void *key, const struct wine_rb_entry *en
static struct wine_rb_tree device_interfaces = { interface_rb_compare };
-static CRITICAL_SECTION drivers_cs; -static CRITICAL_SECTION_DEBUG critsect_debug = -{ - 0, 0, &drivers_cs, - { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": drivers_cs") } -}; -static CRITICAL_SECTION drivers_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; +DECLARE_CRITICAL_SECTION(drivers_cs);
static inline LPCSTR debugstr_us( const UNICODE_STRING *us ) { @@ -290,14 +283,7 @@ void *alloc_kernel_object( POBJECT_TYPE type, HANDLE handle, SIZE_T size, LONG r return header + 1; }
-static CRITICAL_SECTION obref_cs; -static CRITICAL_SECTION_DEBUG obref_critsect_debug = -{ - 0, 0, &obref_cs, - { &obref_critsect_debug.ProcessLocksList, &obref_critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": obref_cs") } -}; -static CRITICAL_SECTION obref_cs = { &obref_critsect_debug, -1, 0, 0, 0, 0 }; +DECLARE_CRITICAL_SECTION(obref_cs);
/*********************************************************************** * ObDereferenceObject (NTOSKRNL.EXE.@) @@ -388,14 +374,7 @@ static const POBJECT_TYPE *known_types[] = &SeTokenObjectType };
-static CRITICAL_SECTION handle_map_cs; -static CRITICAL_SECTION_DEBUG handle_map_critsect_debug = -{ - 0, 0, &handle_map_cs, - { &handle_map_critsect_debug.ProcessLocksList, &handle_map_critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": handle_map_cs") } -}; -static CRITICAL_SECTION handle_map_cs = { &handle_map_critsect_debug, -1, 0, 0, 0, 0 }; +DECLARE_CRITICAL_SECTION(handle_map_cs);
NTSTATUS kernel_object_from_handle( HANDLE handle, POBJECT_TYPE type, void **ret ) { diff --git a/dlls/ntoskrnl.exe/sync.c b/dlls/ntoskrnl.exe/sync.c index 8ea103b3a6..bbbeb08c9e 100644 --- a/dlls/ntoskrnl.exe/sync.c +++ b/dlls/ntoskrnl.exe/sync.c @@ -48,14 +48,7 @@ enum object_type TYPE_AUTO_TIMER = 9, };
-static CRITICAL_SECTION sync_cs; -static CRITICAL_SECTION_DEBUG sync_cs_debug = -{ - 0, 0, &sync_cs, - { &sync_cs_debug.ProcessLocksList, &sync_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": sync_cs") } -}; -static CRITICAL_SECTION sync_cs = { &sync_cs_debug, -1, 0, 0, 0, 0 }; +DECLARE_CRITICAL_SECTION(sync_cs);
/*********************************************************************** * KeWaitForMultipleObjects (NTOSKRNL.EXE.@) diff --git a/include/winnt.h b/include/winnt.h index d0d3b2c24a..b40d6f8661 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -5932,6 +5932,15 @@ typedef struct _RTL_CRITICAL_SECTION { #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
+#if defined(__WINESRC__) && !defined(RC_INVOKED) +#define DECLARE_CRITICAL_SECTION(cs) \ + static CRITICAL_SECTION cs; \ + static CRITICAL_SECTION_DEBUG cs##_debug = \ + { 0, 0, &cs, { &cs##_debug.ProcessLocksList, &cs##_debug.ProcessLocksList }, \ + 0, 0, { (DWORD_PTR)(__FILE__ ": " # cs) }}; \ + static CRITICAL_SECTION cs = { &cs##_debug, -1, 0, 0, 0, 0 }; +#endif + typedef struct _RTL_SRWLOCK { PVOID Ptr; } RTL_SRWLOCK, *PRTL_SRWLOCK;