VirtualBox

Changeset 2976 in vbox for trunk/include/VBox/com


Ignore:
Timestamp:
Jun 1, 2007 1:47:51 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21692
Message:

Main:

  • XPCOM: Implemented storing compreg.data and xpti.data in the VirtualBox home directory (defect #1947).
  • Cleaned up the COM/XPCOM layer API (removed tons of duplicate definitions and several pieces of duplcate code).
Location:
trunk/include/VBox/com
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/com.h

    r2672 r2976  
    2525
    2626#include "VBox/com/defs.h"
     27#include "VBox/com/string.h"
    2728
    2829namespace com
     
    4243 *  No COM calls may be made after this method returns.
    4344 */
    44 void Shutdown();
     45HRESULT Shutdown();
    4546
    4647/**
     
    5556void GetInterfaceNameByIID (const GUID &aIID, BSTR *aName);
    5657
     58/**
     59 *  Returns the VirtualBox user home directory.
     60 *
     61 *  On failure, this function will return a path that caused a failure (or a
     62 *  null string if the faiulre is not path-related).
     63 *
     64 *  On success, this function will try to create the returned directory if it
     65 *  doesn't exist yet. This may also fail with the corresponding status code.
     66 *
     67 *  @param aDir     Where to return the directory to.
     68 *  @return         VBox status code.
     69 */
     70int GetVBoxUserHomeDirectory (Utf8Str &aDir);
     71
    5772}; // namespace com
    5873
  • trunk/include/VBox/com/defs.h

    r612 r2976  
    138138#define E_ABORT             NS_ERROR_ABORT
    139139#define E_FAIL              NS_ERROR_FAILURE
     140/* Note: a better analog for E_ACCESSDENIED would probably be
     141 * NS_ERROR_NOT_AVAILABLE, but we want binary compatibility for now. */
    140142#define E_ACCESSDENIED      ((nsresult) 0x80070005L)
    141143
  • trunk/include/VBox/com/ptr.h

    r1472 r2976  
    2424#define __VBox_com_ptr_h__
    2525
    26 #if defined (__WIN__)
     26#if !defined (VBOX_WITH_XPCOM)
    2727
    2828#include <atlbase.h>
     
    3232#endif
    3333
    34 #else // !defined (__WIN__)
     34#else /* !defined (VBOX_WITH_XPCOM) */
    3535
    3636#include <nsXPCOM.h>
     
    4646    "@mozilla.org/ipc/dconnect-service;1"
    4747
    48 #endif // !defined (__WIN__)
     48#endif /* !defined (VBOX_WITH_XPCOM) */
    4949
    5050#include <VBox/com/defs.h>
     
    8585    class NoAddRefRelease : public I {
    8686        private:
    87 #ifdef __WIN__
     87#if !defined (VBOX_WITH_XPCOM)
    8888            STDMETHOD_(ULONG, AddRef)() = 0;
    8989            STDMETHOD_(ULONG, Release)() = 0;
    90 #else
     90#else /* !defined (VBOX_WITH_XPCOM) */
    9191            NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
    9292            NS_IMETHOD_(nsrefcnt) Release(void) = 0;
    93 #endif
     93#endif /* !defined (VBOX_WITH_XPCOM) */
    9494    };
    9595
     
    255255        HRESULT rc;
    256256        I *obj = NULL;
    257 #if defined (__WIN__)
     257#if !defined (VBOX_WITH_XPCOM)
    258258        rc = CoCreateInstance (clsid, NULL, CLSCTX_INPROC_SERVER, _ATL_IIDOF (I),
    259259                               (void **) &obj);
    260 #else
     260#else /* !defined (VBOX_WITH_XPCOM) */
    261261        nsCOMPtr <nsIComponentManager> manager;
    262262        rc = NS_GetComponentManager (getter_AddRefs (manager));
     
    264264            rc = manager->CreateInstance (clsid, nsnull, NS_GET_IID (I),
    265265                                          (void **) &obj);
    266 #endif
     266#endif /* !defined (VBOX_WITH_XPCOM) */
    267267        *this = obj;
    268268        if (SUCCEEDED (rc))
     
    282282    HRESULT createLocalObject (const CLSID &clsid)
    283283    {
    284 #if defined (__WIN__)
     284#if !defined (VBOX_WITH_XPCOM)
    285285        HRESULT rc;
    286286        I *obj = NULL;
     
    291291            obj->Release();
    292292        return rc;
    293 #else
     293#else /* !defined (VBOX_WITH_XPCOM) */
    294294        return createInprocObject (clsid);
    295 #endif
     295#endif /* !defined (VBOX_WITH_XPCOM) */
    296296    }
    297297
     
    410410    HRESULT createObject() {
    411411        HRESULT rc;
    412 #if defined (__WIN__)
     412#if !defined (VBOX_WITH_XPCOM)
    413413#   ifdef VBOX_COM_OUTOFPROC_MODULE
    414414        CComObjectNoLock <C> *obj = new CComObjectNoLock <C>();
     
    424424        rc = CComObject <C>::CreateInstance (&obj);
    425425#   endif
    426 #else
     426#else /* !defined (VBOX_WITH_XPCOM) */
    427427        CComObject <C> *obj = new CComObject <C>();
    428428        if (obj) {
     
    431431            rc = E_OUTOFMEMORY;
    432432        }
    433 #endif
     433#endif /* !defined (VBOX_WITH_XPCOM) */
    434434        *this = obj;
    435435        return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette