wrong type by MIDIHDR.reserved which get MMSYSERR_INVALPARAM while calling midiOutPrepareHeader function
Original Reporter info from Mantis: ax_pokl
-
Reporter name: Zheng Wang
Original Reporter info from Mantis: ax_pokl
- Reporter name: Zheng Wang
Description:
The type of MIDIHDR.reserved was DWORD, which should be DWORD_PTR
This will cause wrong value of sizeof(MIDIHDR) in 64 bit version and failed to calling midi functions such as midiOutPrepareHeader function and get return value MMSYSERR_INVALPARAM
Steps to reproduce:
program miditest;
uses windows,mmsystem;
var msgbuf:array[0..11]of byte=(0,0,0,0,0,0,0,0,$90,$3C,$7F,0);
var msgbufn:longword=12;
var midiout:longword;
var msghdr:MIDIHDR;
var midiouti:word=0;
begin
writeln(midiStreamOpen(@midiOut,@midiOuti,1,0,0,0));
with msghdr do
begin
lpData:=@msgbuf;
dwBufferLength:=msgbufn;
dwBytesrecorded:=msgbufn;
dwFlags:=0;
dwOffset:=0;
end;
writeln(midiOutPrepareHeader(midiOut,@msghdr,sizeof(msghdr)));
writeln(midiStreamOut(midiOut,@msghdr,sizeof(msghdr)));
writeln(midiStreamRestart(midiOut));
writeln(midiOutUnPrepareHeader(midiOut,@msghdr,sizeof(msghdr)));
sleep(1000);
midiStreamClose(midiOut);
end.
Additional information:
This test program will press note C4 by midi, it will get result 11 while calling midiStreamOut
Mantis conversion info:
- Mantis ID: 35469
- OS: Windows 10
- OS Build: 1903
- Platform: Windows
- Version: 3.0.4
- Fixed in version: 3.3.1
- Fixed in revision: 42775 (#631364aa)