1999-10-31 19:29:16 +01:00
|
|
|
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
|
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/*
|
|
|
|
* MSACM32 library
|
|
|
|
*
|
|
|
|
* Copyright 1998 Patrik Stridvall
|
1999-10-31 19:29:16 +01:00
|
|
|
* 1999 Eric Pouech
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1999-09-11 18:27:20 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "wingdi.h"
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "winuser.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "winerror.h"
|
2001-04-23 20:14:41 +02:00
|
|
|
#include "winreg.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "mmsystem.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "mmreg.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "msacm.h"
|
|
|
|
#include "msacmdrv.h"
|
1999-10-31 19:29:16 +01:00
|
|
|
#include "wineacm.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2003-07-02 02:40:14 +02:00
|
|
|
#include "wine/unicode.h"
|
1998-10-11 19:00:29 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
|
1999-10-31 19:29:16 +01:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/**********************************************************************/
|
|
|
|
|
2003-01-15 00:43:41 +01:00
|
|
|
HANDLE MSACM_hHeap = NULL;
|
1999-02-26 12:11:13 +01:00
|
|
|
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL;
|
|
|
|
PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL;
|
1998-10-11 19:00:29 +02:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
#if 0
|
|
|
|
/***********************************************************************
|
|
|
|
* MSACM_DumpCache
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static void MSACM_DumpCache(PWINE_ACMDRIVERID padid)
|
2001-04-23 20:14:41 +02:00
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
TRACE("cFilterTags=%lu cFormatTags=%lu fdwSupport=%08lx\n",
|
|
|
|
padid->cFilterTags, padid->cFormatTags, padid->fdwSupport);
|
|
|
|
for (i = 0; i < padid->cache->cFormatTags; i++) {
|
2002-06-01 01:06:46 +02:00
|
|
|
TRACE("\tdwFormatTag=%lu cbwfx=%lu\n",
|
2001-04-23 20:14:41 +02:00
|
|
|
padid->aFormatTag[i].dwFormatTag, padid->aFormatTag[i].cbwfx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MSACM_FindFormatTagInCache [internal]
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
2001-04-23 20:14:41 +02:00
|
|
|
* Returns TRUE is the format tag fmtTag is present in the cache.
|
|
|
|
* If so, idx is set to its index.
|
|
|
|
*/
|
|
|
|
BOOL MSACM_FindFormatTagInCache(WINE_ACMDRIVERID* padid, DWORD fmtTag, LPDWORD idx)
|
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for (i = 0; i < padid->cFormatTags; i++) {
|
|
|
|
if (padid->aFormatTag[i].dwFormatTag == fmtTag) {
|
|
|
|
if (idx) *idx = i;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MSACM_FillCache
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static BOOL MSACM_FillCache(PWINE_ACMDRIVERID padid)
|
2001-04-23 20:14:41 +02:00
|
|
|
{
|
2002-02-08 18:11:22 +01:00
|
|
|
HACMDRIVER had = 0;
|
|
|
|
int ntag;
|
|
|
|
ACMDRIVERDETAILSW add;
|
|
|
|
ACMFORMATTAGDETAILSW aftd;
|
2001-04-23 20:14:41 +02:00
|
|
|
|
|
|
|
if (acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
padid->aFormatTag = NULL;
|
|
|
|
add.cbStruct = sizeof(add);
|
|
|
|
if (MSACM_Message(had, ACMDM_DRIVER_DETAILS, (LPARAM)&add, 0))
|
|
|
|
goto errCleanUp;
|
|
|
|
|
|
|
|
if (add.cFormatTags > 0) {
|
2002-06-01 01:06:46 +02:00
|
|
|
padid->aFormatTag = HeapAlloc(MSACM_hHeap, HEAP_ZERO_MEMORY,
|
2001-04-23 20:14:41 +02:00
|
|
|
add.cFormatTags * sizeof(padid->aFormatTag[0]));
|
|
|
|
if (!padid->aFormatTag) goto errCleanUp;
|
|
|
|
}
|
|
|
|
|
|
|
|
padid->cFormatTags = add.cFormatTags;
|
|
|
|
padid->cFilterTags = add.cFilterTags;
|
|
|
|
padid->fdwSupport = add.fdwSupport;
|
|
|
|
|
|
|
|
aftd.cbStruct = sizeof(aftd);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
for (ntag = 0; ntag < add.cFormatTags; ntag++) {
|
2002-02-08 18:11:22 +01:00
|
|
|
aftd.dwFormatTagIndex = ntag;
|
|
|
|
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)&aftd, ACM_FORMATTAGDETAILSF_INDEX)) {
|
2003-07-02 02:40:14 +02:00
|
|
|
TRACE("IIOs (%s)\n", debugstr_w(padid->pszDriverAlias));
|
2001-04-23 20:14:41 +02:00
|
|
|
goto errCleanUp;
|
|
|
|
}
|
|
|
|
padid->aFormatTag[ntag].dwFormatTag = aftd.dwFormatTag;
|
2002-02-08 18:11:22 +01:00
|
|
|
padid->aFormatTag[ntag].cbwfx = aftd.cbFormatSize;
|
2001-04-23 20:14:41 +02:00
|
|
|
}
|
2002-02-08 18:11:22 +01:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
acmDriverClose(had, 0);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
errCleanUp:
|
|
|
|
if (had) acmDriverClose(had, 0);
|
|
|
|
HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
|
|
|
|
padid->aFormatTag = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MSACM_GetRegistryKey
|
|
|
|
*/
|
2003-07-02 02:40:14 +02:00
|
|
|
static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID* padid)
|
2001-04-23 20:14:41 +02:00
|
|
|
{
|
2003-07-02 02:40:14 +02:00
|
|
|
static const WCHAR baseKey[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'A','u','d','i','o','C','o','m','p','r','e','s','s','i','o','n','M','a','n','a','g','e','r','\\',
|
|
|
|
'D','r','i','v','e','r','C','a','c','h','e','\\','\0'};
|
|
|
|
LPWSTR ret;
|
2001-04-23 20:14:41 +02:00
|
|
|
int len;
|
|
|
|
|
|
|
|
if (!padid->pszDriverAlias) {
|
|
|
|
ERR("No alias needed for registry entry\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-07-02 02:40:14 +02:00
|
|
|
len = strlenW(baseKey);
|
|
|
|
ret = HeapAlloc(MSACM_hHeap, 0, (len + strlenW(padid->pszDriverAlias) + 1) * sizeof(WCHAR));
|
2001-04-23 20:14:41 +02:00
|
|
|
if (!ret) return NULL;
|
|
|
|
|
2003-07-02 02:40:14 +02:00
|
|
|
strcpyW(ret, baseKey);
|
|
|
|
strcpyW(ret + len, padid->pszDriverAlias);
|
|
|
|
CharLowerW(ret + len);
|
2001-04-23 20:14:41 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MSACM_ReadCache
|
|
|
|
*/
|
|
|
|
static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid)
|
|
|
|
{
|
2003-07-02 02:40:14 +02:00
|
|
|
LPWSTR key = MSACM_GetRegistryKey(padid);
|
2001-04-23 20:14:41 +02:00
|
|
|
HKEY hKey;
|
|
|
|
DWORD type, size;
|
|
|
|
|
|
|
|
if (!key) return FALSE;
|
|
|
|
|
|
|
|
padid->aFormatTag = NULL;
|
|
|
|
|
2003-07-02 02:40:14 +02:00
|
|
|
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
|
2001-04-23 20:14:41 +02:00
|
|
|
goto errCleanUp;
|
|
|
|
|
|
|
|
size = sizeof(padid->cFormatTags);
|
|
|
|
if (RegQueryValueExA(hKey, "cFormatTags", 0, &type, (void*)&padid->cFormatTags, &size))
|
|
|
|
goto errCleanUp;
|
|
|
|
size = sizeof(padid->cFilterTags);
|
|
|
|
if (RegQueryValueExA(hKey, "cFilterTags", 0, &type, (void*)&padid->cFilterTags, &size))
|
|
|
|
goto errCleanUp;
|
|
|
|
size = sizeof(padid->fdwSupport);
|
|
|
|
if (RegQueryValueExA(hKey, "fdwSupport", 0, &type, (void*)&padid->fdwSupport, &size))
|
|
|
|
goto errCleanUp;
|
|
|
|
|
|
|
|
if (padid->cFormatTags > 0) {
|
|
|
|
size = padid->cFormatTags * sizeof(padid->aFormatTag[0]);
|
|
|
|
padid->aFormatTag = HeapAlloc(MSACM_hHeap, HEAP_ZERO_MEMORY, size);
|
|
|
|
if (!padid->aFormatTag) goto errCleanUp;
|
|
|
|
if (RegQueryValueExA(hKey, "aFormatTagCache", 0, &type, (void*)padid->aFormatTag, &size))
|
|
|
|
goto errCleanUp;
|
|
|
|
}
|
|
|
|
HeapFree(MSACM_hHeap, 0, key);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
errCleanUp:
|
|
|
|
HeapFree(MSACM_hHeap, 0, key);
|
|
|
|
HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
|
|
|
|
padid->aFormatTag = NULL;
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MSACM_WriteCache
|
|
|
|
*/
|
|
|
|
static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid)
|
|
|
|
{
|
2003-07-02 02:40:14 +02:00
|
|
|
LPWSTR key = MSACM_GetRegistryKey(padid);
|
2001-04-23 20:14:41 +02:00
|
|
|
HKEY hKey;
|
|
|
|
|
|
|
|
if (!key) return FALSE;
|
|
|
|
|
2003-07-02 02:40:14 +02:00
|
|
|
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
|
2001-04-23 20:14:41 +02:00
|
|
|
goto errCleanUp;
|
|
|
|
|
|
|
|
if (RegSetValueExA(hKey, "cFormatTags", 0, REG_DWORD, (void*)&padid->cFormatTags, sizeof(DWORD)))
|
|
|
|
goto errCleanUp;
|
|
|
|
if (RegSetValueExA(hKey, "cFilterTags", 0, REG_DWORD, (void*)&padid->cFilterTags, sizeof(DWORD)))
|
|
|
|
goto errCleanUp;
|
|
|
|
if (RegSetValueExA(hKey, "fdwSupport", 0, REG_DWORD, (void*)&padid->fdwSupport, sizeof(DWORD)))
|
|
|
|
goto errCleanUp;
|
2002-06-01 01:06:46 +02:00
|
|
|
if (RegSetValueExA(hKey, "aFormatTagCache", 0, REG_BINARY,
|
|
|
|
(void*)padid->aFormatTag,
|
2001-04-23 20:14:41 +02:00
|
|
|
padid->cFormatTags * sizeof(padid->aFormatTag[0])))
|
|
|
|
goto errCleanUp;
|
|
|
|
HeapFree(MSACM_hHeap, 0, key);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
errCleanUp:
|
|
|
|
HeapFree(MSACM_hHeap, 0, key);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/***********************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* MSACM_RegisterDriver()
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2004-04-20 02:34:52 +02:00
|
|
|
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName,
|
1999-10-31 19:29:16 +01:00
|
|
|
HINSTANCE hinstModule)
|
2002-06-01 01:06:46 +02:00
|
|
|
{
|
2001-05-22 21:21:16 +02:00
|
|
|
PWINE_ACMDRIVERID padid;
|
1999-10-31 19:29:16 +01:00
|
|
|
|
2003-07-02 02:40:14 +02:00
|
|
|
TRACE("(%s, %s, %p)\n",
|
|
|
|
debugstr_w(pszDriverAlias), debugstr_w(pszFileName), hinstModule);
|
1999-10-31 19:29:16 +01:00
|
|
|
|
|
|
|
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
|
2000-08-26 06:33:00 +02:00
|
|
|
padid->obj.dwType = WINE_ACMOBJ_DRIVERID;
|
|
|
|
padid->obj.pACMDriverID = padid;
|
2000-11-13 05:16:05 +01:00
|
|
|
padid->pszDriverAlias = NULL;
|
|
|
|
if (pszDriverAlias)
|
|
|
|
{
|
2003-07-02 02:40:14 +02:00
|
|
|
padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
|
|
|
|
strcpyW( padid->pszDriverAlias, pszDriverAlias );
|
2000-11-13 05:16:05 +01:00
|
|
|
}
|
|
|
|
padid->pszFileName = NULL;
|
|
|
|
if (pszFileName)
|
|
|
|
{
|
2003-07-02 02:40:14 +02:00
|
|
|
padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) );
|
|
|
|
strcpyW( padid->pszFileName, pszFileName );
|
2000-11-13 05:16:05 +01:00
|
|
|
}
|
1999-10-31 19:29:16 +01:00
|
|
|
padid->hInstModule = hinstModule;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-12-12 22:28:09 +01:00
|
|
|
padid->pACMDriverList = NULL;
|
1999-10-31 19:29:16 +01:00
|
|
|
padid->pNextACMDriverID = NULL;
|
1999-12-12 22:28:09 +01:00
|
|
|
padid->pPrevACMDriverID = MSACM_pLastACMDriverID;
|
1999-10-31 19:29:16 +01:00
|
|
|
if (MSACM_pLastACMDriverID)
|
|
|
|
MSACM_pLastACMDriverID->pNextACMDriverID = padid;
|
|
|
|
MSACM_pLastACMDriverID = padid;
|
|
|
|
if (!MSACM_pFirstACMDriverID)
|
|
|
|
MSACM_pFirstACMDriverID = padid;
|
2001-04-23 20:14:41 +02:00
|
|
|
/* disable the driver if we cannot load the cache */
|
|
|
|
if (!MSACM_ReadCache(padid) && !MSACM_FillCache(padid)) {
|
2003-07-02 02:40:14 +02:00
|
|
|
WARN("Couldn't load cache for ACM driver (%s)\n", debugstr_w(pszFileName));
|
2001-04-23 20:14:41 +02:00
|
|
|
MSACM_UnregisterDriver(padid);
|
|
|
|
return NULL;
|
|
|
|
}
|
1999-10-31 19:29:16 +01:00
|
|
|
return padid;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* MSACM_RegisterAllDrivers()
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
void MSACM_RegisterAllDrivers(void)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2004-04-20 02:34:52 +02:00
|
|
|
static const WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
|
|
|
|
static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
|
|
|
|
static const WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
|
|
|
|
static const WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
|
2004-06-30 20:11:39 +02:00
|
|
|
static const WCHAR drvkey[] = {'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s',' ','N','T','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'D','r','i','v','e','r','s','3','2','\0'};
|
|
|
|
DWORD i, cnt = 0, bufLen, lRet;
|
|
|
|
WCHAR buf[2048], *name, *s;
|
|
|
|
FILETIME lastWrite;
|
|
|
|
HKEY hKey;
|
|
|
|
|
|
|
|
/* FIXME: What if the user edits system.ini while the program is running?
|
|
|
|
* Does Windows handle that? */
|
|
|
|
if (MSACM_pFirstACMDriverID) return;
|
|
|
|
|
|
|
|
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
|
|
|
|
if (lRet == ERROR_SUCCESS) {
|
|
|
|
RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
|
|
|
|
for (i = 0; i < cnt; i++) {
|
|
|
|
bufLen = sizeof(buf) / sizeof(buf[0]);
|
|
|
|
lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
|
|
|
|
if (lRet != ERROR_SUCCESS) continue;
|
|
|
|
if (strncmpiW(buf, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
|
|
|
|
if (!(name = strchrW(buf, '='))) continue;
|
|
|
|
*name = 0;
|
|
|
|
MSACM_RegisterDriver(buf, name + 1, 0);
|
|
|
|
}
|
|
|
|
RegCloseKey( hKey );
|
|
|
|
}
|
2000-10-12 22:46:49 +02:00
|
|
|
|
2004-06-30 20:11:39 +02:00
|
|
|
if (GetPrivateProfileSectionW(drv32, buf, sizeof(buf)/sizeof(buf[0]), sys))
|
2003-07-02 02:40:14 +02:00
|
|
|
{
|
2004-06-30 20:11:39 +02:00
|
|
|
for(s = buf; *s; s += strlenW(s) + 1)
|
|
|
|
{
|
|
|
|
if (strncmpiW(s, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
|
|
|
|
if (!(name = strchrW(s, '='))) continue;
|
|
|
|
*name = 0;
|
|
|
|
MSACM_RegisterDriver(s, name + 1, 0);
|
|
|
|
*name = '=';
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2003-07-02 02:40:14 +02:00
|
|
|
MSACM_RegisterDriver(msacm32, msacm32, 0);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-08-26 06:33:00 +02:00
|
|
|
* MSACM_UnregisterDriver()
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
1999-10-31 19:29:16 +01:00
|
|
|
PWINE_ACMDRIVERID pNextACMDriverID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-12-12 22:28:09 +01:00
|
|
|
while (p->pACMDriverList)
|
|
|
|
acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
if (p->pszDriverAlias)
|
|
|
|
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
|
|
|
|
if (p->pszFileName)
|
|
|
|
HeapFree(MSACM_hHeap, 0, p->pszFileName);
|
2001-04-23 20:14:41 +02:00
|
|
|
HeapFree(MSACM_hHeap, 0, p->aFormatTag);
|
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
if (p == MSACM_pFirstACMDriverID)
|
|
|
|
MSACM_pFirstACMDriverID = p->pNextACMDriverID;
|
|
|
|
if (p == MSACM_pLastACMDriverID)
|
1999-12-12 22:28:09 +01:00
|
|
|
MSACM_pLastACMDriverID = p->pPrevACMDriverID;
|
1999-10-31 19:29:16 +01:00
|
|
|
|
1999-12-12 22:28:09 +01:00
|
|
|
if (p->pPrevACMDriverID)
|
|
|
|
p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
|
1999-10-31 19:29:16 +01:00
|
|
|
if (p->pNextACMDriverID)
|
1999-12-12 22:28:09 +01:00
|
|
|
p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
pNextACMDriverID = p->pNextACMDriverID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
HeapFree(MSACM_hHeap, 0, p);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
return pNextACMDriverID;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-08-26 06:33:00 +02:00
|
|
|
* MSACM_UnregisterAllDrivers()
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
void MSACM_UnregisterAllDrivers(void)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
PWINE_ACMDRIVERID p = MSACM_pFirstACMDriverID;
|
1999-10-31 19:29:16 +01:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
while (p) {
|
|
|
|
MSACM_WriteCache(p);
|
|
|
|
p = MSACM_UnregisterDriver(p);
|
|
|
|
}
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-08-26 06:33:00 +02:00
|
|
|
* MSACM_GetObj()
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj;
|
|
|
|
|
2000-10-02 05:33:20 +02:00
|
|
|
if (pao == NULL || IsBadReadPtr(pao, sizeof(WINE_ACMOBJ)) ||
|
2000-08-26 06:33:00 +02:00
|
|
|
((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType)))
|
|
|
|
return NULL;
|
|
|
|
return pao;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* MSACM_GetDriverID()
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
return (PWINE_ACMDRIVERID)MSACM_GetObj((HACMOBJ)hDriverID, WINE_ACMOBJ_DRIVERID);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-08-26 06:33:00 +02:00
|
|
|
* MSACM_GetDriver()
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
2000-08-26 06:33:00 +02:00
|
|
|
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-08-26 06:33:00 +02:00
|
|
|
return (PWINE_ACMDRIVER)MSACM_GetObj((HACMOBJ)hDriver, WINE_ACMOBJ_DRIVER);
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* MSACM_Message()
|
|
|
|
*/
|
|
|
|
MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
|
|
|
{
|
|
|
|
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
|
1998-10-11 19:00:29 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
return pad ? SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2) : MMSYSERR_INVALHANDLE;
|
|
|
|
}
|