1 | /* $Id: GuestControl.h 98665 2023-02-21 07:49:56Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Guest Control - Common Guest and Host Code.
|
---|
4 | *
|
---|
5 | * @todo r=bird: Just merge this with GuestControlSvc.h!
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2016-2023 Oracle and/or its affiliates.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox base platform packages, as
|
---|
12 | * available from https://www.alldomusa.eu.org.
|
---|
13 | *
|
---|
14 | * This program is free software; you can redistribute it and/or
|
---|
15 | * modify it under the terms of the GNU General Public License
|
---|
16 | * as published by the Free Software Foundation, in version 3 of the
|
---|
17 | * License.
|
---|
18 | *
|
---|
19 | * This program is distributed in the hope that it will be useful, but
|
---|
20 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | * General Public License for more details.
|
---|
23 | *
|
---|
24 | * You should have received a copy of the GNU General Public License
|
---|
25 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | *
|
---|
27 | * The contents of this file may alternatively be used under the terms
|
---|
28 | * of the Common Development and Distribution License Version 1.0
|
---|
29 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
30 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
31 | * CDDL are applicable instead of those of the GPL.
|
---|
32 | *
|
---|
33 | * You may elect to license modified versions of this file under the
|
---|
34 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
35 | *
|
---|
36 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
37 | */
|
---|
38 |
|
---|
39 | #ifndef VBOX_INCLUDED_GuestHost_GuestControl_h
|
---|
40 | #define VBOX_INCLUDED_GuestHost_GuestControl_h
|
---|
41 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
42 | # pragma once
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | #include <iprt/time.h>
|
---|
46 | #include <iprt/types.h>
|
---|
47 |
|
---|
48 | /* Everything defined in this file lives in this namespace. */
|
---|
49 | namespace guestControl {
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Process status when executed in the guest.
|
---|
53 | */
|
---|
54 | enum eProcessStatus
|
---|
55 | {
|
---|
56 | /** Process is in an undefined state. */
|
---|
57 | PROC_STS_UNDEFINED = 0,
|
---|
58 | /** Process has been started. */
|
---|
59 | PROC_STS_STARTED = 1,
|
---|
60 | /** Process terminated normally. */
|
---|
61 | PROC_STS_TEN = 2,
|
---|
62 | /** Process terminated via signal. */
|
---|
63 | PROC_STS_TES = 3,
|
---|
64 | /** Process terminated abnormally. */
|
---|
65 | PROC_STS_TEA = 4,
|
---|
66 | /** Process timed out and was killed. */
|
---|
67 | PROC_STS_TOK = 5,
|
---|
68 | /** Process timed out and was not killed successfully. */
|
---|
69 | PROC_STS_TOA = 6,
|
---|
70 | /** Service/OS is stopping, process was killed. */
|
---|
71 | PROC_STS_DWN = 7,
|
---|
72 | /** Something went wrong (error code in flags). */
|
---|
73 | PROC_STS_ERROR = 8
|
---|
74 | };
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Input flags, set by the host. This is needed for
|
---|
78 | * handling flags on the guest side.
|
---|
79 | * Note: Has to match Main's ProcessInputFlag_* flags!
|
---|
80 | */
|
---|
81 | #define GUEST_PROC_IN_FLAG_NONE 0x0
|
---|
82 | #define GUEST_PROC_IN_FLAG_EOF RT_BIT(0)
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * Guest session creation flags.
|
---|
86 | * Only handled internally at the moment.
|
---|
87 | */
|
---|
88 | #define SESSIONCREATIONFLAG_NONE 0x0
|
---|
89 |
|
---|
90 | /** @name DIRREMOVEREC_FLAG_XXX - Guest directory removement flags.
|
---|
91 | * Essentially using what IPRT's RTDIRRMREC_F_
|
---|
92 | * defines have to offer.
|
---|
93 | * @{
|
---|
94 | */
|
---|
95 | /** No remove flags specified. */
|
---|
96 | #define DIRREMOVEREC_FLAG_NONE UINT32_C(0x0)
|
---|
97 | /** Recursively deletes the directory contents. */
|
---|
98 | #define DIRREMOVEREC_FLAG_RECURSIVE RT_BIT(0)
|
---|
99 | /** Delete the content of the directory and the directory itself. */
|
---|
100 | #define DIRREMOVEREC_FLAG_CONTENT_AND_DIR RT_BIT(1)
|
---|
101 | /** Only delete the content of the directory, omit the directory it self. */
|
---|
102 | #define DIRREMOVEREC_FLAG_CONTENT_ONLY RT_BIT(2)
|
---|
103 | /** Mask of valid flags. */
|
---|
104 | #define DIRREMOVEREC_FLAG_VALID_MASK UINT32_C(0x00000007)
|
---|
105 | /** @} */
|
---|
106 |
|
---|
107 | /** @name GUEST_PROC_CREATE_FLAG_XXX - Guest process creation flags.
|
---|
108 | * @note Has to match Main's ProcessCreateFlag_* flags!
|
---|
109 | * @{
|
---|
110 | */
|
---|
111 | #define GUEST_PROC_CREATE_FLAG_NONE UINT32_C(0x0)
|
---|
112 | #define GUEST_PROC_CREATE_FLAG_WAIT_START RT_BIT(0)
|
---|
113 | #define GUEST_PROC_CREATE_FLAG_IGNORE_ORPHANED RT_BIT(1)
|
---|
114 | #define GUEST_PROC_CREATE_FLAG_HIDDEN RT_BIT(2)
|
---|
115 | #define GUEST_PROC_CREATE_FLAG_PROFILE RT_BIT(3)
|
---|
116 | #define GUEST_PROC_CREATE_FLAG_WAIT_STDOUT RT_BIT(4)
|
---|
117 | #define GUEST_PROC_CREATE_FLAG_WAIT_STDERR RT_BIT(5)
|
---|
118 | #define GUEST_PROC_CREATE_FLAG_EXPAND_ARGUMENTS RT_BIT(6)
|
---|
119 | #define GUEST_PROC_CREATE_FLAG_UNQUOTED_ARGS RT_BIT(7)
|
---|
120 | /** @} */
|
---|
121 |
|
---|
122 | /** @name GUEST_PROC_OUT_H_XXX - Pipe handle IDs used internally for referencing
|
---|
123 | * to a certain pipe buffer.
|
---|
124 | * @{
|
---|
125 | */
|
---|
126 | #define GUEST_PROC_OUT_H_STDOUT_DEPRECATED 0 /**< Needed for VBox hosts < 4.1.0. */
|
---|
127 | #define GUEST_PROC_OUT_H_STDOUT 1
|
---|
128 | #define GUEST_PROC_OUT_H_STDERR 2
|
---|
129 | /** @} */
|
---|
130 |
|
---|
131 | /** @name PATHRENAME_FLAG_XXX - Guest path rename flags.
|
---|
132 | * Essentially using what IPRT's RTPATHRENAME_FLAGS_XXX have to offer.
|
---|
133 | * @{
|
---|
134 | */
|
---|
135 | /** Do not replace anything. */
|
---|
136 | #define PATHRENAME_FLAG_NO_REPLACE UINT32_C(0)
|
---|
137 | /** This will replace attempt any target which isn't a directory. */
|
---|
138 | #define PATHRENAME_FLAG_REPLACE RT_BIT(0)
|
---|
139 | /** Don't allow symbolic links as part of the path. */
|
---|
140 | #define PATHRENAME_FLAG_NO_SYMLINKS RT_BIT(1)
|
---|
141 | /** Mask of valid flags. */
|
---|
142 | #define PATHRENAME_FLAG_VALID_MASK UINT32_C(0x00000003)
|
---|
143 | /** @} */
|
---|
144 |
|
---|
145 | /** @name GSTCTL_CREATETEMP_F_XXX - Guest temporary directory/file creation flags.
|
---|
146 | * @{
|
---|
147 | */
|
---|
148 | /** Does not specify anything. */
|
---|
149 | #define GSTCTL_CREATETEMP_F_NONE UINT32_C(0)
|
---|
150 | /** Creates a directory instead of a file. */
|
---|
151 | #define GSTCTL_CREATETEMP_F_DIRECTORY RT_BIT(0)
|
---|
152 | /** Creates a secure temporary file / directory.
|
---|
153 | * Might not be supported on all (guest) OSes.
|
---|
154 | *
|
---|
155 | * @sa IPRT's implementation of RTDirCreateTempSecure() / RTFileCreateTempSecumre(). */
|
---|
156 | #define GSTCTL_CREATETEMP_F_SECURE RT_BIT(1)
|
---|
157 | /** Mask of valid flags. */
|
---|
158 | #define GSTCTL_CREATETEMP_F_VALID_MASK UINT32_C(0x00000003)
|
---|
159 | /** @} */
|
---|
160 |
|
---|
161 | /** @name GSTCTL_CREATEDIRECTORY_F_XXX - Guest directory creation flags.
|
---|
162 | * @{
|
---|
163 | */
|
---|
164 | /** Does not specify anything. */
|
---|
165 | #define GSTCTL_CREATEDIRECTORY_F_NONE UINT32_C(0)
|
---|
166 | /** Also creates parent directories if they don't exist yet. */
|
---|
167 | #define GSTCTL_CREATEDIRECTORY_F_PARENTS RT_BIT(0)
|
---|
168 | /** Mask of valid flags. */
|
---|
169 | #define GSTCTL_CREATEDIRECTORY_F_VALID_MASK UINT32_C(0x00000001)
|
---|
170 | /** @} */
|
---|
171 |
|
---|
172 | /** @name GUEST_SHUTDOWN_FLAG_XXX - Guest shutdown flags.
|
---|
173 | * Must match Main's GuestShutdownFlag_ definitions.
|
---|
174 | * @{
|
---|
175 | */
|
---|
176 | #define GUEST_SHUTDOWN_FLAG_NONE UINT32_C(0)
|
---|
177 | #define GUEST_SHUTDOWN_FLAG_POWER_OFF RT_BIT(0)
|
---|
178 | #define GUEST_SHUTDOWN_FLAG_REBOOT RT_BIT(1)
|
---|
179 | #define GUEST_SHUTDOWN_FLAG_FORCE RT_BIT(2)
|
---|
180 | /** @} */
|
---|
181 |
|
---|
182 | /** @name Defines for default (initial) guest process buffer lengths.
|
---|
183 | * Note: These defaults were the maximum values before; so be careful when raising those in order to
|
---|
184 | * not break running with older Guest Additions.
|
---|
185 | * @{
|
---|
186 | */
|
---|
187 | #define GUEST_PROC_DEF_CMD_LEN _1K
|
---|
188 | #define GUEST_PROC_DEF_ARGS_LEN _1K
|
---|
189 | #define GUEST_PROC_DEF_ENV_LEN _1K
|
---|
190 | #define GUEST_PROC_DEF_USER_LEN 128
|
---|
191 | #define GUEST_PROC_DEF_PASSWORD_LEN 128
|
---|
192 | #define GUEST_PROC_DEF_DOMAIN_LEN 256
|
---|
193 | /** @} */
|
---|
194 |
|
---|
195 | /** @name Defines for maximum guest process buffer lengths.
|
---|
196 | * @{
|
---|
197 | */
|
---|
198 | #define GUEST_PROC_MAX_CMD_LEN _1M
|
---|
199 | #define GUEST_PROC_MAX_ARGS_LEN _2M
|
---|
200 | #define GUEST_PROC_MAX_ENV_LEN _4M
|
---|
201 | #define GUEST_PROC_MAX_USER_LEN _64K
|
---|
202 | #define GUEST_PROC_MAX_PASSWORD_LEN _64K
|
---|
203 | #define GUEST_PROC_MAX_DOMAIN_LEN _64K
|
---|
204 | /** @} */
|
---|
205 |
|
---|
206 | /** @name Internal tools built into VBoxService which are used in order
|
---|
207 | * to accomplish tasks host<->guest.
|
---|
208 | * @{
|
---|
209 | */
|
---|
210 | #define VBOXSERVICE_TOOL_CAT "vbox_cat"
|
---|
211 | #define VBOXSERVICE_TOOL_LS "vbox_ls"
|
---|
212 | #define VBOXSERVICE_TOOL_RM "vbox_rm"
|
---|
213 | #define VBOXSERVICE_TOOL_MKDIR "vbox_mkdir"
|
---|
214 | #define VBOXSERVICE_TOOL_MKTEMP "vbox_mktemp"
|
---|
215 | #define VBOXSERVICE_TOOL_STAT "vbox_stat"
|
---|
216 | /** @} */
|
---|
217 |
|
---|
218 | /** Special process exit codes for "vbox_cat". */
|
---|
219 | typedef enum VBOXSERVICETOOLBOX_CAT_EXITCODE
|
---|
220 | {
|
---|
221 | VBOXSERVICETOOLBOX_CAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
|
---|
222 | VBOXSERVICETOOLBOX_CAT_EXITCODE_FILE_NOT_FOUND,
|
---|
223 | VBOXSERVICETOOLBOX_CAT_EXITCODE_PATH_NOT_FOUND,
|
---|
224 | VBOXSERVICETOOLBOX_CAT_EXITCODE_SHARING_VIOLATION,
|
---|
225 | VBOXSERVICETOOLBOX_CAT_EXITCODE_IS_A_DIRECTORY,
|
---|
226 | /** The usual 32-bit type hack. */
|
---|
227 | VBOXSERVICETOOLBOX_CAT_32BIT_HACK = 0x7fffffff
|
---|
228 | } VBOXSERVICETOOLBOX_CAT_EXITCODE;
|
---|
229 |
|
---|
230 | /** Special process exit codes for "vbox_stat". */
|
---|
231 | typedef enum VBOXSERVICETOOLBOX_STAT_EXITCODE
|
---|
232 | {
|
---|
233 | VBOXSERVICETOOLBOX_STAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
|
---|
234 | VBOXSERVICETOOLBOX_STAT_EXITCODE_FILE_NOT_FOUND,
|
---|
235 | VBOXSERVICETOOLBOX_STAT_EXITCODE_PATH_NOT_FOUND,
|
---|
236 | VBOXSERVICETOOLBOX_STAT_EXITCODE_NET_PATH_NOT_FOUND,
|
---|
237 | VBOXSERVICETOOLBOX_STAT_EXITCODE_INVALID_NAME,
|
---|
238 | /** The usual 32-bit type hack. */
|
---|
239 | VBOXSERVICETOOLBOX_STAT_32BIT_HACK = 0x7fffffff
|
---|
240 | } VBOXSERVICETOOLBOX_STAT_EXITCODE;
|
---|
241 |
|
---|
242 | /**
|
---|
243 | * Input status, reported by the client.
|
---|
244 | */
|
---|
245 | enum eInputStatus
|
---|
246 | {
|
---|
247 | /** Input is in an undefined state. */
|
---|
248 | INPUT_STS_UNDEFINED = 0,
|
---|
249 | /** Input was written (partially, see cbProcessed). */
|
---|
250 | INPUT_STS_WRITTEN = 1,
|
---|
251 | /** Input failed with an error (see flags for rc). */
|
---|
252 | INPUT_STS_ERROR = 20,
|
---|
253 | /** Process has abandoned / terminated input handling. */
|
---|
254 | INPUT_STS_TERMINATED = 21,
|
---|
255 | /** Too much input data. */
|
---|
256 | INPUT_STS_OVERFLOW = 30
|
---|
257 | };
|
---|
258 |
|
---|
259 | /**
|
---|
260 | * Guest file system object -- additional information in a GSTCTLFSOBJATTR object.
|
---|
261 | */
|
---|
262 | enum GSTCTLFSOBJATTRADD
|
---|
263 | {
|
---|
264 | /** No additional information is available / requested. */
|
---|
265 | GSTCTLFSOBJATTRADD_NOTHING = 1,
|
---|
266 | /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available /
|
---|
267 | * requested. */
|
---|
268 | GSTCTLFSOBJATTRADD_UNIX,
|
---|
269 | /** The additional unix attributes (RTFSOBJATTR::u::UnixOwner) are
|
---|
270 | * available / requested. */
|
---|
271 | GSTCTLFSOBJATTRADD_UNIX_OWNER,
|
---|
272 | /** The additional unix attributes (RTFSOBJATTR::u::UnixGroup) are
|
---|
273 | * available / requested. */
|
---|
274 | GSTCTLFSOBJATTRADD_UNIX_GROUP,
|
---|
275 | /** The additional extended attribute size (RTFSOBJATTR::u::EASize) is available / requested. */
|
---|
276 | GSTCTLFSOBJATTRADD_EASIZE,
|
---|
277 | /** The last valid item (inclusive).
|
---|
278 | * The valid range is RTFSOBJATTRADD_NOTHING thru RTFSOBJATTRADD_LAST. */
|
---|
279 | GSTCTLFSOBJATTRADD_LAST = GSTCTLFSOBJATTRADD_EASIZE,
|
---|
280 |
|
---|
281 | /** The usual 32-bit hack. */
|
---|
282 | GSTCTLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
|
---|
283 | };
|
---|
284 |
|
---|
285 | /** The number of bytes reserved for the additional attribute union. */
|
---|
286 | #define GSTCTLFSOBJATTRUNION_MAX_SIZE 128
|
---|
287 |
|
---|
288 | /**
|
---|
289 | * Additional Unix Attributes (GSTCTLFSOBJATTRADD_UNIX).
|
---|
290 | */
|
---|
291 | typedef struct GSTCTLFSOBJATTRUNIX
|
---|
292 | {
|
---|
293 | /** The user owning the filesystem object (st_uid).
|
---|
294 | * This field is NIL_RTUID if not supported. */
|
---|
295 | RTUID uid;
|
---|
296 |
|
---|
297 | /** The group the filesystem object is assigned (st_gid).
|
---|
298 | * This field is NIL_RTGID if not supported. */
|
---|
299 | RTGID gid;
|
---|
300 |
|
---|
301 | /** Number of hard links to this filesystem object (st_nlink).
|
---|
302 | * This field is 1 if the filesystem doesn't support hardlinking or
|
---|
303 | * the information isn't available.
|
---|
304 | */
|
---|
305 | uint32_t cHardlinks;
|
---|
306 |
|
---|
307 | /** The device number of the device which this filesystem object resides on (st_dev).
|
---|
308 | * This field is 0 if this information is not available. */
|
---|
309 | RTDEV INodeIdDevice;
|
---|
310 |
|
---|
311 | /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
|
---|
312 | * Together with INodeIdDevice, this field can be used as a OS wide unique id
|
---|
313 | * when both their values are not 0.
|
---|
314 | * This field is 0 if the information is not available.
|
---|
315 | *
|
---|
316 | * @remarks The special '..' dir always shows up with 0 on NTFS/Windows. */
|
---|
317 | RTINODE INodeId;
|
---|
318 |
|
---|
319 | /** User flags (st_flags).
|
---|
320 | * This field is 0 if this information is not available. */
|
---|
321 | uint32_t fFlags;
|
---|
322 |
|
---|
323 | /** The current generation number (st_gen).
|
---|
324 | * This field is 0 if this information is not available. */
|
---|
325 | uint32_t GenerationId;
|
---|
326 |
|
---|
327 | /** The device number of a character or block device type object (st_rdev).
|
---|
328 | * This field is 0 if the file isn't of a character or block device type and
|
---|
329 | * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
|
---|
330 | RTDEV Device;
|
---|
331 | } GSTCTLFSOBJATTRUNIX;
|
---|
332 |
|
---|
333 | /**
|
---|
334 | * Additional guest Unix attributes (GSTCTLFSOBJATTRADD_UNIX_OWNER).
|
---|
335 | */
|
---|
336 | typedef struct GSTCTLFSOBJATTRUNIXOWNER
|
---|
337 | {
|
---|
338 | /** The user owning the filesystem object (st_uid).
|
---|
339 | * This field is NIL_RTUID if not supported. */
|
---|
340 | RTUID uid;
|
---|
341 | /** The user name.
|
---|
342 | * Empty if not available or not supported, truncated if too long. */
|
---|
343 | char szName[GSTCTLFSOBJATTRUNION_MAX_SIZE - sizeof(RTUID)];
|
---|
344 | } GSTCTLFSOBJATTRUNIXOWNER;
|
---|
345 |
|
---|
346 | /**
|
---|
347 | * Additional guest Unix attributes (GSTCTLFSOBJATTRADD_UNIX_GROUP).
|
---|
348 | */
|
---|
349 | typedef struct GSTCTLFSOBJATTRUNIXGROUP
|
---|
350 | {
|
---|
351 | /** The user owning the filesystem object (st_uid).
|
---|
352 | * This field is NIL_RTUID if not supported. */
|
---|
353 | RTGID gid;
|
---|
354 | /** The group name.
|
---|
355 | * Empty if not available or not supported, truncated if too long. */
|
---|
356 | char szName[GSTCTLFSOBJATTRUNION_MAX_SIZE - sizeof(RTGID)];
|
---|
357 | } GSTCTLFSOBJATTRUNIXGROUP;
|
---|
358 |
|
---|
359 | /**
|
---|
360 | * Guest filesystem object attributes.
|
---|
361 | */
|
---|
362 | #pragma pack(1)
|
---|
363 | typedef struct GSTCTLFSOBJATTR
|
---|
364 | {
|
---|
365 | /** Mode flags (st_mode). RTFS_UNIX_*, RTFS_TYPE_*, and RTFS_DOS_*. */
|
---|
366 | RTFMODE fMode;
|
---|
367 |
|
---|
368 | /** The additional attributes available. */
|
---|
369 | GSTCTLFSOBJATTRADD enmAdditional;
|
---|
370 |
|
---|
371 | /**
|
---|
372 | * Additional attributes.
|
---|
373 | *
|
---|
374 | * Unless explicitly specified to an API, the API can provide additional
|
---|
375 | * data as it is provided by the underlying OS.
|
---|
376 | */
|
---|
377 | union GSTCTLFSOBJATTRUNION
|
---|
378 | {
|
---|
379 | /** Additional Unix Attributes - GUEST_FSOBJATTRADD_UNIX. */
|
---|
380 | GSTCTLFSOBJATTRUNIX Unix;
|
---|
381 | /** Additional Unix Owner Attributes - GUEST_FSOBJATTRADD_UNIX_OWNER. */
|
---|
382 | GSTCTLFSOBJATTRUNIXOWNER UnixOwner;
|
---|
383 | /** Additional Unix Group Attributes - GUEST_FSOBJATTRADD_UNIX_GROUP. */
|
---|
384 | GSTCTLFSOBJATTRUNIXGROUP UnixGroup;
|
---|
385 |
|
---|
386 | /**
|
---|
387 | * Extended attribute size is available when RTFS_DOS_HAVE_EA_SIZE is set.
|
---|
388 | */
|
---|
389 | struct GSTCTLFSOBJATTREASIZE
|
---|
390 | {
|
---|
391 | /** Size of EAs. */
|
---|
392 | RTFOFF cb;
|
---|
393 | } EASize;
|
---|
394 | /** Reserved space. */
|
---|
395 | uint8_t abReserveSpace[128];
|
---|
396 | } u;
|
---|
397 | } GSTCTLFSOBJATTR;
|
---|
398 | #pragma pack()
|
---|
399 | /** Pointer to a guest filesystem object attributes structure. */
|
---|
400 | typedef GSTCTLFSOBJATTR *PGSTCTLFSOBJATTR;
|
---|
401 | /** Pointer to a const guest filesystem object attributes structure. */
|
---|
402 | typedef const GSTCTLFSOBJATTR *PCGSTCTLFSOBJATTR;
|
---|
403 |
|
---|
404 | /** @name GSTCTL_QUERYINFO_F_XXX - Generic flags for querying guest file system information.
|
---|
405 | * @{ */
|
---|
406 | /** No guest stat flags specified. */
|
---|
407 | #define GSTCTL_QUERYINFO_F_NONE UINT32_C(0)
|
---|
408 | /** Last component: Work on the link. */
|
---|
409 | #define GSTCTL_QUERYINFO_F_ON_LINK RT_BIT_32(0)
|
---|
410 | /** Last component: Follow if link. */
|
---|
411 | #define GSTCTL_QUERYINFO_F_FOLLOW_LINK RT_BIT_32(1)
|
---|
412 | /** Don't allow symbolic links as part of the path. */
|
---|
413 | #define GSTCTL_QUERYINFO_F_NO_SYMLINKS RT_BIT_32(2)
|
---|
414 | /** GSTCTL_QUERYINFO_F_XXX flag valid mask. */
|
---|
415 | #define GSTCTL_QUERYINFO_F_VALID_MASK UINT32_C(0x00000007)
|
---|
416 | /** @} */
|
---|
417 |
|
---|
418 | /**
|
---|
419 | * Filter option for HOST_MSG_DIR_OPEN.
|
---|
420 | */
|
---|
421 | typedef enum GSTCTLDIRFILTER
|
---|
422 | {
|
---|
423 | /** The usual invalid 0 entry. */
|
---|
424 | GSTCTLDIRFILTER_INVALID = 0,
|
---|
425 | /** No filter should be applied (and none was specified). */
|
---|
426 | GSTCTLDIRFILTER_NONE,
|
---|
427 | /** The Windows NT filter.
|
---|
428 | * The following wildcard chars: *, ?, <, > and "
|
---|
429 | * The matching is done on the uppercased strings. */
|
---|
430 | GSTCTLDIRFILTER_WINNT,
|
---|
431 | /** The UNIX filter.
|
---|
432 | * The following wildcard chars: *, ?, [..]
|
---|
433 | * The matching is done on exact case. */
|
---|
434 | GSTCTLDIRFILTER_UNIX,
|
---|
435 | /** The UNIX filter, uppercased matching.
|
---|
436 | * Same as GSTCTLDIRFILTER_UNIX except that the strings are uppercased before comparing. */
|
---|
437 | GSTCTLDIRFILTER_UNIX_UPCASED,
|
---|
438 |
|
---|
439 | /** The usual full 32-bit value. */
|
---|
440 | GSTCTLDIRFILTER_32BIT_HACK = 0x7fffffff
|
---|
441 | } GSTCTLDIRFILTER;
|
---|
442 |
|
---|
443 | /** @name GSTCTLDIR_F_XXX - Directory flags for HOST_MSG_DIR_OPEN.
|
---|
444 | * @{ */
|
---|
445 | /** Don't allow symbolic links as part of the path.
|
---|
446 | * @remarks this flag is currently not implemented and will be ignored. */
|
---|
447 | #define GSTCTLDIR_F_NO_SYMLINKS RT_BIT_32(0)
|
---|
448 | /** Deny relative opening of anything above this directory. */
|
---|
449 | #define GSTCTLDIR_F_DENY_ASCENT RT_BIT_32(1)
|
---|
450 | /** Don't follow symbolic links in the final component. */
|
---|
451 | #define GSTCTLDIR_F_NO_FOLLOW RT_BIT_32(2)
|
---|
452 | /** Long path hack: Don't apply RTPathAbs to the path. */
|
---|
453 | #define GSTCTLDIR_F_NO_ABS_PATH RT_BIT_32(3)
|
---|
454 | /** Valid flag mask. */
|
---|
455 | #define GSTCTLDIR_F_VALID_MASK UINT32_C(0x0000000f)
|
---|
456 |
|
---|
457 | /**
|
---|
458 | * Guest filesystem object information structure.
|
---|
459 | *
|
---|
460 | * This is returned by
|
---|
461 | * - GUEST_FS_NOTIFYTYPE_QUERY_INFO
|
---|
462 | * - GUEST_DIR_NOTIFYTYPE_READ
|
---|
463 | */
|
---|
464 | #pragma pack(1)
|
---|
465 | typedef struct GSTCTLFSOBJINFO
|
---|
466 | {
|
---|
467 | /** Logical size (st_size).
|
---|
468 | * For normal files this is the size of the file.
|
---|
469 | * For symbolic links, this is the length of the path name contained
|
---|
470 | * in the symbolic link.
|
---|
471 | * For other objects this fields needs to be specified.
|
---|
472 | */
|
---|
473 | RTFOFF cbObject;
|
---|
474 |
|
---|
475 | /** Disk allocation size (st_blocks * DEV_BSIZE). */
|
---|
476 | RTFOFF cbAllocated;
|
---|
477 |
|
---|
478 | /** Time of last access (st_atime). */
|
---|
479 | RTTIMESPEC AccessTime;
|
---|
480 |
|
---|
481 | /** Time of last data modification (st_mtime). */
|
---|
482 | RTTIMESPEC ModificationTime;
|
---|
483 |
|
---|
484 | /** Time of last status change (st_ctime).
|
---|
485 | * If not available this is set to ModificationTime.
|
---|
486 | */
|
---|
487 | RTTIMESPEC ChangeTime;
|
---|
488 |
|
---|
489 | /** Time of file birth (st_birthtime).
|
---|
490 | * If not available this is set to ChangeTime.
|
---|
491 | */
|
---|
492 | RTTIMESPEC BirthTime;
|
---|
493 |
|
---|
494 | /** Attributes. */
|
---|
495 | GSTCTLFSOBJATTR Attr;
|
---|
496 |
|
---|
497 | } GSTCTLFSOBJINFO;
|
---|
498 | #pragma pack()
|
---|
499 | /** Pointer to a guest filesystem object information structure. */
|
---|
500 | typedef GSTCTLFSOBJINFO *PGSTCTLFSOBJINFO;
|
---|
501 | /** Pointer to a const guest filesystem object information structure. */
|
---|
502 | typedef const GSTCTLFSOBJINFO *PCGSTCTLFSOBJINFO;
|
---|
503 |
|
---|
504 | /**
|
---|
505 | * Guest directory entry with extended information.
|
---|
506 | *
|
---|
507 | * This is inspired by IPRT + the PC interfaces.
|
---|
508 | */
|
---|
509 | #pragma pack(1)
|
---|
510 | typedef struct GSTCTLDIRENTRYEX
|
---|
511 | {
|
---|
512 | /** Full information about the guest object. */
|
---|
513 | GSTCTLFSOBJINFO Info;
|
---|
514 | /** The length of the short field (number of RTUTF16 entries (not chars)).
|
---|
515 | * It is 16-bit for reasons of alignment. */
|
---|
516 | uint16_t cwcShortName;
|
---|
517 | /** The short name for 8.3 compatibility.
|
---|
518 | * Empty string if not available.
|
---|
519 | * Since the length is a bit tricky for a UTF-8 encoded name, and since this
|
---|
520 | * is practically speaking only a windows thing, it is encoded as UCS-2. */
|
---|
521 | RTUTF16 wszShortName[14];
|
---|
522 | /** The length of the filename. */
|
---|
523 | uint16_t cbName;
|
---|
524 | /** The filename. (no path)
|
---|
525 | * Using the pcbDirEntry parameter of RTDirReadEx makes this field variable in size. */
|
---|
526 | char szName[260];
|
---|
527 | } GSTCTLDIRENTRYEX;
|
---|
528 | #pragma pack()
|
---|
529 | /** Pointer to a guest directory entry. */
|
---|
530 | typedef GSTCTLDIRENTRYEX *PGSTCTLDIRENTRYEX;
|
---|
531 | /** Pointer to a const guest directory entry. */
|
---|
532 | typedef GSTCTLDIRENTRYEX const *PCGSTCTLDIRENTRYEX;
|
---|
533 |
|
---|
534 | } /* namespace guestControl */
|
---|
535 |
|
---|
536 | #endif /* !VBOX_INCLUDED_GuestHost_GuestControl_h */
|
---|
537 |
|
---|