Make WINMM_IData statically allocated.
This commit is contained in:
parent
4ed37e03c6
commit
795b17e055
|
@ -104,12 +104,12 @@ LPWINE_MCIDRIVER MCI_GetDriver(UINT16 wDevID)
|
||||||
{
|
{
|
||||||
LPWINE_MCIDRIVER wmd = 0;
|
LPWINE_MCIDRIVER wmd = 0;
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
for (wmd = WINMM_IData->lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
for (wmd = WINMM_IData.lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
||||||
if (wmd->wDeviceID == wDevID)
|
if (wmd->wDeviceID == wDevID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
return wmd;
|
return wmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ UINT MCI_GetDriverFromString(LPCWSTR lpstrName)
|
||||||
if (!strcmpiW(lpstrName, wszAll))
|
if (!strcmpiW(lpstrName, wszAll))
|
||||||
return MCI_ALL_DEVICE_ID;
|
return MCI_ALL_DEVICE_ID;
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
for (wmd = WINMM_IData->lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
for (wmd = WINMM_IData.lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
||||||
if (wmd->lpstrElementName && strcmpW(wmd->lpstrElementName, lpstrName) == 0) {
|
if (wmd->lpstrElementName && strcmpW(wmd->lpstrElementName, lpstrName) == 0) {
|
||||||
ret = wmd->wDeviceID;
|
ret = wmd->wDeviceID;
|
||||||
break;
|
break;
|
||||||
|
@ -142,7 +142,7 @@ UINT MCI_GetDriverFromString(LPCWSTR lpstrName)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ static UINT MCI_GetCommandTable(UINT uDevType)
|
||||||
|
|
||||||
/* well try to load id */
|
/* well try to load id */
|
||||||
if (uDevType >= MCI_DEVTYPE_FIRST && uDevType <= MCI_DEVTYPE_LAST) {
|
if (uDevType >= MCI_DEVTYPE_FIRST && uDevType <= MCI_DEVTYPE_LAST) {
|
||||||
if (LoadStringW(WINMM_IData->hWinMM32Instance, uDevType, buf, sizeof(buf) / sizeof(WCHAR))) {
|
if (LoadStringW(WINMM_IData.hWinMM32Instance, uDevType, buf, sizeof(buf) / sizeof(WCHAR))) {
|
||||||
str = buf;
|
str = buf;
|
||||||
}
|
}
|
||||||
} else if (uDevType == 0) {
|
} else if (uDevType == 0) {
|
||||||
|
@ -688,15 +688,15 @@ static UINT MCI_GetCommandTable(UINT uDevType)
|
||||||
}
|
}
|
||||||
uTbl = MCI_NO_COMMAND_TABLE;
|
uTbl = MCI_NO_COMMAND_TABLE;
|
||||||
if (str) {
|
if (str) {
|
||||||
HRSRC hRsrc = FindResourceW(WINMM_IData->hWinMM32Instance, str, (LPCWSTR)RT_RCDATA);
|
HRSRC hRsrc = FindResourceW(WINMM_IData.hWinMM32Instance, str, (LPCWSTR)RT_RCDATA);
|
||||||
HANDLE hMem = 0;
|
HANDLE hMem = 0;
|
||||||
|
|
||||||
if (hRsrc) hMem = LoadResource(WINMM_IData->hWinMM32Instance, hRsrc);
|
if (hRsrc) hMem = LoadResource(WINMM_IData.hWinMM32Instance, hRsrc);
|
||||||
if (hMem) {
|
if (hMem) {
|
||||||
uTbl = MCI_SetCommandTable(LockResource(hMem), uDevType);
|
uTbl = MCI_SetCommandTable(LockResource(hMem), uDevType);
|
||||||
} else {
|
} else {
|
||||||
WARN("No command table found in resource %p[%s]\n",
|
WARN("No command table found in resource %p[%s]\n",
|
||||||
WINMM_IData->hWinMM32Instance, debugstr_w(str));
|
WINMM_IData.hWinMM32Instance, debugstr_w(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE("=> %d\n", uTbl);
|
TRACE("=> %d\n", uTbl);
|
||||||
|
@ -799,14 +799,14 @@ static BOOL MCI_UnLoadMciDriver(LPWINE_MCIDRIVER wmd)
|
||||||
if (wmd->dwPrivate != 0)
|
if (wmd->dwPrivate != 0)
|
||||||
WARN("Unloading mci driver with non nul dwPrivate field\n");
|
WARN("Unloading mci driver with non nul dwPrivate field\n");
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
for (tmp = &WINMM_IData->lpMciDrvs; *tmp; tmp = &(*tmp)->lpNext) {
|
for (tmp = &WINMM_IData.lpMciDrvs; *tmp; tmp = &(*tmp)->lpNext) {
|
||||||
if (*tmp == wmd) {
|
if (*tmp == wmd) {
|
||||||
*tmp = wmd->lpNext;
|
*tmp = wmd->lpNext;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, wmd->lpstrDeviceType);
|
HeapFree(GetProcessHeap(), 0, wmd->lpstrDeviceType);
|
||||||
HeapFree(GetProcessHeap(), 0, wmd->lpstrAlias);
|
HeapFree(GetProcessHeap(), 0, wmd->lpstrAlias);
|
||||||
|
@ -871,12 +871,12 @@ static DWORD MCI_LoadMciDriver(LPCWSTR _strDevTyp, LPWINE_MCIDRIVER* lpwmd)
|
||||||
wmd->dwYieldData = VK_CANCEL;
|
wmd->dwYieldData = VK_CANCEL;
|
||||||
wmd->CreatorThread = GetCurrentThreadId();
|
wmd->CreatorThread = GetCurrentThreadId();
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
/* wmd must be inserted in list before sending opening the driver, coz' it
|
/* wmd must be inserted in list before sending opening the driver, coz' it
|
||||||
* may want to lookup at wDevID
|
* may want to lookup at wDevID
|
||||||
*/
|
*/
|
||||||
wmd->lpNext = WINMM_IData->lpMciDrvs;
|
wmd->lpNext = WINMM_IData.lpMciDrvs;
|
||||||
WINMM_IData->lpMciDrvs = wmd;
|
WINMM_IData.lpMciDrvs = wmd;
|
||||||
|
|
||||||
for (modp.wDeviceID = MCI_MAGIC;
|
for (modp.wDeviceID = MCI_MAGIC;
|
||||||
MCI_GetDriver(modp.wDeviceID) != 0;
|
MCI_GetDriver(modp.wDeviceID) != 0;
|
||||||
|
@ -884,7 +884,7 @@ static DWORD MCI_LoadMciDriver(LPCWSTR _strDevTyp, LPWINE_MCIDRIVER* lpwmd)
|
||||||
|
|
||||||
wmd->wDeviceID = modp.wDeviceID;
|
wmd->wDeviceID = modp.wDeviceID;
|
||||||
|
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
TRACE("wDevID=%04X \n", modp.wDeviceID);
|
TRACE("wDevID=%04X \n", modp.wDeviceID);
|
||||||
|
|
||||||
|
@ -1195,7 +1195,7 @@ static DWORD MCI_HandleReturnValues(DWORD dwRet, LPWINE_MCIDRIVER wmd, DWORD ret
|
||||||
case MCI_RESOURCE_RETURNED:
|
case MCI_RESOURCE_RETURNED:
|
||||||
/* return string which ID is HIWORD(data[1]),
|
/* return string which ID is HIWORD(data[1]),
|
||||||
* string is loaded from mmsystem.dll */
|
* string is loaded from mmsystem.dll */
|
||||||
LoadStringW(WINMM_IData->hWinMM32Instance, HIWORD(data[1]),
|
LoadStringW(WINMM_IData.hWinMM32Instance, HIWORD(data[1]),
|
||||||
lpstrRet, uRetLen);
|
lpstrRet, uRetLen);
|
||||||
break;
|
break;
|
||||||
case MCI_RESOURCE_RETURNED|MCI_RESOURCE_DRIVER:
|
case MCI_RESOURCE_RETURNED|MCI_RESOURCE_DRIVER:
|
||||||
|
@ -1647,7 +1647,7 @@ static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSW lpParms)
|
||||||
|
|
||||||
if (uDevType < MCI_DEVTYPE_FIRST ||
|
if (uDevType < MCI_DEVTYPE_FIRST ||
|
||||||
uDevType > MCI_DEVTYPE_LAST ||
|
uDevType > MCI_DEVTYPE_LAST ||
|
||||||
!LoadStringW(WINMM_IData->hWinMM32Instance, uDevType,
|
!LoadStringW(WINMM_IData.hWinMM32Instance, uDevType,
|
||||||
strDevTyp, sizeof(strDevTyp) / sizeof(WCHAR))) {
|
strDevTyp, sizeof(strDevTyp) / sizeof(WCHAR))) {
|
||||||
dwRet = MCIERR_BAD_INTEGER;
|
dwRet = MCIERR_BAD_INTEGER;
|
||||||
goto errCleanUp;
|
goto errCleanUp;
|
||||||
|
@ -1762,17 +1762,17 @@ static DWORD MCI_Close(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms
|
||||||
if (wDevID == MCI_ALL_DEVICE_ID) {
|
if (wDevID == MCI_ALL_DEVICE_ID) {
|
||||||
LPWINE_MCIDRIVER next;
|
LPWINE_MCIDRIVER next;
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
/* FIXME: shall I notify once after all is done, or for
|
/* FIXME: shall I notify once after all is done, or for
|
||||||
* each of the open drivers ? if the latest, which notif
|
* each of the open drivers ? if the latest, which notif
|
||||||
* to return when only one fails ?
|
* to return when only one fails ?
|
||||||
*/
|
*/
|
||||||
for (wmd = WINMM_IData->lpMciDrvs; wmd; ) {
|
for (wmd = WINMM_IData.lpMciDrvs; wmd; ) {
|
||||||
next = wmd->lpNext;
|
next = wmd->lpNext;
|
||||||
MCI_Close(wmd->wDeviceID, dwParam, lpParms);
|
MCI_Close(wmd->wDeviceID, dwParam, lpParms);
|
||||||
wmd = next;
|
wmd = next;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1832,11 +1832,11 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm
|
||||||
if (lpParms->wDeviceType < MCI_DEVTYPE_FIRST || lpParms->wDeviceType > MCI_DEVTYPE_LAST) {
|
if (lpParms->wDeviceType < MCI_DEVTYPE_FIRST || lpParms->wDeviceType > MCI_DEVTYPE_LAST) {
|
||||||
if (dwFlags & MCI_SYSINFO_OPEN) {
|
if (dwFlags & MCI_SYSINFO_OPEN) {
|
||||||
TRACE("MCI_SYSINFO_QUANTITY: # of open MCI drivers\n");
|
TRACE("MCI_SYSINFO_QUANTITY: # of open MCI drivers\n");
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
for (wmd = WINMM_IData->lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
for (wmd = WINMM_IData.lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
} else {
|
} else {
|
||||||
TRACE("MCI_SYSINFO_QUANTITY: # of installed MCI drivers\n");
|
TRACE("MCI_SYSINFO_QUANTITY: # of installed MCI drivers\n");
|
||||||
if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, wszHklmMci,
|
if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, wszHklmMci,
|
||||||
|
@ -1850,11 +1850,11 @@ static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParm
|
||||||
} else {
|
} else {
|
||||||
if (dwFlags & MCI_SYSINFO_OPEN) {
|
if (dwFlags & MCI_SYSINFO_OPEN) {
|
||||||
TRACE("MCI_SYSINFO_QUANTITY: # of open MCI drivers of type %u\n", lpParms->wDeviceType);
|
TRACE("MCI_SYSINFO_QUANTITY: # of open MCI drivers of type %u\n", lpParms->wDeviceType);
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
for (wmd = WINMM_IData->lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
for (wmd = WINMM_IData.lpMciDrvs; wmd; wmd = wmd->lpNext) {
|
||||||
if (wmd->wType == lpParms->wDeviceType) cnt++;
|
if (wmd->wType == lpParms->wDeviceType) cnt++;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
} else {
|
} else {
|
||||||
TRACE("MCI_SYSINFO_QUANTITY: # of installed MCI drivers of type %u\n", lpParms->wDeviceType);
|
TRACE("MCI_SYSINFO_QUANTITY: # of installed MCI drivers of type %u\n", lpParms->wDeviceType);
|
||||||
FIXME("Don't know how to get # of MCI devices of a given type\n");
|
FIXME("Don't know how to get # of MCI devices of a given type\n");
|
||||||
|
@ -2135,7 +2135,7 @@ BOOL WINAPI mciGetErrorStringW(MCIERROR wError, LPWSTR lpstrBuffer, UINT uLength
|
||||||
if (lpstrBuffer != NULL && uLength > 0 &&
|
if (lpstrBuffer != NULL && uLength > 0 &&
|
||||||
wError >= MCIERR_BASE && wError <= MCIERR_CUSTOM_DRIVER_BASE) {
|
wError >= MCIERR_BASE && wError <= MCIERR_CUSTOM_DRIVER_BASE) {
|
||||||
|
|
||||||
if (LoadStringW(WINMM_IData->hWinMM32Instance,
|
if (LoadStringW(WINMM_IData.hWinMM32Instance,
|
||||||
wError, lpstrBuffer, uLength) > 0) {
|
wError, lpstrBuffer, uLength) > 0) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2153,7 +2153,7 @@ BOOL WINAPI mciGetErrorStringA(MCIERROR dwError, LPSTR lpstrBuffer, UINT uLength
|
||||||
if (lpstrBuffer != NULL && uLength > 0 &&
|
if (lpstrBuffer != NULL && uLength > 0 &&
|
||||||
dwError >= MCIERR_BASE && dwError <= MCIERR_CUSTOM_DRIVER_BASE) {
|
dwError >= MCIERR_BASE && dwError <= MCIERR_CUSTOM_DRIVER_BASE) {
|
||||||
|
|
||||||
if (LoadStringA(WINMM_IData->hWinMM32Instance,
|
if (LoadStringA(WINMM_IData.hWinMM32Instance,
|
||||||
dwError, lpstrBuffer, uLength) > 0) {
|
dwError, lpstrBuffer, uLength) > 0) {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,12 +440,12 @@ LPWINE_MMIO MMIO_Get(HMMIO h)
|
||||||
{
|
{
|
||||||
LPWINE_MMIO wm = NULL;
|
LPWINE_MMIO wm = NULL;
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
for (wm = WINMM_IData->lpMMIO; wm; wm = wm->lpNext) {
|
for (wm = WINMM_IData.lpMMIO; wm; wm = wm->lpNext) {
|
||||||
if (wm->info.hmmio == h)
|
if (wm->info.hmmio == h)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
return wm;
|
return wm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,13 +461,13 @@ static LPWINE_MMIO MMIO_Create(void)
|
||||||
|
|
||||||
wm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MMIO));
|
wm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MMIO));
|
||||||
if (wm) {
|
if (wm) {
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
/* lookup next unallocated WORD handle, with a non NULL value */
|
/* lookup next unallocated WORD handle, with a non NULL value */
|
||||||
while (++MMIO_counter == 0 || MMIO_Get((HMMIO)(ULONG_PTR)MMIO_counter));
|
while (++MMIO_counter == 0 || MMIO_Get((HMMIO)(ULONG_PTR)MMIO_counter));
|
||||||
wm->info.hmmio = (HMMIO)(ULONG_PTR)MMIO_counter;
|
wm->info.hmmio = (HMMIO)(ULONG_PTR)MMIO_counter;
|
||||||
wm->lpNext = WINMM_IData->lpMMIO;
|
wm->lpNext = WINMM_IData.lpMMIO;
|
||||||
WINMM_IData->lpMMIO = wm;
|
WINMM_IData.lpMMIO = wm;
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
}
|
}
|
||||||
return wm;
|
return wm;
|
||||||
}
|
}
|
||||||
|
@ -481,9 +481,9 @@ static BOOL MMIO_Destroy(LPWINE_MMIO wm)
|
||||||
{
|
{
|
||||||
LPWINE_MMIO* m;
|
LPWINE_MMIO* m;
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
/* search for the matching one... */
|
/* search for the matching one... */
|
||||||
m = &(WINMM_IData->lpMMIO);
|
m = &(WINMM_IData.lpMMIO);
|
||||||
while (*m && *m != wm) m = &(*m)->lpNext;
|
while (*m && *m != wm) m = &(*m)->lpNext;
|
||||||
/* ...and destroy */
|
/* ...and destroy */
|
||||||
if (*m) {
|
if (*m) {
|
||||||
|
@ -491,7 +491,7 @@ static BOOL MMIO_Destroy(LPWINE_MMIO wm)
|
||||||
HeapFree(GetProcessHeap(), 0, wm);
|
HeapFree(GetProcessHeap(), 0, wm);
|
||||||
wm = NULL;
|
wm = NULL;
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
return wm ? FALSE : TRUE;
|
return wm ? FALSE : TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
|
||||||
ERR("Could not load sibling WinMM.dll\n");
|
ERR("Could not load sibling WinMM.dll\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
WINMM_IData->hWinMM16Instance = hinstDLL;
|
WINMM_IData.hWinMM16Instance = hinstDLL;
|
||||||
/* hook in our 16 bit function pointers */
|
/* hook in our 16 bit function pointers */
|
||||||
pFnGetMMThread16 = WINMM_GetmmThread;
|
pFnGetMMThread16 = WINMM_GetmmThread;
|
||||||
pFnOpenDriver16 = DRIVER_OpenDriver16;
|
pFnOpenDriver16 = DRIVER_OpenDriver16;
|
||||||
|
@ -91,7 +91,7 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
|
||||||
MMDRV_Init16();
|
MMDRV_Init16();
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
WINMM_IData->hWinMM16Instance = 0;
|
WINMM_IData.hWinMM16Instance = 0;
|
||||||
pFnGetMMThread16 = NULL;
|
pFnGetMMThread16 = NULL;
|
||||||
pFnOpenDriver16 = NULL;
|
pFnOpenDriver16 = NULL;
|
||||||
pFnCloseDriver16 = NULL;
|
pFnCloseDriver16 = NULL;
|
||||||
|
|
|
@ -194,11 +194,11 @@ static void PlaySound_Free(WINE_PLAYSOUND* wps)
|
||||||
{
|
{
|
||||||
WINE_PLAYSOUND** p;
|
WINE_PLAYSOUND** p;
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
for (p = &WINMM_IData->lpPlaySound; *p && *p != wps; p = &((*p)->lpNext));
|
for (p = &WINMM_IData.lpPlaySound; *p && *p != wps; p = &((*p)->lpNext));
|
||||||
if (*p) *p = (*p)->lpNext;
|
if (*p) *p = (*p)->lpNext;
|
||||||
if (WINMM_IData->lpPlaySound == NULL) SetEvent(WINMM_IData->psLastEvent);
|
if (WINMM_IData.lpPlaySound == NULL) SetEvent(WINMM_IData.psLastEvent);
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
if (wps->bAlloc) HeapFree(GetProcessHeap(), 0, (void*)wps->pszSound);
|
if (wps->bAlloc) HeapFree(GetProcessHeap(), 0, (void*)wps->pszSound);
|
||||||
if (wps->hThread) CloseHandle(wps->hThread);
|
if (wps->hThread) CloseHandle(wps->hThread);
|
||||||
HeapFree(GetProcessHeap(), 0, wps);
|
HeapFree(GetProcessHeap(), 0, wps);
|
||||||
|
@ -382,7 +382,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
|
||||||
mmioSeek(hmmio, mmckInfo.dwDataOffset, SEEK_SET);
|
mmioSeek(hmmio, mmckInfo.dwDataOffset, SEEK_SET);
|
||||||
while (left)
|
while (left)
|
||||||
{
|
{
|
||||||
if (WaitForSingleObject(WINMM_IData->psStopEvent, 0) == WAIT_OBJECT_0)
|
if (WaitForSingleObject(WINMM_IData.psStopEvent, 0) == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
wps->bLoop = FALSE;
|
wps->bLoop = FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -430,7 +430,7 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
|
||||||
/* FIXME? I see no difference between SND_NOWAIT and SND_NOSTOP !
|
/* FIXME? I see no difference between SND_NOWAIT and SND_NOSTOP !
|
||||||
* there could be one if several sounds can be played at once...
|
* there could be one if several sounds can be played at once...
|
||||||
*/
|
*/
|
||||||
if ((fdwSound & (SND_NOWAIT | SND_NOSTOP)) && WINMM_IData->lpPlaySound != NULL)
|
if ((fdwSound & (SND_NOWAIT | SND_NOSTOP)) && WINMM_IData.lpPlaySound != NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* alloc internal structure, if we need to play something */
|
/* alloc internal structure, if we need to play something */
|
||||||
|
@ -440,27 +440,27 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
/* since several threads can enter PlaySound in parallel, we're not
|
/* since several threads can enter PlaySound in parallel, we're not
|
||||||
* sure, at this point, that another thread didn't start a new playsound
|
* sure, at this point, that another thread didn't start a new playsound
|
||||||
*/
|
*/
|
||||||
while (WINMM_IData->lpPlaySound != NULL)
|
while (WINMM_IData.lpPlaySound != NULL)
|
||||||
{
|
{
|
||||||
ResetEvent(WINMM_IData->psLastEvent);
|
ResetEvent(WINMM_IData.psLastEvent);
|
||||||
/* FIXME: doc says we have to stop all instances of pszSound if it's non
|
/* FIXME: doc says we have to stop all instances of pszSound if it's non
|
||||||
* NULL... as of today, we stop all playing instances */
|
* NULL... as of today, we stop all playing instances */
|
||||||
SetEvent(WINMM_IData->psStopEvent);
|
SetEvent(WINMM_IData.psStopEvent);
|
||||||
|
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
WaitForSingleObject(WINMM_IData->psLastEvent, INFINITE);
|
WaitForSingleObject(WINMM_IData.psLastEvent, INFINITE);
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
ResetEvent(WINMM_IData->psStopEvent);
|
ResetEvent(WINMM_IData.psStopEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wps) wps->lpNext = WINMM_IData->lpPlaySound;
|
if (wps) wps->lpNext = WINMM_IData.lpPlaySound;
|
||||||
WINMM_IData->lpPlaySound = wps;
|
WINMM_IData.lpPlaySound = wps;
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
if (!pszSound || (fdwSound & SND_PURGE)) return TRUE;
|
if (!pszSound || (fdwSound & SND_PURGE)) return TRUE;
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ void TIME_MMTimeStart(void)
|
||||||
TIME_TimersList = NULL;
|
TIME_TimersList = NULL;
|
||||||
TIME_hWakeEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
TIME_hWakeEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||||
TIME_TimeToDie = FALSE;
|
TIME_TimeToDie = FALSE;
|
||||||
TIME_hMMTimer = CreateThread(NULL, 0, TIME_MMSysTimeThread, WINMM_IData, 0, NULL);
|
TIME_hMMTimer = CreateThread(NULL, 0, TIME_MMSysTimeThread, &WINMM_IData, 0, NULL);
|
||||||
SetThreadPriority(TIME_hMMTimer, THREAD_PRIORITY_TIME_CRITICAL);
|
SetThreadPriority(TIME_hMMTimer, THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol,
|
||||||
lpNewTimer->dwUser = dwUser;
|
lpNewTimer->dwUser = dwUser;
|
||||||
lpNewTimer->wFlags = wFlags;
|
lpNewTimer->wFlags = wFlags;
|
||||||
|
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
if ((wFlags & TIME_KILL_SYNCHRONOUS) && !TIME_hKillEvent)
|
if ((wFlags & TIME_KILL_SYNCHRONOUS) && !TIME_hKillEvent)
|
||||||
TIME_hKillEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
|
TIME_hKillEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
|
||||||
|
@ -348,7 +348,7 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol,
|
||||||
TIME_TimersList = lpNewTimer;
|
TIME_TimersList = lpNewTimer;
|
||||||
lpNewTimer->wTimerID = wNewID + 1;
|
lpNewTimer->wTimerID = wNewID + 1;
|
||||||
|
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
/* Wake the service thread in case there is work to be done */
|
/* Wake the service thread in case there is work to be done */
|
||||||
SetEvent(TIME_hWakeEvent);
|
SetEvent(TIME_hWakeEvent);
|
||||||
|
@ -379,7 +379,7 @@ MMRESULT WINAPI timeKillEvent(UINT wID)
|
||||||
LPWINE_TIMERENTRY lpSelf = NULL, *lpTimer;
|
LPWINE_TIMERENTRY lpSelf = NULL, *lpTimer;
|
||||||
|
|
||||||
TRACE("(%u)\n", wID);
|
TRACE("(%u)\n", wID);
|
||||||
EnterCriticalSection(&WINMM_IData->cs);
|
EnterCriticalSection(&WINMM_IData.cs);
|
||||||
/* remove WINE_TIMERENTRY from list */
|
/* remove WINE_TIMERENTRY from list */
|
||||||
for (lpTimer = &TIME_TimersList; *lpTimer; lpTimer = &(*lpTimer)->lpNext) {
|
for (lpTimer = &TIME_TimersList; *lpTimer; lpTimer = &(*lpTimer)->lpNext) {
|
||||||
if (wID == (*lpTimer)->wTimerID) {
|
if (wID == (*lpTimer)->wTimerID) {
|
||||||
|
@ -389,7 +389,7 @@ MMRESULT WINAPI timeKillEvent(UINT wID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&WINMM_IData->cs);
|
LeaveCriticalSection(&WINMM_IData.cs);
|
||||||
|
|
||||||
if (!lpSelf)
|
if (!lpSelf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -291,7 +291,7 @@ void TIME_MMTimeStart(void);
|
||||||
void TIME_MMTimeStop(void);
|
void TIME_MMTimeStop(void);
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
extern LPWINE_MM_IDATA WINMM_IData;
|
extern WINE_MM_IDATA WINMM_IData;
|
||||||
|
|
||||||
/* pointers to 16 bit functions (if sibling MMSYSTEM.DLL is loaded
|
/* pointers to 16 bit functions (if sibling MMSYSTEM.DLL is loaded
|
||||||
* NULL otherwise
|
* NULL otherwise
|
||||||
|
|
|
@ -65,23 +65,21 @@ void (WINAPI *pFnRestoreThunkLock)(DWORD);
|
||||||
* 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
|
||||||
* ========================================================================*/
|
* ========================================================================*/
|
||||||
|
|
||||||
LPWINE_MM_IDATA WINMM_IData /* = NULL */;
|
WINE_MM_IDATA WINMM_IData;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* WINMM_CreateIData [internal]
|
* WINMM_CreateIData [internal]
|
||||||
*/
|
*/
|
||||||
static BOOL WINMM_CreateIData(HINSTANCE hInstDLL)
|
static BOOL WINMM_CreateIData(HINSTANCE hInstDLL)
|
||||||
{
|
{
|
||||||
WINMM_IData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MM_IDATA));
|
memset( &WINMM_IData, 0, sizeof WINMM_IData );
|
||||||
|
|
||||||
if (!WINMM_IData)
|
WINMM_IData.hWinMM32Instance = hInstDLL;
|
||||||
return FALSE;
|
InitializeCriticalSection(&WINMM_IData.cs);
|
||||||
WINMM_IData->hWinMM32Instance = hInstDLL;
|
WINMM_IData.cs.DebugInfo->Spare[1] = (DWORD)"WINMM_IData";
|
||||||
InitializeCriticalSection(&WINMM_IData->cs);
|
WINMM_IData.psStopEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
||||||
WINMM_IData->cs.DebugInfo->Spare[1] = (DWORD)"WINMM_IData";
|
WINMM_IData.psLastEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
||||||
WINMM_IData->psStopEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
TRACE("Initialized IData (%p)\n", &WINMM_IData);
|
||||||
WINMM_IData->psLastEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
|
||||||
TRACE("Created IData (%p)\n", WINMM_IData);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,17 +88,13 @@ static BOOL WINMM_CreateIData(HINSTANCE hInstDLL)
|
||||||
*/
|
*/
|
||||||
static void WINMM_DeleteIData(void)
|
static void WINMM_DeleteIData(void)
|
||||||
{
|
{
|
||||||
if (WINMM_IData) {
|
TIME_MMTimeStop();
|
||||||
TIME_MMTimeStop();
|
|
||||||
|
|
||||||
/* FIXME: should also free content and resources allocated
|
/* FIXME: should also free content and resources allocated
|
||||||
* inside WINMM_IData */
|
* inside WINMM_IData */
|
||||||
CloseHandle(WINMM_IData->psStopEvent);
|
CloseHandle(WINMM_IData.psStopEvent);
|
||||||
CloseHandle(WINMM_IData->psLastEvent);
|
CloseHandle(WINMM_IData.psLastEvent);
|
||||||
DeleteCriticalSection(&WINMM_IData->cs);
|
DeleteCriticalSection(&WINMM_IData.cs);
|
||||||
HeapFree(GetProcessHeap(), 0, WINMM_IData);
|
|
||||||
WINMM_IData = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
@ -863,7 +857,7 @@ UINT WINAPI midiOutGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
|
||||||
* a warning for the test was always true */
|
* a warning for the test was always true */
|
||||||
(/*uError >= MMSYSERR_BASE && */ uError <= MMSYSERR_LASTERROR) ||
|
(/*uError >= MMSYSERR_BASE && */ uError <= MMSYSERR_LASTERROR) ||
|
||||||
(uError >= MIDIERR_BASE && uError <= MIDIERR_LASTERROR)) {
|
(uError >= MIDIERR_BASE && uError <= MIDIERR_LASTERROR)) {
|
||||||
if (LoadStringW(WINMM_IData->hWinMM32Instance,
|
if (LoadStringW(WINMM_IData.hWinMM32Instance,
|
||||||
uError, lpText, uSize) > 0) {
|
uError, lpText, uSize) > 0) {
|
||||||
ret = MMSYSERR_NOERROR;
|
ret = MMSYSERR_NOERROR;
|
||||||
}
|
}
|
||||||
|
@ -2173,7 +2167,7 @@ UINT WINAPI waveOutGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
|
||||||
* a warning for the test was always true */
|
* a warning for the test was always true */
|
||||||
(/*uError >= MMSYSERR_BASE && */ uError <= MMSYSERR_LASTERROR) ||
|
(/*uError >= MMSYSERR_BASE && */ uError <= MMSYSERR_LASTERROR) ||
|
||||||
(uError >= WAVERR_BASE && uError <= WAVERR_LASTERROR)) {
|
(uError >= WAVERR_BASE && uError <= WAVERR_LASTERROR)) {
|
||||||
if (LoadStringW(WINMM_IData->hWinMM32Instance,
|
if (LoadStringW(WINMM_IData.hWinMM32Instance,
|
||||||
uError, lpText, uSize) > 0) {
|
uError, lpText, uSize) > 0) {
|
||||||
ret = MMSYSERR_NOERROR;
|
ret = MMSYSERR_NOERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue