this patch removes instance data from winmm (a reminder of before address space separation) A+
Name: mm_init ChangeLog: removed no longer needed list of instance data License: X11 GenDate: 2002/10/10 19:55:41 UTC ModifiedFiles: dlls/winmm/winemm.h dlls/winmm/winmm.c AddedFiles: =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winemm.h,v retrieving revision 1.22 diff -u -u -r1.22 winemm.h --- dlls/winmm/winemm.h 10 Oct 2002 03:43:53 -0000 1.22 +++ dlls/winmm/winemm.h 10 Oct 2002 19:22:39 -0000 @@ -166,9 +166,6 @@ } WINE_PLAYSOUND, *LPWINE_PLAYSOUND; typedef struct tagWINE_MM_IDATA { - /* iData reference */ - DWORD dwThisProcess; - struct tagWINE_MM_IDATA* lpNextIData; /* winmm part */ HANDLE hWinMM32Instance; HANDLE hWinMM16Instance; Index: dlls/winmm/winmm.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winmm.c,v retrieving revision 1.1 diff -u -u -r1.1 winmm.c --- dlls/winmm/winmm.c 10 Oct 2002 03:43:53 -0000 1.1 +++ dlls/winmm/winmm.c 10 Oct 2002 19:16:05 -0000 @@ -72,33 +72,19 @@ * G L O B A L S E T T I N G S * ========================================================================*/ -static LPWINE_MM_IDATA lpFirstIData = 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; -} +static LPWINE_MM_IDATA S_IData = NULL; /************************************************************************** * MULTIMEDIA_GetIData [internal] */ LPWINE_MM_IDATA MULTIMEDIA_GetIData(void) { - LPWINE_MM_IDATA iData = MULTIMEDIA_GetIDataNoCheck(); - - if (!iData) { + if (!S_IData) { ERR("IData not found for pid=%08lx. Suicide !!!\n", GetCurrentProcessId()); DbgBreakPoint(); ExitProcess(0); } - return iData; + return S_IData; } /************************************************************************** @@ -106,21 +92,16 @@ */ 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 (!iData) + if (!S_IData) return FALSE; - iData->hWinMM32Instance = hInstDLL; - iData->dwThisProcess = GetCurrentProcessId(); - iData->lpNextIData = lpFirstIData; - lpFirstIData = iData; - InitializeCriticalSection(&iData->cs); - iData->cs.DebugInfo = (void*)__FILE__ ": WinMM"; - 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); + S_IData->hWinMM32Instance = hInstDLL; + InitializeCriticalSection(&S_IData->cs); + S_IData->cs.DebugInfo = (void*)__FILE__ ": WinMM"; + S_IData->psStopEvent = CreateEventA(NULL, TRUE, FALSE, NULL); + S_IData->psLastEvent = CreateEventA(NULL, TRUE, FALSE, NULL); + TRACE("Created IData (%p)\n", S_IData); return TRUE; } @@ -129,24 +110,16 @@ */ static void MULTIMEDIA_DeleteIData(void) { - LPWINE_MM_IDATA iData = MULTIMEDIA_GetIDataNoCheck(); - LPWINE_MM_IDATA* ppid; - - if (iData) { + if (S_IData) { TIME_MMTimeStop(); - for (ppid = &lpFirstIData; *ppid; ppid = &(*ppid)->lpNextIData) { - if (*ppid == iData) { - *ppid = iData->lpNextIData; - break; - } - } /* FIXME: should also free content and resources allocated - * inside iData */ - CloseHandle(iData->psStopEvent); - CloseHandle(iData->psLastEvent); - DeleteCriticalSection(&iData->cs); - HeapFree(GetProcessHeap(), 0, iData); + * inside S_IData */ + CloseHandle(S_IData->psStopEvent); + CloseHandle(S_IData->psLastEvent); + DeleteCriticalSection(&S_IData->cs); + HeapFree(GetProcessHeap(), 0, S_IData); + S_IData = NULL; } }