ReactOS  0.4.14-dev-317-g96040ec
internal.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "winreg.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "wine/debug.h"
Include dependency graph for internal.c:

Go to the source code of this file.

Macros

#define MSACM_DRIVER_SendMessage(PDRVRINST, msg, lParam1, lParam2)   (PDRVRINST)->pLocalDriver->lpDrvProc((PDRVRINST)->dwDriverID, (HDRVR)(PDRVRINST), msg, lParam1, lParam2)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msacm)
 
static void MSACM_ReorderDriversByPriority (void)
 
PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry (LPCWSTR pszRegEntry)
 
BOOL MSACM_FindFormatTagInCache (const WINE_ACMDRIVERID *padid, DWORD fmtTag, LPDWORD idx)
 
static BOOL MSACM_FillCache (PWINE_ACMDRIVERID padid)
 
static LPWSTR MSACM_GetRegistryKey (const WINE_ACMDRIVERID *padid)
 
static BOOL MSACM_ReadCache (PWINE_ACMDRIVERID padid)
 
static BOOL MSACM_WriteCache (const WINE_ACMDRIVERID *padid)
 
PWINE_ACMDRIVERID MSACM_RegisterDriver (LPCWSTR pszDriverAlias, LPCWSTR pszFileName, PWINE_ACMLOCALDRIVER pLocalDriver)
 
void MSACM_RegisterAllDrivers (void)
 
PWINE_ACMNOTIFYWND MSACM_RegisterNotificationWindow (HWND hNotifyWnd, DWORD dwNotifyMsg)
 
void MSACM_BroadcastNotification (void)
 
void MSACM_DisableNotifications (void)
 
void MSACM_EnableNotifications (void)
 
PWINE_ACMNOTIFYWND MSACM_UnRegisterNotificationWindow (const WINE_ACMNOTIFYWND *panwnd)
 
void MSACM_RePositionDriver (PWINE_ACMDRIVERID padid, DWORD dwPriority)
 
void MSACM_WriteCurrentPriorities (void)
 
static PWINE_ACMLOCALDRIVER MSACM_UnregisterLocalDriver (PWINE_ACMLOCALDRIVER paldrv)
 
PWINE_ACMDRIVERID MSACM_UnregisterDriver (PWINE_ACMDRIVERID p)
 
void MSACM_UnregisterAllDrivers (void)
 
PWINE_ACMOBJ MSACM_GetObj (HACMOBJ hObj, DWORD type)
 
PWINE_ACMDRIVERID MSACM_GetDriverID (HACMDRIVERID hDriverID)
 
PWINE_ACMDRIVER MSACM_GetDriver (HACMDRIVER hDriver)
 
PWINE_ACMNOTIFYWND MSACM_GetNotifyWnd (HACMDRIVERID hDriver)
 
MMRESULT MSACM_Message (HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
 
PWINE_ACMLOCALDRIVER MSACM_RegisterLocalDriver (HMODULE hModule, DRIVERPROC lpDriverProc)
 
static unsigned MSACM_GetNumberOfModuleRefs (HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
 
static BOOL MSACM_RemoveFromList (PWINE_ACMLOCALDRIVERINST lpDrv)
 
static BOOL MSACM_AddToList (PWINE_ACMLOCALDRIVERINST lpNewDrv, LPARAM lParam2)
 
PWINE_ACMLOCALDRIVERINST MSACM_OpenLocalDriver (PWINE_ACMLOCALDRIVER paldrv, LPARAM lParam2)
 
LRESULT MSACM_CloseLocalDriver (PWINE_ACMLOCALDRIVERINST paldrv)
 

Variables

HANDLE MSACM_hHeap = NULL
 
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL
 
static PWINE_ACMDRIVERID MSACM_pLastACMDriverID
 
static DWORD MSACM_suspendBroadcastCount = 0
 
static BOOL MSACM_pendingBroadcast = FALSE
 
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd = NULL
 
static PWINE_ACMNOTIFYWND MSACM_pLastACMNotifyWnd = NULL
 
static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
 
static PWINE_ACMLOCALDRIVER MSACM_pLastACMLocalDriver
 

Macro Definition Documentation

◆ MSACM_DRIVER_SendMessage

#define MSACM_DRIVER_SendMessage (   PDRVRINST,
  msg,
  lParam1,
  lParam2 
)    (PDRVRINST)->pLocalDriver->lpDrvProc((PDRVRINST)->dwDriverID, (HDRVR)(PDRVRINST), msg, lParam1, lParam2)

Definition at line 866 of file internal.c.

Function Documentation

◆ MSACM_AddToList()

static BOOL MSACM_AddToList ( PWINE_ACMLOCALDRIVERINST  lpNewDrv,
LPARAM  lParam2 
)
static

Definition at line 989 of file internal.c.

990 {
991  PWINE_ACMLOCALDRIVER pDriverBase = lpNewDrv->pLocalDriver;
992 
993  /* first of this driver in list ? */
994  if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, NULL) == 0) {
995  if (MSACM_DRIVER_SendMessage(lpNewDrv, DRV_LOAD, 0L, 0L) != DRV_SUCCESS) {
996  FIXME("DRV_LOAD failed on driver %p\n", lpNewDrv);
997  return FALSE;
998  }
999  /* returned value is not checked */
1000  MSACM_DRIVER_SendMessage(lpNewDrv, DRV_ENABLE, 0L, 0L);
1001  }
1002 
1003  lpNewDrv->pNextACMInst = NULL;
1004  if (pDriverBase->pACMInstList == NULL) {
1005  pDriverBase->pACMInstList = lpNewDrv;
1006  } else {
1007  PWINE_ACMLOCALDRIVERINST lpDrvInst = pDriverBase->pACMInstList;
1008 
1009  while (lpDrvInst->pNextACMInst != NULL)
1010  lpDrvInst = lpDrvInst->pNextACMInst;
1011 
1012  lpDrvInst->pNextACMInst = lpNewDrv;
1013  }
1014 
1015  /* Now just open a new instance of a driver on this module */
1016  lpNewDrv->dwDriverID = MSACM_DRIVER_SendMessage(lpNewDrv, DRV_OPEN, 0, lParam2);
1017 
1018  if (lpNewDrv->dwDriverID == 0) {
1019  FIXME("DRV_OPEN failed on driver %p\n", lpNewDrv);
1020  MSACM_RemoveFromList(lpNewDrv);
1021  return FALSE;
1022  }
1023  return TRUE;
1024 }
#define TRUE
Definition: types.h:120
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:66
#define DRV_OPEN
Definition: mmsystem.h:121
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define DRV_LOAD(x)
static BOOL MSACM_RemoveFromList(PWINE_ACMLOCALDRIVERINST lpDrv)
Definition: internal.c:953
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:925
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:63
static const WCHAR L[]
Definition: oid.c:1250
PWINE_ACMLOCALDRIVERINST pACMInstList
Definition: wineacm.h:55
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_SUCCESS
Definition: mmsystem.h:18
DRIVERPROC lpDrvProc
Definition: wineacm.h:54
#define MSACM_DRIVER_SendMessage(PDRVRINST, msg, lParam1, lParam2)
Definition: internal.c:866

Referenced by MSACM_OpenLocalDriver().

◆ MSACM_BroadcastNotification()

void MSACM_BroadcastNotification ( void  )

Definition at line 443 of file internal.c.

444 {
445  if (MSACM_suspendBroadcastCount <= 0) {
446  PWINE_ACMNOTIFYWND panwnd;
447 
448  for (panwnd = MSACM_pFirstACMNotifyWnd; panwnd; panwnd = panwnd->pNextACMNotifyWnd)
450  SendMessageW(panwnd->hNotifyWnd, panwnd->dwNotifyMsg, 0, 0);
451  } else {
453  }
454 }
PWINE_ACMNOTIFYWND pNextACMNotifyWnd
Definition: wineacm.h:112
#define TRUE
Definition: types.h:120
static BOOL MSACM_pendingBroadcast
Definition: internal.c:52
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ACMDRIVERDETAILS_SUPPORTF_DISABLED
Definition: msacm.h:67
static DWORD MSACM_suspendBroadcastCount
Definition: internal.c:51

Referenced by acmDriverAddW(), acmDriverPriority(), acmDriverRemove(), and MSACM_EnableNotifications().

◆ MSACM_CloseLocalDriver()

LRESULT MSACM_CloseLocalDriver ( PWINE_ACMLOCALDRIVERINST  paldrv)

Definition at line 1081 of file internal.c.

1082 {
1083  if (MSACM_RemoveFromList(paldrv)) {
1084  PWINE_ACMLOCALDRIVERINST lpDrv0;
1085  PWINE_ACMLOCALDRIVER pDriverBase = paldrv->pLocalDriver;
1086 
1087  MSACM_DRIVER_SendMessage(paldrv, DRV_CLOSE, 0, 0);
1088  paldrv->dwDriverID = 0;
1089 
1090  if (paldrv->bSession)
1091  ERR("should not directly close session instance (%p)\n", paldrv);
1092 
1093  /* if driver has an opened session instance, we have to close it too */
1094  if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, &lpDrv0) == 1 &&
1095  lpDrv0->bSession)
1096  {
1097  MSACM_DRIVER_SendMessage(lpDrv0, DRV_CLOSE, 0L, 0L);
1098  lpDrv0->dwDriverID = 0;
1099  MSACM_RemoveFromList(lpDrv0);
1100  HeapFree(MSACM_hHeap, 0, lpDrv0);
1101  }
1102 
1103  HeapFree(MSACM_hHeap, 0, paldrv);
1104  return TRUE;
1105  }
1106  ERR("unable to close driver instance\n");
1107  return FALSE;
1108 }
#define TRUE
Definition: types.h:120
#define DRV_CLOSE
Definition: mmsystem.h:122
HANDLE MSACM_hHeap
Definition: internal.c:47
static BOOL MSACM_RemoveFromList(PWINE_ACMLOCALDRIVERINST lpDrv)
Definition: internal.c:953
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:925
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:63
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:109
DRIVERPROC lpDrvProc
Definition: wineacm.h:54
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MSACM_DRIVER_SendMessage(PDRVRINST, msg, lParam1, lParam2)
Definition: internal.c:866

Referenced by acmDriverClose(), and MSACM_OpenLocalDriver().

◆ MSACM_DisableNotifications()

void MSACM_DisableNotifications ( void  )

Definition at line 459 of file internal.c.

460 {
462 }
static DWORD MSACM_suspendBroadcastCount
Definition: internal.c:51

Referenced by acmDriverPriority().

◆ MSACM_EnableNotifications()

void MSACM_EnableNotifications ( void  )

Definition at line 467 of file internal.c.

468 {
469  if (MSACM_suspendBroadcastCount > 0) {
474  }
475  }
476 }
static BOOL MSACM_pendingBroadcast
Definition: internal.c:52
void MSACM_BroadcastNotification(void)
Definition: internal.c:443
static DWORD MSACM_suspendBroadcastCount
Definition: internal.c:51

Referenced by acmDriverPriority().

◆ MSACM_FillCache()

static BOOL MSACM_FillCache ( PWINE_ACMDRIVERID  padid)
static

Definition at line 134 of file internal.c.

135 {
136  HACMDRIVER had = 0;
137  unsigned int ntag;
140 
141  if (acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != 0)
142  return FALSE;
143 
144  padid->aFormatTag = NULL;
145  add.cbStruct = sizeof(add);
147  goto errCleanUp;
148 
149  if (add.cFormatTags > 0) {
150  padid->aFormatTag = HeapAlloc(MSACM_hHeap, HEAP_ZERO_MEMORY,
151  add.cFormatTags * sizeof(padid->aFormatTag[0]));
152  if (!padid->aFormatTag) goto errCleanUp;
153  }
154 
155  padid->cFormatTags = add.cFormatTags;
156  padid->cFilterTags = add.cFilterTags;
157  padid->fdwSupport = add.fdwSupport;
158 
159  aftd.cbStruct = sizeof(aftd);
160 
161  for (ntag = 0; ntag < add.cFormatTags; ntag++) {
162  aftd.dwFormatTagIndex = ntag;
164  TRACE("IIOs (%s)\n", debugstr_w(padid->pszDriverAlias));
165  goto errCleanUp;
166  }
167  padid->aFormatTag[ntag].dwFormatTag = aftd.dwFormatTag;
168  padid->aFormatTag[ntag].cbwfx = aftd.cbFormatSize;
169  }
170 
171  acmDriverClose(had, 0);
172 
173  return TRUE;
174 
175 errCleanUp:
176  if (had) acmDriverClose(had, 0);
177  HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
178  padid->aFormatTag = NULL;
179  return FALSE;
180 }
int add
Definition: i386-dis.c:3122
#define TRUE
Definition: types.h:120
#define ACMDM_FORMATTAG_DETAILS
Definition: msacmdrv.h:51
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
Definition: driver.c:179
#define ACMDM_DRIVER_DETAILS
Definition: msacmdrv.h:46
#define debugstr_w
Definition: kernel32.h:32
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ACM_FORMATTAGDETAILSF_INDEX
Definition: msacm.h:182
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
Definition: driver.c:491
MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
Definition: internal.c:872
DWORD dwFormatTagIndex
Definition: msacm.h:530
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by MSACM_RegisterDriver().

◆ MSACM_FindFormatTagInCache()

BOOL MSACM_FindFormatTagInCache ( const WINE_ACMDRIVERID padid,
DWORD  fmtTag,
LPDWORD  idx 
)

Definition at line 118 of file internal.c.

119 {
120  unsigned i;
121 
122  for (i = 0; i < padid->cFormatTags; i++) {
123  if (padid->aFormatTag[i].dwFormatTag == fmtTag) {
124  if (idx) *idx = i;
125  return TRUE;
126  }
127  }
128  return FALSE;
129 }
#define TRUE
Definition: types.h:120
DWORD cFormatTags
Definition: wineacm.h:97
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int idx
Definition: utils.c:41
struct _WINE_ACMDRIVERID::@464 * aFormatTag

Referenced by acmFormatTagDetailsW(), and acmStreamOpen().

◆ MSACM_GetDriver()

PWINE_ACMDRIVER MSACM_GetDriver ( HACMDRIVER  hDriver)

Definition at line 844 of file internal.c.

845 {
847 }
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3553
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type)
Definition: internal.c:823
#define WINE_ACMOBJ_DRIVER
Definition: wineacm.h:37

Referenced by acmDriverClose(), acmFormatTagDetailsW(), acmStreamOpen(), and MSACM_Message().

◆ MSACM_GetDriverID()

PWINE_ACMDRIVERID MSACM_GetDriverID ( HACMDRIVERID  hDriverID)

Definition at line 836 of file internal.c.

837 {
838  return (PWINE_ACMDRIVERID)MSACM_GetObj((HACMOBJ)hDriverID, WINE_ACMOBJ_DRIVERID);
839 }
#define WINE_ACMOBJ_DRIVERID
Definition: wineacm.h:36
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type)
Definition: internal.c:823

Referenced by acmDriverMessage(), acmDriverOpen(), acmDriverPriority(), acmDriverRemove(), acmFilterEnumW(), and acmFormatEnumW().

◆ MSACM_GetNotifyWnd()

PWINE_ACMNOTIFYWND MSACM_GetNotifyWnd ( HACMDRIVERID  hDriver)

Definition at line 852 of file internal.c.

853 {
855 }
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3553
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type)
Definition: internal.c:823
#define WINE_ACMOBJ_NOTIFYWND
Definition: wineacm.h:39

Referenced by acmDriverPriority(), and acmDriverRemove().

◆ MSACM_GetNumberOfModuleRefs()

static unsigned MSACM_GetNumberOfModuleRefs ( HMODULE  hModule,
DRIVERPROC  lpDrvProc,
WINE_ACMLOCALDRIVERINST **  found 
)
static

Definition at line 925 of file internal.c.

926 {
927  PWINE_ACMLOCALDRIVER lpDrv;
928  unsigned count = 0;
929 
930  if (found) *found = NULL;
931  for (lpDrv = MSACM_pFirstACMLocalDriver; lpDrv; lpDrv = lpDrv->pNextACMLocalDrv)
932  {
933  if (lpDrv->hModule == hModule && lpDrv->lpDrvProc == lpDrvProc)
934  {
935  PWINE_ACMLOCALDRIVERINST pInst = lpDrv->pACMInstList;
936 
937  while (pInst) {
938  if (found && !*found) *found = pInst;
939  count++;
940  pInst = pInst->pNextACMInst;
941  }
942  }
943  }
944  return count;
945 }
static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
Definition: internal.c:736
GLuint GLuint GLsizei count
Definition: gl.h:1545
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:66
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMLOCALDRIVER pNextACMLocalDrv
Definition: wineacm.h:56
PWINE_ACMLOCALDRIVERINST pACMInstList
Definition: wineacm.h:55
DRIVERPROC lpDrvProc
Definition: wineacm.h:54
HMODULE hModule
Definition: animate.c:44

Referenced by MSACM_AddToList(), MSACM_CloseLocalDriver(), MSACM_OpenLocalDriver(), and MSACM_RemoveFromList().

◆ MSACM_GetObj()

PWINE_ACMOBJ MSACM_GetObj ( HACMOBJ  hObj,
DWORD  type 
)

Definition at line 823 of file internal.c.

824 {
825  PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj;
826 
827  if (pao == NULL || IsBadReadPtr(pao, sizeof(WINE_ACMOBJ)) ||
828  ((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType)))
829  return NULL;
830  return pao;
831 }
DWORD dwType
Definition: wineacm.h:44
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct _WINE_ACMOBJ * PWINE_ACMOBJ
smooth NULL
Definition: ftsmooth.c:416
#define WINE_ACMOBJ_DONTCARE
Definition: wineacm.h:35
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807

Referenced by acmDriverID(), acmMetrics(), MSACM_GetDriver(), MSACM_GetDriverID(), and MSACM_GetNotifyWnd().

◆ MSACM_GetRegistryKey()

static LPWSTR MSACM_GetRegistryKey ( const WINE_ACMDRIVERID padid)
static

Definition at line 185 of file internal.c.

186 {
187  static const WCHAR baseKey[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
188  'A','u','d','i','o','C','o','m','p','r','e','s','s','i','o','n','M','a','n','a','g','e','r','\\',
189  'D','r','i','v','e','r','C','a','c','h','e','\\','\0'};
190  LPWSTR ret;
191  int len;
192 
193  if (!padid->pszDriverAlias) {
194  ERR("No alias needed for registry entry\n");
195  return NULL;
196  }
197  len = lstrlenW(baseKey);
198  ret = HeapAlloc(MSACM_hHeap, 0, (len + lstrlenW(padid->pszDriverAlias) + 1) * sizeof(WCHAR));
199  if (!ret) return NULL;
200 
201  lstrcpyW(ret, baseKey);
202  lstrcpyW(ret + len, padid->pszDriverAlias);
203  CharLowerW(ret + len);
204  return ret;
205 }
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
#define lstrlenW
Definition: compat.h:407
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszDriverAlias
Definition: wineacm.h:89
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
#define lstrcpyW
Definition: compat.h:406
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by MSACM_ReadCache(), and MSACM_WriteCache().

◆ MSACM_Message()

MMRESULT MSACM_Message ( HACMDRIVER  had,
UINT  uMsg,
LPARAM  lParam1,
LPARAM  lParam2 
)

Definition at line 872 of file internal.c.

873 {
874  PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
875 
876  if (!pad) return MMSYSERR_INVALHANDLE;
877  if (pad->hDrvr) return SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2);
878  if (pad->pLocalDrvrInst) return MSACM_DRIVER_SendMessage(pad->pLocalDrvrInst, uMsg, lParam1, lParam2);
879 
880  return MMSYSERR_INVALHANDLE;
881 }
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:131
HDRVR hDrvr
Definition: wineacm.h:72
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
Definition: internal.c:844
#define MSACM_DRIVER_SendMessage(PDRVRINST, msg, lParam1, lParam2)
Definition: internal.c:866
PWINE_ACMLOCALDRIVERINST pLocalDrvrInst
Definition: wineacm.h:73

Referenced by acmDriverDetailsW(), acmDriverMessage(), acmFilterDetailsW(), acmFilterTagDetailsW(), acmFormatDetailsW(), acmFormatSuggest(), acmFormatTagDetailsW(), acmFormatTagEnumW(), acmStreamClose(), acmStreamConvert(), acmStreamOpen(), acmStreamPrepareHeader(), acmStreamReset(), acmStreamSize(), acmStreamUnprepareHeader(), and MSACM_FillCache().

◆ MSACM_OpenLocalDriver()

PWINE_ACMLOCALDRIVERINST MSACM_OpenLocalDriver ( PWINE_ACMLOCALDRIVER  paldrv,
LPARAM  lParam2 
)

Definition at line 1026 of file internal.c.

1027 {
1028  PWINE_ACMLOCALDRIVERINST pDrvInst;
1029 
1030  pDrvInst = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVERINST));
1031  if (!pDrvInst)
1032  return NULL;
1033 
1034  pDrvInst->pLocalDriver = paldrv;
1035  pDrvInst->dwDriverID = 0;
1036  pDrvInst->pNextACMInst = NULL;
1037  pDrvInst->bSession = FALSE;
1038 
1039  /* Win32 installable drivers must support a two phase opening scheme:
1040  * + first open with NULL as lParam2 (session instance),
1041  * + then do a second open with the real non null lParam2)
1042  */
1043  if (MSACM_GetNumberOfModuleRefs(paldrv->hModule, paldrv->lpDrvProc, NULL) == 0 && lParam2)
1044  {
1046 
1047  if (!MSACM_AddToList(pDrvInst, 0L))
1048  {
1049  ERR("load0 failed\n");
1050  goto exit;
1051  }
1052  ret = MSACM_OpenLocalDriver(paldrv, lParam2);
1053  if (!ret)
1054  {
1055  ERR("load1 failed\n");
1056  /* If MSACM_CloseLocalDriver returns TRUE,
1057  * then pDrvInst has been freed
1058  */
1059  if (!MSACM_CloseLocalDriver(pDrvInst))
1060  goto exit;
1061 
1062  return NULL;
1063  }
1064  pDrvInst->bSession = TRUE;
1065  return ret;
1066  }
1067 
1068  if (!MSACM_AddToList(pDrvInst, lParam2))
1069  {
1070  ERR("load failed\n");
1071  goto exit;
1072  }
1073 
1074  TRACE("=> %p\n", pDrvInst);
1075  return pDrvInst;
1076 exit:
1077  HeapFree(MSACM_hHeap, 0, pDrvInst);
1078  return NULL;
1079 }
#define TRUE
Definition: types.h:120
static BOOL MSACM_AddToList(PWINE_ACMLOCALDRIVERINST lpNewDrv, LPARAM lParam2)
Definition: internal.c:989
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:66
HANDLE MSACM_hHeap
Definition: internal.c:47
PWINE_ACMLOCALDRIVERINST MSACM_OpenLocalDriver(PWINE_ACMLOCALDRIVER paldrv, LPARAM lParam2)
Definition: internal.c:1026
smooth NULL
Definition: ftsmooth.c:416
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:925
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:63
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:109
LRESULT MSACM_CloseLocalDriver(PWINE_ACMLOCALDRIVERINST paldrv)
Definition: internal.c:1081
void exit(int exitcode)
Definition: _exit.c:33
DRIVERPROC lpDrvProc
Definition: wineacm.h:54
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by acmDriverOpen(), and MSACM_OpenLocalDriver().

◆ MSACM_ReadCache()

static BOOL MSACM_ReadCache ( PWINE_ACMDRIVERID  padid)
static

Definition at line 210 of file internal.c.

211 {
213  HKEY hKey;
214  DWORD type, size;
215 
216  if (!key) return FALSE;
217 
218  padid->aFormatTag = NULL;
219 
220  if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
221  goto errCleanUp;
222 
223  size = sizeof(padid->cFormatTags);
224  if (RegQueryValueExA(hKey, "cFormatTags", 0, &type, (void*)&padid->cFormatTags, &size))
225  goto errCleanUp;
226  size = sizeof(padid->cFilterTags);
227  if (RegQueryValueExA(hKey, "cFilterTags", 0, &type, (void*)&padid->cFilterTags, &size))
228  goto errCleanUp;
229  size = sizeof(padid->fdwSupport);
230  if (RegQueryValueExA(hKey, "fdwSupport", 0, &type, (void*)&padid->fdwSupport, &size))
231  goto errCleanUp;
232 
233  if (padid->cFormatTags > 0) {
234  size = padid->cFormatTags * sizeof(padid->aFormatTag[0]);
236  if (!padid->aFormatTag) goto errCleanUp;
237  if (RegQueryValueExA(hKey, "aFormatTagCache", 0, &type, (void*)padid->aFormatTag, &size))
238  goto errCleanUp;
239  }
240  HeapFree(MSACM_hHeap, 0, key);
241  return TRUE;
242 
243  errCleanUp:
244  HeapFree(MSACM_hHeap, 0, key);
245  HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
246  padid->aFormatTag = NULL;
247  RegCloseKey(hKey);
248  return FALSE;
249 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
DWORD fdwSupport
Definition: wineacm.h:98
#define TRUE
Definition: types.h:120
DWORD cFormatTags
Definition: wineacm.h:97
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD cFilterTags
Definition: wineacm.h:96
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
struct _WINE_ACMDRIVERID::@464 * aFormatTag
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID *padid)
Definition: internal.c:185
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by MSACM_RegisterDriver().

◆ MSACM_RegisterAllDrivers()

void MSACM_RegisterAllDrivers ( void  )

Definition at line 354 of file internal.c.

355 {
356  static const WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
357  static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
358  static const WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
359  static const WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
360  static const WCHAR drvkey[] = {'S','o','f','t','w','a','r','e','\\',
361  'M','i','c','r','o','s','o','f','t','\\',
362  'W','i','n','d','o','w','s',' ','N','T','\\',
363  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
364  'D','r','i','v','e','r','s','3','2','\0'};
365  DWORD i, cnt, bufLen, lRet, type;
366  WCHAR buf[2048], valname[64], *name, *s;
367  FILETIME lastWrite;
368  HKEY hKey;
369 
370  /* FIXME: What if the user edits system.ini while the program is running?
371  * Does Windows handle that? */
372  if (MSACM_pFirstACMDriverID) return;
373 
374  lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
375  if (lRet == ERROR_SUCCESS) {
376  RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
377  for (i = 0; i < cnt; i++) {
378  bufLen = ARRAY_SIZE(buf);
379  lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
380  if (lRet != ERROR_SUCCESS) continue;
381  if (_wcsnicmp(buf, msacmW, ARRAY_SIZE(msacmW))) continue;
382  if (!(name = wcschr(buf, '='))) continue;
383  *name = 0;
384  MSACM_RegisterDriver(buf, name + 1, 0);
385  }
386  i = 0;
387  cnt = ARRAY_SIZE(valname);
388  bufLen = sizeof(buf);
389  while(RegEnumValueW(hKey, i, valname, &cnt, 0,
390  &type, (BYTE*)buf, &bufLen) == ERROR_SUCCESS){
391  if (!_wcsnicmp(valname, msacmW, ARRAY_SIZE(msacmW)))
392  MSACM_RegisterDriver(valname, buf, 0);
393  ++i;
394  }
395  RegCloseKey( hKey );
396  }
397 
398  if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys))
399  {
400  for(s = buf; *s; s += lstrlenW(s) + 1)
401  {
402  if (_wcsnicmp(s, msacmW, ARRAY_SIZE(msacmW))) continue;
403  if (!(name = wcschr(s, '='))) continue;
404  *name = 0;
405  MSACM_RegisterDriver(s, name + 1, 0);
406  *name = '=';
407  }
408  }
410  MSACM_RegisterDriver(msacm32, msacm32, 0);
411 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:407
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName, PWINE_ACMLOCALDRIVER pLocalDriver)
Definition: internal.c:285
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
unsigned char BYTE
Definition: mem.h:68
GLdouble s
Definition: gl.h:2039
static void MSACM_ReorderDriversByPriority(void)
Definition: internal.c:556
#define ARRAY_SIZE(a)
Definition: main.h:24
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
Definition: name.c:36
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
INT WINAPI GetPrivateProfileSectionW(LPCWSTR section, LPWSTR buffer, DWORD len, LPCWSTR filename)
Definition: profile.c:1351
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by DllMain().

◆ MSACM_RegisterDriver()

PWINE_ACMDRIVERID MSACM_RegisterDriver ( LPCWSTR  pszDriverAlias,
LPCWSTR  pszFileName,
PWINE_ACMLOCALDRIVER  pLocalDriver 
)

Definition at line 285 of file internal.c.

287 {
288  PWINE_ACMDRIVERID padid;
289 
290  TRACE("(%s, %s, %p)\n",
291  debugstr_w(pszDriverAlias), debugstr_w(pszFileName), pLocalDriver);
292 
293  padid = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
294  if (!padid)
295  return NULL;
297  padid->obj.pACMDriverID = padid;
298  padid->pszDriverAlias = NULL;
299  if (pszDriverAlias)
300  {
301  padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (lstrlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
302  if (!padid->pszDriverAlias) {
303  HeapFree(MSACM_hHeap, 0, padid);
304  return NULL;
305  }
306  lstrcpyW( padid->pszDriverAlias, pszDriverAlias );
307  }
308  padid->pszFileName = NULL;
309  if (pszFileName)
310  {
311  padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (lstrlenW(pszFileName)+1) * sizeof(WCHAR) );
312  if (!padid->pszFileName) {
313  HeapFree(MSACM_hHeap, 0, padid->pszDriverAlias);
314  HeapFree(MSACM_hHeap, 0, padid);
315  return NULL;
316  }
317  lstrcpyW( padid->pszFileName, pszFileName );
318  }
319  padid->pLocalDriver = pLocalDriver;
320 
321  padid->pACMDriverList = NULL;
322 
323  if (pLocalDriver) {
324  padid->pPrevACMDriverID = NULL;
328  MSACM_pFirstACMDriverID = padid;
330  MSACM_pLastACMDriverID = padid;
331  } else {
332  padid->pNextACMDriverID = NULL;
336  MSACM_pLastACMDriverID = padid;
338  MSACM_pFirstACMDriverID = padid;
339  }
340  /* disable the driver if we cannot load the cache */
341  if ((!padid->pszDriverAlias || !MSACM_ReadCache(padid)) && !MSACM_FillCache(padid)) {
342  WARN("Couldn't load cache for ACM driver (%s)\n", debugstr_w(pszFileName));
343  MSACM_UnregisterDriver(padid);
344  return NULL;
345  }
346 
347  if (pLocalDriver) padid->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_LOCAL;
348  return padid;
349 }
DWORD fdwSupport
Definition: wineacm.h:98
WINE_ACMOBJ obj
Definition: wineacm.h:88
static BOOL MSACM_FillCache(PWINE_ACMDRIVERID padid)
Definition: internal.c:134
#define WARN(fmt,...)
Definition: debug.h:111
PWINE_ACMDRIVERID pACMDriverID
Definition: wineacm.h:45
DWORD dwType
Definition: wineacm.h:44
#define WINE_ACMOBJ_DRIVERID
Definition: wineacm.h:36
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
Definition: internal.c:773
#define lstrlenW
Definition: compat.h:407
PWINE_ACMDRIVERID pPrevACMDriverID
Definition: wineacm.h:94
static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid)
Definition: internal.c:210
#define debugstr_w
Definition: kernel32.h:32
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:93
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszDriverAlias
Definition: wineacm.h:89
PWINE_ACMDRIVER pACMDriverList
Definition: wineacm.h:92
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:91
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
#define ACMDRIVERDETAILS_SUPPORTF_LOCAL
Definition: msacm.h:66
#define lstrcpyW
Definition: compat.h:406
LPWSTR pszFileName
Definition: wineacm.h:90
#define HeapFree(x, y, z)
Definition: compat.h:394
static PWINE_ACMDRIVERID MSACM_pLastACMDriverID
Definition: internal.c:49

Referenced by acmDriverAddW(), MSACM_RegisterAllDrivers(), and MSACM_RegisterDriverFromRegistry().

◆ MSACM_RegisterDriverFromRegistry()

PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry ( LPCWSTR  pszRegEntry)

Definition at line 61 of file internal.c.

62 {
63  static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
64  static const WCHAR drvkey[] = {'S','o','f','t','w','a','r','e','\\',
65  'M','i','c','r','o','s','o','f','t','\\',
66  'W','i','n','d','o','w','s',' ','N','T','\\',
67  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
68  'D','r','i','v','e','r','s','3','2','\0'};
69  WCHAR buf[2048];
70  DWORD bufLen, lRet;
71  HKEY hKey;
72  PWINE_ACMDRIVERID padid = NULL;
73 
74  /* The requested registry entry must have the format msacm.XXXXX in order to
75  be recognized in any future sessions of msacm
76  */
77  if (0 == _wcsnicmp(pszRegEntry, msacmW, ARRAY_SIZE(msacmW))) {
78  lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
79  if (lRet != ERROR_SUCCESS) {
80  WARN("unable to open registry key - 0x%08x\n", lRet);
81  } else {
82  bufLen = sizeof(buf);
83  lRet = RegQueryValueExW(hKey, pszRegEntry, NULL, NULL, (LPBYTE)buf, &bufLen);
84  if (lRet != ERROR_SUCCESS) {
85  WARN("unable to query requested subkey %s - 0x%08x\n", debugstr_w(pszRegEntry), lRet);
86  } else {
87  MSACM_RegisterDriver(pszRegEntry, buf, 0);
88  }
89  RegCloseKey( hKey );
90  }
91  }
92  return padid;
93 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName, PWINE_ACMLOCALDRIVER pLocalDriver)
Definition: internal.c:285
#define ARRAY_SIZE(a)
Definition: main.h:24
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by acmDriverAddW().

◆ MSACM_RegisterLocalDriver()

PWINE_ACMLOCALDRIVER MSACM_RegisterLocalDriver ( HMODULE  hModule,
DRIVERPROC  lpDriverProc 
)

Definition at line 883 of file internal.c.

884 {
885  PWINE_ACMLOCALDRIVER paldrv;
886 
887  TRACE("(%p, %p)\n", hModule, lpDriverProc);
888  if (!hModule || !lpDriverProc) return NULL;
889 
890  /* look up previous instance of local driver module */
891  for (paldrv = MSACM_pFirstACMLocalDriver; paldrv; paldrv = paldrv->pNextACMLocalDrv)
892  {
893  if (paldrv->hModule == hModule && paldrv->lpDrvProc == lpDriverProc)
894  {
895  InterlockedIncrement(&paldrv->ref);
896  return paldrv;
897  }
898  }
899 
900  paldrv = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVER));
902  paldrv->obj.pACMDriverID = 0;
903  paldrv->hModule = hModule;
904  paldrv->lpDrvProc = lpDriverProc;
905  paldrv->pACMInstList = NULL;
906  paldrv->ref = 1;
907 
908  paldrv->pNextACMLocalDrv = NULL;
912  MSACM_pLastACMLocalDriver = paldrv;
915 
916  return paldrv;
917 }
static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
Definition: internal.c:736
static PWINE_ACMLOCALDRIVER MSACM_pLastACMLocalDriver
Definition: internal.c:737
PWINE_ACMDRIVERID pACMDriverID
Definition: wineacm.h:45
DWORD dwType
Definition: wineacm.h:44
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMLOCALDRIVER pPrevACMLocalDrv
Definition: wineacm.h:57
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
PWINE_ACMLOCALDRIVER pNextACMLocalDrv
Definition: wineacm.h:56
PWINE_ACMLOCALDRIVERINST pACMInstList
Definition: wineacm.h:55
#define InterlockedIncrement
Definition: armddk.h:53
#define WINE_ACMOBJ_LOCALDRIVER
Definition: wineacm.h:40
WINE_ACMOBJ obj
Definition: wineacm.h:52
DRIVERPROC lpDrvProc
Definition: wineacm.h:54
HMODULE hModule
Definition: animate.c:44

Referenced by acmDriverAddW().

◆ MSACM_RegisterNotificationWindow()

PWINE_ACMNOTIFYWND MSACM_RegisterNotificationWindow ( HWND  hNotifyWnd,
DWORD  dwNotifyMsg 
)

Definition at line 416 of file internal.c.

417 {
418  PWINE_ACMNOTIFYWND panwnd;
419 
420  TRACE("(%p,0x%08x)\n", hNotifyWnd, dwNotifyMsg);
421 
422  panwnd = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMNOTIFYWND));
423  panwnd->obj.dwType = WINE_ACMOBJ_NOTIFYWND;
424  panwnd->obj.pACMDriverID = 0;
425  panwnd->hNotifyWnd = hNotifyWnd;
426  panwnd->dwNotifyMsg = dwNotifyMsg;
427  panwnd->fdwSupport = 0;
428 
429  panwnd->pNextACMNotifyWnd = NULL;
433  MSACM_pLastACMNotifyWnd = panwnd;
435  MSACM_pFirstACMNotifyWnd = panwnd;
436 
437  return panwnd;
438 }
PWINE_ACMNOTIFYWND pNextACMNotifyWnd
Definition: wineacm.h:112
PWINE_ACMDRIVERID pACMDriverID
Definition: wineacm.h:45
DWORD dwType
Definition: wineacm.h:44
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:53
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WINE_ACMOBJ_NOTIFYWND
Definition: wineacm.h:39
static PWINE_ACMNOTIFYWND MSACM_pLastACMNotifyWnd
Definition: internal.c:54
WINE_ACMOBJ obj
Definition: wineacm.h:108
PWINE_ACMNOTIFYWND pPrevACMNotifyWnd
Definition: wineacm.h:113

Referenced by acmDriverAddW().

◆ MSACM_RemoveFromList()

static BOOL MSACM_RemoveFromList ( PWINE_ACMLOCALDRIVERINST  lpDrv)
static

Definition at line 953 of file internal.c.

954 {
955  PWINE_ACMLOCALDRIVER pDriverBase = lpDrv->pLocalDriver;
956  PWINE_ACMLOCALDRIVERINST pPrevInst;
957 
958  /* last of this driver in list ? */
959  if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, NULL) == 1) {
961  MSACM_DRIVER_SendMessage(lpDrv, DRV_FREE, 0L, 0L);
962  }
963 
964  pPrevInst = NULL;
965  if (pDriverBase->pACMInstList != lpDrv) {
966  pPrevInst = pDriverBase->pACMInstList;
967  while (pPrevInst && pPrevInst->pNextACMInst != lpDrv)
968  pPrevInst = pPrevInst->pNextACMInst;
969  if (!pPrevInst) {
970  ERR("requested to remove invalid instance %p\n", pPrevInst);
971  return FALSE;
972  }
973  }
974  if (!pPrevInst) {
975  /* first driver instance on list */
976  pDriverBase->pACMInstList = lpDrv->pNextACMInst;
977  } else {
978  pPrevInst->pNextACMInst = lpDrv->pNextACMInst;
979  }
980  return TRUE;
981 }
#define DRV_DISABLE
Definition: mmsystem.h:123
#define TRUE
Definition: types.h:120
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:66
smooth NULL
Definition: ftsmooth.c:416
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:925
#define DRV_FREE
Definition: mmsystem.h:124
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:63
static const WCHAR L[]
Definition: oid.c:1250
PWINE_ACMLOCALDRIVERINST pACMInstList
Definition: wineacm.h:55
#define ERR(fmt,...)
Definition: debug.h:109
DRIVERPROC lpDrvProc
Definition: wineacm.h:54
#define MSACM_DRIVER_SendMessage(PDRVRINST, msg, lParam1, lParam2)
Definition: internal.c:866

Referenced by MSACM_AddToList(), and MSACM_CloseLocalDriver().

◆ MSACM_ReorderDriversByPriority()

static void MSACM_ReorderDriversByPriority ( void  )
static

Definition at line 556 of file internal.c.

557 {
558  PWINE_ACMDRIVERID padid;
559  unsigned int iNumDrivers;
560  PWINE_ACMDRIVERID * driverList = NULL;
561  HKEY hPriorityKey = NULL;
562 
563  TRACE("\n");
564 
565  /* Count drivers && alloc corresponding memory for list */
566  iNumDrivers = 0;
567  for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) iNumDrivers++;
568  if (iNumDrivers > 1)
569  {
570  LONG lError;
571  static const WCHAR basePriorityKey[] = {
572  'S','o','f','t','w','a','r','e','\\',
573  'M','i','c','r','o','s','o','f','t','\\',
574  'M','u','l','t','i','m','e','d','i','a','\\',
575  'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
576  'P','r','i','o','r','i','t','y',' ','v','4','.','0','0','\0'
577  };
578  unsigned int i;
579  LONG lBufferLength;
580  WCHAR szBuffer[256];
581 
582  driverList = HeapAlloc(MSACM_hHeap, 0, iNumDrivers * sizeof(PWINE_ACMDRIVERID));
583  if (!driverList)
584  {
585  ERR("out of memory\n");
586  goto errCleanUp;
587  }
588 
589  lError = RegOpenKeyW(HKEY_CURRENT_USER, basePriorityKey, &hPriorityKey);
590  if (lError != ERROR_SUCCESS) {
591  TRACE("RegOpenKeyW failed, possibly key does not exist yet\n");
592  hPriorityKey = NULL;
593  goto errCleanUp;
594  }
595 
596  /* Copy drivers into list to simplify linked list modification */
597  for (i = 0, padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID, i++)
598  {
599  driverList[i] = padid;
600  }
601 
602  /* Query each of the priorities in turn. Alias key is in lowercase.
603  The general form of the priority record is the following:
604  "PriorityN" --> "1, msacm.driveralias"
605  where N is an integer, and the value is a string of the driver
606  alias, prefixed by "1, " for an enabled driver, or "0, " for a
607  disabled driver.
608  */
609  for (i = 0; i < iNumDrivers; i++)
610  {
611  static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
612  WCHAR szSubKey[17];
613  unsigned int iTargetPosition;
614  unsigned int iCurrentPosition;
615  WCHAR * pAlias;
616  static const WCHAR sPrefix[] = {'m','s','a','c','m','.','\0'};
617 
618  /* Build expected entry name */
619  swprintf(szSubKey, priorityTmpl, i + 1);
620  lBufferLength = sizeof(szBuffer);
621  lError = RegQueryValueExW(hPriorityKey, szSubKey, NULL, NULL, (LPBYTE)szBuffer, (LPDWORD)&lBufferLength);
622  if (lError != ERROR_SUCCESS) continue;
623 
624  /* Recovered driver alias should be at this position */
625  iTargetPosition = i;
626 
627  /* Locate driver alias in driver list */
628  pAlias = wcsstr(szBuffer, sPrefix);
629  if (pAlias == NULL) continue;
630 
631  for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) {
632  if (wcsicmp(driverList[iCurrentPosition]->pszDriverAlias, pAlias) == 0)
633  break;
634  }
635  if (iCurrentPosition < iNumDrivers && iTargetPosition != iCurrentPosition) {
636  padid = driverList[iTargetPosition];
637  driverList[iTargetPosition] = driverList[iCurrentPosition];
638  driverList[iCurrentPosition] = padid;
639 
640  /* Locate enabled status */
641  if (szBuffer[0] == '1') {
642  driverList[iTargetPosition]->fdwSupport &= ~ACMDRIVERDETAILS_SUPPORTF_DISABLED;
643  } else if (szBuffer[0] == '0') {
644  driverList[iTargetPosition]->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
645  }
646  }
647  }
648 
649  /* Re-assign pointers so that linked list traverses the ordered array */
650  for (i = 0; i < iNumDrivers; i++) {
651  driverList[i]->pPrevACMDriverID = (i > 0) ? driverList[i - 1] : NULL;
652  driverList[i]->pNextACMDriverID = (i < iNumDrivers - 1) ? driverList[i + 1] : NULL;
653  }
654  MSACM_pFirstACMDriverID = driverList[0];
655  MSACM_pLastACMDriverID = driverList[iNumDrivers - 1];
656  }
657 
658 errCleanUp:
659  if (hPriorityKey != NULL) RegCloseKey(hPriorityKey);
660  HeapFree(MSACM_hHeap, 0, driverList);
661 }
DWORD fdwSupport
Definition: wineacm.h:98
#define ERROR_SUCCESS
Definition: deptool.c:10
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
PWINE_ACMDRIVERID pPrevACMDriverID
Definition: wineacm.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:93
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
#define wcsicmp
Definition: string.h:1152
#define ERR(fmt,...)
Definition: debug.h:109
#define ACMDRIVERDETAILS_SUPPORTF_DISABLED
Definition: msacm.h:67
uint32_t * LPDWORD
Definition: typedefs.h:57
#define HeapFree(x, y, z)
Definition: compat.h:394
static PWINE_ACMDRIVERID MSACM_pLastACMDriverID
Definition: internal.c:49

Referenced by MSACM_RegisterAllDrivers().

◆ MSACM_RePositionDriver()

void MSACM_RePositionDriver ( PWINE_ACMDRIVERID  padid,
DWORD  dwPriority 
)

Definition at line 504 of file internal.c.

505 {
506  PWINE_ACMDRIVERID pTargetPosition = NULL;
507 
508  /* Remove selected driver from linked list */
509  if (MSACM_pFirstACMDriverID == padid) {
511  }
512  if (MSACM_pLastACMDriverID == padid) {
514  }
515  if (padid->pPrevACMDriverID != NULL) {
517  }
518  if (padid->pNextACMDriverID != NULL) {
520  }
521 
522  /* Look up position where selected driver should be */
523  if (dwPriority == 1) {
524  pTargetPosition = padid->pPrevACMDriverID;
525  while (pTargetPosition->pPrevACMDriverID != NULL &&
527  pTargetPosition = pTargetPosition->pPrevACMDriverID;
528  }
529  } else if (dwPriority == -1) {
530  pTargetPosition = padid->pNextACMDriverID;
531  while (pTargetPosition->pNextACMDriverID != NULL) {
532  pTargetPosition = pTargetPosition->pNextACMDriverID;
533  }
534  }
535 
536  /* Place selected driver in selected position */
537  padid->pPrevACMDriverID = pTargetPosition->pPrevACMDriverID;
538  padid->pNextACMDriverID = pTargetPosition;
539  if (padid->pPrevACMDriverID != NULL) {
540  padid->pPrevACMDriverID->pNextACMDriverID = padid;
541  } else {
542  MSACM_pFirstACMDriverID = padid;
543  }
544  if (padid->pNextACMDriverID != NULL) {
545  padid->pNextACMDriverID->pPrevACMDriverID = padid;
546  } else {
547  MSACM_pLastACMDriverID = padid;
548  }
549 }
DWORD fdwSupport
Definition: wineacm.h:98
PWINE_ACMDRIVERID pPrevACMDriverID
Definition: wineacm.h:94
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:93
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
#define ACMDRIVERDETAILS_SUPPORTF_LOCAL
Definition: msacm.h:66
static PWINE_ACMDRIVERID MSACM_pLastACMDriverID
Definition: internal.c:49

Referenced by acmDriverPriority().

◆ MSACM_UnregisterAllDrivers()

void MSACM_UnregisterAllDrivers ( void  )

Definition at line 805 of file internal.c.

806 {
809 
810  while (p) {
813  }
814 
815  while (panwnd) {
816  panwnd = MSACM_UnRegisterNotificationWindow(panwnd);
817  }
818 }
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
Definition: internal.c:773
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:53
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
PWINE_ACMNOTIFYWND MSACM_UnRegisterNotificationWindow(const WINE_ACMNOTIFYWND *panwnd)
Definition: internal.c:481
static BOOL MSACM_WriteCache(const WINE_ACMDRIVERID *padid)
Definition: internal.c:254
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by DllMain().

◆ MSACM_UnregisterDriver()

PWINE_ACMDRIVERID MSACM_UnregisterDriver ( PWINE_ACMDRIVERID  p)

Definition at line 773 of file internal.c.

774 {
775  PWINE_ACMDRIVERID pNextACMDriverID;
776 
777  while (p->pACMDriverList)
778  acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
779 
780  HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
781  HeapFree(MSACM_hHeap, 0, p->pszFileName);
782  HeapFree(MSACM_hHeap, 0, p->aFormatTag);
783 
784  if (p == MSACM_pFirstACMDriverID)
786  if (p == MSACM_pLastACMDriverID)
788 
789  if (p->pPrevACMDriverID)
791  if (p->pNextACMDriverID)
793 
794  pNextACMDriverID = p->pNextACMDriverID;
795 
796  if (p->pLocalDriver) MSACM_UnregisterLocalDriver(p->pLocalDriver);
797  HeapFree(MSACM_hHeap, 0, p);
798 
799  return pNextACMDriverID;
800 }
PWINE_ACMDRIVERID pPrevACMDriverID
Definition: wineacm.h:94
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
Definition: driver.c:179
HANDLE MSACM_hHeap
Definition: internal.c:47
static PWINE_ACMLOCALDRIVER MSACM_UnregisterLocalDriver(PWINE_ACMLOCALDRIVER paldrv)
Definition: internal.c:739
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:93
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
GLfloat GLfloat p
Definition: glext.h:8902
#define HeapFree(x, y, z)
Definition: compat.h:394
static PWINE_ACMDRIVERID MSACM_pLastACMDriverID
Definition: internal.c:49

Referenced by acmDriverRemove(), MSACM_RegisterDriver(), and MSACM_UnregisterAllDrivers().

◆ MSACM_UnregisterLocalDriver()

static PWINE_ACMLOCALDRIVER MSACM_UnregisterLocalDriver ( PWINE_ACMLOCALDRIVER  paldrv)
static

Definition at line 739 of file internal.c.

740 {
741  PWINE_ACMLOCALDRIVER pNextACMLocalDriver;
742  LONG ref;
743 
744  if (paldrv->pACMInstList) {
745  ERR("local driver instances still present after closing all drivers - memory leak\n");
746  return NULL;
747  }
748 
749  ref = InterlockedDecrement(&paldrv->ref);
750  if (ref)
751  return paldrv;
752 
753  if (paldrv == MSACM_pFirstACMLocalDriver)
755  if (paldrv == MSACM_pLastACMLocalDriver)
757 
758  if (paldrv->pPrevACMLocalDrv)
760  if (paldrv->pNextACMLocalDrv)
762 
763  pNextACMLocalDriver = paldrv->pNextACMLocalDrv;
764 
765  HeapFree(MSACM_hHeap, 0, paldrv);
766 
767  return pNextACMLocalDriver;
768 }
static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
Definition: internal.c:736
static PWINE_ACMLOCALDRIVER MSACM_pLastACMLocalDriver
Definition: internal.c:737
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMLOCALDRIVER pPrevACMLocalDrv
Definition: wineacm.h:57
PWINE_ACMLOCALDRIVER pNextACMLocalDrv
Definition: wineacm.h:56
#define InterlockedDecrement
Definition: armddk.h:52
PWINE_ACMLOCALDRIVERINST pACMInstList
Definition: wineacm.h:55
#define ERR(fmt,...)
Definition: debug.h:109
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by MSACM_UnregisterDriver().

◆ MSACM_UnRegisterNotificationWindow()

PWINE_ACMNOTIFYWND MSACM_UnRegisterNotificationWindow ( const WINE_ACMNOTIFYWND panwnd)

Definition at line 481 of file internal.c.

482 {
484 
485  for (p = MSACM_pFirstACMNotifyWnd; p; p = p->pNextACMNotifyWnd) {
486  if (p == panwnd) {
488 
489  if (p->pPrevACMNotifyWnd) p->pPrevACMNotifyWnd->pNextACMNotifyWnd = p->pNextACMNotifyWnd;
490  if (p->pNextACMNotifyWnd) p->pNextACMNotifyWnd->pPrevACMNotifyWnd = p->pPrevACMNotifyWnd;
493  HeapFree(MSACM_hHeap, 0, p);
494 
495  return pNext;
496  }
497  }
498  return NULL;
499 }
PWINE_ACMNOTIFYWND pNextACMNotifyWnd
Definition: wineacm.h:112
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:53
HANDLE MSACM_hHeap
Definition: internal.c:47
smooth NULL
Definition: ftsmooth.c:416
static PWINE_ACMNOTIFYWND MSACM_pLastACMNotifyWnd
Definition: internal.c:54
GLfloat GLfloat p
Definition: glext.h:8902
#define HeapFree(x, y, z)
Definition: compat.h:394
PWINE_ACMNOTIFYWND pPrevACMNotifyWnd
Definition: wineacm.h:113

Referenced by acmDriverRemove(), and MSACM_UnregisterAllDrivers().

◆ MSACM_WriteCache()

static BOOL MSACM_WriteCache ( const WINE_ACMDRIVERID padid)
static

Definition at line 254 of file internal.c.

255 {
257  HKEY hKey;
258 
259  if (!key) return FALSE;
260 
261  if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
262  goto errCleanUp;
263 
264  if (RegSetValueExA(hKey, "cFormatTags", 0, REG_DWORD, (const void*)&padid->cFormatTags, sizeof(DWORD)))
265  goto errCleanUp;
266  if (RegSetValueExA(hKey, "cFilterTags", 0, REG_DWORD, (const void*)&padid->cFilterTags, sizeof(DWORD)))
267  goto errCleanUp;
268  if (RegSetValueExA(hKey, "fdwSupport", 0, REG_DWORD, (const void*)&padid->fdwSupport, sizeof(DWORD)))
269  goto errCleanUp;
270  if (RegSetValueExA(hKey, "aFormatTagCache", 0, REG_BINARY,
271  (void*)padid->aFormatTag,
272  padid->cFormatTags * sizeof(padid->aFormatTag[0])))
273  goto errCleanUp;
274  HeapFree(MSACM_hHeap, 0, key);
275  return TRUE;
276 
277  errCleanUp:
278  HeapFree(MSACM_hHeap, 0, key);
279  return FALSE;
280 }
DWORD fdwSupport
Definition: wineacm.h:98
#define TRUE
Definition: types.h:120
#define REG_BINARY
Definition: nt_native.h:1496
DWORD cFormatTags
Definition: wineacm.h:97
DWORD cFilterTags
Definition: wineacm.h:96
HANDLE MSACM_hHeap
Definition: internal.c:47
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
struct _WINE_ACMDRIVERID::@464 * aFormatTag
static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID *padid)
Definition: internal.c:185
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define REG_DWORD
Definition: sdbapi.c:596
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by MSACM_UnregisterAllDrivers().

◆ MSACM_WriteCurrentPriorities()

void MSACM_WriteCurrentPriorities ( void  )

Definition at line 668 of file internal.c.

669 {
670  LONG lError;
671  HKEY hPriorityKey;
672  static const WCHAR basePriorityKey[] = {
673  'S','o','f','t','w','a','r','e','\\',
674  'M','i','c','r','o','s','o','f','t','\\',
675  'M','u','l','t','i','m','e','d','i','a','\\',
676  'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
677  'P','r','i','o','r','i','t','y',' ','v','4','.','0','0','\0'
678  };
679  PWINE_ACMDRIVERID padid;
680  DWORD dwPriorityCounter;
681  static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
682  static const WCHAR valueTmpl[] = {'%','c',',',' ','%','s','\0'};
683  static const WCHAR converterAlias[] = {'I','n','t','e','r','n','a','l',' ','P','C','M',' ','C','o','n','v','e','r','t','e','r','\0'};
684  WCHAR szSubKey[17];
685  WCHAR szBuffer[256];
686 
687  /* Delete ACM priority key and create it anew */
688  lError = RegDeleteKeyW(HKEY_CURRENT_USER, basePriorityKey);
689  if (lError != ERROR_SUCCESS && lError != ERROR_FILE_NOT_FOUND) {
690  ERR("unable to remove current key %s (0x%08x) - priority changes won't persist past application end.\n",
691  debugstr_w(basePriorityKey), lError);
692  return;
693  }
694  lError = RegCreateKeyW(HKEY_CURRENT_USER, basePriorityKey, &hPriorityKey);
695  if (lError != ERROR_SUCCESS) {
696  ERR("unable to create key %s (0x%08x) - priority changes won't persist past application end.\n",
697  debugstr_w(basePriorityKey), lError);
698  return;
699  }
700 
701  /* Write current list of priorities */
702  for (dwPriorityCounter = 0, padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
703  if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL) continue;
704  if (padid->pszDriverAlias == NULL) continue; /* internal PCM converter is last */
705 
706  /* Build required value name */
707  dwPriorityCounter++;
708  swprintf(szSubKey, priorityTmpl, dwPriorityCounter);
709 
710  /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
711  swprintf(szBuffer, valueTmpl, (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias);
712  _wcslwr(szBuffer);
713 
714  lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR));
715  if (lError != ERROR_SUCCESS) {
716  ERR("unable to write value for %s under key %s (0x%08x)\n",
717  debugstr_w(padid->pszDriverAlias), debugstr_w(basePriorityKey), lError);
718  }
719  }
720 
721  /* Build required value name */
722  dwPriorityCounter++;
723  swprintf(szSubKey, priorityTmpl, dwPriorityCounter);
724 
725  /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
726  swprintf(szBuffer, valueTmpl, '1', converterAlias);
727 
728  lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (lstrlenW(szBuffer) + 1) * sizeof(WCHAR));
729  if (lError != ERROR_SUCCESS) {
730  ERR("unable to write value for %s under key %s (0x%08x)\n",
731  debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError);
732  }
733  RegCloseKey(hPriorityKey);
734 }
DWORD fdwSupport
Definition: wineacm.h:98
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
#define lstrlenW
Definition: compat.h:407
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:93
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
LPWSTR pszDriverAlias
Definition: wineacm.h:89
unsigned long DWORD
Definition: ntddk_ex.h:95
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:48
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define ERR(fmt,...)
Definition: debug.h:109
_CRTIMP wchar_t *__cdecl _wcslwr(_Inout_z_ wchar_t *_String)
#define ACMDRIVERDETAILS_SUPPORTF_LOCAL
Definition: msacm.h:66
#define ACMDRIVERDETAILS_SUPPORTF_DISABLED
Definition: msacm.h:67
#define REG_SZ
Definition: layer.c:22

Referenced by acmDriverPriority().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msacm  )

Variable Documentation

◆ MSACM_hHeap

◆ MSACM_pendingBroadcast

BOOL MSACM_pendingBroadcast = FALSE
static

Definition at line 52 of file internal.c.

Referenced by MSACM_BroadcastNotification(), and MSACM_EnableNotifications().

◆ MSACM_pFirstACMDriverID

◆ MSACM_pFirstACMLocalDriver

PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
static

◆ MSACM_pFirstACMNotifyWnd

◆ MSACM_pLastACMDriverID

PWINE_ACMDRIVERID MSACM_pLastACMDriverID
static

◆ MSACM_pLastACMLocalDriver

PWINE_ACMLOCALDRIVER MSACM_pLastACMLocalDriver
static

Definition at line 737 of file internal.c.

Referenced by MSACM_RegisterLocalDriver(), and MSACM_UnregisterLocalDriver().

◆ MSACM_pLastACMNotifyWnd

PWINE_ACMNOTIFYWND MSACM_pLastACMNotifyWnd = NULL
static

◆ MSACM_suspendBroadcastCount

DWORD MSACM_suspendBroadcastCount = 0
static