Index: trunk/src/VBox/Runtime/common/zip/cpiovfs.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/cpiovfs.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/cpiovfs.cpp	(revision 100908)
@@ -484,5 +484,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipCpioFssIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipCpioFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PRTZIPCPIOIOSTREAM pThis = (PRTZIPCPIOIOSTREAM)pvThis;
@@ -518,4 +518,6 @@
     int rc = RTVfsIoStrmReadAt(pThis->hVfsIos, pThis->offStart + off, pSgBuf->paSegs[0].pvSeg, cbToRead, fBlocking, pcbRead);
     pThis->offFile = off + *pcbRead;
+    RTSgBufAdvance(pSgBuf, *pcbRead);
+
     if (pThis->offFile >= pThis->cbFile)
     {
@@ -532,5 +534,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) rtZipCpioFssIos_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipCpioFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     /* Cannot write to a read-only I/O stream. */
Index: trunk/src/VBox/Runtime/common/zip/gzipvfs.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/gzipvfs.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/gzipvfs.cpp	(revision 100908)
@@ -289,6 +289,8 @@
  * @param   fBlocking       Whether to block or not.
  * @param   pcbRead         Where to store the number of bytes actually read.
- */
-static int rtZipGzip_ReadOneSeg(PRTZIPGZIPSTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead)
+ * @param   pSgBuf          The segment buffer descriptor, for advancing.
+ */
+static int rtZipGzip_ReadOneSeg(PRTZIPGZIPSTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking,
+                                size_t *pcbRead, PRTSGBUF pSgBuf)
 {
     /*
@@ -324,4 +326,5 @@
         {
             size_t cbReadIn = ~(size_t)0;
+            RTSgBufReset(&pThis->SgBuf);
             rc = RTVfsIoStrmSgRead(pThis->hVfsIos, -1 /*off*/, &pThis->SgBuf, fBlocking, &cbReadIn);
             if (rc != VINF_SUCCESS)
@@ -375,4 +378,5 @@
     if (pcbRead)
         *pcbRead      = cbRead;
+    RTSgBufAdvance(pSgBuf, cbRead);
 
     return rc;
@@ -383,5 +387,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipGzip_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipGzip_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PRTZIPGZIPSTREAM pThis = (PRTZIPGZIPSTREAM)pvThis;
@@ -392,5 +396,5 @@
     AssertReturn(off == -1 || off == pThis->offStream , VERR_INVALID_PARAMETER);
 
-    return rtZipGzip_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead);
+    return rtZipGzip_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead, pSgBuf);
 }
 
@@ -517,5 +521,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) rtZipGzip_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipGzip_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     PRTZIPGZIPSTREAM pThis = (PRTZIPGZIPSTREAM)pvThis;
@@ -554,4 +558,5 @@
     if (pcbWritten)
         *pcbWritten = cbWritten;
+    RTSgBufAdvance(pSgBuf, cbWritten);
     return rc;
 }
Index: trunk/src/VBox/Runtime/common/zip/lzmavfs.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/lzmavfs.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/lzmavfs.cpp	(revision 100908)
@@ -215,6 +215,8 @@
  * @param   fBlocking       Whether to block or not.
  * @param   pcbRead         Where to store the number of bytes actually read.
- */
-static int rtZipLzma_ReadOneSeg(PRTZIPLZMASTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead)
+ * @param   pSgBuf          The S/G buffer descriptor, for advancing.
+ */
+static int rtZipLzma_ReadOneSeg(PRTZIPLZMASTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking,
+                                size_t *pcbRead, PRTSGBUF pSgBuf)
 {
     /*
@@ -243,4 +245,5 @@
         {
             size_t cbReadIn = ~(size_t)0;
+            RTSgBufReset(&pThis->SgBuf);
             rc = RTVfsIoStrmSgRead(pThis->hVfsIos, -1 /*off*/, &pThis->SgBuf, fBlocking, &cbReadIn);
             if (rc != VINF_SUCCESS)
@@ -298,4 +301,5 @@
     if (pcbRead)
         *pcbRead      = cbRead;
+    RTSgBufAdvance(pSgBuf, cbRead);
 
     return rc;
@@ -306,5 +310,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipLzma_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipLzma_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PRTZIPLZMASTREAM pThis = (PRTZIPLZMASTREAM)pvThis;
@@ -315,5 +319,5 @@
     AssertReturn(off == -1 || off == pThis->offStream , VERR_INVALID_PARAMETER);
 
-    return rtZipLzma_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead);
+    return rtZipLzma_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead, pSgBuf);
 }
 
@@ -440,5 +444,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) rtZipLzma_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipLzma_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     PRTZIPLZMASTREAM pThis = (PRTZIPLZMASTREAM)pvThis;
@@ -477,4 +481,6 @@
     if (pcbWritten)
         *pcbWritten = cbWritten;
+    RTSgBufAdvance(pSgBuf, cbWritten);
+
     return rc;
 }
Index: trunk/src/VBox/Runtime/common/zip/pkzip.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/pkzip.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/pkzip.cpp	(revision 100908)
@@ -99,5 +99,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) memFssIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) memFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PMEMIOSTREAM pThis = (PMEMIOSTREAM)pvThis;
@@ -123,4 +123,5 @@
     if (pcbRead)
         *pcbRead = cbToRead;
+    RTSgBufAdvance(pSgBuf, cbToRead);
 
     return VINF_SUCCESS;
@@ -130,5 +131,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) memFssIos_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) memFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     RT_NOREF_PV(pvThis); RT_NOREF_PV(off); RT_NOREF_PV(pSgBuf); RT_NOREF_PV(fBlocking); RT_NOREF_PV(pcbWritten);
Index: trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp	(revision 100908)
@@ -907,5 +907,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipPkzipFssIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipPkzipFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PRTZIPPKZIPIOSTREAM pThis = (PRTZIPPKZIPIOSTREAM)pvThis;
@@ -986,4 +986,6 @@
     int rc = RTZipDecompress(pThis->pZip, pSgBuf->paSegs[0].pvSeg, cbToRead, pcbRead);
     pThis->offFile = off + *pcbRead;
+    RTSgBufAdvance(pSgBuf, *pcbRead);
+
     if (pThis->offFile >= pThis->cbFile)
     {
@@ -995,5 +997,5 @@
 }
 
-static DECLCALLBACK(int) rtZipPkzipFssIos_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipPkzipFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     RT_NOREF_PV(pvThis); RT_NOREF_PV(off); RT_NOREF_PV(pSgBuf); RT_NOREF_PV(fBlocking); RT_NOREF_PV(pcbWritten);
Index: trunk/src/VBox/Runtime/common/zip/tarvfs.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/tarvfs.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/tarvfs.cpp	(revision 100908)
@@ -872,5 +872,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipTarFssIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipTarFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PRTZIPTARIOSTREAM pThis = (PRTZIPTARIOSTREAM)pvThis;
@@ -906,4 +906,6 @@
     int rc = RTVfsIoStrmReadAt(pThis->hVfsIos, pThis->offStart + off, pSgBuf->paSegs[0].pvSeg, cbToRead, fBlocking, pcbRead);
     pThis->offFile = off + *pcbRead;
+    RTSgBufAdvance(pSgBuf, *pcbRead);
+
     if (pThis->offFile >= pThis->cbFile)
     {
@@ -920,5 +922,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) rtZipTarFssIos_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipTarFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     /* Cannot write to a read-only I/O stream. */
Index: trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp	(revision 100908)
@@ -753,5 +753,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipTarWriterPush_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipTarWriterPush_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     /* No read support, sorry. */
@@ -765,5 +765,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) rtZipTarWriterPush_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipTarWriterPush_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     PRTZIPTARFSSTREAMWRITERPUSH pPush   = (PRTZIPTARFSSTREAMWRITERPUSH)pvThis;
@@ -810,4 +810,5 @@
             if (pcbWritten)
                 *pcbWritten = cbWritten;
+            RTSgBufAdvance(pSgBuf, cbWritten);
         }
     }
Index: trunk/src/VBox/Runtime/common/zip/xarvfs.cpp
===================================================================
--- trunk/src/VBox/Runtime/common/zip/xarvfs.cpp	(revision 99739)
+++ trunk/src/VBox/Runtime/common/zip/xarvfs.cpp	(revision 100908)
@@ -854,5 +854,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipXarFssIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipXarFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PRTZIPXARIOSTREAM pThis = (PRTZIPXARIOSTREAM)pvThis;
@@ -918,4 +918,5 @@
     /* Update the file position. */
     pThis->offCurPos += cbActuallyRead;
+    RTSgBufAdvance(pSgBuf, cbActuallyRead);
 
     /*
@@ -963,5 +964,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) rtZipXarFssIos_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipXarFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     /* Cannot write to a read-only I/O stream. */
@@ -1226,5 +1227,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static DECLCALLBACK(int) rtZipXarFssDecompIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipXarFssDecompIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
     PRTZIPXARDECOMPIOS pThis = (PRTZIPXARDECOMPIOS)pvThis;
@@ -1243,6 +1244,7 @@
      * validate off wrt data digest updating.
      */
-    int rc = RTVfsIoStrmReadAt(pThis->hVfsIosDecompressor, off, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg,
-                               fBlocking, pcbRead);
+    size_t       cbSeg = 0;
+    void * const pvSeg = RTSgBufGetCurrentSegment(pSgBuf, ~(size_t)0, &cbSeg);
+    int rc = RTVfsIoStrmReadAt(pThis->hVfsIosDecompressor, off, pvSeg, cbSeg, fBlocking, pcbRead);
     if (RT_FAILURE(rc))
         return rc;
@@ -1251,7 +1253,9 @@
      * Hash the data.  When reaching the end match against the expected digest.
      */
-    size_t cbActuallyRead = pcbRead ? *pcbRead : pSgBuf->paSegs[0].cbSeg;
+    size_t const cbActuallyRead = pcbRead ? *pcbRead : cbSeg;
     pThis->offCurPos += cbActuallyRead;
+    RTSgBufAdvance(pSgBuf, cbActuallyRead);
     rtZipXarHashUpdate(&pThis->CtxExtracted, pThis->uHashFunExtracted, pSgBuf->paSegs[0].pvSeg, cbActuallyRead);
+
     if (rc == VINF_EOF)
     {
@@ -1295,5 +1299,5 @@
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
-static DECLCALLBACK(int) rtZipXarFssDecompIos_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
+static DECLCALLBACK(int) rtZipXarFssDecompIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
 {
     /* Cannot write to a read-only I/O stream. */
