ReactOS  0.4.14-dev-368-gfa26425
winemm.h File Reference
#include <wine/config.h>
#include <assert.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <winreg.h>
#include <mmddk.h>
#include <wine/debug.h>
#include <wine/exception.h>
#include <wine/unicode.h>
Include dependency graph for winemm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagWINE_DRIVER
 
struct  tagWINE_MM_DRIVER_PART
 
struct  tagWINE_MM_DRIVER
 
struct  tagWINE_MLD
 
struct  WINE_WAVE
 
struct  WINE_MIDI
 
struct  WINE_MIXER
 
struct  tagWINE_MCIDRIVER
 
struct  IOProcList
 
struct  tagWINE_MMIO
 

Macros

#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NONAMELESSUNION
 
#define NONAMELESSSTRUCT
 
#define WINE_DEFAULT_WINMM_DRIVER   "alsa,oss,coreaudio,esd"
 
#define WINE_DEFAULT_WINMM_MAPPER   "msacm32.drv"
 
#define WINE_DEFAULT_WINMM_MIDI   "midimap.dll"
 
#define WINE_DI_MAGIC   0x900F1B01
 
#define MMDRV_AUX   0
 
#define MMDRV_MIXER   1
 
#define MMDRV_MIDIIN   2
 
#define MMDRV_MIDIOUT   3
 
#define MMDRV_WAVEIN   4
 
#define MMDRV_WAVEOUT   5
 
#define MMDRV_MAX   6
 
#define WINE_GDF_EXIST   0x80000000
 
#define WINE_GDF_EXTERNAL_MASK   0xF0000000
 
#define WINE_GDF_SESSION   0x00000001
 
#define NT_MME_DRIVERS32_KEY   "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32"
 
#define NT_MME_DRIVERS_KEY   "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers"
 

Typedefs

typedef struct tagWINE_DRIVER WINE_DRIVER
 
typedef struct tagWINE_DRIVERLPWINE_DRIVER
 
typedef DWORD(CALLBACKWINEMM_msgFunc32) (UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR)
 
typedef struct tagWINE_MM_DRIVER_PART WINE_MM_DRIVER_PART
 
typedef struct tagWINE_MM_DRIVER WINE_MM_DRIVER
 
typedef struct tagWINE_MM_DRIVERLPWINE_MM_DRIVER
 
typedef struct tagWINE_MLD WINE_MLD
 
typedef struct tagWINE_MLDLPWINE_MLD
 
typedef struct WINE_WAVELPWINE_WAVE
 
typedef struct WINE_MIDILPWINE_MIDI
 
typedef struct WINE_MIXERLPWINE_MIXER
 
typedef struct tagWINE_MCIDRIVER WINE_MCIDRIVER
 
typedef struct tagWINE_MCIDRIVERLPWINE_MCIDRIVER
 
typedef struct tagWINE_MMIO WINE_MMIO
 
typedef struct tagWINE_MMIOLPWINE_MMIO
 

Functions

BOOL WINMM_CheckForMMSystem (void)
 
LPWINE_DRIVER DRIVER_FindFromHDrvr (HDRVR hDrvr)
 
BOOL DRIVER_GetLibName (LPCWSTR keyName, LPCWSTR sectName, LPWSTR buf, int sz)
 
LPWINE_DRIVER DRIVER_TryOpenDriver32 (LPCWSTR fn, LPARAM lParam2)
 
void DRIVER_UnloadAll (void)
 
HDRVR WINAPI OpenDriverA (LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam)
 
BOOL MMDRV_Install (LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper)
 
BOOL LoadRegistryMMEDrivers (char *key)
 
BOOL MMDRV_Init (void)
 
void MMDRV_Exit (void)
 
UINT MMDRV_GetNum (UINT)
 
LPWINE_MLD MMDRV_Alloc (UINT size, UINT type, LPHANDLE hndl, DWORD *dwFlags, DWORD_PTR *dwCallback, DWORD_PTR *dwInstance)
 
void MMDRV_Free (HANDLE hndl, LPWINE_MLD mld)
 
DWORD MMDRV_Open (LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwParam2)
 
DWORD MMDRV_Close (LPWINE_MLD mld, UINT wMsg)
 
LPWINE_MLD MMDRV_Get (HANDLE hndl, UINT type, BOOL bCanBeID)
 
LPWINE_MLD MMDRV_GetRelated (HANDLE hndl, UINT srcType, BOOL bSrcCanBeID, UINT dstTyped)
 
DWORD MMDRV_Message (LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
UINT MMDRV_PhysicalFeatures (LPWINE_MLD mld, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
const charMCI_MessageToString (UINT wMsg)
 
DWORD MCI_SendCommand (UINT wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
LPWSTR MCI_strdupAtoW (LPCSTR str)
 
LPSTR MCI_strdupWtoA (LPCWSTR str)
 
const charWINMM_ErrorToString (MMRESULT error)
 
void TIME_MMTimeStop (void)
 
MMRESULT WINMM_CheckCallback (DWORD_PTR dwCallback, DWORD fdwOpen, BOOL mixer) DECLSPEC_HIDDEN
 

Variables

CRITICAL_SECTION WINMM_cs
 
HINSTANCE hWinMM32Instance
 
HANDLE psLastEvent
 
HANDLE psStopEvent
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 30 of file winemm.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 31 of file winemm.h.

◆ MMDRV_AUX

#define MMDRV_AUX   0

Definition at line 76 of file winemm.h.

◆ MMDRV_MAX

#define MMDRV_MAX   6

Definition at line 82 of file winemm.h.

◆ MMDRV_MIDIIN

#define MMDRV_MIDIIN   2

Definition at line 78 of file winemm.h.

◆ MMDRV_MIDIOUT

#define MMDRV_MIDIOUT   3

Definition at line 79 of file winemm.h.

◆ MMDRV_MIXER

#define MMDRV_MIXER   1

Definition at line 77 of file winemm.h.

◆ MMDRV_WAVEIN

#define MMDRV_WAVEIN   4

Definition at line 80 of file winemm.h.

◆ MMDRV_WAVEOUT

#define MMDRV_WAVEOUT   5

Definition at line 81 of file winemm.h.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 34 of file winemm.h.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 33 of file winemm.h.

◆ NT_MME_DRIVERS32_KEY

#define NT_MME_DRIVERS32_KEY   "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32"

Definition at line 200 of file winemm.h.

◆ NT_MME_DRIVERS_KEY

#define NT_MME_DRIVERS_KEY   "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers"

Definition at line 203 of file winemm.h.

◆ WINE_DEFAULT_WINMM_DRIVER

#define WINE_DEFAULT_WINMM_DRIVER   "alsa,oss,coreaudio,esd"

Definition at line 46 of file winemm.h.

◆ WINE_DEFAULT_WINMM_MAPPER

#define WINE_DEFAULT_WINMM_MAPPER   "msacm32.drv"

Definition at line 47 of file winemm.h.

◆ WINE_DEFAULT_WINMM_MIDI

#define WINE_DEFAULT_WINMM_MIDI   "midimap.dll"

Definition at line 48 of file winemm.h.

◆ WINE_DI_MAGIC

#define WINE_DI_MAGIC   0x900F1B01

Definition at line 51 of file winemm.h.

◆ WINE_GDF_EXIST

#define WINE_GDF_EXIST   0x80000000

Definition at line 193 of file winemm.h.

◆ WINE_GDF_EXTERNAL_MASK

#define WINE_GDF_EXTERNAL_MASK   0xF0000000

Definition at line 194 of file winemm.h.

◆ WINE_GDF_SESSION

#define WINE_GDF_SESSION   0x00000001

Definition at line 195 of file winemm.h.

Typedef Documentation

◆ LPWINE_DRIVER

◆ LPWINE_MCIDRIVER

◆ LPWINE_MIDI

◆ LPWINE_MIXER

◆ LPWINE_MLD

◆ LPWINE_MM_DRIVER

◆ LPWINE_MMIO

◆ LPWINE_WAVE

◆ WINE_DRIVER

◆ WINE_MCIDRIVER

◆ WINE_MLD

◆ WINE_MM_DRIVER

◆ WINE_MM_DRIVER_PART

◆ WINE_MMIO

◆ WINEMM_msgFunc32

typedef DWORD(CALLBACK * WINEMM_msgFunc32) (UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR)

Definition at line 65 of file winemm.h.

Function Documentation

◆ DRIVER_FindFromHDrvr()

LPWINE_DRIVER DRIVER_FindFromHDrvr ( HDRVR  hDrvr)

Definition at line 89 of file driver.c.

90 {
92 
93  __TRY
94  {
95  d = (LPWINE_DRIVER)hDrvr;
96  if (d && d->dwMagic != WINE_DI_MAGIC) d = NULL;
97  }
99  {
100  return NULL;
101  }
102  __ENDTRY;
103 
104  if (d) TRACE("%p -> %p, %p\n", hDrvr, d->lpDrvProc, (void *)d->dwDriverID);
105  else TRACE("%p -> NULL\n", hDrvr);
106 
107  return d;
108 }
struct tagWINE_DRIVER * LPWINE_DRIVER
#define WINE_DI_MAGIC
Definition: winemm.h:51
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
#define d
Definition: ke_i.h:81
#define __ENDTRY
Definition: compat.h:72
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by CloseDriver(), GetDriverFlags(), GetDriverModuleHandle(), MMDRV_Install(), and SendDriverMessage().

◆ DRIVER_GetLibName()

BOOL DRIVER_GetLibName ( LPCWSTR  keyName,
LPCWSTR  sectName,
LPWSTR  buf,
int  sz 
)

Definition at line 233 of file driver.c.

234 {
235  HKEY hKey, hSecKey;
236  DWORD bufLen, lRet;
237  static const WCHAR wszSystemIni[] = {'S','Y','S','T','E','M','.','I','N','I',0};
238  WCHAR wsznull = '\0';
239 
240  /* This takes us as far as Windows NT\CurrentVersion */
242 
243  if (lRet == ERROR_SUCCESS)
244  {
245  /* Now we descend into the section name that we were given */
246  lRet = RegOpenKeyExW(hKey, sectName, 0, KEY_QUERY_VALUE, &hSecKey);
247 
248  if (lRet == ERROR_SUCCESS)
249  {
250  /* Retrieve the desired value - this is the filename of the lib */
251  bufLen = sz;
252  lRet = RegQueryValueExW(hSecKey, keyName, 0, 0, (void*)buf, &bufLen);
253  RegCloseKey( hSecKey );
254  }
255 
256  RegCloseKey( hKey );
257  }
258 
259  /* Finish up if we've got what we want from the registry */
260  if (lRet == ERROR_SUCCESS)
261  return TRUE;
262 
263  /* default to system.ini if we can't find it in the registry,
264  * to support native installations where system.ini is still used */
265  return GetPrivateProfileStringW(sectName, keyName, &wsznull, buf, sz / sizeof(WCHAR), wszSystemIni);
266 }
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static const WCHAR wszSystemIni[]
Definition: mci.c:57
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
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
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
static const WCHAR HKLM_BASE[]
Definition: driver.c:37
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 MCI_OpenMciDriver(), mciSendStringW(), and OpenDriver().

◆ DRIVER_TryOpenDriver32()

LPWINE_DRIVER DRIVER_TryOpenDriver32 ( LPCWSTR  fn,
LPARAM  lParam2 
)

Definition at line 273 of file driver.c.

274 {
275  LPWINE_DRIVER lpDrv = NULL;
276  HMODULE hModule = 0;
277  LPWSTR ptr;
278  LPCSTR cause = 0;
279 
280  TRACE("(%s, %08lX);\n", debugstr_w(fn), lParam2);
281 
282  if ((ptr = strchrW(fn, ' ')) != NULL)
283  {
284  *ptr++ = '\0';
285 
286  while (*ptr == ' ')
287  ptr++;
288 
289  if (*ptr == '\0')
290  ptr = NULL;
291  }
292 
293  lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
294 
295  if (lpDrv == NULL)
296  {
297  cause = "OOM";
298  goto exit;
299  }
300 
301  if ((hModule = LoadLibraryW(fn)) == 0)
302  {
303  cause = "Not a 32 bit lib";
304  goto exit;
305  }
306 
307  lpDrv->lpDrvProc = (DRIVERPROC)GetProcAddress(hModule, "DriverProc");
308 
309  if (lpDrv->lpDrvProc == NULL)
310  {
311  cause = "no DriverProc";
312  goto exit;
313  }
314 
315  lpDrv->dwFlags = 0;
316  lpDrv->hModule = hModule;
317  lpDrv->dwDriverID = 0;
318 
319  /* Win32 installable drivers must support a two phase opening scheme:
320  * + first open with NULL as lParam2 (session instance),
321  * + then do a second open with the real non null lParam2)
322  */
323  if (DRIVER_GetNumberOfModuleRefs(lpDrv->hModule, NULL) == 0 && lParam2)
324  {
326 
327  if (!DRIVER_AddToList(lpDrv, (LPARAM)ptr, 0L))
328  {
329  cause = "load0 failed";
330  goto exit;
331  }
332  ret = DRIVER_TryOpenDriver32(fn, lParam2);
333  if (!ret)
334  {
335  CloseDriver((HDRVR)lpDrv, 0L, 0L);
336  cause = "load1 failed";
337  goto exit;
338  }
339  return ret;
340  }
341 
342  if (!DRIVER_AddToList(lpDrv, (LPARAM)ptr, lParam2))
343  {
344  cause = "load failed";
345  goto exit;
346  }
347 
348  TRACE("=> %p\n", lpDrv);
349  return lpDrv;
350 
351  exit:
353  HeapFree(GetProcessHeap(), 0, lpDrv);
354  TRACE("Unable to load 32 bit module %s: %s\n", debugstr_w(fn), cause);
355  return NULL;
356 }
LRESULT(CALLBACK * DRIVERPROC)(DWORD_PTR, HDRVR, UINT, LPARAM, LPARAM)
Definition: mmsystem.h:1001
DRIVERPROC lpDrvProc
Definition: winemm.h:59
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:413
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCWSTR fn, LPARAM lParam2)
Definition: driver.c:273
int ret
static BOOL DRIVER_AddToList(LPWINE_DRIVER lpNewDrv, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:187
static const WCHAR L[]
Definition: oid.c:1250
HMODULE hModule
Definition: winemm.h:58
DWORD dwFlags
Definition: winemm.h:57
#define GetProcAddress(x, y)
Definition: compat.h:418
DWORD_PTR dwDriverID
Definition: winemm.h:60
void exit(int exitcode)
Definition: _exit.c:33
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static unsigned DRIVER_GetNumberOfModuleRefs(HMODULE hModule, WINE_DRIVER **found)
Definition: driver.c:63
#define HeapFree(x, y, z)
Definition: compat.h:402
HMODULE hModule
Definition: animate.c:44

Referenced by DRIVER_TryOpenDriver32(), MCI_OpenMciDriver(), and OpenDriver().

◆ DRIVER_UnloadAll()

void DRIVER_UnloadAll ( void  )

Definition at line 658 of file driver.c.

659 {
660  LPWINE_DRIVER lpDrv;
661  LPWINE_DRIVER lpNextDrv = NULL;
662  unsigned count = 0;
663 
664 restart:
666 
667  for (lpDrv = lpDrvItemList; lpDrv != NULL; lpDrv = lpNextDrv)
668  {
669  lpNextDrv = lpDrv->lpNextItem;
670 
671  /* session instances will be unloaded automatically */
672  if (!(lpDrv->dwFlags & WINE_GDF_SESSION))
673  {
675  CloseDriver((HDRVR)lpDrv, 0, 0);
676  count++;
677  /* restart from the beginning of the list */
678  goto restart;
679  }
680  }
681 
683 
684  TRACE("Unloaded %u drivers\n", count);
685 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct tagWINE_DRIVER * lpNextItem
Definition: winemm.h:62
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
static LPWINE_DRIVER lpDrvItemList
Definition: driver.c:36
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
void restart(int argc, const char *argv[])
Definition: cmds.c:2115
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwFlags
Definition: winemm.h:57
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define WINE_GDF_SESSION
Definition: winemm.h:195
static CRITICAL_SECTION mmdriver_lock
Definition: driver.c:27

Referenced by DllMain().

◆ LoadRegistryMMEDrivers()

BOOL LoadRegistryMMEDrivers ( char key)

Definition at line 23 of file registry.c.

24 {
25  INT driver_count = 0;
26  INT driver_index = 0;
28 
29  DWORD value_name_length = 256;
30  char value_name[256];
31 
32  DWORD value_data_length = 256;
33  char value_data[256];
34 
35  char wavemapper[256] = { 0 };
36  char midimapper[256] = { 0 };
37 
38  DWORD value_type;
39 
41  {
42  TRACE("ERROR: Could not open: HKEY_LOCAL_MACHINE\\%s\n", key);
43  return 0;
44  }
45 
46  while ( RegEnumValue(drivers_key,
47  driver_index,
48  value_name,
49  &value_name_length,
50  NULL,
51  &value_type,
52  (LPBYTE)value_data,
53  &value_data_length) == ERROR_SUCCESS )
54  {
55  BOOL valid_driver = FALSE;
56  BOOL is_mapper = FALSE;
57 
58  if ( value_type == REG_SZ )
59  {
60  /* We look for mappers first so they don't match
61  something else later on! */
62 
63  if ( ! stricmp("wavemapper", value_name) )
64  {
65  TRACE("Found a Wave-mapper: %s\n", value_data);
66  /* Delay loading Wave mapper driver */
67  strcpy(wavemapper, value_data);
68  is_mapper = TRUE;
69  driver_count ++;
70  }
71  else if ( ! stricmp("midimapper", value_name) )
72  {
73  TRACE("Found a MIDI-mapper: %s\n", value_data);
74  /* Delay loading MIDI mapper driver */
75  strcpy(midimapper, value_data);
76  is_mapper = TRUE;
77  driver_count ++;
78  }
79  else if ( ! _strnicmp("wave", value_name, 4) )
80  {
81  TRACE("Found a Wave driver: %s\n", value_data);
82  valid_driver = TRUE;
83  driver_count ++;
84  }
85  else if ( ! _strnicmp("midi", value_name, 4) )
86  {
87  TRACE("Found a MIDI driver: %s\n", value_data);
88  valid_driver = TRUE;
89  driver_count ++;
90  }
91  else if ( ! _strnicmp("mixer", value_name, 5) )
92  {
93  TRACE("Found a mixer driver: %s\n", value_data);
94  valid_driver = TRUE;
95  driver_count ++;
96  }
97  else if ( ! _strnicmp("aux", value_name, 4) )
98  {
99  TRACE("Found an aux driver: %s\n", value_data);
100  valid_driver = TRUE;
101  driver_count ++;
102  }
103  else
104  {
105  TRACE("Not supported: %s\n", value_data);
106  }
107 
108  /* If we have a valid driver now, we get it "installed" in
109  winmm itself so it can be used */
110 
111  if ( valid_driver )
112  {
113  if ( ! MMDRV_Install(value_name, value_data, is_mapper) )
114  {
115  TRACE("FAILED when initializing %s\n", value_data);
116  }
117  }
118  }
119  else
120  {
121  TRACE("Invalid data format\n");
122  }
123 
124  /* Reinitialize */
125  value_name_length = 256;
126  value_data_length = 256;
127  memset(value_name, 0, value_name_length);
128  memset(value_data, 0, value_data_length);
129 
130  driver_index ++;
131  }
132 
133  /* Finally load mapper drivers, since they expect device drivers already loaded */
134  if (*wavemapper)
135  {
136  if (!MMDRV_Install("wavemapper", wavemapper, TRUE))
137  {
138  TRACE("FAILED when initializing %s\n", wavemapper);
139  }
140  }
141 
142  if (*midimapper)
143  {
144  if (!MMDRV_Install("midimapper", midimapper, TRUE))
145  {
146  TRACE("FAILED when initializing %s\n", midimapper);
147  }
148  }
149 
150  TRACE("Found a total of %d drivers\n", driver_count);
151 
152  return driver_count;
153 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
int32_t INT
Definition: typedefs.h:56
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP int __cdecl stricmp(_In_z_ const char *_Str1, _In_z_ const char *_Str2)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static unsigned driver_count
Definition: ds3d.c:1254
static const WCHAR drivers_key[]
Definition: odbccp32.c:44
BOOL MMDRV_Install(LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper)
Definition: lolvldrv.c:436
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define memset(x, y, z)
Definition: compat.h:39
#define RegEnumValue
Definition: winreg.h:511
Definition: path.c:42
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by MMDRV_Init().

◆ MCI_MessageToString()

const char* MCI_MessageToString ( UINT  wMsg)

Definition at line 130 of file mci.c.

131 {
132  static char buffer[100];
133 
134 #define CASE(s) case (s): return #s
135 
136  switch (wMsg) {
137  CASE(DRV_LOAD);
138  CASE(DRV_ENABLE);
139  CASE(DRV_OPEN);
140  CASE(DRV_CLOSE);
141  CASE(DRV_DISABLE);
142  CASE(DRV_FREE);
145  CASE(DRV_INSTALL);
146  CASE(DRV_REMOVE);
148  CASE(DRV_EXITAPPLICATION);
149  CASE(DRV_POWER);
150  CASE(MCI_BREAK);
151  CASE(MCI_CLOSE);
153  CASE(MCI_COPY);
154  CASE(MCI_CUE);
155  CASE(MCI_CUT);
156  CASE(MCI_DELETE);
157  CASE(MCI_ESCAPE);
158  CASE(MCI_FREEZE);
159  CASE(MCI_PAUSE);
160  CASE(MCI_PLAY);
162  CASE(MCI_INFO);
163  CASE(MCI_LOAD);
164  CASE(MCI_OPEN);
166  CASE(MCI_PASTE);
167  CASE(MCI_PUT);
168  CASE(MCI_REALIZE);
169  CASE(MCI_RECORD);
170  CASE(MCI_RESUME);
171  CASE(MCI_SAVE);
172  CASE(MCI_SEEK);
173  CASE(MCI_SET);
174  CASE(MCI_SPIN);
175  CASE(MCI_STATUS);
176  CASE(MCI_STEP);
177  CASE(MCI_STOP);
178  CASE(MCI_SYSINFO);
180  CASE(MCI_UPDATE);
181  CASE(MCI_WHERE);
182  CASE(MCI_WINDOW);
183  /* constants for digital video */
184  CASE(MCI_CAPTURE);
185  CASE(MCI_MONITOR);
186  CASE(MCI_RESERVE);
188  CASE(MCI_SIGNAL);
190  CASE(MCI_QUALITY);
191  CASE(MCI_LIST);
192  CASE(MCI_UNDO);
194  CASE(MCI_RESTORE);
195 #undef CASE
196  default:
197  sprintf(buffer, "MCI_<<%04X>>", wMsg);
198  return buffer;
199  }
200 }
#define DRV_DISABLE
Definition: mmsystem.h:123
#define MCI_UNFREEZE
Definition: mmsystem.h:669
#define MCI_SETAUDIO
Definition: digitalv.h:39
#define MCI_ESCAPE
Definition: mmsystem.h:648
#define MCI_COPY
Definition: mmsystem.h:672
#define MCI_RESTORE
Definition: digitalv.h:46
#define MCI_CAPTURE
Definition: digitalv.h:36
#define MCI_STEP
Definition: mmsystem.h:657
#define MCI_PASTE
Definition: mmsystem.h:673
#define MCI_RESERVE
Definition: digitalv.h:38
#define MCI_PLAY
Definition: mmsystem.h:649
GLuint buffer
Definition: glext.h:5915
#define DRV_CLOSE
Definition: mmsystem.h:122
#define MCI_RESUME
Definition: mmsystem.h:675
#define MCI_BREAK
Definition: mmsystem.h:660
#define DRV_EXITSESSION
Definition: mmsystem.h:129
#define MCI_FREEZE
Definition: mmsystem.h:668
#define MCI_CUE
Definition: mmsystem.h:663
#define MCI_SAVE
Definition: mmsystem.h:661
#define MCI_QUALITY
Definition: digitalv.h:42
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define DRV_POWER
Definition: mmsystem.h:130
#define DRV_OPEN
Definition: mmsystem.h:121
#define MCI_STOP
Definition: mmsystem.h:651
#define MCI_WINDOW
Definition: mmsystem.h:665
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define MCI_SET
Definition: mmsystem.h:656
#define MCI_RECORD
Definition: mmsystem.h:658
#define MCI_SIGNAL
Definition: digitalv.h:40
#define MCI_WHERE
Definition: mmsystem.h:667
#define DRV_LOAD(x)
#define MCI_OPEN
Definition: mmsystem.h:646
#define DRV_REMOVE
Definition: mmsystem.h:128
#define MCI_INFO
Definition: mmsystem.h:653
#define MCI_CONFIGURE
Definition: digitalv.h:45
#define MCI_OPEN_DRIVER
Definition: mmddk.h:334
#define MCI_STATUS
Definition: mmsystem.h:662
#define DRV_CONFIGURE
Definition: mmsystem.h:125
#define MCI_REALIZE
Definition: mmsystem.h:664
#define DRV_FREE
Definition: mmsystem.h:124
#define MCI_SETVIDEO
Definition: digitalv.h:41
#define MCI_LOAD
Definition: mmsystem.h:670
#define MCI_CUT
Definition: mmsystem.h:671
#define CASE(s)
#define MCI_CLOSE_DRIVER
Definition: mmddk.h:335
#define DRV_ENABLE
Definition: mmsystem.h:120
#define MCI_PUT
Definition: mmsystem.h:666
#define MCI_CLOSE
Definition: mmsystem.h:647
#define MCI_GETDEVCAPS
Definition: mmsystem.h:654
#define MCI_PAUSE
Definition: mmsystem.h:652
#define DRV_INSTALL
Definition: mmsystem.h:127
#define MCI_UNDO
Definition: digitalv.h:44
#define MCI_MONITOR
Definition: digitalv.h:37
#define MCI_SPIN
Definition: mmsystem.h:655
#define MCI_UPDATE
Definition: mmsystem.h:674
#define MCI_SEEK
Definition: mmsystem.h:650
#define MCI_DELETE
Definition: mmsystem.h:676
#define MCI_LIST
Definition: digitalv.h:43
#define MCI_SYSINFO
Definition: mmsystem.h:659

Referenced by MCI_CleanUp(), MCI_MapMsgAtoW(), MCI_UnmapMsgAtoW(), mciSendCommandA(), mciSendCommandW(), and mciSendStringW().

◆ MCI_SendCommand()

DWORD MCI_SendCommand ( UINT  wDevID,
UINT16  wMsg,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)

Definition at line 1908 of file mci.c.

1909 {
1911 
1912  switch (wMsg) {
1913  case MCI_OPEN:
1914  dwRet = MCI_Open(dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
1915  break;
1916  case MCI_CLOSE:
1917  dwRet = MCI_Close(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
1918  break;
1919  case MCI_SYSINFO:
1920  dwRet = MCI_SysInfo(wDevID, dwParam1, (LPMCI_SYSINFO_PARMSW)dwParam2);
1921  break;
1922  case MCI_BREAK:
1923  dwRet = MCI_Break(wDevID, dwParam1, (LPMCI_BREAK_PARMS)dwParam2);
1924  break;
1925  case MCI_SOUND:
1926  dwRet = MCI_Sound(wDevID, dwParam1, (LPMCI_SOUND_PARMSW)dwParam2);
1927  break;
1928  default:
1929  if ((UINT16)wDevID == (UINT16)MCI_ALL_DEVICE_ID) {
1930  FIXME("unhandled MCI_ALL_DEVICE_ID\n");
1931  dwRet = MCIERR_CANNOT_USE_ALL;
1932  } else {
1933  dwRet = MCI_SendCommandFrom32(wDevID, wMsg, dwParam1, dwParam2);
1934  }
1935  break;
1936  }
1937  return dwRet;
1938 }
#define MCI_BREAK
Definition: mmsystem.h:660
static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSW lpParms)
Definition: mci.c:1519
static DWORD MCI_Break(UINT wDevID, DWORD dwFlags, LPMCI_BREAK_PARMS lpParms)
Definition: mci.c:1872
static DWORD MCI_Close(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
Definition: mci.c:1650
#define FIXME(fmt,...)
Definition: debug.h:110
#define MCI_ALL_DEVICE_ID
Definition: mmsystem.h:679
#define MCI_OPEN
Definition: mmsystem.h:646
static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParms)
Definition: mci.c:1721
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD MCI_SendCommandFrom32(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: mci.c:878
#define MCIERR_CANNOT_USE_ALL
Definition: mmsystem.h:589
unsigned short UINT16
#define MCI_CLOSE
Definition: mmsystem.h:647
#define MCIERR_UNRECOGNIZED_COMMAND
Definition: mmsystem.h:571
static DWORD MCI_Sound(UINT wDevID, DWORD dwFlags, LPMCI_SOUND_PARMSW lpParms)
Definition: mci.c:1888
#define MCI_SYSINFO
Definition: mmsystem.h:659

Referenced by DllMain(), mciSendCommandW(), and mciSendStringW().

◆ MCI_strdupAtoW()

LPWSTR MCI_strdupAtoW ( LPCSTR  str)

Definition at line 202 of file mci.c.

203 {
204  LPWSTR ret;
205  INT len;
206 
207  if (!str) return NULL;
208  len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
209  ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
210  if (ret) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
211  return ret;
212 }
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:56
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by MCI_MapMsgAtoW(), mciGetDeviceIDA(), and mciGetDeviceIDFromElementIDA().

◆ MCI_strdupWtoA()

LPSTR MCI_strdupWtoA ( LPCWSTR  str)

Definition at line 214 of file mci.c.

215 {
216  LPSTR ret;
217  INT len;
218 
219  if (!str) return NULL;
220  len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
221  ret = HeapAlloc( GetProcessHeap(), 0, len );
222  if (ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
223  return ret;
224 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
GLenum GLsizei len
Definition: glext.h:6722

◆ MMDRV_Alloc()

LPWINE_MLD MMDRV_Alloc ( UINT  size,
UINT  type,
LPHANDLE  hndl,
DWORD dwFlags,
DWORD_PTR dwCallback,
DWORD_PTR dwInstance 
)

Definition at line 123 of file lolvldrv.c.

125 {
126  LPWINE_MLD mld;
127  UINT_PTR i;
128  TRACE("(%d, %04x, %p, %p, %p, %p)\n",
129  size, type, hndl, dwFlags, dwCallback, dwInstance);
130 
132  if (!mld) return NULL;
133 
134  /* find an empty slot in MM_MLDrvs table */
135  for (i = 0; i < MAX_MM_MLDRVS; i++) if (!MM_MLDrvs[i]) break;
136 
137  if (i == MAX_MM_MLDRVS) {
138  /* the MM_MLDrvs table could be made growable in the future if needed */
139  ERR("Too many open drivers\n");
140  HeapFree(GetProcessHeap(), 0, mld);
141  return NULL;
142  }
143  MM_MLDrvs[i] = mld;
144  *hndl = (HANDLE)(i | 0x8000);
145 
146  mld->type = type;
147  if ((UINT_PTR)*hndl < MMDRV_GetNum(type) || ((UINT_PTR)*hndl >> 16)) {
148  /* FIXME: those conditions must be fulfilled so that:
149  * - we can distinguish between device IDs and handles
150  * - we can use handles as 16 or 32 bit entities
151  */
152  ERR("Shouldn't happen. Bad allocation scheme\n");
153  }
154 
155  mld->dwFlags = HIWORD(*dwFlags);
156  mld->dwCallback = *dwCallback;
157  mld->dwClientInstance = *dwInstance;
158 
159  return mld;
160 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD_PTR dwClientInstance
Definition: winemm.h:101
static LPWINE_MLD MM_MLDrvs[40]
Definition: lolvldrv.c:41
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
smooth NULL
Definition: ftsmooth.c:416
UINT type
Definition: winemm.h:95
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
PVOID HANDLE
Definition: typedefs.h:71
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ERR(fmt,...)
Definition: debug.h:109
DWORD_PTR dwCallback
Definition: winemm.h:100
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HIWORD(l)
Definition: typedefs.h:246
WORD dwFlags
Definition: winemm.h:99
UINT MMDRV_GetNum(UINT type)
Definition: lolvldrv.c:61
#define HeapFree(x, y, z)
Definition: compat.h:402
#define MAX_MM_MLDRVS
Definition: lolvldrv.c:42

Referenced by MIDI_OutAlloc(), midiInOpen(), mixerOpen(), and WAVE_Open().

◆ MMDRV_Close()

DWORD MMDRV_Close ( LPWINE_MLD  mld,
UINT  wMsg 
)

Definition at line 228 of file lolvldrv.c.

229 {
230  TRACE("(%p, %04x)\n", mld, wMsg);
231  return MMDRV_Message(mld, wMsg, 0L, 0L);
232 }
#define TRACE(s)
Definition: solgame.cpp:4
DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: lolvldrv.c:71
static const WCHAR L[]
Definition: oid.c:1250

Referenced by midiInClose(), midiOutClose(), mixerClose(), and waveOutClose().

◆ MMDRV_Exit()

void MMDRV_Exit ( void  )

Definition at line 607 of file lolvldrv.c.

608 {
609  unsigned int i;
610  TRACE("()\n");
611 
612  for (i = 0; i < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0]); i++)
613  {
614  if (MM_MLDrvs[i] != NULL)
615  {
616  FIXME("Closing while ll-driver open\n");
617 #if 0
618  /* FIXME: should generate a message depending on type */
619  MMDRV_Free((HANDLE)(i | 0x8000), MM_MLDrvs[i]);
620 #endif
621  }
622  }
623 
624  /* unload driver, in reverse order of loading */
625  i = MMDrvsHi;
626  while (i-- > 0)
627  {
634  CloseDriver(MMDrvs[i].hDriver, 0, 0);
635  }
636  if (llTypes[MMDRV_AUX].lpMlds)
637  HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_AUX].lpMlds - 1);
638  if (llTypes[MMDRV_MIXER].lpMlds)
639  HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIXER].lpMlds - 1);
640  if (llTypes[MMDRV_MIDIIN].lpMlds)
641  HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIDIIN].lpMlds - 1);
642  if (llTypes[MMDRV_MIDIOUT].lpMlds)
643  HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIDIOUT].lpMlds - 1);
644  if (llTypes[MMDRV_WAVEIN].lpMlds)
645  HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_WAVEIN].lpMlds - 1);
646  if (llTypes[MMDRV_WAVEOUT].lpMlds)
647  HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_WAVEOUT].lpMlds - 1);
648 }
#define MMDRV_MIXER
Definition: winemm.h:77
#define MMDRV_MIDIIN
Definition: winemm.h:78
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3553
#define MMDRV_WAVEOUT
Definition: winemm.h:81
static LPWINE_MLD MM_MLDrvs[40]
Definition: lolvldrv.c:41
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
#define MMDRV_AUX
Definition: winemm.h:76
#define MMDRV_WAVEIN
Definition: winemm.h:80
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define MMDRV_MIDIOUT
Definition: winemm.h:79
static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type)
Definition: lolvldrv.c:584
#define GetProcessHeap()
Definition: compat.h:403
static int MMDrvsHi
Definition: lolvldrv.c:39
void MMDRV_Free(HANDLE hndl, LPWINE_MLD mld)
Definition: lolvldrv.c:165
static WINE_MM_DRIVER MMDrvs[8]
Definition: lolvldrv.c:40
static WINE_LLTYPE llTypes[MMDRV_MAX]
Definition: lolvldrv.c:48
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by DllMain().

◆ MMDRV_Free()

void MMDRV_Free ( HANDLE  hndl,
LPWINE_MLD  mld 
)

Definition at line 165 of file lolvldrv.c.

166 {
167  TRACE("(%p, %p)\n", hndl, mld);
168 
169  if ((UINT_PTR)hndl & 0x8000) {
170  UINT_PTR idx = (UINT_PTR)hndl & ~0x8000;
171  if (idx < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) {
172  MM_MLDrvs[idx] = NULL;
173  HeapFree(GetProcessHeap(), 0, mld);
174  return;
175  }
176  }
177  ERR("Bad Handle %p at %p (not freed)\n", hndl, mld);
178 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
static LPWINE_MLD MM_MLDrvs[40]
Definition: lolvldrv.c:41
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define ERR(fmt,...)
Definition: debug.h:109
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by midiInClose(), midiInOpen(), midiOutClose(), midiOutOpen(), mixerClose(), mixerOpen(), MMDRV_Exit(), WAVE_Open(), waveInClose(), and waveOutClose().

◆ MMDRV_Get()

LPWINE_MLD MMDRV_Get ( HANDLE  hndl,
UINT  type,
BOOL  bCanBeID 
)

Definition at line 250 of file lolvldrv.c.

251 {
252  LPWINE_MLD mld = NULL;
253  UINT_PTR hndl = (UINT_PTR)_hndl;
254  TRACE("(%p, %04x, %c)\n", _hndl, type, bCanBeID ? 'Y' : 'N');
255 
256  assert(type < MMDRV_MAX);
257 
258  if (hndl >= llTypes[type].wMaxId &&
259  hndl != (UINT16)-1 && hndl != (UINT)-1) {
260  if (hndl & 0x8000) {
261  UINT idx = hndl & ~0x8000;
262  if (idx < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) {
263  __TRY
264  {
265  mld = MM_MLDrvs[idx];
266  if (mld && mld->type != type) mld = NULL;
267  }
269  {
270  mld = NULL;
271  }
272  __ENDTRY;
273  }
274  }
275  }
276  if (mld == NULL && bCanBeID) {
277  mld = MMDRV_GetByID(hndl, type);
278  }
279  return mld;
280 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
static LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
Definition: lolvldrv.c:237
static LPWINE_MLD MM_MLDrvs[40]
Definition: lolvldrv.c:41
#define MMDRV_MAX
Definition: winemm.h:82
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
UINT type
Definition: winemm.h:95
#define __TRY
Definition: compat.h:70
#define TRACE(s)
Definition: solgame.cpp:4
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define __ENDTRY
Definition: compat.h:72
unsigned short UINT16
unsigned int UINT
Definition: ndis.h:50
static WINE_LLTYPE llTypes[MMDRV_MAX]
Definition: lolvldrv.c:48
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:71

Referenced by auxGetDevCapsW(), auxGetVolume(), auxOutMessage(), auxSetVolume(), midiInAddBuffer(), midiInClose(), midiInGetDevCapsW(), midiInGetID(), midiInMessage(), midiInPrepareHeader(), midiInReset(), midiInStart(), midiInStop(), midiInUnprepareHeader(), midiOutClose(), midiOutGetDevCapsW(), midiOutGetID(), midiOutGetVolume(), midiOutLongMsg(), midiOutMessage(), midiOutPrepareHeader(), midiOutReset(), midiOutSetVolume(), midiOutShortMsg(), midiOutUnprepareHeader(), MIXER_GetDev(), mixerClose(), mixerGetDevCapsW(), mixerMessage(), MMDRV_GetRelated(), MMSYSTEM_GetMidiStream(), MMSYSTEM_MidiStream_Player(), waveInAddBuffer(), waveInClose(), waveInGetDevCapsW(), waveInGetID(), waveInGetPosition(), waveInMessage(), waveInPrepareHeader(), waveInReset(), waveInStart(), waveInStop(), waveInUnprepareHeader(), waveOutBreakLoop(), waveOutClose(), waveOutGetDevCapsW(), waveOutGetID(), waveOutGetPitch(), waveOutGetPlaybackRate(), waveOutGetPosition(), waveOutGetVolume(), waveOutMessage(), waveOutPause(), waveOutPrepareHeader(), waveOutReset(), waveOutRestart(), waveOutSetPitch(), waveOutSetPlaybackRate(), waveOutSetVolume(), waveOutUnprepareHeader(), and waveOutWrite().

◆ MMDRV_GetNum()

UINT MMDRV_GetNum ( UINT  )

Definition at line 61 of file lolvldrv.c.

62 {
63  TRACE("(%04x)\n", type);
65  return llTypes[type].wMaxId;
66 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
#define MMDRV_MAX
Definition: winemm.h:82
#define TRACE(s)
Definition: solgame.cpp:4
static WINE_LLTYPE llTypes[MMDRV_MAX]
Definition: lolvldrv.c:48

Referenced by auxGetNumDevs(), midiInGetNumDevs(), midiOutGetNumDevs(), mixerGetNumDevs(), MMDRV_Alloc(), waveInGetNumDevs(), and waveOutGetNumDevs().

◆ MMDRV_GetRelated()

LPWINE_MLD MMDRV_GetRelated ( HANDLE  hndl,
UINT  srcType,
BOOL  bSrcCanBeID,
UINT  dstTyped 
)

Definition at line 285 of file lolvldrv.c.

287 {
288  LPWINE_MLD mld;
289  TRACE("(%p, %04x, %c, %04x)\n",
290  hndl, srcType, bSrcCanBeID ? 'Y' : 'N', dstType);
291 
292  if ((mld = MMDRV_Get(hndl, srcType, bSrcCanBeID)) != NULL) {
293  WINE_MM_DRIVER_PART* part = &MMDrvs[mld->mmdIndex].parts[dstType];
294  if (part->nIDMin < part->nIDMax)
295  return MMDRV_GetByID(part->nIDMin, dstType);
296  }
297  return NULL;
298 }
LPWINE_MLD MMDRV_Get(HANDLE _hndl, UINT type, BOOL bCanBeID)
Definition: lolvldrv.c:250
static LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
Definition: lolvldrv.c:237
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static WINE_MM_DRIVER MMDrvs[8]
Definition: lolvldrv.c:40
WINE_MM_DRIVER_PART parts[MMDRV_MAX]
Definition: winemm.h:89
UINT mmdIndex
Definition: winemm.h:96

Referenced by MIXER_GetDev().

◆ MMDRV_Init()

BOOL MMDRV_Init ( void  )

Definition at line 526 of file lolvldrv.c.

527 {
528 /* Redundant code, keeping this for reference only (for now) */
529 #if 0
530  HKEY hKey;
531  char driver_buffer[256];
532  char mapper_buffer[256];
533  char midi_buffer[256];
534  char* p;
535  DWORD type, size;
536  BOOL ret = FALSE;
537  TRACE("()\n");
538 
539  strcpy(driver_buffer, WINE_DEFAULT_WINMM_DRIVER);
540  strcpy(mapper_buffer, WINE_DEFAULT_WINMM_MAPPER);
541  strcpy(midi_buffer, WINE_DEFAULT_WINMM_MIDI);
542 
543  /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
544  if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hKey))
545  {
546  size = sizeof(driver_buffer);
547  if (RegQueryValueExA(hKey, "Audio", 0, &type, (LPVOID)driver_buffer, &size))
548  strcpy(driver_buffer, WINE_DEFAULT_WINMM_DRIVER);
549  }
550 
551  p = driver_buffer;
552  while (p)
553  {
554  char filename[sizeof(driver_buffer)+10];
555  char *next = strchr(p, ',');
556  if (next) *next++ = 0;
557  sprintf( filename, "wine%s.drv", p );
558  if ((ret = MMDRV_Install( filename, filename, FALSE ))) break;
559  p = next;
560  }
561 
562  ret |= MMDRV_Install("beepmidi.dll", "beepmidi.dll", FALSE);
563 
564  ret |= MMDRV_Install("wavemapper", WINE_DEFAULT_WINMM_MAPPER, TRUE);
565  ret |= MMDRV_Install("midimapper", WINE_DEFAULT_WINMM_MIDI, TRUE);
566  return ret;
567 #else
568  INT driver_count = 0;
569 
572 
573  /* Explorer doesn't like us failing */
574  return TRUE;
575 // return ( driver_count > 0 );
576 #endif
577 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
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
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define WINE_DEFAULT_WINMM_MAPPER
Definition: winemm.h:47
const char * filename
Definition: ioapi.h:135
int32_t INT
Definition: typedefs.h:56
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WINE_DEFAULT_WINMM_MIDI
Definition: winemm.h:48
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define NT_MME_DRIVERS32_KEY
Definition: winemm.h:200
unsigned long DWORD
Definition: ntddk_ex.h:95
static unsigned driver_count
Definition: ds3d.c:1254
BOOL LoadRegistryMMEDrivers(char *key)
Definition: registry.c:23
BOOL MMDRV_Install(LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper)
Definition: lolvldrv.c:436
int ret
#define NT_MME_DRIVERS_KEY
Definition: winemm.h:203
#define WINE_DEFAULT_WINMM_DRIVER
Definition: winemm.h:46
static unsigned __int64 next
Definition: rand_nt.c:6
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by DllMain().

◆ MMDRV_Install()

BOOL MMDRV_Install ( LPCSTR  drvRegName,
LPCSTR  drvFileName,
BOOL  bIsMapper 
)

Definition at line 436 of file lolvldrv.c.

437 {
438  int i, count = 0;
439  LPWINE_MM_DRIVER lpDrv = &MMDrvs[MMDrvsHi];
442 
443  TRACE("('%s', '%s', mapper=%c);\n", drvRegName, drvFileName, bIsMapper ? 'Y' : 'N');
444 
445  for (i = 0; i < MMDrvsHi; i++) {
446  if (!strcmp(drvRegName, MMDrvs[i].drvname)) return FALSE;
447  }
448 
449  /* Be sure that size of MMDrvs matches the max number of loadable
450  * drivers !!
451  * If not just increase size of MMDrvs
452  */
453  assert(MMDrvsHi <= sizeof(MMDrvs)/sizeof(MMDrvs[0]));
454 
455  memset(lpDrv, 0, sizeof(*lpDrv));
456 
457  if (!(lpDrv->hDriver = OpenDriverA(drvFileName, 0, 0))) {
458  WARN("Couldn't open driver '%s'\n", drvFileName);
459  return FALSE;
460  }
461 
462  d = DRIVER_FindFromHDrvr(lpDrv->hDriver);
463 
464  if (!(d = DRIVER_FindFromHDrvr(lpDrv->hDriver))) {
465  CloseDriver(lpDrv->hDriver, 0, 0);
466  WARN("Couldn't get the WINE internal structure for driver '%s'\n", drvFileName);
467  return FALSE;
468  }
469 
470  /* Then look for xxxMessage functions */
471 #define AA(_h,_w,_x,_y,_z) \
472  func = (WINEMM_msgFunc##_y) _z ((_h), #_x); \
473  if (func != NULL) \
474  { lpDrv->parts[_w].fnMessage##_y = func; count++; \
475  TRACE("Got %d bit func '%s'\n", _y, #_x); }
476 
477  if (d->hModule) {
478 #define A(_x,_y) AA(d->hModule,_x,_y,32,GetProcAddress)
485 #undef A
486  }
487 #undef AA
488 
489  if (!count) {
490  CloseDriver(lpDrv->hDriver, 0, 0);
491  WARN("No message functions found\n");
492  return FALSE;
493  }
494 
495  /* FIXME: being a mapper or not should be known by another way */
496  /* it's known for NE drvs (the description is of the form '*mapper: *'
497  * I don't have any clue for PE drvs
498  */
499  lpDrv->bIsMapper = bIsMapper;
500  lpDrv->drvname = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(drvRegName) + 1), drvRegName);
501 
502  /* Finish init and get the count of the devices */
503  i = 0;
504  if (MMDRV_InitPerType(lpDrv, MMDRV_AUX, AUXDM_GETNUMDEVS)) i = 1;
510  /* if all those func calls return FALSE, then the driver must be unloaded */
511  if (!i) {
512  CloseDriver(lpDrv->hDriver, 0, 0);
513  HeapFree(GetProcessHeap(), 0, lpDrv->drvname);
514  WARN("Driver initialization failed\n");
515  return FALSE;
516  }
517 
518  MMDrvsHi++;
519 
520  return TRUE;
521 }
GLenum func
Definition: glext.h:6028
#define MMDRV_MIXER
Definition: winemm.h:77
#define TRUE
Definition: types.h:120
#define MMDRV_MIDIIN
Definition: winemm.h:78
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam)
Definition: driver.c:365
GLuint GLuint GLsizei count
Definition: gl.h:1545
unsigned bIsMapper
Definition: winemm.h:88
#define WARN(fmt,...)
Definition: debug.h:111
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
#define WIDM_GETNUMDEVS
Definition: mmddk.h:136
DWORD APIENTRY mxdMessage(UINT DeviceId, UINT Message, DWORD_PTR PrivateHandle, DWORD_PTR Parameter1, DWORD_PTR Parameter2)
Definition: mxdMessage.c:69
#define assert(x)
Definition: debug.h:53
#define MMDRV_WAVEOUT
Definition: winemm.h:81
#define MIDM_GETNUMDEVS
Definition: mmddk.h:169
DWORD APIENTRY wodMessage(UINT device_id, UINT message, DWORD_PTR private_handle, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: mme.c:48
LPSTR drvname
Definition: winemm.h:87
#define AUXDM_GETNUMDEVS
Definition: mmddk.h:182
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
MMRESULT FAR PASCAL modMessage(UINT device_id, UINT message, DWORD_PTR private_data, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: beepmidi.c:771
#define MMDRV_AUX
Definition: winemm.h:76
DWORD APIENTRY widMessage(UINT DeviceId, UINT Message, DWORD_PTR PrivateHandle, DWORD_PTR Parameter1, DWORD_PTR Parameter2)
Definition: widMessage.c:20
#define MMDRV_WAVEIN
Definition: winemm.h:80
static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg)
Definition: lolvldrv.c:355
#define MODM_GETNUMDEVS
Definition: mmddk.h:154
#define A(_x, _y)
Definition: lolvldrv.c:44
#define TRACE(s)
Definition: solgame.cpp:4
#define MMDRV_MIDIOUT
Definition: winemm.h:79
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define d
Definition: ke_i.h:81
HDRVR hDriver
Definition: winemm.h:86
static int MMDrvsHi
Definition: lolvldrv.c:39
DWORD(CALLBACK * WINEMM_msgFunc32)(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR)
Definition: winemm.h:65
#define MXDM_GETNUMDEVS
Definition: mmddk.h:191
static WINE_MM_DRIVER MMDrvs[8]
Definition: lolvldrv.c:40
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
APIENTRY DWORD midMessage(DWORD dwId, DWORD dwMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
Definition: midi.c:251
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:402
APIENTRY DWORD auxMessage(UINT dwId, UINT uMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
Definition: auxil.c:20
LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr)
Definition: driver.c:89
#define WODM_GETNUMDEVS
Definition: mmddk.h:108

Referenced by LoadRegistryMMEDrivers(), and MMDRV_Init().

◆ MMDRV_Message()

DWORD MMDRV_Message ( LPWINE_MLD  mld,
UINT  wMsg,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)

Definition at line 71 of file lolvldrv.c.

73 {
74  LPWINE_MM_DRIVER lpDrv;
75  DWORD ret;
76  WINE_MM_DRIVER_PART* part;
77  WINE_LLTYPE* llType = &llTypes[mld->type];
78  int devID;
79 
80  TRACE("(%s %u %u 0x%08lx 0x%08lx 0x%08lx)\n",
81  llTypes[mld->type].typestr, mld->uDeviceID, wMsg,
82  mld->dwDriverInstance, dwParam1, dwParam2);
83 
84  if (mld->uDeviceID == (UINT16)-1) {
85  if (!llType->bSupportMapper) {
86  WARN("uDev=-1 requested on non-mappable ll type %s\n",
87  llTypes[mld->type].typestr);
88  return MMSYSERR_BADDEVICEID;
89  }
90  devID = -1;
91  } else {
92  if (mld->uDeviceID >= llType->wMaxId) {
93  WARN("uDev(%u) requested >= max (%d)\n", mld->uDeviceID, llType->wMaxId);
94  return MMSYSERR_BADDEVICEID;
95  }
96  devID = mld->uDeviceID;
97  }
98 
99  lpDrv = &MMDrvs[mld->mmdIndex];
100  part = &lpDrv->parts[mld->type];
101 
102 #if 0
103  /* some sanity checks */
104  if (!(part->nIDMin <= devID))
105  ERR("!(part->nIDMin(%d) <= devID(%d))\n", part->nIDMin, devID);
106  if (!(devID < part->nIDMax))
107  ERR("!(devID(%d) < part->nIDMax(%d))\n", devID, part->nIDMax);
108 #endif
109 
110  assert(part->fnMessage32);
111 
112  TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
113  mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
114  ret = part->fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
115  TRACE("=> %s\n", WINMM_ErrorToString(ret));
116 
117  return ret;
118 }
BOOL bSupportMapper
Definition: lolvldrv.c:32
#define WARN(fmt,...)
Definition: debug.h:111
#define assert(x)
Definition: debug.h:53
LPCSTR typestr
Definition: lolvldrv.c:31
UINT type
Definition: winemm.h:95
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
WINEMM_msgFunc32 fnMessage32
Definition: winemm.h:73
const char * WINMM_ErrorToString(MMRESULT error)
Definition: winmm.c:113
#define ERR(fmt,...)
Definition: debug.h:109
UINT uDeviceID
Definition: winemm.h:94
unsigned short UINT16
static WINE_MM_DRIVER MMDrvs[8]
Definition: lolvldrv.c:40
WINE_MM_DRIVER_PART parts[MMDRV_MAX]
Definition: winemm.h:89
UINT mmdIndex
Definition: winemm.h:96
static WINE_LLTYPE llTypes[MMDRV_MAX]
Definition: lolvldrv.c:48
DWORD_PTR dwDriverInstance
Definition: winemm.h:97

Referenced by auxGetDevCapsW(), auxGetVolume(), auxOutMessage(), auxSetVolume(), midiInAddBuffer(), midiInGetDevCapsW(), midiInMessage(), midiInPrepareHeader(), midiInReset(), midiInStart(), midiInStop(), midiInUnprepareHeader(), midiOutGetDevCapsW(), midiOutGetVolume(), midiOutLongMsg(), midiOutMessage(), midiOutPrepareHeader(), midiOutReset(), midiOutSetVolume(), midiOutShortMsg(), midiOutUnprepareHeader(), mixerGetControlDetailsW(), mixerGetDevCapsW(), mixerGetLineControlsW(), mixerGetLineInfoW(), mixerMessage(), mixerSetControlDetails(), MMDRV_Close(), MMDRV_Open(), MMDRV_PhysicalFeatures(), waveInAddBuffer(), waveInClose(), waveInGetDevCapsW(), waveInGetPosition(), waveInMessage(), waveInPrepareHeader(), waveInReset(), waveInStart(), waveInStop(), waveInUnprepareHeader(), waveOutBreakLoop(), waveOutGetDevCapsW(), waveOutGetPitch(), waveOutGetPlaybackRate(), waveOutGetPosition(), waveOutGetVolume(), waveOutMessage(), waveOutPause(), waveOutPrepareHeader(), waveOutReset(), waveOutRestart(), waveOutSetPitch(), waveOutSetPlaybackRate(), waveOutSetVolume(), waveOutUnprepareHeader(), and waveOutWrite().

◆ MMDRV_Open()

DWORD MMDRV_Open ( LPWINE_MLD  mld,
UINT  wMsg,
DWORD_PTR  dwParam1,
DWORD  dwParam2 
)

Definition at line 183 of file lolvldrv.c.

184 {
185  DWORD dwRet = MMSYSERR_BADDEVICEID;
186  DWORD_PTR dwInstance;
187  WINE_LLTYPE* llType = &llTypes[mld->type];
188  TRACE("(%p, %04x, 0x%08lx, 0x%08x)\n", mld, wMsg, dwParam1, dwFlags);
189 
190  mld->dwDriverInstance = (DWORD_PTR)&dwInstance;
191 
192  if (mld->uDeviceID == (UINT)-1 || mld->uDeviceID == (UINT16)-1) {
193  TRACE("MAPPER mode requested !\n");
194  /* check if mapper is supported by type */
195  if (llType->bSupportMapper) {
196  if (llType->nMapper == -1) {
197  /* no driver for mapper has been loaded, try a dumb implementation */
198  TRACE("No mapper loaded, doing it by hand\n");
199  for (mld->uDeviceID = 0; mld->uDeviceID < llType->wMaxId; mld->uDeviceID++) {
200  if ((dwRet = MMDRV_Open(mld, wMsg, dwParam1, dwFlags)) == MMSYSERR_NOERROR) {
201  /* to share this function epilog */
202  dwInstance = mld->dwDriverInstance;
203  break;
204  }
205  }
206  } else {
207  mld->uDeviceID = (UINT16)-1;
208  mld->mmdIndex = llType->lpMlds[-1].mmdIndex;
209  TRACE("Setting mmdIndex to %u\n", mld->mmdIndex);
210  dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags);
211  }
212  }
213  } else {
214  if (mld->uDeviceID < llType->wMaxId) {
215  mld->mmdIndex = llType->lpMlds[mld->uDeviceID].mmdIndex;
216  TRACE("Setting mmdIndex to %u\n", mld->mmdIndex);
217  dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags);
218  }
219  }
220  if (dwRet == MMSYSERR_NOERROR)
221  mld->dwDriverInstance = dwInstance;
222  return dwRet;
223 }
BOOL bSupportMapper
Definition: lolvldrv.c:32
#define DWORD_PTR
Definition: treelist.c:76
LPWINE_MLD lpMlds
Definition: lolvldrv.c:35
DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwFlags)
Definition: lolvldrv.c:183
UINT type
Definition: winemm.h:95
#define TRACE(s)
Definition: solgame.cpp:4
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: lolvldrv.c:71
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
uint32_t DWORD_PTR
Definition: typedefs.h:63
UINT uDeviceID
Definition: winemm.h:94
unsigned short UINT16
unsigned int UINT
Definition: ndis.h:50
UINT mmdIndex
Definition: winemm.h:96
static WINE_LLTYPE llTypes[MMDRV_MAX]
Definition: lolvldrv.c:48
DWORD_PTR dwDriverInstance
Definition: winemm.h:97

Referenced by midiInOpen(), midiOutOpen(), midiStreamOpen(), mixerOpen(), MMDRV_Open(), and WAVE_Open().

◆ MMDRV_PhysicalFeatures()

UINT MMDRV_PhysicalFeatures ( LPWINE_MLD  mld,
UINT  uMsg,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)

Definition at line 303 of file lolvldrv.c.

305 {
306  WINE_MM_DRIVER* lpDrv = &MMDrvs[mld->mmdIndex];
307 
308  TRACE("(%p, %04x, %08lx, %08lx)\n", mld, uMsg, dwParam1, dwParam2);
309 
310  /* all those function calls are undocumented */
311  switch (uMsg) {
312  case DRV_QUERYDRVENTRY:
313  lstrcpynA((LPSTR)dwParam1, lpDrv->drvname, LOWORD(dwParam2));
314  break;
315  case DRV_QUERYDEVNODE:
316  *(LPDWORD)dwParam1 = 0L; /* should be DevNode */
317  break;
318  case DRV_QUERYNAME:
319  WARN("NIY QueryName\n");
320  break;
321  case DRV_QUERYDRIVERIDS:
322  WARN("NIY call VxD\n");
323  /* should call VxD MMDEVLDR with (DevNode, dwParam1 and dwParam2) as pmts
324  * dwParam1 is buffer and dwParam2 is sizeof(buffer)
325  * I don't know where the result is stored though
326  */
327  break;
328  case DRV_QUERYMAPPABLE:
329  return (lpDrv->bIsMapper) ? 2 : 0;
330 
332  /* FIXME: get from registry someday */
333  *((LPDWORD)dwParam1) = -1; /* No preferred device */
334  *((LPDWORD)dwParam2) = 0;
335  break;
336 
339  return MMDRV_Message(mld, uMsg, dwParam1, dwParam2);
340 
341  case DRV_QUERYDSOUNDIFACE: /* Wine-specific: Retrieve DirectSound interface */
342  case DRV_QUERYDSOUNDDESC: /* Wine-specific: Retrieve DirectSound driver description*/
343  return MMDRV_Message(mld, uMsg, dwParam1, dwParam2);
344 
345  default:
346  WARN("Unknown call %04x\n", uMsg);
347  return MMSYSERR_INVALPARAM;
348  }
349  return 0L;
350 }
#define DRV_QUERYDRIVERIDS
Definition: mmddk.h:92
#define DRVM_MAPPER_PREFERRED_GET
Definition: mmsys.h:37
#define DRV_QUERYDRVENTRY
Definition: mmddk.h:89
unsigned bIsMapper
Definition: winemm.h:88
#define WARN(fmt,...)
Definition: debug.h:111
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
char * LPSTR
Definition: xmlstorage.h:182
LPSTR drvname
Definition: winemm.h:87
#define TRACE(s)
Definition: solgame.cpp:4
DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: lolvldrv.c:71
#define LPDWORD
Definition: nt_native.h:46
static const WCHAR L[]
Definition: oid.c:1250
#define DRV_QUERYDEVNODE
Definition: mmddk.h:90
#define DRV_QUERYMAPPABLE
Definition: mmddk.h:93
#define DRV_QUERYNAME
Definition: mmddk.h:91
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define lstrcpynA
Definition: compat.h:416
static WINE_MM_DRIVER MMDrvs[8]
Definition: lolvldrv.c:40
UINT mmdIndex
Definition: winemm.h:96
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
#define LOWORD(l)
Definition: pedump.c:82

Referenced by midiOutMessage(), waveInMessage(), and waveOutMessage().

◆ OpenDriverA()

HDRVR WINAPI OpenDriverA ( LPCSTR  lpDriverName,
LPCSTR  lpSectionName,
LPARAM  lParam 
)

Definition at line 365 of file driver.c.

366 {
367  INT len;
368  LPWSTR dn = NULL;
369  LPWSTR sn = NULL;
370  HDRVR ret = 0;
371 
372  if (lpDriverName)
373  {
374  len = MultiByteToWideChar( CP_ACP, 0, lpDriverName, -1, NULL, 0 );
375  dn = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
376  if (!dn) goto done;
377  MultiByteToWideChar( CP_ACP, 0, lpDriverName, -1, dn, len );
378  }
379 
380  if (lpSectionName)
381  {
382  len = MultiByteToWideChar( CP_ACP, 0, lpSectionName, -1, NULL, 0 );
383  sn = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
384  if (!sn) goto done;
385  MultiByteToWideChar( CP_ACP, 0, lpSectionName, -1, sn, len );
386  }
387 
388  ret = OpenDriver(dn, sn, lParam);
389 
390 done:
391  HeapFree(GetProcessHeap(), 0, dn);
392  HeapFree(GetProcessHeap(), 0, sn);
393  return ret;
394 }
#define CP_ACP
Definition: compat.h:99
HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
Definition: driver.c:400
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by JOY_LoadDriver(), and MMDRV_Install().

◆ TIME_MMTimeStop()

void TIME_MMTimeStop ( void  )

Definition at line 270 of file time.c.

271 {
272  if (TIME_hMMTimer) {
273 
276 
277  /* FIXME: in the worst case, we're going to wait 65 seconds here :-( */
279 
282  TIME_hMMTimer = 0;
284  }
285 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
static BOOL TIME_TimeToDie
Definition: time.c:49
static LPWINE_TIMERENTRY TIME_TimersList
Definition: time.c:46
static HANDLE TIME_hWakeEvent
Definition: time.c:48
static HANDLE TIME_hMMTimer
Definition: time.c:45
#define INFINITE
Definition: serial.h:102

Referenced by WINMM_DeleteIData().

◆ WINMM_CheckCallback()

MMRESULT WINMM_CheckCallback ( DWORD_PTR  dwCallback,
DWORD  fdwOpen,
BOOL  mixer 
)

Definition at line 196 of file winmm.c.

197 {
198  switch (fdwOpen & CALLBACK_TYPEMASK) {
199  case CALLBACK_NULL: /* dwCallback need not be NULL */
200  break;
201  case CALLBACK_WINDOW:
202  if (dwCallback && !IsWindow((HWND)dwCallback))
203  return MMSYSERR_INVALPARAM;
204  break;
205 
206  case CALLBACK_FUNCTION:
207  /* a NULL cb is acceptable since w2k, MMSYSERR_INVALPARAM earlier */
208  if (mixer)
209  return MMSYSERR_INVALFLAG; /* since w2k, MMSYSERR_NOTSUPPORTED earlier */
210  break;
211  case CALLBACK_THREAD:
212  case CALLBACK_EVENT:
213  if (mixer) /* FIXME: mixer supports THREAD+EVENT since w2k */
214  return MMSYSERR_NOTSUPPORTED; /* w9X */
215  break;
216  default:
217  WARN("Unknown callback type %d\n", HIWORD(fdwOpen));
218  }
219  return MMSYSERR_NOERROR;
220 }
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define WARN(fmt,...)
Definition: debug.h:111
#define CALLBACK_TYPEMASK
Definition: mmsystem.h:146
#define CALLBACK_EVENT
Definition: mmsystem.h:152
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define CALLBACK_THREAD
Definition: mmsystem.h:151
#define MMSYSERR_INVALFLAG
Definition: mmsystem.h:106
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define CALLBACK_NULL
Definition: mmsystem.h:147
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define HIWORD(l)
Definition: typedefs.h:246

Referenced by midiInOpen(), midiOutOpen(), midiStreamOpen(), mixerOpen(), and WAVE_Open().

◆ WINMM_CheckForMMSystem()

BOOL WINMM_CheckForMMSystem ( void  )

Definition at line 89 of file winmm.c.

90 {
91  /* 0 is not checked yet, -1 is not present, 1 is present */
92  static int loaded /* = 0 */;
93 
94  if (loaded == 0)
95  {
96  HANDLE h = GetModuleHandleA("kernel32");
97  loaded = -1;
98  if (h)
99  {
100  pGetModuleHandle16 = (void*)GetProcAddress(h, "GetModuleHandle16");
101  pLoadLibrary16 = (void*)GetProcAddress(h, (LPCSTR)35); /* ordinal for LoadLibrary16 */
102  if (pGetModuleHandle16 && pLoadLibrary16 &&
103  (pGetModuleHandle16("MMSYSTEM.DLL") || pLoadLibrary16("MMSYSTEM.DLL")))
104  loaded = 1;
105  }
106  }
107  return loaded > 0;
108 }
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL loaded
Definition: xmlview.c:54
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define GetProcAddress(x, y)
Definition: compat.h:418

Referenced by OpenDriver().

◆ WINMM_ErrorToString()

const char* WINMM_ErrorToString ( MMRESULT  error)

Definition at line 113 of file winmm.c.

114 {
115 #define ERR_TO_STR(dev) case dev: return #dev
116  static char unknown[32];
117  switch (error) {
147  }
148  sprintf(unknown, "Unknown(0x%08x)", error);
149  return unknown;
150 #undef ERR_TO_STR
151 }
#define MMSYSERR_BADDB
Definition: mmsystem.h:110
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define MMSYSERR_KEYNOTFOUND
Definition: mmsystem.h:111
#define MMSYSERR_READERROR
Definition: mmsystem.h:112
#define error(str)
Definition: mkdosfs.c:1605
#define MIDIERR_STILLPLAYING
Definition: mmsystem.h:232
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
#define MMSYSERR_VALNOTFOUND
Definition: mmsystem.h:115
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define ERR_TO_STR(dev)
#define MIDIERR_UNPREPARED
Definition: mmsystem.h:231
#define MMSYSERR_NODRIVER
Definition: mmsystem.h:102
#define MMSYSERR_NODRIVERCB
Definition: mmsystem.h:116
#define WAVERR_STILLPLAYING
Definition: mmsystem.h:177
#define MMSYSERR_HANDLEBUSY
Definition: mmsystem.h:108
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define MMSYSERR_ALLOCATED
Definition: mmsystem.h:100
#define MMSYSERR_INVALFLAG
Definition: mmsystem.h:106
#define WAVERR_SYNC
Definition: mmsystem.h:179
Definition: id3.c:18
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define MMSYSERR_NOTENABLED
Definition: mmsystem.h:99
#define MIDIERR_INVALIDSETUP
Definition: mmsystem.h:236
#define MMSYSERR_DELETEERROR
Definition: mmsystem.h:114
#define MMSYSERR_BADERRNUM
Definition: mmsystem.h:105
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define WAVERR_UNPREPARED
Definition: mmsystem.h:178
#define MMSYSERR_INVALIDALIAS
Definition: mmsystem.h:109
#define MIDIERR_NODEVICE
Definition: mmsystem.h:235
#define MMSYSERR_WRITEERROR
Definition: mmsystem.h:113

Referenced by MMDRV_ExitPerType(), MMDRV_InitPerType(), MMDRV_Message(), and WAVE_Open().

Variable Documentation

◆ hWinMM32Instance

◆ psLastEvent

HANDLE psLastEvent

Definition at line 51 of file winmm.c.

Referenced by MULTIMEDIA_PlaySound(), PlaySound_Free(), WINMM_CreateIData(), and WINMM_DeleteIData().

◆ psStopEvent

HANDLE psStopEvent

Definition at line 52 of file winmm.c.

Referenced by MULTIMEDIA_PlaySound(), proc_PlaySound(), WINMM_CreateIData(), and WINMM_DeleteIData().

◆ WINMM_cs