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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
|
|
|
|
2002-05-16 20:31:27 +02:00
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2000-08-08 22:49:16 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-02-17 14:51:06 +01: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"
|
2001-07-25 02:43:29 +02:00
|
|
|
#include "winnls.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"
|
2006-01-18 12:13:36 +01: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);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1998-10-11 19:00:29 +02:00
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverAddA (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule,
|
|
|
|
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2006-01-18 12:07:42 +01:00
|
|
|
MMRESULT resultW;
|
|
|
|
WCHAR * driverW = NULL;
|
|
|
|
LPARAM lParamW = lParam;
|
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %08lx, %08x, %08x)\n",
|
2004-06-01 21:41:01 +02:00
|
|
|
phadid, hinstModule, lParam, dwPriority, fdwAdd);
|
|
|
|
|
|
|
|
if (!phadid) {
|
|
|
|
WARN("invalid parameter\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALPARAM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
/* Check if any unknown flags */
|
2002-06-01 01:06:46 +02:00
|
|
|
if (fdwAdd &
|
1999-10-31 19:29:16 +01:00
|
|
|
~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
|
2004-06-01 21:41:01 +02:00
|
|
|
ACM_DRIVERADDF_GLOBAL)) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
/* Check if any incompatible flags */
|
2002-06-01 01:06:46 +02:00
|
|
|
if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
|
2004-06-01 21:41:01 +02:00
|
|
|
(fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-01-18 12:07:42 +01:00
|
|
|
/* A->W translation of name */
|
|
|
|
if ((fdwAdd & ACM_DRIVERADDF_TYPEMASK) == ACM_DRIVERADDF_NAME) {
|
|
|
|
unsigned long len;
|
|
|
|
|
|
|
|
if (lParam == 0) return MMSYSERR_INVALPARAM;
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0);
|
|
|
|
driverW = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
|
|
|
|
if (!driverW) return MMSYSERR_NOMEM;
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, (LPSTR)lParam, -1, driverW, len);
|
|
|
|
lParamW = (LPARAM)driverW;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-01-18 12:07:42 +01:00
|
|
|
resultW = acmDriverAddW(phadid, hinstModule, lParamW, dwPriority, fdwAdd);
|
|
|
|
HeapFree(MSACM_hHeap, 0, driverW);
|
|
|
|
return resultW;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverAddW (MSACM32.@)
|
2006-01-18 12:07:42 +01:00
|
|
|
*
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule,
|
|
|
|
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2006-01-18 12:16:57 +01:00
|
|
|
PWINE_ACMLOCALDRIVER pLocalDrv = NULL;
|
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %08lx, %08x, %08x)\n",
|
2006-01-18 12:07:42 +01:00
|
|
|
phadid, hinstModule, lParam, dwPriority, fdwAdd);
|
|
|
|
|
|
|
|
if (!phadid) {
|
|
|
|
WARN("invalid parameter\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if any unknown flags */
|
|
|
|
if (fdwAdd &
|
|
|
|
~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
|
|
|
|
ACM_DRIVERADDF_GLOBAL)) {
|
|
|
|
WARN("invalid flag\n");
|
|
|
|
return MMSYSERR_INVALFLAG;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if any incompatible flags */
|
|
|
|
if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
|
|
|
|
(fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) {
|
|
|
|
WARN("invalid flag\n");
|
|
|
|
return MMSYSERR_INVALFLAG;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (fdwAdd & ACM_DRIVERADDF_TYPEMASK) {
|
|
|
|
case ACM_DRIVERADDF_NAME:
|
|
|
|
/*
|
|
|
|
hInstModule (unused)
|
|
|
|
lParam name of value in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32
|
|
|
|
dwPriority (unused, set to 0)
|
|
|
|
*/
|
|
|
|
*phadid = (HACMDRIVERID) MSACM_RegisterDriverFromRegistry((LPCWSTR)lParam);
|
|
|
|
if (!*phadid) {
|
|
|
|
ERR("Unable to register driver via ACM_DRIVERADDF_NAME\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ACM_DRIVERADDF_FUNCTION:
|
|
|
|
/*
|
|
|
|
hInstModule Handle of module which contains driver entry proc
|
|
|
|
lParam Driver function address
|
|
|
|
dwPriority (unused, set to 0)
|
|
|
|
*/
|
|
|
|
fdwAdd &= ~ACM_DRIVERADDF_TYPEMASK;
|
2006-01-18 12:16:57 +01:00
|
|
|
/* FIXME: fdwAdd ignored */
|
|
|
|
/* Application-supplied acmDriverProc's are placed at the top of the priority unless
|
|
|
|
fdwAdd indicates ACM_DRIVERADDF_GLOBAL
|
|
|
|
*/
|
|
|
|
pLocalDrv = MSACM_RegisterLocalDriver(hinstModule, (DRIVERPROC)lParam);
|
|
|
|
*phadid = pLocalDrv ? (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, pLocalDrv) : NULL;
|
|
|
|
if (!*phadid) {
|
|
|
|
ERR("Unable to register driver via ACM_DRIVERADDF_FUNCTION\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
break;
|
2006-01-18 12:07:42 +01:00
|
|
|
case ACM_DRIVERADDF_NOTIFYHWND:
|
|
|
|
/*
|
|
|
|
hInstModule (unused)
|
|
|
|
lParam Handle of notification window
|
|
|
|
dwPriority Window message to send for notification broadcasts
|
|
|
|
*/
|
2006-01-18 12:10:59 +01:00
|
|
|
*phadid = (HACMDRIVERID) MSACM_RegisterNotificationWindow((HWND)lParam, dwPriority);
|
|
|
|
if (!*phadid) {
|
|
|
|
ERR("Unable to register driver via ACM_DRIVERADDF_NOTIFYHWND\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
break;
|
2006-01-18 12:07:42 +01:00
|
|
|
default:
|
|
|
|
ERR("invalid flag value 0x%08lx for fdwAdd\n", fdwAdd & ACM_DRIVERADDF_TYPEMASK);
|
|
|
|
return MMSYSERR_INVALFLAG;
|
|
|
|
}
|
|
|
|
|
|
|
|
MSACM_BroadcastNotification();
|
|
|
|
return MMSYSERR_NOERROR;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverClose (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2000-10-12 22:46:49 +02:00
|
|
|
PWINE_ACMDRIVER pad;
|
|
|
|
PWINE_ACMDRIVERID padid;
|
|
|
|
PWINE_ACMDRIVER* tpad;
|
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %08x)\n", had, fdwClose);
|
2004-06-01 21:41:01 +02:00
|
|
|
|
|
|
|
if (fdwClose) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-10-12 22:46:49 +02:00
|
|
|
pad = MSACM_GetDriver(had);
|
2004-06-01 21:41:01 +02:00
|
|
|
if (!pad) {
|
|
|
|
WARN("invalid handle\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALHANDLE;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
1999-12-12 22:28:09 +01:00
|
|
|
|
2000-10-12 22:46:49 +02:00
|
|
|
padid = pad->obj.pACMDriverID;
|
|
|
|
|
|
|
|
/* remove driver from list */
|
2006-01-16 21:30:52 +01:00
|
|
|
for (tpad = &(padid->pACMDriverList); *tpad; tpad = &((*tpad)->pNextACMDriver)) {
|
2000-10-12 22:46:49 +02:00
|
|
|
if (*tpad == pad) {
|
|
|
|
*tpad = (*tpad)->pNextACMDriver;
|
1999-12-12 22:28:09 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-10-12 22:46:49 +02:00
|
|
|
/* close driver if it has been opened */
|
2006-01-18 12:16:57 +01:00
|
|
|
if (pad->hDrvr && !pad->pLocalDrvrInst)
|
2000-10-12 22:46:49 +02:00
|
|
|
CloseDriver(pad->hDrvr, 0, 0);
|
2006-01-18 12:16:57 +01:00
|
|
|
else if (pad->pLocalDrvrInst)
|
|
|
|
MSACM_CloseLocalDriver(pad->pLocalDrvrInst);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-10-12 22:46:49 +02:00
|
|
|
HeapFree(MSACM_hHeap, 0, pad);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_NOERROR;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverDetailsA (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT mmr;
|
|
|
|
ACMDRIVERDETAILSW addw;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %08x)\n", hadid, padd, fdwDetails);
|
2004-06-01 21:41:01 +02:00
|
|
|
|
|
|
|
if (!padd) {
|
|
|
|
WARN("invalid parameter\n");
|
2004-05-03 22:09:42 +02:00
|
|
|
return MMSYSERR_INVALPARAM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2004-05-03 22:09:42 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (padd->cbStruct < 4) {
|
|
|
|
WARN("invalid parameter\n");
|
2004-05-03 22:09:42 +02:00
|
|
|
return MMSYSERR_INVALPARAM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2004-05-03 22:09:42 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
addw.cbStruct = sizeof(addw);
|
|
|
|
mmr = acmDriverDetailsW(hadid, &addw, fdwDetails);
|
|
|
|
if (mmr == 0) {
|
2004-05-03 22:09:42 +02:00
|
|
|
ACMDRIVERDETAILSA padda;
|
|
|
|
|
|
|
|
padda.fccType = addw.fccType;
|
|
|
|
padda.fccComp = addw.fccComp;
|
|
|
|
padda.wMid = addw.wMid;
|
|
|
|
padda.wPid = addw.wPid;
|
|
|
|
padda.vdwACM = addw.vdwACM;
|
|
|
|
padda.vdwDriver = addw.vdwDriver;
|
|
|
|
padda.fdwSupport = addw.fdwSupport;
|
|
|
|
padda.cFormatTags = addw.cFormatTags;
|
|
|
|
padda.cFilterTags = addw.cFilterTags;
|
|
|
|
padda.hicon = addw.hicon;
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, addw.szShortName, -1, padda.szShortName,
|
|
|
|
sizeof(padda.szShortName), NULL, NULL );
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, addw.szLongName, -1, padda.szLongName,
|
|
|
|
sizeof(padda.szLongName), NULL, NULL );
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, addw.szCopyright, -1, padda.szCopyright,
|
|
|
|
sizeof(padda.szCopyright), NULL, NULL );
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, addw.szLicensing, -1, padda.szLicensing,
|
|
|
|
sizeof(padda.szLicensing), NULL, NULL );
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, addw.szFeatures, -1, padda.szFeatures,
|
|
|
|
sizeof(padda.szFeatures), NULL, NULL );
|
2005-12-20 11:48:01 +01:00
|
|
|
padda.cbStruct = min(padd->cbStruct, sizeof(*padd));
|
|
|
|
memcpy(padd, &padda, padda.cbStruct);
|
1999-10-31 19:29:16 +01:00
|
|
|
}
|
|
|
|
return mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverDetailsW (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
1999-12-12 22:28:09 +01:00
|
|
|
HACMDRIVER acmDrvr;
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT mmr;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %08x)\n", hadid, padd, fdwDetails);
|
2004-06-01 21:41:01 +02:00
|
|
|
|
|
|
|
if (!padd) {
|
|
|
|
WARN("invalid parameter\n");
|
2004-05-03 22:09:42 +02:00
|
|
|
return MMSYSERR_INVALPARAM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2004-05-03 22:09:42 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (padd->cbStruct < 4) {
|
|
|
|
WARN("invalid parameter\n");
|
2004-05-03 22:09:42 +02:00
|
|
|
return MMSYSERR_INVALPARAM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2004-05-03 22:09:42 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (fdwDetails) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-12-12 22:28:09 +01:00
|
|
|
mmr = acmDriverOpen(&acmDrvr, hadid, 0);
|
2000-08-26 06:33:00 +02:00
|
|
|
if (mmr == MMSYSERR_NOERROR) {
|
2004-05-03 22:09:42 +02:00
|
|
|
ACMDRIVERDETAILSW paddw;
|
2005-12-20 11:48:01 +01:00
|
|
|
paddw.cbStruct = sizeof(paddw);
|
2007-12-21 18:05:29 +01:00
|
|
|
mmr = MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM)&paddw, 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-12-12 22:28:09 +01:00
|
|
|
acmDriverClose(acmDrvr, 0);
|
2005-12-20 11:48:01 +01:00
|
|
|
paddw.cbStruct = min(padd->cbStruct, sizeof(*padd));
|
|
|
|
memcpy(padd, &paddw, paddw.cbStruct);
|
1999-10-31 19:29:16 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
return mmr;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverEnum (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2001-04-23 20:14:41 +02:00
|
|
|
PWINE_ACMDRIVERID padid;
|
|
|
|
DWORD fdwSupport;
|
1999-12-12 22:28:09 +01:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %08x, %08x)\n", fnCallback, dwInstance, fdwEnum);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (!fnCallback) {
|
|
|
|
WARN("invalid parameter\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fdwEnum & ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-04-23 20:14:41 +02:00
|
|
|
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
|
|
|
|
fdwSupport = padid->fdwSupport;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-05-22 21:21:16 +02:00
|
|
|
if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) {
|
1999-12-12 22:28:09 +01:00
|
|
|
if (fdwEnum & ACM_DRIVERENUMF_DISABLED)
|
2001-04-23 20:14:41 +02:00
|
|
|
fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
1999-12-12 22:28:09 +01:00
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
2001-04-23 20:14:41 +02:00
|
|
|
if (!(*fnCallback)((HACMDRIVERID)padid, dwInstance, fdwSupport))
|
2000-08-26 06:33:00 +02:00
|
|
|
break;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_NOERROR;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverID (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
1999-10-31 19:29:16 +01:00
|
|
|
PWINE_ACMOBJ pao;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %08x)\n", hao, phadid, fdwDriverID);
|
2004-06-01 21:41:01 +02:00
|
|
|
|
|
|
|
if (fdwDriverID) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE);
|
2004-06-01 21:41:01 +02:00
|
|
|
if (!pao) {
|
|
|
|
WARN("invalid handle\n");
|
2000-08-26 06:33:00 +02:00
|
|
|
return MMSYSERR_INVALHANDLE;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (!phadid) {
|
|
|
|
WARN("invalid parameter\n");
|
2004-05-03 22:09:42 +02:00
|
|
|
return MMSYSERR_INVALPARAM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2004-05-03 22:09:42 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
*phadid = (HACMDRIVERID) pao->pACMDriverID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_NOERROR;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverMessage (MSACM32.@)
|
2000-08-26 06:33:00 +02:00
|
|
|
*
|
2006-01-18 12:13:36 +01:00
|
|
|
* Note: MSDN documentation (July 2001) is incomplete. This function
|
|
|
|
* accepts sending messages to an HACMDRIVERID in addition to the
|
|
|
|
* documented HACMDRIVER. In fact, for DRV_QUERYCONFIGURE and DRV_CONFIGURE,
|
|
|
|
* this might actually be the required mode of operation.
|
|
|
|
*
|
|
|
|
* Note: For DRV_CONFIGURE, msacm supplies its own DRVCONFIGINFO structure
|
|
|
|
* when the application fails to supply one. Some native drivers depend on
|
|
|
|
* this and refuse to display unless a valid DRVCONFIGINFO structure is
|
|
|
|
* built and supplied.
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %04x, %08lx, %08lx\n", had, uMsg, lParam1, lParam2);
|
|
|
|
|
2000-08-26 06:33:00 +02:00
|
|
|
if ((uMsg >= ACMDM_USER && uMsg < ACMDM_RESERVED_LOW) ||
|
|
|
|
uMsg == ACMDM_DRIVER_ABOUT ||
|
|
|
|
uMsg == DRV_QUERYCONFIGURE ||
|
|
|
|
uMsg == DRV_CONFIGURE)
|
2006-01-18 12:13:36 +01:00
|
|
|
{
|
|
|
|
PWINE_ACMDRIVERID padid;
|
|
|
|
LRESULT lResult;
|
|
|
|
LPDRVCONFIGINFO pConfigInfo = NULL;
|
2006-11-03 21:56:30 +01:00
|
|
|
LPWSTR section_name = NULL;
|
|
|
|
LPWSTR alias_name = NULL;
|
2004-06-01 21:41:01 +02:00
|
|
|
|
2006-01-18 12:13:36 +01:00
|
|
|
/* Check whether handle is an HACMDRIVERID */
|
|
|
|
padid = MSACM_GetDriverID((HACMDRIVERID)had);
|
|
|
|
|
|
|
|
/* If the message is DRV_CONFIGURE, and the application provides no
|
|
|
|
DRVCONFIGINFO structure, msacm must supply its own.
|
|
|
|
*/
|
|
|
|
if (uMsg == DRV_CONFIGURE && lParam2 == 0) {
|
|
|
|
LPWSTR pAlias;
|
|
|
|
|
|
|
|
/* Get the alias from the HACMDRIVERID */
|
|
|
|
if (padid) {
|
|
|
|
pAlias = padid->pszDriverAlias;
|
|
|
|
if (pAlias == NULL) {
|
|
|
|
WARN("DRV_CONFIGURE: no alias for this driver, cannot self-supply alias\n");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
FIXME("DRV_CONFIGURE: reverse lookup HACMDRIVER -> HACMDRIVERID not implemented\n");
|
|
|
|
pAlias = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pAlias != NULL) {
|
2007-01-06 03:42:31 +01:00
|
|
|
/* DRVCONFIGINFO is only 12 bytes long, but native msacm
|
|
|
|
* reports a 16-byte structure to codecs, so allocate 16 bytes,
|
|
|
|
* just to be on the safe side.
|
2006-01-18 12:13:36 +01:00
|
|
|
*/
|
2007-01-06 03:42:31 +01:00
|
|
|
const unsigned int iStructSize = 16;
|
2006-01-18 12:13:36 +01:00
|
|
|
pConfigInfo = HeapAlloc(MSACM_hHeap, 0, iStructSize);
|
|
|
|
if (!pConfigInfo) {
|
|
|
|
ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n");
|
|
|
|
} else {
|
|
|
|
static const WCHAR drivers32[] = {'D','r','i','v','e','r','s','3','2','\0'};
|
2006-11-03 21:56:30 +01:00
|
|
|
|
2006-01-18 12:13:36 +01:00
|
|
|
pConfigInfo->dwDCISize = iStructSize;
|
2006-11-03 21:56:30 +01:00
|
|
|
|
|
|
|
section_name = HeapAlloc(MSACM_hHeap, 0, (strlenW(drivers32) + 1) * sizeof(WCHAR));
|
|
|
|
if (section_name) strcpyW(section_name, drivers32);
|
|
|
|
pConfigInfo->lpszDCISectionName = section_name;
|
|
|
|
alias_name = HeapAlloc(MSACM_hHeap, 0, (strlenW(pAlias) + 1) * sizeof(WCHAR));
|
|
|
|
if (alias_name) strcpyW(alias_name, pAlias);
|
|
|
|
pConfigInfo->lpszDCIAliasName = alias_name;
|
|
|
|
|
2006-01-18 12:13:36 +01:00
|
|
|
if (pConfigInfo->lpszDCISectionName == NULL || pConfigInfo->lpszDCIAliasName == NULL) {
|
2006-11-03 21:56:30 +01:00
|
|
|
HeapFree(MSACM_hHeap, 0, alias_name);
|
|
|
|
HeapFree(MSACM_hHeap, 0, section_name);
|
2006-01-18 12:13:36 +01:00
|
|
|
HeapFree(MSACM_hHeap, 0, pConfigInfo);
|
|
|
|
pConfigInfo = NULL;
|
|
|
|
ERR("OOM while supplying DRVCONFIGINFO for DRV_CONFIGURE, using NULL\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lParam2 = (LPARAM)pConfigInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (padid) {
|
|
|
|
/* Handle is really an HACMDRIVERID, must have an open session to get an HACMDRIVER */
|
|
|
|
if (padid->pACMDriverList != NULL) {
|
2006-01-18 12:13:51 +01:00
|
|
|
lResult = MSACM_Message((HACMDRIVER)padid->pACMDriverList, uMsg, lParam1, lParam2);
|
2006-01-18 12:13:36 +01:00
|
|
|
} else {
|
|
|
|
MMRESULT mmr = acmDriverOpen(&had, (HACMDRIVERID)padid, 0);
|
|
|
|
if (mmr != MMSYSERR_NOERROR) {
|
|
|
|
lResult = MMSYSERR_INVALPARAM;
|
|
|
|
} else {
|
|
|
|
lResult = acmDriverMessage(had, uMsg, lParam1, lParam2);
|
|
|
|
acmDriverClose(had, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
lResult = MSACM_Message(had, uMsg, lParam1, lParam2);
|
|
|
|
}
|
|
|
|
if (pConfigInfo) {
|
2006-11-03 21:56:30 +01:00
|
|
|
HeapFree(MSACM_hHeap, 0, alias_name);
|
|
|
|
HeapFree(MSACM_hHeap, 0, section_name);
|
2006-01-18 12:13:36 +01:00
|
|
|
HeapFree(MSACM_hHeap, 0, pConfigInfo);
|
|
|
|
}
|
|
|
|
return lResult;
|
|
|
|
}
|
2004-06-01 21:41:01 +02:00
|
|
|
WARN("invalid parameter\n");
|
2000-08-26 06:33:00 +02:00
|
|
|
return MMSYSERR_INVALPARAM;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverOpen (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
1999-12-12 22:28:09 +01:00
|
|
|
PWINE_ACMDRIVERID padid;
|
2002-05-12 00:58:23 +02:00
|
|
|
PWINE_ACMDRIVER pad = NULL;
|
2001-05-22 21:21:16 +02:00
|
|
|
MMRESULT ret;
|
1999-10-31 19:29:16 +01:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %p, %08u)\n", phad, hadid, fdwOpen);
|
1999-10-31 19:29:16 +01:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (!phad) {
|
|
|
|
WARN("invalid parameter\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALPARAM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (fdwOpen) {
|
|
|
|
WARN("invalid flag\n");
|
2000-10-12 22:46:49 +02:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
padid = MSACM_GetDriverID(hadid);
|
2004-06-01 21:41:01 +02:00
|
|
|
if (!padid) {
|
|
|
|
WARN("invalid handle\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALHANDLE;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
1999-12-12 22:28:09 +01:00
|
|
|
|
2002-05-12 00:58:23 +02:00
|
|
|
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
|
2004-06-01 21:41:01 +02:00
|
|
|
if (!pad) {
|
|
|
|
WARN("no memory\n");
|
2002-05-12 00:58:23 +02:00
|
|
|
return MMSYSERR_NOMEM;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2001-04-14 00:28:19 +02:00
|
|
|
|
2002-05-12 00:58:23 +02:00
|
|
|
pad->obj.dwType = WINE_ACMOBJ_DRIVER;
|
|
|
|
pad->obj.pACMDriverID = padid;
|
2006-01-18 12:16:57 +01:00
|
|
|
pad->hDrvr = 0;
|
|
|
|
pad->pLocalDrvrInst = NULL;
|
2001-05-22 21:21:16 +02:00
|
|
|
|
2006-01-18 12:16:57 +01:00
|
|
|
if (padid->pLocalDriver == NULL)
|
2002-05-12 00:58:23 +02:00
|
|
|
{
|
|
|
|
ACMDRVOPENDESCW adod;
|
|
|
|
int len;
|
2006-11-03 21:56:30 +01:00
|
|
|
LPWSTR section_name;
|
2002-05-12 00:58:23 +02:00
|
|
|
|
|
|
|
/* this is not an externally added driver... need to actually load it */
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!padid->pszDriverAlias)
|
|
|
|
{
|
2002-05-12 00:58:23 +02:00
|
|
|
ret = MMSYSERR_ERROR;
|
|
|
|
goto gotError;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2002-05-12 00:58:23 +02:00
|
|
|
|
|
|
|
adod.cbStruct = sizeof(adod);
|
|
|
|
adod.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
|
|
|
|
adod.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
|
|
|
|
adod.dwVersion = acmGetVersion();
|
|
|
|
adod.dwFlags = fdwOpen;
|
|
|
|
adod.dwError = 0;
|
|
|
|
len = strlen("Drivers32") + 1;
|
2006-11-03 21:56:30 +01:00
|
|
|
section_name = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, section_name, len);
|
|
|
|
adod.pszSectionName = section_name;
|
2003-07-02 02:40:14 +02:00
|
|
|
adod.pszAliasName = padid->pszDriverAlias;
|
2002-05-12 00:58:23 +02:00
|
|
|
adod.dnDevNode = 0;
|
|
|
|
|
2008-11-24 16:20:12 +01:00
|
|
|
pad->hDrvr = OpenDriver(padid->pszDriverAlias, NULL, (DWORD_PTR)&adod);
|
2002-05-12 00:58:23 +02:00
|
|
|
|
2006-11-03 21:56:30 +01:00
|
|
|
HeapFree(MSACM_hHeap, 0, section_name);
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!pad->hDrvr)
|
2002-05-12 00:58:23 +02:00
|
|
|
{
|
|
|
|
ret = adod.dwError;
|
|
|
|
goto gotError;
|
|
|
|
}
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
2006-01-18 12:16:57 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ACMDRVOPENDESCW adod;
|
|
|
|
|
|
|
|
pad->hDrvr = NULL;
|
|
|
|
|
|
|
|
adod.cbStruct = sizeof(adod);
|
|
|
|
adod.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
|
|
|
|
adod.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
|
|
|
|
adod.dwVersion = acmGetVersion();
|
|
|
|
adod.dwFlags = fdwOpen;
|
|
|
|
adod.dwError = 0;
|
|
|
|
adod.pszSectionName = NULL;
|
|
|
|
adod.pszAliasName = NULL;
|
|
|
|
adod.dnDevNode = 0;
|
|
|
|
|
2008-11-24 16:20:12 +01:00
|
|
|
pad->pLocalDrvrInst = MSACM_OpenLocalDriver(padid->pLocalDriver, (DWORD_PTR)&adod);
|
2006-01-18 12:16:57 +01:00
|
|
|
if (!pad->pLocalDrvrInst)
|
|
|
|
{
|
|
|
|
ret = adod.dwError;
|
|
|
|
goto gotError;
|
|
|
|
}
|
|
|
|
}
|
1999-12-12 22:28:09 +01:00
|
|
|
|
|
|
|
/* insert new pad at beg of list */
|
|
|
|
pad->pNextACMDriver = padid->pACMDriverList;
|
|
|
|
padid->pACMDriverList = pad;
|
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
/* FIXME: Create a WINE_ACMDRIVER32 */
|
1999-12-12 22:28:09 +01:00
|
|
|
*phad = (HACMDRIVER)pad;
|
2007-01-18 11:40:15 +01:00
|
|
|
TRACE("%s => %p\n", debugstr_w(padid->pszDriverAlias), pad);
|
2001-05-22 21:21:16 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_NOERROR;
|
2001-04-14 00:28:19 +02:00
|
|
|
gotError:
|
2004-06-01 21:41:01 +02:00
|
|
|
WARN("failed: ret = %08x\n", ret);
|
2001-06-13 21:35:28 +02:00
|
|
|
if (pad && !pad->hDrvr)
|
2001-04-14 00:28:19 +02:00
|
|
|
HeapFree(MSACM_hHeap, 0, pad);
|
|
|
|
return ret;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverPriority (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverPriority(HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %08x, %08x)\n", hadid, dwPriority, fdwPriority);
|
2004-06-01 21:41:01 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
/* Check for unknown flags */
|
2002-06-01 01:06:46 +02:00
|
|
|
if (fdwPriority &
|
1999-10-31 19:29:16 +01:00
|
|
|
~(ACM_DRIVERPRIORITYF_ENABLE|ACM_DRIVERPRIORITYF_DISABLE|
|
2004-06-01 21:41:01 +02:00
|
|
|
ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END)) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
/* Check for incompatible flags */
|
|
|
|
if ((fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) &&
|
2004-06-01 21:41:01 +02:00
|
|
|
(fdwPriority & ACM_DRIVERPRIORITYF_DISABLE)) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
/* Check for incompatible flags */
|
|
|
|
if ((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) &&
|
2004-06-01 21:41:01 +02:00
|
|
|
(fdwPriority & ACM_DRIVERPRIORITYF_END)) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2006-01-18 12:06:56 +01:00
|
|
|
|
|
|
|
/* According to MSDN, ACM_DRIVERPRIORITYF_BEGIN and ACM_DRIVERPRIORITYF_END
|
|
|
|
may only appear by themselves, and in addition, hadid and dwPriority must
|
|
|
|
both be zero */
|
|
|
|
if ((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) ||
|
|
|
|
(fdwPriority & ACM_DRIVERPRIORITYF_END)) {
|
|
|
|
if (fdwPriority & ~(ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END)) {
|
|
|
|
WARN("ACM_DRIVERPRIORITYF_[BEGIN|END] cannot be used with any other flags\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
if (dwPriority) {
|
|
|
|
WARN("priority invalid with ACM_DRIVERPRIORITYF_[BEGIN|END]\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
if (hadid) {
|
|
|
|
WARN("non-null hadid invalid with ACM_DRIVERPRIORITYF_[BEGIN|END]\n");
|
|
|
|
return MMSYSERR_INVALPARAM;
|
|
|
|
}
|
|
|
|
/* FIXME: MSDN wording suggests that deferred notification should be
|
|
|
|
implemented as a system-wide lock held by a calling task, and that
|
|
|
|
re-enabling notifications should broadcast them across all processes.
|
|
|
|
This implementation uses a simple DWORD counter. One consequence of the
|
|
|
|
current implementation is that applications will never see
|
|
|
|
MMSYSERR_ALLOCATED as a return error.
|
|
|
|
*/
|
|
|
|
if (fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) {
|
|
|
|
MSACM_DisableNotifications();
|
|
|
|
} else if (fdwPriority & ACM_DRIVERPRIORITYF_END) {
|
|
|
|
MSACM_EnableNotifications();
|
|
|
|
}
|
|
|
|
return MMSYSERR_NOERROR;
|
|
|
|
} else {
|
|
|
|
PWINE_ACMDRIVERID padid;
|
2006-01-18 12:10:59 +01:00
|
|
|
PWINE_ACMNOTIFYWND panwnd;
|
2006-01-18 12:06:56 +01:00
|
|
|
BOOL bPerformBroadcast = FALSE;
|
|
|
|
|
|
|
|
/* Fetch driver ID */
|
|
|
|
padid = MSACM_GetDriverID(hadid);
|
2006-01-18 12:10:59 +01:00
|
|
|
panwnd = MSACM_GetNotifyWnd(hadid);
|
|
|
|
if (!padid && !panwnd) {
|
2006-01-18 12:06:56 +01:00
|
|
|
WARN("invalid handle\n");
|
|
|
|
return MMSYSERR_INVALHANDLE;
|
|
|
|
}
|
|
|
|
|
2006-01-18 12:10:59 +01:00
|
|
|
if (padid) {
|
|
|
|
/* Check whether driver ID is appropriate for requested op */
|
|
|
|
if (dwPriority) {
|
|
|
|
if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL) {
|
|
|
|
return MMSYSERR_NOTSUPPORTED;
|
|
|
|
}
|
2006-09-16 19:26:06 +02:00
|
|
|
if (dwPriority != 1 && dwPriority != (DWORD)-1) {
|
2006-10-12 21:35:06 +02:00
|
|
|
FIXME("unexpected priority %d, using sign only\n", dwPriority);
|
2006-09-16 19:26:06 +02:00
|
|
|
if ((signed)dwPriority < 0) dwPriority = (DWORD)-1;
|
2006-01-18 12:10:59 +01:00
|
|
|
if (dwPriority > 0) dwPriority = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwPriority == 1 && (padid->pPrevACMDriverID == NULL ||
|
|
|
|
(padid->pPrevACMDriverID->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))) {
|
|
|
|
/* do nothing - driver is first of list, or first after last
|
|
|
|
local driver */
|
2006-09-16 19:26:06 +02:00
|
|
|
} else if (dwPriority == (DWORD)-1 && padid->pNextACMDriverID == NULL) {
|
2006-01-18 12:10:59 +01:00
|
|
|
/* do nothing - driver is last of list */
|
|
|
|
} else {
|
|
|
|
MSACM_RePositionDriver(padid, dwPriority);
|
|
|
|
bPerformBroadcast = TRUE;
|
|
|
|
}
|
2006-01-18 12:06:56 +01:00
|
|
|
}
|
2006-01-18 12:10:59 +01:00
|
|
|
|
|
|
|
/* Check whether driver ID should be enabled or disabled */
|
|
|
|
if (fdwPriority & ACM_DRIVERPRIORITYF_DISABLE) {
|
|
|
|
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
|
|
|
|
padid->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
|
|
|
bPerformBroadcast = TRUE;
|
|
|
|
}
|
|
|
|
} else if (fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) {
|
|
|
|
if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) {
|
|
|
|
padid->fdwSupport &= ~ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
|
|
|
bPerformBroadcast = TRUE;
|
|
|
|
}
|
2006-01-18 12:06:56 +01:00
|
|
|
}
|
|
|
|
}
|
2006-01-18 12:10:59 +01:00
|
|
|
|
|
|
|
if (panwnd) {
|
|
|
|
if (dwPriority) {
|
|
|
|
return MMSYSERR_NOTSUPPORTED;
|
2006-01-18 12:06:56 +01:00
|
|
|
}
|
2006-01-18 12:10:59 +01:00
|
|
|
|
|
|
|
/* Check whether notify window should be enabled or disabled */
|
|
|
|
if (fdwPriority & ACM_DRIVERPRIORITYF_DISABLE) {
|
|
|
|
if (!(panwnd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
|
|
|
|
panwnd->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
|
|
|
bPerformBroadcast = TRUE;
|
|
|
|
}
|
|
|
|
} else if (fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) {
|
|
|
|
if (panwnd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) {
|
|
|
|
panwnd->fdwSupport &= ~ACMDRIVERDETAILS_SUPPORTF_DISABLED;
|
|
|
|
bPerformBroadcast = TRUE;
|
|
|
|
}
|
2006-01-18 12:06:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Perform broadcast of changes */
|
|
|
|
if (bPerformBroadcast) {
|
|
|
|
MSACM_WriteCurrentPriorities();
|
|
|
|
MSACM_BroadcastNotification();
|
|
|
|
}
|
|
|
|
return MMSYSERR_NOERROR;
|
1999-10-31 19:29:16 +01:00
|
|
|
}
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-11 22:14:43 +02:00
|
|
|
* acmDriverRemove (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
*/
|
1999-10-31 19:29:16 +01:00
|
|
|
MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove)
|
1998-10-11 19:00:29 +02:00
|
|
|
{
|
1999-10-31 19:29:16 +01:00
|
|
|
PWINE_ACMDRIVERID padid;
|
2006-01-18 12:10:59 +01:00
|
|
|
PWINE_ACMNOTIFYWND panwnd;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:35:06 +02:00
|
|
|
TRACE("(%p, %08x)\n", hadid, fdwRemove);
|
2004-06-01 21:41:01 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
padid = MSACM_GetDriverID(hadid);
|
2006-01-18 12:10:59 +01:00
|
|
|
panwnd = MSACM_GetNotifyWnd(hadid);
|
|
|
|
if (!padid && !panwnd) {
|
2004-06-01 21:41:01 +02:00
|
|
|
WARN("invalid handle\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALHANDLE;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
if (fdwRemove) {
|
|
|
|
WARN("invalid flag\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_INVALFLAG;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-01-18 12:10:59 +01:00
|
|
|
if (padid) MSACM_UnregisterDriver(padid);
|
|
|
|
if (panwnd) MSACM_UnRegisterNotificationWindow(panwnd);
|
2006-01-18 12:06:56 +01:00
|
|
|
MSACM_BroadcastNotification();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_NOERROR;
|
1998-10-11 19:00:29 +02:00
|
|
|
}
|