A while back I was tinkering with the XHDI interface to inquire about the installed driver.
The source code is here: http://userpages.bright.net/~gfabasic/files/xhdi.zip
I didn't write wrappers for all the calls, but its proof of concept. It was also written in a hurry and somewhat sloppy, but you should be able to figure out how to add the missing calls if you need them.
It won't help with MIDI.