Index: /trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
===================================================================
--- /trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp	(revision 57881)
+++ /trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp	(revision 57882)
@@ -116,4 +116,13 @@
             DWORD uError = GetLastError();
 
+            if (uError == ERROR_IO_PENDING)
+            {
+                uError = 0;
+
+                /* Wait for incoming bytes. */
+                if (GetOverlappedResult(pThis->NamedPipe, &pThis->OverlappedRead, &cbReallyRead, TRUE) == FALSE)
+                    uError = GetLastError();
+            }
+
             if (   uError == ERROR_PIPE_LISTENING
                 || uError == ERROR_PIPE_NOT_CONNECTED)
@@ -127,13 +136,4 @@
             else
             {
-                if (uError == ERROR_IO_PENDING)
-                {
-                    uError = 0;
-
-                    /* Wait for incoming bytes. */
-                    if (GetOverlappedResult(pThis->NamedPipe, &pThis->OverlappedRead, &cbReallyRead, TRUE) == FALSE)
-                        uError = GetLastError();
-                }
-
                 rc = RTErrConvertFromWin32(uError);
                 Log(("drvNamedPipeRead: ReadFile returned %d (%Rrc)\n", uError, rc));
