Changeset 81559 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Oct 28, 2019 10:09:35 AM (5 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedClipboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r81451 r81559 88 88 /** The client's session ID. */ 89 89 SHCLSESSIONID uSessionID; 90 /** Optional protocol version the client uses. Set to 0 by default. */91 uint32_t uProtocolVer;92 90 /** Guest feature flags, VBOX_SHCL_GF_0_XXX. */ 93 91 uint64_t fGuestFeatures0; … … 96 94 /** Maximum chunk size to use for data transfers. Set to _64K by default. */ 97 95 uint32_t cbChunkSize; 96 /** Where the transfer sources its data from. */ 98 97 SHCLSOURCE enmSource; 99 98 /** The client's transfers state. */ -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r81460 r81559 422 422 * Sets the VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD return parameters. 423 423 * 424 * This function does the necessary translation between the legacy protocol ( v0) and the new protocols (>= v1),424 * This function does the necessary translation between the legacy protocol (<= VBox 6.0) and the new protocols (>= VBox 6.1), 425 425 * as messages are always stored as >= v1 messages in the message queue. 426 426 * … … 1113 1113 1114 1114 SHCLEVENTID uEvent; 1115 if ( pClient->State.uProtocolVer == 0)1116 { 1117 /* Protocol v0did not have any context ID handling, so we ASSUME that the last event registered1115 if (!(pClient->State.fGuestFeatures0 & VBOX_SHCL_GF_0_CONTEXT_ID)) /* Legacy */ 1116 { 1117 /* Older Guest Additions (<= VBox 6.0) did not have any context ID handling, so we ASSUME that the last event registered 1118 1118 * is the one we want to handle (as this all was a synchronous protocol anyway). */ 1119 1119 uEvent = ShClEventGetLast(&pClient->Events); … … 1204 1204 RT_ZERO(cmdCtx); 1205 1205 1206 if ( pClient->State.uProtocolVer == 0) /* Legacy protocol*/1206 if (!(pClient->State.fGuestFeatures0 & VBOX_SHCL_GF_0_CONTEXT_ID)) /* Legacy */ 1207 1207 { 1208 1208 if (cParms < 2) … … 1431 1431 AssertPtr(pClient); 1432 1432 1433 LogFunc(("u32ClientID=%RU32 (proto %RU32), fn=%RU32 (%s), cParms=%RU32, paParms=%p\n",1434 u32ClientID, pClient->State.uProtocolVer,u32Function, ShClGuestMsgToStr(u32Function), cParms, paParms));1433 LogFunc(("u32ClientID=%RU32, fn=%RU32 (%s), cParms=%RU32, paParms=%p\n", 1434 u32ClientID, u32Function, ShClGuestMsgToStr(u32Function), cParms, paParms)); 1435 1435 1436 1436 #ifdef DEBUG … … 1458 1458 rc = VERR_INVALID_PARAMETER; 1459 1459 } 1460 else if ( paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* uProtocolVer */ 1461 || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* uProtocolFlags */ 1462 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* cbChunkSize */ 1463 || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT /* enmCompression */ 1464 || paParms[4].type != VBOX_HGCM_SVC_PARM_32BIT) /* enmChecksumType */ 1460 else if ( paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* cbChunkSize */ 1461 || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* enmCompression */ 1462 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT) /* enmChecksumType */ 1465 1463 { 1466 1464 rc = VERR_INVALID_PARAMETER; … … 1472 1470 else 1473 1471 { 1474 /* Update the protocol version and tell the guest. */ 1475 pClient->State.uProtocolVer = 1; 1476 1477 LogFlowFunc(("Now using protocol v%RU32\n", pClient->State.uProtocolVer)); 1478 1479 HGCMSvcSetU32(&paParms[0], pClient->State.uProtocolVer); 1480 HGCMSvcSetU32(&paParms[1], 0 /* Procotol flags, not used yet */); 1481 HGCMSvcSetU32(&paParms[2], pClient->State.cbChunkSize); 1482 HGCMSvcSetU32(&paParms[3], 0 /* Compression type, not used yet */); 1483 HGCMSvcSetU32(&paParms[4], 0 /* Checksum type, not used yet */); 1472 /* Report back supported chunk size to the guest. */ 1473 HGCMSvcSetU32(&paParms[0], _64K); /* Chunk size */ /** @todo Make chunk size dynamic. */ 1484 1474 1485 1475 rc = VINF_SUCCESS; … … 1523 1513 uint32_t uFormats = 0; 1524 1514 1525 if ( pClient->State.uProtocolVer == 0)1515 if (!(pClient->State.fGuestFeatures0 & VBOX_SHCL_GF_0_CONTEXT_ID)) /* Legacy */ 1526 1516 { 1527 1517 if (cParms != 1) … … 1799 1789 LogFlowFuncEnter(); 1800 1790 1801 pClientState->uProtocolVer = 0;1802 1791 pClientState->fGuestFeatures0 = VBOX_SHCL_GF_NONE; 1803 1792 pClientState->fGuestFeatures1 = VBOX_SHCL_GF_NONE; … … 1900 1889 static SSMFIELD const s_aShClSSMClientState[] = 1901 1890 { 1902 SSMFIELD_ENTRY(SHCLCLIENTSTATE, uProtocolVer), 1903 SSMFIELD_ENTRY(SHCLCLIENTSTATE, cbChunkSize), 1904 SSMFIELD_ENTRY(SHCLCLIENTSTATE, enmSource), 1891 /** Note: Saving the session ID not necessary, as they're not persistent across state save/restore. */ 1892 SSMFIELD_ENTRY (SHCLCLIENTSTATE, fGuestFeatures0), 1893 SSMFIELD_ENTRY (SHCLCLIENTSTATE, fGuestFeatures1), 1894 SSMFIELD_ENTRY (SHCLCLIENTSTATE, cbChunkSize), 1895 SSMFIELD_ENTRY (SHCLCLIENTSTATE, enmSource), 1905 1896 SSMFIELD_ENTRY_TERM() 1906 1897 }; … … 1909 1900 * SSM descriptor table for the SHCLCLIENTURISTATE structure. 1910 1901 */ 1911 static SSMFIELD const s_aShClSSMClient URIState[] =1902 static SSMFIELD const s_aShClSSMClientTransferState[] = 1912 1903 { 1913 1904 SSMFIELD_ENTRY(SHCLCLIENTTRANSFERSTATE, enmTransferDir), … … 1938 1929 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM) 1939 1930 { 1940 RT_NOREF(u32ClientID);1931 LogFlowFuncEnter(); 1941 1932 1942 1933 #ifndef UNIT_TEST … … 1947 1938 * Pending requests, if any, will be completed in svcDisconnect. 1948 1939 */ 1940 RT_NOREF(u32ClientID); 1949 1941 LogFunc(("u32ClientID=%RU32\n", u32ClientID)); 1950 1942 … … 1958 1950 AssertRCReturn(rc, rc); 1959 1951 1960 rc = SSMR3PutStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /*fFlags*/, &s_aShClSSMClient URIState[0], NULL);1952 rc = SSMR3PutStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /*fFlags*/, &s_aShClSSMClientTransferState[0], NULL); 1961 1953 AssertRCReturn(rc, rc); 1962 1954 … … 2026 2018 static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, uint32_t uVersion) 2027 2019 { 2020 LogFlowFuncEnter(); 2021 2028 2022 #ifndef UNIT_TEST 2023 2029 2024 RT_NOREF(u32ClientID, uVersion); 2030 2031 LogFunc(("u32ClientID=%RU32\n", u32ClientID));2032 2025 2033 2026 PSHCLCLIENT pClient = (PSHCLCLIENT)pvClient; … … 2038 2031 int rc = SSMR3GetU32(pSSM, &lenOrVer); 2039 2032 AssertRCReturn(rc, rc); 2033 2034 LogFunc(("u32ClientID=%RU32, lenOrVer=%#RX64\n", u32ClientID, lenOrVer)); 2035 2040 2036 if (lenOrVer == VBOX_SHCL_SSM_VER_0) 2041 2037 { … … 2044 2040 else if (lenOrVer == VBOX_SHCL_SSM_VER_1) 2045 2041 { 2046 rc = SSMR3GetStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /*fFlags*/, &s_aShClSSMClientState[0], NULL); 2042 rc = SSMR3GetStructEx(pSSM, &pClient->State, sizeof(pClient->State), 0 /* fFlags */, 2043 &s_aShClSSMClientState[0], NULL); 2047 2044 AssertRCReturn(rc, rc); 2048 2045 2049 rc = SSMR3GetStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /*fFlags*/, &s_aShClSSMClientURIState[0], NULL); 2046 rc = SSMR3GetStructEx(pSSM, &pClient->State.Transfers, sizeof(pClient->State.Transfers), 0 /* fFlags */, 2047 &s_aShClSSMClientTransferState[0], NULL); 2050 2048 AssertRCReturn(rc, rc); 2051 2049 … … 2192 2190 int rc = VINF_SUCCESS; 2193 2191 2194 LogFlowFunc(("p table=%p\n", pTable));2195 2196 if (! pTable)2192 LogFlowFunc(("pTable=%p\n", pTable)); 2193 2194 if (!VALID_PTR(pTable)) 2197 2195 { 2198 2196 rc = VERR_INVALID_PARAMETER; … … 2200 2198 else 2201 2199 { 2202 LogFunc(("p table->cbSize = %d, ptable->u32Version = 0x%08X\n", pTable->cbSize, pTable->u32Version));2200 LogFunc(("pTable->cbSize = %d, ptable->u32Version = 0x%08X\n", pTable->cbSize, pTable->u32Version)); 2203 2201 2204 2202 if ( pTable->cbSize != sizeof (VBOXHGCMSVCFNTABLE) 2205 2203 || pTable->u32Version != VBOX_HGCM_SVC_VERSION) 2206 2204 { 2207 rc = VERR_ INVALID_PARAMETER;2205 rc = VERR_VERSION_MISMATCH; 2208 2206 } 2209 2207 else … … 2213 2211 pTable->cbClient = sizeof(SHCLCLIENT); 2214 2212 2215 pTable->pfnUnload = svcUnload;2216 pTable->pfnConnect = svcConnect;2217 pTable->pfnDisconnect = svcDisconnect;2218 pTable->pfnCall = svcCall;2219 pTable->pfnHostCall = svcHostCall;2220 pTable->pfnSaveState = svcSaveState;2221 pTable->pfnLoadState = svcLoadState;2222 pTable->pfnRegisterExtension 2223 pTable->pfnNotify = NULL;2224 pTable->pvService = NULL;2213 pTable->pfnUnload = svcUnload; 2214 pTable->pfnConnect = svcConnect; 2215 pTable->pfnDisconnect = svcDisconnect; 2216 pTable->pfnCall = svcCall; 2217 pTable->pfnHostCall = svcHostCall; 2218 pTable->pfnSaveState = svcSaveState; 2219 pTable->pfnLoadState = svcLoadState; 2220 pTable->pfnRegisterExtension = svcRegisterExtension; 2221 pTable->pfnNotify = NULL; 2222 pTable->pvService = NULL; 2225 2223 2226 2224 /* Service specific initialization. */ … … 2229 2227 } 2230 2228 2229 LogFlowFunc(("Returning %Rrc\n", rc)); 2231 2230 return rc; 2232 2231 }
Note:
See TracChangeset
for help on using the changeset viewer.