-    int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode));
-    if ( fd == -1 ) {
-        wxLogSysError(_("can't open file '%s'"), szFileName);
-        return FALSE;
-    }
-    else {
-        Attach(fd);
-        return TRUE;
+#ifdef __WINDOWS__
+    // only read/write bits for "all" are supported by this function under
+    // Windows, and VC++ 8 returns EINVAL if any other bits are used in
+    // accessMode, so clear them as they have at best no effect anyhow
+    accessMode &= wxS_IRUSR | wxS_IWUSR;
+#endif // __WINDOWS__
+
+    int fd = wxOpen( fileName, flags ACCESS(accessMode));
+
+    if ( fd == -1 )
+    {
+        wxLogSysError(_("can't open file '%s'"), fileName);
+        return false;