Changeset 86908 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Nov 18, 2020 10:56:12 AM (4 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedClipboard
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/Makefile.kmk
r82968 r86908 49 49 VBoxSharedClipboardSvc-transfers.cpp \ 50 50 VBoxSharedClipboardSvc-utils.cpp \ 51 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardArea.cpp \52 51 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardPath.cpp \ 53 52 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r86531 r86908 389 389 * @{ 390 390 */ 391 int shClSvcTransferAreaDetach(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer);392 391 int shClSvcTransferHandler(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE callHandle, uint32_t u32Function, 393 392 uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp
r84996 r86908 72 72 73 73 LogFlowFuncEnter(); 74 75 const uint32_t cTransfers = ShClTransferCtxGetTotalTransfers(&pClient->TransferCtx);76 for (uint32_t i = 0; i < cTransfers; i++)77 {78 PSHCLTRANSFER pTransfer = ShClTransferCtxGetTransfer(&pClient->TransferCtx, i);79 if (pTransfer)80 shClSvcTransferAreaDetach(&pClient->State, pTransfer);81 }82 74 83 75 ShClTransferCtxDestroy(&pClient->TransferCtx); … … 1311 1303 } 1312 1304 1313 /* A (valid) service extension is needed because VBoxSVC needs to keep track of the1314 * clipboard areas cached on the host. */1315 if (!g_ExtState.pfnExtension)1316 {1317 #ifdef DEBUG_andy1318 AssertPtr(g_ExtState.pfnExtension);1319 #endif1320 LogFunc(("Invalid / no service extension set, skipping transfer handling\n"));1321 return VERR_NOT_SUPPORTED;1322 }1323 1324 1305 int rc = VERR_INVALID_PARAMETER; /* Play safe by default. */ 1325 1306 … … 1755 1736 break; 1756 1737 } 1757 1758 LogFlowFuncLeaveRC(rc);1759 return rc;1760 }1761 1762 /**1763 * Registers an clipboard transfer area.1764 *1765 * @returns VBox status code.1766 * @param pClientState Client state to use.1767 * @param pTransfer Shared Clipboard transfer to register a clipboard area for.1768 */1769 int shClSvcTransferAreaRegister(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer)1770 {1771 RT_NOREF(pClientState);1772 1773 LogFlowFuncEnter();1774 1775 AssertMsgReturn(pTransfer->pArea == NULL, ("An area already is registered for this transfer\n"),1776 VERR_WRONG_ORDER);1777 1778 pTransfer->pArea = new SharedClipboardArea();1779 if (!pTransfer->pArea)1780 return VERR_NO_MEMORY;1781 1782 int rc;1783 1784 if (g_ExtState.pfnExtension)1785 {1786 SHCLEXTAREAPARMS parms;1787 RT_ZERO(parms);1788 1789 parms.uID = NIL_SHCLAREAID;1790 1791 /* As the meta data is now complete, register a new clipboard on the host side. */1792 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_AREA_REGISTER, &parms, sizeof(parms));1793 if (RT_SUCCESS(rc))1794 {1795 /* Note: Do *not* specify SHCLAREA_OPEN_FLAGS_MUST_NOT_EXIST as flags here, as VBoxSVC took care of the1796 * clipboard area creation already. */1797 rc = pTransfer->pArea->OpenTemp(parms.uID /* Area ID */,1798 SHCLAREA_OPEN_FLAGS_NONE);1799 }1800 1801 LogFlowFunc(("Registered new clipboard area (%RU32) by client %RU32 with rc=%Rrc\n",1802 parms.uID, pClientState->uClientID, rc));1803 }1804 else1805 rc = VERR_NOT_SUPPORTED;1806 1807 LogFlowFuncLeaveRC(rc);1808 return rc;1809 }1810 1811 /**1812 * Unregisters an clipboard transfer area.1813 *1814 * @returns VBox status code.1815 * @param pClientState Client state to use.1816 * @param pTransfer Shared Clipboard transfer to unregister a clipboard area from.1817 */1818 int shClSvcTransferAreaUnregister(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer)1819 {1820 RT_NOREF(pClientState);1821 1822 LogFlowFuncEnter();1823 1824 if (!pTransfer->pArea)1825 return VINF_SUCCESS;1826 1827 int rc = VINF_SUCCESS;1828 1829 if (g_ExtState.pfnExtension)1830 {1831 SHCLEXTAREAPARMS parms;1832 RT_ZERO(parms);1833 1834 parms.uID = pTransfer->pArea->GetID();1835 1836 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_AREA_UNREGISTER, &parms, sizeof(parms));1837 if (RT_SUCCESS(rc))1838 {1839 rc = pTransfer->pArea->Close();1840 if (RT_SUCCESS(rc))1841 {1842 delete pTransfer->pArea;1843 pTransfer->pArea = NULL;1844 }1845 }1846 1847 LogFlowFunc(("Unregistered clipboard area (%RU32) by client %RU32 with rc=%Rrc\n",1848 parms.uID, pClientState->uClientID, rc));1849 }1850 1851 delete pTransfer->pArea;1852 pTransfer->pArea = NULL;1853 1854 LogFlowFuncLeaveRC(rc);1855 return rc;1856 }1857 1858 /**1859 * Attaches to an existing (registered) clipboard transfer area.1860 *1861 * @returns VBox status code.1862 * @param pClientState Client state to use.1863 * @param pTransfer Shared Clipboard transfer to attach a clipboard area to.1864 * @param uID ID of clipboard area to to attach to. Specify 0 to attach to the most recent one.1865 */1866 int shClSvcTransferAreaAttach(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer,1867 SHCLAREAID uID)1868 {1869 RT_NOREF(pClientState);1870 1871 LogFlowFuncEnter();1872 1873 AssertMsgReturn(pTransfer->pArea == NULL, ("An area already is attached to this transfer\n"),1874 VERR_WRONG_ORDER);1875 1876 pTransfer->pArea = new SharedClipboardArea();1877 if (!pTransfer->pArea)1878 return VERR_NO_MEMORY;1879 1880 int rc = VINF_SUCCESS;1881 1882 if (g_ExtState.pfnExtension)1883 {1884 SHCLEXTAREAPARMS parms;1885 RT_ZERO(parms);1886 1887 parms.uID = uID; /* 0 means most recent clipboard area. */1888 1889 /* The client now needs to attach to the most recent clipboard area1890 * to keep a reference to it. The host does the actual book keeping / cleanup then.1891 *1892 * This might fail if the host does not have a most recent clipboard area (yet). */1893 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_AREA_ATTACH, &parms, sizeof(parms));1894 if (RT_SUCCESS(rc))1895 rc = pTransfer->pArea->OpenTemp(parms.uID /* Area ID */);1896 1897 LogFlowFunc(("Attached client %RU32 to clipboard area %RU32 with rc=%Rrc\n",1898 pClientState->uClientID, parms.uID, rc));1899 }1900 else1901 rc = VERR_NOT_SUPPORTED;1902 1903 LogFlowFuncLeaveRC(rc);1904 return rc;1905 }1906 1907 /**1908 * Detaches from an clipboard transfer area.1909 *1910 * @returns VBox status code.1911 * @param pClientState Client state to use.1912 * @param pTransfer Shared Clipboard transfer to detach a clipboard area from.1913 */1914 int shClSvcTransferAreaDetach(PSHCLCLIENTSTATE pClientState, PSHCLTRANSFER pTransfer)1915 {1916 RT_NOREF(pClientState);1917 1918 LogFlowFuncEnter();1919 1920 if (!pTransfer->pArea)1921 return VINF_SUCCESS;1922 1923 const uint32_t uAreaID = pTransfer->pArea->GetID();1924 1925 int rc = VINF_SUCCESS;1926 1927 if (g_ExtState.pfnExtension)1928 {1929 SHCLEXTAREAPARMS parms;1930 RT_ZERO(parms);1931 parms.uID = uAreaID;1932 1933 rc = g_ExtState.pfnExtension(g_ExtState.pvExtension, VBOX_CLIPBOARD_EXT_FN_AREA_DETACH, &parms, sizeof(parms));1934 1935 LogFlowFunc(("Detached client %RU32 from clipboard area %RU32 with rc=%Rrc\n",1936 pClientState->uClientID, uAreaID, rc));1937 }1938 1939 delete pTransfer->pArea;1940 pTransfer->pArea = NULL;1941 1738 1942 1739 LogFlowFuncLeaveRC(rc); … … 2041 1838 if (enmDir == SHCLTRANSFERDIR_FROM_REMOTE) 2042 1839 { 2043 rc = shClSvcTransferAreaRegister(&pClient->State, pTransfer); 2044 if (RT_SUCCESS(rc)) 2045 { 2046 creationCtx.Interface.pfnTransferOpen = shClSvcTransferIfaceOpen; 2047 creationCtx.Interface.pfnTransferClose = shClSvcTransferIfaceClose; 2048 2049 creationCtx.Interface.pfnRootsGet = shClSvcTransferIfaceGetRoots; 2050 2051 creationCtx.Interface.pfnListOpen = shClSvcTransferIfaceListOpen; 2052 creationCtx.Interface.pfnListClose = shClSvcTransferIfaceListClose; 2053 creationCtx.Interface.pfnListHdrRead = shClSvcTransferIfaceListHdrRead; 2054 creationCtx.Interface.pfnListEntryRead = shClSvcTransferIfaceListEntryRead; 2055 2056 creationCtx.Interface.pfnObjOpen = shClSvcTransferIfaceObjOpen; 2057 creationCtx.Interface.pfnObjClose = shClSvcTransferIfaceObjClose; 2058 creationCtx.Interface.pfnObjRead = shClSvcTransferIfaceObjRead; 2059 } 1840 creationCtx.Interface.pfnTransferOpen = shClSvcTransferIfaceOpen; 1841 creationCtx.Interface.pfnTransferClose = shClSvcTransferIfaceClose; 1842 1843 creationCtx.Interface.pfnRootsGet = shClSvcTransferIfaceGetRoots; 1844 1845 creationCtx.Interface.pfnListOpen = shClSvcTransferIfaceListOpen; 1846 creationCtx.Interface.pfnListClose = shClSvcTransferIfaceListClose; 1847 creationCtx.Interface.pfnListHdrRead = shClSvcTransferIfaceListHdrRead; 1848 creationCtx.Interface.pfnListEntryRead = shClSvcTransferIfaceListEntryRead; 1849 1850 creationCtx.Interface.pfnObjOpen = shClSvcTransferIfaceObjOpen; 1851 creationCtx.Interface.pfnObjClose = shClSvcTransferIfaceObjClose; 1852 creationCtx.Interface.pfnObjRead = shClSvcTransferIfaceObjRead; 2060 1853 } 2061 1854 else if (enmDir == SHCLTRANSFERDIR_TO_REMOTE) -
trunk/src/VBox/HostServices/SharedClipboard/testcase/Makefile.kmk
r86362 r86908 39 39 tstClipboardServiceHost_SOURCES += \ 40 40 ../VBoxSharedClipboardSvc-transfers.cpp \ 41 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp \ 42 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardArea.cpp 41 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp 43 42 endif 44 43
Note:
See TracChangeset
for help on using the changeset viewer.