diff options
Diffstat (limited to 'src/VBox/Main/include/VirtualBoxBase.h')
-rw-r--r-- | src/VBox/Main/include/VirtualBoxBase.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/VBox/Main/include/VirtualBoxBase.h b/src/VBox/Main/include/VirtualBoxBase.h index 98ed8ce58..f16f48e3e 100644 --- a/src/VBox/Main/include/VirtualBoxBase.h +++ b/src/VBox/Main/include/VirtualBoxBase.h @@ -323,6 +323,17 @@ public: } while (0) /** + * Checks that the pointer argument is a valid pointer or NULL and returns + * E_INVALIDARG + extended error info on failure. + * @param arg Input pointer-type argument (strings, interface pointers...) + */ +#define CheckComArgMaybeNull(arg) \ + do { \ + if (RT_UNLIKELY(!RT_VALID_PTR(arg) && (arg) != NULL)) \ + return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #arg); \ + } while (0) + +/** * Checks that safe array argument is not NULL and returns E_INVALIDARG + * extended error info on failure. * @param arg Input safe array argument (strings, interface pointers...) @@ -637,6 +648,29 @@ class ATL_NO_VTABLE VirtualBoxBase , public ISupportErrorInfo #endif { +protected: +#ifdef RT_OS_WINDOWS + CComPtr <IUnknown> m_pUnkMarshaler; +#endif + + HRESULT BaseFinalConstruct() + { +#ifdef RT_OS_WINDOWS + return CoCreateFreeThreadedMarshaler(this, //GetControllingUnknown(), + &m_pUnkMarshaler.p); +#else + return S_OK; +#endif + } + + void BaseFinalRelease() + { +#ifdef RT_OS_WINDOWS + m_pUnkMarshaler.Release(); +#endif + } + + public: enum State { NotReady, Ready, InInit, InUninit, InitFailed, Limited }; |