Fix incompatibility with Win9x

Fix some Win32 API calls which are incompatible with Win9x.