Index: trunk/include/VBox/VBoxGuestLib.h
===================================================================
--- trunk/include/VBox/VBoxGuestLib.h	(revision 21490)
+++ trunk/include/VBox/VBoxGuestLib.h	(revision 21506)
@@ -166,9 +166,11 @@
  * completion IRQ is required.
  *
- * @param pvData     VBoxGuest pointer to be passed to callback.
- * @param u32Data    VBoxGuest 32 bit value to be passed to callback.
- */
-
-typedef DECLVBGL(void) VBGLHGCMCALLBACK(VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data);
+ * @returns VINF_SUCCESS, VERR_INTERRUPT or VERR_TIMEOUT.
+ * @param   pvData      VBoxGuest pointer to be passed to callback.
+ * @param   u32Data     VBoxGuest 32 bit value to be passed to callback.
+ */
+typedef DECLVBGL(int) FNVBGLHGCMCALLBACK(VMMDevHGCMRequestHeader *pHeader, void *pvData, uint32_t u32Data);
+/** Pointer to a FNVBGLHGCMCALLBACK. */
+typedef FNVBGLHGCMCALLBACK *PFNVBGLHGCMCALLBACK;
 
 /**
@@ -178,16 +180,16 @@
  * @note This function can NOT handle cancelled requests!
  *
- * @param pConnectInfo    The request data.
- * @param pAsyncCallback  Required pointer to function that is called when
- *                        host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
- *                        implements waiting for an IRQ in this function.
- * @param pvAsyncData     An arbitrary VBoxGuest pointer to be passed to callback.
- * @param u32AsyncData    An arbitrary VBoxGuest 32 bit value to be passed to callback.
- *
- * @return VBox status code.
+ * @param   pConnectInfo        The request data.
+ * @param   pfnAsyncCallback    Required pointer to function that is calledwhen
+ *                              host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
+ *                              implements waiting for an IRQ in this function.
+ * @param   pvAsyncData         An arbitrary VBoxGuest pointer to be passed to callback.
+ * @param   u32AsyncData        An arbitrary VBoxGuest 32 bit value to be passed to callback.
+ *
+ * @return  VBox status code.
  */
 
 DECLR0VBGL(int) VbglR0HGCMInternalConnect (VBoxGuestHGCMConnectInfo *pConnectInfo,
-                                           VBGLHGCMCALLBACK *pAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+                                           PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 
@@ -198,16 +200,17 @@
  * @note This function can NOT handle cancelled requests!
  *
- * @param pDisconnectInfo The request data.
- * @param pAsyncCallback  Required pointer to function that is called when
- *                        host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
- *                        implements waiting for an IRQ in this function.
- * @param pvAsyncData     An arbitrary VBoxGuest pointer to be passed to callback.
- * @param u32AsyncData    An arbitrary VBoxGuest 32 bit value to be passed to callback.
- *
- * @return VBox status code.
+ * @param   pDisconnectInfo     The request data.
+ * @param   pfnAsyncCallback    Required pointer to function that is called when
+ *                              host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
+ *                              implements waiting for an IRQ in this function.
+ * @param   pvAsyncData         An arbitrary VBoxGuest pointer to be passed to callback.
+ * @param   u32AsyncData        An arbitrary VBoxGuest 32 bit value to be passed to
+ *                              callback.
+ *
+ * @return  VBox status code.
  */
 
 DECLR0VBGL(int) VbglR0HGCMInternalDisconnect (VBoxGuestHGCMDisconnectInfo *pDisconnectInfo,
-                                              VBGLHGCMCALLBACK *pAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+                                              PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 /** Call a HGCM service.
@@ -215,16 +218,16 @@
  * @note This function can deal with cancelled requests.
  *
- * @param pCallInfo       The request data.
- * @param fFlags          Flags, see VBGLR0_HGCMCALL_F_XXX.
- * @param pAsyncCallback  Required pointer to function that is called when
- *                        host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
- *                        implements waiting for an IRQ in this function.
- * @param pvAsyncData     An arbitrary VBoxGuest pointer to be passed to callback.
- * @param u32AsyncData    An arbitrary VBoxGuest 32 bit value to be passed to callback.
+ * @param   pCallInfo           The request data.
+ * @param   fFlags              Flags, see VBGLR0_HGCMCALL_F_XXX.
+ * @param   pfnAsyncCallback    Required pointer to function that is called when
+ *                              host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
+ *                              implements waiting for an IRQ in this function.
+ * @param   pvAsyncData         An arbitrary VBoxGuest pointer to be passed to callback.
+ * @param   u32AsyncData        An arbitrary VBoxGuest 32 bit value to be passed to callback.
  *
  * @return VBox status code.
  */
 DECLR0VBGL(int) VbglR0HGCMInternalCall (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
-                                        VBGLHGCMCALLBACK *pAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+                                        PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 /** Call a HGCM service. (32 bits packet structure in a 64 bits guest)
@@ -232,16 +235,16 @@
  * @note This function can deal with cancelled requests.
  *
- * @param pCallInfo       The request data.
- * @param fFlags          Flags, see VBGLR0_HGCMCALL_F_XXX.
- * @param pAsyncCallback  Required pointer to function that is called when
- *                        host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
- *                        implements waiting for an IRQ in this function.
- * @param pvAsyncData     An arbitrary VBoxGuest pointer to be passed to callback.
- * @param u32AsyncData    An arbitrary VBoxGuest 32 bit value to be passed to callback.
- *
- * @return VBox status code.
+ * @param   pCallInfo           The request data.
+ * @param   fFlags              Flags, see VBGLR0_HGCMCALL_F_XXX.
+ * @param   pfnAsyncCallback    Required pointer to function that is called when
+ *                              host returns VINF_HGCM_ASYNC_EXECUTE. VBoxGuest
+ *                              implements waiting for an IRQ in this function.
+ * @param   pvAsyncData         An arbitrary VBoxGuest pointer to be passed to callback.
+ * @param   u32AsyncData        An arbitrary VBoxGuest 32 bit value to be passed to callback.
+ *
+ * @return  VBox status code.
  */
 DECLR0VBGL(int) VbglR0HGCMInternalCall32 (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
-                                          VBGLHGCMCALLBACK *pAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
+                                          PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
 
 /** @name VbglR0HGCMInternalCall flags
Index: trunk/include/VBox/VMMDev.h
===================================================================
--- trunk/include/VBox/VMMDev.h	(revision 21490)
+++ trunk/include/VBox/VMMDev.h	(revision 21506)
@@ -151,4 +151,5 @@
 #endif /* VBOX_WITH_64_BITS_GUESTS */
     VMMDevReq_HGCMCancel                 = 64,
+    VMMDevReq_HGCMCancel2                = 65,
 #endif
     VMMDevReq_VideoAccelEnable           = 70,
@@ -953,5 +954,6 @@
  * @{
  */
-# define VBOX_HGCM_REQ_DONE      (0x1)
+# define VBOX_HGCM_REQ_DONE      RT_BIT_32(VBOX_HGCM_REQ_DONE_BIT)
+# define VBOX_HGCM_REQ_DONE_BIT  0
 # define VBOX_HGCM_REQ_CANCELLED (0x2)
 /** @} */
@@ -1332,4 +1334,22 @@
 } VMMDevHGCMCancel;
 AssertCompileSize(VMMDevHGCMCancel, 32);
+
+/**
+ * HGCM cancel request structure, version 2.
+ *
+ * Used by VMMDevReq_HGCMCancel2.
+ *
+ * VINF_SUCCESS when cancelled.
+ * VERR_NOT_FOUND if the specified request cannot be found.
+ * VERR_INVALID_PARAMETER if the address is invalid valid.
+ */
+typedef struct
+{
+    /** Header. */
+    VMMDevRequestHeader header;
+    /** The physical address of the request to cancel. */
+    RTGCPHYS32 physReqToCancel;
+} VMMDevHGCMCancel2;
+AssertCompileSize(VMMDevHGCMCancel2, 24+4);
 
 #endif /* VBOX_WITH_HGCM */
