Commit 4c4a0875 authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

mciseq: Fix reading MCI_INFO_NAME and COPYRIGHT from MIDI file.

parent 3c640b8d
...@@ -347,10 +347,7 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt) ...@@ -347,10 +347,7 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
switch (LOWORD(mmt->dwEventData)) { switch (LOWORD(mmt->dwEventData)) {
case 0x02FF: case 0x02FF:
case 0x03FF: case 0x03FF:
/* position after meta data header */
mmioSeek(wmm->hFile, mmt->dwIndex + HIWORD(mmt->dwEventData), SEEK_SET);
len = mmt->wEventLength - HIWORD(mmt->dwEventData); len = mmt->wEventLength - HIWORD(mmt->dwEventData);
if (len >= sizeof(buf)) { if (len >= sizeof(buf)) {
WARN("Buffer for text is too small (%u are needed)\n", len); WARN("Buffer for text is too small (%u are needed)\n", len);
len = sizeof(buf) - 1; len = sizeof(buf) - 1;
...@@ -361,20 +358,20 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt) ...@@ -361,20 +358,20 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
case 0x02: case 0x02:
if (wmm->lpstrCopyright) { if (wmm->lpstrCopyright) {
WARN("Two copyright notices (%s|%s)\n", debugstr_w(wmm->lpstrCopyright), buf); WARN("Two copyright notices (%s|%s)\n", debugstr_w(wmm->lpstrCopyright), buf);
} else { HeapFree(GetProcessHeap(), 0, wmm->lpstrCopyright);
len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
wmm->lpstrCopyright = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, buf, -1, wmm->lpstrCopyright, len );
} }
len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
wmm->lpstrCopyright = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, buf, -1, wmm->lpstrCopyright, len );
break; break;
case 0x03: case 0x03:
if (wmm->lpstrName) { if (wmm->lpstrName) {
WARN("Two names (%s|%s)\n", debugstr_w(wmm->lpstrName), buf); WARN("Two names (%s|%s)\n", debugstr_w(wmm->lpstrName), buf);
} else { HeapFree(GetProcessHeap(), 0, wmm->lpstrName);
len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 ); } /* last name or name from last track wins */
wmm->lpstrName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
MultiByteToWideChar( CP_ACP, 0, buf, -1, wmm->lpstrName, len ); wmm->lpstrName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
} MultiByteToWideChar( CP_ACP, 0, buf, -1, wmm->lpstrName, len );
break; break;
} }
} }
...@@ -1524,7 +1521,7 @@ static DWORD MIDI_mciInfo(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_INFO_PARMSW lp ...@@ -1524,7 +1521,7 @@ static DWORD MIDI_mciInfo(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_INFO_PARMSW lp
case MCI_INFO_NAME: str = wmm->lpstrName; break; case MCI_INFO_NAME: str = wmm->lpstrName; break;
default: default:
WARN("Don't know this info command (%u)\n", dwFlags); WARN("Don't know this info command (%u)\n", dwFlags);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_MISSING_PARAMETER; /* not MCIERR_FLAGS_... */
} }
if (!ret) { if (!ret) {
if (lpParms->dwRetSize) { if (lpParms->dwRetSize) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment