Changeset 85712 in vbox for trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp
- Timestamp:
- Aug 12, 2020 12:24:30 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp
r85587 r85712 685 685 AssertPtrReturn(pDataHdr, VERR_INVALID_POINTER); 686 686 687 Assert(pCtx->uProtocol >= 3); /* Only for protocol v3 and up. */687 Assert(pCtx->uProtocolDeprecated >= 3); /* Only for protocol v3 and up. */ 688 688 689 689 HGCMMsgHGSendDataHdr Msg; … … 1012 1012 Assert(pCtx->uClientID); 1013 1013 1014 /* Set the default protocol version we would like to use. */ 1015 pCtx->uProtocol = 3; 1014 /* Set the default protocol version we would like to use. 1015 * Deprecated since VBox 6.1.x, but let this set to 3 to (hopefully) not break things. */ 1016 pCtx->uProtocolDeprecated = 3; 1017 1018 pCtx->fHostFeatures = VBOX_DND_HF_NONE; 1019 pCtx->fGuestFeatures = VBOX_DND_GF_NONE; 1016 1020 1017 1021 /* … … 1030 1034 HGCMMsgConnect Msg; 1031 1035 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_DND_CONNECT, 3); 1032 /** @todo Context ID not used yet. */ 1033 Msg.u.v3.uContext.SetUInt32(0); 1034 Msg.u.v3.uProtocol.SetUInt32(pCtx->uProtocol); 1035 Msg.u.v3.uFlags.SetUInt32(0); /* Unused at the moment. */ 1036 Msg.u.v3.uContext.SetUInt32(0); /** @todo Context ID not used yet. */ 1037 Msg.u.v3.uProtocol.SetUInt32(pCtx->uProtocolDeprecated); /* Deprecated since VBox 6.1.x. */ 1038 Msg.u.v3.uFlags.SetUInt32(0); /* Unused at the moment. */ 1036 1039 1037 1040 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); … … 1039 1042 { 1040 1043 /* Set the protocol version we're going to use as told by the host. */ 1041 rc = Msg.u.v3.uProtocol.GetUInt32(&pCtx->uProtocol); AssertRC(rc); 1044 rc = Msg.u.v3.uProtocol.GetUInt32(&pCtx->uProtocolDeprecated); AssertRC(rc); 1045 1046 /* 1047 * Next is reporting our features. If this fails, assume older host. 1048 */ 1049 rc2 = VbglR3DnDReportFeatures(pCtx->uClientID, pCtx->fGuestFeatures, &pCtx->fHostFeatures); 1050 if (RT_SUCCESS(rc2)) 1051 { 1052 LogRel2(("DnD: Guest features: %#RX64 - Host features: %#RX64\n", 1053 pCtx->fGuestFeatures, pCtx->fHostFeatures)); 1054 } 1055 else /* Failing here is not fatal; might be running with an older host. */ 1056 { 1057 AssertLogRelMsg(rc2 == VERR_NOT_SUPPORTED || rc2 == VERR_NOT_IMPLEMENTED, 1058 ("Reporting features failed: %Rrc\n", rc2)); 1059 } 1042 1060 1043 1061 pCtx->cbMaxChunkSize = DND_DEFAULT_CHUNK_SIZE; /** @todo Use a scratch buffer on the heap? */ 1044 1062 } 1045 1063 else 1046 pCtx->uProtocol = 0; /* We're using protocol v0 (initial draft) as a fallback. */ 1047 1048 /** @todo Implement protocol feature flags. */ 1049 1050 LogFlowFunc(("uClient=%RU32, uProtocol=%RU32, rc=%Rrc\n", pCtx->uClientID, pCtx->uProtocol, rc)); 1064 pCtx->uProtocolDeprecated = 0; /* We're using protocol v0 (initial draft) as a fallback. */ 1065 1066 LogFlowFunc(("uClient=%RU32, uProtocol=%RU32, rc=%Rrc\n", pCtx->uClientID, pCtx->uProtocolDeprecated, rc)); 1051 1067 return rc; 1052 1068 } … … 1066 1082 pCtx->uClientID = 0; 1067 1083 return rc; 1084 } 1085 1086 /** 1087 * Reports features to the host and retrieve host feature set. 1088 * 1089 * @returns VBox status code. 1090 * @param idClient The client ID returned by VbglR3DnDConnect(). 1091 * @param fGuestFeatures Features to report, VBOX_DND_GF_XXX. 1092 * @param pfHostFeatures Where to store the features VBOX_DND_HF_XXX. 1093 */ 1094 VBGLR3DECL(int) VbglR3DnDReportFeatures(uint32_t idClient, uint64_t fGuestFeatures, uint64_t *pfHostFeatures) 1095 { 1096 int rc; 1097 do 1098 { 1099 struct 1100 { 1101 VBGLIOCHGCMCALL Hdr; 1102 HGCMFunctionParameter f64Features0; 1103 HGCMFunctionParameter f64Features1; 1104 } Msg; 1105 VBGL_HGCM_HDR_INIT(&Msg.Hdr, idClient, GUEST_DND_REPORT_FEATURES, 2); 1106 VbglHGCMParmUInt64Set(&Msg.f64Features0, fGuestFeatures); 1107 VbglHGCMParmUInt64Set(&Msg.f64Features1, VBOX_DND_GF_1_MUST_BE_ONE); 1108 1109 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg)); 1110 if (RT_SUCCESS(rc)) 1111 { 1112 Assert(Msg.f64Features0.type == VMMDevHGCMParmType_64bit); 1113 Assert(Msg.f64Features1.type == VMMDevHGCMParmType_64bit); 1114 if (Msg.f64Features1.u.value64 & VBOX_DND_GF_1_MUST_BE_ONE) 1115 rc = VERR_NOT_SUPPORTED; 1116 else if (pfHostFeatures) 1117 *pfHostFeatures = Msg.f64Features0.u.value64; 1118 break; 1119 } 1120 } while (rc == VERR_INTERRUPTED); 1121 return rc; 1122 1068 1123 } 1069 1124
Note:
See TracChangeset
for help on using the changeset viewer.