Changeset 79630 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Jul 9, 2019 8:14:01 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r79500 r79630 162 162 163 163 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 164 static int vbglR3ClipboardGetNextMsgType(HGCMCLIENTID idClient, uint32_t *puMsg, uint32_t *pcParms, bool fWait) 164 #if 0 165 static int vbglR3ClipboardPeekMsg(HGCMCLIENTID idClient, uint32_t *puMsg, uint32_t *pcParms, bool fWait) 165 166 { 166 167 AssertPtrReturn(puMsg, VERR_INVALID_POINTER); 167 168 AssertPtrReturn(pcParms, VERR_INVALID_POINTER); 168 169 169 VBoxClipboard GetHostMsg Msg;170 VBoxClipboardPeekMsg Msg; 170 171 RT_ZERO(Msg); 171 172 … … 188 189 return rc; 189 190 } 190 191 static int vbglR3ClipboardRecvListOpen(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTHDR pListHdr) 191 #else 192 /** 193 * Peeks at the next host message, waiting for one to turn up. 194 * 195 * @returns VBox status code. 196 * @retval VERR_INTERRUPTED if interrupted. Does the necessary cleanup, so 197 * caller just have to repeat this call. 198 * @retval VERR_VM_RESTORED if the VM has been restored (idRestoreCheck). 199 * 200 * @param idClient The client ID returned by VbglR3GuestCtrlConnect(). 201 * @param pidMsg Where to store the message id. 202 * @param pcParameters Where to store the number of parameters which will 203 * be received in a second call to the host. 204 * @param pidRestoreCheck Pointer to the VbglR3GetSessionId() variable to use 205 * for the VM restore check. Optional. 206 * 207 * @note Restore check is only performed optimally with a 6.0 host. 208 */ 209 static int vbglR3ClipboardMsgPeekWait(uint32_t idClient, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck) 210 { 211 AssertPtrReturn(pidMsg, VERR_INVALID_POINTER); 212 AssertPtrReturn(pcParameters, VERR_INVALID_POINTER); 213 214 int rc; 215 216 struct 217 { 218 VBGLIOCHGCMCALL Hdr; 219 HGCMFunctionParameter idMsg; /* Doubles as restore check on input. */ 220 HGCMFunctionParameter cParameters; 221 } Msg; 222 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT, 2); 223 VbglHGCMParmUInt64Set(&Msg.idMsg, pidRestoreCheck ? *pidRestoreCheck : 0); 224 VbglHGCMParmUInt32Set(&Msg.cParameters, 0); 225 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 226 LogRel2(("VbglR3GuestCtrlMsgPeekWait -> %Rrc\n", rc)); 227 if (RT_SUCCESS(rc)) 228 { 229 AssertMsgReturn( Msg.idMsg.type == VMMDevHGCMParmType_64bit 230 && Msg.cParameters.type == VMMDevHGCMParmType_32bit, 231 ("msg.type=%d num_parms.type=%d\n", Msg.idMsg.type, Msg.cParameters.type), 232 VERR_INTERNAL_ERROR_3); 233 234 *pidMsg = (uint32_t)Msg.idMsg.u.value64; 235 *pcParameters = Msg.cParameters.u.value32; 236 return rc; 237 } 238 239 /* 240 * If interrupted we must cancel the call so it doesn't prevent us from making another one. 241 */ 242 if (rc == VERR_INTERRUPTED) 243 { 244 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL, 0); 245 int rc2 = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr)); 246 AssertRC(rc2); 247 } 248 249 /* 250 * If restored, update pidRestoreCheck. 251 */ 252 if (rc == VERR_VM_RESTORED && pidRestoreCheck) 253 *pidRestoreCheck = Msg.idMsg.u.value64; 254 255 *pidMsg = UINT32_MAX - 1; 256 *pcParameters = UINT32_MAX - 2; 257 return rc; 258 } 259 #endif 260 261 VBGLR3DECL(int) VbglR3ClipboardTransferSendStatus(HGCMCLIENTID idClient, SHAREDCLIPBOARDURITRANSFERSTATUS uStatus) 262 { 263 VBoxClipboardStatusMsg Msg; 264 RT_ZERO(Msg); 265 266 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 267 VBOX_SHARED_CLIPBOARD_GUEST_FN_STATUS, VBOX_SHARED_CLIPBOARD_CPARMS_STATUS); 268 269 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 270 Msg.uStatus.SetUInt32(uStatus); 271 Msg.cbPayload.SetUInt32(0); 272 Msg.pvPayload.SetPtr(NULL, 0); 273 274 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 275 276 LogFlowFuncLeaveRC(rc); 277 return rc; 278 } 279 280 VBGLR3DECL(int) VbglR3ClipboardListOpenSend(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms, 281 PSHAREDCLIPBOARDLISTHANDLE phList) 282 { 283 AssertPtrReturn(pOpenParms, VERR_INVALID_POINTER); 284 AssertPtrReturn(phList, VERR_INVALID_POINTER); 285 286 VBoxClipboardListOpenMsg Msg; 287 RT_ZERO(Msg); 288 289 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 290 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_OPEN, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN); 291 292 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 293 Msg.fList.SetUInt32(0); 294 Msg.cbFilter.SetUInt32(pOpenParms->cbFilter); 295 Msg.pvFilter.SetPtr(pOpenParms->pszFilter, pOpenParms->cbFilter); 296 Msg.cbPath.SetUInt32(pOpenParms->cbPath); 297 Msg.pvFilter.SetPtr(pOpenParms->pszPath, pOpenParms->cbPath); 298 299 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 300 if (RT_SUCCESS(rc)) 301 { 302 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); 303 } 304 305 LogFlowFuncLeaveRC(rc); 306 return rc; 307 } 308 309 VBGLR3DECL(int) VbglR3ClipboardListOpenRecv(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms) 310 { 311 AssertPtrReturn(pOpenParms, VERR_INVALID_POINTER); 312 313 VBoxClipboardListOpenMsg Msg; 314 RT_ZERO(Msg); 315 316 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 317 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN); 318 319 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN); 320 Msg.fList.SetUInt32(0); 321 Msg.cbPath.SetUInt32(pOpenParms->cbPath); 322 Msg.pvPath.SetPtr(pOpenParms->pszPath, pOpenParms->cbPath); 323 Msg.cbFilter.SetUInt32(pOpenParms->cbFilter); 324 Msg.pvFilter.SetPtr(pOpenParms->pszFilter, pOpenParms->cbFilter); 325 Msg.uHandle.SetUInt64(0); 326 327 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 328 if (RT_SUCCESS(rc)) 329 { 330 rc = Msg.fList.GetUInt32(&pOpenParms->fList); 331 if (RT_SUCCESS(rc)) 332 rc = Msg.cbFilter.GetUInt32(&pOpenParms->cbFilter); 333 if (RT_SUCCESS(rc)) 334 rc = Msg.cbPath.GetUInt32(&pOpenParms->cbPath); 335 } 336 337 LogFlowFuncLeaveRC(rc); 338 return rc; 339 } 340 341 VBGLR3DECL(int) VbglR3ClipboardListOpenReply(HGCMCLIENTID idClient, int rcReply, SHAREDCLIPBOARDLISTHANDLE hList) 342 { 343 VBoxClipboardReplyMsg Msg; 344 RT_ZERO(Msg); 345 346 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 347 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6); 348 349 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 350 Msg.enmType.SetUInt32(VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_LIST_OPEN); 351 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ 352 Msg.cbPayload.SetUInt32(0); 353 Msg.pvPayload.SetPtr(0, NULL); 354 355 Msg.u.ListOpen.uHandle.SetUInt64(hList); 356 357 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 358 359 LogFlowFuncLeaveRC(rc); 360 return rc; 361 } 362 363 VBGLR3DECL(int) VbglR3ClipboardListCloseSend(HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList) 364 { 365 VBoxClipboardListCloseMsg Msg; 366 RT_ZERO(Msg); 367 368 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 369 VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE); 370 371 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 372 Msg.uHandle.SetUInt64(hList); 373 374 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 375 376 LogFlowFuncLeaveRC(rc); 377 return rc; 378 } 379 380 VBGLR3DECL(int) VbglR3ClipboardListCloseRecv(HGCMCLIENTID idClient, PSHAREDCLIPBOARDLISTHANDLE phList) 381 { 382 AssertPtrReturn(phList, VERR_INVALID_POINTER); 383 384 VBoxClipboardListCloseMsg Msg; 385 RT_ZERO(Msg); 386 387 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 388 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE); 389 390 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE); 391 Msg.uHandle.SetUInt64(0); 392 393 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 394 if (RT_SUCCESS(rc)) 395 { 396 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); 397 } 398 399 LogFlowFuncLeaveRC(rc); 400 return rc; 401 } 402 403 VBGLR3DECL(int) VbglR3ClipboardListHdrRead(HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList, uint32_t fFlags, 404 PVBOXCLIPBOARDLISTHDR pListHdr) 192 405 { 193 406 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER); 194 407 195 VBoxClipboardListOpenMsg Msg; 196 RT_ZERO(Msg); 197 198 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 199 VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN); 200 201 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 202 Msg.uHandle.SetUInt64(0); 203 Msg.fList.SetUInt32(0); 408 VBoxClipboardListHdrMsg Msg; 409 RT_ZERO(Msg); 410 411 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 412 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR); 413 414 Msg.ReqParms.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 415 Msg.ReqParms.uHandle.SetUInt64(hList); 416 Msg.ReqParms.fFlags.SetUInt32(fFlags); 417 204 418 Msg.fFeatures.SetUInt32(0); 205 Msg.cbFilter.SetUInt32(0); 206 Msg.pvFilter.SetPtr(pListHdr->pszFilter, pListHdr->cbFilter); 207 208 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 209 if (RT_SUCCESS(rc)) 210 { 211 rc = Msg.fList.GetUInt32(&pListHdr->fList); AssertRC(rc); 212 rc = Msg.fFeatures.GetUInt32(&pListHdr->fFeatures); AssertRC(rc); 213 } 214 215 LogFlowFuncLeaveRC(rc); 216 return rc; 217 } 218 219 static int vbglR3ClipboardRecvListClose(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTHANDLE phList) 220 { 221 AssertPtrReturn(phList, VERR_INVALID_POINTER); 222 223 VBoxClipboardListCloseMsg Msg; 224 RT_ZERO(Msg); 225 226 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 227 VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE); 228 229 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 230 Msg.uHandle.SetUInt64(0); 231 232 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 233 if (RT_SUCCESS(rc)) 234 { 235 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); 236 } 237 238 LogFlowFuncLeaveRC(rc); 239 return rc; 240 } 241 242 static int vbglR3ClipboardRecvListHdrRead(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTHANDLE phList, PVBOXCLIPBOARDLISTHDR pListHdr) 243 { 244 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER); 245 AssertPtrReturn(phList, VERR_INVALID_POINTER); 246 247 VBoxClipboardListHdrReadMsg Msg; 248 RT_ZERO(Msg); 249 250 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 251 VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ); 252 253 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 254 Msg.uHandle.SetUInt64(0); 419 Msg.cbTotalSize.SetUInt32(0); 255 420 Msg.cTotalObjects.SetUInt64(0); 256 421 Msg.cbTotalSize.SetUInt64(0); … … 261 426 if (RT_SUCCESS(rc)) 262 427 { 263 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); 264 } 265 266 LogFlowFuncLeaveRC(rc); 267 return rc; 268 } 269 270 static int vbglR3ClipboardRecvListEntryRead(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTHANDLE phList, 271 PVBOXCLIPBOARDLISTENTRY pListEntry) 428 rc = Msg.fFeatures.GetUInt32(&pListHdr->fFeatures); 429 if (RT_SUCCESS(rc)) 430 rc = Msg.cTotalObjects.GetUInt64(&pListHdr->cTotalObjects); 431 if (RT_SUCCESS(rc)) 432 rc = Msg.cbTotalSize.GetUInt64(&pListHdr->cbTotalSize); 433 if (RT_SUCCESS(rc)) 434 rc = Msg.enmCompression.GetUInt32(&pListHdr->enmCompression); 435 if (RT_SUCCESS(rc)) 436 rc = Msg.enmChecksumType.GetUInt32(&pListHdr->enmChecksumType); 437 } 438 439 LogFlowFuncLeaveRC(rc); 440 return rc; 441 } 442 443 VBGLR3DECL(int) VbglR3ClipboardListHdrReadRecvReq(HGCMCLIENTID idClient, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfFlags) 444 { 445 AssertPtrReturn(phList, VERR_INVALID_POINTER); 446 AssertPtrReturn(pfFlags, VERR_INVALID_POINTER); 447 448 VBoxClipboardListHdrReadReqMsg Msg; 449 RT_ZERO(Msg); 450 451 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 452 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ_REQ); 453 454 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ); 455 Msg.ReqParms.uHandle.SetUInt64(0); 456 Msg.ReqParms.fFlags.SetUInt32(0); 457 458 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 459 if (RT_SUCCESS(rc)) 460 { 461 if (RT_SUCCESS(rc)) 462 rc = Msg.ReqParms.uHandle.GetUInt64(phList); 463 if (RT_SUCCESS(rc)) 464 rc = Msg.ReqParms.fFlags.GetUInt32(pfFlags); 465 } 466 467 LogFlowFuncLeaveRC(rc); 468 return rc; 469 } 470 471 VBGLR3DECL(int) VbglR3ClipboardListHdrWrite(HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList, 472 PVBOXCLIPBOARDLISTHDR pListHdr) 473 { 474 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER); 475 476 VBoxClipboardListHdrMsg Msg; 477 RT_ZERO(Msg); 478 479 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 480 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR); 481 482 Msg.ReqParms.uContext.SetUInt32(0); 483 Msg.ReqParms.uHandle.SetUInt64(hList); 484 Msg.ReqParms.fFlags.SetUInt32(0); 485 486 Msg.fFeatures.SetUInt32(0); 487 Msg.cbTotalSize.SetUInt32(pListHdr->fFeatures); 488 Msg.cTotalObjects.SetUInt64(pListHdr->cTotalObjects); 489 Msg.cbTotalSize.SetUInt64(pListHdr->cbTotalSize); 490 Msg.enmCompression.SetUInt32(pListHdr->enmCompression); 491 Msg.enmChecksumType.SetUInt32(pListHdr->enmChecksumType); 492 493 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 494 495 LogFlowFuncLeaveRC(rc); 496 return rc; 497 } 498 499 VBGLR3DECL(int) VbglR3ClipboardListEntryRead(HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList, 500 PVBOXCLIPBOARDLISTENTRY pListEntry) 272 501 { 273 502 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER); 274 AssertPtrReturn(phList, VERR_INVALID_POINTER); 275 276 VBoxClipboardListEntryReadMsg Msg;277 RT_ZERO(Msg); 278 279 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,280 VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_READ); 281 282 Msg. uContext.SetUInt32(0); /** @todo Context ID not used yet. */283 Msg. uHandle.SetUInt64(0);284 Msg.fInfo.SetUInt32(0); 503 504 VBoxClipboardListEntryMsg Msg; 505 RT_ZERO(Msg); 506 507 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 508 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY); 509 510 Msg.ReqParms.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 511 Msg.ReqParms.uHandle.SetUInt64(hList); 512 Msg.ReqParms.fInfo.SetUInt32(0); 513 285 514 Msg.cbInfo.SetUInt32(0); 286 515 Msg.pvInfo.SetPtr(pListEntry->pvInfo, pListEntry->cbInfo); … … 289 518 if (RT_SUCCESS(rc)) 290 519 { 291 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc);292 rc = Msg.fInfo.GetUInt32(&pListEntry->fInfo); AssertRC(rc);293 520 rc = Msg.cbInfo.GetUInt32(&pListEntry->cbInfo); AssertRC(rc); 294 521 } 522 523 LogFlowFuncLeaveRC(rc); 524 return rc; 525 } 526 527 VBGLR3DECL(int) VbglR3ClipboardListEntryReadRecvReq(HGCMCLIENTID idClient, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfInfo) 528 { 529 AssertPtrReturn(phList, VERR_INVALID_POINTER); 530 AssertPtrReturn(pfInfo, VERR_INVALID_POINTER); 531 532 VBoxClipboardListEntryReadReqMsg Msg; 533 RT_ZERO(Msg); 534 535 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 536 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_READ_REQ); 537 538 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ); 539 Msg.ReqParms.uHandle.SetUInt64(0); 540 Msg.ReqParms.fInfo.SetUInt32(0); 541 542 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 543 if (RT_SUCCESS(rc)) 544 { 545 rc = Msg.ReqParms.uHandle.GetUInt64(phList); AssertRC(rc); 546 if (RT_SUCCESS(rc)) 547 rc = Msg.ReqParms.fInfo.GetUInt32(pfInfo); AssertRC(rc); 548 } 549 550 LogFlowFuncLeaveRC(rc); 551 return rc; 552 } 553 554 VBGLR3DECL(int) VbglR3ClipboardListEntryWrite(HGCMCLIENTID idClient, SHAREDCLIPBOARDLISTHANDLE hList, 555 PVBOXCLIPBOARDLISTENTRY pListEntry) 556 { 557 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER); 558 559 VBoxClipboardListEntryMsg Msg; 560 RT_ZERO(Msg); 561 562 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 563 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY); 564 565 Msg.ReqParms.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 566 Msg.ReqParms.uHandle.SetUInt64(hList); 567 Msg.ReqParms.fInfo.SetUInt32(pListEntry->fInfo); 568 569 Msg.cbInfo.SetUInt32(pListEntry->cbInfo); 570 Msg.pvInfo.SetPtr(pListEntry->pvInfo, pListEntry->cbInfo); 571 572 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 295 573 296 574 LogFlowFuncLeaveRC(rc); … … 310 588 uint32_t uMsg = 0; 311 589 uint32_t cParms = 0; 312 int rc = vbglR3ClipboardGetNextMsgType(idClient, &uMsg, &cParms, true /* fWait */); 313 if (RT_SUCCESS(rc)) 314 { 315 /** @todo Check for VM session change. */ 316 } 317 318 #if 0 319 typedef struct _ 320 { 321 union 322 { 323 struct Dir 324 { 325 RTDIR hDir; 326 }; 327 } u; 328 }; 329 #endif 330 590 int rc = vbglR3ClipboardMsgPeekWait(idClient, &uMsg, &cParms, NULL /* pidRestoreCheck */); 331 591 if (RT_SUCCESS(rc)) 332 592 { … … 340 600 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN\n")); 341 601 342 VBOXCLIPBOARDLIST HDR listHdr;343 rc = SharedClipboardURIList HdrInit(&listHdr);602 VBOXCLIPBOARDLISTOPENPARMS openParmsList; 603 rc = SharedClipboardURIListOpenParmsInit(&openParmsList); 344 604 if (RT_SUCCESS(rc)) 345 605 { 346 rc = vbglR3ClipboardRecvListOpen(idClient, &listHdr);606 rc = VbglR3ClipboardListOpenRecv(idClient, &openParmsList); 347 607 if (RT_SUCCESS(rc)) 348 608 { 349 rc = SharedClipboardURITransferListOpen(pTransfer, &listHdr, NULL /* phList */); 609 SHAREDCLIPBOARDLISTHANDLE hList = SHAREDCLIPBOARDLISTHANDLE_INVALID; 610 rc = SharedClipboardURITransferListOpen(pTransfer, &openParmsList, &hList); 611 612 /* Reply in any case. */ 613 int rc2 = VbglR3ClipboardListOpenReply(idClient, rc, hList); 614 AssertRC(rc2); 350 615 } 351 616 352 SharedClipboardURIList HdrDestroy(&listHdr);617 SharedClipboardURIListOpenParmsDestroy(&openParmsList); 353 618 } 354 355 619 break; 356 620 } … … 360 624 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE\n")); 361 625 362 VBOXCLIPBOARDLISTHANDLE hList;363 rc = vbglR3ClipboardRecvListClose(idClient, &hList);626 SHAREDCLIPBOARDLISTHANDLE hList; 627 rc = VbglR3ClipboardListCloseRecv(idClient, &hList); 364 628 if (RT_SUCCESS(rc)) 365 629 { … … 376 640 /** @todo Handle filter + list features. */ 377 641 378 VBOXCLIPBOARDLISTHDR listHdr; 379 rc = SharedClipboardURIListHdrInit(&listHdr); 642 SHAREDCLIPBOARDLISTHANDLE hList = SHAREDCLIPBOARDLISTHANDLE_INVALID; 643 uint32_t fFlags = 0; 644 rc = VbglR3ClipboardListHdrReadRecvReq(idClient, &hList, &fFlags); 380 645 if (RT_SUCCESS(rc)) 381 646 { 382 VBOXCLIPBOARDLISTH ANDLE hList;383 rc = vbglR3ClipboardRecvListHdrRead(idClient, &hList, &listHdr);647 VBOXCLIPBOARDLISTHDR hdrList; 648 rc = SharedClipboardURITransferListGetHeader(pTransfer, hList, &hdrList); 384 649 if (RT_SUCCESS(rc)) 385 650 { 386 if (SharedClipboardURITransferListHandleIsValid(pTransfer, hList)) 387 { 388 rc = VbglR3ClipboardSendListHdrWrite(idClient, hList, &listHdr); 389 } 390 else 391 rc = VERR_INVALID_HANDLE; 651 rc = VbglR3ClipboardListHdrWrite(idClient, hList, &hdrList); 652 SharedClipboardURIListHdrDestroy(&hdrList); 392 653 } 393 394 SharedClipboardURIListHdrDestroy(&listHdr);395 654 } 396 655 … … 398 657 } 399 658 659 #if 0 400 660 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_WRITE: 401 661 { 402 662 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_WRITE\n")); 403 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_URI_LIST_HDR_WRITE; 663 664 VBOXCLIPBOARDLISTHDR hdrList; 665 rc = SharedClipboardURIListHdrInit(&hdrList); 666 if (RT_SUCCESS(rc)) 667 { 668 rc = VBglR3ClipboardListHdrRecv(idClient, ) 669 } 404 670 break; 405 671 } 672 #endif 406 673 407 674 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ: … … 413 680 if (RT_SUCCESS(rc)) 414 681 { 415 VBOXCLIPBOARDLISTHANDLE hList; 416 rc = vbglR3ClipboardRecvListEntryRead(idClient, &hList, &listEntry); 682 SHAREDCLIPBOARDLISTHANDLE hList; 683 uint32_t fInfo; 684 rc = VbglR3ClipboardListEntryReadRecvReq(idClient, &hList, &fInfo); 417 685 if (RT_SUCCESS(rc)) 418 686 { 419 if (SharedClipboardURITransferListHandleIsValid(pTransfer, hList)) 687 rc = SharedClipboardURITransferListRead(pTransfer, hList, &listEntry); 688 if (RT_SUCCESS(rc)) 420 689 { 421 rc = VbglR3Clipboard SendListEntryWrite(idClient, hList, &listEntry);690 rc = VbglR3ClipboardListEntryWrite(idClient, hList, &listEntry); 422 691 } 423 else424 rc = VERR_INVALID_HANDLE;425 692 } 426 693 427 694 SharedClipboardURIListEntryDestroy(&listEntry); 428 695 } 696 429 697 break; 430 698 } 431 699 700 #if 0 432 701 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_WRITE: 433 702 { … … 436 705 break; 437 706 } 707 #endif 438 708 439 709 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN: … … 458 728 } 459 729 730 #if 0 460 731 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_WRITE: 461 732 { … … 464 735 break; 465 736 } 737 #endif 466 738 #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */ 467 739 … … 471 743 } 472 744 } 473 474 745 475 746 if (RT_SUCCESS(rc)) … … 485 756 { 486 757 /* Report error back to the host. */ 487 VbglR3ClipboardWriteError(idClient, rc);758 //VbglR3ClipboardWriteError(idClient, rc); 488 759 489 760 VbglR3ClipboardEventFree(pEvent); … … 514 785 RTMemFree(pEvent); 515 786 pEvent = NULL; 787 } 788 789 #if 0 790 VBGLR3DECL(int) VbglR3ClipboardListHdrReadRecv(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTHANDLE phList) 791 { 792 AssertPtrReturn(phList, VERR_INVALID_POINTER); 793 794 VBoxClipboardListHdrReadMsg Msg; 795 RT_ZERO(Msg); 796 797 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 798 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ); 799 800 Msg.uContext.SetUInt32(0); /** @todo Not used yet. */ 801 Msg.uHandle.SetUInt64(0); 802 803 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 804 if (RT_SUCCESS(rc)) 805 { 806 Msg.uHandle.GetUInt32(phList); 807 } 808 809 LogFlowFuncLeaveRC(rc); 810 return rc; 516 811 } 517 812 … … 524 819 * @param pListHdr List header to send. 525 820 */ 526 VBGLR3DECL(int) VbglR3ClipboardSendListHdrWrite(HGCMCLIENTID idClient, 527 VBOXCLIPBOARDLISTHANDLE hList, PVBOXCLIPBOARDLISTHDR pListHdr) 528 { 529 VBoxClipboardListHdrWriteMsg Msg; 530 RT_ZERO(Msg); 531 532 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 533 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_WRITE); 821 VBGLR3DECL(int) VbglR3ClipboardListHdrSend(HGCMCLIENTID idClient, 822 VBOXCLIPBOARDLISTHANDLE hList, PVBOXCLIPBOARDLISTHDR pListHdr) 823 { 824 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER); 825 826 VBoxClipboardListHdrMsg Msg; 827 RT_ZERO(Msg); 828 829 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 830 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR); 534 831 535 832 Msg.uContext.SetUInt32(0); /** @todo Not used yet. */ 536 Msg. uHandle.SetUInt64(hList);833 Msg.fFeatures.SetUInt32(pListHdr->fFeatures); 537 834 Msg.cTotalObjects.SetUInt64(pListHdr->cTotalObjects); 538 835 Msg.cbTotalSize.SetUInt64(pListHdr->cbTotalSize); … … 576 873 return rc; 577 874 } 875 #endif 578 876 579 877 VBGLR3DECL(int) VbglR3ClipboardObjOpen(HGCMCLIENTID idClient, … … 683 981 Msg.pvData.SetPtr(pvData, cbData); 684 982 Msg.cbData.SetUInt32(cbData); 685 Msg.pvChecksum.SetPtr(NULL, 0); 686 Msg.cbChecksum.SetUInt32(0); 983 Msg.pvChecksum.SetPtr(NULL, 0); /** @todo Implement this. */ 984 Msg.cbChecksum.SetUInt32(0); /** @todo Implement this. */ 687 985 688 986 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
Note:
See TracChangeset
for help on using the changeset viewer.