1 | /** @file
|
---|
2 | * MS COM / XPCOM Abstraction Layer - COM initialization / shutdown.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2005-2015 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_com_com_h
|
---|
27 | #define ___VBox_com_com_h
|
---|
28 |
|
---|
29 | #include "VBox/com/defs.h"
|
---|
30 |
|
---|
31 | /** @defgroup grp_com MS COM / XPCOM Abstraction Layer
|
---|
32 | * @{
|
---|
33 | */
|
---|
34 |
|
---|
35 | namespace com
|
---|
36 | {
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Initializes the COM runtime.
|
---|
40 | * Must be called on the main thread, before any COM activity in any thread, and by any thread
|
---|
41 | * willing to perform COM operations.
|
---|
42 | *
|
---|
43 | * @param fGui if call is performed on the GUI thread
|
---|
44 | * @param fAutoRegUpdate if to do auto MS COM registration updates.
|
---|
45 | * @return COM result code
|
---|
46 | */
|
---|
47 | HRESULT Initialize(bool fGui = false, bool fAutoRegUpdate = true);
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Shuts down the COM runtime.
|
---|
51 | * Must be called on the main thread before termination.
|
---|
52 | * No COM calls may be made in any thread after this method returns.
|
---|
53 | */
|
---|
54 | HRESULT Shutdown();
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Resolves a given interface ID to a string containing the interface name.
|
---|
58 | * If, for some reason, the given IID cannot be resolved to a name, a NULL
|
---|
59 | * string is returned. A non-NULL string returned by this function must be
|
---|
60 | * freed using SysFreeString().
|
---|
61 | *
|
---|
62 | * @param aIID ID of the interface to get a name for
|
---|
63 | * @param aName Resolved interface name or @c NULL on error
|
---|
64 | */
|
---|
65 | void GetInterfaceNameByIID(const GUID &aIID, BSTR *aName);
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Returns the VirtualBox user home directory.
|
---|
69 | *
|
---|
70 | * On failure, this function will return a path that caused a failure (or
|
---|
71 | * NULL if the failure is not path-related).
|
---|
72 | *
|
---|
73 | * On success, this function will try to create the returned directory if it
|
---|
74 | * doesn't exist yet. This may also fail with the corresponding status code.
|
---|
75 | *
|
---|
76 | * If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
|
---|
77 | * this method will return VERR_BUFFER_OVERFLOW.
|
---|
78 | *
|
---|
79 | * @param aDir Buffer to store the directory string in UTF-8 encoding.
|
---|
80 | * @param aDirLen Length of the supplied buffer including space for the
|
---|
81 | * terminating null character, in bytes.
|
---|
82 | * @param fCreateDir Flag whether to create the returned directory on success if it
|
---|
83 | * doesn't exist.
|
---|
84 | * @return VBox status code.
|
---|
85 | */
|
---|
86 | int GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir = true);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Creates a release log file, used both in VBoxSVC and in API clients.
|
---|
90 | *
|
---|
91 | * @param pcszEntity Human readable name of the program.
|
---|
92 | * @param pcszLogFile Name of the release log file.
|
---|
93 | * @param fFlags Logger instance flags.
|
---|
94 | * @param pcszGroupSettings Group logging settings.
|
---|
95 | * @param pcszEnvVarBase Base environment variable name for the logger.
|
---|
96 | * @param fDestFlags Logger destination flags.
|
---|
97 | * @param cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
|
---|
98 | * @param cHistory Number of old log files to keep.
|
---|
99 | * @param uHistoryFileTime Maximum amount of time to put in a log file.
|
---|
100 | * @param uHistoryFileSize Maximum size of a log file before rotating.
|
---|
101 | * @param pszError In case of creation failure: buffer for error message.
|
---|
102 | * @param cbError Size of error message buffer.
|
---|
103 | * @return VBox status code.
|
---|
104 | */
|
---|
105 | int VBoxLogRelCreate(const char *pcszEntity, const char *pcszLogFile,
|
---|
106 | uint32_t fFlags, const char *pcszGroupSettings,
|
---|
107 | const char *pcszEnvVarBase, uint32_t fDestFlags,
|
---|
108 | uint32_t cMaxEntriesPerGroup, uint32_t cHistory,
|
---|
109 | uint32_t uHistoryFileTime, uint64_t uHistoryFileSize,
|
---|
110 | char *pszError, size_t cbError);
|
---|
111 |
|
---|
112 | } /* namespace com */
|
---|
113 |
|
---|
114 | /** @} */
|
---|
115 | #endif
|
---|
116 |
|
---|