VirtualBox

source: vbox/trunk/include/VBox/GuestHost/GuestControl.h@ 99085

Last change on this file since 99085 was 99085, checked in by vboxsync, 21 months ago

Guest Control: Added directory listing support via IDirectory::list(). Added (randomized) testcase support for it. bugref:9783

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.6 KB
Line 
1/* $Id: GuestControl.h 99085 2023-03-21 12:15:00Z 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.virtualbox.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. */
49namespace guestControl {
50
51/**
52 * Process status when executed in the guest.
53 */
54enum 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() / RTFileCreateTempSecure(). */
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/** Don't allow symbolic links as part of the path. */
169#define GSTCTL_CREATEDIRECTORY_F_NO_SYMLINKS RT_BIT(1)
170/** Set the not-content-indexed flag (default). Windows only atm. */
171#define GSTCTL_CREATEDIRECTORY_F_NOT_CONTENT_INDEXED_DONT_SET RT_BIT(2)
172/** Ignore errors setting the not-content-indexed flag. Windows only atm. */
173#define GSTCTL_CREATEDIRECTORY_F_NOT_CONTENT_INDEXED_NOT_CRITICAL RT_BIT(3)
174/** Ignore umask when applying the mode. */
175#define GSTCTL_CREATEDIRECTORY_F_IGNORE_UMASK RT_BIT(4)
176/** Mask of valid flags. */
177#define GSTCTL_CREATEDIRECTORY_F_VALID_MASK UINT32_C(0x0000001F)
178/** @} */
179
180/** @name GUEST_SHUTDOWN_FLAG_XXX - Guest shutdown flags.
181 * Must match Main's GuestShutdownFlag_ definitions.
182 * @{
183 */
184#define GUEST_SHUTDOWN_FLAG_NONE UINT32_C(0)
185#define GUEST_SHUTDOWN_FLAG_POWER_OFF RT_BIT(0)
186#define GUEST_SHUTDOWN_FLAG_REBOOT RT_BIT(1)
187#define GUEST_SHUTDOWN_FLAG_FORCE RT_BIT(2)
188/** @} */
189
190/** @name Defines for default (initial) guest process buffer lengths.
191 * Note: These defaults were the maximum values before; so be careful when raising those in order to
192 * not break running with older Guest Additions.
193 * @{
194 */
195#define GUEST_PROC_DEF_CMD_LEN _1K
196#define GUEST_PROC_DEF_ARGS_LEN _1K
197#define GUEST_PROC_DEF_ENV_LEN _1K
198#define GUEST_PROC_DEF_USER_LEN 128
199#define GUEST_PROC_DEF_PASSWORD_LEN 128
200#define GUEST_PROC_DEF_DOMAIN_LEN 256
201/** @} */
202
203/** @name Defines for maximum guest process buffer lengths.
204 * @{
205 */
206#define GUEST_PROC_MAX_CMD_LEN _1M
207#define GUEST_PROC_MAX_ARGS_LEN _2M
208#define GUEST_PROC_MAX_ENV_LEN _4M
209#define GUEST_PROC_MAX_USER_LEN _64K
210#define GUEST_PROC_MAX_PASSWORD_LEN _64K
211#define GUEST_PROC_MAX_DOMAIN_LEN _64K
212/** @} */
213
214/** @name Internal tools built into VBoxService which are used in order
215 * to accomplish tasks host<->guest.
216 * @{
217 */
218#define VBOXSERVICE_TOOL_CAT "vbox_cat"
219#define VBOXSERVICE_TOOL_LS "vbox_ls"
220#define VBOXSERVICE_TOOL_RM "vbox_rm"
221#define VBOXSERVICE_TOOL_MKDIR "vbox_mkdir"
222#define VBOXSERVICE_TOOL_MKTEMP "vbox_mktemp"
223#define VBOXSERVICE_TOOL_STAT "vbox_stat"
224/** @} */
225
226/** Special process exit codes for "vbox_cat". */
227typedef enum VBOXSERVICETOOLBOX_CAT_EXITCODE
228{
229 VBOXSERVICETOOLBOX_CAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
230 VBOXSERVICETOOLBOX_CAT_EXITCODE_FILE_NOT_FOUND,
231 VBOXSERVICETOOLBOX_CAT_EXITCODE_PATH_NOT_FOUND,
232 VBOXSERVICETOOLBOX_CAT_EXITCODE_SHARING_VIOLATION,
233 VBOXSERVICETOOLBOX_CAT_EXITCODE_IS_A_DIRECTORY,
234 /** The usual 32-bit type hack. */
235 VBOXSERVICETOOLBOX_CAT_32BIT_HACK = 0x7fffffff
236} VBOXSERVICETOOLBOX_CAT_EXITCODE;
237
238/** Special process exit codes for "vbox_stat". */
239typedef enum VBOXSERVICETOOLBOX_STAT_EXITCODE
240{
241 VBOXSERVICETOOLBOX_STAT_EXITCODE_ACCESS_DENIED = RTEXITCODE_END,
242 VBOXSERVICETOOLBOX_STAT_EXITCODE_FILE_NOT_FOUND,
243 VBOXSERVICETOOLBOX_STAT_EXITCODE_PATH_NOT_FOUND,
244 VBOXSERVICETOOLBOX_STAT_EXITCODE_NET_PATH_NOT_FOUND,
245 VBOXSERVICETOOLBOX_STAT_EXITCODE_INVALID_NAME,
246 /** The usual 32-bit type hack. */
247 VBOXSERVICETOOLBOX_STAT_32BIT_HACK = 0x7fffffff
248} VBOXSERVICETOOLBOX_STAT_EXITCODE;
249
250/**
251 * Input status, reported by the client.
252 */
253enum eInputStatus
254{
255 /** Input is in an undefined state. */
256 INPUT_STS_UNDEFINED = 0,
257 /** Input was written (partially, see cbProcessed). */
258 INPUT_STS_WRITTEN = 1,
259 /** Input failed with an error (see flags for rc). */
260 INPUT_STS_ERROR = 20,
261 /** Process has abandoned / terminated input handling. */
262 INPUT_STS_TERMINATED = 21,
263 /** Too much input data. */
264 INPUT_STS_OVERFLOW = 30
265};
266
267/**
268 * Guest file system object -- additional information in a GSTCTLFSOBJATTR object.
269 */
270enum GSTCTLFSOBJATTRADD
271{
272 /** No additional information is available / requested. */
273 GSTCTLFSOBJATTRADD_NOTHING = 1,
274 /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available /
275 * requested. */
276 GSTCTLFSOBJATTRADD_UNIX,
277 /** The additional unix attributes (RTFSOBJATTR::u::UnixOwner) are
278 * available / requested. */
279 GSTCTLFSOBJATTRADD_UNIX_OWNER,
280 /** The additional unix attributes (RTFSOBJATTR::u::UnixGroup) are
281 * available / requested. */
282 GSTCTLFSOBJATTRADD_UNIX_GROUP,
283 /** The additional extended attribute size (RTFSOBJATTR::u::EASize) is available / requested. */
284 GSTCTLFSOBJATTRADD_EASIZE,
285 /** The last valid item (inclusive).
286 * The valid range is RTFSOBJATTRADD_NOTHING thru RTFSOBJATTRADD_LAST. */
287 GSTCTLFSOBJATTRADD_LAST = GSTCTLFSOBJATTRADD_EASIZE,
288
289 /** The usual 32-bit hack. */
290 GSTCTLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
291};
292
293/** The number of bytes reserved for the additional attribute union. */
294#define GSTCTLFSOBJATTRUNION_MAX_SIZE 128
295
296/* Validate stuff used in the structures used below. */
297AssertCompileSize(RTINODE, 8);
298AssertCompileSize(RTDEV, 4);
299AssertCompileSize(RTGID, 4);
300AssertCompileSize(RTUID, 4);
301
302/**
303 * Additional Unix Attributes (GSTCTLFSOBJATTRADD_UNIX).
304 */
305#pragma pack(1)
306typedef struct GSTCTLFSOBJATTRUNIX
307{
308 /** The user owning the filesystem object (st_uid).
309 * This field is NIL_RTUID if not supported. */
310 RTUID uid;
311
312 /** The group the filesystem object is assigned (st_gid).
313 * This field is NIL_RTGID if not supported. */
314 RTGID gid;
315
316 /** Number of hard links to this filesystem object (st_nlink).
317 * This field is 1 if the filesystem doesn't support hardlinking or
318 * the information isn't available.
319 */
320 uint32_t cHardlinks;
321
322 /** The device number of the device which this filesystem object resides on (st_dev).
323 * This field is 0 if this information is not available. */
324 RTDEV INodeIdDevice;
325
326 /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
327 * Together with INodeIdDevice, this field can be used as a OS wide unique id
328 * when both their values are not 0.
329 * This field is 0 if the information is not available.
330 *
331 * @remarks The special '..' dir always shows up with 0 on NTFS/Windows. */
332 RTINODE INodeId;
333
334 /** User flags (st_flags).
335 * This field is 0 if this information is not available. */
336 uint32_t fFlags;
337
338 /** The current generation number (st_gen).
339 * This field is 0 if this information is not available. */
340 uint32_t GenerationId;
341
342 /** The device number of a character or block device type object (st_rdev).
343 * This field is 0 if the file isn't of a character or block device type and
344 * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
345 RTDEV Device;
346} GSTCTLFSOBJATTRUNIX;
347#pragma pack()
348AssertCompileSize(GSTCTLFSOBJATTRUNIX, 36);
349
350/**
351 * Additional guest Unix attributes (GSTCTLFSOBJATTRADD_UNIX_OWNER).
352 */
353typedef struct GSTCTLFSOBJATTRUNIXOWNER
354{
355 /** The user owning the filesystem object (st_uid).
356 * This field is NIL_RTUID if not supported. */
357 RTUID uid;
358 /** The user name.
359 * Empty if not available or not supported, truncated if too long. */
360 char szName[GSTCTLFSOBJATTRUNION_MAX_SIZE - sizeof(RTUID)];
361} GSTCTLFSOBJATTRUNIXOWNER;
362AssertCompileSize(GSTCTLFSOBJATTRUNIXOWNER, 128);
363
364/**
365 * Additional guest Unix attributes (GSTCTLFSOBJATTRADD_UNIX_GROUP).
366 */
367typedef struct GSTCTLFSOBJATTRUNIXGROUP
368{
369 /** The user owning the filesystem object (st_uid).
370 * This field is NIL_RTUID if not supported. */
371 RTGID gid;
372 /** The group name.
373 * Empty if not available or not supported, truncated if too long. */
374 char szName[GSTCTLFSOBJATTRUNION_MAX_SIZE - sizeof(RTGID)];
375} GSTCTLFSOBJATTRUNIXGROUP;
376AssertCompileSize(GSTCTLFSOBJATTRUNIXGROUP, 128);
377
378/**
379 * Guest filesystem object attributes.
380 */
381typedef struct GSTCTLFSOBJATTR
382{
383 /** Mode flags (st_mode). RTFS_UNIX_*, RTFS_TYPE_*, and RTFS_DOS_*. */
384 RTFMODE fMode;
385
386 /** The additional attributes available. */
387 GSTCTLFSOBJATTRADD enmAdditional;
388
389 /**
390 * Additional attributes.
391 *
392 * Unless explicitly specified to an API, the API can provide additional
393 * data as it is provided by the underlying OS.
394 */
395 union GSTCTLFSOBJATTRUNION
396 {
397 /** Additional Unix Attributes - GUEST_FSOBJATTRADD_UNIX. */
398 GSTCTLFSOBJATTRUNIX Unix;
399 /** Additional Unix Owner Attributes - GUEST_FSOBJATTRADD_UNIX_OWNER. */
400 GSTCTLFSOBJATTRUNIXOWNER UnixOwner;
401 /** Additional Unix Group Attributes - GUEST_FSOBJATTRADD_UNIX_GROUP. */
402 GSTCTLFSOBJATTRUNIXGROUP UnixGroup;
403
404 /**
405 * Extended attribute size is available when RTFS_DOS_HAVE_EA_SIZE is set.
406 */
407 struct GSTCTLFSOBJATTREASIZE
408 {
409 /** Size of EAs. */
410 RTFOFF cb;
411 } EASize;
412 /** Reserved space. */
413 uint8_t abReserveSpace[128];
414 } u;
415} GSTCTLFSOBJATTR;
416AssertCompileSize(GSTCTLFSOBJATTR /* 136 */, sizeof(RTFMODE) + sizeof(GSTCTLFSOBJATTRADD) + 128);
417/** Pointer to a guest filesystem object attributes structure. */
418typedef GSTCTLFSOBJATTR *PGSTCTLFSOBJATTR;
419/** Pointer to a const guest filesystem object attributes structure. */
420typedef const GSTCTLFSOBJATTR *PCGSTCTLFSOBJATTR;
421
422/** @name GSTCTL_PATH_F_XXX - Generic flags for querying guest file system information.
423 * @{ */
424/** No guest stat flags specified. */
425#define GSTCTL_PATH_F_NONE UINT32_C(0)
426/** Last component: Work on the link. */
427#define GSTCTL_PATH_F_ON_LINK RT_BIT_32(0)
428/** Last component: Follow if link. */
429#define GSTCTL_PATH_F_FOLLOW_LINK RT_BIT_32(1)
430/** Don't allow symbolic links as part of the path. */
431#define GSTCTL_PATH_F_NO_SYMLINKS RT_BIT_32(2)
432/** GSTCTL_PATH_F_XXX flag valid mask. */
433#define GSTCTL_PATH_F_VALID_MASK UINT32_C(0x00000007)
434/** @} */
435
436/** @name GSTCTL_DIRLIST_F_XXX - Flags for guest directory listings.
437 * @{ */
438/** No guest listing flags specified. */
439#define GSTCTL_DIRLIST_F_NONE UINT32_C(0)
440/** GSTCTL_DIRLIST_F_XXX valid mask. */
441#define GSTCTL_DIRLIST_F_VALID_MASK UINT32_C(0x00000000)
442/** @} */
443
444/**
445 * Filter option for HOST_MSG_DIR_OPEN.
446 */
447typedef enum GSTCTLDIRFILTER
448{
449 /** The usual invalid 0 entry. */
450 GSTCTLDIRFILTER_INVALID = 0,
451 /** No filter should be applied (and none was specified). */
452 GSTCTLDIRFILTER_NONE,
453 /** The Windows NT filter.
454 * The following wildcard chars: *, ?, <, > and "
455 * The matching is done on the uppercased strings. */
456 GSTCTLDIRFILTER_WINNT,
457 /** The UNIX filter.
458 * The following wildcard chars: *, ?, [..]
459 * The matching is done on exact case. */
460 GSTCTLDIRFILTER_UNIX,
461 /** The UNIX filter, uppercased matching.
462 * Same as GSTCTLDIRFILTER_UNIX except that the strings are uppercased before comparing. */
463 GSTCTLDIRFILTER_UNIX_UPCASED,
464
465 /** The usual full 32-bit value. */
466 GSTCTLDIRFILTER_32BIT_HACK = 0x7fffffff
467} GSTCTLDIRFILTER;
468
469/** @name GSTCTLDIR_F_XXX - Directory flags for HOST_MSG_DIR_OPEN.
470 * @{ */
471/** No directory open flags specified. */
472#define GSTCTLDIR_F_NONE UINT32_C(0)
473/** Don't allow symbolic links as part of the path.
474 * @remarks this flag is currently not implemented and will be ignored. */
475#define GSTCTLDIR_F_NO_SYMLINKS RT_BIT_32(0)
476/** Deny relative opening of anything above this directory. */
477#define GSTCTLDIR_F_DENY_ASCENT RT_BIT_32(1)
478/** Don't follow symbolic links in the final component. */
479#define GSTCTLDIR_F_NO_FOLLOW RT_BIT_32(2)
480/** Long path hack: Don't apply RTPathAbs to the path. */
481#define GSTCTLDIR_F_NO_ABS_PATH RT_BIT_32(3)
482/** Valid flag mask. */
483#define GSTCTLDIR_F_VALID_MASK UINT32_C(0x0000000f)
484
485/**
486 * Guest filesystem object information structure.
487 *
488 * This is returned by
489 * - GUEST_FS_NOTIFYTYPE_QUERY_INFO
490 * - GUEST_DIR_NOTIFYTYPE_READ
491 */
492typedef struct GSTCTLFSOBJINFO
493{
494 /** Logical size (st_size).
495 * For normal files this is the size of the file.
496 * For symbolic links, this is the length of the path name contained
497 * in the symbolic link.
498 * For other objects this fields needs to be specified.
499 */
500 RTFOFF cbObject;
501
502 /** Disk allocation size (st_blocks * DEV_BSIZE). */
503 RTFOFF cbAllocated;
504
505 /** Time of last access (st_atime). */
506 RTTIMESPEC AccessTime;
507
508 /** Time of last data modification (st_mtime). */
509 RTTIMESPEC ModificationTime;
510
511 /** Time of last status change (st_ctime).
512 * If not available this is set to ModificationTime.
513 */
514 RTTIMESPEC ChangeTime;
515
516 /** Time of file birth (st_birthtime).
517 * If not available this is set to ChangeTime.
518 */
519 RTTIMESPEC BirthTime;
520
521 /** Attributes. */
522 GSTCTLFSOBJATTR Attr;
523
524} GSTCTLFSOBJINFO;
525AssertCompileSize(GSTCTLFSOBJINFO /* 184 */, 48 + sizeof(GSTCTLFSOBJATTR));
526/** Pointer to a guest filesystem object information structure. */
527typedef GSTCTLFSOBJINFO *PGSTCTLFSOBJINFO;
528/** Pointer to a const guest filesystem object information structure. */
529typedef const GSTCTLFSOBJINFO *PCGSTCTLFSOBJINFO;
530
531/**
532 * Guest directory entry with extended information.
533 *
534 * This is inspired by IPRT + the PC interfaces.
535 */
536#pragma pack(1)
537typedef struct GSTCTLDIRENTRYEX
538{
539 /** Full information about the guest object. */
540 GSTCTLFSOBJINFO Info;
541 /** The length of the short field (number of RTUTF16 entries (not chars)).
542 * It is 16-bit for reasons of alignment. */
543 uint16_t cwcShortName;
544 /** The short name for 8.3 compatibility.
545 * Empty string if not available.
546 * Since the length is a bit tricky for a UTF-8 encoded name, and since this
547 * is practically speaking only a windows thing, it is encoded as UCS-2. */
548 RTUTF16 wszShortName[14];
549 /** The length of the filename. */
550 uint16_t cbName;
551 /** The filename. (no path)
552 * Using the pcbDirEntry parameter of RTDirReadEx makes this field variable in size. */
553 char szName[260];
554} GSTCTLDIRENTRYEX;
555#pragma pack()
556AssertCompileSize(GSTCTLDIRENTRYEX, sizeof(GSTCTLFSOBJINFO) + 292);
557/** Pointer to a guest directory entry. */
558typedef GSTCTLDIRENTRYEX *PGSTCTLDIRENTRYEX;
559/** Pointer to a const guest directory entry. */
560typedef GSTCTLDIRENTRYEX const *PCGSTCTLDIRENTRYEX;
561
562/** The maximum size (in bytes) of an entry file name (at least RT_UOFFSETOF(GSTCTLDIRENTRYEX, szName[2]). */
563#define GSTCTL_DIRENTRY_MAX_SIZE 4096
564/** Maximum characters of the resolved user name. Including terminator. */
565#define GSTCTL_DIRENTRY_MAX_USER_NAME 255
566/** Maximum characters of the resolved user groups list. Including terminator. */
567#define GSTCTL_DIRENTRY_MAX_USER_GROUPS _1K
568/** The resolved user groups delimiter as a string. */
569#define GSTCTL_DIRENTRY_GROUPS_DELIMITER_STR "\r\n"
570
571/**
572 * Guest directory entry header.
573 *
574 * This is needed for (un-)packing multiple directory entries with its resolved user name + groups
575 * with the HOST_MSG_DIR_LIST command.
576 *
577 * The order of the attributes also mark their packed order, so be careful when changing this!
578 *
579 * @since 7.1.
580 */
581#pragma pack(1)
582typedef struct GSTCTLDIRENTRYLISTHDR
583{
584 /** Size (in bytes) of the directory header). */
585 uint32_t cbDirEntryEx;
586 /** Size (in bytes) of the resolved user name as a string
587 * Includes terminator. */
588 uint32_t cbUser;
589 /** Size (in bytes) of the resolved user groups as a string.
590 * Delimited by GSTCTL_DIRENTRY_GROUPS_DELIMITER_STR. Includes terminator. */
591 uint32_t cbGroups;
592} GSTCTLDIRENTRYBLOCK;
593/** Pointer to a guest directory header entry. */
594typedef GSTCTLDIRENTRYLISTHDR *PGSTCTLDIRENTRYLISTHDR;
595#pragma pack()
596} /* namespace guestControl */
597
598#endif /* !VBOX_INCLUDED_GuestHost_GuestControl_h */
599
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette