Clean up *GetDevCaps to check for valid pointer and only copy proper
amount of data.
This commit is contained in:
parent
0f252372b7
commit
b4e9ef02c2
|
@ -465,7 +465,7 @@ UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1,
|
||||||
{
|
{
|
||||||
WINE_MM_DRIVER* lpDrv = &MMDrvs[mld->mmdIndex];
|
WINE_MM_DRIVER* lpDrv = &MMDrvs[mld->mmdIndex];
|
||||||
|
|
||||||
TRACE("(%p, %04x, %08lx, %08lx)\n", mld, uMsg, dwParam1, dwParam2);
|
TRACE("(%p, %04x, %08lx, %08lx, %d)\n", mld, uMsg, dwParam1, dwParam2, bFrom32);
|
||||||
|
|
||||||
/* all those function calls are undocumented */
|
/* all those function calls are undocumented */
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
|
|
@ -215,12 +215,15 @@ UINT16 WINAPI mixerGetNumDevs16(void)
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* mixerGetDevCaps [MMSYSTEM.801]
|
* mixerGetDevCaps [MMSYSTEM.801]
|
||||||
*/
|
*/
|
||||||
UINT16 WINAPI mixerGetDevCaps16(UINT16 devid, LPMIXERCAPS16 mixcaps,
|
UINT16 WINAPI mixerGetDevCaps16(UINT16 uDeviceID, LPMIXERCAPS16 lpCaps,
|
||||||
UINT16 size)
|
UINT16 uSize)
|
||||||
{
|
{
|
||||||
MIXERCAPSA micA;
|
MIXERCAPSA micA;
|
||||||
UINT ret = mixerGetDevCapsA(devid, &micA, sizeof(micA));
|
UINT ret;
|
||||||
|
|
||||||
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
|
ret = mixerGetDevCapsA(uDeviceID, &micA, sizeof(micA));
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
MIXERCAPS16 mic16;
|
MIXERCAPS16 mic16;
|
||||||
mic16.wMid = micA.wMid;
|
mic16.wMid = micA.wMid;
|
||||||
|
@ -229,7 +232,7 @@ UINT16 WINAPI mixerGetDevCaps16(UINT16 devid, LPMIXERCAPS16 mixcaps,
|
||||||
strcpy(mic16.szPname, micA.szPname);
|
strcpy(mic16.szPname, micA.szPname);
|
||||||
mic16.fdwSupport = micA.fdwSupport;
|
mic16.fdwSupport = micA.fdwSupport;
|
||||||
mic16.cDestinations = micA.cDestinations;
|
mic16.cDestinations = micA.cDestinations;
|
||||||
memcpy(mixcaps, &mic16, min(size, sizeof(mic16)));
|
memcpy(lpCaps, &mic16, min(uSize, sizeof(mic16)));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -453,13 +456,23 @@ UINT16 WINAPI auxGetNumDevs16(void)
|
||||||
*/
|
*/
|
||||||
UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID, LPAUXCAPS16 lpCaps, UINT16 uSize)
|
UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID, LPAUXCAPS16 lpCaps, UINT16 uSize)
|
||||||
{
|
{
|
||||||
LPWINE_MLD wmld;
|
AUXCAPSA acA;
|
||||||
|
UINT ret;
|
||||||
|
|
||||||
TRACE("(%04X, %p, %d) !\n", uDeviceID, lpCaps, uSize);
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
if ((wmld = MMDRV_Get((HANDLE)(ULONG_PTR)uDeviceID, MMDRV_AUX, TRUE)) == NULL)
|
ret = auxGetDevCapsA(uDeviceID, &acA, sizeof(acA));
|
||||||
return MMSYSERR_INVALHANDLE;
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
return MMDRV_Message(wmld, AUXDM_GETDEVCAPS, (DWORD)lpCaps, uSize, TRUE);
|
AUXCAPS16 ac16;
|
||||||
|
ac16.wMid = acA.wMid;
|
||||||
|
ac16.wPid = acA.wPid;
|
||||||
|
ac16.vDriverVersion = acA.vDriverVersion;
|
||||||
|
strcpy(ac16.szPname, acA.szPname);
|
||||||
|
ac16.wTechnology = acA.wTechnology;
|
||||||
|
ac16.dwSupport = acA.dwSupport;
|
||||||
|
memcpy(lpCaps, &ac16, min(uSize, sizeof(ac16)));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -691,24 +704,26 @@ UINT16 WINAPI midiOutGetNumDevs16(void)
|
||||||
UINT16 WINAPI midiOutGetDevCaps16(UINT16 uDeviceID, LPMIDIOUTCAPS16 lpCaps,
|
UINT16 WINAPI midiOutGetDevCaps16(UINT16 uDeviceID, LPMIDIOUTCAPS16 lpCaps,
|
||||||
UINT16 uSize)
|
UINT16 uSize)
|
||||||
{
|
{
|
||||||
MIDIOUTCAPSA capsA;
|
MIDIOUTCAPSA mocA;
|
||||||
UINT dwRet;
|
UINT ret;
|
||||||
|
|
||||||
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
dwRet = midiOutGetDevCapsA(uDeviceID, &capsA, sizeof(capsA));
|
ret = midiOutGetDevCapsA(uDeviceID, &mocA, sizeof(mocA));
|
||||||
if (dwRet == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wMid = capsA.wMid;
|
MIDIOUTCAPS16 moc16;
|
||||||
lpCaps->wPid = capsA.wPid;
|
moc16.wMid = mocA.wMid;
|
||||||
lpCaps->vDriverVersion = capsA.vDriverVersion;
|
moc16.wPid = mocA.wPid;
|
||||||
strcpy(lpCaps->szPname, capsA.szPname);
|
moc16.vDriverVersion = mocA.vDriverVersion;
|
||||||
lpCaps->wTechnology = capsA.wTechnology;
|
strcpy(moc16.szPname, mocA.szPname);
|
||||||
lpCaps->wVoices = capsA.wVoices;
|
moc16.wTechnology = mocA.wTechnology;
|
||||||
lpCaps->wNotes = capsA.wNotes;
|
moc16.wVoices = mocA.wVoices;
|
||||||
lpCaps->wChannelMask = capsA.wChannelMask;
|
moc16.wNotes = mocA.wNotes;
|
||||||
lpCaps->dwSupport = capsA.dwSupport;
|
moc16.wChannelMask = mocA.wChannelMask;
|
||||||
|
moc16.dwSupport = mocA.dwSupport;
|
||||||
|
memcpy(lpCaps, &moc16, min(uSize, sizeof(moc16)));
|
||||||
}
|
}
|
||||||
return dwRet;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -913,16 +928,20 @@ UINT16 WINAPI midiInGetDevCaps16(UINT16 uDeviceID, LPMIDIINCAPS16 lpCaps,
|
||||||
UINT16 uSize)
|
UINT16 uSize)
|
||||||
{
|
{
|
||||||
MIDIINCAPSA micA;
|
MIDIINCAPSA micA;
|
||||||
UINT ret = midiInGetDevCapsA(uDeviceID, &micA, uSize);
|
UINT ret;
|
||||||
|
|
||||||
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
|
ret = midiInGetDevCapsA(uDeviceID, &micA, uSize);
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wMid = micA.wMid;
|
MIDIINCAPS16 mic16;
|
||||||
lpCaps->wPid = micA.wPid;
|
mic16.wMid = micA.wMid;
|
||||||
lpCaps->vDriverVersion = micA.vDriverVersion;
|
mic16.wPid = micA.wPid;
|
||||||
strcpy(lpCaps->szPname, micA.szPname);
|
mic16.vDriverVersion = micA.vDriverVersion;
|
||||||
lpCaps->dwSupport = micA.dwSupport;
|
strcpy(mic16.szPname, micA.szPname);
|
||||||
|
mic16.dwSupport = micA.dwSupport;
|
||||||
|
memcpy(lpCaps, &mic16, min(uSize, sizeof(mic16)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1195,12 +1214,11 @@ UINT16 WINAPI waveOutGetDevCaps16(UINT16 uDeviceID,
|
||||||
{
|
{
|
||||||
WAVEOUTCAPSA wocA;
|
WAVEOUTCAPSA wocA;
|
||||||
UINT ret;
|
UINT ret;
|
||||||
|
|
||||||
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
|
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
|
||||||
|
|
||||||
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
|
ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
|
||||||
|
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
WAVEOUTCAPS16 woc16;
|
WAVEOUTCAPS16 woc16;
|
||||||
woc16.wMid = wocA.wMid;
|
woc16.wMid = wocA.wMid;
|
||||||
|
@ -1494,10 +1512,11 @@ UINT16 WINAPI waveInGetDevCaps16(UINT16 uDeviceID, LPWAVEINCAPS16 lpCaps,
|
||||||
UINT16 uSize)
|
UINT16 uSize)
|
||||||
{
|
{
|
||||||
WAVEINCAPSA wicA;
|
WAVEINCAPSA wicA;
|
||||||
UINT ret = waveInGetDevCapsA(uDeviceID, &wicA, sizeof(wicA));
|
UINT ret;
|
||||||
|
|
||||||
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
|
ret = waveInGetDevCapsA(uDeviceID, &wicA, sizeof(wicA));
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
WAVEINCAPS16 wic16;
|
WAVEINCAPS16 wic16;
|
||||||
wic16.wMid = wicA.wMid;
|
wic16.wMid = wicA.wMid;
|
||||||
|
@ -2539,13 +2558,18 @@ MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16 lpCaps, UINT16 wSize)
|
||||||
{
|
{
|
||||||
TIMECAPS caps;
|
TIMECAPS caps;
|
||||||
MMRESULT ret;
|
MMRESULT ret;
|
||||||
|
|
||||||
TRACE("(%p, %u) !\n", lpCaps, wSize);
|
TRACE("(%p, %u) !\n", lpCaps, wSize);
|
||||||
|
|
||||||
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
ret = timeGetDevCaps(&caps, sizeof(caps));
|
ret = timeGetDevCaps(&caps, sizeof(caps));
|
||||||
lpCaps->wPeriodMin = caps.wPeriodMin;
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wPeriodMax = caps.wPeriodMax;
|
TIMECAPS16 tc16;
|
||||||
return 0;
|
tc16.wPeriodMin = caps.wPeriodMin;
|
||||||
|
tc16.wPeriodMax = caps.wPeriodMax;
|
||||||
|
memcpy(lpCaps, &tc16, min(wSize, sizeof(tc16)));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -228,32 +228,36 @@ UINT WINAPI mixerGetNumDevs(void)
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* mixerGetDevCapsA [WINMM.@]
|
* mixerGetDevCapsA [WINMM.@]
|
||||||
*/
|
*/
|
||||||
UINT WINAPI mixerGetDevCapsA(UINT devid, LPMIXERCAPSA mixcaps, UINT size)
|
UINT WINAPI mixerGetDevCapsA(UINT uDeviceID, LPMIXERCAPSA lpCaps, UINT uSize)
|
||||||
{
|
{
|
||||||
LPWINE_MLD wmld;
|
LPWINE_MLD wmld;
|
||||||
|
|
||||||
if ((wmld = MMDRV_Get((HANDLE)devid, MMDRV_MIXER, TRUE)) == NULL)
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
|
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIXER, TRUE)) == NULL)
|
||||||
return MMSYSERR_BADDEVICEID;
|
return MMSYSERR_BADDEVICEID;
|
||||||
|
|
||||||
return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD)mixcaps, size, TRUE);
|
return MMDRV_Message(wmld, MXDM_GETDEVCAPS, (DWORD)lpCaps, uSize, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* mixerGetDevCapsW [WINMM.@]
|
* mixerGetDevCapsW [WINMM.@]
|
||||||
*/
|
*/
|
||||||
UINT WINAPI mixerGetDevCapsW(UINT devid, LPMIXERCAPSW mixcaps, UINT size)
|
UINT WINAPI mixerGetDevCapsW(UINT uDeviceID, LPMIXERCAPSW lpCaps, UINT uSize)
|
||||||
{
|
{
|
||||||
MIXERCAPSA micA;
|
MIXERCAPSA micA;
|
||||||
UINT ret = mixerGetDevCapsA(devid, &micA, sizeof(micA));
|
UINT ret = mixerGetDevCapsA(uDeviceID, &micA, sizeof(micA));
|
||||||
|
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
mixcaps->wMid = micA.wMid;
|
MIXERCAPSW micW;
|
||||||
mixcaps->wPid = micA.wPid;
|
micW.wMid = micA.wMid;
|
||||||
mixcaps->vDriverVersion = micA.vDriverVersion;
|
micW.wPid = micA.wPid;
|
||||||
MultiByteToWideChar( CP_ACP, 0, micA.szPname, -1, mixcaps->szPname,
|
micW.vDriverVersion = micA.vDriverVersion;
|
||||||
sizeof(mixcaps->szPname)/sizeof(WCHAR) );
|
MultiByteToWideChar( CP_ACP, 0, micA.szPname, -1, micW.szPname,
|
||||||
mixcaps->fdwSupport = micA.fdwSupport;
|
sizeof(micW.szPname)/sizeof(WCHAR) );
|
||||||
mixcaps->cDestinations = micA.cDestinations;
|
micW.fdwSupport = micA.fdwSupport;
|
||||||
|
micW.cDestinations = micA.cDestinations;
|
||||||
|
memcpy(lpCaps, &micW, min(uSize, sizeof(micW)));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -625,13 +629,17 @@ UINT WINAPI auxGetDevCapsW(UINT uDeviceID, LPAUXCAPSW lpCaps, UINT uSize)
|
||||||
AUXCAPSA acA;
|
AUXCAPSA acA;
|
||||||
UINT ret = auxGetDevCapsA(uDeviceID, &acA, sizeof(acA));
|
UINT ret = auxGetDevCapsA(uDeviceID, &acA, sizeof(acA));
|
||||||
|
|
||||||
lpCaps->wMid = acA.wMid;
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wPid = acA.wPid;
|
AUXCAPSW acW;
|
||||||
lpCaps->vDriverVersion = acA.vDriverVersion;
|
acW.wMid = acA.wMid;
|
||||||
MultiByteToWideChar( CP_ACP, 0, acA.szPname, -1, lpCaps->szPname,
|
acW.wPid = acA.wPid;
|
||||||
sizeof(lpCaps->szPname)/sizeof(WCHAR) );
|
acW.vDriverVersion = acA.vDriverVersion;
|
||||||
lpCaps->wTechnology = acA.wTechnology;
|
MultiByteToWideChar( CP_ACP, 0, acA.szPname, -1, acW.szPname,
|
||||||
lpCaps->dwSupport = acA.dwSupport;
|
sizeof(acW.szPname)/sizeof(WCHAR) );
|
||||||
|
acW.wTechnology = acA.wTechnology;
|
||||||
|
acW.dwSupport = acA.dwSupport;
|
||||||
|
memcpy(lpCaps, &acW, min(uSize, sizeof(acW)));
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,6 +652,8 @@ UINT WINAPI auxGetDevCapsA(UINT uDeviceID, LPAUXCAPSA lpCaps, UINT uSize)
|
||||||
|
|
||||||
TRACE("(%04X, %p, %d) !\n", uDeviceID, lpCaps, uSize);
|
TRACE("(%04X, %p, %d) !\n", uDeviceID, lpCaps, uSize);
|
||||||
|
|
||||||
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_AUX, TRUE)) == NULL)
|
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_AUX, TRUE)) == NULL)
|
||||||
return MMSYSERR_INVALHANDLE;
|
return MMSYSERR_INVALHANDLE;
|
||||||
return MMDRV_Message(wmld, AUXDM_GETDEVCAPS, (DWORD)lpCaps, uSize, TRUE);
|
return MMDRV_Message(wmld, AUXDM_GETDEVCAPS, (DWORD)lpCaps, uSize, TRUE);
|
||||||
|
@ -952,19 +962,22 @@ UINT WINAPI midiOutGetDevCapsW(UINT uDeviceID, LPMIDIOUTCAPSW lpCaps,
|
||||||
UINT uSize)
|
UINT uSize)
|
||||||
{
|
{
|
||||||
MIDIOUTCAPSA mocA;
|
MIDIOUTCAPSA mocA;
|
||||||
UINT ret;
|
UINT ret = midiOutGetDevCapsA(uDeviceID, &mocA, sizeof(mocA));
|
||||||
|
|
||||||
ret = midiOutGetDevCapsA(uDeviceID, &mocA, sizeof(mocA));
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wMid = mocA.wMid;
|
MIDIOUTCAPSW mocW;
|
||||||
lpCaps->wPid = mocA.wPid;
|
mocW.wMid = mocA.wMid;
|
||||||
lpCaps->vDriverVersion = mocA.vDriverVersion;
|
mocW.wPid = mocA.wPid;
|
||||||
MultiByteToWideChar( CP_ACP, 0, mocA.szPname, -1, lpCaps->szPname,
|
mocW.vDriverVersion = mocA.vDriverVersion;
|
||||||
sizeof(lpCaps->szPname)/sizeof(WCHAR) );
|
MultiByteToWideChar( CP_ACP, 0, mocA.szPname, -1, mocW.szPname,
|
||||||
lpCaps->wTechnology = mocA.wTechnology;
|
sizeof(mocW.szPname)/sizeof(WCHAR) );
|
||||||
lpCaps->wVoices = mocA.wVoices;
|
mocW.wTechnology = mocA.wTechnology;
|
||||||
lpCaps->wNotes = mocA.wNotes;
|
mocW.wVoices = mocA.wVoices;
|
||||||
lpCaps->wChannelMask = mocA.wChannelMask;
|
mocW.wNotes = mocA.wNotes;
|
||||||
lpCaps->dwSupport = mocA.dwSupport;
|
mocW.wChannelMask = mocA.wChannelMask;
|
||||||
|
mocW.dwSupport = mocA.dwSupport;
|
||||||
|
memcpy(lpCaps, &mocW, min(uSize, sizeof(mocW)));
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1323,12 +1336,14 @@ UINT WINAPI midiInGetDevCapsW(UINT uDeviceID, LPMIDIINCAPSW lpCaps, UINT uSize)
|
||||||
UINT ret = midiInGetDevCapsA(uDeviceID, &micA, uSize);
|
UINT ret = midiInGetDevCapsA(uDeviceID, &micA, uSize);
|
||||||
|
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wMid = micA.wMid;
|
MIDIINCAPSW micW;
|
||||||
lpCaps->wPid = micA.wPid;
|
micW.wMid = micA.wMid;
|
||||||
lpCaps->vDriverVersion = micA.vDriverVersion;
|
micW.wPid = micA.wPid;
|
||||||
MultiByteToWideChar( CP_ACP, 0, micA.szPname, -1, lpCaps->szPname,
|
micW.vDriverVersion = micA.vDriverVersion;
|
||||||
sizeof(lpCaps->szPname)/sizeof(WCHAR) );
|
MultiByteToWideChar( CP_ACP, 0, micA.szPname, -1, micW.szPname,
|
||||||
lpCaps->dwSupport = micA.dwSupport;
|
sizeof(micW.szPname)/sizeof(WCHAR) );
|
||||||
|
micW.dwSupport = micA.dwSupport;
|
||||||
|
memcpy(lpCaps, &micW, min(uSize, sizeof(micW)));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1342,6 +1357,8 @@ UINT WINAPI midiInGetDevCapsA(UINT uDeviceID, LPMIDIINCAPSA lpCaps, UINT uSize)
|
||||||
|
|
||||||
TRACE("(%d, %p, %d);\n", uDeviceID, lpCaps, uSize);
|
TRACE("(%d, %p, %d);\n", uDeviceID, lpCaps, uSize);
|
||||||
|
|
||||||
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIDIIN, TRUE)) == NULL)
|
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_MIDIIN, TRUE)) == NULL)
|
||||||
return MMSYSERR_INVALHANDLE;
|
return MMSYSERR_INVALHANDLE;
|
||||||
|
|
||||||
|
@ -2266,21 +2283,19 @@ UINT WINAPI waveOutGetDevCapsW(UINT uDeviceID, LPWAVEOUTCAPSW lpCaps,
|
||||||
UINT uSize)
|
UINT uSize)
|
||||||
{
|
{
|
||||||
WAVEOUTCAPSA wocA;
|
WAVEOUTCAPSA wocA;
|
||||||
UINT ret;
|
UINT ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
|
||||||
|
|
||||||
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
|
||||||
|
|
||||||
ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
|
|
||||||
|
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wMid = wocA.wMid;
|
WAVEOUTCAPSW wocW;
|
||||||
lpCaps->wPid = wocA.wPid;
|
wocW.wMid = wocA.wMid;
|
||||||
lpCaps->vDriverVersion = wocA.vDriverVersion;
|
wocW.wPid = wocA.wPid;
|
||||||
MultiByteToWideChar( CP_ACP, 0, wocA.szPname, -1, lpCaps->szPname,
|
wocW.vDriverVersion = wocA.vDriverVersion;
|
||||||
sizeof(lpCaps->szPname)/sizeof(WCHAR) );
|
MultiByteToWideChar( CP_ACP, 0, wocA.szPname, -1, wocW.szPname,
|
||||||
lpCaps->dwFormats = wocA.dwFormats;
|
sizeof(wocW.szPname)/sizeof(WCHAR) );
|
||||||
lpCaps->wChannels = wocA.wChannels;
|
wocW.dwFormats = wocA.dwFormats;
|
||||||
lpCaps->dwSupport = wocA.dwSupport;
|
wocW.wChannels = wocA.wChannels;
|
||||||
|
wocW.dwSupport = wocA.dwSupport;
|
||||||
|
memcpy(lpCaps, &wocW, min(uSize, sizeof(wocW)));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2634,15 +2649,16 @@ UINT WINAPI waveInGetDevCapsW(UINT uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
|
||||||
UINT ret = waveInGetDevCapsA(uDeviceID, &wicA, uSize);
|
UINT ret = waveInGetDevCapsA(uDeviceID, &wicA, uSize);
|
||||||
|
|
||||||
if (ret == MMSYSERR_NOERROR) {
|
if (ret == MMSYSERR_NOERROR) {
|
||||||
lpCaps->wMid = wicA.wMid;
|
WAVEINCAPSW wicW;
|
||||||
lpCaps->wPid = wicA.wPid;
|
wicW.wMid = wicA.wMid;
|
||||||
lpCaps->vDriverVersion = wicA.vDriverVersion;
|
wicW.wPid = wicA.wPid;
|
||||||
MultiByteToWideChar( CP_ACP, 0, wicA.szPname, -1, lpCaps->szPname,
|
wicW.vDriverVersion = wicA.vDriverVersion;
|
||||||
sizeof(lpCaps->szPname)/sizeof(WCHAR) );
|
MultiByteToWideChar( CP_ACP, 0, wicA.szPname, -1, wicW.szPname,
|
||||||
lpCaps->dwFormats = wicA.dwFormats;
|
sizeof(wicW.szPname)/sizeof(WCHAR) );
|
||||||
lpCaps->wChannels = wicA.wChannels;
|
wicW.dwFormats = wicA.dwFormats;
|
||||||
|
wicW.wChannels = wicA.wChannels;
|
||||||
|
memcpy(lpCaps, &wicW, min(uSize, sizeof(wicW)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2655,6 +2671,8 @@ UINT WINAPI waveInGetDevCapsA(UINT uDeviceID, LPWAVEINCAPSA lpCaps, UINT uSize)
|
||||||
|
|
||||||
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
|
TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
|
||||||
|
|
||||||
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
|
|
||||||
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_WAVEIN, TRUE)) == NULL)
|
if ((wmld = MMDRV_Get((HANDLE)uDeviceID, MMDRV_WAVEIN, TRUE)) == NULL)
|
||||||
return MMSYSERR_BADDEVICEID;
|
return MMSYSERR_BADDEVICEID;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue