VirtualBox

Changeset 75747 in vbox


Ignore:
Timestamp:
Nov 26, 2018 6:54:55 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126948
Message:

HGCM: Continue with getting VERR_CANCELLED to the service when the guest has cancelled (or canceled if you prefer) the command.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/hgcmsvc.h

    r75745 r75747  
    6868 *          this problem is already solved by service extension callbacks
    6969 * 5.1->6.1 Because pfnCall got a new parameter. Also new helpers. (VBox 6.0)
     70 * 6.1->6.2 Because pfnCallComplete starts returning a status code (VBox 6.0).
    7071 */
    7172#define VBOX_HGCM_SVC_VERSION_MAJOR (0x0006)
    72 #define VBOX_HGCM_SVC_VERSION_MINOR (0x0001)
     73#define VBOX_HGCM_SVC_VERSION_MINOR (0x0002)
    7374#define VBOX_HGCM_SVC_VERSION ((VBOX_HGCM_SVC_VERSION_MAJOR << 16) + VBOX_HGCM_SVC_VERSION_MINOR)
    7475
     
    8283{
    8384    /** The service has processed the Call request. */
    84     DECLR3CALLBACKMEMBER(void, pfnCallComplete, (VBOXHGCMCALLHANDLE callHandle, int32_t rc));
     85    DECLR3CALLBACKMEMBER(int, pfnCallComplete, (VBOXHGCMCALLHANDLE callHandle, int32_t rc));
    8586
    8687    void *pvInstance;
  • trunk/src/VBox/Main/include/HGCMThread.h

    r75740 r75747  
    123123/** Initialize threads.
    124124 *
    125  * @return VBox error code
     125 * @return VBox status code.
    126126 */
    127127int hgcmThreadInit(void);
     
    141141 *                          NULL if no stats.
    142142 *
    143  * @return VBox error code
     143 * @return VBox status code.
    144144 */
    145145int hgcmThreadCreate(HGCMThread **ppThread, const char *pszThreadName, PFNHGCMTHREAD pfnThread, void *pvUser,
     
    151151 *                      consumed.
    152152 *
    153  * @return VBox error code
     153 * @return VBox status code.
    154154 */
    155155int hgcmThreadWait(HGCMThread *pThread);
     
    162162 * @param pfnNewMessage New message allocation callback.
    163163 *
    164  * @return VBox error code
     164 * @return VBox status code.
    165165 */
    166166int hgcmMsgAlloc(HGCMThread *pThread, HGCMMsgCore **ppHandle, uint32_t u32MsgId, PFNHGCMNEWMSGALLOC pfnNewMessage);
     
    171171 * @param pfnCallback   Message completion callback.
    172172 *
    173  * @return VBox error code
     173 * @return VBox status code.
    174174 * @retval VINF_HGCM_ASYNC_EXECUTE on success.
    175175 *
     
    184184 * @param pMsg          The message.  Reference will be consumed!
    185185 *
    186  * @return VBox error code
     186 * @return VBox status code.
    187187 *
    188188 * @thread any
     
    196196 * @param ppMsg         Where to store returned message pointer.
    197197 *
    198  * @return VBox error code
     198 * @return VBox status code.
    199199 *
    200200 * @thread worker thread
     
    206206 *
    207207 * @param pMsg          Processed message pointer.
    208  * @param result        Result code, VBox erro code.
    209  *
    210  * @return VBox error code
     208 * @param result        Result code, VBox status code.
     209 *
     210 * @return Restricted set of VBox status codes when guest call message:
     211 * @retval VINF_SUCCESS on success
     212 * @retval VERR_CANCELLED if the request was cancelled.
     213 * @retval VERR_ALREADY_RESET if the VM is resetting.
     214 * @retval VERR_NOT_AVAILABLE if HGCM has been disconnected from the VMMDev
     215 *         (shouldn't happen).
    211216 *
    212217 * @thread worker thread
    213218 */
    214 void hgcmMsgComplete(HGCMMsgCore *pMsg, int32_t result);
     219int hgcmMsgComplete(HGCMMsgCore *pMsg, int32_t result);
    215220
    216221
  • trunk/src/VBox/Main/src-client/HGCM.cpp

    r75740 r75747  
    139139        ~HGCMService() {};
    140140
    141         static DECLCALLBACK(void) svcHlpCallComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc);
     141        static DECLCALLBACK(int) svcHlpCallComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc);
    142142        static DECLCALLBACK(void) svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId);
    143143        static DECLCALLBACK(bool) svcHlpIsCallRestored(VBOXHGCMCALLHANDLE callHandle);
     
    796796 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnCallComplete}
    797797 */
    798 /* static */ DECLCALLBACK(void) HGCMService::svcHlpCallComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc)
     798/* static */ DECLCALLBACK(int) HGCMService::svcHlpCallComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc)
    799799{
    800800   HGCMMsgCore *pMsgCore = (HGCMMsgCore *)callHandle;
    801801
    802    if (pMsgCore->MsgId () == SVC_MSG_GUESTCALL)
    803    {
    804        /* Only call the completion for these messages. The helper
    805         * is called by the service, and the service does not get
    806         * any other messages.
    807         */
    808        hgcmMsgComplete(pMsgCore, rc);
    809    }
    810    else
    811    {
    812        AssertFailed();
    813    }
     802   /* Only call the completion for these messages. The helper
     803    * is called by the service, and the service does not get
     804    * any other messages.
     805    */
     806   AssertMsgReturn(pMsgCore->MsgId() == SVC_MSG_GUESTCALL, ("%d\n", pMsgCore->MsgId()), VERR_WRONG_TYPE);
     807   return hgcmMsgComplete(pMsgCore, rc);
    814808}
    815809
  • trunk/src/VBox/Main/src-client/HGCMThread.cpp

    r75601 r75747  
    147147        int MsgGet(HGCMMsgCore **ppMsg);
    148148        int MsgPost(HGCMMsgCore *pMsg, PHGCMMSGCALLBACK pfnCallback, bool bWait);
    149         void MsgComplete(HGCMMsgCore *pMsg, int32_t result);
     149        int MsgComplete(HGCMMsgCore *pMsg, int32_t result);
    150150};
    151151
     
    554554}
    555555
    556 void HGCMThread::MsgComplete(HGCMMsgCore *pMsg, int32_t result)
     556int HGCMThread::MsgComplete(HGCMMsgCore *pMsg, int32_t result)
    557557{
    558558    LogFlow(("HGCMThread::MsgComplete: thread = %p, pMsg = %p\n", this, pMsg));
     
    561561    AssertReleaseMsg((pMsg->m_fu32Flags & HGCM_MSG_F_IN_PROCESS) != 0, ("%p %x\n", pMsg, pMsg->m_fu32Flags));
    562562
     563    int rcRet = VINF_SUCCESS;
    563564    if (pMsg->m_pfnCallback)
    564565    {
    565566        /** @todo call callback with error code in MsgPost in case of errors */
    566567
    567         pMsg->m_pfnCallback(result, pMsg);
    568 
    569         LogFlow(("HGCMThread::MsgComplete: callback executed. pMsg = %p, thread = %p\n", pMsg, this));
     568        rcRet = pMsg->m_pfnCallback(result, pMsg);
     569
     570        LogFlow(("HGCMThread::MsgComplete: callback executed. pMsg = %p, thread = %p, rcRet = %Rrc\n", pMsg, this, rcRet));
    570571    }
    571572
     
    616617        }
    617618    }
     619
     620    return rcRet;
    618621}
    619622
     
    737740}
    738741
    739 void hgcmMsgComplete(HGCMMsgCore *pMsg, int32_t u32Result)
     742int hgcmMsgComplete(HGCMMsgCore *pMsg, int32_t u32Result)
    740743{
    741744    LogFlow(("MAIN::hgcmMsgComplete: pMsg = %p\n", pMsg));
    742745
     746    int rc;
    743747    if (pMsg)
    744         pMsg->Thread()->MsgComplete(pMsg, u32Result);
    745 
    746 
    747     LogFlow(("MAIN::hgcmMsgComplete: pMsg = %p, rc = void\n", pMsg));
     748        rc = pMsg->Thread()->MsgComplete(pMsg, u32Result);
     749    else
     750        rc = VINF_SUCCESS;
     751
     752    LogFlow(("MAIN::hgcmMsgComplete: pMsg = %p, rc = %Rrc\n", pMsg, rc));
     753    return rc;
    748754}
    749755
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette