1 | /** @file
|
---|
2 | * MS COM / XPCOM Abstraction Layer:
|
---|
3 | * COM initialization / shutdown
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___VBox_com_com_h
|
---|
23 | #define ___VBox_com_com_h
|
---|
24 |
|
---|
25 | #include "VBox/com/defs.h"
|
---|
26 |
|
---|
27 | namespace com
|
---|
28 | {
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Initializes the COM runtime.
|
---|
32 | * Must be called on every thread that uses COM, before any COM activity.
|
---|
33 | *
|
---|
34 | * @return COM result code
|
---|
35 | */
|
---|
36 | HRESULT Initialize();
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Shuts down the COM runtime.
|
---|
40 | * Must be called on every thread before termination.
|
---|
41 | * No COM calls may be made after this method returns.
|
---|
42 | */
|
---|
43 | HRESULT Shutdown();
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Resolves a given interface ID to a string containing the interface name.
|
---|
47 | * If, for some reason, the given IID cannot be resolved to a name, a NULL
|
---|
48 | * string is returned. A non-NULL string returned by this funciton must be
|
---|
49 | * freed using SysFreeString().
|
---|
50 | *
|
---|
51 | * @param aIID ID of the interface to get a name for
|
---|
52 | * @param aName Resolved interface name or @c NULL on error
|
---|
53 | */
|
---|
54 | void GetInterfaceNameByIID (const GUID &aIID, BSTR *aName);
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Returns the VirtualBox user home directory.
|
---|
58 | *
|
---|
59 | * On failure, this function will return a path that caused a failure (or
|
---|
60 | * NULL if the faiulre is not path-related).
|
---|
61 | *
|
---|
62 | * On success, this function will try to create the returned directory if it
|
---|
63 | * doesn't exist yet. This may also fail with the corresponding status code.
|
---|
64 | *
|
---|
65 | * If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
|
---|
66 | * this method will return VERR_BUFFER_OVERFLOW.
|
---|
67 | *
|
---|
68 | * @param aDir Buffer to store the directory string in UTF-8 encoding.
|
---|
69 | * @param aDirLen Length of the supplied buffer including space for the
|
---|
70 | * terminating null character, in bytes.
|
---|
71 | * @return VBox status code.
|
---|
72 | */
|
---|
73 | int GetVBoxUserHomeDirectory (char *aDir, size_t aDirLen);
|
---|
74 |
|
---|
75 | }; // namespace com
|
---|
76 |
|
---|
77 | #endif
|
---|
78 |
|
---|