Index: /trunk/include/iprt/file.h
===================================================================
--- /trunk/include/iprt/file.h	(revision 37595)
+++ /trunk/include/iprt/file.h	(revision 37596)
@@ -254,5 +254,5 @@
  *                          The ACCESS, ACTION and DENY flags are mandatory!
  */
-RTDECL(int)  RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen);
+RTDECL(int)  RTFileOpen(PRTFILE pFile, const char *pszFilename, uint64_t fOpen);
 
 /**
@@ -267,5 +267,5 @@
  * @param   ...             Arguments to the format string.
  */
-RTDECL(int)  RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, ...);
+RTDECL(int)  RTFileOpenF(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, ...);
 
 /**
@@ -280,5 +280,5 @@
  * @param   va              Arguments to the format string.
  */
-RTDECL(int)  RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, va_list va);
+RTDECL(int)  RTFileOpenV(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, va_list va);
 
 /**
@@ -289,5 +289,5 @@
  * @param   fAccess         The desired access only, i.e. read, write or both.
  */
-RTDECL(int)  RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess);
+RTDECL(int)  RTFileOpenBitBucket(PRTFILE phFile, uint64_t fAccess);
 
 /**
Index: /trunk/include/iprt/types.h
===================================================================
--- /trunk/include/iprt/types.h	(revision 37595)
+++ /trunk/include/iprt/types.h	(revision 37596)
@@ -1477,9 +1477,9 @@
 
 /** File handle. */
-typedef RTUINT                                      RTFILE;
+typedef R3R0PTRTYPE(struct RTFILEINT *)             RTFILE;
 /** Pointer to file handle. */
 typedef RTFILE                                     *PRTFILE;
 /** Nil file handle. */
-#define NIL_RTFILE                                  (~(RTFILE)0)
+#define NIL_RTFILE                                  ((RTFILE)~(RTHCINTPTR)0)
 
 /** Async I/O request handle. */
Index: /trunk/include/iprt/vfs.h
===================================================================
--- /trunk/include/iprt/vfs.h	(revision 37595)
+++ /trunk/include/iprt/vfs.h	(revision 37596)
@@ -439,5 +439,5 @@
  * @param   phVfsIos        Where to return the VFS I/O stream handle.
  */
-RTDECL(int)         RTVfsIoStrmFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos);
+RTDECL(int)         RTVfsIoStrmFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos);
 
 /**
@@ -452,5 +452,5 @@
  * @param   phVfsIos        Where to return the VFS I/O stream handle.
  */
-RTDECL(int)         RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint32_t fOpen, bool fLeaveOpen,
+RTDECL(int)         RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint64_t fOpen, bool fLeaveOpen,
                                              PRTVFSIOSTREAM phVfsIos);
 
@@ -676,5 +676,5 @@
  * @{
  */
-RTDECL(int)         RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile);
+RTDECL(int)         RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint64_t fOpen, PRTVFSFILE phVfsFile);
 
 /**
@@ -689,5 +689,5 @@
  * @param   phVfsFile       Where to return the VFS file handle.
  */
-RTDECL(int)         RTVfsFileFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile);
+RTDECL(int)         RTVfsFileFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile);
 RTDECL(RTHCUINTPTR) RTVfsFileToNative(RTFILE hVfsFile);
 
@@ -898,8 +898,8 @@
 RTDECL(int) RTVfsChainOpenVfs(      const char *pszSpec,                 PRTVFS          phVfs,     const char **ppszError);
 RTDECL(int) RTVfsChainOpenFsStream( const char *pszSpec,                 PRTVFSFSSTREAM  phVfsFss,  const char **ppszError);
-RTDECL(int) RTVfsChainOpenDir(      const char *pszSpec, uint32_t fOpen, PRTVFSDIR       phVfsDir,  const char **ppszError);
-RTDECL(int) RTVfsChainOpenFile(     const char *pszSpec, uint32_t fOpen, PRTVFSFILE      phVfsFile, const char **ppszError);
+RTDECL(int) RTVfsChainOpenDir(      const char *pszSpec, uint64_t fOpen, PRTVFSDIR       phVfsDir,  const char **ppszError);
+RTDECL(int) RTVfsChainOpenFile(     const char *pszSpec, uint64_t fOpen, PRTVFSFILE      phVfsFile, const char **ppszError);
 RTDECL(int) RTVfsChainOpenSymlink(  const char *pszSpec,                 PRTVFSSYMLINK   phVfsSym,  const char **ppszError);
-RTDECL(int) RTVfsChainOpenIoStream( const char *pszSpec, uint32_t fOpen, PRTVFSIOSTREAM  phVfsIos,  const char **ppszError);
+RTDECL(int) RTVfsChainOpenIoStream( const char *pszSpec, uint64_t fOpen, PRTVFSIOSTREAM  phVfsIos,  const char **ppszError);
 
 /**
Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp	(revision 37595)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp	(revision 37596)
@@ -188,5 +188,5 @@
         }
     }
-    g_File = hf;
+    g_File = (RTFILE)hf;
 
 #elif defined(VBOX_VBGLR3_XFREE86)
@@ -267,5 +267,5 @@
     g_File = NIL_RTFILE;
     AssertReturnVoid(File != NIL_RTFILE);
-    APIRET rc = DosClose(File);
+    APIRET rc = DosClose((uintptr_t)File);
     AssertMsg(!rc, ("%ld\n", rc));
 
@@ -323,5 +323,5 @@
     int32_t vrc = VERR_INTERNAL_ERROR;
     ULONG cbOS2Data = sizeof(vrc);
-    APIRET rc = DosDevIOCtl(g_File, VBOXGUEST_IOCTL_CATEGORY, iFunction,
+    APIRET rc = DosDevIOCtl((uintptr_t)g_File, VBOXGUEST_IOCTL_CATEGORY, iFunction,
                             pvData, cbData, &cbOS2Parm,
                             &vrc, sizeof(vrc), &cbOS2Data);
@@ -344,5 +344,5 @@
  *        header with an error code return field (much better alternative
  *        actually). */
-    int rc = ioctl((int)g_File, iFunction, &Hdr);
+    int rc = ioctl(RTFileToNative(g_File), iFunction, &Hdr);
     if (rc == -1)
     {
@@ -356,5 +356,5 @@
     int rc = xf86ioctl((int)g_File, iFunction, pvData);
 # else
-    int rc = ioctl((int)g_File, iFunction, pvData);
+    int rc = ioctl(RTFileToNative(g_File), iFunction, pvData);
 # endif
     if (RT_LIKELY(rc == 0))
Index: /trunk/src/VBox/Devices/Network/DrvNAT.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 37596)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -28,10 +28,12 @@
 #include <VBox/vmm/pdmnetifs.h>
 #include <VBox/vmm/pdmnetinline.h>
+
 #include <iprt/assert.h>
+#include <iprt/critsect.h>
+#include <iprt/cidr.h>
 #include <iprt/file.h>
 #include <iprt/mem.h>
+#include <iprt/pipe.h>
 #include <iprt/string.h>
-#include <iprt/critsect.h>
-#include <iprt/cidr.h>
 #include <iprt/stream.h>
 #include <iprt/uuid.h>
@@ -163,7 +165,7 @@
 #ifndef RT_OS_WINDOWS
     /** The write end of the control pipe. */
-    RTFILE                  PipeWrite;
+    RTPIPE                  hPipeWrite;
     /** The read end of the control pipe. */
-    RTFILE                  PipeRead;
+    RTPIPE                  hPipeRead;
 #else
     /** for external notification */
@@ -569,5 +571,6 @@
 #ifndef RT_OS_WINDOWS
     /* kick poll() */
-    rc = RTFileWrite(pThis->PipeWrite, "", 1, NULL);
+    size_t cbIgnored;
+    rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
 #else
     /* kick WSAWaitForMultipleEvents */
@@ -744,7 +747,7 @@
         slirp_select_fill(pThis->pNATState, &nFDs, &polls[1]);
 
-        polls[0].fd = pThis->PipeRead;
+        polls[0].fd = RTPipeToNative(pThis->hPipeRead);
         /* POLLRDBAND usually doesn't used on Linux but seems used on Solaris */
-        polls[0].events = POLLRDNORM|POLLPRI|POLLRDBAND;
+        polls[0].events = POLLRDNORM | POLLPRI | POLLRDBAND;
         polls[0].revents = 0;
 
@@ -770,10 +773,7 @@
             if (polls[0].revents & (POLLRDNORM|POLLPRI|POLLRDBAND))
             {
-                /* drain the pipe */
-                char ch[1];
-                size_t cbRead;
-                int counter = 0;
-                /*
-                 * drvNATSend decoupled so we don't know how many times
+                /* drain the pipe
+                 *
+                 * Note! drvNATSend decoupled so we don't know how many times
                  * device's thread sends before we've entered multiplex,
                  * so to avoid false alarm drain pipe here to the very end
@@ -782,9 +782,10 @@
                  * deep pipe has been filed before drain.
                  *
-                 * XXX:Make it reading exactly we need to drain the pipe.
                  */
-                /** @todo use RTPipeCreate + RTPipeRead(,biggerbuffer) here, it's
-                 *        non-blocking. */
-                RTFileRead(pThis->PipeRead, &ch, 1, &cbRead);
+                /** @todo XXX: Make it reading exactly we need to drain the
+                 * pipe.*/
+                char ch;
+                size_t cbRead;
+                RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
             }
         }
@@ -1345,13 +1346,6 @@
              * Create the control pipe.
              */
-            int fds[2];
-            if (pipe(&fds[0]) != 0) /** @todo RTPipeCreate() or something... */
-            {
-                rc = RTErrConvertFromErrno(errno);
-                AssertRC(rc);
-                return rc;
-            }
-            pThis->PipeRead = fds[0];
-            pThis->PipeWrite = fds[1];
+            rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
+            AssertRCReturn(rc, rc);
 #else
             pThis->hWakeupEvent = CreateEvent(NULL, FALSE, FALSE, NULL); /* auto-reset event */
@@ -1362,10 +1356,10 @@
             rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pSlirpThread, pThis, drvNATAsyncIoThread,
                                        drvNATAsyncIoWakeup, 128 * _1K, RTTHREADTYPE_IO, "NAT");
-            AssertRC(rc);
+            AssertRCReturn(rc, rc);
 
 #ifdef VBOX_WITH_SLIRP_MT
             rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pGuestThread, pThis, drvNATAsyncIoGuest,
                                        drvNATAsyncIoGuestWakeup, 128 * _1K, RTTHREADTYPE_IO, "NATGUEST");
-            AssertRC(rc);
+            AssertRCReturn(rc, rc);
 #endif
 
Index: /trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp	(revision 37596)
@@ -66,5 +66,5 @@
     char                    szFilename[RTPATH_MAX];
     /** The filehandle. */
-    RTFILE                  File;
+    RTFILE                  hFile;
     /** The lock serializing the file access. */
     RTCRITSECT              Lock;
@@ -134,10 +134,10 @@
     RTCritSectEnter(&pThis->Lock);
     if (!pSgBuf->pvUser)
-        PcapFileFrame(pThis->File, pThis->StartNanoTS,
+        PcapFileFrame(pThis->hFile, pThis->StartNanoTS,
                       pSgBuf->aSegs[0].pvSeg,
                       pSgBuf->cbUsed,
                       RT_MIN(pSgBuf->cbUsed, pSgBuf->aSegs[0].cbSeg));
     else
-        PcapFileGsoFrame(pThis->File, pThis->StartNanoTS, (PCPDMNETWORKGSO)pSgBuf->pvUser,
+        PcapFileGsoFrame(pThis->hFile, pThis->StartNanoTS, (PCPDMNETWORKGSO)pSgBuf->pvUser,
                          pSgBuf->aSegs[0].pvSeg,
                          pSgBuf->cbUsed,
@@ -206,5 +206,5 @@
     /* output to sniffer */
     RTCritSectEnter(&pThis->Lock);
-    PcapFileFrame(pThis->File, pThis->StartNanoTS, pvBuf, cb, cb);
+    PcapFileFrame(pThis->hFile, pThis->StartNanoTS, pvBuf, cb, cb);
     RTCritSectLeave(&pThis->Lock);
 
@@ -217,5 +217,5 @@
     Hdr.ts_usec = (uint32_t)((u64TS / 1000) % 1000000);
     Hdr.incl_len = 0;
-    RTFileWrite(pThis->File, &Hdr, sizeof(Hdr), NULL);
+    RTFileWrite(pThis->hFile, &Hdr, sizeof(Hdr), NULL);
     RTCritSectLeave(&pThis->Lock);
 #endif
@@ -358,9 +358,6 @@
         RTCritSectDelete(&pThis->XmitLock);
 
-    if (pThis->File != NIL_RTFILE)
-    {
-        RTFileClose(pThis->File);
-        pThis->File = NIL_RTFILE;
-    }
+    RTFileClose(pThis->hFile);
+    pThis->hFile = NIL_RTFILE;
 }
 
@@ -380,5 +377,5 @@
      */
     pThis->pDrvIns                                  = pDrvIns;
-    pThis->File                                     = NIL_RTFILE;
+    pThis->hFile                                    = NIL_RTFILE;
     /* The pcap file *must* start at time offset 0,0. */
     pThis->StartNanoTS                              = RTTimeNanoTS() - RTTimeProgramNanoTS();
@@ -483,5 +480,5 @@
      * Open output file / pipe.
      */
-    rc = RTFileOpen(&pThis->File, pThis->szFilename,
+    rc = RTFileOpen(&pThis->hFile, pThis->szFilename,
                     RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_WRITE);
     if (RT_FAILURE(rc))
@@ -494,5 +491,5 @@
      * current time again.
      */
-    PcapFileHdr(pThis->File, RTTimeNanoTS());
+    PcapFileHdr(pThis->hFile, RTTimeNanoTS());
 
     return VINF_SUCCESS;
Index: /trunk/src/VBox/Devices/Network/DrvTAP.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/DrvTAP.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Network/DrvTAP.cpp	(revision 37596)
@@ -31,4 +31,5 @@
 #include <iprt/mem.h>
 #include <iprt/path.h>
+#include <iprt/pipe.h>
 #include <iprt/semaphore.h>
 #include <iprt/string.h>
@@ -93,5 +94,5 @@
     PPDMDRVINS              pDrvIns;
     /** TAP device file handle. */
-    RTFILE                  FileDevice;
+    RTFILE                  hFileDevice;
     /** The configured TAP device name. */
     char                   *pszDeviceName;
@@ -104,5 +105,5 @@
 # else
     /** IP device file handle (/dev/udp). */
-    RTFILE                  IPFileDevice;
+    int                     iIPFileDes;
 # endif
     /** Whether device name is obtained from setup application. */
@@ -114,7 +115,7 @@
     char                   *pszTerminateApplication;
     /** The write end of the control pipe. */
-    RTFILE                  PipeWrite;
+    RTPIPE                  hPipeWrite;
     /** The read end of the control pipe. */
-    RTFILE                  PipeRead;
+    RTPIPE                  hPipeRead;
     /** Reader thread. */
     PPDMTHREAD              pThread;
@@ -275,5 +276,5 @@
               pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, pSgBuf->cbUsed, pSgBuf->aSegs[0].pvSeg));
 
-        rc = RTFileWrite(pThis->FileDevice, pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, NULL);
+        rc = RTFileWrite(pThis->hFileDevice, pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, NULL);
     }
     else
@@ -289,5 +290,5 @@
             void *pvSegFrame = PDMNetGsoCarveSegmentQD(pGso, (uint8_t *)pbFrame, pSgBuf->cbUsed, abHdrScratch,
                                                        iSeg, cSegs, &cbSegFrame);
-            rc = RTFileWrite(pThis->FileDevice, pvSegFrame, cbSegFrame, NULL);
+            rc = RTFileWrite(pThis->hFileDevice, pvSegFrame, cbSegFrame, NULL);
             if (RT_FAILURE(rc))
                 break;
@@ -366,8 +367,8 @@
          */
         struct pollfd aFDs[2];
-        aFDs[0].fd      = pThis->FileDevice;
+        aFDs[0].fd      = RTFileToNative(pThis->hFileDevice);
         aFDs[0].events  = POLLIN | POLLPRI;
         aFDs[0].revents = 0;
-        aFDs[1].fd      = pThis->PipeRead;
+        aFDs[1].fd      = RTPipeToNative(pThis->hPipeRead);
         aFDs[1].events  = POLLIN | POLLPRI | POLLERR | POLLHUP;
         aFDs[1].revents = 0;
@@ -398,5 +399,5 @@
              *        after poll() returned successfully. I don't know why but a second
              *        RTFileRead() operation will return with VERR_TRY_AGAIN in any case. */
-            rc = RTFileRead(pThis->FileDevice, achBuf, sizeof(achBuf), &cbRead);
+            rc = RTFileRead(pThis->hFileDevice, achBuf, sizeof(achBuf), &cbRead);
 #endif
             if (RT_SUCCESS(rc))
@@ -459,5 +460,5 @@
             char ch;
             size_t cbRead;
-            RTFileRead(pThis->PipeRead, &ch, 1, &cbRead);
+            RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
         }
         else
@@ -495,5 +496,6 @@
     PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP);
 
-    int rc = RTFileWrite(pThis->PipeWrite, "", 1, NULL);
+    size_t cbIgnored;
+    int rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
     AssertRC(rc);
 
@@ -657,13 +659,17 @@
                         if (rc == DLPI_SUCCESS)
                         {
-                            pThis->FileDevice = g_pfnLibDlpiFd(pThis->pDeviceHandle);
+                            int fd = g_pfnLibDlpiFd(pThis->pDeviceHandle);
                             if (pThis->FileDevice >= 0)
                             {
-                                Log(("SolarisOpenVNIC: %s -> %d\n", pThis->pszDeviceName, pThis->FileDevice));
-                                return VINF_SUCCESS;
+                                rc = RTFileFromNative(&pThis->hFileDevice, fd);
+                                if (RT_SUCCESS(rc))
+                                {
+                                    Log(("SolarisOpenVNIC: %s -> %RTfile\n", pThis->pszDeviceName, pThis->hFileDevice));
+                                    return VINF_SUCCESS;
+                                }
                             }
-
-                            rc = PDMDrvHlpVMSetError(pThis->pDrvIns, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS,
-                                                     N_("Failed to obtain file descriptor for VNIC"));
+                            else
+                                rc = PDMDrvHlpVMSetError(pThis->pDrvIns, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS,
+                                                         N_("Failed to obtain file descriptor for VNIC"));
                         }
                         else
@@ -879,6 +885,12 @@
     }
 
-    pThis->FileDevice = (RTFILE)TapFileDes;
-    pThis->IPFileDevice = (RTFILE)IPFileDes;
+    int rc = RTFileFromNative(&pThis->hFileDevice, TapFileDes);
+    AssertLogRelRC(rc);
+    if (RT_FAILURE(rc)))
+    {
+        close(IPFileDes);
+        close(TapFileDes);
+    }
+    pThis->iIPFileDes = IPFileDes;
 
     return VINF_SUCCESS;
@@ -922,32 +934,24 @@
      * Terminate the control pipe.
      */
-    if (pThis->PipeWrite != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->PipeWrite);
-        AssertRC(rc);
-        pThis->PipeWrite = NIL_RTFILE;
-    }
-    if (pThis->PipeRead != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->PipeRead);
-        AssertRC(rc);
-        pThis->PipeRead = NIL_RTFILE;
-    }
+    int rc;
+    rc = RTPipeClose(pThis->hPipeWrite); AssertRC(rc);
+    pThis->hPipeWrite = NIL_RTPIPE;
+    rc = RTPipeClose(pThis->hPipeRead); AssertRC(rc);
+    pThis->hPipeRead = NIL_RTPIPE;
 
 #ifdef RT_OS_SOLARIS
     /** @todo r=bird: This *does* need checking against ConsoleImpl2.cpp if used on non-solaris systems. */
-    if (pThis->FileDevice != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->FileDevice);
+    if (pThis->hFileDevice != NIL_RTFILE)
+    {
+        int rc = RTFileClose(pThis->hFileDevice);
         AssertRC(rc);
-        pThis->FileDevice = NIL_RTFILE;
+        pThis->hFileDevice = NIL_RTFILE;
     }
 
 # ifndef VBOX_WITH_CROSSBOW
-    if (pThis->IPFileDevice != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->IPFileDevice);
-        AssertRC(rc);
-        pThis->IPFileDevice = NIL_RTFILE;
+    if (pThis->iIPFileDes != -1)
+    {
+        close(pThis->iIPFileDes);
+        pThis->iIPFileDes = -1;
     }
 # endif
@@ -1007,5 +1011,5 @@
      */
     pThis->pDrvIns                      = pDrvIns;
-    pThis->FileDevice                   = NIL_RTFILE;
+    pThis->hFileDevice                  = NIL_RTFILE;
     pThis->pszDeviceName                = NULL;
 #ifdef RT_OS_SOLARIS
@@ -1013,5 +1017,5 @@
     pThis->pDeviceHandle                = NULL;
 # else
-    pThis->IPFileDevice                 = NIL_RTFILE;
+    pThis->iIPFileDes                   = -1;
 # endif
     pThis->fStatic                      = true;
@@ -1126,13 +1130,13 @@
 #else /* !RT_OS_SOLARIS */
 
-    int32_t iFile;
-    rc = CFGMR3QueryS32(pCfg, "FileHandle", &iFile);
+    uint64_t u64File;
+    rc = CFGMR3QueryU64(pCfg, "FileHandle", &u64File);
     if (RT_FAILURE(rc))
         return PDMDRV_SET_ERROR(pDrvIns, rc,
                                 N_("Configuration error: Query for \"FileHandle\" 32-bit signed integer failed"));
-    pThis->FileDevice = (RTFILE)iFile;
-    if (!RTFileIsValid(pThis->FileDevice))
+    pThis->hFileDevice = (RTFILE)(uintptr_t)u64File;
+    if (!RTFileIsValid(pThis->hFileDevice))
         return PDMDrvHlpVMSetError(pDrvIns, VERR_INVALID_HANDLE, RT_SRC_POS,
-                                   N_("The TAP file handle %RTfile is not valid"), pThis->FileDevice);
+                                   N_("The TAP file handle %RTfile is not valid"), pThis->hFileDevice);
 #endif /* !RT_OS_SOLARIS */
 
@@ -1149,9 +1153,9 @@
      * found any way to do that.
      */
-    if (fcntl(pThis->FileDevice, F_SETFL, O_NONBLOCK) == -1)
+    if (fcntl(RTFileToNative(pThis->hFileDevice), F_SETFL, O_NONBLOCK) == -1)
         return PDMDrvHlpVMSetError(pDrvIns, VERR_HOSTIF_IOCTL, RT_SRC_POS,
                                    N_("Configuration error: Failed to configure /dev/net/tun. errno=%d"), errno);
     /** @todo determine device name. This can be done by reading the link /proc/<pid>/fd/<fd> */
-    Log(("drvTAPContruct: %d (from fd)\n", pThis->FileDevice));
+    Log(("drvTAPContruct: %d (from fd)\n", pThis->hFileDevice));
     rc = VINF_SUCCESS;
 
@@ -1159,17 +1163,6 @@
      * Create the control pipe.
      */
-    int fds[2];
-#ifdef RT_OS_L4
-    /* XXX We need to tell the library which interface we are using */
-    fds[0] = vboxrtLinuxFd2VBoxFd(VBOXRT_FT_TAP, 0);
-#endif
-    if (pipe(&fds[0]) != 0) /** @todo RTPipeCreate() or something... */
-    {
-        rc = RTErrConvertFromErrno(errno);
-        AssertRC(rc);
-        return rc;
-    }
-    pThis->PipeRead = fds[0];
-    pThis->PipeWrite = fds[1];
+    rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
+    AssertRCReturn(rc, rc);
 
     /*
Index: /trunk/src/VBox/Devices/Network/DrvVDE.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/DrvVDE.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Network/DrvVDE.cpp	(revision 37596)
@@ -34,4 +34,5 @@
 #include <iprt/param.h>
 #include <iprt/path.h>
+#include <iprt/pipe.h>
 #include <iprt/semaphore.h>
 #include <iprt/string.h>
@@ -64,16 +65,14 @@
     /** Pointer to the driver instance. */
     PPDMDRVINS              pDrvIns;
-    /** VDE device file handle. */
-    RTFILE                  FileDevice;
     /** The configured VDE device name. */
     char                   *pszDeviceName;
     /** The write end of the control pipe. */
-    RTFILE                  PipeWrite;
+    RTPIPE                  hPipeWrite;
     /** The read end of the control pipe. */
-    RTFILE                  PipeRead;
+    RTPIPE                  hPipeRead;
     /** Reader thread. */
     PPDMTHREAD              pThread;
     /** The connection to the VDE switch */
-    VDECONN                *vdeconn;
+    VDECONN                *pVdeConn;
 
     /** @todo The transmit thread. */
@@ -225,5 +224,5 @@
 
         ssize_t cbSent;
-        cbSent = vde_send(pThis->vdeconn, pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, 0);
+        cbSent = vde_send(pThis->pVdeConn, pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, 0);
         rc = cbSent < 0 ? RTErrConvertFromErrno(-cbSent) : VINF_SUCCESS;
     }
@@ -241,5 +240,5 @@
                                                        iSeg, cSegs, &cbSegFrame);
             ssize_t cbSent;
-            cbSent = vde_send(pThis->vdeconn, pvSegFrame, cbSegFrame, 0);
+            cbSent = vde_send(pThis->pVdeConn, pvSegFrame, cbSegFrame, 0);
             rc = cbSent < 0 ? RTErrConvertFromErrno(-cbSent) : VINF_SUCCESS;
             if (RT_FAILURE(rc))
@@ -319,8 +318,8 @@
          */
         struct pollfd aFDs[2];
-        aFDs[0].fd      = vde_datafd(pThis->vdeconn);
+        aFDs[0].fd      = vde_datafd(pThis->pVdeConn);
         aFDs[0].events  = POLLIN | POLLPRI;
         aFDs[0].revents = 0;
-        aFDs[1].fd      = pThis->PipeRead;
+        aFDs[1].fd      = RTPipeToNative(pThis->hPipeRead);
         aFDs[1].events  = POLLIN | POLLPRI | POLLERR | POLLHUP;
         aFDs[1].revents = 0;
@@ -343,5 +342,5 @@
             char achBuf[16384];
             ssize_t cbRead = 0;
-            cbRead = vde_recv(pThis->vdeconn, achBuf, sizeof(achBuf), 0);
+            cbRead = vde_recv(pThis->pVdeConn, achBuf, sizeof(achBuf), 0);
             rc = cbRead < 0 ? RTErrConvertFromErrno(-cbRead) : VINF_SUCCESS;
             if (RT_SUCCESS(rc))
@@ -404,5 +403,5 @@
             char ch;
             size_t cbRead;
-            RTFileRead(pThis->PipeRead, &ch, 1, &cbRead);
+            RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
         }
         else
@@ -440,5 +439,6 @@
     PDRVVDE pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE);
 
-    int rc = RTFileWrite(pThis->PipeWrite, "", 1, NULL);
+    size_t cbIgnored;
+    int rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
     AssertRC(rc);
 
@@ -481,16 +481,8 @@
      * Terminate the control pipe.
      */
-    if (pThis->PipeWrite != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->PipeWrite);
-        AssertRC(rc);
-        pThis->PipeWrite = NIL_RTFILE;
-    }
-    if (pThis->PipeRead != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->PipeRead);
-        AssertRC(rc);
-        pThis->PipeRead = NIL_RTFILE;
-    }
+    RTPipeClose(pThis->hPipeWrite);
+    pThis->hPipeWrite = NIL_RTPIPE;
+    RTPipeClose(pThis->hPipeRead);
+    pThis->hPipeRead = NIL_RTPIPE;
 
     MMR3HeapFree(pThis->pszDeviceName);
@@ -502,5 +494,7 @@
         RTCritSectDelete(&pThis->XmitLock);
 
-    vde_close(pThis->vdeconn);
+    vde_close(pThis->pVdeConn);
+    pThis->pVdeConn = NULL;
+
 #ifdef VBOX_WITH_STATISTICS
     /*
@@ -530,12 +524,11 @@
      * Init the static parts.
      */
-    pThis->pDrvIns                      = pDrvIns;
-    pThis->FileDevice                   = NIL_RTFILE;
-    pThis->pszDeviceName                = NULL;
-    pThis->PipeRead                     = NIL_RTFILE;
-    pThis->PipeWrite                    = NIL_RTFILE;
+    pThis->pDrvIns                              = pDrvIns;
+    pThis->pszDeviceName                        = NULL;
+    pThis->hPipeRead                            = NIL_RTPIPE;
+    pThis->hPipeWrite                           = NIL_RTPIPE;
 
     /* IBase */
-    pDrvIns->IBase.pfnQueryInterface    = drvVDEQueryInterface;
+    pDrvIns->IBase.pfnQueryInterface            = drvVDEQueryInterface;
     /* INetwork */
     pThis->INetworkUp.pfnBeginXmit              = drvVDENetworkUp_BeginXmit;
@@ -592,6 +585,6 @@
         return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_HIF_OPEN_FAILED, RT_SRC_POS,
                                    N_("VDEplug library: not found"));
-    pThis->vdeconn = vde_open(szNetwork, "VirtualBOX", NULL);
-    if (pThis->vdeconn == NULL)
+    pThis->pVdeConn = vde_open(szNetwork, "VirtualBOX", NULL);
+    if (pThis->pVdeConn == NULL)
         return PDMDrvHlpVMSetError(pThis->pDrvIns, VERR_PDM_HIF_OPEN_FAILED, RT_SRC_POS,
                                    N_("Failed to connect to the VDE SWITCH"));
@@ -606,13 +599,6 @@
      * Create the control pipe.
      */
-    int fds[2];
-    if (pipe(&fds[0]) != 0) /** @todo RTPipeCreate() or something... */
-    {
-        rc = RTErrConvertFromErrno(errno);
-        AssertRC(rc);
-        return rc;
-    }
-    pThis->PipeRead = fds[0];
-    pThis->PipeWrite = fds[1];
+    rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
+    AssertRCReturn(rc, rc);
 
     /*
Index: /trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp
===================================================================
--- /trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp	(revision 37596)
@@ -27,4 +27,5 @@
 #include <iprt/assert.h>
 #include <iprt/file.h>
+#include <iprt/pipe.h>
 #include <iprt/semaphore.h>
 #include <iprt/stream.h>
@@ -64,11 +65,11 @@
     char                         *pszDevicePath;
     /** Device Handle */
-    RTFILE                        FileDevice;
+    RTFILE                        hFileDevice;
     /** Thread waiting for interrupts. */
     PPDMTHREAD                    pMonitorThread;
     /** Wakeup pipe read end. */
-    RTFILE                        WakeupPipeR;
+    RTPIPE                        hWakeupPipeR;
     /** Wakeup pipe write end. */
-    RTFILE                        WakeupPipeW;
+    RTPIPE                        hWakeupPipeW;
 } DRVHOSTPARALLEL, *PDRVHOSTPARALLEL;
 
@@ -102,5 +103,5 @@
     LogFlow(("%s: pvBuf=%#p cbWrite=%d\n", __FUNCTION__, pvBuf, *cbWrite));
 
-    ioctl(pThis->FileDevice, PPWDATA, pBuffer);
+    ioctl(RTFileToNative(pThis->hFileDevice), PPWDATA, pBuffer);
     *cbWrite = 1;
 
@@ -115,5 +116,5 @@
     LogFlow(("%s: pvBuf=%#p cbRead=%d\n", __FUNCTION__, pvBuf, cbRead));
 
-    ioctl(pThis->FileDevice, PPRDATA, pBuffer);
+    ioctl(RTFileToNative(pThis->hFileDevice), PPRDATA, pBuffer);
     *cbRead = 1;
 
@@ -140,5 +141,5 @@
     }
 
-    ioctl(pThis->FileDevice, PPSETMODE, &ppdev_mode);
+    ioctl(RTFileToNative(pThis->hFileDevice), PPSETMODE, &ppdev_mode);
 
     return VINF_SUCCESS;
@@ -150,6 +151,5 @@
 
     LogFlow(("%s: fReg=%d\n", __FUNCTION__, fReg));
-
-    ioctl(pThis->FileDevice, PPWCONTROL, &fReg);
+    ioctl(RTFileToNative(pThis->hFileDevice), PPWCONTROL, &fReg);
 
     return VINF_SUCCESS;
@@ -159,10 +159,8 @@
 {
     PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
-    uint8_t fReg;
-
-    ioctl(pThis->FileDevice, PPRCONTROL, &fReg);
-
+
+    uint8_t fReg = 0;
+    ioctl(RTFileToNative(pThis->hFileDevice), PPRCONTROL, &fReg);
     LogFlow(("%s: fReg=%d\n", __FUNCTION__, fReg));
-
     *pfReg = fReg;
 
@@ -173,10 +171,8 @@
 {
     PDRVHOSTPARALLEL pThis = PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface);
-    uint8_t fReg;
-
-    ioctl(pThis->FileDevice, PPRSTATUS, &fReg);
-
+
+    uint8_t fReg = 0;
+    ioctl(RTFileToNative(pThis->hFileDevice), PPRSTATUS, &fReg);
     LogFlow(("%s: fReg=%d\n", __FUNCTION__, fReg));
-
     *pfReg = fReg;
 
@@ -196,8 +192,8 @@
         int rc;
 
-        aFDs[0].fd      = pThis->FileDevice;
+        aFDs[0].fd      = RTFileToNative(pThis->hFileDevice);
         aFDs[0].events  = POLLIN;
         aFDs[0].revents = 0;
-        aFDs[1].fd      = pThis->WakeupPipeR;
+        aFDs[1].fd      = RTPipeToNative(pThis->hWakeupPipeR);
         aFDs[1].events  = POLLIN | POLLERR | POLLHUP;
         aFDs[1].revents = 0;
@@ -218,5 +214,5 @@
             char ch;
             size_t cbRead;
-            RTFileRead(pThis->WakeupPipeR, &ch, 1, &cbRead);
+            RTPipeRead(pThis->hWakeupPipeR, &ch, 1, &cbRead);
             continue;
         }
@@ -240,6 +236,6 @@
 {
     PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
-
-    return RTFileWrite(pThis->WakeupPipeW, "", 1, NULL);
+    size_t cbIgnored;
+    return RTPipeWrite(pThis->hWakeupPipeW, "", 1, &cbIgnored);
 }
 
@@ -257,25 +253,18 @@
     LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
-
-    ioctl(pThis->FileDevice, PPRELEASE);
-
-    if (pThis->WakeupPipeW != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->WakeupPipeW);
-        AssertRC(rc);
-        pThis->WakeupPipeW = NIL_RTFILE;
-    }
-    if (pThis->WakeupPipeR != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->WakeupPipeR);
-        AssertRC(rc);
-        pThis->WakeupPipeR = NIL_RTFILE;
-    }
-    if (pThis->FileDevice != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->FileDevice);
-        AssertRC(rc);
-        pThis->FileDevice = NIL_RTFILE;
-    }
+    int rc;
+
+    if (pThis->hFileDevice != NIL_RTFILE)
+        ioctl(RTFileToNative(pThis->hFileDevice), PPRELEASE);
+
+    rc = RTPipeClose(pThis->hWakeupPipeW); AssertRC(rc);
+    pThis->hWakeupPipeW = NIL_RTPIPE;
+
+    rc = RTPipeClose(pThis->hWakeupPipeR); AssertRC(rc);
+    pThis->hWakeupPipeR = NIL_RTPIPE;
+
+    rc = RTFileClose(pThis->hFileDevice); AssertRC(rc);
+    pThis->hFileDevice = NIL_RTFILE;
+
     if (pThis->pszDevicePath)
     {
@@ -297,13 +286,11 @@
 
     /*
-     * Validate the config.
-     */
-    if (!CFGMR3AreValuesValid(pCfg, "DevicePath\0"))
-        return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
-                                N_("Unknown host parallel configuration option, only supports DevicePath"));
-
-    /*
      * Init basic data members and interfaces.
-     */
+     *
+     * Must be done before returning any failure because we've got a destructor.
+     */
+    pThis->hFileDevice  = NIL_RTFILE;
+    pThis->hWakeupPipeR = NIL_RTPIPE;
+    pThis->hWakeupPipeW = NIL_RTPIPE;
 
     /* IBase. */
@@ -318,4 +305,11 @@
 
     /*
+     * Validate the config.
+     */
+    if (!CFGMR3AreValuesValid(pCfg, "DevicePath\0"))
+        return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES,
+                                N_("Unknown host parallel configuration option, only supports DevicePath"));
+
+    /*
      * Query configuration.
      */
@@ -331,5 +325,5 @@
      * Open the device
      */
-    rc = RTFileOpen(&pThis->FileDevice, pThis->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+    rc = RTFileOpen(&pThis->hFileDevice, pThis->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     if (RT_FAILURE(rc))
         return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Parallel#%d could not open '%s'"),
@@ -339,5 +333,5 @@
      * Try to get exclusive access to parallel port
      */
-    rc = ioctl(pThis->FileDevice, PPEXCL);
+    rc = ioctl(RTFileToNative(pThis->hFileDevice), PPEXCL);
     if (rc < 0)
         return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
@@ -349,5 +343,5 @@
      * Claim the parallel port
      */
-    rc = ioctl(pThis->FileDevice, PPCLAIM);
+    rc = ioctl(RTFileToNative(pThis->hFileDevice), PPCLAIM);
     if (rc < 0)
         return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
@@ -367,13 +361,6 @@
      * Create wakeup pipe.
      */
-    int aFDs[2];
-    if (pipe(aFDs) != 0)
-    {
-        rc = RTErrConvertFromErrno(errno);
-        AssertRC(rc);
-        return rc;
-    }
-    pThis->WakeupPipeR = aFDs[0];
-    pThis->WakeupPipeW = aFDs[1];
+    rc = RTPipeCreate(&pThis->hWakeupPipeR, &pThis->hWakeupPipeR, 0 /*fFlags*/);
+    AssertRCReturn(rc, rc);
 
     /*
Index: /trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp
===================================================================
--- /trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp	(revision 37596)
@@ -30,4 +30,5 @@
 #include <iprt/file.h>
 #include <iprt/mem.h>
+#include <iprt/pipe.h>
 #include <iprt/semaphore.h>
 #include <iprt/uuid.h>
@@ -103,14 +104,14 @@
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
     /** the device handle */
-    RTFILE                      DeviceFile;
+    RTFILE                      hDeviceFile;
 # ifdef RT_OS_DARWIN
     /** The device handle used for reading.
      * Used to prevent the read select from blocking the writes. */
-    RTFILE                      DeviceFileR;
+    RTFILE                      hDeviceFileR;
 # endif
     /** The read end of the control pipe */
-    RTFILE                      WakeupPipeR;
+    RTPIPE                      hWakeupPipeR;
     /** The write end of the control pipe */
-    RTFILE                      WakeupPipeW;
+    RTPIPE                      hWakeupPipeW;
 # ifndef RT_OS_LINUX
     /** The current line status.
@@ -265,5 +266,5 @@
 #ifdef RT_OS_LINUX
             struct serial_struct serialStruct;
-            if (ioctl(pThis->DeviceFile, TIOCGSERIAL, &serialStruct) != -1)
+            if (ioctl(RTFileToNative(pThis->hDeviceFile), TIOCGSERIAL, &serialStruct) != -1)
             {
                 serialStruct.custom_divisor = serialStruct.baud_base / Bps;
@@ -272,5 +273,5 @@
                 serialStruct.flags &= ~ASYNC_SPD_MASK;
                 serialStruct.flags |= ASYNC_SPD_CUST;
-                ioctl(pThis->DeviceFile, TIOCSSERIAL, &serialStruct);
+                ioctl(RTFileToNative(pThis->hDeviceFile), TIOCSSERIAL, &serialStruct);
                 baud_rate = B38400;
             }
@@ -328,5 +329,5 @@
     termiosSetup->c_lflag &= ~(ICANON | ECHO | ECHOE | ECHONL | ECHOK | ISIG | IEXTEN);
 
-    tcsetattr(pThis->DeviceFile, TCSANOW, termiosSetup);
+    tcsetattr(RTFileToNative(pThis->hDeviceFile), TCSANOW, termiosSetup);
     RTMemTmpFree(termiosSetup);
 
@@ -486,5 +487,5 @@
 
             size_t cbWritten;
-            rc = RTFileWrite(pThis->DeviceFile, &ch, 1, &cbWritten);
+            rc = RTFileWrite(pThis->hDeviceFile, &ch, 1, &cbWritten);
             if (rc == VERR_TRY_AGAIN)
                 cbWritten = 0;
@@ -498,12 +499,12 @@
                     fd_set WrSet;
                     FD_ZERO(&WrSet);
-                    FD_SET(pThis->DeviceFile, &WrSet);
+                    FD_SET(RTFileToNative(pThis->hDeviceFile), &WrSet);
                     fd_set XcptSet;
                     FD_ZERO(&XcptSet);
-                    FD_SET(pThis->DeviceFile, &XcptSet);
+                    FD_SET(RTFileToNative(pThis->hDeviceFile), &XcptSet);
 # ifdef DEBUG
                     uint64_t u64Now = RTTimeMilliTS();
 # endif
-                    rc = select(pThis->DeviceFile + 1, NULL, &WrSet, &XcptSet, NULL);
+                    rc = select(RTFileToNative(pThis->hDeviceFile) + 1, NULL, &WrSet, &XcptSet, NULL);
                     /** @todo check rc? */
 
@@ -512,5 +513,5 @@
 # endif
                     /* try write more */
-                    rc = RTFileWrite(pThis->DeviceFile, &ch, 1, &cbWritten);
+                    rc = RTFileWrite(pThis->hDeviceFile, &ch, 1, &cbWritten);
                     if (rc == VERR_TRY_AGAIN)
                         cbWritten = 0;
@@ -627,15 +628,17 @@
             fd_set RdSet;
             FD_ZERO(&RdSet);
-            FD_SET(pThis->DeviceFileR, &RdSet);
-            FD_SET(pThis->WakeupPipeR, &RdSet);
+            FD_SET(RTFileToNative(pThis->hDeviceFileR), &RdSet);
+            FD_SET(RTPipeToNative(pThis->hWakeupPipeR), &RdSet);
             fd_set XcptSet;
             FD_ZERO(&XcptSet);
-            FD_SET(pThis->DeviceFileR, &XcptSet);
-            FD_SET(pThis->WakeupPipeR, &XcptSet);
+            FD_SET(RTFileToNative(pThis->hDeviceFile), &XcptSet);
+            FD_SET(RTPipeToNative(pThis->hWakeupPipeR), &XcptSet);
 # if 1 /* it seems like this select is blocking the write... */
-            rc = select(RT_MAX(pThis->WakeupPipeR, pThis->DeviceFileR) + 1, &RdSet, NULL, &XcptSet, NULL);
+            rc = select(RT_MAX(RTFileToPipe(pThis->hWakeupPipeR), RTFileToNative(pThis->hDeviceFileR)) + 1,
+                        &RdSet, NULL, &XcptSet, NULL);
 # else
             struct timeval tv = { 0, 1000 };
-            rc = select(RT_MAX(pThis->WakeupPipeR, pThis->DeviceFileR) + 1, &RdSet, NULL, &XcptSet, &tv);
+            rc = select(RTFileToPipe(pThis->hWakeupPipeR), RTFileToNative(pThis->hDeviceFileR) + 1,
+                        &RdSet, NULL, &XcptSet, &tv);
 # endif
             if (rc == -1)
@@ -655,8 +658,8 @@
             /* drain the wakeup pipe */
             size_t cbRead;
-            if (   FD_ISSET(pThis->WakeupPipeR, &RdSet)
-                || FD_ISSET(pThis->WakeupPipeR, &XcptSet))
-            {
-                rc = RTFileRead(pThis->WakeupPipeR, abBuffer, 1, &cbRead);
+            if (   FD_ISSET(RTPipeToNative(pThis->hWakeupPipeR), &RdSet)
+                || FD_ISSET(pThis->hWakeupPipeR, &XcptSet))
+            {
+                rc = RTPipeRead(pThis->hWakeupPipeR, abBuffer, 1, &cbRead);
                 if (RT_FAILURE(rc))
                 {
@@ -669,5 +672,5 @@
 
             /* read data from the serial port. */
-            rc = RTFileRead(pThis->DeviceFileR, abBuffer, sizeof(abBuffer), &cbRead);
+            rc = RTFileRead(pThis->hDeviceFileR, abBuffer, sizeof(abBuffer), &cbRead);
             if (RT_FAILURE(rc))
             {
@@ -682,8 +685,8 @@
             size_t cbRead;
             struct pollfd aFDs[2];
-            aFDs[0].fd      = pThis->DeviceFile;
+            aFDs[0].fd      = RTFileToNative(pThis->hDeviceFile);
             aFDs[0].events  = POLLIN;
             aFDs[0].revents = 0;
-            aFDs[1].fd      = pThis->WakeupPipeR;
+            aFDs[1].fd      = RTPipeToNative(pThis->hWakeupPipeR);
             aFDs[1].events  = POLLIN | POLLERR | POLLHUP;
             aFDs[1].revents = 0;
@@ -704,8 +707,8 @@
                     break;
                 /* notification to terminate -- drain the pipe */
-                RTFileRead(pThis->WakeupPipeR, &abBuffer, 1, &cbRead);
+                RTPipeRead(pThis->hWakeupPipeR, &abBuffer, 1, &cbRead);
                 continue;
             }
-            rc = RTFileRead(pThis->DeviceFile, abBuffer, sizeof(abBuffer), &cbRead);
+            rc = RTFileRead(pThis->hDeviceFile, abBuffer, sizeof(abBuffer), &cbRead);
             if (RT_FAILURE(rc))
             {
@@ -844,5 +847,7 @@
     PDRVHOSTSERIAL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL);
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
-    return RTFileWrite(pThis->WakeupPipeW, "", 1, NULL);
+    size_t cbIgnored;
+    return RTPipeWrite(pThis->hWakeupPipeW, "", 1, &cbIgnored);
+
 #elif defined(RT_OS_WINDOWS)
     if (!SetEvent(pThis->hHaltEventSem))
@@ -883,5 +888,5 @@
          * Get the status line state.
          */
-        rc = ioctl(pThis->DeviceFile, TIOCMGET, &statusLines);
+        rc = ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMGET, &statusLines);
         if (rc < 0)
         {
@@ -916,5 +921,5 @@
          * is to send a signal after each tcsetattr.
          */
-        ioctl(pThis->DeviceFile, TIOCMIWAIT, uStatusLinesToCheck);
+        ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMIWAIT, uStatusLinesToCheck);
 # else
         /* Poll for status line change. */
@@ -989,8 +994,8 @@
 
     if (modemStateSet)
-        ioctl(pThis->DeviceFile, TIOCMBIS, &modemStateSet);
+        ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMBIS, &modemStateSet);
 
     if (modemStateClear)
-        ioctl(pThis->DeviceFile, TIOCMBIC, &modemStateClear);
+        ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMBIC, &modemStateClear);
 
 #elif defined(RT_OS_WINDOWS)
@@ -1024,7 +1029,7 @@
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
     if (fBreak)
-        ioctl(pThis->DeviceFile, TIOCSBRK);
+        ioctl(RTFileToNative(pThis->hDeviceFile), TIOCSBRK);
     else
-        ioctl(pThis->DeviceFile, TIOCCBRK);
+        ioctl(RTFileToNative(pThis->hDeviceFile), TIOCCBRK);
 
 #elif defined(RT_OS_WINDOWS)
@@ -1058,38 +1063,27 @@
     pThis->SendSem = NIL_RTSEMEVENT;
 
+    int rc;
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
 
-    if (pThis->WakeupPipeW != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->WakeupPipeW);
-        AssertRC(rc);
-        pThis->WakeupPipeW = NIL_RTFILE;
-    }
-    if (pThis->WakeupPipeR != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->WakeupPipeR);
-        AssertRC(rc);
-        pThis->WakeupPipeR = NIL_RTFILE;
-    }
+    rc = RTPipeClose(pThis->hWakeupPipeW); AssertRC(rc);
+    pThis->hWakeupPipeW = NIL_RTPIPE;
+    rc = RTPipeClose(pThis->hWakeupPipeR); AssertRC(rc);
+    pThis->hWakeupPipeR = NIL_RTPIPE;
+
 # if defined(RT_OS_DARWIN)
-    if (pThis->DeviceFileR != NIL_RTFILE)
-    {
-        if (pThis->DeviceFileR != pThis->DeviceFile)
+    if (pThis->hDeviceFileR != NIL_RTFILE)
+    {
+        if (pThis->hDeviceFileR != pThis->hDeviceFile)
         {
-            int rc = RTFileClose(pThis->DeviceFileR);
+            rc = RTFileClose(pThis->hDeviceFileR);
             AssertRC(rc);
         }
-        pThis->DeviceFileR = NIL_RTFILE;
-    }
-# endif
-    if (pThis->DeviceFile != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->DeviceFile);
-        AssertRC(rc);
-        pThis->DeviceFile = NIL_RTFILE;
-    }
+        pThis->hDeviceFileR = NIL_RTFILE;
+    }
+# endif
+    rc = RTFileClose(pThis->hDeviceFile); AssertRC(rc);
+    pThis->hDeviceFile = NIL_RTFILE;
 
 #elif defined(RT_OS_WINDOWS)
-
     CloseHandle(pThis->hEventRecv);
     CloseHandle(pThis->hEventSend);
@@ -1121,10 +1115,14 @@
      */
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
-    pThis->DeviceFile  = NIL_RTFILE;
+    pThis->hDeviceFile  = NIL_RTFILE;
 # ifdef RT_OS_DARWIN
-    pThis->DeviceFileR = NIL_RTFILE;
-# endif
-    pThis->WakeupPipeR = NIL_RTFILE;
-    pThis->WakeupPipeW = NIL_RTFILE;
+    pThis->hDeviceFileR = NIL_RTFILE;
+# endif
+    pThis->hWakeupPipeR = NIL_RTPIPE;
+    pThis->hWakeupPipeW = NIL_RTPIPE;
+#elif defined(RT_OS_WINDOWS)
+    pThis->hEventRecv  = INVALID_HANDLE_VALUE;
+    pThis->hEventSend  = INVALID_HANDLE_VALUE;
+    pThis->hDeviceFile = INVALID_HANDLE_VALUE;
 #endif
     /* IBase. */
@@ -1191,13 +1189,13 @@
     fOpen |= RTFILE_O_NON_BLOCK;
 # endif
-    rc = RTFileOpen(&pThis->DeviceFile, pThis->pszDevicePath, fOpen);
+    rc = RTFileOpen(&pThis->hDeviceFile, pThis->pszDevicePath, fOpen);
 # ifdef RT_OS_LINUX
     /* RTFILE_O_NON_BLOCK not supported? */
     if (rc == VERR_INVALID_PARAMETER)
-        rc = RTFileOpen(&pThis->DeviceFile, pThis->pszDevicePath, fOpen & ~RTFILE_O_NON_BLOCK);
+        rc = RTFileOpen(&pThis->hDeviceFile, pThis->pszDevicePath, fOpen & ~RTFILE_O_NON_BLOCK);
 # endif
 # ifdef RT_OS_DARWIN
     if (RT_SUCCESS(rc))
-        rc = RTFileOpen(&pThis->DeviceFileR, pThis->pszDevicePath, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+        rc = RTFileOpen(&pThis->hDeviceFileR, pThis->pszDevicePath, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
 # endif
 
@@ -1232,17 +1230,10 @@
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
 
-    fcntl(pThis->DeviceFile, F_SETFL, O_NONBLOCK);
+    fcntl(RTFileToNative(pThis->hDeviceFile), F_SETFL, O_NONBLOCK);
 # ifdef RT_OS_DARWIN
-    fcntl(pThis->DeviceFileR, F_SETFL, O_NONBLOCK);
-# endif
-    int aFDs[2];
-    if (pipe(aFDs) != 0)
-    {
-        rc = RTErrConvertFromErrno(errno);
-        AssertRC(rc);
-        return rc;
-    }
-    pThis->WakeupPipeR = aFDs[0];
-    pThis->WakeupPipeW = aFDs[1];
+    fcntl(RTFileToNative(pThis->hDeviceFileR), F_SETFL, O_NONBLOCK);
+# endif
+    rc = RTPipeCreate(&pThis->hWakeupPipeR, &pThis->hWakeupPipeW, 0 /*fFlags*/);
+    AssertRCReturn(rc, rc);
 
 #elif defined(RT_OS_WINDOWS)
Index: /trunk/src/VBox/Devices/Serial/DrvRawFile.cpp
===================================================================
--- /trunk/src/VBox/Devices/Serial/DrvRawFile.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Serial/DrvRawFile.cpp	(revision 37596)
@@ -60,5 +60,5 @@
     char               *pszLocation;
     /** Flag whether VirtualBox represents the server or client side. */
-    RTFILE              OutputFile;
+    RTFILE              hOutputFile;
 } DRVRAWFILE, *PDRVRAWFILE;
 
@@ -75,12 +75,12 @@
 
     Assert(pvBuf);
-    if (pThis->OutputFile != NIL_RTFILE)
+    if (pThis->hOutputFile != NIL_RTFILE)
     {
         size_t cbWritten;
-        rc = RTFileWrite(pThis->OutputFile, pvBuf, *pcbWrite, &cbWritten);
+        rc = RTFileWrite(pThis->hOutputFile, pvBuf, *pcbWrite, &cbWritten);
 #if 0
         /* don't flush here, takes too long and we will loose characters */
         if (RT_SUCCESS(rc))
-            RTFileFlush(pThis->OutputFile);
+            RTFileFlush(pThis->hOutputFile);
 #endif
         *pcbWrite = cbWritten;
@@ -121,9 +121,6 @@
     LogFlow(("%s: %s\n", __FUNCTION__, pThis->pszLocation));
 
-    if (pThis->OutputFile != NIL_RTFILE)
-    {
-        RTFileClose(pThis->OutputFile);
-        pThis->OutputFile = NIL_RTFILE;
-    }
+    RTFileClose(pThis->hOutputFile);
+    pThis->hOutputFile = NIL_RTFILE;
 }
 
@@ -146,9 +143,6 @@
         MMR3HeapFree(pThis->pszLocation);
 
-    if (pThis->OutputFile != NIL_RTFILE)
-    {
-        RTFileClose(pThis->OutputFile);
-        pThis->OutputFile = NIL_RTFILE;
-    }
+    RTFileClose(pThis->hOutputFile);
+    pThis->hOutputFile = NIL_RTFILE;
 }
 
@@ -169,5 +163,5 @@
     pThis->pDrvIns                      = pDrvIns;
     pThis->pszLocation                  = NULL;
-    pThis->OutputFile                   = NIL_RTFILE;
+    pThis->hOutputFile                  = NIL_RTFILE;
     /* IBase */
     pDrvIns->IBase.pfnQueryInterface    = drvRawFileQueryInterface;
@@ -188,5 +182,5 @@
      * Open the raw file.
      */
-    rc = RTFileOpen(&pThis->OutputFile, pThis->pszLocation, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE);
+    rc = RTFileOpen(&pThis->hOutputFile, pThis->pszLocation, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE);
     if (RT_FAILURE(rc))
     {
Index: /trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvHostBase.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Storage/DrvHostBase.cpp	(revision 37596)
@@ -185,22 +185,15 @@
          * Seek and read.
          */
-        rc = RTFileSeek(pThis->FileDevice, off, RTFILE_SEEK_BEGIN, NULL);
+        rc = RTFileReadAt(pThis->hFileDevice, off, pvBuf, cbRead, NULL);
         if (RT_SUCCESS(rc))
         {
-            rc = RTFileRead(pThis->FileDevice, pvBuf, cbRead, NULL);
-            if (RT_SUCCESS(rc))
-            {
-                Log2(("%s-%d: drvHostBaseRead: off=%#llx cbRead=%#x\n"
-                      "%16.*Rhxd\n",
-                      pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, off, cbRead, cbRead, pvBuf));
-            }
-            else
-                Log(("%s-%d: drvHostBaseRead: RTFileRead(%d, %p, %#x) -> %Rrc (off=%#llx '%s')\n",
-                     pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, pThis->FileDevice,
-                     pvBuf, cbRead, rc, off, pThis->pszDevice));
+            Log2(("%s-%d: drvHostBaseRead: off=%#llx cbRead=%#x\n"
+                  "%16.*Rhxd\n",
+                  pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, off, cbRead, cbRead, pvBuf));
         }
         else
-            Log(("%s-%d: drvHostBaseRead: RTFileSeek(%d,%#llx,) -> %Rrc\n", pThis->pDrvIns->pReg->szName,
-                 pThis->pDrvIns->iInstance, pThis->FileDevice, off, rc));
+            Log(("%s-%d: drvHostBaseRead: RTFileReadAt(%RTfile, %#llx, %p, %#x) -> %Rrc ('%s')\n",
+                 pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, pThis->hFileDevice,
+                 off, pvBuf, cbRead, rc, pThis->pszDevice));
 #endif
     }
@@ -241,16 +234,9 @@
              * Seek and write.
              */
-            rc = RTFileSeek(pThis->FileDevice, off, RTFILE_SEEK_BEGIN, NULL);
-            if (RT_SUCCESS(rc))
-            {
-                rc = RTFileWrite(pThis->FileDevice, pvBuf, cbWrite, NULL);
-                if (RT_FAILURE(rc))
-                    Log(("%s-%d: drvHostBaseWrite: RTFileWrite(%d, %p, %#x) -> %Rrc (off=%#llx '%s')\n",
-                         pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, pThis->FileDevice,
-                         pvBuf, cbWrite, rc, off, pThis->pszDevice));
-            }
-            else
-                Log(("%s-%d: drvHostBaseWrite: RTFileSeek(%d,%#llx,) -> %Rrc\n",
-                     pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, pThis->FileDevice, off, rc));
+            rc = RTFileWriteAt(pThis->hFileDevice, off, pvBuf, cbWrite, NULL);
+            if (RT_FAILURE(rc))
+                Log(("%s-%d: drvHostBaseWrite: RTFileWriteAt(%RTfile, %#llx, %p, %#x) -> %Rrc ('%s')\n",
+                     pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, pThis->hFileDevice,
+                     off, pvBuf, cbWrite, rc, pThis->pszDevice));
 #endif
         }
@@ -282,5 +268,5 @@
         /** @todo scsi device buffer flush... */
 #else
-        rc = RTFileFlush(pThis->FileDevice);
+        rc = RTFileFlush(pThis->hFileDevice);
 #endif
     }
@@ -762,5 +748,5 @@
 static int drvHostBaseOpen(PDRVHOSTBASE pThis, PRTFILE pFileDevice, bool fReadOnly)
 {
-#ifdef RT_OS_DARWIN
+# ifdef RT_OS_DARWIN
     /* Darwin is kind of special... */
     Assert(!pFileDevice); NOREF(pFileDevice);
@@ -940,17 +926,7 @@
     return rc;
 
-#elif defined(RT_OS_LINUX)
-    /** @todo we've got RTFILE_O_NON_BLOCK now. Change the code to use RTFileOpen. */
-    int FileDevice = open(pThis->pszDeviceOpen, (pThis->fReadOnlyConfig ? O_RDONLY : O_RDWR) | O_NONBLOCK);
-    if (FileDevice < 0)
-        return RTErrConvertFromErrno(errno);
-    *pFileDevice = FileDevice;
-    return VINF_SUCCESS;
-
 #elif defined(RT_OS_FREEBSD)
-    int rc = VINF_SUCCESS;
-    RTFILE FileDevice;
-
-    rc = RTFileOpen(&FileDevice, pThis->pszDeviceOpen, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+    RTFILE hFileDevice;
+    int rc = RTFileOpen(&hFileDevice, pThis->pszDeviceOpen, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     if (RT_FAILURE(rc))
         return rc;
@@ -964,5 +940,5 @@
 
     DeviceCCB.ccb_h.func_code = XPT_GDEVLIST;
-    int rcBSD = ioctl(FileDevice, CAMGETPASSTHRU, &DeviceCCB);
+    int rcBSD = ioctl(RTFileToNative(hFileDevice), CAMGETPASSTHRU, &DeviceCCB);
     if (!rcBSD)
     {
@@ -972,10 +948,7 @@
         if (rc >= 0)
         {
-            RTFILE PassthroughDevice;
-
-            rc = RTFileOpen(&PassthroughDevice, pszPassthroughDevice, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
-
+            RTFILE hPassthroughDevice;
+            rc = RTFileOpen(&hPassthroughDevice, pszPassthroughDevice, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
             RTStrFree(pszPassthroughDevice);
-
             if (RT_SUCCESS(rc))
             {
@@ -989,5 +962,5 @@
                 DeviceCCB.ccb_h.func_code = XPT_GDEVLIST;
 
-                rcBSD = ioctl(PassthroughDevice, CAMGETPASSTHRU, &DeviceCCB);
+                rcBSD = ioctl(RTFileToNative(hPassthroughDevice), CAMGETPASSTHRU, &DeviceCCB);
                 if (!rcBSD)
                 {
@@ -997,5 +970,5 @@
                         pThis->ScsiTargetID = DeviceCCB.ccb_h.target_id;
                         pThis->ScsiLunID    = DeviceCCB.ccb_h.target_lun;
-                        *pFileDevice = PassthroughDevice;
+                        *pFileDevice = hPassthroughDevice;
                     }
                     else
@@ -1009,5 +982,5 @@
 
                 if (RT_FAILURE(rc))
-                    RTFileClose(PassthroughDevice);
+                    RTFileClose(hPassthroughDevice);
             }
         }
@@ -1018,9 +991,13 @@
         rc = RTErrConvertFromErrno(errno);
 
-    RTFileClose(FileDevice);
+    RTFileClose(hFileDevice);
     return rc;
+
 #else
-    return RTFileOpen(pFileDevice, pThis->pszDeviceOpen,
-                      (fReadOnly ? RTFILE_O_READ : RTFILE_O_READWRITE) | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+    uint32_t fFlags = (fReadOnly ? RTFILE_O_READ : RTFILE_O_READWRITE) | RTFILE_O_OPEN | RTFILE_O_DENY_NONE;
+# ifdef RT_OS_LINUX
+    fFlags |= RTFILE_O_NON_BLOCK;
+# endif
+    return RTFileOpen(pFileDevice, pThis->pszDeviceOpen, fFlags);
 #endif
 }
@@ -1072,20 +1049,20 @@
     LogFlow(("%s-%d: drvHostBaseReopen: '%s'\n", pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, pThis->pszDeviceOpen));
 
-    RTFILE FileDevice;
+    RTFILE hFileDevice;
 #ifdef RT_OS_SOLARIS
-    if (pThis->FileRawDevice != NIL_RTFILE)
-    {
-        RTFileClose(pThis->FileRawDevice);
-        pThis->FileRawDevice = NIL_RTFILE;
-    }
-    if (pThis->FileDevice != NIL_RTFILE)
-    {
-        RTFileClose(pThis->FileDevice);
-        pThis->FileDevice = NIL_RTFILE;
-    }
-    RTFILE FileRawDevice;
-    int rc = drvHostBaseOpen(pThis, &FileDevice, &FileRawDevice, pThis->fReadOnlyConfig);
+    if (pThis->hFileRawDevice != NIL_RTFILE)
+    {
+        RTFileClose(pThis->hFileRawDevice);
+        pThis->hFileRawDevice = NIL_RTFILE;
+    }
+    if (pThis->hFileDevice != NIL_RTFILE)
+    {
+        RTFileClose(pThis->hFileDevice);
+        pThis->hFileDevice = NIL_RTFILE;
+    }
+    RTFILE hFileRawDevice;
+    int rc = drvHostBaseOpen(pThis, &hFileDevice, &hFileRawDevice, pThis->fReadOnlyConfig);
 #else
-    int rc = drvHostBaseOpen(pThis, &FileDevice, pThis->fReadOnlyConfig);
+    int rc = drvHostBaseOpen(pThis, &hFileDevice, pThis->fReadOnlyConfig);
 #endif
     if (RT_FAILURE(rc))
@@ -1095,7 +1072,7 @@
             LogFlow(("%s-%d: drvHostBaseReopen: '%s' - retry readonly (%Rrc)\n", pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, pThis->pszDeviceOpen, rc));
 #ifdef RT_OS_SOLARIS
-            rc = drvHostBaseOpen(pThis, &FileDevice, &FileRawDevice, false);
+            rc = drvHostBaseOpen(pThis, &hFileDevice, &hFileRawDevice, false);
 #else
-            rc = drvHostBaseOpen(pThis, &FileDevice, false);
+            rc = drvHostBaseOpen(pThis, &hFileDevice, false);
 #endif
         }
@@ -1112,12 +1089,12 @@
 
 #ifdef RT_OS_SOLARIS
-    if (pThis->FileRawDevice != NIL_RTFILE)
-        RTFileClose(pThis->FileRawDevice);
-    pThis->FileRawDevice = FileRawDevice;
-#endif
-
-    if (pThis->FileDevice != NIL_RTFILE)
-        RTFileClose(pThis->FileDevice);
-    pThis->FileDevice = FileDevice;
+    if (pThis->hFileRawDevice != NIL_RTFILE)
+        RTFileClose(pThis->hFileRawDevice);
+    pThis->hFileRawDevice = hFileRawDevice;
+#endif
+
+    if (pThis->hFileDevice != NIL_RTFILE)
+        RTFileClose(pThis->hFileDevice);
+    pThis->hFileDevice = hFileDevice;
 #endif /* !RT_OS_DARWIN */
     return VINF_SUCCESS;
@@ -1170,10 +1147,10 @@
      */
     struct dk_minfo MediaInfo;
-    if (ioctl(pThis->FileRawDevice, DKIOCGMEDIAINFO, &MediaInfo) == 0)
+    if (ioctl(RTFileToNative(pThis->hFileRawDevice), DKIOCGMEDIAINFO, &MediaInfo) == 0)
     {
         *pcb = MediaInfo.dki_capacity * (uint64_t)MediaInfo.dki_lbsize;
         return VINF_SUCCESS;
     }
-    return RTFileSeek(pThis->FileDevice, 0, RTFILE_SEEK_END, pcb);
+    return RTFileSeek(pThis->hFileDevice, 0, RTFILE_SEEK_END, pcb);
 
 #elif defined(RT_OS_WINDOWS)
@@ -1181,5 +1158,5 @@
     IO_STATUS_BLOCK             IoStatusBlock = {0};
     FILE_FS_SIZE_INFORMATION    FsSize= {0};
-    NTSTATUS rcNt = NtQueryVolumeInformationFile((HANDLE)pThis->FileDevice,  &IoStatusBlock,
+    NTSTATUS rcNt = NtQueryVolumeInformationFile(RTFileToNative(pThis->hFileDevice),  &IoStatusBlock,
                                                  &FsSize, sizeof(FsSize), FileFsSizeInformation);
     int cRetries = 5;
@@ -1187,5 +1164,5 @@
     {
         RTThreadSleep(10);
-        rcNt = NtQueryVolumeInformationFile((HANDLE)pThis->FileDevice,  &IoStatusBlock,
+        rcNt = NtQueryVolumeInformationFile(RTFileToNative(pThis->hFileDevice),  &IoStatusBlock,
                                             &FsSize, sizeof(FsSize), FileFsSizeInformation);
     }
@@ -1207,5 +1184,5 @@
     return rc;
 #else
-    return RTFileSeek(pThis->FileDevice, 0, RTFILE_SEEK_END, pcb);
+    return RTFileSeek(pThis->hFileDevice, 0, RTFILE_SEEK_END, pcb);
 #endif
 }
@@ -1340,5 +1317,5 @@
         pDeviceCCB->ccb_h.func_code = XPT_GDEV_TYPE;
 
-        rcBSD = ioctl(pThis->FileDevice, CAMIOCOMMAND, pDeviceCCB);
+        rcBSD = ioctl(RTFileToNative(pThis->hFileDevice), CAMIOCOMMAND, pDeviceCCB);
         if (!rcBSD)
         {
@@ -1375,5 +1352,5 @@
 
         /* Send command */
-        rcBSD = ioctl(pThis->FileDevice, CAMIOCOMMAND, pDeviceCCB);
+        rcBSD = ioctl(RTFileToNative(pThis->hFileDevice), CAMIOCOMMAND, pDeviceCCB);
         if (!rcBSD)
         {
@@ -1715,5 +1692,5 @@
        * (We're currently not unlocking the device after use. See todo in DevATA.cpp.) */
     if (    pThis->fLocked
-        &&  pThis->FileDevice != NIL_RTFILE
+        &&  pThis->hFileDevice != NIL_RTFILE
 #endif
         &&  pThis->pfnDoLock)
@@ -1785,18 +1762,18 @@
     }
 #else
-    if (pThis->FileDevice != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->FileDevice);
+    if (pThis->hFileDevice != NIL_RTFILE)
+    {
+        int rc = RTFileClose(pThis->hFileDevice);
         AssertRC(rc);
-        pThis->FileDevice = NIL_RTFILE;
+        pThis->hFileDevice = NIL_RTFILE;
     }
 #endif
 
 #ifdef RT_OS_SOLARIS
-    if (pThis->FileRawDevice != NIL_RTFILE)
-    {
-        int rc = RTFileClose(pThis->FileRawDevice);
+    if (pThis->hFileRawDevice != NIL_RTFILE)
+    {
+        int rc = RTFileClose(pThis->hFileRawDevice);
         AssertRC(rc);
-        pThis->FileRawDevice = NIL_RTFILE;
+        pThis->hFileRawDevice = NIL_RTFILE;
     }
 
@@ -1863,8 +1840,8 @@
     pThis->pDASession                       = NULL;
 #else
-    pThis->FileDevice                       = NIL_RTFILE;
+    pThis->hFileDevice                      = NIL_RTFILE;
 #endif
 #ifdef RT_OS_SOLARIS
-    pThis->FileRawDevice                    = NIL_RTFILE;
+    pThis->hFileRawDevice                   = NIL_RTFILE;
 #endif
     pThis->enmType                          = enmType;
@@ -2110,8 +2087,8 @@
             && RT_SUCCESS(RTPathReal(pszDevice, szPathReal, sizeof(szPathReal))))
             pszDevice = szPathReal;
-        pThis->FileDevice = NIL_RTFILE;
+        pThis->hFileDevice = NIL_RTFILE;
 #endif
 #ifdef RT_OS_SOLARIS
-        pThis->FileRawDevice = NIL_RTFILE;
+        pThis->hFileRawDevice = NIL_RTFILE;
 #endif
 
Index: /trunk/src/VBox/Devices/Storage/DrvHostBase.h
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvHostBase.h	(revision 37595)
+++ /trunk/src/VBox/Devices/Storage/DrvHostBase.h	(revision 37596)
@@ -83,9 +83,9 @@
 #if !defined(RT_OS_DARWIN)
     /** The filehandle of the device. */
-    RTFILE                  FileDevice;
+    RTFILE                  hFileDevice;
 #endif
 #ifdef RT_OS_SOLARIS
     /** The raw filehandle of the device. */
-    RTFILE                  FileRawDevice;
+    RTFILE                  hFileRawDevice;
 #endif
 
Index: /trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp	(revision 37596)
@@ -156,5 +156,5 @@
 
 #elif defined(RT_OS_LINUX)
-            rc = ioctl(pThis->FileDevice, CDROMEJECT, 0);
+            rc = ioctl(RTFileToNative(pThis->hFileDevice), CDROMEJECT, 0);
             if (rc < 0)
             {
@@ -168,5 +168,5 @@
 
 #elif defined(RT_OS_SOLARIS)
-            rc = ioctl(pThis->FileRawDevice, DKIOCEJECT, 0);
+            rc = ioctl(RTFileToNative(pThis->hFileRawDevice), DKIOCEJECT, 0);
             if (rc < 0)
             {
@@ -182,12 +182,12 @@
 
 #elif defined(RT_OS_WINDOWS)
-            RTFILE FileDevice = pThis->FileDevice;
-            if (FileDevice == NIL_RTFILE) /* obsolete crap */
-                rc = RTFileOpen(&FileDevice, pThis->pszDeviceOpen, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+            RTFILE hFileDevice = pThis->hFileDevice;
+            if (hFileDevice == NIL_RTFILE) /* obsolete crap */
+                rc = RTFileOpen(&hFileDevice, pThis->pszDeviceOpen, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
             if (RT_SUCCESS(rc))
             {
                 /* do ioctl */
                 DWORD cbReturned;
-                if (DeviceIoControl((HANDLE)FileDevice, IOCTL_STORAGE_EJECT_MEDIA,
+                if (DeviceIoControl(RTFileToNative(hFileDevice), IOCTL_STORAGE_EJECT_MEDIA,
                                     NULL, 0,
                                     NULL, 0, &cbReturned,
@@ -198,6 +198,6 @@
 
                 /* clean up handle */
-                if (FileDevice != pThis->FileDevice)
-                    RTFileClose(FileDevice);
+                if (hFileDevice != pThis->hFileDevice)
+                    RTFileClose(hFileDevice);
             }
             else
@@ -246,5 +246,5 @@
 
 #elif defined(RT_OS_LINUX)
-    int rc = ioctl(pThis->FileDevice, CDROM_LOCKDOOR, (int)fLock);
+    int rc = ioctl(RTFileToNative(pThis->hFileDevice), CDROM_LOCKDOOR, (int)fLock);
     if (rc < 0)
     {
@@ -258,5 +258,5 @@
 
 #elif defined(RT_OS_SOLARIS)
-    int rc = ioctl(pThis->FileRawDevice, fLock ? DKIOCLOCK : DKIOCUNLOCK, 0);
+    int rc = ioctl(RTFileToNative(pThis->hFileRawDevice), fLock ? DKIOCLOCK : DKIOCUNLOCK, 0);
     if (rc < 0)
     {
@@ -274,5 +274,5 @@
     DWORD cbReturned;
     int rc;
-    if (DeviceIoControl((HANDLE)pThis->FileDevice, IOCTL_STORAGE_MEDIA_REMOVAL,
+    if (DeviceIoControl(RTFileToNative(pThis->hFileDevice), IOCTL_STORAGE_MEDIA_REMOVAL,
                         &PreventMediaRemoval, sizeof(PreventMediaRemoval),
                         NULL, 0, &cbReturned,
@@ -309,6 +309,6 @@
      */
     /* Clear the media-changed-since-last-call-thingy just to be on the safe side. */
-    ioctl(pThis->FileDevice, CDROM_MEDIA_CHANGED, CDSL_CURRENT);
-    return RTFileSeek(pThis->FileDevice, 0, RTFILE_SEEK_END, pcb);
+    ioctl(RTFileToNative(pThis->hFileDevice), CDROM_MEDIA_CHANGED, CDSL_CURRENT);
+    return RTFileSeek(pThis->hFileDevice, 0, RTFILE_SEEK_END, pcb);
 
 }
@@ -357,5 +357,5 @@
 
 #elif defined(RT_OS_LINUX)
-    bool fMediaPresent = ioctl(pThis->FileDevice, CDROM_DRIVE_STATUS, CDSL_CURRENT) == CDS_DISC_OK;
+    bool fMediaPresent = ioctl(RTFileToNative(pThis->hFileDevice), CDROM_DRIVE_STATUS, CDSL_CURRENT) == CDS_DISC_OK;
 
 #elif defined(RT_OS_SOLARIS)
@@ -366,5 +366,5 @@
     static dkio_state s_DeviceState = DKIO_NONE;
     dkio_state PreviousState = s_DeviceState;
-    int rc2 = ioctl(pThis->FileRawDevice, DKIOCSTATE, &s_DeviceState);
+    int rc2 = ioctl(RTFileToNative(pThis->hFileRawDevice), DKIOCSTATE, &s_DeviceState);
     if (rc2 == 0)
     {
@@ -398,5 +398,5 @@
         /* taken care of above. */
 #elif defined(RT_OS_LINUX)
-        bool fMediaChanged = ioctl(pThis->FileDevice, CDROM_MEDIA_CHANGED, CDSL_CURRENT) == 1;
+        bool fMediaChanged = ioctl(RTFileToNative(pThis->hFileDevice), CDROM_MEDIA_CHANGED, CDSL_CURRENT) == 1;
 #else
 # error "Unsupported platform."
@@ -484,5 +484,5 @@
     cgc.quiet = false;
     cgc.timeout = cTimeoutMillies;
-    rc = ioctl(pThis->FileDevice, CDROM_SEND_PACKET, &cgc);
+    rc = ioctl(RTFileToNative(pThis->hFileDevice), CDROM_SEND_PACKET, &cgc);
     if (rc < 0)
     {
@@ -560,5 +560,5 @@
     solarisEnterRootMode(&effUserID); /** @todo check return code when this really works. */
 #endif
-    rc = ioctl(pThis->FileRawDevice, USCSICMD, &usc);
+    rc = ioctl(RTFileToNative(pThis->hFileRawDevice), USCSICMD, &usc);
 #ifdef VBOX_WITH_SUID_WRAPPER
     solarisExitRootMode(&effUserID);
@@ -620,5 +620,5 @@
     Req.spt.SenseInfoLength = (UCHAR)RT_MIN(sizeof(Req.aSense), cbSense);
     Req.spt.SenseInfoOffset = RT_OFFSETOF(struct _REQ, aSense);
-    if (DeviceIoControl((HANDLE)pThis->FileDevice, IOCTL_SCSI_PASS_THROUGH_DIRECT,
+    if (DeviceIoControl(RTFileToNative(pThis->hFileDevice), IOCTL_SCSI_PASS_THROUGH_DIRECT,
                         &Req, sizeof(Req), &Req, sizeof(Req), &cbReturned, NULL))
     {
Index: /trunk/src/VBox/Devices/Storage/DrvHostFloppy.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvHostFloppy.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Storage/DrvHostFloppy.cpp	(revision 37596)
@@ -73,5 +73,5 @@
 static DECLCALLBACK(int) drvHostFloppyGetMediaSize(PDRVHOSTBASE pThis, uint64_t *pcb)
 {
-    int rc = ioctl(pThis->FileDevice, FDFLUSH);
+    int rc = ioctl(RTFileToNative(pThis->hFileDevice), FDFLUSH);
     if (rc)
     {
@@ -82,5 +82,5 @@
 
     floppy_drive_struct DrvStat;
-    rc = ioctl(pThis->FileDevice, FDGETDRVSTAT, &DrvStat);
+    rc = ioctl(RTFileToNative(pThis->hFileDevice), FDGETDRVSTAT, &DrvStat);
     if (rc)
     {
@@ -91,5 +91,5 @@
     pThis->fReadOnly = !(DrvStat.flags & FD_DISK_WRITABLE);
 
-    return RTFileSeek(pThis->FileDevice, 0, RTFILE_SEEK_END, pcb);
+    return RTFileSeek(pThis->hFileDevice, 0, RTFILE_SEEK_END, pcb);
 }
 #endif /* RT_OS_LINUX */
@@ -108,5 +108,5 @@
     PDRVHOSTFLOPPY          pThisFloppy = (PDRVHOSTFLOPPY)pThis;
     floppy_drive_struct     DrvStat;
-    int rc = ioctl(pThis->FileDevice, FDPOLLDRVSTAT, &DrvStat);
+    int rc = ioctl(RTFileToNative(pThis->hFileDevice), FDPOLLDRVSTAT, &DrvStat);
     if (rc)
         return RTErrConvertFromErrno(errno);
Index: /trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp	(revision 37596)
@@ -60,5 +60,5 @@
     char           *pszFilename;
     /** File handle of the ISO file. */
-    RTFILE          File;
+    RTFILE          hFile;
 } DRVMEDIAISO, *PDRVMEDIAISO;
 
@@ -74,5 +74,5 @@
 
     uint64_t cbFile;
-    int rc = RTFileGetSize(pThis->File, &cbFile);
+    int rc = RTFileGetSize(pThis->hFile, &cbFile);
     if (RT_SUCCESS(rc))
     {
@@ -124,5 +124,5 @@
     LogFlow(("drvMediaISORead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n", off, pvBuf, cbRead, pThis->pszFilename));
 
-    Assert(pThis->File);
+    Assert(pThis->hFile != NIL_RTFILE);
     Assert(pvBuf);
 
@@ -130,21 +130,13 @@
      * Seek to the position and read.
      */
-    int rc = RTFileSeek(pThis->File, off, RTFILE_SEEK_BEGIN, NULL);
+    int rc = RTFileReadAt(pThis->hFile, off, pvBuf, cbRead, NULL);
     if (RT_SUCCESS(rc))
-    {
-        rc = RTFileRead(pThis->File, pvBuf, cbRead, NULL);
-        if (RT_SUCCESS(rc))
-        {
-            Log2(("drvMediaISORead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n"
-                  "%16.*Rhxd\n",
-                  off, pvBuf, cbRead, pThis->pszFilename,
-                  cbRead, pvBuf));
-        }
-        else
-            AssertMsgFailed(("RTFileRead(%d, %p, %#x) -> %Rrc (off=%#llx '%s')\n",
-                             pThis->File, pvBuf, cbRead, rc, off, pThis->pszFilename));
-    }
+        Log2(("drvMediaISORead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n"
+              "%16.*Rhxd\n",
+              off, pvBuf, cbRead, pThis->pszFilename,
+              cbRead, pvBuf));
     else
-        AssertMsgFailed(("RTFileSeek(%d,%#llx,) -> %Rrc\n", pThis->File, off, rc));
+        AssertMsgFailed(("RTFileReadAt(%RTfile, %#llx, %p, %#x) -> %Rrc ('%s')\n",
+                         pThis->hFile, off, pvBuf, cbRead, rc, pThis->pszFilename));
     LogFlow(("drvMediaISORead: returns %Rrc\n", rc));
     return rc;
@@ -212,11 +204,12 @@
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
-    if (pThis->File != NIL_RTFILE)
+    RTFileClose(pThis->hFile);
+    pThis->hFile = NIL_RTFILE;
+
+    if (pThis->pszFilename)
     {
-        RTFileClose(pThis->File);
-        pThis->File = NIL_RTFILE;
+        MMR3HeapFree(pThis->pszFilename);
+        pThis->pszFilename = NULL;
     }
-    if (pThis->pszFilename)
-        MMR3HeapFree(pThis->pszFilename);
 }
 
@@ -236,5 +229,5 @@
      */
     pThis->pDrvIns                      = pDrvIns;
-    pThis->File                         = NIL_RTFILE;
+    pThis->hFile                        = NIL_RTFILE;
     /* IBase */
     pDrvIns->IBase.pfnQueryInterface    = drvMediaISOQueryInterface;
@@ -265,6 +258,5 @@
      * Open the image.
      */
-    rc = RTFileOpen(&pThis->File, pszName,
-                    RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
+    rc = RTFileOpen(&pThis->hFile, pszName, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
     if (RT_SUCCESS(rc))
     {
Index: /trunk/src/VBox/Devices/Storage/DrvRawImage.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvRawImage.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Storage/DrvRawImage.cpp	(revision 37596)
@@ -61,5 +61,5 @@
     char           *pszFilename;
     /** File handle of the raw image file. */
-    RTFILE          File;
+    RTFILE          hFile;
     /** True if the image is operating in readonly mode. */
     bool            fReadOnly;
@@ -77,5 +77,5 @@
 
     uint64_t cbFile;
-    int rc = RTFileGetSize(pThis->File, &cbFile);
+    int rc = RTFileGetSize(pThis->hFile, &cbFile);
     if (RT_SUCCESS(rc))
     {
@@ -127,5 +127,5 @@
     LogFlow(("drvRawImageRead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n", off, pvBuf, cbRead, pThis->pszFilename));
 
-    Assert(pThis->File);
+    Assert(pThis->hFile != NIL_RTFILE);
     Assert(pvBuf);
 
@@ -133,8 +133,8 @@
      * Seek to the position and read.
      */
-    int rc = RTFileSeek(pThis->File, off, RTFILE_SEEK_BEGIN, NULL);
+    int rc = RTFileSeek(pThis->hFile, off, RTFILE_SEEK_BEGIN, NULL);
     if (RT_SUCCESS(rc))
     {
-        rc = RTFileRead(pThis->File, pvBuf, cbRead, NULL);
+        rc = RTFileRead(pThis->hFile, pvBuf, cbRead, NULL);
         if (RT_SUCCESS(rc))
         {
@@ -145,9 +145,9 @@
         }
         else
-            AssertMsgFailed(("RTFileRead(%d, %p, %#x) -> %Rrc (off=%#llx '%s')\n",
-                             pThis->File, pvBuf, cbRead, rc, off, pThis->pszFilename));
+            AssertMsgFailed(("RTFileRead(%RTfile, %p, %#x) -> %Rrc (off=%#llx '%s')\n",
+                             pThis->hFile, pvBuf, cbRead, rc, off, pThis->pszFilename));
     }
     else
-        AssertMsgFailed(("RTFileSeek(%d,%#llx,) -> %Rrc\n", pThis->File, off, rc));
+        AssertMsgFailed(("RTFileSeek(%RTfile,%#llx,) -> %Rrc\n", pThis->hFile, off, rc));
     LogFlow(("drvRawImageRead: returns %Rrc\n", rc));
     return rc;
@@ -161,5 +161,5 @@
     LogFlow(("drvRawImageWrite: off=%#llx pvBuf=%p cbWrite=%#x (%s)\n", off, pvBuf, cbWrite, pThis->pszFilename));
 
-    Assert(pThis->File);
+    Assert(pThis->hFile != NIL_RTFILE);
     Assert(pvBuf);
 
@@ -167,8 +167,8 @@
      * Seek to the position and write.
      */
-    int rc = RTFileSeek(pThis->File, off, RTFILE_SEEK_BEGIN, NULL);
+    int rc = RTFileSeek(pThis->hFile, off, RTFILE_SEEK_BEGIN, NULL);
     if (RT_SUCCESS(rc))
     {
-        rc = RTFileWrite(pThis->File, pvBuf, cbWrite, NULL);
+        rc = RTFileWrite(pThis->hFile, pvBuf, cbWrite, NULL);
         if (RT_SUCCESS(rc))
         {
@@ -179,9 +179,9 @@
         }
         else
-            AssertMsgFailed(("RTFileWrite(%d, %p, %#x) -> %Rrc (off=%#llx '%s')\n",
-                             pThis->File, pvBuf, cbWrite, rc, off, pThis->pszFilename));
+            AssertMsgFailed(("RTFileWrite(%RTfile, %p, %#x) -> %Rrc (off=%#llx '%s')\n",
+                             pThis->hFile, pvBuf, cbWrite, rc, off, pThis->pszFilename));
     }
     else
-        AssertMsgFailed(("RTFileSeek(%d,%#llx,) -> %Rrc\n", pThis->File, off, rc));
+        AssertMsgFailed(("RTFileSeek(%RTfile,%#llx,) -> %Rrc\n", pThis->hFile, off, rc));
     LogFlow(("drvRawImageWrite: returns %Rrc\n", rc));
     return rc;
@@ -195,6 +195,6 @@
     LogFlow(("drvRawImageFlush: (%s)\n", pThis->pszFilename));
 
-    Assert(pThis->File != NIL_RTFILE);
-    int rc = RTFileFlush(pThis->File);
+    Assert(pThis->hFile != NIL_RTFILE);
+    int rc = RTFileFlush(pThis->hFile);
     LogFlow(("drvRawImageFlush: returns %Rrc\n", rc));
     return rc;
@@ -249,11 +249,12 @@
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
-    if (pThis->File != NIL_RTFILE)
-    {
-        RTFileClose(pThis->File);
-        pThis->File = NIL_RTFILE;
-    }
+    RTFileClose(pThis->hFile);
+    pThis->hFile = NIL_RTFILE;
+
     if (pThis->pszFilename)
+    {
         MMR3HeapFree(pThis->pszFilename);
+        pThis->pszFilename = NULL;
+    }
 }
 
@@ -273,5 +274,5 @@
      */
     pThis->pDrvIns                      = pDrvIns;
-    pThis->File                         = NIL_RTFILE;
+    pThis->hFile                        = NIL_RTFILE;
     /* IBase */
     pDrvIns->IBase.pfnQueryInterface    = drvRawImageQueryInterface;
@@ -305,6 +306,5 @@
      * Open the image.
      */
-    rc = RTFileOpen(&pThis->File, pszName,
-                    RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+    rc = RTFileOpen(&pThis->hFile, pszName, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     if (RT_SUCCESS(rc))
     {
@@ -315,6 +315,5 @@
     else
     {
-        rc = RTFileOpen(&pThis->File, pszName,
-                        RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+        rc = RTFileOpen(&pThis->hFile, pszName, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
         if (RT_SUCCESS(rc))
         {
Index: /trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp
===================================================================
--- /trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp	(revision 37596)
@@ -58,5 +58,5 @@
     char                   *pszDevicePath;
     /** Handle to the device. */
-    RTFILE                  DeviceFile;
+    RTFILE                  hDeviceFile;
 
     /** The dedicated I/O thread. */
@@ -302,6 +302,6 @@
         ScsiIoReq.flags  |= SG_FLAG_DIRECT_IO;
 
-        /** Issue command. */
-        rc = ioctl(pThis->DeviceFile, SG_IO, &ScsiIoReq);
+        /* Issue command. */
+        rc = ioctl(RTFileToNative(pThis->hDeviceFile), SG_IO, &ScsiIoReq);
         if (rc < 0)
         {
@@ -420,9 +420,12 @@
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
 
-    if (pThis->DeviceFile != NIL_RTFILE)
-        RTFileClose(pThis->DeviceFile);
+    RTFileClose(pThis->hDeviceFile);
+    pThis->hDeviceFile = NIL_RTFILE;
 
     if (pThis->pszDevicePath)
+    {
         MMR3HeapFree(pThis->pszDevicePath);
+        pThis->pszDevicePath = NULL;
+    }
 
     if (pThis->pQueueRequests)
@@ -457,6 +460,6 @@
     pDrvIns->IBase.pfnQueryInterface                    = drvscsihostQueryInterface;
     pThis->ISCSIConnector.pfnSCSIRequestSend            = drvscsihostRequestSend;
-    pThis->pDrvIns    = pDrvIns;
-    pThis->DeviceFile = NIL_RTFILE;
+    pThis->pDrvIns     = pDrvIns;
+    pThis->hDeviceFile = NIL_RTFILE;
 
     /* Query the SCSI port interface above. */
@@ -474,5 +477,5 @@
                                 N_("Configuration error: Failed to get the \"DevicePath\" value"));
 
-    rc = RTFileOpen(&pThis->DeviceFile, pThis->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+    rc = RTFileOpen(&pThis->hDeviceFile, pThis->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     if (RT_FAILURE(rc))
         return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
Index: /trunk/src/VBox/Devices/USB/USBProxyDevice.h
===================================================================
--- /trunk/src/VBox/Devices/USB/USBProxyDevice.h	(revision 37595)
+++ /trunk/src/VBox/Devices/USB/USBProxyDevice.h	(revision 37596)
@@ -207,5 +207,5 @@
          * The Linux and Darwin backends are making use of this. */
         void *pv;
-        RTFILE File;
+        RTFILE hFile;
         int fd;
         struct vrdp_priv
Index: /trunk/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp
===================================================================
--- /trunk/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp	(revision 37596)
@@ -94,5 +94,5 @@
 {
     /** The open file. */
-    RTFILE                 File;
+    RTFILE                 hFile;
     /** Software endpoint structures */
     USBENDPOINTFBSD        aSwEndpoint[USBFBSD_MAXENDPOINTS];
@@ -133,5 +133,5 @@
     do
     {
-        rc = ioctl(pDevFBSD->File, iCmd, pvArg);
+        rc = ioctl(RTFileToNative(pDevFBSD->hFile), iCmd, pvArg);
         if (rc >= 0)
             return VINF_SUCCESS;
@@ -369,18 +369,15 @@
      * Try open the device node.
      */
-    RTFILE File;
-
-    rc = RTFileOpen(&File, pszAddress, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+    RTFILE hFile;
+    rc = RTFileOpen(&hFile, pszAddress, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     if (RT_SUCCESS(rc))
     {
         /*
-             * Allocate and initialize the linux backend data.
-             */
-        PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD)
-        RTMemAllocZ(sizeof(USBPROXYDEVFBSD));
-
+         * Allocate and initialize the linux backend data.
+         */
+        PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD)RTMemAllocZ(sizeof(USBPROXYDEVFBSD));
         if (pDevFBSD)
         {
-            pDevFBSD->File = File;
+            pDevFBSD->hFile = hFile;
             pProxyDev->Backend.pv = pDevFBSD;
 
@@ -388,8 +385,6 @@
             if (RT_SUCCESS(rc))
             {
-                LogFlow(("usbProxyFreeBSDOpen(%p, %s): returns "
-                         "successfully File=%d iActiveCfg=%d\n",
-                         pProxyDev, pszAddress,
-                         pDevFBSD->File, pProxyDev->iActiveCfg));
+                LogFlow(("usbProxyFreeBSDOpen(%p, %s): returns successfully hFile=%RTfile iActiveCfg=%d\n",
+                         pProxyDev, pszAddress, pDevFBSD->hFile, pProxyDev->iActiveCfg));
 
                 return VINF_SUCCESS;
@@ -401,5 +396,5 @@
             rc = VERR_NO_MEMORY;
 
-        RTFileClose(File);
+        RTFileClose(hFile);
     }
     else if (rc == VERR_ACCESS_DENIED)
@@ -455,5 +450,5 @@
 static void usbProxyFreeBSDClose(PUSBPROXYDEV pProxyDev)
 {
-    PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD) pProxyDev->Backend.pv;
+    PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD)pProxyDev->Backend.pv;
 
     LogFlow(("usbProxyFreeBSDClose: pProxyDev=%s\n", pProxyDev->pUsbIns->pszName));
@@ -464,10 +459,8 @@
     usbProxyFreeBSDFsUnInit(pProxyDev);
 
-    RTFileClose(pDevFBSD->File);
-
-    pDevFBSD->File = NIL_RTFILE;
+    RTFileClose(pDevFBSD->hFile);
+    pDevFBSD->hFile = NIL_RTFILE;
 
     RTMemFree(pDevFBSD);
-
     pProxyDev->Backend.pv = NULL;
 
@@ -991,5 +984,5 @@
     {
         /* Poll for finished transfers */
-        PollFd.fd = (int)pDevFBSD->File;
+        PollFd.fd = RTFileToNative(pDevFBSD->hFile);
         PollFd.events = POLLIN | POLLRDNORM;
         PollFd.revents = 0;
Index: /trunk/src/VBox/Devices/USB/linux/USBProxyDevice-linux.cpp
===================================================================
--- /trunk/src/VBox/Devices/USB/linux/USBProxyDevice-linux.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/USB/linux/USBProxyDevice-linux.cpp	(revision 37596)
@@ -137,5 +137,5 @@
 {
     /** The open file. */
-    RTFILE              File;
+    RTFILE              hFile;
     /** Critical section protecting the two lists. */
     RTCRITSECT          CritSect;
@@ -194,5 +194,5 @@
         do
         {
-            rc = ioctl(pDevLnx->File, iCmd, pvArg);
+            rc = ioctl(RTFileToNative(pDevLnx->hFile), iCmd, pvArg);
             if (rc >= 0)
                 return rc;
@@ -236,5 +236,5 @@
         pUrbLnx = pUrbLnx->pNext;
 
-        ioctl(pDevLnx->File, USBDEVFS_DISCARDURB, &pCur->KUrb); /* not sure if this is required.. */
+        ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_DISCARDURB, &pCur->KUrb); /* not sure if this is required.. */
         if (!pCur->KUrb.status)
             pCur->KUrb.status = -ENODEV;
@@ -596,6 +596,6 @@
 {
     PUSBPROXYDEVLNX pDevLnx = (PUSBPROXYDEVLNX)pProxyDev->Backend.pv;
-    AssertReturn(pDevLnx->File != NIL_RTFILE, -1);
-    return pDevLnx->File;
+    AssertReturn(pDevLnx->hFile != NIL_RTFILE, -1);
+    return RTFileToNative(pDevLnx->hFile);
 }
 
@@ -653,6 +653,6 @@
      * Try open the device node.
      */
-    RTFILE File;
-    int rc = RTFileOpen(&File, pszDevNode, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+    RTFILE hFile;
+    int rc = RTFileOpen(&hFile, pszDevNode, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     if (RT_SUCCESS(rc))
     {
@@ -666,5 +666,5 @@
             memcpy(&pDevLnx->szPath[0], pszPath, cchPath);
             pDevLnx->szPath[cchPath] = '\0';
-            pDevLnx->File = File;
+            pDevLnx->hFile = hFile;
             rc = RTCritSectInit(&pDevLnx->CritSect);
             if (RT_SUCCESS(rc))
@@ -672,6 +672,6 @@
                 pProxyDev->Backend.pv = pDevLnx;
 
-                LogFlow(("usbProxyLinuxOpen(%p, %s): returns successfully File=%d iActiveCfg=%d\n",
-                         pProxyDev, pszAddress, pDevLnx->File, pProxyDev->iActiveCfg));
+                LogFlow(("usbProxyLinuxOpen(%p, %s): returns successfully File=%RTfile iActiveCfg=%d\n",
+                         pProxyDev, pszAddress, pDevLnx->hFile, pProxyDev->iActiveCfg));
 
                 return VINF_SUCCESS;
@@ -682,5 +682,5 @@
         else
             rc = VERR_NO_MEMORY;
-        RTFileClose(File);
+        RTFileClose(hFile);
     }
     else if (rc == VERR_ACCESS_DENIED)
@@ -812,6 +812,6 @@
     }
 
-    RTFileClose(pDevLnx->File);
-    pDevLnx->File = NIL_RTFILE;
+    RTFileClose(pDevLnx->hFile);
+    pDevLnx->hFile = NIL_RTFILE;
 
     RTMemFree(pDevLnx);
@@ -1278,5 +1278,5 @@
     unsigned        cTries = 0;
 
-    while (ioctl(pDevLnx->File, USBDEVFS_SUBMITURB, &pCur->KUrb))
+    while (ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_SUBMITURB, &pCur->KUrb))
     {
         if (errno == EINTR)
@@ -1516,5 +1516,5 @@
      */
     cTries = 0;
-    while (ioctl(pDevLnx->File, USBDEVFS_SUBMITURB, &pUrbLnx->KUrb))
+    while (ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_SUBMITURB, &pUrbLnx->KUrb))
     {
         if (errno == EINTR)
@@ -1760,11 +1760,9 @@
             {
                 struct pollfd pfd;
-                int rc;
-
-                pfd.fd = pDevLnx->File;
+                pfd.fd = RTFileToNative(pDevLnx->hFile);
                 pfd.events = POLLOUT | POLLWRNORM /* completed async */
                            | POLLERR | POLLHUP    /* disconnected */;
                 pfd.revents = 0;
-                rc = poll(&pfd, 1, cMillies);
+                int rc = poll(&pfd, 1, cMillies);
                 Log(("usbProxyLinuxUrbReap: poll rc = %d\n", rc));
                 if (rc >= 1)
@@ -1790,5 +1788,5 @@
         {
             struct usbdevfs_urb *pKUrb;
-            while (ioctl(pDevLnx->File, USBDEVFS_REAPURBNDELAY, &pKUrb))
+            while (ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_REAPURBNDELAY, &pKUrb))
                 if (errno != EINTR)
                 {
Index: /trunk/src/VBox/Devices/USB/solaris/USBProxyDevice-solaris.cpp
===================================================================
--- /trunk/src/VBox/Devices/USB/solaris/USBProxyDevice-solaris.cpp	(revision 37595)
+++ /trunk/src/VBox/Devices/USB/solaris/USBProxyDevice-solaris.cpp	(revision 37596)
@@ -80,5 +80,5 @@
     char                          *pszDevicePath;
     /** The connection to the client driver. */
-    RTFILE                         File;
+    RTFILE                         hFile;
     /** Pointer to the proxy device instance. */
     PUSBPROXYDEV                   pProxyDev;
@@ -196,9 +196,6 @@
 static void usbProxySolarisCloseFile(PUSBPROXYDEVSOL pDevSol)
 {
-    if (pDevSol->File != NIL_RTFILE)
-    {
-        RTFileClose(pDevSol->File);
-        pDevSol->File = NIL_RTFILE;
-    }
+    RTFileClose(pDevSol->hFile);
+    pDevSol->hFile = NIL_RTFILE;
 }
 
@@ -215,5 +212,5 @@
 static int usbProxySolarisIOCtl(PUSBPROXYDEVSOL pDevSol, unsigned Function, void *pvData, size_t cbData)
 {
-    if (RT_UNLIKELY(pDevSol->File == NIL_RTFILE))
+    if (RT_UNLIKELY(pDevSol->hFile == NIL_RTFILE))
     {
         LogFlow((USBPROXY ":usbProxySolarisIOCtl connection to driver gone!\n"));
@@ -228,5 +225,5 @@
 
     int Ret = -1;
-    int rc = RTFileIoCtl(pDevSol->File, Function, &Req, sizeof(Req), &Ret);
+    int rc = RTFileIoCtl(pDevSol->hFile, Function, &Req, sizeof(Req), &Ret);
     if (RT_SUCCESS(rc))
     {
@@ -327,9 +324,9 @@
                          * Open the client driver.
                          */
-                        RTFILE File;
-                        rc = RTFileOpen(&File, pDevSol->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+                        RTFILE hFile;
+                        rc = RTFileOpen(&hFile, pDevSol->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
                         if (RT_SUCCESS(rc))
                         {
-                            pDevSol->File = File;
+                            pDevSol->hFile = hFile;
                             pDevSol->pProxyDev = pProxyDev;
 
@@ -363,6 +360,6 @@
                             }
 
-                            RTFileClose(pDevSol->File);
-                            pDevSol->File = NIL_RTFILE;
+                            RTFileClose(pDevSol->hFile);
+                            pDevSol->hFile = NIL_RTFILE;
                             pDevSol->pProxyDev = NULL;
                         }
@@ -721,11 +718,8 @@
         {
             struct pollfd pfd;
-            int rc;
-
-            pfd.fd = pDevSol->File;
+            pfd.fd = RTFileToNative(pDevSol->hFile);
             pfd.events = POLLIN;
             pfd.revents = 0;
-            rc = poll(&pfd, 1, cMillies);
-
+            int rc = poll(&pfd, 1, cMillies);
             if (rc > 0)
             {
Index: /trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp	(revision 37595)
+++ /trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp	(revision 37596)
@@ -1703,5 +1703,5 @@
                         strcpy(IfReq.ifr_name, "tun%d");
                     IfReq.ifr_flags = IFF_TAP | IFF_NO_PI;
-                    rc = ioctl(tapFD, TUNSETIFF, &IfReq);
+                    rc = ioctl(RTFileToNative(tapFD), TUNSETIFF, &IfReq);
                     if (rc)
                     {
@@ -1712,5 +1712,5 @@
                     }
 
-                    rc = fcntl(tapFD, F_SETFL, O_NONBLOCK);
+                    rc = fcntl(RTFileToNative(tapFD), F_SETFL, O_NONBLOCK);
                     if (rc)
                     {
@@ -1722,5 +1722,5 @@
 
                     rc = CFGMR3InsertString(pCfg, "Device", g_aNetDevs[ulInstance].pszName);        UPDATE_RC();
-                    rc = CFGMR3InsertInteger(pCfg, "FileHandle", (RTFILE)tapFD);                    UPDATE_RC();
+                    rc = CFGMR3InsertInteger(pCfg, "FileHandle", (uintptr_t)tapFD);                 UPDATE_RC();
 
 #elif defined(RT_OS_SOLARIS)
Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp	(revision 37595)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp	(revision 37596)
@@ -864,6 +864,6 @@
         return errorSyntax(USAGE_LISTPARTITIONS, "Mandatory parameter -rawdisk missing");
 
-    RTFILE RawFile;
-    int vrc = RTFileOpen(&RawFile, rawdisk.c_str(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
+    RTFILE hRawFile;
+    int vrc = RTFileOpen(&hRawFile, rawdisk.c_str(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
     if (RT_FAILURE(vrc))
     {
@@ -873,5 +873,5 @@
 
     HOSTPARTITIONS partitions;
-    vrc = partRead(RawFile, &partitions);
+    vrc = partRead(hRawFile, &partitions);
     /* Don't bail out on errors, print the table and return the result code. */
 
@@ -989,6 +989,6 @@
     fRelative = true;
 #endif /* RT_OS_DARWIN */
-    RTFILE RawFile;
-    int vrc = RTFileOpen(&RawFile, rawdisk.c_str(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
+    RTFILE hRawFile;
+    int vrc = RTFileOpen(&hRawFile, rawdisk.c_str(), RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
     if (RT_FAILURE(vrc))
     {
@@ -1008,5 +1008,5 @@
     DISK_GEOMETRY DriveGeo;
     DWORD cbDriveGeo;
-    if (DeviceIoControl((HANDLE)RawFile,
+    if (DeviceIoControl((HANDLE)RTFileToNative(hRawFile),
                         IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0,
                         &DriveGeo, sizeof(DriveGeo), &cbDriveGeo, NULL))
@@ -1029,5 +1029,5 @@
         GET_LENGTH_INFORMATION DiskLenInfo;
         DWORD junk;
-        if (DeviceIoControl((HANDLE)RawFile,
+        if (DeviceIoControl((HANDLE)RTFileToNative(hRawFile),
                             IOCTL_DISK_GET_LENGTH_INFO, NULL, 0,
                             &DiskLenInfo, sizeof(DiskLenInfo), &junk, (LPOVERLAPPED)NULL))
@@ -1045,5 +1045,5 @@
 #elif defined(RT_OS_LINUX)
     struct stat DevStat;
-    if (!fstat(RawFile, &DevStat) && S_ISBLK(DevStat.st_mode))
+    if (!fstat(RTFileToNative(hRawFile), &DevStat) && S_ISBLK(DevStat.st_mode))
     {
 #ifdef BLKGETSIZE64
@@ -1056,5 +1056,5 @@
         {
             uint64_t cbBlk;
-            if (!ioctl(RawFile, BLKGETSIZE64, &cbBlk))
+            if (!ioctl(RTFileToNative(hRawFile), BLKGETSIZE64, &cbBlk))
                 cbSize = cbBlk;
         }
@@ -1063,5 +1063,5 @@
         {
             long cBlocks;
-            if (!ioctl(RawFile, BLKGETSIZE, &cBlocks))
+            if (!ioctl(RTFileToNative(hRawFile), BLKGETSIZE, &cBlocks))
                 cbSize = (uint64_t)cBlocks << 9;
             else
@@ -1081,11 +1081,11 @@
 #elif defined(RT_OS_DARWIN)
     struct stat DevStat;
-    if (!fstat(RawFile, &DevStat) && S_ISBLK(DevStat.st_mode))
+    if (!fstat(RTFileToNative(hRawFile), &DevStat) && S_ISBLK(DevStat.st_mode))
     {
         uint64_t cBlocks;
         uint32_t cbBlock;
-        if (!ioctl(RawFile, DKIOCGETBLOCKCOUNT, &cBlocks))
-        {
-            if (!ioctl(RawFile, DKIOCGETBLOCKSIZE, &cbBlock))
+        if (!ioctl(RTFileToNative(hRawFile), DKIOCGETBLOCKCOUNT, &cBlocks))
+        {
+            if (!ioctl(RTFileToNative(hRawFile), DKIOCGETBLOCKSIZE, &cbBlock))
                 cbSize = cBlocks * cbBlock;
             else
@@ -1111,9 +1111,9 @@
 #elif defined(RT_OS_SOLARIS)
     struct stat DevStat;
-    if (!fstat(RawFile, &DevStat) && (   S_ISBLK(DevStat.st_mode)
+    if (!fstat(RTFileToNative(hRawFile), &DevStat) && (   S_ISBLK(DevStat.st_mode)
                                       || S_ISCHR(DevStat.st_mode)))
     {
         struct dk_minfo mediainfo;
-        if (!ioctl(RawFile, DKIOCGMEDIAINFO, &mediainfo))
+        if (!ioctl(RTFileToNative(hRawFile), DKIOCGMEDIAINFO, &mediainfo))
             cbSize = mediainfo.dki_capacity * mediainfo.dki_lbsize;
         else
@@ -1132,8 +1132,8 @@
 #elif defined(RT_OS_FREEBSD)
     struct stat DevStat;
-    if (!fstat(RawFile, &DevStat) && S_ISCHR(DevStat.st_mode))
+    if (!fstat(RTFileToNative(hRawFile), &DevStat) && S_ISCHR(DevStat.st_mode))
     {
         off_t cbMedia = 0;
-        if (!ioctl(RawFile, DIOCGMEDIASIZE, &cbMedia))
+        if (!ioctl(RTFileToNative(hRawFile), DIOCGMEDIASIZE, &cbMedia))
         {
             cbSize = cbMedia;
@@ -1155,5 +1155,5 @@
     /* Hopefully this works on all other hosts. If it doesn't, it'll just fail
      * creating the VMDK, so no real harm done. */
-    vrc = RTFileGetSize(RawFile, &cbSize);
+    vrc = RTFileGetSize(hRawFile, &cbSize);
     if (RT_FAILURE(vrc))
     {
@@ -1213,5 +1213,5 @@
 
         HOSTPARTITIONS partitions;
-        vrc = partRead(RawFile, &partitions);
+        vrc = partRead(hRawFile, &partitions);
         if (RT_FAILURE(vrc))
         {
@@ -1268,5 +1268,5 @@
                     goto out;
                 }
-                vrc = RTFileReadAt(RawFile, partitions.aPartitions[i].uPartDataStart * 512,
+                vrc = RTFileReadAt(hRawFile, partitions.aPartitions[i].uPartDataStart * 512,
                                    pPartData, (size_t)pPartDesc->cbData, NULL);
                 if (RT_FAILURE(vrc))
@@ -1415,5 +1415,5 @@
     }
 
-    RTFileClose(RawFile);
+    RTFileClose(hRawFile);
 
 #ifdef DEBUG_klaus
@@ -1638,5 +1638,5 @@
     vrc = VINF_SUCCESS;
     if (fWriteToStdOut)
-        outFile = 1;
+        vrc = RTFileFromNative(&outFile, 1);
     else
         vrc = RTFileOpen(&outFile, dst.c_str(), RTFILE_O_WRITE | RTFILE_O_CREATE | RTFILE_O_DENY_ALL);
Index: /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 37596)
@@ -97,5 +97,5 @@
 SUPLIBDATA                      g_supLibData =
 {
-    NIL_RTFILE
+    SUP_HDEVICE_NIL
 #if   defined(RT_OS_DARWIN)
     , NULL
@@ -185,8 +185,8 @@
         return VERR_INVALID_MAGIC;
     if (    !(fFlags & SUPSECMAIN_FLAGS_DONT_OPEN_DEV)
-        &&  pPreInitData->Data.hDevice == NIL_RTFILE)
+        &&  pPreInitData->Data.hDevice == SUP_HDEVICE_NIL)
         return VERR_INVALID_HANDLE;
     if (    (fFlags & SUPSECMAIN_FLAGS_DONT_OPEN_DEV)
-        &&  pPreInitData->Data.hDevice != NIL_RTFILE)
+        &&  pPreInitData->Data.hDevice != SUP_HDEVICE_NIL)
         return VERR_INVALID_PARAMETER;
 
Index: /trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h	(revision 37596)
@@ -185,5 +185,9 @@
 {
     /** The device handle. */
-    RTFILE              hDevice;
+#if defined(RT_OS_WINDOWS)
+    void               *hDevice;
+#else
+    int                 hDevice;
+#endif
 #if   defined(RT_OS_DARWIN)
     /** The connection to the VBoxSupDrv service. */
@@ -203,4 +207,11 @@
 /** Pointer to const pre-init data. */
 typedef SUPLIBDATA const *PCSUPLIBDATA;
+
+/** The NIL value of SUPLIBDATA::hDevice. */
+#if defined(RT_OS_WINDOWS)
+# define SUP_HDEVICE_NIL NULL
+#else
+# define SUP_HDEVICE_NIL (-1)
+#endif
 
 
Index: /trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp	(revision 37596)
@@ -1019,7 +1019,7 @@
      */
     g_pszSupLibHardenedProgName = pszProgName;
-    g_SupPreInitData.u32Magic = SUPPREINITDATA_MAGIC;
-    g_SupPreInitData.Data.hDevice = NIL_RTFILE;
-    g_SupPreInitData.u32EndMagic = SUPPREINITDATA_MAGIC;
+    g_SupPreInitData.u32Magic     = SUPPREINITDATA_MAGIC;
+    g_SupPreInitData.Data.hDevice = SUP_HDEVICE_NIL;
+    g_SupPreInitData.u32EndMagic  = SUPPREINITDATA_MAGIC;
 
 #ifdef SUP_HARDENED_SUID
Index: /trunk/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp	(revision 37596)
@@ -194,5 +194,5 @@
      * Do the job.
      */
-    Assert(pThis->hDevice == NIL_RTFILE);
+    Assert(pThis->hDevice == (intptr_t)NIL_RTFILE);
     int rc = suplibDarwinOpenService(pThis);
     if (RT_SUCCESS(rc))
@@ -237,9 +237,9 @@
      * Check if we're inited at all.
      */
-    if (pThis->hDevice != NIL_RTFILE)
+    if (pThis->hDevice != (intptr_t)NIL_RTFILE)
     {
         if (close(pThis->hDevice))
             AssertFailed();
-        pThis->hDevice = NIL_RTFILE;
+        pThis->hDevice = (intptr_t)NIL_RTFILE;
     }
 
Index: /trunk/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/freebsd/SUPLib-freebsd.cpp	(revision 37596)
@@ -133,9 +133,9 @@
      * Check if we're inited at all.
      */
-    if (pThis->hDevice != NIL_RTFILE)
+    if (pThis->hDevice != (intptr_t)NIL_RTFILE)
     {
         if (close(pThis->hDevice))
             AssertFailed();
-        pThis->hDevice = NIL_RTFILE;
+        pThis->hDevice = (intptr_t)NIL_RTFILE;
     }
     return VINF_SUCCESS;
Index: /trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp	(revision 37596)
@@ -79,5 +79,5 @@
     if (fPreInited)
         return VINF_SUCCESS;
-    Assert(pThis->hDevice == NIL_RTFILE);
+    Assert(pThis->hDevice == (intptr_t)NIL_RTFILE);
 
     /*
@@ -145,9 +145,9 @@
      * Close the device if it's actually open.
      */
-    if (pThis->hDevice != NIL_RTFILE)
+    if (pThis->hDevice != (intptr_t)NIL_RTFILE)
     {
         if (close(pThis->hDevice))
             AssertFailed();
-        pThis->hDevice = NIL_RTFILE;
+        pThis->hDevice = (intptr_t)NIL_RTFILE;
     }
 
@@ -172,5 +172,5 @@
 int suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cbReq)
 {
-    AssertMsg(pThis->hDevice != NIL_RTFILE, ("SUPLIB not initiated successfully!\n"));
+    AssertMsg(pThis->hDevice != (intptr_t)NIL_RTFILE, ("SUPLIB not initiated successfully!\n"));
 
     /*
Index: /trunk/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/os2/SUPLib-os2.cpp	(revision 37596)
@@ -100,5 +100,5 @@
     }
 
-    pThis->hDevice = (RTFILE)hDevice;
+    pThis->hDevice = hDevice;
     return VINF_SUCCESS;
 }
@@ -112,9 +112,9 @@
      * Check if we're inited at all.
      */
-    if (pThis->hDevice != NIL_RTFILE)
+    if (pThis->hDevice != (intptr_t)NIL_RTFILE)
     {
         APIRET rc = DosClose((HFILE)pThis->hDevice);
         AssertMsg(rc == NO_ERROR, ("%d\n", rc)); NOREF(rc);
-        pThis->hDevice = NIL_RTFILE;
+        pThis->hDevice = (intptr_t)NIL_RTFILE;
     }
 
Index: /trunk/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/solaris/SUPLib-solaris.cpp	(revision 37596)
@@ -162,5 +162,5 @@
         if (close(pThis->hDevice))
             AssertFailed();
-        pThis->hDevice = NIL_RTFILE;
+        pThis->hDevice = (intptr_t)NIL_RTFILE;
     }
 
Index: /trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp	(revision 37595)
+++ /trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp	(revision 37596)
@@ -139,5 +139,5 @@
      * We're done.
      */
-    pThis->hDevice = (RTFILE)hDevice;
+    pThis->hDevice = hDevice;
     return VINF_SUCCESS;
 }
@@ -475,9 +475,9 @@
      * Check if we're inited at all.
      */
-    if (pThis->hDevice != NIL_RTFILE)
+    if (pThis->hDevice != NULL)
     {
         if (!CloseHandle((HANDLE)pThis->hDevice))
             AssertFailed();
-        pThis->hDevice = NIL_RTFILE;
+        pThis->hDevice = NIL_RTFILE; /* yes, that's right */
     }
 
Index: /trunk/src/VBox/Main/include/USBProxyService.h
===================================================================
--- /trunk/src/VBox/Main/include/USBProxyService.h	(revision 37595)
+++ /trunk/src/VBox/Main/include/USBProxyService.h	(revision 37596)
@@ -256,9 +256,9 @@
 private:
     /** File handle to the '/proc/bus/usb/devices' file. */
-    RTFILE mFile;
+    RTFILE mhFile;
     /** Pipe used to interrupt wait(), the read end. */
-    RTFILE mWakeupPipeR;
+    RTPIPE mhWakeupPipeR;
     /** Pipe used to interrupt wait(), the write end. */
-    RTFILE mWakeupPipeW;
+    RTPIPE mhWakeupPipeW;
     /** The root of usbfs. */
     Utf8Str mDevicesRoot;
Index: /trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp	(revision 37595)
+++ /trunk/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp	(revision 37596)
@@ -39,4 +39,5 @@
 #include <iprt/param.h>
 #include <iprt/path.h>
+#include <iprt/pipe.h>
 #include <iprt/stream.h>
 #include <iprt/linux/sysfs.h>
@@ -60,6 +61,6 @@
  */
 USBProxyServiceLinux::USBProxyServiceLinux(Host *aHost)
-    : USBProxyService(aHost), mFile(NIL_RTFILE), mWakeupPipeR(NIL_RTFILE),
-      mWakeupPipeW(NIL_RTFILE), mUsingUsbfsDevices(true /* see init */),
+    : USBProxyService(aHost), mhFile(NIL_RTFILE), mhWakeupPipeR(NIL_RTPIPE),
+      mhWakeupPipeW(NIL_RTPIPE), mUsingUsbfsDevices(true /* see init */),
       mUdevPolls(0), mpWaiter(NULL)
 #ifdef UNIT_TEST
@@ -209,46 +210,28 @@
     if (pszDevices)
     {
-        rc = RTFileOpen(&mFile, pszDevices, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+        rc = RTFileOpen(&mhFile, pszDevices, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
         if (RT_SUCCESS(rc))
         {
-            int pipes[2];
-            if (!pipe(pipes))
+            rc = RTPipeCreate(&mhWakeupPipeR, &mhWakeupPipeW, 0 /*fFlags*/);
+            if (RT_SUCCESS(rc))
             {
-                /* Set close on exec (race here!) */
-                if (   fcntl(pipes[0], F_SETFD, FD_CLOEXEC) >= 0
-                    && fcntl(pipes[1], F_SETFD, FD_CLOEXEC) >= 0)
+                /*
+                 * Start the poller thread.
+                 */
+                rc = start();
+                if (RT_SUCCESS(rc))
                 {
-                    mWakeupPipeR = pipes[0];
-                    mWakeupPipeW = pipes[1];
-                    /*
-                     * Start the poller thread.
-                     */
-                    rc = start();
-                    if (RT_SUCCESS(rc))
-                    {
-                        RTStrFree(pszDevices);
-                        LogFlowThisFunc(("returns successfully - mWakeupPipeR/W=%d/%d\n",
-                                         mWakeupPipeR, mWakeupPipeW));
-                        return VINF_SUCCESS;
-                    }
-
-                    RTFileClose(mWakeupPipeR);
-                    RTFileClose(mWakeupPipeW);
-                    mWakeupPipeW = mWakeupPipeR = NIL_RTFILE;
+                    RTStrFree(pszDevices);
+                    LogFlowThisFunc(("returns successfully\n"));
+                    return VINF_SUCCESS;
                 }
-                else
-                {
-                    rc = RTErrConvertFromErrno(errno);
-                    Log(("USBProxyServiceLinux::USBProxyServiceLinux: fcntl failed, errno=%d\n", errno));
-                    close(pipes[0]);
-                    close(pipes[1]);
-                }
+
+                RTPipeClose(mhWakeupPipeR);
+                RTPipeClose(mhWakeupPipeW);
+                mhWakeupPipeW = mhWakeupPipeR = NIL_RTPIPE;
             }
             else
-            {
-                rc = RTErrConvertFromErrno(errno);
-                Log(("USBProxyServiceLinux::USBProxyServiceLinux: pipe failed, errno=%d\n", errno));
-            }
-            RTFileClose(mFile);
+                Log(("USBProxyServiceLinux::USBProxyServiceLinux: RTFilePipe failed with rc=%Rrc\n", rc));
+            RTFileClose(mhFile);
         }
 
@@ -332,15 +315,10 @@
      * Free resources.
      */
-    if (mFile != NIL_RTFILE)
-    {
-        RTFileClose(mFile);
-        mFile = NIL_RTFILE;
-    }
-
-    if (mWakeupPipeR != NIL_RTFILE)
-        RTFileClose(mWakeupPipeR);
-    if (mWakeupPipeW != NIL_RTFILE)
-        RTFileClose(mWakeupPipeW);
-    mWakeupPipeW = mWakeupPipeR = NIL_RTFILE;
+    RTFileClose(mhFile);
+    mhFile = NIL_RTFILE;
+
+    RTPipeClose(mhWakeupPipeR);
+    RTPipeClose(mhWakeupPipeW);
+    mhWakeupPipeW = mhWakeupPipeR = NIL_RTPIPE;
 }
 
@@ -434,7 +412,7 @@
 
     memset(&PollFds, 0, sizeof(PollFds));
-    PollFds[0].fd        = mFile;
+    PollFds[0].fd        = RTFileToNative(mhFile);
     PollFds[0].events    = POLLIN;
-    PollFds[1].fd        = mWakeupPipeR;
+    PollFds[1].fd        = RTPipeToNative(mhWakeupPipeR);
     PollFds[1].events    = POLLIN | POLLERR | POLLHUP;
 
@@ -448,5 +426,5 @@
         {
             char szBuf[WAKE_UP_STRING_LEN];
-            rc = RTFileRead(mWakeupPipeR, szBuf, sizeof(szBuf), NULL);
+            rc = RTPipeReadBlocking(mhWakeupPipeR, szBuf, sizeof(szBuf), NULL);
             AssertRC(rc);
         }
@@ -484,7 +462,7 @@
     }
 #endif /* VBOX_USB_WITH_SYSFS */
-    int rc = RTFileWrite(mWakeupPipeW, WAKE_UP_STRING, WAKE_UP_STRING_LEN, NULL);
+    int rc = RTPipeWriteBlocking(mhWakeupPipeW, WAKE_UP_STRING, WAKE_UP_STRING_LEN, NULL);
     if (RT_SUCCESS(rc))
-        RTFileFlush(mWakeupPipeW);
+        RTPipeFlush(mhWakeupPipeW);
     LogFlowFunc(("returning %Rrc\n", rc));
     return rc;
Index: /trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp
===================================================================
--- /trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp	(revision 37595)
+++ /trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp	(revision 37596)
@@ -35,4 +35,5 @@
 #include <iprt/path.h>
 #include <iprt/param.h>
+#include <iprt/pipe.h>
 #include <iprt/getopt.h>
 #include <iprt/string.h>
@@ -90,6 +91,6 @@
     HANDLE m_hWakeupEvent;
 #else
-    RTFILE m_PipeWrite;
-    RTFILE m_PipeRead;
+    RTPIPE m_hPipeWrite;
+    RTPIPE m_hPipeRead;
 #endif
     /** Queue for NAT-thread-external events. */
@@ -126,5 +127,6 @@
 #ifndef RT_OS_WINDOWS
     /* kick select() */
-    rc = RTFileWrite(g_pNAT->m_PipeWrite, "", 1, NULL);
+    size_t cbIgnored;
+    rc = RTPipeWrite(g_pNAT->m_hPipeWrite, "", 1, &cbIgnored);
 #else
     /* kick WSAWaitForMultipleEvents */
@@ -170,15 +172,9 @@
      * Create the control pipe.
      */
-    int fds[2];
-    if (pipe(&fds[0]) != 0) /** @todo RTPipeCreate() or something... */
-    {
-        rc = RTErrConvertFromErrno(errno);
-        AssertReleaseRC(rc);
-        return;
-    }
-    m_PipeRead = fds[0];
-    m_PipeWrite = fds[1];
+    rc = RTPipeCreate(&m_hPipeRead, &m_hPipeWrite, 0 /*fFlags*/);
+    AssertReleaseRC(rc);
 #else
     m_hWakeupEvent = CreateEvent(NULL, FALSE, FALSE, NULL); /* auto-reset event */
+    AssertReleaseRC(m_hWakeupEvent != NULL);
     slirp_register_external_event(m_pNATState, m_hWakeupEvent, VBOX_WAKEUP_EVENT_INDEX);
 #endif
@@ -299,5 +295,6 @@
 #ifndef RT_OS_WINDOWS
                 /* kick select() */
-                rc = RTFileWrite(m_PipeWrite, "", 1, NULL);
+                size_t cbIgnored;
+                rc = RTPipeWrite(m_hPipeWrite, "", 1, &cbIgnored);
                 AssertRC(rc);
 #else
@@ -468,5 +465,5 @@
         unsigned int cMsTimeout = slirp_get_timeout_ms(pThis->m_pNATState);
 
-        polls[0].fd = pThis->m_PipeRead;
+        polls[0].fd = RTPipeToNative(pThis->m_hPipeRead);
         /* POLLRDBAND usually doesn't used on Linux but seems used on Solaris */
         polls[0].events = POLLRDNORM|POLLPRI|POLLRDBAND;
@@ -494,9 +491,7 @@
             if (polls[0].revents & (POLLRDNORM|POLLPRI|POLLRDBAND))
             {
-                /* drain the pipe */
-                char ch[1];
-                size_t cbRead;
-                int counter = 0;
-                /*
+                /* drain the pipe
+                 *
+                 * Note!
                  * drvNATSend decoupled so we don't know how many times
                  * device's thread sends before we've entered multiplex,
@@ -506,7 +501,10 @@
                  * deep pipe has been filed before drain.
                  *
-                 * XXX:Make it reading exactly we need to drain the pipe.
                  */
-                RTFileRead(pThis->m_PipeRead, &ch, 1, &cbRead);
+                 /** @todo XXX: Make it reading exactly we need to drain the
+                  *  pipe.  */
+                char    ch;
+                size_t  cbRead;
+                RTPipeRead(pThis->m_hPipeRead, &ch, 1, &cbRead);
             }
         }
Index: /trunk/src/VBox/Runtime/common/ldr/ldr.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/ldr/ldr.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/ldr/ldr.cpp	(revision 37596)
@@ -39,23 +39,4 @@
 #include <iprt/log.h>
 #include "internal/ldr.h"
-
-
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
-typedef struct RTLDRREADERFILE
-{
-    /** The core. */
-    RTLDRREADER     Core;
-    /** The file. */
-    RTFILE          File;
-    /** The file size. */
-    RTFOFF          cbFile;
-    /** The current offset. */
-    RTFOFF          off;
-    /** The filename (variable size). */
-    char            szFilename[1];
-} RTLDRREADERFILE, *PRTLDRREADERFILE;
-
 
 
Index: /trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp	(revision 37596)
@@ -55,5 +55,5 @@
     RTLDRREADER     Core;
     /** The file. */
-    RTFILE          File;
+    RTFILE          hFile;
     /** The file size. */
     RTFOFF          cbFile;
@@ -79,5 +79,5 @@
     if (pFileReader->off != off)
     {
-        int rc = RTFileSeek(pFileReader->File, off, RTFILE_SEEK_BEGIN, NULL);
+        int rc = RTFileSeek(pFileReader->hFile, off, RTFILE_SEEK_BEGIN, NULL);
         if (RT_FAILURE(rc))
         {
@@ -91,5 +91,5 @@
      * Read.
      */
-    int rc = RTFileRead(pFileReader->File, pvBuf, cb, NULL);
+    int rc = RTFileRead(pFileReader->hFile, pvBuf, cb, NULL);
     if (RT_SUCCESS(rc))
         pFileReader->off += cb;
@@ -185,9 +185,9 @@
     int rc = VINF_SUCCESS;
     PRTLDRREADERFILE pFileReader = (PRTLDRREADERFILE)pReader;
-    if (pFileReader->File != NIL_RTFILE)
-    {
-        rc = RTFileClose(pFileReader->File);
+    if (pFileReader->hFile != NIL_RTFILE)
+    {
+        rc = RTFileClose(pFileReader->hFile);
         AssertRC(rc);
-        pFileReader->File = NIL_RTFILE;
+        pFileReader->hFile = NIL_RTFILE;
     }
     RTMemFree(pFileReader);
@@ -211,8 +211,8 @@
     {
         memcpy(pFileReader->szFilename, pszFilename, cchFilename + 1);
-        rc = RTFileOpen(&pFileReader->File, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
+        rc = RTFileOpen(&pFileReader->hFile, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
         if (RT_SUCCESS(rc))
         {
-            rc = RTFileGetSize(pFileReader->File, (uint64_t *)&pFileReader->cbFile);
+            rc = RTFileGetSize(pFileReader->hFile, (uint64_t *)&pFileReader->cbFile);
             if (RT_SUCCESS(rc))
             {
@@ -230,5 +230,6 @@
                 return VINF_SUCCESS;
             }
-            RTFileClose(pFileReader->File);
+
+            RTFileClose(pFileReader->hFile);
         }
         RTMemFree(pFileReader);
Index: /trunk/src/VBox/Runtime/common/log/log.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/log/log.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/log/log.cpp	(revision 37596)
@@ -129,9 +129,5 @@
 
     /** Handle to log file (if open). */
-    union
-    {
-        RTFILE              hFile;
-        RTHCUINTPTR         uPaddingForNewRTFILE;
-    } u;
+    RTFILE                  hFile;
     /** Log file history settings: maximum amount of data to put in a file. */
     uint64_t                cbHistoryFileMax;
@@ -157,5 +153,5 @@
 /** The size of the RTLOGGERINTERNAL structure in ring-0.  */
 # define RTLOGGERINTERNAL_R0_SIZE       RT_OFFSETOF(RTLOGGERINTERNAL, pfnPhase)
-AssertCompileMemberAlignment(RTLOGGERINTERNAL, u.hFile, sizeof(void *));
+AssertCompileMemberAlignment(RTLOGGERINTERNAL, hFile, sizeof(void *));
 AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t));
 #endif
@@ -341,5 +337,5 @@
 {
     PRTLOGGER pLogger = (PRTLOGGER)pvArg;
-    RTFileWrite(pLogger->pInt->u.hFile, pachChars, cbChars, NULL);
+    RTFileWrite(pLogger->pInt->hFile, pachChars, cbChars, NULL);
     return cbChars;
 }
@@ -479,5 +475,5 @@
 # ifdef IN_RING3
         pLogger->pInt->pfnPhase                 = pfnPhase;
-        pLogger->pInt->u.hFile                  = NIL_RTFILE;
+        pLogger->pInt->hFile                    = NIL_RTFILE;
         pLogger->pInt->cHistory                 = cHistory;
         if (cbHistoryFileMax == 0)
@@ -596,5 +592,5 @@
 
                     /* If the file is not open then rotation is not set up. */
-                    if (pLogger->pInt->u.hFile == NIL_RTFILE)
+                    if (pLogger->pInt->hFile == NIL_RTFILE)
                     {
                         pLogger->pInt->cbHistoryFileWritten = 0;
@@ -638,5 +634,5 @@
             }
 # ifdef IN_RING3
-            RTFileClose(pLogger->pInt->u.hFile);
+            RTFileClose(pLogger->pInt->hFile);
 # endif
 # if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC)
@@ -736,5 +732,5 @@
      */
     if (   (pLogger->fDestFlags & RTLOGDEST_FILE)
-        && pLogger->pInt->u.hFile != NIL_RTFILE)
+        && pLogger->pInt->hFile != NIL_RTFILE)
         pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_END, rtlogPhaseMsgLocked);
 
@@ -742,11 +738,11 @@
      * Close output stuffs.
      */
-    if (pLogger->pInt->u.hFile != NIL_RTFILE)
-    {
-        int rc2 = RTFileClose(pLogger->pInt->u.hFile);
+    if (pLogger->pInt->hFile != NIL_RTFILE)
+    {
+        int rc2 = RTFileClose(pLogger->pInt->hFile);
         AssertRC(rc2);
         if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
             rc = rc2;
-        pLogger->pInt->u.hFile = NIL_RTFILE;
+        pLogger->pInt->hFile = NIL_RTFILE;
     }
 # endif
@@ -2558,8 +2554,8 @@
         fOpen |= RTFILE_O_WRITE_THROUGH;
 
-    int rc = RTFileOpen(&pLogger->pInt->u.hFile, pLogger->pInt->szFilename, fOpen);
+    int rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen);
     if (RT_FAILURE(rc))
     {
-        pLogger->pInt->u.hFile = NIL_RTFILE;
+        pLogger->pInt->hFile = NIL_RTFILE;
         if (pszErrorMsg)
             RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("could not open file '%s' (fOpen=%#x)"), pLogger->pInt->szFilename, fOpen);
@@ -2567,5 +2563,5 @@
     else
     {
-        rc = RTFileGetSize(pLogger->pInt->u.hFile, &pLogger->pInt->cbHistoryFileWritten);
+        rc = RTFileGetSize(pLogger->pInt->hFile, &pLogger->pInt->cbHistoryFileWritten);
         if (RT_FAILURE(rc))
         {
@@ -2619,5 +2615,5 @@
      * Close the old log file.
      */
-    if (pLogger->pInt->u.hFile != NIL_RTFILE)
+    if (pLogger->pInt->hFile != NIL_RTFILE)
     {
         /* Use the callback to generate some final log contents, but only if
@@ -2631,6 +2627,6 @@
             pLogger->fDestFlags = fODestFlags;
         }
-        RTFileClose(pLogger->pInt->u.hFile);
-        pLogger->pInt->u.hFile = NIL_RTFILE;
+        RTFileClose(pLogger->pInt->hFile);
+        pLogger->pInt->hFile = NIL_RTFILE;
     }
 
@@ -2717,9 +2713,9 @@
     if (pLogger->fDestFlags & RTLOGDEST_FILE)
     {
-        if (pLogger->pInt->u.hFile != NIL_RTFILE)
-        {
-            RTFileWrite(pLogger->pInt->u.hFile, pLogger->achScratch, pLogger->offScratch, NULL);
+        if (pLogger->pInt->hFile != NIL_RTFILE)
+        {
+            RTFileWrite(pLogger->pInt->hFile, pLogger->achScratch, pLogger->offScratch, NULL);
             if (pLogger->fFlags & RTLOGFLAGS_FLUSH)
-                RTFileFlush(pLogger->pInt->u.hFile);
+                RTFileFlush(pLogger->pInt->hFile);
         }
         if (pLogger->pInt->cHistory)
Index: /trunk/src/VBox/Runtime/common/misc/RTFileOpenF.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/misc/RTFileOpenF.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/misc/RTFileOpenF.cpp	(revision 37596)
@@ -33,5 +33,5 @@
 
 
-RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, ...)
+RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, ...)
 {
     va_list va;
Index: /trunk/src/VBox/Runtime/common/misc/RTFileOpenV.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/misc/RTFileOpenV.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/misc/RTFileOpenV.cpp	(revision 37596)
@@ -37,5 +37,5 @@
 
 
-RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, va_list va)
+RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, va_list va)
 {
     char szFilename[RTPATH_MAX];
Index: /trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp	(revision 37596)
@@ -2298,5 +2298,5 @@
 
 
-RTDECL(int)         RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile)
+RTDECL(int)         RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint64_t fOpen, PRTVFSFILE phVfsFile)
 {
     /*
Index: /trunk/src/VBox/Runtime/common/vfs/vfschain.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/vfs/vfschain.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/vfs/vfschain.cpp	(revision 37596)
@@ -563,5 +563,5 @@
 
 
-RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint32_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError)
+RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint64_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError)
 {
     AssertPtrReturn(pszSpec, VERR_INVALID_POINTER);
@@ -610,5 +610,5 @@
 
 
-RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint32_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError)
+RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint64_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError)
 {
     AssertPtrReturn(pszSpec, VERR_INVALID_POINTER);
Index: /trunk/src/VBox/Runtime/common/vfs/vfsmisc.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/vfs/vfsmisc.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/vfs/vfsmisc.cpp	(revision 37596)
@@ -39,5 +39,5 @@
 
 
-RTDECL(int)         RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint32_t fOpen, bool fLeaveOpen,
+RTDECL(int)         RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint64_t fOpen, bool fLeaveOpen,
                                              PRTVFSIOSTREAM phVfsIos)
 {
Index: /trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp	(revision 37596)
@@ -419,5 +419,5 @@
 
 
-RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile)
+RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile)
 {
     /*
@@ -451,5 +451,5 @@
 
 
-RTDECL(int)         RTVfsIoStrmFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos)
+RTDECL(int)         RTVfsIoStrmFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos)
 {
     RTVFSFILE hVfsFile;
Index: /trunk/src/VBox/Runtime/include/internal/file.h
===================================================================
--- /trunk/src/VBox/Runtime/include/internal/file.h	(revision 37595)
+++ /trunk/src/VBox/Runtime/include/internal/file.h	(revision 37596)
@@ -42,5 +42,5 @@
  * @internal
  */
-int rtFileRecalcAndValidateFlags(uint32_t *pfOpen);
+int rtFileRecalcAndValidateFlags(uint64_t *pfOpen);
 
 
Index: /trunk/src/VBox/Runtime/include/internal/rand.h
===================================================================
--- /trunk/src/VBox/Runtime/include/internal/rand.h	(revision 37595)
+++ /trunk/src/VBox/Runtime/include/internal/rand.h	(revision 37596)
@@ -150,6 +150,6 @@
         struct RTRandFile
         {
-            /** The file handle. */
-            RTFILE      hFile;
+            /** The file handle (native). */
+            intptr_t    hFile;
         } File;
     } u;
Index: /trunk/src/VBox/Runtime/r3/fileio.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/fileio.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/fileio.cpp	(revision 37596)
@@ -107,5 +107,5 @@
  * @internal
  */
-int rtFileRecalcAndValidateFlags(uint32_t *pfOpen)
+int rtFileRecalcAndValidateFlags(uint64_t *pfOpen)
 {
     /*
@@ -128,5 +128,5 @@
             break;
         default:
-            AssertMsgFailed(("Invalid RW value, fOpen=%#x\n", fOpen));
+            AssertMsgFailed(("Invalid RW value, fOpen=%#llx\n", fOpen));
             return VERR_INVALID_PARAMETER;
     }
@@ -135,11 +135,11 @@
      * Validate                                                                                                                                       .
      */
-    AssertMsgReturn(fOpen & RTFILE_O_ACCESS_MASK, ("Missing RTFILE_O_READ/WRITE: fOpen=%#x\n", fOpen), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(fOpen & RTFILE_O_ACCESS_MASK, ("Missing RTFILE_O_READ/WRITE: fOpen=%#llx\n", fOpen), VERR_INVALID_PARAMETER);
 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
-    AssertMsgReturn(!(fOpen & (~RTFILE_O_VALID_MASK | RTFILE_O_NON_BLOCK)), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!(fOpen & (~(uint64_t)RTFILE_O_VALID_MASK | RTFILE_O_NON_BLOCK)), ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
 #else
-    AssertMsgReturn(!(fOpen & ~RTFILE_O_VALID_MASK), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!(fOpen & ~(uint64_t)RTFILE_O_VALID_MASK), ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
 #endif
-    AssertMsgReturn((fOpen & (RTFILE_O_TRUNCATE | RTFILE_O_WRITE)) != RTFILE_O_TRUNCATE, ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+    AssertMsgReturn((fOpen & (RTFILE_O_TRUNCATE | RTFILE_O_WRITE)) != RTFILE_O_TRUNCATE, ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
 
     switch (fOpen & RTFILE_O_ACTION_MASK)
@@ -150,5 +150,5 @@
             break;
         case RTFILE_O_OPEN:
-            AssertMsgReturn(!(RTFILE_O_NOT_CONTENT_INDEXED & fOpen), ("%#x\n", fOpen), VERR_INVALID_PARAMETER);
+            AssertMsgReturn(!(RTFILE_O_NOT_CONTENT_INDEXED & fOpen), ("%#llx\n", fOpen), VERR_INVALID_PARAMETER);
         case RTFILE_O_OPEN_CREATE:
         case RTFILE_O_CREATE:
@@ -156,5 +156,5 @@
             break;
         default:
-            AssertMsgFailed(("Invalid action value: fOpen=%#x\n", fOpen));
+            AssertMsgFailed(("Invalid action value: fOpen=%#llx\n", fOpen));
             return VERR_INVALID_PARAMETER;
     }
@@ -176,5 +176,5 @@
             break;
         default:
-            AssertMsgFailed(("Invalid deny value: fOpen=%#x\n", fOpen));
+            AssertMsgFailed(("Invalid deny value: fOpen=%#llx\n", fOpen));
             return VERR_INVALID_PARAMETER;
     }
Index: /trunk/src/VBox/Runtime/r3/linux/fileaio-linux.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/linux/fileaio-linux.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/linux/fileaio-linux.cpp	(revision 37596)
@@ -105,5 +105,5 @@
     int16_t   i16Priority;
     /** The file descriptor. */
-    uint32_t  File;
+    uint32_t  uFileDesc;
     /** The userspace pointer to the buffer containing/receiving the data. */
     void     *pvBuf;
@@ -379,5 +379,5 @@
      */
     pReqInt->AioCB.u16IoOpCode = uTransferDirection;
-    pReqInt->AioCB.File        = (uint32_t)hFile;
+    pReqInt->AioCB.uFileDesc   = RTFileToNative(hFile);
     pReqInt->AioCB.off         = off;
     pReqInt->AioCB.cbTransfer  = cbTransfer;
Index: /trunk/src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/posix/RTFileQueryFsSizes-posix.cpp	(revision 37596)
@@ -48,5 +48,5 @@
     struct statvfs StatVFS;
     RT_ZERO(StatVFS);
-    if (fstatvfs(hFile, &StatVFS))
+    if (fstatvfs(RTFileToNative(hFile), &StatVFS))
         return RTErrConvertFromErrno(errno);
 
Index: /trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/posix/fileaio-posix.cpp	(revision 37596)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -407,5 +407,5 @@
     pReqInt->fFlush               = false;
     pReqInt->AioCB.aio_lio_opcode = uTransferDirection;
-    pReqInt->AioCB.aio_fildes     = (int)hFile;
+    pReqInt->AioCB.aio_fildes     = RTFileToNative(hFile);
     pReqInt->AioCB.aio_offset     = off;
     pReqInt->AioCB.aio_nbytes     = cbTransfer;
@@ -445,5 +445,5 @@
 
     pReqInt->fFlush           = true;
-    pReqInt->AioCB.aio_fildes = (int)hFile;
+    pReqInt->AioCB.aio_fildes = RTFileToNative(hFile);
     pReqInt->AioCB.aio_offset = 0;
     pReqInt->AioCB.aio_nbytes = 0;
Index: /trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp	(revision 37596)
@@ -93,5 +93,5 @@
 
 
-RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
+RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint64_t fOpen)
 {
     /*
@@ -111,5 +111,5 @@
     if (fOpen & RTFILE_O_NON_BLOCK)
     {
-        AssertMsgFailed(("Invalid parameters! fOpen=%#x\n", fOpen));
+        AssertMsgFailed(("Invalid parameters! fOpen=%#llx\n", fOpen));
         return VERR_INVALID_PARAMETER;
     }
@@ -177,5 +177,5 @@
             break;
         default:
-            AssertMsgFailed(("RTFileOpen received an invalid RW value, fOpen=%#x\n", fOpen));
+            AssertMsgFailed(("RTFileOpen received an invalid RW value, fOpen=%#llx\n", fOpen));
             return VERR_INVALID_PARAMETER;
     }
@@ -322,7 +322,7 @@
         if (iErr == 0)
         {
-            *pFile = (RTFILE)fh;
-            Assert((int)*pFile == fh);
-            LogFlow(("RTFileOpen(%p:{%RTfile}, %p:{%s}, %#x): returns %Rrc\n",
+            *pFile = (RTFILE)(uintptr_t)fh;
+            Assert((intptr_t)*pFile == fh);
+            LogFlow(("RTFileOpen(%p:{%RTfile}, %p:{%s}, %#llx): returns %Rrc\n",
                      pFile, *pFile, pszFilename, pszFilename, fOpen, rc));
             return VINF_SUCCESS;
@@ -335,5 +335,5 @@
 
 
-RTR3DECL(int)  RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess)
+RTR3DECL(int)  RTFileOpenBitBucket(PRTFILE phFile, uint64_t fAccess)
 {
     AssertReturn(   fAccess == RTFILE_O_READ
@@ -345,9 +345,9 @@
 
 
-RTR3DECL(int)  RTFileClose(RTFILE File)
-{
-    if (File == NIL_RTFILE)
-        return VINF_SUCCESS;
-    if (close((int)File) == 0)
+RTR3DECL(int)  RTFileClose(RTFILE hFile)
+{
+    if (hFile == NIL_RTFILE)
+        return VINF_SUCCESS;
+    if (close(RTFileToNative(hFile)) == 0)
         return VINF_SUCCESS;
     return RTErrConvertFromErrno(errno);
@@ -357,6 +357,6 @@
 RTR3DECL(int) RTFileFromNative(PRTFILE pFile, RTHCINTPTR uNative)
 {
-    if (    uNative < 0
-        ||  (RTFILE)uNative != (RTUINTPTR)uNative)
+    AssertCompile(sizeof(uNative) == sizeof(*pFile));
+    if (uNative < 0)
     {
         AssertMsgFailed(("%p\n", uNative));
@@ -369,8 +369,8 @@
 
 
-RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE File)
-{
-    AssertReturn(File != NIL_RTFILE, -1);
-    return (RTHCINTPTR)File;
+RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE hFile)
+{
+    AssertReturn(hFile != NIL_RTFILE, -1);
+    return (intptr_t)hFile;
 }
 
@@ -411,5 +411,5 @@
 
 
-RTR3DECL(int)  RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
+RTR3DECL(int)  RTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
 {
     static const unsigned aSeekRecode[] =
@@ -438,5 +438,5 @@
     }
 
-    off_t offCurrent = lseek((int)File, (off_t)offSeek, aSeekRecode[uMethod]);
+    off_t offCurrent = lseek(RTFileToNative(hFile), (off_t)offSeek, aSeekRecode[uMethod]);
     if (offCurrent != ~0)
     {
@@ -449,5 +449,5 @@
 
 
-RTR3DECL(int)  RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead)
+RTR3DECL(int)  RTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead)
 {
     if (cbToRead <= 0)
@@ -457,5 +457,5 @@
      * Attempt read.
      */
-    ssize_t cbRead = read((int)File, pvBuf, cbToRead);
+    ssize_t cbRead = read(RTFileToNative(hFile), pvBuf, cbToRead);
     if (cbRead >= 0)
     {
@@ -468,5 +468,5 @@
             while ((ssize_t)cbToRead > cbRead)
             {
-                ssize_t cbReadPart = read((int)File, (char*)pvBuf + cbRead, cbToRead - cbRead);
+                ssize_t cbReadPart = read(RTFileToNative(hFile), (char*)pvBuf + cbRead, cbToRead - cbRead);
                 if (cbReadPart <= 0)
                 {
@@ -485,5 +485,5 @@
 
 
-RTR3DECL(int)  RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
+RTR3DECL(int)  RTFileWrite(RTFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
 {
     if (cbToWrite <= 0)
@@ -493,5 +493,5 @@
      * Attempt write.
      */
-    ssize_t cbWritten = write((int)File, pvBuf, cbToWrite);
+    ssize_t cbWritten = write(RTFileToNative(hFile), pvBuf, cbToWrite);
     if (cbWritten >= 0)
     {
@@ -504,5 +504,5 @@
             while ((ssize_t)cbToWrite > cbWritten)
             {
-                ssize_t cbWrittenPart = write((int)File, (const char *)pvBuf + cbWritten, cbToWrite - cbWritten);
+                ssize_t cbWrittenPart = write(RTFileToNative(hFile), (const char *)pvBuf + cbWritten, cbToWrite - cbWritten);
                 if (cbWrittenPart <= 0)
                     return RTErrConvertFromErrno(errno);
@@ -516,5 +516,5 @@
 
 
-RTR3DECL(int)  RTFileSetSize(RTFILE File, uint64_t cbSize)
+RTR3DECL(int)  RTFileSetSize(RTFILE hFile, uint64_t cbSize)
 {
     /*
@@ -529,5 +529,5 @@
 
 #if defined(_MSC_VER) || (defined(RT_OS_OS2) && (!defined(__INNOTEK_LIBC__) || __INNOTEK_LIBC__ < 0x006))
-    if (chsize((int)File, (off_t)cbSize) == 0)
+    if (chsize(RTFileToNative(hFile), (off_t)cbSize) == 0)
 #else
     /* This relies on a non-standard feature of FreeBSD, Linux, and OS/2
@@ -535,5 +535,5 @@
      * than the file.)
      */
-    if (ftruncate((int)File, (off_t)cbSize) == 0)
+    if (ftruncate(RTFileToNative(hFile), (off_t)cbSize) == 0)
 #endif
         return VINF_SUCCESS;
@@ -542,8 +542,8 @@
 
 
-RTR3DECL(int)   RTFileGetSize(RTFILE File, uint64_t *pcbSize)
+RTR3DECL(int)   RTFileGetSize(RTFILE hFile, uint64_t *pcbSize)
 {
     struct stat st;
-    if (!fstat((int)File, &st))
+    if (!fstat(RTFileToNative(hFile), &st))
     {
         *pcbSize = st.st_size;
@@ -554,13 +554,5 @@
 
 
-/**
- * Determine the maximum file size.
- *
- * @returns IPRT status code.
- * @param   File        Handle to the file.
- * @param   pcbMax      Where to store the max file size.
- * @see     RTFileGetMaxSize.
- */
-RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax)
+RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax)
 {
     /*
@@ -568,5 +560,5 @@
      */
     uint64_t offOld;
-    int rc = RTFileSeek(File, 0, RTFILE_SEEK_CURRENT, &offOld);
+    int rc = RTFileSeek(hFile, 0, RTFILE_SEEK_CURRENT, &offOld);
     if (RT_FAILURE(rc))
         return rc;
@@ -588,8 +580,8 @@
             if (pcbMax)
                 *pcbMax = offLow;
-            return RTFileSeek(File, offOld, RTFILE_SEEK_BEGIN, NULL);
-        }
-
-        rc = RTFileSeek(File, offLow + cbInterval, RTFILE_SEEK_BEGIN, NULL);
+            return RTFileSeek(hFile, offOld, RTFILE_SEEK_BEGIN, NULL);
+        }
+
+        rc = RTFileSeek(hFile, offLow + cbInterval, RTFILE_SEEK_BEGIN, NULL);
         if (RT_FAILURE(rc))
             offHigh = offLow + cbInterval;
@@ -600,9 +592,9 @@
 
 
-RTR3DECL(bool) RTFileIsValid(RTFILE File)
-{
-    if (File != NIL_RTFILE)
-    {
-        int fFlags = fcntl(File, F_GETFD);
+RTR3DECL(bool) RTFileIsValid(RTFILE hFile)
+{
+    if (hFile != NIL_RTFILE)
+    {
+        int fFlags = fcntl(RTFileToNative(hFile), F_GETFD);
         if (fFlags >= 0)
             return true;
@@ -612,7 +604,7 @@
 
 
-RTR3DECL(int)  RTFileFlush(RTFILE File)
-{
-    if (fsync((int)File))
+RTR3DECL(int)  RTFileFlush(RTFILE hFile)
+{
+    if (fsync(RTFileToNative(hFile)))
         return RTErrConvertFromErrno(errno);
     return VINF_SUCCESS;
@@ -620,7 +612,7 @@
 
 
-RTR3DECL(int) RTFileIoCtl(RTFILE File, unsigned long ulRequest, void *pvData, unsigned cbData, int *piRet)
-{
-    int rc = ioctl((int)File, ulRequest, pvData);
+RTR3DECL(int) RTFileIoCtl(RTFILE hFile, unsigned long ulRequest, void *pvData, unsigned cbData, int *piRet)
+{
+    int rc = ioctl(RTFileToNative(hFile), ulRequest, pvData);
     if (piRet)
         *piRet = rc;
@@ -629,5 +621,5 @@
 
 
-RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode)
+RTR3DECL(int) RTFileSetMode(RTFILE hFile, RTFMODE fMode)
 {
     /*
@@ -638,8 +630,8 @@
         return VERR_INVALID_PARAMETER;
 
-    if (fchmod((int)File, fMode & RTFS_UNIX_MASK))
+    if (fchmod(RTFileToNative(hFile), fMode & RTFS_UNIX_MASK))
     {
         int rc = RTErrConvertFromErrno(errno);
-        Log(("RTFileSetMode(%RTfile,%RTfmode): returns %Rrc\n", File, fMode, rc));
+        Log(("RTFileSetMode(%RTfile,%RTfmode): returns %Rrc\n", hFile, fMode, rc));
         return rc;
     }
Index: /trunk/src/VBox/Runtime/r3/posix/fileio2-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/fileio2-posix.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/posix/fileio2-posix.cpp	(revision 37596)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -69,19 +69,11 @@
 
 
-RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
+RTR3DECL(int) RTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
 {
     /*
      * Validate input.
      */
-    if (File == NIL_RTFILE)
-    {
-        AssertMsgFailed(("Invalid File=%RTfile\n", File));
-        return VERR_INVALID_PARAMETER;
-    }
-    if (!pObjInfo)
-    {
-        AssertMsgFailed(("Invalid pObjInfo=%p\n", pObjInfo));
-        return VERR_INVALID_PARAMETER;
-    }
+    AssertReturn(hFile != NIL_RTFILE, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pObjInfo, VERR_INVALID_PARAMETER);
     if (    enmAdditionalAttribs < RTFSOBJATTRADD_NOTHING
         ||  enmAdditionalAttribs > RTFSOBJATTRADD_LAST)
@@ -95,8 +87,8 @@
      */
     struct stat Stat;
-    if (fstat((int)File, &Stat))
+    if (fstat(RTFileToNative(hFile), &Stat))
     {
         int rc = RTErrConvertFromErrno(errno);
-        Log(("RTFileQueryInfo(%RTfile,,%d): returns %Rrc\n", File, enmAdditionalAttribs, rc));
+        Log(("RTFileQueryInfo(%RTfile,,%d): returns %Rrc\n", hFile, enmAdditionalAttribs, rc));
         return rc;
     }
@@ -135,10 +127,10 @@
     }
 
-    LogFlow(("RTFileQueryInfo(%RTfile,,%d): returns VINF_SUCCESS\n", File, enmAdditionalAttribs));
+    LogFlow(("RTFileQueryInfo(%RTfile,,%d): returns VINF_SUCCESS\n", hFile, enmAdditionalAttribs));
     return VINF_SUCCESS;
 }
 
 
-RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
+RTR3DECL(int) RTFileSetTimes(RTFILE hFile, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
                              PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)
 {
@@ -163,5 +155,5 @@
     {
         RTFSOBJINFO ObjInfo;
-        int rc = RTFileQueryInfo(File, &ObjInfo, RTFSOBJATTRADD_UNIX);
+        int rc = RTFileQueryInfo(hFile, &ObjInfo, RTFSOBJATTRADD_UNIX);
         if (RT_FAILURE(rc))
             return rc;
@@ -170,8 +162,8 @@
     }
 
-    if (futimes((int)File, aTimevals))
+    if (futimes(RTFileToNative(hFile), aTimevals))
     {
         int rc = RTErrConvertFromErrno(errno);
-        Log(("RTFileSetTimes(%RTfile,%p,%p,,): returns %Rrc\n", File, pAccessTime, pModificationTime, rc));
+        Log(("RTFileSetTimes(%RTfile,%p,%p,,): returns %Rrc\n", hFile, pAccessTime, pModificationTime, rc));
         return rc;
     }
Index: /trunk/src/VBox/Runtime/r3/posix/filelock-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/filelock-posix.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/posix/filelock-posix.cpp	(revision 37596)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -50,5 +50,5 @@
 
 
-RTR3DECL(int)  RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int)  RTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
 {
     Assert(offLock >= 0);
@@ -83,5 +83,5 @@
 
     Assert(RTFILE_LOCK_WAIT);
-    if (fcntl(File, (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0)
+    if (fcntl(RTFileToNative(hFile), (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0)
         return VINF_SUCCESS;
 
@@ -95,12 +95,12 @@
 
 
-RTR3DECL(int)  RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int)  RTFileChangeLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
 {
     /** @todo We never returns VERR_FILE_NOT_LOCKED for now. */
-    return RTFileLock(File, fLock, offLock, cbLock);
+    return RTFileLock(hFile, fLock, offLock, cbLock);
 }
 
 
-RTR3DECL(int)  RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int)  RTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock)
 {
     Assert(offLock >= 0);
@@ -126,5 +126,5 @@
     fl.l_pid    = 0;
 
-    if (fcntl(File, F_SETLK, &fl) >= 0)
+    if (fcntl(RTFileToNative(hFile), F_SETLK, &fl) >= 0)
         return VINF_SUCCESS;
 
Index: /trunk/src/VBox/Runtime/r3/posix/rand-posix.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/posix/rand-posix.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/posix/rand-posix.cpp	(revision 37596)
@@ -79,5 +79,5 @@
     pThis->u32Magic = ~RTRANDINT_MAGIC;
     int fd = pThis->u.File.hFile;
-    pThis->u.File.hFile = NIL_RTFILE;
+    pThis->u.File.hFile = -1;
     RTMemFree(pThis);
     close(fd);
Index: /trunk/src/VBox/Runtime/r3/win/fileaio-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/fileaio-win.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/win/fileaio-win.cpp	(revision 37596)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -189,5 +189,5 @@
 
     pReqInt->enmTransferDirection  = enmTransferDirection;
-    pReqInt->hFile                 = (HANDLE)hFile;
+    pReqInt->hFile                 = RTFileToNative(hFile);
     pReqInt->Overlapped.Offset     = (DWORD)(off & 0xffffffff);
     pReqInt->Overlapped.OffsetHigh = (DWORD)(off >> 32);
@@ -318,5 +318,5 @@
     RTFILEAIOCTX_VALID_RETURN(pCtxInt);
 
-    HANDLE hTemp = CreateIoCompletionPort((HANDLE)hFile, pCtxInt->hIoCompletionPort, 0, 1);
+    HANDLE hTemp = CreateIoCompletionPort(RTFileToNative(hFile), pCtxInt->hIoCompletionPort, 0, 1);
     if (hTemp != pCtxInt->hIoCompletionPort)
         rc = RTErrConvertFromWin32(GetLastError());
Index: /trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/fileio-win.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/win/fileio-win.cpp	(revision 37596)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -55,10 +55,10 @@
  *
  * @returns Success indicator. Extended error information obtainable using GetLastError().
- * @param   File        Filehandle.
+ * @param   hFile       Filehandle.
  * @param   offSeek     Offset to seek.
  * @param   poffNew     Where to store the new file offset. NULL allowed.
  * @param   uMethod     Seek method. (The windows one!)
  */
-DECLINLINE(bool) MySetFilePointer(RTFILE File, uint64_t offSeek, uint64_t *poffNew, unsigned uMethod)
+DECLINLINE(bool) MySetFilePointer(RTFILE hFile, uint64_t offSeek, uint64_t *poffNew, unsigned uMethod)
 {
     bool            fRc;
@@ -69,5 +69,5 @@
     if (off.LowPart != INVALID_SET_FILE_POINTER)
     {
-        off.LowPart = SetFilePointer((HANDLE)File, off.LowPart, &off.HighPart, uMethod);
+        off.LowPart = SetFilePointer((HANDLE)RTFileToNative(hFile), off.LowPart, &off.HighPart, uMethod);
         fRc = off.LowPart != INVALID_SET_FILE_POINTER;
     }
@@ -75,9 +75,9 @@
     {
         SetLastError(NO_ERROR);
-        off.LowPart = SetFilePointer((HANDLE)File, off.LowPart, &off.HighPart, uMethod);
+        off.LowPart = SetFilePointer(RTFileToNative(hFile), off.LowPart, &off.HighPart, uMethod);
         fRc = GetLastError() == NO_ERROR;
     }
 #else
-    fRc = SetFilePointerEx((HANDLE)File, off, &off, uMethod);
+    fRc = SetFilePointerEx((HANDLE)RTFileToNative(hFile), off, &off, uMethod);
 #endif
     if (fRc && poffNew)
@@ -92,9 +92,9 @@
  *
  * @returns true for file size limit exceeded.
- * @param   File        Filehandle.
+ * @param   hFile       Filehandle.
  * @param   offSeek     Offset to seek.
  * @param   uMethod     The seek method.
  */
-DECLINLINE(bool) IsBeyondLimit(RTFILE File, uint64_t offSeek, unsigned uMethod)
+DECLINLINE(bool) IsBeyondLimit(RTFILE hFile, uint64_t offSeek, unsigned uMethod)
 {
     bool fIsBeyondLimit = false;
@@ -108,10 +108,10 @@
  * file seeking, only at the time of writing (and some other odd ones we cannot make use of). */
     uint64_t offCurrent;
-    if (MySetFilePointer(File, 0, &offCurrent, FILE_CURRENT))
-    {
-        if (!MySetFilePointer(File, offSeek, NULL, uMethod))
+    if (MySetFilePointer(hFile, 0, &offCurrent, FILE_CURRENT))
+    {
+        if (!MySetFilePointer(hFile, offSeek, NULL, uMethod))
             fIsBeyondLimit = GetLastError() == ERROR_SEEK;
         else /* Restore file pointer on success. */
-            MySetFilePointer(File, offCurrent, NULL, FILE_BEGIN);
+            MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN);
     }
 
@@ -135,12 +135,12 @@
 
 
-RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE File)
-{
-    AssertReturn(File != NIL_RTFILE, (RTHCINTPTR)INVALID_HANDLE_VALUE);
-    return (RTHCINTPTR)File;
-}
-
-
-RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint32_t fOpen)
+RTR3DECL(RTHCINTPTR) RTFileToNative(RTFILE hFile)
+{
+    AssertReturn(hFile != NIL_RTFILE, (RTHCINTPTR)INVALID_HANDLE_VALUE);
+    return (RTHCINTPTR)hFile;
+}
+
+
+RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, uint64_t fOpen)
 {
     /*
@@ -186,5 +186,5 @@
             break;
         default:
-            AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+            AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
             return VERR_INVALID_PARAMETER;
     }
@@ -207,5 +207,5 @@
             break;
         default:
-            AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+            AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
             return VERR_INVALID_PARAMETER;
     }
@@ -228,5 +228,5 @@
                 case RTFILE_O_READWRITE:     dwDesiredAccess |= FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; break;
                 default:
-                    AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+                    AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
                     return VERR_INVALID_PARAMETER;
             }
@@ -246,5 +246,5 @@
         case RTFILE_O_DENY_NOT_DELETE | RTFILE_O_DENY_READWRITE:dwShareMode = FILE_SHARE_DELETE; break;
         default:
-            AssertMsgFailed(("Impossible fOpen=%#x\n", fOpen));
+            AssertMsgFailed(("Impossible fOpen=%#llx\n", fOpen));
             return VERR_INVALID_PARAMETER;
     }
@@ -329,5 +329,5 @@
 
 
-RTR3DECL(int)  RTFileOpenBitBucket(PRTFILE phFile, uint32_t fAccess)
+RTR3DECL(int)  RTFileOpenBitBucket(PRTFILE phFile, uint64_t fAccess)
 {
     AssertReturn(   fAccess == RTFILE_O_READ
@@ -339,9 +339,9 @@
 
 
-RTR3DECL(int)  RTFileClose(RTFILE File)
-{
-    if (File == NIL_RTFILE)
-        return VINF_SUCCESS;
-    if (CloseHandle((HANDLE)File))
+RTR3DECL(int)  RTFileClose(RTFILE hFile)
+{
+    if (hFile == NIL_RTFILE)
+        return VINF_SUCCESS;
+    if (CloseHandle((HANDLE)RTFileToNative(hFile)))
         return VINF_SUCCESS;
     return RTErrConvertFromWin32(GetLastError());
@@ -372,5 +372,5 @@
 
 
-RTR3DECL(int)  RTFileSeek(RTFILE File, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
+RTR3DECL(int)  RTFileSeek(RTFILE hFile, int64_t offSeek, unsigned uMethod, uint64_t *poffActual)
 {
     static ULONG aulSeekRecode[] =
@@ -393,5 +393,5 @@
      * Execute the seek.
      */
-    if (MySetFilePointer(File, offSeek, poffActual, aulSeekRecode[uMethod]))
+    if (MySetFilePointer(hFile, offSeek, poffActual, aulSeekRecode[uMethod]))
         return VINF_SUCCESS;
     return RTErrConvertFromWin32(GetLastError());
@@ -399,5 +399,5 @@
 
 
-RTR3DECL(int)  RTFileRead(RTFILE File, void *pvBuf, size_t cbToRead, size_t *pcbRead)
+RTR3DECL(int)  RTFileRead(RTFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead)
 {
     if (cbToRead <= 0)
@@ -407,5 +407,5 @@
 
     ULONG cbRead = 0;
-    if (ReadFile((HANDLE)File, pvBuf, cbToReadAdj, &cbRead, NULL))
+    if (ReadFile((HANDLE)RTFileToNative(hFile), pvBuf, cbToReadAdj, &cbRead, NULL))
     {
         if (pcbRead)
@@ -418,5 +418,5 @@
             {
                 ULONG cbReadPart = 0;
-                if (!ReadFile((HANDLE)File, (char*)pvBuf + cbRead, cbToReadAdj - cbRead, &cbReadPart, NULL))
+                if (!ReadFile((HANDLE)RTFileToNative(hFile), (char*)pvBuf + cbRead, cbToReadAdj - cbRead, &cbReadPart, NULL))
                     return RTErrConvertFromWin32(GetLastError());
                 if (cbReadPart == 0)
@@ -446,5 +446,5 @@
             ULONG cbToRead   = RT_MIN(cbChunk, cbToReadAdj - cbRead);
             ULONG cbReadPart = 0;
-            if (!ReadFile((HANDLE)File, (char *)pvBuf + cbRead, cbToRead, &cbReadPart, NULL))
+            if (!ReadFile((HANDLE)RTFileToNative(hFile), (char *)pvBuf + cbRead, cbToRead, &cbReadPart, NULL))
             {
                 /* If we failed because the buffer is too big, shrink it and
@@ -478,5 +478,5 @@
 
 
-RTR3DECL(int)  RTFileWrite(RTFILE File, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
+RTR3DECL(int)  RTFileWrite(RTFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
 {
     if (cbToWrite <= 0)
@@ -486,5 +486,5 @@
 
     ULONG cbWritten = 0;
-    if (WriteFile((HANDLE)File, pvBuf, cbToWriteAdj, &cbWritten, NULL))
+    if (WriteFile((HANDLE)RTFileToNative(hFile), pvBuf, cbToWriteAdj, &cbWritten, NULL))
     {
         if (pcbWritten)
@@ -497,9 +497,10 @@
             {
                 ULONG cbWrittenPart = 0;
-                if (!WriteFile((HANDLE)File, (char*)pvBuf + cbWritten, cbToWriteAdj - cbWritten, &cbWrittenPart, NULL))
+                if (!WriteFile((HANDLE)RTFileToNative(hFile), (char*)pvBuf + cbWritten,
+                               cbToWriteAdj - cbWritten, &cbWrittenPart, NULL))
                 {
                     int rc = RTErrConvertFromWin32(GetLastError());
                     if (   rc == VERR_DISK_FULL
-                        && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT)
+                        && IsBeyondLimit(RTFileToNative(hFile), cbToWriteAdj - cbWritten, FILE_CURRENT)
                        )
                         rc = VERR_FILE_TOO_BIG;
@@ -532,5 +533,5 @@
             ULONG cbToWrite     = RT_MIN(cbChunk, cbToWriteAdj - cbWritten);
             ULONG cbWrittenPart = 0;
-            if (!WriteFile((HANDLE)File, (const char *)pvBuf + cbWritten, cbToWrite, &cbWrittenPart, NULL))
+            if (!WriteFile((HANDLE)RTFileToNative(hFile), (const char *)pvBuf + cbWritten, cbToWrite, &cbWrittenPart, NULL))
             {
                 /* If we failed because the buffer is too big, shrink it and
@@ -545,5 +546,5 @@
                 int rc = RTErrConvertFromWin32(dwErr);
                 if (   rc == VERR_DISK_FULL
-                    && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT))
+                    && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT))
                     rc = VERR_FILE_TOO_BIG;
                 return rc;
@@ -566,5 +567,5 @@
     int rc = RTErrConvertFromWin32(dwErr);
     if (   rc == VERR_DISK_FULL
-        && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT))
+        && IsBeyondLimit(hFile, cbToWriteAdj - cbWritten, FILE_CURRENT))
         rc = VERR_FILE_TOO_BIG;
     return rc;
@@ -572,7 +573,7 @@
 
 
-RTR3DECL(int)  RTFileFlush(RTFILE File)
-{
-    if (!FlushFileBuffers((HANDLE)File))
+RTR3DECL(int)  RTFileFlush(RTFILE hFile)
+{
+    if (!FlushFileBuffers((HANDLE)RTFileToNative(hFile)))
     {
         int rc = GetLastError();
@@ -584,5 +585,5 @@
 
 
-RTR3DECL(int)  RTFileSetSize(RTFILE File, uint64_t cbSize)
+RTR3DECL(int)  RTFileSetSize(RTFILE hFile, uint64_t cbSize)
 {
     /*
@@ -591,13 +592,13 @@
     int         rc;
     uint64_t    offCurrent;
-    if (MySetFilePointer(File, 0, &offCurrent, FILE_CURRENT))
+    if (MySetFilePointer(hFile, 0, &offCurrent, FILE_CURRENT))
     {
         /*
          * Set new file pointer.
          */
-        if (MySetFilePointer(File, cbSize, NULL, FILE_BEGIN))
+        if (MySetFilePointer(hFile, cbSize, NULL, FILE_BEGIN))
         {
             /* set file pointer */
-            if (SetEndOfFile((HANDLE)File))
+            if (SetEndOfFile((HANDLE)RTFileToNative(hFile)))
             {
                 /*
@@ -605,5 +606,5 @@
                  * If the old pointer was beyond the new file end, ignore failure.
                  */
-                if (    MySetFilePointer(File, offCurrent, NULL, FILE_BEGIN)
+                if (    MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN)
                     ||  offCurrent > cbSize)
                     return VINF_SUCCESS;
@@ -614,5 +615,5 @@
              */
             rc = GetLastError();
-            MySetFilePointer(File, offCurrent, NULL, FILE_BEGIN);
+            MySetFilePointer(hFile, offCurrent, NULL, FILE_BEGIN);
         }
         else
@@ -626,8 +627,8 @@
 
 
-RTR3DECL(int)  RTFileGetSize(RTFILE File, uint64_t *pcbSize)
+RTR3DECL(int)  RTFileGetSize(RTFILE hFile, uint64_t *pcbSize)
 {
     ULARGE_INTEGER  Size;
-    Size.LowPart = GetFileSize((HANDLE)File, &Size.HighPart);
+    Size.LowPart = GetFileSize((HANDLE)RTFileToNative(hFile), &Size.HighPart);
     if (Size.LowPart != INVALID_FILE_SIZE)
     {
@@ -641,5 +642,5 @@
 
 
-RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE File, PRTFOFF pcbMax)
+RTR3DECL(int) RTFileGetMaxSizeEx(RTFILE hFile, PRTFOFF pcbMax)
 {
     /** @todo r=bird:
@@ -653,9 +654,9 @@
 
 
-RTR3DECL(bool) RTFileIsValid(RTFILE File)
-{
-    if (File != NIL_RTFILE)
-    {
-        DWORD dwType = GetFileType((HANDLE)File);
+RTR3DECL(bool) RTFileIsValid(RTFILE hFile)
+{
+    if (hFile != NIL_RTFILE)
+    {
+        DWORD dwType = GetFileType((HANDLE)RTFileToNative(hFile));
         switch (dwType)
         {
@@ -679,5 +680,5 @@
 #define HIGH_DWORD(u64) (((DWORD *)&u64)[1])
 
-RTR3DECL(int)  RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int)  RTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
 {
     Assert(offLock >= 0);
@@ -704,5 +705,5 @@
 
     /* Note: according to Microsoft, LockFileEx API call is available starting from NT 3.5 */
-    if (LockFileEx((HANDLE)File, dwFlags, 0, LOW_DWORD(cbLock), HIGH_DWORD(cbLock), &Overlapped))
+    if (LockFileEx((HANDLE)RTFileToNative(hFile), dwFlags, 0, LOW_DWORD(cbLock), HIGH_DWORD(cbLock), &Overlapped))
         return VINF_SUCCESS;
 
@@ -711,5 +712,5 @@
 
 
-RTR3DECL(int)  RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int)  RTFileChangeLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock)
 {
     Assert(offLock >= 0);
@@ -723,10 +724,10 @@
 
     /* Remove old lock. */
-    int rc = RTFileUnlock(File, offLock, cbLock);
+    int rc = RTFileUnlock(hFile, offLock, cbLock);
     if (RT_FAILURE(rc))
         return rc;
 
     /* Set new lock. */
-    rc = RTFileLock(File, fLock, offLock, cbLock);
+    rc = RTFileLock(hFile, fLock, offLock, cbLock);
     if (RT_SUCCESS(rc))
         return rc;
@@ -734,5 +735,5 @@
     /* Try to restore old lock. */
     unsigned fLockOld = (fLock & RTFILE_LOCK_WRITE) ? fLock & ~RTFILE_LOCK_WRITE : fLock | RTFILE_LOCK_WRITE;
-    rc = RTFileLock(File, fLockOld, offLock, cbLock);
+    rc = RTFileLock(hFile, fLockOld, offLock, cbLock);
     if (RT_SUCCESS(rc))
         return VERR_FILE_LOCK_VIOLATION;
@@ -742,9 +743,11 @@
 
 
-RTR3DECL(int)  RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)
+RTR3DECL(int)  RTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock)
 {
     Assert(offLock >= 0);
 
-    if (UnlockFile((HANDLE)File, LOW_DWORD(offLock), HIGH_DWORD(offLock), LOW_DWORD(cbLock), HIGH_DWORD(cbLock)))
+    if (UnlockFile((HANDLE)RTFileToNative(hFile),
+                   LOW_DWORD(offLock), HIGH_DWORD(offLock),
+                   LOW_DWORD(cbLock), HIGH_DWORD(cbLock)))
         return VINF_SUCCESS;
 
@@ -754,12 +757,12 @@
 
 
-RTR3DECL(int) RTFileQueryInfo(RTFILE File, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
+RTR3DECL(int) RTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
 {
     /*
      * Validate input.
      */
-    if (File == NIL_RTFILE)
-    {
-        AssertMsgFailed(("Invalid File=%RTfile\n", File));
+    if (hFile == NIL_RTFILE)
+    {
+        AssertMsgFailed(("Invalid hFile=%RTfile\n", hFile));
         return VERR_INVALID_PARAMETER;
     }
@@ -780,5 +783,5 @@
      */
     BY_HANDLE_FILE_INFORMATION Data;
-    if (!GetFileInformationByHandle((HANDLE)File, &Data))
+    if (!GetFileInformationByHandle((HANDLE)RTFileToNative(hFile), &Data))
     {
         DWORD dwErr = GetLastError();
@@ -851,5 +854,5 @@
 
 
-RTR3DECL(int) RTFileSetTimes(RTFILE File, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
+RTR3DECL(int) RTFileSetTimes(RTFILE hFile, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
                              PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)
 {
@@ -873,10 +876,10 @@
 
     int rc = VINF_SUCCESS;
-    if (!SetFileTime((HANDLE)File, pCreationTimeFT, pLastAccessTimeFT, pLastWriteTimeFT))
+    if (!SetFileTime((HANDLE)RTFileToNative(hFile), pCreationTimeFT, pLastAccessTimeFT, pLastWriteTimeFT))
     {
         DWORD Err = GetLastError();
         rc = RTErrConvertFromWin32(Err);
         Log(("RTFileSetTimes(%RTfile, %p, %p, %p, %p): SetFileTime failed with lasterr %d (%Rrc)\n",
-             File, pAccessTime, pModificationTime, pChangeTime, pBirthTime, Err, rc));
+             hFile, pAccessTime, pModificationTime, pChangeTime, pBirthTime, Err, rc));
     }
     return rc;
@@ -890,5 +893,5 @@
 
 
-RTR3DECL(int) RTFileSetMode(RTFILE File, RTFMODE fMode)
+RTR3DECL(int) RTFileSetMode(RTFILE hFile, RTFMODE fMode)
 {
     /*
@@ -900,10 +903,10 @@
 
     ULONG FileAttributes = (fMode & RTFS_DOS_MASK) >> RTFS_DOS_SHIFT;
-    int Err = rtFileNativeSetAttributes((HANDLE)File, FileAttributes);
+    int Err = rtFileNativeSetAttributes((HANDLE)hFile, FileAttributes);
     if (Err != ERROR_SUCCESS)
     {
         int rc = RTErrConvertFromWin32(Err);
         Log(("RTFileSetMode(%RTfile, %RTfmode): rtFileNativeSetAttributes (0x%08X) failed with err %d (%Rrc)\n",
-             File, fMode, FileAttributes, Err, rc));
+             hFile, fMode, FileAttributes, Err, rc));
         return rc;
     }
Index: /trunk/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp	(revision 37595)
+++ /trunk/src/VBox/Runtime/r3/win/rtFileNativeSetAttributes-win.cpp	(revision 37596)
@@ -60,5 +60,5 @@
 
     /** @todo resolve dynamically to avoid dragging in NtDll? */
-    NTSTATUS Status = NtSetInformationFile(hFile,
+    NTSTATUS Status = NtSetInformationFile(RTFileToNative(hFile),
                                            &IoStatusBlock,
                                            &Info,
Index: /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp	(revision 37595)
+++ /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp	(revision 37596)
@@ -1012,12 +1012,12 @@
          * contain dirty buffers.
          */
-        RTFILE File = NIL_RTFILE;
-
-        rc = RTFileOpen(&File, pszUri, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
+        RTFILE hFile = NIL_RTFILE;
+
+        rc = RTFileOpen(&hFile, pszUri, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
         if (RT_SUCCESS(rc))
         {
             uint64_t cbSize;
 
-            rc = pdmacFileEpNativeGetSize(File, &cbSize);
+            rc = pdmacFileEpNativeGetSize(hFile, &cbSize);
             Assert(RT_FAILURE(rc) || cbSize != 0);
 
@@ -1034,10 +1034,10 @@
 #endif
             }
-            RTFileClose(File);
+            RTFileClose(hFile);
         }
     }
 
     /* Open with final flags. */
-    rc = RTFileOpen(&pEpFile->File, pszUri, fFileFlags);
+    rc = RTFileOpen(&pEpFile->hFile, pszUri, fFileFlags);
     if ((rc == VERR_INVALID_FUNCTION) || (rc == VERR_INVALID_PARAMETER))
     {
@@ -1064,5 +1064,5 @@
 
         /* Open again. */
-        rc = RTFileOpen(&pEpFile->File, pszUri, fFileFlags);
+        rc = RTFileOpen(&pEpFile->hFile, pszUri, fFileFlags);
 
         if (RT_FAILURE(rc))
@@ -1077,5 +1077,5 @@
         pEpFile->fFlags = fFileFlags;
 
-        rc = pdmacFileEpNativeGetSize(pEpFile->File, (uint64_t *)&pEpFile->cbFile);
+        rc = pdmacFileEpNativeGetSize(pEpFile->hFile, (uint64_t *)&pEpFile->cbFile);
         Assert(RT_FAILURE(rc) || pEpFile->cbFile != 0);
 
@@ -1147,5 +1147,5 @@
 
         if (RT_FAILURE(rc))
-            RTFileClose(pEpFile->File);
+            RTFileClose(pEpFile->hFile);
     }
 
@@ -1207,5 +1207,5 @@
     RTAvlrFileOffsetDestroy(pEpFile->AioMgr.pTreeRangesLocked, pdmacFileEpRangesLockedDestroy, NULL);
 
-    RTFileClose(pEpFile->File);
+    RTFileClose(pEpFile->hFile);
 
 #ifdef VBOX_WITH_STATISTICS
@@ -1301,5 +1301,5 @@
 
     ASMAtomicWriteU64(&pEpFile->cbFile, cbSize);
-    return RTFileSetSize(pEpFile->File, cbSize);
+    return RTFileSetSize(pEpFile->hFile, cbSize);
 }
 
Index: /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileFailsafe.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileFailsafe.cpp	(revision 37595)
+++ /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileFailsafe.cpp	(revision 37596)
@@ -78,5 +78,5 @@
             case PDMACTASKFILETRANSFER_FLUSH:
             {
-                rc = RTFileFlush(pEndpoint->File);
+                rc = RTFileFlush(pEndpoint->hFile);
                 break;
             }
@@ -86,5 +86,5 @@
                 if (pCurr->enmTransferType == PDMACTASKFILETRANSFER_READ)
                 {
-                    rc = RTFileReadAt(pEndpoint->File, pCurr->Off,
+                    rc = RTFileReadAt(pEndpoint->hFile, pCurr->Off,
                                       pCurr->DataSeg.pvSeg,
                                       pCurr->DataSeg.cbSeg,
@@ -96,8 +96,8 @@
                     {
                         ASMAtomicWriteU64(&pEndpoint->cbFile, pCurr->Off + pCurr->DataSeg.cbSeg);
-                        RTFileSetSize(pEndpoint->File, pCurr->Off + pCurr->DataSeg.cbSeg);
+                        RTFileSetSize(pEndpoint->hFile, pCurr->Off + pCurr->DataSeg.cbSeg);
                     }
 
-                    rc = RTFileWriteAt(pEndpoint->File, pCurr->Off,
+                    rc = RTFileWriteAt(pEndpoint->hFile, pCurr->Off,
                                        pCurr->DataSeg.pvSeg,
                                        pCurr->DataSeg.cbSeg,
Index: /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp	(revision 37595)
+++ /trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFileNormal.cpp	(revision 37596)
@@ -205,6 +205,6 @@
 
         /* Reopen the file so that the new endpoint can re-associate with the file */
-        RTFileClose(pEndpointRemove->File);
-        int rc = RTFileOpen(&pEndpointRemove->File, pEndpointRemove->Core.pszUri, pEndpointRemove->fFlags);
+        RTFileClose(pEndpointRemove->hFile);
+        int rc = RTFileOpen(&pEndpointRemove->hFile, pEndpointRemove->Core.pszUri, pEndpointRemove->fFlags);
         AssertRC(rc);
         return false;
@@ -341,6 +341,6 @@
     while (pCurr)
     {
-        RTFileClose(pCurr->File);
-        rc = RTFileOpen(&pCurr->File, pCurr->Core.pszUri, pCurr->fFlags);
+        RTFileClose(pCurr->hFile);
+        rc = RTFileOpen(&pCurr->hFile, pCurr->Core.pszUri, pCurr->fFlags);
         AssertRC(rc);
 
@@ -390,5 +390,5 @@
     while (pCurr)
     {
-        rc = RTFileAioCtxAssociateWithFile(pAioMgr->hAioCtx, pCurr->File);
+        rc = RTFileAioCtxAssociateWithFile(pAioMgr->hAioCtx, pCurr->hFile);
         AssertRC(rc);
 
@@ -790,13 +790,13 @@
             {
                 ASMAtomicWriteU64(&pEndpoint->cbFile, pTask->Off + pTask->DataSeg.cbSeg);
-                RTFileSetSize(pEndpoint->File, pTask->Off + pTask->DataSeg.cbSeg);
-            }
-
-            rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->File,
+                RTFileSetSize(pEndpoint->hFile, pTask->Off + pTask->DataSeg.cbSeg);
+            }
+
+            rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->hFile,
                                           pTask->Off, pTask->DataSeg.pvSeg,
                                           pTask->DataSeg.cbSeg, pTask);
         }
         else
-            rc = RTFileAioReqPrepareRead(hReq, pEndpoint->File,
+            rc = RTFileAioReqPrepareRead(hReq, pEndpoint->hFile,
                                          pTask->Off, pTask->DataSeg.pvSeg,
                                          pTask->DataSeg.cbSeg, pTask);
@@ -925,12 +925,12 @@
                 {
                     ASMAtomicWriteU64(&pEndpoint->cbFile, pTask->Off + pTask->DataSeg.cbSeg);
-                    RTFileSetSize(pEndpoint->File, pTask->Off + pTask->DataSeg.cbSeg);
-                }
-
-                rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->File,
+                    RTFileSetSize(pEndpoint->hFile, pTask->Off + pTask->DataSeg.cbSeg);
+                }
+
+                rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->hFile,
                                               offStart, pvBuf, cbToTransfer, pTask);
             }
             else
-                rc = RTFileAioReqPrepareRead(hReq, pEndpoint->File,
+                rc = RTFileAioReqPrepareRead(hReq, pEndpoint->hFile,
                                              offStart, pvBuf, cbToTransfer, pTask);
             AssertRC(rc);
@@ -1004,5 +1004,5 @@
                     LogFlow(("Flush request %#p\n", hReq));
 
-                    rc = RTFileAioReqPrepareFlush(hReq, pEndpoint->File, pCurr);
+                    rc = RTFileAioReqPrepareFlush(hReq, pEndpoint->hFile, pCurr);
                     if (RT_FAILURE(rc))
                     {
@@ -1189,5 +1189,5 @@
 
             /* Assign the completion point to this file. */
-            rc = RTFileAioCtxAssociateWithFile(pAioMgr->hAioCtx, pEndpointNew->File);
+            rc = RTFileAioCtxAssociateWithFile(pAioMgr->hAioCtx, pEndpointNew->hFile);
             fNotifyWaiter = true;
             pAioMgr->cEndpoints++;
@@ -1289,6 +1289,6 @@
         {
             /* Reopen the file so that the new endpoint can re-associate with the file */
-            RTFileClose(pEndpoint->File);
-            rc = RTFileOpen(&pEndpoint->File, pEndpoint->Core.pszUri, pEndpoint->fFlags);
+            RTFileClose(pEndpoint->hFile);
+            rc = RTFileOpen(&pEndpoint->hFile, pEndpoint->Core.pszUri, pEndpoint->fFlags);
             AssertRC(rc);
 
@@ -1472,5 +1472,5 @@
                 if (pTask->fPrefetch || pTask->enmTransferType == PDMACTASKFILETRANSFER_READ)
                 {
-                    rc = RTFileAioReqPrepareRead(hReq, pEndpoint->File, offStart,
+                    rc = RTFileAioReqPrepareRead(hReq, pEndpoint->hFile, offStart,
                                                  pbBuf, cbToTransfer, pTask);
                 }
@@ -1479,5 +1479,5 @@
                     AssertMsg(pTask->enmTransferType == PDMACTASKFILETRANSFER_WRITE,
                                   ("Invalid transfer type\n"));
-                    rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->File, offStart,
+                    rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->hFile, offStart,
                                                   pbBuf, cbToTransfer, pTask);
                 }
@@ -1507,8 +1507,8 @@
                 {
                     ASMAtomicWriteU64(&pEndpoint->cbFile, pTask->Off + pTask->DataSeg.cbSeg);
-                    RTFileSetSize(pEndpoint->File, pTask->Off + pTask->DataSeg.cbSeg);
-                }
-
-                rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->File,
+                    RTFileSetSize(pEndpoint->hFile, pTask->Off + pTask->DataSeg.cbSeg);
+                }
+
+                rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->hFile,
                                               offStart, pTask->pvBounceBuffer, cbToTransfer, pTask);
                 AssertRC(rc);
Index: /trunk/src/VBox/VMM/include/PDMAsyncCompletionFileInternal.h
===================================================================
--- /trunk/src/VBox/VMM/include/PDMAsyncCompletionFileInternal.h	(revision 37595)
+++ /trunk/src/VBox/VMM/include/PDMAsyncCompletionFileInternal.h	(revision 37596)
@@ -327,5 +327,5 @@
     unsigned                               fFlags;
     /** File handle. */
-    RTFILE                                 File;
+    RTFILE                                 hFile;
     /**
      * Real size of the file. Only updated if
