Changeset 78618 in vbox for trunk/src/VBox
- Timestamp:
- May 21, 2019 8:36:42 AM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/Makefile.kmk
r78307 r78618 111 111 $(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS,) \ 112 112 $(if $(VBOX_WITH_SHARED_CLIPBOARD),VBOX_WITH_SHARED_CLIPBOARD,) \ 113 $(if $(VBOX_WITH_SHARED_CLIPBOARD_URI_LIST),VBOX_WITH_SHARED_CLIPBOARD_URI_LIST,) \ 113 114 $(if $(VBOX_WITH_SHARED_FOLDERS),VBOX_WITH_SHARED_FOLDERS,) \ 114 115 $(if $(VBOX_WITH_GUEST_CONTROL),VBOX_WITH_GUEST_CONTROL,) … … 118 119 VBoxGuestR3LibAutoLogon.cpp \ 119 120 VBoxGuestR3LibBalloon.cpp \ 120 VBoxGuestR3LibClipboard.cpp \121 121 VBoxGuestR3LibCoreDump.cpp \ 122 122 VBoxGuestR3LibCpuHotPlug.cpp \ … … 146 146 VBoxGuestR3LibHostVersion.cpp 147 147 endif 148 ifdef VBOX_WITH_SHARED_CLIPBOARD 149 VBoxGuestR3Lib_SOURCES += \ 150 VBoxGuestR3LibClipboard.cpp 151 endif 148 152 ifdef VBOX_WITH_SHARED_FOLDERS 149 153 VBoxGuestR3Lib_SOURCES += \ … … 160 164 VBoxGuestR3Lib_SOURCES += \ 161 165 VBoxGuestR3LibDragAndDrop.cpp 162 endif163 ifdef VBOX_WITH_SHARED_CLIPBOARD164 VBoxGuestR3Lib_DEFS += \165 $(if $(VBOX_WITH_SHARED_CLIPBOARD_URI_LIST),VBOX_WITH_SHARED_CLIPBOARD_URI_LIST,)166 166 endif 167 167 -
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardCache.cpp
r78581 r78618 252 252 } 253 253 254 int SharedClipboardCache::Reset(bool f RemoveDropDir)254 int SharedClipboardCache::Reset(bool fDeleteContent) 255 255 { 256 256 int rc = closeInternal(); 257 257 if (RT_SUCCESS(rc)) 258 258 { 259 if (f RemoveDropDir)259 if (fDeleteContent) 260 260 { 261 261 rc = Rollback(); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-darwin.cpp
r78580 r78618 44 44 PasteboardRef pasteboard; 45 45 46 PVBOXCLIPBOARD SVCCTX pSvcCtx;46 PVBOXCLIPBOARDCLIENTDATA pClientData; 47 47 }; 48 48 … … 63 63 static int vboxClipboardChanged(VBOXCLIPBOARDCONTEXT *pCtx) 64 64 { 65 if (pCtx->p SvcCtx== NULL)65 if (pCtx->pClientData == NULL) 66 66 return VINF_SUCCESS; 67 67 … … 72 72 if (RT_SUCCESS(rc) && fChanged) 73 73 { 74 vboxSvcClipboardReportMsg(pCtx->p SvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, fFormats);74 vboxSvcClipboardReportMsg(pCtx->pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, fFormats); 75 75 Log(("vboxClipboardChanged fFormats %02X\n", fFormats)); 76 76 } … … 157 157 destroyPasteboard(&g_ctx.pasteboard); 158 158 g_ctx.thread = NIL_RTTHREAD; 159 g_ctx.p SvcCtx= NULL;159 g_ctx.pClientData = NULL; 160 160 } 161 161 … … 163 163 * Enable the shared clipboard - called by the hgcm clipboard subsystem. 164 164 * 165 * @param p SvcCtxStructure containing context information about the guest system166 * @param fHeadless Whether headless.165 * @param pClientData Structure containing context information about the guest system 166 * @param fHeadless Whether headless. 167 167 * @returns RT status code 168 168 */ 169 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARD SVCCTX pSvcCtx, bool fHeadless)169 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless) 170 170 { 171 171 NOREF(fHeadless); 172 if (g_ctx.p SvcCtx!= NULL)172 if (g_ctx.pClientData != NULL) 173 173 { 174 174 /* One client only. */ … … 178 178 VBoxSvcClipboardLock(); 179 179 180 p SvcCtx->pCtx = &g_ctx;181 p SvcCtx->pCtx->pSvcCtx = pSvcCtx;180 pClientData->State.pCtx = &g_ctx; 181 pClientData->State.pCtx->pClientData = pClientData; 182 182 183 183 /* Initially sync the host clipboard content with the client. */ 184 int rc = VBoxClipboardSvcImplSync(p SvcCtx);184 int rc = VBoxClipboardSvcImplSync(pClientData); 185 185 186 186 VBoxSvcClipboardUnlock(); … … 192 192 * after a save and restore of the guest. 193 193 */ 194 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARD SVCCTX pSvcCtx)194 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA pClientData) 195 195 { 196 196 /* Sync the host clipboard content with the client. */ 197 197 VBoxSvcClipboardLock(); 198 int rc = vboxClipboardChanged(p SvcCtx->pCtx);198 int rc = vboxClipboardChanged(pClientData->State.pCtx); 199 199 VBoxSvcClipboardUnlock(); 200 200 … … 205 205 * Shut down the shared clipboard subsystem and "disconnect" the guest. 206 206 */ 207 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARD SVCCTX pSvcCtx)207 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData) 208 208 { 209 209 Log(("vboxClipboardDisconnect\n")); 210 210 211 211 VBoxSvcClipboardLock(); 212 p SvcCtx->pCtx->pSvcCtx= NULL;212 pClientData->State.pCtx->pClientData = NULL; 213 213 VBoxSvcClipboardUnlock(); 214 214 } … … 218 218 * subsystem. 219 219 * 220 * @param p SvcCtxContext data for the guest system221 * @param u32Formats Clipboard formats the guest is offering222 */ 223 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Formats)220 * @param pClientData Context data for the guest system 221 * @param u32Formats Clipboard formats the guest is offering 222 */ 223 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats) 224 224 { 225 225 Log(("vboxClipboardFormatAnnounce u32Formats %02X\n", u32Formats)); … … 230 230 } 231 231 232 vboxSvcClipboardReportMsg(p SvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, u32Formats);232 vboxSvcClipboardReportMsg(pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, u32Formats); 233 233 } 234 234 … … 236 236 * Called by the HGCM clipboard subsystem when the guest wants to read the host clipboard. 237 237 * 238 * @param p SvcCtxContext information about the guest VM239 * @param u32Format The format that the guest would like to receive the data in240 * @param pv Where to write the data to241 * @param cb The size of the buffer to write the data to242 * @param pcbActual Where to write the actual size of the written data243 */ 244 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Format,238 * @param pClientData Context information about the guest VM 239 * @param u32Format The format that the guest would like to receive the data in 240 * @param pv Where to write the data to 241 * @param cb The size of the buffer to write the data to 242 * @param pcbActual Where to write the actual size of the written data 243 */ 244 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Format, 245 245 void *pv, uint32_t cb, uint32_t *pcbActual) 246 246 { … … 249 249 /* Default to no data available. */ 250 250 *pcbActual = 0; 251 int rc = readFromPasteboard(p SvcCtx->pCtx->pasteboard, u32Format, pv, cb, pcbActual);251 int rc = readFromPasteboard(pClientData->State.pCtx->pasteboard, u32Format, pv, cb, pcbActual); 252 252 253 253 VBoxSvcClipboardUnlock(); … … 258 258 * Called by the HGCM clipboard subsystem when we have requested data and that data arrives. 259 259 * 260 * @param p SvcCtxContext information about the guest VM261 * @param pv Buffer to which the data was written262 * @param cb The size of the data written263 * @param u32Format The format of the data written264 */ 265 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARD SVCCTX pSvcCtx, void *pv, uint32_t cb, uint32_t u32Format)266 { 267 VBoxSvcClipboardLock(); 268 269 writeToPasteboard(p SvcCtx->pCtx->pasteboard, pv, cb, u32Format);270 271 VBoxSvcClipboardUnlock(); 272 } 260 * @param pClientData Context information about the guest VM 261 * @param pv Buffer to which the data was written 262 * @param cb The size of the data written 263 * @param u32Format The format of the data written 264 */ 265 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, void *pv, uint32_t cb, uint32_t u32Format) 266 { 267 VBoxSvcClipboardLock(); 268 269 writeToPasteboard(pClientData->State.pCtx->pasteboard, pv, cb, u32Format); 270 271 VBoxSvcClipboardUnlock(); 272 } -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r78617 r78618 16 16 */ 17 17 18 #ifndef VBOX_INCLUDED_SRC_SharedClipboard_VBox Clipboard_h19 #define VBOX_INCLUDED_SRC_SharedClipboard_VBox Clipboard_h18 #ifndef VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h 19 #define VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 26 26 27 27 #include <VBox/GuestHost/SharedClipboard.h> 28 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 29 # include <VBox/GuestHost/SharedClipboard-uri.h> 30 #endif 28 31 29 typedef struct _VBOXCLIPBOARDSVCCTX 32 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 33 typedef struct _VBOXCLIPBOARDCLIENTURIDATA 30 34 { 31 struct _VBOXCLIPBOARDSVCCTX *pNext; 32 struct _VBOXCLIPBOARDSVCCTX *pPrev; 35 SharedClipboardCache Cache; 36 } VBOXCLIPBOARDCLIENTURIDATA, *PVBOXCLIPBOARDCLIENTURIDATA; 37 #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */ 38 39 /** 40 * Structure for keeping generic client state data within the Shared Clipboard host service. 41 * This structure needs to be serializable by SSM. 42 */ 43 typedef struct _VBOXCLIPBOARDCLIENTSTATE 44 { 45 struct _VBOXCLIPBOARDCLIENTSTATE *pNext; 46 struct _VBOXCLIPBOARDCLIENTSTATE *pPrev; 33 47 34 48 VBOXCLIPBOARDCONTEXT *pCtx; … … 65 79 uint32_t u32AvailableFormats; 66 80 uint32_t u32RequestedFormat; 81 } VBOXCLIPBOARDCLIENTSTATE, *PVBOXCLIPBOARDCLIENTSTATE; 67 82 68 } VBOXCLIPBOARDSVCCTX, *PVBOXCLIPBOARDSVCCTX; 83 /** 84 * Structure for keeping a HGCM client state within the Shared Clipboard host service. 85 */ 86 typedef struct _VBOXCLIPBOARDCLIENTDATA 87 { 88 /** General client state data. */ 89 VBOXCLIPBOARDCLIENTSTATE State; 90 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 91 /** Data related to URI handling. */ 92 VBOXCLIPBOARDCLIENTURIDATA URI; 93 #endif 94 } VBOXCLIPBOARDCLIENTDATA, *PVBOXCLIPBOARDCLIENTDATA; 69 95 70 96 /* 71 97 * The service functions. Locking is between the service thread and the platform dependent windows thread. 72 98 */ 73 void vboxSvcClipboardReportMsg(PVBOXCLIPBOARDSVCCTX pSvcCtx, uint32_t u32Msg, uint32_t u32Formats); 74 void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARDSVCCTX pSvcCtx, int rc, uint32_t cbActual); 99 uint32_t vboxSvcClipboardGetMode(void); 100 void vboxSvcClipboardReportMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Msg, uint32_t u32Formats); 101 void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, int rc, uint32_t cbActual); 75 102 76 103 /* … … 80 107 void VBoxClipboardSvcImplDestroy(void); 81 108 82 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARD SVCCTX pSvcCtx, bool fHeadless);83 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARD SVCCTX pSvcCtx);84 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Formats);85 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual);86 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARD SVCCTX pSvcCtx, void *pv, uint32_t cb, uint32_t u32Format);87 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARD SVCCTX pSvcCtx);109 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless); 110 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData); 111 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats); 112 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual); 113 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, void *pv, uint32_t cb, uint32_t u32Format); 114 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA pClientData); 88 115 89 116 /* Host unit testing interface */ … … 92 119 #endif 93 120 94 #endif /* !VBOX_INCLUDED_SRC_SharedClipboard_VBox Clipboard_h */121 #endif /* !VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_internal_h */ 95 122 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-uri.cpp
r78501 r78618 23 23 #include <VBox/HostServices/VBoxClipboardSvc.h> 24 24 25 #include "VBoxSharedClipboardSvc-internal.h" 25 26 #include "VBoxSharedClipboardSvc-uri.h" 26 27 28 29 int vboxClipboardSvcURICreate(PVBOXCLIPBOARDCLIENTURIDATA pURIData, uint32_t uClientID) 30 { 31 RT_NOREF(pURIData, uClientID); 32 33 int rc = pURIData->Cache.OpenTemp(SHAREDCLIPBOARDCACHE_FLAGS_NONE); 34 if (RT_SUCCESS(rc)) 35 { 36 } 37 38 return rc; 39 } 40 41 void vboxClipboardSvcURIDestroy(PVBOXCLIPBOARDCLIENTURIDATA pURIData) 42 { 43 int rc = pURIData->Cache.Rollback(); 44 if (RT_SUCCESS(rc)) 45 rc = pURIData->Cache.Close(); 46 } 27 47 28 48 int vboxClipboardSvcURIHandler(uint32_t u32ClientID, … … 34 54 bool *pfAsync) 35 55 { 36 RT_NOREF(u32ClientID, pvClient, u32Function, cParms, paParms, tsArrival, pfAsync); 37 38 return VINF_SUCCESS; 56 RT_NOREF(u32ClientID, pvClient, paParms, tsArrival, pfAsync); 57 58 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pvClient; 59 RT_NOREF(pClientData); 60 61 /* Check if we've the right mode set. */ 62 int rc = VERR_ACCESS_DENIED; /* Play safe. */ 63 64 switch (u32Function) 65 { 66 case VBOX_SHARED_CLIPBOARD_FN_READ_DATA_HDR: 67 RT_FALL_THROUGH(); 68 case VBOX_SHARED_CLIPBOARD_FN_READ_DIR: 69 RT_FALL_THROUGH(); 70 case VBOX_SHARED_CLIPBOARD_FN_READ_FILE_HDR: 71 RT_FALL_THROUGH(); 72 case VBOX_SHARED_CLIPBOARD_FN_READ_FILE_DATA: 73 { 74 if ( vboxSvcClipboardGetMode() == VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST 75 || vboxSvcClipboardGetMode() == VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL) 76 { 77 rc = VINF_SUCCESS; 78 } 79 80 if (RT_FAILURE(rc)) 81 LogFunc(("Guest -> Host Shared Clipboard mode disabled, ignoring request\n")); 82 break; 83 } 84 85 case VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA_HDR: 86 RT_FALL_THROUGH(); 87 case VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_HDR: 88 RT_FALL_THROUGH(); 89 case VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_DATA: 90 RT_FALL_THROUGH(); 91 case VBOX_SHARED_CLIPBOARD_FN_WRITE_CANCEL: 92 RT_FALL_THROUGH(); 93 case VBOX_SHARED_CLIPBOARD_FN_WRITE_ERROR: 94 { 95 if ( vboxSvcClipboardGetMode() == VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST 96 || vboxSvcClipboardGetMode() == VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL) 97 { 98 rc = VINF_SUCCESS; 99 } 100 101 if (RT_FAILURE(rc)) 102 LogFunc(("Clipboard: Host -> Guest Shared Clipboard mode disabled, ignoring request\n")); 103 break; 104 } 105 106 default: 107 break; 108 } 109 110 if (RT_FAILURE(rc)) 111 return rc; 112 113 rc = VERR_INVALID_PARAMETER; /* Play safe. */ 114 115 switch (u32Function) 116 { 117 case VBOX_SHARED_CLIPBOARD_FN_READ_DATA_HDR: 118 { 119 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_READ_DATA_HDR\n")); 120 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 121 break; 122 } 123 124 case VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA_HDR: 125 { 126 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA_HDR\n")); 127 if (cParms == 12) 128 { 129 VBOXCLIPBOARDCBWRITEDATAHDRDATA data; 130 RT_ZERO(data); 131 data.hdr.uMagic = CB_MAGIC_CLIPBOARD_WRITE_DATA_HDR; 132 rc = HGCMSvcGetU32(&paParms[0], &data.hdr.uContextID); 133 if (RT_SUCCESS(rc)) 134 rc = HGCMSvcGetU32(&paParms[1], &data.data.uFlags); 135 if (RT_SUCCESS(rc)) 136 rc = HGCMSvcGetU32(&paParms[2], &data.data.uScreenId); 137 if (RT_SUCCESS(rc)) 138 rc = HGCMSvcGetU64(&paParms[3], &data.data.cbTotal); 139 if (RT_SUCCESS(rc)) 140 rc = HGCMSvcGetU32(&paParms[4], &data.data.cbMeta); 141 if (RT_SUCCESS(rc)) 142 rc = HGCMSvcGetPv(&paParms[5], &data.data.pvMetaFmt, &data.data.cbMetaFmt); 143 if (RT_SUCCESS(rc)) 144 rc = HGCMSvcGetU32(&paParms[6], &data.data.cbMetaFmt); 145 if (RT_SUCCESS(rc)) 146 rc = HGCMSvcGetU64(&paParms[7], &data.data.cObjects); 147 if (RT_SUCCESS(rc)) 148 rc = HGCMSvcGetU32(&paParms[8], &data.data.enmCompression); 149 if (RT_SUCCESS(rc)) 150 rc = HGCMSvcGetU32(&paParms[9], (uint32_t *)&data.data.enmChecksumType); 151 if (RT_SUCCESS(rc)) 152 rc = HGCMSvcGetPv(&paParms[10], &data.data.pvChecksum, &data.data.cbChecksum); 153 if (RT_SUCCESS(rc)) 154 rc = HGCMSvcGetU32(&paParms[11], &data.data.cbChecksum); 155 156 LogFlowFunc(("fFlags=0x%x, cbTotalSize=%RU64, cObj=%RU64\n", 157 data.data.uFlags, data.data.cbTotal, data.data.cObjects)); 158 } 159 160 break; 161 } 162 163 case VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA_CHUNK: 164 { 165 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA_CHUNK\n")); 166 if (cParms == 5) 167 { 168 VBOXCLIPBOARDCBDATADATA data; 169 RT_ZERO(data); 170 data.hdr.uMagic = CB_MAGIC_CLIPBOARD_WRITE_DATA_CHUNK; 171 rc = HGCMSvcGetU32(&paParms[0], &data.hdr.uContextID); 172 if (RT_SUCCESS(rc)) 173 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.data.pvData, &data.data.cbData); 174 if (RT_SUCCESS(rc)) 175 rc = HGCMSvcGetU32(&paParms[2], &data.data.cbData); 176 if (RT_SUCCESS(rc)) 177 rc = HGCMSvcGetPv(&paParms[3], (void**)&data.data.pvChecksum, &data.data.cbChecksum); 178 if (RT_SUCCESS(rc)) 179 rc = HGCMSvcGetU32(&paParms[4], &data.data.cbChecksum); 180 } 181 break; 182 } 183 184 case VBOX_SHARED_CLIPBOARD_FN_READ_DIR: 185 { 186 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_READ_DIR\n")); 187 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 188 break; 189 } 190 191 case VBOX_SHARED_CLIPBOARD_FN_WRITE_DIR: 192 { 193 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_WRITE_DIR\n")); 194 if (cParms == 4) 195 { 196 VBOXCLIPBOARDCBWRITEDIRDATA data; 197 RT_ZERO(data); 198 data.hdr.uMagic = CB_MAGIC_CLIPBOARD_WRITE_DIR; 199 200 rc = HGCMSvcGetU32(&paParms[0], &data.hdr.uContextID); 201 if (RT_SUCCESS(rc)) 202 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.pszPath, &data.cbPath); 203 if (RT_SUCCESS(rc)) 204 rc = HGCMSvcGetU32(&paParms[2], &data.cbPath); 205 if (RT_SUCCESS(rc)) 206 rc = HGCMSvcGetU32(&paParms[3], &data.fMode); 207 } 208 break; 209 } 210 211 case VBOX_SHARED_CLIPBOARD_FN_READ_FILE_HDR: 212 { 213 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_READ_FILE_HDR\n")); 214 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 215 break; 216 } 217 218 case VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_HDR: 219 { 220 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_HDR\n")); 221 if (cParms == 6) 222 { 223 VBOXCLIPBOARDCBWRITEFILEHDRDATA data; 224 RT_ZERO(data); 225 data.hdr.uMagic = CB_MAGIC_CLIPBOARD_WRITE_FILE_HDR; 226 227 rc = HGCMSvcGetU32(&paParms[0], &data.hdr.uContextID); 228 if (RT_SUCCESS(rc)) 229 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.pszFilePath, &data.cbFilePath); 230 if (RT_SUCCESS(rc)) 231 rc = HGCMSvcGetU32(&paParms[2], &data.cbFilePath); 232 if (RT_SUCCESS(rc)) 233 rc = HGCMSvcGetU32(&paParms[3], &data.fFlags); 234 if (RT_SUCCESS(rc)) 235 rc = HGCMSvcGetU32(&paParms[4], &data.fMode); 236 if (RT_SUCCESS(rc)) 237 rc = HGCMSvcGetU64(&paParms[5], &data.cbSize); 238 239 LogFlowFunc(("pszPath=%s, cbPath=%RU32, fMode=0x%x, cbSize=%RU64\n", 240 data.pszFilePath, data.cbFilePath, data.fMode, data.cbSize)); 241 } 242 break; 243 } 244 245 case VBOX_SHARED_CLIPBOARD_FN_READ_FILE_DATA: 246 { 247 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_READ_FILE_DATA\n")); 248 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 249 break; 250 } 251 252 case VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_DATA: 253 { 254 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_WRITE_FILE_DATA\n")); 255 if (cParms == 5) 256 { 257 VBOXCLIPBOARDCBWRITEFILEDATADATA data; 258 RT_ZERO(data); 259 data.hdr.uMagic = CB_MAGIC_CLIPBOARD_WRITE_FILE_DATA; 260 261 rc = HGCMSvcGetU32(&paParms[0], &data.hdr.uContextID); 262 if (RT_SUCCESS(rc)) 263 rc = HGCMSvcGetPv(&paParms[1], (void**)&data.pvData, &data.cbData); 264 if (RT_SUCCESS(rc)) 265 rc = HGCMSvcGetU32(&paParms[2], &data.cbData); 266 if (RT_SUCCESS(rc)) 267 rc = HGCMSvcGetPv(&paParms[3], (void**)&data.pvChecksum, &data.cbChecksum); 268 if (RT_SUCCESS(rc)) 269 rc = HGCMSvcGetU32(&paParms[4], &data.cbChecksum); 270 271 LogFlowFunc(("pvData=0x%p, cbData=%RU32\n", data.pvData, data.cbData)); 272 } 273 break; 274 } 275 276 case VBOX_SHARED_CLIPBOARD_FN_WRITE_CANCEL: 277 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_WRITE_CANCEL\n")); 278 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 279 break; 280 281 case VBOX_SHARED_CLIPBOARD_FN_WRITE_ERROR: 282 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_FN_WRITE_ERROR\n")); 283 AssertFailedStmt(rc = VERR_NOT_IMPLEMENTED); 284 break; 285 286 default: 287 AssertMsgFailed(("Not implemented\n")); 288 break; 289 } 290 291 return rc; 39 292 } 40 293 … … 43 296 VBOXHGCMSVCPARM paParms[]) 44 297 { 45 RT_NOREF(u32Function, cParms, paParms); 46 47 return VINF_SUCCESS; 298 RT_NOREF(cParms, paParms); 299 300 int rc = VERR_INVALID_PARAMETER; /* Play safe. */ 301 302 switch (u32Function) 303 { 304 case VBOX_SHARED_CLIPBOARD_HOST_FN_CANCEL: 305 break; 306 307 case VBOX_SHARED_CLIPBOARD_HOST_FN_ERROR: 308 break; 309 310 default: 311 AssertMsgFailed(("Not implemented\n")); 312 break; 313 314 } 315 316 return rc; 48 317 } 49 318 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-uri.h
r78501 r78618 22 22 #endif 23 23 24 int vboxClipboardSvcURIHandler(uint32_t u32ClientID, 25 void *pvClient, 26 uint32_t u32Function, 27 uint32_t cParms, 28 VBOXHGCMSVCPARM paParms[], 29 uint64_t tsArrival, 30 bool *pfAsync); 31 32 int vboxClipboardSvcURIHostHandler(uint32_t u32Function, 33 uint32_t cParms, 34 VBOXHGCMSVCPARM paParms[]); 24 int vboxClipboardSvcURICreate(PVBOXCLIPBOARDCLIENTURIDATA pURIData); 25 void vboxClipboardSvcURIDestroy(PVBOXCLIPBOARDCLIENTURIDATA pURIData); 26 int vboxClipboardSvcURIHandler(uint32_t u32ClientID, void *pvClient, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival, bool *pfAsync); 27 int vboxClipboardSvcURIHostHandler(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]); 35 28 36 29 #endif /* !VBOX_INCLUDED_SRC_SharedClipboard_VBoxSharedClipboardSvc_uri_h */ -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp
r78580 r78618 61 61 RTSEMEVENT hRenderEvent; 62 62 /** Structure for keeping and communicating with client data (from the guest). */ 63 PVBOXCLIPBOARD SVCCTX pSvcCtx;63 PVBOXCLIPBOARDCLIENTDATA pClientData; 64 64 /** Windows-specific context data. */ 65 65 VBOXCLIPBOARDWINCTX Win; … … 160 160 static int vboxClipboardReadDataFromClient(VBOXCLIPBOARDCONTEXT *pCtx, VBOXCLIPBOARDFORMAT fFormat) 161 161 { 162 Assert(pCtx->p SvcCtx);162 Assert(pCtx->pClientData); 163 163 Assert(pCtx->hRenderEvent); 164 Assert(pCtx->p SvcCtx->data.pv == NULL && pCtx->pSvcCtx->data.cb == 0 && pCtx->pSvcCtx->data.u32Format == 0);164 Assert(pCtx->pClientData->data.pv == NULL && pCtx->pClientData->data.cb == 0 && pCtx->pClientData->data.u32Format == 0); 165 165 166 166 LogFlowFunc(("fFormat=%02X\n", fFormat)); 167 167 168 vboxSvcClipboardReportMsg(pCtx->p SvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, fFormat);168 vboxSvcClipboardReportMsg(pCtx->pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, fFormat); 169 169 170 170 return RTSemEventWait(pCtx->hRenderEvent, 30 * 1000 /* Timeout in ms */); … … 289 289 290 290 if ( fFormat == VBOX_SHARED_CLIPBOARD_FMT_NONE 291 || pCtx->p SvcCtx== NULL)291 || pCtx->pClientData == NULL) 292 292 { 293 293 /* Unsupported clipboard format is requested. */ … … 300 300 301 301 LogFunc(("vboxClipboardReadDataFromClient rc = %Rrc, pv %p, cb %d, u32Format %d\n", 302 rc, pCtx->p SvcCtx->data.pv, pCtx->pSvcCtx->data.cb, pCtx->pSvcCtx->data.u32Format));302 rc, pCtx->pClientData->data.pv, pCtx->pClientData->data.cb, pCtx->pClientData->data.u32Format)); 303 303 304 304 if ( RT_SUCCESS (rc) 305 && pCtx->p SvcCtx->data.pv != NULL306 && pCtx->p SvcCtx->data.cb > 0307 && pCtx->p SvcCtx->data.u32Format == fFormat)308 { 309 HANDLE hMem = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, pCtx->p SvcCtx->data.cb);305 && pCtx->pClientData->data.pv != NULL 306 && pCtx->pClientData->data.cb > 0 307 && pCtx->pClientData->data.u32Format == fFormat) 308 { 309 HANDLE hMem = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, pCtx->pClientData->data.cb); 310 310 311 311 LogFunc(("hMem %p\n", hMem)); … … 321 321 LogFunc(("WM_RENDERFORMAT setting data\n")); 322 322 323 if (pCtx->p SvcCtx->data.pv)323 if (pCtx->pClientData->data.pv) 324 324 { 325 memcpy(pMem, pCtx->p SvcCtx->data.pv, pCtx->pSvcCtx->data.cb);326 327 RTMemFree(pCtx->p SvcCtx->data.pv);328 pCtx->p SvcCtx->data.pv = NULL;325 memcpy(pMem, pCtx->pClientData->data.pv, pCtx->pClientData->data.cb); 326 327 RTMemFree(pCtx->pClientData->data.pv); 328 pCtx->pClientData->data.pv = NULL; 329 329 } 330 330 331 pCtx->p SvcCtx->data.cb = 0;332 pCtx->p SvcCtx->data.u32Format = 0;331 pCtx->pClientData->data.cb = 0; 332 pCtx->pClientData->data.u32Format = 0; 333 333 334 334 /* The memory must be unlocked before inserting to the Clipboard. */ … … 353 353 } 354 354 355 RTMemFree(pCtx->p SvcCtx->data.pv);356 pCtx->p SvcCtx->data.pv = NULL;357 pCtx->p SvcCtx->data.cb = 0;358 pCtx->p SvcCtx->data.u32Format = 0;355 RTMemFree(pCtx->pClientData->data.pv); 356 pCtx->pClientData->data.pv = NULL; 357 pCtx->pClientData->data.cb = 0; 358 pCtx->pClientData->data.u32Format = 0; 359 359 360 360 /* Something went wrong. */ … … 380 380 case VBOX_CLIPBOARD_WM_SET_FORMATS: 381 381 { 382 if ( pCtx->p SvcCtx== NULL383 || pCtx->p SvcCtx->fHostMsgFormats)382 if ( pCtx->pClientData == NULL 383 || pCtx->pClientData->State.fHostMsgFormats) 384 384 { 385 385 /* Host has pending formats message. Ignore the guest announcement, … … 545 545 int rc; 546 546 547 if (pCtx->p SvcCtx)547 if (pCtx->pClientData) 548 548 { 549 549 uint32_t uFormats; 550 550 rc = VBoxClipboardWinGetFormats(&pCtx->Win, &uFormats); 551 551 if (RT_SUCCESS(rc)) 552 vboxSvcClipboardReportMsg(pCtx->p SvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, uFormats);552 vboxSvcClipboardReportMsg(pCtx->pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, uFormats); 553 553 } 554 554 else /* If we don't have any client data (yet), bail out. */ … … 602 602 } 603 603 604 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARD SVCCTX pSvcCtx, bool fHeadless)604 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless) 605 605 { 606 606 RT_NOREF(fHeadless); … … 608 608 LogFlowFuncEnter(); 609 609 610 if (g_ctx.p SvcCtx!= NULL)610 if (g_ctx.pClientData != NULL) 611 611 { 612 612 /* One client only. */ … … 614 614 } 615 615 616 p SvcCtx->pCtx = &g_ctx;617 618 p SvcCtx->pCtx->pSvcCtx = pSvcCtx;616 pClientData->State.pCtx = &g_ctx; 617 618 pClientData->State.pCtx->pClientData = pClientData; 619 619 620 620 /* Sync the host clipboard content with the client. */ 621 VBoxClipboardSvcImplSync(p SvcCtx);621 VBoxClipboardSvcImplSync(pClientData); 622 622 623 623 return VINF_SUCCESS; 624 624 } 625 625 626 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARD SVCCTX pSvcCtx)626 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA pClientData) 627 627 { 628 628 /* Sync the host clipboard content with the client. */ 629 return vboxClipboardWinSyncInternal(p SvcCtx->pCtx);630 } 631 632 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARD SVCCTX pSvcCtx)633 { 634 RT_NOREF(p SvcCtx);629 return vboxClipboardWinSyncInternal(pClientData->State.pCtx); 630 } 631 632 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData) 633 { 634 RT_NOREF(pClientData); 635 635 636 636 LogFlowFuncEnter(); 637 637 638 g_ctx.p SvcCtx= NULL;639 } 640 641 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Formats)642 { 643 AssertPtrReturnVoid(p SvcCtx);644 AssertPtrReturnVoid(p SvcCtx->pCtx);638 g_ctx.pClientData = NULL; 639 } 640 641 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats) 642 { 643 AssertPtrReturnVoid(pClientData); 644 AssertPtrReturnVoid(pClientData->State.pCtx); 645 645 646 646 /* 647 647 * The guest announces formats. Forward to the window thread. 648 648 */ 649 PostMessage(p SvcCtx->pCtx->Win.hWnd, WM_USER, 0, u32Formats);649 PostMessage(pClientData->State.pCtx->Win.hWnd, WM_USER, 0, u32Formats); 650 650 } 651 651 … … 682 682 #endif 683 683 684 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual)685 { 686 AssertPtrReturn(p SvcCtx, VERR_INVALID_POINTER);687 AssertPtrReturn(p SvcCtx->pCtx, VERR_INVALID_POINTER);684 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual) 685 { 686 AssertPtrReturn(pClientData, VERR_INVALID_POINTER); 687 AssertPtrReturn(pClientData->State.pCtx, VERR_INVALID_POINTER); 688 688 689 689 LogFlowFunc(("u32Format=%02X\n", u32Format)); … … 691 691 HANDLE hClip = NULL; 692 692 693 const PVBOXCLIPBOARDWINCTX pWinCtx = &p SvcCtx->pCtx->Win;693 const PVBOXCLIPBOARDWINCTX pWinCtx = &pClientData->State.pCtx->Win; 694 694 695 695 /* … … 816 816 } 817 817 818 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARD SVCCTX pSvcCtx, void *pv, uint32_t cb, uint32_t u32Format)818 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, void *pv, uint32_t cb, uint32_t u32Format) 819 819 { 820 820 LogFlowFuncEnter(); … … 823 823 * The guest returns data that was requested in the WM_RENDERFORMAT handler. 824 824 */ 825 Assert(p SvcCtx->data.pv == NULL && pSvcCtx->data.cb == 0 && pSvcCtx->data.u32Format == 0);825 Assert(pClientData->data.pv == NULL && pClientData->data.cb == 0 && pClientData->data.u32Format == 0); 826 826 827 827 vboxClipboardDump(pv, cb, u32Format); … … 841 841 if (pszResult != NULL && cbResult != 0) 842 842 { 843 p SvcCtx->data.pv = pszResult;844 p SvcCtx->data.cb = cbResult;845 p SvcCtx->data.u32Format = u32Format;843 pClientData->data.pv = pszResult; 844 pClientData->data.cb = cbResult; 845 pClientData->data.u32Format = u32Format; 846 846 } 847 847 } … … 849 849 else 850 850 { 851 p SvcCtx->data.pv = RTMemDup(pv, cb);852 if (p SvcCtx->data.pv)853 { 854 p SvcCtx->data.cb = cb;855 p SvcCtx->data.u32Format = u32Format;856 } 857 } 858 } 859 860 AssertPtr(p SvcCtx->pCtx);861 int rc = RTSemEventSignal(p SvcCtx->pCtx->hRenderEvent);851 pClientData->data.pv = RTMemDup(pv, cb); 852 if (pClientData->data.pv) 853 { 854 pClientData->data.cb = cb; 855 pClientData->data.u32Format = u32Format; 856 } 857 } 858 } 859 860 AssertPtr(pClientData->State.pCtx); 861 int rc = RTSemEventSignal(pClientData->State.pCtx->hRenderEvent); 862 862 AssertRC(rc); 863 863 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11-stubs.cpp
r78580 r78618 55 55 * Enable the shared clipboard - called by the hgcm clipboard subsystem. 56 56 * 57 * @param p SvcCtxStructure containing context information about the guest system58 * @param fHeadless Whether headless.57 * @param pClientData Structure containing context information about the guest system 58 * @param fHeadless Whether headless. 59 59 * @returns RT status code 60 60 */ 61 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARD SVCCTX pSvcCtx, bool fHeadless)61 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless) 62 62 { 63 RT_NOREF(p SvcCtx, fHeadless);63 RT_NOREF(pClientData, fHeadless); 64 64 LogFlowFunc(("called, returning VINF_SUCCESS.\n")); 65 65 return VINF_SUCCESS; … … 70 70 * after a save and restore of the guest. 71 71 */ 72 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARD SVCCTX /* pSvcCtx*/)72 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA /* pClientData */) 73 73 { 74 74 LogFlowFunc(("called, returning VINF_SUCCESS.\n")); … … 79 79 * Shut down the shared clipboard subsystem and "disconnect" the guest. 80 80 * 81 * @param p SvcCtxStructure containing context information about the guest system81 * @param pClientData Structure containing context information about the guest system 82 82 */ 83 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARD SVCCTX pSvcCtx)83 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData) 84 84 { 85 RT_NOREF(p SvcCtx);85 RT_NOREF(pClientData); 86 86 LogFlowFunc(("called, returning.\n")); 87 87 } … … 91 91 * subsystem. 92 92 * 93 * @param p SvcCtxContext data for the guest system93 * @param pClientData Context data for the guest system 94 94 * @param u32Formats Clipboard formats the guest is offering 95 95 */ 96 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Formats)96 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats) 97 97 { 98 RT_NOREF(p SvcCtx, u32Formats);98 RT_NOREF(pClientData, u32Formats); 99 99 LogFlowFunc(("called, returning.\n")); 100 100 } … … 103 103 * Called by the HGCM clipboard subsystem when the guest wants to read the host clipboard. 104 104 * 105 * @param p SvcCtxContext information about the guest VM106 * @param u32Format The format that the guest would like to receive the data in107 * @param pv Where to write the data to108 * @param cb The size of the buffer to write the data to109 * @param pcbActual Where to write the actual size of the written data105 * @param pClientData Context information about the guest VM 106 * @param u32Format The format that the guest would like to receive the data in 107 * @param pv Where to write the data to 108 * @param cb The size of the buffer to write the data to 109 * @param pcbActual Where to write the actual size of the written data 110 110 */ 111 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Format,111 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Format, 112 112 void *pv, uint32_t cb, uint32_t *pcbActual) 113 113 { 114 RT_NOREF(p SvcCtx, u32Format, pv, cb);114 RT_NOREF(pClientData, u32Format, pv, cb); 115 115 LogFlowFunc(("called, returning VINF_SUCCESS.\n")); 116 116 /* No data available. */ … … 122 122 * Called by the HGCM clipboard subsystem when we have requested data and that data arrives. 123 123 * 124 * @param p SvcCtxContext information about the guest VM125 * @param pv Buffer to which the data was written126 * @param cb The size of the data written127 * @param u32Format The format of the data written124 * @param pClientData Context information about the guest VM 125 * @param pv Buffer to which the data was written 126 * @param cb The size of the data written 127 * @param u32Format The format of the data written 128 128 */ 129 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARD SVCCTX pSvcCtx, void *pv, uint32_t cb,129 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, void *pv, uint32_t cb, 130 130 uint32_t u32Format) 131 131 { 132 RT_NOREF(p SvcCtx, pv, cb, u32Format);132 RT_NOREF(pClientData, pv, cb, u32Format); 133 133 LogFlowFunc(("called, returning.\n")); 134 134 } -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp
r78582 r78618 32 32 #include <VBox/err.h> 33 33 34 #include "VBox Clipboard.h"34 #include "VBoxSharedClipboardSvc-internal.h" 35 35 36 36 … … 59 59 CLIPBACKEND *pBackend; 60 60 /** Pointer to the VBox host client data structure. */ 61 PVBOXCLIPBOARD SVCCTX pSvcCtx;61 PVBOXCLIPBOARDCLIENTDATA pClientData; 62 62 /** We set this when we start shutting down as a hint not to post any new 63 63 * requests. */ … … 75 75 void ClipReportX11Formats(VBOXCLIPBOARDCONTEXT *pCtx, uint32_t u32Formats) 76 76 { 77 LogRelFlowFunc(("called. pCtx=%p, u32Formats=%02X\n", pCtx, u32Formats)); 78 vboxSvcClipboardReportMsg(pCtx->pSvcCtx, 79 VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, 80 u32Formats); 77 LogFlowFunc(("pCtx=%p, u32Formats=%02X\n", pCtx, u32Formats)); 78 79 vboxSvcClipboardReportMsg(pCtx->pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, u32Formats); 81 80 } 82 81 … … 105 104 * the clipboard and leave ownership to X11. 106 105 */ 107 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARD SVCCTX pSvcCtx, bool fHeadless)106 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA pClientData, bool fHeadless) 108 107 { 109 108 int rc = VINF_SUCCESS; 110 CLIPBACKEND *pBackend = NULL;111 109 112 110 LogRel(("Starting host clipboard service\n")); 113 VBOXCLIPBOARDCONTEXT *pCtx = (VBOXCLIPBOARDCONTEXT *)RTMemAllocZ(sizeof(VBOXCLIPBOARDCONTEXT)); 111 112 PVBOXCLIPBOARDCONTEXT pCtx = (PVBOXCLIPBOARDCONTEXT)RTMemAllocZ(sizeof(VBOXCLIPBOARDCONTEXT)); 114 113 if (!pCtx) 114 { 115 115 rc = VERR_NO_MEMORY; 116 } 116 117 else 117 118 { 118 119 RTCritSectInit(&pCtx->clipboardMutex); 119 pBackend = ClipConstructX11(pCtx, fHeadless); 120 if (pBackend == NULL) 120 CLIPBACKEND *pBackend = ClipConstructX11(pCtx, fHeadless); 121 if (!pBackend) 122 { 121 123 rc = VERR_NO_MEMORY; 124 } 122 125 else 123 126 { 124 127 pCtx->pBackend = pBackend; 125 pSvcCtx->pCtx = pCtx; 126 pCtx->pSvcCtx = pSvcCtx; 128 pClientData->State.pCtx = pCtx; 129 pCtx->pClientData = pClientData; 130 127 131 rc = ClipStartX11(pBackend, true /* grab shared clipboard */); 132 if (RT_FAILURE(rc)) 133 ClipDestructX11(pBackend); 128 134 } 135 129 136 if (RT_FAILURE(rc)) 137 { 130 138 RTCritSectDelete(&pCtx->clipboardMutex); 131 } 139 RTMemFree(pCtx); 140 } 141 } 142 132 143 if (RT_FAILURE(rc)) 133 { 134 RTMemFree(pCtx); 135 LogRel(("Failed to initialise the shared clipboard\n")); 136 } 137 LogRelFlowFunc(("returning %Rrc\n", rc)); 144 LogRel(("Failed to initialize the Shared Clipboard host service, rc=%Rrc\n", rc)); 145 146 LogFlowFunc(("returning %Rrc\n", rc)); 138 147 return rc; 139 148 } … … 144 153 * @note Host glue code 145 154 */ 146 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARD SVCCTX pSvcCtx)155 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA pClientData) 147 156 { 148 157 /* Tell the guest we have no data in case X11 is not available. If 149 158 * there is data in the host clipboard it will automatically be sent to 150 159 * the guest when the clipboard starts up. */ 151 vboxSvcClipboardReportMsg(p SvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, 0);152 /** @todo r=andy Check rc code. */ 153 return VINF_SUCCESS; 160 vboxSvcClipboardReportMsg(pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, 0); 161 162 return VINF_SUCCESS; /** @todo r=andy Check rc code. */ 154 163 } 155 164 … … 158 167 * @note Host glue code 159 168 */ 160 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARD SVCCTX pSvcCtx)161 { 162 Log RelFlow(("vboxClipboardDisconnect\n"));169 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA pClientData) 170 { 171 LogFlowFuncEnter(); 163 172 164 173 LogRel(("Stopping the host clipboard service\n")); 165 VBOXCLIPBOARDCONTEXT *pCtx = pSvcCtx->pCtx; 174 175 PVBOXCLIPBOARDCONTEXT pCtx = pClientData->State.pCtx; 176 166 177 /* Drop the reference to the client, in case it is still there. This 167 178 * will cause any outstanding clipboard data requests from X11 to fail 168 179 * immediately. */ 169 180 pCtx->fShuttingDown = true; 181 170 182 /* If there is a currently pending request, release it immediately. */ 171 VBoxClipboardSvcImplWriteData(pSvcCtx, NULL, 0, 0); 183 VBoxClipboardSvcImplWriteData(pClientData, NULL, 0, 0); 184 172 185 int rc = ClipStopX11(pCtx->pBackend); 173 186 /** @todo handle this slightly more reasonably, or be really sure 174 187 * it won't go wrong. */ 175 188 AssertRC(rc); 189 176 190 if (RT_SUCCESS(rc)) /* And if not? */ 177 191 { … … 185 199 * VBox is taking possession of the shared clipboard. 186 200 * 187 * @param p SvcCtxContext data for the guest system201 * @param pClientData Context data for the guest system 188 202 * @param u32Formats Clipboard formats the guest is offering 189 203 * @note Host glue code 190 204 */ 191 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Formats)192 { 193 Log RelFlowFunc(("called. pSvcCtx=%p, u32Formats=%02X\n", pSvcCtx, u32Formats));194 195 ClipAnnounceFormatToX11(p SvcCtx->pCtx->pBackend, u32Formats);205 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Formats) 206 { 207 LogFlowFunc(("pClientData=%p, u32Formats=%02X\n", pClientData, u32Formats)); 208 209 ClipAnnounceFormatToX11(pClientData->State.pCtx->pBackend, u32Formats); 196 210 } 197 211 … … 214 228 * asynchronously 215 229 * @returns iprt status code on failure 216 * @param p SvcCtxContext information about the guest VM217 * @param u32Format The format that the guest would like to receive the data in218 * @param pv Where to write the data to219 * @param cb The size of the buffer to write the data to230 * @param pClientData Context information about the guest VM 231 * @param u32Format The format that the guest would like to receive the data in 232 * @param pv Where to write the data to 233 * @param cb The size of the buffer to write the data to 220 234 * @param pcbActual Where to write the actual size of the written data 235 * 221 236 * @note We always fail or complete asynchronously 222 237 * @note On success allocates a CLIPREADCBREQ structure which must be … … 225 240 * 226 241 */ 227 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDSVCCTX pSvcCtx, 228 uint32_t u32Format, void *pv, uint32_t cb, 229 uint32_t *pcbActual) 230 { 231 LogRelFlowFunc(("pSvcCtx=%p, u32Format=%02X, pv=%p, cb=%u, pcbActual=%p", 232 pSvcCtx, u32Format, pv, cb, pcbActual)); 242 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, 243 uint32_t u32Format, void *pv, uint32_t cb, uint32_t *pcbActual) 244 { 245 LogFlowFunc(("pClientData=%p, u32Format=%02X, pv=%p, cb=%u, pcbActual=%p\n", 246 pClientData, u32Format, pv, cb, pcbActual)); 233 247 234 248 int rc = VINF_SUCCESS; 235 249 CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)RTMemAlloc(sizeof(CLIPREADCBREQ)); 236 250 if (!pReq) 251 { 237 252 rc = VERR_NO_MEMORY; 253 } 238 254 else 239 255 { … … 241 257 pReq->cb = cb; 242 258 pReq->pcbActual = pcbActual; 243 rc = ClipRequestDataFromX11(p SvcCtx->pCtx->pBackend, u32Format, pReq);259 rc = ClipRequestDataFromX11(pClientData->State.pCtx->pBackend, u32Format, pReq); 244 260 if (RT_SUCCESS(rc)) 245 261 rc = VINF_HGCM_ASYNC_EXECUTE; 246 262 } 247 LogRelFlowFunc(("returning %Rrc\n", rc)); 263 264 LogFlowFuncLeaveRC(rc); 248 265 return rc; 249 266 } … … 269 286 RTMemFree(pReq); 270 287 271 vboxSvcClipboardCompleteReadData(pCtx->p SvcCtx, rc, cb);288 vboxSvcClipboardCompleteReadData(pCtx->pClientData, rc, cb); 272 289 } 273 290 … … 292 309 int rc = VINF_SUCCESS; 293 310 294 Log RelFlowFunc(("pCtx=%p, pReq=%p, u32Format=%02X\n", pCtx, pReq, u32Format));311 LogFlowFunc(("pCtx=%p, pReq=%p, u32Format=%02X\n", pCtx, pReq, u32Format)); 295 312 296 313 /* Request data from VBox */ 297 vboxSvcClipboardReportMsg(pCtx->p SvcCtx,314 vboxSvcClipboardReportMsg(pCtx->pClientData, 298 315 VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, 299 316 u32Format); … … 302 319 */ 303 320 rc = RTSemEventWait(pReq->finished, CLIPBOARD_TIMEOUT); 321 304 322 /* If the request hasn't yet completed then we cancel it. We use 305 323 * the critical section to prevent these operations colliding. */ 306 324 RTCritSectEnter(&pCtx->clipboardMutex); 325 307 326 /* The data may have arrived between the semaphore timing out and 308 327 * our grabbing the mutex. */ … … 312 331 pCtx->pReq = NULL; 313 332 Assert(pCtx->pReq == NULL); 333 314 334 RTCritSectLeave(&pCtx->clipboardMutex); 335 315 336 if (RT_SUCCESS(rc) && (pReq->pv == NULL)) 316 337 rc = VERR_NO_DATA; 317 LogRelFlowFunc(("returning %Rrc\n", rc)); 338 339 LogFlowFuncLeaveRC(rc); 318 340 return rc; 319 341 } … … 325 347 int rc = VINF_SUCCESS; 326 348 327 Log RelFlowFunc(("pCtx=%p, pReq=%p, u32Format=%02X\n", pCtx, pReq, u32Format));349 LogFlowFunc(("pCtx=%p, pReq=%p, u32Format=%02X\n", pCtx, pReq, u32Format)); 328 350 329 351 /* Start by "posting" the request for the next invocation of 330 352 * vboxClipboardWriteData. */ 331 353 RTCritSectEnter(&pCtx->clipboardMutex); 354 332 355 if (pCtx->pReq != NULL) 333 356 { … … 339 362 else 340 363 pCtx->pReq = pReq; 364 341 365 RTCritSectLeave(&pCtx->clipboardMutex); 366 342 367 if (RT_SUCCESS(rc)) 343 368 rc = clipWaitForDataFromVBox(pCtx, pReq, u32Format); 344 LogRelFlowFunc(("returning %Rrc\n", rc)); 369 370 LogFlowFuncLeaveRC(rc); 345 371 return rc; 346 372 } … … 361 387 VBOXCLIPBOARDREQFROMVBOX request = { NULL, 0, 0, NIL_RTSEMEVENT }; 362 388 363 Log RelFlowFunc(("pCtx=%p, u32Format=%02X, ppv=%p, pcb=%p\n", pCtx, u32Format, ppv, pcb));389 LogFlowFunc(("pCtx=%p, u32Format=%02X, ppv=%p, pcb=%p\n", pCtx, u32Format, ppv, pcb)); 364 390 365 391 if (pCtx->fShuttingDown) 366 392 { 367 393 /* The shared clipboard is disconnecting. */ 368 LogRel Func(("host requested guest clipboard data after guest had disconnected.\n"));394 LogRel(("Clipboard: Host requested guest clipboard data after guest had disconnected\n")); 369 395 return VERR_WRONG_ORDER; 370 396 } 397 371 398 int rc = RTSemEventCreate(&request.finished); 372 399 if (RT_SUCCESS(rc)) … … 382 409 } 383 410 384 LogRelFlowFunc(("returning %Rrc\n", rc)); 385 386 if (RT_SUCCESS(rc)) 387 LogRelFlowFunc(("*ppv=%.*ls, *pcb=%u\n",*pcb / 2,*ppv,*pcb)); 388 411 LogFlowFuncLeaveRC(rc); 389 412 return rc; 390 413 } … … 393 416 * Called when we have requested data from VBox and that data has arrived. 394 417 * 395 * @param p SvcCtxContext information about the guest VM396 * @param pv Buffer to which the data was written397 * @param cb The size of the data written398 * @param u32Format The format of the data written418 * @param pClientData Context information about the guest VM 419 * @param pv Buffer to which the data was written 420 * @param cb The size of the data written 421 * @param u32Format The format of the data written 399 422 * @note Host glue code 400 423 */ 401 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDSVCCTX pSvcCtx, 402 void *pv, uint32_t cb, uint32_t u32Format) 403 { 404 LogRelFlowFunc(("called. pSvcCtx=%p, pv=%p (%.*ls), cb=%u, u32Format=%02X\n", 405 pSvcCtx, pv, cb / 2, pv, cb, u32Format)); 406 407 VBOXCLIPBOARDCONTEXT *pCtx = pSvcCtx->pCtx; 424 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA pClientData, 425 void *pv, uint32_t cb, uint32_t u32Format) 426 { 427 LogFlowFunc(("pClientData=%p, pv=%p (%.*ls), cb=%u, u32Format=%02X\n", pClientData, pv, cb / 2, pv, cb, u32Format)); 428 429 VBOXCLIPBOARDCONTEXT *pCtx = pClientData->State.pCtx; 408 430 409 431 /* Grab the mutex and check whether there is a pending request for data. */ … … 463 485 }; 464 486 465 void vboxSvcClipboardReportMsg(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Msg, uint32_t u32Formats)487 void vboxSvcClipboardReportMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Msg, uint32_t u32Formats) 466 488 { 467 489 RT_NOREF(u32Formats); 468 CLIPBACKEND *pBackend = p SvcCtx->pCtx->pBackend;490 CLIPBACKEND *pBackend = pClientData->State.pCtx->pBackend; 469 491 470 492 if ((u32Msg == VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA) 471 493 && !pBackend->writeData.timeout) 472 VBoxClipboardSvcImplWriteData(p SvcCtx, pBackend->writeData.pv,494 VBoxClipboardSvcImplWriteData(pClientData, pBackend->writeData.pv, 473 495 pBackend->writeData.cb, 474 496 pBackend->writeData.format); … … 477 499 } 478 500 479 void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARD SVCCTX pSvcCtx, int rc, uint32_t cbActual)480 { 481 CLIPBACKEND *pBackend = p SvcCtx->pCtx->pBackend;501 void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, int rc, uint32_t cbActual) 502 { 503 CLIPBACKEND *pBackend = pClientData->State.pCtx->pBackend; 482 504 pBackend->completeRead.rc = rc; 483 505 pBackend->completeRead.cbActual = cbActual; … … 523 545 int main() 524 546 { 525 VBOXCLIPBOARD SVCCTXclient;547 VBOXCLIPBOARDCLIENTDATA client; 526 548 unsigned cErrors = 0; 527 549 int rc = RTR3InitExeNoArguments(0); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r78581 r78618 85 85 #include <VBox/vmm/ssm.h> 86 86 87 #include "VBox Clipboard.h"87 #include "VBoxSharedClipboardSvc-internal.h" 88 88 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 89 89 # include "VBoxSharedClipboardSvc-uri.h" … … 96 96 static PVBOXHGCMSVCHELPERS g_pHelpers; 97 97 98 static RTCRITSECT critsect;99 static uint32_t g_u 32Mode;98 static RTCRITSECT g_CritSect; 99 static uint32_t g_uMode; 100 100 101 101 static PFNHGCMSVCEXT g_pfnExtension; 102 102 static void *g_pvExtension; 103 103 104 static PVBOXCLIPBOARD SVCCTX g_pSvcCtx;104 static PVBOXCLIPBOARDCLIENTDATA g_pClientData; 105 105 106 106 /* Serialization of data reading and format announcements from the RDP client. */ … … 151 151 } 152 152 153 154 static uint32_t vboxSvcClipboardMode(void) 155 { 156 return g_u32Mode; 153 uint32_t vboxSvcClipboardGetMode(void) 154 { 155 return g_uMode; 157 156 } 158 157 … … 161 160 uint32_t TestClipSvcGetMode(void) 162 161 { 163 return vboxSvcClipboard Mode();162 return vboxSvcClipboardGetMode(); 164 163 } 165 164 #endif … … 179 178 case VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST: 180 179 case VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL: 181 g_u 32Mode = u32Mode;180 g_uMode = u32Mode; 182 181 break; 183 182 184 183 default: 185 g_u 32Mode = VBOX_SHARED_CLIPBOARD_MODE_OFF;184 g_uMode = VBOX_SHARED_CLIPBOARD_MODE_OFF; 186 185 } 187 186 } … … 189 188 bool VBoxSvcClipboardLock(void) 190 189 { 191 return RT_SUCCESS(RTCritSectEnter(& critsect));190 return RT_SUCCESS(RTCritSectEnter(&g_CritSect)); 192 191 } 193 192 194 193 void VBoxSvcClipboardUnlock(void) 195 194 { 196 RTCritSectLeave(&critsect); 195 int rc2 = RTCritSectLeave(&g_CritSect); 196 AssertRC(rc2); 197 197 } 198 198 … … 200 200 * Executed under the clipboard lock. 201 201 */ 202 static bool vboxSvcClipboardReturnMsg(PVBOXCLIPBOARD SVCCTX pSvcCtx, VBOXHGCMSVCPARM paParms[])202 static bool vboxSvcClipboardReturnMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, VBOXHGCMSVCPARM paParms[]) 203 203 { 204 204 /* Message priority is taken into account. */ 205 if (p SvcCtx->fHostMsgQuit)205 if (pClientData->State.fHostMsgQuit) 206 206 { 207 207 LogFlowFunc(("vboxSvcClipboardReturnMsg: Quit\n")); 208 208 VBoxHGCMParmUInt32Set(&paParms[0], VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT); 209 209 VBoxHGCMParmUInt32Set(&paParms[1], 0); 210 p SvcCtx->fHostMsgQuit = false;211 } 212 else if (p SvcCtx->fHostMsgReadData)210 pClientData->State.fHostMsgQuit = false; 211 } 212 else if (pClientData->State.fHostMsgReadData) 213 213 { 214 214 uint32_t fFormat = 0; 215 215 216 LogFlowFunc(("vboxSvcClipboardReturnMsg: ReadData %02X\n", p SvcCtx->u32RequestedFormat));217 if (p SvcCtx->u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT)216 LogFlowFunc(("vboxSvcClipboardReturnMsg: ReadData %02X\n", pClientData->State.u32RequestedFormat)); 217 if (pClientData->State.u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) 218 218 fFormat = VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT; 219 else if (p SvcCtx->u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_BITMAP)219 else if (pClientData->State.u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_BITMAP) 220 220 fFormat = VBOX_SHARED_CLIPBOARD_FMT_BITMAP; 221 else if (p SvcCtx->u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_HTML)221 else if (pClientData->State.u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_HTML) 222 222 fFormat = VBOX_SHARED_CLIPBOARD_FMT_HTML; 223 223 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 224 else if (p SvcCtx->u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_URI_LIST)224 else if (pClientData->State.u32RequestedFormat & VBOX_SHARED_CLIPBOARD_FMT_URI_LIST) 225 225 fFormat = VBOX_SHARED_CLIPBOARD_FMT_URI_LIST; 226 226 #endif … … 228 228 { 229 229 LogRel2(("Clipboard: Unsupported format from guest (0x%x), skipping\n", fFormat)); 230 p SvcCtx->u32RequestedFormat = 0;230 pClientData->State.u32RequestedFormat = 0; 231 231 } 232 p SvcCtx->u32RequestedFormat &= ~fFormat;232 pClientData->State.u32RequestedFormat &= ~fFormat; 233 233 VBoxHGCMParmUInt32Set(&paParms[0], VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA); 234 234 VBoxHGCMParmUInt32Set(&paParms[1], fFormat); 235 if (p SvcCtx->u32RequestedFormat == 0)236 p SvcCtx->fHostMsgReadData = false;237 } 238 else if (p SvcCtx->fHostMsgFormats)239 { 240 LogFlowFunc(("vboxSvcClipboardReturnMsg: Formats %02X\n", p SvcCtx->u32AvailableFormats));235 if (pClientData->State.u32RequestedFormat == 0) 236 pClientData->State.fHostMsgReadData = false; 237 } 238 else if (pClientData->State.fHostMsgFormats) 239 { 240 LogFlowFunc(("vboxSvcClipboardReturnMsg: Formats %02X\n", pClientData->State.u32AvailableFormats)); 241 241 VBoxHGCMParmUInt32Set(&paParms[0], VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS); 242 VBoxHGCMParmUInt32Set(&paParms[1], p SvcCtx->u32AvailableFormats);243 p SvcCtx->fHostMsgFormats = false;242 VBoxHGCMParmUInt32Set(&paParms[1], pClientData->State.u32AvailableFormats); 243 pClientData->State.fHostMsgFormats = false; 244 244 } 245 245 else … … 254 254 } 255 255 256 void vboxSvcClipboardReportMsg(PVBOXCLIPBOARD SVCCTX pSvcCtx, uint32_t u32Msg, uint32_t u32Formats)257 { 258 AssertPtrReturnVoid(p SvcCtx);256 void vboxSvcClipboardReportMsg(PVBOXCLIPBOARDCLIENTDATA pClientData, uint32_t u32Msg, uint32_t u32Formats) 257 { 258 AssertPtrReturnVoid(pClientData); 259 259 260 260 if (VBoxSvcClipboardLock()) … … 265 265 { 266 266 LogFlowFunc(("Quit\n")); 267 p SvcCtx->fHostMsgQuit = true;267 pClientData->State.fHostMsgQuit = true; 268 268 } break; 269 269 case VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA: 270 270 { 271 if ( vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST272 && vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL)271 if ( vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST 272 && vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL) 273 273 { 274 274 /* Skip the message. */ … … 277 277 278 278 LogFlowFunc(("ReadData %02X\n", u32Formats)); 279 p SvcCtx->u32RequestedFormat = u32Formats;280 p SvcCtx->fHostMsgReadData = true;279 pClientData->State.u32RequestedFormat = u32Formats; 280 pClientData->State.fHostMsgReadData = true; 281 281 } break; 282 282 case VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS: 283 283 { 284 if ( vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST285 && vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL)284 if ( vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST 285 && vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL) 286 286 { 287 287 /* Skip the message. */ … … 290 290 291 291 LogFlowFunc(("Formats %02X\n", u32Formats)); 292 p SvcCtx->u32AvailableFormats = u32Formats;293 p SvcCtx->fHostMsgFormats = true;292 pClientData->State.u32AvailableFormats = u32Formats; 293 pClientData->State.fHostMsgFormats = true; 294 294 } break; 295 295 default: … … 300 300 } 301 301 302 if (p SvcCtx->fAsync)302 if (pClientData->State.fAsync) 303 303 { 304 304 /* The client waits for a response. */ 305 bool fMessageReturned = vboxSvcClipboardReturnMsg(p SvcCtx, pSvcCtx->async.paParms);305 bool fMessageReturned = vboxSvcClipboardReturnMsg(pClientData, pClientData->State.async.paParms); 306 306 307 307 /* Make a copy of the handle. */ 308 VBOXHGCMCALLHANDLE callHandle = p SvcCtx->async.callHandle;308 VBOXHGCMCALLHANDLE callHandle = pClientData->State.async.callHandle; 309 309 310 310 if (fMessageReturned) 311 311 { 312 312 /* There is a response. */ 313 p SvcCtx->fAsync = false;313 pClientData->State.fAsync = false; 314 314 } 315 315 … … 331 331 static int svcInit(void) 332 332 { 333 int rc = RTCritSectInit(& critsect);333 int rc = RTCritSectInit(&g_CritSect); 334 334 335 335 if (RT_SUCCESS(rc)) … … 344 344 if (RT_FAILURE(rc)) 345 345 { 346 RTCritSectDelete(& critsect);346 RTCritSectDelete(&g_CritSect); 347 347 } 348 348 } … … 354 354 { 355 355 VBoxClipboardSvcImplDestroy(); 356 RTCritSectDelete(& critsect);356 RTCritSectDelete(&g_CritSect); 357 357 return VINF_SUCCESS; 358 358 } … … 366 366 RT_NOREF(u32ClientID); 367 367 368 PVBOXCLIPBOARD SVCCTX pSvcCtx = (PVBOXCLIPBOARDSVCCTX)pvClient;368 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pvClient; 369 369 370 370 LogFunc(("u32ClientID = %d\n", u32ClientID)); 371 371 372 vboxSvcClipboardReportMsg(pSvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT, 0); 373 374 vboxSvcClipboardCompleteReadData(pSvcCtx, VERR_NO_DATA, 0); 375 376 VBoxClipboardSvcImplDisconnect(pSvcCtx); 377 378 memset(pSvcCtx, 0, sizeof(*pSvcCtx)); 379 380 g_pSvcCtx = NULL; 372 vboxSvcClipboardReportMsg(pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT, 0); 373 374 vboxSvcClipboardCompleteReadData(pClientData, VERR_NO_DATA, 0); 375 376 #ifdef VBOX_VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 377 vboxClipboardSvcURIDestroy(&pClientData->URI); 378 #endif 379 380 VBoxClipboardSvcImplDisconnect(pClientData); 381 382 g_pClientData = NULL; 381 383 382 384 return VINF_SUCCESS; … … 386 388 { 387 389 RT_NOREF(fRequestor, fRestoring); 388 PVBOXCLIPBOARDSVCCTX pSvcCtx = (PVBOXCLIPBOARDSVCCTX)pvClient; 389 390 int rc = VINF_SUCCESS; 390 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pvClient; 391 391 392 392 /* If there is already a client connected then we want to release it first. */ 393 if (g_pSvcCtx != NULL) 394 { 395 uint32_t u32OldClientID = g_pSvcCtx->u32ClientID; 396 397 svcDisconnect(NULL, u32OldClientID, g_pSvcCtx); 393 if (g_pClientData != NULL) 394 { 395 uint32_t u32OldClientID = g_pClientData->State.u32ClientID; 396 397 svcDisconnect(NULL, u32OldClientID, g_pClientData); 398 398 399 /* And free the resources in the hgcm subsystem. */ 399 400 g_pHelpers->pfnDisconnectClient(g_pHelpers->pvInstance, u32OldClientID); 400 401 } 401 402 402 /* Register the client. */ 403 memset(pSvcCtx, 0, sizeof(*pSvcCtx)); 404 405 pSvcCtx->u32ClientID = u32ClientID; 406 407 rc = VBoxClipboardSvcImplConnect(pSvcCtx, VBoxSvcClipboardGetHeadless()); 408 403 /* Register the client. 404 * Note: Do *not* memset the struct, as it contains classes (for caching). */ 405 pClientData->State.u32ClientID = u32ClientID; 406 407 int rc = VBoxClipboardSvcImplConnect(pClientData, VBoxSvcClipboardGetHeadless()); 408 #ifdef VBOX_VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 409 409 if (RT_SUCCESS(rc)) 410 { 411 g_pSvcCtx = pSvcCtx; 410 rc = vboxClipboardSvcURICreate(&pClientData->URI); 411 #endif 412 413 if (RT_SUCCESS(rc)) 414 { 415 g_pClientData = pClientData; 412 416 } 413 417 … … 431 435 u32ClientID, u32Function, cParms, paParms)); 432 436 433 PVBOXCLIPBOARD SVCCTX pSvcCtx = (PVBOXCLIPBOARDSVCCTX)pvClient;437 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pvClient; 434 438 435 439 bool fAsynchronousProcessing = false; … … 467 471 if (VBoxSvcClipboardLock()) 468 472 { 469 bool fMessageReturned = vboxSvcClipboardReturnMsg (p SvcCtx, paParms);473 bool fMessageReturned = vboxSvcClipboardReturnMsg (pClientData, paParms); 470 474 471 475 if (fMessageReturned) 472 476 { 473 477 /* Just return to the caller. */ 474 p SvcCtx->fAsync = false;478 pClientData->State.fAsync = false; 475 479 } 476 480 else … … 479 483 fAsynchronousProcessing = true; 480 484 481 p SvcCtx->fAsync = true;482 p SvcCtx->async.callHandle = callHandle;483 p SvcCtx->async.paParms = paParms;485 pClientData->State.fAsync = true; 486 pClientData->State.async.callHandle = callHandle; 487 pClientData->State.async.paParms = paParms; 484 488 485 489 LogFunc(("async.\n")); … … 517 521 if (RT_SUCCESS (rc)) 518 522 { 519 if ( vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST520 && vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL)523 if ( vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST 524 && vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL) 521 525 { 522 526 rc = VERR_NOT_SUPPORTED; … … 534 538 else 535 539 { 536 VBoxClipboardSvcImplFormatAnnounce (p SvcCtx, u32Formats);540 VBoxClipboardSvcImplFormatAnnounce (pClientData, u32Formats); 537 541 } 538 542 } … … 570 574 if (RT_SUCCESS (rc)) 571 575 { 572 if ( vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST573 && vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL)576 if ( vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_HOST_TO_GUEST 577 && vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL) 574 578 { 575 579 rc = VERR_NOT_SUPPORTED; … … 592 596 if (g_fDelayedAnnouncement) 593 597 { 594 vboxSvcClipboardReportMsg (g_p SvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, g_u32DelayedFormats);598 vboxSvcClipboardReportMsg (g_pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, g_u32DelayedFormats); 595 599 g_fDelayedAnnouncement = false; 596 600 g_u32DelayedFormats = 0; … … 607 611 /* Release any other pending read, as we only 608 612 * support one pending read at one time. */ 609 vboxSvcClipboardCompleteReadData(p SvcCtx, VERR_NO_DATA, 0);610 rc = VBoxClipboardSvcImplReadData (p SvcCtx, u32Format, pv, cb, &cbActual);613 vboxSvcClipboardCompleteReadData(pClientData, VERR_NO_DATA, 0); 614 rc = VBoxClipboardSvcImplReadData (pClientData, u32Format, pv, cb, &cbActual); 611 615 } 612 616 … … 618 622 if (VBoxSvcClipboardLock()) 619 623 { 620 p SvcCtx->asyncRead.callHandle = callHandle;621 p SvcCtx->asyncRead.paParms = paParms;622 p SvcCtx->fReadPending = true;624 pClientData->State.asyncRead.callHandle = callHandle; 625 pClientData->State.asyncRead.paParms = paParms; 626 pClientData->State.fReadPending = true; 623 627 fAsynchronousProcessing = true; 624 628 VBoxSvcClipboardUnlock(); … … 665 669 if (RT_SUCCESS (rc)) 666 670 { 667 if ( vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST668 && vboxSvcClipboard Mode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL)671 if ( vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_GUEST_TO_HOST 672 && vboxSvcClipboardGetMode () != VBOX_SHARED_CLIPBOARD_MODE_BIDIRECTIONAL) 669 673 { 670 674 rc = VERR_NOT_SUPPORTED; … … 684 688 else 685 689 { 686 VBoxClipboardSvcImplWriteData (p SvcCtx, pv, cb, u32Format);690 VBoxClipboardSvcImplWriteData (pClientData, pv, cb, u32Format); 687 691 } 688 692 } … … 713 717 * then complete it, otherwise return. See the protocol description in the 714 718 * shared clipboard module description. */ 715 void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARD SVCCTX pSvcCtx, int rc, uint32_t cbActual)719 void vboxSvcClipboardCompleteReadData(PVBOXCLIPBOARDCLIENTDATA pClientData, int rc, uint32_t cbActual) 716 720 { 717 721 VBOXHGCMCALLHANDLE callHandle = NULL; … … 720 724 if (VBoxSvcClipboardLock()) /* if not can we do anything useful? */ 721 725 { 722 callHandle = p SvcCtx->asyncRead.callHandle;723 paParms = p SvcCtx->asyncRead.paParms;724 fReadPending = p SvcCtx->fReadPending;725 p SvcCtx->fReadPending = false;726 callHandle = pClientData->State.asyncRead.callHandle; 727 paParms = pClientData->State.asyncRead.paParms; 728 fReadPending = pClientData->State.fReadPending; 729 pClientData->State.fReadPending = false; 726 730 VBoxSvcClipboardUnlock(); 727 731 } … … 804 808 static SSMFIELD const g_aClipboardClientDataFields[] = 805 809 { 806 SSMFIELD_ENTRY(VBOXCLIPBOARD SVCCTX, u32ClientID), /* for validation purposes */807 SSMFIELD_ENTRY(VBOXCLIPBOARD SVCCTX, fHostMsgQuit),808 SSMFIELD_ENTRY(VBOXCLIPBOARD SVCCTX, fHostMsgReadData),809 SSMFIELD_ENTRY(VBOXCLIPBOARD SVCCTX, fHostMsgFormats),810 SSMFIELD_ENTRY(VBOXCLIPBOARD SVCCTX, u32RequestedFormat),810 SSMFIELD_ENTRY(VBOXCLIPBOARDCLIENTSTATE, u32ClientID), /* for validation purposes */ 811 SSMFIELD_ENTRY(VBOXCLIPBOARDCLIENTSTATE, fHostMsgQuit), 812 SSMFIELD_ENTRY(VBOXCLIPBOARDCLIENTSTATE, fHostMsgReadData), 813 SSMFIELD_ENTRY(VBOXCLIPBOARDCLIENTSTATE, fHostMsgFormats), 814 SSMFIELD_ENTRY(VBOXCLIPBOARDCLIENTSTATE, u32RequestedFormat), 811 815 SSMFIELD_ENTRY_TERM() 812 816 }; … … 826 830 LogFunc(("u32ClientID = %d\n", u32ClientID)); 827 831 828 PVBOXCLIPBOARD SVCCTX pSvcCtx = (PVBOXCLIPBOARDSVCCTX)pvClient;832 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pvClient; 829 833 830 834 /* This field used to be the length. We're using it as a version field 831 835 with the high bit set. */ 832 836 SSMR3PutU32(pSSM, UINT32_C(0x80000002)); 833 int rc = SSMR3PutStructEx(pSSM, p SvcCtx, sizeof(*pSvcCtx), 0 /*fFlags*/, &g_aClipboardClientDataFields[0], NULL);837 int rc = SSMR3PutStructEx(pSSM, pClientData, sizeof(*pClientData), 0 /*fFlags*/, &g_aClipboardClientDataFields[0], NULL); 834 838 AssertRCReturn(rc, rc); 835 839 … … 840 844 } 841 845 842 /**843 * This structure corresponds to the original layout of the844 * VBOXCLIPBOARDCLIENTDATA structure. As the structure was saved as a whole845 * when saving state, we need to remember it forever in order to preserve846 * compatibility.847 *848 * (Starting with 3.1 this is no longer used.)849 *850 * @remarks Putting this outside svcLoadState to avoid visibility warning caused851 * by -Wattributes.852 */853 typedef struct CLIPSAVEDSTATEDATA854 {855 struct CLIPSAVEDSTATEDATA *pNext;856 struct CLIPSAVEDSTATEDATA *pPrev;857 858 VBOXCLIPBOARDCONTEXT *pCtx;859 860 uint32_t u32ClientID;861 862 bool fAsync: 1; /* Guest is waiting for a message. */863 864 bool fHostMsgQuit: 1;865 bool fHostMsgReadData: 1;866 bool fHostMsgFormats: 1;867 868 struct869 {870 VBOXHGCMCALLHANDLE callHandle;871 VBOXHGCMSVCPARM *paParms;872 } async;873 874 struct875 {876 void *pv;877 uint32_t cb;878 uint32_t u32Format;879 } data;880 881 uint32_t u32AvailableFormats;882 uint32_t u32RequestedFormat;883 884 } CLIPSAVEDSTATEDATA;885 886 846 static DECLCALLBACK(int) svcLoadState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM, uint32_t uVersion) 887 847 { … … 891 851 LogFunc(("u32ClientID = %d\n", u32ClientID)); 892 852 893 PVBOXCLIPBOARDSVCCTX pSvcCtx = (PVBOXCLIPBOARDSVCCTX)pvClient; 853 PVBOXCLIPBOARDCLIENTDATA pClientData = (PVBOXCLIPBOARDCLIENTDATA)pvClient; 854 AssertPtr(pClientData); 894 855 895 856 /* Existing client can not be in async state yet. */ 896 Assert(!p SvcCtx->fAsync);857 Assert(!pClientData->State.fAsync); 897 858 898 859 /* Save the client ID for data validation. */ 899 860 /** @todo isn't this the same as u32ClientID? Playing safe for now... */ 900 uint32_t const u32ClientIDOld = p SvcCtx->u32ClientID;861 uint32_t const u32ClientIDOld = pClientData->State.u32ClientID; 901 862 902 863 /* Restore the client data. */ … … 906 867 if (lenOrVer == UINT32_C(0x80000002)) 907 868 { 908 rc = SSMR3GetStructEx(pSSM, p SvcCtx, sizeof(*pSvcCtx), 0 /*fFlags*/, &g_aClipboardClientDataFields[0], NULL);869 rc = SSMR3GetStructEx(pSSM, pClientData, sizeof(*pClientData), 0 /*fFlags*/, &g_aClipboardClientDataFields[0], NULL); 909 870 AssertRCReturn(rc, rc); 910 }911 else if (lenOrVer == (SSMR3HandleHostBits(pSSM) == 64 ? 72U : 48U))912 {913 /**914 * SSM descriptor table for the CLIPSAVEDSTATEDATA structure.915 */916 static SSMFIELD const s_aClipSavedStateDataFields30[] =917 {918 SSMFIELD_ENTRY_IGN_HCPTR( CLIPSAVEDSTATEDATA, pNext),919 SSMFIELD_ENTRY_IGN_HCPTR( CLIPSAVEDSTATEDATA, pPrev),920 SSMFIELD_ENTRY_IGN_HCPTR( CLIPSAVEDSTATEDATA, pCtx),921 SSMFIELD_ENTRY( CLIPSAVEDSTATEDATA, u32ClientID),922 SSMFIELD_ENTRY_CUSTOM(fMsgQuit + fMsgReadData + fMsgFormats, RT_UOFFSETOF(CLIPSAVEDSTATEDATA, u32ClientID) + 4, 4),923 SSMFIELD_ENTRY_IGN_HCPTR( CLIPSAVEDSTATEDATA, async.callHandle),924 SSMFIELD_ENTRY_IGN_HCPTR( CLIPSAVEDSTATEDATA, async.paParms),925 SSMFIELD_ENTRY_IGNORE( CLIPSAVEDSTATEDATA, data.pv),926 SSMFIELD_ENTRY_IGNORE( CLIPSAVEDSTATEDATA, data.cb),927 SSMFIELD_ENTRY_IGNORE( CLIPSAVEDSTATEDATA, data.u32Format),928 SSMFIELD_ENTRY_IGNORE( CLIPSAVEDSTATEDATA, u32AvailableFormats),929 SSMFIELD_ENTRY( CLIPSAVEDSTATEDATA, u32RequestedFormat),930 SSMFIELD_ENTRY_TERM()931 };932 933 CLIPSAVEDSTATEDATA savedState;934 RT_ZERO(savedState);935 rc = SSMR3GetStructEx(pSSM, &savedState, sizeof(savedState), SSMSTRUCT_FLAGS_MEM_BAND_AID,936 &s_aClipSavedStateDataFields30[0], NULL);937 AssertRCReturn(rc, rc);938 939 pSvcCtx->fHostMsgQuit = savedState.fHostMsgQuit;940 pSvcCtx->fHostMsgReadData = savedState.fHostMsgReadData;941 pSvcCtx->fHostMsgFormats = savedState.fHostMsgFormats;942 pSvcCtx->u32RequestedFormat = savedState.u32RequestedFormat;943 871 } 944 872 else … … 949 877 950 878 /* Verify the client ID. */ 951 if (p SvcCtx->u32ClientID != u32ClientIDOld)952 { 953 LogFunc(("Client ID mismatch: expected %d, got %d\n", u32ClientIDOld, p SvcCtx->u32ClientID));954 p SvcCtx->u32ClientID = u32ClientIDOld;879 if (pClientData->State.u32ClientID != u32ClientIDOld) 880 { 881 LogFunc(("Client ID mismatch: expected %d, got %d\n", u32ClientIDOld, pClientData->State.u32ClientID)); 882 pClientData->State.u32ClientID = u32ClientIDOld; 955 883 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 956 884 } 957 885 958 886 /* Actual host data are to be reported to guest (SYNC). */ 959 VBoxClipboardSvcImplSync(p SvcCtx);887 VBoxClipboardSvcImplSync(pClientData); 960 888 961 889 #else /* UNIT_TEST*/ … … 968 896 { 969 897 RT_NOREF2(pvData, cbData); 970 if (g_p SvcCtx!= NULL)898 if (g_pClientData != NULL) 971 899 { 972 900 switch (u32Function) … … 982 910 else 983 911 { 984 vboxSvcClipboardReportMsg (g_pSvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, u32Format);912 vboxSvcClipboardReportMsg(g_pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS, u32Format); 985 913 } 986 914 } break; … … 988 916 case VBOX_CLIPBOARD_EXT_FN_DATA_READ: 989 917 { 990 vboxSvcClipboardReportMsg (g_pSvcCtx, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, u32Format);918 vboxSvcClipboardReportMsg(g_pClientData, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, u32Format); 991 919 } break; 992 920 … … 1030 958 } 1031 959 1032 extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad 960 extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad(VBOXHGCMSVCFNTABLE *ptable) 1033 961 { 1034 962 int rc = VINF_SUCCESS; … … 1053 981 g_pHelpers = ptable->pHelpers; 1054 982 1055 ptable->cbClient = sizeof(VBOXCLIPBOARD SVCCTX);983 ptable->cbClient = sizeof(VBOXCLIPBOARDCLIENTDATA); 1056 984 1057 985 ptable->pfnUnload = svcUnload; -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp
r78580 r78618 26 26 extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *ptable); 27 27 28 static VBOXCLIPBOARD SVCCTXg_Client;28 static VBOXCLIPBOARDCLIENTDATA g_Client; 29 29 static VBOXHGCMSVCHELPERS g_Helpers = { NULL }; 30 30 … … 275 275 int VBoxClipboardSvcImplInit() { return VINF_SUCCESS; } 276 276 void VBoxClipboardSvcImplDestroy() { } 277 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARD SVCCTX) { AssertFailed(); }278 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARD SVCCTX, bool)277 void VBoxClipboardSvcImplDisconnect(PVBOXCLIPBOARDCLIENTDATA) { AssertFailed(); } 278 int VBoxClipboardSvcImplConnect(PVBOXCLIPBOARDCLIENTDATA, bool) 279 279 { AssertFailed(); return VERR_WRONG_ORDER; } 280 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARD SVCCTX, unsigned int)280 void VBoxClipboardSvcImplFormatAnnounce(PVBOXCLIPBOARDCLIENTDATA, unsigned int) 281 281 { AssertFailed(); } 282 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARD SVCCTX, unsigned int, void *, unsigned int, unsigned int *)282 int VBoxClipboardSvcImplReadData(PVBOXCLIPBOARDCLIENTDATA, unsigned int, void *, unsigned int, unsigned int *) 283 283 { AssertFailed(); return VERR_WRONG_ORDER; } 284 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARD SVCCTX, void *, unsigned int, unsigned int) { AssertFailed(); }285 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARD SVCCTX)284 void VBoxClipboardSvcImplWriteData(PVBOXCLIPBOARDCLIENTDATA, void *, unsigned int, unsigned int) { AssertFailed(); } 285 int VBoxClipboardSvcImplSync(PVBOXCLIPBOARDCLIENTDATA) 286 286 { AssertFailed(); return VERR_WRONG_ORDER; }
Note:
See TracChangeset
for help on using the changeset viewer.