1 | /* $Id: vbsfpath.h 98103 2023-01-17 14:15:46Z 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 |
|
---|
41 | #define VBSF_F_PATH_HAS_WILDCARD_IN_PREFIX UINT32_C(0x00000001) /* A component before the last one contains a wildcard. */
|
---|
42 | #define VBSF_F_PATH_HAS_WILDCARD_IN_LAST UINT32_C(0x00000002) /* The last component contains a wildcard. */
|
---|
43 |
|
---|
44 | /**
|
---|
45 | *
|
---|
46 | * @param pClient Shared folder client.
|
---|
47 | * @param hRoot Root handle.
|
---|
48 | * @param pGuestString Guest want to access the path.
|
---|
49 | * @param cbGuestString Size of pGuestString memory buffer.
|
---|
50 | * @param ppszHostPath Returned full host path: root prefix + guest path.
|
---|
51 | * @param pcbHostPathRoot Length of the root prefix in bytes. Optional, can be NULL.
|
---|
52 | * @param fu32Options Options.
|
---|
53 | * @param pfu32PathFlags VBSF_F_PATH_* flags. Optional, can be NULL.
|
---|
54 | */
|
---|
55 | int vbsfPathGuestToHost(SHFLCLIENTDATA *pClient, SHFLROOT hRoot,
|
---|
56 | PCSHFLSTRING pGuestString, uint32_t cbGuestString,
|
---|
57 | char **ppszHostPath, uint32_t *pcbHostPathRoot,
|
---|
58 | uint32_t fu32Options, uint32_t *pfu32PathFlags);
|
---|
59 |
|
---|
60 | /** Free the host path returned by vbsfPathGuestToHost.
|
---|
61 | *
|
---|
62 | * @param pszHostPath Host path string.
|
---|
63 | */
|
---|
64 | void vbsfFreeHostPath(char *pszHostPath);
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Build the absolute path by combining an absolute pszRoot and a relative pszPath.
|
---|
68 | * The resulting path does not contain '.' and '..' components.
|
---|
69 | * Similar to RTPathAbsEx but with support for Windows extended-length paths ("\\?\" prefix).
|
---|
70 | * Uses RTPathAbsEx for regular paths and on non-Windows hosts.
|
---|
71 | *
|
---|
72 | * @param pszRoot The absolute prefix. It is copied to the pszAbsPath without any processing.
|
---|
73 | * If NULL then the pszPath must be converted to the absolute path.
|
---|
74 | * @param pszPath The relative path to be appended to pszRoot. Already has correct delimiters (RTPATH_SLASH).
|
---|
75 | * @param pszAbsPath Where to store the resulting absolute path.
|
---|
76 | * @param cbAbsPath Size of pszAbsBuffer in bytes.
|
---|
77 | */
|
---|
78 | int vbsfPathAbs(const char *pszRoot, const char *pszPath, char *pszAbsPath, size_t cbAbsPath);
|
---|
79 |
|
---|
80 | #endif /* !VBOX_INCLUDED_SRC_SharedFolders_vbsfpath_h */
|
---|