diff --git a/trunk/mingw-w64-headers/crt/_mingw.h b/trunk/mingw-w64-headers/crt/_mingw.h
index ccd6e86..c5169ce 100644
--- a/trunk/mingw-w64-headers/crt/_mingw.h
+++ b/trunk/mingw-w64-headers/crt/_mingw.h
@@ -62,7 +62,8 @@ limitations in handling dllimport attribute.  */
 #define __MINGW_GNUC_PREREQ(major, minor)  0
 #endif
 
-#define USE___UUIDOF	0
+#define USE___UUIDOF	1
+#define __uuidof(A) *((const GUID*) NULL)
 
 #ifdef __cplusplus
 # define __CRT_INLINE inline
diff --git a/trunk/mingw-w64-headers/include/comdef.h b/trunk/mingw-w64-headers/include/comdef.h
index 928df51..0b1b17a 100644
--- a/trunk/mingw-w64-headers/include/comdef.h
+++ b/trunk/mingw-w64-headers/include/comdef.h
@@ -49,15 +49,17 @@ public:
   DWORD HelpContext() const throw();
   _bstr_t HelpFile() const;
   _bstr_t Source() const;
-  GUID GUID() const throw();
+  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
   };
-  const HRESULT m_hresult;
+  HRESULT m_hresult;
   IErrorInfo *m_perrinfo;
   mutable TCHAR *m_pszMsg;
 };
@@ -66,19 +68,18 @@ inline _com_error::_com_error(HRESULT hr,IErrorInfo *perrinfo,bool fAddRef) thro
   if(m_perrinfo!=NULL && fAddRef) m_perrinfo->AddRef();
 }
 
-inline _com_error::_com_error(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();
+inline _com_error::_com_error(const _com_error &that) throw() {
+  Ctor(that);
 }
 
 inline _com_error::~_com_error() throw() {
-  if(m_perrinfo!=NULL) m_perrinfo->Release();
-  if(m_pszMsg!=NULL) LocalFree((HLOCAL)m_pszMsg);
+	Dtor();
 }
 
 inline _com_error &_com_error::operator=(const _com_error &that) throw() {
   if(this!=&that) {
-    this->_com_error::~_com_error();
-    this->_com_error::_com_error(that);
+    Dtor();
+    Ctor(that); 
   }
   return *this;
 }
@@ -115,7 +116,7 @@ inline _bstr_t _com_error::Source() const {
   return _bstr_t(bstr,false);
 }
 
-inline _GUID _com_error::GUID() const throw() {
+inline GUID _com_error::GUID_() const throw() {
   _GUID guid;
   memset (&guid, 0, sizeof (_GUID));
   if(m_perrinfo!=NULL) m_perrinfo->GetGUID(&guid);
@@ -149,8 +150,22 @@ inline const TCHAR *_com_error::ErrorMessage() const throw() {
 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__;
 
+UUID IDispatchUUID = __uuidof(IDispatch);
+
 #if !defined(_COM_SMARTPTR)
 #if !defined(_INC_COMIP)
 #include <comip.h>
@@ -161,33 +176,31 @@ typedef int __missing_type__;
 #if defined(_COM_SMARTPTR)
 #if !defined(_COM_SMARTPTR_TYPEDEF)
 #if defined(_COM_SMARTPTR_LEVEL2)
-#define _COM_SMARTPTR_TYPEDEF(Interface,IID) typedef _COM_SMARTPTR<_COM_SMARTPTR_LEVEL2<Interface,&IID> > Interface ## Ptr
+#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) typedef _COM_SMARTPTR<Interface,&IID> Interface ## Ptr
+#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_) && USE___UUIDOF != 0
 #if defined(__IFontDisp_INTERFACE_DEFINED__)
-__if_not_exists(Font)
-{
+#if !defined(Font)
   struct Font : IFontDisp {};
-}
+#endif
 _COM_SMARTPTR_TYPEDEF(Font,__uuidof(IDispatch));
+
 #endif
 #if defined(__IFontEventsDisp_INTERFACE_DEFINED__)
-__if_not_exists(FontEvents)
-{
+#if !defined(FontEvents)
   struct FontEvents : IFontEventsDisp {};
-}
+#endif
 _COM_SMARTPTR_TYPEDEF(FontEvents,__uuidof(IDispatch));
 #endif
 #if defined(__IPictureDisp_INTERFACE_DEFINED__)
-__if_not_exists(Picture)
-{
+#if !defined(Picture)
   struct Picture : IPictureDisp {};
-}
+#endif
 _COM_SMARTPTR_TYPEDEF(Picture,__uuidof(IDispatch));
 #endif
 
diff --git a/trunk/mingw-w64-headers/include/comip.h b/trunk/mingw-w64-headers/include/comip.h
index 02fc245..5dd970e 100644
--- a/trunk/mingw-w64-headers/include/comip.h
+++ b/trunk/mingw-w64-headers/include/comip.h
@@ -55,9 +55,9 @@ public:
     HRESULT hr = _QueryInterface(p);
     if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
   }
-  template<> _com_ptr_t(LPSTR str) { new(this) _com_ptr_t(static_cast<LPCSTR> (str),NULL); }
-  template<> _com_ptr_t(LPWSTR str) { new(this) _com_ptr_t(static_cast<LPCWSTR> (str),NULL); }
-  template<> explicit _com_ptr_t(_com_ptr_t *p) : m_pInterface(NULL) {
+  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;
@@ -69,7 +69,7 @@ public:
     if(null!=0) { _com_issue_error(E_POINTER); }
   }
   _com_ptr_t(const _com_ptr_t &cp) throw() : m_pInterface(cp.m_pInterface) { _AddRef(); }
-  template<> _com_ptr_t(Interface *pInterface) throw() : m_pInterface(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();
   }
@@ -99,7 +99,7 @@ public:
     if(FAILED(hr) && (hr!=E_NOINTERFACE)) { _com_issue_error(hr); }
     return *this;
   }
-  template<> _com_ptr_t &operator=(Interface *pInterface) throw() {
+  template<typename X> _com_ptr_t &operator=(Interface *pInterface) throw() {
     if(m_pInterface!=pInterface) {
       Interface *pOldInterface = m_pInterface;
       m_pInterface = pInterface;
@@ -158,9 +158,9 @@ public:
   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<> bool operator==(Interface *p) { return (m_pInterface==p) ? true : _CompareUnknown(p)==0; }
-  template<> bool operator==(const _com_ptr_t &p) throw() { return operator==(p.m_pInterface); }
-  template<> bool operator==(_com_ptr_t &p) throw() { return operator==(p.m_pInterface); }
+  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;
@@ -259,9 +259,9 @@ public:
     int size = lstrlenA(clsidStringA) + 1;
     int destSize = MultiByteToWideChar(CP_ACP,0,clsidStringA,size,NULL,0);
     LPWSTR clsidStringW;
-    __try {
+    try {
       clsidStringW = static_cast<LPWSTR>(_alloca(destSize*sizeof(WCHAR)));
-    } __except (1) {
+    } catch (...) {
       clsidStringW = NULL;
     }
     if(!clsidStringW) return E_OUTOFMEMORY;
diff --git a/trunk/mingw-w64-headers/include/comutil.h b/trunk/mingw-w64-headers/include/comutil.h
index a004c39..1f40725 100644
--- a/trunk/mingw-w64-headers/include/comutil.h
+++ b/trunk/mingw-w64-headers/include/comutil.h
@@ -32,7 +32,7 @@ class _bstr_t;
 class _variant_t;
 
 namespace _com_util {
-  inline void CheckError(HRESULT hr) throw(...) {
+  inline void CheckError(HRESULT hr) throw() {
     if(FAILED(hr)) { _com_issue_error(hr); }
   }
 }
