Index: inquire.c
===================================================================
--- inquire.c	(revision 163225)
+++ inquire.c	(working copy)
@@ -83,8 +83,25 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_u
 	    fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
 	}
       else
+	fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
+#elif defined __MINGW32__
+    switch (u->unit_number)
+      {
+	case options.stdin_unit:
+	  fstrcpy (iqp->name, iqp->name_len, "CONIN$", sizeof("CONIN$"));
+	  break;
+	case options.stdout_unit:
+	  fstrcpy (iqp->name, iqp->name_len, "CONOUT$", sizeof("CONOUT$"));
+	  break;
+	case options.stderr_unit:
+	  fstrcpy (iqp->name, iqp->name_len, "CONERR$", sizeof("CONERR$"));
+	  break;
+	default:
+	  fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
+      }
+#else
+    fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
 #endif
-	fstrcpy (iqp->name, iqp->name_len, u->file, u->file_len);
     }
 
   if ((cf & IOPARM_INQUIRE_HAS_ACCESS) != 0)
