Changeset 79631 in vbox
- Timestamp:
- Jul 9, 2019 8:23:52 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard-uri.h
r79630 r79631 342 342 } VBOXCLIPBOARDCREATEPARMS, *PVBOXCLIPBOARDCREATEPARMS; 343 343 #pragma pack() 344 345 /** Clipboard area ID. A valid area is >= 1.346 * If 0 is specified, the last (most recent) area is meant.347 * Set to UINT32_MAX if not initialized. */348 typedef uint32_t SHAREDCLIPBOARDAREAID;349 350 /** Defines a non-initialized (nil) clipboard area. */351 #define NIL_SHAREDCLIPBOARDAREAID UINT32_MAX352 353 /** SharedClipboardArea open flags. */354 typedef uint32_t SHAREDCLIPBOARDAREAOPENFLAGS;355 356 /** No clipboard area open flags specified. */357 #define SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE 0358 /** The clipboard area must not exist yet. */359 #define SHAREDCLIPBOARDAREA_OPEN_FLAGS_MUST_NOT_EXIST RT_BIT(0)360 /** Mask of all valid clipboard area open flags. */361 #define SHAREDCLIPBOARDAREA_OPEN_FLAGS_VALID_MASK 0x1362 363 /** SharedClipboardURIObject flags. */364 typedef uint32_t SHAREDCLIPBOARDURIOBJECTFLAGS;365 366 /** No flags specified. */367 #define SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE 0368 369 /** Mask of all valid Shared Clipboard URI object flags. */370 #define SHAREDCLIPBOARDURIOBJECT_FLAGS_VALID_MASK UINT32_C(0x0)371 372 /**373 * Class for handling Shared Clipboard URI objects.374 * This class abstracts the access and handling objects when performing Shared Clipboard actions.375 */376 class SharedClipboardURIObject377 {378 public:379 380 /**381 * Enumeration for specifying an URI object type.382 */383 enum Type384 {385 /** Unknown type, do not use. */386 Type_Unknown = 0,387 /** Object is a file. */388 Type_File,389 /** Object is a directory. */390 Type_Directory,391 /** The usual 32-bit hack. */392 Type_32Bit_Hack = 0x7fffffff393 };394 395 enum Storage396 {397 Storage_Unknown = 0,398 Storage_Local,399 Storage_Temporary,400 /** The usual 32-bit hack. */401 Storage_32Bit_Hack = 0x7fffffff402 };403 404 /**405 * Enumeration for specifying an URI object view406 * for representing its data accordingly.407 */408 enum View409 {410 /** Unknown view, do not use. */411 View_Unknown = 0,412 /** Handle data from the source point of view. */413 View_Source,414 /** Handle data from the destination point of view. */415 View_Target,416 /** The usual 32-bit hack. */417 View_Dest_32Bit_Hack = 0x7fffffff418 };419 420 SharedClipboardURIObject(void);421 SharedClipboardURIObject(Type type, const RTCString &strSrcPathAbs = "", const RTCString &strDstPathAbs = "");422 virtual ~SharedClipboardURIObject(void);423 424 public:425 426 /**427 * Returns the given absolute source path of the object.428 *429 * @return Absolute source path of the object.430 */431 const RTCString &GetSourcePathAbs(void) const { return m_strSrcPathAbs; }432 433 /**434 * Returns the given, absolute destination path of the object.435 *436 * @return Absolute destination path of the object.437 */438 const RTCString &GetDestPathAbs(void) const { return m_strTgtPathAbs; }439 440 RTFMODE GetMode(void) const;441 442 uint64_t GetProcessed(void) const;443 444 uint64_t GetSize(void) const;445 446 /**447 * Returns the object's type.448 *449 * @return The object's type.450 */451 Type GetType(void) const { return m_enmType; }452 453 /**454 * Returns the object's view.455 *456 * @return The object's view.457 */458 View GetView(void) const { return m_enmView; }459 460 public:461 462 int SetSize(uint64_t cbSize);463 464 public:465 466 void Close(void);467 bool IsComplete(void) const;468 bool IsOpen(void) const;469 int OpenDirectory(View enmView, uint32_t fCreate = 0, RTFMODE fMode = 0);470 int OpenDirectoryEx(const RTCString &strPathAbs, View enmView,471 uint32_t fCreate = 0, RTFMODE fMode = 0,472 SHAREDCLIPBOARDURIOBJECTFLAGS fFlags = SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE);473 int OpenFile(View enmView, uint64_t fOpen = 0, RTFMODE fMode = 0);474 int OpenFileEx(const RTCString &strPathAbs, View enmView,475 uint64_t fOpen = 0, RTFMODE fMode = 0,476 SHAREDCLIPBOARDURIOBJECTFLAGS fFlags = SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE);477 int QueryInfo(View enmView);478 int Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead);479 void Reset(void);480 int SetDirectoryData(const RTCString &strPathAbs, View enmView, uint32_t fOpen = 0, RTFMODE fMode = 0,481 SHAREDCLIPBOARDURIOBJECTFLAGS fFlags = SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE);482 int SetFileData(const RTCString &strPathAbs, View enmView, uint64_t fOpen = 0, RTFMODE fMode = 0,483 SHAREDCLIPBOARDURIOBJECTFLAGS fFlags = SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE);484 int Write(const void *pvBuf, size_t cbBuf, uint32_t *pcbWritten);485 486 public:487 488 static int RebaseURIPath(RTCString &strPath, const RTCString &strBaseOld = "", const RTCString &strBaseNew = "");489 490 protected:491 492 void closeInternal(void);493 int setDirectoryDataInternal(const RTCString &strPathAbs, View enmView, uint32_t fCreate = 0, RTFMODE fMode = 0,494 SHAREDCLIPBOARDURIOBJECTFLAGS fFlags = SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE);495 int setFileDataInternal(const RTCString &strPathAbs, View enmView, uint64_t fOpen = 0, RTFMODE fMode = 0,496 SHAREDCLIPBOARDURIOBJECTFLAGS fFlags = SHAREDCLIPBOARDURIOBJECT_FLAGS_NONE);497 int queryInfoInternal(View enmView);498 499 protected:500 501 /** The object's type. */502 Type m_enmType;503 /** The object's view. */504 View m_enmView;505 /** Where the object is being stored to. */506 Storage m_enmStorage;507 /** Absolute path (base) for the source. */508 RTCString m_strSrcPathAbs;509 /** Absolute path (base) for the target. */510 RTCString m_strTgtPathAbs;511 /** Saved SHAREDCLIPBOARDURIOBJECT_FLAGS. */512 uint32_t m_fFlags;513 /** Requested file mode.514 * Note: The actual file mode of an opened file will be in objInfo. */515 RTFMODE m_fModeRequested;516 517 /** Union containing data depending on the object's type. */518 union519 {520 /** Structure containing members for objects that521 * are files. */522 struct523 {524 /** File handle. */525 RTFILE hFile;526 /** File system object information of this file. */527 RTFSOBJINFO objInfo;528 /** Requested file open flags. */529 uint32_t fOpenRequested;530 /** Bytes to proces for reading/writing. */531 uint64_t cbToProcess;532 /** Bytes processed reading/writing. */533 uint64_t cbProcessed;534 } File;535 struct536 {537 /** Directory handle. */538 RTDIR hDir;539 /** File system object information of this directory. */540 RTFSOBJINFO objInfo;541 /** Requested directory creation flags. */542 uint32_t fCreateRequested;543 } Dir;544 } u;545 };546 344 547 345 /** … … 644 442 } SHAREDCLIPBOARDAREAOBJTYPE; 645 443 444 /** Clipboard area ID. A valid area is >= 1. 445 * If 0 is specified, the last (most recent) area is meant. 446 * Set to UINT32_MAX if not initialized. */ 447 typedef uint32_t SHAREDCLIPBOARDAREAID; 448 449 /** Defines a non-initialized (nil) clipboard area. */ 450 #define NIL_SHAREDCLIPBOARDAREAID UINT32_MAX 451 452 /** SharedClipboardArea open flags. */ 453 typedef uint32_t SHAREDCLIPBOARDAREAOPENFLAGS; 454 455 /** No clipboard area open flags specified. */ 456 #define SHAREDCLIPBOARDAREA_OPEN_FLAGS_NONE 0 457 /** The clipboard area must not exist yet. */ 458 #define SHAREDCLIPBOARDAREA_OPEN_FLAGS_MUST_NOT_EXIST RT_BIT(0) 459 /** Mask of all valid clipboard area open flags. */ 460 #define SHAREDCLIPBOARDAREA_OPEN_FLAGS_VALID_MASK 0x1 461 646 462 /** Defines a clipboard area object state. */ 647 463 typedef uint32_t SHAREDCLIPBOARDAREAOBJSTATE; … … 739 555 int SharedClipboardPathSanitizeFilename(char *pszPath, size_t cbPath); 740 556 int SharedClipboardPathSanitize(char *pszPath, size_t cbPath); 741 742 /** SharedClipboardURIList flags. */743 typedef uint32_t SHAREDCLIPBOARDURILISTFLAGS;744 745 /** No flags specified. */746 #define SHAREDCLIPBOARDURILIST_FLAGS_NONE 0747 /** Keep the original paths, don't convert paths to relative ones. */748 #define SHAREDCLIPBOARDURILIST_FLAGS_ABSOLUTE_PATHS RT_BIT(0)749 /** Resolve all symlinks. */750 #define SHAREDCLIPBOARDURILIST_FLAGS_RESOLVE_SYMLINKS RT_BIT(1)751 /** Keep the files + directory entries open while752 * being in this list. */753 #define SHAREDCLIPBOARDURILIST_FLAGS_KEEP_OPEN RT_BIT(2)754 /** Lazy loading: Only enumerate sub directories when needed.755 ** @todo Implement lazy loading. */756 #define SHAREDCLIPBOARDURILIST_FLAGS_LAZY RT_BIT(3)757 758 /** Mask of all valid Shared Clipboard URI list flags. */759 #define SHAREDCLIPBOARDURILIST_FLAGS_VALID_MASK UINT32_C(0xF)760 761 class SharedClipboardURIList762 {763 public:764 765 SharedClipboardURIList(void);766 virtual ~SharedClipboardURIList(void);767 768 public:769 770 int AppendNativePath(const char *pszPath, SHAREDCLIPBOARDURILISTFLAGS fFlags);771 int AppendNativePathsFromList(const char *pszNativePaths, size_t cbNativePaths, SHAREDCLIPBOARDURILISTFLAGS fFlags);772 int AppendNativePathsFromList(const RTCList<RTCString> &lstNativePaths, SHAREDCLIPBOARDURILISTFLAGS fFlags);773 int AppendURIObject(SharedClipboardURIObject *pObject);774 int AppendURIPath(const char *pszURI, SHAREDCLIPBOARDURILISTFLAGS fFlags);775 int AppendURIPathsFromList(const char *pszURIPaths, size_t cbURIPaths, SHAREDCLIPBOARDURILISTFLAGS fFlags);776 int AppendURIPathsFromList(const RTCList<RTCString> &lstURI, SHAREDCLIPBOARDURILISTFLAGS fFlags);777 778 void Clear(void);779 SharedClipboardURIObject *At(size_t i) const { return m_lstTree.at(i); }780 SharedClipboardURIObject *First(void) const { return m_lstTree.first(); }781 bool IsEmpty(void) const { return m_lstTree.isEmpty(); }782 void RemoveFirst(void);783 int SetFromURIData(const void *pvData, size_t cbData, SHAREDCLIPBOARDURILISTFLAGS fFlags);784 785 RTCString GetRootEntries(const RTCString &strPathBase = "", const RTCString &strSeparator = "\r\n") const;786 uint64_t GetRootCount(void) const { return m_lstRoot.size(); }787 uint64_t GetTotalCount(void) const { return m_cTotal; }788 uint64_t GetTotalBytes(void) const { return m_cbTotal; }789 790 protected:791 792 int appendEntry(const char *pcszSource, const char *pcszTarget, SHAREDCLIPBOARDURILISTFLAGS fFlags);793 int appendObject(SharedClipboardURIObject *pObject);794 int appendPathRecursive(const char *pcszSrcPath, const char *pcszDstPath, const char *pcszDstBase, size_t cchDstBase, SHAREDCLIPBOARDURILISTFLAGS fFlags);795 796 protected:797 798 /** List of all top-level file/directory entries.799 * Note: All paths are kept internally as UNIX paths for800 * easier conversion/handling! */801 RTCList<RTCString> m_lstRoot;802 /** List of all URI objects added. The list's content803 * might vary depending on how the objects are being804 * added (lazy or not). */805 RTCList<SharedClipboardURIObject *> m_lstTree;806 /** Total number of all URI objects. */807 uint64_t m_cTotal;808 /** Total size of all URI objects, that is, the file809 * size of all objects (in bytes).810 * Note: Do *not* size_t here, as we also want to support large files811 * on 32-bit guests. */812 uint64_t m_cbTotal;813 };814 557 815 558 int SharedClipboardURIListHdrAlloc(PVBOXCLIPBOARDLISTHDR *ppListHdr); -
trunk/src/VBox/Additions/WINNT/VBoxTray/Makefile.kmk
r79347 r79631 62 62 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardPath.cpp \ 63 63 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp \ 64 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardURIList.cpp \65 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardURIObject.cpp \66 64 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp \ 67 65 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-uri.cpp -
trunk/src/VBox/HostServices/SharedClipboard/Makefile.kmk
r79497 r79631 51 51 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardArea.cpp \ 52 52 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardPath.cpp \ 53 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardURIList.cpp \54 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/ClipboardURIObject.cpp \55 53 $(PATH_ROOT)/src/VBox/GuestHost/SharedClipboard/clipboard-uri.cpp 56 54 VBoxSharedClipboard_SOURCES.win += \ -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h
r79630 r79631 42 42 43 43 #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST 44 /**45 * Structure for handling a single URI object context.46 */47 typedef struct _VBOXCLIPBOARDCLIENTURIOBJCTX48 {49 /** Pointer to current object being processed. */50 SharedClipboardURIObject *pObj;51 } VBOXCLIPBOARDCLIENTURIOBJCTX, *PVBOXCLIPBOARDCLIENTURIOBJCTX;52 53 44 struct VBOXCLIPBOARDCLIENTSTATE; 54 45 #endif /* VBOX_WITH_SHARED_CLIPBOARD_URI_LIST */
Note:
See TracChangeset
for help on using the changeset viewer.