ReactOS  0.4.13-dev-1148-g9b75b67
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 "wine/unicode.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 859 of file internal.c.

Function Documentation

◆ MSACM_AddToList()

static BOOL MSACM_AddToList ( PWINE_ACMLOCALDRIVERINST  lpNewDrv,
LPARAM  lParam2 
)
static

Definition at line 977 of file internal.c.

978 {
979  PWINE_ACMLOCALDRIVER pDriverBase = lpNewDrv->pLocalDriver;
980 
981  /* first of this driver in list ? */
982  if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, NULL) == 0) {
983  if (MSACM_DRIVER_SendMessage(lpNewDrv, DRV_LOAD, 0L, 0L) != DRV_SUCCESS) {
984  FIXME("DRV_LOAD failed on driver %p\n", lpNewDrv);
985  return FALSE;
986  }
987  /* returned value is not checked */
988  MSACM_DRIVER_SendMessage(lpNewDrv, DRV_ENABLE, 0L, 0L);
989  }
990 
991  lpNewDrv->pNextACMInst = NULL;
992  if (pDriverBase->pACMInstList == NULL) {
993  pDriverBase->pACMInstList = lpNewDrv;
994  } else {
995  PWINE_ACMLOCALDRIVERINST lpDrvInst = pDriverBase->pACMInstList;
996 
997  while (lpDrvInst->pNextACMInst != NULL)
998  lpDrvInst = lpDrvInst->pNextACMInst;
999 
1000  lpDrvInst->pNextACMInst = lpNewDrv;
1001  }
1002 
1003  /* Now just open a new instance of a driver on this module */
1004  lpNewDrv->dwDriverID = MSACM_DRIVER_SendMessage(lpNewDrv, DRV_OPEN, 0, lParam2);
1005 
1006  if (lpNewDrv->dwDriverID == 0) {
1007  FIXME("DRV_OPEN failed on driver %p\n", lpNewDrv);
1008  MSACM_RemoveFromList(lpNewDrv);
1009  return FALSE;
1010  }
1011  return TRUE;
1012 }
#define TRUE
Definition: types.h:120
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:65
#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:941
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:913
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:62
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:859

Referenced by MSACM_OpenLocalDriver().

◆ MSACM_BroadcastNotification()

void MSACM_BroadcastNotification ( void  )

Definition at line 441 of file internal.c.

442 {
443  if (MSACM_suspendBroadcastCount <= 0) {
444  PWINE_ACMNOTIFYWND panwnd;
445 
446  for (panwnd = MSACM_pFirstACMNotifyWnd; panwnd; panwnd = panwnd->pNextACMNotifyWnd)
448  SendMessageW(panwnd->hNotifyWnd, panwnd->dwNotifyMsg, 0, 0);
449  } else {
451  }
452 }
PWINE_ACMNOTIFYWND pNextACMNotifyWnd
Definition: wineacm.h:111
#define TRUE
Definition: types.h:120
static BOOL MSACM_pendingBroadcast
Definition: internal.c:50
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:51
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:49

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

◆ MSACM_CloseLocalDriver()

LRESULT MSACM_CloseLocalDriver ( PWINE_ACMLOCALDRIVERINST  paldrv)

Definition at line 1069 of file internal.c.

1070 {
1071  if (MSACM_RemoveFromList(paldrv)) {
1072  PWINE_ACMLOCALDRIVERINST lpDrv0;
1073  PWINE_ACMLOCALDRIVER pDriverBase = paldrv->pLocalDriver;
1074 
1075  MSACM_DRIVER_SendMessage(paldrv, DRV_CLOSE, 0, 0);
1076  paldrv->dwDriverID = 0;
1077 
1078  if (paldrv->bSession)
1079  ERR("should not directly close session instance (%p)\n", paldrv);
1080 
1081  /* if driver has an opened session instance, we have to close it too */
1082  if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, &lpDrv0) == 1 &&
1083  lpDrv0->bSession)
1084  {
1085  MSACM_DRIVER_SendMessage(lpDrv0, DRV_CLOSE, 0L, 0L);
1086  lpDrv0->dwDriverID = 0;
1087  MSACM_RemoveFromList(lpDrv0);
1088  HeapFree(MSACM_hHeap, 0, lpDrv0);
1089  }
1090 
1091  HeapFree(MSACM_hHeap, 0, paldrv);
1092  return TRUE;
1093  }
1094  ERR("unable to close driver instance\n");
1095  return FALSE;
1096 }
#define TRUE
Definition: types.h:120
#define DRV_CLOSE
Definition: mmsystem.h:122
HANDLE MSACM_hHeap
Definition: internal.c:45
static BOOL MSACM_RemoveFromList(PWINE_ACMLOCALDRIVERINST lpDrv)
Definition: internal.c:941
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:913
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:62
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:859

Referenced by acmDriverClose(), and MSACM_OpenLocalDriver().

◆ MSACM_DisableNotifications()

void MSACM_DisableNotifications ( void  )

Definition at line 457 of file internal.c.

458 {
460 }
static DWORD MSACM_suspendBroadcastCount
Definition: internal.c:49

Referenced by acmDriverPriority().

◆ MSACM_EnableNotifications()

void MSACM_EnableNotifications ( void  )

Definition at line 465 of file internal.c.

466 {
467  if (MSACM_suspendBroadcastCount > 0) {
472  }
473  }
474 }
static BOOL MSACM_pendingBroadcast
Definition: internal.c:50
void MSACM_BroadcastNotification(void)
Definition: internal.c:441
static DWORD MSACM_suspendBroadcastCount
Definition: internal.c:49

Referenced by acmDriverPriority().

◆ MSACM_FillCache()

static BOOL MSACM_FillCache ( PWINE_ACMDRIVERID  padid)
static

Definition at line 132 of file internal.c.

133 {
134  HACMDRIVER had = 0;
135  unsigned int ntag;
138 
139  if (acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != 0)
140  return FALSE;
141 
142  padid->aFormatTag = NULL;
143  add.cbStruct = sizeof(add);
145  goto errCleanUp;
146 
147  if (add.cFormatTags > 0) {
148  padid->aFormatTag = HeapAlloc(MSACM_hHeap, HEAP_ZERO_MEMORY,
149  add.cFormatTags * sizeof(padid->aFormatTag[0]));
150  if (!padid->aFormatTag) goto errCleanUp;
151  }
152 
153  padid->cFormatTags = add.cFormatTags;
154  padid->cFilterTags = add.cFilterTags;
155  padid->fdwSupport = add.fdwSupport;
156 
157  aftd.cbStruct = sizeof(aftd);
158 
159  for (ntag = 0; ntag < add.cFormatTags; ntag++) {
160  aftd.dwFormatTagIndex = ntag;
162  TRACE("IIOs (%s)\n", debugstr_w(padid->pszDriverAlias));
163  goto errCleanUp;
164  }
165  padid->aFormatTag[ntag].dwFormatTag = aftd.dwFormatTag;
166  padid->aFormatTag[ntag].cbwfx = aftd.cbFormatSize;
167  }
168 
169  acmDriverClose(had, 0);
170 
171  return TRUE;
172 
173 errCleanUp:
174  if (had) acmDriverClose(had, 0);
175  HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
176  padid->aFormatTag = NULL;
177  return FALSE;
178 }
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:182
#define ACMDM_DRIVER_DETAILS
Definition: msacmdrv.h:46
#define debugstr_w
Definition: kernel32.h:32
HANDLE MSACM_hHeap
Definition: internal.c:45
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:494
MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
Definition: internal.c:865
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 116 of file internal.c.

117 {
118  unsigned i;
119 
120  for (i = 0; i < padid->cFormatTags; i++) {
121  if (padid->aFormatTag[i].dwFormatTag == fmtTag) {
122  if (idx) *idx = i;
123  return TRUE;
124  }
125  }
126  return FALSE;
127 }
#define TRUE
Definition: types.h:120
DWORD cFormatTags
Definition: wineacm.h:96
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
struct _WINE_ACMDRIVERID::@456 * aFormatTag
unsigned int idx
Definition: utils.c:41

Referenced by acmFormatTagDetailsW(), and acmStreamOpen().

◆ MSACM_GetDriver()

PWINE_ACMDRIVER MSACM_GetDriver ( HACMDRIVER  hDriver)

Definition at line 837 of file internal.c.

838 {
840 }
_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:816
#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 829 of file internal.c.

830 {
831  return (PWINE_ACMDRIVERID)MSACM_GetObj((HACMOBJ)hDriverID, WINE_ACMOBJ_DRIVERID);
832 }
#define WINE_ACMOBJ_DRIVERID
Definition: wineacm.h:36
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type)
Definition: internal.c:816

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

◆ MSACM_GetNotifyWnd()

PWINE_ACMNOTIFYWND MSACM_GetNotifyWnd ( HACMDRIVERID  hDriver)

Definition at line 845 of file internal.c.

846 {
848 }
_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:816
#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 913 of file internal.c.

914 {
915  PWINE_ACMLOCALDRIVER lpDrv;
916  unsigned count = 0;
917 
918  if (found) *found = NULL;
919  for (lpDrv = MSACM_pFirstACMLocalDriver; lpDrv; lpDrv = lpDrv->pNextACMLocalDrv)
920  {
921  if (lpDrv->hModule == hModule && lpDrv->lpDrvProc == lpDrvProc)
922  {
923  PWINE_ACMLOCALDRIVERINST pInst = lpDrv->pACMInstList;
924 
925  while (pInst) {
926  if (found && !*found) *found = pInst;
927  count++;
928  pInst = pInst->pNextACMInst;
929  }
930  }
931  }
932  return count;
933 }
static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
Definition: internal.c:734
GLuint GLuint GLsizei count
Definition: gl.h:1545
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:65
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 816 of file internal.c.

817 {
818  PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj;
819 
820  if (pao == NULL || IsBadReadPtr(pao, sizeof(WINE_ACMOBJ)) ||
821  ((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType)))
822  return NULL;
823  return pao;
824 }
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 183 of file internal.c.

184 {
185  static const WCHAR baseKey[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
186  'A','u','d','i','o','C','o','m','p','r','e','s','s','i','o','n','M','a','n','a','g','e','r','\\',
187  'D','r','i','v','e','r','C','a','c','h','e','\\','\0'};
188  LPWSTR ret;
189  int len;
190 
191  if (!padid->pszDriverAlias) {
192  ERR("No alias needed for registry entry\n");
193  return NULL;
194  }
195  len = strlenW(baseKey);
196  ret = HeapAlloc(MSACM_hHeap, 0, (len + strlenW(padid->pszDriverAlias) + 1) * sizeof(WCHAR));
197  if (!ret) return NULL;
198 
199  strcpyW(ret, baseKey);
200  strcpyW(ret + len, padid->pszDriverAlias);
201  CharLowerW(ret + len);
202  return ret;
203 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
HANDLE MSACM_hHeap
Definition: internal.c:45
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:88
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
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 865 of file internal.c.

866 {
868 
869  if (!pad) return MMSYSERR_INVALHANDLE;
870  if (pad->hDrvr) return SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2);
871  if (pad->pLocalDrvrInst) return MSACM_DRIVER_SendMessage(pad->pLocalDrvrInst, uMsg, lParam1, lParam2);
872 
873  return MMSYSERR_INVALHANDLE;
874 }
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, UINT msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:131
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
static void pad(Char *s)
Definition: bzip2.c:908
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
Definition: internal.c:837
#define MSACM_DRIVER_SendMessage(PDRVRINST, msg, lParam1, lParam2)
Definition: internal.c:859

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 1014 of file internal.c.

1015 {
1016  PWINE_ACMLOCALDRIVERINST pDrvInst;
1017 
1018  pDrvInst = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVERINST));
1019  if (!pDrvInst)
1020  return NULL;
1021 
1022  pDrvInst->pLocalDriver = paldrv;
1023  pDrvInst->dwDriverID = 0;
1024  pDrvInst->pNextACMInst = NULL;
1025  pDrvInst->bSession = FALSE;
1026 
1027  /* Win32 installable drivers must support a two phase opening scheme:
1028  * + first open with NULL as lParam2 (session instance),
1029  * + then do a second open with the real non null lParam2)
1030  */
1031  if (MSACM_GetNumberOfModuleRefs(paldrv->hModule, paldrv->lpDrvProc, NULL) == 0 && lParam2)
1032  {
1034 
1035  if (!MSACM_AddToList(pDrvInst, 0L))
1036  {
1037  ERR("load0 failed\n");
1038  goto exit;
1039  }
1040  ret = MSACM_OpenLocalDriver(paldrv, lParam2);
1041  if (!ret)
1042  {
1043  ERR("load1 failed\n");
1044  /* If MSACM_CloseLocalDriver returns TRUE,
1045  * then pDrvInst has been freed
1046  */
1047  if (!MSACM_CloseLocalDriver(pDrvInst))
1048  goto exit;
1049 
1050  return NULL;
1051  }
1052  pDrvInst->bSession = TRUE;
1053  return ret;
1054  }
1055 
1056  if (!MSACM_AddToList(pDrvInst, lParam2))
1057  {
1058  ERR("load failed\n");
1059  goto exit;
1060  }
1061 
1062  TRACE("=> %p\n", pDrvInst);
1063  return pDrvInst;
1064 exit:
1065  HeapFree(MSACM_hHeap, 0, pDrvInst);
1066  return NULL;
1067 }
#define TRUE
Definition: types.h:120
static BOOL MSACM_AddToList(PWINE_ACMLOCALDRIVERINST lpNewDrv, LPARAM lParam2)
Definition: internal.c:977
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:65
HANDLE MSACM_hHeap
Definition: internal.c:45
PWINE_ACMLOCALDRIVERINST MSACM_OpenLocalDriver(PWINE_ACMLOCALDRIVER paldrv, LPARAM lParam2)
Definition: internal.c:1014
smooth NULL
Definition: ftsmooth.c:416
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:913
#define TRACE(s)
Definition: solgame.cpp:4
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:62
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:1069
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 208 of file internal.c.

209 {
211  HKEY hKey;
212  DWORD type, size;
213 
214  if (!key) return FALSE;
215 
216  padid->aFormatTag = NULL;
217 
218  if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
219  goto errCleanUp;
220 
221  size = sizeof(padid->cFormatTags);
222  if (RegQueryValueExA(hKey, "cFormatTags", 0, &type, (void*)&padid->cFormatTags, &size))
223  goto errCleanUp;
224  size = sizeof(padid->cFilterTags);
225  if (RegQueryValueExA(hKey, "cFilterTags", 0, &type, (void*)&padid->cFilterTags, &size))
226  goto errCleanUp;
227  size = sizeof(padid->fdwSupport);
228  if (RegQueryValueExA(hKey, "fdwSupport", 0, &type, (void*)&padid->fdwSupport, &size))
229  goto errCleanUp;
230 
231  if (padid->cFormatTags > 0) {
232  size = padid->cFormatTags * sizeof(padid->aFormatTag[0]);
234  if (!padid->aFormatTag) goto errCleanUp;
235  if (RegQueryValueExA(hKey, "aFormatTagCache", 0, &type, (void*)padid->aFormatTag, &size))
236  goto errCleanUp;
237  }
238  HeapFree(MSACM_hHeap, 0, key);
239  return TRUE;
240 
241  errCleanUp:
242  HeapFree(MSACM_hHeap, 0, key);
243  HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
244  padid->aFormatTag = NULL;
245  RegCloseKey(hKey);
246  return FALSE;
247 }
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:97
#define TRUE
Definition: types.h:120
DWORD cFormatTags
Definition: wineacm.h:96
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD cFilterTags
Definition: wineacm.h:95
struct _WINE_ACMDRIVERID::@456 * aFormatTag
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
HANDLE MSACM_hHeap
Definition: internal.c:45
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
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID *padid)
Definition: internal.c:183
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 352 of file internal.c.

353 {
354  static const WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
355  static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
356  static const WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
357  static const WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
358  static const WCHAR drvkey[] = {'S','o','f','t','w','a','r','e','\\',
359  'M','i','c','r','o','s','o','f','t','\\',
360  'W','i','n','d','o','w','s',' ','N','T','\\',
361  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
362  'D','r','i','v','e','r','s','3','2','\0'};
363  DWORD i, cnt, bufLen, lRet, type;
364  WCHAR buf[2048], valname[64], *name, *s;
365  FILETIME lastWrite;
366  HKEY hKey;
367 
368  /* FIXME: What if the user edits system.ini while the program is running?
369  * Does Windows handle that? */
370  if (MSACM_pFirstACMDriverID) return;
371 
372  lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
373  if (lRet == ERROR_SUCCESS) {
374  RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
375  for (i = 0; i < cnt; i++) {
376  bufLen = ARRAY_SIZE(buf);
377  lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
378  if (lRet != ERROR_SUCCESS) continue;
379  if (strncmpiW(buf, msacmW, ARRAY_SIZE(msacmW))) continue;
380  if (!(name = strchrW(buf, '='))) continue;
381  *name = 0;
382  MSACM_RegisterDriver(buf, name + 1, 0);
383  }
384  i = 0;
385  cnt = ARRAY_SIZE(valname);
386  bufLen = sizeof(buf);
387  while(RegEnumValueW(hKey, i, valname, &cnt, 0,
388  &type, (BYTE*)buf, &bufLen) == ERROR_SUCCESS){
389  if (!strncmpiW(valname, msacmW, ARRAY_SIZE(msacmW)))
390  MSACM_RegisterDriver(valname, buf, 0);
391  ++i;
392  }
393  RegCloseKey( hKey );
394  }
395 
396  if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys))
397  {
398  for(s = buf; *s; s += strlenW(s) + 1)
399  {
400  if (strncmpiW(s, msacmW, ARRAY_SIZE(msacmW))) continue;
401  if (!(name = strchrW(s, '='))) continue;
402  *name = 0;
403  MSACM_RegisterDriver(s, name + 1, 0);
404  *name = '=';
405  }
406  }
408  MSACM_RegisterDriver(msacm32, msacm32, 0);
409 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
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
__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:283
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:46
unsigned char BYTE
Definition: mem.h:68
GLdouble s
Definition: gl.h:2039
static void MSACM_ReorderDriversByPriority(void)
Definition: internal.c:554
#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 283 of file internal.c.

285 {
286  PWINE_ACMDRIVERID padid;
287 
288  TRACE("(%s, %s, %p)\n",
289  debugstr_w(pszDriverAlias), debugstr_w(pszFileName), pLocalDriver);
290 
291  padid = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
292  if (!padid)
293  return NULL;
295  padid->obj.pACMDriverID = padid;
296  padid->pszDriverAlias = NULL;
297  if (pszDriverAlias)
298  {
299  padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
300  if (!padid->pszDriverAlias) {
301  HeapFree(MSACM_hHeap, 0, padid);
302  return NULL;
303  }
304  strcpyW( padid->pszDriverAlias, pszDriverAlias );
305  }
306  padid->pszFileName = NULL;
307  if (pszFileName)
308  {
309  padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) );
310  if (!padid->pszFileName) {
311  HeapFree(MSACM_hHeap, 0, padid->pszDriverAlias);
312  HeapFree(MSACM_hHeap, 0, padid);
313  return NULL;
314  }
315  strcpyW( padid->pszFileName, pszFileName );
316  }
317  padid->pLocalDriver = pLocalDriver;
318 
319  padid->pACMDriverList = NULL;
320 
321  if (pLocalDriver) {
322  padid->pPrevACMDriverID = NULL;
326  MSACM_pFirstACMDriverID = padid;
328  MSACM_pLastACMDriverID = padid;
329  } else {
330  padid->pNextACMDriverID = NULL;
334  MSACM_pLastACMDriverID = padid;
336  MSACM_pFirstACMDriverID = padid;
337  }
338  /* disable the driver if we cannot load the cache */
339  if ((!padid->pszDriverAlias || !MSACM_ReadCache(padid)) && !MSACM_FillCache(padid)) {
340  WARN("Couldn't load cache for ACM driver (%s)\n", debugstr_w(pszFileName));
341  MSACM_UnregisterDriver(padid);
342  return NULL;
343  }
344 
345  if (pLocalDriver) padid->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_LOCAL;
346  return padid;
347 }
DWORD fdwSupport
Definition: wineacm.h:97
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
WINE_ACMOBJ obj
Definition: wineacm.h:87
static BOOL MSACM_FillCache(PWINE_ACMDRIVERID padid)
Definition: internal.c:132
#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:766
PWINE_ACMDRIVERID pPrevACMDriverID
Definition: wineacm.h:93
static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid)
Definition: internal.c:208
#define debugstr_w
Definition: kernel32.h:32
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:41
HANDLE MSACM_hHeap
Definition: internal.c:45
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:92
#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:88
PWINE_ACMDRIVER pACMDriverList
Definition: wineacm.h:91
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:90
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:46
#define ACMDRIVERDETAILS_SUPPORTF_LOCAL
Definition: msacm.h:66
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
LPWSTR pszFileName
Definition: wineacm.h:89
#define HeapFree(x, y, z)
Definition: compat.h:394
static PWINE_ACMDRIVERID MSACM_pLastACMDriverID
Definition: internal.c:47

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

◆ MSACM_RegisterDriverFromRegistry()

PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry ( LPCWSTR  pszRegEntry)

Definition at line 59 of file internal.c.

60 {
61  static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
62  static const WCHAR drvkey[] = {'S','o','f','t','w','a','r','e','\\',
63  'M','i','c','r','o','s','o','f','t','\\',
64  'W','i','n','d','o','w','s',' ','N','T','\\',
65  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
66  'D','r','i','v','e','r','s','3','2','\0'};
67  WCHAR buf[2048];
68  DWORD bufLen, lRet;
69  HKEY hKey;
70  PWINE_ACMDRIVERID padid = NULL;
71 
72  /* The requested registry entry must have the format msacm.XXXXX in order to
73  be recognized in any future sessions of msacm
74  */
75  if (0 == strncmpiW(pszRegEntry, msacmW, ARRAY_SIZE(msacmW))) {
76  lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
77  if (lRet != ERROR_SUCCESS) {
78  WARN("unable to open registry key - 0x%08x\n", lRet);
79  } else {
80  bufLen = sizeof(buf);
81  lRet = RegQueryValueExW(hKey, pszRegEntry, NULL, NULL, (LPBYTE)buf, &bufLen);
82  if (lRet != ERROR_SUCCESS) {
83  WARN("unable to query requested subkey %s - 0x%08x\n", debugstr_w(pszRegEntry), lRet);
84  } else {
85  MSACM_RegisterDriver(pszRegEntry, buf, 0);
86  }
87  RegCloseKey( hKey );
88  }
89  }
90  return padid;
91 }
#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
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
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:283
#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 876 of file internal.c.

877 {
878  PWINE_ACMLOCALDRIVER paldrv;
879 
880  TRACE("(%p, %p)\n", hModule, lpDriverProc);
881  if (!hModule || !lpDriverProc) return NULL;
882 
883  /* look up previous instance of local driver module */
884  for (paldrv = MSACM_pFirstACMLocalDriver; paldrv; paldrv = paldrv->pNextACMLocalDrv)
885  {
886  if (paldrv->hModule == hModule && paldrv->lpDrvProc == lpDriverProc) return paldrv;
887  }
888 
889  paldrv = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMLOCALDRIVER));
891  paldrv->obj.pACMDriverID = 0;
892  paldrv->hModule = hModule;
893  paldrv->lpDrvProc = lpDriverProc;
894  paldrv->pACMInstList = NULL;
895 
896  paldrv->pNextACMLocalDrv = NULL;
900  MSACM_pLastACMLocalDriver = paldrv;
903 
904  return paldrv;
905 }
static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
Definition: internal.c:734
static PWINE_ACMLOCALDRIVER MSACM_pLastACMLocalDriver
Definition: internal.c:735
PWINE_ACMDRIVERID pACMDriverID
Definition: wineacm.h:45
DWORD dwType
Definition: wineacm.h:44
HANDLE MSACM_hHeap
Definition: internal.c:45
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 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 414 of file internal.c.

415 {
416  PWINE_ACMNOTIFYWND panwnd;
417 
418  TRACE("(%p,0x%08x)\n", hNotifyWnd, dwNotifyMsg);
419 
420  panwnd = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMNOTIFYWND));
421  panwnd->obj.dwType = WINE_ACMOBJ_NOTIFYWND;
422  panwnd->obj.pACMDriverID = 0;
423  panwnd->hNotifyWnd = hNotifyWnd;
424  panwnd->dwNotifyMsg = dwNotifyMsg;
425  panwnd->fdwSupport = 0;
426 
427  panwnd->pNextACMNotifyWnd = NULL;
431  MSACM_pLastACMNotifyWnd = panwnd;
433  MSACM_pFirstACMNotifyWnd = panwnd;
434 
435  return panwnd;
436 }
PWINE_ACMNOTIFYWND pNextACMNotifyWnd
Definition: wineacm.h:111
PWINE_ACMDRIVERID pACMDriverID
Definition: wineacm.h:45
DWORD dwType
Definition: wineacm.h:44
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:51
HANDLE MSACM_hHeap
Definition: internal.c:45
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:52
WINE_ACMOBJ obj
Definition: wineacm.h:107
PWINE_ACMNOTIFYWND pPrevACMNotifyWnd
Definition: wineacm.h:112

Referenced by acmDriverAddW().

◆ MSACM_RemoveFromList()

static BOOL MSACM_RemoveFromList ( PWINE_ACMLOCALDRIVERINST  lpDrv)
static

Definition at line 941 of file internal.c.

942 {
943  PWINE_ACMLOCALDRIVER pDriverBase = lpDrv->pLocalDriver;
944  PWINE_ACMLOCALDRIVERINST pPrevInst;
945 
946  /* last of this driver in list ? */
947  if (MSACM_GetNumberOfModuleRefs(pDriverBase->hModule, pDriverBase->lpDrvProc, NULL) == 1) {
949  MSACM_DRIVER_SendMessage(lpDrv, DRV_FREE, 0L, 0L);
950  }
951 
952  pPrevInst = NULL;
953  if (pDriverBase->pACMInstList != lpDrv) {
954  pPrevInst = pDriverBase->pACMInstList;
955  while (pPrevInst && pPrevInst->pNextACMInst != lpDrv)
956  pPrevInst = pPrevInst->pNextACMInst;
957  if (!pPrevInst) {
958  ERR("requested to remove invalid instance %p\n", pPrevInst);
959  return FALSE;
960  }
961  }
962  if (!pPrevInst) {
963  /* first driver instance on list */
964  pDriverBase->pACMInstList = lpDrv->pNextACMInst;
965  } else {
966  pPrevInst->pNextACMInst = lpDrv->pNextACMInst;
967  }
968  return TRUE;
969 }
#define DRV_DISABLE
Definition: mmsystem.h:123
#define TRUE
Definition: types.h:120
PWINE_ACMLOCALDRIVERINST pNextACMInst
Definition: wineacm.h:65
smooth NULL
Definition: ftsmooth.c:416
static unsigned MSACM_GetNumberOfModuleRefs(HMODULE hModule, DRIVERPROC lpDrvProc, WINE_ACMLOCALDRIVERINST **found)
Definition: internal.c:913
#define DRV_FREE
Definition: mmsystem.h:124
PWINE_ACMLOCALDRIVER pLocalDriver
Definition: wineacm.h:62
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:859

Referenced by MSACM_AddToList(), and MSACM_CloseLocalDriver().

◆ MSACM_ReorderDriversByPriority()

static void MSACM_ReorderDriversByPriority ( void  )
static

Definition at line 554 of file internal.c.

555 {
556  PWINE_ACMDRIVERID padid;
557  unsigned int iNumDrivers;
558  PWINE_ACMDRIVERID * driverList = NULL;
559  HKEY hPriorityKey = NULL;
560 
561  TRACE("\n");
562 
563  /* Count drivers && alloc corresponding memory for list */
564  iNumDrivers = 0;
565  for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) iNumDrivers++;
566  if (iNumDrivers > 1)
567  {
568  LONG lError;
569  static const WCHAR basePriorityKey[] = {
570  'S','o','f','t','w','a','r','e','\\',
571  'M','i','c','r','o','s','o','f','t','\\',
572  'M','u','l','t','i','m','e','d','i','a','\\',
573  'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
574  'P','r','i','o','r','i','t','y',' ','v','4','.','0','0','\0'
575  };
576  unsigned int i;
577  LONG lBufferLength;
578  WCHAR szBuffer[256];
579 
580  driverList = HeapAlloc(MSACM_hHeap, 0, iNumDrivers * sizeof(PWINE_ACMDRIVERID));
581  if (!driverList)
582  {
583  ERR("out of memory\n");
584  goto errCleanUp;
585  }
586 
587  lError = RegOpenKeyW(HKEY_CURRENT_USER, basePriorityKey, &hPriorityKey);
588  if (lError != ERROR_SUCCESS) {
589  TRACE("RegOpenKeyW failed, possibly key does not exist yet\n");
590  hPriorityKey = NULL;
591  goto errCleanUp;
592  }
593 
594  /* Copy drivers into list to simplify linked list modification */
595  for (i = 0, padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID, i++)
596  {
597  driverList[i] = padid;
598  }
599 
600  /* Query each of the priorities in turn. Alias key is in lowercase.
601  The general form of the priority record is the following:
602  "PriorityN" --> "1, msacm.driveralias"
603  where N is an integer, and the value is a string of the driver
604  alias, prefixed by "1, " for an enabled driver, or "0, " for a
605  disabled driver.
606  */
607  for (i = 0; i < iNumDrivers; i++)
608  {
609  static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
610  WCHAR szSubKey[17];
611  unsigned int iTargetPosition;
612  unsigned int iCurrentPosition;
613  WCHAR * pAlias;
614  static const WCHAR sPrefix[] = {'m','s','a','c','m','.','\0'};
615 
616  /* Build expected entry name */
617  snprintfW(szSubKey, 17, priorityTmpl, i + 1);
618  lBufferLength = sizeof(szBuffer);
619  lError = RegQueryValueExW(hPriorityKey, szSubKey, NULL, NULL, (LPBYTE)szBuffer, (LPDWORD)&lBufferLength);
620  if (lError != ERROR_SUCCESS) continue;
621 
622  /* Recovered driver alias should be at this position */
623  iTargetPosition = i;
624 
625  /* Locate driver alias in driver list */
626  pAlias = strstrW(szBuffer, sPrefix);
627  if (pAlias == NULL) continue;
628 
629  for (iCurrentPosition = 0; iCurrentPosition < iNumDrivers; iCurrentPosition++) {
630  if (strcmpiW(driverList[iCurrentPosition]->pszDriverAlias, pAlias) == 0)
631  break;
632  }
633  if (iCurrentPosition < iNumDrivers && iTargetPosition != iCurrentPosition) {
634  padid = driverList[iTargetPosition];
635  driverList[iTargetPosition] = driverList[iCurrentPosition];
636  driverList[iCurrentPosition] = padid;
637 
638  /* Locate enabled status */
639  if (szBuffer[0] == '1') {
640  driverList[iTargetPosition]->fdwSupport &= ~ACMDRIVERDETAILS_SUPPORTF_DISABLED;
641  } else if (szBuffer[0] == '0') {
642  driverList[iTargetPosition]->fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
643  }
644  }
645  }
646 
647  /* Re-assign pointers so that linked list traverses the ordered array */
648  for (i = 0; i < iNumDrivers; i++) {
649  driverList[i]->pPrevACMDriverID = (i > 0) ? driverList[i - 1] : NULL;
650  driverList[i]->pNextACMDriverID = (i < iNumDrivers - 1) ? driverList[i + 1] : NULL;
651  }
652  MSACM_pFirstACMDriverID = driverList[0];
653  MSACM_pLastACMDriverID = driverList[iNumDrivers - 1];
654  }
655 
656 errCleanUp:
657  if (hPriorityKey != NULL) RegCloseKey(hPriorityKey);
658  HeapFree(MSACM_hHeap, 0, driverList);
659 }
DWORD fdwSupport
Definition: wineacm.h:97
#define snprintfW
Definition: unicode.h:60
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
PWINE_ACMDRIVERID pPrevACMDriverID
Definition: wineacm.h:93
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:45
#define strstrW(d, s)
Definition: unicode.h:32
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:92
#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
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:46
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#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:47

Referenced by MSACM_RegisterAllDrivers().

◆ MSACM_RePositionDriver()

void MSACM_RePositionDriver ( PWINE_ACMDRIVERID  padid,
DWORD  dwPriority 
)

Definition at line 502 of file internal.c.

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

Referenced by acmDriverPriority().

◆ MSACM_UnregisterAllDrivers()

void MSACM_UnregisterAllDrivers ( void  )

Definition at line 798 of file internal.c.

799 {
802 
803  while (p) {
806  }
807 
808  while (panwnd) {
809  panwnd = MSACM_UnRegisterNotificationWindow(panwnd);
810  }
811 }
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
Definition: internal.c:766
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:51
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:46
PWINE_ACMNOTIFYWND MSACM_UnRegisterNotificationWindow(const WINE_ACMNOTIFYWND *panwnd)
Definition: internal.c:479
static BOOL MSACM_WriteCache(const WINE_ACMDRIVERID *padid)
Definition: internal.c:252
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by DllMain().

◆ MSACM_UnregisterDriver()

PWINE_ACMDRIVERID MSACM_UnregisterDriver ( PWINE_ACMDRIVERID  p)

Definition at line 766 of file internal.c.

767 {
768  PWINE_ACMDRIVERID pNextACMDriverID;
769 
770  while (p->pACMDriverList)
771  acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
772 
773  HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
774  HeapFree(MSACM_hHeap, 0, p->pszFileName);
775  HeapFree(MSACM_hHeap, 0, p->aFormatTag);
776 
777  if (p == MSACM_pFirstACMDriverID)
779  if (p == MSACM_pLastACMDriverID)
781 
782  if (p->pPrevACMDriverID)
784  if (p->pNextACMDriverID)
786 
787  pNextACMDriverID = p->pNextACMDriverID;
788 
789  if (p->pLocalDriver) MSACM_UnregisterLocalDriver(p->pLocalDriver);
790  HeapFree(MSACM_hHeap, 0, p);
791 
792  return pNextACMDriverID;
793 }
PWINE_ACMDRIVERID pPrevACMDriverID
Definition: wineacm.h:93
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
Definition: driver.c:182
HANDLE MSACM_hHeap
Definition: internal.c:45
static PWINE_ACMLOCALDRIVER MSACM_UnregisterLocalDriver(PWINE_ACMLOCALDRIVER paldrv)
Definition: internal.c:737
PWINE_ACMDRIVERID pNextACMDriverID
Definition: wineacm.h:92
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:46
GLfloat GLfloat p
Definition: glext.h:8902
#define HeapFree(x, y, z)
Definition: compat.h:394
static PWINE_ACMDRIVERID MSACM_pLastACMDriverID
Definition: internal.c:47

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

◆ MSACM_UnregisterLocalDriver()

static PWINE_ACMLOCALDRIVER MSACM_UnregisterLocalDriver ( PWINE_ACMLOCALDRIVER  paldrv)
static

Definition at line 737 of file internal.c.

738 {
739  PWINE_ACMLOCALDRIVER pNextACMLocalDriver;
740 
741  if (paldrv->pACMInstList) {
742  ERR("local driver instances still present after closing all drivers - memory leak\n");
743  return NULL;
744  }
745 
746  if (paldrv == MSACM_pFirstACMLocalDriver)
748  if (paldrv == MSACM_pLastACMLocalDriver)
750 
751  if (paldrv->pPrevACMLocalDrv)
753  if (paldrv->pNextACMLocalDrv)
755 
756  pNextACMLocalDriver = paldrv->pNextACMLocalDrv;
757 
758  HeapFree(MSACM_hHeap, 0, paldrv);
759 
760  return pNextACMLocalDriver;
761 }
static PWINE_ACMLOCALDRIVER MSACM_pFirstACMLocalDriver
Definition: internal.c:734
static PWINE_ACMLOCALDRIVER MSACM_pLastACMLocalDriver
Definition: internal.c:735
HANDLE MSACM_hHeap
Definition: internal.c:45
smooth NULL
Definition: ftsmooth.c:416
PWINE_ACMLOCALDRIVER pPrevACMLocalDrv
Definition: wineacm.h:57
PWINE_ACMLOCALDRIVER pNextACMLocalDrv
Definition: wineacm.h:56
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 479 of file internal.c.

480 {
482 
483  for (p = MSACM_pFirstACMNotifyWnd; p; p = p->pNextACMNotifyWnd) {
484  if (p == panwnd) {
486 
487  if (p->pPrevACMNotifyWnd) p->pPrevACMNotifyWnd->pNextACMNotifyWnd = p->pNextACMNotifyWnd;
488  if (p->pNextACMNotifyWnd) p->pNextACMNotifyWnd->pPrevACMNotifyWnd = p->pPrevACMNotifyWnd;
491  HeapFree(MSACM_hHeap, 0, p);
492 
493  return pNext;
494  }
495  }
496  return NULL;
497 }
PWINE_ACMNOTIFYWND pNextACMNotifyWnd
Definition: wineacm.h:111
static PWINE_ACMNOTIFYWND MSACM_pFirstACMNotifyWnd
Definition: internal.c:51
HANDLE MSACM_hHeap
Definition: internal.c:45
smooth NULL
Definition: ftsmooth.c:416
static PWINE_ACMNOTIFYWND MSACM_pLastACMNotifyWnd
Definition: internal.c:52
GLfloat GLfloat p
Definition: glext.h:8902
#define HeapFree(x, y, z)
Definition: compat.h:394
PWINE_ACMNOTIFYWND pPrevACMNotifyWnd
Definition: wineacm.h:112

Referenced by acmDriverRemove(), and MSACM_UnregisterAllDrivers().

◆ MSACM_WriteCache()

static BOOL MSACM_WriteCache ( const WINE_ACMDRIVERID padid)
static

Definition at line 252 of file internal.c.

253 {
255  HKEY hKey;
256 
257  if (!key) return FALSE;
258 
259  if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
260  goto errCleanUp;
261 
262  if (RegSetValueExA(hKey, "cFormatTags", 0, REG_DWORD, (const void*)&padid->cFormatTags, sizeof(DWORD)))
263  goto errCleanUp;
264  if (RegSetValueExA(hKey, "cFilterTags", 0, REG_DWORD, (const void*)&padid->cFilterTags, sizeof(DWORD)))
265  goto errCleanUp;
266  if (RegSetValueExA(hKey, "fdwSupport", 0, REG_DWORD, (const void*)&padid->fdwSupport, sizeof(DWORD)))
267  goto errCleanUp;
268  if (RegSetValueExA(hKey, "aFormatTagCache", 0, REG_BINARY,
269  (void*)padid->aFormatTag,
270  padid->cFormatTags * sizeof(padid->aFormatTag[0])))
271  goto errCleanUp;
272  HeapFree(MSACM_hHeap, 0, key);
273  return TRUE;
274 
275  errCleanUp:
276  HeapFree(MSACM_hHeap, 0, key);
277  return FALSE;
278 }
DWORD fdwSupport
Definition: wineacm.h:97
#define TRUE
Definition: types.h:120
#define REG_BINARY
Definition: nt_native.h:1496
DWORD cFormatTags
Definition: wineacm.h:96
DWORD cFilterTags
Definition: wineacm.h:95
struct _WINE_ACMDRIVERID::@456 * aFormatTag
HANDLE MSACM_hHeap
Definition: internal.c:45
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID *padid)
Definition: internal.c:183
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 666 of file internal.c.

667 {
668  LONG lError;
669  HKEY hPriorityKey;
670  static const WCHAR basePriorityKey[] = {
671  'S','o','f','t','w','a','r','e','\\',
672  'M','i','c','r','o','s','o','f','t','\\',
673  'M','u','l','t','i','m','e','d','i','a','\\',
674  'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
675  'P','r','i','o','r','i','t','y',' ','v','4','.','0','0','\0'
676  };
677  PWINE_ACMDRIVERID padid;
678  DWORD dwPriorityCounter;
679  static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
680  static const WCHAR valueTmpl[] = {'%','c',',',' ','%','s','\0'};
681  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'};
682  WCHAR szSubKey[17];
683  WCHAR szBuffer[256];
684 
685  /* Delete ACM priority key and create it anew */
686  lError = RegDeleteKeyW(HKEY_CURRENT_USER, basePriorityKey);
687  if (lError != ERROR_SUCCESS && lError != ERROR_FILE_NOT_FOUND) {
688  ERR("unable to remove current key %s (0x%08x) - priority changes won't persist past application end.\n",
689  debugstr_w(basePriorityKey), lError);
690  return;
691  }
692  lError = RegCreateKeyW(HKEY_CURRENT_USER, basePriorityKey, &hPriorityKey);
693  if (lError != ERROR_SUCCESS) {
694  ERR("unable to create key %s (0x%08x) - priority changes won't persist past application end.\n",
695  debugstr_w(basePriorityKey), lError);
696  return;
697  }
698 
699  /* Write current list of priorities */
700  for (dwPriorityCounter = 0, padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
701  if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL) continue;
702  if (padid->pszDriverAlias == NULL) continue; /* internal PCM converter is last */
703 
704  /* Build required value name */
705  dwPriorityCounter++;
706  snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter);
707 
708  /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
709  snprintfW(szBuffer, 256, valueTmpl, (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias);
710  strlwrW(szBuffer);
711 
712  lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR));
713  if (lError != ERROR_SUCCESS) {
714  ERR("unable to write value for %s under key %s (0x%08x)\n",
715  debugstr_w(padid->pszDriverAlias), debugstr_w(basePriorityKey), lError);
716  }
717  }
718 
719  /* Build required value name */
720  dwPriorityCounter++;
721  snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter);
722 
723  /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
724  snprintfW(szBuffer, 256, valueTmpl, '1', converterAlias);
725 
726  lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR));
727  if (lError != ERROR_SUCCESS) {
728  ERR("unable to write value for %s under key %s (0x%08x)\n",
729  debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError);
730  }
731  RegCloseKey(hPriorityKey);
732 }
DWORD fdwSupport
Definition: wineacm.h:97
#define snprintfW
Definition: unicode.h:60
WINE_UNICODE_INLINE WCHAR * strlwrW(WCHAR *str)
Definition: unicode.h:281
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#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
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:92
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
LPWSTR pszDriverAlias
Definition: wineacm.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID
Definition: internal.c:46
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
#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 50 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 735 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