Index: /trunk/include/VBox/GuestHost/DragAndDrop.h
===================================================================
--- /trunk/include/VBox/GuestHost/DragAndDrop.h	(revision 74713)
+++ /trunk/include/VBox/GuestHost/DragAndDrop.h	(revision 74714)
@@ -149,6 +149,5 @@
     DnDURIObject(Type type,
                  const RTCString &strSrcPathAbs = "",
-                 const RTCString &strDstPathAbs = "",
-                 uint32_t fMode = 0, uint64_t cbSize = 0);
+                 const RTCString &strDstPathAbs = "");
     virtual ~DnDURIObject(void);
 
@@ -169,30 +168,9 @@
     const RTCString &GetDestPathAbs(void) const { return m_strTgtPathAbs; }
 
-    /**
-     * Returns the file mode of the object.
-     *
-     * Note: Only applies if the object is of type DnDURIObject::Type_File.
-     *
-     * @return  File mode.
-     */
-    uint32_t GetMode(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.fMode; }
-
-    /**
-     * Returns the bytes already processed (read / written).
-     *
-     * Note: Only applies if the object is of type DnDURIObject::Type_File.
-     *
-     * @return  Bytes already processed (read / written).
-     */
-    uint64_t GetProcessed(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.cbProcessed; }
-
-    /**
-     * Returns the file's size (in bytes).
-     *
-     * Note: Only applies if the object is of type DnDURIObject::Type_File.
-     *
-     * @return  The file's size (in bytes).
-     */
-    uint64_t GetSize(void) const { AssertReturn(m_Type == Type_File, 0); return u.File.cbSize; }
+    RTFMODE GetMode(void) const;
+
+    uint64_t GetProcessed(void) const;
+
+    uint64_t GetSize(void) const;
 
     /**
@@ -201,17 +179,16 @@
      * @return  The object's type.
      */
-    Type GetType(void) const { return m_Type; }
-
-public:
-
-    /**
-     * Sets the bytes to process by the object.
+    Type GetType(void) const { return m_enmType; }
+
+    /**
+     * Returns the object's view.
      *
-     * Note: Only applies if the object is of type DnDURIObject::Type_File.
-     *
-     * @return  IPRT return code.
-     * @param   cbSize          Size (in bytes) to process.
-     */
-    int SetSize(uint64_t cbSize) { AssertReturn(m_Type == Type_File, 0); u.File.cbSize = cbSize; return VINF_SUCCESS; }
+     * @return  The object's view.
+     */
+    View GetView(void) const { return m_enmView; }
+
+public:
+
+    int SetSize(uint64_t cbSize);
 
 public:
@@ -220,6 +197,7 @@
     bool IsComplete(void) const;
     bool IsOpen(void) const;
-    int Open(View enmView, uint64_t fOpen, uint32_t fMode = 0);
-    int OpenEx(const RTCString &strPath, Type enmType, View enmView, uint64_t fOpen = 0, uint32_t fMode = 0, DNDURIOBJECTFLAGS = DNDURIOBJECT_FLAGS_NONE);
+    int Open(View enmView, uint64_t fOpen, RTFMODE fMode = 0);
+    int OpenEx(const RTCString &strPath, View enmView, uint64_t fOpen = 0, RTFMODE fMode = 0, DNDURIOBJECTFLAGS = DNDURIOBJECT_FLAGS_NONE);
+    int QueryInfo(View enmView);
     int Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead);
     void Reset(void);
@@ -233,9 +211,12 @@
 
     void closeInternal(void);
+    int queryInfoInternal(View enmView);
 
 protected:
 
     /** The object's type. */
-    Type      m_Type;
+    Type      m_enmType;
+    /** The object's view. */
+    View      m_enmView;
     /** Absolute path (base) for the source. */
     RTCString m_strSrcPathAbs;
@@ -253,12 +234,19 @@
         {
             /** File handle. */
-            RTFILE   hFile;
-            /** Used file mode. */
-            uint32_t fMode;
-            /** Size (in bytes) to read/write. */
-            uint64_t cbSize;
+            RTFILE      hFile;
+            /** File system object information of this file. */
+            RTFSOBJINFO objInfo;
+            /** Bytes to proces for reading/writing. */
+            uint64_t    cbToProcess;
             /** Bytes processed reading/writing. */
-            uint64_t cbProcessed;
+            uint64_t    cbProcessed;
         } File;
+        struct
+        {
+            /** Directory handle. */
+            RTDIR       hDir;
+            /** File system object information of this directory. */
+            RTFSOBJINFO objInfo;
+        } Dir;
     } u;
 };
Index: /trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp	(revision 74713)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp	(revision 74714)
@@ -510,5 +510,5 @@
                                 uint32_t fCreationMode = (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR;
 #endif
-                                rc = objFile.OpenEx(strPathAbs, DnDURIObject::Type_File, DnDURIObject::View_Target, fOpen, fCreationMode);
+                                rc = objFile.OpenEx(strPathAbs, DnDURIObject::View_Target, fOpen, fCreationMode);
                                 if (RT_SUCCESS(rc))
                                 {
Index: /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp
===================================================================
--- /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp	(revision 74713)
+++ /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp	(revision 74714)
@@ -70,6 +70,8 @@
                 {
                     /** @todo Add a standard fOpen mode for this list. */
-                    rc = pObjFile->Open(DnDURIObject::View_Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, objInfo.Attr.fMode);
+                    rc = pObjFile->Open(DnDURIObject::View_Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
                 }
+                else /* Just query the information without opening the file. */
+                    rc = pObjFile->QueryInfo(DnDURIObject::View_Source);
 
                 if (RT_SUCCESS(rc))
@@ -90,6 +92,5 @@
             LogFlowFunc(("Directory '%s' -> '%s' (file mode 0x%x)\n", pcszSource, pcszTarget, objInfo.Attr.fMode));
 
-            DnDURIObject *pObjDir = new DnDURIObject(DnDURIObject::Type_Directory, pcszSource, pcszTarget,
-                                                     objInfo.Attr.fMode, 0 /* Size */);
+            DnDURIObject *pObjDir = new DnDURIObject(DnDURIObject::Type_Directory, pcszSource, pcszTarget);
             if (pObjDir)
             {
Index: /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
===================================================================
--- /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp	(revision 74713)
+++ /trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp	(revision 74714)
@@ -37,5 +37,6 @@
 
 DnDURIObject::DnDURIObject(void)
-    : m_Type(Type_Unknown)
+    : m_enmType(Type_Unknown)
+    , m_enmView(View_Unknown)
     , m_fIsOpen(false)
 {
@@ -45,7 +46,7 @@
 DnDURIObject::DnDURIObject(Type enmType,
                            const RTCString &strSrcPathAbs /* = 0 */,
-                           const RTCString &strDstPathAbs /* = 0 */,
-                           uint32_t fMode  /* = 0 */, uint64_t cbSize  /* = 0 */)
-    : m_Type(enmType)
+                           const RTCString &strDstPathAbs /* = 0 */)
+    : m_enmType(enmType)
+    , m_enmView(View_Unknown)
     , m_strSrcPathAbs(strSrcPathAbs)
     , m_strTgtPathAbs(strDstPathAbs)
@@ -53,15 +54,4 @@
 {
     RT_ZERO(u);
-
-    switch (m_Type)
-    {
-        case Type_File:
-            u.File.fMode = fMode;
-            u.File.cbSize = cbSize;
-            break;
-
-        default:
-            break;
-    }
 }
 
@@ -82,5 +72,5 @@
         return;
 
-    switch (m_Type)
+    switch (m_enmType)
     {
         case Type_File:
@@ -88,10 +78,15 @@
             RTFileClose(u.File.hFile);
             u.File.hFile = NIL_RTFILE;
-            u.File.fMode = 0;
+            RT_ZERO(u.File.objInfo);
             break;
         }
 
         case Type_Directory:
-            break;
+        {
+            RTDirClose(u.Dir.hDir);
+            u.Dir.hDir = NIL_RTDIR;
+            RT_ZERO(u.Dir.objInfo);
+            break;
+        }
 
         default:
@@ -112,4 +107,57 @@
 
 /**
+ * Returns the directory / file mode of the object.
+ *
+ * @return  File / directory mode.
+ */
+RTFMODE DnDURIObject::GetMode(void) const
+{
+    switch (m_enmType)
+    {
+        case Type_File:
+            return u.File.objInfo.Attr.fMode;
+
+        case Type_Directory:
+            return u.Dir.objInfo.Attr.fMode;
+
+        default:
+            break;
+    }
+
+    AssertFailed();
+    return 0;
+}
+
+/**
+ * Returns the bytes already processed (read / written).
+ *
+ * Note: Only applies if the object is of type DnDURIObject::Type_File.
+ *
+ * @return  Bytes already processed (read / written).
+ */
+uint64_t DnDURIObject::GetProcessed(void) const
+{
+    if (m_enmType == Type_File)
+        return u.File.cbProcessed;
+
+    return 0;
+}
+
+/**
+ * Returns the file's logical size (in bytes).
+ *
+ * Note: Only applies if the object is of type DnDURIObject::Type_File.
+ *
+ * @return  The file's logical size (in bytes).
+ */
+uint64_t DnDURIObject::GetSize(void) const
+{
+    if (m_enmType == Type_File)
+        return u.File.cbToProcess;
+
+    return 0;
+}
+
+/**
  * Returns whether the processing of the object is complete or not.
  * For file objects this means that all bytes have been processed.
@@ -121,9 +169,9 @@
     bool fComplete;
 
-    switch (m_Type)
+    switch (m_enmType)
     {
         case Type_File:
-            Assert(u.File.cbProcessed <= u.File.cbSize);
-            fComplete = u.File.cbProcessed == u.File.cbSize;
+            Assert(u.File.cbProcessed <= u.File.cbToProcess);
+            fComplete = u.File.cbProcessed == u.File.cbToProcess;
             break;
 
@@ -154,13 +202,11 @@
  * @param   enmView             View to use for opening the object.
  * @param   fOpen               File open flags to use.
- * @param   fMode
- *
- * @remark
- */
-int DnDURIObject::Open(View enmView, uint64_t fOpen /* = 0 */, uint32_t fMode /* = 0 */)
+ * @param   fMode               File mode to use.
+ */
+int DnDURIObject::Open(View enmView, uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */)
 {
     return OpenEx(  enmView == View_Source
                   ? m_strSrcPathAbs : m_strTgtPathAbs
-                  , m_Type, enmView, fOpen, fMode, 0 /* fFlags */);
+                  , enmView, fOpen, fMode, DNDURIOBJECT_FLAGS_NONE);
 }
 
@@ -170,5 +216,4 @@
  * @return  IPRT status code.
  * @param   strPathAbs          Absolute path of the object (file / directory / ...).
- * @param   enmType             Type of the object.
  * @param   enmView             View of the object.
  * @param   fOpen               Open mode to use; only valid for file objects.
@@ -176,10 +221,13 @@
  * @param   fFlags              Additional DnD URI object flags.
  */
-int DnDURIObject::OpenEx(const RTCString &strPathAbs, Type enmType, View enmView,
-                         uint64_t fOpen /* = 0 */, uint32_t fMode /* = 0 */, DNDURIOBJECTFLAGS fFlags /* = DNDURIOBJECT_FLAGS_NONE */)
+int DnDURIObject::OpenEx(const RTCString &strPathAbs, View enmView,
+                         uint64_t fOpen /* = 0 */, RTFMODE fMode /* = 0 */, DNDURIOBJECTFLAGS fFlags /* = DNDURIOBJECT_FLAGS_NONE */)
 {
     AssertReturn(!(fFlags & ~DNDURIOBJECT_FLAGS_VALID_MASK), VERR_INVALID_FLAGS);
     RT_NOREF1(fFlags);
 
+    if (m_fIsOpen)
+        return VINF_SUCCESS;
+
     int rc = VINF_SUCCESS;
 
@@ -202,52 +250,37 @@
         && fOpen) /* Opening mode specified? */
     {
-        LogFlowThisFunc(("strPath=%s, enmType=%RU32, enmView=%RU32, fOpen=0x%x, fMode=0x%x, fFlags=0x%x\n",
-                         strPathAbs.c_str(), enmType, enmView, fOpen, fMode, fFlags));
-        switch (enmType)
+        LogFlowThisFunc(("strPath=%s, enmView=%RU32, fOpen=0x%x, fMode=0x%x, fFlags=0x%x\n",
+                         strPathAbs.c_str(), enmView, fOpen, fMode, fFlags));
+        switch (m_enmType)
         {
             case Type_File:
             {
-                if (!m_fIsOpen)
+                /*
+                 * Open files on the source with RTFILE_O_DENY_WRITE to prevent races
+                 * where the OS writes to the file while the destination side transfers
+                 * it over.
+                 */
+                LogFlowThisFunc(("Opening ...\n"));
+                rc = RTFileOpen(&u.File.hFile, strPathAbs.c_str(), fOpen);
+                if (RT_SUCCESS(rc))
                 {
-                    /*
-                     * Open files on the source with RTFILE_O_DENY_WRITE to prevent races
-                     * where the OS writes to the file while the destination side transfers
-                     * it over.
-                     */
-                    LogFlowThisFunc(("Opening ...\n"));
-                    rc = RTFileOpen(&u.File.hFile, strPathAbs.c_str(), fOpen);
-                    if (RT_SUCCESS(rc))
-                        rc = RTFileGetSize(u.File.hFile, &u.File.cbSize);
-
-                    if (RT_SUCCESS(rc))
+                    if (   (fOpen & RTFILE_O_WRITE) /* Only set the file mode on write. */
+                        &&  fMode                   /* Some file mode to set specified? */)
                     {
-                        if (   (fOpen & RTFILE_O_WRITE) /* Only set the file mode on write. */
-                            &&  fMode                   /* Some file mode to set specified? */)
-                        {
-                            rc = RTFileSetMode(u.File.hFile, fMode);
-                            if (RT_SUCCESS(rc))
-                                u.File.fMode = fMode;
-                        }
-                        else if (fOpen & RTFILE_O_READ)
-                        {
-#if 0 /** @todo Enable this as soon as RTFileGetMode is implemented. */
-                            rc = RTFileGetMode(u.m_hFile, &m_fMode);
-#else
-                            RTFSOBJINFO ObjInfo;
-                            rc = RTFileQueryInfo(u.File.hFile, &ObjInfo, RTFSOBJATTRADD_NOTHING);
-                            if (RT_SUCCESS(rc))
-                                u.File.fMode = ObjInfo.Attr.fMode;
-#endif
-                        }
+                        rc = RTFileSetMode(u.File.hFile, fMode);
                     }
-
-                    if (RT_SUCCESS(rc))
+                    else if (fOpen & RTFILE_O_READ)
                     {
-                        LogFlowThisFunc(("cbSize=%RU64, fMode=0x%x\n", u.File.cbSize, u.File.fMode));
-                        u.File.cbProcessed = 0;
+                        rc = queryInfoInternal(enmView);
                     }
                 }
-                else
-                    rc = VINF_SUCCESS;
+
+                if (RT_SUCCESS(rc))
+                {
+                    LogFlowThisFunc(("File cbObject=%RU64, fMode=0x%x\n",
+                                     u.File.objInfo.cbObject, u.File.objInfo.Attr.fMode));
+                    u.File.cbToProcess = u.File.objInfo.cbObject;
+                    u.File.cbProcessed = 0;
+                }
 
                 break;
@@ -255,6 +288,10 @@
 
             case Type_Directory:
-                rc = VINF_SUCCESS;
+            {
+                rc = RTDirOpen(&u.Dir.hDir, strPathAbs.c_str());
+                if (RT_SUCCESS(rc))
+                    rc = queryInfoInternal(enmView);
                 break;
+            }
 
             default:
@@ -266,5 +303,5 @@
     if (RT_SUCCESS(rc))
     {
-        m_Type  = enmType;
+        m_enmView = enmView;
         m_fIsOpen = true;
     }
@@ -272,4 +309,45 @@
     LogFlowFuncLeaveRC(rc);
     return rc;
+}
+
+/**
+ * Queries information about the object using a specific view, internal version.
+ *
+ * @return  IPRT status code.
+ * @param   enmView             View to use for querying information.
+ */
+int DnDURIObject::queryInfoInternal(View enmView)
+{
+    RT_NOREF(enmView);
+
+    int rc;
+
+    switch (m_enmType)
+    {
+        case Type_File:
+            rc = RTFileQueryInfo(u.File.hFile, &u.File.objInfo, RTFSOBJATTRADD_NOTHING);
+            break;
+
+        case Type_Directory:
+            rc = RTDirQueryInfo(u.Dir.hDir, &u.Dir.objInfo, RTFSOBJATTRADD_NOTHING);
+            break;
+
+        default:
+            rc = VERR_NOT_IMPLEMENTED;
+            break;
+    }
+
+    return rc;
+}
+
+/**
+ * Queries information about the object using a specific view.
+ *
+ * @return  IPRT status code.
+ * @param   enmView             View to use for querying information.
+ */
+int DnDURIObject::QueryInfo(View enmView)
+{
+    return queryInfoInternal(enmView);
 }
 
@@ -354,31 +432,28 @@
     /* pcbRead is optional. */
 
+    AssertMsgReturn(m_fIsOpen, ("Object not in open state\n"), VERR_INVALID_STATE);
+    AssertMsgReturn(m_enmView == View_Source, ("Cannot write to an object which is not in target view\n"),
+                    VERR_INVALID_STATE);
+
     size_t cbRead = 0;
 
     int rc;
-    switch (m_Type)
+    switch (m_enmType)
     {
         case Type_File:
         {
-            rc = OpenEx(m_strSrcPathAbs, Type_File, View_Source,
-                        /* Use some sensible defaults. */
-                        RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 0 /* fFlags */);
+            rc = RTFileRead(u.File.hFile, pvBuf, cbBuf, &cbRead);
             if (RT_SUCCESS(rc))
             {
-                rc = RTFileRead(u.File.hFile, pvBuf, cbBuf, &cbRead);
-                if (RT_SUCCESS(rc))
+                u.File.cbProcessed += cbRead;
+                Assert(u.File.cbProcessed <= u.File.cbToProcess);
+
+                /* End of file reached or error occurred? */
+                if (   u.File.cbToProcess
+                    && u.File.cbProcessed == u.File.cbToProcess)
                 {
-                    u.File.cbProcessed += cbRead;
-                    Assert(u.File.cbProcessed <= u.File.cbSize);
-
-                    /* End of file reached or error occurred? */
-                    if (   u.File.cbSize
-                        && u.File.cbProcessed == u.File.cbSize)
-                    {
-                        rc = VINF_EOF;
-                    }
+                    rc = VINF_EOF;
                 }
             }
-
             break;
         }
@@ -414,9 +489,28 @@
     Close();
 
-    m_Type          = Type_Unknown;
+    m_enmType       = Type_Unknown;
+    m_enmView       = View_Unknown;
     m_strSrcPathAbs = "";
     m_strTgtPathAbs = "";
 
     RT_ZERO(u);
+}
+
+/**
+ * Sets the bytes to process by the object.
+ *
+ * Note: Only applies if the object is of type DnDURIObject::Type_File.
+ *
+ * @return  IPRT return code.
+ * @param   cbSize          Size (in bytes) to process.
+ */
+int DnDURIObject::SetSize(uint64_t cbSize)
+{
+    AssertReturn(m_enmType == Type_File, VERR_INVALID_PARAMETER);
+
+    /** @todo Implement sparse file support here. */
+
+    u.File.cbToProcess = cbSize;
+    return VINF_SUCCESS;
 }
 
@@ -435,20 +529,18 @@
     /* pcbWritten is optional. */
 
+    AssertMsgReturn(m_fIsOpen, ("Object not in open state\n"), VERR_INVALID_STATE);
+    AssertMsgReturn(m_enmView == View_Target, ("Cannot write to an object which is not in target view\n"),
+                    VERR_INVALID_STATE);
+
     size_t cbWritten = 0;
 
     int rc;
-    switch (m_Type)
+    switch (m_enmType)
     {
         case Type_File:
         {
-            rc = OpenEx(m_strTgtPathAbs, Type_File, View_Target,
-                        /* Use some sensible defaults. */
-                        RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_WRITE, 0 /* fFlags */);
+            rc = RTFileWrite(u.File.hFile, pvBuf, cbBuf, &cbWritten);
             if (RT_SUCCESS(rc))
-            {
-                rc = RTFileWrite(u.File.hFile, pvBuf, cbBuf, &cbWritten);
-                if (RT_SUCCESS(rc))
-                    u.File.cbProcessed += cbWritten;
-            }
+                u.File.cbProcessed += cbWritten;
             break;
         }
Index: /trunk/src/VBox/Main/include/GuestDnDPrivate.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestDnDPrivate.h	(revision 74713)
+++ /trunk/src/VBox/Main/include/GuestDnDPrivate.h	(revision 74714)
@@ -390,5 +390,5 @@
 public:
 
-    int createIntermediate(DnDURIObject::Type enmType = DnDURIObject::Type_Unknown)
+    int createIntermediate(DnDURIObject::Type enmType)
     {
         reset();
Index: /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp	(revision 74713)
+++ /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp	(revision 74714)
@@ -798,5 +798,5 @@
              * Create new intermediate object to work with.
              */
-            rc = objCtx.createIntermediate();
+            rc = objCtx.createIntermediate(DnDURIObject::Type_File);
         }
 
@@ -824,8 +824,8 @@
             }
 
-            LogRel2(("DnD: Absolute file path on the host now is '%s'\n", pszPathAbs));
+            LogRel2(("DnD: Absolute file path for guest file on the host is now '%s'\n", pszPathAbs));
 
             /** @todo Add sparse file support based on fFlags? (Use Open(..., fFlags | SPARSE). */
-            rc = pObj->OpenEx(pszPathAbs, DnDURIObject::Type_File, DnDURIObject::View_Target,
+            rc = pObj->OpenEx(pszPathAbs, DnDURIObject::View_Target,
                               RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE,
                               (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR);
@@ -836,4 +836,6 @@
                 AssertRC(rc2);
             }
+            else
+                LogRel(("DnD: Error opening/creating guest file '%s' on host, rc=%Rrc\n", pszPathAbs, rc));
         }
 
@@ -854,12 +856,8 @@
         }
 
-        if (RT_FAILURE(rc))
-        {
-            LogRel2(("DnD: Error opening/creating guest file '%s' on host, rc=%Rrc\n",
-                     pObj->GetDestPathAbs().c_str(), rc));
-            break;
-        }
-
     } while (0);
+
+    if (RT_FAILURE(rc))
+        LogRel(("DnD: Error receiving guest file header, rc=%Rrc\n", rc));
 
     LogFlowFuncLeaveRC(rc);
@@ -923,6 +921,6 @@
                 rc = updateProgress(&pCtx->mData, pCtx->mpResp, cbWritten);
         }
-        else /* Something went wrong; close the object. */
-            pObj->Close();
+        else
+            LogRel(("DnD: Error writing guest file data for '%s', rc=%Rrc\n", pObj->GetDestPathAbs().c_str(), rc));
 
         if (RT_SUCCESS(rc))
@@ -931,16 +929,14 @@
             {
                 /** @todo Sanitize path. */
-                LogRel2(("DnD: File transfer to host complete: %s\n", pObj->GetDestPathAbs().c_str()));
+                LogRel2(("DnD: Transferring guest file '%s' to host complete\n", pObj->GetDestPathAbs().c_str()));
                 pCtx->mURI.processObject(*pObj);
                 objCtx.reset();
             }
         }
-        else
-        {
-            /** @todo What to do when the host's disk is full? */
-            LogRel(("DnD: Error writing guest file to host to '%s': %Rrc\n", pObj->GetDestPathAbs().c_str(), rc));
-        }
 
     } while (0);
+
+    if (RT_FAILURE(rc))
+        LogRel(("DnD: Error receiving guest file data, rc=%Rrc\n", rc));
 
     LogFlowFuncLeaveRC(rc);
Index: /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 74713)
+++ /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 74714)
@@ -910,5 +910,5 @@
         return VERR_BUFFER_OVERFLOW;
 
-    LogRel2(("DnD: Transferring host directory to guest: %s\n", strPath.c_str()));
+    LogRel2(("DnD: Transferring host directory '%s' to guest\n", strPath.c_str()));
 
     pMsg->setType(HOST_DND_HG_SND_DIR);
@@ -943,9 +943,9 @@
     if (!pObj->IsOpen())
     {
-        LogRel2(("DnD: Opening host file for transferring to guest: %s\n", strPathSrc.c_str()));
-        rc = pObj->OpenEx(strPathSrc, DnDURIObject::Type_File, DnDURIObject::View_Source,
-                          RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 0 /* fFlags */);
+        LogRel2(("DnD: Opening host file '%s' for transferring to guest\n", strPathSrc.c_str()));
+        rc = pObj->OpenEx(strPathSrc, DnDURIObject::View_Source,
+                          RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
         if (RT_FAILURE(rc))
-            LogRel(("DnD: Error opening host file '%s', rc=%Rrc\n", strPathSrc.c_str(), rc));
+            LogRel(("DnD: Opening host file '%s' failed, rc=%Rrc\n", strPathSrc.c_str(), rc));
     }
 
@@ -998,4 +998,7 @@
     }
 
+    if (RT_FAILURE(rc))
+        LogRel(("DnD: Sending host file to guest failed, rc=%Rrc\n", rc));
+
     LogFlowFuncLeaveRC(rc);
     return rc;
@@ -1063,5 +1066,5 @@
         if (pObj->IsComplete()) /* Done reading? */
         {
-            LogRel2(("DnD: File transfer to guest complete: %s\n", pObj->GetSourcePathAbs().c_str()));
+            LogRel2(("DnD: Transferring file '%s' to guest complete\n", pObj->GetSourcePathAbs().c_str()));
             LogFlowFunc(("File '%s' complete\n", pObj->GetSourcePathAbs().c_str()));
 
@@ -1071,4 +1074,7 @@
         }
     }
+
+    if (RT_FAILURE(rc))
+        LogRel(("DnD: Reading from host file '%s' failed, rc=%Rrc\n", pObj->GetSourcePathAbs().c_str(), rc));
 
     LogFlowFuncLeaveRC(rc);
@@ -1465,15 +1471,14 @@
     AssertPtr(pCurObj);
 
-    uint32_t fMode = pCurObj->GetMode();
-    LogRel3(("DnD: Processing: srcPath=%s, dstPath=%s, fMode=0x%x, cbSize=%RU32, fIsDir=%RTbool, fIsFile=%RTbool\n",
+    DnDURIObject::Type enmType = pCurObj->GetType();
+    LogRel3(("DnD: Processing: srcPath=%s, dstPath=%s, enmType=%RU32, cbSize=%RU32\n",
              pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str(),
-             fMode, pCurObj->GetSize(),
-             RTFS_IS_DIRECTORY(fMode), RTFS_IS_FILE(fMode)));
-
-    if (RTFS_IS_DIRECTORY(fMode))
+             enmType, pCurObj->GetSize()));
+
+    if (enmType == DnDURIObject::Type_Directory)
     {
         rc = i_sendDirectory(pCtx, &objCtx, pMsg);
     }
-    else if (RTFS_IS_FILE(fMode))
+    else if (DnDURIObject::Type_File)
     {
         rc = i_sendFile(pCtx, &objCtx, pMsg);
@@ -1481,6 +1486,6 @@
     else
     {
-        AssertMsgFailed(("fMode=0x%x is not supported for srcPath=%s, dstPath=%s\n",
-                         fMode, pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str()));
+        AssertMsgFailed(("enmType=%RU32 is not supported for srcPath=%s, dstPath=%s\n",
+                         enmType, pCurObj->GetSourcePathAbs().c_str(), pCurObj->GetDestPathAbs().c_str()));
         rc = VERR_NOT_SUPPORTED;
     }
