Index: /trunk/src/VBox/Runtime/r3/win/process-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/process-win.cpp	(revision 70485)
+++ /trunk/src/VBox/Runtime/r3/win/process-win.cpp	(revision 70486)
@@ -2260,7 +2260,8 @@
     }
 
-    PCRTHANDLE  paHandles[3] = { phStdIn, phStdOut, phStdErr };
-    HANDLE     *aphStds[3]   = { &StartupInfo.hStdInput, &StartupInfo.hStdOutput, &StartupInfo.hStdError };
-    DWORD       afInhStds[3] = { 0xffffffff, 0xffffffff, 0xffffffff };
+    PCRTHANDLE  paHandles[3] = { phStdIn,                   phStdOut,                   phStdErr };
+    HANDLE     *aphStds[3]   = { &StartupInfo.hStdInput,    &StartupInfo.hStdOutput,    &StartupInfo.hStdError };
+    DWORD       afInhStds[3] = { 0xffffffff,                0xffffffff,                 0xffffffff };
+    HANDLE      ahStdDups[3] = { INVALID_HANDLE_VALUE,      INVALID_HANDLE_VALUE,       INVALID_HANDLE_VALUE };
     for (int i = 0; i < 3; i++)
     {
@@ -2271,8 +2272,14 @@
             {
                 case RTHANDLETYPE_FILE:
-                    *aphStds[i] = paHandles[i]->u.hFile != NIL_RTFILE
-                                ? (HANDLE)RTFileToNative(paHandles[i]->u.hFile)
-                                : INVALID_HANDLE_VALUE;
+                {
+                    HANDLE hNativeFile = paHandles[i]->u.hFile != NIL_RTFILE
+                                       ? (HANDLE)RTFileToNative(paHandles[i]->u.hFile)
+                                       : INVALID_HANDLE_VALUE;
+                    if (   hNativeFile == *aphStds[i]
+                        && g_enmWinVer == kRTWinOSType_NT310)
+                        continue;
+                    *aphStds[i] = hNativeFile;
                     break;
+                }
 
                 case RTHANDLETYPE_PIPE:
@@ -2280,4 +2287,11 @@
                                 ? (HANDLE)RTPipeToNative(paHandles[i]->u.hPipe)
                                 : INVALID_HANDLE_VALUE;
+                    if (   g_enmWinVer == kRTWinOSType_NT310
+                        && *aphStds[i] == INVALID_HANDLE_VALUE)
+                    {
+                        AssertMsgReturn(RTPipeGetCreationInheritability(paHandles[i]->u.hPipe), ("%Rrc %p\n", rc, *aphStds[i]),
+                                        VERR_INVALID_STATE);
+                        continue;
+                    }
                     break;
 
@@ -2295,9 +2309,12 @@
             if (*aphStds[i] != INVALID_HANDLE_VALUE)
             {
-                if (!GetHandleInformation(*aphStds[i], &afInhStds[i]))
+                if (g_enmWinVer == kRTWinOSType_NT310)
+                    afInhStds[i] = 0; /* No handle info on NT 3.1, so ASSUME it is not inheritable. */
+                else if (!GetHandleInformation(*aphStds[i], &afInhStds[i]))
                 {
                     rc = RTErrConvertFromWin32(GetLastError());
-                    if (rc != VERR_INVALID_FUNCTION || g_enmWinVer != kRTWinOSType_NT310)
-                        AssertMsgFailedReturn(("%Rrc %p\n", rc, *aphStds[i]), rc);
+                    AssertMsgFailedReturn(("%Rrc aphStds[%d] => %p paHandles[%d]={%d,%p}\n",
+                                           rc, i, *aphStds[i], i, paHandles[i]->enmType, paHandles[i]->u.uInt),
+                                          rc);
                 }
             }
@@ -2307,11 +2324,25 @@
     /*
      * Set the inheritability any handles we're handing the child.
+     *
+     * Note! On NT 3.1 there is no SetHandleInformation, so we have to duplicate
+     *       the handles to make sure they are inherited by the child.
      */
     rc = VINF_SUCCESS;
     for (int i = 0; i < 3; i++)
-        if (    (afInhStds[i] != 0xffffffff)
-            &&  !(afInhStds[i] & HANDLE_FLAG_INHERIT))
-        {
-            if (!SetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))
+        if (   (afInhStds[i] != 0xffffffff)
+            && !(afInhStds[i] & HANDLE_FLAG_INHERIT))
+        {
+            if (g_enmWinVer == kRTWinOSType_NT310)
+            {
+                if (DuplicateHandle(GetCurrentProcess(), *aphStds[i], GetCurrentProcess(), &ahStdDups[i],
+                                    i == 0 ? GENERIC_READ : GENERIC_WRITE, TRUE /*fInheritHandle*/, DUPLICATE_SAME_ACCESS))
+                    *aphStds[i] = ahStdDups[i];
+                else
+                {
+                    rc = RTErrConvertFromWin32(GetLastError());
+                    AssertMsgFailedBreak(("%Rrc aphStds[%u] => %p\n", rc, i, *aphStds[i]));
+                }
+            }
+            else if (!SetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))
             {
                 rc = RTErrConvertFromWin32(GetLastError());
@@ -2319,5 +2350,5 @@
                     rc = VINF_SUCCESS;
                 else
-                    AssertMsgFailedBreak(("%Rrc %p\n", rc,*aphStds[i]));
+                    AssertMsgFailedBreak(("%Rrc aphStds[%u] => %p\n", rc, i, *aphStds[i]));
             }
         }
@@ -2423,14 +2454,24 @@
     }
 
-    /* Undo any handle inherit changes. */
-    for (int i = 0; i < 3; i++)
-        if (    (afInhStds[i] != 0xffffffff)
-            &&  !(afInhStds[i] & HANDLE_FLAG_INHERIT))
-        {
-            if (   !SetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, 0)
-                && (   GetLastError() != ERROR_INVALID_FUNCTION
-                    || g_enmWinVer != kRTWinOSType_NT310) )
-                AssertMsgFailed(("%Rrc %p\n", RTErrConvertFromWin32(GetLastError()), *aphStds[i]));
-        }
+    if (g_enmWinVer != kRTWinOSType_NT310)
+    {
+        /* Undo any handle inherit changes. */
+        for (int i = 0; i < 3; i++)
+            if (   (afInhStds[i] != 0xffffffff)
+                && !(afInhStds[i] & HANDLE_FLAG_INHERIT))
+            {
+                if (   !SetHandleInformation(*aphStds[i], HANDLE_FLAG_INHERIT, 0)
+                    && (   GetLastError() != ERROR_INVALID_FUNCTION
+                        || g_enmWinVer != kRTWinOSType_NT310) )
+                    AssertMsgFailed(("%Rrc %p\n", RTErrConvertFromWin32(GetLastError()), *aphStds[i]));
+            }
+    }
+    else
+    {
+        /* Close handles duplicated for correct inheritance. */
+        for (int i = 0; i < 3; i++)
+            if (ahStdDups[i] != INVALID_HANDLE_VALUE)
+                CloseHandle(ahStdDups[i]);
+    }
 
     return rc;
Index: /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp	(revision 70485)
+++ /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp	(revision 70486)
@@ -579,5 +579,5 @@
     *pfFlags = 0;
     //MY_ASSERT(rcNt == STATUS_INVALID_HANDLE, "rcNt=%#x", rcNt);
-    MY_ASSERT(rcNt == STATUS_INVALID_HANDLE, "GetHandleInformation");
+    MY_ASSERT(rcNt == STATUS_INVALID_HANDLE || rcNt == STATUS_INVALID_INFO_CLASS, "GetHandleInformation");
     SetLastError(rcNt == STATUS_INVALID_HANDLE ? ERROR_INVALID_HANDLE : ERROR_INVALID_FUNCTION); /* see also process-win.cpp */
     return FALSE;
