VirtualBox

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

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

Guest Control: Added ability of specifying an optional current working directory to started guest processes. This needs Guest Additions which support this. bugref:8053

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