VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp@ 80283

Last change on this file since 80283 was 80283, checked in by vboxsync, 6 years ago

Shared Clipboard/URI: Update; more work on root list handling.

  • Property svn:eol-style set to native
  • Property svn:keyword set to Id
  • Property svn:keywords set to Author Date Id Revision
File size: 49.1 KB
Line 
1/* $Id: VBoxGuestR3LibClipboard.cpp 80283 2019-08-15 08:47:23Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Shared Clipboard.
4 */
5
6/*
7 * Copyright (C) 2007-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28/*********************************************************************************************************************************
29* Header Files *
30*********************************************************************************************************************************/
31#include <VBox/GuestHost/SharedClipboard.h>
32#include <VBox/GuestHost/clipboard-helper.h>
33#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
34# include <VBox/GuestHost/SharedClipboard-uri.h>
35#endif
36#include <VBox/HostServices/VBoxClipboardSvc.h>
37#include <VBox/err.h>
38#include <iprt/assert.h>
39#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
40# include <iprt/dir.h>
41# include <iprt/file.h>
42# include <iprt/path.h>
43#endif
44#include <iprt/string.h>
45#include <iprt/cpp/ministring.h>
46
47#include "VBoxGuestR3LibInternal.h"
48
49
50/*********************************************************************************************************************************
51* Prototypes *
52*********************************************************************************************************************************/
53
54
55/**
56 * Connects to the clipboard service.
57 *
58 * @returns VBox status code
59 * @param pidClient Where to put the client id on success. The client id
60 * must be passed to all the other clipboard calls.
61 */
62VBGLR3DECL(int) VbglR3ClipboardConnect(HGCMCLIENTID *pidClient)
63{
64 int rc = VbglR3HGCMConnect("VBoxSharedClipboard", pidClient);
65 if (rc == VERR_HGCM_SERVICE_NOT_FOUND)
66 rc = VINF_PERMISSION_DENIED;
67
68 LogFlowFuncLeaveRC(rc);
69 return rc;
70}
71
72
73/**
74 * Disconnect from the clipboard service.
75 *
76 * @returns VBox status code.
77 * @param idClient The client id returned by VbglR3ClipboardConnect().
78 */
79VBGLR3DECL(int) VbglR3ClipboardDisconnect(HGCMCLIENTID idClient)
80{
81 return VbglR3HGCMDisconnect(idClient);
82}
83
84
85/**
86 * Get a host message, old version.
87 *
88 * Note: This is the old message which still is being used for the non-URI Shared Clipboard transfers,
89 * to not break compatibility with older additions / VBox versions.
90 *
91 * This will block until a message becomes available.
92 *
93 * @returns VBox status code.
94 * @param idClient The client id returned by VbglR3ClipboardConnect().
95 * @param pidMsg Where to store the message id.
96 * @param pfFormats Where to store the format(s) the message applies to.
97 */
98VBGLR3DECL(int) VbglR3ClipboardGetHostMsgOld(HGCMCLIENTID idClient, uint32_t *pidMsg, uint32_t *pfFormats)
99{
100 VBoxClipboardGetHostMsgOld Msg;
101
102 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,
103 VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG_OLD, VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG_OLD);
104
105 VbglHGCMParmUInt32Set(&Msg.msg, 0);
106 VbglHGCMParmUInt32Set(&Msg.formats, 0);
107
108 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
109 if (RT_SUCCESS(rc))
110 {
111 int rc2 = VbglHGCMParmUInt32Get(&Msg.msg, pidMsg);
112 if (RT_SUCCESS(rc))
113 {
114 rc2 = VbglHGCMParmUInt32Get(&Msg.formats, pfFormats);
115 if (RT_SUCCESS(rc2))
116 return rc;
117 }
118 rc = rc2;
119 }
120 *pidMsg = UINT32_MAX - 1;
121 *pfFormats = UINT32_MAX;
122 return rc;
123}
124
125
126/**
127 * Reads data from the host clipboard.
128 *
129 * @returns VBox status code.
130 * @retval VINF_BUFFER_OVERFLOW If there is more data available than the caller provided buffer space for.
131 *
132 * @param idClient The client id returned by VbglR3ClipboardConnect().
133 * @param fFormat The format we're requesting the data in.
134 * @param pv Where to store the data.
135 * @param cb The size of the buffer pointed to by pv.
136 * @param pcb The actual size of the host clipboard data. May be larger than cb.
137 */
138VBGLR3DECL(int) VbglR3ClipboardReadData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcb)
139{
140 VBoxClipboardReadDataMsg Msg;
141
142 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_READ_DATA, VBOX_SHARED_CLIPBOARD_CPARMS_READ_DATA);
143 VbglHGCMParmUInt32Set(&Msg.format, fFormat);
144 VbglHGCMParmPtrSet(&Msg.ptr, pv, cb);
145 VbglHGCMParmUInt32Set(&Msg.size, 0);
146
147 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
148 if (RT_SUCCESS(rc))
149 {
150 uint32_t cbActual;
151 int rc2 = VbglHGCMParmUInt32Get(&Msg.size, &cbActual);
152 if (RT_SUCCESS(rc2))
153 {
154 *pcb = cbActual;
155 if (cbActual > cb)
156 return VINF_BUFFER_OVERFLOW;
157 return rc;
158 }
159 rc = rc2;
160 }
161 return rc;
162}
163
164#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
165#if 0
166static int vbglR3ClipboardPeekMsg(HGCMCLIENTID idClient, uint32_t *puMsg, uint32_t *pcParms, bool fWait)
167{
168 AssertPtrReturn(puMsg, VERR_INVALID_POINTER);
169 AssertPtrReturn(pcParms, VERR_INVALID_POINTER);
170
171 VBoxClipboardPeekMsg Msg;
172 RT_ZERO(Msg);
173
174 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,
175 VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG, VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG);
176
177 Msg.uMsg.SetUInt32(0);
178 Msg.cParms.SetUInt32(0);
179 Msg.fBlock.SetUInt32(fWait ? 1 : 0);
180
181 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
182 if (RT_SUCCESS(rc))
183 {
184 rc = Msg.uMsg.GetUInt32(puMsg);
185 if (RT_SUCCESS(rc))
186 rc = Msg.cParms.GetUInt32(pcParms);
187 }
188
189 LogFlowFuncLeaveRC(rc);
190 return rc;
191}
192#else
193/**
194 * Peeks at the next host message, waiting for one to turn up.
195 *
196 * @returns VBox status code.
197 * @retval VERR_INTERRUPTED if interrupted. Does the necessary cleanup, so
198 * caller just have to repeat this call.
199 * @retval VERR_VM_RESTORED if the VM has been restored (idRestoreCheck).
200 *
201 * @param idClient The client ID returned by VbglR3GuestCtrlConnect().
202 * @param pidMsg Where to store the message id.
203 * @param pcParameters Where to store the number of parameters which will
204 * be received in a second call to the host.
205 * @param pidRestoreCheck Pointer to the VbglR3GetSessionId() variable to use
206 * for the VM restore check. Optional.
207 *
208 * @note Restore check is only performed optimally with a 6.0 host.
209 */
210static int vbglR3ClipboardMsgPeekWait(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pidMsg, uint32_t *pcParameters, uint64_t *pidRestoreCheck)
211{
212 AssertPtrReturn(pidMsg, VERR_INVALID_POINTER);
213 AssertPtrReturn(pcParameters, VERR_INVALID_POINTER);
214
215 int rc;
216
217 struct
218 {
219 VBGLIOCHGCMCALL Hdr;
220 HGCMFunctionParameter idMsg; /* Doubles as restore check on input. */
221 HGCMFunctionParameter cParameters;
222 } Msg;
223 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT, 2);
224 VbglHGCMParmUInt64Set(&Msg.idMsg, pidRestoreCheck ? *pidRestoreCheck : 0);
225 VbglHGCMParmUInt32Set(&Msg.cParameters, 0);
226 rc = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg));
227 LogRel2(("VbglR3GuestCtrlMsgPeekWait -> %Rrc\n", rc));
228 if (RT_SUCCESS(rc))
229 {
230 AssertMsgReturn( Msg.idMsg.type == VMMDevHGCMParmType_64bit
231 && Msg.cParameters.type == VMMDevHGCMParmType_32bit,
232 ("msg.type=%d num_parms.type=%d\n", Msg.idMsg.type, Msg.cParameters.type),
233 VERR_INTERNAL_ERROR_3);
234
235 *pidMsg = (uint32_t)Msg.idMsg.u.value64;
236 *pcParameters = Msg.cParameters.u.value32;
237 return rc;
238 }
239
240 /*
241 * If interrupted we must cancel the call so it doesn't prevent us from making another one.
242 */
243 if (rc == VERR_INTERRUPTED)
244 {
245 VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL, 0);
246 int rc2 = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr));
247 AssertRC(rc2);
248 }
249
250 /*
251 * If restored, update pidRestoreCheck.
252 */
253 if (rc == VERR_VM_RESTORED && pidRestoreCheck)
254 *pidRestoreCheck = Msg.idMsg.u.value64;
255
256 *pidMsg = UINT32_MAX - 1;
257 *pcParameters = UINT32_MAX - 2;
258 return rc;
259}
260#endif
261
262VBGLR3DECL(int) VbglR3ClipboardTransferSendStatus(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDURITRANSFERSTATUS uStatus)
263{
264 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
265
266 VBoxClipboardStatusMsg Msg;
267 RT_ZERO(Msg);
268
269 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
270 VBOX_SHARED_CLIPBOARD_GUEST_FN_STATUS, VBOX_SHARED_CLIPBOARD_CPARMS_STATUS);
271
272 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
273 Msg.uStatus.SetUInt32(uStatus);
274 Msg.cbPayload.SetUInt32(0);
275 Msg.pvPayload.SetPtr(NULL, 0);
276
277 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
278
279 LogFlowFuncLeaveRC(rc);
280 return rc;
281}
282
283VBGLR3DECL(int) VbglR3ClipboardRootListHdrReadReq(PVBGLR3SHCLCMDCTX pCtx, uint32_t *pfRoots)
284{
285 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
286 AssertPtrReturn(pfRoots, VERR_INVALID_POINTER);
287
288 VBoxClipboardRootListReadReqMsg Msg;
289 RT_ZERO(Msg);
290
291 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
292 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_HDR_READ);
293
294 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ);
295 Msg.ReqParms.fRoots.SetUInt32(0);
296
297 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
298 if (RT_SUCCESS(rc))
299 {
300 rc = Msg.ReqParms.uContext.GetUInt32(&pCtx->uContextID); AssertRC(rc);
301 if (RT_SUCCESS(rc))
302 rc = Msg.ReqParms.fRoots.GetUInt32(pfRoots); AssertRC(rc);
303 }
304
305 LogFlowFuncLeaveRC(rc);
306 return rc;
307}
308
309VBGLR3DECL(int) VbglR3ClipboardRootListHdrReadReply(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDROOTLISTHDR pRootListHdr)
310{
311 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
312 AssertPtrReturn(pRootListHdr, VERR_INVALID_POINTER);
313
314 VBoxClipboardRootListHdrMsg Msg;
315 RT_ZERO(Msg);
316
317 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
318 VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_HDR);
319
320 Msg.ReqParms.uContext.SetUInt32(pCtx->uContextID);
321 Msg.ReqParms.fRoots.SetUInt32(pRootListHdr->fRoots);
322
323 Msg.cRoots.SetUInt32(pRootListHdr->cRoots);
324 Msg.enmCompression.SetUInt32(0); /** @todo Not implemented yet. */
325 Msg.enmChecksumType.SetUInt32(0); /** @todo Not implemented yet. */
326
327 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
328
329 LogFlowFuncLeaveRC(rc);
330 return rc;
331}
332
333VBGLR3DECL(int) VbglR3ClipboardRootListEntryReadReq(PVBGLR3SHCLCMDCTX pCtx, uint32_t *puIndex, uint32_t *pfInfo)
334{
335 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
336 AssertPtrReturn(puIndex, VERR_INVALID_POINTER);
337 AssertPtrReturn(pfInfo, VERR_INVALID_POINTER);
338
339 VBoxClipboardRootListEntryReadReqMsg Msg;
340 RT_ZERO(Msg);
341
342 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
343 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_ENTRY_READ_REQ);
344
345 Msg.Parms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_ENTRY_READ);
346 Msg.Parms.fInfo.SetUInt32(0);
347 Msg.Parms.uIndex.SetUInt32(0);
348
349 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
350 if (RT_SUCCESS(rc))
351 {
352 rc = Msg.Parms.uContext.GetUInt32(&pCtx->uContextID); AssertRC(rc);
353 if (RT_SUCCESS(rc))
354 rc = Msg.Parms.fInfo.GetUInt32(pfInfo); AssertRC(rc);
355 if (RT_SUCCESS(rc))
356 rc = Msg.Parms.uIndex.GetUInt32(puIndex); AssertRC(rc);
357 }
358
359 LogFlowFuncLeaveRC(rc);
360 return rc;
361}
362
363VBGLR3DECL(int) VbglR3ClipboardRootListEntryReadReply(PVBGLR3SHCLCMDCTX pCtx, uint32_t uIndex, PVBOXCLIPBOARDLISTENTRY pEntry)
364{
365 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
366 AssertPtrReturn(pEntry, VERR_INVALID_POINTER);
367
368 VBoxClipboardRootListEntryMsg Msg;
369 RT_ZERO(Msg);
370
371 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
372 VBOX_SHARED_CLIPBOARD_GUEST_FN_ROOT_LIST_ENTRY_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_ROOT_LIST_ENTRY);
373
374 Msg.Parms.uContext.SetUInt32(pCtx->uContextID);
375 Msg.Parms.fInfo.SetUInt32(0);
376 Msg.Parms.uIndex.SetUInt32(uIndex);
377
378 Msg.szName.SetPtr(pEntry->pszName, pEntry->cbName);
379 Msg.cbInfo.SetUInt32(pEntry->cbInfo);
380 Msg.pvInfo.SetPtr(pEntry->pvInfo, pEntry->cbInfo);
381
382 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
383
384 LogFlowFuncLeaveRC(rc);
385 return rc;
386}
387
388VBGLR3DECL(int) VbglR3ClipboardListOpenSend(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms,
389 PSHAREDCLIPBOARDLISTHANDLE phList)
390{
391 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
392 AssertPtrReturn(pOpenParms, VERR_INVALID_POINTER);
393 AssertPtrReturn(phList, VERR_INVALID_POINTER);
394
395 VBoxClipboardListOpenMsg Msg;
396 RT_ZERO(Msg);
397
398 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
399 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_OPEN, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN);
400
401 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
402 Msg.fList.SetUInt32(0);
403 Msg.cbFilter.SetUInt32(pOpenParms->cbFilter);
404 Msg.pvFilter.SetPtr(pOpenParms->pszFilter, pOpenParms->cbFilter);
405 Msg.cbPath.SetUInt32(pOpenParms->cbPath);
406 Msg.pvFilter.SetPtr(pOpenParms->pszPath, pOpenParms->cbPath);
407
408 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
409 if (RT_SUCCESS(rc))
410 {
411 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc);
412 }
413
414 LogFlowFuncLeaveRC(rc);
415 return rc;
416}
417
418VBGLR3DECL(int) VbglR3ClipboardListOpenRecv(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDLISTOPENPARMS pOpenParms)
419{
420 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
421 AssertPtrReturn(pOpenParms, VERR_INVALID_POINTER);
422
423 VBoxClipboardListOpenMsg Msg;
424 RT_ZERO(Msg);
425
426 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
427 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_OPEN);
428
429 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN);
430 Msg.fList.SetUInt32(0);
431 Msg.cbPath.SetUInt32(pOpenParms->cbPath);
432 Msg.pvPath.SetPtr(pOpenParms->pszPath, pOpenParms->cbPath);
433 Msg.cbFilter.SetUInt32(pOpenParms->cbFilter);
434 Msg.pvFilter.SetPtr(pOpenParms->pszFilter, pOpenParms->cbFilter);
435 Msg.uHandle.SetUInt64(0);
436
437 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
438 if (RT_SUCCESS(rc))
439 {
440 rc = Msg.fList.GetUInt32(&pOpenParms->fList);
441 if (RT_SUCCESS(rc))
442 rc = Msg.cbFilter.GetUInt32(&pOpenParms->cbFilter);
443 if (RT_SUCCESS(rc))
444 rc = Msg.cbPath.GetUInt32(&pOpenParms->cbPath);
445 }
446
447 LogFlowFuncLeaveRC(rc);
448 return rc;
449}
450
451VBGLR3DECL(int) VbglR3ClipboardListOpenReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDLISTHANDLE hList)
452{
453 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
454
455 VBoxClipboardReplyMsg Msg;
456 RT_ZERO(Msg);
457
458 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
459 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6);
460
461 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
462 Msg.enmType.SetUInt32(VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_LIST_OPEN);
463 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */
464 Msg.cbPayload.SetUInt32(0);
465 Msg.pvPayload.SetPtr(0, NULL);
466
467 Msg.u.ListOpen.uHandle.SetUInt64(hList);
468
469 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
470
471 LogFlowFuncLeaveRC(rc);
472 return rc;
473}
474
475VBGLR3DECL(int) VbglR3ClipboardListCloseRecv(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDLISTHANDLE phList)
476{
477 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
478 AssertPtrReturn(phList, VERR_INVALID_POINTER);
479
480 VBoxClipboardListCloseMsg Msg;
481 RT_ZERO(Msg);
482
483 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
484 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE);
485
486 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE);
487 Msg.uHandle.SetUInt64(0);
488
489 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
490 if (RT_SUCCESS(rc))
491 {
492 rc = Msg.uHandle.GetUInt64(phList); AssertRC(rc);
493 }
494
495 LogFlowFuncLeaveRC(rc);
496 return rc;
497}
498
499VBGLR3DECL(int) VbglR3ClipboardListCloseReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDLISTHANDLE hList)
500{
501 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
502
503 VBoxClipboardReplyMsg Msg;
504 RT_ZERO(Msg);
505
506 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
507 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6);
508
509 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
510 Msg.enmType.SetUInt32(VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_LIST_CLOSE);
511 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */
512 Msg.cbPayload.SetUInt32(0);
513 Msg.pvPayload.SetPtr(0, NULL);
514
515 Msg.u.ListOpen.uHandle.SetUInt64(hList);
516
517 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
518
519 LogFlowFuncLeaveRC(rc);
520 return rc;
521}
522
523VBGLR3DECL(int) VbglR3ClipboardListCloseSend(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList)
524{
525 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
526
527 VBoxClipboardListCloseMsg Msg;
528 RT_ZERO(Msg);
529
530 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
531 VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_CLOSE);
532
533 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
534 Msg.uHandle.SetUInt64(hList);
535
536 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
537
538 LogFlowFuncLeaveRC(rc);
539 return rc;
540}
541
542
543VBGLR3DECL(int) VbglR3ClipboardListHdrRead(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList, uint32_t fFlags,
544 PVBOXCLIPBOARDLISTHDR pListHdr)
545{
546 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
547 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER);
548
549 VBoxClipboardListHdrMsg Msg;
550 RT_ZERO(Msg);
551
552 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
553 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR);
554
555 Msg.ReqParms.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
556 Msg.ReqParms.uHandle.SetUInt64(hList);
557 Msg.ReqParms.fFlags.SetUInt32(fFlags);
558
559 Msg.fFeatures.SetUInt32(0);
560 Msg.cbTotalSize.SetUInt32(0);
561 Msg.cTotalObjects.SetUInt64(0);
562 Msg.cbTotalSize.SetUInt64(0);
563 Msg.enmCompression.SetUInt32(0);
564 Msg.enmChecksumType.SetUInt32(0);
565
566 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
567 if (RT_SUCCESS(rc))
568 {
569 rc = Msg.fFeatures.GetUInt32(&pListHdr->fFeatures);
570 if (RT_SUCCESS(rc))
571 rc = Msg.cTotalObjects.GetUInt64(&pListHdr->cTotalObjects);
572 if (RT_SUCCESS(rc))
573 rc = Msg.cbTotalSize.GetUInt64(&pListHdr->cbTotalSize);
574 if (RT_SUCCESS(rc))
575 rc = Msg.enmCompression.GetUInt32(&pListHdr->enmCompression);
576 if (RT_SUCCESS(rc))
577 rc = Msg.enmChecksumType.GetUInt32(&pListHdr->enmChecksumType);
578 }
579
580 LogFlowFuncLeaveRC(rc);
581 return rc;
582}
583
584VBGLR3DECL(int) VbglR3ClipboardListHdrReadRecvReq(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfFlags)
585{
586 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
587 AssertPtrReturn(phList, VERR_INVALID_POINTER);
588 AssertPtrReturn(pfFlags, VERR_INVALID_POINTER);
589
590 VBoxClipboardListHdrReadReqMsg Msg;
591 RT_ZERO(Msg);
592
593 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
594 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ_REQ);
595
596 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ);
597 Msg.ReqParms.uHandle.SetUInt64(0);
598 Msg.ReqParms.fFlags.SetUInt32(0);
599
600 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
601 if (RT_SUCCESS(rc))
602 {
603 if (RT_SUCCESS(rc))
604 rc = Msg.ReqParms.uHandle.GetUInt64(phList);
605 if (RT_SUCCESS(rc))
606 rc = Msg.ReqParms.fFlags.GetUInt32(pfFlags);
607 }
608
609 LogFlowFuncLeaveRC(rc);
610 return rc;
611}
612
613VBGLR3DECL(int) VbglR3ClipboardListHdrWrite(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList,
614 PVBOXCLIPBOARDLISTHDR pListHdr)
615{
616 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
617 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER);
618
619 VBoxClipboardListHdrMsg Msg;
620 RT_ZERO(Msg);
621
622 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
623 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR);
624
625 Msg.ReqParms.uContext.SetUInt32(0);
626 Msg.ReqParms.uHandle.SetUInt64(hList);
627 Msg.ReqParms.fFlags.SetUInt32(0);
628
629 Msg.fFeatures.SetUInt32(0);
630 Msg.cbTotalSize.SetUInt32(pListHdr->fFeatures);
631 Msg.cTotalObjects.SetUInt64(pListHdr->cTotalObjects);
632 Msg.cbTotalSize.SetUInt64(pListHdr->cbTotalSize);
633 Msg.enmCompression.SetUInt32(pListHdr->enmCompression);
634 Msg.enmChecksumType.SetUInt32(pListHdr->enmChecksumType);
635
636 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
637
638 LogFlowFuncLeaveRC(rc);
639 return rc;
640}
641
642VBGLR3DECL(int) VbglR3ClipboardListEntryRead(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList,
643 PVBOXCLIPBOARDLISTENTRY pListEntry)
644{
645 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
646 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER);
647
648 VBoxClipboardListEntryMsg Msg;
649 RT_ZERO(Msg);
650
651 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
652 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY);
653
654 Msg.ReqParms.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
655 Msg.ReqParms.uHandle.SetUInt64(hList);
656 Msg.ReqParms.fInfo.SetUInt32(0);
657
658 Msg.szName.SetPtr(pListEntry->pszName, pListEntry->cbName);
659 Msg.cbInfo.SetUInt32(pListEntry->cbInfo);
660 Msg.pvInfo.SetPtr(pListEntry->pvInfo, pListEntry->cbInfo);
661
662 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
663 if (RT_SUCCESS(rc))
664 {
665 rc = Msg.cbInfo.GetUInt32(&pListEntry->cbInfo); AssertRC(rc);
666 }
667
668 LogFlowFuncLeaveRC(rc);
669 return rc;
670}
671
672VBGLR3DECL(int) VbglR3ClipboardListEntryReadRecvReq(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDLISTHANDLE phList, uint32_t *pfInfo)
673{
674 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
675 AssertPtrReturn(phList, VERR_INVALID_POINTER);
676 AssertPtrReturn(pfInfo, VERR_INVALID_POINTER);
677
678 VBoxClipboardListEntryReadReqMsg Msg;
679 RT_ZERO(Msg);
680
681 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
682 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_READ);
683
684 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ);
685 Msg.ReqParms.uHandle.SetUInt64(0);
686 Msg.ReqParms.fInfo.SetUInt32(0);
687
688 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
689 if (RT_SUCCESS(rc))
690 {
691 rc = Msg.ReqParms.uHandle.GetUInt64(phList); AssertRC(rc);
692 if (RT_SUCCESS(rc))
693 rc = Msg.ReqParms.fInfo.GetUInt32(pfInfo); AssertRC(rc);
694 }
695
696 LogFlowFuncLeaveRC(rc);
697 return rc;
698}
699
700VBGLR3DECL(int) VbglR3ClipboardListEntryWrite(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDLISTHANDLE hList,
701 PVBOXCLIPBOARDLISTENTRY pListEntry)
702{
703 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
704 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER);
705
706 VBoxClipboardListEntryMsg Msg;
707 RT_ZERO(Msg);
708
709 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
710 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY);
711
712 Msg.ReqParms.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
713 Msg.ReqParms.uHandle.SetUInt64(hList);
714 Msg.ReqParms.fInfo.SetUInt32(pListEntry->fInfo);
715
716 Msg.szName.SetPtr(pListEntry->pszName, pListEntry->cbName);
717 Msg.cbInfo.SetUInt32(pListEntry->cbInfo);
718 Msg.pvInfo.SetPtr(pListEntry->pvInfo, pListEntry->cbInfo);
719
720 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
721
722 LogFlowFuncLeaveRC(rc);
723 return rc;
724}
725
726VBGLR3DECL(int) VbglR3ClipboardObjOpenRecv(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDOBJOPENCREATEPARMS pCreateParms)
727{
728 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
729 AssertPtrReturn(pCreateParms, VERR_INVALID_POINTER);
730
731 VBoxClipboardObjOpenMsg Msg;
732 RT_ZERO(Msg);
733
734 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
735 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_OPEN);
736
737 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN);
738 Msg.cbPath.SetUInt64(pCreateParms->cbPath);
739 Msg.szPath.SetPtr(pCreateParms->pszPath, pCreateParms->cbPath);
740 Msg.fCreate.SetUInt32(0);
741 Msg.objInfo.SetPtr(&pCreateParms->ObjInfo, sizeof(pCreateParms->ObjInfo));
742
743 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
744 if (RT_SUCCESS(rc))
745 {
746 rc = Msg.cbPath.GetUInt32(&pCreateParms->cbPath);
747 if (RT_SUCCESS(rc))
748 rc = Msg.fCreate.GetUInt32(&pCreateParms->fCreate);
749 }
750
751 LogFlowFuncLeaveRC(rc);
752 return rc;
753}
754
755VBGLR3DECL(int) VbglR3ClipboardObjOpenReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDOBJHANDLE hObj)
756{
757 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
758
759 VBoxClipboardReplyMsg Msg;
760 RT_ZERO(Msg);
761
762 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
763 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6);
764
765 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
766 Msg.enmType.SetUInt32(VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_OPEN);
767 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */
768 Msg.cbPayload.SetUInt32(0);
769 Msg.pvPayload.SetPtr(0, NULL);
770
771 Msg.u.ObjOpen.uHandle.SetUInt64(hObj);
772
773 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
774
775 LogFlowFuncLeaveRC(rc);
776 return rc;
777}
778
779VBGLR3DECL(int) VbglR3ClipboardObjOpenSend(PVBGLR3SHCLCMDCTX pCtx, PVBOXCLIPBOARDOBJOPENCREATEPARMS pCreateParms,
780 PSHAREDCLIPBOARDOBJHANDLE phObj)
781{
782 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
783 AssertPtrReturn(pCreateParms, VERR_INVALID_POINTER);
784 AssertPtrReturn(phObj, VERR_INVALID_POINTER);
785
786 VBoxClipboardObjOpenMsg Msg;
787 RT_ZERO(Msg);
788
789 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
790 VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_OPEN, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_OPEN);
791
792 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
793 Msg.uHandle.SetUInt64(0);
794 Msg.cbPath.SetUInt32(pCreateParms->cbPath);
795 Msg.szPath.SetPtr((void *)pCreateParms->pszPath, pCreateParms->cbPath + 1 /* Include terminating zero */);
796 Msg.fCreate.SetUInt32(pCreateParms->fCreate);
797 Msg.objInfo.SetPtr((void *)&pCreateParms->ObjInfo, sizeof(pCreateParms->ObjInfo));
798
799 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
800 if (RT_SUCCESS(rc))
801 {
802 Msg.uHandle.GetUInt64(phObj);
803 }
804
805 LogFlowFuncLeaveRC(rc);
806 return rc;
807}
808
809VBGLR3DECL(int) VbglR3ClipboardObjCloseRecv(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDOBJHANDLE phObj)
810{
811 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
812 AssertPtrReturn(phObj, VERR_INVALID_POINTER);
813
814 VBoxClipboardObjCloseMsg Msg;
815 RT_ZERO(Msg);
816
817 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
818 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_CLOSE);
819
820 Msg.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN);
821 Msg.uHandle.SetUInt64(0);
822
823 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
824 if (RT_SUCCESS(rc))
825 {
826 rc = Msg.uHandle.GetUInt64(phObj);
827 }
828
829 LogFlowFuncLeaveRC(rc);
830 return rc;
831}
832
833VBGLR3DECL(int) VbglR3ClipboardObjCloseReply(PVBGLR3SHCLCMDCTX pCtx, int rcReply, SHAREDCLIPBOARDOBJHANDLE hObj)
834{
835 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
836
837 VBoxClipboardReplyMsg Msg;
838 RT_ZERO(Msg);
839
840 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
841 VBOX_SHARED_CLIPBOARD_GUEST_FN_REPLY, 6);
842
843 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
844 Msg.enmType.SetUInt32(VBOX_SHAREDCLIPBOARD_REPLYMSGTYPE_OBJ_CLOSE);
845 Msg.rc.SetUInt32((uint32_t)rcReply); /** int vs. uint32_t */
846 Msg.cbPayload.SetUInt32(0);
847 Msg.pvPayload.SetPtr(0, NULL);
848
849 Msg.u.ObjClose.uHandle.SetUInt64(hObj);
850
851 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
852
853 LogFlowFuncLeaveRC(rc);
854 return rc;
855}
856
857VBGLR3DECL(int) VbglR3ClipboardObjCloseSend(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDOBJHANDLE hObj)
858{
859 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
860
861 VBoxClipboardObjCloseMsg Msg;
862 RT_ZERO(Msg);
863
864 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
865 VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_CLOSE, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_CLOSE);
866
867 Msg.uContext.SetUInt32(0); /** @todo Context ID not used yet. */
868 Msg.uHandle.SetUInt64(hObj);
869
870 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
871
872 LogFlowFuncLeaveRC(rc);
873 return rc;
874}
875
876VBGLR3DECL(int) VbglR3ClipboardObjReadRecv(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDOBJHANDLE phObj, uint32_t *pcbToRead,
877 uint32_t *pfFlags)
878{
879 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
880 AssertPtrReturn(phObj, VERR_INVALID_POINTER);
881 AssertPtrReturn(pcbToRead, VERR_INVALID_POINTER);
882 AssertPtrReturn(pfFlags, VERR_INVALID_POINTER);
883
884 VBoxClipboardObjReadReqMsg Msg;
885 RT_ZERO(Msg);
886
887 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID,
888 VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_GET, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ_REQ);
889
890 Msg.ReqParms.uContext.SetUInt32(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ);
891 Msg.ReqParms.uHandle.SetUInt64(0);
892 Msg.ReqParms.cbToRead.SetUInt32(0);
893 Msg.ReqParms.fRead.SetUInt32(0);
894
895 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
896 if (RT_SUCCESS(rc))
897 {
898 rc = Msg.ReqParms.uHandle.GetUInt64(phObj);
899 if (RT_SUCCESS(rc))
900 rc = Msg.ReqParms.cbToRead.GetUInt32(pcbToRead);
901 if (RT_SUCCESS(rc))
902 rc = Msg.ReqParms.fRead.GetUInt32(pfFlags);
903 }
904
905 LogFlowFuncLeaveRC(rc);
906 return rc;
907}
908
909VBGLR3DECL(int) VbglR3ClipboardObjReadSend(PVBGLR3SHCLCMDCTX pCtx, SHAREDCLIPBOARDOBJHANDLE hObj,
910 void *pvData, uint32_t cbData, uint32_t *pcbRead)
911{
912 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
913 AssertPtrReturn(pvData, VERR_INVALID_POINTER);
914 AssertReturn(cbData, VERR_INVALID_PARAMETER);
915 /* pcbRead is optional. */
916
917 VBoxClipboardObjReadWriteMsg Msg;
918 RT_ZERO(Msg);
919
920 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_READ, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_READ);
921
922 Msg.uContext.SetUInt32(0);
923 Msg.uHandle.SetUInt64(hObj);
924 Msg.pvData.SetPtr(pvData, cbData);
925 Msg.cbData.SetUInt32(0);
926 Msg.pvChecksum.SetPtr(NULL, 0);
927 Msg.cbChecksum.SetUInt32(0);
928
929 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
930 if (RT_SUCCESS(rc))
931 {
932 /** @todo Context ID not used yet. */
933 /** @todo Add checksum support. */
934
935 if (pcbRead)
936 {
937 rc = Msg.cbData.GetUInt32(pcbRead); AssertRC(rc);
938 AssertReturn(cbData >= *pcbRead, VERR_TOO_MUCH_DATA);
939 }
940 }
941
942 LogFlowFuncLeaveRC(rc);
943 return rc;
944}
945
946VBGLR3DECL(int) VbglR3ClipboardObjWriteSend(PVBGLR3SHCLCMDCTX pCtx,
947 SHAREDCLIPBOARDOBJHANDLE hObj,
948 void *pvData, uint32_t cbData, uint32_t *pcbWritten)
949{
950 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
951 AssertPtrReturn(pvData, VERR_INVALID_POINTER);
952 AssertReturn(cbData, VERR_INVALID_PARAMETER);
953 /* pcbWritten is optional. */
954
955 VBoxClipboardObjReadWriteMsg Msg;
956 RT_ZERO(Msg);
957
958 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, VBOX_SHARED_CLIPBOARD_GUEST_FN_OBJ_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_OBJ_WRITE);
959
960 Msg.uContext.SetUInt32(0);
961 Msg.uHandle.SetUInt64(hObj);
962 Msg.pvData.SetPtr(pvData, cbData);
963 Msg.cbData.SetUInt32(cbData);
964 Msg.pvChecksum.SetPtr(NULL, 0); /** @todo Implement this. */
965 Msg.cbChecksum.SetUInt32(0); /** @todo Implement this. */
966
967 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
968 if (RT_SUCCESS(rc))
969 {
970 if (pcbWritten)
971 *pcbWritten = cbData;
972 }
973
974 LogFlowFuncLeaveRC(rc);
975 return rc;
976}
977
978VBGLR3DECL(int) VbglR3ClipboardEventGetNext(PVBGLR3SHCLCMDCTX pCtx, PSHAREDCLIPBOARDURITRANSFER pTransfer,
979 PVBGLR3CLIPBOARDEVENT *ppEvent)
980{
981 AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
982 AssertPtrReturn(pTransfer, VERR_INVALID_POINTER);
983 AssertPtrReturn(ppEvent, VERR_INVALID_POINTER);
984
985 PVBGLR3CLIPBOARDEVENT pEvent = (PVBGLR3CLIPBOARDEVENT)RTMemAllocZ(sizeof(VBGLR3CLIPBOARDEVENT));
986 if (!pEvent)
987 return VERR_NO_MEMORY;
988
989 uint32_t uMsg = 0;
990 uint32_t cParms = 0;
991 int rc = vbglR3ClipboardMsgPeekWait(pCtx, &uMsg, &cParms, NULL /* pidRestoreCheck */);
992 if (RT_SUCCESS(rc))
993 {
994#ifdef LOG_ENABLED
995 LogFunc(("Handling uMsg=%RU32 (%s)\n", uMsg, VBoxClipboardHostMsgToStr(uMsg)));
996#endif
997 switch (uMsg)
998 {
999#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
1000 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ:
1001 {
1002 uint32_t fRoots;
1003 rc = VbglR3ClipboardRootListHdrReadReq(pCtx, &fRoots);
1004
1005 /** @todo Validate / handle fRoots. */
1006
1007 if (RT_SUCCESS(rc))
1008 {
1009 VBOXCLIPBOARDROOTLISTHDR rootListHdr;
1010 RT_ZERO(rootListHdr);
1011
1012 rootListHdr.cRoots = SharedClipboardURILTransferRootsCount(pTransfer);
1013
1014 LogFlowFunc(("cRoots=%RU32\n", rootListHdr.cRoots));
1015
1016 rc = VbglR3ClipboardRootListHdrReadReply(pCtx, &rootListHdr);
1017 }
1018 break;
1019 }
1020
1021 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_ENTRY_READ:
1022 {
1023 uint32_t uIndex;
1024 uint32_t fInfo;
1025 rc = VbglR3ClipboardRootListEntryReadReq(pCtx, &uIndex, &fInfo);
1026 if (RT_SUCCESS(rc))
1027 {
1028 VBOXCLIPBOARDLISTENTRY rootListEntry;
1029 rc = SharedClipboardURILTransferRootsEntry(pTransfer, uIndex, &rootListEntry);
1030 if (RT_SUCCESS(rc))
1031 rc = VbglR3ClipboardRootListEntryReadReply(pCtx, uIndex, &rootListEntry);
1032 }
1033 break;
1034 }
1035
1036 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN:
1037 {
1038 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_OPEN\n"));
1039
1040 VBOXCLIPBOARDLISTOPENPARMS openParmsList;
1041 rc = SharedClipboardURIListOpenParmsInit(&openParmsList);
1042 if (RT_SUCCESS(rc))
1043 {
1044 rc = VbglR3ClipboardListOpenRecv(pCtx, &openParmsList);
1045 if (RT_SUCCESS(rc))
1046 {
1047 LogFlowFunc(("pszPath=%s\n", openParmsList.pszPath));
1048
1049 SHAREDCLIPBOARDLISTHANDLE hList = SHAREDCLIPBOARDLISTHANDLE_INVALID;
1050 rc = SharedClipboardURITransferListOpen(pTransfer, &openParmsList, &hList);
1051
1052 /* Reply in any case. */
1053 int rc2 = VbglR3ClipboardListOpenReply(pCtx, rc, hList);
1054 AssertRC(rc2);
1055
1056 SharedClipboardURIListOpenParmsDestroy(&openParmsList);
1057 }
1058 }
1059
1060 break;
1061 }
1062
1063 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE:
1064 {
1065 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_CLOSE\n"));
1066
1067 SHAREDCLIPBOARDLISTHANDLE hList;
1068 rc = VbglR3ClipboardListCloseRecv(pCtx, &hList);
1069 if (RT_SUCCESS(rc))
1070 {
1071 rc = SharedClipboardURITransferListClose(pTransfer, hList);
1072
1073 /* Reply in any case. */
1074 int rc2 = VbglR3ClipboardListCloseReply(pCtx, rc, hList);
1075 AssertRC(rc2);
1076 }
1077
1078 break;
1079 }
1080
1081 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ:
1082 {
1083 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_READ\n"));
1084
1085 /** @todo Handle filter + list features. */
1086
1087 SHAREDCLIPBOARDLISTHANDLE hList = SHAREDCLIPBOARDLISTHANDLE_INVALID;
1088 uint32_t fFlags = 0;
1089 rc = VbglR3ClipboardListHdrReadRecvReq(pCtx, &hList, &fFlags);
1090 if (RT_SUCCESS(rc))
1091 {
1092 VBOXCLIPBOARDLISTHDR hdrList;
1093 rc = SharedClipboardURITransferListGetHeader(pTransfer, hList, &hdrList);
1094 if (RT_SUCCESS(rc))
1095 {
1096 rc = VbglR3ClipboardListHdrWrite(pCtx, hList, &hdrList);
1097
1098 SharedClipboardURIListHdrDestroy(&hdrList);
1099 }
1100 }
1101
1102 break;
1103 }
1104
1105 #if 0
1106 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_WRITE:
1107 {
1108 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_HDR_WRITE\n"));
1109
1110 VBOXCLIPBOARDLISTHDR hdrList;
1111 rc = SharedClipboardURIListHdrInit(&hdrList);
1112 if (RT_SUCCESS(rc))
1113 {
1114 rc = VBglR3ClipboardListHdrRecv(pCtx, )
1115 }
1116 break;
1117 }
1118 #endif
1119
1120 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ:
1121 {
1122 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_READ\n"));
1123
1124 VBOXCLIPBOARDLISTENTRY entryList;
1125 rc = SharedClipboardURIListEntryInit(&entryList);
1126 if (RT_SUCCESS(rc))
1127 {
1128 SHAREDCLIPBOARDLISTHANDLE hList;
1129 uint32_t fInfo;
1130 rc = VbglR3ClipboardListEntryReadRecvReq(pCtx, &hList, &fInfo);
1131 if (RT_SUCCESS(rc))
1132 {
1133 rc = SharedClipboardURITransferListRead(pTransfer, hList, &entryList);
1134 if (RT_SUCCESS(rc))
1135 {
1136 PSHAREDCLIPBOARDFSOBJINFO pObjInfo = (PSHAREDCLIPBOARDFSOBJINFO)entryList.pvInfo;
1137 Assert(entryList.cbInfo == sizeof(SHAREDCLIPBOARDFSOBJINFO));
1138
1139 RT_NOREF(pObjInfo);
1140
1141 LogFlowFunc(("\t%s (%RU64 bytes)\n", entryList.pszName, pObjInfo->cbObject));
1142
1143 rc = VbglR3ClipboardListEntryWrite(pCtx, hList, &entryList);
1144 }
1145 }
1146
1147 SharedClipboardURIListEntryDestroy(&entryList);
1148 }
1149
1150 break;
1151 }
1152
1153 #if 0
1154 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_WRITE:
1155 {
1156 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_LIST_ENTRY_WRITE\n"));
1157 pEvent->enmType = VBGLR3CLIPBOARDEVENTTYPE_URI_LIST_ENTRY_WRITE;
1158 break;
1159 }
1160 #endif
1161
1162 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN:
1163 {
1164 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_OPEN\n"));
1165
1166 VBOXCLIPBOARDOBJOPENCREATEPARMS createParms;
1167 rc = VbglR3ClipboardObjOpenRecv(pCtx, &createParms);
1168 if (RT_SUCCESS(rc))
1169 {
1170 SHAREDCLIPBOARDOBJHANDLE hObj;
1171 rc = SharedClipboardURIObjectOpen(pTransfer, &createParms, &hObj);
1172 if (RT_SUCCESS(rc))
1173 {
1174 int rc2 = VbglR3ClipboardObjOpenReply(pCtx, rc, hObj);
1175 AssertRC(rc2);
1176 }
1177 }
1178
1179 break;
1180 }
1181
1182 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_CLOSE:
1183 {
1184 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_CLOSE\n"));
1185
1186 SHAREDCLIPBOARDOBJHANDLE hObj;
1187 rc = VbglR3ClipboardObjCloseRecv(pCtx, &hObj);
1188 if (RT_SUCCESS(rc))
1189 {
1190 rc = SharedClipboardURIObjectClose(hObj);
1191
1192 /* Reply in any case. */
1193 int rc2 = VbglR3ClipboardObjCloseReply(pCtx, rc, hObj);
1194 AssertRC(rc2);
1195 }
1196 break;
1197 }
1198
1199 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ:
1200 {
1201 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_READ\n"));
1202
1203 SHAREDCLIPBOARDOBJHANDLE hObj;
1204 uint32_t cbBuf;
1205 uint32_t fFlags;
1206 rc = VbglR3ClipboardObjReadRecv(pCtx, &hObj, &cbBuf, &fFlags);
1207 if (RT_SUCCESS(rc))
1208 {
1209 void *pvBuf = RTMemAlloc(RT_MIN(cbBuf, _64K)); /** @todo Make this more flexible. */
1210 if (pvBuf)
1211 {
1212 uint32_t cbRead;
1213 rc = SharedClipboardURIObjectRead(hObj, pvBuf, cbBuf, &cbRead, fFlags);
1214 if (RT_SUCCESS(rc))
1215 rc = VbglR3ClipboardObjReadSend(pCtx, hObj, pvBuf, cbRead, NULL /* pcbWritten */);
1216
1217 RTMemFree(pvBuf);
1218 }
1219 else
1220 rc = VERR_NO_MEMORY;
1221 }
1222 break;
1223 }
1224
1225 #if 0
1226 case VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_WRITE:
1227 {
1228 LogFlowFunc(("VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_OBJ_WRITE\n"));
1229 break;
1230 }
1231 #endif
1232#endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
1233
1234 default:
1235 rc = VERR_NOT_SUPPORTED;
1236 break;
1237 }
1238 }
1239
1240 if (RT_SUCCESS(rc))
1241 {
1242 if (pEvent->enmType != VBGLR3CLIPBOARDEVENTTYPE_INVALID)
1243 {
1244 *ppEvent = pEvent;
1245 }
1246 else
1247 VbglR3ClipboardEventFree(pEvent);
1248 }
1249 else
1250 {
1251 /* Report error back to the host. */
1252 int rc2 = VbglR3ClipboardWriteError(pCtx->uClientID, rc);
1253 Assert(rc2);
1254
1255 VbglR3ClipboardEventFree(pEvent);
1256 }
1257
1258 LogFlowFuncLeaveRC(rc);
1259 return rc;
1260}
1261
1262/**
1263 * Frees (destroys) a formerly allocated Shared Clipboard event.
1264 *
1265 * @returns IPRT status code.
1266 * @param pEvent Event to free (destroy).
1267 */
1268VBGLR3DECL(void) VbglR3ClipboardEventFree(PVBGLR3CLIPBOARDEVENT pEvent)
1269{
1270 if (!pEvent)
1271 return;
1272
1273 /* Some messages require additional cleanup. */
1274 switch (pEvent->enmType)
1275 {
1276 default:
1277 break;
1278 }
1279
1280 RTMemFree(pEvent);
1281 pEvent = NULL;
1282}
1283
1284#if 0
1285VBGLR3DECL(int) VbglR3ClipboardListHdrReadRecv(HGCMCLIENTID idClient, PVBOXCLIPBOARDLISTHANDLE phList)
1286{
1287 AssertPtrReturn(phList, VERR_INVALID_POINTER);
1288
1289 VBoxClipboardListHdrReadMsg Msg;
1290 RT_ZERO(Msg);
1291
1292 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,
1293 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_READ, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR_READ);
1294
1295 Msg.uContext.SetUInt32(0); /** @todo Not used yet. */
1296 Msg.uHandle.SetUInt64(0);
1297
1298 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
1299 if (RT_SUCCESS(rc))
1300 {
1301 Msg.uHandle.GetUInt32(phList);
1302 }
1303
1304 LogFlowFuncLeaveRC(rc);
1305 return rc;
1306}
1307
1308/**
1309 * Sends a list header to the host.
1310 *
1311 * @returns VBox status code.
1312 * @param idClient The client id returned by VbglR3ClipboardConnect().
1313 * @param hList List handle to send header for.
1314 * @param pListHdr List header to send.
1315 */
1316VBGLR3DECL(int) VbglR3ClipboardListHdrSend(HGCMCLIENTID idClient,
1317 VBOXCLIPBOARDLISTHANDLE hList, PVBOXCLIPBOARDLISTHDR pListHdr)
1318{
1319 AssertPtrReturn(pListHdr, VERR_INVALID_POINTER);
1320
1321 VBoxClipboardListHdrMsg Msg;
1322 RT_ZERO(Msg);
1323
1324 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,
1325 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_HDR_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_HDR);
1326
1327 Msg.uContext.SetUInt32(0); /** @todo Not used yet. */
1328 Msg.fFeatures.SetUInt32(pListHdr->fFeatures);
1329 Msg.cTotalObjects.SetUInt64(pListHdr->cTotalObjects);
1330 Msg.cbTotalSize.SetUInt64(pListHdr->cbTotalSize);
1331 Msg.enmCompression.SetUInt32(pListHdr->enmCompression);
1332 Msg.enmChecksumType.SetUInt32(RTDIGESTTYPE_INVALID);
1333
1334 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
1335
1336 LogFlowFuncLeaveRC(rc);
1337 return rc;
1338}
1339
1340/**
1341 * Sends a list entry to the host.
1342 *
1343 * @returns IPRT status code.
1344 * @param idClient The client id returned by VbglR3ClipboardConnect()
1345 * @param hList List handle to send entry for.
1346 * @param pListEntry List entry to send.
1347 */
1348VBGLR3DECL(int) VbglR3ClipboardSendListEntryWrite(HGCMCLIENTID idClient,
1349 VBOXCLIPBOARDLISTHANDLE hList, PVBOXCLIPBOARDLISTENTRY pListEntry)
1350{
1351 AssertPtrReturn(pListEntry, VERR_INVALID_POINTER);
1352
1353 VBoxClipboardListEntryWriteMsg Msg;
1354 RT_ZERO(Msg);
1355
1356 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,
1357 VBOX_SHARED_CLIPBOARD_GUEST_FN_LIST_ENTRY_WRITE, VBOX_SHARED_CLIPBOARD_CPARMS_LIST_ENTRY_WRITE);
1358
1359 Msg.uContext.SetUInt32(0); /** @todo Not used yet. */
1360 Msg.uHandle.SetUInt64(hList);
1361 Msg.fInfo.SetUInt32(pListEntry->fInfo);
1362 Msg.cbInfo.SetUInt32(pListEntry->cbInfo);
1363 Msg.pvInfo.SetPtr(pListEntry->pvInfo, pListEntry->cbInfo);
1364
1365 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
1366
1367 LogFlowFuncLeaveRC(rc);
1368 return rc;
1369}
1370#endif
1371#endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
1372
1373/**
1374 * Reports (advertises) guest clipboard formats to the host.
1375 *
1376 * @returns VBox status code.
1377 * @param idClient The client id returned by VbglR3ClipboardConnect().
1378 * @param fFormats The formats to advertise.
1379 */
1380VBGLR3DECL(int) VbglR3ClipboardReportFormats(HGCMCLIENTID idClient, uint32_t fFormats)
1381{
1382 VBoxClipboardReportFormatsMsg Msg;
1383
1384 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_REPORT_FORMATS, VBOX_SHARED_CLIPBOARD_CPARMS_REPORT_FORMATS);
1385 VbglHGCMParmUInt32Set(&Msg.formats, fFormats);
1386
1387 return VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
1388}
1389
1390/**
1391 * Sends guest clipboard data to the host.
1392 *
1393 * This is usually called in reply to a VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA message
1394 * from the host.
1395 *
1396 * @returns VBox status code.
1397 * @param idClient The client id returned by VbglR3ClipboardConnect().
1398 * @param fFormat The format of the data.
1399 * @param pv The data.
1400 * @param cb The size of the data.
1401 */
1402static int vbglR3ClipboardWriteDataRaw(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb)
1403{
1404 VBoxClipboardWriteDataMsg Msg;
1405 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_WRITE_DATA, VBOX_SHARED_CLIPBOARD_CPARMS_WRITE_DATA);
1406 VbglHGCMParmUInt32Set(&Msg.format, fFormat);
1407 VbglHGCMParmPtrSet(&Msg.ptr, pv, cb);
1408
1409 return VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
1410}
1411
1412/**
1413 * Send guest clipboard data to the host.
1414 *
1415 * This is usually called in reply to a VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA message
1416 * from the host.
1417 *
1418 * @returns VBox status code.
1419 * @param idClient The client id returned by VbglR3ClipboardConnect().
1420 * @param fFormat The format of the data.
1421 * @param pv The data.
1422 * @param cb The size of the data.
1423 */
1424VBGLR3DECL(int) VbglR3ClipboardWriteData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb)
1425{
1426 int rc = vbglR3ClipboardWriteDataRaw(idClient, fFormat, pv, cb);
1427
1428 return rc;
1429}
1430
1431#ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
1432/**
1433 * Writes an error to the host.
1434 *
1435 * @returns IPRT status code.
1436 * @param idClient The client id returned by VbglR3ClipboardConnect().
1437 * @param rcErr Error (IPRT-style) to send.
1438 */
1439VBGLR3DECL(int) VbglR3ClipboardWriteError(HGCMCLIENTID idClient, int rcErr)
1440{
1441 VBoxClipboardWriteErrorMsg Msg;
1442 RT_ZERO(Msg);
1443
1444 VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient, VBOX_SHARED_CLIPBOARD_GUEST_FN_ERROR, VBOX_SHARED_CLIPBOARD_CPARMS_ERROR);
1445
1446 /** @todo Context ID not used yet. */
1447 Msg.uContext.SetUInt32(0);
1448 Msg.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
1449
1450 int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
1451
1452 if (RT_FAILURE(rc))
1453 LogFlowFunc(("Sending error %Rrc failed with rc=%Rrc\n", rcErr, rc));
1454 if (rc == VERR_NOT_SUPPORTED)
1455 rc = VINF_SUCCESS;
1456
1457 if (RT_FAILURE(rc))
1458 LogRel(("Shared Clipboard: Reporting error %Rrc to the host failed with %Rrc\n", rcErr, rc));
1459
1460 LogFlowFuncLeaveRC(rc);
1461 return rc;
1462}
1463#endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
1464
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette