1 | /** @file
|
---|
2 | * MS COM / XPCOM Abstraction Layer - COM initialization / shutdown.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2005-2024 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_com_utils_h
|
---|
37 | #define VBOX_INCLUDED_com_utils_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include "iprt/types.h"
|
---|
43 |
|
---|
44 | /** @addtogroup grp_com
|
---|
45 | * @{
|
---|
46 | */
|
---|
47 |
|
---|
48 | namespace com
|
---|
49 | {
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Returns the VirtualBox user home directory.
|
---|
53 | *
|
---|
54 | * On failure, this function will return a path that caused a failure (or
|
---|
55 | * NULL if the failure is not path-related).
|
---|
56 | *
|
---|
57 | * On success, this function will try to create the returned directory if it
|
---|
58 | * doesn't exist yet. This may also fail with the corresponding status code.
|
---|
59 | *
|
---|
60 | * If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
|
---|
61 | * this method will return VERR_BUFFER_OVERFLOW.
|
---|
62 | *
|
---|
63 | * @param aDir Buffer to store the directory string in UTF-8 encoding.
|
---|
64 | * @param aDirLen Length of the supplied buffer including space for the
|
---|
65 | * terminating null character, in bytes.
|
---|
66 | * @param fCreateDir Flag whether to create the returned directory on success
|
---|
67 | * if it doesn't exist.
|
---|
68 | * @returns VBox status code.
|
---|
69 | */
|
---|
70 | int GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir = true);
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Creates a release log file, used both in VBoxSVC and in API clients.
|
---|
74 | *
|
---|
75 | * @param pszEntity Human readable name of the program.
|
---|
76 | * @param pszLogFile Name of the release log file.
|
---|
77 | * @param fFlags Logger instance flags.
|
---|
78 | * @param pszGroupSettings Group logging settings.
|
---|
79 | * @param pszEnvVarBase Base environment variable name for the logger.
|
---|
80 | * @param fDestFlags Logger destination flags.
|
---|
81 | * @param cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
|
---|
82 | * @param cHistory Number of old log files to keep.
|
---|
83 | * @param uHistoryFileTime Maximum amount of time to put in a log file.
|
---|
84 | * @param uHistoryFileSize Maximum size of a log file before rotating.
|
---|
85 | * @param pErrInfo Where to return extended error information.
|
---|
86 | * Optional.
|
---|
87 | *
|
---|
88 | * @returns VBox status code.
|
---|
89 | */
|
---|
90 | int VBoxLogRelCreate(const char *pszEntity, const char *pszLogFile,
|
---|
91 | uint32_t fFlags, const char *pszGroupSettings,
|
---|
92 | const char *pszEnvVarBase, uint32_t fDestFlags,
|
---|
93 | uint32_t cMaxEntriesPerGroup, uint32_t cHistory,
|
---|
94 | uint32_t uHistoryFileTime, uint64_t uHistoryFileSize,
|
---|
95 | PRTERRINFO pErrInfo);
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Creates a release log file, used both in VBoxSVC and in API clients.
|
---|
99 | *
|
---|
100 | * @param pszEntity Human readable name of the program.
|
---|
101 | * @param pszLogFile Name of the release log file.
|
---|
102 | * @param fFlags Logger instance flags.
|
---|
103 | * @param pszGroupSettings Group logging settings.
|
---|
104 | * @param pszEnvVarBase Base environment variable name for the logger.
|
---|
105 | * @param fDestFlags Logger destination flags.
|
---|
106 | * @param cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
|
---|
107 | * @param cHistory Number of old log files to keep.
|
---|
108 | * @param uHistoryFileTime Maximum amount of time to put in a log file.
|
---|
109 | * @param uHistoryFileSize Maximum size of a log file before rotating.
|
---|
110 | * @param pOutputIf The optional file output interface, can be NULL which will
|
---|
111 | * make use of the default one.
|
---|
112 | * @param pvOutputIfUser The opaque user data to pass to the callbacks in the output interface.
|
---|
113 | * @param pErrInfo Where to return extended error information.
|
---|
114 | * Optional.
|
---|
115 | *
|
---|
116 | * @returns VBox status code.
|
---|
117 | *
|
---|
118 | * @note Can't include log.h here because of precompiled header fun, hence pOutputIf is void *...
|
---|
119 | */
|
---|
120 | int VBoxLogRelCreateEx(const char *pszEntity, const char *pszLogFile,
|
---|
121 | uint32_t fFlags, const char *pszGroupSettings,
|
---|
122 | const char *pszEnvVarBase, uint32_t fDestFlags,
|
---|
123 | uint32_t cMaxEntriesPerGroup, uint32_t cHistory,
|
---|
124 | uint32_t uHistoryFileTime, uint64_t uHistoryFileSize,
|
---|
125 | const void *pOutputIf, void *pvOutputIfUser,
|
---|
126 | PRTERRINFO pErrInfo);
|
---|
127 |
|
---|
128 | } /* namespace com */
|
---|
129 |
|
---|
130 | /** @} */
|
---|
131 | #endif /* !VBOX_INCLUDED_com_utils_h */
|
---|
132 |
|
---|