Fixes for WINAPI < 0x0500 compatibility