Index: /trunk/include/VBox/HostServices/DragAndDropSvc.h
===================================================================
--- /trunk/include/VBox/HostServices/DragAndDropSvc.h	(revision 58256)
+++ /trunk/include/VBox/HostServices/DragAndDropSvc.h	(revision 58257)
@@ -44,4 +44,5 @@
  *
  *     Protocol v3 (VBox 5.0+):
+             Added context IDs for every HGCM message. Not used yet and must be 0.
  *         - Added VBOXDNDSNDDATAHDR and VBOXDNDCBSNDDATAHDRDATA to support (simple) accounting of objects
  *           being transferred, along with supplying separate meta data size (which is part of the total size being sent).
@@ -276,11 +277,29 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    HGCMFunctionParameter uScreenId;    /* OUT uint32_t */
-    HGCMFunctionParameter uX;           /* OUT uint32_t */
-    HGCMFunctionParameter uY;           /* OUT uint32_t */
-    HGCMFunctionParameter uDefAction;   /* OUT uint32_t */
-    HGCMFunctionParameter uAllActions;  /* OUT uint32_t */
-    HGCMFunctionParameter pvFormats;    /* OUT ptr */
-    HGCMFunctionParameter cFormats;     /* OUT uint32_t */
+    union
+    {
+        struct
+        {
+            HGCMFunctionParameter uScreenId;    /* OUT uint32_t */
+            HGCMFunctionParameter uX;           /* OUT uint32_t */
+            HGCMFunctionParameter uY;           /* OUT uint32_t */
+            HGCMFunctionParameter uDefAction;   /* OUT uint32_t */
+            HGCMFunctionParameter uAllActions;  /* OUT uint32_t */
+            HGCMFunctionParameter pvFormats;    /* OUT ptr */
+            HGCMFunctionParameter cFormats;     /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Context ID. */
+            HGCMFunctionParameter uContext;
+            HGCMFunctionParameter uScreenId;    /* OUT uint32_t */
+            HGCMFunctionParameter uX;           /* OUT uint32_t */
+            HGCMFunctionParameter uY;           /* OUT uint32_t */
+            HGCMFunctionParameter uDefAction;   /* OUT uint32_t */
+            HGCMFunctionParameter uAllActions;  /* OUT uint32_t */
+            HGCMFunctionParameter pvFormats;    /* OUT ptr */
+            HGCMFunctionParameter cFormats;     /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDHGACTIONMSG;
 
@@ -294,7 +313,14 @@
 {
     VBoxGuestHGCMCallInfo hdr;
+    union
+    {
+        struct
+        {
+            /** Context ID. */
+            HGCMFunctionParameter uContext;
+        } v3;
+    } u;
 } VBOXDNDHGLEAVEMSG;
 
-
 /**
  * Tells the guest that the host wants to cancel the current drag and drop operation.
@@ -306,4 +332,12 @@
 {
     VBoxGuestHGCMCallInfo hdr;
+    union
+    {
+        struct
+        {
+            /** Context ID. */
+            HGCMFunctionParameter uContext;
+        } v3;
+    } u;
 } VBOXDNDHGCANCELMSG;
 
@@ -418,10 +452,27 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    /** Directory name. */
-    HGCMFunctionParameter pvName;       /* OUT ptr */
-    /** Size (in bytes) of directory name. */
-    HGCMFunctionParameter cbName;       /* OUT uint32_t */
-    /** Directory mode. */
-    HGCMFunctionParameter fMode;        /* OUT uint32_t */
+    union
+    {
+        struct
+        {
+            /** Directory name. */
+            HGCMFunctionParameter pvName;       /* OUT ptr */
+            /** Size (in bytes) of directory name. */
+            HGCMFunctionParameter cbName;       /* OUT uint32_t */
+            /** Directory mode. */
+            HGCMFunctionParameter fMode;        /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            /** Directory name. */
+            HGCMFunctionParameter pvName;       /* OUT ptr */
+            /** Size (in bytes) of directory name. */
+            HGCMFunctionParameter cbName;       /* OUT uint32_t */
+            /** Directory mode. */
+            HGCMFunctionParameter fMode;        /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDHGSENDDIRMSG;
 
@@ -518,6 +569,19 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    /** Screen ID. */
-    HGCMFunctionParameter uScreenId;    /* OUT uint32_t */
+    union
+    {
+        struct
+        {
+            /** Screen ID. */
+            HGCMFunctionParameter uScreenId;    /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            /** Screen ID. */
+            HGCMFunctionParameter uScreenId;    /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDGHREQPENDINGMSG;
 
@@ -533,10 +597,27 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    /** Requested format for sending the data. */
-    HGCMFunctionParameter pvFormat;     /* OUT ptr */
-    /** Size (in bytes) of requested format. */
-    HGCMFunctionParameter cbFormat;     /* OUT uint32_t */
-    /** Drop action peformed on the host. */
-    HGCMFunctionParameter uAction;      /* OUT uint32_t */
+    union
+    {
+        struct
+        {
+            /** Requested format for sending the data. */
+            HGCMFunctionParameter pvFormat;     /* OUT ptr */
+            /** Size (in bytes) of requested format. */
+            HGCMFunctionParameter cbFormat;     /* OUT uint32_t */
+            /** Drop action peformed on the host. */
+            HGCMFunctionParameter uAction;      /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            /** Requested format for sending the data. */
+            HGCMFunctionParameter pvFormat;     /* OUT ptr */
+            /** Size (in bytes) of requested format. */
+            HGCMFunctionParameter cbFormat;     /* OUT uint32_t */
+            /** Drop action peformed on the host. */
+            HGCMFunctionParameter uAction;      /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDGHDROPPEDMSG;
 
@@ -546,6 +627,7 @@
 
 /**
- * The returned command the host wants to
- * run on the guest.
+ * Asks the host for the next command to process, along
+ * with the needed amount of parameters and an optional blocking
+ * flag.
  *
  * Used by:
@@ -576,8 +658,23 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    /** Protocol version to use. */
-    HGCMFunctionParameter uProtocol;     /* OUT uint32_t */
-    /** Connection flags. Optional. */
-    HGCMFunctionParameter uFlags;        /* OUT uint32_t */
+    union
+    {
+        struct
+        {
+            /** Protocol version to use. */
+            HGCMFunctionParameter uProtocol;     /* OUT uint32_t */
+            /** Connection flags. Optional. */
+            HGCMFunctionParameter uFlags;        /* OUT uint32_t */
+        } v2;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            /** Protocol version to use. */
+            HGCMFunctionParameter uProtocol;     /* OUT uint32_t */
+            /** Connection flags. Optional. */
+            HGCMFunctionParameter uFlags;        /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDCONNECTMSG;
 
@@ -592,5 +689,17 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    HGCMFunctionParameter uAction;      /* OUT uint32_t */
+    union
+    {
+        struct
+        {
+            HGCMFunctionParameter uAction;      /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            HGCMFunctionParameter uAction;      /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDHGACKOPMSG;
 
@@ -605,5 +714,18 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    HGCMFunctionParameter pFormat;      /* OUT ptr */
+    union
+    {
+        struct
+        {
+            HGCMFunctionParameter pvFormat;     /* OUT ptr */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            HGCMFunctionParameter pvFormat;     /* OUT ptr */
+            HGCMFunctionParameter cbFormat;     /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDHGREQDATAMSG;
 
@@ -612,7 +734,21 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    HGCMFunctionParameter uStatus;
-    HGCMFunctionParameter uPercent;
-    HGCMFunctionParameter rc;
+    union
+    {
+        struct
+        {
+            HGCMFunctionParameter uStatus;      /* OUT uint32_t */
+            HGCMFunctionParameter uPercent;     /* OUT uint32_t */
+            HGCMFunctionParameter rc;           /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            HGCMFunctionParameter uStatus;      /* OUT uint32_t */
+            HGCMFunctionParameter uPercent;     /* OUT uint32_t */
+            HGCMFunctionParameter rc;           /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDHGEVTPROGRESSMSG;
 
@@ -628,7 +764,22 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    HGCMFunctionParameter uDefAction;   /* OUT uint32_t */
-    HGCMFunctionParameter uAllActions;  /* OUT uint32_t */
-    HGCMFunctionParameter pFormat;      /* OUT ptr */
+    union
+    {
+        struct
+        {
+            HGCMFunctionParameter uDefAction;   /* OUT uint32_t */
+            HGCMFunctionParameter uAllActions;  /* OUT uint32_t */
+            HGCMFunctionParameter pvFormats;    /* OUT ptr */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            HGCMFunctionParameter uDefAction;   /* OUT uint32_t */
+            HGCMFunctionParameter uAllActions;  /* OUT uint32_t */
+            HGCMFunctionParameter pvFormats;    /* OUT ptr */
+            HGCMFunctionParameter cbFormats;    /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDGHACKPENDINGMSG;
 
@@ -716,5 +867,17 @@
     VBoxGuestHGCMCallInfo hdr;
 
-    HGCMFunctionParameter rc;               /* OUT uint32_t */
+    union
+    {
+        struct
+        {
+            HGCMFunctionParameter rc;           /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            HGCMFunctionParameter rc;           /* OUT uint32_t */
+        } v3;
+    } u;
 } VBOXDNDGHEVTERRORMSG;
 
@@ -748,7 +911,7 @@
 {
     /** Magic number to identify the structure. */
-    uint32_t                    u32Magic;
+    uint32_t                    uMagic;
     /** Context ID to identify callback data. */
-    uint32_t                    u32ContextID;
+    uint32_t                    uContextID;
 } VBOXDNDCBHEADERDATA, *PVBOXDNDCBHEADERDATA;
 
Index: /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp	(revision 58256)
+++ /trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp	(revision 58257)
@@ -120,13 +120,30 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = uMsg;
-    Msg.hdr.cParms      = 7;
-
-    Msg.uScreenId.SetUInt32(0);
-    Msg.uX.SetUInt32(0);
-    Msg.uY.SetUInt32(0);
-    Msg.uDefAction.SetUInt32(0);
-    Msg.uAllActions.SetUInt32(0);
-    Msg.pvFormats.SetPtr(pszFormats, cbFormats);
-    Msg.cFormats.SetUInt32(0);
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 7;
+
+        Msg.u.v1.uScreenId.SetUInt32(0);
+        Msg.u.v1.uX.SetUInt32(0);
+        Msg.u.v1.uY.SetUInt32(0);
+        Msg.u.v1.uDefAction.SetUInt32(0);
+        Msg.u.v1.uAllActions.SetUInt32(0);
+        Msg.u.v1.pvFormats.SetPtr(pszFormats, cbFormats);
+        Msg.u.v1.cFormats.SetUInt32(0);
+    }
+    else
+    {
+        Msg.hdr.cParms = 8;
+
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.uScreenId.SetUInt32(0);
+        Msg.u.v3.uX.SetUInt32(0);
+        Msg.u.v3.uY.SetUInt32(0);
+        Msg.u.v3.uDefAction.SetUInt32(0);
+        Msg.u.v3.uAllActions.SetUInt32(0);
+        Msg.u.v3.pvFormats.SetPtr(pszFormats, cbFormats);
+        Msg.u.v3.cFormats.SetUInt32(0);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -136,10 +153,23 @@
         if (RT_SUCCESS(rc))
         {
-            rc = Msg.uScreenId.GetUInt32(puScreenId);     AssertRC(rc);
-            rc = Msg.uX.GetUInt32(puX);                   AssertRC(rc);
-            rc = Msg.uY.GetUInt32(puY);                   AssertRC(rc);
-            rc = Msg.uDefAction.GetUInt32(puDefAction);   AssertRC(rc);
-            rc = Msg.uAllActions.GetUInt32(puAllActions); AssertRC(rc);
-            rc = Msg.cFormats.GetUInt32(pcbFormatsRecv);  AssertRC(rc);
+            if (pCtx->uProtocol < 3)
+            {
+                rc = Msg.u.v1.uScreenId.GetUInt32(puScreenId);     AssertRC(rc);
+                rc = Msg.u.v1.uX.GetUInt32(puX);                   AssertRC(rc);
+                rc = Msg.u.v1.uY.GetUInt32(puY);                   AssertRC(rc);
+                rc = Msg.u.v1.uDefAction.GetUInt32(puDefAction);   AssertRC(rc);
+                rc = Msg.u.v1.uAllActions.GetUInt32(puAllActions); AssertRC(rc);
+                rc = Msg.u.v1.cFormats.GetUInt32(pcbFormatsRecv);  AssertRC(rc);
+            }
+            else
+            {
+                /** @todo Context ID not used yet. */
+                rc = Msg.u.v3.uScreenId.GetUInt32(puScreenId);     AssertRC(rc);
+                rc = Msg.u.v3.uX.GetUInt32(puX);                   AssertRC(rc);
+                rc = Msg.u.v3.uY.GetUInt32(puY);                   AssertRC(rc);
+                rc = Msg.u.v3.uDefAction.GetUInt32(puDefAction);   AssertRC(rc);
+                rc = Msg.u.v3.uAllActions.GetUInt32(puAllActions); AssertRC(rc);
+                rc = Msg.u.v3.cFormats.GetUInt32(pcbFormatsRecv);  AssertRC(rc);
+            }
 
             AssertReturn(cbFormats >= *pcbFormatsRecv, VERR_TOO_MUCH_DATA);
@@ -158,5 +188,16 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = HOST_DND_HG_EVT_LEAVE;
-    Msg.hdr.cParms      = 0;
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 0;
+    }
+    else
+    {
+        Msg.hdr.cParms = 1;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -176,5 +217,16 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = HOST_DND_HG_EVT_CANCEL;
-    Msg.hdr.cParms      = 0;
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 0;
+    }
+    else
+    {
+        Msg.hdr.cParms = 1;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -202,9 +254,23 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = HOST_DND_HG_SND_DIR;
-    Msg.hdr.cParms      = 3;
-
-    Msg.pvName.SetPtr(pszDirname, cbDirname);
-    Msg.cbName.SetUInt32(cbDirname);
-    Msg.fMode.SetUInt32(0);
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 3;
+
+        Msg.u.v1.pvName.SetPtr(pszDirname, cbDirname);
+        Msg.u.v1.cbName.SetUInt32(cbDirname);
+        Msg.u.v1.fMode.SetUInt32(0);
+    }
+    else
+    {
+        Msg.hdr.cParms = 4;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.pvName.SetPtr(pszDirname, cbDirname);
+        Msg.u.v3.cbName.SetUInt32(cbDirname);
+        Msg.u.v3.fMode.SetUInt32(0);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -214,6 +280,15 @@
         if (RT_SUCCESS(Msg.hdr.result))
         {
-            rc = Msg.cbName.GetUInt32(pcbDirnameRecv); AssertRC(rc);
-            rc = Msg.fMode.GetUInt32(pfMode);          AssertRC(rc);
+            if (pCtx->uProtocol < 3)
+            {
+                rc = Msg.u.v1.cbName.GetUInt32(pcbDirnameRecv); AssertRC(rc);
+                rc = Msg.u.v1.fMode.GetUInt32(pfMode);          AssertRC(rc);
+            }
+            else
+            {
+                /** @todo Context ID not used yet. */
+                rc = Msg.u.v3.cbName.GetUInt32(pcbDirnameRecv); AssertRC(rc);
+                rc = Msg.u.v3.fMode.GetUInt32(pfMode);          AssertRC(rc);
+            }
 
             AssertReturn(cbDirname >= *pcbDirnameRecv, VERR_TOO_MUCH_DATA);
@@ -343,4 +418,6 @@
     else
     {
+        Msg.hdr.cParms = 6;
+
         Msg.uContext.SetUInt32(0); /** @todo Not used yet. */
         Msg.pvName.SetPtr(pszFilename, cbFilename);
@@ -349,6 +426,4 @@
         Msg.fMode.SetUInt32(0);
         Msg.cbTotal.SetUInt64(0);
-
-        Msg.hdr.cParms = 6;
 
         rc = VINF_SUCCESS;
@@ -1084,7 +1159,19 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = HOST_DND_GH_REQ_PENDING;
-    Msg.hdr.cParms      = 1;
-
-    Msg.uScreenId.SetUInt32(0);
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 1;
+
+        Msg.u.v1.uScreenId.SetUInt32(0);
+    }
+    else
+    {
+        Msg.hdr.cParms = 2;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.uScreenId.SetUInt32(0);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1094,5 +1181,13 @@
         if (RT_SUCCESS(rc))
         {
-            rc = Msg.uScreenId.GetUInt32(puScreenId); AssertRC(rc);
+            if (pCtx->uProtocol < 3)
+            {
+                rc = Msg.u.v1.uScreenId.GetUInt32(puScreenId); AssertRC(rc);
+            }
+            else
+            {
+                /** @todo Context ID not used yet. */
+                rc = Msg.u.v3.uContext.GetUInt32(puScreenId); AssertRC(rc);
+            }
         }
     }
@@ -1118,9 +1213,22 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = HOST_DND_GH_EVT_DROPPED;
-    Msg.hdr.cParms      = 3;
-
-    Msg.pvFormat.SetPtr(pszFormat, cbFormat);
-    Msg.cbFormat.SetUInt32(0);
-    Msg.uAction.SetUInt32(0);
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 3;
+
+        Msg.u.v1.pvFormat.SetPtr(pszFormat, cbFormat);
+        Msg.u.v1.cbFormat.SetUInt32(0);
+        Msg.u.v1.uAction.SetUInt32(0);
+    }
+    else
+    {
+        Msg.hdr.cParms = 4;
+
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.pvFormat.SetPtr(pszFormat, cbFormat);
+        Msg.u.v3.cbFormat.SetUInt32(0);
+        Msg.u.v3.uAction.SetUInt32(0);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1130,6 +1238,15 @@
         if (RT_SUCCESS(rc))
         {
-            rc = Msg.cbFormat.GetUInt32(pcbFormatRecv); AssertRC(rc);
-            rc = Msg.uAction.GetUInt32(puAction);       AssertRC(rc);
+            if (pCtx->uProtocol < 3)
+            {
+                rc = Msg.u.v1.cbFormat.GetUInt32(pcbFormatRecv); AssertRC(rc);
+                rc = Msg.u.v1.uAction.GetUInt32(puAction);       AssertRC(rc);
+            }
+            else
+            {
+                /** @todo Context ID not used yet. */
+                rc = Msg.u.v3.cbFormat.GetUInt32(pcbFormatRecv); AssertRC(rc);
+                rc = Msg.u.v3.uAction.GetUInt32(puAction);       AssertRC(rc);
+            }
 
             AssertReturn(cbFormat >= *pcbFormatRecv, VERR_TOO_MUCH_DATA);
@@ -1216,8 +1333,21 @@
         Msg.hdr.u32ClientID = pCtx->uClientID;
         Msg.hdr.u32Function = GUEST_DND_CONNECT;
-        Msg.hdr.cParms      = 2;
-
-        Msg.uProtocol.SetUInt32(pCtx->uProtocol);
-        Msg.uFlags.SetUInt32(0); /* Unused at the moment. */
+
+        if (pCtx->uProtocol < 3)
+        {
+            Msg.hdr.cParms = 2;
+
+            Msg.u.v2.uProtocol.SetUInt32(pCtx->uProtocol);
+            Msg.u.v2.uFlags.SetUInt32(0); /* Unused at the moment. */
+        }
+        else
+        {
+            Msg.hdr.cParms = 3;
+
+             /** @todo Context ID not used yet. */
+            Msg.u.v3.uContext.SetUInt32(0);
+            Msg.u.v3.uProtocol.SetUInt32(pCtx->uProtocol);
+            Msg.u.v3.uFlags.SetUInt32(0); /* Unused at the moment. */
+        }
 
         int rc2 = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1375,7 +1505,19 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = GUEST_DND_HG_ACK_OP;
-    Msg.hdr.cParms      = 1;
-
-    Msg.uAction.SetUInt32(uAction);
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 1;
+
+        Msg.u.v1.uAction.SetUInt32(uAction);
+    }
+    else
+    {
+        Msg.hdr.cParms = 2;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.uAction.SetUInt32(uAction);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1396,7 +1538,25 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = GUEST_DND_HG_REQ_DATA;
-    Msg.hdr.cParms      = 1;
-
-    Msg.pFormat.SetPtr((void*)pcszFormat, strlen(pcszFormat) + 1 /* Include termination */);
+
+    if (!RTStrIsValidEncoding(pcszFormat))
+        return VERR_INVALID_PARAMETER;
+
+    const uint32_t cbFormat = (uint32_t)strlen(pcszFormat) + 1; /* Include termination */
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 1;
+
+        Msg.u.v1.pvFormat.SetPtr((void*)pcszFormat, cbFormat);
+    }
+    else
+    {
+        Msg.hdr.cParms = 3;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.pvFormat.SetPtr((void*)pcszFormat, cbFormat);
+        Msg.u.v3.cbFormat.SetUInt32(cbFormat);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1417,9 +1577,23 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = uStatus;
-    Msg.hdr.cParms      = 3;
-
-    Msg.uStatus.SetUInt32(uStatus);
-    Msg.uPercent.SetUInt32(uPercent);
-    Msg.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 3;
+
+        Msg.u.v1.uStatus.SetUInt32(uStatus);
+        Msg.u.v1.uPercent.SetUInt32(uPercent);
+        Msg.u.v1.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+    }
+    else
+    {
+        Msg.hdr.cParms = 4;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.uStatus.SetUInt32(uStatus);
+        Msg.u.v3.uPercent.SetUInt32(uPercent);
+        Msg.u.v3.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1437,4 +1611,7 @@
     AssertPtrReturn(pcszFormats, VERR_INVALID_POINTER);
     AssertReturn(cbFormats,      VERR_INVALID_PARAMETER);
+
+    if (!RTStrIsValidEncoding(pcszFormats))
+        return VERR_INVALID_PARAMETER;
 
     VBOXDNDGHACKPENDINGMSG Msg;
@@ -1443,9 +1620,24 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = GUEST_DND_GH_ACK_PENDING;
-    Msg.hdr.cParms      = 3;
-
-    Msg.uDefAction.SetUInt32(uDefAction);
-    Msg.uAllActions.SetUInt32(uAllActions);
-    Msg.pFormat.SetPtr((void*)pcszFormats, cbFormats);
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 3;
+
+        Msg.u.v1.uDefAction.SetUInt32(uDefAction);
+        Msg.u.v1.uAllActions.SetUInt32(uAllActions);
+        Msg.u.v1.pvFormats.SetPtr((void*)pcszFormats, cbFormats);
+    }
+    else
+    {
+        Msg.hdr.cParms = 5;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.uDefAction.SetUInt32(uDefAction);
+        Msg.u.v3.uAllActions.SetUInt32(uAllActions);
+        Msg.u.v3.pvFormats.SetPtr((void*)pcszFormats, cbFormats);
+        Msg.u.v3.cbFormats.SetUInt32(cbFormats);
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1563,4 +1755,10 @@
     AssertReturn(pObj->GetType() == DnDURIObject::Directory, VERR_INVALID_PARAMETER);
 
+    RTCString strPath = pObj->GetDestPath();
+    LogFlowFunc(("strDir=%s (%zu), fMode=0x%x\n",
+                 strPath.c_str(), strPath.length(), pObj->GetMode()));
+
+    const uint32_t cbPath = strPath.length() + 1; /* Include termination. */
+
     VBOXDNDGHSENDDIRMSG Msg;
     RT_ZERO(Msg);
@@ -1568,13 +1766,23 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = GUEST_DND_GH_SND_DIR;
-    Msg.hdr.cParms      = 3;
-
-    RTCString strPath = pObj->GetDestPath();
-    LogFlowFunc(("strDir=%s (%zu), fMode=0x%x\n",
-                 strPath.c_str(), strPath.length(), pObj->GetMode()));
-
-    Msg.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)(strPath.length() + 1));
-    Msg.cbName.SetUInt32((uint32_t)(strPath.length() + 1));
-    Msg.fMode.SetUInt32(pObj->GetMode());
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 3;
+
+        Msg.u.v1.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)cbPath);
+        Msg.u.v1.cbName.SetUInt32((uint32_t)cbPath);
+        Msg.u.v1.fMode.SetUInt32(pObj->GetMode());
+    }
+    else
+    {
+        Msg.hdr.cParms = 4;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)cbPath);
+        Msg.u.v3.cbName.SetUInt32((uint32_t)cbPath);
+        Msg.u.v3.fMode.SetUInt32(pObj->GetMode());
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
@@ -1869,7 +2077,19 @@
     Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = GUEST_DND_GH_EVT_ERROR;
-    Msg.hdr.cParms      = 1;
-
-    Msg.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+
+    if (pCtx->uProtocol < 3)
+    {
+        Msg.hdr.cParms = 1;
+
+        Msg.u.v1.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+    }
+    else
+    {
+        Msg.hdr.cParms = 2;
+
+        /** @todo Context ID not used yet. */
+        Msg.u.v3.uContext.SetUInt32(0);
+        Msg.u.v3.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+    }
 
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
Index: /trunk/src/VBox/HostServices/DragAndDrop/service.cpp
===================================================================
--- /trunk/src/VBox/HostServices/DragAndDrop/service.cpp	(revision 58256)
+++ /trunk/src/VBox/HostServices/DragAndDrop/service.cpp	(revision 58257)
@@ -347,5 +347,6 @@
                         {
                             VBOXDNDCBHGGETNEXTHOSTMSG data;
-                            data.hdr.u32Magic = CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG;
+                            RT_ZERO(data);
+                            data.hdr.uMagic = CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG;
                             rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
                             if (RT_SUCCESS(rc))
@@ -380,11 +381,17 @@
             {
                 LogFlowFunc(("GUEST_DND_CONNECT\n"));
-                if (cParms == 2)
-                {
+                if (cParms >= 2)
+                {
+                    const uint8_t idxProto = cParms >= 3 ? 1 : 0;
+
                     VBOXDNDCBCONNECTMSGDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_CONNECT;
-                    rc = paParms[0].getUInt32(&data.uProtocol);
-                    if (RT_SUCCESS(rc))
-                        rc = paParms[1].getUInt32(&data.uFlags);
+                    RT_ZERO(data);
+                    data.hdr.uMagic = CB_MAGIC_DND_CONNECT;
+                    if (cParms >= 3)
+                        rc = paParms[0].getUInt32(&data.hdr.uContextID);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[idxProto].getUInt32(&data.uProtocol);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[idxProto + 1].getUInt32(&data.uFlags);
                     if (RT_SUCCESS(rc))
                         rc = pClient->setProtocol(data.uProtocol);
@@ -400,11 +407,32 @@
             {
                 LogFlowFunc(("GUEST_DND_HG_ACK_OP\n"));
-                if (cParms == 1)
-                {
-                    VBOXDNDCBHGACKOPDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_HG_ACK_OP;
-                    rc = paParms[0].getUInt32(&data.uAction); /* Get drop action. */
-                    DO_HOST_CALLBACK();
-                }
+
+                VBOXDNDCBHGACKOPDATA data;
+                RT_ZERO(data);
+                data.hdr.uMagic = CB_MAGIC_DND_HG_ACK_OP;
+
+                switch (pClient->protocol())
+                {
+                    case 3:
+                    {
+                        if (cParms == 2)
+                        {
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.uAction); /* Get drop action. */
+                        }
+                        break;
+                    }
+
+                    case 2:
+                    default:
+                    {
+                        if (cParms == 1)
+                            rc = paParms[0].getUInt32(&data.uAction); /* Get drop action. */
+                        break;
+                    }
+                }
+
+                DO_HOST_CALLBACK();
                 break;
             }
@@ -412,11 +440,34 @@
             {
                 LogFlowFunc(("GUEST_DND_HG_REQ_DATA\n"));
-                if (cParms == 1)
-                {
-                    VBOXDNDCBHGREQDATADATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_HG_REQ_DATA;
-                    rc = paParms[0].getPointer((void**)&data.pszFormat, &data.cbFormat);
-                    DO_HOST_CALLBACK();
-                }
+
+                VBOXDNDCBHGREQDATADATA data;
+                RT_ZERO(data);
+                data.hdr.uMagic = CB_MAGIC_DND_HG_REQ_DATA;
+
+                switch (pClient->protocol())
+                {
+                    case 3:
+                    {
+                        if (cParms == 3)
+                        {
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getPointer((void **)&data.pszFormat, &data.cbFormat);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getUInt32(&data.cbFormat);
+                        }
+                        break;
+                    }
+
+                    case 2:
+                    default:
+                    {
+                        if (cParms == 1)
+                            rc = paParms[0].getPointer((void**)&data.pszFormat, &data.cbFormat);
+                        break;
+                    }
+                }
+
+                DO_HOST_CALLBACK();
                 break;
             }
@@ -424,15 +475,42 @@
             {
                 LogFlowFunc(("GUEST_DND_HG_EVT_PROGRESS\n"));
-                if (cParms == 3)
-                {
-                    VBOXDNDCBHGEVTPROGRESSDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_HG_EVT_PROGRESS;
-                    rc = paParms[0].getUInt32(&data.uStatus);
-                    if (RT_SUCCESS(rc))
-                        rc = paParms[1].getUInt32(&data.uPercentage);
-                    if (RT_SUCCESS(rc))
-                        rc = paParms[2].getUInt32(&data.rc);
-                    DO_HOST_CALLBACK();
-                }
+
+                VBOXDNDCBHGEVTPROGRESSDATA data;
+                RT_ZERO(data);
+                data.hdr.uMagic = CB_MAGIC_DND_HG_EVT_PROGRESS;
+
+                switch (pClient->protocol())
+                {
+                    case 3:
+                    {
+                        if (cParms == 4)
+                        {
+                            rc = paParms[0].getUInt32(&data.uStatus);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.uStatus);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getUInt32(&data.uPercentage);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[3].getUInt32(&data.rc);
+                        }
+                        break;
+                    }
+
+                    case 2:
+                    default:
+                    {
+                        if (cParms == 3)
+                        {
+                            rc = paParms[0].getUInt32(&data.uStatus);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.uPercentage);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getUInt32(&data.rc);
+                        }
+                        break;
+                    }
+                }
+
+                DO_HOST_CALLBACK();
                 break;
             }
@@ -441,15 +519,44 @@
             {
                 LogFlowFunc(("GUEST_DND_GH_ACK_PENDING\n"));
-                if (cParms == 3)
-                {
-                    VBOXDNDCBGHACKPENDINGDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_GH_ACK_PENDING;
-                    rc = paParms[0].getUInt32(&data.uDefAction);
-                    if (RT_SUCCESS(rc))
-                        rc = paParms[1].getUInt32(&data.uAllActions);
-                    if (RT_SUCCESS(rc))
-                        rc = paParms[2].getPointer((void**)&data.pszFormat, &data.cbFormat);
-                    DO_HOST_CALLBACK();
-                }
+
+                VBOXDNDCBGHACKPENDINGDATA data;
+                RT_ZERO(data);
+                data.hdr.uMagic = CB_MAGIC_DND_GH_ACK_PENDING;
+
+                switch (pClient->protocol())
+                {
+                    case 3:
+                    {
+                        if (cParms == 5)
+                        {
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.uDefAction);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getUInt32(&data.uAllActions);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[3].getPointer((void**)&data.pszFormat, &data.cbFormat);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[4].getUInt32(&data.cbFormat);
+                        }
+                        break;
+                    }
+
+                    case 2:
+                    default:
+                    {
+                        if (cParms == 3)
+                        {
+                            rc = paParms[0].getUInt32(&data.uDefAction);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.uAllActions);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getPointer((void**)&data.pszFormat, &data.cbFormat);
+                        }
+                        break;
+                    }
+                }
+
+                DO_HOST_CALLBACK();
                 break;
             }
@@ -461,6 +568,7 @@
                 {
                     VBOXDNDCBSNDDATAHDRDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DATA_HDR;
-                    rc = paParms[0].getUInt32(&data.hdr.u32ContextID);
+                    RT_ZERO(data);
+                    data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DATA_HDR;
+                    rc = paParms[0].getUInt32(&data.hdr.uContextID);
                     if (RT_SUCCESS(rc))
                         rc = paParms[1].getUInt32(&data.data.uFlags);
@@ -502,6 +610,7 @@
                         {
                             VBOXDNDCBSNDDATADATA data;
-                            data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DATA;
-                            rc = paParms[0].getUInt32(&data.hdr.u32ContextID);
+                            RT_ZERO(data);
+                            data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DATA;
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
                             if (RT_SUCCESS(rc))
                                 rc = paParms[1].getPointer((void**)&data.data.u.v3.pvData, &data.data.u.v3.cbData);
@@ -523,5 +632,6 @@
                         {
                             VBOXDNDCBSNDDATADATA data;
-                            data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DATA;
+                            RT_ZERO(data);
+                            data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DATA;
                             rc = paParms[0].getPointer((void**)&data.data.u.v1.pvData, &data.data.u.v1.cbData);
                             if (RT_SUCCESS(rc))
@@ -537,18 +647,42 @@
             {
                 LogFlowFunc(("GUEST_DND_GH_SND_DIR\n"));
-                if (cParms == 3)
-                {
-                    VBOXDNDCBSNDDIRDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DIR;
-                    uint32_t cTmp;
-                    rc = paParms[0].getPointer((void**)&data.pszPath, &cTmp);
-                    if (RT_SUCCESS(rc))
-                        rc = paParms[1].getUInt32(&data.cbPath);
-                    if (RT_SUCCESS(rc))
-                        rc = paParms[2].getUInt32(&data.fMode);
-
-                    LogFlowFunc(("pszPath=%s, cbPath=%RU32, fMode=0x%x\n", data.pszPath, data.cbPath, data.fMode));
-                    DO_HOST_CALLBACK();
-                }
+
+                VBOXDNDCBSNDDIRDATA data;
+                RT_ZERO(data);
+                data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DIR;
+
+                switch (pClient->protocol())
+                {
+                    case 3:
+                    {
+                        if (cParms == 4)
+                        {
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[0].getPointer((void**)&data.pszPath, &data.cbPath);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.cbPath);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getUInt32(&data.fMode);
+                        }
+                        break;
+                    }
+
+                    case 2:
+                    default:
+                    {
+                        if (cParms == 3)
+                        {
+                            rc = paParms[0].getPointer((void**)&data.pszPath, &data.cbPath);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.cbPath);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getUInt32(&data.fMode);
+                        }
+                        break;
+                    }
+                }
+
+                DO_HOST_CALLBACK();
                 break;
             }
@@ -560,8 +694,10 @@
                 {
                     VBOXDNDCBSNDFILEHDRDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_HDR;
-                    uint32_t cTmp;
-                    /* paParms[0] is context ID; unused yet. */
-                    rc = paParms[1].getPointer((void**)&data.pszFilePath, &cTmp);
+                    RT_ZERO(data);
+                    data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_HDR;
+
+                    rc = paParms[0].getUInt32(&data.hdr.uContextID);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[1].getPointer((void**)&data.pszFilePath, &data.cbFilePath);
                     if (RT_SUCCESS(rc))
                         rc = paParms[2].getUInt32(&data.cbFilePath);
@@ -591,6 +727,8 @@
                         {
                             VBOXDNDCBSNDFILEDATADATA data;
-                            data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_DATA;
-                            rc = paParms[0].getUInt32(&data.hdr.u32ContextID);
+                            RT_ZERO(data);
+                            data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_DATA;
+
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
                             if (RT_SUCCESS(rc))
                                 rc = paParms[1].getPointer((void**)&data.pvData, &data.cbData);
@@ -613,6 +751,7 @@
                         {
                             VBOXDNDCBSNDFILEDATADATA data;
-                            data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_DATA;
-                            rc = paParms[0].getUInt32(&data.hdr.u32ContextID);
+                            RT_ZERO(data);
+                            data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_DATA;
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
                             if (RT_SUCCESS(rc))
                                 rc = paParms[1].getPointer((void**)&data.pvData, &data.cbData);
@@ -631,5 +770,6 @@
                         {
                             VBOXDNDCBSNDFILEDATADATA data;
-                            data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_DATA;
+                            RT_ZERO(data);
+                            data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_DATA;
                             uint32_t cTmp;
                             rc = paParms[0].getPointer((void**)&data.u.v1.pszFilePath, &cTmp);
@@ -655,16 +795,42 @@
             {
                 LogFlowFunc(("GUEST_DND_GH_EVT_ERROR\n"));
-                if (cParms == 1)
-                {
-                    VBOXDNDCBEVTERRORDATA data;
-                    data.hdr.u32Magic = CB_MAGIC_DND_GH_EVT_ERROR;
-
-                    uint32_t rcOp;
-                    rc = paParms[0].getUInt32(&rcOp);
-                    if (RT_SUCCESS(rc))
-                        data.rc = rcOp;
-
-                    DO_HOST_CALLBACK();
-                }
+
+                VBOXDNDCBEVTERRORDATA data;
+                RT_ZERO(data);
+                data.hdr.uMagic = CB_MAGIC_DND_GH_EVT_ERROR;
+
+                switch (pClient->protocol())
+                {
+                    case 3:
+                    {
+                        if (cParms == 2)
+                        {
+                            rc = paParms[0].getUInt32(&data.hdr.uContextID);
+                            if (RT_SUCCESS(rc))
+                            {
+                                uint32_t rcOp;
+                                rc = paParms[1].getUInt32(&rcOp);
+                                if (RT_SUCCESS(rc))
+                                    data.rc = rcOp;
+                            }
+                        }
+                        break;
+                    }
+
+                    case 2:
+                    default:
+                    {
+                        if (cParms == 1)
+                        {
+                            uint32_t rcOp;
+                            rc = paParms[0].getUInt32(&rcOp);
+                            if (RT_SUCCESS(rc))
+                                data.rc = (int32_t)rcOp;
+                        }
+                        break;
+                    }
+                }
+
+                DO_HOST_CALLBACK();
                 break;
             }
@@ -679,5 +845,6 @@
                     {
                         VBOXDNDCBHGGETNEXTHOSTMSGDATA data;
-                        data.hdr.u32Magic = VBOX_DND_CB_MAGIC_MAKE(0 /* uFn */, 0 /* uVer */);
+                        RT_ZERO(data);
+                        data.hdr.uMagic = VBOX_DND_CB_MAGIC_MAKE(0 /* uFn */, 0 /* uVer */);
                         data.uMsg    = u32Function;
                         data.cParms  = cParms;
@@ -831,5 +998,5 @@
 
         VBOXDNDCBHGEVTPROGRESSDATA data;
-        data.hdr.u32Magic = CB_MAGIC_DND_HG_EVT_PROGRESS;
+        data.hdr.uMagic = CB_MAGIC_DND_HG_EVT_PROGRESS;
         data.uPercentage  = RT_MIN(uPercentage, 100);
         data.uStatus      = uStatus;
Index: /trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp	(revision 58256)
+++ /trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp	(revision 58257)
@@ -374,5 +374,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGACKOPDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             setDefAction(pCBData->uAction);
@@ -386,5 +386,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGREQDATADATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             if (   pCBData->cbFormat  == 0
@@ -416,5 +416,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGEVTPROGRESSDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             rc = setProgress(pCBData->uPercentage, pCBData->uStatus, pCBData->rc);
@@ -430,5 +430,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBGHACKPENDINGDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             if (   pCBData->cbFormat  == 0
Index: /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp	(revision 58256)
+++ /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp	(revision 58257)
@@ -253,4 +253,6 @@
     GuestDnDMsg Msg;
     Msg.setType(HOST_DND_GH_REQ_PENDING);
+    if (mDataBase.m_uProtocolVersion >= 3)
+        Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
     Msg.setNextUInt32(uScreenId);
 
@@ -1036,4 +1038,6 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_GH_EVT_DROPPED);
+        if (mDataBase.m_uProtocolVersion >= 3)
+            Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
         Msg.setNextPointer((void*)pCtx->mFmtRecv.c_str(), (uint32_t)pCtx->mFmtRecv.length() + 1);
         Msg.setNextUInt32((uint32_t)pCtx->mFmtRecv.length() + 1);
@@ -1135,4 +1139,6 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_GH_EVT_DROPPED);
+        if (mDataBase.m_uProtocolVersion >= 3)
+            Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
         Msg.setNextPointer((void*)pCtx->mFmtRecv.c_str(), (uint32_t)pCtx->mFmtRecv.length() + 1);
         Msg.setNextUInt32((uint32_t)pCtx->mFmtRecv.length() + 1);
@@ -1224,5 +1230,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBSNDDATAHDRDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             rc = pThis->i_onReceiveDataHdr(pCtx, &pCBData->data);
@@ -1234,5 +1240,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBSNDDATADATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             rc = pThis->i_onReceiveData(pCtx, &pCBData->data);
@@ -1244,5 +1250,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             pCtx->mpResp->reset();
@@ -1297,5 +1303,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBSNDDATAHDRDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             rc = pThis->i_onReceiveDataHdr(pCtx, &pCBData->data);
@@ -1307,5 +1313,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBSNDDATADATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             rc = pThis->i_onReceiveData(pCtx, &pCBData->data);
@@ -1317,5 +1323,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBSNDDIRDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_SND_DIR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_SND_DIR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             rc = pThis->i_onReceiveDir(pCtx, pCBData->pszPath, pCBData->cbPath, pCBData->fMode);
@@ -1327,5 +1333,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBSNDFILEHDRDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_SND_FILE_HDR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_SND_FILE_HDR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             rc = pThis->i_onReceiveFileHdr(pCtx, pCBData->pszFilePath, pCBData->cbFilePath,
@@ -1338,5 +1344,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBSNDFILEDATADATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_SND_FILE_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_SND_FILE_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             if (pThis->mDataBase.m_uProtocolVersion <= 1)
@@ -1363,5 +1369,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             pCtx->mpResp->reset();
Index: /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 58256)
+++ /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 58257)
@@ -303,4 +303,6 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_ENTER);
+        if (mDataBase.m_uProtocolVersion >= 3)
+            Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
         Msg.setNextUInt32(aScreenId);
         Msg.setNextUInt32(aX);
@@ -377,4 +379,6 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_MOVE);
+        if (mDataBase.m_uProtocolVersion >= 3)
+            Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
         Msg.setNextUInt32(aScreenId);
         Msg.setNextUInt32(aX);
@@ -489,4 +493,6 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_DROPPED);
+        if (mDataBase.m_uProtocolVersion >= 3)
+            Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
         Msg.setNextUInt32(aScreenId);
         Msg.setNextUInt32(aX);
@@ -810,5 +816,5 @@
     else
     {
-        Msg.setNextUInt32(0);                                                              /** @todo uContext; not used yet. */
+        Msg.setNextUInt32(0); /** @todo ContextID not used yet. */
         Msg.setNextPointer(pData->getMeta().getDataMutable(), pData->getMeta().getSize()); /* pvData */
         Msg.setNextUInt32(pData->getMeta().getSize());                                     /* cbData */
@@ -872,4 +878,6 @@
 
     pMsg->setType(HOST_DND_HG_SND_DIR);
+    if (mDataBase.m_uProtocolVersion >= 3)
+        pMsg->setNextUInt32(0); /** @todo ContextID not used yet. */
     pMsg->setNextString(strPath.c_str());                  /* path */
     pMsg->setNextUInt32((uint32_t)(strPath.length() + 1)); /* path length (maximum is RTPATH_MAX on guest side). */
@@ -920,7 +928,6 @@
                  */
                 pMsg->setType(HOST_DND_HG_SND_FILE_HDR);
-                pMsg->setNextUInt32(0);                                            /* uContextID */
-                rc = pMsg->setNextString(pObj->GetDestPath().c_str());             /* pvName */
-                AssertRC(rc);
+                pMsg->setNextUInt32(0); /** @todo ContextID not used yet. */
+                pMsg->setNextString(pObj->GetDestPath().c_str());                  /* pvName */
                 pMsg->setNextUInt32((uint32_t)(pObj->GetDestPath().length() + 1)); /* cbName */
                 pMsg->setNextUInt32(0);                                            /* uFlags */
@@ -989,6 +996,5 @@
     else if (mDataBase.m_uProtocolVersion >= 2)
     {
-        /* Since protocol v2 we also send the context ID. Currently unused. */
-        pMsg->setNextUInt32(0);                                            /* uContext */
+        pMsg->setNextUInt32(0);                                            /** @todo ContextID not used yet. */
     }
 
@@ -1057,5 +1063,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBHGGETNEXTHOSTMSG) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             try
@@ -1097,5 +1103,5 @@
             AssertPtr(pCBData);
             AssertReturn(sizeof(VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+            AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
             pCtx->mpResp->reset();
@@ -1243,16 +1249,8 @@
     AssertPtr(pCtx->mpResp);
 
-#define URI_DATA_IS_VALID_BREAK(x) \
-    if (!x) \
-    { \
-        LogFlowFunc(("Invalid URI data value for \"" #x "\"\n")); \
-        rc = VERR_INVALID_PARAMETER; \
-        break; \
-    }
-
 #define REGISTER_CALLBACK(x)                                        \
     rc = pCtx->mpResp->setCallback(x, i_sendURIDataCallback, pCtx); \
     if (RT_FAILURE(rc))                                             \
-        return rc;
+        break;
 
 #define UNREGISTER_CALLBACK(x)                        \
@@ -1269,16 +1267,4 @@
     if (RT_FAILURE(rc))
         return rc;
-
-    /*
-     * Register callbacks.
-     */
-    /* Guest callbacks. */
-    REGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG);
-    REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);
-    /* Host callbacks. */
-    REGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
-    if (mDataBase.m_uProtocolVersion >= 2)
-        REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
-    REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
 
     do
@@ -1340,4 +1326,16 @@
         if (RT_SUCCESS(rc))
         {
+            /*
+             * Register callbacks.
+             */
+            /* Guest callbacks. */
+            REGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG);
+            REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);
+            /* Host callbacks. */
+            REGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
+            if (mDataBase.m_uProtocolVersion >= 2)
+                REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
+            REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
+
             rc = waitForEvent(&pCtx->mCBEvent, pCtx->mpResp, msTimeout);
             if (RT_FAILURE(rc))
@@ -1351,19 +1349,19 @@
             else
                 rc = pCtx->mpResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
+
+            /*
+             * Unregister callbacks.
+             */
+            /* Guest callbacks. */
+            UNREGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG);
+            UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);
+            /* Host callbacks. */
+            UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
+            if (mDataBase.m_uProtocolVersion >= 2)
+                UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
+            UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
         }
 
     } while (0);
-
-    /*
-     * Unregister callbacks.
-     */
-    /* Guest callbacks. */
-    UNREGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG);
-    UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);
-    /* Host callbacks. */
-    UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
-    if (mDataBase.m_uProtocolVersion >= 2)
-        UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
-    UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
 
 #undef REGISTER_CALLBACK
@@ -1380,6 +1378,4 @@
         AssertRC(rc2);
     }
-
-#undef URI_DATA_IS_VALID_BREAK
 
     LogFlowFuncLeaveRC(rc);
