Work around bug in HDAPI.
More working around broken sensable headers.
Fix a warning found with mingw on windows.
A bit more tweaking on phantom stuff.