Closed leecher1337 closed 1 year ago
Lettuce see...
Oh goody, it opens in IDA 6.8 still.
The idb contributed to is the kernelmode part of the driver... However, the meat of the synth lies in the usermode dll. I get the impression that a good chunk of the code in kernelmode sys is vestigial remains of the DDK example driver.
In win2k+ driver, the situation changes... The whole code has been transferred to kernelmode, and converted to abominable C++, likely for WDF. Further more, a few screws and nuts fell out of the midi synth during C++ conversion, evident from borked tone portamento.
Still, I accept this contribution,
Theoretically, to get i.e. an x64 driver for the Midi synth, it should be possible to derive the NT4 driver source, compile it with 64bit DDK and then just install the .DLL in HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Drivers32
on the x64 system as MIDI driver to get it working, or am I mistaken?
I am unfamiliar with 64bit dealings. Personally, I'd have midi handling bit in usermode, communicating with a portio driver.
Also, I believe the MS example driver only deals with OPL3 crud. ESFM exceeds OPL3 and is officialy undocumented(unofficial effort exists now).
Stupid question: is the stuff in the DLL just OPL2 or is it the ESFM-proprietary stuff? I'm asking, because in Windows 2000 driver, we have:
CMiniportMidiFM::Init
this->m_fNotOpl3 = 0;
if ( CMiniportMidiFM::SoundMidiIsOpl3(this) )
{
CMiniportMidiFM::SoundMidiQuiet(this);
CMiniportMidiFM::Opl3_BoardReset(this);
*ServiceGroup = 0;
}
else
{
v6 = this->m_PortBase + 2;
this->m_fNotOpl3 = 1;
WRITE_PORT_UCHAR(v6, 5u);
KeStallExecutionProcessor(0x19u);
WRITE_PORT_UCHAR(this->m_PortBase + 1, 0x80u);
KeStallExecutionProcessor(0x19u);
g_PortBase = (int)this->m_PortBase;
fmreset();
}
CMiniportMidiStreamFM::Write
if ( this->m_Miniport->m_fNotOpl3 )
MidiMessage(Length);
else
CMiniportMidiStreamFM::WriteMidiData(this, Length);
The dll stuff in here(nt4 driver) carries the midi implementation that turns midi messages to ESFM writes, which are then sent to kernel mode as a buffer(midi flush).
See esfm.asm and esfm.c for implementation outline, but do note I replaced buffer thinghie with direct port writes(see dll idb for original). https://github.com/pachuco/ESSPlayMid/tree/master/src
https://github.com/jwt27/esfm this is unoficial ESFM docu.
Added annotations from well-known soundlib (from NT4 DDK) to .sys driver IDB in order to get out properly readable code.
Basically most of NT4 DDK sndblst and sndlib code can be taken as template and adapted accordingly. Only these structs are different: GLOBAL_DEVICE_INFO, SOUND_HARDWARE, LOCAL_MIXER_DATA (only #defines for sizes differ), SB_CONFIG_DATA All documented in .idb