com.h revision 66c293c13909211df8668fd3e1dcbddd116425f5
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync/** @file
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * MS COM / XPCOM Abstraction Layer:
9476d2be49d26a770787f5957478b930484c6ea5vboxsync * COM initialization / shutdown
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync */
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2007 innotek GmbH
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * available from http://www.virtualbox.org. This file is free software;
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * you can redistribute it and/or modify it under the terms of the GNU
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * General Public License as published by the Free Software Foundation,
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * If you received this file as part of a commercial VirtualBox
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * distribution, then only the terms of your commercial VirtualBox
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * license agreement apply instead of the previous paragraph.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync */
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync#ifndef ___VBox_com_com_h
b7782c7ad55341aaa2bcc6c5f20c8fcaf4d8dd7bvboxsync#define ___VBox_com_com_h
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync#include "VBox/com/defs.h"
23179f1443b03947d85eccc81cbc6b5153a4abf3vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsyncnamespace com
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync{
389492cf692ff5f76b379f1142092a3091e9bb8dvboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync/**
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * Initializes the COM runtime.
1715638289c28170682182429eaae968dddbe120vboxsync * Must be called on every thread that uses COM, before any COM activity.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
1715638289c28170682182429eaae968dddbe120vboxsync * @return COM result code
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync */
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsyncHRESULT Initialize();
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync/**
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * Shuts down the COM runtime.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * Must be called on every thread before termination.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * No COM calls may be made after this method returns.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync */
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsyncHRESULT Shutdown();
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync/**
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * Resolves a given interface ID to a string containing the interface name.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * If, for some reason, the given IID cannot be resolved to a name, a NULL
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * string is returned. A non-NULL string returned by this funciton must be
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * freed using SysFreeString().
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * @param aIID ID of the interface to get a name for
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * @param aName Resolved interface name or @c NULL on error
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync */
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsyncvoid GetInterfaceNameByIID (const GUID &aIID, BSTR *aName);
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync/**
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * Returns the VirtualBox user home directory.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * On failure, this function will return a path that caused a failure (or
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * NULL if the faiulre is not path-related).
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * On success, this function will try to create the returned directory if it
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * doesn't exist yet. This may also fail with the corresponding status code.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * this method will return VERR_BUFFER_OVERFLOW.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync *
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * @param aDir Buffer to store the directory string in UTF-8 encoding.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * @param aDirLen Length of the supplied buffer including space for the
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * terminating null character, in bytes.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync * @return VBox status code.
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync */
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsyncint GetVBoxUserHomeDirectory (char *aDir, size_t aDirLen);
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync}; // namespace com
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync#endif
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync
5b93fdb3b4e681a6e4e01a3000f2a3ac07d99895vboxsync