Index: trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
===================================================================
--- trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp	(revision 78942)
+++ trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp	(revision 78943)
@@ -417,4 +417,5 @@
 }
 
+#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
 /**
  * Reads the actual meta data from the host.
@@ -675,265 +676,4 @@
     return rc;
 }
-
-#if 0
-/**
- * Helper function for receiving URI data from the host. Do not call directly.
- * This function also will take care of the file creation / locking on the guest.
- *
- * @returns IPRT status code.
- * @param   idClient            The client id returned by VbglR3ClipboardConnect().
- * @param   pDataHdr            Data header to use. Needed for accounting.
- */
-static int vbglR3ClipboardReadURIData(HGCMCLIENTID idClient, PVBOXCLIPBOARDDATAHDR pDataHdr)
-{
-    AssertPtrReturn(pDataHdr,      VERR_INVALID_POINTER);
-
-    RT_NOREF(idClient, pDataHdr);
-
-#if 0
-
-    /* Only count the raw data minus the already received meta data. */
-    Assert(pDataHdr->cbTotal >= pDataHdr->cbMeta);
-    uint64_t cbToRecvBytes = pDataHdr->cbTotal - pDataHdr->cbMeta;
-    uint64_t cToRecvObjs   = pDataHdr->cObjects;
-
-    LogFlowFunc(("cbToRecvBytes=%RU64, cToRecvObjs=%RU64, (cbTotal=%RU64, cbMeta=%RU32)\n",
-                 cbToRecvBytes, cToRecvObjs, pDataHdr->cbTotal, pDataHdr->cbMeta));
-
-    /* Anything to do at all? */
-    /* Note: Do not check for cbToRecvBytes == 0 here, as this might be just
-     *       a bunch of 0-byte files to be transferred. */
-    if (!cToRecvObjs)
-        return VINF_SUCCESS;
-
-    /*
-     * Allocate temporary chunk buffer.
-     */
-    uint32_t cbChunkMax = VBOX_SHARED_CLIPBOARD_MAX_CHUNK_SIZE;
-    void *pvChunk = RTMemAlloc(cbChunkMax);
-    if (!pvChunk)
-        return VERR_NO_MEMORY;
-    uint32_t cbChunkRead   = 0;
-
-    uint64_t cbFileSize    = 0; /* Total file size (in bytes). */
-    uint64_t cbFileWritten = 0; /* Written bytes. */
-
-    char *pszDropDir = NULL;
-
-    int rc;
-
-    /*
-     * Enter the main loop of retieving files + directories.
-     */
-    SharedClipboardURIObject objFile(SharedClipboardURIObject::Type_File);
-
-    char szPathName[RTPATH_MAX] = { 0 };
-    uint32_t cbPathName = 0;
-    uint32_t fFlags     = 0;
-    uint32_t fMode      = 0;
-
-    do
-    {
-        LogFlowFunc(("Wating for new message ...\n"));
-
-        uint32_t uNextMsg;
-        uint32_t cNextParms;
-        rc = vbglR3DnDGetNextMsgType(idClient, &uNextMsg, &cNextParms, true /* fWait */);
-        if (RT_SUCCESS(rc))
-        {
-            LogFlowFunc(("uNextMsg=%RU32, cNextParms=%RU32\n", uNextMsg, cNextParms));
-
-            switch (uNextMsg)
-            {
-                case HOST_DND_HG_SND_DIR:
-                {
-                    rc = vbglR3ClipboardReadDir(idClient,
-                                                szPathName,
-                                                sizeof(szPathName),
-                                                &cbPathName,
-                                                &fMode);
-                    LogFlowFunc(("HOST_DND_HG_SND_DIR pszPathName=%s, cbPathName=%RU32, fMode=0x%x, rc=%Rrc\n",
-                                 szPathName, cbPathName, fMode, rc));
-
-                    char *pszPathAbs = RTPathJoinA(pszDropDir, szPathName);
-                    if (pszPathAbs)
-                    {
-#ifdef RT_OS_WINDOWS
-                        uint32_t fCreationMode = (fMode & RTFS_DOS_MASK) | RTFS_DOS_NT_NORMAL;
-#else
-                        uint32_t fCreationMode = (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRWXU;
-#endif
-                        rc = RTDirCreate(pszPathAbs, fCreationMode, 0);
-                        /*if (RT_SUCCESS(rc))
-                            rc = pDroppedFiles->AddDir(pszPathAbs);*/
-
-                        if (RT_SUCCESS(rc))
-                        {
-                            Assert(cToRecvObjs);
-                            cToRecvObjs--;
-                        }
-
-                        RTStrFree(pszPathAbs);
-                    }
-                    else
-                        rc = VERR_NO_MEMORY;
-                    break;
-                }
-                case HOST_DND_HG_SND_FILE_HDR:
-                case HOST_DND_HG_SND_FILE_DATA:
-                {
-                    if (uNextMsg == HOST_DND_HG_SND_FILE_HDR)
-                    {
-                        rc = vbglR3ClipboardReadFileHdr(idClient,
-                                                        szPathName,
-                                                        sizeof(szPathName),
-                                                        &fFlags,
-                                                        &fMode,
-                                                        &cbFileSize);
-                        LogFlowFunc(("HOST_DND_HG_SND_FILE_HDR: "
-                                     "szPathName=%s, fFlags=0x%x, fMode=0x%x, cbFileSize=%RU64, rc=%Rrc\n",
-                                     szPathName, fFlags, fMode, cbFileSize, rc));
-                    }
-                    else
-                    {
-                        rc = vbglR3ClipboardReadFileData(idClient,
-                                                         pvChunk,
-                                                         cbChunkMax,
-                                                         &cbChunkRead);
-                        LogFlowFunc(("HOST_DND_HG_SND_FILE_DATA: "
-                                     "cbChunkRead=%RU32, rc=%Rrc\n", cbChunkRead, rc));
-                    }
-
-                    if (   RT_SUCCESS(rc)
-                        && uNextMsg == HOST_DND_HG_SND_FILE_HDR)
-                    {
-                        char *pszPathAbs = RTPathJoinA(pszDropDir, szPathName);
-                        if (pszPathAbs)
-                        {
-                            LogFlowFunc(("Opening pszPathName=%s, cbPathName=%RU32, fMode=0x%x, cbFileSize=%zu\n",
-                                         szPathName, cbPathName, fMode, cbFileSize));
-
-                            uint64_t fOpen  =   RTFILE_O_WRITE | RTFILE_O_DENY_WRITE
-                                              | RTFILE_O_CREATE_REPLACE;
-
-                            /* Is there already a file open, e.g. in transfer? */
-                            if (!objFile.IsOpen())
-                            {
-                                RTCString strPathAbs(pszPathAbs);
-#ifdef RT_OS_WINDOWS
-                                uint32_t fCreationMode = (fMode & RTFS_DOS_MASK) | RTFS_DOS_NT_NORMAL;
-#else
-                                uint32_t fCreationMode = (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR;
-#endif
-                                rc = objFile.OpenEx(strPathAbs, SharedClipboardURIObject::View_Target, fOpen, fCreationMode);
-                                if (RT_SUCCESS(rc))
-                                {
-                                    //rc = pDroppedFiles->AddFile(strPathAbs.c_str());
-                                    if (RT_SUCCESS(rc))
-                                    {
-                                        cbFileWritten = 0;
-                                        objFile.SetSize(cbFileSize);
-                                    }
-                                }
-                            }
-                            else
-                            {
-                                AssertMsgFailed(("ObjType=%RU32\n", objFile.GetType()));
-                                rc = VERR_WRONG_ORDER;
-                            }
-
-                            RTStrFree(pszPathAbs);
-                        }
-                        else
-                            rc = VERR_NO_MEMORY;
-                    }
-
-                    if (   RT_SUCCESS(rc)
-                        && uNextMsg == HOST_DND_HG_SND_FILE_DATA
-                        && cbChunkRead)
-                    {
-                        uint32_t cbChunkWritten;
-                        rc = objFile.Write(pvChunk, cbChunkRead, &cbChunkWritten);
-                        if (RT_SUCCESS(rc))
-                        {
-                            LogFlowFunc(("HOST_DND_HG_SND_FILE_DATA "
-                                         "cbChunkRead=%RU32, cbChunkWritten=%RU32, cbFileWritten=%RU64 cbFileSize=%RU64\n",
-                                         cbChunkRead, cbChunkWritten, cbFileWritten + cbChunkWritten, cbFileSize));
-
-                            cbFileWritten += cbChunkWritten;
-
-                            Assert(cbChunkRead <= cbToRecvBytes);
-                            cbToRecvBytes -= cbChunkRead;
-                        }
-                    }
-
-                    /* Data transfer complete? Close the file. */
-                    bool fClose = objFile.IsComplete();
-                    if (fClose)
-                    {
-                        Assert(cToRecvObjs);
-                        cToRecvObjs--;
-                    }
-
-                    /* Only since protocol v2 we know the file size upfront. */
-                    Assert(cbFileWritten <= cbFileSize);
-
-                    if (fClose)
-                    {
-                        LogFlowFunc(("Closing file\n"));
-                        objFile.Close();
-                    }
-
-                    break;
-                }
-                default:
-                {
-                    LogFlowFunc(("Message %RU32 not supported\n", uNextMsg));
-                    rc = VERR_NOT_SUPPORTED;
-                    break;
-                }
-            }
-        }
-
-        if (RT_FAILURE(rc))
-            break;
-
-        LogFlowFunc(("cbToRecvBytes=%RU64, cToRecvObjs=%RU64\n", cbToRecvBytes, cToRecvObjs));
-        if (   !cbToRecvBytes
-            && !cToRecvObjs)
-        {
-            break;
-        }
-
-    } while (RT_SUCCESS(rc));
-
-    LogFlowFunc(("Loop ended with %Rrc\n", rc));
-
-    /* All URI data processed? */
-    if (rc == VERR_NO_DATA)
-        rc = VINF_SUCCESS;
-
-    /* Delete temp buffer again. */
-    if (pvChunk)
-        RTMemFree(pvChunk);
-
-    /* Cleanup on failure or if the user has canceled the operation or
-     * something else went wrong. */
-    if (RT_FAILURE(rc))
-    {
-        objFile.Close();
-    }
-    else
-    {
-        /** @todo Compare the URI list with the dirs/files we really transferred. */
-        /** @todo Implement checksum verification, if any. */
-    }
-
-    LogFlowFuncLeaveRC(rc);
-    return rc;
-#endif
-    return 0;
-}
-#endif
 #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
 
