[CRT]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 26 Jan 2013 13:33:15 +0000 (13:33 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 26 Jan 2013 13:33:15 +0000 (13:33 +0000)
- Import C++ compiler support headers from mingw-w64 (with some fixes)
- Implement the required parts of the comsupp library

svn path=/trunk/; revision=58223

reactos/include/crt/comdef.h [new file with mode: 0644]
reactos/include/crt/comdefsp.h [new file with mode: 0644]
reactos/include/crt/comip.h [new file with mode: 0644]
reactos/include/crt/comutil.h [new file with mode: 0644]
reactos/lib/sdk/CMakeLists.txt
reactos/lib/sdk/comsupp/CMakeLists.txt [new file with mode: 0644]
reactos/lib/sdk/comsupp/comsupp.cpp [new file with mode: 0644]

diff --git a/reactos/include/crt/comdef.h b/reactos/include/crt/comdef.h
new file mode 100644 (file)
index 0000000..9448c06
--- /dev/null
@@ -0,0 +1,211 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#ifndef _INC_COMDEF
+#define _INC_COMDEF
+
+#include <_mingw.h>
+
+#ifndef RC_INVOKED
+
+#ifndef __cplusplus
+#error Native Compiler support only available in C++ compiler
+#endif
+
+#include <ole2.h>
+#include <olectl.h>
+#include <comutil.h>
+
+#ifndef WINAPI
+#define WINAPI __stdcall
+#endif
+
+#ifdef __cplusplus
+
+class _com_error;
+void WINAPI _com_raise_error(HRESULT hr,IErrorInfo *perrinfo = 0);
+void WINAPI _set_com_error_handler(void (WINAPI *pHandler)(HRESULT hr,IErrorInfo *perrinfo));
+void WINAPI _com_issue_error(HRESULT);
+void WINAPI _com_issue_errorex(HRESULT,IUnknown*,REFIID);
+HRESULT WINAPI _com_dispatch_propget(IDispatch*,DISPID,VARTYPE,void*);
+HRESULT __cdecl _com_dispatch_propput(IDispatch*,DISPID,VARTYPE,...);
+HRESULT __cdecl _com_dispatch_method(IDispatch*,DISPID,WORD,VARTYPE,void*,const wchar_t*,...);
+HRESULT WINAPI _com_dispatch_raw_propget(IDispatch*,DISPID,VARTYPE,void*) throw();
+HRESULT __cdecl _com_dispatch_raw_propput(IDispatch*,DISPID,VARTYPE,...) throw();
+HRESULT __cdecl _com_dispatch_raw_method(IDispatch*,DISPID,WORD,VARTYPE,void*,const wchar_t*,...) throw();
+
+class _com_error {
+public:
+  _com_error(HRESULT hr,IErrorInfo *perrinfo = NULL,bool fAddRef = false) throw();
+  _com_error(const _com_error &that) throw();
+  virtual ~_com_error() throw();
+  _com_error &operator=(const _com_error &that) throw();
+  HRESULT Error() const throw();
+  WORD WCode() const throw();
+  IErrorInfo *ErrorInfo() const throw();
+  _bstr_t Description() const;
+  DWORD HelpContext() const throw();
+  _bstr_t HelpFile() const;
+  _bstr_t Source() const;
+  GUID GUID_() const throw();
+  const TCHAR *ErrorMessage() const throw();
+  static HRESULT WCodeToHRESULT(WORD wCode) throw();
+  static WORD HRESULTToWCode(HRESULT hr) throw();
+private:
+  void Dtor() throw();
+  void Ctor(const _com_error &that) throw();
+  enum {
+    WCODE_HRESULT_FIRST = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200),WCODE_HRESULT_LAST = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF+1,0) - 1
+  };
+  HRESULT m_hresult;
+  IErrorInfo *m_perrinfo;
+  mutable TCHAR *m_pszMsg;
+};
+
+inline _com_error::_com_error(HRESULT hr,IErrorInfo *perrinfo,bool fAddRef) throw() : m_hresult(hr),m_perrinfo(perrinfo),m_pszMsg(NULL) {
+  if(m_perrinfo!=NULL && fAddRef) m_perrinfo->AddRef();
+}
+
+inline _com_error::_com_error(const _com_error &that) throw() {
+  Ctor(that);
+}
+
+inline _com_error::~_com_error() throw() {
+  Dtor();
+}
+
+inline _com_error &_com_error::operator=(const _com_error &that) throw() {
+  if(this!=&that) {
+    Dtor();
+    Ctor(that);
+  }
+  return *this;
+}
+
+inline HRESULT _com_error::Error() const throw() { return m_hresult; }
+inline WORD _com_error::WCode() const throw() { return HRESULTToWCode(m_hresult); }
+
+inline IErrorInfo *_com_error::ErrorInfo() const throw() {
+  if(m_perrinfo!=NULL) m_perrinfo->AddRef();
+  return m_perrinfo;
+}
+
+inline _bstr_t _com_error::Description() const {
+  BSTR bstr = NULL;
+  if(m_perrinfo!=NULL) m_perrinfo->GetDescription(&bstr);
+  return _bstr_t(bstr,false);
+}
+
+inline DWORD _com_error::HelpContext() const throw() {
+  DWORD dwHelpContext = 0;
+  if(m_perrinfo!=NULL) m_perrinfo->GetHelpContext(&dwHelpContext);
+  return dwHelpContext;
+}
+
+inline _bstr_t _com_error::HelpFile() const {
+  BSTR bstr = NULL;
+  if(m_perrinfo!=NULL)  m_perrinfo->GetHelpFile(&bstr);
+  return _bstr_t(bstr,false);
+}
+
+inline _bstr_t _com_error::Source() const {
+  BSTR bstr = NULL;
+  if(m_perrinfo!=NULL) m_perrinfo->GetSource(&bstr);
+  return _bstr_t(bstr,false);
+}
+
+inline _GUID _com_error::GUID_() const throw() {
+  _GUID guid;
+  memset (&guid, 0, sizeof (_GUID));
+  if(m_perrinfo!=NULL) m_perrinfo->GetGUID(&guid);
+  return guid;
+}
+
+inline const TCHAR *_com_error::ErrorMessage() const throw() {
+  if(!m_pszMsg) {
+    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,NULL,m_hresult,MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),(LPTSTR)&m_pszMsg,0,NULL);
+    if(m_pszMsg!=NULL) {
+      int nLen = lstrlen(m_pszMsg);
+      if(nLen > 1 && m_pszMsg[nLen - 1]=='\n') {
+        m_pszMsg[nLen-1] = 0;
+        if(m_pszMsg[nLen - 2]=='\r') m_pszMsg[nLen-2] = 0;
+      }
+    } else {
+      m_pszMsg = (LPTSTR)LocalAlloc(0,32 *sizeof(TCHAR));
+      if(m_pszMsg!=NULL) {
+        WORD wCode = WCode();
+        if(wCode!=0) {
+        _COM_PRINTF_S_1(m_pszMsg,32,TEXT("IDispatch error #%d"),wCode);
+        } else {
+        _COM_PRINTF_S_1(m_pszMsg,32,TEXT("Unknown error 0x%0lX"),m_hresult);
+        }
+      }
+    }
+  }
+  return m_pszMsg;
+}
+
+inline HRESULT _com_error::WCodeToHRESULT(WORD wCode) throw() { return wCode >= 0xFE00 ? WCODE_HRESULT_LAST : WCODE_HRESULT_FIRST + wCode; }
+inline WORD _com_error::HRESULTToWCode(HRESULT hr) throw() { return (hr >= WCODE_HRESULT_FIRST && hr <= WCODE_HRESULT_LAST) ? WORD(hr - WCODE_HRESULT_FIRST) : 0; }
+
+inline void _com_error::Dtor() throw() {
+  if(m_perrinfo!=NULL) m_perrinfo->Release();
+  if(m_pszMsg!=NULL) LocalFree((HLOCAL)m_pszMsg);
+}
+
+inline void _com_error::Ctor(const _com_error &that) throw() {
+  m_hresult = that.m_hresult;
+  m_perrinfo = that.m_perrinfo;
+  m_pszMsg = NULL;
+  if(m_perrinfo!=NULL) m_perrinfo->AddRef();
+}
+
+typedef int __missing_type__;
+
+#if !defined(_COM_SMARTPTR)
+#if !defined(_INC_COMIP)
+#include <comip.h>
+#endif
+#define _COM_SMARTPTR _com_ptr_t
+#define _COM_SMARTPTR_LEVEL2 _com_IIID
+#endif
+#if defined(_COM_SMARTPTR)
+#if !defined(_COM_SMARTPTR_TYPEDEF)
+#if defined(_COM_SMARTPTR_LEVEL2)
+#define _COM_SMARTPTR_TYPEDEF(Interface,IID) UUID IIDArgForTypedef ## Interface = IID; typedef _COM_SMARTPTR< _COM_SMARTPTR_LEVEL2<Interface, &IIDArgForTypedef ## Interface > > Interface ## Ptr
+#else
+#define _COM_SMARTPTR_TYPEDEF(Interface,IID) UUID IIDArgForTypedef ## Interface  = IID; typedef _COM_SMARTPTR<Interface,&IIDArgForTypedef ## Interface > Interface ## Ptr
+#endif
+#endif
+#endif
+
+#if !defined(_COM_NO_STANDARD_GUIDS_)
+#if defined(__IFontDisp_INTERFACE_DEFINED__)
+#if !defined(Font)
+  struct Font : IFontDisp {};
+#endif
+_COM_SMARTPTR_TYPEDEF(Font, IID_IDispatch);
+
+#endif
+#if defined(__IFontEventsDisp_INTERFACE_DEFINED__)
+#if !defined(FontEvents)
+  struct FontEvents : IFontEventsDisp {};
+#endif
+_COM_SMARTPTR_TYPEDEF(FontEvents, IID_IDispatch);
+#endif
+#if defined(__IPictureDisp_INTERFACE_DEFINED__)
+#if !defined(Picture)
+  struct Picture : IPictureDisp {};
+#endif
+_COM_SMARTPTR_TYPEDEF(Picture, IID_IDispatch);
+#endif
+
+#include "comdefsp.h"
+#endif
+#endif
+
+#endif /* __cplusplus */
+
+#endif
diff --git a/reactos/include/crt/comdefsp.h b/reactos/include/crt/comdefsp.h
new file mode 100644 (file)
index 0000000..e024b4f
--- /dev/null
@@ -0,0 +1,1316 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#if !defined(_INC_COMDEFSP)
+#define _INC_COMDEFSP
+
+#include <_mingw.h>
+
+#if !defined(RC_INVOKED) && USE___UUIDOF != 0
+
+#ifndef __cplusplus
+#error Native compiler support only available in C++ compiler.
+#endif
+
+#ifndef _COM_SMARTPTR_TYPEDEF
+#error The header file comdefsp.h requires comdef.h to be included first.
+#endif
+
+#if defined(__AsyncIAdviseSink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(AsyncIAdviseSink,IID_AsyncIAdviseSink);
+#endif
+#if defined(__AsyncIAdviseSink2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(AsyncIAdviseSink2,IID_AsyncIAdviseSink2);
+#endif
+#if defined(__AsyncIMultiQI_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(AsyncIMultiQI,IID_AsyncIMultiQI);
+#endif
+#if defined(__AsyncIPipeByte_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(AsyncIPipeByte,IID_AsyncIPipeByte);
+#endif
+#if defined(__AsyncIPipeDouble_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(AsyncIPipeDouble,IID_AsyncIPipeDouble);
+#endif
+#if defined(__AsyncIPipeLong_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(AsyncIPipeLong,IID_AsyncIPipeLong);
+#endif
+#if defined(__AsyncIUnknown_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(AsyncIUnknown,IID_AsyncIUnknown);
+#endif
+#if defined(__FolderItem_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(FolderItem,IID_FolderItem);
+#endif
+#if defined(__FolderItemVerb_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(FolderItemVerb,IID_FolderItemVerb);
+#endif
+#if defined(__FolderItemVerbs_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(FolderItemVerbs,IID_FolderItemVerbs);
+#endif
+#if defined(__FolderItems_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(FolderItems,IID_FolderItems);
+#endif
+#if defined(__IAccessible_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAccessible,IID_IAccessible);
+#endif
+#if defined(__IActiveScript_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScript,IID_IActiveScript);
+#endif
+#if defined(__IActiveScriptError_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptError,IID_IActiveScriptError);
+#endif
+#if defined(__IActiveScriptParse_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptParse,IID_IActiveScriptParse);
+#endif
+#if defined(__IActiveScriptParseProcedure_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptParseProcedure,IID_IActiveScriptParseProcedure);
+#endif
+#if defined(__IActiveScriptParseProcedureOld_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptParseProcedureOld,IID_IActiveScriptParseProcedureOld);
+#endif
+#if defined(__IActiveScriptSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptSite,IID_IActiveScriptSite);
+#endif
+#if defined(__IActiveScriptSiteInterruptPoll_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptSiteInterruptPoll,IID_IActiveScriptSiteInterruptPoll);
+#endif
+#if defined(__IActiveScriptSiteWindow_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptSiteWindow,IID_IActiveScriptSiteWindow);
+#endif
+#if defined(__IActiveScriptStats_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IActiveScriptStats,IID_IActiveScriptStats);
+#endif
+#if defined(__IAddrExclusionControl_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAddrExclusionControl,IID_IAddrExclusionControl);
+#endif
+#if defined(__IAddrTrackingControl_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAddrTrackingControl,IID_IAddrTrackingControl);
+#endif
+#if defined(__IAdviseSink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAdviseSink,IID_IAdviseSink);
+#endif
+#if defined(__IAdviseSink2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAdviseSink2,IID_IAdviseSink2);
+#endif
+#if defined(__IAdviseSinkEx_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAdviseSinkEx,IID_IAdviseSinkEx);
+#endif
+#if defined(__IAsyncManager_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAsyncManager,IID_IAsyncManager);
+#endif
+#if defined(__IAsyncRpcChannelBuffer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAsyncRpcChannelBuffer,IID_IAsyncRpcChannelBuffer);
+#endif
+#if defined(__IAuthenticate_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IAuthenticate,IID_IAuthenticate);
+#endif
+#if defined(__IBindCtx_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IBindCtx,IID_IBindCtx);
+#endif
+#if defined(__IBindEventHandler_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IBindEventHandler,IID_IBindEventHandler);
+#endif
+#if defined(__IBindHost_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IBindHost,IID_IBindHost);
+#endif
+#if defined(__IBindProtocol_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IBindProtocol,IID_IBindProtocol);
+#endif
+#if defined(__IBindStatusCallback_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IBindStatusCallback,IID_IBindStatusCallback);
+#endif
+#if defined(__IBinding_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IBinding,IID_IBinding);
+#endif
+#if defined(__IBlockingLock_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IBlockingLock,IID_IBlockingLock);
+#endif
+#if defined(__ICSSFilter_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICSSFilter,IID_ICSSFilter);
+#endif
+#if defined(__ICSSFilterSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICSSFilterSite,IID_ICSSFilterSite);
+#endif
+#if defined(__ICallFactory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICallFactory,IID_ICallFactory);
+#endif
+#if defined(__ICancelMethodCalls_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICancelMethodCalls,IID_ICancelMethodCalls);
+#endif
+#if defined(__ICatInformation_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICatInformation,IID_ICatInformation);
+#endif
+#if defined(__ICatRegister_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICatRegister,IID_ICatRegister);
+#endif
+#if defined(__ICatalogFileInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICatalogFileInfo,IID_ICatalogFileInfo);
+#endif
+#if defined(__IChannelHook_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IChannelHook,IID_IChannelHook);
+#endif
+#if defined(__IChannelMgr_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IChannelMgr,IID_IChannelMgr);
+#endif
+#if defined(__IClassActivator_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IClassActivator,IID_IClassActivator);
+#endif
+#if defined(__IClassFactory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IClassFactory,IID_IClassFactory);
+#endif
+#if defined(__IClassFactory2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IClassFactory2,IID_IClassFactory2);
+#endif
+#if defined(__IClientSecurity_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IClientSecurity,IID_IClientSecurity);
+#endif
+#if defined(__ICodeInstall_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICodeInstall,IID_ICodeInstall);
+#endif
+#if defined(__IConnectionPoint_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IConnectionPoint,IID_IConnectionPoint);
+#endif
+#if defined(__IConnectionPointContainer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IConnectionPointContainer,IID_IConnectionPointContainer);
+#endif
+#if defined(__IContinue_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IContinue,IID_IContinue);
+#endif
+#if defined(__IContinueCallback_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IContinueCallback,IID_IContinueCallback);
+#endif
+#if defined(__ICreateErrorInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICreateErrorInfo,IID_ICreateErrorInfo);
+#endif
+#if defined(__ICreateTypeInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICreateTypeInfo,IID_ICreateTypeInfo);
+#endif
+#if defined(__ICreateTypeInfo2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICreateTypeInfo2,IID_ICreateTypeInfo2);
+#endif
+#if defined(__ICreateTypeLib_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICreateTypeLib,IID_ICreateTypeLib);
+#endif
+#if defined(__ICreateTypeLib2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICreateTypeLib2,IID_ICreateTypeLib2);
+#endif
+#if defined(__ICustomDoc_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ICustomDoc,IID_ICustomDoc);
+#endif
+#if defined(__IDataAdviseHolder_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDataAdviseHolder,IID_IDataAdviseHolder);
+#endif
+#if defined(__IDataFilter_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDataFilter,IID_IDataFilter);
+#endif
+#if defined(__IDataObject_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDataObject,IID_IDataObject);
+#endif
+#if defined(__IDeskBand_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDeskBand,IID_IDeskBand);
+#endif
+#if defined(__IDirectWriterLock_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDirectWriterLock,IID_IDirectWriterLock);
+#endif
+#if defined(__IDispError_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDispError,IID_IDispError);
+#endif
+#if defined(__IDispatch_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDispatch,IID_IDispatch);
+#endif
+#if defined(__IDispatchEx_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDispatchEx,IID_IDispatchEx);
+#endif
+#if defined(__IDocHostShowUI_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDocHostShowUI,IID_IDocHostShowUI);
+#endif
+#if defined(__IDocHostUIHandler_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDocHostUIHandler,IID_IDocHostUIHandler);
+#endif
+#if defined(__IDockingWindow_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDockingWindow,IID_IDockingWindow);
+#endif
+#if defined(__IDropSource_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDropSource,IID_IDropSource);
+#endif
+#if defined(__IDropTarget_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDropTarget,IID_IDropTarget);
+#endif
+#if defined(__IDummyHICONIncluder_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IDummyHICONIncluder,IID_IDummyHICONIncluder);
+#endif
+#if defined(__IEncodingFilterFactory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEncodingFilterFactory,IID_IEncodingFilterFactory);
+#endif
+#if defined(__IEnumCATEGORYINFO_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumCATEGORYINFO,IID_IEnumCATEGORYINFO);
+#endif
+#if defined(__IEnumChannels_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumChannels,IID_IEnumChannels);
+#endif
+#if defined(__IEnumCodePage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumCodePage,IID_IEnumCodePage);
+#endif
+#if defined(__IEnumConnectionPoints_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumConnectionPoints,IID_IEnumConnectionPoints);
+#endif
+#if defined(__IEnumConnections_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumConnections,IID_IEnumConnections);
+#endif
+#if defined(__IEnumFORMATETC_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumFORMATETC,IID_IEnumFORMATETC);
+#endif
+#if defined(__IEnumGUID_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumGUID,IID_IEnumGUID);
+#endif
+#if defined(__IEnumHLITEM_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumHLITEM,IID_IEnumHLITEM);
+#endif
+#if defined(__IEnumIDList_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumIDList,IID_IEnumIDList);
+#endif
+#if defined(__IEnumMoniker_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumMoniker,IID_IEnumMoniker);
+#endif
+#if defined(__IEnumOLEVERB_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumOLEVERB,IID_IEnumOLEVERB);
+#endif
+#if defined(__IEnumOleDocumentViews_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumOleDocumentViews,IID_IEnumOleDocumentViews);
+#endif
+#if defined(__IEnumOleUndoUnits_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumOleUndoUnits,IID_IEnumOleUndoUnits);
+#endif
+#if defined(__IEnumRfc1766_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumRfc1766,IID_IEnumRfc1766);
+#endif
+#if defined(__IEnumSTATDATA_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumSTATDATA,IID_IEnumSTATDATA);
+#endif
+#if defined(__IEnumSTATPROPSETSTG_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumSTATPROPSETSTG,IID_IEnumSTATPROPSETSTG);
+#endif
+#if defined(__IEnumSTATPROPSTG_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumSTATPROPSTG,IID_IEnumSTATPROPSTG);
+#endif
+#if defined(__IEnumSTATSTG_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumSTATSTG,IID_IEnumSTATSTG);
+#endif
+#if defined(__IEnumSTATURL_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumSTATURL,IID_IEnumSTATURL);
+#endif
+#if defined(__IEnumString_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumString,IID_IEnumString);
+#endif
+#if defined(__IEnumUnknown_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumUnknown,IID_IEnumUnknown);
+#endif
+#if defined(__IEnumVARIANT_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IEnumVARIANT,IID_IEnumVARIANT);
+#endif
+#if defined(__IErrorInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IErrorInfo,IID_IErrorInfo);
+#endif
+#if defined(__IErrorLog_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IErrorLog,IID_IErrorLog);
+#endif
+#if defined(__IExtensionServices_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IExtensionServices,IID_IExtensionServices);
+#endif
+#if defined(__IExternalConnection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IExternalConnection,IID_IExternalConnection);
+#endif
+#if defined(__IFillLockBytes_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IFillLockBytes,IID_IFillLockBytes);
+#endif
+#if defined(__IFilter_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IFilter,IID_IFilter);
+#endif
+#if defined(__IFolderViewOC_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IFolderViewOC,IID_IFolderViewOC);
+#endif
+#if defined(__IFont_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IFont,IID_IFont);
+#endif
+#if defined(__IFontDisp_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IFontDisp,IID_IFontDisp);
+#endif
+#if defined(__IFontEventsDisp_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IFontEventsDisp,IID_IFontEventsDisp);
+#endif
+#if defined(__IForegroundTransfer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IForegroundTransfer,IID_IForegroundTransfer);
+#endif
+#if defined(__IGlobalInterfaceTable_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IGlobalInterfaceTable,IID_IGlobalInterfaceTable);
+#endif
+#if defined(__IHTMLAnchorElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLAnchorElement,IID_IHTMLAnchorElement);
+#endif
+#if defined(__IHTMLAreaElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLAreaElement,IID_IHTMLAreaElement);
+#endif
+#if defined(__IHTMLAreasCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLAreasCollection,IID_IHTMLAreasCollection);
+#endif
+#if defined(__IHTMLBGsound_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLBGsound,IID_IHTMLBGsound);
+#endif
+#if defined(__IHTMLBRElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLBRElement,IID_IHTMLBRElement);
+#endif
+#if defined(__IHTMLBaseElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLBaseElement,IID_IHTMLBaseElement);
+#endif
+#if defined(__IHTMLBaseFontElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLBaseFontElement,IID_IHTMLBaseFontElement);
+#endif
+#if defined(__IHTMLBlockElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLBlockElement,IID_IHTMLBlockElement);
+#endif
+#if defined(__IHTMLBodyElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLBodyElement,IID_IHTMLBodyElement);
+#endif
+#if defined(__IHTMLButtonElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLButtonElement,IID_IHTMLButtonElement);
+#endif
+#if defined(__IHTMLCommentElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLCommentElement,IID_IHTMLCommentElement);
+#endif
+#if defined(__IHTMLControlElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLControlElement,IID_IHTMLControlElement);
+#endif
+#if defined(__IHTMLControlRange_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLControlRange,IID_IHTMLControlRange);
+#endif
+#if defined(__IHTMLDDElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDDElement,IID_IHTMLDDElement);
+#endif
+#if defined(__IHTMLDListElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDListElement,IID_IHTMLDListElement);
+#endif
+#if defined(__IHTMLDTElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDTElement,IID_IHTMLDTElement);
+#endif
+#if defined(__IHTMLDatabinding_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDatabinding,IID_IHTMLDatabinding);
+#endif
+#if defined(__IHTMLDialog_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDialog,IID_IHTMLDialog);
+#endif
+#if defined(__IHTMLDivElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDivElement,IID_IHTMLDivElement);
+#endif
+#if defined(__IHTMLDivPosition_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDivPosition,IID_IHTMLDivPosition);
+#endif
+#if defined(__IHTMLDocument_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDocument,IID_IHTMLDocument);
+#endif
+#if defined(__IHTMLDocument2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLDocument2,IID_IHTMLDocument2);
+#endif
+#if defined(__IHTMLElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLElement,IID_IHTMLElement);
+#endif
+#if defined(__IHTMLElementCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLElementCollection,IID_IHTMLElementCollection);
+#endif
+#if defined(__IHTMLEmbedElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLEmbedElement,IID_IHTMLEmbedElement);
+#endif
+#if defined(__IHTMLEventObj_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLEventObj,IID_IHTMLEventObj);
+#endif
+#if defined(__IHTMLFieldSetElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFieldSetElement,IID_IHTMLFieldSetElement);
+#endif
+#if defined(__IHTMLFiltersCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFiltersCollection,IID_IHTMLFiltersCollection);
+#endif
+#if defined(__IHTMLFontElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFontElement,IID_IHTMLFontElement);
+#endif
+#if defined(__IHTMLFontNamesCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFontNamesCollection,IID_IHTMLFontNamesCollection);
+#endif
+#if defined(__IHTMLFontSizesCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFontSizesCollection,IID_IHTMLFontSizesCollection);
+#endif
+#if defined(__IHTMLFormElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFormElement,IID_IHTMLFormElement);
+#endif
+#if defined(__IHTMLFrameBase_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFrameBase,IID_IHTMLFrameBase);
+#endif
+#if defined(__IHTMLFrameElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFrameElement,IID_IHTMLFrameElement);
+#endif
+#if defined(__IHTMLFrameSetElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFrameSetElement,IID_IHTMLFrameSetElement);
+#endif
+#if defined(__IHTMLFramesCollection2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLFramesCollection2,IID_IHTMLFramesCollection2);
+#endif
+#if defined(__IHTMLHRElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLHRElement,IID_IHTMLHRElement);
+#endif
+#if defined(__IHTMLHeaderElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLHeaderElement,IID_IHTMLHeaderElement);
+#endif
+#if defined(__IHTMLIFrameElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLIFrameElement,IID_IHTMLIFrameElement);
+#endif
+#if defined(__IHTMLImageElementFactory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLImageElementFactory,IID_IHTMLImageElementFactory);
+#endif
+#if defined(__IHTMLImgElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLImgElement,IID_IHTMLImgElement);
+#endif
+#if defined(__IHTMLInputButtonElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLInputButtonElement,IID_IHTMLInputButtonElement);
+#endif
+#if defined(__IHTMLInputFileElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLInputFileElement,IID_IHTMLInputFileElement);
+#endif
+#if defined(__IHTMLInputHiddenElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLInputHiddenElement,IID_IHTMLInputHiddenElement);
+#endif
+#if defined(__IHTMLInputImage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLInputImage,IID_IHTMLInputImage);
+#endif
+#if defined(__IHTMLInputTextElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLInputTextElement,IID_IHTMLInputTextElement);
+#endif
+#if defined(__IHTMLIsIndexElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLIsIndexElement,IID_IHTMLIsIndexElement);
+#endif
+#if defined(__IHTMLLIElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLLIElement,IID_IHTMLLIElement);
+#endif
+#if defined(__IHTMLLabelElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLLabelElement,IID_IHTMLLabelElement);
+#endif
+#if defined(__IHTMLLegendElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLLegendElement,IID_IHTMLLegendElement);
+#endif
+#if defined(__IHTMLLinkElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLLinkElement,IID_IHTMLLinkElement);
+#endif
+#if defined(__IHTMLListElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLListElement,IID_IHTMLListElement);
+#endif
+#if defined(__IHTMLLocation_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLLocation,IID_IHTMLLocation);
+#endif
+#if defined(__IHTMLMapElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLMapElement,IID_IHTMLMapElement);
+#endif
+#if defined(__IHTMLMarqueeElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLMarqueeElement,IID_IHTMLMarqueeElement);
+#endif
+#if defined(__IHTMLMetaElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLMetaElement,IID_IHTMLMetaElement);
+#endif
+#if defined(__IHTMLMimeTypesCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLMimeTypesCollection,IID_IHTMLMimeTypesCollection);
+#endif
+#if defined(__IHTMLNextIdElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLNextIdElement,IID_IHTMLNextIdElement);
+#endif
+#if defined(__IHTMLNoShowElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLNoShowElement,IID_IHTMLNoShowElement);
+#endif
+#if defined(__IHTMLOListElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLOListElement,IID_IHTMLOListElement);
+#endif
+#if defined(__IHTMLObjectElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLObjectElement,IID_IHTMLObjectElement);
+#endif
+#if defined(__IHTMLOpsProfile_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLOpsProfile,IID_IHTMLOpsProfile);
+#endif
+#if defined(__IHTMLOptionButtonElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLOptionButtonElement,IID_IHTMLOptionButtonElement);
+#endif
+#if defined(__IHTMLOptionElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLOptionElement,IID_IHTMLOptionElement);
+#endif
+#if defined(__IHTMLOptionElementFactory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLOptionElementFactory,IID_IHTMLOptionElementFactory);
+#endif
+#if defined(__IHTMLOptionsHolder_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLOptionsHolder,IID_IHTMLOptionsHolder);
+#endif
+#if defined(__IHTMLParaElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLParaElement,IID_IHTMLParaElement);
+#endif
+#if defined(__IHTMLPhraseElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLPhraseElement,IID_IHTMLPhraseElement);
+#endif
+#if defined(__IHTMLPluginsCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLPluginsCollection,IID_IHTMLPluginsCollection);
+#endif
+#if defined(__IHTMLRuleStyle_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLRuleStyle,IID_IHTMLRuleStyle);
+#endif
+#if defined(__IHTMLScreen_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLScreen,IID_IHTMLScreen);
+#endif
+#if defined(__IHTMLScriptElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLScriptElement,IID_IHTMLScriptElement);
+#endif
+#if defined(__IHTMLSelectElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLSelectElement,IID_IHTMLSelectElement);
+#endif
+#if defined(__IHTMLSelectionObject_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLSelectionObject,IID_IHTMLSelectionObject);
+#endif
+#if defined(__IHTMLSpanElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLSpanElement,IID_IHTMLSpanElement);
+#endif
+#if defined(__IHTMLSpanFlow_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLSpanFlow,IID_IHTMLSpanFlow);
+#endif
+#if defined(__IHTMLStyle_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLStyle,IID_IHTMLStyle);
+#endif
+#if defined(__IHTMLStyleElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLStyleElement,IID_IHTMLStyleElement);
+#endif
+#if defined(__IHTMLStyleFontFace_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLStyleFontFace,IID_IHTMLStyleFontFace);
+#endif
+#if defined(__IHTMLStyleSheet_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLStyleSheet,IID_IHTMLStyleSheet);
+#endif
+#if defined(__IHTMLStyleSheetRule_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLStyleSheetRule,IID_IHTMLStyleSheetRule);
+#endif
+#if defined(__IHTMLStyleSheetRulesCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLStyleSheetRulesCollection,IID_IHTMLStyleSheetRulesCollection);
+#endif
+#if defined(__IHTMLStyleSheetsCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLStyleSheetsCollection,IID_IHTMLStyleSheetsCollection);
+#endif
+#if defined(__IHTMLTable_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTable,IID_IHTMLTable);
+#endif
+#if defined(__IHTMLTableCaption_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTableCaption,IID_IHTMLTableCaption);
+#endif
+#if defined(__IHTMLTableCell_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTableCell,IID_IHTMLTableCell);
+#endif
+#if defined(__IHTMLTableCol_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTableCol,IID_IHTMLTableCol);
+#endif
+#if defined(__IHTMLTableRow_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTableRow,IID_IHTMLTableRow);
+#endif
+#if defined(__IHTMLTableSection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTableSection,IID_IHTMLTableSection);
+#endif
+#if defined(__IHTMLTextAreaElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTextAreaElement,IID_IHTMLTextAreaElement);
+#endif
+#if defined(__IHTMLTextContainer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTextContainer,IID_IHTMLTextContainer);
+#endif
+#if defined(__IHTMLTextElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTextElement,IID_IHTMLTextElement);
+#endif
+#if defined(__IHTMLTitleElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTitleElement,IID_IHTMLTitleElement);
+#endif
+#if defined(__IHTMLTxtRange_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLTxtRange,IID_IHTMLTxtRange);
+#endif
+#if defined(__IHTMLUListElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLUListElement,IID_IHTMLUListElement);
+#endif
+#if defined(__IHTMLUnknownElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLUnknownElement,IID_IHTMLUnknownElement);
+#endif
+#if defined(__IHTMLWindow2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHTMLWindow2,IID_IHTMLWindow2);
+#endif
+#if defined(__IHlink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHlink,IID_IHlink);
+#endif
+#if defined(__IHlinkBrowseContext_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHlinkBrowseContext,IID_IHlinkBrowseContext);
+#endif
+#if defined(__IHlinkFrame_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHlinkFrame,IID_IHlinkFrame);
+#endif
+#if defined(__IHlinkSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHlinkSite,IID_IHlinkSite);
+#endif
+#if defined(__IHlinkTarget_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHlinkTarget,IID_IHlinkTarget);
+#endif
+#if defined(__IHttpNegotiate_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHttpNegotiate,IID_IHttpNegotiate);
+#endif
+#if defined(__IHttpNegotiate2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHttpNegotiate2,IID_IHttpNegotiate2);
+#endif
+#if defined(__IHttpSecurity_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IHttpSecurity,IID_IHttpSecurity);
+#endif
+#if defined(__IImageDecodeEventSink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IImageDecodeEventSink,IID_IImageDecodeEventSink);
+#endif
+#if defined(__IImageDecodeFilter_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IImageDecodeFilter,IID_IImageDecodeFilter);
+#endif
+#if defined(__IInternalUnknown_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternalUnknown,IID_IInternalUnknown);
+#endif
+#if defined(__IInternet_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternet,IID_IInternet);
+#endif
+#if defined(__IInternetBindInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetBindInfo,IID_IInternetBindInfo);
+#endif
+#if defined(__IInternetHostSecurityManager_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetHostSecurityManager,IID_IInternetHostSecurityManager);
+#endif
+#if defined(__IInternetPriority_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetPriority,IID_IInternetPriority);
+#endif
+#if defined(__IInternetProtocol_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetProtocol,IID_IInternetProtocol);
+#endif
+#if defined(__IInternetProtocolInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetProtocolInfo,IID_IInternetProtocolInfo);
+#endif
+#if defined(__IInternetProtocolRoot_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetProtocolRoot,IID_IInternetProtocolRoot);
+#endif
+#if defined(__IInternetProtocolSink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetProtocolSink,IID_IInternetProtocolSink);
+#endif
+#if defined(__IInternetProtocolSinkStackable_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetProtocolSinkStackable,IID_IInternetProtocolSinkStackable);
+#endif
+#if defined(__IInternetSecurityManager_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetSecurityManager,IID_IInternetSecurityManager);
+#endif
+#if defined(__IInternetSecurityMgrSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetSecurityMgrSite,IID_IInternetSecurityMgrSite);
+#endif
+#if defined(__IInternetSession_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetSession,IID_IInternetSession);
+#endif
+#if defined(__IInternetThreadSwitch_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetThreadSwitch,IID_IInternetThreadSwitch);
+#endif
+#if defined(__IInternetZoneManager_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IInternetZoneManager,IID_IInternetZoneManager);
+#endif
+#if defined(__ILayoutStorage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ILayoutStorage,IID_ILayoutStorage);
+#endif
+#if defined(__ILockBytes_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ILockBytes,IID_ILockBytes);
+#endif
+#if defined(__IMLangCodePages_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangCodePages,IID_IMLangCodePages);
+#endif
+#if defined(__IMLangConvertCharset_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangConvertCharset,IID_IMLangConvertCharset);
+#endif
+#if defined(__IMLangFontLink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangFontLink,IID_IMLangFontLink);
+#endif
+#if defined(__IMLangLineBreakConsole_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangLineBreakConsole,IID_IMLangLineBreakConsole);
+#endif
+#if defined(__IMLangString_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangString,IID_IMLangString);
+#endif
+#if defined(__IMLangStringAStr_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangStringAStr,IID_IMLangStringAStr);
+#endif
+#if defined(__IMLangStringBufA_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangStringBufA,IID_IMLangStringBufA);
+#endif
+#if defined(__IMLangStringBufW_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangStringBufW,IID_IMLangStringBufW);
+#endif
+#if defined(__IMLangStringWStr_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMLangStringWStr,IID_IMLangStringWStr);
+#endif
+#if defined(__IMalloc_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMalloc,IID_IMalloc);
+#endif
+#if defined(__IMallocSpy_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMallocSpy,IID_IMallocSpy);
+#endif
+#if defined(__IMapMIMEToCLSID_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMapMIMEToCLSID,IID_IMapMIMEToCLSID);
+#endif
+#if defined(__IMarshal_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMarshal,IID_IMarshal);
+#endif
+#if defined(__IMarshal2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMarshal2,IID_IMarshal2);
+#endif
+#if defined(__IMessageFilter_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMessageFilter,IID_IMessageFilter);
+#endif
+#if defined(__IMimeInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMimeInfo,IID_IMimeInfo);
+#endif
+#if defined(__IMoniker_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMoniker,IID_IMoniker);
+#endif
+#if defined(__IMonikerProp_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMonikerProp,IID_IMonikerProp);
+#endif
+#if defined(__IMultiLanguage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMultiLanguage,IID_IMultiLanguage);
+#endif
+#if defined(__IMultiQI_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IMultiQI,IID_IMultiQI);
+#endif
+#if defined(__IObjectIdentity_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IObjectIdentity,IID_IObjectIdentity);
+#endif
+#if defined(__IObjectSafety_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IObjectSafety,IID_IObjectSafety);
+#endif
+#if defined(__IObjectWithSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IObjectWithSite,IID_IObjectWithSite);
+#endif
+#if defined(__IOleAdviseHolder_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleAdviseHolder,IID_IOleAdviseHolder);
+#endif
+#if defined(__IOleCache_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleCache,IID_IOleCache);
+#endif
+#if defined(__IOleCache2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleCache2,IID_IOleCache2);
+#endif
+#if defined(__IOleCacheControl_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleCacheControl,IID_IOleCacheControl);
+#endif
+#if defined(__IOleClientSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleClientSite,IID_IOleClientSite);
+#endif
+#if defined(__IOleCommandTarget_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleCommandTarget,IID_IOleCommandTarget);
+#endif
+#if defined(__IOleContainer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleContainer,IID_IOleContainer);
+#endif
+#if defined(__IOleControl_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleControl,IID_IOleControl);
+#endif
+#if defined(__IOleControlSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleControlSite,IID_IOleControlSite);
+#endif
+#if defined(__IOleDocument_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleDocument,IID_IOleDocument);
+#endif
+#if defined(__IOleDocumentSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleDocumentSite,IID_IOleDocumentSite);
+#endif
+#if defined(__IOleDocumentView_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleDocumentView,IID_IOleDocumentView);
+#endif
+#if defined(__IOleInPlaceActiveObject_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceActiveObject,IID_IOleInPlaceActiveObject);
+#endif
+#if defined(__IOleInPlaceFrame_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceFrame,IID_IOleInPlaceFrame);
+#endif
+#if defined(__IOleInPlaceObject_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceObject,IID_IOleInPlaceObject);
+#endif
+#if defined(__IOleInPlaceObjectWindowless_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceObjectWindowless,IID_IOleInPlaceObjectWindowless);
+#endif
+#if defined(__IOleInPlaceSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceSite,IID_IOleInPlaceSite);
+#endif
+#if defined(__IOleInPlaceSiteEx_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceSiteEx,IID_IOleInPlaceSiteEx);
+#endif
+#if defined(__IOleInPlaceSiteWindowless_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceSiteWindowless,IID_IOleInPlaceSiteWindowless);
+#endif
+#if defined(__IOleInPlaceUIWindow_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleInPlaceUIWindow,IID_IOleInPlaceUIWindow);
+#endif
+#if defined(__IOleItemContainer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleItemContainer,IID_IOleItemContainer);
+#endif
+#if defined(__IOleLink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleLink,IID_IOleLink);
+#endif
+#if defined(__IOleObject_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleObject,IID_IOleObject);
+#endif
+#if defined(__IOleParentUndoUnit_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleParentUndoUnit,IID_IOleParentUndoUnit);
+#endif
+#if defined(__IOleUndoManager_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleUndoManager,IID_IOleUndoManager);
+#endif
+#if defined(__IOleUndoUnit_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleUndoUnit,IID_IOleUndoUnit);
+#endif
+#if defined(__IOleWindow_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOleWindow,IID_IOleWindow);
+#endif
+#if defined(__IOmHistory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOmHistory,IID_IOmHistory);
+#endif
+#if defined(__IOmNavigator_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOmNavigator,IID_IOmNavigator);
+#endif
+#if defined(__IOplockStorage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IOplockStorage,IID_IOplockStorage);
+#endif
+#if defined(__IPSFactoryBuffer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPSFactoryBuffer,IID_IPSFactoryBuffer);
+#endif
+#if defined(__IParseDisplayName_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IParseDisplayName,IID_IParseDisplayName);
+#endif
+#if defined(__IPerPropertyBrowsing_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPerPropertyBrowsing,IID_IPerPropertyBrowsing);
+#endif
+#if defined(__IPersist_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersist,IID_IPersist);
+#endif
+#if defined(__IPersistFile_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistFile,IID_IPersistFile);
+#endif
+#if defined(__IPersistFolder_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistFolder,IID_IPersistFolder);
+#endif
+#if defined(__IPersistFolder2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistFolder2,IID_IPersistFolder2);
+#endif
+#if defined(__IPersistHistory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistHistory,IID_IPersistHistory);
+#endif
+#if defined(__IPersistMemory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistMemory,IID_IPersistMemory);
+#endif
+#if defined(__IPersistMoniker_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistMoniker,IID_IPersistMoniker);
+#endif
+#if defined(__IPersistPropertyBag_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistPropertyBag,IID_IPersistPropertyBag);
+#endif
+#if defined(__IPersistPropertyBag2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistPropertyBag2,IID_IPersistPropertyBag2);
+#endif
+#if defined(__IPersistStorage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistStorage,IID_IPersistStorage);
+#endif
+#if defined(__IPersistStream_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistStream,IID_IPersistStream);
+#endif
+#if defined(__IPersistStreamInit_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPersistStreamInit,IID_IPersistStreamInit);
+#endif
+#if defined(__IPicture_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPicture,IID_IPicture);
+#endif
+#if defined(__IPictureDisp_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPictureDisp,IID_IPictureDisp);
+#endif
+#if defined(__IPipeByte_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPipeByte,IID_IPipeByte);
+#endif
+#if defined(__IPipeDouble_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPipeDouble,IID_IPipeDouble);
+#endif
+#if defined(__IPipeLong_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPipeLong,IID_IPipeLong);
+#endif
+#if defined(__IPointerInactive_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPointerInactive,IID_IPointerInactive);
+#endif
+#if defined(__IPrint_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPrint,IID_IPrint);
+#endif
+#if defined(__IProgressNotify_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IProgressNotify,IID_IProgressNotify);
+#endif
+#if defined(__IPropertyBag_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertyBag,IID_IPropertyBag);
+#endif
+#if defined(__IPropertyBag2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertyBag2,IID_IPropertyBag2);
+#endif
+#if defined(__IPropertyNotifySink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertyNotifySink,IID_IPropertyNotifySink);
+#endif
+#if defined(__IPropertyPage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertyPage,IID_IPropertyPage);
+#endif
+#if defined(__IPropertyPage2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertyPage2,IID_IPropertyPage2);
+#endif
+#if defined(__IPropertyPageSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertyPageSite,IID_IPropertyPageSite);
+#endif
+#if defined(__IPropertySetStorage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertySetStorage,IID_IPropertySetStorage);
+#endif
+#if defined(__IPropertyStorage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IPropertyStorage,IID_IPropertyStorage);
+#endif
+#if defined(__IProvideClassInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IProvideClassInfo,IID_IProvideClassInfo);
+#endif
+#if defined(__IProvideClassInfo2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IProvideClassInfo2,IID_IProvideClassInfo2);
+#endif
+#if defined(__IProvideMultipleClassInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IProvideMultipleClassInfo,IID_IProvideMultipleClassInfo);
+#endif
+#if defined(__IQuickActivate_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IQuickActivate,IID_IQuickActivate);
+#endif
+#if defined(__IROTData_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IROTData,IID_IROTData);
+#endif
+#if defined(__IRecordInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRecordInfo,IID_IRecordInfo);
+#endif
+#if defined(__IReleaseMarshalBuffers_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IReleaseMarshalBuffers,IID_IReleaseMarshalBuffers);
+#endif
+#if defined(__IRootStorage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRootStorage,IID_IRootStorage);
+#endif
+#if defined(__IRpcChannelBuffer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcChannelBuffer,IID_IRpcChannelBuffer);
+#endif
+#if defined(__IRpcChannelBuffer2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcChannelBuffer2,IID_IRpcChannelBuffer2);
+#endif
+#if defined(__IRpcChannelBuffer3_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcChannelBuffer3,IID_IRpcChannelBuffer3);
+#endif
+#if defined(__IRpcHelper_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcHelper,IID_IRpcHelper);
+#endif
+#if defined(__IRpcOptions_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcOptions,IID_IRpcOptions);
+#endif
+#if defined(__IRpcProxyBuffer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcProxyBuffer,IID_IRpcProxyBuffer);
+#endif
+#if defined(__IRpcStubBuffer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcStubBuffer,IID_IRpcStubBuffer);
+#endif
+#if defined(__IRpcSyntaxNegotiate_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRpcSyntaxNegotiate,IID_IRpcSyntaxNegotiate);
+#endif
+#if defined(__IRunnableObject_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRunnableObject,IID_IRunnableObject);
+#endif
+#if defined(__IRunningObjectTable_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IRunningObjectTable,IID_IRunningObjectTable);
+#endif
+#if defined(__ISequentialStream_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISequentialStream,IID_ISequentialStream);
+#endif
+#if defined(__IServerSecurity_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IServerSecurity,IID_IServerSecurity);
+#endif
+#if defined(__IServiceProvider_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IServiceProvider,IID_IServiceProvider);
+#endif
+#if defined(__IShellBrowser_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellBrowser,IID_IShellBrowser);
+#endif
+#if defined(__IShellDispatch_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellDispatch,IID_IShellDispatch);
+#endif
+#if defined(__IShellExtInit_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellExtInit,IID_IShellExtInit);
+#endif
+#if defined(__IShellFolder_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellFolder,IID_IShellFolder);
+#endif
+#if defined(__IShellFolderViewDual_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellFolderViewDual,IID_IShellFolderViewDual);
+#endif
+#if defined(__IShellLinkA_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellLinkA,IID_IShellLinkA);
+#endif
+#if defined(__IShellLinkDual_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellLinkDual,IID_IShellLinkDual);
+#endif
+#if defined(__IShellLinkW_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellLinkW,IID_IShellLinkW);
+#endif
+#if defined(__IShellPropSheetExt_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellPropSheetExt,IID_IShellPropSheetExt);
+#endif
+#if defined(__IShellUIHelper_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellUIHelper,IID_IShellUIHelper);
+#endif
+#if defined(__IShellView_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellView,IID_IShellView);
+#endif
+#if defined(__IShellView2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellView2,IID_IShellView2);
+#endif
+#if defined(__IShellWindows_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IShellWindows,IID_IShellWindows);
+#endif
+#if defined(__ISimpleFrameSite_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISimpleFrameSite,IID_ISimpleFrameSite);
+#endif
+#if defined(__ISoftDistExt_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISoftDistExt,IID_ISoftDistExt);
+#endif
+#if defined(__ISpecifyPropertyPages_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISpecifyPropertyPages,IID_ISpecifyPropertyPages);
+#endif
+#if defined(__IStdMarshalInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IStdMarshalInfo,IID_IStdMarshalInfo);
+#endif
+#if defined(__IStorage_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IStorage,IID_IStorage);
+#endif
+#if defined(__IStream_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IStream,IID_IStream);
+#endif
+#if defined(__ISubscriptionMgr_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISubscriptionMgr,IID_ISubscriptionMgr);
+#endif
+#if defined(__ISupportErrorInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISupportErrorInfo,IID_ISupportErrorInfo);
+#endif
+#if defined(__ISurrogate_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISurrogate,IID_ISurrogate);
+#endif
+#if defined(__ISynchronize_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISynchronize,IID_ISynchronize);
+#endif
+#if defined(__ISynchronizeContainer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISynchronizeContainer,IID_ISynchronizeContainer);
+#endif
+#if defined(__ISynchronizeEvent_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISynchronizeEvent,IID_ISynchronizeEvent);
+#endif
+#if defined(__ISynchronizeHandle_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISynchronizeHandle,IID_ISynchronizeHandle);
+#endif
+#if defined(__ISynchronizeMutex_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ISynchronizeMutex,IID_ISynchronizeMutex);
+#endif
+#if defined(__IThumbnailExtractor_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IThumbnailExtractor,IID_IThumbnailExtractor);
+#endif
+#if defined(__ITimeAndNoticeControl_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITimeAndNoticeControl,IID_ITimeAndNoticeControl);
+#endif
+#if defined(__ITimer_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITimer,IID_ITimer);
+#endif
+#if defined(__ITimerService_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITimerService,IID_ITimerService);
+#endif
+#if defined(__ITimerSink_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITimerSink,IID_ITimerSink);
+#endif
+#if defined(__ITypeChangeEvents_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeChangeEvents,IID_ITypeChangeEvents);
+#endif
+#if defined(__ITypeComp_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeComp,IID_ITypeComp);
+#endif
+#if defined(__ITypeFactory_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeFactory,IID_ITypeFactory);
+#endif
+#if defined(__ITypeInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeInfo,IID_ITypeInfo);
+#endif
+#if defined(__ITypeInfo2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeInfo2,IID_ITypeInfo2);
+#endif
+#if defined(__ITypeLib_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeLib,IID_ITypeLib);
+#endif
+#if defined(__ITypeLib2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeLib2,IID_ITypeLib2);
+#endif
+#if defined(__ITypeMarshal_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(ITypeMarshal,IID_ITypeMarshal);
+#endif
+#if defined(__IUnknown_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IUnknown,IID_IUnknown);
+#endif
+#if defined(__IUrlHistoryNotify_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IUrlHistoryNotify,IID_IUrlHistoryNotify);
+#endif
+#if defined(__IUrlHistoryStg_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IUrlHistoryStg,IID_IUrlHistoryStg);
+#endif
+#if defined(__IUrlHistoryStg2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IUrlHistoryStg2,IID_IUrlHistoryStg2);
+#endif
+#if defined(__IUrlMon_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IUrlMon,IID_IUrlMon);
+#endif
+#if defined(__IVariantChangeType_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IVariantChangeType,IID_IVariantChangeType);
+#endif
+#if defined(__IViewObject_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IViewObject,IID_IViewObject);
+#endif
+#if defined(__IViewObject2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IViewObject2,IID_IViewObject2);
+#endif
+#if defined(__IViewObjectEx_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IViewObjectEx,IID_IViewObjectEx);
+#endif
+#if defined(__IWaitMultiple_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWaitMultiple,IID_IWaitMultiple);
+#endif
+#if defined(__IWebBrowser_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWebBrowser,IID_IWebBrowser);
+#endif
+#if defined(__IWebBrowser2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWebBrowser2,IID_IWebBrowser2);
+#endif
+#if defined(__IWebBrowserApp_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWebBrowserApp,IID_IWebBrowserApp);
+#endif
+#if defined(__IWinInetHttpInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWinInetHttpInfo,IID_IWinInetHttpInfo);
+#endif
+#if defined(__IWinInetInfo_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWinInetInfo,IID_IWinInetInfo);
+#endif
+#if defined(__IWindowForBindingUI_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWindowForBindingUI,IID_IWindowForBindingUI);
+#endif
+#if defined(__IWrappedProtocol_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IWrappedProtocol,IID_IWrappedProtocol);
+#endif
+#if defined(__IXMLAttribute_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLAttribute,IID_IXMLAttribute);
+#endif
+#if defined(__IXMLDOMAttribute_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMAttribute,IID_IXMLDOMAttribute);
+#endif
+#if defined(__IXMLDOMCDATASection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMCDATASection,IID_IXMLDOMCDATASection);
+#endif
+#if defined(__IXMLDOMCharacterData_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMCharacterData,IID_IXMLDOMCharacterData);
+#endif
+#if defined(__IXMLDOMComment_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMComment,IID_IXMLDOMComment);
+#endif
+#if defined(__IXMLDOMDocument_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMDocument,IID_IXMLDOMDocument);
+#endif
+#if defined(__IXMLDOMDocumentFragment_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMDocumentFragment,IID_IXMLDOMDocumentFragment);
+#endif
+#if defined(__IXMLDOMDocumentType_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMDocumentType,IID_IXMLDOMDocumentType);
+#endif
+#if defined(__IXMLDOMElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMElement,IID_IXMLDOMElement);
+#endif
+#if defined(__IXMLDOMEntity_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMEntity,IID_IXMLDOMEntity);
+#endif
+#if defined(__IXMLDOMEntityReference_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMEntityReference,IID_IXMLDOMEntityReference);
+#endif
+#if defined(__IXMLDOMImplementation_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMImplementation,IID_IXMLDOMImplementation);
+#endif
+#if defined(__IXMLDOMNamedNodeMap_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMNamedNodeMap,IID_IXMLDOMNamedNodeMap);
+#endif
+#if defined(__IXMLDOMNode_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMNode,IID_IXMLDOMNode);
+#endif
+#if defined(__IXMLDOMNodeList_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMNodeList,IID_IXMLDOMNodeList);
+#endif
+#if defined(__IXMLDOMNotation_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMNotation,IID_IXMLDOMNotation);
+#endif
+#if defined(__IXMLDOMParseError_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMParseError,IID_IXMLDOMParseError);
+#endif
+#if defined(__IXMLDOMProcessingInstruction_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMProcessingInstruction,IID_IXMLDOMProcessingInstruction);
+#endif
+#if defined(__IXMLDOMText_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDOMText,IID_IXMLDOMText);
+#endif
+#if defined(__IXMLDSOControl_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDSOControl,IID_IXMLDSOControl);
+#endif
+#if defined(__IXMLDocument_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDocument,IID_IXMLDocument);
+#endif
+#if defined(__IXMLDocument2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLDocument2,IID_IXMLDocument2);
+#endif
+#if defined(__IXMLElement_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLElement,IID_IXMLElement);
+#endif
+#if defined(__IXMLElement2_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLElement2,IID_IXMLElement2);
+#endif
+#if defined(__IXMLElementCollection_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLElementCollection,IID_IXMLElementCollection);
+#endif
+#if defined(__IXMLError_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLError,IID_IXMLError);
+#endif
+#if defined(__IXMLHttpRequest_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXMLHttpRequest,IID_IXMLHttpRequest);
+#endif
+#if defined(__IXTLRuntime_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(IXTLRuntime,IID_IXTLRuntime);
+#endif
+#if defined(__OLEDBSimpleProvider_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(OLEDBSimpleProvider,IID_OLEDBSimpleProvider);
+#endif
+#if defined(__OLEDBSimpleProviderListener_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(OLEDBSimpleProviderListener,IID_OLEDBSimpleProviderListener);
+#endif
+#if defined(__XMLDOMDocumentEvents_INTERFACE_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(XMLDOMDocumentEvents,IID_XMLDOMDocumentEvents);
+#endif
+
+#if defined(__DOMDocument_FWD_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(DOMDocument,IID_DOMDocument);
+#endif
+#if defined(__DOMFreeThreadedDocument_FWD_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(DOMFreeThreadedDocument,IID_DOMFreeThreadedDocument);
+#endif
+#if defined(__XMLDSOControl_FWD_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(XMLDSOControl,IID_XMLDSOControl);
+#endif
+#if defined(__XMLDocument_FWD_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(XMLDocument,IID_XMLDocument);
+#endif
+#if defined(__XMLHTTPRequest_FWD_DEFINED__)
+_COM_SMARTPTR_TYPEDEF(XMLHTTPRequest,IID_XMLHTTPRequest);
+#endif
+#endif
+#endif
diff --git a/reactos/include/crt/comip.h b/reactos/include/crt/comip.h
new file mode 100644 (file)
index 0000000..1b26097
--- /dev/null
@@ -0,0 +1,378 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#ifndef _INC_COMIP
+#define _INC_COMIP
+
+#include <_mingw.h>
+
+#include <ole2.h>
+#include <malloc.h>
+
+#include <comutil.h>
+
+#ifdef __cplusplus
+
+#pragma push_macro("new")
+#undef new
+
+#include <new.h>
+
+class _com_error;
+
+#ifndef WINAPI
+#define WINAPI __stdcall
+#endif
+
+void WINAPI _com_issue_error(HRESULT);
+struct IUnknown;
+
+template<typename _Interface,const IID *_IID >
+class _com_IIID {
+public:
+  typedef _Interface Interface;
+  static _Interface *GetInterfacePtr() throw() { return NULL; }
+  static _Interface& GetInterface() throw() { return *GetInterfacePtr(); }
+  static const IID& GetIID() throw() { return *_IID; }
+};
+
+template<typename _IIID> class _com_ptr_t {
+public:
+  typedef _IIID ThisIIID;
+  typedef typename _IIID::Interface Interface;
+  static const IID& GetIID() throw() { return ThisIIID::GetIID(); }
+  template<typename _OtherIID> _com_ptr_t(const _com_ptr_t<_OtherIID> &p) : m_pInterface(NULL) {
+    HRESULT hr = _QueryInterface(p);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+  }
+  template<typename _InterfaceType> _com_ptr_t(_InterfaceType *p) : m_pInterface(NULL) {
+    HRESULT hr = _QueryInterface(p);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+  }
+  template<typename _X> _com_ptr_t(LPSTR str) { new(this) _com_ptr_t(static_cast<LPCSTR> (str),NULL); }
+  template<typename _X> _com_ptr_t(LPWSTR str) { new(this) _com_ptr_t(static_cast<LPCWSTR> (str),NULL); }
+  template<typename _X> explicit _com_ptr_t(_com_ptr_t *p) : m_pInterface(NULL) {
+    if(!p) { _com_issue_error(E_POINTER); }
+    else {
+      m_pInterface = p->m_pInterface;
+      AddRef();
+    }
+  }
+  _com_ptr_t() throw() : m_pInterface(NULL) { }
+  _com_ptr_t(int null) : m_pInterface(NULL) {
+    if(null!=0) { _com_issue_error(E_POINTER); }
+  }
+
+#ifdef _NATIVE_NULLPTR_SUPPORTED
+  _com_ptr_t(decltype(nullptr)) : m_pInterface(NULL) {}
+#endif
+
+  _com_ptr_t(const _com_ptr_t &cp) throw() : m_pInterface(cp.m_pInterface) { _AddRef(); }
+  template<typename _X> _com_ptr_t(Interface *pInterface) throw() : m_pInterface(pInterface) { _AddRef(); }
+  _com_ptr_t(Interface *pInterface,bool fAddRef) throw() : m_pInterface(pInterface) {
+    if(fAddRef) _AddRef();
+  }
+  _com_ptr_t(const _variant_t& varSrc) : m_pInterface(NULL) {
+    HRESULT hr = QueryStdInterfaces(varSrc);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+  }
+  explicit _com_ptr_t(const CLSID &clsid,IUnknown *pOuter = NULL,DWORD dwClsContext = CLSCTX_ALL) : m_pInterface(NULL) {
+    HRESULT hr = CreateInstance(clsid,pOuter,dwClsContext);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+  }
+  explicit _com_ptr_t(LPCWSTR str,IUnknown *pOuter = NULL,DWORD dwClsContext = CLSCTX_ALL) : m_pInterface(NULL) {
+    HRESULT hr = CreateInstance(str,pOuter,dwClsContext);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+  }
+  explicit _com_ptr_t(LPCSTR str,IUnknown *pOuter = NULL,DWORD dwClsContext = CLSCTX_ALL) : m_pInterface(NULL) {
+    HRESULT hr = CreateInstance(str,pOuter,dwClsContext);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+  }
+  template<typename _OtherIID> _com_ptr_t &operator=(const _com_ptr_t<_OtherIID> &p) {
+    HRESULT hr = _QueryInterface(p);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+    return *this;
+  }
+  template<typename _InterfaceType> _com_ptr_t &operator=(_InterfaceType *p) {
+    HRESULT hr = _QueryInterface(p);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+    return *this;
+  }
+  template<typename _X> _com_ptr_t &operator=(Interface *pInterface) throw() {
+    if(m_pInterface!=pInterface) {
+      Interface *pOldInterface = m_pInterface;
+      m_pInterface = pInterface;
+      _AddRef();
+      if(pOldInterface!=NULL) pOldInterface->Release();
+    }
+    return *this;
+  }
+  _com_ptr_t &operator=(const _com_ptr_t &cp) throw() { return operator=(cp.m_pInterface); }
+  _com_ptr_t &operator=(int null) {
+    if(null!=0) { _com_issue_error(E_POINTER); }
+    return operator=(reinterpret_cast<Interface*>(NULL));
+  }
+  _com_ptr_t &operator=(const _variant_t& varSrc) {
+    HRESULT hr = QueryStdInterfaces(varSrc);
+    if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
+    return *this;
+  }
+  ~_com_ptr_t() throw() { _Release(); }
+  void Attach(Interface *pInterface) throw() {
+    _Release();
+    m_pInterface = pInterface;
+  }
+  void Attach(Interface *pInterface,bool fAddRef) throw() {
+    _Release();
+    m_pInterface = pInterface;
+    if(fAddRef) {
+      if(!pInterface) { _com_issue_error(E_POINTER); }
+      else pInterface->AddRef();
+    }
+  }
+  Interface *Detach() throw() {
+    Interface *const old = m_pInterface;
+    m_pInterface = NULL;
+    return old;
+  }
+  operator Interface*() const throw() { return m_pInterface; }
+  operator Interface&() const {
+    if(!m_pInterface) { _com_issue_error(E_POINTER); }
+    return *m_pInterface;
+  }
+  Interface& operator*() const {
+    if(!m_pInterface) { _com_issue_error(E_POINTER); }
+    return *m_pInterface;
+  }
+  Interface **operator&() throw() {
+    _Release();
+    m_pInterface = NULL;
+    return &m_pInterface;
+  }
+  Interface *operator->() const {
+    if(!m_pInterface) { _com_issue_error(E_POINTER); }
+    return m_pInterface;
+  }
+  operator bool() const throw() { return m_pInterface!=NULL; }
+  template<typename _OtherIID> bool operator==(const _com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)==0; }
+  template<typename _OtherIID> bool operator==(_com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)==0; }
+  template<typename _InterfaceType> bool operator==(_InterfaceType *p) { return _CompareUnknown(p)==0; }
+  template<typename _X> bool operator==(Interface *p) { return (m_pInterface==p) ? true : _CompareUnknown(p)==0; }
+  template<typename _X> bool operator==(const _com_ptr_t &p) throw() { return operator==(p.m_pInterface); }
+  template<typename _X> bool operator==(_com_ptr_t &p) throw() { return operator==(p.m_pInterface); }
+  bool operator==(int null) {
+    if(null!=0) { _com_issue_error(E_POINTER); }
+    return !m_pInterface;
+  }
+  template<typename _OtherIID> bool operator!=(const _com_ptr_t<_OtherIID> &p) { return !(operator==(p)); }
+  template<typename _OtherIID> bool operator!=(_com_ptr_t<_OtherIID> &p) { return !(operator==(p)); }
+  template<typename _InterfaceType> bool operator!=(_InterfaceType *p) { return !(operator==(p)); }
+  bool operator!=(int null) { return !(operator==(null)); }
+  template<typename _OtherIID> bool operator<(const _com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)<0; }
+  template<typename _OtherIID> bool operator<(_com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)<0; }
+  template<typename _InterfaceType> bool operator<(_InterfaceType *p) { return _CompareUnknown(p)<0; }
+  template<typename _OtherIID> bool operator>(const _com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)>0; }
+  template<typename _OtherIID> bool operator>(_com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)>0; }
+  template<typename _InterfaceType> bool operator>(_InterfaceType *p) { return _CompareUnknown(p)>0; }
+  template<typename _OtherIID> bool operator<=(const _com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)<=0; }
+  template<typename _OtherIID> bool operator<=(_com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)<=0; }
+  template<typename _InterfaceType> bool operator<=(_InterfaceType *p) { return _CompareUnknown(p)<=0; }
+  template<typename _OtherIID> bool operator>=(const _com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)>=0; }
+  template<typename _OtherIID> bool operator>=(_com_ptr_t<_OtherIID> &p) { return _CompareUnknown(p)>=0; }
+  template<typename _InterfaceType> bool operator>=(_InterfaceType *p) { return _CompareUnknown(p)>=0; }
+  void Release() {
+    if(!m_pInterface) { _com_issue_error(E_POINTER); }
+    else {
+      m_pInterface->Release();
+      m_pInterface = NULL;
+    }
+  }
+  void AddRef() {
+    if(!m_pInterface) { _com_issue_error(E_POINTER); }
+    else m_pInterface->AddRef();
+  }
+  Interface *GetInterfacePtr() const throw() { return m_pInterface; }
+  Interface*& GetInterfacePtr() throw() { return m_pInterface; }
+  HRESULT CreateInstance(const CLSID &rclsid,IUnknown *pOuter = NULL,DWORD dwClsContext = CLSCTX_ALL) throw() {
+    HRESULT hr;
+    _Release();
+    if(dwClsContext & (CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)) {
+      IUnknown *pIUnknown;
+      hr = CoCreateInstance(rclsid,pOuter,dwClsContext,IID_IUnknown,reinterpret_cast<void**>(&pIUnknown));
+      if(SUCCEEDED(hr)) {
+        hr = OleRun(pIUnknown);
+        if(SUCCEEDED(hr)) hr = pIUnknown->QueryInterface(GetIID(),reinterpret_cast<void**>(&m_pInterface));
+        pIUnknown->Release();
+      }
+    } else hr = CoCreateInstance(rclsid,pOuter,dwClsContext,GetIID(),reinterpret_cast<void**>(&m_pInterface));
+    if(FAILED(hr)) m_pInterface = NULL;
+    return hr;
+  }
+  HRESULT CreateInstance(LPCWSTR clsidString,IUnknown *pOuter = NULL,DWORD dwClsContext = CLSCTX_ALL) throw() {
+    if(!clsidString) return E_INVALIDARG;
+    CLSID clsid;
+    HRESULT hr;
+    if(clsidString[0]==L'{') hr = CLSIDFromString(const_cast<LPWSTR> (clsidString),&clsid);
+    else hr = CLSIDFromProgID(const_cast<LPWSTR> (clsidString),&clsid);
+    if(FAILED(hr)) return hr;
+    return CreateInstance(clsid,pOuter,dwClsContext);
+  }
+  HRESULT CreateInstance(LPCSTR clsidStringA,IUnknown *pOuter = NULL,DWORD dwClsContext = CLSCTX_ALL) throw() {
+    if(!clsidStringA) return E_INVALIDARG;
+    int size = lstrlenA(clsidStringA) + 1;
+    int destSize = MultiByteToWideChar(CP_ACP,0,clsidStringA,size,NULL,0);
+    if(destSize==0) return HRESULT_FROM_WIN32(GetLastError());
+    LPWSTR clsidStringW;
+    clsidStringW = static_cast<LPWSTR>(_malloca(destSize*sizeof(WCHAR)));
+    if(!clsidStringW) return E_OUTOFMEMORY;
+    if(MultiByteToWideChar(CP_ACP,0,clsidStringA,size,clsidStringW,destSize)==0) {
+      _freea(clsidStringW);
+      return HRESULT_FROM_WIN32(GetLastError());
+    }
+    HRESULT hr=CreateInstance(clsidStringW,pOuter,dwClsContext);
+    _freea(clsidStringW);
+    return hr;
+  }
+  HRESULT GetActiveObject(const CLSID &rclsid) throw() {
+    _Release();
+    IUnknown *pIUnknown;
+    HRESULT hr = ::GetActiveObject(rclsid,NULL,&pIUnknown);
+    if(SUCCEEDED(hr)) {
+      hr = pIUnknown->QueryInterface(GetIID(),reinterpret_cast<void**>(&m_pInterface));
+      pIUnknown->Release();
+    }
+    if(FAILED(hr)) m_pInterface = NULL;
+    return hr;
+  }
+  HRESULT GetActiveObject(LPCWSTR clsidString) throw() {
+    if(!clsidString) return E_INVALIDARG;
+    CLSID clsid;
+    HRESULT hr;
+    if(clsidString[0]=='{') hr = CLSIDFromString(const_cast<LPWSTR> (clsidString),&clsid);
+    else hr = CLSIDFromProgID(const_cast<LPWSTR> (clsidString),&clsid);
+    if(FAILED(hr)) return hr;
+    return GetActiveObject(clsid);
+  }
+  HRESULT GetActiveObject(LPCSTR clsidStringA) throw() {
+    if(!clsidStringA) return E_INVALIDARG;
+    int size = lstrlenA(clsidStringA) + 1;
+    int destSize = MultiByteToWideChar(CP_ACP,0,clsidStringA,size,NULL,0);
+    LPWSTR clsidStringW;
+    try {
+      clsidStringW = static_cast<LPWSTR>(_alloca(destSize*sizeof(WCHAR)));
+    } catch (...) {
+      clsidStringW = NULL;
+    }
+    if(!clsidStringW) return E_OUTOFMEMORY;
+    if(MultiByteToWideChar(CP_ACP,0,clsidStringA,size,clsidStringW,destSize)==0) return HRESULT_FROM_WIN32(GetLastError());
+    return GetActiveObject(clsidStringW);
+  }
+  template<typename _InterfaceType> HRESULT QueryInterface(const IID& iid,_InterfaceType*& p) throw () {
+    if(m_pInterface!=NULL) return m_pInterface->QueryInterface(iid,reinterpret_cast<void**>(&p));
+    return E_POINTER;
+  }
+  template<typename _InterfaceType> HRESULT QueryInterface(const IID& iid,_InterfaceType **p) throw() { return QueryInterface(iid,*p); }
+private:
+  Interface *m_pInterface;
+  void _Release() throw() {
+    if(m_pInterface!=NULL) m_pInterface->Release();
+  }
+  void _AddRef() throw() {
+    if(m_pInterface!=NULL) m_pInterface->AddRef();
+  }
+  template<typename _InterfacePtr> HRESULT _QueryInterface(_InterfacePtr p) throw() {
+    HRESULT hr;
+    if(p!=NULL) {
+      Interface *pInterface;
+      hr = p->QueryInterface(GetIID(),reinterpret_cast<void**>(&pInterface));
+      Attach(SUCCEEDED(hr)? pInterface: NULL);
+    } else {
+      operator=(static_cast<Interface*>(NULL));
+      hr = E_NOINTERFACE;
+    }
+    return hr;
+  }
+  template<typename _InterfacePtr> int _CompareUnknown(_InterfacePtr p) {
+    IUnknown *pu1,*pu2;
+    if(m_pInterface!=NULL) {
+      HRESULT hr = m_pInterface->QueryInterface(IID_IUnknown,reinterpret_cast<void**>(&pu1));
+      if(FAILED(hr)) {
+        _com_issue_error(hr);
+        pu1 = NULL;
+      } else pu1->Release();
+    } else pu1 = NULL;
+    if(p!=NULL) {
+      HRESULT hr = p->QueryInterface(IID_IUnknown,reinterpret_cast<void**>(&pu2));
+      if(FAILED(hr)) {
+        _com_issue_error(hr);
+        pu2 = NULL;
+      } else pu2->Release();
+    } else pu2 = NULL;
+    return pu1 - pu2;
+  }
+  HRESULT QueryStdInterfaces(const _variant_t& varSrc) throw() {
+    if(V_VT(&varSrc)==VT_DISPATCH) return _QueryInterface(V_DISPATCH(&varSrc));
+    if(V_VT(&varSrc)==VT_UNKNOWN) return _QueryInterface(V_UNKNOWN(&varSrc));
+    VARIANT varDest;
+    VariantInit(&varDest);
+    HRESULT hr = VariantChangeType(&varDest,const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)),0,VT_DISPATCH);
+    if(SUCCEEDED(hr)) hr = _QueryInterface(V_DISPATCH(&varSrc));
+    if(hr==E_NOINTERFACE) {
+      VariantInit(&varDest);
+      hr = VariantChangeType(&varDest,const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)),0,VT_UNKNOWN);
+      if(SUCCEEDED(hr)) hr = _QueryInterface(V_UNKNOWN(&varSrc));
+    }
+    VariantClear(&varDest);
+    return hr;
+  }
+};
+
+template<typename _InterfaceType> bool operator==(int null,_com_ptr_t<_InterfaceType> &p) {
+  if(null!=0) { _com_issue_error(E_POINTER); }
+  return !p;
+}
+
+template<typename _Interface,typename _InterfacePtr> bool operator==(_Interface *i,_com_ptr_t<_InterfacePtr> &p) { return p==i; }
+
+template<typename _Interface> bool operator!=(int null,_com_ptr_t<_Interface> &p) {
+  if(null!=0) { _com_issue_error(E_POINTER); }
+  return p!=NULL;
+}
+
+template<typename _Interface,typename _InterfacePtr> bool operator!=(_Interface *i,_com_ptr_t<_InterfacePtr> &p) { return p!=i; }
+
+template<typename _Interface> bool operator<(int null,_com_ptr_t<_Interface> &p) {
+  if(null!=0) { _com_issue_error(E_POINTER); }
+  return p>NULL;
+}
+
+template<typename _Interface,typename _InterfacePtr> bool operator<(_Interface *i,_com_ptr_t<_InterfacePtr> &p) { return p>i; }
+
+template<typename _Interface> bool operator>(int null,_com_ptr_t<_Interface> &p) {
+  if(null!=0) { _com_issue_error(E_POINTER); }
+  return p<NULL;
+}
+
+template<typename _Interface,typename _InterfacePtr> bool operator>(_Interface *i,_com_ptr_t<_InterfacePtr> &p) { return p<i; }
+
+template<typename _Interface> bool operator<=(int null,_com_ptr_t<_Interface> &p) {
+  if(null!=0) { _com_issue_error(E_POINTER); }
+  return p>=NULL;
+}
+
+template<typename _Interface,typename _InterfacePtr> bool operator<=(_Interface *i,_com_ptr_t<_InterfacePtr> &p) { return p>=i; }
+
+template<typename _Interface> bool operator>=(int null,_com_ptr_t<_Interface> &p) {
+  if(null!=0) { _com_issue_error(E_POINTER); }
+  return p<=NULL;
+}
+
+template<typename _Interface,typename _InterfacePtr> bool operator>=(_Interface *i,_com_ptr_t<_InterfacePtr> &p) { return p<=i; }
+
+#pragma pop_macro("new")
+
+#endif /* __cplusplus */
+
+#endif /* _INC_COMIP */
diff --git a/reactos/include/crt/comutil.h b/reactos/include/crt/comutil.h
new file mode 100644 (file)
index 0000000..9c60830
--- /dev/null
@@ -0,0 +1,1212 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#ifndef _INC_COMUTIL
+#define _INC_COMUTIL
+
+#include <ole2.h>
+
+#ifndef _COM_ASSERT
+#define _COM_ASSERT(x) ((void)0)
+#endif
+
+#define _COM_MEMCPY_S(dest,destsize,src,count) memcpy(dest,src,count)
+
+/* Use of wsprintf might be impossible, if strsafe.h is included. */
+#ifndef __STDC_SECURE_LIB__
+#define _COM_PRINTF_S_1(dest,destsize,format,arg1) wsprintf(dest,format,arg1)
+#elif defined(UNICODE)
+#define _COM_PRINTF_S_1(dest,destsize,format,arg1) swprintf_s(dest,destsize,format,arg1)
+#else
+#define _COM_PRINTF_S_1(dest,destsize,format,arg1) sprintf_s(dest,destsize,format,arg1)
+#endif
+
+#ifdef __cplusplus
+
+#pragma push_macro("new")
+#undef new
+
+#ifndef WINAPI
+#define WINAPI __stdcall
+#endif
+
+class _com_error;
+
+void WINAPI _com_issue_error(HRESULT);
+
+class _bstr_t;
+class _variant_t;
+
+namespace _com_util {
+  inline void CheckError(HRESULT hr) {
+    if(FAILED(hr)) { _com_issue_error(hr); }
+  }
+}
+
+namespace _com_util {
+  BSTR WINAPI ConvertStringToBSTR(const char *pSrc);
+  char *WINAPI ConvertBSTRToString(BSTR pSrc);
+}
+
+class _bstr_t {
+public:
+  _bstr_t() throw();
+  _bstr_t(const _bstr_t &s) throw();
+  _bstr_t(const char *s);
+  _bstr_t(const wchar_t *s);
+  _bstr_t(const _variant_t &var);
+  _bstr_t(BSTR bstr,bool fCopy);
+  ~_bstr_t() throw();
+  _bstr_t &operator=(const _bstr_t &s) throw();
+  _bstr_t &operator=(const char *s);
+  _bstr_t &operator=(const wchar_t *s);
+  _bstr_t &operator=(const _variant_t &var);
+  _bstr_t &operator+=(const _bstr_t &s);
+  _bstr_t operator+(const _bstr_t &s) const;
+  friend _bstr_t operator+(const char *s1,const _bstr_t &s2);
+  friend _bstr_t operator+(const wchar_t *s1,const _bstr_t &s2);
+  operator const wchar_t *() const throw();
+  operator wchar_t *() const throw();
+  operator const char *() const;
+  operator char *() const;
+  bool operator!() const throw();
+  bool operator==(const _bstr_t &str) const throw();
+  bool operator!=(const _bstr_t &str) const throw();
+  bool operator<(const _bstr_t &str) const throw();
+  bool operator>(const _bstr_t &str) const throw();
+  bool operator<=(const _bstr_t &str) const throw();
+  bool operator>=(const _bstr_t &str) const throw();
+  BSTR copy(bool fCopy = true) const;
+  unsigned int length() const throw();
+  void Assign(BSTR s);
+  BSTR &GetBSTR();
+  BSTR *GetAddress();
+  void Attach(BSTR s);
+  BSTR Detach();
+private:
+  class Data_t {
+  public:
+    Data_t(const char *s);
+    Data_t(const wchar_t *s);
+    Data_t(BSTR bstr,bool fCopy);
+    Data_t(const _bstr_t &s1,const _bstr_t &s2);
+    unsigned long AddRef() throw();
+    unsigned long Release() throw();
+    unsigned long RefCount() const throw();
+    operator const wchar_t *() const throw();
+    operator const char *() const;
+    const wchar_t *GetWString() const throw();
+    wchar_t *&GetWString() throw();
+    const char *GetString() const;
+    BSTR Copy() const;
+    void Assign(BSTR s);
+    void Attach(BSTR s) throw();
+    unsigned int Length() const throw();
+    int Compare(const Data_t &str) const throw();
+    void *operator new(size_t sz);
+  private:
+    BSTR m_wstr;
+    mutable char *m_str;
+    unsigned long m_RefCount;
+    Data_t() throw();
+    Data_t(const Data_t &s) throw();
+    ~Data_t() throw();
+    void _Free() throw();
+  };
+private:
+  Data_t *m_Data;
+private:
+  void _AddRef() throw();
+  void _Free() throw();
+  int _Compare(const _bstr_t &str) const throw();
+};
+
+inline _bstr_t::_bstr_t() throw() : m_Data(NULL) { }
+
+inline _bstr_t::_bstr_t(const _bstr_t &s) throw() : m_Data(s.m_Data) { _AddRef(); }
+
+inline _bstr_t::_bstr_t(const char *s) : m_Data(new Data_t(s)) {
+  if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+}
+
+inline _bstr_t::_bstr_t(const wchar_t *s) : m_Data(new Data_t(s)) {
+  if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+}
+
+inline _bstr_t::_bstr_t(BSTR bstr,bool fCopy) : m_Data(new Data_t(bstr,fCopy)) {
+  if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+}
+
+inline _bstr_t::~_bstr_t() throw() { _Free(); }
+
+inline _bstr_t &_bstr_t::operator=(const _bstr_t &s) throw() {
+  if(this!=&s) {
+    _Free();
+    m_Data = s.m_Data;
+    _AddRef();
+  }
+  return *this;
+}
+
+inline _bstr_t &_bstr_t::operator=(const char *s) {
+  _COM_ASSERT(!s || static_cast<const char *>(*this)!=s);
+  if(!s || static_cast<const char *>(*this)!=s) {
+    _Free();
+    m_Data = new Data_t(s);
+    if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+  }
+  return *this;
+}
+
+inline _bstr_t &_bstr_t::operator=(const wchar_t *s) {
+  _COM_ASSERT(!s || static_cast<const wchar_t *>(*this)!=s);
+  if(!s || static_cast<const wchar_t *>(*this)!=s) {
+    _Free();
+    m_Data = new Data_t(s);
+    if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+  }
+  return *this;
+}
+
+inline _bstr_t &_bstr_t::operator+=(const _bstr_t &s) {
+  Data_t *newData = new Data_t(*this,s);
+  if(!newData) { _com_issue_error(E_OUTOFMEMORY); }
+  else {
+    _Free();
+    m_Data = newData;
+  }
+  return *this;
+}
+
+inline _bstr_t _bstr_t::operator+(const _bstr_t &s) const {
+  _bstr_t b = *this;
+  b += s;
+  return b;
+}
+
+inline _bstr_t operator+(const char *s1,const _bstr_t &s2) {
+  _bstr_t b = s1;
+  b += s2;
+  return b;
+}
+
+inline _bstr_t operator+(const wchar_t *s1,const _bstr_t &s2) {
+  _bstr_t b = s1;
+  b += s2;
+  return b;
+}
+
+inline _bstr_t::operator const wchar_t *() const throw() { return (m_Data!=NULL) ? m_Data->GetWString() : NULL; }
+inline _bstr_t::operator wchar_t *() const throw() { return const_cast<wchar_t *>((m_Data!=NULL) ? m_Data->GetWString() : NULL); }
+inline _bstr_t::operator const char *() const { return (m_Data!=NULL) ? m_Data->GetString() : NULL; }
+inline _bstr_t::operator char *() const { return const_cast<char *>((m_Data!=NULL) ? m_Data->GetString() : NULL); }
+inline bool _bstr_t::operator!() const throw() { return (m_Data!=NULL) ? !m_Data->GetWString() : true; }
+inline bool _bstr_t::operator==(const _bstr_t &str) const throw() { return _Compare(str)==0; }
+inline bool _bstr_t::operator!=(const _bstr_t &str) const throw() { return _Compare(str)!=0; }
+inline bool _bstr_t::operator<(const _bstr_t &str) const throw() { return _Compare(str)<0; }
+inline bool _bstr_t::operator>(const _bstr_t &str) const throw() { return _Compare(str)>0; }
+inline bool _bstr_t::operator<=(const _bstr_t &str) const throw() { return _Compare(str)<=0; }
+inline bool _bstr_t::operator>=(const _bstr_t &str) const throw() { return _Compare(str)>=0; }
+inline BSTR _bstr_t::copy(bool fCopy) const { return (m_Data!=NULL) ? (fCopy ? m_Data->Copy() : m_Data->GetWString()) : NULL; }
+inline unsigned int _bstr_t::length() const throw() { return (m_Data!=NULL) ? m_Data->Length() : 0; }
+inline void _bstr_t::Assign(BSTR s) {
+  _COM_ASSERT(!s || !m_Data || m_Data->GetWString()!=s);
+  if(!s || !m_Data || m_Data->GetWString()!=s) {
+    _Free();
+    m_Data = new Data_t(s,TRUE);
+    if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+  }
+}
+
+inline BSTR &_bstr_t::GetBSTR() {
+  if(!m_Data) {
+    m_Data = new Data_t(0,FALSE);
+    if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+  }
+  return m_Data->GetWString();
+}
+
+inline BSTR *_bstr_t::GetAddress() {
+  Attach(0);
+  return &m_Data->GetWString();
+}
+
+inline void _bstr_t::Attach(BSTR s) {
+  _Free();
+  m_Data = new Data_t(s,FALSE);
+  if(!m_Data) { _com_issue_error(E_OUTOFMEMORY); }
+}
+
+inline BSTR _bstr_t::Detach() {
+  _COM_ASSERT(m_Data!=NULL && m_Data->RefCount()==1);
+  if(m_Data!=NULL && m_Data->RefCount()==1) {
+    BSTR b = m_Data->GetWString();
+    m_Data->GetWString() = NULL;
+    _Free();
+    return b;
+  } else {
+    _com_issue_error(E_POINTER);
+    return NULL;
+  }
+}
+
+inline void _bstr_t::_AddRef() throw() {
+  if(m_Data!=NULL) m_Data->AddRef();
+}
+
+inline void _bstr_t::_Free() throw() {
+  if(m_Data!=NULL) {
+    m_Data->Release();
+    m_Data = NULL;
+  }
+}
+
+inline int _bstr_t::_Compare(const _bstr_t &str) const throw() {
+  if(m_Data==str.m_Data) return 0;
+  if(!m_Data) return -1;
+  if(!str.m_Data) return 1;
+  return m_Data->Compare(*str.m_Data);
+}
+
+inline _bstr_t::Data_t::Data_t(const char *s) : m_str(NULL),m_RefCount(1) {
+  m_wstr = _com_util::ConvertStringToBSTR(s);
+}
+
+inline _bstr_t::Data_t::Data_t(const wchar_t *s) : m_str(NULL),m_RefCount(1) {
+  m_wstr = ::SysAllocString(s);
+  if(!m_wstr && s!=NULL) { _com_issue_error(E_OUTOFMEMORY); }
+}
+
+inline _bstr_t::Data_t::Data_t(BSTR bstr,bool fCopy) : m_str(NULL),m_RefCount(1) {
+  if(fCopy && bstr!=NULL) {
+    m_wstr = ::SysAllocStringByteLen(reinterpret_cast<char *>(bstr),::SysStringByteLen(bstr));
+    if(!m_wstr) { _com_issue_error(E_OUTOFMEMORY); }
+  } else m_wstr = bstr;
+}
+
+inline _bstr_t::Data_t::Data_t(const _bstr_t &s1,const _bstr_t &s2) : m_str(NULL),m_RefCount(1) {
+  const unsigned int l1 = s1.length();
+  const unsigned int l2 = s2.length();
+  m_wstr = ::SysAllocStringByteLen(NULL,(l1 + l2) *sizeof(wchar_t));
+  if(!m_wstr) {
+    _com_issue_error(E_OUTOFMEMORY);
+    return;
+  }
+  const wchar_t *wstr1 = static_cast<const wchar_t *>(s1);
+  if(wstr1!=NULL) {
+    _COM_MEMCPY_S(m_wstr,(l1 + l2 + 1) *sizeof(wchar_t),wstr1,(l1 + 1) *sizeof(wchar_t));
+  }
+  const wchar_t *wstr2 = static_cast<const wchar_t *>(s2);
+  if(wstr2!=NULL) {
+    _COM_MEMCPY_S(m_wstr + l1,(l2 + 1) *sizeof(wchar_t),wstr2,(l2 + 1) *sizeof(wchar_t));
+  }
+}
+
+inline unsigned long _bstr_t::Data_t::AddRef() throw() {
+  InterlockedIncrement(reinterpret_cast<LONG*>(&m_RefCount));
+  return m_RefCount;
+}
+
+inline unsigned long _bstr_t::Data_t::Release() throw() {
+  unsigned long cRef = InterlockedDecrement(reinterpret_cast<LONG*>(&m_RefCount));
+  if(cRef==0) delete this;
+  return cRef;
+}
+
+inline unsigned long _bstr_t::Data_t::RefCount() const throw() { return m_RefCount; }
+inline _bstr_t::Data_t::operator const wchar_t *() const throw() { return m_wstr; }
+inline _bstr_t::Data_t::operator const char *() const { return GetString(); }
+inline const wchar_t *_bstr_t::Data_t::GetWString() const throw() { return m_wstr; }
+inline wchar_t *&_bstr_t::Data_t::GetWString() throw() { return m_wstr; }
+inline const char *_bstr_t::Data_t::GetString() const {
+  if(!m_str) m_str = _com_util::ConvertBSTRToString(m_wstr);
+  return m_str;
+}
+inline BSTR _bstr_t::Data_t::Copy() const {
+  if(m_wstr!=NULL) {
+    BSTR bstr = ::SysAllocStringByteLen(reinterpret_cast<char *>(m_wstr),::SysStringByteLen(m_wstr));
+    if(!bstr) { _com_issue_error(E_OUTOFMEMORY); }
+    return bstr;
+  }
+  return NULL;
+}
+inline void _bstr_t::Data_t::Assign(BSTR s) {
+  _Free();
+  if(s!=NULL) {
+    m_wstr = ::SysAllocStringByteLen(reinterpret_cast<char *>(s),::SysStringByteLen(s));
+    m_str = 0;
+  }
+}
+inline void _bstr_t::Data_t::Attach(BSTR s) throw() {
+  _Free();
+  m_wstr = s;
+  m_str = 0;
+  m_RefCount = 1;
+}
+inline unsigned int _bstr_t::Data_t::Length() const throw() { return m_wstr ? ::SysStringLen(m_wstr) : 0; }
+inline int _bstr_t::Data_t::Compare(const _bstr_t::Data_t &str) const throw() {
+  if(!m_wstr) return str.m_wstr ? -1 : 0;
+  if(!str.m_wstr) return 1;
+  const unsigned int l1 = ::SysStringLen(m_wstr);
+  const unsigned int l2 = ::SysStringLen(str.m_wstr);
+  unsigned int len = l1;
+  if(len>l2) len = l2;
+  BSTR bstr1 = m_wstr;
+  BSTR bstr2 = str.m_wstr;
+  while (len-->0) {
+    if(*bstr1++!=*bstr2++) return bstr1[-1] - bstr2[-1];
+  }
+  return (l1<l2) ? -1 : (l1==l2) ? 0 : 1;
+}
+
+#ifdef _COM_OPERATOR_NEW_THROWS
+inline void *_bstr_t::Data_t::operator new(size_t sz) {
+  try {
+    return ::operator new(sz);
+  } catch (...) {
+    return NULL;
+  }
+}
+#else
+inline void *_bstr_t::Data_t::operator new(size_t sz) {
+  return ::operator new(sz);
+}
+#endif
+
+inline _bstr_t::Data_t::~Data_t() throw() { _Free(); }
+inline void _bstr_t::Data_t::_Free() throw() {
+  if(m_wstr!=NULL) ::SysFreeString(m_wstr);
+  if(m_str!=NULL) delete [] m_str;
+}
+
+class _variant_t : public ::tagVARIANT {
+public:
+  _variant_t() throw();
+  _variant_t(const VARIANT &varSrc);
+  _variant_t(const VARIANT *pSrc);
+  _variant_t(const _variant_t &varSrc);
+  _variant_t(VARIANT &varSrc,bool fCopy);
+  _variant_t(short sSrc,VARTYPE vtSrc = VT_I2);
+  _variant_t(long lSrc,VARTYPE vtSrc = VT_I4);
+  _variant_t(float fltSrc) throw();
+  _variant_t(double dblSrc,VARTYPE vtSrc = VT_R8);
+  _variant_t(const CY &cySrc) throw();
+  _variant_t(const _bstr_t &bstrSrc);
+  _variant_t(const wchar_t *pSrc);
+  _variant_t(const char *pSrc);
+  _variant_t(IDispatch *pSrc,bool fAddRef = true) throw();
+  _variant_t(bool boolSrc) throw();
+  _variant_t(IUnknown *pSrc,bool fAddRef = true) throw();
+  _variant_t(const DECIMAL &decSrc) throw();
+  _variant_t(BYTE bSrc) throw();
+  _variant_t(char cSrc) throw();
+  _variant_t(unsigned short usSrc) throw();
+  _variant_t(unsigned long ulSrc) throw();
+  _variant_t(int iSrc) throw();
+  _variant_t(unsigned int uiSrc) throw();
+  __MINGW_EXTENSION _variant_t(__int64 i8Src) throw();
+  __MINGW_EXTENSION _variant_t(unsigned __int64 ui8Src) throw();
+  ~_variant_t() throw();
+  operator short() const;
+  operator long() const;
+  operator float() const;
+  operator double() const;
+  operator CY() const;
+  operator _bstr_t() const;
+  operator IDispatch*() const;
+  operator bool() const;
+  operator IUnknown*() const;
+  operator DECIMAL() const;
+  operator BYTE() const;
+  operator VARIANT() const throw();
+  operator char() const;
+  operator unsigned short() const;
+  operator unsigned long() const;
+  operator int() const;
+  operator unsigned int() const;
+  __MINGW_EXTENSION operator __int64() const;
+  __MINGW_EXTENSION operator unsigned __int64() const;
+  _variant_t &operator=(const VARIANT &varSrc);
+  _variant_t &operator=(const VARIANT *pSrc);
+  _variant_t &operator=(const _variant_t &varSrc);
+  _variant_t &operator=(short sSrc);
+  _variant_t &operator=(long lSrc);
+  _variant_t &operator=(float fltSrc);
+  _variant_t &operator=(double dblSrc);
+  _variant_t &operator=(const CY &cySrc);
+  _variant_t &operator=(const _bstr_t &bstrSrc);
+  _variant_t &operator=(const wchar_t *pSrc);
+  _variant_t &operator=(const char *pSrc);
+  _variant_t &operator=(IDispatch *pSrc);
+  _variant_t &operator=(bool boolSrc);
+  _variant_t &operator=(IUnknown *pSrc);
+  _variant_t &operator=(const DECIMAL &decSrc);
+  _variant_t &operator=(BYTE bSrc);
+  _variant_t &operator=(char cSrc);
+  _variant_t &operator=(unsigned short usSrc);
+  _variant_t &operator=(unsigned long ulSrc);
+  _variant_t &operator=(int iSrc);
+  _variant_t &operator=(unsigned int uiSrc);
+  __MINGW_EXTENSION _variant_t &operator=(__int64 i8Src);
+  __MINGW_EXTENSION _variant_t &operator=(unsigned __int64 ui8Src);
+  bool operator==(const VARIANT &varSrc) const throw();
+  bool operator==(const VARIANT *pSrc) const throw();
+  bool operator!=(const VARIANT &varSrc) const throw();
+  bool operator!=(const VARIANT *pSrc) const throw();
+  void Clear();
+  void Attach(VARIANT &varSrc);
+  VARIANT Detach();
+  VARIANT &GetVARIANT() throw();
+  VARIANT *GetAddress();
+  void ChangeType(VARTYPE vartype,const _variant_t *pSrc = NULL);
+  void SetString(const char *pSrc);
+};
+
+inline _variant_t::_variant_t() throw() { ::VariantInit(this); }
+inline _variant_t::_variant_t(const VARIANT &varSrc) {
+  ::VariantInit(this);
+  _com_util::CheckError(::VariantCopy(this,const_cast<VARIANT*>(&varSrc)));
+}
+inline _variant_t::_variant_t(const VARIANT *pSrc) {
+  if(!pSrc) { _com_issue_error(E_POINTER); }
+  else {
+    ::VariantInit(this);
+    _com_util::CheckError(::VariantCopy(this,const_cast<VARIANT*>(pSrc)));
+  }
+}
+inline _variant_t::_variant_t(const _variant_t &varSrc) {
+  ::VariantInit(this);
+  _com_util::CheckError(::VariantCopy(this,const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))));
+}
+inline _variant_t::_variant_t(VARIANT &varSrc,bool fCopy) {
+  if(fCopy) {
+    ::VariantInit(this);
+    _com_util::CheckError(::VariantCopy(this,&varSrc));
+  } else {
+    _COM_MEMCPY_S(this,sizeof(varSrc),&varSrc,sizeof(varSrc));
+    V_VT(&varSrc) = VT_EMPTY;
+  }
+}
+inline _variant_t::_variant_t(short sSrc,VARTYPE vtSrc) {
+  if((vtSrc!=VT_I2) && (vtSrc!=VT_BOOL)) {
+    _com_issue_error(E_INVALIDARG);
+    return;
+  }
+  if(vtSrc==VT_BOOL) {
+    V_VT(this) = VT_BOOL;
+    V_BOOL(this) = (sSrc ? VARIANT_TRUE : VARIANT_FALSE);
+  } else {
+    V_VT(this) = VT_I2;
+    V_I2(this) = sSrc;
+  }
+}
+inline _variant_t::_variant_t(long lSrc,VARTYPE vtSrc) {
+  if((vtSrc!=VT_I4) && (vtSrc!=VT_ERROR) && (vtSrc!=VT_BOOL)) {
+    _com_issue_error(E_INVALIDARG);
+    return;
+  }
+  if(vtSrc==VT_ERROR) {
+    V_VT(this) = VT_ERROR;
+    V_ERROR(this) = lSrc;
+  } else if(vtSrc==VT_BOOL) {
+    V_VT(this) = VT_BOOL;
+    V_BOOL(this) = (lSrc ? VARIANT_TRUE : VARIANT_FALSE);
+  } else {
+    V_VT(this) = VT_I4;
+    V_I4(this) = lSrc;
+  }
+}
+inline _variant_t::_variant_t(float fltSrc) throw() {
+  V_VT(this) = VT_R4;
+  V_R4(this) = fltSrc;
+}
+
+inline _variant_t::_variant_t(double dblSrc,VARTYPE vtSrc) {
+  if((vtSrc!=VT_R8) && (vtSrc!=VT_DATE)) {
+    _com_issue_error(E_INVALIDARG);
+    return;
+  }
+  if(vtSrc==VT_DATE) {
+    V_VT(this) = VT_DATE;
+    V_DATE(this) = dblSrc;
+  } else {
+    V_VT(this) = VT_R8;
+    V_R8(this) = dblSrc;
+  }
+}
+inline _variant_t::_variant_t(const CY &cySrc) throw() {
+  V_VT(this) = VT_CY;
+  V_CY(this) = cySrc;
+}
+inline _variant_t::_variant_t(const _bstr_t &bstrSrc) {
+  V_VT(this) = VT_BSTR;
+  BSTR bstr = static_cast<wchar_t *>(bstrSrc);
+  if(!bstr) V_BSTR(this) = NULL;
+  else {
+    V_BSTR(this) = ::SysAllocStringByteLen(reinterpret_cast<char *>(bstr),::SysStringByteLen(bstr));
+    if(!(V_BSTR(this))) { _com_issue_error(E_OUTOFMEMORY); }
+  }
+}
+inline _variant_t::_variant_t(const wchar_t *pSrc) {
+  V_VT(this) = VT_BSTR;
+  V_BSTR(this) = ::SysAllocString(pSrc);
+  if(!(V_BSTR(this)) && pSrc!=NULL) { _com_issue_error(E_OUTOFMEMORY); }
+}
+inline _variant_t::_variant_t(const char *pSrc) {
+  V_VT(this) = VT_BSTR;
+  V_BSTR(this) = _com_util::ConvertStringToBSTR(pSrc);
+}
+inline _variant_t::_variant_t(IDispatch *pSrc,bool fAddRef) throw() {
+  V_VT(this) = VT_DISPATCH;
+  V_DISPATCH(this) = pSrc;
+  if(fAddRef && V_DISPATCH(this)!=NULL) V_DISPATCH(this)->AddRef();
+}
+inline _variant_t::_variant_t(bool boolSrc) throw() {
+  V_VT(this) = VT_BOOL;
+  V_BOOL(this) = (boolSrc ? VARIANT_TRUE : VARIANT_FALSE);
+}
+inline _variant_t::_variant_t(IUnknown *pSrc,bool fAddRef) throw() {
+  V_VT(this) = VT_UNKNOWN;
+  V_UNKNOWN(this) = pSrc;
+  if(fAddRef && V_UNKNOWN(this)!=NULL) V_UNKNOWN(this)->AddRef();
+}
+inline _variant_t::_variant_t(const DECIMAL &decSrc) throw() {
+  V_DECIMAL(this) = decSrc;
+  V_VT(this) = VT_DECIMAL;
+}
+inline _variant_t::_variant_t(BYTE bSrc) throw() {
+  V_VT(this) = VT_UI1;
+  V_UI1(this) = bSrc;
+}
+inline _variant_t::_variant_t(char cSrc) throw() {
+  V_VT(this) = VT_I1;
+  V_I1(this) = cSrc;
+}
+inline _variant_t::_variant_t(unsigned short usSrc) throw() {
+  V_VT(this) = VT_UI2;
+  V_UI2(this) = usSrc;
+}
+inline _variant_t::_variant_t(unsigned long ulSrc) throw() {
+  V_VT(this) = VT_UI4;
+  V_UI4(this) = ulSrc;
+}
+inline _variant_t::_variant_t(int iSrc) throw() {
+  V_VT(this) = VT_INT;
+  V_INT(this) = iSrc;
+}
+inline _variant_t::_variant_t(unsigned int uiSrc) throw() {
+  V_VT(this) = VT_UINT;
+  V_UINT(this) = uiSrc;
+}
+__MINGW_EXTENSION inline _variant_t::_variant_t(__int64 i8Src) throw() {
+  V_VT(this) = VT_I8;
+  V_I8(this) = i8Src;
+}
+__MINGW_EXTENSION inline _variant_t::_variant_t(unsigned __int64 ui8Src) throw() {
+  V_VT(this) = VT_UI8;
+  V_UI8(this) = ui8Src;
+}
+inline _variant_t::operator short() const {
+  if(V_VT(this)==VT_I2) return V_I2(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_I2,this);
+  return V_I2(&varDest);
+}
+inline _variant_t::operator long() const {
+  if(V_VT(this)==VT_I4) return V_I4(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_I4,this);
+  return V_I4(&varDest);
+}
+
+inline _variant_t::operator float() const {
+  if(V_VT(this)==VT_R4) return V_R4(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_R4,this);
+  return V_R4(&varDest);
+}
+
+inline _variant_t::operator double() const {
+  if(V_VT(this)==VT_R8) return V_R8(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_R8,this);
+  return V_R8(&varDest);
+}
+
+inline _variant_t::operator CY() const {
+  if(V_VT(this)==VT_CY) return V_CY(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_CY,this);
+  return V_CY(&varDest);
+}
+
+inline _variant_t::operator _bstr_t() const {
+  if(V_VT(this)==VT_BSTR) return V_BSTR(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_BSTR,this);
+  return V_BSTR(&varDest);
+}
+
+inline _variant_t::operator IDispatch*() const {
+  if(V_VT(this)==VT_DISPATCH) {
+    if(V_DISPATCH(this)!=NULL) V_DISPATCH(this)->AddRef();
+    return V_DISPATCH(this);
+  }
+  _variant_t varDest;
+  varDest.ChangeType(VT_DISPATCH,this);
+  if(V_DISPATCH(&varDest)!=NULL) V_DISPATCH(&varDest)->AddRef();
+  return V_DISPATCH(&varDest);
+}
+inline _variant_t::operator bool() const {
+  if(V_VT(this)==VT_BOOL) return V_BOOL(this) ? true : false;
+  _variant_t varDest;
+  varDest.ChangeType(VT_BOOL,this);
+  return (V_BOOL(&varDest)==VARIANT_TRUE) ? true : false;
+}
+
+inline _variant_t::operator IUnknown*() const {
+  if(V_VT(this)==VT_UNKNOWN) {
+    if(V_UNKNOWN(this)!=NULL) V_UNKNOWN(this)->AddRef();
+    return V_UNKNOWN(this);
+  }
+  _variant_t varDest;
+  varDest.ChangeType(VT_UNKNOWN,this);
+  if(V_UNKNOWN(&varDest)!=NULL) V_UNKNOWN(&varDest)->AddRef();
+  return V_UNKNOWN(&varDest);
+}
+inline _variant_t::operator DECIMAL() const {
+  if(V_VT(this)==VT_DECIMAL) return V_DECIMAL(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_DECIMAL,this);
+  return V_DECIMAL(&varDest);
+}
+inline _variant_t::operator BYTE() const {
+  if(V_VT(this)==VT_UI1) return V_UI1(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_UI1,this);
+  return V_UI1(&varDest);
+}
+inline _variant_t::operator VARIANT() const throw() { return *(VARIANT*) this; }
+inline _variant_t::operator char() const {
+  if(V_VT(this)==VT_I1) return V_I1(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_I1,this);
+  return V_I1(&varDest);
+}
+
+inline _variant_t::operator unsigned short() const {
+  if(V_VT(this)==VT_UI2) return V_UI2(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_UI2,this);
+  return V_UI2(&varDest);
+}
+
+inline _variant_t::operator unsigned long() const {
+  if(V_VT(this)==VT_UI4) return V_UI4(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_UI4,this);
+  return V_UI4(&varDest);
+}
+inline _variant_t::operator int() const {
+  if(V_VT(this)==VT_INT) return V_INT(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_INT,this);
+  return V_INT(&varDest);
+}
+inline _variant_t::operator unsigned int() const {
+  if(V_VT(this)==VT_UINT) return V_UINT(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_UINT,this);
+  return V_UINT(&varDest);
+}
+__MINGW_EXTENSION inline _variant_t::operator __int64() const {
+  if(V_VT(this)==VT_I8) return V_I8(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_I8,this);
+  return V_I8(&varDest);
+}
+__MINGW_EXTENSION inline _variant_t::operator unsigned __int64() const {
+  if(V_VT(this)==VT_UI8) return V_UI8(this);
+  _variant_t varDest;
+  varDest.ChangeType(VT_UI8,this);
+  return V_UI8(&varDest);
+}
+inline _variant_t &_variant_t::operator=(const VARIANT &varSrc) {
+  _com_util::CheckError(::VariantCopy(this,const_cast<VARIANT*>(&varSrc)));
+  return *this;
+}
+inline _variant_t &_variant_t::operator=(const VARIANT *pSrc) {
+  if(!pSrc) { _com_issue_error(E_POINTER); }
+  else { _com_util::CheckError(::VariantCopy(this,const_cast<VARIANT*>(pSrc))); }
+  return *this;
+}
+inline _variant_t &_variant_t::operator=(const _variant_t &varSrc) {
+  _com_util::CheckError(::VariantCopy(this,const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc))));
+  return *this;
+}
+inline _variant_t &_variant_t::operator=(short sSrc) {
+  if(V_VT(this)==VT_I2) V_I2(this) = sSrc;
+  else if(V_VT(this)==VT_BOOL) V_BOOL(this) = (sSrc ? VARIANT_TRUE : VARIANT_FALSE);
+  else {
+    Clear();
+    V_VT(this) = VT_I2;
+    V_I2(this) = sSrc;
+  }
+  return *this;
+}
+inline _variant_t &_variant_t::operator=(long lSrc) {
+  if(V_VT(this)==VT_I4) V_I4(this) = lSrc;
+  else if(V_VT(this)==VT_ERROR) V_ERROR(this) = lSrc;
+  else if(V_VT(this)==VT_BOOL) V_BOOL(this) = (lSrc ? VARIANT_TRUE : VARIANT_FALSE);
+  else {
+    Clear();
+    V_VT(this) = VT_I4;
+    V_I4(this) = lSrc;
+  }
+  return *this;
+}
+inline _variant_t &_variant_t::operator=(float fltSrc) {
+  if(V_VT(this)!=VT_R4) {
+    Clear();
+    V_VT(this) = VT_R4;
+  }
+  V_R4(this) = fltSrc;
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(double dblSrc)
+{
+  if(V_VT(this)==VT_R8) {
+    V_R8(this) = dblSrc;
+  }
+  else if(V_VT(this)==VT_DATE) {
+    V_DATE(this) = dblSrc;
+  }
+  else {
+
+    Clear();
+
+    V_VT(this) = VT_R8;
+    V_R8(this) = dblSrc;
+  }
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(const CY &cySrc)
+{
+  if(V_VT(this)!=VT_CY) {
+
+    Clear();
+
+    V_VT(this) = VT_CY;
+  }
+
+  V_CY(this) = cySrc;
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(const _bstr_t &bstrSrc)
+{
+  _COM_ASSERT(V_VT(this)!=VT_BSTR || !((BSTR) bstrSrc) || V_BSTR(this)!=(BSTR) bstrSrc);
+
+  Clear();
+
+  V_VT(this) = VT_BSTR;
+
+  if(!bstrSrc) {
+    V_BSTR(this) = NULL;
+  }
+  else {
+    BSTR bstr = static_cast<wchar_t *>(bstrSrc);
+    V_BSTR(this) = ::SysAllocStringByteLen(reinterpret_cast<char *>(bstr),::SysStringByteLen(bstr));
+
+    if(!(V_BSTR(this))) {
+      _com_issue_error(E_OUTOFMEMORY);
+    }
+  }
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(const wchar_t *pSrc)
+{
+  _COM_ASSERT(V_VT(this)!=VT_BSTR || !pSrc || V_BSTR(this)!=pSrc);
+
+  Clear();
+
+  V_VT(this) = VT_BSTR;
+
+  if(!pSrc) {
+    V_BSTR(this) = NULL;
+  }
+  else {
+    V_BSTR(this) = ::SysAllocString(pSrc);
+
+    if(!(V_BSTR(this))) {
+      _com_issue_error(E_OUTOFMEMORY);
+    }
+  }
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(const char *pSrc)
+{
+  _COM_ASSERT(V_VT(this)!=(VT_I1 | VT_BYREF) || !pSrc || V_I1REF(this)!=pSrc);
+
+  Clear();
+
+  V_VT(this) = VT_BSTR;
+  V_BSTR(this) = _com_util::ConvertStringToBSTR(pSrc);
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(IDispatch *pSrc)
+{
+  _COM_ASSERT(V_VT(this)!=VT_DISPATCH || pSrc==0 || V_DISPATCH(this)!=pSrc);
+
+  Clear();
+
+  V_VT(this) = VT_DISPATCH;
+  V_DISPATCH(this) = pSrc;
+
+  if(V_DISPATCH(this)!=NULL) {
+
+    V_DISPATCH(this)->AddRef();
+  }
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(bool boolSrc)
+{
+  if(V_VT(this)!=VT_BOOL) {
+
+    Clear();
+
+    V_VT(this) = VT_BOOL;
+  }
+
+  V_BOOL(this) = (boolSrc ? VARIANT_TRUE : VARIANT_FALSE);
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(IUnknown *pSrc)
+{
+  _COM_ASSERT(V_VT(this)!=VT_UNKNOWN || !pSrc || V_UNKNOWN(this)!=pSrc);
+
+  Clear();
+
+  V_VT(this) = VT_UNKNOWN;
+  V_UNKNOWN(this) = pSrc;
+
+  if(V_UNKNOWN(this)!=NULL) {
+
+    V_UNKNOWN(this)->AddRef();
+  }
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(const DECIMAL &decSrc)
+{
+  if(V_VT(this)!=VT_DECIMAL) {
+
+    Clear();
+  }
+
+  V_DECIMAL(this) = decSrc;
+  V_VT(this) = VT_DECIMAL;
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(BYTE bSrc)
+{
+  if(V_VT(this)!=VT_UI1) {
+
+    Clear();
+
+    V_VT(this) = VT_UI1;
+  }
+
+  V_UI1(this) = bSrc;
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(char cSrc)
+{
+  if(V_VT(this)!=VT_I1) {
+
+    Clear();
+
+    V_VT(this) = VT_I1;
+  }
+
+  V_I1(this) = cSrc;
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(unsigned short usSrc)
+{
+  if(V_VT(this)!=VT_UI2) {
+
+    Clear();
+
+    V_VT(this) = VT_UI2;
+  }
+
+  V_UI2(this) = usSrc;
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(unsigned long ulSrc)
+{
+  if(V_VT(this)!=VT_UI4) {
+
+    Clear();
+
+    V_VT(this) = VT_UI4;
+  }
+
+  V_UI4(this) = ulSrc;
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(int iSrc)
+{
+  if(V_VT(this)!=VT_INT) {
+
+    Clear();
+
+    V_VT(this) = VT_INT;
+  }
+
+  V_INT(this) = iSrc;
+
+  return *this;
+}
+
+inline _variant_t &_variant_t::operator=(unsigned int uiSrc)
+{
+  if(V_VT(this)!=VT_UINT) {
+
+    Clear();
+
+    V_VT(this) = VT_UINT;
+  }
+
+  V_UINT(this) = uiSrc;
+
+  return *this;
+}
+
+__MINGW_EXTENSION inline _variant_t &_variant_t::operator=(__int64 i8Src) {
+  if(V_VT(this)!=VT_I8) {
+
+    Clear();
+
+    V_VT(this) = VT_I8;
+  }
+
+  V_I8(this) = i8Src;
+
+  return *this;
+}
+
+__MINGW_EXTENSION inline _variant_t &_variant_t::operator=(unsigned __int64 ui8Src) {
+  if(V_VT(this)!=VT_UI8) {
+
+    Clear();
+
+    V_VT(this) = VT_UI8;
+  }
+
+  V_UI8(this) = ui8Src;
+
+  return *this;
+}
+
+inline bool _variant_t::operator==(const VARIANT &varSrc) const throw() {
+  return *this==&varSrc;
+}
+
+inline bool _variant_t::operator==(const VARIANT *pSrc) const throw()
+{
+  if(!pSrc) {
+    return false;
+  }
+
+  if(this==pSrc) {
+    return true;
+  }
+
+  if(V_VT(this)!=V_VT(pSrc)) {
+    return false;
+  }
+
+  switch (V_VT(this)) {
+case VT_EMPTY:
+case VT_NULL:
+  return true;
+
+case VT_I2:
+  return V_I2(this)==V_I2(pSrc);
+
+case VT_I4:
+  return V_I4(this)==V_I4(pSrc);
+
+case VT_R4:
+  return V_R4(this)==V_R4(pSrc);
+
+case VT_R8:
+  return V_R8(this)==V_R8(pSrc);
+
+case VT_CY:
+  return memcmp(&(V_CY(this)),&(V_CY(pSrc)),sizeof(CY))==0;
+
+case VT_DATE:
+  return V_DATE(this)==V_DATE(pSrc);
+
+case VT_BSTR:
+  return (::SysStringByteLen(V_BSTR(this))==::SysStringByteLen(V_BSTR(pSrc))) &&
+    (memcmp(V_BSTR(this),V_BSTR(pSrc),::SysStringByteLen(V_BSTR(this)))==0);
+
+case VT_DISPATCH:
+  return V_DISPATCH(this)==V_DISPATCH(pSrc);
+
+case VT_ERROR:
+  return V_ERROR(this)==V_ERROR(pSrc);
+
+case VT_BOOL:
+  return V_BOOL(this)==V_BOOL(pSrc);
+
+case VT_UNKNOWN:
+  return V_UNKNOWN(this)==V_UNKNOWN(pSrc);
+
+case VT_DECIMAL:
+  return memcmp(&(V_DECIMAL(this)),&(V_DECIMAL(pSrc)),sizeof(DECIMAL))==0;
+
+case VT_UI1:
+  return V_UI1(this)==V_UI1(pSrc);
+
+case VT_I1:
+  return V_I1(this)==V_I1(pSrc);
+
+case VT_UI2:
+  return V_UI2(this)==V_UI2(pSrc);
+
+case VT_UI4:
+  return V_UI4(this)==V_UI4(pSrc);
+
+case VT_INT:
+  return V_INT(this)==V_INT(pSrc);
+
+case VT_UINT:
+  return V_UINT(this)==V_UINT(pSrc);
+
+case VT_I8:
+  return V_I8(this)==V_I8(pSrc);
+
+case VT_UI8:
+  return V_UI8(this)==V_UI8(pSrc);
+
+default:
+  _com_issue_error(E_INVALIDARG);
+
+  }
+
+  return false;
+}
+
+inline bool _variant_t::operator!=(const VARIANT &varSrc) const throw()
+{
+  return !(*this==&varSrc);
+}
+
+inline bool _variant_t::operator!=(const VARIANT *pSrc) const throw()
+{
+  return !(*this==pSrc);
+}
+
+inline void _variant_t::Clear()
+{
+  _com_util::CheckError(::VariantClear(this));
+}
+
+inline void _variant_t::Attach(VARIANT &varSrc)
+{
+
+  Clear();
+
+  _COM_MEMCPY_S(this,sizeof(varSrc),&varSrc,sizeof(varSrc));
+  V_VT(&varSrc) = VT_EMPTY;
+}
+
+inline VARIANT _variant_t::Detach()
+{
+  VARIANT varResult = *this;
+  V_VT(this) = VT_EMPTY;
+
+  return varResult;
+}
+
+inline VARIANT &_variant_t::GetVARIANT() throw()
+{
+  return *(VARIANT*) this;
+}
+
+inline VARIANT *_variant_t::GetAddress() {
+  Clear();
+  return (VARIANT*) this;
+}
+inline void _variant_t::ChangeType(VARTYPE vartype,const _variant_t *pSrc) {
+  if(!pSrc) pSrc = this;
+  if((this!=pSrc) || (vartype!=V_VT(this))) {
+    _com_util::CheckError(::VariantChangeType(static_cast<VARIANT*>(this),const_cast<VARIANT*>(static_cast<const VARIANT*>(pSrc)),0,vartype));
+  }
+}
+inline void _variant_t::SetString(const char *pSrc) { operator=(pSrc); }
+inline _variant_t::~_variant_t() throw() { ::VariantClear(this); }
+inline _bstr_t::_bstr_t(const _variant_t &var) : m_Data(NULL) {
+  if(V_VT(&var)==VT_BSTR) {
+    *this = V_BSTR(&var);
+    return;
+  }
+  _variant_t varDest;
+  varDest.ChangeType(VT_BSTR,&var);
+  *this = V_BSTR(&varDest);
+}
+inline _bstr_t &_bstr_t::operator=(const _variant_t &var) {
+  if(V_VT(&var)==VT_BSTR) {
+    *this = V_BSTR(&var);
+    return *this;
+  }
+  _variant_t varDest;
+  varDest.ChangeType(VT_BSTR,&var);
+  *this = V_BSTR(&varDest);
+  return *this;
+}
+
+extern _variant_t vtMissing;
+
+#ifndef _USE_RAW
+#define bstr_t _bstr_t
+#define variant_t _variant_t
+#endif
+
+#pragma pop_macro("new")
+
+#endif /* __cplusplus */
+
+#endif
index ef3b467..2f85da7 100644 (file)
@@ -1,4 +1,5 @@
 
 
+add_subdirectory(comsupp)
 add_subdirectory(crt)
 add_subdirectory(delayimp)
 add_subdirectory(dxguid)
 add_subdirectory(crt)
 add_subdirectory(delayimp)
 add_subdirectory(dxguid)
diff --git a/reactos/lib/sdk/comsupp/CMakeLists.txt b/reactos/lib/sdk/comsupp/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0514982
--- /dev/null
@@ -0,0 +1,5 @@
+
+set_cpp()
+
+add_library(comsupp comsupp.cpp)
+add_dependencies(comsupp psdk)
diff --git a/reactos/lib/sdk/comsupp/comsupp.cpp b/reactos/lib/sdk/comsupp/comsupp.cpp
new file mode 100644 (file)
index 0000000..de1938c
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * PROJECT:         ReactOS crt library
+ * LICENSE:         GPLv2+ - See COPYING in the top level directory
+ * PURPOSE:         Compiler support for COM
+ * PROGRAMMER:      Thomas Faber
+ */
+
+#include <comdef.h>
+#include <comutil.h>
+
+/* comdef.h */
+typedef void WINAPI COM_ERROR_HANDLER(HRESULT, IErrorInfo *);
+static COM_ERROR_HANDLER *com_error_handler;
+
+void WINAPI _com_raise_error(HRESULT hr, IErrorInfo *perrinfo)
+{
+    throw _com_error(hr, perrinfo);
+}
+
+void WINAPI _set_com_error_handler(COM_ERROR_HANDLER *phandler)
+{
+    com_error_handler = phandler;
+}
+
+void WINAPI _com_issue_error(HRESULT hr)
+{
+    com_error_handler(hr, NULL);
+}
+
+void WINAPI _com_issue_errorex(HRESULT hr, IUnknown *punk, REFIID riid)
+{
+    void *pv;
+    IErrorInfo *perrinfo = NULL;
+
+    if (SUCCEEDED(punk->QueryInterface(riid, &pv)))
+    {
+        ISupportErrorInfo *pserrinfo = static_cast<ISupportErrorInfo *>(pv);
+        if (pserrinfo->InterfaceSupportsErrorInfo(riid) == S_OK)
+            (void)GetErrorInfo(0, &perrinfo);
+        pserrinfo->Release();
+    }
+
+    com_error_handler(hr, perrinfo);
+}
+
+/* comutil.h */
+_variant_t vtMissing(DISP_E_PARAMNOTFOUND, VT_ERROR);