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
|
|
|
*/
|
|
|
|
|
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"
|
1998-10-11 19:00:29 +02:00
|
|
|
#include "winerror.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"
|
2003-09-06 01:08:26 +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"
|
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
|
|
|
{
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %p, %08lx, %08lx, %08lx)\n",
|
|
|
|
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
|
|
|
|
|
|
|
/* FIXME: in fact, should GetModuleFileName(hinstModule) and do a
|
1999-10-31 19:29:16 +01:00
|
|
|
* LoadDriver on it, to be sure we can call SendDriverMessage on the
|
|
|
|
* hDrvr handle.
|
|
|
|
*/
|
|
|
|
*phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
/* FIXME: lParam, dwPriority and fdwAdd ignored */
|
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
|
|
|
* acmDriverAddW (MSACM32.@)
|
1998-10-11 19:00:29 +02:00
|
|
|
* FIXME
|
|
|
|
* Not implemented
|
|
|
|
*/
|
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
|
|
|
{
|
2002-10-22 02:46:23 +02:00
|
|
|
FIXME("(%p, %p, %ld, %ld, %ld): stub\n",
|
1999-10-31 19:29:16 +01:00
|
|
|
phadid, hinstModule, lParam, dwPriority, fdwAdd);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return MMSYSERR_ERROR;
|
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;
|
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %08lx)\n", had, fdwClose);
|
|
|
|
|
|
|
|
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 */
|
|
|
|
for (tpad = &(padid->pACMDriverList); *tpad; *tpad = (*tpad)->pNextACMDriver) {
|
|
|
|
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 */
|
|
|
|
if (pad->hDrvr && !padid->hInstModule)
|
|
|
|
CloseDriver(pad->hDrvr, 0, 0);
|
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
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %p, %08lx)\n", hadid, padd, fdwDetails);
|
|
|
|
|
|
|
|
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 );
|
|
|
|
memcpy(padd, &padda, min(padd->cbStruct, sizeof(*padd)));
|
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
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %p, %08lx)\n", hadid, padd, fdwDetails);
|
|
|
|
|
|
|
|
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;
|
|
|
|
mmr = (MMRESULT)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);
|
2004-05-03 22:09:42 +02:00
|
|
|
memcpy(padd, &paddw, min(padd->cbStruct, sizeof(*padd)));
|
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
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %08lx, %08lx)\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
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %p, %08lx)\n", hao, phadid, fdwDriverID);
|
|
|
|
|
|
|
|
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
|
|
|
*
|
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)
|
|
|
|
return MSACM_Message(had, uMsg, lParam1, lParam2);
|
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
|
|
|
|
2002-10-22 02:46:23 +02:00
|
|
|
TRACE("(%p, %p, %08lu)\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;
|
2001-05-22 21:21:16 +02:00
|
|
|
|
2002-08-09 03:02:25 +02:00
|
|
|
if (!(pad->hDrvr = (HDRVR)padid->hInstModule))
|
2002-05-12 00:58:23 +02:00
|
|
|
{
|
|
|
|
ACMDRVOPENDESCW adod;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
adod.pszSectionName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, (LPWSTR)adod.pszSectionName, len);
|
2003-07-02 02:40:14 +02:00
|
|
|
adod.pszAliasName = padid->pszDriverAlias;
|
2002-05-12 00:58:23 +02:00
|
|
|
adod.dnDevNode = 0;
|
|
|
|
|
2003-07-02 02:40:14 +02:00
|
|
|
pad->hDrvr = OpenDriver(padid->pszDriverAlias, NULL, (DWORD)&adod);
|
2002-05-12 00:58:23 +02:00
|
|
|
|
|
|
|
HeapFree(MSACM_hHeap, 0, (LPWSTR)adod.pszSectionName);
|
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
|
|
|
}
|
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;
|
2003-07-02 02:40:14 +02:00
|
|
|
TRACE("'%s' => %08lx\n", debugstr_w(padid->pszDriverAlias), (DWORD)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
|
|
|
{
|
1999-10-31 19:29:16 +01:00
|
|
|
PWINE_ACMDRIVERID padid;
|
|
|
|
CHAR szSubKey[17];
|
|
|
|
CHAR szBuffer[256];
|
|
|
|
LONG lBufferLength = sizeof(szBuffer);
|
|
|
|
LONG lError;
|
|
|
|
HKEY hPriorityKey;
|
|
|
|
DWORD dwPriorityCounter;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %08lx, %08lx)\n", hadid, dwPriority, fdwPriority);
|
|
|
|
|
1999-10-31 19:29:16 +01: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
|
|
|
}
|
2002-06-01 01:06:46 +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
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
lError = RegOpenKeyA(HKEY_CURRENT_USER,
|
1999-10-31 19:29:16 +01:00
|
|
|
"Software\\Microsoft\\Multimedia\\"
|
|
|
|
"Audio Compression Manager\\Priority v4.00",
|
|
|
|
&hPriorityKey
|
|
|
|
);
|
|
|
|
/* FIXME: Create key */
|
2004-06-01 21:41:01 +02:00
|
|
|
if (lError != ERROR_SUCCESS) {
|
|
|
|
WARN("RegOpenKeyA failed\n");
|
1999-10-31 19:29:16 +01:00
|
|
|
return MMSYSERR_ERROR;
|
2004-06-01 21:41:01 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
for (dwPriorityCounter = 1; ; dwPriorityCounter++) {
|
2002-07-24 21:02:50 +02:00
|
|
|
snprintf(szSubKey, 17, "Priority%ld", dwPriorityCounter);
|
1999-10-31 19:29:16 +01:00
|
|
|
lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength);
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-10-22 02:46:23 +02:00
|
|
|
FIXME("(%p, %ld, %ld): stub (partial)\n",
|
1999-10-31 19:29:16 +01:00
|
|
|
hadid, dwPriority, fdwPriority);
|
|
|
|
break;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
RegCloseKey(hPriorityKey);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
WARN("RegQueryValueA failed\n");
|
1998-10-11 19:00:29 +02:00
|
|
|
return MMSYSERR_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
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;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-06-01 21:41:01 +02:00
|
|
|
TRACE("(%p, %08lx)\n", hadid, fdwRemove);
|
|
|
|
|
1999-10-31 19:29:16 +01: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
|
|
|
}
|
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
|
|
|
|
1999-10-31 19:29:16 +01:00
|
|
|
MSACM_UnregisterDriver(padid);
|
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
|
|
|
}
|