Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp	(revision 56504)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp	(revision 56505)
@@ -1303,5 +1303,12 @@
     AssertReturn(obj.GetType() == DnDURIObject::File, VERR_INVALID_PARAMETER);
 
-    uint32_t cbBuf = _64K; /** @todo Make this configurable? */
+    int rc = obj.Open(DnDURIObject::Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
+    if (RT_FAILURE(rc))
+    {
+        LogFunc(("Opening file \"%s\" failed with rc=%Rrc\n", obj.GetSourcePath().c_str(), rc));
+        return rc;
+    }
+
+    uint32_t cbBuf = _64K;           /** @todo Make this configurable? */
     void *pvBuf = RTMemAlloc(cbBuf); /** @todo Make this buffer part of PVBGLR3GUESTDNDCMDCTX? */
     if (!pvBuf)
@@ -1309,11 +1316,4 @@
 
     RTCString strPath = obj.GetDestPath();
-
-    int rc = obj.Open(DnDURIObject::Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
-    if (RT_FAILURE(rc))
-    {
-        LogFunc(("Opening file \"%s\" failed with rc=%Rrc\n", obj.GetSourcePath().c_str(), rc));
-        return rc;
-    }
 
     LogFlowFunc(("strFile=%s (%zu), cbSize=%RU64, fMode=0x%x\n", strPath.c_str(), strPath.length(), obj.GetSize(), obj.GetMode()));
@@ -1329,10 +1329,10 @@
         MsgHdr.hdr.cParms      = 6;
 
-        MsgHdr.uContext.SetUInt32(0); /* Context ID; unused at the moment. */
+        MsgHdr.uContext.SetUInt32(0);                                                    /* Context ID; unused at the moment. */
         MsgHdr.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)(strPath.length() + 1));
         MsgHdr.cbName.SetUInt32((uint32_t)(strPath.length() + 1));
-        MsgHdr.uFlags.SetUInt32(0);   /* Flags; unused at the moment. */
-        MsgHdr.fMode.SetUInt32(obj.GetMode());
-        MsgHdr.cbTotal.SetUInt64(obj.GetSize());
+        MsgHdr.uFlags.SetUInt32(0);                                                      /* Flags; unused at the moment. */
+        MsgHdr.fMode.SetUInt32(obj.GetMode());                                           /* File mode */
+        MsgHdr.cbTotal.SetUInt64(obj.GetSize());                                         /* File size (in bytes). */
 
         rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(MsgHdr)), &MsgHdr, sizeof(MsgHdr));
@@ -1470,5 +1470,5 @@
 
         void *pvToSend = (void *)strRootDest.c_str();
-        uint32_t cbToSend = (uint32_t)strRootDest.length() + 1;
+        uint32_t cbToSend = (uint32_t)strRootDest.length() + 1; /* Include string termination. */
 
         rc = vbglR3DnDGHSendDataInternal(pCtx, pvToSend, cbToSend,
