- Timestamp:
- Oct 15, 2015 8:31:46 AM (9 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp
r58212 r58257 120 120 Msg.hdr.u32ClientID = pCtx->uClientID; 121 121 Msg.hdr.u32Function = uMsg; 122 Msg.hdr.cParms = 7; 123 124 Msg.uScreenId.SetUInt32(0); 125 Msg.uX.SetUInt32(0); 126 Msg.uY.SetUInt32(0); 127 Msg.uDefAction.SetUInt32(0); 128 Msg.uAllActions.SetUInt32(0); 129 Msg.pvFormats.SetPtr(pszFormats, cbFormats); 130 Msg.cFormats.SetUInt32(0); 122 123 if (pCtx->uProtocol < 3) 124 { 125 Msg.hdr.cParms = 7; 126 127 Msg.u.v1.uScreenId.SetUInt32(0); 128 Msg.u.v1.uX.SetUInt32(0); 129 Msg.u.v1.uY.SetUInt32(0); 130 Msg.u.v1.uDefAction.SetUInt32(0); 131 Msg.u.v1.uAllActions.SetUInt32(0); 132 Msg.u.v1.pvFormats.SetPtr(pszFormats, cbFormats); 133 Msg.u.v1.cFormats.SetUInt32(0); 134 } 135 else 136 { 137 Msg.hdr.cParms = 8; 138 139 Msg.u.v3.uContext.SetUInt32(0); 140 Msg.u.v3.uScreenId.SetUInt32(0); 141 Msg.u.v3.uX.SetUInt32(0); 142 Msg.u.v3.uY.SetUInt32(0); 143 Msg.u.v3.uDefAction.SetUInt32(0); 144 Msg.u.v3.uAllActions.SetUInt32(0); 145 Msg.u.v3.pvFormats.SetPtr(pszFormats, cbFormats); 146 Msg.u.v3.cFormats.SetUInt32(0); 147 } 131 148 132 149 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 136 153 if (RT_SUCCESS(rc)) 137 154 { 138 rc = Msg.uScreenId.GetUInt32(puScreenId); AssertRC(rc); 139 rc = Msg.uX.GetUInt32(puX); AssertRC(rc); 140 rc = Msg.uY.GetUInt32(puY); AssertRC(rc); 141 rc = Msg.uDefAction.GetUInt32(puDefAction); AssertRC(rc); 142 rc = Msg.uAllActions.GetUInt32(puAllActions); AssertRC(rc); 143 rc = Msg.cFormats.GetUInt32(pcbFormatsRecv); AssertRC(rc); 155 if (pCtx->uProtocol < 3) 156 { 157 rc = Msg.u.v1.uScreenId.GetUInt32(puScreenId); AssertRC(rc); 158 rc = Msg.u.v1.uX.GetUInt32(puX); AssertRC(rc); 159 rc = Msg.u.v1.uY.GetUInt32(puY); AssertRC(rc); 160 rc = Msg.u.v1.uDefAction.GetUInt32(puDefAction); AssertRC(rc); 161 rc = Msg.u.v1.uAllActions.GetUInt32(puAllActions); AssertRC(rc); 162 rc = Msg.u.v1.cFormats.GetUInt32(pcbFormatsRecv); AssertRC(rc); 163 } 164 else 165 { 166 /** @todo Context ID not used yet. */ 167 rc = Msg.u.v3.uScreenId.GetUInt32(puScreenId); AssertRC(rc); 168 rc = Msg.u.v3.uX.GetUInt32(puX); AssertRC(rc); 169 rc = Msg.u.v3.uY.GetUInt32(puY); AssertRC(rc); 170 rc = Msg.u.v3.uDefAction.GetUInt32(puDefAction); AssertRC(rc); 171 rc = Msg.u.v3.uAllActions.GetUInt32(puAllActions); AssertRC(rc); 172 rc = Msg.u.v3.cFormats.GetUInt32(pcbFormatsRecv); AssertRC(rc); 173 } 144 174 145 175 AssertReturn(cbFormats >= *pcbFormatsRecv, VERR_TOO_MUCH_DATA); … … 158 188 Msg.hdr.u32ClientID = pCtx->uClientID; 159 189 Msg.hdr.u32Function = HOST_DND_HG_EVT_LEAVE; 160 Msg.hdr.cParms = 0; 190 191 if (pCtx->uProtocol < 3) 192 { 193 Msg.hdr.cParms = 0; 194 } 195 else 196 { 197 Msg.hdr.cParms = 1; 198 199 /** @todo Context ID not used yet. */ 200 Msg.u.v3.uContext.SetUInt32(0); 201 } 161 202 162 203 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 176 217 Msg.hdr.u32ClientID = pCtx->uClientID; 177 218 Msg.hdr.u32Function = HOST_DND_HG_EVT_CANCEL; 178 Msg.hdr.cParms = 0; 219 220 if (pCtx->uProtocol < 3) 221 { 222 Msg.hdr.cParms = 0; 223 } 224 else 225 { 226 Msg.hdr.cParms = 1; 227 228 /** @todo Context ID not used yet. */ 229 Msg.u.v3.uContext.SetUInt32(0); 230 } 179 231 180 232 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 202 254 Msg.hdr.u32ClientID = pCtx->uClientID; 203 255 Msg.hdr.u32Function = HOST_DND_HG_SND_DIR; 204 Msg.hdr.cParms = 3; 205 206 Msg.pvName.SetPtr(pszDirname, cbDirname); 207 Msg.cbName.SetUInt32(cbDirname); 208 Msg.fMode.SetUInt32(0); 256 257 if (pCtx->uProtocol < 3) 258 { 259 Msg.hdr.cParms = 3; 260 261 Msg.u.v1.pvName.SetPtr(pszDirname, cbDirname); 262 Msg.u.v1.cbName.SetUInt32(cbDirname); 263 Msg.u.v1.fMode.SetUInt32(0); 264 } 265 else 266 { 267 Msg.hdr.cParms = 4; 268 269 /** @todo Context ID not used yet. */ 270 Msg.u.v3.uContext.SetUInt32(0); 271 Msg.u.v3.pvName.SetPtr(pszDirname, cbDirname); 272 Msg.u.v3.cbName.SetUInt32(cbDirname); 273 Msg.u.v3.fMode.SetUInt32(0); 274 } 209 275 210 276 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 214 280 if (RT_SUCCESS(Msg.hdr.result)) 215 281 { 216 rc = Msg.cbName.GetUInt32(pcbDirnameRecv); AssertRC(rc); 217 rc = Msg.fMode.GetUInt32(pfMode); AssertRC(rc); 282 if (pCtx->uProtocol < 3) 283 { 284 rc = Msg.u.v1.cbName.GetUInt32(pcbDirnameRecv); AssertRC(rc); 285 rc = Msg.u.v1.fMode.GetUInt32(pfMode); AssertRC(rc); 286 } 287 else 288 { 289 /** @todo Context ID not used yet. */ 290 rc = Msg.u.v3.cbName.GetUInt32(pcbDirnameRecv); AssertRC(rc); 291 rc = Msg.u.v3.fMode.GetUInt32(pfMode); AssertRC(rc); 292 } 218 293 219 294 AssertReturn(cbDirname >= *pcbDirnameRecv, VERR_TOO_MUCH_DATA); … … 343 418 else 344 419 { 420 Msg.hdr.cParms = 6; 421 345 422 Msg.uContext.SetUInt32(0); /** @todo Not used yet. */ 346 423 Msg.pvName.SetPtr(pszFilename, cbFilename); … … 349 426 Msg.fMode.SetUInt32(0); 350 427 Msg.cbTotal.SetUInt64(0); 351 352 Msg.hdr.cParms = 6;353 428 354 429 rc = VINF_SUCCESS; … … 1084 1159 Msg.hdr.u32ClientID = pCtx->uClientID; 1085 1160 Msg.hdr.u32Function = HOST_DND_GH_REQ_PENDING; 1086 Msg.hdr.cParms = 1; 1087 1088 Msg.uScreenId.SetUInt32(0); 1161 1162 if (pCtx->uProtocol < 3) 1163 { 1164 Msg.hdr.cParms = 1; 1165 1166 Msg.u.v1.uScreenId.SetUInt32(0); 1167 } 1168 else 1169 { 1170 Msg.hdr.cParms = 2; 1171 1172 /** @todo Context ID not used yet. */ 1173 Msg.u.v3.uContext.SetUInt32(0); 1174 Msg.u.v3.uScreenId.SetUInt32(0); 1175 } 1089 1176 1090 1177 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1094 1181 if (RT_SUCCESS(rc)) 1095 1182 { 1096 rc = Msg.uScreenId.GetUInt32(puScreenId); AssertRC(rc); 1183 if (pCtx->uProtocol < 3) 1184 { 1185 rc = Msg.u.v1.uScreenId.GetUInt32(puScreenId); AssertRC(rc); 1186 } 1187 else 1188 { 1189 /** @todo Context ID not used yet. */ 1190 rc = Msg.u.v3.uContext.GetUInt32(puScreenId); AssertRC(rc); 1191 } 1097 1192 } 1098 1193 } … … 1118 1213 Msg.hdr.u32ClientID = pCtx->uClientID; 1119 1214 Msg.hdr.u32Function = HOST_DND_GH_EVT_DROPPED; 1120 Msg.hdr.cParms = 3; 1121 1122 Msg.pvFormat.SetPtr(pszFormat, cbFormat); 1123 Msg.cbFormat.SetUInt32(0); 1124 Msg.uAction.SetUInt32(0); 1215 1216 if (pCtx->uProtocol < 3) 1217 { 1218 Msg.hdr.cParms = 3; 1219 1220 Msg.u.v1.pvFormat.SetPtr(pszFormat, cbFormat); 1221 Msg.u.v1.cbFormat.SetUInt32(0); 1222 Msg.u.v1.uAction.SetUInt32(0); 1223 } 1224 else 1225 { 1226 Msg.hdr.cParms = 4; 1227 1228 Msg.u.v3.uContext.SetUInt32(0); 1229 Msg.u.v3.pvFormat.SetPtr(pszFormat, cbFormat); 1230 Msg.u.v3.cbFormat.SetUInt32(0); 1231 Msg.u.v3.uAction.SetUInt32(0); 1232 } 1125 1233 1126 1234 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1130 1238 if (RT_SUCCESS(rc)) 1131 1239 { 1132 rc = Msg.cbFormat.GetUInt32(pcbFormatRecv); AssertRC(rc); 1133 rc = Msg.uAction.GetUInt32(puAction); AssertRC(rc); 1240 if (pCtx->uProtocol < 3) 1241 { 1242 rc = Msg.u.v1.cbFormat.GetUInt32(pcbFormatRecv); AssertRC(rc); 1243 rc = Msg.u.v1.uAction.GetUInt32(puAction); AssertRC(rc); 1244 } 1245 else 1246 { 1247 /** @todo Context ID not used yet. */ 1248 rc = Msg.u.v3.cbFormat.GetUInt32(pcbFormatRecv); AssertRC(rc); 1249 rc = Msg.u.v3.uAction.GetUInt32(puAction); AssertRC(rc); 1250 } 1134 1251 1135 1252 AssertReturn(cbFormat >= *pcbFormatRecv, VERR_TOO_MUCH_DATA); … … 1216 1333 Msg.hdr.u32ClientID = pCtx->uClientID; 1217 1334 Msg.hdr.u32Function = GUEST_DND_CONNECT; 1218 Msg.hdr.cParms = 2; 1219 1220 Msg.uProtocol.SetUInt32(pCtx->uProtocol); 1221 Msg.uFlags.SetUInt32(0); /* Unused at the moment. */ 1335 1336 if (pCtx->uProtocol < 3) 1337 { 1338 Msg.hdr.cParms = 2; 1339 1340 Msg.u.v2.uProtocol.SetUInt32(pCtx->uProtocol); 1341 Msg.u.v2.uFlags.SetUInt32(0); /* Unused at the moment. */ 1342 } 1343 else 1344 { 1345 Msg.hdr.cParms = 3; 1346 1347 /** @todo Context ID not used yet. */ 1348 Msg.u.v3.uContext.SetUInt32(0); 1349 Msg.u.v3.uProtocol.SetUInt32(pCtx->uProtocol); 1350 Msg.u.v3.uFlags.SetUInt32(0); /* Unused at the moment. */ 1351 } 1222 1352 1223 1353 int rc2 = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1375 1505 Msg.hdr.u32ClientID = pCtx->uClientID; 1376 1506 Msg.hdr.u32Function = GUEST_DND_HG_ACK_OP; 1377 Msg.hdr.cParms = 1; 1378 1379 Msg.uAction.SetUInt32(uAction); 1507 1508 if (pCtx->uProtocol < 3) 1509 { 1510 Msg.hdr.cParms = 1; 1511 1512 Msg.u.v1.uAction.SetUInt32(uAction); 1513 } 1514 else 1515 { 1516 Msg.hdr.cParms = 2; 1517 1518 /** @todo Context ID not used yet. */ 1519 Msg.u.v3.uContext.SetUInt32(0); 1520 Msg.u.v3.uAction.SetUInt32(uAction); 1521 } 1380 1522 1381 1523 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1396 1538 Msg.hdr.u32ClientID = pCtx->uClientID; 1397 1539 Msg.hdr.u32Function = GUEST_DND_HG_REQ_DATA; 1398 Msg.hdr.cParms = 1; 1399 1400 Msg.pFormat.SetPtr((void*)pcszFormat, strlen(pcszFormat) + 1 /* Include termination */); 1540 1541 if (!RTStrIsValidEncoding(pcszFormat)) 1542 return VERR_INVALID_PARAMETER; 1543 1544 const uint32_t cbFormat = (uint32_t)strlen(pcszFormat) + 1; /* Include termination */ 1545 1546 if (pCtx->uProtocol < 3) 1547 { 1548 Msg.hdr.cParms = 1; 1549 1550 Msg.u.v1.pvFormat.SetPtr((void*)pcszFormat, cbFormat); 1551 } 1552 else 1553 { 1554 Msg.hdr.cParms = 3; 1555 1556 /** @todo Context ID not used yet. */ 1557 Msg.u.v3.uContext.SetUInt32(0); 1558 Msg.u.v3.pvFormat.SetPtr((void*)pcszFormat, cbFormat); 1559 Msg.u.v3.cbFormat.SetUInt32(cbFormat); 1560 } 1401 1561 1402 1562 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1417 1577 Msg.hdr.u32ClientID = pCtx->uClientID; 1418 1578 Msg.hdr.u32Function = uStatus; 1419 Msg.hdr.cParms = 3; 1420 1421 Msg.uStatus.SetUInt32(uStatus); 1422 Msg.uPercent.SetUInt32(uPercent); 1423 Msg.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */ 1579 1580 if (pCtx->uProtocol < 3) 1581 { 1582 Msg.hdr.cParms = 3; 1583 1584 Msg.u.v1.uStatus.SetUInt32(uStatus); 1585 Msg.u.v1.uPercent.SetUInt32(uPercent); 1586 Msg.u.v1.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */ 1587 } 1588 else 1589 { 1590 Msg.hdr.cParms = 4; 1591 1592 /** @todo Context ID not used yet. */ 1593 Msg.u.v3.uContext.SetUInt32(0); 1594 Msg.u.v3.uStatus.SetUInt32(uStatus); 1595 Msg.u.v3.uPercent.SetUInt32(uPercent); 1596 Msg.u.v3.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */ 1597 } 1424 1598 1425 1599 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1437 1611 AssertPtrReturn(pcszFormats, VERR_INVALID_POINTER); 1438 1612 AssertReturn(cbFormats, VERR_INVALID_PARAMETER); 1613 1614 if (!RTStrIsValidEncoding(pcszFormats)) 1615 return VERR_INVALID_PARAMETER; 1439 1616 1440 1617 VBOXDNDGHACKPENDINGMSG Msg; … … 1443 1620 Msg.hdr.u32ClientID = pCtx->uClientID; 1444 1621 Msg.hdr.u32Function = GUEST_DND_GH_ACK_PENDING; 1445 Msg.hdr.cParms = 3; 1446 1447 Msg.uDefAction.SetUInt32(uDefAction); 1448 Msg.uAllActions.SetUInt32(uAllActions); 1449 Msg.pFormat.SetPtr((void*)pcszFormats, cbFormats); 1622 1623 if (pCtx->uProtocol < 3) 1624 { 1625 Msg.hdr.cParms = 3; 1626 1627 Msg.u.v1.uDefAction.SetUInt32(uDefAction); 1628 Msg.u.v1.uAllActions.SetUInt32(uAllActions); 1629 Msg.u.v1.pvFormats.SetPtr((void*)pcszFormats, cbFormats); 1630 } 1631 else 1632 { 1633 Msg.hdr.cParms = 5; 1634 1635 /** @todo Context ID not used yet. */ 1636 Msg.u.v3.uContext.SetUInt32(0); 1637 Msg.u.v3.uDefAction.SetUInt32(uDefAction); 1638 Msg.u.v3.uAllActions.SetUInt32(uAllActions); 1639 Msg.u.v3.pvFormats.SetPtr((void*)pcszFormats, cbFormats); 1640 Msg.u.v3.cbFormats.SetUInt32(cbFormats); 1641 } 1450 1642 1451 1643 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1563 1755 AssertReturn(pObj->GetType() == DnDURIObject::Directory, VERR_INVALID_PARAMETER); 1564 1756 1757 RTCString strPath = pObj->GetDestPath(); 1758 LogFlowFunc(("strDir=%s (%zu), fMode=0x%x\n", 1759 strPath.c_str(), strPath.length(), pObj->GetMode())); 1760 1761 const uint32_t cbPath = strPath.length() + 1; /* Include termination. */ 1762 1565 1763 VBOXDNDGHSENDDIRMSG Msg; 1566 1764 RT_ZERO(Msg); … … 1568 1766 Msg.hdr.u32ClientID = pCtx->uClientID; 1569 1767 Msg.hdr.u32Function = GUEST_DND_GH_SND_DIR; 1570 Msg.hdr.cParms = 3; 1571 1572 RTCString strPath = pObj->GetDestPath(); 1573 LogFlowFunc(("strDir=%s (%zu), fMode=0x%x\n", 1574 strPath.c_str(), strPath.length(), pObj->GetMode())); 1575 1576 Msg.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)(strPath.length() + 1)); 1577 Msg.cbName.SetUInt32((uint32_t)(strPath.length() + 1)); 1578 Msg.fMode.SetUInt32(pObj->GetMode()); 1768 1769 if (pCtx->uProtocol < 3) 1770 { 1771 Msg.hdr.cParms = 3; 1772 1773 Msg.u.v1.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)cbPath); 1774 Msg.u.v1.cbName.SetUInt32((uint32_t)cbPath); 1775 Msg.u.v1.fMode.SetUInt32(pObj->GetMode()); 1776 } 1777 else 1778 { 1779 Msg.hdr.cParms = 4; 1780 1781 /** @todo Context ID not used yet. */ 1782 Msg.u.v3.uContext.SetUInt32(0); 1783 Msg.u.v3.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)cbPath); 1784 Msg.u.v3.cbName.SetUInt32((uint32_t)cbPath); 1785 Msg.u.v3.fMode.SetUInt32(pObj->GetMode()); 1786 } 1579 1787 1580 1788 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 1869 2077 Msg.hdr.u32ClientID = pCtx->uClientID; 1870 2078 Msg.hdr.u32Function = GUEST_DND_GH_EVT_ERROR; 1871 Msg.hdr.cParms = 1; 1872 1873 Msg.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */ 2079 2080 if (pCtx->uProtocol < 3) 2081 { 2082 Msg.hdr.cParms = 1; 2083 2084 Msg.u.v1.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */ 2085 } 2086 else 2087 { 2088 Msg.hdr.cParms = 2; 2089 2090 /** @todo Context ID not used yet. */ 2091 Msg.u.v3.uContext.SetUInt32(0); 2092 Msg.u.v3.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */ 2093 } 1874 2094 1875 2095 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); -
trunk/src/VBox/HostServices/DragAndDrop/service.cpp
r58231 r58257 347 347 { 348 348 VBOXDNDCBHGGETNEXTHOSTMSG data; 349 data.hdr.u32Magic = CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG; 349 RT_ZERO(data); 350 data.hdr.uMagic = CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG; 350 351 rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data)); 351 352 if (RT_SUCCESS(rc)) … … 380 381 { 381 382 LogFlowFunc(("GUEST_DND_CONNECT\n")); 382 if (cParms == 2) 383 { 383 if (cParms >= 2) 384 { 385 const uint8_t idxProto = cParms >= 3 ? 1 : 0; 386 384 387 VBOXDNDCBCONNECTMSGDATA data; 385 data.hdr.u32Magic = CB_MAGIC_DND_CONNECT; 386 rc = paParms[0].getUInt32(&data.uProtocol); 387 if (RT_SUCCESS(rc)) 388 rc = paParms[1].getUInt32(&data.uFlags); 388 RT_ZERO(data); 389 data.hdr.uMagic = CB_MAGIC_DND_CONNECT; 390 if (cParms >= 3) 391 rc = paParms[0].getUInt32(&data.hdr.uContextID); 392 if (RT_SUCCESS(rc)) 393 rc = paParms[idxProto].getUInt32(&data.uProtocol); 394 if (RT_SUCCESS(rc)) 395 rc = paParms[idxProto + 1].getUInt32(&data.uFlags); 389 396 if (RT_SUCCESS(rc)) 390 397 rc = pClient->setProtocol(data.uProtocol); … … 400 407 { 401 408 LogFlowFunc(("GUEST_DND_HG_ACK_OP\n")); 402 if (cParms == 1) 403 { 404 VBOXDNDCBHGACKOPDATA data; 405 data.hdr.u32Magic = CB_MAGIC_DND_HG_ACK_OP; 406 rc = paParms[0].getUInt32(&data.uAction); /* Get drop action. */ 407 DO_HOST_CALLBACK(); 408 } 409 410 VBOXDNDCBHGACKOPDATA data; 411 RT_ZERO(data); 412 data.hdr.uMagic = CB_MAGIC_DND_HG_ACK_OP; 413 414 switch (pClient->protocol()) 415 { 416 case 3: 417 { 418 if (cParms == 2) 419 { 420 rc = paParms[0].getUInt32(&data.hdr.uContextID); 421 if (RT_SUCCESS(rc)) 422 rc = paParms[1].getUInt32(&data.uAction); /* Get drop action. */ 423 } 424 break; 425 } 426 427 case 2: 428 default: 429 { 430 if (cParms == 1) 431 rc = paParms[0].getUInt32(&data.uAction); /* Get drop action. */ 432 break; 433 } 434 } 435 436 DO_HOST_CALLBACK(); 409 437 break; 410 438 } … … 412 440 { 413 441 LogFlowFunc(("GUEST_DND_HG_REQ_DATA\n")); 414 if (cParms == 1) 415 { 416 VBOXDNDCBHGREQDATADATA data; 417 data.hdr.u32Magic = CB_MAGIC_DND_HG_REQ_DATA; 418 rc = paParms[0].getPointer((void**)&data.pszFormat, &data.cbFormat); 419 DO_HOST_CALLBACK(); 420 } 442 443 VBOXDNDCBHGREQDATADATA data; 444 RT_ZERO(data); 445 data.hdr.uMagic = CB_MAGIC_DND_HG_REQ_DATA; 446 447 switch (pClient->protocol()) 448 { 449 case 3: 450 { 451 if (cParms == 3) 452 { 453 rc = paParms[0].getUInt32(&data.hdr.uContextID); 454 if (RT_SUCCESS(rc)) 455 rc = paParms[1].getPointer((void **)&data.pszFormat, &data.cbFormat); 456 if (RT_SUCCESS(rc)) 457 rc = paParms[2].getUInt32(&data.cbFormat); 458 } 459 break; 460 } 461 462 case 2: 463 default: 464 { 465 if (cParms == 1) 466 rc = paParms[0].getPointer((void**)&data.pszFormat, &data.cbFormat); 467 break; 468 } 469 } 470 471 DO_HOST_CALLBACK(); 421 472 break; 422 473 } … … 424 475 { 425 476 LogFlowFunc(("GUEST_DND_HG_EVT_PROGRESS\n")); 426 if (cParms == 3) 427 { 428 VBOXDNDCBHGEVTPROGRESSDATA data; 429 data.hdr.u32Magic = CB_MAGIC_DND_HG_EVT_PROGRESS; 430 rc = paParms[0].getUInt32(&data.uStatus); 431 if (RT_SUCCESS(rc)) 432 rc = paParms[1].getUInt32(&data.uPercentage); 433 if (RT_SUCCESS(rc)) 434 rc = paParms[2].getUInt32(&data.rc); 435 DO_HOST_CALLBACK(); 436 } 477 478 VBOXDNDCBHGEVTPROGRESSDATA data; 479 RT_ZERO(data); 480 data.hdr.uMagic = CB_MAGIC_DND_HG_EVT_PROGRESS; 481 482 switch (pClient->protocol()) 483 { 484 case 3: 485 { 486 if (cParms == 4) 487 { 488 rc = paParms[0].getUInt32(&data.uStatus); 489 if (RT_SUCCESS(rc)) 490 rc = paParms[1].getUInt32(&data.uStatus); 491 if (RT_SUCCESS(rc)) 492 rc = paParms[2].getUInt32(&data.uPercentage); 493 if (RT_SUCCESS(rc)) 494 rc = paParms[3].getUInt32(&data.rc); 495 } 496 break; 497 } 498 499 case 2: 500 default: 501 { 502 if (cParms == 3) 503 { 504 rc = paParms[0].getUInt32(&data.uStatus); 505 if (RT_SUCCESS(rc)) 506 rc = paParms[1].getUInt32(&data.uPercentage); 507 if (RT_SUCCESS(rc)) 508 rc = paParms[2].getUInt32(&data.rc); 509 } 510 break; 511 } 512 } 513 514 DO_HOST_CALLBACK(); 437 515 break; 438 516 } … … 441 519 { 442 520 LogFlowFunc(("GUEST_DND_GH_ACK_PENDING\n")); 443 if (cParms == 3) 444 { 445 VBOXDNDCBGHACKPENDINGDATA data; 446 data.hdr.u32Magic = CB_MAGIC_DND_GH_ACK_PENDING; 447 rc = paParms[0].getUInt32(&data.uDefAction); 448 if (RT_SUCCESS(rc)) 449 rc = paParms[1].getUInt32(&data.uAllActions); 450 if (RT_SUCCESS(rc)) 451 rc = paParms[2].getPointer((void**)&data.pszFormat, &data.cbFormat); 452 DO_HOST_CALLBACK(); 453 } 521 522 VBOXDNDCBGHACKPENDINGDATA data; 523 RT_ZERO(data); 524 data.hdr.uMagic = CB_MAGIC_DND_GH_ACK_PENDING; 525 526 switch (pClient->protocol()) 527 { 528 case 3: 529 { 530 if (cParms == 5) 531 { 532 rc = paParms[0].getUInt32(&data.hdr.uContextID); 533 if (RT_SUCCESS(rc)) 534 rc = paParms[1].getUInt32(&data.uDefAction); 535 if (RT_SUCCESS(rc)) 536 rc = paParms[2].getUInt32(&data.uAllActions); 537 if (RT_SUCCESS(rc)) 538 rc = paParms[3].getPointer((void**)&data.pszFormat, &data.cbFormat); 539 if (RT_SUCCESS(rc)) 540 rc = paParms[4].getUInt32(&data.cbFormat); 541 } 542 break; 543 } 544 545 case 2: 546 default: 547 { 548 if (cParms == 3) 549 { 550 rc = paParms[0].getUInt32(&data.uDefAction); 551 if (RT_SUCCESS(rc)) 552 rc = paParms[1].getUInt32(&data.uAllActions); 553 if (RT_SUCCESS(rc)) 554 rc = paParms[2].getPointer((void**)&data.pszFormat, &data.cbFormat); 555 } 556 break; 557 } 558 } 559 560 DO_HOST_CALLBACK(); 454 561 break; 455 562 } … … 461 568 { 462 569 VBOXDNDCBSNDDATAHDRDATA data; 463 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DATA_HDR; 464 rc = paParms[0].getUInt32(&data.hdr.u32ContextID); 570 RT_ZERO(data); 571 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DATA_HDR; 572 rc = paParms[0].getUInt32(&data.hdr.uContextID); 465 573 if (RT_SUCCESS(rc)) 466 574 rc = paParms[1].getUInt32(&data.data.uFlags); … … 502 610 { 503 611 VBOXDNDCBSNDDATADATA data; 504 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DATA; 505 rc = paParms[0].getUInt32(&data.hdr.u32ContextID); 612 RT_ZERO(data); 613 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DATA; 614 rc = paParms[0].getUInt32(&data.hdr.uContextID); 506 615 if (RT_SUCCESS(rc)) 507 616 rc = paParms[1].getPointer((void**)&data.data.u.v3.pvData, &data.data.u.v3.cbData); … … 523 632 { 524 633 VBOXDNDCBSNDDATADATA data; 525 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DATA; 634 RT_ZERO(data); 635 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DATA; 526 636 rc = paParms[0].getPointer((void**)&data.data.u.v1.pvData, &data.data.u.v1.cbData); 527 637 if (RT_SUCCESS(rc)) … … 537 647 { 538 648 LogFlowFunc(("GUEST_DND_GH_SND_DIR\n")); 539 if (cParms == 3) 540 { 541 VBOXDNDCBSNDDIRDATA data; 542 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_DIR; 543 uint32_t cTmp; 544 rc = paParms[0].getPointer((void**)&data.pszPath, &cTmp); 545 if (RT_SUCCESS(rc)) 546 rc = paParms[1].getUInt32(&data.cbPath); 547 if (RT_SUCCESS(rc)) 548 rc = paParms[2].getUInt32(&data.fMode); 549 550 LogFlowFunc(("pszPath=%s, cbPath=%RU32, fMode=0x%x\n", data.pszPath, data.cbPath, data.fMode)); 551 DO_HOST_CALLBACK(); 552 } 649 650 VBOXDNDCBSNDDIRDATA data; 651 RT_ZERO(data); 652 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_DIR; 653 654 switch (pClient->protocol()) 655 { 656 case 3: 657 { 658 if (cParms == 4) 659 { 660 rc = paParms[0].getUInt32(&data.hdr.uContextID); 661 if (RT_SUCCESS(rc)) 662 rc = paParms[0].getPointer((void**)&data.pszPath, &data.cbPath); 663 if (RT_SUCCESS(rc)) 664 rc = paParms[1].getUInt32(&data.cbPath); 665 if (RT_SUCCESS(rc)) 666 rc = paParms[2].getUInt32(&data.fMode); 667 } 668 break; 669 } 670 671 case 2: 672 default: 673 { 674 if (cParms == 3) 675 { 676 rc = paParms[0].getPointer((void**)&data.pszPath, &data.cbPath); 677 if (RT_SUCCESS(rc)) 678 rc = paParms[1].getUInt32(&data.cbPath); 679 if (RT_SUCCESS(rc)) 680 rc = paParms[2].getUInt32(&data.fMode); 681 } 682 break; 683 } 684 } 685 686 DO_HOST_CALLBACK(); 553 687 break; 554 688 } … … 560 694 { 561 695 VBOXDNDCBSNDFILEHDRDATA data; 562 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_HDR; 563 uint32_t cTmp; 564 /* paParms[0] is context ID; unused yet. */ 565 rc = paParms[1].getPointer((void**)&data.pszFilePath, &cTmp); 696 RT_ZERO(data); 697 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_HDR; 698 699 rc = paParms[0].getUInt32(&data.hdr.uContextID); 700 if (RT_SUCCESS(rc)) 701 rc = paParms[1].getPointer((void**)&data.pszFilePath, &data.cbFilePath); 566 702 if (RT_SUCCESS(rc)) 567 703 rc = paParms[2].getUInt32(&data.cbFilePath); … … 591 727 { 592 728 VBOXDNDCBSNDFILEDATADATA data; 593 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_DATA; 594 rc = paParms[0].getUInt32(&data.hdr.u32ContextID); 729 RT_ZERO(data); 730 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_DATA; 731 732 rc = paParms[0].getUInt32(&data.hdr.uContextID); 595 733 if (RT_SUCCESS(rc)) 596 734 rc = paParms[1].getPointer((void**)&data.pvData, &data.cbData); … … 613 751 { 614 752 VBOXDNDCBSNDFILEDATADATA data; 615 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_DATA; 616 rc = paParms[0].getUInt32(&data.hdr.u32ContextID); 753 RT_ZERO(data); 754 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_DATA; 755 rc = paParms[0].getUInt32(&data.hdr.uContextID); 617 756 if (RT_SUCCESS(rc)) 618 757 rc = paParms[1].getPointer((void**)&data.pvData, &data.cbData); … … 631 770 { 632 771 VBOXDNDCBSNDFILEDATADATA data; 633 data.hdr.u32Magic = CB_MAGIC_DND_GH_SND_FILE_DATA; 772 RT_ZERO(data); 773 data.hdr.uMagic = CB_MAGIC_DND_GH_SND_FILE_DATA; 634 774 uint32_t cTmp; 635 775 rc = paParms[0].getPointer((void**)&data.u.v1.pszFilePath, &cTmp); … … 655 795 { 656 796 LogFlowFunc(("GUEST_DND_GH_EVT_ERROR\n")); 657 if (cParms == 1) 658 { 659 VBOXDNDCBEVTERRORDATA data; 660 data.hdr.u32Magic = CB_MAGIC_DND_GH_EVT_ERROR; 661 662 uint32_t rcOp; 663 rc = paParms[0].getUInt32(&rcOp); 664 if (RT_SUCCESS(rc)) 665 data.rc = rcOp; 666 667 DO_HOST_CALLBACK(); 668 } 797 798 VBOXDNDCBEVTERRORDATA data; 799 RT_ZERO(data); 800 data.hdr.uMagic = CB_MAGIC_DND_GH_EVT_ERROR; 801 802 switch (pClient->protocol()) 803 { 804 case 3: 805 { 806 if (cParms == 2) 807 { 808 rc = paParms[0].getUInt32(&data.hdr.uContextID); 809 if (RT_SUCCESS(rc)) 810 { 811 uint32_t rcOp; 812 rc = paParms[1].getUInt32(&rcOp); 813 if (RT_SUCCESS(rc)) 814 data.rc = rcOp; 815 } 816 } 817 break; 818 } 819 820 case 2: 821 default: 822 { 823 if (cParms == 1) 824 { 825 uint32_t rcOp; 826 rc = paParms[0].getUInt32(&rcOp); 827 if (RT_SUCCESS(rc)) 828 data.rc = (int32_t)rcOp; 829 } 830 break; 831 } 832 } 833 834 DO_HOST_CALLBACK(); 669 835 break; 670 836 } … … 679 845 { 680 846 VBOXDNDCBHGGETNEXTHOSTMSGDATA data; 681 data.hdr.u32Magic = VBOX_DND_CB_MAGIC_MAKE(0 /* uFn */, 0 /* uVer */); 847 RT_ZERO(data); 848 data.hdr.uMagic = VBOX_DND_CB_MAGIC_MAKE(0 /* uFn */, 0 /* uVer */); 682 849 data.uMsg = u32Function; 683 850 data.cParms = cParms; … … 831 998 832 999 VBOXDNDCBHGEVTPROGRESSDATA data; 833 data.hdr.u 32Magic = CB_MAGIC_DND_HG_EVT_PROGRESS;1000 data.hdr.uMagic = CB_MAGIC_DND_HG_EVT_PROGRESS; 834 1001 data.uPercentage = RT_MIN(uPercentage, 100); 835 1002 data.uStatus = uStatus; -
trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
r58232 r58257 374 374 AssertPtr(pCBData); 375 375 AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGACKOPDATA) == cbParms, VERR_INVALID_PARAMETER); 376 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);376 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 377 377 378 378 setDefAction(pCBData->uAction); … … 386 386 AssertPtr(pCBData); 387 387 AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGREQDATADATA) == cbParms, VERR_INVALID_PARAMETER); 388 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);388 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 389 389 390 390 if ( pCBData->cbFormat == 0 … … 416 416 AssertPtr(pCBData); 417 417 AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGEVTPROGRESSDATA) == cbParms, VERR_INVALID_PARAMETER); 418 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);418 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 419 419 420 420 rc = setProgress(pCBData->uPercentage, pCBData->uStatus, pCBData->rc); … … 430 430 AssertPtr(pCBData); 431 431 AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBGHACKPENDINGDATA) == cbParms, VERR_INVALID_PARAMETER); 432 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);432 AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 433 433 434 434 if ( pCBData->cbFormat == 0 -
trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
r58212 r58257 253 253 GuestDnDMsg Msg; 254 254 Msg.setType(HOST_DND_GH_REQ_PENDING); 255 if (mDataBase.m_uProtocolVersion >= 3) 256 Msg.setNextUInt32(0); /** @todo ContextID not used yet. */ 255 257 Msg.setNextUInt32(uScreenId); 256 258 … … 1036 1038 GuestDnDMsg Msg; 1037 1039 Msg.setType(HOST_DND_GH_EVT_DROPPED); 1040 if (mDataBase.m_uProtocolVersion >= 3) 1041 Msg.setNextUInt32(0); /** @todo ContextID not used yet. */ 1038 1042 Msg.setNextPointer((void*)pCtx->mFmtRecv.c_str(), (uint32_t)pCtx->mFmtRecv.length() + 1); 1039 1043 Msg.setNextUInt32((uint32_t)pCtx->mFmtRecv.length() + 1); … … 1135 1139 GuestDnDMsg Msg; 1136 1140 Msg.setType(HOST_DND_GH_EVT_DROPPED); 1141 if (mDataBase.m_uProtocolVersion >= 3) 1142 Msg.setNextUInt32(0); /** @todo ContextID not used yet. */ 1137 1143 Msg.setNextPointer((void*)pCtx->mFmtRecv.c_str(), (uint32_t)pCtx->mFmtRecv.length() + 1); 1138 1144 Msg.setNextUInt32((uint32_t)pCtx->mFmtRecv.length() + 1); … … 1224 1230 AssertPtr(pCBData); 1225 1231 AssertReturn(sizeof(VBOXDNDCBSNDDATAHDRDATA) == cbParms, VERR_INVALID_PARAMETER); 1226 AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1232 AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1227 1233 1228 1234 rc = pThis->i_onReceiveDataHdr(pCtx, &pCBData->data); … … 1234 1240 AssertPtr(pCBData); 1235 1241 AssertReturn(sizeof(VBOXDNDCBSNDDATADATA) == cbParms, VERR_INVALID_PARAMETER); 1236 AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1242 AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1237 1243 1238 1244 rc = pThis->i_onReceiveData(pCtx, &pCBData->data); … … 1244 1250 AssertPtr(pCBData); 1245 1251 AssertReturn(sizeof(VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER); 1246 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1252 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1247 1253 1248 1254 pCtx->mpResp->reset(); … … 1297 1303 AssertPtr(pCBData); 1298 1304 AssertReturn(sizeof(VBOXDNDCBSNDDATAHDRDATA) == cbParms, VERR_INVALID_PARAMETER); 1299 AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1305 AssertReturn(CB_MAGIC_DND_GH_SND_DATA_HDR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1300 1306 1301 1307 rc = pThis->i_onReceiveDataHdr(pCtx, &pCBData->data); … … 1307 1313 AssertPtr(pCBData); 1308 1314 AssertReturn(sizeof(VBOXDNDCBSNDDATADATA) == cbParms, VERR_INVALID_PARAMETER); 1309 AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1315 AssertReturn(CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1310 1316 1311 1317 rc = pThis->i_onReceiveData(pCtx, &pCBData->data); … … 1317 1323 AssertPtr(pCBData); 1318 1324 AssertReturn(sizeof(VBOXDNDCBSNDDIRDATA) == cbParms, VERR_INVALID_PARAMETER); 1319 AssertReturn(CB_MAGIC_DND_GH_SND_DIR == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1325 AssertReturn(CB_MAGIC_DND_GH_SND_DIR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1320 1326 1321 1327 rc = pThis->i_onReceiveDir(pCtx, pCBData->pszPath, pCBData->cbPath, pCBData->fMode); … … 1327 1333 AssertPtr(pCBData); 1328 1334 AssertReturn(sizeof(VBOXDNDCBSNDFILEHDRDATA) == cbParms, VERR_INVALID_PARAMETER); 1329 AssertReturn(CB_MAGIC_DND_GH_SND_FILE_HDR == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1335 AssertReturn(CB_MAGIC_DND_GH_SND_FILE_HDR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1330 1336 1331 1337 rc = pThis->i_onReceiveFileHdr(pCtx, pCBData->pszFilePath, pCBData->cbFilePath, … … 1338 1344 AssertPtr(pCBData); 1339 1345 AssertReturn(sizeof(VBOXDNDCBSNDFILEDATADATA) == cbParms, VERR_INVALID_PARAMETER); 1340 AssertReturn(CB_MAGIC_DND_GH_SND_FILE_DATA == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1346 AssertReturn(CB_MAGIC_DND_GH_SND_FILE_DATA == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1341 1347 1342 1348 if (pThis->mDataBase.m_uProtocolVersion <= 1) … … 1363 1369 AssertPtr(pCBData); 1364 1370 AssertReturn(sizeof(VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER); 1365 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1371 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1366 1372 1367 1373 pCtx->mpResp->reset(); -
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r58231 r58257 303 303 GuestDnDMsg Msg; 304 304 Msg.setType(HOST_DND_HG_EVT_ENTER); 305 if (mDataBase.m_uProtocolVersion >= 3) 306 Msg.setNextUInt32(0); /** @todo ContextID not used yet. */ 305 307 Msg.setNextUInt32(aScreenId); 306 308 Msg.setNextUInt32(aX); … … 377 379 GuestDnDMsg Msg; 378 380 Msg.setType(HOST_DND_HG_EVT_MOVE); 381 if (mDataBase.m_uProtocolVersion >= 3) 382 Msg.setNextUInt32(0); /** @todo ContextID not used yet. */ 379 383 Msg.setNextUInt32(aScreenId); 380 384 Msg.setNextUInt32(aX); … … 489 493 GuestDnDMsg Msg; 490 494 Msg.setType(HOST_DND_HG_EVT_DROPPED); 495 if (mDataBase.m_uProtocolVersion >= 3) 496 Msg.setNextUInt32(0); /** @todo ContextID not used yet. */ 491 497 Msg.setNextUInt32(aScreenId); 492 498 Msg.setNextUInt32(aX); … … 810 816 else 811 817 { 812 Msg.setNextUInt32(0); /** @todo uContext;not used yet. */818 Msg.setNextUInt32(0); /** @todo ContextID not used yet. */ 813 819 Msg.setNextPointer(pData->getMeta().getDataMutable(), pData->getMeta().getSize()); /* pvData */ 814 820 Msg.setNextUInt32(pData->getMeta().getSize()); /* cbData */ … … 872 878 873 879 pMsg->setType(HOST_DND_HG_SND_DIR); 880 if (mDataBase.m_uProtocolVersion >= 3) 881 pMsg->setNextUInt32(0); /** @todo ContextID not used yet. */ 874 882 pMsg->setNextString(strPath.c_str()); /* path */ 875 883 pMsg->setNextUInt32((uint32_t)(strPath.length() + 1)); /* path length (maximum is RTPATH_MAX on guest side). */ … … 920 928 */ 921 929 pMsg->setType(HOST_DND_HG_SND_FILE_HDR); 922 pMsg->setNextUInt32(0); /* uContextID */ 923 rc = pMsg->setNextString(pObj->GetDestPath().c_str()); /* pvName */ 924 AssertRC(rc); 930 pMsg->setNextUInt32(0); /** @todo ContextID not used yet. */ 931 pMsg->setNextString(pObj->GetDestPath().c_str()); /* pvName */ 925 932 pMsg->setNextUInt32((uint32_t)(pObj->GetDestPath().length() + 1)); /* cbName */ 926 933 pMsg->setNextUInt32(0); /* uFlags */ … … 989 996 else if (mDataBase.m_uProtocolVersion >= 2) 990 997 { 991 /* Since protocol v2 we also send the context ID. Currently unused. */ 992 pMsg->setNextUInt32(0); /* uContext */ 998 pMsg->setNextUInt32(0); /** @todo ContextID not used yet. */ 993 999 } 994 1000 … … 1057 1063 AssertPtr(pCBData); 1058 1064 AssertReturn(sizeof(VBOXDNDCBHGGETNEXTHOSTMSG) == cbParms, VERR_INVALID_PARAMETER); 1059 AssertReturn(CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1065 AssertReturn(CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1060 1066 1061 1067 try … … 1097 1103 AssertPtr(pCBData); 1098 1104 AssertReturn(sizeof(VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER); 1099 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u 32Magic, VERR_INVALID_PARAMETER);1105 AssertReturn(CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.uMagic, VERR_INVALID_PARAMETER); 1100 1106 1101 1107 pCtx->mpResp->reset(); … … 1243 1249 AssertPtr(pCtx->mpResp); 1244 1250 1245 #define URI_DATA_IS_VALID_BREAK(x) \1246 if (!x) \1247 { \1248 LogFlowFunc(("Invalid URI data value for \"" #x "\"\n")); \1249 rc = VERR_INVALID_PARAMETER; \1250 break; \1251 }1252 1253 1251 #define REGISTER_CALLBACK(x) \ 1254 1252 rc = pCtx->mpResp->setCallback(x, i_sendURIDataCallback, pCtx); \ 1255 1253 if (RT_FAILURE(rc)) \ 1256 return rc;1254 break; 1257 1255 1258 1256 #define UNREGISTER_CALLBACK(x) \ … … 1269 1267 if (RT_FAILURE(rc)) 1270 1268 return rc; 1271 1272 /*1273 * Register callbacks.1274 */1275 /* Guest callbacks. */1276 REGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG);1277 REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);1278 /* Host callbacks. */1279 REGISTER_CALLBACK(HOST_DND_HG_SND_DIR);1280 if (mDataBase.m_uProtocolVersion >= 2)1281 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);1282 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);1283 1269 1284 1270 do … … 1340 1326 if (RT_SUCCESS(rc)) 1341 1327 { 1328 /* 1329 * Register callbacks. 1330 */ 1331 /* Guest callbacks. */ 1332 REGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG); 1333 REGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1334 /* Host callbacks. */ 1335 REGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1336 if (mDataBase.m_uProtocolVersion >= 2) 1337 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1338 REGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); 1339 1342 1340 rc = waitForEvent(&pCtx->mCBEvent, pCtx->mpResp, msTimeout); 1343 1341 if (RT_FAILURE(rc)) … … 1351 1349 else 1352 1350 rc = pCtx->mpResp->setProgress(100, DND_PROGRESS_COMPLETE, VINF_SUCCESS); 1351 1352 /* 1353 * Unregister callbacks. 1354 */ 1355 /* Guest callbacks. */ 1356 UNREGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG); 1357 UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR); 1358 /* Host callbacks. */ 1359 UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR); 1360 if (mDataBase.m_uProtocolVersion >= 2) 1361 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR); 1362 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA); 1353 1363 } 1354 1364 1355 1365 } while (0); 1356 1357 /*1358 * Unregister callbacks.1359 */1360 /* Guest callbacks. */1361 UNREGISTER_CALLBACK(GUEST_DND_GET_NEXT_HOST_MSG);1362 UNREGISTER_CALLBACK(GUEST_DND_GH_EVT_ERROR);1363 /* Host callbacks. */1364 UNREGISTER_CALLBACK(HOST_DND_HG_SND_DIR);1365 if (mDataBase.m_uProtocolVersion >= 2)1366 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_HDR);1367 UNREGISTER_CALLBACK(HOST_DND_HG_SND_FILE_DATA);1368 1366 1369 1367 #undef REGISTER_CALLBACK … … 1380 1378 AssertRC(rc2); 1381 1379 } 1382 1383 #undef URI_DATA_IS_VALID_BREAK1384 1380 1385 1381 LogFlowFuncLeaveRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.