Changeset 85712 in vbox for trunk/src/VBox/HostServices/DragAndDrop
- Timestamp:
- Aug 12, 2020 12:24:30 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139856
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.cpp
r85681 r85712 50 50 { 51 51 public: 52 52 53 DragAndDropClient(uint32_t idClient) 53 54 : HGCM::Client(idClient) 55 , fGuestFeatures0(VBOX_DND_GF_NONE) 56 , fGuestFeatures1(VBOX_DND_GF_NONE) 54 57 { 55 58 RT_ZERO(m_SvcCtx); … … 62 65 63 66 public: 67 64 68 void disconnect(void) RT_NOEXCEPT; 69 70 public: 71 72 /** Guest feature flags, VBOX_DND_GF_0_XXX. */ 73 uint64_t fGuestFeatures0; 74 /** Guest feature flags, VBOX_DND_GF_1_XXX. */ 75 uint64_t fGuestFeatures1; 65 76 }; 66 77 … … 88 99 int clientConnect(uint32_t idClient, void *pvClient) RT_NOEXCEPT RT_OVERRIDE; 89 100 int clientDisconnect(uint32_t idClient, void *pvClient) RT_NOEXCEPT RT_OVERRIDE; 101 int clientQueryFeatures(DragAndDropClient *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) RT_NOEXCEPT; 102 int clientReportFeatures(DragAndDropClient *pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) RT_NOEXCEPT; 90 103 void guestCall(VBOXHGCMCALLHANDLE callHandle, uint32_t idClient, void *pvClient, uint32_t u32Function, 91 104 uint32_t cParms, VBOXHGCMSVCPARM paParms[]) RT_NOEXCEPT RT_OVERRIDE; … … 112 125 /** Current drag and drop mode, VBOX_DRAG_AND_DROP_MODE_XXX. */ 113 126 uint32_t m_u32Mode; 127 /** Host feature mask (VBOX_DND_HF_0_XXX) for DND_GUEST_REPORT_FEATURES 128 * and DND_GUEST_QUERY_FEATURES. */ 129 uint64_t m_fHostFeatures0; 114 130 }; 115 131 … … 166 182 modeSet(VBOX_DRAG_AND_DROP_MODE_OFF); 167 183 184 /* Set host features. */ 185 m_fHostFeatures0 = VBOX_DND_HF_NONE; 186 168 187 int rc = VINF_SUCCESS; 169 188 … … 274 293 } 275 294 295 /** 296 * Implements GUEST_DND_REPORT_FEATURES. 297 * 298 * @returns VBox status code. 299 * @retval VINF_HGCM_ASYNC_EXECUTE on success (we complete the message here). 300 * @retval VERR_ACCESS_DENIED if not master 301 * @retval VERR_INVALID_PARAMETER if bit 63 in the 2nd parameter isn't set. 302 * @retval VERR_WRONG_PARAMETER_COUNT 303 * 304 * @param pClient The client state. 305 * @param hCall The client's call handle. 306 * @param cParms Number of parameters. 307 * @param paParms Array of parameters. 308 */ 309 int DragAndDropService::clientReportFeatures(DragAndDropClient *pClient, 310 VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) RT_NOEXCEPT 311 { 312 /* 313 * Validate the request. 314 */ 315 ASSERT_GUEST_RETURN(cParms == 2, VERR_WRONG_PARAMETER_COUNT); 316 ASSERT_GUEST_RETURN(paParms[0].type == VBOX_HGCM_SVC_PARM_64BIT, VERR_WRONG_PARAMETER_TYPE); 317 uint64_t const fFeatures0 = paParms[0].u.uint64; 318 ASSERT_GUEST_RETURN(paParms[1].type == VBOX_HGCM_SVC_PARM_64BIT, VERR_WRONG_PARAMETER_TYPE); 319 uint64_t const fFeatures1 = paParms[1].u.uint64; 320 ASSERT_GUEST_RETURN(fFeatures1 & VBOX_DND_GF_1_MUST_BE_ONE, VERR_INVALID_PARAMETER); 321 322 /* 323 * Do the work. 324 */ 325 paParms[0].u.uint64 = m_fHostFeatures0; 326 paParms[1].u.uint64 = 0; 327 328 int rc = pClient->Complete(hCall, VINF_SUCCESS); 329 if (RT_SUCCESS(rc)) 330 { 331 pClient->fGuestFeatures0 = fFeatures0; 332 pClient->fGuestFeatures1 = fFeatures1; 333 Log(("[Client %RU32] features: %#RX64 %#RX64\n", pClient->GetClientID(), fFeatures0, fFeatures1)); 334 } 335 else 336 LogFunc(("pfnCallComplete -> %Rrc\n", rc)); 337 338 return VINF_HGCM_ASYNC_EXECUTE; 339 } 340 341 /** 342 * Implements GUEST_DND_QUERY_FEATURES. 343 * 344 * @returns VBox status code. 345 * @retval VINF_HGCM_ASYNC_EXECUTE on success (we complete the message here). 346 * @retval VERR_WRONG_PARAMETER_COUNT 347 * 348 * @param pClient The client state. 349 * @param hCall The client's call handle. 350 * @param cParms Number of parameters. 351 * @param paParms Array of parameters. 352 */ 353 int DragAndDropService::clientQueryFeatures(DragAndDropClient *pClient, 354 VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) RT_NOEXCEPT 355 { 356 /* 357 * Validate the request. 358 */ 359 ASSERT_GUEST_RETURN(cParms == 2, VERR_WRONG_PARAMETER_COUNT); 360 ASSERT_GUEST_RETURN(paParms[0].type == VBOX_HGCM_SVC_PARM_64BIT, VERR_WRONG_PARAMETER_TYPE); 361 ASSERT_GUEST_RETURN(paParms[1].type == VBOX_HGCM_SVC_PARM_64BIT, VERR_WRONG_PARAMETER_TYPE); 362 ASSERT_GUEST(paParms[1].u.uint64 & RT_BIT_64(63)); 363 364 /* 365 * Do the work. 366 */ 367 paParms[0].u.uint64 = m_fHostFeatures0; 368 paParms[1].u.uint64 = 0; 369 370 int rc = pClient->Complete(hCall, VINF_SUCCESS); 371 if (RT_FAILURE(rc)) 372 LogFunc(("pfnCallComplete -> %Rrc\n", rc)); 373 374 return VINF_HGCM_ASYNC_EXECUTE; 375 } 376 276 377 int DragAndDropService::modeSet(uint32_t u32Mode) RT_NOEXCEPT 277 378 { … … 327 428 /* New since protocol v2. */ 328 429 case GUEST_DND_CONNECT: 430 RT_FALL_THROUGH(); 431 /* New since VBox 6.1.x. */ 432 case GUEST_DND_REPORT_FEATURES: 433 RT_FALL_THROUGH(); 434 /* New since VBox 6.1.x. */ 435 case GUEST_DND_QUERY_FEATURES: 329 436 { 330 437 /* 331 * Never block the initial connect call, as the clients do thiswhen438 * Never block these calls, as the clients issues those when 332 439 * initializing and might get stuck if drag and drop is set to "disabled" at 333 440 * that time. … … 524 631 break; 525 632 } 633 case GUEST_DND_REPORT_FEATURES: 634 { 635 LogFlowFunc(("GUEST_DND_REPORT_FEATURES\n")); 636 rc = clientReportFeatures(pClient, callHandle, cParms, paParms); 637 break; 638 } 639 case GUEST_DND_QUERY_FEATURES: 640 { 641 LogFlowFunc(("GUEST_DND_QUERY_FEATURES")); 642 rc = clientQueryFeatures(pClient, callHandle, cParms, paParms); 643 break; 644 } 526 645 case GUEST_DND_HG_ACK_OP: 527 646 {
Note:
See TracChangeset
for help on using the changeset viewer.