1 | /* $Id: vbsfpath.h 105087 2024-07-01 23:27:59Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Shared Folders Service - Guest/host path convertion and verification.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_SharedFolders_vbsfpath_h
|
---|
29 | #define VBOX_INCLUDED_SRC_SharedFolders_vbsfpath_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "shfl.h"
|
---|
35 | #include <VBox/shflsvc.h>
|
---|
36 |
|
---|
37 | #define VBSF_O_PATH_WILDCARD UINT32_C(0x00000001)
|
---|
38 | #define VBSF_O_PATH_PRESERVE_LAST_COMPONENT UINT32_C(0x00000002)
|
---|
39 | #define VBSF_O_PATH_CHECK_ROOT_ESCAPE UINT32_C(0x00000004)
|
---|
40 | #define VBSF_O_PATH_CHECK_SYMLINK_POLICY UINT32_C(0x00000008)
|
---|
41 |
|
---|
42 | #define VBSF_F_PATH_HAS_WILDCARD_IN_PREFIX UINT32_C(0x00000001) /* A component before the last one contains a wildcard. */
|
---|
43 | #define VBSF_F_PATH_HAS_WILDCARD_IN_LAST UINT32_C(0x00000002) /* The last component contains a wildcard. */
|
---|
44 |
|
---|
45 | /**
|
---|
46 | *
|
---|
47 | * @param pClient Shared folder client.
|
---|
48 | * @param hRoot Root handle.
|
---|
49 | * @param pGuestString Guest want to access the path.
|
---|
50 | * @param cbGuestString Size of pGuestString memory buffer.
|
---|
51 | * @param ppszHostPath Returned full host path: root prefix + guest path.
|
---|
52 | * @param pcbHostPathRoot Length of the root prefix in bytes. Optional, can be NULL.
|
---|
53 | * @param fu32Options Options.
|
---|
54 | * @param pfu32PathFlags VBSF_F_PATH_* flags. Optional, can be NULL.
|
---|
55 | */
|
---|
56 | int vbsfPathGuestToHost(SHFLCLIENTDATA *pClient, SHFLROOT hRoot,
|
---|
57 | PCSHFLSTRING pGuestString, uint32_t cbGuestString,
|
---|
58 | char **ppszHostPath, uint32_t *pcbHostPathRoot,
|
---|
59 | uint32_t fu32Options, uint32_t *pfu32PathFlags);
|
---|
60 |
|
---|
61 | /** Free the host path returned by vbsfPathGuestToHost.
|
---|
62 | *
|
---|
63 | * @param pszHostPath Host path string.
|
---|
64 | */
|
---|
65 | void vbsfFreeHostPath(char *pszHostPath);
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Build the absolute path by combining an absolute pszRoot and a relative pszPath.
|
---|
69 | * The resulting path does not contain '.' and '..' components.
|
---|
70 | * Similar to RTPathAbsEx but with support for Windows extended-length paths ("\\?\" prefix).
|
---|
71 | * Uses RTPathAbsEx for regular paths and on non-Windows hosts.
|
---|
72 | *
|
---|
73 | * @param pszRoot The absolute prefix. It is copied to the pszAbsPath without any processing.
|
---|
74 | * If NULL then the pszPath must be converted to the absolute path.
|
---|
75 | * @param pszPath The relative path to be appended to pszRoot. Already has correct delimiters (RTPATH_SLASH).
|
---|
76 | * @param pszAbsPath Where to store the resulting absolute path.
|
---|
77 | * @param cbAbsPath Size of pszAbsBuffer in bytes.
|
---|
78 | */
|
---|
79 | int vbsfPathAbs(const char *pszRoot, const char *pszPath, char *pszAbsPath, size_t cbAbsPath);
|
---|
80 |
|
---|
81 | #endif /* !VBOX_INCLUDED_SRC_SharedFolders_vbsfpath_h */
|
---|