VirtualBox

source: vbox/trunk/include/VBox/com/com.h

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/** @file
2 * MS COM / XPCOM Abstraction Layer - COM initialization / shutdown.
3 */
4
5/*
6 * Copyright (C) 2005-2023 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_com_h
37#define VBOX_INCLUDED_com_com_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include "VBox/com/defs.h"
43#include "VBox/com/utils.h"
44
45/** @defgroup grp_com MS COM / XPCOM Abstraction Layer
46 * @{
47 */
48
49namespace com
50{
51
52/** @name VBOX_COM_INIT_F_XXX - flags for com::Initialize().
53 * @{ */
54/** Windows: Caller is the GUI and needs a STA rather than MTA apartment. */
55#define VBOX_COM_INIT_F_GUI RT_BIT_32(0)
56/** Windows: Auto registration updating, if privileged enough. */
57#define VBOX_COM_INIT_F_AUTO_REG_UPDATE RT_BIT_32(1)
58/** Windows: Opt-out of COM patching (client code should do this). */
59#define VBOX_COM_INIT_F_NO_COM_PATCHING RT_BIT_32(2)
60/** The default flags. */
61#define VBOX_COM_INIT_F_DEFAULT (VBOX_COM_INIT_F_AUTO_REG_UPDATE)
62/** @} */
63
64/**
65 * Initializes the COM runtime.
66 *
67 * Must be called on the main thread, before any COM activity in any thread, and by any thread
68 * willing to perform COM operations.
69 *
70 * @return COM result code
71 */
72HRESULT Initialize(uint32_t fInitFlags = VBOX_COM_INIT_F_DEFAULT);
73
74/**
75 * Shuts down the COM runtime.
76 *
77 * Must be called on the main thread before termination.
78 * No COM calls may be made in any thread after this method returns.
79 */
80HRESULT Shutdown();
81
82/**
83 * Resolves a given interface ID to a string containing the interface name.
84 *
85 * If, for some reason, the given IID cannot be resolved to a name, a NULL
86 * string is returned. A non-NULL string returned by this function must be
87 * freed using SysFreeString().
88 *
89 * @param aIID ID of the interface to get a name for
90 * @param aName Resolved interface name or @c NULL on error
91 */
92void GetInterfaceNameByIID(const GUID &aIID, BSTR *aName);
93
94#ifdef RT_OS_WINDOWS
95void PatchComBugs(void);
96#endif
97
98} /* namespace com */
99
100/** @} */
101#endif /* !VBOX_INCLUDED_com_com_h */
102
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use