- Timestamp:
- Dec 9, 2019 7:48:38 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/VBoxClipboardSvc.h
r82513 r82525 343 343 #define VBOX_SHCL_GUEST_FN_DATA_WRITE 4 344 344 345 /** Does the actual protocol handshake. 346 * 347 * If this message is not being sent by the guest, the host handles that 348 * particular client with the legacy protocol (v0). 349 * 350 * @retval VINF_SUCCESS on success. 351 * @retval VERR_INVALID_CLIENT_ID 352 * @retval VERR_WRONG_PARAMETER_COUNT 353 * @retval VERR_WRONG_PARAMETER_TYPE 345 /** This is a left-over from the 6.1 dev cycle and will always fail. 346 * 347 * It used to take three 32-bit parameters, only one of which was actually used. 348 * 349 * It was replaced by VBOX_SHCL_GUEST_FN_REPORT_FEATURES and 350 * VBOX_SHCL_GUEST_FN_NEGOTIATE_CHUNK_SIZE. 351 * 352 * @retval VERR_NOT_IMPLEMENTED 354 353 * @since 6.1 355 354 */ … … 564 563 #define VBOX_SHCL_GUEST_FN_ERROR 27 565 564 565 /** For negotiating a chunk size between the guest and host. 566 * 567 * Takes two 32-bit parameters both being byte counts, the first one gives the 568 * maximum chunk size the guest can handle and the second the preferred choice 569 * of the guest. Upon return, the host will have updated both of them to 570 * reflect the maximum and default chunk sizes this client connect. The guest 571 * may set the 2nd value to zero and let the host choose. 572 * 573 * @retval VINF_SUCCESS on success. 574 * @retval VERR_INVALID_CLIENT_ID 575 * @retval VERR_WRONG_PARAMETER_COUNT 576 * @retval VERR_WRONG_PARAMETER_TYPE 577 * @retval VERR_INVALID_PARAMETER if the 2nd parameter is larger than the 578 * first one 579 * @since 6.1 580 */ 581 #define VBOX_SHCL_GUEST_FN_NEGOTIATE_CHUNK_SIZE 28 582 566 583 /** The last function number (used for validation/sanity). */ 567 #define VBOX_SHCL_GUEST_FN_LAST VBOX_SHCL_GUEST_FN_ ERROR584 #define VBOX_SHCL_GUEST_FN_LAST VBOX_SHCL_GUEST_FN_NEGOTIATE_CHUNK_SIZE 568 585 /** @} */ 569 586 … … 579 596 /** No flags set. */ 580 597 #define VBOX_SHCL_GF_NONE 0 581 /** Guest can handle context IDs (uint64_t, in paParam[0]). 582 * This is true for Guest Additions < 6.1. */ 598 /** The guest can handle context IDs where applicable. */ 583 599 #define VBOX_SHCL_GF_0_CONTEXT_ID RT_BIT_64(0) 584 600 /** Bit that must be set in the 2nd parameter, will be cleared if the host reponds … … 592 608 /** No flags set. */ 593 609 #define VBOX_SHCL_HF_NONE 0 610 /** The host can handle context IDs where applicable as well as the new 611 * message handling functions. */ 612 #define VBOX_SHCL_HF_0_CONTEXT_ID RT_BIT_64(0) 594 613 /** @} */ 595 614 -
trunk/include/VBox/VBoxGuestLib.h
r82513 r82525 576 576 * @{ */ 577 577 578 # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS579 /**580 * Structure containing context parameters for Shared Clipboard transfers.581 */582 typedef struct VBGLR3SHCLTRANSFERCMDCTX583 {584 /** Callback table to use for all transfers. */585 SHCLTRANSFERCALLBACKS Callbacks;586 } VBGLR3SHCLTRANSFERCMDCTX, *PVBGLR3SHCLTRANSFERCMDCTX;587 # endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */588 589 578 /** 590 579 * The context required for either retrieving or sending a HGCM shared clipboard 591 580 * commands from or to the host. 581 * 582 * @todo This struct could be handy if we want to implement a second 583 * communication channel, e.g. via TCP/IP. Use a union for the HGCM stuff then. 592 584 */ 593 585 typedef struct VBGLR3SHCLCMDCTX 594 586 { 595 /** @todo This struct could be handy if we want to implement 596 * a second communication channel, e.g. via TCP/IP. 597 * Use a union for the HGCM stuff then. */ 598 599 /** IN/OUT: Context ID to retrieve or to use. */ 600 uint64_t uContextID; 601 /** IN: HGCM client ID to use for communication. */ 602 uint32_t uClientID; 603 /** IN: Maximum chunk size (in bytes). */ 604 uint32_t cbChunkSize; 605 /** IN: Host feature flags (of type VBOX_SHCL_HF_XXX). */ 606 uint64_t fHostFeatures; 607 /** Flag indicating whether to use the legacy protocol (<= VBox 6.1) or not. 608 * This is determined in VbglR3ClipboardConnectEx(). */ 609 bool fUseLegacyProtocol; 587 /** HGCM client ID to use for communication. 588 * This is set by VbglR3ClipboardConnectEx(). */ 589 uint32_t idClient; 590 /** This is @c false if both VBOX_SHCL_HF_0_CONTEXT_ID and 591 * VBOX_SHCL_GF_0_CONTEXT_ID are set, otherwise @c true and only the old 592 * protocol (< 6.1) should be used. 593 * This is set by VbglR3ClipboardConnectEx(). */ 594 bool fUseLegacyProtocol; 595 /** Host feature flags (VBOX_SHCL_HF_XXX). 596 * This is set by VbglR3ClipboardConnectEx(). */ 597 uint64_t fHostFeatures; 598 /** The guest feature flags reported to the host (VBOX_SHCL_GF_XXX). 599 * This is set by VbglR3ClipboardConnectEx(). */ 600 uint64_t fGuestFeatures; 601 # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 602 /** Default chunk size (in bytes). 603 * This is set by VbglR3ClipboardConnectEx(). */ 604 uint32_t cbChunkSize; 605 /** Max chunk size (in bytes). 606 * This is set by VbglR3ClipboardConnectEx(). */ 607 uint32_t cbMaxChunkSize; 608 # endif 609 610 /** The context ID - input or/and output depending on the operation. */ 611 uint64_t idContext; 610 612 /** OUT: Number of parameters retrieved. 611 * @todo r=bird: s/uNumParms/cParms/ !! */ 612 uint32_t uNumParms; 613 * This is set by ??. */ 614 uint32_t cParmsRecived; 615 613 616 # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 614 VBGLR3SHCLTRANSFERCMDCTX Transfers; 617 /** Callback table to use for all transfers. */ 618 SHCLTRANSFERCALLBACKS Callbacks; 615 619 # endif 616 } VBGLR3SHCLCMDCTX, *PVBGLR3SHCLCMDCTX; 620 } VBGLR3SHCLCMDCTX; 621 /** Pointer to a shared clipboard context for Vbgl. */ 622 typedef VBGLR3SHCLCMDCTX *PVBGLR3SHCLCMDCTX; 617 623 618 624 /** … … 680 686 VBGLR3DECL(int) VbglR3ClipboardReportFormats(HGCMCLIENTID idClient, uint32_t fFormats); 681 687 682 VBGLR3DECL(int) VbglR3ClipboardConnectEx(PVBGLR3SHCLCMDCTX pCtx );688 VBGLR3DECL(int) VbglR3ClipboardConnectEx(PVBGLR3SHCLCMDCTX pCtx, uint64_t fGuestFeatures); 683 689 VBGLR3DECL(int) VbglR3ClipboardDisconnectEx(PVBGLR3SHCLCMDCTX pCtx); 684 690 -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r82513 r82525 257 257 { 258 258 LogFunc(("WM_CLIPBOARDUPDATE: Reporting formats %#x\n", Formats.Formats)); 259 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx. uClientID, Formats.Formats);259 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx.idClient, Formats.Formats); 260 260 } 261 261 } … … 303 303 if ( RT_SUCCESS(rc) 304 304 && Formats.Formats != VBOX_SHCL_FMT_NONE) 305 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx. uClientID, Formats.Formats);305 rc = VbglR3ClipboardReportFormats(pCtx->CmdCtx.idClient, Formats.Formats); 306 306 } 307 307 else … … 647 647 648 648 /* Requested clipboard format is not available, send empty data. */ 649 VbglR3ClipboardWriteData(pCtx->CmdCtx. uClientID, VBOX_SHCL_FMT_NONE, NULL, 0);649 VbglR3ClipboardWriteData(pCtx->CmdCtx.idClient, VBOX_SHCL_FMT_NONE, NULL, 0); 650 650 } 651 651 … … 922 922 rc = SharedClipboardWinCtxInit(&pCtx->Win); 923 923 if (RT_SUCCESS(rc)) 924 rc = VbglR3ClipboardConnectEx(&pCtx->CmdCtx );924 rc = VbglR3ClipboardConnectEx(&pCtx->CmdCtx, VBOX_SHCL_GF_0_CONTEXT_ID); 925 925 if (RT_SUCCESS(rc)) 926 926 { … … 1004 1004 if (pCtx->CmdCtx.fUseLegacyProtocol) 1005 1005 { 1006 rc = VbglR3ClipboardGetHostMsgOld(pCtx->CmdCtx. uClientID, &uMsg, &uFormats);1006 rc = VbglR3ClipboardGetHostMsgOld(pCtx->CmdCtx.idClient, &uMsg, &uFormats); 1007 1007 if (RT_FAILURE(rc)) 1008 1008 { … … 1179 1179 /* Disconnect from the host service. 1180 1180 * This will also send a VBOX_SHCL_HOST_MSG_QUIT from the host so that we can break out from our message worker. */ 1181 VbglR3ClipboardDisconnect(pCtx->CmdCtx. uClientID);1182 pCtx->CmdCtx. uClientID= 0;1181 VbglR3ClipboardDisconnect(pCtx->CmdCtx.idClient); 1182 pCtx->CmdCtx.idClient = 0; 1183 1183 1184 1184 LogFlowFuncLeaveRC(VINF_SUCCESS); … … 1194 1194 1195 1195 /* Make sure that we are disconnected. */ 1196 Assert(pCtx->CmdCtx. uClientID== 0);1196 Assert(pCtx->CmdCtx.idClient == 0); 1197 1197 1198 1198 vboxClipboardDestroy(pCtx); -
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp
r82513 r82525 81 81 * 82 82 * @returns VBox status code. 83 * @param pCtx Shared Clipboard command context to use for the connection. 84 */ 85 VBGLR3DECL(int) VbglR3ClipboardConnectEx(PVBGLR3SHCLCMDCTX pCtx) 86 { 87 int rc = VbglR3ClipboardConnect(&pCtx->uClientID); 88 if (RT_SUCCESS(rc)) 89 { 90 VBoxShClConnect Msg; 91 RT_ZERO(Msg); 92 93 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 94 VBOX_SHCL_GUEST_FN_CONNECT, VBOX_SHCL_CPARMS_CONNECT); 95 96 VbglHGCMParmUInt32Set(&Msg.cbChunkSize, 0); 97 VbglHGCMParmUInt32Set(&Msg.enmCompression, 0); 98 VbglHGCMParmUInt32Set(&Msg.enmChecksumType, 0); 99 100 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 101 if (RT_SUCCESS(rc)) 102 { 103 rc = VbglHGCMParmUInt32Get(&Msg.cbChunkSize, &pCtx->cbChunkSize); 104 105 /** @todo Add / handle checksum + compression type. */ 106 107 if (RT_SUCCESS(rc)) 83 * @param pCtx Command context. This will be initialized by this 84 * call. 85 * @param fGuestFeatures The guest features supported by this client, 86 * VBOX_SHCL_GF_0_XXX. 87 */ 88 VBGLR3DECL(int) VbglR3ClipboardConnectEx(PVBGLR3SHCLCMDCTX pCtx, uint64_t fGuestFeatures) 89 { 90 /* 91 * Intialize the context structure. 92 */ 93 pCtx->idClient = 0; 94 pCtx->fHostFeatures = 0; 95 pCtx->fGuestFeatures = 0; 96 pCtx->fUseLegacyProtocol = true; 97 pCtx->cParmsRecived = 0; 98 pCtx->idContext = 0; 99 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 100 pCtx->cbChunkSize = VBOX_SHCL_DEFAULT_MAX_CHUNK_SIZE; 101 pCtx->cbMaxChunkSize = VMMDEV_MAX_HGCM_DATA_SIZE - _4K; 102 # error todo 103 #endif 104 105 /* 106 * First step is connecting to the HGCM service. 107 */ 108 int rc = VbglR3ClipboardConnect(&pCtx->idClient); 109 if (RT_SUCCESS(rc)) 110 { 111 /* 112 * Next is reporting our features. If this fails, assume older host. 113 */ 114 rc = VbglR3ClipboardReportFeatures(pCtx->idClient, fGuestFeatures, &pCtx->fHostFeatures); 115 if (RT_SUCCESS(rc)) 116 { 117 LogRel2(("Shared Clipboard: Host features: %#RX64\n", pCtx->fHostFeatures)); 118 if ( (pCtx->fHostFeatures & VBOX_SHCL_HF_0_CONTEXT_ID) 119 && (pCtx->fGuestFeatures & VBOX_SHCL_GF_0_CONTEXT_ID) ) 108 120 { 121 pCtx->fUseLegacyProtocol = false; 122 123 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 109 124 /* 110 * Report features to the host.125 * Negotiate a chunk size (sketched, as I don't know what it is supposed to be for). 111 126 */ 112 const uint64_t fGuestFeatures = VBOX_SHCL_GF_0_CONTEXT_ID; 113 114 rc = VbglR3ClipboardReportFeatures(pCtx->uClientID, fGuestFeatures, 115 &pCtx->fHostFeatures); 127 struct 128 { 129 VBGLIOCHGCMCALL Hdr; 130 VBoxShClParmNegotiateChunkSize Parms; 131 } Msg; 132 do 133 { 134 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_NEGOTIATE_CHUNK_SIZE, 135 VBOX_SHCL_GUEST_CPARM_NEGOTIATE_CHUNK_SIZE); 136 Msg.Parsm.cb32MaxChunkSize = VMMDEV_MAX_HGCM_DATA_SIZE - _4K; 137 Msg.Parsm.cb32ChunkSize = 0; 138 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 139 } while (rc == VERR_INTERRUPTED); 116 140 if (RT_SUCCESS(rc)) 117 LogRel2(("Shared Clipboard: Host features: %#RX64\n", pCtx->fHostFeatures)); 118 else 119 LogRel(("Shared Clipboard: Warning! Feature reporing failed: %Rrc\n", rc)); 120 121 pCtx->fUseLegacyProtocol = false; 141 { 142 pCtx->cbChunkSize = RT_MIN(Msg.Parms.cb32ChunkSize, _4K); 143 pCtx->cbMaxChunkSize = RT_MIN(Msg.Parms.cb32ChunkSize); 144 } 145 # error todo 146 LogRel2(("Shared Clipboard: Client %RU32 connected (cbChunkSize=%RU32, fUseLegacyProtocol=%RTbool)\n", 147 pCtx->idClient, pCtx->cbChunkSize, pCtx->fUseLegacyProtocol)); 148 #endif 122 149 } 150 else 151 { 152 if (pCtx->fHostFeatures & VBOX_SHCL_HF_0_CONTEXT_ID) 153 LogRel(("Shared Clipboard: Host does not expose VBOX_SHCL_HF_0_CONTEXT_ID (%RX64)\n", pCtx->fHostFeatures)); 154 if (pCtx->fHostFeatures & VBOX_SHCL_HF_0_CONTEXT_ID) 155 LogRel(("Shared Clipboard: Host does not expose VBOX_SHCL_HF_0_CONTEXT_ID (%RX64)\n", pCtx->fHostFeatures)); 156 157 pCtx->fUseLegacyProtocol = true; 158 } 123 159 } 124 160 else 125 161 { 126 /* If the above call fails, make sure to use some sane defaults for127 * the old (legacy, VBox <= 6.1) protocol. */162 AssertLogRelMsg(rc == VERR_NOT_SUPPORTED || rc == VERR_NOT_IMPLEMENTED, 163 ("Reporting features failed: %Rrc\n", rc)); 128 164 pCtx->fUseLegacyProtocol = true; 129 pCtx->cbChunkSize = _64K; /* Use 64KB as chunk size by default. */ 130 131 rc = VINF_SUCCESS; /* Failing above is not fatal. */ 132 } 133 134 LogFlowFunc(("fHostFeatures=%#RX64, cbChunkSize=%RU32\n", pCtx->fHostFeatures, pCtx->cbChunkSize)); 135 136 LogRel2(("Shared Clipboard: Client %RU32 connected (cbChunkSize=%RU32, fUseLegacyProtocol=%RTbool)\n", 137 pCtx->uClientID, pCtx->cbChunkSize, pCtx->fUseLegacyProtocol)); 138 } 139 140 LogFlowFuncLeaveRC(rc); 141 return rc; 142 } 143 144 145 /** 146 * Disconnects from the Shared Clipboard service, legacy version, do not use anymore. 147 * 148 * @returns VBox status code. 149 * @param idClient The client id returned by VbglR3ClipboardConnect(). 150 */ 151 VBGLR3DECL(int) VbglR3ClipboardDisconnect(HGCMCLIENTID idClient) 152 { 153 return VbglR3HGCMDisconnect(idClient); 154 } 155 156 157 /** 158 * Disconnects from the Shared Clipboard service, extended version. 159 * 160 * @returns VBox status code. 161 * @param pCtx Shared Clipboard command context to use for the connection. 162 */ 163 VBGLR3DECL(int) VbglR3ClipboardDisconnectEx(PVBGLR3SHCLCMDCTX pCtx) 164 { 165 int rc = VbglR3ClipboardDisconnect(pCtx->uClientID); 166 if (RT_SUCCESS(rc)) 167 { 168 pCtx->uClientID = 0; 169 } 170 171 LogFlowFuncLeaveRC(rc); 172 return rc; 173 } 174 175 176 /** 177 * Receives reported formats from the host. 178 * 179 * @returns VBox status code. 180 * @param pCtx Shared Clipboard command context to use for the connection. 181 * @param pFormats Where to store the received formats from the host. 182 */ 183 VBGLR3DECL(int) VbglR3ClipboardFormatsReportRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLFORMATDATA pFormats) 184 { 185 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 186 AssertPtrReturn(pFormats, VERR_INVALID_POINTER); 187 188 VBoxShClFormatsMsg Msg; 189 RT_ZERO(Msg); 190 191 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, VBOX_SHCL_GUEST_FN_MSG_GET, 3); 192 193 Msg.u.v1.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_FORMATS_REPORT); 194 Msg.u.v1.uFormats.SetUInt32(0); 195 Msg.u.v1.fFlags.SetUInt32(0); 196 197 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 198 if (RT_SUCCESS(rc)) 199 { 200 rc = Msg.u.v1.uContext.GetUInt64(&pCtx->uContextID); 201 if (RT_SUCCESS(rc)) 202 rc = Msg.u.v1.uFormats.GetUInt32(&pFormats->Formats); 203 if (RT_SUCCESS(rc)) 204 rc = Msg.u.v1.fFlags.GetUInt32(&pFormats->fFlags); 205 } 206 207 LogFlowFuncLeaveRC(rc); 208 return rc; 209 } 210 211 212 /** 213 * Receives a host request to read clipboard data from the guest. 214 * 215 * @returns VBox status code. 216 * @param pCtx Shared Clipboard command context to use for the connection. 217 * @param pDataReq Where to store the read data request from the host. 218 */ 219 VBGLR3DECL(int) VbglR3ClipboardReadDataRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLDATAREQ pDataReq) 220 { 221 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 222 AssertPtrReturn(pDataReq, VERR_INVALID_POINTER); 223 224 VBoxShClReadDataReqMsg Msg; 225 226 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, 227 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_READ_DATA_REQ); 228 229 Msg.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_READ_DATA); 230 Msg.fFlags.SetUInt32(0); 231 Msg.uFormat.SetUInt32(0); 232 Msg.cbSize.SetUInt32(0); 233 234 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 235 if (RT_SUCCESS(rc)) 236 { 237 rc = Msg.uContext.GetUInt64(&pCtx->uContextID); 238 if (RT_SUCCESS(rc)) 239 rc = Msg.uFormat.GetUInt32(&pDataReq->uFmt); 240 if (RT_SUCCESS(rc)) 241 rc = Msg.cbSize.GetUInt32(&pDataReq->cbSize); 242 } 243 244 LogFlowFuncLeaveRC(rc); 245 return rc; 246 } 247 248 249 /** 250 * Get a host message, legacy version (which does not have VBOX_SHCL_GUEST_FN_MSG_GET). Do not use anymore. 251 * 252 * Note: This is the old message which still is being used for the non-URI Shared Clipboard transfers, 253 * to not break compatibility with older additions / VBox versions. 254 * 255 * This will block until a message becomes available. 256 * 257 * @returns VBox status code. 258 * @param idClient The client id returned by VbglR3ClipboardConnect(). 259 * @param pidMsg Where to store the message id. 260 * @param pfFormats Where to store the format(s) the message applies to. 261 */ 262 VBGLR3DECL(int) VbglR3ClipboardGetHostMsgOld(HGCMCLIENTID idClient, uint32_t *pidMsg, uint32_t *pfFormats) 263 { 264 VBoxShClGetHostMsgOld Msg; 265 266 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 267 VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, VBOX_SHCL_CPARMS_GET_HOST_MSG_OLD); 268 269 VbglHGCMParmUInt32Set(&Msg.msg, 0); 270 VbglHGCMParmUInt32Set(&Msg.formats, 0); 271 272 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 273 if (RT_SUCCESS(rc)) 274 { 275 int rc2 = VbglHGCMParmUInt32Get(&Msg.msg, pidMsg); 276 if (RT_SUCCESS(rc)) 277 { 278 rc2 = VbglHGCMParmUInt32Get(&Msg.formats, pfFormats); 279 if (RT_SUCCESS(rc2)) 280 return rc; 281 } 282 rc = rc2; 283 } 284 *pidMsg = UINT32_MAX - 1; 285 *pfFormats = UINT32_MAX; 286 return rc; 287 } 288 289 290 /** 291 * Reads data from the host clipboard. 292 * 293 * Legacy function, do not use anymore. 294 * 295 * @returns VBox status code. 296 * @retval VINF_BUFFER_OVERFLOW If there is more data available than the caller provided buffer space for. 297 * 298 * @param idClient The client id returned by VbglR3ClipboardConnect(). 299 * @param fFormat The format we're requesting the data in. 300 * @param pvData Where to store the data. 301 * @param cbData The size of the buffer pointed to by \a pvData. 302 * @param pcbRead The actual size of the host clipboard data. May be larger than \a cbData. 303 */ 304 VBGLR3DECL(int) VbglR3ClipboardReadData(HGCMCLIENTID idClient, uint32_t fFormat, void *pvData, uint32_t cbData, 305 uint32_t *pcbRead) 306 { 307 LogFlowFuncEnter(); 308 309 struct 310 { 311 VBGLIOCHGCMCALL Hdr; 312 VBoxShClParmDataRead Parms; 313 } Msg; 314 315 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHCL_GUEST_FN_DATA_READ, VBOX_SHCL_CPARMS_DATA_READ); 316 VbglHGCMParmUInt32Set(&Msg.Parms.f32Format, fFormat); 317 VbglHGCMParmPtrSet( &Msg.Parms.pData, pvData, cbData); 318 VbglHGCMParmUInt32Set(&Msg.Parms.cb32Needed, 0); 319 320 int rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 321 if (RT_SUCCESS(rc)) 322 { 323 uint32_t cbRead; 324 rc = VbglHGCMParmUInt32Get(&Msg.Parms.cb32Needed, &cbRead); 325 if (RT_SUCCESS(rc)) 326 { 327 LogFlowFunc(("cbRead=%RU32\n", cbRead)); 328 329 if (cbRead > cbData) 330 rc = VINF_BUFFER_OVERFLOW; 331 332 *pcbRead = cbRead; 333 } 334 } 335 336 LogFlowFuncLeaveRC(rc); 337 return rc; 338 } 339 340 /** 341 * Reads clipboard data from the host clipboard. 342 * 343 * @returns VBox status code. 344 * @retval VINF_BUFFER_OVERFLOW If there is more data available than the caller provided buffer space for. 345 * 346 * @param pCtx The command context returned by VbglR3ClipboardConnectEx(). 347 * @param pData Where to store the clipboard data read. 348 * @param pcbRead The actual size of the host clipboard data. 349 */ 350 VBGLR3DECL(int) VbglR3ClipboardReadDataEx(PVBGLR3SHCLCMDCTX pCtx, PSHCLDATABLOCK pData, uint32_t *pcbRead) 351 { 352 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 353 AssertPtrReturn(pData, VERR_INVALID_POINTER); 354 return VbglR3ClipboardReadData(pCtx->uClientID, pData->uFormat, pData->pvData, pData->cbData, pcbRead); 355 } 165 } 166 } 167 168 LogFlowFuncLeaveRC(rc); 169 return rc; 170 } 171 356 172 357 173 /** … … 394 210 } 395 211 212 213 /** 214 * Disconnects from the Shared Clipboard service, legacy version, do not use anymore. 215 * 216 * @returns VBox status code. 217 * @param idClient The client id returned by VbglR3ClipboardConnect(). 218 */ 219 VBGLR3DECL(int) VbglR3ClipboardDisconnect(HGCMCLIENTID idClient) 220 { 221 return VbglR3HGCMDisconnect(idClient); 222 } 223 224 225 /** 226 * Disconnects from the Shared Clipboard service, extended version. 227 * 228 * @returns VBox status code. 229 * @param pCtx Shared Clipboard command context to use for the connection. 230 */ 231 VBGLR3DECL(int) VbglR3ClipboardDisconnectEx(PVBGLR3SHCLCMDCTX pCtx) 232 { 233 int rc = VbglR3ClipboardDisconnect(pCtx->idClient); 234 if (RT_SUCCESS(rc)) 235 { 236 pCtx->idClient = 0; 237 } 238 239 LogFlowFuncLeaveRC(rc); 240 return rc; 241 } 242 243 244 /** 245 * Receives reported formats from the host. 246 * 247 * @returns VBox status code. 248 * @param pCtx Shared Clipboard command context to use for the connection. 249 * @param pFormats Where to store the received formats from the host. 250 */ 251 VBGLR3DECL(int) VbglR3ClipboardFormatsReportRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLFORMATDATA pFormats) 252 { 253 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 254 AssertPtrReturn(pFormats, VERR_INVALID_POINTER); 255 256 VBoxShClFormatsMsg Msg; 257 RT_ZERO(Msg); 258 259 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_MSG_GET, 3); 260 261 Msg.u.v1.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_FORMATS_REPORT); 262 Msg.u.v1.uFormats.SetUInt32(0); 263 Msg.u.v1.fFlags.SetUInt32(0); 264 265 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 266 if (RT_SUCCESS(rc)) 267 { 268 rc = Msg.u.v1.uContext.GetUInt64(&pCtx->idContext); 269 if (RT_SUCCESS(rc)) 270 rc = Msg.u.v1.uFormats.GetUInt32(&pFormats->Formats); 271 if (RT_SUCCESS(rc)) 272 rc = Msg.u.v1.fFlags.GetUInt32(&pFormats->fFlags); 273 } 274 275 LogFlowFuncLeaveRC(rc); 276 return rc; 277 } 278 279 280 /** 281 * Receives a host request to read clipboard data from the guest. 282 * 283 * @returns VBox status code. 284 * @param pCtx Shared Clipboard command context to use for the connection. 285 * @param pDataReq Where to store the read data request from the host. 286 */ 287 VBGLR3DECL(int) VbglR3ClipboardReadDataRecv(PVBGLR3SHCLCMDCTX pCtx, PSHCLDATAREQ pDataReq) 288 { 289 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 290 AssertPtrReturn(pDataReq, VERR_INVALID_POINTER); 291 292 VBoxShClReadDataReqMsg Msg; 293 294 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 295 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_READ_DATA_REQ); 296 297 Msg.uContext.SetUInt64(VBOX_SHCL_HOST_MSG_READ_DATA); 298 Msg.fFlags.SetUInt32(0); 299 Msg.uFormat.SetUInt32(0); 300 Msg.cbSize.SetUInt32(0); 301 302 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 303 if (RT_SUCCESS(rc)) 304 { 305 rc = Msg.uContext.GetUInt64(&pCtx->idContext); 306 if (RT_SUCCESS(rc)) 307 rc = Msg.uFormat.GetUInt32(&pDataReq->uFmt); 308 if (RT_SUCCESS(rc)) 309 rc = Msg.cbSize.GetUInt32(&pDataReq->cbSize); 310 } 311 312 LogFlowFuncLeaveRC(rc); 313 return rc; 314 } 315 316 317 /** 318 * Get a host message, legacy version (which does not have VBOX_SHCL_GUEST_FN_MSG_GET). Do not use anymore. 319 * 320 * Note: This is the old message which still is being used for the non-URI Shared Clipboard transfers, 321 * to not break compatibility with older additions / VBox versions. 322 * 323 * This will block until a message becomes available. 324 * 325 * @returns VBox status code. 326 * @param idClient The client id returned by VbglR3ClipboardConnect(). 327 * @param pidMsg Where to store the message id. 328 * @param pfFormats Where to store the format(s) the message applies to. 329 */ 330 VBGLR3DECL(int) VbglR3ClipboardGetHostMsgOld(HGCMCLIENTID idClient, uint32_t *pidMsg, uint32_t *pfFormats) 331 { 332 VBoxShClGetHostMsgOld Msg; 333 334 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, 335 VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, VBOX_SHCL_CPARMS_GET_HOST_MSG_OLD); 336 337 VbglHGCMParmUInt32Set(&Msg.msg, 0); 338 VbglHGCMParmUInt32Set(&Msg.formats, 0); 339 340 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 341 if (RT_SUCCESS(rc)) 342 { 343 int rc2 = VbglHGCMParmUInt32Get(&Msg.msg, pidMsg); 344 if (RT_SUCCESS(rc)) 345 { 346 rc2 = VbglHGCMParmUInt32Get(&Msg.formats, pfFormats); 347 if (RT_SUCCESS(rc2)) 348 return rc; 349 } 350 rc = rc2; 351 } 352 *pidMsg = UINT32_MAX - 1; 353 *pfFormats = UINT32_MAX; 354 return rc; 355 } 356 357 358 /** 359 * Reads data from the host clipboard. 360 * 361 * Legacy function, do not use anymore. 362 * 363 * @returns VBox status code. 364 * @retval VINF_BUFFER_OVERFLOW If there is more data available than the caller provided buffer space for. 365 * 366 * @param idClient The client id returned by VbglR3ClipboardConnect(). 367 * @param fFormat The format we're requesting the data in. 368 * @param pvData Where to store the data. 369 * @param cbData The size of the buffer pointed to by \a pvData. 370 * @param pcbRead The actual size of the host clipboard data. May be larger than \a cbData. 371 */ 372 VBGLR3DECL(int) VbglR3ClipboardReadData(HGCMCLIENTID idClient, uint32_t fFormat, void *pvData, uint32_t cbData, 373 uint32_t *pcbRead) 374 { 375 LogFlowFuncEnter(); 376 377 struct 378 { 379 VBGLIOCHGCMCALL Hdr; 380 VBoxShClParmDataRead Parms; 381 } Msg; 382 383 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, VBOX_SHCL_GUEST_FN_DATA_READ, VBOX_SHCL_CPARMS_DATA_READ); 384 VbglHGCMParmUInt32Set(&Msg.Parms.f32Format, fFormat); 385 VbglHGCMParmPtrSet( &Msg.Parms.pData, pvData, cbData); 386 VbglHGCMParmUInt32Set(&Msg.Parms.cb32Needed, 0); 387 388 int rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 389 if (RT_SUCCESS(rc)) 390 { 391 uint32_t cbRead; 392 rc = VbglHGCMParmUInt32Get(&Msg.Parms.cb32Needed, &cbRead); 393 if (RT_SUCCESS(rc)) 394 { 395 LogFlowFunc(("cbRead=%RU32\n", cbRead)); 396 397 if (cbRead > cbData) 398 rc = VINF_BUFFER_OVERFLOW; 399 400 *pcbRead = cbRead; 401 } 402 } 403 404 LogFlowFuncLeaveRC(rc); 405 return rc; 406 } 407 408 409 /** 410 * Reads clipboard data from the host clipboard. 411 * 412 * @returns VBox status code. 413 * @retval VINF_BUFFER_OVERFLOW If there is more data available than the caller provided buffer space for. 414 * 415 * @param pCtx The command context returned by VbglR3ClipboardConnectEx(). 416 * @param pData Where to store the clipboard data read. 417 * @param pcbRead The actual size of the host clipboard data. 418 */ 419 VBGLR3DECL(int) VbglR3ClipboardReadDataEx(PVBGLR3SHCLCMDCTX pCtx, PSHCLDATABLOCK pData, uint32_t *pcbRead) 420 { 421 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 422 AssertPtrReturn(pData, VERR_INVALID_POINTER); 423 return VbglR3ClipboardReadData(pCtx->idClient, pData->uFormat, pData->pvData, pData->cbData, pcbRead); 424 } 425 426 396 427 /** 397 428 * Query the host features. … … 462 493 HGCMFunctionParameter cParameters; 463 494 } Msg; 464 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx-> uClientID, VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT, 2);495 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT, 2); 465 496 VbglHGCMParmUInt64Set(&Msg.idMsg, pidRestoreCheck ? *pidRestoreCheck : 0); 466 497 VbglHGCMParmUInt32Set(&Msg.cParameters, 0); … … 484 515 if (rc == VERR_INTERRUPTED) 485 516 { 486 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx-> uClientID, VBOX_SHCL_GUEST_FN_CANCEL, 0);517 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_CANCEL, 0); 487 518 int rc2 = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr)); 488 519 AssertRC(rc2); … … 516 547 RT_ZERO(Msg); 517 548 518 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,549 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 519 550 VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_READ, VBOX_SHCL_CPARMS_ROOT_LIST_HDR_READ); 520 551 521 Msg.ReqParms.uContext.SetUInt64(pCtx-> uContextID);552 Msg.ReqParms.uContext.SetUInt64(pCtx->idContext); 522 553 Msg.ReqParms.fRoots.SetUInt32(0); 523 554 … … 552 583 RT_ZERO(Msg); 553 584 554 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,585 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 555 586 VBOX_SHCL_GUEST_FN_ROOT_LIST_ENTRY_READ, VBOX_SHCL_CPARMS_ROOT_LIST_ENTRY_READ); 556 587 557 Msg.Parms.uContext.SetUInt64(pCtx-> uContextID);588 Msg.Parms.uContext.SetUInt64(pCtx->idContext); 558 589 Msg.Parms.fInfo.SetUInt32(pRootListEntry->fInfo); 559 590 Msg.Parms.uIndex.SetUInt32(uIndex); … … 661 692 RT_ZERO(Msg); 662 693 663 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,694 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 664 695 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_TRANSFER_STATUS); 665 696 … … 673 704 if (RT_SUCCESS(rc)) 674 705 { 675 rc = Msg.uContext.GetUInt64(&pCtx-> uContextID); AssertRC(rc);706 rc = Msg.uContext.GetUInt64(&pCtx->idContext); AssertRC(rc); 676 707 if (RT_SUCCESS(rc)) 677 708 rc = Msg.enmDir.GetUInt32((uint32_t *)pEnmDir); AssertRC(rc); … … 708 739 RT_ZERO(Msg); 709 740 710 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,741 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 711 742 VBOX_SHCL_GUEST_FN_REPLY, VBOX_SHCL_CPARMS_REPLY_MIN + 1); 712 743 713 Msg.uContext.SetUInt64(pCtx-> uContextID);744 Msg.uContext.SetUInt64(pCtx->idContext); 714 745 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_TRANSFER_STATUS); 715 746 Msg.rc.SetUInt32((uint32_t )rcTransfer); /* int vs. uint32_t */ … … 742 773 RT_ZERO(Msg); 743 774 744 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,775 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 745 776 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_ROOT_LIST_HDR_READ_REQ); 746 777 … … 751 782 if (RT_SUCCESS(rc)) 752 783 { 753 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx-> uContextID); AssertRC(rc);784 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx->idContext); AssertRC(rc); 754 785 if (RT_SUCCESS(rc)) 755 786 rc = Msg.ReqParms.fRoots.GetUInt32(pfRoots); AssertRC(rc); … … 775 806 RT_ZERO(Msg); 776 807 777 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,808 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 778 809 VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_WRITE, VBOX_SHCL_CPARMS_ROOT_LIST_HDR_WRITE); 779 810 780 Msg.ReqParms.uContext.SetUInt64(pCtx-> uContextID);811 Msg.ReqParms.uContext.SetUInt64(pCtx->idContext); 781 812 Msg.ReqParms.fRoots.SetUInt32(pRootListHdr->fRoots); 782 813 … … 806 837 RT_ZERO(Msg); 807 838 808 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,839 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 809 840 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_ROOT_LIST_ENTRY_READ_REQ); 810 841 … … 816 847 if (RT_SUCCESS(rc)) 817 848 { 818 rc = Msg.Parms.uContext.GetUInt64(&pCtx-> uContextID); AssertRC(rc);849 rc = Msg.Parms.uContext.GetUInt64(&pCtx->idContext); AssertRC(rc); 819 850 if (RT_SUCCESS(rc)) 820 851 rc = Msg.Parms.fInfo.GetUInt32(pfInfo); AssertRC(rc); … … 843 874 RT_ZERO(Msg); 844 875 845 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,876 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 846 877 VBOX_SHCL_GUEST_FN_ROOT_LIST_ENTRY_WRITE, VBOX_SHCL_CPARMS_ROOT_LIST_ENTRY_WRITE); 847 878 848 Msg.Parms.uContext.SetUInt64(pCtx-> uContextID);879 Msg.Parms.uContext.SetUInt64(pCtx->idContext); 849 880 Msg.Parms.fInfo.SetUInt32(0); 850 881 Msg.Parms.uIndex.SetUInt32(uIndex); … … 878 909 RT_ZERO(Msg); 879 910 880 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,911 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 881 912 VBOX_SHCL_GUEST_FN_LIST_OPEN, VBOX_SHCL_CPARMS_LIST_OPEN); 882 913 883 Msg.uContext.SetUInt64(pCtx-> uContextID);914 Msg.uContext.SetUInt64(pCtx->idContext); 884 915 Msg.fList.SetUInt32(0); 885 916 Msg.cbFilter.SetUInt32(pOpenParms->cbFilter); … … 914 945 RT_ZERO(Msg); 915 946 916 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,947 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 917 948 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_LIST_OPEN); 918 949 … … 928 959 if (RT_SUCCESS(rc)) 929 960 { 930 rc = Msg.uContext.GetUInt64(&pCtx-> uContextID);961 rc = Msg.uContext.GetUInt64(&pCtx->idContext); 931 962 if (RT_SUCCESS(rc)) 932 963 rc = Msg.fList.GetUInt32(&pOpenParms->fList); … … 956 987 RT_ZERO(Msg); 957 988 958 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,989 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 959 990 VBOX_SHCL_GUEST_FN_REPLY, VBOX_SHCL_CPARMS_REPLY_MIN + 1); 960 991 961 Msg.uContext.SetUInt64(pCtx-> uContextID);992 Msg.uContext.SetUInt64(pCtx->idContext); 962 993 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_LIST_OPEN); 963 994 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ … … 988 1019 RT_ZERO(Msg); 989 1020 990 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1021 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 991 1022 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_LIST_CLOSE); 992 1023 … … 997 1028 if (RT_SUCCESS(rc)) 998 1029 { 999 rc = Msg.uContext.GetUInt64(&pCtx-> uContextID);1030 rc = Msg.uContext.GetUInt64(&pCtx->idContext); 1000 1031 if (RT_SUCCESS(rc)) 1001 1032 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc); … … 1021 1052 RT_ZERO(Msg); 1022 1053 1023 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1054 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1024 1055 VBOX_SHCL_GUEST_FN_REPLY, VBOX_SHCL_CPARMS_REPLY_MIN + 1); 1025 1056 1026 Msg.uContext.SetUInt64(pCtx-> uContextID);1057 Msg.uContext.SetUInt64(pCtx->idContext); 1027 1058 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_LIST_CLOSE); 1028 1059 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ … … 1052 1083 RT_ZERO(Msg); 1053 1084 1054 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1085 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1055 1086 VBOX_SHCL_GUEST_FN_LIST_CLOSE, VBOX_SHCL_CPARMS_LIST_CLOSE); 1056 1087 1057 Msg.uContext.SetUInt64(pCtx-> uContextID);1088 Msg.uContext.SetUInt64(pCtx->idContext); 1058 1089 Msg.uHandle.SetUInt64(hList); 1059 1090 … … 1082 1113 RT_ZERO(Msg); 1083 1114 1084 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1115 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1085 1116 VBOX_SHCL_GUEST_FN_LIST_HDR_READ, VBOX_SHCL_CPARMS_LIST_HDR); 1086 1117 1087 Msg.ReqParms.uContext.SetUInt64(pCtx-> uContextID);1118 Msg.ReqParms.uContext.SetUInt64(pCtx->idContext); 1088 1119 Msg.ReqParms.uHandle.SetUInt64(hList); 1089 1120 Msg.ReqParms.fFlags.SetUInt32(fFlags); … … 1125 1156 RT_ZERO(Msg); 1126 1157 1127 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1158 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1128 1159 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_LIST_HDR_READ_REQ); 1129 1160 … … 1135 1166 if (RT_SUCCESS(rc)) 1136 1167 { 1137 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx-> uContextID);1168 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx->idContext); 1138 1169 if (RT_SUCCESS(rc)) 1139 1170 rc = Msg.ReqParms.uHandle.GetUInt64(phList); … … 1163 1194 RT_ZERO(Msg); 1164 1195 1165 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1196 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1166 1197 VBOX_SHCL_GUEST_FN_LIST_HDR_WRITE, VBOX_SHCL_CPARMS_LIST_HDR); 1167 1198 1168 Msg.ReqParms.uContext.SetUInt64(pCtx-> uContextID);1199 Msg.ReqParms.uContext.SetUInt64(pCtx->idContext); 1169 1200 Msg.ReqParms.uHandle.SetUInt64(hList); 1170 1201 Msg.ReqParms.fFlags.SetUInt32(0); … … 1198 1229 RT_ZERO(Msg); 1199 1230 1200 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1231 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1201 1232 VBOX_SHCL_GUEST_FN_LIST_ENTRY_READ, VBOX_SHCL_CPARMS_LIST_ENTRY); 1202 1233 1203 Msg.ReqParms.uContext.SetUInt64(pCtx-> uContextID);1234 Msg.ReqParms.uContext.SetUInt64(pCtx->idContext); 1204 1235 Msg.ReqParms.uHandle.SetUInt64(hList); 1205 1236 Msg.ReqParms.fInfo.SetUInt32(0); … … 1236 1267 RT_ZERO(Msg); 1237 1268 1238 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1269 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1239 1270 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_LIST_ENTRY_READ); 1240 1271 … … 1246 1277 if (RT_SUCCESS(rc)) 1247 1278 { 1248 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx-> uContextID);1279 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx->idContext); 1249 1280 if (RT_SUCCESS(rc)) 1250 1281 rc = Msg.ReqParms.uHandle.GetUInt64(phList); AssertRC(rc); … … 1274 1305 RT_ZERO(Msg); 1275 1306 1276 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1307 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1277 1308 VBOX_SHCL_GUEST_FN_LIST_ENTRY_WRITE, VBOX_SHCL_CPARMS_LIST_ENTRY); 1278 1309 1279 Msg.ReqParms.uContext.SetUInt64(pCtx-> uContextID);1310 Msg.ReqParms.uContext.SetUInt64(pCtx->idContext); 1280 1311 Msg.ReqParms.uHandle.SetUInt64(hList); 1281 1312 Msg.ReqParms.fInfo.SetUInt32(pListEntry->fInfo); … … 1306 1337 RT_ZERO(Msg); 1307 1338 1308 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1339 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1309 1340 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_OBJ_OPEN); 1310 1341 … … 1318 1349 if (RT_SUCCESS(rc)) 1319 1350 { 1320 rc = Msg.uContext.GetUInt64(&pCtx-> uContextID);1351 rc = Msg.uContext.GetUInt64(&pCtx->idContext); 1321 1352 if (RT_SUCCESS(rc)) 1322 1353 rc = Msg.cbPath.GetUInt32(&pCreateParms->cbPath); … … 1344 1375 RT_ZERO(Msg); 1345 1376 1346 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1377 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1347 1378 VBOX_SHCL_GUEST_FN_REPLY, VBOX_SHCL_CPARMS_REPLY_MIN + 1); 1348 1379 1349 Msg.uContext.SetUInt64(pCtx-> uContextID);1380 Msg.uContext.SetUInt64(pCtx->idContext); 1350 1381 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_OBJ_OPEN); 1351 1382 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ … … 1379 1410 RT_ZERO(Msg); 1380 1411 1381 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1412 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1382 1413 VBOX_SHCL_GUEST_FN_OBJ_OPEN, VBOX_SHCL_CPARMS_OBJ_OPEN); 1383 1414 1384 Msg.uContext.SetUInt64(pCtx-> uContextID);1415 Msg.uContext.SetUInt64(pCtx->idContext); 1385 1416 Msg.uHandle.SetUInt64(0); 1386 1417 Msg.cbPath.SetUInt32(pCreateParms->cbPath); … … 1413 1444 RT_ZERO(Msg); 1414 1445 1415 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1446 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1416 1447 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_OBJ_CLOSE); 1417 1448 … … 1422 1453 if (RT_SUCCESS(rc)) 1423 1454 { 1424 rc = Msg.uContext.GetUInt64(&pCtx-> uContextID);1455 rc = Msg.uContext.GetUInt64(&pCtx->idContext); 1425 1456 if (RT_SUCCESS(rc)) 1426 1457 rc = Msg.uHandle.GetUInt64(phObj); … … 1446 1477 RT_ZERO(Msg); 1447 1478 1448 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1479 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1449 1480 VBOX_SHCL_GUEST_FN_REPLY, VBOX_SHCL_CPARMS_REPLY_MIN + 1); 1450 1481 1451 Msg.uContext.SetUInt64(pCtx-> uContextID);1482 Msg.uContext.SetUInt64(pCtx->idContext); 1452 1483 Msg.enmType.SetUInt32(VBOX_SHCL_REPLYMSGTYPE_OBJ_CLOSE); 1453 1484 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */ … … 1477 1508 RT_ZERO(Msg); 1478 1509 1479 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1510 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1480 1511 VBOX_SHCL_GUEST_FN_OBJ_CLOSE, VBOX_SHCL_CPARMS_OBJ_CLOSE); 1481 1512 1482 Msg.uContext.SetUInt64(pCtx-> uContextID);1513 Msg.uContext.SetUInt64(pCtx->idContext); 1483 1514 Msg.uHandle.SetUInt64(hObj); 1484 1515 … … 1509 1540 RT_ZERO(Msg); 1510 1541 1511 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1542 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1512 1543 VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_CPARMS_OBJ_READ_REQ); 1513 1544 … … 1520 1551 if (RT_SUCCESS(rc)) 1521 1552 { 1522 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx-> uContextID);1553 rc = Msg.ReqParms.uContext.GetUInt64(&pCtx->idContext); 1523 1554 if (RT_SUCCESS(rc)) 1524 1555 rc = Msg.ReqParms.uHandle.GetUInt64(phObj); … … 1554 1585 RT_ZERO(Msg); 1555 1586 1556 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1587 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1557 1588 VBOX_SHCL_GUEST_FN_OBJ_READ, VBOX_SHCL_CPARMS_OBJ_READ); 1558 1589 1559 Msg.uContext.SetUInt64(pCtx-> uContextID);1590 Msg.uContext.SetUInt64(pCtx->idContext); 1560 1591 Msg.uHandle.SetUInt64(hObj); 1561 1592 Msg.cbData.SetUInt32(cbData); … … 1601 1632 RT_ZERO(Msg); 1602 1633 1603 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx-> uClientID,1634 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->idClient, 1604 1635 VBOX_SHCL_GUEST_FN_OBJ_WRITE, VBOX_SHCL_CPARMS_OBJ_WRITE); 1605 1636 1606 Msg.uContext.SetUInt64(pCtx-> uContextID);1637 Msg.uContext.SetUInt64(pCtx->idContext); 1607 1638 Msg.uHandle.SetUInt64(hObj); 1608 1639 Msg.pvData.SetPtr(pvData, cbData); … … 2282 2313 { 2283 2314 /* Report error back to the host. */ 2284 int rc2 = VbglR3ClipboardWriteError(pCtx-> uClientID, rc);2315 int rc2 = VbglR3ClipboardWriteError(pCtx->idClient, rc); 2285 2316 AssertRC(rc2); 2286 2317 } … … 2393 2424 if (pCtx->fUseLegacyProtocol) 2394 2425 { 2395 rc = VbglR3ClipboardWriteData(pCtx-> uClientID, pData->uFormat, pData->pvData, pData->cbData);2426 rc = VbglR3ClipboardWriteData(pCtx->idClient, pData->uFormat, pData->pvData, pData->cbData); 2396 2427 } 2397 2428 else … … 2403 2434 } Msg; 2404 2435 2405 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx-> uClientID, VBOX_SHCL_GUEST_FN_DATA_WRITE, VBOX_SHCL_CPARMS_DATA_WRITE);2406 Msg.Parms.id64Context.SetUInt64(pCtx-> uContextID);2436 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_DATA_WRITE, VBOX_SHCL_CPARMS_DATA_WRITE); 2437 Msg.Parms.id64Context.SetUInt64(pCtx->idContext); 2407 2438 Msg.Parms.f32Format.SetUInt32(pData->uFormat); 2408 2439 Msg.Parms.pData.SetPtr(pData->pvData, pData->cbData); 2409 2440 2410 LogFlowFunc(("CID=%RU32\n", pCtx-> uContextID));2441 LogFlowFunc(("CID=%RU32\n", pCtx->idContext)); 2411 2442 2412 2443 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); -
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r82513 r82525 184 184 LogFlowFunc(("Formats=0x%x\n", fFormats)); 185 185 186 int rc2 = VbglR3ClipboardReportFormats(pCtx->CmdCtx. uClientID, fFormats);186 int rc2 = VbglR3ClipboardReportFormats(pCtx->CmdCtx.idClient, fFormats); 187 187 RT_NOREF(rc2); 188 188 LogFlowFuncLeaveRC(rc2); … … 240 240 if (RT_SUCCESS(rc)) 241 241 { 242 rc = VbglR3ClipboardConnectEx(&g_Ctx.CmdCtx );242 rc = VbglR3ClipboardConnectEx(&g_Ctx.CmdCtx, VBOX_SHCL_GF_0_CONTEXT_ID); 243 243 if (RT_FAILURE(rc)) 244 244 ShClX11ThreadStop(&g_Ctx.X11); … … 286 286 uint32_t uFormats; 287 287 288 rc = VbglR3ClipboardGetHostMsgOld(pCtx->CmdCtx. uClientID, &uMsg, &uFormats);288 rc = VbglR3ClipboardGetHostMsgOld(pCtx->CmdCtx.idClient, &uMsg, &uFormats); 289 289 if (RT_FAILURE(rc)) 290 290 { 291 if (rc == VERR_INTERRUPTED) 291 if (rc == VERR_INTERRUPTED) /** @todo r=bird: What on earth is the meaning of this?!?!?!?!?!?!? */ 292 292 break; 293 293 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r82515 r82525 293 293 ClipboardClientQueue g_listClientsDeferred; 294 294 295 /** Host feature mask for VBOX_SHCL_GUEST_FN_REPORT_FEATURES/VBOX_SHCL_GUEST_FN_QUERY_FEATURES. */ 296 static uint64_t const g_fHostFeatures0 = VBOX_SHCL_HF_NONE; 295 /** Host feature mask (VBOX_SHCL_HF_0_XXX) for VBOX_SHCL_GUEST_FN_REPORT_FEATURES 296 * and VBOX_SHCL_GUEST_FN_QUERY_FEATURES. */ 297 static uint64_t const g_fHostFeatures0 = VBOX_SHCL_HF_0_CONTEXT_ID; 297 298 298 299 … … 1849 1850 1850 1851 case VBOX_SHCL_GUEST_FN_CONNECT: 1851 { 1852 if (cParms != VBOX_SHCL_CPARMS_CONNECT) 1853 { 1854 rc = VERR_INVALID_PARAMETER; 1855 } 1856 else if ( paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* cbChunkSize */ 1857 || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* enmCompression */ 1858 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT) /* enmChecksumType */ 1859 { 1860 rc = VERR_INVALID_PARAMETER; 1861 } 1862 else if (ShClSvcGetMode() == VBOX_SHCL_MODE_OFF) 1863 { 1864 rc = VERR_ACCESS_DENIED; 1865 } 1866 else 1867 { 1868 /* Report back supported chunk size to the guest. */ 1869 HGCMSvcSetU32(&paParms[0], _64K); /* Chunk size */ /** @todo Make chunk size dynamic. */ 1870 1871 rc = VINF_SUCCESS; 1872 } 1852 LogRel(("6.1.0 beta or rc additions detected. Please upgrade!\n")); 1853 rc = VERR_NOT_IMPLEMENTED; 1873 1854 break; 1874 }1875 1855 1876 1856 case VBOX_SHCL_GUEST_FN_REPORT_FEATURES:
Note:
See TracChangeset
for help on using the changeset viewer.