Commit 6c370766 authored by Alex Villacís Lasso's avatar Alex Villacís Lasso Committed by Alexandre Julliard

msacm: acmDriverAdd() support for ACM_DRIVERADDF_FUNCTION, implemented

local drivers.
parent 07dc3c54
......@@ -101,6 +101,8 @@ MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule,
MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
{
PWINE_ACMLOCALDRIVER pLocalDrv = NULL;
TRACE("(%p, %p, %08lx, %08lx, %08lx)\n",
phadid, hinstModule, lParam, dwPriority, fdwAdd);
......@@ -144,11 +146,17 @@ MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule,
dwPriority (unused, set to 0)
*/
fdwAdd &= ~ACM_DRIVERADDF_TYPEMASK;
*phadid = 0;
FIXME("(%p, %p, %ld, %ld, %ld): ACM_DRIVERADDF_FUNCTION: stub\n", phadid, hinstModule, lParam, dwPriority, fdwAdd);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
/* 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;
case ACM_DRIVERADDF_NOTIFYHWND:
/*
hInstModule (unused)
......@@ -203,8 +211,10 @@ MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
}
/* close driver if it has been opened */
if (pad->hDrvr && !padid->hInstModule)
if (pad->hDrvr && !pad->pLocalDrvrInst)
CloseDriver(pad->hDrvr, 0, 0);
else if (pad->pLocalDrvrInst)
MSACM_CloseLocalDriver(pad->pLocalDrvrInst);
HeapFree(MSACM_hHeap, 0, pad);
......@@ -506,8 +516,10 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
pad->obj.dwType = WINE_ACMOBJ_DRIVER;
pad->obj.pACMDriverID = padid;
pad->hDrvr = 0;
pad->pLocalDrvrInst = NULL;
if (!(pad->hDrvr = (HDRVR)padid->hInstModule))
if (padid->pLocalDriver == NULL)
{
ACMDRVOPENDESCW adod;
int len;
......@@ -540,6 +552,29 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe
goto gotError;
}
}
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;
pad->pLocalDrvrInst = MSACM_OpenLocalDriver(padid->pLocalDriver, (DWORD)&adod);
if (!pad->pLocalDrvrInst)
{
ret = adod.dwError;
goto gotError;
}
}
/* insert new pad at beg of list */
pad->pNextACMDriver = padid->pACMDriverList;
......
......@@ -292,6 +292,7 @@ typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER;
#define WINE_ACMOBJ_DRIVER 0x5EED0002
#define WINE_ACMOBJ_STREAM 0x5EED0003
#define WINE_ACMOBJ_NOTIFYWND 0x5EED0004
#define WINE_ACMOBJ_LOCALDRIVER 0x5EED0005
typedef struct _WINE_ACMOBJ
{
......@@ -299,10 +300,32 @@ typedef struct _WINE_ACMOBJ
PWINE_ACMDRIVERID pACMDriverID;
} WINE_ACMOBJ, *PWINE_ACMOBJ;
typedef struct _WINE_ACMLOCALDRIVER * PWINE_ACMLOCALDRIVER;
typedef struct _WINE_ACMLOCALDRIVERINST * PWINE_ACMLOCALDRIVERINST;
typedef struct _WINE_ACMLOCALDRIVER
{
WINE_ACMOBJ obj;
HMODULE hModule;
DRIVERPROC lpDrvProc;
PWINE_ACMLOCALDRIVERINST pACMInstList;
PWINE_ACMLOCALDRIVER pNextACMLocalDrv;
PWINE_ACMLOCALDRIVER pPrevACMLocalDrv;
} WINE_ACMLOCALDRIVER;
typedef struct _WINE_ACMLOCALDRIVERINST
{
PWINE_ACMLOCALDRIVER pLocalDriver;
DWORD dwDriverID;
BOOL bSession;
PWINE_ACMLOCALDRIVERINST pNextACMInst;
} WINE_ACMLOCALDRIVERINST;
typedef struct _WINE_ACMDRIVER
{
WINE_ACMOBJ obj;
HDRVR hDrvr;
PWINE_ACMLOCALDRIVERINST pLocalDrvrInst;
PWINE_ACMDRIVER pNextACMDriver;
} WINE_ACMDRIVER;
......@@ -319,7 +342,7 @@ typedef struct _WINE_ACMDRIVERID
WINE_ACMOBJ obj;
LPWSTR pszDriverAlias;
LPWSTR pszFileName;
HINSTANCE hInstModule; /* NULL if global */
PWINE_ACMLOCALDRIVER pLocalDriver; /* NULL if global */
PWINE_ACMDRIVER pACMDriverList;
PWINE_ACMDRIVERID pNextACMDriverID;
PWINE_ACMDRIVERID pPrevACMDriverID;
......@@ -349,7 +372,7 @@ extern HANDLE MSACM_hHeap;
extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
extern PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName,
HINSTANCE hinstModule);
PWINE_ACMLOCALDRIVER pLocalDriver);
extern void MSACM_RegisterAllDrivers(void);
extern PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p);
extern void MSACM_UnregisterAllDrivers(void);
......@@ -371,6 +394,13 @@ extern PWINE_ACMNOTIFYWND MSACM_UnRegisterNotificationWindow(PWINE_ACMNOTIFYWND)
extern PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry(LPCWSTR pszRegEntry);
extern PWINE_ACMLOCALDRIVER MSACM_RegisterLocalDriver(HMODULE hModule, DRIVERPROC lpDriverProc);
extern PWINE_ACMLOCALDRIVERINST MSACM_OpenLocalDriver(PWINE_ACMLOCALDRIVER, LPARAM);
extern LRESULT MSACM_CloseLocalDriver(PWINE_ACMLOCALDRIVERINST);
extern PWINE_ACMLOCALDRIVER MSACM_UnregisterLocalDriver(PWINE_ACMLOCALDRIVER);
/*
extern PWINE_ACMLOCALDRIVER MSACM_GetLocalDriver(HACMDRIVER hDriver);
*/
/* From msacm32.c */
extern HINSTANCE MSACM_hInstance32;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment