Removed no longer needed list of instance data.

This commit is contained in:
Eric Pouech 2002-10-10 22:47:25 +00:00 committed by Alexandre Julliard
parent 1c0a8ac4c0
commit 46c49c6d79
2 changed files with 18 additions and 49 deletions

View File

@ -166,9 +166,6 @@ typedef struct tagWINE_PLAYSOUND {
} WINE_PLAYSOUND, *LPWINE_PLAYSOUND; } WINE_PLAYSOUND, *LPWINE_PLAYSOUND;
typedef struct tagWINE_MM_IDATA { typedef struct tagWINE_MM_IDATA {
/* iData reference */
DWORD dwThisProcess;
struct tagWINE_MM_IDATA* lpNextIData;
/* winmm part */ /* winmm part */
HANDLE hWinMM32Instance; HANDLE hWinMM32Instance;
HANDLE hWinMM16Instance; HANDLE hWinMM16Instance;

View File

@ -72,33 +72,19 @@ void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16)
* G L O B A L S E T T I N G S * G L O B A L S E T T I N G S
* ========================================================================*/ * ========================================================================*/
static LPWINE_MM_IDATA lpFirstIData = NULL; static LPWINE_MM_IDATA S_IData = NULL;
static LPWINE_MM_IDATA MULTIMEDIA_GetIDataNoCheck(void)
{
DWORD pid = GetCurrentProcessId();
LPWINE_MM_IDATA iData;
for (iData = lpFirstIData; iData; iData = iData->lpNextIData) {
if (iData->dwThisProcess == pid)
break;
}
return iData;
}
/************************************************************************** /**************************************************************************
* MULTIMEDIA_GetIData [internal] * MULTIMEDIA_GetIData [internal]
*/ */
LPWINE_MM_IDATA MULTIMEDIA_GetIData(void) LPWINE_MM_IDATA MULTIMEDIA_GetIData(void)
{ {
LPWINE_MM_IDATA iData = MULTIMEDIA_GetIDataNoCheck(); if (!S_IData) {
if (!iData) {
ERR("IData not found for pid=%08lx. Suicide !!!\n", GetCurrentProcessId()); ERR("IData not found for pid=%08lx. Suicide !!!\n", GetCurrentProcessId());
DbgBreakPoint(); DbgBreakPoint();
ExitProcess(0); ExitProcess(0);
} }
return iData; return S_IData;
} }
/************************************************************************** /**************************************************************************
@ -106,21 +92,16 @@ LPWINE_MM_IDATA MULTIMEDIA_GetIData(void)
*/ */
static BOOL MULTIMEDIA_CreateIData(HINSTANCE hInstDLL) static BOOL MULTIMEDIA_CreateIData(HINSTANCE hInstDLL)
{ {
LPWINE_MM_IDATA iData; S_IData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MM_IDATA));
iData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MM_IDATA)); if (!S_IData)
if (!iData)
return FALSE; return FALSE;
iData->hWinMM32Instance = hInstDLL; S_IData->hWinMM32Instance = hInstDLL;
iData->dwThisProcess = GetCurrentProcessId(); InitializeCriticalSection(&S_IData->cs);
iData->lpNextIData = lpFirstIData; S_IData->cs.DebugInfo = (void*)__FILE__ ": WinMM";
lpFirstIData = iData; S_IData->psStopEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
InitializeCriticalSection(&iData->cs); S_IData->psLastEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
iData->cs.DebugInfo = (void*)__FILE__ ": WinMM"; TRACE("Created IData (%p)\n", S_IData);
iData->psStopEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
iData->psLastEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
TRACE("Created IData (%p) for pid %08lx\n", iData, iData->dwThisProcess);
return TRUE; return TRUE;
} }
@ -129,24 +110,16 @@ static BOOL MULTIMEDIA_CreateIData(HINSTANCE hInstDLL)
*/ */
static void MULTIMEDIA_DeleteIData(void) static void MULTIMEDIA_DeleteIData(void)
{ {
LPWINE_MM_IDATA iData = MULTIMEDIA_GetIDataNoCheck(); if (S_IData) {
LPWINE_MM_IDATA* ppid;
if (iData) {
TIME_MMTimeStop(); TIME_MMTimeStop();
for (ppid = &lpFirstIData; *ppid; ppid = &(*ppid)->lpNextIData) {
if (*ppid == iData) {
*ppid = iData->lpNextIData;
break;
}
}
/* FIXME: should also free content and resources allocated /* FIXME: should also free content and resources allocated
* inside iData */ * inside S_IData */
CloseHandle(iData->psStopEvent); CloseHandle(S_IData->psStopEvent);
CloseHandle(iData->psLastEvent); CloseHandle(S_IData->psLastEvent);
DeleteCriticalSection(&iData->cs); DeleteCriticalSection(&S_IData->cs);
HeapFree(GetProcessHeap(), 0, iData); HeapFree(GetProcessHeap(), 0, S_IData);
S_IData = NULL;
} }
} }
@ -2876,4 +2849,3 @@ DWORD WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE); return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE);
} }