1 | /* $Id: vbsfpath.h 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Shared Folders Service - Guest/host path convertion and verification.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 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 |
|
---|
18 | #ifndef VBOX_INCLUDED_SRC_SharedFolders_vbsfpath_h
|
---|
19 | #define VBOX_INCLUDED_SRC_SharedFolders_vbsfpath_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "shfl.h"
|
---|
25 | #include <VBox/shflsvc.h>
|
---|
26 |
|
---|
27 | #define VBSF_O_PATH_WILDCARD UINT32_C(0x00000001)
|
---|
28 | #define VBSF_O_PATH_PRESERVE_LAST_COMPONENT UINT32_C(0x00000002)
|
---|
29 | #define VBSF_O_PATH_CHECK_ROOT_ESCAPE UINT32_C(0x00000004)
|
---|
30 |
|
---|
31 | #define VBSF_F_PATH_HAS_WILDCARD_IN_PREFIX UINT32_C(0x00000001) /* A component before the last one contains a wildcard. */
|
---|
32 | #define VBSF_F_PATH_HAS_WILDCARD_IN_LAST UINT32_C(0x00000002) /* The last component contains a wildcard. */
|
---|
33 |
|
---|
34 | /**
|
---|
35 | *
|
---|
36 | * @param pClient Shared folder client.
|
---|
37 | * @param hRoot Root handle.
|
---|
38 | * @param pGuestString Guest want to access the path.
|
---|
39 | * @param cbGuestString Size of pGuestString memory buffer.
|
---|
40 | * @param ppszHostPath Returned full host path: root prefix + guest path.
|
---|
41 | * @param pcbHostPathRoot Length of the root prefix in bytes. Optional, can be NULL.
|
---|
42 | * @param fu32Options Options.
|
---|
43 | * @param pfu32PathFlags VBSF_F_PATH_* flags. Optional, can be NULL.
|
---|
44 | */
|
---|
45 | int vbsfPathGuestToHost(SHFLCLIENTDATA *pClient, SHFLROOT hRoot,
|
---|
46 | PCSHFLSTRING pGuestString, uint32_t cbGuestString,
|
---|
47 | char **ppszHostPath, uint32_t *pcbHostPathRoot,
|
---|
48 | uint32_t fu32Options, uint32_t *pfu32PathFlags);
|
---|
49 |
|
---|
50 | /** Free the host path returned by vbsfPathGuestToHost.
|
---|
51 | *
|
---|
52 | * @param pszHostPath Host path string.
|
---|
53 | */
|
---|
54 | void vbsfFreeHostPath(char *pszHostPath);
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Build the absolute path by combining an absolute pszRoot and a relative pszPath.
|
---|
58 | * The resulting path does not contain '.' and '..' components.
|
---|
59 | * Similar to RTPathAbsEx but with support for Windows extended-length paths ("\\?\" prefix).
|
---|
60 | * Uses RTPathAbsEx for regular paths and on non-Windows hosts.
|
---|
61 | *
|
---|
62 | * @param pszRoot The absolute prefix. It is copied to the pszAbsPath without any processing.
|
---|
63 | * If NULL then the pszPath must be converted to the absolute path.
|
---|
64 | * @param pszPath The relative path to be appended to pszRoot. Already has correct delimiters (RTPATH_SLASH).
|
---|
65 | * @param pszAbsPath Where to store the resulting absolute path.
|
---|
66 | * @param cbAbsPath Size of pszAbsBuffer in bytes.
|
---|
67 | */
|
---|
68 | int vbsfPathAbs(const char *pszRoot, const char *pszPath, char *pszAbsPath, size_t cbAbsPath);
|
---|
69 |
|
---|
70 | #endif /* !VBOX_INCLUDED_SRC_SharedFolders_vbsfpath_h */
|
---|