Allocate DebugInfo field for all critical sections (based on a patch

by Alex Pasadyn).
Get rid of the Wine-specific CRITICAL_SECTION_INIT macro.
This commit is contained in:
Alexandre Julliard 2003-08-12 23:50:54 +00:00
parent c2320dbc4a
commit 19b6a49845
33 changed files with 350 additions and 76 deletions

View File

@ -72,7 +72,15 @@ but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
static BYTE DInputKeyState[256]; /* array for 'GetDeviceState' */
static CRITICAL_SECTION keyboard_crit = CRITICAL_SECTION_INIT("dinput_keyboard");
static CRITICAL_SECTION keyboard_crit;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &keyboard_crit,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": keyboard_crit") }
};
static CRITICAL_SECTION keyboard_crit = { &critsect_debug, -1, 0, 0, 0, 0 };
static DWORD keyboard_users;
static HHOOK keyboard_hook;

View File

@ -42,7 +42,15 @@ struct graphics_driver
static struct graphics_driver *first_driver;
static struct graphics_driver *display_driver;
static CRITICAL_SECTION driver_section = CRITICAL_SECTION_INIT( "driver_section" );
static CRITICAL_SECTION driver_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &driver_section,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": driver_section") }
};
static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };
/**********************************************************************
* create_driver

View File

@ -1274,7 +1274,15 @@ struct ConsoleHandler {
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");
static CRITICAL_SECTION CONSOLE_CritSect;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &CONSOLE_CritSect,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": CONSOLE_CritSect") }
};
static CRITICAL_SECTION CONSOLE_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
/*****************************************************************************/

View File

@ -53,7 +53,14 @@ extern void ENV_CopyStartupInformation(void);
extern int main_create_flags;
static CRITICAL_SECTION ldt_section = CRITICAL_SECTION_INIT("ldt_section");
static CRITICAL_SECTION ldt_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &ldt_section,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": ldt_section") }
};
static CRITICAL_SECTION ldt_section = { &critsect_debug, -1, 0, 0, 0, 0 };
/***********************************************************************
* locking for LDT routines

View File

@ -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 @@ static inline HANDLE get_semaphore( RTL_CRITICAL_SECTION *crit )
*/
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 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit )
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 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
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 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
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;

View File

@ -64,7 +64,15 @@ static UINT tls_module_count; /* number of modules with TLS directory */
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" );
static CRITICAL_SECTION loader_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &loader_section,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": loader_section") }
};
static CRITICAL_SECTION loader_section = { &critsect_debug, -1, 0, 0, 0, 0 };
static WINE_MODREF *cached_modref;
static WINE_MODREF *current_modref;

View File

@ -39,8 +39,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
static RTL_CRITICAL_SECTION peb_lock = CRITICAL_SECTION_INIT("peb_lock");
static CRITICAL_SECTION peb_lock;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &peb_lock,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": peb_lock") }
};
static CRITICAL_SECTION peb_lock = { &critsect_debug, -1, 0, 0, 0, 0 };
/* CRC polynomial 0xedb88320 */
static const DWORD CRC_table[256] =

View File

@ -95,7 +95,15 @@ static const BYTE VIRTUAL_Win32Flags[16] =
static FILE_VIEW *VIRTUAL_FirstView;
static CRITICAL_SECTION csVirtual = CRITICAL_SECTION_INIT("csVirtual");
static CRITICAL_SECTION csVirtual;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &csVirtual,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": csVirtual") }
};
static CRITICAL_SECTION csVirtual = { &critsect_debug, -1, 0, 0, 0, 0 };
#ifdef __i386__
/* These are always the same on an i386, and it will be faster this way */

View File

@ -62,10 +62,16 @@ static void COM_ExternalLockFreeList();
const CLSID CLSID_StdGlobalInterfaceTable = { 0x00000323, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} };
APARTMENT MTA, *apts;
static CRITICAL_SECTION csApartment = CRITICAL_SECTION_INIT("csApartment");
static CRITICAL_SECTION csApartment;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &csApartment,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": csApartment") }
};
static CRITICAL_SECTION csApartment = { &critsect_debug, -1, 0, 0, 0, 0 };
/*
* This lock count counts the number of times CoInitialize is called. It is
@ -93,9 +99,17 @@ typedef struct tagRegisteredClass
struct tagRegisteredClass* nextClass;
} RegisteredClass;
static CRITICAL_SECTION csRegisteredClassList = CRITICAL_SECTION_INIT("csRegisteredClassList");
static RegisteredClass* firstRegisteredClass = NULL;
static CRITICAL_SECTION csRegisteredClassList;
static CRITICAL_SECTION_DEBUG class_cs_debug =
{
0, 0, &csRegisteredClassList,
{ &class_cs_debug.ProcessLocksList, &class_cs_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": csRegisteredClassList") }
};
static CRITICAL_SECTION csRegisteredClassList = { &class_cs_debug, -1, 0, 0, 0, 0 };
/*****************************************************************************
* This section contains OpenDllList definitions
*
@ -112,9 +126,17 @@ typedef struct tagOpenDll {
struct tagOpenDll *next;
} OpenDll;
static CRITICAL_SECTION csOpenDllList = CRITICAL_SECTION_INIT("csOpenDllList");
static OpenDll *openDllList = NULL; /* linked list of open dlls */
static CRITICAL_SECTION csOpenDllList;
static CRITICAL_SECTION_DEBUG dll_cs_debug =
{
0, 0, &csOpenDllList,
{ &dll_cs_debug.ProcessLocksList, &dll_cs_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": csOpenDllList") }
};
static CRITICAL_SECTION csOpenDllList = { &dll_cs_debug, -1, 0, 0, 0, 0 };
static const char aptWinClass[] = "WINE_OLE32_APT_CLASS";
static LRESULT CALLBACK COM_AptWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

View File

@ -59,7 +59,14 @@ typedef struct {
_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");
static CRITICAL_SECTION IMalloc32_SpyCS;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &IMalloc32_SpyCS,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": IMalloc32_SpyCS") }
};
static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
/* resize the old table */
static int SetSpyedBlockTableLength ( int NewLength )

View File

@ -41,7 +41,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
static RpcConnection* conn_cache;
static CRITICAL_SECTION conn_cache_cs = CRITICAL_SECTION_INIT("conn_cache_cs");
static CRITICAL_SECTION conn_cache_cs;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &conn_cache_cs,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": conn_cache_cs") }
};
static CRITICAL_SECTION conn_cache_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
LPSTR RPCRT4_strndupA(LPSTR src, INT slen)
{

View File

@ -55,13 +55,37 @@ typedef struct _RpcPacket
static RpcServerProtseq* protseqs;
static RpcServerInterface* ifs;
static CRITICAL_SECTION server_cs = CRITICAL_SECTION_INIT("RpcServer");
static CRITICAL_SECTION listen_cs = CRITICAL_SECTION_INIT("RpcListen");
static CRITICAL_SECTION server_cs;
static CRITICAL_SECTION_DEBUG server_cs_debug =
{
0, 0, &server_cs,
{ &server_cs_debug.ProcessLocksList, &server_cs_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": server_cs") }
};
static CRITICAL_SECTION server_cs = { &server_cs_debug, -1, 0, 0, 0, 0 };
static CRITICAL_SECTION listen_cs;
static CRITICAL_SECTION_DEBUG listen_cs_debug =
{
0, 0, &listen_cs,
{ &listen_cs_debug.ProcessLocksList, &listen_cs_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": listen_cs") }
};
static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 };
static BOOL std_listen;
static LONG listen_count = -1;
static HANDLE mgr_event, server_thread;
static CRITICAL_SECTION spacket_cs = CRITICAL_SECTION_INIT("RpcServerPacket");
static CRITICAL_SECTION spacket_cs;
static CRITICAL_SECTION_DEBUG spacket_cs_debug =
{
0, 0, &spacket_cs,
{ &spacket_cs_debug.ProcessLocksList, &spacket_cs_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": spacket_cs") }
};
static CRITICAL_SECTION spacket_cs = { &spacket_cs_debug, -1, 0, 0, 0, 0 };
static RpcPacket* spacket_head;
static RpcPacket* spacket_tail;
static HANDLE server_sem;

View File

@ -27,7 +27,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
static CRITICAL_SECTION SHELL32_ChangenotifyCS = CRITICAL_SECTION_INIT("SHELL32_ChangenotifyCS");
static CRITICAL_SECTION SHELL32_ChangenotifyCS;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &SHELL32_ChangenotifyCS,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": SHELL32_ChangenotifyCS") }
};
static CRITICAL_SECTION SHELL32_ChangenotifyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
/* internal list of notification clients (internal) */
typedef struct _NOTIFICATIONLIST

View File

@ -58,7 +58,15 @@ typedef struct
} SIC_ENTRY, * LPSIC_ENTRY;
static HDPA sic_hdpa = 0;
static CRITICAL_SECTION SHELL32_SicCS = CRITICAL_SECTION_INIT("SHELL32_SicCS");
static CRITICAL_SECTION SHELL32_SicCS;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &SHELL32_SicCS,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": SHELL32_SicCS") }
};
static CRITICAL_SECTION SHELL32_SicCS = { &critsect_debug, -1, 0, 0, 0, 0 };
/*****************************************************************************
* SIC_CompareEntries

View File

@ -49,7 +49,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
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");
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &WDML_CritSect,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": WDML_CritSect") }
};
CRITICAL_SECTION WDML_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
/* ================================================================
*

View File

@ -1127,7 +1127,15 @@ struct DDE_pair {
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");
static CRITICAL_SECTION dde_crst;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &dde_crst,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": dde_crst") }
};
static CRITICAL_SECTION dde_crst = { &critsect_debug, -1, 0, 0, 0, 0 };
static BOOL dde_add_pair(HGLOBAL chm, HGLOBAL shm)
{

View File

@ -51,7 +51,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(aspi);
#ifdef linux
static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
static CRITICAL_SECTION ASPI_CritSection = CRITICAL_SECTION_INIT("ASPI_CritSection");
static CRITICAL_SECTION ASPI_CritSection;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &ASPI_CritSection,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": ASPI_CritSection") }
};
static CRITICAL_SECTION ASPI_CritSection = { &critsect_debug, -1, 0, 0, 0, 0 };
#endif /* defined(linux) */

View File

@ -76,10 +76,18 @@ typedef struct _DOSEVENT {
struct _DOSEVENT *next;
} DOSEVENT, *LPDOSEVENT;
static CRITICAL_SECTION qcrit = CRITICAL_SECTION_INIT("DOSVM");
static struct _DOSEVENT *pending_event, *current_event;
static HANDLE event_notifier;
static CRITICAL_SECTION qcrit;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &qcrit,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": qcrit") }
};
static CRITICAL_SECTION qcrit = { &critsect_debug, -1, 0, 0, 0, 0 };
/***********************************************************************
* DOSVM_HasPendingEvents

View File

@ -131,7 +131,14 @@ static BOOL vga_address_3c0 = TRUE;
* 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");
static CRITICAL_SECTION vga_lock;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &vga_lock,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": vga_lock") }
};
static CRITICAL_SECTION vga_lock = { &critsect_debug, -1, 0, 0, 0, 0 };
typedef HRESULT (WINAPI *DirectDrawCreateProc)(LPGUID,LPDIRECTDRAW *,LPUNKNOWN);
static DirectDrawCreateProc pDirectDrawCreate;

View File

@ -112,7 +112,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(winsock);
/* critical section to protect some non-rentrant net function */
CRITICAL_SECTION csWSgetXXXbyYYY = CRITICAL_SECTION_INIT("csWSgetXXXbyYYY");
CRITICAL_SECTION csWSgetXXXbyYYY;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &csWSgetXXXbyYYY,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": csWSgetXXXbyYYY") }
};
CRITICAL_SECTION csWSgetXXXbyYYY = { &critsect_debug, -1, 0, 0, 0, 0 };
/* protoptypes of some functions in socket.c
*/

View File

@ -52,7 +52,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
static CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT("X11DRV_CritSection");
static CRITICAL_SECTION X11DRV_CritSection;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &X11DRV_CritSection,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": X11DRV_CritSection") }
};
static CRITICAL_SECTION X11DRV_CritSection = { &critsect_debug, -1, 0, 0, 0, 0 };
Screen *screen;
Visual *visual;

View File

@ -120,7 +120,14 @@ MAKE_FUNCPTR(XRenderSetPictureClipRectangles)
MAKE_FUNCPTR(XRenderQueryExtension)
#undef MAKE_FUNCPTR
static CRITICAL_SECTION xrender_cs = CRITICAL_SECTION_INIT("xrender_cs");
static CRITICAL_SECTION xrender_cs;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &xrender_cs,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": xrender_cs") }
};
static CRITICAL_SECTION xrender_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
/***********************************************************************

View File

@ -90,7 +90,14 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES]={NULL};
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");
static CRITICAL_SECTION PROFILE_CritSect;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &PROFILE_CritSect,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": PROFILE_CritSect") }
};
static CRITICAL_SECTION PROFILE_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
static const char hex[16] = "0123456789ABCDEF";

View File

@ -322,7 +322,14 @@ static const struct CharsetBindingInfo charsetbindings[] =
static int DefResolution = 0;
static CRITICAL_SECTION crtsc_fonts_X11 = CRITICAL_SECTION_INIT("crtsc_fonts_X11");
static CRITICAL_SECTION crtsc_fonts_X11;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &crtsc_fonts_X11,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": crtsc_fonts_X11") }
};
static CRITICAL_SECTION crtsc_fonts_X11 = { &critsect_debug, -1, 0, 0, 0, 0 };
static fontResource* fontList = NULL;
static fontObject* fontCache = NULL; /* array */

View File

@ -839,10 +839,6 @@ typedef DWORD (CALLBACK *LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE
#define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x00002000
#define FORMAT_MESSAGE_MAX_WIDTH_MASK 0x000000FF
#ifdef __WINESRC__
#define CRITICAL_SECTION_INIT(name) { (void *)(__FILE__ ": " name), -1, 0, 0, 0, 0 }
#endif
typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;

View File

@ -66,7 +66,15 @@ static const LOGPEN NullPen = { PS_NULL, { 0, 0 }, 0 };
static HGDIOBJ stock_objects[NB_STOCK_OBJECTS];
static SYSLEVEL GDI_level = { CRITICAL_SECTION_INIT("GDI_level"), 3 };
static SYSLEVEL GDI_level;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &GDI_level.crst,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": GDI_level") }
};
static SYSLEVEL GDI_level = { { &critsect_debug, -1, 0, 0, 0, 0 }, 3 };
static WORD GDI_HeapSel;
inline static BOOL get_bool(char *buffer)

View File

@ -325,7 +325,15 @@ strong_alias(__pthread_kill_other_threads_np, pthread_kill_other_threads_np);
#define MAX_ATFORK 8 /* libc doesn't need that many anyway */
static CRITICAL_SECTION atfork_section = CRITICAL_SECTION_INIT("atfork_section");
static CRITICAL_SECTION atfork_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &atfork_section,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": atfork_section") }
};
static CRITICAL_SECTION atfork_section = { &critsect_debug, -1, 0, 0, 0, 0 };
typedef void (*atfork_handler)();
static atfork_handler atfork_prepare[MAX_ATFORK];
static atfork_handler atfork_parent[MAX_ATFORK];

View File

@ -32,7 +32,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(win32);
static SYSLEVEL Win16Mutex = { CRITICAL_SECTION_INIT("Win16Mutex"), 1 };
static SYSLEVEL Win16Mutex;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &Win16Mutex.crst,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": Win16Mutex") }
};
static SYSLEVEL Win16Mutex = { { &critsect_debug, -1, 0, 0, 0, 0 }, 1 };
/* Global variable to save current TEB while in 16-bit code */
WORD SYSLEVEL_Win16CurrentTeb = 0;

View File

@ -93,7 +93,16 @@ typedef struct tagICONCACHE
} ICONCACHE;
static ICONCACHE *IconAnchor = NULL;
static CRITICAL_SECTION IconCrst = CRITICAL_SECTION_INIT("IconCrst");
static CRITICAL_SECTION IconCrst;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &IconCrst,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": IconCrst") }
};
static CRITICAL_SECTION IconCrst = { &critsect_debug, -1, 0, 0, 0, 0 };
static WORD ICON_HOTSPOT = 0x4242;

View File

@ -50,7 +50,14 @@ typedef struct tagTIMER
static TIMER TimersArray[NB_TIMERS];
static CRITICAL_SECTION csTimer = CRITICAL_SECTION_INIT("csTimer");
static CRITICAL_SECTION csTimer;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &csTimer,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": csTimer") }
};
static CRITICAL_SECTION csTimer = { &critsect_debug, -1, 0, 0, 0, 0 };
/***********************************************************************

View File

@ -42,8 +42,14 @@ WINE_DECLARE_DEBUG_CHANNEL(system);
WINE_DECLARE_DEBUG_CHANNEL(win);
WINE_DECLARE_DEBUG_CHANNEL(win32);
SYSLEVEL USER_SysLevel = { CRITICAL_SECTION_INIT("USER_SysLevel"), 2 };
static SYSLEVEL USER_SysLevel;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &USER_SysLevel.crst,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": USER_SysLevel") }
};
static SYSLEVEL USER_SysLevel = { { &critsect_debug, -1, 0, 0, 0, 0 }, 2 };
/* USER signal proc flags and codes */
/* See UserSignalProc for comments */
@ -151,6 +157,36 @@ void USER_CheckNotLock(void)
}
/***********************************************************************
* WIN_SuspendWndsLock
*
* Suspend the lock on WND structures.
* Returns the number of locks suspended
* FIXME: should be removed
*/
int WIN_SuspendWndsLock( void )
{
int isuspendedLocks = _ConfirmSysLevel( &USER_SysLevel );
int count = isuspendedLocks;
while ( count-- > 0 )
_LeaveSysLevel( &USER_SysLevel );
return isuspendedLocks;
}
/***********************************************************************
* WIN_RestoreWndsLock
*
* Restore the suspended locks on WND structures
* FIXME: should be removed
*/
void WIN_RestoreWndsLock( int ipreviousLocks )
{
while ( ipreviousLocks-- > 0 )
_EnterSysLevel( &USER_SysLevel );
}
/***********************************************************************
* FinalUserInit (USER.400)
*/

View File

@ -56,37 +56,6 @@ static WORD wDragHeight= 3;
static void *user_handles[NB_USER_HANDLES];
/* thread safeness */
extern SYSLEVEL USER_SysLevel; /* FIXME */
/***********************************************************************
* WIN_SuspendWndsLock
*
* Suspend the lock on WND structures.
* Returns the number of locks suspended
*/
int WIN_SuspendWndsLock( void )
{
int isuspendedLocks = _ConfirmSysLevel( &USER_SysLevel );
int count = isuspendedLocks;
while ( count-- > 0 )
_LeaveSysLevel( &USER_SysLevel );
return isuspendedLocks;
}
/***********************************************************************
* WIN_RestoreWndsLock
*
* Restore the suspended locks on WND structures
*/
void WIN_RestoreWndsLock( int ipreviousLocks )
{
while ( ipreviousLocks-- > 0 )
_EnterSysLevel( &USER_SysLevel );
}
/***********************************************************************
* create_window_handle
*

View File

@ -114,7 +114,15 @@ static LRESULT WINAPI WINPROC_CallProc32WTo16( WNDPROC16 func, HWND hwnd,
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");
static CRITICAL_SECTION winproc_cs;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &winproc_cs,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { 0, (DWORD)(__FILE__ ": winproc_cs") }
};
static CRITICAL_SECTION winproc_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
/* allocate a window procedure from the global array */
static WINDOWPROC *alloc_winproc(void)