Commit 814c854f authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

winmm: Give a name to the critical sections, make them static and delete them…

winmm: Give a name to the critical sections, make them static and delete them when unloading the dll.
parent b6117b68
......@@ -140,6 +140,13 @@ static UINT g_inmmdevices_count;
static IMMDeviceEnumerator *g_devenum;
static CRITICAL_SECTION g_devthread_lock;
static CRITICAL_SECTION_DEBUG g_devthread_lock_debug =
{
0, 0, &g_devthread_lock,
{ &g_devthread_lock_debug.ProcessLocksList, &g_devthread_lock_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": g_devthread_lock") }
};
static CRITICAL_SECTION g_devthread_lock = { &g_devthread_lock_debug, -1, 0, 0, 0, 0 };
static HANDLE g_devices_thread;
static HWND g_devices_hwnd;
......@@ -167,10 +174,10 @@ static LRESULT WOD_Close(HWAVEOUT hwave);
static LRESULT WID_Open(WINMM_OpenInfo *info);
static LRESULT WID_Close(HWAVEIN hwave);
BOOL WINMM_InitWaveform(void)
void WINMM_DeleteWaveform(void)
{
InitializeCriticalSection(&g_devthread_lock);
return TRUE;
/* FIXME: Free g_(in,out)_mmdevices? */
DeleteCriticalSection(&g_devthread_lock);
}
static inline HWAVE WINMM_MakeHWAVE(UINT mmdevice, BOOL is_out, UINT device)
......@@ -193,6 +200,8 @@ static void WINMM_InitDevice(WINMM_Device *device,
WINMM_MMDevice *parent, HWAVE hwave)
{
InitializeCriticalSection(&device->lock);
device->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINMM_Device.lock");
device->handle = hwave;
device->parent = parent;
}
......@@ -449,6 +458,7 @@ static HRESULT WINMM_InitMMDevice(EDataFlow flow, IMMDevice *device,
CoCreateGuid(&dev->session);
InitializeCriticalSection(&dev->lock);
dev->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINMM_Device.lock");
return S_OK;
}
......
......@@ -152,7 +152,7 @@ void TIME_MMTimeStop(void) DECLSPEC_HIDDEN;
MMRESULT WINMM_CheckCallback(DWORD_PTR dwCallback, DWORD fdwOpen, BOOL mixer) DECLSPEC_HIDDEN;
BOOL WINMM_InitWaveform(void) DECLSPEC_HIDDEN;
void WINMM_DeleteWaveform(void) DECLSPEC_HIDDEN;
/* Global variables */
extern CRITICAL_SECTION WINMM_cs DECLSPEC_HIDDEN;
......
......@@ -79,7 +79,7 @@ static BOOL WINMM_CreateIData(HINSTANCE hInstDLL)
{
hWinMM32Instance = hInstDLL;
psLastEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
return WINMM_InitWaveform();
return TRUE;
}
/**************************************************************************
......@@ -89,8 +89,7 @@ static void WINMM_DeleteIData(void)
{
TIME_MMTimeStop();
/* FIXME: should also free content and resources allocated
* inside WINMM_IData */
WINMM_DeleteWaveform();
CloseHandle(psLastEvent);
DeleteCriticalSection(&WINMM_cs);
}
......
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