Index: /trunk/src/VBox/Main/include/GuestDnDPrivate.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestDnDPrivate.h	(revision 85743)
+++ /trunk/src/VBox/Main/include/GuestDnDPrivate.h	(revision 85744)
@@ -37,5 +37,5 @@
 class Guest;
 class GuestDnDBase;
-class GuestDnDResponse;
+class GuestDnDState;
 class GuestDnDSource;
 class GuestDnDTarget;
@@ -481,6 +481,6 @@
     /** Pointer to guest target class this context belongs to. */
     GuestDnDTarget                     *pTarget;
-    /** Pointer to guest response class this context belongs to. */
-    GuestDnDResponse                   *pResp;
+    /** Pointer to guest state this context belongs to. */
+    GuestDnDState                      *pState;
     /** Target (VM) screen ID. */
     uint32_t                            uScreenID;
@@ -558,6 +558,6 @@
     /** Pointer to guest source class this context belongs to. */
     GuestDnDSource                     *pSource;
-    /** Pointer to guest response class this context belongs to. */
-    GuestDnDResponse                   *pResp;
+    /** Pointer to guest state this context belongs to. */
+    GuestDnDState                      *pState;
     /** Formats offered by the guest (and supported by the host). */
     GuestDnDMIMEList                    lstFmtOffered;
@@ -797,14 +797,14 @@
 typedef std::map<uint32_t, GuestDnDCallback> GuestDnDCallbackMap;
 
-/** @todo r=andy This class needs to go, as this now is too inflexible when it comes to all
- *               the callback handling/dispatching. It's part of the initial code and only adds
- *               unnecessary complexity. */
-class GuestDnDResponse
-{
-
-public:
-
-    GuestDnDResponse(const ComObjPtr<Guest>& pGuest);
-    virtual ~GuestDnDResponse(void);
+/**
+ * Class for keeping a DnD guest state around.
+ */
+class GuestDnDState
+{
+
+public:
+
+    GuestDnDState(const ComObjPtr<Guest>& pGuest);
+    virtual ~GuestDnDState(void);
 
 public:
@@ -925,6 +925,6 @@
      * @{ */
     HRESULT           adjustScreenCoordinates(ULONG uScreenId, ULONG *puX, ULONG *puY) const;
+    GuestDnDState    *getState(uint32_t = 0) const;
     int               hostCall(uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms) const;
-    GuestDnDResponse *response(void) { return m_pResponse; }
     GuestDnDMIMEList  defaultFormats(void) const { return m_strDefaultFormats; }
     /** @}  */
@@ -968,7 +968,7 @@
     /** Pointer to guest implementation. */
     const ComObjPtr<Guest>      m_pGuest;
-    /** The current (last) response from the guest. At the
-     *  moment we only support only response a time (ARQ-style). */
-    GuestDnDResponse           *m_pResponse;
+    /** The current state from the guest. At the
+     *  moment we only support only state a time (ARQ-style). */
+    GuestDnDState              *m_pState;
     /** Critical section to serialize access. */
     RTCRITSECT                  m_CritSect;
@@ -1022,6 +1022,6 @@
 
     int sendCancel(void);
-    int updateProgress(GuestDnDData *pData, GuestDnDResponse *pResp, size_t cbDataAdd = 0);
-    int waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnDResponse *pResp, RTMSINTERVAL msTimeout);
+    int updateProgress(GuestDnDData *pData, GuestDnDState *pState, size_t cbDataAdd = 0);
+    int waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnDState *pState, RTMSINTERVAL msTimeout);
 
 protected:
@@ -1037,6 +1037,6 @@
     /** Whether the object still is in pending state. */
     bool                            m_fIsPending;
-    /** Pointer to response bound to this object. */
-    GuestDnDResponse               *m_pResp;
+    /** Pointer to state bound to this object. */
+    GuestDnDState                  *m_pState;
     /** @}  */
 
Index: /trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp	(revision 85743)
+++ /trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp	(revision 85744)
@@ -184,5 +184,5 @@
 GuestDnDSendCtx::GuestDnDSendCtx(void)
     : pTarget(NULL)
-    , pResp(NULL)
+    , pState(NULL)
 {
     reset();
@@ -194,6 +194,6 @@
 void GuestDnDSendCtx::reset(void)
 {
-    if (pResp)
-        pResp->reset();
+    if (pState)
+        pState->reset();
 
     uScreenID  = 0;
@@ -213,5 +213,5 @@
 GuestDnDRecvCtx::GuestDnDRecvCtx(void)
     : pSource(NULL)
-    , pResp(NULL)
+    , pState(NULL)
 {
     reset();
@@ -223,6 +223,6 @@
 void GuestDnDRecvCtx::reset(void)
 {
-    if (pResp)
-        pResp->reset();
+    if (pState)
+        pState->reset();
 
     lstFmtOffered.clear();
@@ -290,5 +290,5 @@
  ********************************************************************************************************************************/
 
-GuestDnDResponse::GuestDnDResponse(const ComObjPtr<Guest>& pGuest)
+GuestDnDState::GuestDnDState(const ComObjPtr<Guest>& pGuest)
     : m_uProtocolVersion(0)
     , m_fGuestFeatures0(VBOX_DND_GF_NONE)
@@ -303,5 +303,5 @@
 }
 
-GuestDnDResponse::~GuestDnDResponse(void)
+GuestDnDState::~GuestDnDState(void)
 {
     reset();
@@ -314,5 +314,5 @@
  * Notifies the waiting side about a guest notification response.
  */
-int GuestDnDResponse::notifyAboutGuestResponse(void) const
+int GuestDnDState::notifyAboutGuestResponse(void) const
 {
     return RTSemEventSignal(m_EventSem);
@@ -322,5 +322,5 @@
  * Resets a GuestDnDResponse object.
  */
-void GuestDnDResponse::reset(void)
+void GuestDnDState::reset(void)
 {
     LogFlowThisFuncEnter();
@@ -338,5 +338,5 @@
  * @param   pParent             Parent to set for the progress object.
  */
-HRESULT GuestDnDResponse::resetProgress(const ComObjPtr<Guest>& pParent)
+HRESULT GuestDnDState::resetProgress(const ComObjPtr<Guest>& pParent)
 {
     m_pProgress.setNull();
@@ -358,5 +358,5 @@
  * @returns \c true if canceled, \c false if not.
  */
-bool GuestDnDResponse::isProgressCanceled(void) const
+bool GuestDnDState::isProgressCanceled(void) const
 {
     BOOL fCanceled;
@@ -380,5 +380,5 @@
  * @param   pvUser              User-provided arguments for the callback function. Optional and can be NULL.
  */
-int GuestDnDResponse::setCallback(uint32_t uMsg, PFNGUESTDNDCALLBACK pfnCallback, void *pvUser /* = NULL */)
+int GuestDnDState::setCallback(uint32_t uMsg, PFNGUESTDNDCALLBACK pfnCallback, void *pvUser /* = NULL */)
 {
     GuestDnDCallbackMap::iterator it = m_mapCallbacks.find(uMsg);
@@ -413,6 +413,6 @@
  * @param   strMsg              Message to set. Optional.
  */
-int GuestDnDResponse::setProgress(unsigned uPercentage, uint32_t uStatus,
-                                  int rcOp /* = VINF_SUCCESS */, const Utf8Str &strMsg /* = "" */)
+int GuestDnDState::setProgress(unsigned uPercentage, uint32_t uStatus,
+                               int rcOp /* = VINF_SUCCESS */, const Utf8Str &strMsg /* = "" */)
 {
     LogFlowFunc(("uPercentage=%u, uStatus=%RU32, , rcOp=%Rrc, strMsg=%s\n",
@@ -516,5 +516,5 @@
  * @param   cbParms             Size (in bytes) of \a pvParms.
  */
-int GuestDnDResponse::onDispatch(uint32_t u32Function, void *pvParms, uint32_t cbParms)
+int GuestDnDState::onDispatch(uint32_t u32Function, void *pvParms, uint32_t cbParms)
 {
     LogFlowFunc(("u32Function=%RU32, pvParms=%p, cbParms=%RU32\n", u32Function, pvParms, cbParms));
@@ -687,5 +687,5 @@
  * @param   ppProgress          Where to query the progress object to.
  */
-HRESULT GuestDnDResponse::queryProgressTo(IProgress **ppProgress)
+HRESULT GuestDnDState::queryProgressTo(IProgress **ppProgress)
 {
     return m_pProgress.queryInterfaceTo(ppProgress);
@@ -698,5 +698,5 @@
  * @param   msTimeout           Timeout (in ms) for waiting. Optional, waits 500 ms if not specified.
  */
-int GuestDnDResponse::waitForGuestResponse(RTMSINTERVAL msTimeout /*= 500 */) const
+int GuestDnDState::waitForGuestResponse(RTMSINTERVAL msTimeout /*= 500 */) const
 {
     int rc = RTSemEventWait(m_EventSem, msTimeout);
@@ -722,5 +722,5 @@
     try
     {
-        m_pResponse = new GuestDnDResponse(pGuest);
+        m_pState = new GuestDnDState(pGuest);
     }
     catch (std::bad_alloc &)
@@ -751,6 +751,6 @@
     RTCritSectDelete(&m_CritSect);
 
-    if (m_pResponse)
-        delete m_pResponse;
+    if (m_pState)
+        delete m_pState;
 }
 
@@ -794,4 +794,17 @@
 
 /**
+ * Returns a DnD guest state.
+ *
+ * @returns Pointer to DnD guest state, or NULL if not found / invalid.
+ * @param   uID                 ID of DnD guest state to return.
+ */
+GuestDnDState *GuestDnD::getState(uint32_t uID /* = 0 */) const
+{
+    AssertMsgReturn(uID == 0, ("Only one state (0) is supported at the moment\n"), NULL);
+
+    return m_pState;
+}
+
+/**
  * Sends a (blocking) message to the host side of the host service.
  *
@@ -941,7 +954,6 @@
      *        would be the place to lookup and dispatch to those. For the moment we
      *        only have one response -- simple. */
-    GuestDnDResponse *pResp = pGuestDnD->m_pResponse;
-    if (pResp)
-        return pResp->onDispatch(u32Function, pvParms, cbParms);
+    if (pGuestDnD->m_pState)
+        return pGuestDnD->m_pState->onDispatch(u32Function, pvParms, cbParms);
 
     return VERR_NOT_SUPPORTED;
@@ -1308,5 +1320,5 @@
     GuestDnDMsg Msg;
     Msg.setType(HOST_DND_CANCEL);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         Msg.appendUInt32(0); /** @todo ContextID not used yet. */
 
@@ -1325,12 +1337,12 @@
  * @returns VBox status code.
  * @param   pData               GuestDnDData object to use for accounting.
- * @param   pResp               GuestDnDResponse to update its progress object for.
+ * @param   pState              Guest state to update its progress object for.
  * @param   cbDataAdd           By how much data (in bytes) to update the progress.
  */
-int GuestDnDBase::updateProgress(GuestDnDData *pData, GuestDnDResponse *pResp,
+int GuestDnDBase::updateProgress(GuestDnDData *pData, GuestDnDState *pState,
                                  size_t cbDataAdd /* = 0 */)
 {
     AssertPtrReturn(pData, VERR_INVALID_POINTER);
-    AssertPtrReturn(pResp, VERR_INVALID_POINTER);
+    AssertPtrReturn(pState, VERR_INVALID_POINTER);
     /* cbDataAdd is optional. */
 
@@ -1338,5 +1350,5 @@
                  pData->cbExtra, pData->cbProcessed, pData->getRemaining(), cbDataAdd));
 
-    if (   !pResp
+    if (   !pState
         || !cbDataAdd) /* Only update if something really changes. */
         return VINF_SUCCESS;
@@ -1349,8 +1361,8 @@
     LogRel2(("DnD: Transfer %RU8%% complete\n", uPercent));
 
-    int rc = pResp->setProgress(uPercent,
-                                  pData->isComplete()
-                                ? DND_PROGRESS_COMPLETE
-                                : DND_PROGRESS_RUNNING);
+    int rc = pState->setProgress(uPercent,
+                                   pData->isComplete()
+                                 ? DND_PROGRESS_COMPLETE
+                                 : DND_PROGRESS_RUNNING);
     LogFlowFuncLeaveRC(rc);
     return rc;
@@ -1360,15 +1372,13 @@
  * Waits for a specific guest callback event to get signalled.
  *
- ** @todo GuestDnDResponse *pResp needs to go.
- *
  * @returns VBox status code. Will return VERR_CANCELLED if the user has cancelled the progress object.
  * @param   pEvent                  Callback event to wait for.
- * @param   pResp                   Response to update.
+ * @param   pState                  Guest state to update.
  * @param   msTimeout               Timeout (in ms) to wait.
  */
-int GuestDnDBase::waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnDResponse *pResp, RTMSINTERVAL msTimeout)
+int GuestDnDBase::waitForEvent(GuestDnDCallbackEvent *pEvent, GuestDnDState *pState, RTMSINTERVAL msTimeout)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
-    AssertPtrReturn(pResp, VERR_INVALID_POINTER);
+    AssertPtrReturn(pState, VERR_INVALID_POINTER);
 
     int rc;
@@ -1400,5 +1410,5 @@
             LogRel2(("DnD: Error: Guest did not respond within time\n"));
         }
-        else if (pResp->isProgressCanceled()) /** @todo GuestDnDResponse *pResp needs to go. */
+        else if (pState->isProgressCanceled())
         {
             LogRel2(("DnD: Operation was canceled by user\n"));
Index: /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp	(revision 85743)
+++ /trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp	(revision 85744)
@@ -163,6 +163,6 @@
      *  nor 2) mixed transfers (G->H + H->G at the same time).
      */
-    m_pResp = GuestDnDInst()->response();
-    AssertPtrReturn(m_pResp, E_POINTER);
+    m_pState = GuestDnDInst()->getState();
+    AssertPtrReturn(m_pState, E_POINTER);
 
     /* Confirm a successful initialization when it's the case. */
@@ -276,5 +276,5 @@
     GuestDnDMsg Msg;
     Msg.setType(HOST_DND_GH_REQ_PENDING);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         Msg.appendUInt32(0); /** @todo ContextID not used yet. */
     Msg.appendUInt32(uScreenId);
@@ -283,15 +283,15 @@
     if (RT_SUCCESS(rc))
     {
-        GuestDnDResponse *pResp = GuestDnDInst()->response();
-        AssertPtr(pResp);
+        GuestDnDState *pState = GuestDnDInst()->getState();
+        AssertPtr(pState);
 
         bool fFetchResult = true;
 
-        rc = pResp->waitForGuestResponse(100 /* Timeout in ms */);
+        rc = pState->waitForGuestResponse(100 /* Timeout in ms */);
         if (RT_FAILURE(rc))
             fFetchResult = false;
 
         if (   fFetchResult
-            && isDnDIgnoreAction(pResp->getActionDefault()))
+            && isDnDIgnoreAction(pState->getActionDefault()))
             fFetchResult = false;
 
@@ -305,5 +305,5 @@
              * which are not supported by the host.
              */
-            GuestDnDMIMEList lstFiltered  = GuestDnD::toFilteredFormatList(m_lstFmtSupported, pResp->formats());
+            GuestDnDMIMEList lstFiltered  = GuestDnD::toFilteredFormatList(m_lstFmtSupported, pState->formats());
             if (lstFiltered.size())
             {
@@ -313,7 +313,7 @@
 
                 aFormats            = lstFiltered;
-                aAllowedActions     = GuestDnD::toMainActions(pResp->getActionsAllowed());
+                aAllowedActions     = GuestDnD::toMainActions(pState->getActionsAllowed());
                 if (aDefaultAction)
-                    *aDefaultAction = GuestDnD::toMainAction(pResp->getActionDefault());
+                    *aDefaultAction = GuestDnD::toMainAction(pState->getActionDefault());
 
                 /* Apply the (filtered) formats list. */
@@ -324,5 +324,5 @@
         }
 
-        LogFlowFunc(("fFetchResult=%RTbool, lstActionsAllowed=0x%x\n", fFetchResult, pResp->getActionsAllowed()));
+        LogFlowFunc(("fFetchResult=%RTbool, lstActionsAllowed=0x%x\n", fFetchResult, pState->getActionsAllowed()));
     }
 
@@ -370,7 +370,7 @@
 
     /* Reset progress object. */
-    GuestDnDResponse *pResp = GuestDnDInst()->response();
-    AssertPtr(pResp);
-    HRESULT hr = pResp->resetProgress(m_pGuest);
+    GuestDnDState *pState = GuestDnDInst()->getState();
+    AssertPtr(pState);
+    HRESULT hr = pState->resetProgress(m_pGuest);
     if (FAILED(hr))
         return hr;
@@ -381,5 +381,5 @@
     {
         mData.mRecvCtx.pSource       = this;
-        mData.mRecvCtx.pResp         = pResp;
+        mData.mRecvCtx.pState        = pState;
         mData.mRecvCtx.enmAction     = dndAction;
         mData.mRecvCtx.strFmtReq     = aFormat;
@@ -419,5 +419,5 @@
         GuestDnDInst()->registerSource(this);
 
-        hr = pResp->queryProgressTo(aProgress.asOutParam());
+        hr = pState->queryProgressTo(aProgress.asOutParam());
         ComAssertComRC(hr);
 
@@ -665,5 +665,5 @@
         size_t  cbMetaAnnounced;
 
-        if (m_pResp->m_uProtocolVersion < 3)
+        if (m_pState->m_uProtocolVersion < 3)
         {
             cbData  = pSndData->u.v1.cbData;
@@ -748,5 +748,5 @@
                 {
                     /* Update our process with the data we already received. */
-                    rc = updateProgress(pCtx, pCtx->pResp, cbMetaAnnounced);
+                    rc = updateProgress(pCtx, pCtx->pState, cbMetaAnnounced);
                     AssertRC(rc);
                 }
@@ -757,5 +757,5 @@
             else /* Raw data. */
             {
-                rc = updateProgress(pCtx, pCtx->pResp, cbData);
+                rc = updateProgress(pCtx, pCtx->pState, cbData);
                 AssertRC(rc);
             }
@@ -882,5 +882,5 @@
 
         /* Note: Protocol v1 does not send any file sizes, so always 0. */
-        if (m_pResp->m_uProtocolVersion >= 2)
+        if (m_pState->m_uProtocolVersion >= 2)
             rc = DnDTransferObjectSetSize(pObj, cbSize);
 
@@ -966,5 +966,5 @@
         }
 
-        rc = updateProgress(pCtx, pCtx->pResp, cbWritten);
+        rc = updateProgress(pCtx, pCtx->pState, cbWritten);
         AssertRCBreak(rc);
 
@@ -1104,6 +1104,6 @@
     LogFlowFuncEnter();
 
-    GuestDnDResponse *pResp = pCtx->pResp;
-    AssertPtr(pCtx->pResp);
+    GuestDnDState *pState = pCtx->pState;
+    AssertPtr(pCtx->pState);
 
     GuestDnD *pInst = GuestDnDInst();
@@ -1112,13 +1112,13 @@
 
 #define REGISTER_CALLBACK(x) \
-    do {                                                            \
-        rc = pResp->setCallback(x, i_receiveRawDataCallback, pCtx); \
-        if (RT_FAILURE(rc))                                         \
-            return rc;                                              \
+    do {                                                             \
+        rc = pState->setCallback(x, i_receiveRawDataCallback, pCtx); \
+        if (RT_FAILURE(rc))                                          \
+            return rc;                                               \
     } while (0)
 
 #define UNREGISTER_CALLBACK(x)                                      \
     do {                                                            \
-        int rc2 = pResp->setCallback(x, NULL);                      \
+        int rc2 = pState->setCallback(x, NULL);                     \
         AssertRC(rc2);                                              \
     } while (0)
@@ -1130,5 +1130,5 @@
     REGISTER_CALLBACK(GUEST_DND_DISCONNECT);
     REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA_HDR);
     REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA);
@@ -1141,5 +1141,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_GH_EVT_DROPPED);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendPointer((void*)pCtx->strFmtRecv.c_str(), (uint32_t)pCtx->strFmtRecv.length() + 1);
@@ -1152,7 +1152,7 @@
         if (RT_SUCCESS(rc))
         {
-            rc = waitForEvent(&pCtx->EventCallback, pCtx->pResp, msTimeout);
+            rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout);
             if (RT_SUCCESS(rc))
-                rc = pCtx->pResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
+                rc = pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
         }
 
@@ -1165,5 +1165,5 @@
     UNREGISTER_CALLBACK(GUEST_DND_DISCONNECT);
     UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         UNREGISTER_CALLBACK(GUEST_DND_GH_SND_DATA_HDR);
     UNREGISTER_CALLBACK(GUEST_DND_GH_SND_DATA);
@@ -1184,11 +1184,11 @@
             AssertRC(rc2);
 
-            rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_CANCELLED);
+            rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED);
             AssertRC(rc2);
         }
         else if (rc != VERR_GSTDND_GUEST_ERROR) /* Guest-side error are already handled in the callback. */
         {
-            int rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR,
-                                               rc, GuestDnDSource::i_hostErrorToString(rc));
+            int rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR,
+                                                rc, GuestDnDSource::i_hostErrorToString(rc));
             AssertRC(rc2);
         }
@@ -1216,6 +1216,6 @@
     LogFlowFuncEnter();
 
-    GuestDnDResponse *pResp = pCtx->pResp;
-    AssertPtr(pCtx->pResp);
+    GuestDnDState *pState = pCtx->pState;
+    AssertPtr(pCtx->pState);
 
     GuestDnD *pInst = GuestDnDInst();
@@ -1223,15 +1223,15 @@
         return VERR_INVALID_POINTER;
 
-#define REGISTER_CALLBACK(x)                                             \
-    do {                                                                 \
-        rc = pResp->setCallback(x, i_receiveTransferDataCallback, pCtx); \
-        if (RT_FAILURE(rc))                                              \
-            return rc;                                                   \
+#define REGISTER_CALLBACK(x)                                              \
+    do {                                                                  \
+        rc = pState->setCallback(x, i_receiveTransferDataCallback, pCtx); \
+        if (RT_FAILURE(rc))                                               \
+            return rc;                                                    \
     } while (0)
 
-#define UNREGISTER_CALLBACK(x)                                      \
-    do {                                                            \
-        int rc2 = pResp->setCallback(x, NULL);                      \
-        AssertRC(rc2);                                              \
+#define UNREGISTER_CALLBACK(x)                                       \
+    do {                                                             \
+        int rc2 = pState->setCallback(x, NULL);                      \
+        AssertRC(rc2);                                               \
     } while (0)
 
@@ -1243,9 +1243,9 @@
     REGISTER_CALLBACK(GUEST_DND_DISCONNECT);
     REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA_HDR);
     REGISTER_CALLBACK(GUEST_DND_GH_SND_DATA);
     REGISTER_CALLBACK(GUEST_DND_GH_SND_DIR);
-    if (m_pResp->m_uProtocolVersion >= 2)
+    if (m_pState->m_uProtocolVersion >= 2)
         REGISTER_CALLBACK(GUEST_DND_GH_SND_FILE_HDR);
     REGISTER_CALLBACK(GUEST_DND_GH_SND_FILE_DATA);
@@ -1268,5 +1268,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_GH_EVT_DROPPED);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendPointer((void*)pCtx->strFmtRecv.c_str(), (uint32_t)pCtx->strFmtRecv.length() + 1);
@@ -1281,7 +1281,7 @@
             LogFlowFunc(("Waiting ...\n"));
 
-            rc = waitForEvent(&pCtx->EventCallback, pCtx->pResp, msTimeout);
+            rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout);
             if (RT_SUCCESS(rc))
-                rc = pCtx->pResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
+                rc = pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
 
             LogFlowFunc(("Waiting ended with rc=%Rrc\n", rc));
@@ -1322,5 +1322,5 @@
             AssertRC(rc2);
 
-            rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_CANCELLED);
+            rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED);
             AssertRC(rc2);
 
@@ -1330,6 +1330,6 @@
         else if (rc != VERR_GSTDND_GUEST_ERROR) /* Guest-side error are already handled in the callback. */
         {
-            rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR,
-                                           rc, GuestDnDSource::i_hostErrorToString(rc));
+            rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR,
+                                            rc, GuestDnDSource::i_hostErrorToString(rc));
             AssertRC(rc2);
         }
@@ -1405,5 +1405,5 @@
             AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
-            pCtx->pResp->reset();
+            pCtx->pState->reset();
 
             if (RT_SUCCESS(pCBData->rc))
@@ -1414,9 +1414,9 @@
             else if (pCBData->rc == VERR_WRONG_ORDER)
             {
-                rc = pCtx->pResp->setProgress(100, DND_PROGRESS_CANCELLED);
+                rc = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED);
             }
             else
-                rc = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
-                                              GuestDnDSource::i_guestErrorToString(pCBData->rc));
+                rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
+                                               GuestDnDSource::i_guestErrorToString(pCBData->rc));
 
             LogRel3(("DnD: Guest reported data transfer error: %Rrc\n", pCBData->rc));
@@ -1458,6 +1458,6 @@
 
         /* Unregister this callback. */
-        AssertPtr(pCtx->pResp);
-        int rc2 = pCtx->pResp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
+        AssertPtr(pCtx->pState);
+        int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
         AssertRC(rc2);
     }
@@ -1564,5 +1564,5 @@
             AssertReturn(CB_MAGIC_DND_GH_SND_FILE_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
-            if (pThis->m_pResp->m_uProtocolVersion <= 1)
+            if (pThis->m_pState->m_uProtocolVersion <= 1)
             {
                 /**
@@ -1589,5 +1589,5 @@
             AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
-            pCtx->pResp->reset();
+            pCtx->pState->reset();
 
             if (RT_SUCCESS(pCBData->rc))
@@ -1598,9 +1598,9 @@
             else if (pCBData->rc == VERR_WRONG_ORDER)
             {
-                rc = pCtx->pResp->setProgress(100, DND_PROGRESS_CANCELLED);
+                rc = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED);
             }
             else
-                rc = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
-                                              GuestDnDSource::i_guestErrorToString(pCBData->rc));
+                rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
+                                               GuestDnDSource::i_guestErrorToString(pCBData->rc));
 
             LogRel3(("DnD: Guest reported file transfer error: %Rrc\n", pCBData->rc));
@@ -1642,6 +1642,6 @@
 
         /* Unregister this callback. */
-        AssertPtr(pCtx->pResp);
-        int rc2 = pCtx->pResp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
+        AssertPtr(pCtx->pState);
+        int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
         AssertRC(rc2);
     }
Index: /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 85743)
+++ /trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp	(revision 85744)
@@ -161,6 +161,6 @@
      *  nor 2) mixed transfers (G->H + H->G at the same time).
      */
-    m_pResp = GuestDnDInst()->response();
-    AssertPtrReturn(m_pResp, E_POINTER);
+    m_pState = GuestDnDInst()->getState();
+    AssertPtrReturn(m_pState, E_POINTER);
 
     /* Confirm a successful initialization when it's the case. */
@@ -316,5 +316,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_ENTER);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendUInt32(aScreenId);
@@ -329,6 +329,6 @@
         if (RT_SUCCESS(rc))
         {
-            if (RT_SUCCESS(m_pResp->waitForGuestResponse()))
-                resAction = GuestDnD::toMainAction(m_pResp->getActionDefault());
+            if (RT_SUCCESS(m_pState->waitForGuestResponse()))
+                resAction = GuestDnD::toMainAction(m_pState->getActionDefault());
         }
     }
@@ -393,5 +393,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_MOVE);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendUInt32(aScreenId);
@@ -406,7 +406,7 @@
         if (RT_SUCCESS(rc))
         {
-            GuestDnDResponse *pResp = GuestDnDInst()->response();
-            if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
-                resAction = GuestDnD::toMainAction(pResp->getActionDefault());
+            GuestDnDState *pState = GuestDnDInst()->getState();
+            if (pState && RT_SUCCESS(pState->waitForGuestResponse()))
+                resAction = GuestDnD::toMainAction(pState->getActionDefault());
         }
     }
@@ -440,5 +440,5 @@
     GuestDnDMsg Msg;
     Msg.setType(HOST_DND_HG_EVT_LEAVE);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         Msg.appendUInt32(0); /** @todo ContextID not used yet. */
 
@@ -446,7 +446,7 @@
     if (RT_SUCCESS(rc))
     {
-        GuestDnDResponse *pResp = GuestDnDInst()->response();
-        if (pResp)
-            pResp->waitForGuestResponse();
+        GuestDnDState *pState = GuestDnDInst()->getState();
+        if (pState)
+            pState->waitForGuestResponse();
     }
 
@@ -516,5 +516,5 @@
         GuestDnDMsg Msg;
         Msg.setType(HOST_DND_HG_EVT_DROPPED);
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             Msg.appendUInt32(0); /** @todo ContextID not used yet. */
         Msg.appendUInt32(aScreenId);
@@ -529,10 +529,10 @@
         if (RT_SUCCESS(vrc))
         {
-            GuestDnDResponse *pResp = GuestDnDInst()->response();
-            if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
+            GuestDnDState *pState = GuestDnDInst()->getState();
+            if (pState && RT_SUCCESS(pState->waitForGuestResponse()))
             {
-                resAct = GuestDnD::toMainAction(pResp->getActionDefault());
-
-                GuestDnDMIMEList lstFormats = pResp->formats();
+                resAct = GuestDnD::toMainAction(pState->getActionDefault());
+
+                GuestDnDMIMEList lstFormats = pState->formats();
                 if (lstFormats.size() == 1) /* Exactly one format to use specified? */
                 {
@@ -606,7 +606,7 @@
 
     /* Reset progress object. */
-    GuestDnDResponse *pResp = GuestDnDInst()->response();
-    AssertPtr(pResp);
-    HRESULT hr = pResp->resetProgress(m_pGuest);
+    GuestDnDState *pState = GuestDnDInst()->getState();
+    AssertPtr(pState);
+    HRESULT hr = pState->resetProgress(m_pGuest);
     if (FAILED(hr))
         return hr;
@@ -619,5 +619,5 @@
 
         mData.mSendCtx.pTarget   = this;
-        mData.mSendCtx.pResp     = pResp;
+        mData.mSendCtx.pState    = pState;
         mData.mSendCtx.uScreenID = aScreenId;
 
@@ -654,5 +654,5 @@
 
         /* Return progress to caller. */
-        hr = pResp->queryProgressTo(aProgress.asOutParam());
+        hr = pState->queryProgressTo(aProgress.asOutParam());
         ComAssertComRC(hr);
     }
@@ -835,5 +835,5 @@
     const char   *pcszFmt = pCtx->Meta.strFmt.c_str();
 
-    LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pResp->m_uProtocolVersion, pcszFmt, cbFmt, cbData));
+    LogFlowFunc(("uProtoVer=%RU32, szFmt=%s, cbFmt=%RU32, cbData=%zu\n", m_pState->m_uProtocolVersion, pcszFmt, cbFmt, cbData));
 
     LogRel2(("DnD: Sending meta data to guest as '%s' (%zu bytes)\n", pcszFmt, cbData));
@@ -853,5 +853,5 @@
         Msg.setType(HOST_DND_HG_SND_DATA);
 
-        if (m_pResp->m_uProtocolVersion < 3)
+        if (m_pState->m_uProtocolVersion < 3)
         {
             Msg.appendUInt32(pCtx->uScreenID);                                 /* uScreenId */
@@ -883,5 +883,5 @@
     if (RT_SUCCESS(rc))
     {
-        rc = updateProgress(pCtx, pCtx->pResp, (uint32_t)pCtx->Meta.cbData);
+        rc = updateProgress(pCtx, pCtx->pState, (uint32_t)pCtx->Meta.cbData);
         AssertRC(rc);
     }
@@ -901,5 +901,5 @@
     AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
 
-    if (m_pResp->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */
+    if (m_pState->m_uProtocolVersion < 3) /* Protocol < v3 did not support this, skip. */
         return VINF_SUCCESS;
 
@@ -950,5 +950,5 @@
 
     pMsg->setType(HOST_DND_HG_SND_DIR);
-    if (m_pResp->m_uProtocolVersion >= 3)
+    if (m_pState->m_uProtocolVersion >= 3)
         pMsg->appendUInt32(0); /** @todo ContextID not used yet. */
     pMsg->appendString(pcszDstPath);                    /* path */
@@ -997,5 +997,5 @@
     if (RT_SUCCESS(rc))
     {
-        if (m_pResp->m_uProtocolVersion >= 2)
+        if (m_pState->m_uProtocolVersion >= 2)
         {
             if (!(pCtx->Transfer.fObjState & DND_OBJ_STATE_HAS_HDR))
@@ -1067,5 +1067,5 @@
     AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
 
-    AssertPtrReturn(pCtx->pResp, VERR_WRONG_ORDER);
+    AssertPtrReturn(pCtx->pState, VERR_WRONG_ORDER);
 
     /** @todo Don't allow concurrent reads per context! */
@@ -1079,5 +1079,5 @@
     /* Protocol version 1 sends the file path *every* time with a new file chunk.
      * In protocol version 2 we only do this once with HOST_DND_HG_SND_FILE_HDR. */
-    if (m_pResp->m_uProtocolVersion <= 1)
+    if (m_pState->m_uProtocolVersion <= 1)
     {
         const size_t cchDstPath = RTStrNLen(pcszDstPath, RTPATH_MAX);
@@ -1086,5 +1086,5 @@
         pMsg->appendUInt32((uint32_t)cchDstPath + 1); /* cbName */
     }
-    else if (m_pResp->m_uProtocolVersion >= 2)
+    else if (m_pState->m_uProtocolVersion >= 2)
     {
         pMsg->appendUInt32(0);                        /** @todo ContextID not used yet. */
@@ -1103,5 +1103,5 @@
         LogFlowFunc(("cbBufe=%zu, cbRead=%RU32\n", cbBuf, cbRead));
 
-        if (m_pResp->m_uProtocolVersion <= 1)
+        if (m_pState->m_uProtocolVersion <= 1)
         {
             pMsg->appendPointer(pvBuf, cbRead);                            /* pvData */
@@ -1114,5 +1114,5 @@
             pMsg->appendUInt32(cbRead);                                    /* cbData */
 
-            if (m_pResp->m_uProtocolVersion >= 3)
+            if (m_pState->m_uProtocolVersion >= 3)
             {
                 /** @todo Calculate checksum. */
@@ -1122,5 +1122,5 @@
         }
 
-        int rc2 = updateProgress(pCtx, pCtx->pResp, (uint32_t)cbRead);
+        int rc2 = updateProgress(pCtx, pCtx->pState, (uint32_t)cbRead);
         AssertRC(rc2);
 
@@ -1223,5 +1223,5 @@
             AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER);
 
-            pCtx->pResp->reset();
+            pCtx->pState->reset();
 
             if (RT_SUCCESS(pCBData->rc))
@@ -1231,6 +1231,6 @@
             }
 
-            rc = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
-                                          GuestDnDTarget::i_guestErrorToString(pCBData->rc));
+            rc = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, pCBData->rc,
+                                           GuestDnDTarget::i_guestErrorToString(pCBData->rc));
             if (RT_SUCCESS(rc))
             {
@@ -1343,6 +1343,6 @@
     {
         /* Unregister this callback. */
-        AssertPtr(pCtx->pResp);
-        int rc2 = pCtx->pResp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
+        AssertPtr(pCtx->pState);
+        int rc2 = pCtx->pState->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
         AssertRC(rc2);
 
@@ -1373,9 +1373,9 @@
 {
     AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
-    AssertPtr(pCtx->pResp);
+    AssertPtr(pCtx->pState);
 
 #define REGISTER_CALLBACK(x)                                                 \
     do {                                                                     \
-        rc = pCtx->pResp->setCallback(x, i_sendTransferDataCallback, pCtx); \
+        rc = pCtx->pState->setCallback(x, i_sendTransferDataCallback, pCtx); \
         if (RT_FAILURE(rc))                                                  \
             return rc;                                                       \
@@ -1384,5 +1384,5 @@
 #define UNREGISTER_CALLBACK(x)                        \
     do {                                              \
-        int rc2 = pCtx->pResp->setCallback(x, NULL); \
+        int rc2 = pCtx->pState->setCallback(x, NULL); \
         AssertRC(rc2);                                \
     } while (0)
@@ -1406,5 +1406,5 @@
     /* Host callbacks. */
     REGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
-    if (m_pResp->m_uProtocolVersion >= 2)
+    if (m_pState->m_uProtocolVersion >= 2)
         REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
     REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
@@ -1473,5 +1473,5 @@
          * Send the data header first.
          */
-        if (m_pResp->m_uProtocolVersion >= 3)
+        if (m_pState->m_uProtocolVersion >= 3)
             rc = i_sendMetaDataHeader(pCtx);
 
@@ -1484,7 +1484,7 @@
         if (RT_SUCCESS(rc))
         {
-            rc = waitForEvent(&pCtx->EventCallback, pCtx->pResp, msTimeout);
+            rc = waitForEvent(&pCtx->EventCallback, pCtx->pState, msTimeout);
             if (RT_SUCCESS(rc))
-                pCtx->pResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
+                pCtx->pState->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS);
         }
 
@@ -1501,5 +1501,5 @@
     /* Host callbacks. */
     UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR);
-    if (m_pResp->m_uProtocolVersion >= 2)
+    if (m_pState->m_uProtocolVersion >= 2)
         UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);
     UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);
@@ -1522,5 +1522,5 @@
             LogRel2(("DnD: Sending transfer data to guest cancelled by user\n"));
 
-            rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);
+            rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_CANCELLED, VINF_SUCCESS);
             AssertRC(rc2);
 
@@ -1531,6 +1531,6 @@
         {
             LogRel(("DnD: Sending transfer data to guest failed with rc=%Rrc\n", rc));
-            int rc2 = pCtx->pResp->setProgress(100, DND_PROGRESS_ERROR, rc,
-                                               GuestDnDTarget::i_hostErrorToString(rc));
+            int rc2 = pCtx->pState->setProgress(100, DND_PROGRESS_ERROR, rc,
+                                                GuestDnDTarget::i_hostErrorToString(rc));
             AssertRC(rc2);
         }
@@ -1555,5 +1555,5 @@
     AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
 
-    int rc = updateProgress(pCtx, pCtx->pResp);
+    int rc = updateProgress(pCtx, pCtx->pState);
     AssertRCReturn(rc, rc);
 
@@ -1619,9 +1619,9 @@
     {
         LogRel(("DnD: Sending raw data to guest failed with rc=%Rrc\n", rc));
-        rc2 = pCtx->pResp->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,
-                                       GuestDnDTarget::i_hostErrorToString(rc));
+        rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_ERROR, rc,
+                                        GuestDnDTarget::i_hostErrorToString(rc));
     }
     else
-        rc2 = pCtx->pResp->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);
+        rc2 = pCtx->pState->setProgress(100 /* Percent */, DND_PROGRESS_COMPLETE, rc);
     AssertRC(rc2);
 
