ReactOS 0.4.15-dev-7906-g1b85a5f
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"
 
#define ARRAY_SIZE(a)   (sizeof(a) / sizeof((a)[0]))
 
#define wcsnicmp   strncmpiW
 
#define swprintf   snprintfW
 

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)
 
DWORD MCI_SendCommand (UINT wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
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.

◆ ARRAY_SIZE

#define ARRAY_SIZE (   a)    (sizeof(a) / sizeof((a)[0]))

Definition at line 207 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 198 of file winemm.h.

◆ NT_MME_DRIVERS_KEY

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

Definition at line 201 of file winemm.h.

◆ swprintf

#define swprintf   snprintfW

Definition at line 209 of file winemm.h.

◆ wcsnicmp

#define wcsnicmp   strncmpiW

Definition at line 208 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 191 of file winemm.h.

◆ WINE_GDF_EXTERNAL_MASK

#define WINE_GDF_EXTERNAL_MASK   0xF0000000

Definition at line 192 of file winemm.h.

◆ WINE_GDF_SESSION

#define WINE_GDF_SESSION   0x00000001

Definition at line 193 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}
#define NULL
Definition: types.h:112
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
#define d
Definition: ke_i.h:81
#define TRACE(s)
Definition: solgame.cpp:4
struct tagWINE_DRIVER * LPWINE_DRIVER
#define WINE_DI_MAGIC
Definition: winemm.h:51

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}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
static const WCHAR HKLM_BASE[]
Definition: driver.c:37
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180

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}
HMODULE hModule
Definition: animate.c:44
#define GetProcessHeap()
Definition: compat.h:736
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define HeapFree(x, y, z)
Definition: compat.h:735
#define LoadLibraryW(x)
Definition: compat.h:747
static BOOL DRIVER_AddToList(LPWINE_DRIVER lpNewDrv, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:187
static unsigned DRIVER_GetNumberOfModuleRefs(HMODULE hModule, WINE_DRIVER **found)
Definition: driver.c:63
LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCWSTR fn, LPARAM lParam2)
Definition: driver.c:273
LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:462
#define debugstr_w
Definition: kernel32.h:32
LRESULT(CALLBACK * DRIVERPROC)(DWORD_PTR, HDRVR, UINT, LPARAM, LPARAM)
Definition: mmsystem.h:1001
static PVOID ptr
Definition: dispmode.c:27
#define L(x)
Definition: ntvdm.h:50
#define strchrW(s, c)
Definition: unicode.h:34
#define exit(n)
Definition: config.h:202
HMODULE hModule
Definition: winemm.h:58
DRIVERPROC lpDrvProc
Definition: winemm.h:59
DWORD_PTR dwDriverID
Definition: winemm.h:60
DWORD dwFlags
Definition: winemm.h:57
int ret
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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
664restart:
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}
void restart(int argc, const char *argv[])
Definition: cmds.c:2115
static LPWINE_DRIVER lpDrvItemList
Definition: driver.c:36
static CRITICAL_SECTION mmdriver_lock
Definition: driver.c:27
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct tagWINE_DRIVER * lpNextItem
Definition: winemm.h:62
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define WINE_GDF_SESSION
Definition: winemm.h:193

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
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}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3234
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
#define stricmp(_String1, _String2)
Definition: compat.h:24
static unsigned driver_count
Definition: ds3d.c:1254
unsigned int BOOL
Definition: ntddk_ex.h:94
#define REG_SZ
Definition: layer.c:22
BOOL MMDRV_Install(LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper)
Definition: lolvldrv.c:440
#define memset(x, y, z)
Definition: compat.h:39
Definition: copy.c:22
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
static const WCHAR drivers_key[]
Definition: odbccp32.c:44
#define RegEnumValue
Definition: winreg.h:511

Referenced by MMDRV_Init().

◆ MCI_SendCommand()

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

Definition at line 2075 of file mci.c.

2076{
2078
2079 switch (wMsg) {
2080 case MCI_OPEN:
2081 dwRet = MCI_Open(dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
2082 break;
2083 case MCI_CLOSE:
2084 dwRet = MCI_Close(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
2085 break;
2086 case MCI_SYSINFO:
2087 dwRet = MCI_SysInfo(wDevID, dwParam1, (LPMCI_SYSINFO_PARMSW)dwParam2);
2088 break;
2089 case MCI_BREAK:
2090 dwRet = MCI_Break(wDevID, dwParam1, (LPMCI_BREAK_PARMS)dwParam2);
2091 break;
2092 case MCI_SOUND:
2093 dwRet = MCI_Sound(wDevID, dwParam1, (LPMCI_SOUND_PARMSW)dwParam2);
2094 break;
2095 default:
2096 if ((UINT16)wDevID == (UINT16)MCI_ALL_DEVICE_ID) {
2097 FIXME("unhandled MCI_ALL_DEVICE_ID\n");
2098 dwRet = MCIERR_CANNOT_USE_ALL;
2099 } else {
2100 dwRet = MCI_SendCommandFrom32(wDevID, wMsg, dwParam1, dwParam2);
2101 }
2102 break;
2103 }
2104 return dwRet;
2105}
unsigned short UINT16
#define FIXME(fmt,...)
Definition: debug.h:111
static DWORD MCI_Break(UINT wDevID, DWORD dwFlags, LPMCI_BREAK_PARMS lpParms)
Definition: mci.c:2035
static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSW lpParms)
Definition: mci.c:1700
static DWORD MCI_SysInfo(UINT uDevID, DWORD dwFlags, LPMCI_SYSINFO_PARMSW lpParms)
Definition: mci.c:1884
static DWORD MCI_Close(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
Definition: mci.c:1821
static DWORD MCI_SendCommandFrom32(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: mci.c:876
static DWORD MCI_Sound(UINT wDevID, DWORD dwFlags, LPMCI_SOUND_PARMSW lpParms)
Definition: mci.c:2054
#define MCI_BREAK
Definition: mmsystem.h:660
#define MCIERR_UNRECOGNIZED_COMMAND
Definition: mmsystem.h:571
#define MCI_ALL_DEVICE_ID
Definition: mmsystem.h:679
#define MCI_CLOSE
Definition: mmsystem.h:647
#define MCI_OPEN
Definition: mmsystem.h:646
#define MCIERR_CANNOT_USE_ALL
Definition: mmsystem.h:589
#define MCI_SYSINFO
Definition: mmsystem.h:659

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

◆ MCI_strdupWtoA()

LPSTR MCI_strdupWtoA ( LPCWSTR  str)

◆ 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}
#define ERR(fmt,...)
Definition: debug.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
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 MAX_MM_MLDRVS
Definition: lolvldrv.c:42
UINT MMDRV_GetNum(UINT type)
Definition: lolvldrv.c:61
static LPWINE_MLD MM_MLDrvs[40]
Definition: lolvldrv.c:41
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
DWORD_PTR dwCallback
Definition: winemm.h:100
WORD dwFlags
Definition: winemm.h:99
DWORD_PTR dwClientInstance
Definition: winemm.h:101
UINT type
Definition: winemm.h:95
PVOID HANDLE
Definition: typedefs.h:73
#define HIWORD(l)
Definition: typedefs.h:247
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

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}
DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: lolvldrv.c:71

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

◆ MMDRV_Exit()

void MMDRV_Exit ( void  )

Definition at line 611 of file lolvldrv.c.

612{
613 unsigned int i;
614 TRACE("()\n");
615
616 for (i = 0; i < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0]); i++)
617 {
618 if (MM_MLDrvs[i] != NULL)
619 {
620 FIXME("Closing while ll-driver open\n");
621#if 0
622 /* FIXME: should generate a message depending on type */
623 MMDRV_Free((HANDLE)(i | 0x8000), MM_MLDrvs[i]);
624#endif
625 }
626 }
627
628 /* unload driver, in reverse order of loading */
629 i = MMDrvsHi;
630 while (i-- > 0)
631 {
638 CloseDriver(MMDrvs[i].hDriver, 0, 0);
639 }
640 if (llTypes[MMDRV_AUX].lpMlds)
641 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_AUX].lpMlds - 1);
642 if (llTypes[MMDRV_MIXER].lpMlds)
643 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIXER].lpMlds - 1);
644 if (llTypes[MMDRV_MIDIIN].lpMlds)
645 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIDIIN].lpMlds - 1);
646 if (llTypes[MMDRV_MIDIOUT].lpMlds)
647 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIDIOUT].lpMlds - 1);
648 if (llTypes[MMDRV_WAVEIN].lpMlds)
649 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_WAVEIN].lpMlds - 1);
650 if (llTypes[MMDRV_WAVEOUT].lpMlds)
651 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_WAVEOUT].lpMlds - 1);
652}
static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type)
Definition: lolvldrv.c:588
void MMDRV_Free(HANDLE hndl, LPWINE_MLD mld)
Definition: lolvldrv.c:165
static WINE_MM_DRIVER MMDrvs[8]
Definition: lolvldrv.c:40
static int MMDrvsHi
Definition: lolvldrv.c:39
static WINE_LLTYPE llTypes[MMDRV_MAX]
Definition: lolvldrv.c:48
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3557
#define MMDRV_WAVEIN
Definition: winemm.h:80
#define MMDRV_AUX
Definition: winemm.h:76
#define MMDRV_MIDIIN
Definition: winemm.h:78
#define MMDRV_MIDIOUT
Definition: winemm.h:79
#define MMDRV_WAVEOUT
Definition: winemm.h:81
#define MMDRV_MIXER
Definition: winemm.h:77

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 int idx
Definition: utils.c:41

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
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}
#define assert(x)
Definition: debug.h:53
static LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
Definition: lolvldrv.c:237
unsigned int UINT
Definition: ndis.h:50
#define MMDRV_MAX
Definition: winemm.h:82

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  type)

◆ 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
UINT mmdIndex
Definition: winemm.h:96
WINE_MM_DRIVER_PART parts[MMDRV_MAX]
Definition: winemm.h:89

Referenced by MIXER_GetDev().

◆ MMDRV_Init()

BOOL MMDRV_Init ( void  )

Definition at line 530 of file lolvldrv.c.

531{
532/* Redundant code, keeping this for reference only (for now) */
533#if 0
534 HKEY hKey;
535 char driver_buffer[256];
536 char mapper_buffer[256];
537 char midi_buffer[256];
538 char* p;
539 DWORD type, size;
540 BOOL ret = FALSE;
541 TRACE("()\n");
542
543 strcpy(driver_buffer, WINE_DEFAULT_WINMM_DRIVER);
544 strcpy(mapper_buffer, WINE_DEFAULT_WINMM_MAPPER);
545 strcpy(midi_buffer, WINE_DEFAULT_WINMM_MIDI);
546
547 /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
548 if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hKey))
549 {
550 size = sizeof(driver_buffer);
551 if (RegQueryValueExA(hKey, "Audio", 0, &type, (LPVOID)driver_buffer, &size))
552 strcpy(driver_buffer, WINE_DEFAULT_WINMM_DRIVER);
553 }
554
555 p = driver_buffer;
556 while (p)
557 {
558 char filename[sizeof(driver_buffer)+10];
559 char *next = strchr(p, ',');
560 if (next) *next++ = 0;
561 sprintf( filename, "wine%s.drv", p );
562 if ((ret = MMDRV_Install( filename, filename, FALSE ))) break;
563 p = next;
564 }
565
566 ret |= MMDRV_Install("beepmidi.dll", "beepmidi.dll", FALSE);
567
570 return ret;
571#else
572 INT driver_count = 0;
573
576
577 /* Explorer doesn't like us failing */
578 return TRUE;
579// return ( driver_count > 0 );
580#endif
581}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
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:4009
BOOL LoadRegistryMMEDrivers(char *key)
Definition: registry.c:23
GLfloat GLfloat p
Definition: glext.h:8902
const char * filename
Definition: ioapi.h:137
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static unsigned __int64 next
Definition: rand_nt.c:6
#define WINE_DEFAULT_WINMM_DRIVER
Definition: winemm.h:46
#define NT_MME_DRIVERS_KEY
Definition: winemm.h:201
#define NT_MME_DRIVERS32_KEY
Definition: winemm.h:198
#define WINE_DEFAULT_WINMM_MIDI
Definition: winemm.h:48
#define WINE_DEFAULT_WINMM_MAPPER
Definition: winemm.h:47
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by DllMain().

◆ MMDRV_Install()

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

Definition at line 440 of file lolvldrv.c.

441{
442 int i, count = 0;
446
447 TRACE("('%s', '%s', mapper=%c);\n", drvRegName, drvFileName, bIsMapper ? 'Y' : 'N');
448
449 for (i = 0; i < MMDrvsHi; i++) {
450 if (!strcmp(drvRegName, MMDrvs[i].drvname)) return FALSE;
451 }
452
453 /* Be sure that size of MMDrvs matches the max number of loadable
454 * drivers !!
455 * If not just increase size of MMDrvs
456 */
457 assert(MMDrvsHi <= sizeof(MMDrvs)/sizeof(MMDrvs[0]));
458
459 memset(lpDrv, 0, sizeof(*lpDrv));
460
461 if (!(lpDrv->hDriver = OpenDriverA(drvFileName, 0, 0))) {
462 WARN("Couldn't open driver '%s'\n", drvFileName);
463 return FALSE;
464 }
465
467
468 if (!(d = DRIVER_FindFromHDrvr(lpDrv->hDriver))) {
469 CloseDriver(lpDrv->hDriver, 0, 0);
470 WARN("Couldn't get the WINE internal structure for driver '%s'\n", drvFileName);
471 return FALSE;
472 }
473
474 /* Then look for xxxMessage functions */
475#define AA(_h,_w,_x,_y,_z) \
476 func = (WINEMM_msgFunc##_y) _z ((_h), #_x); \
477 if (func != NULL) \
478 { lpDrv->parts[_w].fnMessage##_y = func; count++; \
479 TRACE("Got %d bit func '%s'\n", _y, #_x); }
480
481 if (d->hModule) {
482#define A(_x,_y) AA(d->hModule,_x,_y,32,GetProcAddress)
489#undef A
490 }
491#undef AA
492
493 if (!count) {
494 CloseDriver(lpDrv->hDriver, 0, 0);
495 WARN("No message functions found\n");
496 return FALSE;
497 }
498
499 /* FIXME: being a mapper or not should be known by another way */
500 /* it's known for NE drvs (the description is of the form '*mapper: *'
501 * I don't have any clue for PE drvs
502 */
503 lpDrv->bIsMapper = bIsMapper;
504 lpDrv->drvname = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(drvRegName) + 1), drvRegName);
505
506 /* Finish init and get the count of the devices */
507 i = 0;
514 /* if all those func calls return FALSE, then the driver must be unloaded */
515 if (!i) {
516 CloseDriver(lpDrv->hDriver, 0, 0);
517 HeapFree(GetProcessHeap(), 0, lpDrv->drvname);
518 WARN("Driver initialization failed\n");
519 return FALSE;
520 }
521
522 MMDrvsHi++;
523
524 return TRUE;
525}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
APIENTRY DWORD auxMessage(UINT dwId, UINT uMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
Definition: auxil.c:20
MMRESULT FAR PASCAL modMessage(UINT device_id, UINT message, DWORD_PTR private_data, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: beepmidi.c:771
#define WARN(fmt,...)
Definition: debug.h:112
APIENTRY DWORD midMessage(DWORD dwId, DWORD dwMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
Definition: midi.c:251
#define WIDM_GETNUMDEVS
Definition: mmddk.h:136
#define AUXDM_GETNUMDEVS
Definition: mmddk.h:182
#define MODM_GETNUMDEVS
Definition: mmddk.h:154
#define WODM_GETNUMDEVS
Definition: mmddk.h:108
#define MIDM_GETNUMDEVS
Definition: mmddk.h:169
#define MXDM_GETNUMDEVS
Definition: mmddk.h:191
LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr)
Definition: driver.c:89
HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam)
Definition: driver.c:365
GLenum func
Definition: glext.h:6028
#define A(_x, _y)
Definition: lolvldrv.c:44
static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg)
Definition: lolvldrv.c:359
DWORD APIENTRY wodMessage(UINT device_id, UINT message, DWORD_PTR private_handle, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: mme.c:48
DWORD APIENTRY mxdMessage(UINT DeviceId, UINT Message, DWORD_PTR PrivateHandle, DWORD_PTR Parameter1, DWORD_PTR Parameter2)
Definition: mxdMessage.c:69
LPSTR drvname
Definition: winemm.h:87
unsigned bIsMapper
Definition: winemm.h:88
HDRVR hDriver
Definition: winemm.h:86
DWORD APIENTRY widMessage(UINT DeviceId, UINT Message, DWORD_PTR PrivateHandle, DWORD_PTR Parameter1, DWORD_PTR Parameter2)
Definition: widMessage.c:20
DWORD(CALLBACK * WINEMM_msgFunc32)(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR)
Definition: winemm.h:65

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;
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);
89 }
90 devID = -1;
91 } else {
92 if (mld->uDeviceID >= llType->wMaxId) {
93 WARN("uDev(%u) requested >= max (%d)\n", mld->uDeviceID, llType->wMaxId);
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}
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
LPCSTR typestr
Definition: lolvldrv.c:31
BOOL bSupportMapper
Definition: lolvldrv.c:32
DWORD_PTR dwDriverInstance
Definition: winemm.h:97
UINT uDeviceID
Definition: winemm.h:94
WINEMM_msgFunc32 fnMessage32
Definition: winemm.h:73
const char * WINMM_ErrorToString(MMRESULT error)
Definition: winmm.c:110

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{
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}
DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwFlags)
Definition: lolvldrv.c:183
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
LPWINE_MLD lpMlds
Definition: lolvldrv.c:35
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65

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) {
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;
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;
329 return (lpDrv->bIsMapper) ? 2 : 0;
330
332 /* FIXME: get from registry someday */
333#ifdef __REACTOS__
334 if (!dwParam1 || !dwParam2)
335 return MMSYSERR_INVALPARAM;
336#endif
337 *((LPDWORD)dwParam1) = -1; /* No preferred device */
338 *((LPDWORD)dwParam2) = 0;
339 break;
340
343 return MMDRV_Message(mld, uMsg, dwParam1, dwParam2);
344
345 case DRV_QUERYDSOUNDIFACE: /* Wine-specific: Retrieve DirectSound interface */
346 case DRV_QUERYDSOUNDDESC: /* Wine-specific: Retrieve DirectSound driver description*/
347 return MMDRV_Message(mld, uMsg, dwParam1, dwParam2);
348
349 default:
350 WARN("Unknown call %04x\n", uMsg);
351 return MMSYSERR_INVALPARAM;
352 }
353 return 0L;
354}
#define lstrcpynA
Definition: compat.h:751
#define DRV_QUERYDEVNODE
Definition: mmddk.h:90
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
#define DRV_QUERYDRVENTRY
Definition: mmddk.h:89
#define DRV_QUERYNAME
Definition: mmddk.h:91
#define DRV_QUERYMAPPABLE
Definition: mmddk.h:93
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
#define DRV_QUERYDRIVERIDS
Definition: mmddk.h:92
#define DRVM_MAPPER_PREFERRED_GET
Definition: mmsys.h:39
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define LPDWORD
Definition: nt_native.h:46
#define LOWORD(l)
Definition: pedump.c:82
char * LPSTR
Definition: xmlstorage.h:182

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
390done:
391 HeapFree(GetProcessHeap(), 0, dn);
392 HeapFree(GetProcessHeap(), 0, sn);
393 return ret;
394}
LPARAM lParam
Definition: combotst.c:139
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
HDRVR WINAPI OpenDriver(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
Definition: driver.c:400
GLenum GLsizei len
Definition: glext.h:6722

Referenced by JOY_LoadDriver(), and MMDRV_Install().

◆ TIME_MMTimeStop()

void TIME_MMTimeStop ( void  )

Definition at line 271 of file time.c.

272{
273 if (TIME_hMMTimer) {
274
277
278 /* FIXME: in the worst case, we're going to wait 65 seconds here :-( */
280
283 TIME_hMMTimer = 0;
285 }
286}
#define CloseHandle
Definition: compat.h:739
static BOOL TIME_TimeToDie
Definition: time.c:49
static HANDLE TIME_hMMTimer
Definition: time.c:45
static HANDLE TIME_hWakeEvent
Definition: time.c:48
static LPWINE_TIMERENTRY TIME_TimersList
Definition: time.c:46
#define INFINITE
Definition: serial.h:102
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733

Referenced by WINMM_DeleteIData().

◆ WINMM_CheckCallback()

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

Definition at line 193 of file winmm.c.

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

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

◆ WINMM_CheckForMMSystem()

BOOL WINMM_CheckForMMSystem ( void  )

Definition at line 86 of file winmm.c.

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

Referenced by OpenDriver().

◆ WINMM_ErrorToString()

const char * WINMM_ErrorToString ( MMRESULT  error)

Definition at line 110 of file winmm.c.

111{
112#define ERR_TO_STR(dev) case dev: return #dev
113 static char unknown[32];
114 switch (error) {
144 }
145 sprintf(unknown, "Unknown(0x%08x)", error);
146 return unknown;
147#undef ERR_TO_STR
148}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define error(str)
Definition: mkdosfs.c:1605
#define WAVERR_STILLPLAYING
Definition: mmsystem.h:177
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define MMSYSERR_HANDLEBUSY
Definition: mmsystem.h:108
#define MMSYSERR_BADDB
Definition: mmsystem.h:110
#define MIDIERR_INVALIDSETUP
Definition: mmsystem.h:236
#define MIDIERR_NODEVICE
Definition: mmsystem.h:235
#define MMSYSERR_NODRIVER
Definition: mmsystem.h:102
#define MIDIERR_UNPREPARED
Definition: mmsystem.h:231
#define MMSYSERR_DELETEERROR
Definition: mmsystem.h:114
#define MMSYSERR_NODRIVERCB
Definition: mmsystem.h:116
#define MMSYSERR_VALNOTFOUND
Definition: mmsystem.h:115
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
#define MMSYSERR_WRITEERROR
Definition: mmsystem.h:113
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define MMSYSERR_ALLOCATED
Definition: mmsystem.h:100
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define MIDIERR_STILLPLAYING
Definition: mmsystem.h:232
#define MMSYSERR_READERROR
Definition: mmsystem.h:112
#define MMSYSERR_KEYNOTFOUND
Definition: mmsystem.h:111
#define WAVERR_UNPREPARED
Definition: mmsystem.h:178
#define MMSYSERR_NOTENABLED
Definition: mmsystem.h:99
#define WAVERR_SYNC
Definition: mmsystem.h:179
#define MMSYSERR_INVALIDALIAS
Definition: mmsystem.h:109
#define MMSYSERR_BADERRNUM
Definition: mmsystem.h:105
#define ERR_TO_STR(dev)

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

Variable Documentation

◆ hWinMM32Instance

◆ psLastEvent

HANDLE psLastEvent
extern

Definition at line 51 of file winmm.c.

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

◆ psStopEvent

HANDLE psStopEvent
extern

◆ WINMM_cs