Sync to Wine-20050111:
Eric Pouech <pouech-eric(a)wanadoo.fr>
Filip Navara <xnavara(a)volny.cz>
- 32 bit low level drivers now use a Unicode interface (used to be
ANSI):
- Send the *_GETDEVCAPS messages in unicode format from the
*GetDevCapsW function and call the *GetDevCapsW from their respective
Ansi versions.
- Modify all low level drivers to correctly process the *_GETDEVCAPS
messages as unicode.
- *_GETDEVCAPS messages are now mapped from/to unicode for 16 bit code.
- Removed all SoundBlaster naming oldies.
Better use of some unicode functions (instead of Ansi) in winmm.
Alexandre Julliard <julliard(a)winehq.org>
- Fixed header dependencies to be fully compatible with the Windows
headers (with help from Dimitrie O. Paun).
- Get rid of the ThunkData stubs, these are not functions.
Jeff Smith <whydoubt(a)hotmail.com>
- Fix for MIDI Mapper.
Robert Reif <reif(a)earthlink.net>
- Return actual result on error.
- Return flag for DRVM_MAPPER_PREFERRED_GET.
Michael Stefaniuc <mstefani(a)redhat.de>
- Do not check for non NULL pointer before HeapFree'ing it. It's
redundant.
Ge van Geldorp <gvg(a)reactos.com>
- Match PSDK definitions for LPCWAVEFORMATEX.
Modified: trunk/reactos/lib/winmm/driver.c
Modified: trunk/reactos/lib/winmm/joystick.c
Modified: trunk/reactos/lib/winmm/lolvldrv.c
Modified: trunk/reactos/lib/winmm/mci.c
Modified: trunk/reactos/lib/winmm/message16.c
Deleted: trunk/reactos/lib/winmm/midimap/.cvsignore
Modified: trunk/reactos/lib/winmm/midimap/midimap.c
Modified: trunk/reactos/lib/winmm/mmio.c
Modified: trunk/reactos/lib/winmm/mmsystem.c
Modified: trunk/reactos/lib/winmm/playsound.c
Deleted: trunk/reactos/lib/winmm/wavemap/.cvsignore
Modified: trunk/reactos/lib/winmm/wavemap/wavemap.c
Modified: trunk/reactos/lib/winmm/winemm.h
Modified: trunk/reactos/lib/winmm/winmm.c
Modified: trunk/reactos/lib/winmm/winmm.spec
_____
Modified: trunk/reactos/lib/winmm/driver.c
--- trunk/reactos/lib/winmm/driver.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/driver.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -368,8 +368,8 @@
ret = OpenDriverA(dn, sn, lParam);
- if (dn) HeapFree(GetProcessHeap(), 0, dn);
- if (sn) HeapFree(GetProcessHeap(), 0, sn);
+ HeapFree(GetProcessHeap(), 0, dn);
+ HeapFree(GetProcessHeap(), 0, sn);
return ret;
}
_____
Modified: trunk/reactos/lib/winmm/joystick.c
--- trunk/reactos/lib/winmm/joystick.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/joystick.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -138,9 +138,9 @@
}
/***********************************************************************
***
- * joyGetDevCapsA [WINMM.@]
+ * joyGetDevCapsW [WINMM.@]
*/
-MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT
wSize)
+MMRESULT WINAPI joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT
wSize)
{
if (wID >= MAXJOYSTICK) return JOYERR_PARMS;
if (!JOY_LoadDriver(wID)) return MMSYSERR_NODRIVER;
@@ -152,43 +152,49 @@
}
/***********************************************************************
***
- * joyGetDevCapsW [WINMM.@]
+ * joyGetDevCapsA [WINMM.@]
*/
-MMRESULT WINAPI joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT
wSize)
+MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT
wSize)
{
- JOYCAPSA jca;
- MMRESULT ret = joyGetDevCapsA(wID, &jca, sizeof(jca));
+ JOYCAPSW jcw;
+ MMRESULT ret;
- if (ret != JOYERR_NOERROR) return ret;
- lpCaps->wMid = jca.wMid;
- lpCaps->wPid = jca.wPid;
- MultiByteToWideChar( CP_ACP, 0, jca.szPname, -1, lpCaps->szPname,
- sizeof(lpCaps->szPname)/sizeof(WCHAR) );
- lpCaps->wXmin = jca.wXmin;
- lpCaps->wXmax = jca.wXmax;
- lpCaps->wYmin = jca.wYmin;
- lpCaps->wYmax = jca.wYmax;
- lpCaps->wZmin = jca.wZmin;
- lpCaps->wZmax = jca.wZmax;
- lpCaps->wNumButtons = jca.wNumButtons;
- lpCaps->wPeriodMin = jca.wPeriodMin;
- lpCaps->wPeriodMax = jca.wPeriodMax;
+ if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
- if (wSize >= sizeof(JOYCAPSW)) { /* Win95 extensions ? */
- lpCaps->wRmin = jca.wRmin;
- lpCaps->wRmax = jca.wRmax;
- lpCaps->wUmin = jca.wUmin;
- lpCaps->wUmax = jca.wUmax;
- lpCaps->wVmin = jca.wVmin;
- lpCaps->wVmax = jca.wVmax;
- lpCaps->wCaps = jca.wCaps;
- lpCaps->wMaxAxes = jca.wMaxAxes;
- lpCaps->wNumAxes = jca.wNumAxes;
- lpCaps->wMaxButtons = jca.wMaxButtons;
- MultiByteToWideChar( CP_ACP, 0, jca.szRegKey, -1,
lpCaps->szRegKey,
- sizeof(lpCaps->szRegKey)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, jca.szOEMVxD, -1,
lpCaps->szOEMVxD,
- sizeof(lpCaps->szOEMVxD)/sizeof(WCHAR) );
+ ret = joyGetDevCapsW(wID, &jcw, sizeof(jcw));
+
+ if (ret == JOYERR_NOERROR)
+ {
+ lpCaps->wMid = jcw.wMid;
+ lpCaps->wPid = jcw.wPid;
+ WideCharToMultiByte( CP_ACP, 0, jcw.szPname, -1,
lpCaps->szPname,
+ sizeof(lpCaps->szPname), NULL, NULL );
+ lpCaps->wXmin = jcw.wXmin;
+ lpCaps->wXmax = jcw.wXmax;
+ lpCaps->wYmin = jcw.wYmin;
+ lpCaps->wYmax = jcw.wYmax;
+ lpCaps->wZmin = jcw.wZmin;
+ lpCaps->wZmax = jcw.wZmax;
+ lpCaps->wNumButtons = jcw.wNumButtons;
+ lpCaps->wPeriodMin = jcw.wPeriodMin;
+ lpCaps->wPeriodMax = jcw.wPeriodMax;
+
+ if (wSize >= sizeof(JOYCAPSA)) { /* Win95 extensions ? */
+ lpCaps->wRmin = jcw.wRmin;
+ lpCaps->wRmax = jcw.wRmax;
+ lpCaps->wUmin = jcw.wUmin;
+ lpCaps->wUmax = jcw.wUmax;
+ lpCaps->wVmin = jcw.wVmin;
+ lpCaps->wVmax = jcw.wVmax;
+ lpCaps->wCaps = jcw.wCaps;
+ lpCaps->wMaxAxes = jcw.wMaxAxes;
+ lpCaps->wNumAxes = jcw.wNumAxes;
+ lpCaps->wMaxButtons = jcw.wMaxButtons;
+ WideCharToMultiByte( CP_ACP, 0, jcw.szRegKey, -1,
lpCaps->szRegKey,
+ sizeof(lpCaps->szRegKey), NULL, NULL
);
+ WideCharToMultiByte( CP_ACP, 0, jcw.szOEMVxD, -1,
lpCaps->szOEMVxD,
+ sizeof(lpCaps->szOEMVxD), NULL, NULL
);
+ }
}
return ret;
_____
Modified: trunk/reactos/lib/winmm/lolvldrv.c
--- trunk/reactos/lib/winmm/lolvldrv.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/lolvldrv.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -504,6 +504,7 @@
case DRVM_MAPPER_PREFERRED_GET:
/* FIXME: get from registry someday */
*((LPDWORD)dwParam1) = -1; /* No preferred device */
+ *((LPDWORD)dwParam2) = 0;
break;
case DRV_QUERYDEVICEINTERFACE:
_____
Modified: trunk/reactos/lib/winmm/mci.c
--- trunk/reactos/lib/winmm/mci.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/mci.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -415,10 +415,8 @@
return FALSE;
S_MciCmdTable[uTbl].lpTable = NULL;
- if (S_MciCmdTable[uTbl].aVerbs) {
- HeapFree(GetProcessHeap(), 0, S_MciCmdTable[uTbl].aVerbs);
- S_MciCmdTable[uTbl].aVerbs = 0;
- }
+ HeapFree(GetProcessHeap(), 0, S_MciCmdTable[uTbl].aVerbs);
+ S_MciCmdTable[uTbl].aVerbs = 0;
return TRUE;
}
@@ -1090,7 +1088,7 @@
if (lpwstrRet)
MultiByteToWideChar( CP_ACP, 0, lpstrRet, -1, lpwstrRet,
uRetLen );
HeapFree(GetProcessHeap(), 0, lpstrCommand);
- if (lpstrRet) HeapFree(GetProcessHeap(), 0, lpstrRet);
+ HeapFree(GetProcessHeap(), 0, lpstrRet);
return ret;
}
_____
Modified: trunk/reactos/lib/winmm/message16.c
--- trunk/reactos/lib/winmm/message16.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/message16.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -1,7 +1,7 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
- * MMSYTEM MCI and low level mapping functions
+ * MMSYSTEM MCI and low level mapping functions
*
* Copyright 1999 Eric Pouech
*
@@ -297,14 +297,14 @@
case MODM_GETDEVCAPS:
{
- LPMIDIOUTCAPSA moc32 = HeapAlloc(GetProcessHeap(), 0,
sizeof(LPMIDIOUTCAPS16) + sizeof(MIDIOUTCAPSA));
+ LPMIDIOUTCAPSW moc32 = HeapAlloc(GetProcessHeap(), 0,
sizeof(LPMIDIOUTCAPS16) + sizeof(MIDIOUTCAPSW));
LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1);
if (moc32) {
*(LPMIDIOUTCAPS16*)moc32 = moc16;
- moc32 = (LPMIDIOUTCAPSA)((LPSTR)moc32 +
sizeof(LPMIDIOUTCAPS16));
+ moc32 = (LPMIDIOUTCAPSW)((LPSTR)moc32 +
sizeof(LPMIDIOUTCAPS16));
*lpParam1 = (DWORD)moc32;
- *lpParam2 = sizeof(MIDIOUTCAPSA);
+ *lpParam2 = sizeof(MIDIOUTCAPSW);
ret = WINMM_MAP_OKMEM;
} else {
@@ -390,13 +390,14 @@
case MODM_GETDEVCAPS:
{
- LPMIDIOUTCAPSA moc32 =
(LPMIDIOUTCAPSA)(*lpParam1);
+ LPMIDIOUTCAPSW moc32 =
(LPMIDIOUTCAPSW)(*lpParam1);
LPMIDIOUTCAPS16 moc16 =
*(LPMIDIOUTCAPS16*)((LPSTR)moc32 - sizeof(LPMIDIOUTCAPS16));
moc16->wMid = moc32->wMid;
moc16->wPid = moc32->wPid;
moc16->vDriverVersion = moc32->vDriverVersion;
- strcpy(moc16->szPname, moc32->szPname);
+ WideCharToMultiByte( CP_ACP, 0, moc32->szPname, -1,
moc16->szPname,
+ sizeof(moc16->szPname), NULL, NULL );
moc16->wTechnology = moc32->wTechnology;
moc16->wVoices = moc32->wVoices;
moc16->wNotes = moc32->wNotes;
@@ -455,16 +456,16 @@
break;
case MODM_GETDEVCAPS:
{
- LPMIDIOUTCAPSA moc32 = (LPMIDIOUTCAPSA)*lpParam1;
- LPSTR ptr = HeapAlloc( GetProcessHeap(), 0,
sizeof(LPMIDIOUTCAPSA)+sizeof(MIDIOUTCAPS16));
+ LPMIDIOUTCAPSW moc32 = (LPMIDIOUTCAPSW)*lpParam1;
+ LPSTR ptr = HeapAlloc( GetProcessHeap(), 0,
sizeof(LPMIDIOUTCAPSW)+sizeof(MIDIOUTCAPS16));
if (ptr) {
- *(LPMIDIOUTCAPSA*)ptr = moc32;
+ *(LPMIDIOUTCAPSW*)ptr = moc32;
ret = WINMM_MAP_OKMEM;
} else {
ret = WINMM_MAP_NOMEM;
}
- *lpParam1 = (DWORD)MapLS(ptr) + sizeof(LPMIDIOUTCAPSA);
+ *lpParam1 = (DWORD)MapLS(ptr) + sizeof(LPMIDIOUTCAPSW);
*lpParam2 = sizeof(MIDIOUTCAPS16);
}
break;
@@ -596,13 +597,14 @@
case MODM_GETDEVCAPS:
{
LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1);
- LPSTR ptr = (LPSTR)moc16 -
sizeof(LPMIDIOUTCAPSA);
- LPMIDIOUTCAPSA moc32 = *(LPMIDIOUTCAPSA*)ptr;
+ LPSTR ptr = (LPSTR)moc16 -
sizeof(LPMIDIOUTCAPSW);
+ LPMIDIOUTCAPSW moc32 = *(LPMIDIOUTCAPSW*)ptr;
moc32->wMid = moc16->wMid;
moc32->wPid = moc16->wPid;
moc32->vDriverVersion = moc16->vDriverVersion;
- strcpy(moc32->szPname, moc16->szPname);
+ WideCharToMultiByte( CP_ACP, 0, moc32->szPname, -1,
moc16->szPname,
+ sizeof(moc16->szPname), NULL, NULL );
moc32->wTechnology = moc16->wTechnology;
moc32->wVoices = moc16->wVoices;
moc32->wNotes = moc16->wNotes;
@@ -723,14 +725,14 @@
break;
case WIDM_GETDEVCAPS:
{
- LPWAVEINCAPSA wic32 = HeapAlloc(GetProcessHeap(), 0,
sizeof(LPWAVEINCAPS16) + sizeof(WAVEINCAPSA));
+ LPWAVEINCAPSW wic32 = HeapAlloc(GetProcessHeap(), 0,
sizeof(LPWAVEINCAPS16) + sizeof(WAVEINCAPSW));
LPWAVEINCAPS16 wic16 = MapSL(*lpParam1);
if (wic32) {
*(LPWAVEINCAPS16*)wic32 = wic16;
- wic32 = (LPWAVEINCAPSA)((LPSTR)wic32 +
sizeof(LPWAVEINCAPS16));
+ wic32 = (LPWAVEINCAPSW)((LPSTR)wic32 +
sizeof(LPWAVEINCAPS16));
*lpParam1 = (DWORD)wic32;
- *lpParam2 = sizeof(WAVEINCAPSA);
+ *lpParam2 = sizeof(WAVEINCAPSW);
ret = WINMM_MAP_OKMEM;
} else {
@@ -833,13 +835,14 @@
break;
case WIDM_GETDEVCAPS:
{
- LPWAVEINCAPSA wic32 =
(LPWAVEINCAPSA)(*lpParam1);
+ LPWAVEINCAPSW wic32 =
(LPWAVEINCAPSW)(*lpParam1);
LPWAVEINCAPS16 wic16 =
*(LPWAVEINCAPS16*)((LPSTR)wic32 - sizeof(LPWAVEINCAPS16));
wic16->wMid = wic32->wMid;
wic16->wPid = wic32->wPid;
wic16->vDriverVersion = wic32->vDriverVersion;
- strcpy(wic16->szPname, wic32->szPname);
+ WideCharToMultiByte( CP_ACP, 0, wic32->szPname, -1,
wic16->szPname,
+ sizeof(wic16->szPname), NULL, NULL );
wic16->dwFormats = wic32->dwFormats;
wic16->wChannels = wic32->wChannels;
HeapFree(GetProcessHeap(), 0, (LPSTR)wic32 -
sizeof(LPWAVEINCAPS16));
@@ -1010,16 +1013,16 @@
break;
case WIDM_GETDEVCAPS:
{
- LPWAVEINCAPSA wic32 = (LPWAVEINCAPSA)*lpParam1;
- LPSTR ptr = HeapAlloc( GetProcessHeap(), 0
,sizeof(LPWAVEINCAPSA) + sizeof(WAVEINCAPS16));
+ LPWAVEINCAPSW wic32 = (LPWAVEINCAPSW)*lpParam1;
+ LPSTR ptr = HeapAlloc( GetProcessHeap(), 0
,sizeof(LPWAVEINCAPSW) + sizeof(WAVEINCAPS16));
if (ptr) {
- *(LPWAVEINCAPSA*)ptr = wic32;
+ *(LPWAVEINCAPSW*)ptr = wic32;
ret = WINMM_MAP_OKMEM;
} else {
ret = WINMM_MAP_NOMEM;
}
- *lpParam1 = MapLS(ptr) + sizeof(LPWAVEINCAPSA);
+ *lpParam1 = MapLS(ptr) + sizeof(LPWAVEINCAPSW);
*lpParam2 = sizeof(WAVEINCAPS16);
}
break;
@@ -1109,13 +1112,14 @@
case WIDM_GETDEVCAPS:
{
LPWAVEINCAPS16 wic16 = MapSL(*lpParam1);
- LPSTR ptr = (LPSTR)wic16 -
sizeof(LPWAVEINCAPSA);
- LPWAVEINCAPSA wic32 = *(LPWAVEINCAPSA*)ptr;
+ LPSTR ptr = (LPSTR)wic16 -
sizeof(LPWAVEINCAPSW);
+ LPWAVEINCAPSW wic32 = *(LPWAVEINCAPSW*)ptr;
wic32->wMid = wic16->wMid;
wic32->wPid = wic16->wPid;
wic32->vDriverVersion = wic16->vDriverVersion;
- strcpy(wic32->szPname, wic16->szPname);
+ WideCharToMultiByte( CP_ACP, 0, wic32->szPname, -1,
wic16->szPname,
+ sizeof(wic16->szPname), NULL, NULL );
wic32->dwFormats = wic16->dwFormats;
wic32->wChannels = wic16->wChannels;
UnMapLS( *lpParam1 );
@@ -1222,14 +1226,14 @@
case WODM_GETDEVCAPS:
{
- LPWAVEOUTCAPSA woc32 =
HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEOUTCAPS16) +
sizeof(WAVEOUTCAPSA));
+ LPWAVEOUTCAPSW woc32 =
HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEOUTCAPS16) +
sizeof(WAVEOUTCAPSW));
LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1);
if (woc32) {
*(LPWAVEOUTCAPS16*)woc32 = woc16;
- woc32 = (LPWAVEOUTCAPSA)((LPSTR)woc32 +
sizeof(LPWAVEOUTCAPS16));
+ woc32 = (LPWAVEOUTCAPSW)((LPSTR)woc32 +
sizeof(LPWAVEOUTCAPS16));
*lpParam1 = (DWORD)woc32;
- *lpParam2 = sizeof(WAVEOUTCAPSA);
+ *lpParam2 = sizeof(WAVEOUTCAPSW);
ret = WINMM_MAP_OKMEM;
} else {
@@ -1341,13 +1345,14 @@
case WODM_GETDEVCAPS:
{
- LPWAVEOUTCAPSA woc32 =
(LPWAVEOUTCAPSA)(*lpParam1);
+ LPWAVEOUTCAPSW woc32 =
(LPWAVEOUTCAPSW)(*lpParam1);
LPWAVEOUTCAPS16 woc16 =
*(LPWAVEOUTCAPS16*)((LPSTR)woc32 - sizeof(LPWAVEOUTCAPS16));
woc16->wMid = woc32->wMid;
woc16->wPid = woc32->wPid;
woc16->vDriverVersion = woc32->vDriverVersion;
- strcpy(woc16->szPname, woc32->szPname);
+ WideCharToMultiByte( CP_ACP, 0, woc32->szPname, -1,
woc16->szPname,
+ sizeof(woc16->szPname), NULL, NULL );
woc16->dwFormats = woc32->dwFormats;
woc16->wChannels = woc32->wChannels;
woc16->dwSupport = woc32->dwSupport;
@@ -1416,17 +1421,17 @@
case WODM_GETDEVCAPS:
{
- LPWAVEOUTCAPSA woc32 = (LPWAVEOUTCAPSA)*lpParam1;
+ LPWAVEOUTCAPSW woc32 = (LPWAVEOUTCAPSW)*lpParam1;
LPSTR ptr = HeapAlloc( GetProcessHeap(), 0,
- sizeof(LPWAVEOUTCAPSA) +
sizeof(WAVEOUTCAPS16));
+ sizeof(LPWAVEOUTCAPSW) +
sizeof(WAVEOUTCAPS16));
if (ptr) {
- *(LPWAVEOUTCAPSA*)ptr = woc32;
+ *(LPWAVEOUTCAPSW*)ptr = woc32;
ret = WINMM_MAP_OKMEM;
} else {
ret = WINMM_MAP_NOMEM;
}
- *lpParam1 = MapLS(ptr) + sizeof(LPWAVEOUTCAPSA);
+ *lpParam1 = MapLS(ptr) + sizeof(LPWAVEOUTCAPSW);
*lpParam2 = sizeof(WAVEOUTCAPS16);
}
break;
@@ -1606,13 +1611,14 @@
case WODM_GETDEVCAPS:
{
LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1);
- LPSTR ptr = (LPSTR)woc16 -
sizeof(LPWAVEOUTCAPSA);
- LPWAVEOUTCAPSA woc32 = *(LPWAVEOUTCAPSA*)ptr;
+ LPSTR ptr = (LPSTR)woc16 -
sizeof(LPWAVEOUTCAPSW);
+ LPWAVEOUTCAPSW woc32 = *(LPWAVEOUTCAPSW*)ptr;
woc32->wMid = woc16->wMid;
woc32->wPid = woc16->wPid;
woc32->vDriverVersion = woc16->vDriverVersion;
- strcpy(woc32->szPname, woc16->szPname);
+ WideCharToMultiByte( CP_ACP, 0, woc32->szPname, -1,
woc16->szPname,
+ sizeof(woc16->szPname), NULL, NULL );
woc32->dwFormats = woc16->dwFormats;
woc32->wChannels = woc16->wChannels;
woc32->dwSupport = woc16->dwSupport;
_____
Deleted: trunk/reactos/lib/winmm/midimap/.cvsignore
--- trunk/reactos/lib/winmm/midimap/.cvsignore 2005-01-12 23:25:02 UTC
(rev 13005)
+++ trunk/reactos/lib/winmm/midimap/.cvsignore 2005-01-12 23:33:10 UTC
(rev 13006)
@@ -1,2 +0,0 @@
-Makefile
-midimap.drv.dbg.c
_____
Modified: trunk/reactos/lib/winmm/midimap/midimap.c
--- trunk/reactos/lib/winmm/midimap/midimap.c 2005-01-12 23:25:02 UTC
(rev 13005)
+++ trunk/reactos/lib/winmm/midimap/midimap.c 2005-01-12 23:33:10 UTC
(rev 13006)
@@ -32,6 +32,7 @@
#include "winuser.h"
#include "mmddk.h"
#include "winreg.h"
+#include "wine/unicode.h"
#include "wine/debug.h"
/*
@@ -80,7 +81,7 @@
typedef struct tagMIDIOUTPORT
{
- char name[MAXPNAMELEN];
+ WCHAR name[MAXPNAMELEN];
int loaded;
HMIDIOUT hMidi;
unsigned short uDevID;
@@ -105,31 +106,36 @@
return TRUE;
}
-static BOOL MIDIMAP_FindPort(const char* name, unsigned* dev)
+static BOOL MIDIMAP_FindPort(const WCHAR* name, unsigned* dev)
{
for (*dev = 0; *dev < numMidiOutPorts; (*dev)++)
{
- TRACE("%s\n", midiOutPorts[*dev].name);
- if (strcmp(midiOutPorts[*dev].name, name) == 0)
+ TRACE("%s\n", wine_dbgstr_w(midiOutPorts[*dev].name));
+ if (strcmpW(midiOutPorts[*dev].name, name) == 0)
return TRUE;
}
/* try the form #nnn */
if (*name == '#' && isdigit(name[1]))
{
- *dev = atoi(name + 1);
+ const WCHAR* ptr = name + 1;
+ *dev = 0;
+ do
+ {
+ *dev = *dev * 10 + *ptr - '0';
+ } while (isdigit(*++ptr));
if (*dev < numMidiOutPorts)
return TRUE;
}
return FALSE;
}
-static BOOL MIDIMAP_LoadSettingsDefault(MIDIMAPDATA* mom, const
char* port)
+static BOOL MIDIMAP_LoadSettingsDefault(MIDIMAPDATA* mom, const
WCHAR* port)
{
unsigned i, dev = 0;
if (port != NULL && !MIDIMAP_FindPort(port, &dev))
{
- ERR("Registry glitch: couldn't find midi out (%s)\n", port);
+ ERR("Registry glitch: couldn't find midi out (%s)\n",
wine_dbgstr_w(port));
dev = 0;
}
@@ -142,11 +148,11 @@
return TRUE;
}
-static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA* mom, const char*
scheme)
+static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA* mom, const
WCHAR* scheme)
{
HKEY hSchemesKey, hKey, hPortKey;
unsigned i, idx, dev;
- char buffer[256], port[256];
+ WCHAR buffer[256], port[256];
DWORD type, size, mask;
for (i = 0; i < 16; i++) mom->ChannelMap[i] = NULL;
@@ -157,18 +163,18 @@
{
return FALSE;
}
- if (RegOpenKeyA(hSchemesKey, scheme, &hKey))
+ if (RegOpenKeyW(hSchemesKey, scheme, &hKey))
{
RegCloseKey(hSchemesKey);
return FALSE;
}
- for (idx = 0; !RegEnumKeyA(hKey, idx, buffer, sizeof(buffer));
idx++)
+ for (idx = 0; !RegEnumKeyW(hKey, idx, buffer, sizeof(buffer));
idx++)
{
- if (RegOpenKeyA(hKey, buffer, &hPortKey)) continue;
+ if (RegOpenKeyW(hKey, buffer, &hPortKey)) continue;
size = sizeof(port);
- if (RegQueryValueExA(hPortKey, NULL, 0, &type, port, &size))
continue;
+ if (RegQueryValueExW(hPortKey, NULL, 0, &type, (void*)port,
&size)) continue;
if (!MIDIMAP_FindPort(port, &dev)) continue;
@@ -206,14 +212,15 @@
else
{
DWORD type, size, out;
- char buffer[256];
+ WCHAR buffer[256];
ret = 2;
size = sizeof(out);
if (!RegQueryValueExA(hKey, "UseScheme", 0, &type, (void*)&out,
&size) && out)
{
+ static const WCHAR cs[] =
{'C','u','r','r','e','n','t','S','c','h','e','m','e',0};
size = sizeof(buffer);
- if (!RegQueryValueExA(hKey, "CurrentScheme", 0, &type,
buffer, &size))
+ if (!RegQueryValueExW(hKey, cs, 0, &type, (void*)buffer,
&size))
{
if (!(ret = MIDIMAP_LoadSettingsScheme(mom, buffer)))
ret = MIDIMAP_LoadSettingsDefault(mom, NULL);
@@ -225,8 +232,9 @@
}
if (ret == 2)
{
+ static const WCHAR ci[] =
{'C','u','r','r','e','n','t','I','n','s','t','r','u','m','e','n','t',0};
size = sizeof(buffer);
- if (!RegQueryValueExA(hKey, "CurrentInstrument", 0, &type,
buffer, &size) && *buffer)
+ if (!RegQueryValueExW(hKey, ci, 0, &type, (void*)buffer,
&size) && *buffer)
{
ret = MIDIMAP_LoadSettingsDefault(mom, buffer);
}
@@ -404,12 +412,13 @@
return MMSYSERR_NOERROR;
}
-static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA* mom,
LPMIDIOUTCAPSA lpMidiCaps, DWORD size)
+static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA* mom,
LPMIDIOUTCAPSW lpMidiCaps, DWORD size)
{
+ static const WCHAR name[] = {'W','i','n','e','
','m','i','d','i','
','m','a','p','p','e','r',0};
lpMidiCaps->wMid = 0x00FF;
lpMidiCaps->wPid = 0x0001;
lpMidiCaps->vDriverVersion = 0x0100;
- strcpy(lpMidiCaps->szPname, "Wine midi out mapper");
+ lstrcpyW(lpMidiCaps->szPname, name);
lpMidiCaps->wTechnology = MOD_MAPPER;
lpMidiCaps->wVoices = 0;
lpMidiCaps->wNotes = 0;
@@ -465,7 +474,7 @@
case MODM_UNPREPARE: return modUnprepare
((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
case MODM_RESET: return modReset
((MIDIMAPDATA*)dwUser);
- case MODM_GETDEVCAPS: return modGetDevCaps (wDevID,
(MIDIMAPDATA*)dwUser, (LPMIDIOUTCAPSA)dwParam1,dwParam2);
+ case MODM_GETDEVCAPS: return modGetDevCaps (wDevID,
(MIDIMAPDATA*)dwUser, (LPMIDIOUTCAPSW)dwParam1,dwParam2);
case MODM_GETNUMDEVS: return 1;
case MODM_GETVOLUME: return MMSYSERR_NOTSUPPORTED;
case MODM_SETVOLUME: return MMSYSERR_NOTSUPPORTED;
@@ -484,7 +493,7 @@
*/
static DWORD MIDIMAP_drvOpen(LPSTR str)
{
- MIDIOUTCAPSA moc;
+ MIDIOUTCAPSW moc;
unsigned dev, i;
if (midiOutPorts)
@@ -495,9 +504,9 @@
numMidiOutPorts * sizeof(MIDIOUTPORT));
for (dev = 0; dev < numMidiOutPorts; dev++)
{
- if (midiOutGetDevCapsA(dev, &moc, sizeof(moc)) == 0L)
+ if (midiOutGetDevCapsW(dev, &moc, sizeof(moc)) == 0L)
{
- strcpy(midiOutPorts[dev].name, moc.szPname);
+ strcpyW(midiOutPorts[dev].name, moc.szPname);
midiOutPorts[dev].loaded = 0;
midiOutPorts[dev].hMidi = 0;
midiOutPorts[dev].uDevID = dev;
_____
Modified: trunk/reactos/lib/winmm/mmio.c
--- trunk/reactos/lib/winmm/mmio.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/mmio.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -703,7 +703,7 @@
{
INT len = WideCharToMultiByte( CP_ACP, 0, szFileName, -1,
NULL, 0, NULL, NULL );
szFn = HeapAlloc( GetProcessHeap(), 0, len );
- if (!szFn) return (HMMIO)NULL;
+ if (!szFn) return NULL;
WideCharToMultiByte( CP_ACP, 0, szFileName, -1, szFn, len,
NULL, NULL );
}
_____
Modified: trunk/reactos/lib/winmm/mmsystem.c
--- trunk/reactos/lib/winmm/mmsystem.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/mmsystem.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -1940,7 +1940,7 @@
lpMMThd->hTask = 0;
if ((dwFlags & 1) == 0 && (GetProcessFlags(GetCurrentThreadId())
& 8) == 0) {
- lpMMThd->hEvent = CreateEventA(0, 0, 1, 0);
+ lpMMThd->hEvent = CreateEventW(NULL, FALSE, TRUE, NULL);
TRACE("Let's go crazy... trying new MM thread.
lpMMThd=%p\n", lpMMThd);
if (lpMMThd->dwFlags & 2) {
@@ -2712,7 +2712,6 @@
mmioInfo16.adwInfo[0] = lpmmioinfo->adwInfo[0];
mmioInfo16.adwInfo[1] = lpmmioinfo->adwInfo[1];
mmioInfo16.adwInfo[2] = lpmmioinfo->adwInfo[2];
- mmioInfo16.adwInfo[3] = lpmmioinfo->adwInfo[3];
/* map (lParam1, lParam2) into (lp1, lp2) 32=>16 */
if ((result = MMIO_Map32To16(uMessage, &lp1, &lp2)) !=
MMSYSERR_NOERROR)
return result;
@@ -2733,7 +2732,6 @@
lpmmioinfo->adwInfo[0] = mmioInfo16.adwInfo[0];
lpmmioinfo->adwInfo[1] = mmioInfo16.adwInfo[1];
lpmmioinfo->adwInfo[2] = mmioInfo16.adwInfo[2];
- lpmmioinfo->adwInfo[3] = mmioInfo16.adwInfo[3];
return result;
}
@@ -2777,7 +2775,6 @@
mmioinfo.adwInfo[0] =
(DWORD)DosFileHandleToWin32Handle(mmioinfo.adwInfo[0]);
mmioinfo.adwInfo[1] = lpmmioinfo16->adwInfo[1];
mmioinfo.adwInfo[2] = lpmmioinfo16->adwInfo[2];
- mmioinfo.adwInfo[3] = lpmmioinfo16->adwInfo[3];
ret = MMIO_Open(szFileName, &mmioinfo, dwOpenFlags,
MMIO_PROC_16);
MMIO_SetSegmentedBuffer(mmioinfo.hmmio,
(SEGPTR)lpmmioinfo16->pchBuffer, FALSE);
@@ -2856,7 +2853,6 @@
lpmmioinfo->adwInfo[0] = mmioinfo.adwInfo[0];
lpmmioinfo->adwInfo[1] = mmioinfo.adwInfo[1];
lpmmioinfo->adwInfo[2] = mmioinfo.adwInfo[2];
- lpmmioinfo->adwInfo[3] = mmioinfo.adwInfo[3];
lpmmioinfo->dwReserved1 = 0;
lpmmioinfo->dwReserved2 = 0;
lpmmioinfo->hmmio = HMMIO_16(mmioinfo.hmmio);
@@ -3065,8 +3061,12 @@
MMRESULT16 WINAPI joyGetDevCaps16(UINT16 wID, LPJOYCAPS16 lpCaps,
UINT16 wSize)
{
JOYCAPSA jca;
- MMRESULT ret = joyGetDevCapsA(wID, &jca, sizeof(jca));
+ MMRESULT ret;
+ if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
+
+ ret = joyGetDevCapsA(wID, &jca, sizeof(jca));
+
if (ret != JOYERR_NOERROR) return ret;
lpCaps->wMid = jca.wMid;
lpCaps->wPid = jca.wPid;
_____
Modified: trunk/reactos/lib/winmm/playsound.c
--- trunk/reactos/lib/winmm/playsound.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/playsound.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -352,7 +352,7 @@
TRACE("Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX\n",
(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
mmckInfo.cksize);
- s.hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
+ s.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (waveOutOpen(&hWave, WAVE_MAPPER, lpWaveFormat,
(DWORD)PlaySound_Callback,
(DWORD)&s, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
@@ -374,9 +374,9 @@
}
s.dwEventCount = 1L; /* for first buffer */
+ index = 0;
do {
- index = 0;
left = mmckInfo.cksize;
mmioSeek(hmmio, mmckInfo.dwDataOffset, SEEK_SET);
@@ -410,8 +410,8 @@
errCleanUp:
TRACE("Done playing='%s' => %s!\n",
debugstr_w(wps->pszSound), bRet
? "ok" : "ko");
CloseHandle(s.hEvent);
- if (waveHdr) HeapFree(GetProcessHeap(), 0, waveHdr);
- if (lpWaveFormat) HeapFree(GetProcessHeap(), 0, lpWaveFormat);
+ HeapFree(GetProcessHeap(), 0, waveHdr);
+ HeapFree(GetProcessHeap(), 0, lpWaveFormat);
if (hWave) while (waveOutClose(hWave) ==
WAVERR_STILLPLAYING) Sleep(100);
if (hmmio) mmioClose(hmmio, 0);
_____
Deleted: trunk/reactos/lib/winmm/wavemap/.cvsignore
--- trunk/reactos/lib/winmm/wavemap/.cvsignore 2005-01-12 23:25:02 UTC
(rev 13005)
+++ trunk/reactos/lib/winmm/wavemap/.cvsignore 2005-01-12 23:33:10 UTC
(rev 13006)
@@ -1,2 +0,0 @@
-Makefile
-msacm.drv.dbg.c
_____
Modified: trunk/reactos/lib/winmm/wavemap/wavemap.c
--- trunk/reactos/lib/winmm/wavemap/wavemap.c 2005-01-12 23:25:02 UTC
(rev 13005)
+++ trunk/reactos/lib/winmm/wavemap/wavemap.c 2005-01-12 23:33:10 UTC
(rev 13006)
@@ -37,6 +37,7 @@
#include "mmddk.h"
#include "mmreg.h"
#include "msacm.h"
+#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wavemap);
@@ -269,8 +270,8 @@
WARN("ret = WAVERR_BADFORMAT\n");
return WAVERR_BADFORMAT;
}
- WARN("ret = MMSYSERR_ERROR\n");
- return MMSYSERR_ERROR;
+ WARN("ret = 0x%08lx\n", res);
+ return res;
}
static DWORD wodClose(WAVEMAPDATA* wom)
@@ -422,13 +423,15 @@
return val;
}
-static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA* wom,
LPWAVEOUTCAPSA lpWaveCaps, DWORD dwParam2)
+static DWORD wodGetDevCaps(UINT wDevID, WAVEMAPDATA* wom,
LPWAVEOUTCAPSW lpWaveCaps, DWORD dwParam2)
{
+ static const WCHAR name[] = {'W','i','n','e','
','w','a','v','e','
','o','u','t','
','m','a','p','p','e','r',0};
+
TRACE("(%04x %p %p %08lx)\n",wDevID, wom, lpWaveCaps, dwParam2);
/* if opened low driver, forward message */
if (WAVEMAP_IsData(wom))
- return waveOutGetDevCapsA((UINT)wom->u.out.hInnerWave,
lpWaveCaps, dwParam2);
+ return waveOutGetDevCapsW((UINT)wom->u.out.hInnerWave,
lpWaveCaps, dwParam2);
/* else if no drivers, nothing to map so return bad device */
if (waveOutGetNumDevs() == 0) {
WARN("bad device id\n");
@@ -436,11 +439,11 @@
}
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
- WAVEOUTCAPSA woc;
+ WAVEOUTCAPSW woc;
woc.wMid = 0x00FF;
woc.wPid = 0x0001;
woc.vDriverVersion = 0x0100;
- strcpy(woc.szPname, "Wine wave out mapper");
+ lstrcpyW(woc.szPname, name);
woc.dwFormats =
WAVE_FORMAT_96M08 | WAVE_FORMAT_96S08 | WAVE_FORMAT_96M16 |
WAVE_FORMAT_96S16 |
WAVE_FORMAT_48M08 | WAVE_FORMAT_48S08 | WAVE_FORMAT_48M16 |
WAVE_FORMAT_48S16 |
@@ -556,7 +559,7 @@
case WODM_BREAKLOOP: return wodBreakLoop
((WAVEMAPDATA*)dwUser);
case WODM_PREPARE: return wodPrepare
((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WODM_UNPREPARE: return wodUnprepare
((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
- case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID,
(WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSA)dwParam1,dwParam2);
+ case WODM_GETDEVCAPS: return wodGetDevCaps (wDevID,
(WAVEMAPDATA*)dwUser, (LPWAVEOUTCAPSW)dwParam1,dwParam2);
case WODM_GETNUMDEVS: return 1;
case WODM_GETPITCH: return MMSYSERR_NOTSUPPORTED;
case WODM_SETPITCH: return MMSYSERR_NOTSUPPORTED;
@@ -778,8 +781,8 @@
WARN("ret = WAVERR_BADFORMAT\n");
return WAVERR_BADFORMAT;
}
- WARN("ret = MMSYSERR_ERROR\n");
- return MMSYSERR_ERROR;
+ WARN("ret = 0x%08lx\n", res);
+ return res;
}
static DWORD widClose(WAVEMAPDATA* wim)
@@ -916,13 +919,13 @@
return val;
}
-static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA* wim,
LPWAVEINCAPSA lpWaveCaps, DWORD dwParam2)
+static DWORD widGetDevCaps(UINT wDevID, WAVEMAPDATA* wim,
LPWAVEINCAPSW lpWaveCaps, DWORD dwParam2)
{
TRACE("(%04x, %p %p %08lx)\n", wDevID, wim, lpWaveCaps, dwParam2);
/* if opened low driver, forward message */
if (WAVEMAP_IsData(wim))
- return waveInGetDevCapsA((UINT)wim->u.in.hInnerWave, lpWaveCaps,
dwParam2);
+ return waveInGetDevCapsW((UINT)wim->u.in.hInnerWave, lpWaveCaps,
dwParam2);
/* else if no drivers, nothing to map so return bad device */
if (waveInGetNumDevs() == 0) {
WARN("bad device id\n");
@@ -930,11 +933,12 @@
}
/* otherwise, return caps of mapper itself */
if (wDevID == (UINT)-1 || wDevID == (UINT16)-1) {
- WAVEINCAPSA wic;
+ WAVEINCAPSW wic;
+ static const WCHAR init[] =
{'W','i','n','e','
','w','a','v','e','
','i','n','
','m','a','p','p','e','r',0};
wic.wMid = 0x00FF;
wic.wPid = 0x0001;
wic.vDriverVersion = 0x0001;
- strcpy(wic.szPname, "Wine wave in mapper");
+ strcpyW(wic.szPname, init);
wic.dwFormats =
WAVE_FORMAT_96M08 | WAVE_FORMAT_96S08 | WAVE_FORMAT_96M16 |
WAVE_FORMAT_96S16 |
WAVE_FORMAT_48M08 | WAVE_FORMAT_48S08 | WAVE_FORMAT_48M16 |
WAVE_FORMAT_48S16 |
@@ -1023,7 +1027,7 @@
case WIDM_ADDBUFFER: return widAddBuffer
((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_PREPARE: return widPrepare
((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
case WIDM_UNPREPARE: return widUnprepare
((WAVEMAPDATA*)dwUser, (LPWAVEHDR)dwParam1, dwParam2);
- case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID,
(WAVEMAPDATA*)dwUser, (LPWAVEINCAPSA)dwParam1, dwParam2);
+ case WIDM_GETDEVCAPS: return widGetDevCaps (wDevID,
(WAVEMAPDATA*)dwUser, (LPWAVEINCAPSW)dwParam1, dwParam2);
case WIDM_GETNUMDEVS: return 1;
case WIDM_GETPOS: return widGetPosition
((WAVEMAPDATA*)dwUser, (LPMMTIME)dwParam1, dwParam2);
case WIDM_RESET: return widReset
((WAVEMAPDATA*)dwUser);
_____
Modified: trunk/reactos/lib/winmm/winemm.h
--- trunk/reactos/lib/winmm/winemm.h 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/winemm.h 2005-01-12 23:33:10 UTC (rev
13006)
@@ -268,7 +268,7 @@
DWORD cMidi, DWORD_PTR dwCallback,
DWORD_PTR dwInstance, DWORD fdwOpen,
BOOL bFrom32);
UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
- const LPWAVEFORMATEX lpFormat, DWORD_PTR
dwCallback,
+ LPCWAVEFORMATEX lpFormat, DWORD_PTR
dwCallback,
DWORD_PTR dwInstance, DWORD dwFlags, BOOL
bFrom32);
HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo,
_____
Modified: trunk/reactos/lib/winmm/winmm.c
--- trunk/reactos/lib/winmm/winmm.c 2005-01-12 23:25:02 UTC (rev
13005)
+++ trunk/reactos/lib/winmm/winmm.c 2005-01-12 23:33:10 UTC (rev
13006)
@@ -97,8 +97,8 @@
/* FIXME crashes in ReactOS
WINMM_IData->cs.DebugInfo->Spare[1] = (DWORD)"WINMM_IData";
*/
- WINMM_IData->psStopEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
- WINMM_IData->psLastEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
+ WINMM_IData->psStopEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
+ WINMM_IData->psLastEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
TRACE("Created IData (%p)\n", WINMM_IData);
return TRUE;
}
@@ -295,14 +295,25 @@
*/
UINT WINAPI mixerGetDevCapsA(UINT_PTR uDeviceID, LPMIXERCAPSA lpCaps,
UINT uSize)
{
- LPWINE_MLD wmld;
+ MIXERCAPSW micW;
+ UINT ret;
- if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
+ if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
- if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIXER, TRUE)) ==
NULL)
- return MMSYSERR_BADDEVICEID;
+ ret = mixerGetDevCapsW(uDeviceID, &micW, sizeof(micW));
- return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD_PTR)lpCaps,
uSize, TRUE);
+ if (ret == MMSYSERR_NOERROR) {
+ MIXERCAPSA micA;
+ micA.wMid = micW.wMid;
+ micA.wPid = micW.wPid;
+ micA.vDriverVersion = micW.vDriverVersion;
+ WideCharToMultiByte( CP_ACP, 0, micW.szPname, -1, micA.szPname,
+ sizeof(micA.szPname), NULL, NULL );
+ micA.fdwSupport = micW.fdwSupport;
+ micA.cDestinations = micW.cDestinations;
+ memcpy(lpCaps, &micA, min(uSize, sizeof(micA)));
+ }
+ return ret;
}
/***********************************************************************
***
@@ -310,24 +321,14 @@
*/
UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps,
UINT uSize)
{
- MIXERCAPSA micA;
- UINT ret;
+ LPWINE_MLD wmld;
- if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
+ if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
- ret = mixerGetDevCapsA(uDeviceID, &micA, sizeof(micA));
- if (ret == MMSYSERR_NOERROR) {
- MIXERCAPSW micW;
- micW.wMid = micA.wMid;
- micW.wPid = micA.wPid;
- micW.vDriverVersion = micA.vDriverVersion;
- MultiByteToWideChar( CP_ACP, 0, micA.szPname, -1, micW.szPname,
- sizeof(micW.szPname)/sizeof(WCHAR) );
- micW.fdwSupport = micA.fdwSupport;
- micW.cDestinations = micA.cDestinations;
- memcpy(lpCaps, &micW, min(uSize, sizeof(micW)));
- }
- return ret;
+ if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIXER, TRUE)) ==
NULL)
+ return MMSYSERR_BADDEVICEID;
+
+ return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD_PTR)lpCaps,
uSize, TRUE);
}
UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD_PTR dwCallback,
@@ -408,75 +409,76 @@
}
/***********************************************************************
***
- * mixerGetControlDetailsA
[WINMM.@]
+ * mixerGetControlDetailsW
[WINMM.@]
*/
-UINT WINAPI mixerGetControlDetailsA(HMIXEROBJ hmix,
LPMIXERCONTROLDETAILS lpmcdA,
+UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix,
LPMIXERCONTROLDETAILS lpmcdW,
DWORD fdwDetails)
{
LPWINE_MIXER lpwm;
UINT uRet = MMSYSERR_NOERROR;
- TRACE("(%p, %p, %08lx)\n", hmix, lpmcdA, fdwDetails);
+ TRACE("(%p, %p, %08lx)\n", hmix, lpmcdW, fdwDetails);
if ((uRet = MIXER_GetDev(hmix, fdwDetails, &lpwm)) !=
MMSYSERR_NOERROR)
return uRet;
- if (lpmcdA == NULL || lpmcdA->cbStruct != sizeof(*lpmcdA))
+ if (lpmcdW == NULL || lpmcdW->cbStruct != sizeof(*lpmcdW))
return MMSYSERR_INVALPARAM;
- return MMDRV_Message(&lpwm->mld, MXDM_GETCONTROLDETAILS,
(DWORD_PTR)lpmcdA,
+ return MMDRV_Message(&lpwm->mld, MXDM_GETCONTROLDETAILS,
(DWORD_PTR)lpmcdW,
fdwDetails, TRUE);
}
/***********************************************************************
***
- * mixerGetControlDetailsW [WINMM.@]
+ * mixerGetControlDetailsA [WINMM.@]
*/
-UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix,
LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
+UINT WINAPI mixerGetControlDetailsA(HMIXEROBJ hmix,
LPMIXERCONTROLDETAILS lpmcdA,
+ DWORD fdwDetails)
{
DWORD ret = MMSYSERR_NOTENABLED;
- TRACE("(%p, %p, %08lx)\n", hmix, lpmcd, fdwDetails);
+ TRACE("(%p, %p, %08lx)\n", hmix, lpmcdA, fdwDetails);
- if (lpmcd == NULL || lpmcd->cbStruct != sizeof(*lpmcd))
+ if (lpmcdA == NULL || lpmcdA->cbStruct != sizeof(*lpmcdA))
return MMSYSERR_INVALPARAM;
switch (fdwDetails & MIXER_GETCONTROLDETAILSF_QUERYMASK) {
case MIXER_GETCONTROLDETAILSF_VALUE:
- /* can savely use W structure as it is, no string inside */
- ret = mixerGetControlDetailsA(hmix, lpmcd, fdwDetails);
+ /* can savely use A structure as it is, no string inside */
+ ret = mixerGetControlDetailsW(hmix, lpmcdA, fdwDetails);
break;
case MIXER_GETCONTROLDETAILSF_LISTTEXT:
{
- MIXERCONTROLDETAILS_LISTTEXTW *pDetailsW =
(MIXERCONTROLDETAILS_LISTTEXTW *)lpmcd->paDetails;
- MIXERCONTROLDETAILS_LISTTEXTA *pDetailsA;
- int size = max(1, lpmcd->cChannels) *
sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
+ MIXERCONTROLDETAILS_LISTTEXTA *pDetailsA =
(MIXERCONTROLDETAILS_LISTTEXTA *)lpmcdA->paDetails;
+ MIXERCONTROLDETAILS_LISTTEXTW *pDetailsW;
+ int size = max(1, lpmcdA->cChannels) *
sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
unsigned int i;
- if (lpmcd->u.cMultipleItems != 0) {
- size *= lpmcd->u.cMultipleItems;
+ if (lpmcdA->u.cMultipleItems != 0) {
+ size *= lpmcdA->u.cMultipleItems;
}
- pDetailsA = (MIXERCONTROLDETAILS_LISTTEXTA
*)HeapAlloc(GetProcessHeap(), 0, size);
- lpmcd->paDetails = pDetailsA;
- lpmcd->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
+ pDetailsW = (MIXERCONTROLDETAILS_LISTTEXTW
*)HeapAlloc(GetProcessHeap(), 0, size);
+ lpmcdA->paDetails = pDetailsW;
+ lpmcdA->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
/* set up lpmcd->paDetails */
- ret = mixerGetControlDetailsA(hmix, lpmcd, fdwDetails);
+ ret = mixerGetControlDetailsW(hmix, lpmcdA, fdwDetails);
/* copy from lpmcd->paDetails back to paDetailsW; */
- if(ret == MMSYSERR_NOERROR) {
- for(i=0;i<lpmcd->u.cMultipleItems*lpmcd->cChannels;i++)
{
- pDetailsW->dwParam1 = pDetailsA->dwParam1;
- pDetailsW->dwParam2 = pDetailsA->dwParam2;
- MultiByteToWideChar( CP_ACP, 0, pDetailsA->szName,
-1,
- pDetailsW->szName,
-
sizeof(pDetailsW->szName)/sizeof(WCHAR) );
+ if (ret == MMSYSERR_NOERROR) {
+ for (i = 0; i < lpmcdA->u.cMultipleItems *
lpmcdA->cChannels; i++) {
+ pDetailsA->dwParam1 = pDetailsW->dwParam1;
+ pDetailsA->dwParam2 = pDetailsW->dwParam2;
+ WideCharToMultiByte( CP_ACP, 0, pDetailsW->szName,
-1,
+ pDetailsA->szName,
+ sizeof(pDetailsA->szName),
NULL, NULL );
pDetailsA++;
pDetailsW++;
}
- pDetailsA -= lpmcd->u.cMultipleItems*lpmcd->cChannels;
- pDetailsW -= lpmcd->u.cMultipleItems*lpmcd->cChannels;
+ pDetailsA -= lpmcdA->u.cMultipleItems *
lpmcdA->cChannels;
+ pDetailsW -= lpmcdA->u.cMultipleItems *
lpmcdA->cChannels;
}
- HeapFree(GetProcessHeap(), 0, pDetailsA);
- lpmcd->paDetails = pDetailsW;
- lpmcd->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTW);
+ HeapFree(GetProcessHeap(), 0, pDetailsW);
+ lpmcdA->paDetails = pDetailsA;
+ lpmcdA->cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
}
break;
default:
@@ -492,19 +494,59 @@
[truncated at 1000 lines; 651 more skipped]