1 --- include/atl/atlbase.h.orig 2005-04-14 17:54:32.000000000 +0900
2 +++ include/atl/atlbase.h 2007-12-23 14:38:02.467500000 +0900
8 +#pragma GCC system_header
12 #error ATL requires C++ compilation (use a .cpp suffix)
14 #define _ATL_TYPELIB_INDEX_LENGTH 10
15 #define _ATL_QUOTES_SPACE 2
17 -#pragma pack(push, _ATL_PACKING)
18 +#pragma pack(push, 8)
21 #pragma comment(lib, "atl.lib")
24 -extern "C" const __declspec(selectany) GUID LIBID_ATLLib = {0x44EC0535,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
25 -extern "C" const __declspec(selectany) CLSID CLSID_Registrar = {0x44EC053A,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
26 -extern "C" const __declspec(selectany) IID IID_IRegistrar = {0x44EC053B,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
27 -extern "C" const __declspec(selectany) IID IID_IAxWinHostWindow = {0xb6ea2050,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
28 -extern "C" const __declspec(selectany) IID IID_IAxWinAmbientDispatch = {0xb6ea2051,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
29 -extern "C" const __declspec(selectany) IID IID_IInternalConnection = {0x72AD0770,0x6A9F,0x11d1,{0xBC,0xEC,0x00,0x60,0x08,0x8F,0x44,0x4E}};
30 -extern "C" const __declspec(selectany) IID IID_IDocHostUIHandlerDispatch = {0x425B5AF0,0x65F1,0x11d1,{0x96,0x11,0x00,0x00,0xF8,0x1E,0x0D,0x0D}};
31 +#define __uuidof(I) IID_##I
37 +inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
40 + ((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] &&
41 + ((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] &&
42 + ((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] &&
43 + ((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]);
47 +#ifdef _INIT_ATL_COMMON_VARS
48 +extern "C" const GUID LIBID_ATLLib = {0x44EC0535,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
49 +extern "C" const CLSID CLSID_Registrar = {0x44EC053A,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
50 +extern "C" const IID IID_IRegistrar = {0x44EC053B,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
51 +extern "C" const IID IID_IAxWinHostWindow = {0xb6ea2050,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
52 +extern "C" const IID IID_IAxWinAmbientDispatch = {0xb6ea2051,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
53 +extern "C" const IID IID_IInternalConnection = {0x72AD0770,0x6A9F,0x11d1,{0xBC,0xEC,0x00,0x60,0x08,0x8F,0x44,0x4E}};
54 +extern "C" const IID IID_IDocHostUIHandlerDispatch = {0x425B5AF0,0x65F1,0x11d1,{0x96,0x11,0x00,0x00,0xF8,0x1E,0x0D,0x0D}};
57 +extern const GUID LIBID_ATLLib;
58 +extern const CLSID CLSID_Registrar;
59 +extern const IID IID_IRegistrar;
60 +extern const IID IID_IAxWinHostWindow;
61 +extern const IID IID_IAxWinAmbientDispatch;
62 +extern const IID IID_IInternalConnection;
63 +extern const IID IID_IDocHostUIHandlerDispatch;
71 if (pfnGetClassObject == NULL)
73 - HRESULT hRes = pfnGetClassObject(pfnCreateInstance, IID_IUnknown, (LPVOID*) &p);
74 + HRESULT hRes = pfnGetClassObject((LPVOID)pfnCreateInstance, IID_IUnknown, (LPVOID*) &p);
76 hRes = CoRegisterClassObject(*pclsid, p, dwClsContext, dwFlags, &dwRegister);
82 -PVOID __stdcall __AllocStdCallThunk(VOID);
83 -VOID __stdcall __FreeStdCallThunk(PVOID);
84 +//PVOID __stdcall __AllocStdCallThunk(VOID);
85 +//VOID __stdcall __FreeStdCallThunk(PVOID);
87 -#define AllocStdCallThunk() __AllocStdCallThunk()
88 -#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
89 +//#define AllocStdCallThunk() __AllocStdCallThunk()
90 +//#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
92 -#pragma comment(lib, "atlthunk.lib")
93 +//#pragma comment(lib, "atlthunk.lib")
94 +#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),0,sizeof(_stdcallthunk))
95 +#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
97 #elif defined (_M_AMD64)
100 return( HRESULT_FROM_WIN32( nError ) );
103 -inline void __declspec(noreturn) _AtlRaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags = EXCEPTION_NONCONTINUABLE )
104 +inline void _AtlRaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags = EXCEPTION_NONCONTINUABLE )
106 RaiseException( dwExceptionCode, dwExceptionFlags, 0, NULL );
109 class _NoAddRefReleaseOnCComPtr : public T
112 + _NoAddRefReleaseOnCComPtr();
113 STDMETHOD_(ULONG, AddRef)()=0;
114 STDMETHOD_(ULONG, Release)()=0;
118 return AtlAdvise(p, pUnk, iid, pdw);
121 HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
123 ATLASSERT(p == NULL);
124 @@ -801,11 +836,12 @@
125 ATLASSERT(pp != NULL && *pp == NULL);
126 return p->QueryInterface(__uuidof(Q), (void**)pp);
133 -template <class T, const IID* piid = &__uuidof(T)>
134 +template <class T, const IID* piid>
140 return AtlAdvise(p, pUnk, iid, pdw);
143 HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
145 ATLASSERT(p == NULL);
147 ATLASSERT(pp != NULL && *pp == NULL);
148 return p->QueryInterface(__uuidof(Q), (void**)pp);
154 @@ -1087,12 +1125,14 @@
155 hr = ::CoCreateInstance(clsid, pUnkOuter, dwClsContext, __uuidof(IUnknown), (void**)&p);
160 HRESULT QueryInterface(Q** pp)
162 ATLASSERT(pp != NULL && *pp == NULL);
163 return p->QueryInterface(__uuidof(Q), (void**)pp);
169 @@ -1257,21 +1297,26 @@
170 LeaveCriticalSection(&m_sec);
173 + static void _InitHandler(void *pData, LPEXCEPTION_POINTERS ep)
175 + HRESULT &hRes=*reinterpret_cast<HRESULT*>(pData);
176 + if (STATUS_NO_MEMORY == ep->ExceptionRecord->ExceptionCode)
177 + hRes = E_OUTOFMEMORY;
181 HRESULT Init() throw()
187 + __SEHandler _sehandler;
188 + if (__builtin_setjmp(_sejmpbuf) == 0)
190 + _sehandler.Set(_sejmpbuf, &hRes, reinterpret_cast<__SEHandler::PF>(EXCEPTION_EXECUTE_HANDLER), _InitHandler);
191 InitializeCriticalSection(&m_sec);
194 // structured exception may be raised in low memory situations
195 - __except(EXCEPTION_EXECUTE_HANDLER)
197 - if (STATUS_NO_MEMORY == GetExceptionCode())
198 - hRes = E_OUTOFMEMORY;
202 + _sehandler.Reset();
206 @@ -2799,10 +2844,19 @@
210 -__declspec(selectany) CComModule* _pModule=NULL;
211 +#ifdef _INIT_ATL_COMMON_VARS
212 +CComModule* _pModule=NULL;
214 +extern CComModule* _pModule;
218 // {B62F5910-6528-11d1-9611-0000F81E0D0D}
219 -_declspec(selectany) GUID GUID_ATLVer30 = { 0xb62f5910, 0x6528, 0x11d1, { 0x96, 0x11, 0x0, 0x0, 0xf8, 0x1e, 0xd, 0xd } };
220 +#ifdef _INIT_ATL_COMMON_VARS
221 +GUID GUID_ATLVer30 = { 0xb62f5910, 0x6528, 0x11d1, { 0x96, 0x11, 0x0, 0x0, 0xf8, 0x1e, 0xd, 0xd } };
223 +extern GUID GUID_ATLVer30;
226 class CComModule : public _ATL_MODULE
228 @@ -4286,7 +4340,9 @@
232 -__declspec(selectany) GUID CComModule::m_libid = {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
233 +#ifdef _INIT_ATL_COMMON_VARS
234 +GUID CComModule::m_libid = {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
237 #ifdef _ATL_STATIC_REGISTRY
238 #define UpdateRegistryFromResource UpdateRegistryFromResourceS
239 @@ -4355,7 +4411,9 @@
243 -__declspec(selectany) UINT CComApartment::ATL_CREATE_OBJECT = 0;
244 +#ifdef _INIT_ATL_COMMON_VARS
245 +UINT CComApartment::ATL_CREATE_OBJECT = 0;
248 class CComSimpleThreadAllocator
250 @@ -5855,6 +5913,10 @@
254 + static int _Except(void *pThis, LPEXCEPTION_POINTERS lpEP)
256 + return reinterpret_cast<CVirtualBuffer *>(pThis)->Except(lpEP);
258 void Seek(int nElement)
260 if(nElement < 0 || nElement >= m_nMaxElements)
261 @@ -5866,41 +5928,53 @@
263 if(nElement < 0 || nElement >= m_nMaxElements)
264 _AtlRaiseException((DWORD)EXCEPTION_ARRAY_BOUNDS_EXCEEDED);
267 + __SEHandler _sehandler;
268 + if (__builtin_setjmp(_sejmpbuf) == 0)
270 + _sehandler.Set(_sejmpbuf, this, _Except);
271 T* p = &m_pBase[nElement];
273 m_pTop = p > m_pTop ? p : m_pTop;
275 - __except(Except(GetExceptionInformation()))
279 + _sehandler.Reset();
283 void WriteBulk(Q& helper)
287 + __SEHandler _sehandler;
288 + if (__builtin_setjmp(_sejmpbuf) == 0)
290 + _sehandler.Set(_sejmpbuf, this, _Except);
291 m_pCurrent = helper(m_pBase);
292 m_pTop = m_pCurrent > m_pTop ? m_pCurrent : m_pTop;
294 - __except(Except(GetExceptionInformation()))
298 + _sehandler.Reset();
300 void Write(const T& Element)
302 if (m_pCurrent < &m_pBase[m_nMaxElements]) {
305 + __SEHandler _sehandler;
306 + if (__builtin_setjmp(_sejmpbuf) == 0)
308 + _sehandler.Set(_sejmpbuf, this, _Except);
309 *m_pCurrent = Element;
311 m_pTop = m_pCurrent > m_pTop ? m_pCurrent : m_pTop;
313 - __except(Except(GetExceptionInformation()))
317 + _sehandler.Reset();
321 @@ -5910,14 +5984,18 @@
324 BSTR bstrTemp = NULL ;
327 + __SEHandler _sehandler;
328 + if (__builtin_setjmp(_sejmpbuf) == 0)
330 + _sehandler.Set(_sejmpbuf, this, _Except);
331 bstrTemp = SysAllocStringByteLen((char*) m_pBase,
332 (UINT) ((BYTE*)m_pTop - (BYTE*)m_pBase));
334 - __except(Except(GetExceptionInformation()))
338 + _sehandler.Reset();
341 const T& operator[](int nElement) const
342 @@ -6336,6 +6414,11 @@
343 //Although these functions are big, they are only used once in a module
344 //so we should make them inline.
346 +ATLINLINE int atlmoduleinitfilter(void *, LPEXCEPTION_POINTERS ep)
348 + return ep->ExceptionRecord->ExceptionCode == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
351 ATLINLINE ATLAPI AtlModuleInit(_ATL_MODULE* pM, _ATL_OBJMAP_ENTRY* p, HINSTANCE h)
353 ATLASSERT(pM != NULL);
354 @@ -6352,32 +6435,43 @@
355 pM->m_hInst = pM->m_hInstTypeLib = pM->m_hInstResource = h;
360 + __SEHandler _sehandler;
361 + if (__builtin_setjmp(_sejmpbuf) == 0) {
362 + _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
363 InitializeCriticalSection(&pM->m_csTypeInfoHolder);
364 - } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
366 ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
367 - return STATUS_NO_MEMORY;
368 + _sehandler.Reset();
369 + return STATUS_NO_MEMORY;
371 + _sehandler.Reset();
374 + if (__builtin_setjmp(_sejmpbuf) == 0) {
375 + _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
376 InitializeCriticalSection(&pM->m_csWindowCreate);
377 - } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
379 DeleteCriticalSection(&pM->m_csTypeInfoHolder);
380 ZeroMemory(&pM->m_csWindowCreate, sizeof(pM->m_csWindowCreate));
381 ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
382 + _sehandler.Reset();
383 return STATUS_NO_MEMORY;
385 + _sehandler.Reset();
388 + if (__builtin_setjmp(_sejmpbuf) == 0) {
389 + _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
390 InitializeCriticalSection(&pM->m_csObjMap);
391 - } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
393 DeleteCriticalSection(&pM->m_csWindowCreate);
394 DeleteCriticalSection(&pM->m_csTypeInfoHolder);
395 ZeroMemory(&pM->m_csObjMap, sizeof(pM->m_csObjMap));
396 ZeroMemory(&pM->m_csWindowCreate, sizeof(pM->m_csWindowCreate));
397 ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
398 + _sehandler.Reset();
399 return STATUS_NO_MEMORY;
401 + _sehandler.Reset();
403 if (pM->cbSize > _nAtlModuleVer21Size)
405 @@ -6450,6 +6544,11 @@
409 +ATLINLINE void atlfinalleavecriticalsection(void *pData)
411 + LeaveCriticalSection(reinterpret_cast<LPCRITICAL_SECTION>(pData));
414 ATLINLINE ATLAPI AtlModuleGetClassObject(_ATL_MODULE* pM, REFCLSID rclsid, REFIID riid, LPVOID* ppv)
416 ATLASSERT(pM != NULL);
417 @@ -6473,15 +6572,15 @@
418 if (pEntry->pCF == NULL)
420 EnterCriticalSection(&pM->m_csObjMap);
423 + __SEHandler _sehandler;
424 + if (__builtin_setjmp(_sejmpbuf) == 0)
426 + _sehandler.Set(_sejmpbuf, &pM->m_csObjMap, EXCEPTION_CONTINUE_SEARCH, NULL, atlfinalleavecriticalsection);
427 if (pEntry->pCF == NULL)
428 - hRes = pEntry->pfnGetClassObject(pEntry->pfnCreateInstance, IID_IUnknown, (LPVOID*)&pEntry->pCF);
432 - LeaveCriticalSection(&pM->m_csObjMap);
433 + hRes = pEntry->pfnGetClassObject((void *)(pEntry->pfnCreateInstance), IID_IUnknown, (LPVOID*)&pEntry->pCF);
435 + _sehandler.Reset();
437 if (pEntry->pCF != NULL)
438 hRes = pEntry->pCF->QueryInterface(riid, ppv);
439 --- include/atl/atlcom.h.orig 2005-04-14 17:54:32.000000000 +0900
440 +++ include/atl/atlcom.h 2007-12-03 22:43:54.833375000 +0900
446 +#pragma GCC system_header
450 #error ATL requires C++ compilation (use a .cpp suffix)
452 #error atlcom.h requires atlbase.h to be included first
455 -#pragma pack(push, _ATL_PACKING)
456 +#include <algorithm>
459 +#pragma pack(push, 8)
461 EXTERN_C const IID IID_ITargetFrame;
463 @@ -2191,19 +2197,23 @@
464 // override it in your class and call each base class' version of this
465 #define BEGIN_COM_MAP(x) public: \
466 typedef x _ComMapClass; \
467 + static void _CacheFinal(void *pData)\
469 + reinterpret_cast<_ComMapClass*>(pData)->Unlock();\
471 static HRESULT WINAPI _Cache(void* pv, REFIID iid, void** ppvObject, DWORD_PTR dw)\
473 _ComMapClass* p = (_ComMapClass*)pv;\
475 HRESULT hRes = E_FAIL; \
477 + jmp_buf _sejmpbuf; \
478 + __SEHandler _sehandler; \
479 + if (__builtin_setjmp(_sejmpbuf) == 0) \
481 + _sehandler.Set(_sejmpbuf, p, EXCEPTION_CONTINUE_SEARCH, NULL, _CacheFinal);\
482 hRes = CComObjectRootBase::_Cache(pv, iid, ppvObject, dw);\
488 + _sehandler.Reset();\
491 IUnknown* _GetRawUnknown() \
492 @@ -2339,7 +2349,7 @@
495 #define BEGIN_OBJECT_MAP(x) static _ATL_OBJMAP_ENTRY x[] = {
496 -#define END_OBJECT_MAP() {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
497 +#define END_OBJECT_MAP() {NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL}};
498 #define OBJECT_ENTRY(clsid, class) {&clsid, class::UpdateRegistry, class::_ClassFactoryCreatorClass::CreateInstance, class::_CreatorClass::CreateInstance, NULL, 0, class::GetObjectDescription, class::GetCategoryMap, class::ObjectMain },
499 #define OBJECT_ENTRY_NON_CREATEABLE(class) {&CLSID_NULL, class::UpdateRegistry, NULL, NULL, NULL, 0, NULL, class::GetCategoryMap, class::ObjectMain },
501 @@ -2492,9 +2502,9 @@
503 typedef ThreadModel _ThreadModel;
504 #ifdef OLD_ATL_CRITSEC_CODE
505 - typename typedef _ThreadModel::AutoCriticalSection _CritSec;
506 + typedef typename _ThreadModel::AutoCriticalSection _CritSec;
508 - typename typedef _ThreadModel::AutoDeleteCriticalSection _AutoDelCritSec;
509 + typedef typename _ThreadModel::AutoDeleteCriticalSection _AutoDelCritSec;
510 #endif /* OLD_ATL_CRITSEC_CODE */
511 typedef CComObjectLockT<_ThreadModel> ObjectLock;
513 @@ -2638,8 +2648,8 @@
514 // Set refcount to 1 to protect destruction
519 + this->m_dwRef = 1L;
520 + this->FinalRelease();
521 #ifdef _ATL_DEBUG_INTERFACES
522 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
524 @@ -2647,22 +2657,24 @@
526 //If InternalAddRef or InternalRelease is undefined then your class
527 //doesn't derive from CComObjectRoot
528 - STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
529 + STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
530 STDMETHOD_(ULONG, Release)()
532 - ULONG l = InternalRelease();
533 + ULONG l = this->InternalRelease();
538 //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
539 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
540 - {return _InternalQueryInterface(iid, ppvObject);}
541 + {return this->_InternalQueryInterface(iid, ppvObject);}
544 HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
546 return QueryInterface(__uuidof(Q), (void**)pp);
550 static HRESULT WINAPI CreateInstance(CComObject<Base>** pp);
552 @@ -2719,8 +2731,8 @@
553 #endif /* OLD_ATL_CRITSEC_CODE */
558 + this->m_dwRef = 1L;
559 + this->FinalRelease();
560 #ifdef _ATL_DEBUG_INTERFACES
561 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
563 @@ -2729,14 +2741,14 @@
564 //doesn't derive from CComObjectRoot
565 STDMETHOD_(ULONG, AddRef)()
567 - ULONG l = InternalAddRef();
568 + ULONG l = this->InternalAddRef();
573 STDMETHOD_(ULONG, Release)()
575 - ULONG l = InternalRelease();
576 + ULONG l = this->InternalRelease();
580 @@ -2745,7 +2757,7 @@
582 //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
583 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
584 - {return _InternalQueryInterface(iid, ppvObject);}
585 + {return this->_InternalQueryInterface(iid, ppvObject);}
586 #ifndef OLD_ATL_CRITSEC_CODE
587 CComGlobalsThreadModel::AutoDeleteCriticalSection m_csCached;
588 #endif /* OLD_ATL_CRITSEC_CODE */
589 @@ -2762,8 +2774,8 @@
590 // Set refcount to 1 to protect destruction
595 + this->m_dwRef = 1L;
596 + this->FinalRelease();
597 #ifdef _ATL_DEBUG_INTERFACES
598 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
600 @@ -2771,17 +2783,17 @@
602 //If InternalAddRef or InternalRelease is undefined then your class
603 //doesn't derive from CComObjectRoot
604 - STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
605 + STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
606 STDMETHOD_(ULONG, Release)()
608 - ULONG l = InternalRelease();
609 + ULONG l = this->InternalRelease();
614 //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
615 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
616 - {return _InternalQueryInterface(iid, ppvObject);}
617 + {return this->_InternalQueryInterface(iid, ppvObject);}
620 // It is possible for Base not to derive from CComObjectRoot
621 @@ -2794,14 +2806,14 @@
622 CComObjectGlobal(void* = NULL)
624 #ifndef OLD_ATL_CRITSEC_CODE
625 - m_hResFinalConstruct = _AtlInitialConstruct();
626 + m_hResFinalConstruct = this->_AtlInitialConstruct();
627 if (SUCCEEDED(m_hResFinalConstruct))
628 #endif /* OLD_ATL_CRITSEC_CODE */
629 - m_hResFinalConstruct = FinalConstruct();
630 + m_hResFinalConstruct = this->FinalConstruct();
635 + this->FinalRelease();
636 #ifdef _ATL_DEBUG_INTERFACES
637 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
639 @@ -2810,7 +2822,7 @@
640 STDMETHOD_(ULONG, AddRef)() {return _Module.Lock();}
641 STDMETHOD_(ULONG, Release)(){return _Module.Unlock();}
642 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
643 - {return _InternalQueryInterface(iid, ppvObject);}
644 + {return this->_InternalQueryInterface(iid, ppvObject);}
645 HRESULT m_hResFinalConstruct;
648 @@ -2824,14 +2836,14 @@
649 CComObjectStack(void* = NULL)
651 #ifndef OLD_ATL_CRITSEC_CODE
652 - m_hResFinalConstruct = _AtlInitialConstruct();
653 + m_hResFinalConstruct = this->_AtlInitialConstruct();
654 if (SUCCEEDED(m_hResFinalConstruct))
655 #endif /* OLD_ATL_CRITSEC_CODE */
656 - m_hResFinalConstruct = FinalConstruct();
657 + m_hResFinalConstruct = this->FinalConstruct();
662 + this->FinalRelease();
663 #ifdef _ATL_DEBUG_INTERFACES
664 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
666 @@ -2850,6 +2862,8 @@
669 typedef Base _BaseClass;
670 + using Base::_GetRawUnknown;
671 + using Base::m_pOuterUnknown;
672 CComContainedObject(void* pv) {m_pOuterUnknown = (IUnknown*)pv;}
673 #ifdef _ATL_DEBUG_INTERFACES
674 ~CComContainedObject()
675 @@ -2859,20 +2873,22 @@
679 - STDMETHOD_(ULONG, AddRef)() {return OuterAddRef();}
680 - STDMETHOD_(ULONG, Release)() {return OuterRelease();}
681 + STDMETHOD_(ULONG, AddRef)() {return this->OuterAddRef();}
682 + STDMETHOD_(ULONG, Release)() {return this->OuterRelease();}
683 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
685 - HRESULT hr = OuterQueryInterface(iid, ppvObject);
686 + HRESULT hr = this->OuterQueryInterface(iid, ppvObject);
687 if (FAILED(hr) && _GetRawUnknown() != m_pOuterUnknown)
688 - hr = _InternalQueryInterface(iid, ppvObject);
689 + hr = this->_InternalQueryInterface(iid, ppvObject);
694 HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
696 return QueryInterface(__uuidof(Q), (void**)pp);
699 //GetControllingUnknown may be virtual if the Base class has declared
700 //DECLARE_GET_CONTROLLING_UNKNOWN()
701 IUnknown* GetControllingUnknown()
702 @@ -2915,18 +2931,18 @@
703 // override it in your class and call each base class' version of this
704 HRESULT FinalConstruct()
706 - CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
707 + CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
708 return m_contained.FinalConstruct();
712 - CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
713 + CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
714 m_contained.FinalRelease();
716 // Set refcount to 1 to protect destruction
720 + this->m_dwRef = 1L;
722 #ifdef _ATL_DEBUG_INTERFACES
723 _Module.DeleteNonAddRefThunk(this);
724 @@ -2934,10 +2950,10 @@
728 - STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
729 + STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
730 STDMETHOD_(ULONG, Release)()
732 - ULONG l = InternalRelease();
733 + ULONG l = this->InternalRelease();
737 @@ -2959,11 +2975,13 @@
738 hRes = m_contained._InternalQueryInterface(iid, ppvObject);
743 HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
745 return QueryInterface(__uuidof(Q), (void**)pp);
748 static HRESULT WINAPI CreateInstance(LPUNKNOWN pUnkOuter, CComAggObject<contained>** pp)
750 _ATL_VALIDATE_OUT_POINTER(pp);
751 @@ -3023,21 +3041,21 @@
752 // override it in your class and call each base class' version of this
753 HRESULT FinalConstruct()
756 - CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
757 + this->InternalAddRef();
758 + CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
759 HRESULT hr = m_contained.FinalConstruct();
761 + this->InternalRelease();
766 - CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
767 + CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
768 m_contained.FinalRelease();
770 // Set refcount to 1 to protect destruction
774 + this->m_dwRef = 1L;
776 #ifdef _ATL_DEBUG_INTERFACES
777 _Module.DeleteNonAddRefThunk(this);
778 @@ -3045,10 +3063,10 @@
782 - STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
783 + STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
784 STDMETHOD_(ULONG, Release)()
786 - ULONG l = InternalRelease();
787 + ULONG l = this->InternalRelease();
791 @@ -3072,11 +3090,13 @@
792 hRes = m_contained._InternalQueryInterface(iid, ppvObject);
797 HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
799 return QueryInterface(__uuidof(Q), (void**)pp);
802 static HRESULT WINAPI CreateInstance(LPUNKNOWN pUnkOuter, CComPolyObject<contained>** pp)
804 _ATL_VALIDATE_OUT_POINTER(pp);
805 @@ -3111,27 +3131,28 @@
806 class CComTearOffObject : public Base
809 + using Base::m_pOwner;
810 CComTearOffObject(void* pv)
812 ATLASSERT(m_pOwner == NULL);
813 - m_pOwner = reinterpret_cast<CComObject<Base::_OwnerClass>*>(pv);
814 + m_pOwner = reinterpret_cast<CComObject<typename Base::_OwnerClass>*>(pv);
817 // Set refcount to 1 to protect destruction
822 + this->m_dwRef = 1L;
823 + this->FinalRelease();
824 #ifdef _ATL_DEBUG_INTERFACES
825 _Module.DeleteNonAddRefThunk(_GetRawUnknown());
830 - STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
831 + STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
832 STDMETHOD_(ULONG, Release)()
834 - ULONG l = InternalRelease();
835 + ULONG l = this->InternalRelease();
839 @@ -3150,27 +3171,27 @@
841 typedef contained _BaseClass;
842 CComCachedTearOffObject(void* pv) :
843 - m_contained(((contained::_OwnerClass*)pv)->GetControllingUnknown())
844 + m_contained(((typename contained::_OwnerClass*)pv)->GetControllingUnknown())
846 ATLASSERT(m_contained.m_pOwner == NULL);
847 - m_contained.m_pOwner = reinterpret_cast<CComObject<contained::_OwnerClass>*>(pv);
848 + m_contained.m_pOwner = reinterpret_cast<CComObject<typename contained::_OwnerClass>*>(pv);
850 //If you get a message that this call is ambiguous then you need to
851 // override it in your class and call each base class' version of this
852 HRESULT FinalConstruct()
854 - CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
855 + CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
856 return m_contained.FinalConstruct();
860 - CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
861 + CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
862 m_contained.FinalRelease();
864 // Set refcount to 1 to protect destruction
865 ~CComCachedTearOffObject()
868 + this->m_dwRef = 1L;
870 #ifdef _ATL_DEBUG_INTERFACES
871 _Module.DeleteNonAddRefThunk(this);
872 @@ -3178,10 +3199,10 @@
876 - STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
877 + STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
878 STDMETHOD_(ULONG, Release)()
880 - ULONG l = InternalRelease();
881 + ULONG l = this->InternalRelease();
885 @@ -3260,7 +3281,9 @@
888 typedef license _LicenseClass;
889 - typedef CComClassFactory2<license> _ComMapClass;
890 + using license::IsLicenseValid;
891 + using license::GetLicenseKey;
892 +// typedef CComClassFactory2<license> _ComMapClass;
893 BEGIN_COM_MAP(CComClassFactory2<license>)
894 COM_INTERFACE_ENTRY(IClassFactory)
895 COM_INTERFACE_ENTRY(IClassFactory2)
896 @@ -3297,7 +3320,7 @@
897 if (ppvObject == NULL)
900 - if ( ((bstrKey != NULL) && !VerifyLicenseKey(bstrKey)) ||
901 + if ( ((bstrKey != NULL) && !this->VerifyLicenseKey(bstrKey)) ||
902 ((bstrKey == NULL) && !IsLicenseValid()) )
903 return CLASS_E_NOTLICENSED;
904 if ((pUnkOuter != NULL) && !InlineIsEqualUnknown(riid))
905 @@ -3363,7 +3386,7 @@
906 if (pUnkOuter != NULL)
907 hRes = CLASS_E_NOAGGREGATION;
909 - hRes = _Module.CreateInstance(m_pfnCreateInstance, riid, ppvObj);
910 + hRes = _Module.CreateInstance((LPVOID)m_pfnCreateInstance, riid, ppvObj);
914 @@ -3454,6 +3477,7 @@
915 lpszHelpFile, iid, hRes);
920 static HRESULT CreateInstance(IUnknown* punkOuter, Q** pp)
922 @@ -3464,6 +3488,7 @@
924 return T::_CreatorClass::CreateInstance(NULL, __uuidof(Q), (void**) pp);
929 // ATL doesn't support multiple LCID's at the same time
930 @@ -3651,7 +3676,7 @@
932 CComPtr<ITypeInfo> spInfo(spTypeInfo);
933 CComPtr<ITypeInfo2> spTypeInfo2;
934 - if (SUCCEEDED(spTypeInfo->QueryInterface(&spTypeInfo2)))
935 + if (SUCCEEDED(spTypeInfo->QueryInterface(IID_ITypeInfo2, (void**)&spTypeInfo2)))
936 spInfo = spTypeInfo2;
938 m_pInfo = spInfo.Detach();
939 @@ -3760,6 +3785,9 @@
940 /////////////////////////////////////////////////////////////////////////////
944 +struct _ATL_EVENT_ENTRY;
947 ATLAPI AtlGetObjectSourceInterface(IUnknown* punkObj, GUID* plibid, IID* piid, unsigned short* pdwMajor, unsigned short* pdwMinor);
949 @@ -3909,16 +3937,17 @@
952 #pragma warning(disable:4740) // flow in/out of inline disables global opts
953 -inline void __declspec(naked) __stdcall CComStdCallThunkHelper()
954 +inline void __stdcall CComStdCallThunkHelper()
958 - mov eax, [esp+4]; // get pThunk
959 - mov edx, [eax+4]; // get the pThunk->pThis
960 - mov [esp+4], edx; // replace pThunk with pThis
961 - mov eax, [eax+8]; // get pThunk->pfn
962 - jmp eax; // jump pfn
965 + " movl $8(%ebp), %eax\n" // get pThunk
966 + " movl $4(%eax), edx\n" // get the pThunk->pThis
967 + " movl %edx, $8(%ebp)\n" // replace pThunk with pThis
968 + " movl $8(%eax), %eax\n" // get pThunk->pfn
969 + " movl %ebp, %esp\n"
971 + " jmp %eax" // jump pfn
974 #pragma warning(default:4740)
976 @@ -3985,6 +4014,7 @@
977 class ATL_NO_VTABLE IDispEventSimpleImpl : public _IDispEventLocator<nID, pdiid>
980 + using _IDispEventLocator<nID, pdiid>::m_dwEventCookie;
981 STDMETHOD(_LocDEQueryInterface)(REFIID riid, void ** ppvObject)
983 _ATL_VALIDATE_OUT_POINTER(ppvObject);
984 @@ -3992,7 +4022,7 @@
985 if (InlineIsEqualGUID(riid, *pdiid) ||
986 InlineIsEqualUnknown(riid) ||
987 InlineIsEqualGUID(riid, IID_IDispatch) ||
988 - InlineIsEqualGUID(riid, m_iid))
989 + InlineIsEqualGUID(riid, this->m_iid))
993 @@ -4186,6 +4216,10 @@
996 typedef tihclass _tihclass;
997 + using IDispEventSimpleImpl<nID, T, pdiid>::m_libid;
998 + using IDispEventSimpleImpl<nID, T, pdiid>::m_iid;
999 + using IDispEventSimpleImpl<nID, T, pdiid>::m_wMajorVerNum;
1000 + using IDispEventSimpleImpl<nID, T, pdiid>::m_wMinorVerNum;
1004 @@ -4475,6 +4509,11 @@
1008 +template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
1009 +class ATL_NO_VTABLE CComEnum;
1010 +template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel = CComObjectThreadModel>
1011 +class ATL_NO_VTABLE CComEnumOnSTL;
1014 /////////////////////////////////////////////////////////////////////////////
1016 @@ -4746,7 +4785,7 @@
1020 -template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
1021 +template <class Base, const IID* piid, class T, class Copy, class ThreadModel>
1022 class ATL_NO_VTABLE CComEnum :
1023 public CComEnumImpl<Base, piid, T, Copy>,
1024 public CComObjectRootEx< ThreadModel >
1025 @@ -4868,7 +4907,7 @@
1029 -template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel = CComObjectThreadModel>
1030 +template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel>
1031 class ATL_NO_VTABLE CComEnumOnSTL :
1032 public IEnumOnSTLImpl<Base, piid, T, Copy, CollType>,
1033 public CComObjectRootEx< ThreadModel >
1034 @@ -4901,7 +4940,7 @@
1035 return E_INVALIDARG;
1036 HRESULT hr = E_FAIL;
1038 - CollType::iterator iter = m_coll.begin();
1039 + typename CollType::iterator iter = m_coll.begin();
1040 while (iter != m_coll.end() && Index > 0)
1043 @@ -5314,7 +5353,7 @@
1044 if (InlineIsEqualGUID(riid, IID_IConnectionPoint) || InlineIsEqualUnknown(riid))
1049 #ifdef _ATL_DEBUG_INTERFACES
1050 _Module.AddThunk((IUnknown**)ppvObject, _T("IConnectionPointImpl"), riid);
1051 #endif // _ATL_DEBUG_INTERFACES
1052 --- include/atl/atlconv.h.orig 2005-04-14 17:54:32.000000000 +0900
1053 +++ include/atl/atlconv.h 2007-12-31 07:29:34.759750000 +0900
1056 #ifndef __ATLCONV_H__
1057 #define __ATLCONV_H__
1059 +#pragma GCC system_header
1063 #error ATL requires C++ compilation (use a .cpp suffix)
1065 // Following code is to avoid alloca causing a stack overflow.
1066 // It is intended for use from the _ATL_SAFE_ALLOCA macros
1067 // or Conversion macros.
1068 -__declspec(selectany) DWORD _Atlosplatform = 0;
1069 +#ifdef _INIT_ATL_COMMON_VARS
1070 +DWORD _Atlosplatform = 0;
1072 +extern DWORD _Atlosplatform;
1074 inline BOOL _AtlGetVersionEx()
1077 @@ -156,8 +163,11 @@
1078 #pragma prefast(suppress:515, "Atlresetstkoflw is the same as resetstkoflw")
1080 // Verifies if sufficient space is available on the stack.
1081 -inline bool _AtlVerifyStackAvailable(SIZE_T Size)
1082 +inline bool _AtlVerifyStackAvailable(SIZE_T /*Size*/)
1087 bool bStackAvailable = true;
1093 return bStackAvailable;
1097 #pragma prefast(pop)
1098 @@ -281,15 +292,15 @@
1100 #ifdef _CONVERSION_USES_THREAD_LOCALE
1102 - #define USES_CONVERSION int _convert; _convert; UINT _acp = GetACP(); _acp; LPCWSTR _lpw; _lpw; LPCSTR _lpa; _lpa
1103 + #define USES_CONVERSION int _convert; (void)_convert; UINT _acp = GetACP(); (void)_acp; LPCWSTR _lpw; (void)_lpw; LPCSTR _lpa; (void)_lpa
1105 - #define USES_CONVERSION int _convert = 0; _convert; UINT _acp = GetACP(); _acp; LPCWSTR _lpw = NULL; _lpw; LPCSTR _lpa = NULL; _lpa
1106 + #define USES_CONVERSION int _convert = 0; (void)_convert; UINT _acp = GetACP(); (void)_acp; LPCWSTR _lpw = NULL; (void)_lpw; LPCSTR _lpa = NULL; (void)_lpa
1110 - #define USES_CONVERSION int _convert; _convert; UINT _acp = CP_ACP; _acp; LPCWSTR _lpw; _lpw; LPCSTR _lpa; _lpa
1111 + #define USES_CONVERSION int _convert; (void)_convert; UINT _acp = CP_ACP; (void)_acp; LPCWSTR _lpw; (void)_lpw; LPCSTR _lpa; (void)_lpa
1113 - #define USES_CONVERSION int _convert = 0; _convert; UINT _acp = CP_ACP; _acp; LPCWSTR _lpw = NULL; _lpw; LPCSTR _lpa = NULL; _lpa
1114 + #define USES_CONVERSION int _convert = 0; (void)_convert; UINT _acp = CP_ACP; (void)_acp; LPCWSTR _lpw = NULL; (void)_lpw; LPCSTR _lpa = NULL; (void)_lpa
1118 --- include/atl/atlctl.h.orig 2005-04-14 17:54:32.000000000 +0900
1119 +++ include/atl/atlctl.h 2009-04-19 13:31:15.146000000 +0900
1122 #ifndef __ATLCTL_H__
1123 #define __ATLCTL_H__
1125 +#pragma GCC system_header
1129 #error ATL requires C++ compilation (use a .cpp suffix)
1134 -#pragma pack(push, _ATL_PACKING)
1135 +#pragma pack(push, 8)
1137 // Forward declarations
1140 CComControlBase(HWND& h) : m_hWndCD(h)
1142 memset(this, 0, sizeof(CComControlBase));
1144 + // previous element of m_hWndCD in this class is m_rcPos
1145 + *reinterpret_cast<HWND **>(reinterpret_cast<DWORD>(reinterpret_cast<char *>(&m_rcPos)+sizeof(m_rcPos)+(__alignof__(m_hWndCD)-1))&(-(__alignof__(m_hWndCD))))=&h;
1147 m_sizeExtent.cx = 2*2540;
1148 m_sizeExtent.cy = 2*2540;
1149 m_sizeNatural = m_sizeExtent;
1150 @@ -530,13 +535,13 @@
1151 SIZE m_sizeNatural; //unscaled size in himetric
1152 SIZE m_sizeExtent; //current extents in himetric
1153 RECT m_rcPos; // position in pixels
1154 -#pragma warning(disable: 4510 4610) // unnamed union
1157 +//#pragma warning(disable: 4510 4610) // unnamed union
1163 -#pragma warning(default: 4510 4610)
1164 +// HWND* m_phWndCD;
1166 +//#pragma warning(default: 4510 4610)
1169 // m_nFreezeEvents is the only one actually used
1170 @@ -1362,7 +1367,7 @@
1171 class ATL_NO_VTABLE CComControl : public CComControlBase, public WinBase
1174 - CComControl() : CComControlBase(m_hWnd) {}
1175 + CComControl() : CComControlBase(this->m_hWnd) {}
1176 HRESULT FireOnRequestEdit(DISPID dispID)
1178 T* pT = static_cast<T*>(this);
1179 @@ -1401,6 +1406,8 @@
1180 class CComCompositeControl : public CComControl< T, CAxDialogImpl< T > >
1183 + using CComControl< T, CAxDialogImpl< T > >::m_hWnd;
1184 + using CComControl< T, CAxDialogImpl< T > >::GetNextDlgTabItem;
1185 CComCompositeControl()
1187 m_hbrBackground = NULL;
1188 @@ -1429,7 +1436,7 @@
1189 m_hbrBackground = NULL;
1192 - HRESULT hr = GetAmbientBackColor(clr);
1193 + HRESULT hr = this->GetAmbientBackColor(clr);
1197 @@ -1443,7 +1450,7 @@
1199 CAxWindow wnd(hwnd);
1200 CComPtr<IAxWinAmbientDispatch> spDispatch;
1201 - wnd.QueryHost(&spDispatch);
1202 + wnd.QueryHost(IID_IAxWinAmbientDispatch, (void**)&spDispatch);
1203 if (spDispatch != NULL)
1204 spDispatch->put_BackColor((OLE_COLOR)l);
1206 @@ -1458,10 +1465,10 @@
1208 HWND Create(HWND hWndParent, RECT& /*rcPos*/, LPARAM dwInitParam = NULL)
1210 - CComControl< T, CAxDialogImpl< T > >::Create(hWndParent, dwInitParam);
1211 + this->Create(hWndParent, dwInitParam);
1212 SetBackgroundColorFromAmbient();
1214 - ShowWindow(SW_SHOWNOACTIVATE);
1215 + this->ShowWindow(SW_SHOWNOACTIVATE);
1218 BOOL CalcExtent(SIZE& size)
1219 @@ -1488,7 +1495,7 @@
1221 // find a direct child of the dialog from the window that has focus
1222 HWND hWndCtl = ::GetFocus();
1223 - if (IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd)
1224 + if (this->IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd)
1228 @@ -1546,7 +1553,7 @@
1232 - return IsDialogMessage(pMsg);
1233 + return this->IsDialogMessage(pMsg);
1235 HRESULT IOleInPlaceObject_InPlaceDeactivate(void)
1237 @@ -1563,7 +1570,7 @@
1239 virtual HRESULT OnDraw(ATL_DRAWINFO& di)
1241 - if(!m_bInPlaceActive)
1242 + if(!this->m_bInPlaceActive)
1244 HPEN hPen = (HPEN)::GetStockObject(BLACK_PEN);
1245 HBRUSH hBrush = (HBRUSH)::GetStockObject(GRAY_BRUSH);
1246 @@ -1626,7 +1633,7 @@
1248 STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
1252 ATLTRACE2(atlTraceControls,2,_T("IOleControlImpl::OnAmbientPropertyChange\n"));
1253 ATLTRACE2(atlTraceControls,2,_T(" -- DISPID = %d (%d)\n"), dispid);
1255 @@ -2905,7 +2912,7 @@
1256 ATLTRACE2(atlTraceControls,2,_T("~CBindStatusCallback\n"));
1259 - STDMETHOD(OnStartBinding)(DWORD dwReserved, IBinding *pBinding)
1260 + STDMETHOD(OnStartBinding)(DWORD /*dwReserved*/, IBinding *pBinding)
1262 ATLTRACE2(atlTraceControls,2,_T("CBindStatusCallback::OnStartBinding\n"));
1263 m_spBinding = pBinding;
1264 @@ -2923,19 +2930,19 @@
1268 - STDMETHOD(OnLowResource)(DWORD reserved)
1269 + STDMETHOD(OnLowResource)(DWORD /*reserved*/)
1271 ATLTRACE2(atlTraceControls,2,_T("CBindStatusCallback::OnLowResource"));
1275 - STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
1276 + STDMETHOD(OnProgress)(ULONG /*ulProgress*/, ULONG /*ulProgressMax*/, ULONG /*ulStatusCode*/, LPCWSTR /*szStatusText*/)
1278 ATLTRACE2(atlTraceControls,2,_T("CBindStatusCallback::OnProgress"));
1282 - STDMETHOD(OnStopBinding)(HRESULT hresult, LPCWSTR szError)
1283 + STDMETHOD(OnStopBinding)(HRESULT /*hresult*/, LPCWSTR /*szError*/)
1285 ATLTRACE2(atlTraceControls,2,_T("CBindStatusCallback::OnStopBinding\n"));
1286 (m_pT->*m_pFunc)(this, NULL, 0);
1287 @@ -2962,7 +2969,7 @@
1291 - STDMETHOD(OnDataAvailable)(DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
1292 + STDMETHOD(OnDataAvailable)(DWORD grfBSCF, DWORD dwSize, FORMATETC */*pformatetc*/, STGMEDIUM *pstgmed)
1294 ATLTRACE2(atlTraceControls,2,_T("CBindStatusCallback::OnDataAvailable\n"));
1296 @@ -3005,7 +3012,7 @@
1300 - STDMETHOD(OnObjectAvailable)(REFIID riid, IUnknown *punk)
1301 + STDMETHOD(OnObjectAvailable)(REFIID /*riid*/, IUnknown */*punk*/)
1303 ATLTRACE2(atlTraceControls,2,_T("CBindStatusCallback::OnObjectAvailable"));
1305 --- include/atl/atlwin.h.orig 2005-04-14 17:54:32.000000000 +0900
1306 +++ include/atl/atlwin.h 2007-12-31 07:29:28.525375000 +0900
1309 #ifndef __ATLWIN_H__
1310 #define __ATLWIN_H__
1312 +#pragma GCC system_header
1316 #error ATL requires C++ compilation (use a .cpp suffix)
1319 #define CWndClassInfo CWndClassInfoA
1321 +template <DWORD t_dwStyle = 0, DWORD t_dwExStyle = 0> class CWinTraits;
1322 +typedef CWinTraits<WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> CControlWinTraits;
1323 template <class T, class TBase = CWindow, class TWinTraits = CControlWinTraits> class CWindowImpl;
1324 template <class T, class TBase = CWindow> class CDialogImpl;
1325 #ifndef _ATL_NO_HOSTING
1326 @@ -658,6 +663,13 @@
1327 ATLASSERT(::IsWindow(m_hWnd));
1328 return ::GetDlgItemText(m_hWnd, nID, lpStr, nMaxCount);
1331 + HWND GetDlgItem(int nID) const
1333 + ATLASSERT(::IsWindow(m_hWnd));
1334 + return ::GetDlgItem(m_hWnd, nID);
1337 BOOL GetDlgItemText(int nID, BSTR& bstrText) const
1339 ATLASSERT(::IsWindow(m_hWnd));
1340 @@ -847,12 +859,6 @@
1341 return (int)::SetWindowLong(m_hWnd, GWL_ID, nID);
1344 - HWND GetDlgItem(int nID) const
1346 - ATLASSERT(::IsWindow(m_hWnd));
1347 - return ::GetDlgItem(m_hWnd, nID);
1352 BOOL FlashWindow(BOOL bInvert)
1353 @@ -1319,7 +1325,9 @@
1357 -_declspec(selectany) RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 };
1358 +#ifdef _INIT_ATL_COMMON_VARS
1359 +RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 };
1362 /////////////////////////////////////////////////////////////////////////////
1363 // CAxWindow - client side for an ActiveX host window
1364 @@ -1330,6 +1338,7 @@
1365 class CAxWindowT : public TBase
1368 + using TBase::m_hWnd;
1370 CAxWindowT(HWND hWnd = NULL) : TBase(hWnd)
1372 @@ -1439,11 +1448,13 @@
1373 hr = spUnk->QueryInterface(iid, ppUnk);
1378 HRESULT QueryHost(Q** ppUnk)
1380 return QueryHost(__uuidof(Q), (void**)ppUnk);
1383 HRESULT QueryControl(REFIID iid, void** ppUnk)
1385 ATLASSERT(ppUnk != NULL);
1386 @@ -1459,11 +1470,13 @@
1387 hr = spUnk->QueryInterface(iid, ppUnk);
1392 HRESULT QueryControl(Q** ppUnk)
1394 return QueryControl(__uuidof(Q), (void**)ppUnk);
1397 HRESULT SetExternalDispatch(IDispatch* pDisp)
1400 @@ -1521,12 +1534,12 @@
1401 BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \
1403 BOOL bHandled = TRUE; \
1416 switch(dwMsgMapID) \
1419 @@ -1750,7 +1763,7 @@
1421 // search for an empty one
1423 - for(i = 0; i < m_aChainEntry.GetSize(); i++)
1424 + for(int i = 0; i < m_aChainEntry.GetSize(); i++)
1426 if(m_aChainEntry[i] == NULL)
1428 @@ -1841,7 +1854,7 @@
1429 /////////////////////////////////////////////////////////////////////////////
1430 // CWinTraits - Defines various default values for a window
1432 -template <DWORD t_dwStyle = 0, DWORD t_dwExStyle = 0>
1433 +template <DWORD t_dwStyle, DWORD t_dwExStyle>
1437 @@ -1855,7 +1868,7 @@
1441 -typedef CWinTraits<WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> CControlWinTraits;
1442 +//typedef CWinTraits<WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> CControlWinTraits;
1443 typedef CWinTraits<WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE> CFrameWinTraits;
1444 typedef CWinTraits<WS_OVERLAPPEDWINDOW | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_MDICHILD> CMDIChildWinTraits;
1446 @@ -1882,6 +1895,7 @@
1447 class ATL_NO_VTABLE CWindowImplRoot : public TBase, public CMessageMap
1450 + using TBase::GetDlgItem;
1451 CWndProcThunk m_thunk;
1452 const MSG* m_pCurrentMsg;
1454 @@ -1892,7 +1906,7 @@
1458 - if(m_hWnd != NULL) // should be cleared in WindowProc
1459 + if(this->m_hWnd != NULL) // should be cleared in WindowProc
1461 ATLTRACE2(atlTraceWindowing, 0, _T("ERROR - Object deleted before window was destroyed\n"));
1463 @@ -2017,6 +2031,8 @@
1464 class ATL_NO_VTABLE CWindowImplBaseT : public CWindowImplRoot< TBase >
1467 + using CWindowImplRoot< TBase >::m_hWnd;
1468 + using CWindowImplRoot< TBase >::m_thunk;
1469 WNDPROC m_pfnSuperWindowProc;
1471 CWindowImplBaseT() : m_pfnSuperWindowProc(::DefWindowProc)
1472 @@ -2049,7 +2065,7 @@
1474 LRESULT DefWindowProc()
1476 - const MSG* pMsg = m_pCurrentMsg;
1477 + const MSG* pMsg = this->m_pCurrentMsg;
1480 lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
1481 @@ -2091,7 +2107,7 @@
1482 if(pOldProc != StartWindowProc)
1483 ATLTRACE2(atlTraceWindowing, 0, _T("Subclassing through a hook discarded.\n"));
1485 - pOldProc; // avoid unused warning
1486 + (void)pOldProc; // avoid unused warning
1488 return pProc(hWnd, uMsg, wParam, lParam);
1490 @@ -2219,6 +2235,7 @@
1491 class ATL_NO_VTABLE CWindowImpl : public CWindowImplBaseT< TBase, TWinTraits >
1494 + using CWindowImplBaseT< TBase, TWinTraits >::StartWindowProc;
1495 DECLARE_WND_CLASS(NULL)
1497 HWND Create(HWND hWndParent, RECT& rcPos, LPCTSTR szWindowName = NULL,
1498 @@ -2226,8 +2243,8 @@
1499 UINT nID = 0, LPVOID lpCreateParam = NULL)
1501 if (T::GetWndClassInfo().m_lpszOrigName == NULL)
1502 - T::GetWndClassInfo().m_lpszOrigName = GetWndClassName();
1503 - ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc);
1504 + T::GetWndClassInfo().m_lpszOrigName = this->GetWndClassName();
1505 + ATOM atom = T::GetWndClassInfo().Register(&(this->m_pfnSuperWindowProc));
1507 dwStyle = T::GetWndStyle(dwStyle);
1508 dwExStyle = T::GetWndExStyle(dwExStyle);
1509 @@ -2244,6 +2261,7 @@
1510 class ATL_NO_VTABLE CDialogImplBaseT : public CWindowImplRoot< TBase >
1513 + using CWindowImplRoot< TBase >::m_hWnd;
1514 virtual DLGPROC GetDialogProc()
1517 @@ -2344,6 +2362,9 @@
1518 class ATL_NO_VTABLE CDialogImpl : public CDialogImplBaseT< TBase >
1521 + using CDialogImplBaseT< TBase >::m_hWnd;
1522 + using CDialogImplBaseT< TBase >::m_thunk;
1523 + typedef CDialogImplBaseT< TBase > CDialogImplBase_Class;
1526 CDialogImpl() : m_bModal(false) { }
1527 @@ -2422,6 +2443,8 @@
1528 class ATL_NO_VTABLE CAxDialogImpl : public CDialogImplBaseT< TBase >
1531 + using CDialogImplBaseT< TBase >::m_hWnd;
1532 + using CDialogImplBaseT< TBase >::m_thunk;
1535 CAxDialogImpl() : m_bModal(false) { }
1536 @@ -2515,6 +2538,8 @@
1537 class CContainedWindowT : public TBase
1540 + using TBase::m_hWnd;
1541 + using TBase::GetWndClassName;
1542 CWndProcThunk m_thunk;
1543 LPCTSTR m_lpszClassName;
1544 WNDPROC m_pfnSuperWindowProc;
1545 @@ -2536,7 +2561,7 @@
1548 CContainedWindowT(CMessageMap* pObject, DWORD dwMsgMapID = 0)
1549 - : m_lpszClassName(TBase::GetWndClassName()),
1550 + : m_lpszClassName(GetWndClassName()),
1551 m_pfnSuperWindowProc(::DefWindowProc),
1552 m_pObject(pObject), m_dwMsgMapID(dwMsgMapID),
1554 @@ -2666,7 +2691,7 @@
1555 LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0,
1556 UINT nID = 0, LPVOID lpCreateParam = NULL)
1558 - m_lpszClassName = TBase::GetWndClassName();
1559 + m_lpszClassName = GetWndClassName();
1560 m_pfnSuperWindowProc = ::DefWindowProc;
1561 m_pObject = pObject;
1562 m_dwMsgMapID = dwMsgMapID;
1563 @@ -2959,8 +2984,11 @@
1566 ::EnterCriticalSection(&pM->m_csWindowCreate);
1568 + jmp_buf _sejmpbuf;
1569 + __SEHandler _sehandler;
1570 + if (__builtin_setjmp(_sejmpbuf) == 0)
1572 + _sehandler.Set(_sejmpbuf, &pM->m_csWindowCreate, EXCEPTION_CONTINUE_SEARCH, NULL, atlfinalleavecriticalsection);
1575 HINSTANCE hInst = pM->m_hInst;
1576 @@ -2979,7 +3007,7 @@
1577 if(!::GetClassInfoExA(_Module.GetModuleInstance(), p->m_lpszOrigName, &wc))
1581 + __builtin_longjmp(_sejmpbuf, 1);
1584 memcpy(&p->m_wc, &wc, sizeof(WNDCLASSEX));
1585 @@ -3011,10 +3039,7 @@
1586 p->m_atom = ::RegisterClassExA(&p->m_wc);
1591 - ::LeaveCriticalSection(&pM->m_csWindowCreate);
1593 + _sehandler.Reset();
1597 @@ -3038,8 +3063,11 @@
1600 ::EnterCriticalSection(&pM->m_csWindowCreate);
1602 + jmp_buf _sejmpbuf;
1603 + __SEHandler _sehandler;
1604 + if (__builtin_setjmp(_sejmpbuf) == 0)
1606 + _sehandler.Set(_sejmpbuf, &pM->m_csWindowCreate, EXCEPTION_CONTINUE_SEARCH, NULL, atlfinalleavecriticalsection);
1609 HINSTANCE hInst = pM->m_hInst;
1610 @@ -3058,7 +3086,7 @@
1611 if(!::GetClassInfoExW(_Module.GetModuleInstance(), p->m_lpszOrigName, &wc))
1615 + __builtin_longjmp(_sejmpbuf, -1);
1618 memcpy(&p->m_wc, &wc, sizeof(WNDCLASSEX));
1619 @@ -3090,10 +3118,7 @@
1620 p->m_atom = ::RegisterClassExW(&p->m_wc);
1625 - ::LeaveCriticalSection(&pM->m_csWindowCreate);
1627 + _sehandler.Reset();
1631 --- include/atl/statreg.h.orig 2005-04-14 17:54:34.000000000 +0900
1632 +++ include/atl/statreg.h 2006-09-18 20:05:01.468750000 +0900
1633 @@ -573,15 +573,16 @@
1637 -__declspec(selectany) LPCTSTR CRegParser::rgszNeverDelete[] = //Component Catagories
1638 +#ifdef _INIT_ATL_COMMON_VARS
1639 +LPCTSTR CRegParser::rgszNeverDelete[] = //Component Catagories
1641 _T("CLSID"), _T("TYPELIB")
1644 -__declspec(selectany) const int CRegParser::cbNeverDelete = sizeof(rgszNeverDelete) / sizeof(LPCTSTR*);
1645 -__declspec(selectany) const int CRegParser::MAX_VALUE=4096;
1646 -__declspec(selectany) const int CRegParser::MAX_TYPE=MAX_VALUE;
1648 +const int CRegParser::cbNeverDelete = sizeof(rgszNeverDelete) / sizeof(LPCTSTR*);
1649 +const int CRegParser::MAX_VALUE=4096;
1650 +const int CRegParser::MAX_TYPE=MAX_VALUE;
1653 inline BOOL CRegParser::VTFromRegType(LPCTSTR szValueType, VARTYPE& vt)