Index: /trunk/include/iprt/vfslowlevel.h
===================================================================
--- /trunk/include/iprt/vfslowlevel.h	(revision 33866)
+++ /trunk/include/iprt/vfslowlevel.h	(revision 33867)
@@ -523,4 +523,25 @@
 /** The RTVFSIOSTREAMOPS structure version. */
 #define RTVFSIOSTREAMOPS_VERSION    RT_MAKE_U32_FROM_U8(0xff,0x5f,1,0)
+
+
+/**
+ * Creates a new VFS I/O stream handle.
+ *
+ * @returns IPRT status code
+ * @param   pIoStreamOps        The I/O stream operations.
+ * @param   cbInstance          The size of the instance data.
+ * @param   fOpen               The open flags.  The minimum is the access mask.
+ * @param   hVfs                The VFS handle to associate this file with.
+ *                              NIL_VFS is ok.
+ * @param   hSemRW              The read-write semaphore to use to protect the
+ *                              handle if this differs from the one the VFS
+ *                              uses.  NIL_RTSEMRW is ok if no locking is
+ *                              desired.
+ * @param   phVfsIos            Where to return the new handle.
+ * @param   ppvInstance         Where to return the pointer to the instance data
+ *                              (size is @a cbInstance).
+ */
+RTDECL(int) RTVfsNewStream(PCRTVFSIOSTREAMOPS pIoStreamOps, size_t cbInstance, uint32_t fOpen, RTVFS hVfs, RTSEMRW hSemRW,
+                           PRTVFSIOSTREAM phVfsIos, void **ppvInstance);
 
 
Index: /trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp	(revision 33866)
+++ /trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp	(revision 33867)
@@ -530,4 +530,5 @@
     AssertPtr(pPath);
     AssertPtr(ppVfsParentDir);
+    *ppVfsParentDir = NULL;
     AssertReturn(pPath->cComponents > 0, VERR_INTERNAL_ERROR_3);
 
@@ -776,4 +777,52 @@
  */
 
+RTDECL(int) RTVfsNewIoStream(PCRTVFSIOSTREAMOPS pIoStreamOps, size_t cbInstance, uint32_t fOpen, RTVFS hVfs, RTSEMRW hSemRW,
+                             PRTVFSIOSTREAM phVfsIos, void **ppvInstance)
+{
+    /*
+     * Validate the input, be extra strict in strict builds.
+     */
+    AssertPtr(pIoStreamOps);
+    AssertReturn(pIoStreamOps->uVersion   == RTVFSIOSTREAMOPS_VERSION, VERR_VERSION_MISMATCH);
+    AssertReturn(pIoStreamOps->uEndMarker == RTVFSIOSTREAMOPS_VERSION, VERR_VERSION_MISMATCH);
+    Assert(!pIoStreamOps->fReserved);
+    Assert(cbInstance > 0);
+    Assert(fOpen & RTFILE_O_ACCESS_MASK);
+    AssertPtr(ppvInstance);
+    AssertPtr(phVfsIos);
+
+    RTVFSINTERNAL *pVfs = NULL;
+    if (hVfs == NIL_RTVFS)
+    {
+        pVfs = hVfs;
+        AssertPtrReturn(pVfs, VERR_INVALID_HANDLE);
+        AssertReturn(pVfs->uMagic == RTVFS_MAGIC, VERR_INVALID_HANDLE);
+    }
+
+    /*
+     * Allocate the handle + instance data.
+     */
+    size_t const cbThis = RT_ALIGN_Z(sizeof(RTVFSIOSTREAMINTERNAL), RTVFS_INST_ALIGNMENT)
+                        + RT_ALIGN_Z(cbInstance, RTVFS_INST_ALIGNMENT);
+    RTVFSIOSTREAMINTERNAL *pThis = (RTVFSIOSTREAMINTERNAL *)RTMemAllocZ(cbThis);
+    if (!pThis)
+        return VERR_NO_MEMORY;
+
+    pThis->uMagic   = RTVFSIOSTREAM_MAGIC;
+    pThis->fFlags   = fOpen;
+    pThis->pvThis   = (char *)pThis + RT_ALIGN_Z(sizeof(*pThis), RTVFS_INST_ALIGNMENT);
+    pThis->pOps     = pIoStreamOps;
+    pThis->hSemRW   = hSemRW != NIL_RTSEMRW ? hSemRW : pVfs ? pVfs->hSemRW : NIL_RTSEMRW;
+    pThis->hVfs     = hVfs;
+    pThis->cRefs    = 1;
+    if (hVfs != NIL_RTVFS)
+        rtVfsRetainVoid(&pVfs->cRefs);
+
+    *phVfsIos    = pThis;
+    *ppvInstance = pThis->pvThis;
+    return VINF_SUCCESS;
+}
+
+
 RTDECL(uint32_t)    RTVfsIoStrmRetain(RTVFSIOSTREAM hVfsIos)
 {
