summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-03-26 12:40:24 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-03-26 12:40:24 +0000
commit0cafcc23329131b90de57c5e9dcf4676a19a6583 (patch)
treecd5d7d3086e202b9afaaf70ae1171203dc18bbb5 /external
parent932302160ea952392f6c810814511c945014d428 (diff)
INTEGRATION: CWS mingwport03 (1.1.4); FILE ADDED
2006/11/16 16:02:28 vg 1.1.4.1: #i53572# MinGW port
Diffstat (limited to 'external')
-rw-r--r--external/mingwheaders/mingw_headers.patch3080
1 files changed, 3080 insertions, 0 deletions
diff --git a/external/mingwheaders/mingw_headers.patch b/external/mingwheaders/mingw_headers.patch
new file mode 100644
index 000000000000..9a8bdc9c69f8
--- /dev/null
+++ b/external/mingwheaders/mingw_headers.patch
@@ -0,0 +1,3080 @@
+--- include/crtdbg.h.orig 2006-09-18 01:21:38.968750000 +0900
++++ include/crtdbg.h 2006-09-02 23:12:50.109375000 +0900
+@@ -0,0 +1,11 @@
++#ifndef _CRTDBG_H
++#define _CRTDBG_H
++#if __GNUC__ >=3
++#pragma GCC system_header
++#endif
++
++#ifndef _ASSERTE
++#define _ASSERTE(expr) ((void)0)
++#endif
++
++#endif
+--- include/winres.h.orig 2006-07-22 23:41:18.000000000 +0900
++++ include/winres.h 2006-07-22 23:41:18.000000000 +0900
+@@ -0,0 +1,13 @@
++#ifndef _WINRES_H
++#define _WINRES_H
++#if __GNUC__ >=3
++#pragma GCC system_header
++#endif
++
++#define VS_VERSION_INFO 1
++#include <winresrc.h>
++#ifdef IDC_STATIC
++#undef IDC_STATIC
++#endif
++#define IDC_STATIC (-1)
++#endif
+--- include/excpt.h.orig 2005-01-14 05:19:52.000000000 +0900
++++ include/excpt.h 2006-09-17 10:13:37.796875000 +0900
+@@ -16,8 +16,11 @@
+
+ /* All the headers include this file. */
+ #include <_mingw.h>
++#include <setjmp.h>
++#include <stdarg.h>
+
+ #include <windef.h>
++#include <winbase.h>
+
+ /*
+ * NOTE: The constants structs and typedefs below should be defined in the
+@@ -52,7 +55,7 @@
+ * The type of function that is expected as an exception handler to be
+ * installed with _try1.
+ */
+-typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)
++typedef EXCEPTION_DISPOSITION (* PEXCEPTION_HANDLER)
+ (struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
+
+ /*
+@@ -93,10 +96,125 @@
+ __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
+ : : : "%eax");
+
++WINBASEAPI
++VOID
++WINAPI
++RtlUnwind (
++ IN PVOID TargetFrame OPTIONAL,
++ IN PVOID TargetIp OPTIONAL,
++ IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
++ IN PVOID ReturnValue
++ );
+ #ifdef __cplusplus
+ }
++
++class __SEHandler
++{
++ public:
++ __SEHandler() {}
++ ~__SEHandler() {}
++ typedef int (*PF)(void *, LPEXCEPTION_POINTERS);
++ typedef void (*PH)(void *, LPEXCEPTION_POINTERS);
++ typedef void (*PN)(void *);
++ void Set(jmp_buf jb, void *pdata=NULL, PF pfilter=NULL, PH phandlerbody=NULL, PN pfinal=NULL)
++ {
++ __builtin_memcpy(m_jmpbuf, jb, sizeof(jmp_buf));
++ m_pData=pdata;
++ switch (reinterpret_cast<int>(pfilter))
++ {
++ default:
++ m_filter=pfilter;
++ break;
++ case EXCEPTION_CONTINUE_EXECUTION:
++ m_filter=DefaultFilterContinueExecution;
++ break;
++ case EXCEPTION_EXECUTE_HANDLER:
++ m_filter=DefaultFilterExecuteHandler;
++ break;
++ case EXCEPTION_CONTINUE_SEARCH:
++ m_filter=DefaultFilterContinueSearch;
++ break;
++ }
++ if (phandlerbody)
++ m_handlerbody=phandlerbody;
++ else
++ m_handlerbody=DefaultHandler;
++ if (pfinal)
++ m_final=pfinal;
++ else
++ m_final=DefaultFinal;
++ m_ER.pHandlerClass = this;
++ m_ER.hp = handler;
++ asm("movl %%fs:0, %%eax\n\t"
++ "movl %%eax, %0": : "m" (m_ER.prev): "%eax" );
++ asm("movl %0, %%eax\n\t"
++ "movl %%eax, %%fs:0": : "r" (&m_ER): "%eax" );
++ }
++ void Reset()
++ {
++ m_final(m_pData);
++ asm("movl %0, %%eax \n\t"
++ "movl %%eax, %%fs:0"
++ : : "m" (m_ER.prev): "%eax");
++ }
++ private:
++ __SEHandler(const __SEHandler&);
++ __SEHandler& operator=(const __SEHandler&);
++ struct _ER {
++ _ER* prev;
++ PEXCEPTION_HANDLER hp;
++ __SEHandler *pHandlerClass;
++ };
++ static EXCEPTION_DISPOSITION handler(
++ struct _EXCEPTION_RECORD *pExceptionRecord,
++ void * EstablisherFrame,
++ struct _CONTEXT *ContextRecord,
++ void * DispatcherContext)
++ {
++ __SEHandler* pThis = reinterpret_cast< _ER * >(EstablisherFrame)->pHandlerClass;
++ if ( pExceptionRecord->ExceptionFlags & EH_UNWINDING )
++ {
++ pThis->m_final(pThis->m_pData);
++ return ExceptionContinueSearch;
++ }
++ EXCEPTION_POINTERS ep={pExceptionRecord, ContextRecord};
++ switch ( pThis->m_filter(pThis->m_pData, &ep) )
++ {
++ case EXCEPTION_EXECUTE_HANDLER:
++ RtlUnwind(EstablisherFrame, &&__set_label, pExceptionRecord, 0);
++__set_label:
++ pThis->m_handlerbody(pThis->m_pData, &ep);
++ ContextRecord->Ebp = pThis->m_jmpbuf[0];
++ ContextRecord->Eip = pThis->m_jmpbuf[1];
++ ContextRecord->Esp = pThis->m_jmpbuf[2];
++ return ExceptionContinueExecution;
++ case EXCEPTION_CONTINUE_SEARCH:
++ return ExceptionContinueSearch;
++ case EXCEPTION_CONTINUE_EXECUTION:
++ return ExceptionContinueExecution;
++ }
++ }
++ static int DefaultFilterContinueSearch(void *, LPEXCEPTION_POINTERS) { return EXCEPTION_CONTINUE_SEARCH; }
++ static int DefaultFilterContinueExecution(void *, LPEXCEPTION_POINTERS) { return EXCEPTION_CONTINUE_EXECUTION; }
++ static int DefaultFilterExecuteHandler(void *, LPEXCEPTION_POINTERS) { return EXCEPTION_EXECUTE_HANDLER; }
++ static void DefaultHandler(void *, LPEXCEPTION_POINTERS) {}
++ static void DefaultFinal(void *) {}
++ typedef int (*handler_p)(
++ struct _EXCEPTION_RECORD *ExceptionRecord,
++ void * EstablisherFrame,
++ struct _CONTEXT *ContextRecord,
++ void * DispatcherContext);
++ _ER m_ER;
++ void *m_pData;
++ PN m_final;
++ PH m_handlerbody;
++ PF m_filter;
++ jmp_buf m_jmpbuf;
++};
+ #endif
+
+ #endif /* Not RC_INVOKED */
+
+ #endif /* _EXCPT_H_ not defined */
++
++
+--- include/tchar.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/tchar.h 2006-03-26 09:21:42.000000000 +0900
+@@ -221,6 +221,9 @@
+ #define _trewinddir _wrewinddir
+ #define _ttelldir _wtelldir
+ #define _tseekdir _wseekdir
++
++#define _ttempnam _wtempnam
++
+
+ #else /* Not _UNICODE */
+
+@@ -405,6 +408,8 @@
+ #define _ttelldir telldir
+ #define _tseekdir seekdir
+
++#define _ttempnam _tempnam
++
+ #endif /* Not _UNICODE */
+
+ /*
+--- include/basetyps.h.orig 2006-01-18 04:12:06.000000000 +0900
++++ include/basetyps.h 2006-09-17 12:12:05.812500000 +0900
+@@ -117,7 +117,10 @@
+ #define UUID_DEFINED
+ typedef GUID UUID;
+ #endif /* UUID_DEFINED */
++#ifndef __IID_DEFINED__
++#define __IID_DEFINED__
+ typedef GUID IID;
++#endif
+ typedef GUID CLSID;
+ typedef CLSID *LPCLSID;
+ typedef IID *LPIID;
+--- include/objfwd.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/objfwd.h 2006-03-26 09:21:42.000000000 +0900
+@@ -27,7 +27,7 @@
+ typedef interface IEnumFORMATETC *LPENUMFORMATETC;
+ typedef interface IEnumSTATDATA *LPENUMSTATDATA;
+ typedef interface IEnumSTATSTG *LPENUMSTATSTG;
+-typedef interface IEnumSTATPROPSTG LPENUMSTATPROPSTG;
++typedef interface IEnumSTATPROPSTG *LPENUMSTATPROPSTG;
+ typedef interface IEnumString *LPENUMSTRING;
+ typedef interface IEnumUnknown *LPENUMUNKNOWN;
+ typedef interface IStorage *LPSTORAGE;
+--- include/rpcndr.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/rpcndr.h 2006-03-26 09:21:42.000000000 +0900
+@@ -48,6 +48,7 @@
+ #endif
+ #define small char
+ typedef unsigned char byte;
++typedef unsigned char boolean;
+ #define NDRSContextValue(hContext) (&(hContext)->userContext)
+ #define cbNDRContext 20
+ #define byte_from_ndr(source, target) { *(target) = *(*(char**)&(source)->Buffer)++; }
+--- include/wininet.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/wininet.h 2006-04-04 23:18:14.000000000 +0900
+@@ -868,6 +868,7 @@
+ BOOL WINAPI InternetAutodial(DWORD,DWORD);
+ BOOL WINAPI InternetAutodialHangup(DWORD);
+ BOOL WINAPI InternetGetConnectedState(LPDWORD,DWORD);
++BOOL WINAPI InternetGetConnectedStateEx(LPDWORD,LPTSTR,DWORD,DWORD);
+ BOOL WINAPI InternetSetDialState(LPCTSTR,DWORD,DWORD);
+ BOOL WINAPI InternetReadFileExA(HINTERNET,LPINTERNET_BUFFERSA,DWORD,DWORD_PTR);
+ BOOL WINAPI InternetReadFileExW(HINTERNET,LPINTERNET_BUFFERSW,DWORD,DWORD_PTR);
+--- include/winbase.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/winbase.h 2006-04-04 23:18:14.000000000 +0900
+@@ -980,12 +980,14 @@
+ WORD Reserved2;
+ CHAR szPathName[OFS_MAXPATHNAME];
+ } OFSTRUCT,*LPOFSTRUCT,*POFSTRUCT;
++#if 0
+ typedef struct _WIN_CERTIFICATE {
+ DWORD dwLength;
+ WORD wRevision;
+ WORD wCertificateType;
+ BYTE bCertificate[1];
+ } WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
++#endif
+ #if (_WIN32_WINNT >= 0x0501)
+ typedef struct tagACTCTXA {
+ ULONG cbSize;
+@@ -1303,8 +1305,8 @@
+ WINBASEAPI HANDLE WINAPI FindFirstFileExW(LPCWSTR,FINDEX_INFO_LEVELS,PVOID,FINDEX_SEARCH_OPS,PVOID,DWORD);
+ WINBASEAPI BOOL WINAPI FindFirstFreeAce(PACL,PVOID*);
+ #if (_WIN32_WINNT >= 0x0500)
+-WINBASEAPI HANDLE WINAPI FindFirstVolumeA(LPCSTR,DWORD);
+-WINBASEAPI HANDLE WINAPI FindFirstVolumeW(LPCWSTR,DWORD);
++WINBASEAPI HANDLE WINAPI FindFirstVolumeA(LPSTR,DWORD);
++WINBASEAPI HANDLE WINAPI FindFirstVolumeW(LPWSTR,DWORD);
+ WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointA(LPSTR,LPSTR,DWORD);
+ WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointW(LPWSTR,LPWSTR,DWORD);
+ #endif
+@@ -1312,7 +1314,7 @@
+ WINBASEAPI BOOL WINAPI FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
+ WINBASEAPI BOOL WINAPI FindNextFileW(HANDLE,LPWIN32_FIND_DATAW);
+ #if (_WIN32_WINNT >= 0x0500)
+-WINBASEAPI BOOL WINAPI FindNextVolumeA(HANDLE,LPCSTR,DWORD);
++WINBASEAPI BOOL WINAPI FindNextVolumeA(HANDLE,LPSTR,DWORD);
+ WINBASEAPI BOOL WINAPI FindNextVolumeW(HANDLE,LPWSTR,DWORD);
+ WINBASEAPI BOOL WINAPI FindNextVolumeMountPointA(HANDLE,LPSTR,DWORD);
+ WINBASEAPI BOOL WINAPI FindNextVolumeMountPointW(HANDLE,LPWSTR,DWORD);
+--- include/winnt.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/winnt.h 2006-03-26 09:21:42.000000000 +0900
+@@ -2567,6 +2567,7 @@
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_OPTIONAL_HEADER OptionalHeader;
+ } IMAGE_NT_HEADERS,*PIMAGE_NT_HEADERS;
++#define PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
+ typedef struct _IMAGE_ROM_HEADERS {
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
+--- include/winver.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/winver.h 2006-03-26 09:21:42.000000000 +0900
+@@ -101,10 +101,10 @@
+ DWORD WINAPI VerFindFileW(DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT,LPWSTR,PUINT);
+ DWORD WINAPI VerInstallFileA(DWORD,LPSTR,LPSTR,LPSTR,LPSTR,LPSTR,LPSTR,PUINT);
+ DWORD WINAPI VerInstallFileW(DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT);
+-DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR,PDWORD);
+-DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR,PDWORD);
+-BOOL WINAPI GetFileVersionInfoA(LPCSTR,DWORD,DWORD,PVOID);
+-BOOL WINAPI GetFileVersionInfoW(LPCWSTR,DWORD,DWORD,PVOID);
++DWORD WINAPI GetFileVersionInfoSizeA(LPSTR,PDWORD);
++DWORD WINAPI GetFileVersionInfoSizeW(LPWSTR,PDWORD);
++BOOL WINAPI GetFileVersionInfoA(LPSTR,DWORD,DWORD,PVOID);
++BOOL WINAPI GetFileVersionInfoW(LPWSTR,DWORD,DWORD,PVOID);
+ DWORD WINAPI VerLanguageNameA(DWORD,LPSTR,DWORD);
+ DWORD WINAPI VerLanguageNameW(DWORD,LPWSTR,DWORD);
+ BOOL WINAPI VerQueryValueA(const LPVOID,LPSTR,LPVOID*,PUINT);
+--- include/wtypes.h.orig 2006-01-18 04:12:12.000000000 +0900
++++ include/wtypes.h 2006-04-08 22:05:48.000000000 +0900
+@@ -72,6 +72,29 @@
+ unsigned short asData[1];
+ }FLAGGED_WORD_BLOB;
+
++typedef struct _COAUTHIDENTITY
++ {
++ /* [size_is] */ USHORT *User;
++ /* [range] */ ULONG UserLength;
++ /* [size_is] */ USHORT *Domain;
++ /* [range] */ ULONG DomainLength;
++ /* [size_is] */ USHORT *Password;
++ /* [range] */ ULONG PasswordLength;
++ ULONG Flags;
++ } COAUTHIDENTITY;
++
++typedef struct _COAUTHINFO
++ {
++ DWORD dwAuthnSvc;
++ DWORD dwAuthzSvc;
++ LPWSTR pwszServerPrincName;
++ DWORD dwAuthnLevel;
++ DWORD dwImpersonationLevel;
++ COAUTHIDENTITY *pAuthIdentityData;
++ DWORD dwCapabilities;
++ } COAUTHINFO;
++typedef WORD CLIPFORMAT,*LPCLIPFORMAT;
++
+ #ifndef OLE2ANSI
+ typedef WCHAR OLECHAR;
+ typedef LPWSTR LPOLESTR;
+@@ -100,6 +123,7 @@
+ }_STRUCT_NAME(s);
+ LONGLONG int64;
+ } CY;
++typedef union tagCY *LPCY;
+ typedef double DATE;
+ typedef struct tagBSTRBLOB {
+ ULONG cbSize;
+@@ -163,7 +187,49 @@
+ ULONGLONG Lo64;
+ } DUMMYUNIONNAME2;
+ } DECIMAL;
++typedef DECIMAL *LPDECIMAL;
+ typedef void *HMETAFILEPICT;
++
++typedef enum tagTYSPEC {
++ TYSPEC_CLSID,
++ TYSPEC_FILEEXT,
++ TYSPEC_MIMETYPE,
++ TYSPEC_FILENAME,
++ TYSPEC_PROGID,
++ TYSPEC_PACKAGENAME,
++ TYSPEC_OBJECTID
++} TYSPEC;
++
++typedef union {
++ CLSID clsid;
++ LPOLESTR pFileExt;
++ LPOLESTR pMimeType;
++ LPOLESTR pProgId;
++ LPOLESTR pFileName;
++ struct {
++ LPOLESTR pPackageName;
++ GUID PolicyId;
++ } ByName;
++ struct {
++ GUID ObjectId;
++ GUID PolicyId;
++ } ByObjectId;
++} uCLSSPEC;
++
++typedef struct tagCSPLATFORM {
++ DWORD dwContext;
++ DWORD dwVersionHi;
++ DWORD dwVersionLo;
++ DWORD dwProcessorArch;
++} CSPLATFORM;
++
++typedef struct tagQUERYCONTEXT {
++ DWORD dwContext;
++ CSPLATFORM Platform;
++ LCID Locale;
++ DWORD dwVersionHi;
++ DWORD dwVersionLo;
++} QUERYCONTEXT;
+ #ifdef __cplusplus
+ }
+ #endif
+--- include/adoctint.h.orig 2006-02-26 07:54:34.000000000 +0900
++++ include/adoctint.h 2006-03-11 15:18:50.000000000 +0900
+@@ -3310,11 +3310,11 @@
+ #endif /* __Procedure_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Catalog;
+ #ifdef __cplusplus
+-Catalog;
++//Catalog;
+ #endif
+ EXTERN_C const CLSID CLSID_Table;
+ #ifdef __cplusplus
+-Table;
++//Table;
+ #endif
+ #ifndef __Property_INTERFACE_DEFINED__
+ #define __Property_INTERFACE_DEFINED__
+@@ -3503,23 +3503,23 @@
+ #endif /* __Property_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Group;
+ #ifdef __cplusplus
+-Group;
++//Group;
+ #endif
+ EXTERN_C const CLSID CLSID_User;
+ #ifdef __cplusplus
+-User;
++//User;
+ #endif
+ EXTERN_C const CLSID CLSID_Column;
+ #ifdef __cplusplus
+-Column;
++//Column;
+ #endif
+ EXTERN_C const CLSID CLSID_Index;
+ #ifdef __cplusplus
+-Index;
++//Index;
+ #endif
+ EXTERN_C const CLSID CLSID_Key;
+ #ifdef __cplusplus
+-Key;
++//Key;
+ #endif
+ #ifndef __Tables_INTERFACE_DEFINED__
+ #define __Tables_INTERFACE_DEFINED__
+--- include/adoint.h.orig 2005-04-04 18:50:18.000000000 +0900
++++ include/adoint.h 2006-03-11 15:06:04.000000000 +0900
+@@ -4273,7 +4273,7 @@
+ #endif /* __ADOConnectionConstruction_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Connection;
+ #ifdef __cplusplus
+-Connection;
++//Connection;
+ #endif
+ #ifndef ___Record_INTERFACE_DEFINED__
+ #define ___Record_INTERFACE_DEFINED__
+@@ -4740,7 +4740,7 @@
+ #endif /* ___Record_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Record;
+ #ifdef __cplusplus
+-Record;
++//Record;
+ #endif
+ #ifndef ___Stream_INTERFACE_DEFINED__
+ #define ___Stream_INTERFACE_DEFINED__
+@@ -5281,7 +5281,7 @@
+ #endif /* ___Stream_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Stream;
+ #ifdef __cplusplus
+-Stream;
++//Stream;
+ #endif
+ #ifndef __ADORecordConstruction_INTERFACE_DEFINED__
+ #define __ADORecordConstruction_INTERFACE_DEFINED__
+@@ -5616,11 +5616,11 @@
+ #endif /* __ADOCommandConstruction_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Command;
+ #ifdef __cplusplus
+-Command;
++//Command;
+ #endif
+ EXTERN_C const CLSID CLSID_Recordset;
+ #ifdef __cplusplus
+-Recordset;
++//Recordset;
+ #endif
+ #ifndef __Recordset15_INTERFACE_DEFINED__
+ #define __Recordset15_INTERFACE_DEFINED__
+@@ -10662,7 +10662,7 @@
+ #endif /* ___Parameter_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Parameter;
+ #ifdef __cplusplus
+-Parameter;
++//Parameter;
+ #endif
+ #ifndef __Parameters_INTERFACE_DEFINED__
+ #define __Parameters_INTERFACE_DEFINED__
+@@ -11124,4 +11124,4 @@
+ #define ADOStream _ADOStream
+
+
+-#endif // _ADOINT_H_
+\ No newline at end of file
++#endif // _ADOINT_H_
+--- include/commctrl.h.orig 2005-04-14 17:54:38.000000000 +0900
++++ include/commctrl.h 2006-04-01 00:40:44.000000000 +0900
+@@ -7319,6 +7319,7 @@
+ #if defined(ISOLATION_AWARE_ENABLED) && (ISOLATION_AWARE_ENABLED != 0)
+
+
++#if 0
+ #if !defined(ISOLATION_AWARE_USE_STATIC_LIBRARY)
+ #define ISOLATION_AWARE_USE_STATIC_LIBRARY 0
+ #endif
+@@ -10499,6 +10500,7 @@
+ #define Str_SetPtrW IsolationAwareStr_SetPtrW
+ #define UninitializeFlatSB IsolationAwareUninitializeFlatSB
+ #define _TrackMouseEvent IsolationAware_TrackMouseEvent
++#endif
+
+ #endif /* ISOLATION_AWARE_ENABLED */
+ #endif /* RC */
+--- include/gdiplusenums.h.orig 2003-03-26 16:34:34.000000000 +0900
++++ include/gdiplusenums.h 2004-12-30 20:42:34.000000000 +0900
+@@ -531,11 +531,11 @@
+ // We have to change the WMF record numbers so that they don't conflict with
+ // the EMF and EMF+ record numbers.
+
+-enum EmfPlusRecordType;
++// enum EmfPlusRecordType;
+
+ #define GDIP_EMFPLUS_RECORD_BASE 0x00004000
+ #define GDIP_WMF_RECORD_BASE 0x00010000
+-#define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
++#define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((n) | GDIP_WMF_RECORD_BASE)
+ #define GDIP_EMFPLUS_RECORD_TO_WMF(n) ((n) & (~GDIP_WMF_RECORD_BASE))
+ #define GDIP_IS_WMF_RECORDTYPE(n) (((n) & GDIP_WMF_RECORD_BASE) != 0)
+
+--- include/gdiplusheaders.h.orig 2003-03-26 16:34:34.000000000 +0900
++++ include/gdiplusheaders.h 2004-12-30 20:58:22.000000000 +0900
+@@ -650,7 +650,7 @@
+
+ class CachedBitmap : public GdiplusBase
+ {
+- friend Graphics;
++ friend class Graphics;
+
+ public:
+ CachedBitmap(IN Bitmap *bitmap,
+--- include/gdiplusimaging.h.orig 2003-03-26 16:34:34.000000000 +0900
++++ include/gdiplusimaging.h 2004-12-30 21:15:38.000000000 +0900
+@@ -153,7 +153,7 @@
+ UINT Width;
+ UINT Height;
+ INT Stride;
+- PixelFormat PixelFormat;
++ PixelFormat aPixelFormat;
+ VOID* Scan0;
+ UINT_PTR Reserved;
+ };
+--- include/imagehlp.h.orig 2005-04-14 17:54:44.000000000 +0900
++++ include/imagehlp.h 2006-04-04 23:22:28.000000000 +0900
+@@ -376,7 +376,7 @@
+ IMAGEAPI
+ TouchFileTimes (
+ HANDLE FileHandle,
+- PSYSTEMTIME pSystemTime
++ LPSYSTEMTIME pSystemTime
+ );
+
+ BOOL
+@@ -2592,7 +2592,7 @@
+ // ThreadId must be 4 bytes on all architectures.
+ //
+
+-C_ASSERT (sizeof ( ((PPROCESS_INFORMATION)0)->dwThreadId ) == 4);
++//C_ASSERT (sizeof ( ((PPROCESS_INFORMATION)0)->dwThreadId ) == 4);
+
+ typedef struct _MINIDUMP_THREAD {
+ ULONG32 ThreadId;
+--- include/mapiwin.h.orig 2003-03-26 16:34:38.000000000 +0900
++++ include/mapiwin.h 2004-12-28 21:41:14.000000000 +0900
+@@ -428,4 +428,4 @@
+ #endif
+
+ #endif /* __MAPIWIN_H__ */
+-
++
+--- include/oaidl.h.orig 2005-04-14 17:54:54.000000000 +0900
++++ include/oaidl.h 2006-09-17 11:50:46.750000000 +0900
+@@ -405,7 +405,7 @@
+ * UINT * VT_BYREF|VT_UINT
+ * }
+ */
+-#if (__STDC__ && !defined(_FORCENAMELESSUNION)) || defined(NONAMELESSUNION)
++#if (defined(NONAMELESSUNION))
+ #define __VARIANT_NAME_1 n1
+ #define __VARIANT_NAME_2 n2
+ #define __VARIANT_NAME_3 n3
+@@ -420,8 +420,12 @@
+ #endif
+ typedef /* [wire_marshal] */ struct tagVARIANT VARIANT;
+
++#if defined (__GNUC__) && !defined (NONAMELESSUNION)
++__extension__ /* no named members */
++#endif
+ struct tagVARIANT
+ {
++ _ANONYMOUS_UNION
+ union
+ {
+ struct __tagVARIANT
+@@ -430,6 +434,7 @@
+ WORD wReserved1;
+ WORD wReserved2;
+ WORD wReserved3;
++ _ANONYMOUS_UNION
+ union
+ {
+ LONGLONG llVal;
+--- include/objidl.h.orig 2005-04-14 17:54:54.000000000 +0900
++++ include/objidl.h 2006-03-30 23:50:30.000000000 +0900
+@@ -6594,6 +6594,7 @@
+ } uSTGMEDIUM;
+
+ #endif /* !NONAMELESSUNION */
++#if 0
+ typedef struct _GDI_OBJECT
+ {
+ DWORD ObjectType;
+@@ -6626,15 +6627,17 @@
+ } userSTGMEDIUM;
+
+ typedef /* [unique] */ userSTGMEDIUM *wireSTGMEDIUM;
++#endif
+
+ typedef /* [wire_marshal] */ uSTGMEDIUM STGMEDIUM;
+
+-typedef /* [unique] */ userSTGMEDIUM *wireASYNC_STGMEDIUM;
++//typedef /* [unique] */ userSTGMEDIUM *wireASYNC_STGMEDIUM;
+
+ typedef /* [wire_marshal] */ STGMEDIUM ASYNC_STGMEDIUM;
+
+ typedef STGMEDIUM *LPSTGMEDIUM;
+
++#if 0
+ typedef struct _userFLAG_STGMEDIUM
+ {
+ long ContextFlags;
+@@ -6643,6 +6646,7 @@
+ } userFLAG_STGMEDIUM;
+
+ typedef /* [unique] */ userFLAG_STGMEDIUM *wireFLAG_STGMEDIUM;
++#endif
+
+ typedef /* [wire_marshal] */ struct _FLAG_STGMEDIUM
+ {
+--- include/ocidl.h.orig 2005-04-14 17:54:54.000000000 +0900
++++ include/ocidl.h 2006-09-02 21:54:34.562500000 +0900
+@@ -5767,11 +5767,13 @@
+ HITRESULT_HIT = 3
+ } HITRESULT;
+
++#if 0
+ typedef /* [v1_enum] */
+ enum tagDVASPECT2
+ { DVASPECT_OPAQUE = 16,
+ DVASPECT_TRANSPARENT = 32
+ } DVASPECT2;
++#endif
+
+ typedef struct tagExtentInfo
+ {
+--- include/oleauto.h.orig 2005-04-14 17:54:54.000000000 +0900
++++ include/oleauto.h 2006-04-08 22:33:24.000000000 +0900
+@@ -392,6 +392,9 @@
+ WINOLEAUTAPI VarBoolFromUI8(ULONG64 i64In, VARIANT_BOOL FAR* pboolOut);
+ WINOLEAUTAPI VarBoolFromDec(DECIMAL *pdecIn, VARIANT_BOOL *pboolOut);
+
++#define __in
++#define __out
++
+ WINOLEAUTAPI
+ VarI1FromUI1(
+ __in BYTE bIn,
+@@ -485,6 +488,9 @@
+ __out CHAR *pcOut
+ );
+
++#undef __in
++#undef __out
++
+ WINOLEAUTAPI VarUI2FromUI1(BYTE bIn, USHORT *puiOut);
+ WINOLEAUTAPI VarUI2FromI2(SHORT uiIn, USHORT *puiOut);
+ WINOLEAUTAPI VarUI2FromI4(LONG lIn, USHORT *puiOut);
+@@ -880,6 +886,9 @@
+ /* ICreateTypeLib */
+ /*---------------------------------------------------------------------*/
+
++typedef interface ICreateTypeLib ICreateTypeLib;
++typedef interface ICreateTypeLib2 ICreateTypeLib2;
++typedef interface ICreateTypeInfo ICreateTypeInfo;
+ typedef ICreateTypeLib * LPCREATETYPELIB;
+
+ typedef ICreateTypeInfo * LPCREATETYPEINFO;
+@@ -1068,7 +1077,7 @@
+
+ // Declare variant access functions.
+
+-#if __STDC__ || defined(NONAMELESSUNION)
++#ifdef NONAMELESSUNION
+ #define V_UNION(X, Y) ((X)->n1.n2.n3.Y)
+ #define V_VT(X) ((X)->n1.n2.vt)
+ #define V_RECORDINFO(X) ((X)->n1.n2.n3.brecVal.pRecInfo)
+--- include/oledb.h.orig 2005-04-04 18:50:18.000000000 +0900
++++ include/oledb.h 2006-04-03 06:41:04.000000000 +0900
+@@ -788,7 +788,7 @@
+
+ //@@@+ V2.0
+ #if( OLEDBVER >= 0x0200 )
+-#if !defined(_WINBASE_) && !defined(_FILETIME_)
++#if !defined(_WINBASE_H) && !defined(_FILETIME_)
+ #define _FILETIME_
+ typedef struct _FILETIME {
+ DWORD dwLowDateTime;
+--- include/propidl.h.orig 2005-04-14 17:54:56.000000000 +0900
++++ include/propidl.h 2006-04-01 08:26:46.000000000 +0900
+@@ -307,7 +307,7 @@
+ /* [case()] */ FLOAT fltVal;
+ /* [case()] */ DOUBLE dblVal;
+ /* [case()] */ VARIANT_BOOL boolVal;
+- /* [case()] */ _VARIANT_BOOL bool;
++// /* [case()] */ _VARIANT_BOOL bool;
+ /* [case()] */ SCODE scode;
+ /* [case()] */ CY cyVal;
+ /* [case()] */ DATE date;
+--- include/qedit.h.orig 2005-04-14 17:54:56.000000000 +0900
++++ include/qedit.h 2006-05-12 22:25:46.000000000 +0900
+@@ -10205,10 +10205,10 @@
+ #define DEX_IDS_GRAPH_ERROR 1427
+ #define DEX_IDS_GRID_ERROR 1428
+ #define DEX_IDS_INTERFACE_ERROR 1429
+-EXTERN_GUID(CLSID_VideoEffects1Category, 0xcc7bfb42, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+-EXTERN_GUID(CLSID_VideoEffects2Category, 0xcc7bfb43, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+-EXTERN_GUID(CLSID_AudioEffects1Category, 0xcc7bfb44, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+-EXTERN_GUID(CLSID_AudioEffects2Category, 0xcc7bfb45, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_VideoEffects1Category, 0xcc7bfb42, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_VideoEffects2Category, 0xcc7bfb43, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_AudioEffects1Category, 0xcc7bfb44, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_AudioEffects2Category, 0xcc7bfb45, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+
+
+ extern RPC_IF_HANDLE __MIDL_itf_qedit_0495_v0_0_c_ifspec;
+--- include/shlobj.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/shlobj.h 2006-04-01 15:49:26.000000000 +0900
+@@ -1383,7 +1383,7 @@
+
+ // no POF_ flags currently defined
+
+-typedef UINT PRINTEROP_FLAGS;
++//typedef UINT PRINTEROP_FLAGS;
+
+ #endif // FO_MOVE
+
+--- include/shtypes.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/shtypes.h 2006-03-31 06:51:02.000000000 +0900
+@@ -122,7 +122,7 @@
+ } ITEMIDLIST;
+
+ #include <poppack.h>
+-typedef /* [unique] */ BYTE_BLOB *wirePIDL;
++//typedef /* [unique] */ BYTE_BLOB *wirePIDL;
+
+ typedef /* [wire_marshal] */ ITEMIDLIST __unaligned *LPITEMIDLIST;
+
+--- include/specstrings.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/specstrings.h 2005-05-25 06:42:00.000000000 +0900
+@@ -8,6 +8,8 @@
+ * *
+ \***************************************************************/
+
++#include <wchar.h>
++
+ // @@BEGIN_DDKSPLIT
+
+ // -------------------------------------------------------------------------------
+@@ -445,7 +447,7 @@
+
+ // @@END_DDKSPLIT
+
+- #define __null
++// #define __null
+ #define __notnull
+ #define __maybenull
+ #define __readonly
+--- include/strmif.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/strmif.h 2006-04-05 19:36:02.000000000 +0900
+@@ -20566,7 +20566,7 @@
+ #define _IAMFilterGraphCallback_
+ // Note: Because this interface was not defined as a proper interface it is
+ // supported under C++ only. Methods aren't stdcall.
+-EXTERN_GUID(IID_IAMFilterGraphCallback,0x56a868fd,0x0ad4,0x11ce,0xb0,0xa3,0x0,0x20,0xaf,0x0b,0xa7,0x70);
++DEFINE_GUID(IID_IAMFilterGraphCallback,0x56a868fd,0x0ad4,0x11ce,0xb0,0xa3,0x0,0x20,0xaf,0x0b,0xa7,0x70);
+ interface IAMFilterGraphCallback : public IUnknown
+ {
+ // S_OK means rendering complete, S_FALSE means retry now.
+@@ -28962,7 +28962,7 @@
+ typedef struct tagVMRGUID
+ {
+ GUID *pGUID;
+- GUID GUID;
++ GUID aGUID;
+ } VMRGUID;
+
+ typedef struct tagVMRMONITORINFO
+--- include/wincrypt.h.orig 2005-04-14 17:55:02.000000000 +0900
++++ include/wincrypt.h 2006-03-29 00:13:26.000000000 +0900
+@@ -14713,8 +14713,8 @@
+ IN DWORD dwFlags,
+ OPTIONAL PCRYPT_KEY_PROV_INFO pKeyProvInfo,
+ OPTIONAL PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
+- OPTIONAL PSYSTEMTIME pStartTime,
+- OPTIONAL PSYSTEMTIME pEndTime,
++ OPTIONAL LPSYSTEMTIME pStartTime,
++ OPTIONAL LPSYSTEMTIME pEndTime,
+ OPTIONAL PCERT_EXTENSIONS pExtensions
+ );
+
+--- include/wingdi.h.orig 2005-04-14 17:55:02.000000000 +0900
++++ include/wingdi.h 2006-03-31 23:27:00.000000000 +0900
+@@ -2751,7 +2751,26 @@
+ typedef FARPROC LINEDDAPROC;
+ #endif
+
+-
++#define __in
++#define __in_ecount(x)
++#define __in_bcount(x)
++#define __in_opt
++#define __in_ecount_opt(x)
++#define __in_bcount_opt(x)
++#define __out
++#define __out_ecount(x)
++#define __out_bcount(x)
++#define __out_opt
++#define __out_ecount_opt(x)
++#define __out_bcount_opt(x)
++#define __out_bcount_part_opt(x,y)
++#define __out_ecount_part_opt(x,y)
++#define __inout
++#define __inout_ecount(x)
++#define __reserved
++#define __deref_opt_out
++#define __typefix(x)
++WINGDIAPI int WINAPI FillRect(HDC,LPCRECT,HBRUSH);
+
+ WINGDIAPI int WINAPI AddFontResourceA(__in LPCSTR);
+ WINGDIAPI int WINAPI AddFontResourceW(__in LPCWSTR);
+@@ -4140,6 +4159,26 @@
+ WINGDIAPI BOOL WINAPI ColorCorrectPalette( __in HDC hdc, __in HPALETTE hPal, __in DWORD deFirst, __in DWORD num);
+ #endif
+
++#undef __in
++#undef __in_ecount(x)
++#undef __in_bcount(x)
++#undef __in_opt
++#undef __in_ecount_opt(x)
++#undef __in_bcount_opt(x)
++#undef __out
++#undef __out_ecount(x)
++#undef __out_bcount(x)
++#undef __out_opt
++#undef __out_ecount_opt(x)
++#undef __out_bcount_opt(x)
++#undef __out_bcount_part_opt(x,y)
++#undef __out_ecount_part_opt(x,y)
++#undef __inout
++#undef __inout_ecount(x)
++#undef __reserved
++#undef __deref_opt_out
++#undef __typefix(x)
++
+ #ifndef NOMETAFILE
+
+ // Enhanced metafile constants.
+--- include/winsock2.h.orig 2005-04-14 17:55:02.000000000 +0900
++++ include/winsock2.h 2006-04-08 23:36:00.000000000 +0900
+@@ -10,9 +10,9 @@
+ * conditions for redistribution.
+ */
+
+-#ifndef _WINSOCK2API_
+-#define _WINSOCK2API_
+-#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
++#ifndef _WINSOCK2_H
++#define _WINSOCK2_H
++#define _WINSOCK_H /* to prevent later inclusion of winsock.h */
+
+ /*
+ * Ensure structures are packed consistently.
+@@ -1293,10 +1293,8 @@
+ * registration (RNR) API
+ */
+
+-#ifndef _tagBLOB_DEFINED
+-#define _tagBLOB_DEFINED
+-#define _BLOB_DEFINED
+-#define _LPBLOB_DEFINED
++#ifndef __BLOB_T_DEFINED
++#define __BLOB_T_DEFINED
+ typedef struct _BLOB {
+ ULONG cbSize ;
+ #ifdef MIDL_PASS
+@@ -3858,4 +3856,4 @@
+ #include <wsipv6ok.h>
+ #endif // IPV6STRICT
+
+-#endif /* _WINSOCK2API_ */
++#endif /* _WINSOCK2_H */
+--- include/ws2tcpip.h.orig 2005-04-14 17:55:04.000000000 +0900
++++ include/ws2tcpip.h 2006-04-01 01:37:10.000000000 +0900
+@@ -396,6 +396,8 @@
+ UINT ipi_ifindex; // received interface index
+ } IN_PKTINFO;
+
++#define C_ASSERT(x)
++
+ C_ASSERT(sizeof(IN_PKTINFO) == 8);
+
+ // structure for IPV6_PKTINFO option
+--- include/wspiapi.h.orig 2005-04-14 17:55:04.000000000 +0900
++++ include/wspiapi.h 2006-05-03 12:32:14.000000000 +0900
+@@ -76,6 +76,11 @@
+
+ #ifdef __cplusplus
+ extern "C" {
++#define _inline inline
++#define __inline inline
++#else
++#define _inline static
++#define __inline static
+ #endif
+
+ ////////////////////////////////////////////////////////////
+@@ -1043,6 +1048,8 @@
+ (*pfFreeAddrInfo)(ai);
+ }
+
++#undef _inline
++#undef __inline
+ #ifdef __cplusplus
+ }
+ #endif
+--- include/atl/atlbase.h.orig 2005-04-14 17:54:32.000000000 +0900
++++ include/atl/atlbase.h 2006-10-07 13:55:07.859375000 +0900
+@@ -79,13 +79,41 @@
+ #pragma comment(lib, "atl.lib")
+ #endif
+
+-extern "C" const __declspec(selectany) GUID LIBID_ATLLib = {0x44EC0535,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
+-extern "C" const __declspec(selectany) CLSID CLSID_Registrar = {0x44EC053A,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
+-extern "C" const __declspec(selectany) IID IID_IRegistrar = {0x44EC053B,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
+-extern "C" const __declspec(selectany) IID IID_IAxWinHostWindow = {0xb6ea2050,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
+-extern "C" const __declspec(selectany) IID IID_IAxWinAmbientDispatch = {0xb6ea2051,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
+-extern "C" const __declspec(selectany) IID IID_IInternalConnection = {0x72AD0770,0x6A9F,0x11d1,{0xBC,0xEC,0x00,0x60,0x08,0x8F,0x44,0x4E}};
+-extern "C" const __declspec(selectany) IID IID_IDocHostUIHandlerDispatch = {0x425B5AF0,0x65F1,0x11d1,{0x96,0x11,0x00,0x00,0xF8,0x1E,0x0D,0x0D}};
++#define __uuidof(I) IID_##I
++
++#include <excpt.h>
++
++namespace ATL
++{
++inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
++{
++ return (
++ ((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] &&
++ ((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] &&
++ ((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] &&
++ ((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]);
++}
++}
++
++#ifdef _INIT_ATL_COMMON_VARS
++extern "C" const GUID LIBID_ATLLib = {0x44EC0535,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
++extern "C" const CLSID CLSID_Registrar = {0x44EC053A,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
++extern "C" const IID IID_IRegistrar = {0x44EC053B,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
++extern "C" const IID IID_IAxWinHostWindow = {0xb6ea2050,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
++extern "C" const IID IID_IAxWinAmbientDispatch = {0xb6ea2051,0x48a,0x11d1,{0x82,0xb9,0x0,0xc0,0x4f,0xb9,0x94,0x2e}};
++extern "C" const IID IID_IInternalConnection = {0x72AD0770,0x6A9F,0x11d1,{0xBC,0xEC,0x00,0x60,0x08,0x8F,0x44,0x4E}};
++extern "C" const IID IID_IDocHostUIHandlerDispatch = {0x425B5AF0,0x65F1,0x11d1,{0x96,0x11,0x00,0x00,0xF8,0x1E,0x0D,0x0D}};
++#else
++extern "C" {
++extern const GUID LIBID_ATLLib;
++extern const CLSID CLSID_Registrar;
++extern const IID IID_IRegistrar;
++extern const IID IID_IAxWinHostWindow;
++extern const IID IID_IAxWinAmbientDispatch;
++extern const IID IID_IInternalConnection;
++extern const IID IID_IDocHostUIHandlerDispatch;
++}
++#endif
+
+ #ifndef _ATL_DLL_IMPL
+ namespace ATL
+@@ -135,7 +163,7 @@
+ IUnknown* p = NULL;
+ if (pfnGetClassObject == NULL)
+ return S_OK;
+- HRESULT hRes = pfnGetClassObject(pfnCreateInstance, IID_IUnknown, (LPVOID*) &p);
++ HRESULT hRes = pfnGetClassObject((LPVOID)pfnCreateInstance, IID_IUnknown, (LPVOID*) &p);
+ if (SUCCEEDED(hRes))
+ hRes = CoRegisterClassObject(*pclsid, p, dwClsContext, dwFlags, &dwRegister);
+ if (p != NULL)
+@@ -284,13 +312,15 @@
+ };
+ #pragma pack(pop)
+
+-PVOID __stdcall __AllocStdCallThunk(VOID);
+-VOID __stdcall __FreeStdCallThunk(PVOID);
++//PVOID __stdcall __AllocStdCallThunk(VOID);
++//VOID __stdcall __FreeStdCallThunk(PVOID);
+
+-#define AllocStdCallThunk() __AllocStdCallThunk()
+-#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
++//#define AllocStdCallThunk() __AllocStdCallThunk()
++//#define FreeStdCallThunk(p) __FreeStdCallThunk(p)
+
+-#pragma comment(lib, "atlthunk.lib")
++//#pragma comment(lib, "atlthunk.lib")
++#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),0,sizeof(_stdcallthunk))
++#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
+
+ #elif defined (_M_AMD64)
+ #pragma pack(push,2)
+@@ -658,6 +688,7 @@
+ class _NoAddRefReleaseOnCComPtr : public T
+ {
+ private:
++ _NoAddRefReleaseOnCComPtr();
+ STDMETHOD_(ULONG, AddRef)()=0;
+ STDMETHOD_(ULONG, Release)()=0;
+ };
+@@ -781,6 +812,7 @@
+ {
+ return AtlAdvise(p, pUnk, iid, pdw);
+ }
++#if 0
+ HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
+ {
+ ATLASSERT(p == NULL);
+@@ -801,11 +833,12 @@
+ ATLASSERT(pp != NULL && *pp == NULL);
+ return p->QueryInterface(__uuidof(Q), (void**)pp);
+ }
++#endif
+ T* p;
+ };
+
+
+-template <class T, const IID* piid = &__uuidof(T)>
++template <class T, const IID* piid>
+ class CComQIPtr
+ {
+ public:
+@@ -933,6 +966,7 @@
+ {
+ return AtlAdvise(p, pUnk, iid, pdw);
+ }
++#if 0
+ HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL)
+ {
+ ATLASSERT(p == NULL);
+@@ -953,6 +987,7 @@
+ ATLASSERT(pp != NULL && *pp == NULL);
+ return p->QueryInterface(__uuidof(Q), (void**)pp);
+ }
++#endif
+ T* p;
+ };
+
+@@ -1087,12 +1122,14 @@
+ hr = ::CoCreateInstance(clsid, pUnkOuter, dwClsContext, __uuidof(IUnknown), (void**)&p);
+ return hr;
+ }
++#if 0
+ template <class Q>
+ HRESULT QueryInterface(Q** pp)
+ {
+ ATLASSERT(pp != NULL && *pp == NULL);
+ return p->QueryInterface(__uuidof(Q), (void**)pp);
+ }
++#endif
+ IUnknown* p;
+ };
+
+@@ -1257,21 +1294,26 @@
+ LeaveCriticalSection(&m_sec);
+ return S_OK;
+ }
++ static void _InitHandler(void *pData, LPEXCEPTION_POINTERS ep)
++ {
++ HRESULT &hRes=*reinterpret_cast<HRESULT*>(pData);
++ if (STATUS_NO_MEMORY == ep->ExceptionRecord->ExceptionCode)
++ hRes = E_OUTOFMEMORY;
++ else
++ hRes = E_FAIL;
++ }
+ HRESULT Init() throw()
+ {
+ HRESULT hRes = S_OK;
+- __try
+- {
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
++ {
++ _sehandler.Set(_sejmpbuf, &hRes, reinterpret_cast<__SEHandler::PF>(EXCEPTION_EXECUTE_HANDLER), _InitHandler);
+ InitializeCriticalSection(&m_sec);
+- }
++ }
+ // structured exception may be raised in low memory situations
+- __except(EXCEPTION_EXECUTE_HANDLER)
+- {
+- if (STATUS_NO_MEMORY == GetExceptionCode())
+- hRes = E_OUTOFMEMORY;
+- else
+- hRes = E_FAIL;
+- }
++ _sehandler.Reset();
+ return hRes;
+ }
+
+@@ -2799,10 +2841,19 @@
+
+
+ class CComModule;
+-__declspec(selectany) CComModule* _pModule=NULL;
++#ifdef _INIT_ATL_COMMON_VARS
++CComModule* _pModule=NULL;
++#else
++extern CComModule* _pModule;
++#endif
++
+
+ // {B62F5910-6528-11d1-9611-0000F81E0D0D}
+-_declspec(selectany) GUID GUID_ATLVer30 = { 0xb62f5910, 0x6528, 0x11d1, { 0x96, 0x11, 0x0, 0x0, 0xf8, 0x1e, 0xd, 0xd } };
++#ifdef _INIT_ATL_COMMON_VARS
++GUID GUID_ATLVer30 = { 0xb62f5910, 0x6528, 0x11d1, { 0x96, 0x11, 0x0, 0x0, 0xf8, 0x1e, 0xd, 0xd } };
++#else
++extern GUID GUID_ATLVer30;
++#endif
+
+ class CComModule : public _ATL_MODULE
+ {
+@@ -4286,7 +4337,9 @@
+
+ #endif
+
+-__declspec(selectany) GUID CComModule::m_libid = {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
++#ifdef _INIT_ATL_COMMON_VARS
++GUID CComModule::m_libid = {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}};
++#endif
+
+ #ifdef _ATL_STATIC_REGISTRY
+ #define UpdateRegistryFromResource UpdateRegistryFromResourceS
+@@ -4355,7 +4408,9 @@
+ LONG m_nLockCnt;
+ };
+
+-__declspec(selectany) UINT CComApartment::ATL_CREATE_OBJECT = 0;
++#ifdef _INIT_ATL_COMMON_VARS
++UINT CComApartment::ATL_CREATE_OBJECT = 0;
++#endif
+
+ class CComSimpleThreadAllocator
+ {
+@@ -5855,6 +5910,10 @@
+ }
+
+ }
++ static int _Except(void *pThis, LPEXCEPTION_POINTERS lpEP)
++ {
++ return reinterpret_cast<CVirtualBuffer *>(pThis)->Except(lpEP);
++ }
+ void Seek(int nElement)
+ {
+ if(nElement < 0 || nElement >= m_nMaxElements)
+@@ -5866,41 +5925,53 @@
+ {
+ if(nElement < 0 || nElement >= m_nMaxElements)
+ _AtlRaiseException((DWORD)EXCEPTION_ARRAY_BOUNDS_EXCEEDED);
+- __try
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
+ {
++ _sehandler.Set(_sejmpbuf, this, _Except);
+ T* p = &m_pBase[nElement];
+ *p = Element;
+ m_pTop = p > m_pTop ? p : m_pTop;
+ }
+- __except(Except(GetExceptionInformation()))
++ else
+ {
+ }
++ _sehandler.Reset();
+
+ }
+ template <class Q>
+ void WriteBulk(Q& helper)
+ {
+- __try
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
+ {
++ _sehandler.Set(_sejmpbuf, this, _Except);
+ m_pCurrent = helper(m_pBase);
+ m_pTop = m_pCurrent > m_pTop ? m_pCurrent : m_pTop;
+ }
+- __except(Except(GetExceptionInformation()))
++ else
+ {
+ }
++ _sehandler.Reset();
+ }
+ void Write(const T& Element)
+ {
+ if (m_pCurrent < &m_pBase[m_nMaxElements]) {
+- __try
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
+ {
++ _sehandler.Set(_sejmpbuf, this, _Except);
+ *m_pCurrent = Element;
+ m_pCurrent++;
+ m_pTop = m_pCurrent > m_pTop ? m_pCurrent : m_pTop;
+ }
+- __except(Except(GetExceptionInformation()))
++ else
+ {
+ }
++ _sehandler.Reset();
+ }
+ }
+ T& Read()
+@@ -5910,14 +5981,18 @@
+ operator BSTR()
+ {
+ BSTR bstrTemp = NULL ;
+- __try
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
+ {
++ _sehandler.Set(_sejmpbuf, this, _Except);
+ bstrTemp = SysAllocStringByteLen((char*) m_pBase,
+ (UINT) ((BYTE*)m_pTop - (BYTE*)m_pBase));
+ }
+- __except(Except(GetExceptionInformation()))
++ else
+ {
+ }
++ _sehandler.Reset();
+ return bstrTemp;
+ }
+ const T& operator[](int nElement) const
+@@ -6336,6 +6411,11 @@
+ //Although these functions are big, they are only used once in a module
+ //so we should make them inline.
+
++ATLINLINE int atlmoduleinitfilter(void *, LPEXCEPTION_POINTERS ep)
++{
++ return ep->ExceptionRecord->ExceptionCode == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
++}
++
+ ATLINLINE ATLAPI AtlModuleInit(_ATL_MODULE* pM, _ATL_OBJMAP_ENTRY* p, HINSTANCE h)
+ {
+ ATLASSERT(pM != NULL);
+@@ -6352,32 +6432,43 @@
+ pM->m_hInst = pM->m_hInstTypeLib = pM->m_hInstResource = h;
+ pM->m_nLockCnt=0L;
+ pM->m_hHeap = NULL;
+- __try {
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0) {
++ _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
+ InitializeCriticalSection(&pM->m_csTypeInfoHolder);
+- } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
++ } else {
+ ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
+- return STATUS_NO_MEMORY;
++ _sehandler.Reset();
++ return STATUS_NO_MEMORY;
+ }
++ _sehandler.Reset();
+
+- __try {
++ if (__builtin_setjmp(_sejmpbuf) == 0) {
++ _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
+ InitializeCriticalSection(&pM->m_csWindowCreate);
+- } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
++ } else {
+ DeleteCriticalSection(&pM->m_csTypeInfoHolder);
+ ZeroMemory(&pM->m_csWindowCreate, sizeof(pM->m_csWindowCreate));
+ ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
++ _sehandler.Reset();
+ return STATUS_NO_MEMORY;
+ }
++ _sehandler.Reset();
+
+- __try {
++ if (__builtin_setjmp(_sejmpbuf) == 0) {
++ _sehandler.Set(_sejmpbuf, NULL, atlmoduleinitfilter);
+ InitializeCriticalSection(&pM->m_csObjMap);
+- } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
++ } else {
+ DeleteCriticalSection(&pM->m_csWindowCreate);
+ DeleteCriticalSection(&pM->m_csTypeInfoHolder);
+ ZeroMemory(&pM->m_csObjMap, sizeof(pM->m_csObjMap));
+ ZeroMemory(&pM->m_csWindowCreate, sizeof(pM->m_csWindowCreate));
+ ZeroMemory(&pM->m_csTypeInfoHolder, sizeof(pM->m_csTypeInfoHolder));
++ _sehandler.Reset();
+ return STATUS_NO_MEMORY;
+ }
++ _sehandler.Reset();
+ #ifdef _ATL_DLL_IMPL
+ if (pM->cbSize > _nAtlModuleVer21Size)
+ #endif
+@@ -6450,6 +6541,11 @@
+ return hRes;
+ }
+
++ATLINLINE void atlfinalleavecriticalsection(void *pData)
++{
++ LeaveCriticalSection(reinterpret_cast<LPCRITICAL_SECTION>(pData));
++}
++
+ ATLINLINE ATLAPI AtlModuleGetClassObject(_ATL_MODULE* pM, REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+ {
+ ATLASSERT(pM != NULL);
+@@ -6473,15 +6569,15 @@
+ if (pEntry->pCF == NULL)
+ {
+ EnterCriticalSection(&pM->m_csObjMap);
+- __try
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
+ {
++ _sehandler.Set(_sejmpbuf, &pM->m_csObjMap, EXCEPTION_CONTINUE_SEARCH, NULL, atlfinalleavecriticalsection);
+ if (pEntry->pCF == NULL)
+- hRes = pEntry->pfnGetClassObject(pEntry->pfnCreateInstance, IID_IUnknown, (LPVOID*)&pEntry->pCF);
+- }
+- __finally
+- {
+- LeaveCriticalSection(&pM->m_csObjMap);
++ hRes = pEntry->pfnGetClassObject((void *)(pEntry->pfnCreateInstance), IID_IUnknown, (LPVOID*)&pEntry->pCF);
+ }
++ _sehandler.Reset();
+ }
+ if (pEntry->pCF != NULL)
+ hRes = pEntry->pCF->QueryInterface(riid, ppv);
+--- include/atl/atlcom.h.orig 2005-04-14 17:54:32.000000000 +0900
++++ include/atl/atlcom.h 2006-10-07 16:36:44.000000000 +0900
+@@ -2191,19 +2191,23 @@
+ // override it in your class and call each base class' version of this
+ #define BEGIN_COM_MAP(x) public: \
+ typedef x _ComMapClass; \
++ static void _CacheFinal(void *pData)\
++ {\
++ reinterpret_cast<_ComMapClass*>(pData)->Unlock();\
++ }\
+ static HRESULT WINAPI _Cache(void* pv, REFIID iid, void** ppvObject, DWORD_PTR dw)\
+ {\
+ _ComMapClass* p = (_ComMapClass*)pv;\
+ p->Lock();\
+ HRESULT hRes = E_FAIL; \
+- __try \
++ jmp_buf _sejmpbuf; \
++ __SEHandler _sehandler; \
++ if (__builtin_setjmp(_sejmpbuf) == 0) \
+ { \
++ _sehandler.Set(_sejmpbuf, p, EXCEPTION_CONTINUE_SEARCH, NULL, _CacheFinal);\
+ hRes = CComObjectRootBase::_Cache(pv, iid, ppvObject, dw);\
+ } \
+- __finally \
+- { \
+- p->Unlock();\
+- } \
++ _sehandler.Reset();\
+ return hRes;\
+ }\
+ IUnknown* _GetRawUnknown() \
+@@ -2492,9 +2496,9 @@
+ public:
+ typedef ThreadModel _ThreadModel;
+ #ifdef OLD_ATL_CRITSEC_CODE
+- typename typedef _ThreadModel::AutoCriticalSection _CritSec;
++ typedef typename _ThreadModel::AutoCriticalSection _CritSec;
+ #else
+- typename typedef _ThreadModel::AutoDeleteCriticalSection _AutoDelCritSec;
++ typedef typename _ThreadModel::AutoDeleteCriticalSection _AutoDelCritSec;
+ #endif /* OLD_ATL_CRITSEC_CODE */
+ typedef CComObjectLockT<_ThreadModel> ObjectLock;
+
+@@ -2638,8 +2642,8 @@
+ // Set refcount to 1 to protect destruction
+ ~CComObject()
+ {
+- m_dwRef = 1L;
+- FinalRelease();
++ this->m_dwRef = 1L;
++ this->FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(_GetRawUnknown());
+ #endif
+@@ -2647,22 +2651,24 @@
+ }
+ //If InternalAddRef or InternalRelease is undefined then your class
+ //doesn't derive from CComObjectRoot
+- STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
++ STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
+ STDMETHOD_(ULONG, Release)()
+ {
+- ULONG l = InternalRelease();
++ ULONG l = this->InternalRelease();
+ if (l == 0)
+ delete this;
+ return l;
+ }
+ //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
+ STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
+- {return _InternalQueryInterface(iid, ppvObject);}
++ {return this->_InternalQueryInterface(iid, ppvObject);}
++#if 0
+ template <class Q>
+ HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
+ {
+ return QueryInterface(__uuidof(Q), (void**)pp);
+ }
++#endif
+
+ static HRESULT WINAPI CreateInstance(CComObject<Base>** pp);
+ };
+@@ -2719,8 +2725,8 @@
+ #endif /* OLD_ATL_CRITSEC_CODE */
+ ~CComObjectCached()
+ {
+- m_dwRef = 1L;
+- FinalRelease();
++ this->m_dwRef = 1L;
++ this->FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(_GetRawUnknown());
+ #endif
+@@ -2729,14 +2735,14 @@
+ //doesn't derive from CComObjectRoot
+ STDMETHOD_(ULONG, AddRef)()
+ {
+- ULONG l = InternalAddRef();
++ ULONG l = this->InternalAddRef();
+ if (l == 2)
+ _Module.Lock();
+ return l;
+ }
+ STDMETHOD_(ULONG, Release)()
+ {
+- ULONG l = InternalRelease();
++ ULONG l = this->InternalRelease();
+ if (l == 0)
+ delete this;
+ else if (l == 1)
+@@ -2745,7 +2751,7 @@
+ }
+ //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
+ STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
+- {return _InternalQueryInterface(iid, ppvObject);}
++ {return this->_InternalQueryInterface(iid, ppvObject);}
+ #ifndef OLD_ATL_CRITSEC_CODE
+ CComGlobalsThreadModel::AutoDeleteCriticalSection m_csCached;
+ #endif /* OLD_ATL_CRITSEC_CODE */
+@@ -2762,8 +2768,8 @@
+ // Set refcount to 1 to protect destruction
+ ~CComObjectNoLock()
+ {
+- m_dwRef = 1L;
+- FinalRelease();
++ this->m_dwRef = 1L;
++ this->FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(_GetRawUnknown());
+ #endif
+@@ -2771,17 +2777,17 @@
+
+ //If InternalAddRef or InternalRelease is undefined then your class
+ //doesn't derive from CComObjectRoot
+- STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
++ STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
+ STDMETHOD_(ULONG, Release)()
+ {
+- ULONG l = InternalRelease();
++ ULONG l = this->InternalRelease();
+ if (l == 0)
+ delete this;
+ return l;
+ }
+ //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP
+ STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
+- {return _InternalQueryInterface(iid, ppvObject);}
++ {return this->_InternalQueryInterface(iid, ppvObject);}
+ };
+
+ // It is possible for Base not to derive from CComObjectRoot
+@@ -2794,14 +2800,14 @@
+ CComObjectGlobal(void* = NULL)
+ {
+ #ifndef OLD_ATL_CRITSEC_CODE
+- m_hResFinalConstruct = _AtlInitialConstruct();
++ m_hResFinalConstruct = this->_AtlInitialConstruct();
+ if (SUCCEEDED(m_hResFinalConstruct))
+ #endif /* OLD_ATL_CRITSEC_CODE */
+- m_hResFinalConstruct = FinalConstruct();
++ m_hResFinalConstruct = this->FinalConstruct();
+ }
+ ~CComObjectGlobal()
+ {
+- FinalRelease();
++ this->FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(_GetRawUnknown());
+ #endif
+@@ -2810,7 +2816,7 @@
+ STDMETHOD_(ULONG, AddRef)() {return _Module.Lock();}
+ STDMETHOD_(ULONG, Release)(){return _Module.Unlock();}
+ STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
+- {return _InternalQueryInterface(iid, ppvObject);}
++ {return this->_InternalQueryInterface(iid, ppvObject);}
+ HRESULT m_hResFinalConstruct;
+ };
+
+@@ -2824,14 +2830,14 @@
+ CComObjectStack(void* = NULL)
+ {
+ #ifndef OLD_ATL_CRITSEC_CODE
+- m_hResFinalConstruct = _AtlInitialConstruct();
++ m_hResFinalConstruct = this->_AtlInitialConstruct();
+ if (SUCCEEDED(m_hResFinalConstruct))
+ #endif /* OLD_ATL_CRITSEC_CODE */
+- m_hResFinalConstruct = FinalConstruct();
++ m_hResFinalConstruct = this->FinalConstruct();
+ }
+ ~CComObjectStack()
+ {
+- FinalRelease();
++ this->FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(_GetRawUnknown());
+ #endif
+@@ -2850,6 +2856,8 @@
+ {
+ public:
+ typedef Base _BaseClass;
++ using Base::_GetRawUnknown;
++ using Base::m_pOuterUnknown;
+ CComContainedObject(void* pv) {m_pOuterUnknown = (IUnknown*)pv;}
+ #ifdef _ATL_DEBUG_INTERFACES
+ ~CComContainedObject()
+@@ -2859,20 +2867,22 @@
+ }
+ #endif
+
+- STDMETHOD_(ULONG, AddRef)() {return OuterAddRef();}
+- STDMETHOD_(ULONG, Release)() {return OuterRelease();}
++ STDMETHOD_(ULONG, AddRef)() {return this->OuterAddRef();}
++ STDMETHOD_(ULONG, Release)() {return this->OuterRelease();}
+ STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject)
+ {
+- HRESULT hr = OuterQueryInterface(iid, ppvObject);
++ HRESULT hr = this->OuterQueryInterface(iid, ppvObject);
+ if (FAILED(hr) && _GetRawUnknown() != m_pOuterUnknown)
+- hr = _InternalQueryInterface(iid, ppvObject);
++ hr = this->_InternalQueryInterface(iid, ppvObject);
+ return hr;
+ }
++#if 0
+ template <class Q>
+ HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
+ {
+ return QueryInterface(__uuidof(Q), (void**)pp);
+ }
++#endif
+ //GetControllingUnknown may be virtual if the Base class has declared
+ //DECLARE_GET_CONTROLLING_UNKNOWN()
+ IUnknown* GetControllingUnknown()
+@@ -2915,18 +2925,18 @@
+ // override it in your class and call each base class' version of this
+ HRESULT FinalConstruct()
+ {
+- CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
++ CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
+ return m_contained.FinalConstruct();
+ }
+ void FinalRelease()
+ {
+- CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
++ CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
+ m_contained.FinalRelease();
+ }
+ // Set refcount to 1 to protect destruction
+ ~CComAggObject()
+ {
+- m_dwRef = 1L;
++ this->m_dwRef = 1L;
+ FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(this);
+@@ -2934,10 +2944,10 @@
+ _Module.Unlock();
+ }
+
+- STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
++ STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
+ STDMETHOD_(ULONG, Release)()
+ {
+- ULONG l = InternalRelease();
++ ULONG l = this->InternalRelease();
+ if (l == 0)
+ delete this;
+ return l;
+@@ -2959,11 +2969,13 @@
+ hRes = m_contained._InternalQueryInterface(iid, ppvObject);
+ return hRes;
+ }
++#if 0
+ template <class Q>
+ HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
+ {
+ return QueryInterface(__uuidof(Q), (void**)pp);
+ }
++#endif
+ static HRESULT WINAPI CreateInstance(LPUNKNOWN pUnkOuter, CComAggObject<contained>** pp)
+ {
+ _ATL_VALIDATE_OUT_POINTER(pp);
+@@ -3023,21 +3035,21 @@
+ // override it in your class and call each base class' version of this
+ HRESULT FinalConstruct()
+ {
+- InternalAddRef();
+- CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
++ this->InternalAddRef();
++ CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
+ HRESULT hr = m_contained.FinalConstruct();
+- InternalRelease();
++ this->InternalRelease();
+ return hr;
+ }
+ void FinalRelease()
+ {
+- CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
++ CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
+ m_contained.FinalRelease();
+ }
+ // Set refcount to 1 to protect destruction
+ ~CComPolyObject()
+ {
+- m_dwRef = 1L;
++ this->m_dwRef = 1L;
+ FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(this);
+@@ -3045,10 +3057,10 @@
+ _Module.Unlock();
+ }
+
+- STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
++ STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
+ STDMETHOD_(ULONG, Release)()
+ {
+- ULONG l = InternalRelease();
++ ULONG l = this->InternalRelease();
+ if (l == 0)
+ delete this;
+ return l;
+@@ -3072,11 +3084,13 @@
+ hRes = m_contained._InternalQueryInterface(iid, ppvObject);
+ return hRes;
+ }
++#if 0
+ template <class Q>
+ HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
+ {
+ return QueryInterface(__uuidof(Q), (void**)pp);
+ }
++#endif
+ static HRESULT WINAPI CreateInstance(LPUNKNOWN pUnkOuter, CComPolyObject<contained>** pp)
+ {
+ _ATL_VALIDATE_OUT_POINTER(pp);
+@@ -3111,27 +3125,28 @@
+ class CComTearOffObject : public Base
+ {
+ public:
++ using Base::m_pOwner;
+ CComTearOffObject(void* pv)
+ {
+ ATLASSERT(m_pOwner == NULL);
+- m_pOwner = reinterpret_cast<CComObject<Base::_OwnerClass>*>(pv);
++ m_pOwner = reinterpret_cast<CComObject<typename Base::_OwnerClass>*>(pv);
+ m_pOwner->AddRef();
+ }
+ // Set refcount to 1 to protect destruction
+ ~CComTearOffObject()
+ {
+- m_dwRef = 1L;
+- FinalRelease();
++ this->m_dwRef = 1L;
++ this->FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(_GetRawUnknown());
+ #endif
+ m_pOwner->Release();
+ }
+
+- STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
++ STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
+ STDMETHOD_(ULONG, Release)()
+ {
+- ULONG l = InternalRelease();
++ ULONG l = this->InternalRelease();
+ if (l == 0)
+ delete this;
+ return l;
+@@ -3150,27 +3165,27 @@
+ public:
+ typedef contained _BaseClass;
+ CComCachedTearOffObject(void* pv) :
+- m_contained(((contained::_OwnerClass*)pv)->GetControllingUnknown())
++ m_contained(((typename contained::_OwnerClass*)pv)->GetControllingUnknown())
+ {
+ ATLASSERT(m_contained.m_pOwner == NULL);
+- m_contained.m_pOwner = reinterpret_cast<CComObject<contained::_OwnerClass>*>(pv);
++ m_contained.m_pOwner = reinterpret_cast<CComObject<typename contained::_OwnerClass>*>(pv);
+ }
+ //If you get a message that this call is ambiguous then you need to
+ // override it in your class and call each base class' version of this
+ HRESULT FinalConstruct()
+ {
+- CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
++ CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalConstruct();
+ return m_contained.FinalConstruct();
+ }
+ void FinalRelease()
+ {
+- CComObjectRootEx<contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
++ CComObjectRootEx<typename contained::_ThreadModel::ThreadModelNoCS>::FinalRelease();
+ m_contained.FinalRelease();
+ }
+ // Set refcount to 1 to protect destruction
+ ~CComCachedTearOffObject()
+ {
+- m_dwRef = 1L;
++ this->m_dwRef = 1L;
+ FinalRelease();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.DeleteNonAddRefThunk(this);
+@@ -3178,10 +3193,10 @@
+ }
+
+
+- STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
++ STDMETHOD_(ULONG, AddRef)() {return this->InternalAddRef();}
+ STDMETHOD_(ULONG, Release)()
+ {
+- ULONG l = InternalRelease();
++ ULONG l = this->InternalRelease();
+ if (l == 0)
+ delete this;
+ return l;
+@@ -3260,6 +3275,8 @@
+ {
+ public:
+ typedef license _LicenseClass;
++ using license::IsLicenseValid;
++ using license::GetLicenseKey;
+ typedef CComClassFactory2<license> _ComMapClass;
+ BEGIN_COM_MAP(CComClassFactory2<license>)
+ COM_INTERFACE_ENTRY(IClassFactory)
+@@ -3297,7 +3314,7 @@
+ if (ppvObject == NULL)
+ return E_POINTER;
+ *ppvObject = NULL;
+- if ( ((bstrKey != NULL) && !VerifyLicenseKey(bstrKey)) ||
++ if ( ((bstrKey != NULL) && !this->VerifyLicenseKey(bstrKey)) ||
+ ((bstrKey == NULL) && !IsLicenseValid()) )
+ return CLASS_E_NOTLICENSED;
+ if ((pUnkOuter != NULL) && !InlineIsEqualUnknown(riid))
+@@ -3363,7 +3380,7 @@
+ if (pUnkOuter != NULL)
+ hRes = CLASS_E_NOAGGREGATION;
+ else
+- hRes = _Module.CreateInstance(m_pfnCreateInstance, riid, ppvObj);
++ hRes = _Module.CreateInstance((LPVOID)m_pfnCreateInstance, riid, ppvObj);
+ }
+ return hRes;
+ }
+@@ -3454,6 +3471,7 @@
+ lpszHelpFile, iid, hRes);
+ }
+ #endif
++#if 0
+ template <class Q>
+ static HRESULT CreateInstance(IUnknown* punkOuter, Q** pp)
+ {
+@@ -3464,6 +3482,7 @@
+ {
+ return T::_CreatorClass::CreateInstance(NULL, __uuidof(Q), (void**) pp);
+ }
++#endif
+ };
+
+ // ATL doesn't support multiple LCID's at the same time
+@@ -3651,7 +3670,7 @@
+ {
+ CComPtr<ITypeInfo> spInfo(spTypeInfo);
+ CComPtr<ITypeInfo2> spTypeInfo2;
+- if (SUCCEEDED(spTypeInfo->QueryInterface(&spTypeInfo2)))
++ if (SUCCEEDED(spTypeInfo->QueryInterface(IID_ITypeInfo2, (void**)&spTypeInfo2)))
+ spInfo = spTypeInfo2;
+
+ m_pInfo = spInfo.Detach();
+@@ -3760,6 +3779,9 @@
+ /////////////////////////////////////////////////////////////////////////////
+ // IDispEventImpl
+
++template <class T>
++struct _ATL_EVENT_ENTRY;
++
+ #ifdef _ATL_DLL
+ ATLAPI AtlGetObjectSourceInterface(IUnknown* punkObj, GUID* plibid, IID* piid, unsigned short* pdwMajor, unsigned short* pdwMinor);
+ #else
+@@ -3909,16 +3931,17 @@
+ #else
+
+ #pragma warning(disable:4740) // flow in/out of inline disables global opts
+-inline void __declspec(naked) __stdcall CComStdCallThunkHelper()
++inline void __stdcall CComStdCallThunkHelper()
+ {
+- __asm
+- {
+- mov eax, [esp+4]; // get pThunk
+- mov edx, [eax+4]; // get the pThunk->pThis
+- mov [esp+4], edx; // replace pThunk with pThis
+- mov eax, [eax+8]; // get pThunk->pfn
+- jmp eax; // jump pfn
+- };
++ asm(
++ " movl $8(%ebp), %eax\n" // get pThunk
++ " movl $4(%eax), edx\n" // get the pThunk->pThis
++ " movl %edx, $8(%ebp)\n" // replace pThunk with pThis
++ " movl $8(%eax), %eax\n" // get pThunk->pfn
++ " movl %ebp, %esp\n"
++ " popl %ebp\n"
++ " jmp %eax" // jump pfn
++ );
+ }
+ #pragma warning(default:4740)
+ #endif
+@@ -3985,6 +4008,7 @@
+ class ATL_NO_VTABLE IDispEventSimpleImpl : public _IDispEventLocator<nID, pdiid>
+ {
+ public:
++ using _IDispEventLocator<nID, pdiid>::m_dwEventCookie;
+ STDMETHOD(_LocDEQueryInterface)(REFIID riid, void ** ppvObject)
+ {
+ _ATL_VALIDATE_OUT_POINTER(ppvObject);
+@@ -3992,7 +4016,7 @@
+ if (InlineIsEqualGUID(riid, *pdiid) ||
+ InlineIsEqualUnknown(riid) ||
+ InlineIsEqualGUID(riid, IID_IDispatch) ||
+- InlineIsEqualGUID(riid, m_iid))
++ InlineIsEqualGUID(riid, this->m_iid))
+ {
+ *ppvObject = this;
+ AddRef();
+@@ -4186,6 +4210,10 @@
+ {
+ public:
+ typedef tihclass _tihclass;
++ using IDispEventSimpleImpl<nID, T, pdiid>::m_libid;
++ using IDispEventSimpleImpl<nID, T, pdiid>::m_iid;
++ using IDispEventSimpleImpl<nID, T, pdiid>::m_wMajorVerNum;
++ using IDispEventSimpleImpl<nID, T, pdiid>::m_wMinorVerNum;
+
+ IDispEventImpl()
+ {
+@@ -4475,6 +4503,11 @@
+ }
+ };
+
++template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
++class ATL_NO_VTABLE CComEnum;
++template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel = CComObjectThreadModel>
++class ATL_NO_VTABLE CComEnumOnSTL;
++
+
+ /////////////////////////////////////////////////////////////////////////////
+ // CComEnumImpl
+@@ -4746,7 +4779,7 @@
+ return S_OK;
+ }
+
+-template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
++template <class Base, const IID* piid, class T, class Copy, class ThreadModel>
+ class ATL_NO_VTABLE CComEnum :
+ public CComEnumImpl<Base, piid, T, Copy>,
+ public CComObjectRootEx< ThreadModel >
+@@ -4868,7 +4901,7 @@
+ return hRes;
+ }
+
+-template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel = CComObjectThreadModel>
++template <class Base, const IID* piid, class T, class Copy, class CollType, class ThreadModel>
+ class ATL_NO_VTABLE CComEnumOnSTL :
+ public IEnumOnSTLImpl<Base, piid, T, Copy, CollType>,
+ public CComObjectRootEx< ThreadModel >
+@@ -4901,7 +4934,7 @@
+ return E_INVALIDARG;
+ HRESULT hr = E_FAIL;
+ Index--;
+- CollType::iterator iter = m_coll.begin();
++ typename CollType::iterator iter = m_coll.begin();
+ while (iter != m_coll.end() && Index > 0)
+ {
+ iter++;
+@@ -5314,7 +5347,7 @@
+ if (InlineIsEqualGUID(riid, IID_IConnectionPoint) || InlineIsEqualUnknown(riid))
+ {
+ *ppvObject = this;
+- AddRef();
++ this->AddRef();
+ #ifdef _ATL_DEBUG_INTERFACES
+ _Module.AddThunk((IUnknown**)ppvObject, _T("IConnectionPointImpl"), riid);
+ #endif // _ATL_DEBUG_INTERFACES
+--- include/atl/atlconv.h.orig 2005-04-14 17:54:32.000000000 +0900
++++ include/atl/atlconv.h 2006-09-18 20:37:06.015625000 +0900
+@@ -30,7 +30,11 @@
+ // Following code is to avoid alloca causing a stack overflow.
+ // It is intended for use from the _ATL_SAFE_ALLOCA macros
+ // or Conversion macros.
+-__declspec(selectany) DWORD _Atlosplatform = 0;
++#ifdef _INIT_ATL_COMMON_VARS
++DWORD _Atlosplatform = 0;
++#else
++extern DWORD _Atlosplatform;
++#endif
+ inline BOOL _AtlGetVersionEx()
+ {
+ OSVERSIONINFO osi;
+@@ -158,6 +162,9 @@
+ // Verifies if sufficient space is available on the stack.
+ inline bool _AtlVerifyStackAvailable(SIZE_T Size)
+ {
++#if 1
++ return false;
++#else
+ bool bStackAvailable = true;
+
+ __try
+@@ -173,6 +180,7 @@
+ _Atlresetstkoflw();
+ }
+ return bStackAvailable;
++#endif
+ }
+
+ #pragma prefast(pop)
+--- include/atl/atlctl.h.orig 2005-04-14 17:54:32.000000000 +0900
++++ include/atl/atlctl.h 2006-10-07 15:47:14.250000000 +0900
+@@ -142,7 +142,7 @@
+ CComControlBase(HWND& h) : m_hWndCD(h)
+ {
+ memset(this, 0, sizeof(CComControlBase));
+- m_phWndCD = &h;
++// m_phWndCD = &h;
+ m_sizeExtent.cx = 2*2540;
+ m_sizeExtent.cy = 2*2540;
+ m_sizeNatural = m_sizeExtent;
+@@ -530,13 +530,13 @@
+ SIZE m_sizeNatural; //unscaled size in himetric
+ SIZE m_sizeExtent; //current extents in himetric
+ RECT m_rcPos; // position in pixels
+-#pragma warning(disable: 4510 4610) // unnamed union
+- union
+- {
++//#pragma warning(disable: 4510 4610) // unnamed union
++// union
++// {
+ HWND& m_hWndCD;
+- HWND* m_phWndCD;
+- };
+-#pragma warning(default: 4510 4610)
++// HWND* m_phWndCD;
++// };
++//#pragma warning(default: 4510 4610)
+ union
+ {
+ // m_nFreezeEvents is the only one actually used
+@@ -1362,7 +1362,7 @@
+ class ATL_NO_VTABLE CComControl : public CComControlBase, public WinBase
+ {
+ public:
+- CComControl() : CComControlBase(m_hWnd) {}
++ CComControl() : CComControlBase(this->m_hWnd) {}
+ HRESULT FireOnRequestEdit(DISPID dispID)
+ {
+ T* pT = static_cast<T*>(this);
+@@ -1401,6 +1401,8 @@
+ class CComCompositeControl : public CComControl< T, CAxDialogImpl< T > >
+ {
+ public:
++ using CComControl< T, CAxDialogImpl< T > >::m_hWnd;
++ using CComControl< T, CAxDialogImpl< T > >::GetNextDlgTabItem;
+ CComCompositeControl()
+ {
+ m_hbrBackground = NULL;
+@@ -1429,7 +1431,7 @@
+ m_hbrBackground = NULL;
+ }
+ OLE_COLOR clr;
+- HRESULT hr = GetAmbientBackColor(clr);
++ HRESULT hr = this->GetAmbientBackColor(clr);
+ if (SUCCEEDED(hr))
+ {
+ COLORREF rgb;
+@@ -1458,10 +1460,10 @@
+ }
+ HWND Create(HWND hWndParent, RECT& /*rcPos*/, LPARAM dwInitParam = NULL)
+ {
+- CComControl< T, CAxDialogImpl< T > >::Create(hWndParent, dwInitParam);
++ this->Create(hWndParent, dwInitParam);
+ SetBackgroundColorFromAmbient();
+ if (m_hWnd != NULL)
+- ShowWindow(SW_SHOWNOACTIVATE);
++ this->ShowWindow(SW_SHOWNOACTIVATE);
+ return m_hWnd;
+ }
+ BOOL CalcExtent(SIZE& size)
+@@ -1488,7 +1490,7 @@
+ return FALSE;
+ // find a direct child of the dialog from the window that has focus
+ HWND hWndCtl = ::GetFocus();
+- if (IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd)
++ if (this->IsChild(hWndCtl) && ::GetParent(hWndCtl) != m_hWnd)
+ {
+ do
+ {
+@@ -1546,7 +1548,7 @@
+ break;
+ }
+
+- return IsDialogMessage(pMsg);
++ return this->IsDialogMessage(pMsg);
+ }
+ HRESULT IOleInPlaceObject_InPlaceDeactivate(void)
+ {
+@@ -1563,7 +1565,7 @@
+ }
+ virtual HRESULT OnDraw(ATL_DRAWINFO& di)
+ {
+- if(!m_bInPlaceActive)
++ if(!this->m_bInPlaceActive)
+ {
+ HPEN hPen = (HPEN)::GetStockObject(BLACK_PEN);
+ HBRUSH hBrush = (HBRUSH)::GetStockObject(GRAY_BRUSH);
+--- include/atl/atlwin.h.orig 2005-04-14 17:54:32.000000000 +0900
++++ include/atl/atlwin.h 2006-10-07 16:35:28.406250000 +0900
+@@ -99,6 +99,8 @@
+ #else
+ #define CWndClassInfo CWndClassInfoA
+ #endif
++template <DWORD t_dwStyle = 0, DWORD t_dwExStyle = 0> class CWinTraits;
++typedef CWinTraits<WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> CControlWinTraits;
+ template <class T, class TBase = CWindow, class TWinTraits = CControlWinTraits> class CWindowImpl;
+ template <class T, class TBase = CWindow> class CDialogImpl;
+ #ifndef _ATL_NO_HOSTING
+@@ -658,6 +660,13 @@
+ ATLASSERT(::IsWindow(m_hWnd));
+ return ::GetDlgItemText(m_hWnd, nID, lpStr, nMaxCount);
+ }
++
++ HWND GetDlgItem(int nID) const
++ {
++ ATLASSERT(::IsWindow(m_hWnd));
++ return ::GetDlgItem(m_hWnd, nID);
++ }
++
+ BOOL GetDlgItemText(int nID, BSTR& bstrText) const
+ {
+ ATLASSERT(::IsWindow(m_hWnd));
+@@ -847,12 +856,6 @@
+ return (int)::SetWindowLong(m_hWnd, GWL_ID, nID);
+ }
+
+- HWND GetDlgItem(int nID) const
+- {
+- ATLASSERT(::IsWindow(m_hWnd));
+- return ::GetDlgItem(m_hWnd, nID);
+- }
+-
+ // Alert Functions
+
+ BOOL FlashWindow(BOOL bInvert)
+@@ -1319,7 +1322,9 @@
+ }
+ };
+
+-_declspec(selectany) RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 };
++#ifdef _INIT_ATL_COMMON_VARS
++RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 };
++#endif
+
+ /////////////////////////////////////////////////////////////////////////////
+ // CAxWindow - client side for an ActiveX host window
+@@ -1330,6 +1335,7 @@
+ class CAxWindowT : public TBase
+ {
+ public:
++ using TBase::m_hWnd;
+ // Constructors
+ CAxWindowT(HWND hWnd = NULL) : TBase(hWnd)
+ { }
+@@ -1439,11 +1445,13 @@
+ hr = spUnk->QueryInterface(iid, ppUnk);
+ return hr;
+ }
++#if 0
+ template <class Q>
+ HRESULT QueryHost(Q** ppUnk)
+ {
+ return QueryHost(__uuidof(Q), (void**)ppUnk);
+ }
++#endif
+ HRESULT QueryControl(REFIID iid, void** ppUnk)
+ {
+ ATLASSERT(ppUnk != NULL);
+@@ -1459,11 +1467,13 @@
+ hr = spUnk->QueryInterface(iid, ppUnk);
+ return hr;
+ }
++#if 0
+ template <class Q>
+ HRESULT QueryControl(Q** ppUnk)
+ {
+ return QueryControl(__uuidof(Q), (void**)ppUnk);
+ }
++#endif
+ HRESULT SetExternalDispatch(IDispatch* pDisp)
+ {
+ HRESULT hr;
+@@ -1750,7 +1760,7 @@
+
+ // search for an empty one
+
+- for(i = 0; i < m_aChainEntry.GetSize(); i++)
++ for(int i = 0; i < m_aChainEntry.GetSize(); i++)
+ {
+ if(m_aChainEntry[i] == NULL)
+ {
+@@ -1841,7 +1851,7 @@
+ /////////////////////////////////////////////////////////////////////////////
+ // CWinTraits - Defines various default values for a window
+
+-template <DWORD t_dwStyle = 0, DWORD t_dwExStyle = 0>
++template <DWORD t_dwStyle, DWORD t_dwExStyle>
+ class CWinTraits
+ {
+ public:
+@@ -1855,7 +1865,7 @@
+ }
+ };
+
+-typedef CWinTraits<WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> CControlWinTraits;
++//typedef CWinTraits<WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> CControlWinTraits;
+ typedef CWinTraits<WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_APPWINDOW | WS_EX_WINDOWEDGE> CFrameWinTraits;
+ typedef CWinTraits<WS_OVERLAPPEDWINDOW | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_MDICHILD> CMDIChildWinTraits;
+
+@@ -1882,6 +1892,7 @@
+ class ATL_NO_VTABLE CWindowImplRoot : public TBase, public CMessageMap
+ {
+ public:
++ using TBase::GetDlgItem;
+ CWndProcThunk m_thunk;
+ const MSG* m_pCurrentMsg;
+
+@@ -1892,7 +1903,7 @@
+ ~CWindowImplRoot()
+ {
+ #ifdef _DEBUG
+- if(m_hWnd != NULL) // should be cleared in WindowProc
++ if(this->m_hWnd != NULL) // should be cleared in WindowProc
+ {
+ ATLTRACE2(atlTraceWindowing, 0, _T("ERROR - Object deleted before window was destroyed\n"));
+ ATLASSERT(FALSE);
+@@ -2017,6 +2028,8 @@
+ class ATL_NO_VTABLE CWindowImplBaseT : public CWindowImplRoot< TBase >
+ {
+ public:
++ using CWindowImplRoot< TBase >::m_hWnd;
++ using CWindowImplRoot< TBase >::m_thunk;
+ WNDPROC m_pfnSuperWindowProc;
+
+ CWindowImplBaseT() : m_pfnSuperWindowProc(::DefWindowProc)
+@@ -2049,7 +2062,7 @@
+
+ LRESULT DefWindowProc()
+ {
+- const MSG* pMsg = m_pCurrentMsg;
++ const MSG* pMsg = this->m_pCurrentMsg;
+ LRESULT lRes = 0;
+ if (pMsg != NULL)
+ lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam);
+@@ -2219,6 +2232,7 @@
+ class ATL_NO_VTABLE CWindowImpl : public CWindowImplBaseT< TBase, TWinTraits >
+ {
+ public:
++ using CWindowImplBaseT< TBase, TWinTraits >::StartWindowProc;
+ DECLARE_WND_CLASS(NULL)
+
+ HWND Create(HWND hWndParent, RECT& rcPos, LPCTSTR szWindowName = NULL,
+@@ -2226,8 +2240,8 @@
+ UINT nID = 0, LPVOID lpCreateParam = NULL)
+ {
+ if (T::GetWndClassInfo().m_lpszOrigName == NULL)
+- T::GetWndClassInfo().m_lpszOrigName = GetWndClassName();
+- ATOM atom = T::GetWndClassInfo().Register(&m_pfnSuperWindowProc);
++ T::GetWndClassInfo().m_lpszOrigName = this->GetWndClassName();
++ ATOM atom = T::GetWndClassInfo().Register(&(this->m_pfnSuperWindowProc));
+
+ dwStyle = T::GetWndStyle(dwStyle);
+ dwExStyle = T::GetWndExStyle(dwExStyle);
+@@ -2244,6 +2258,7 @@
+ class ATL_NO_VTABLE CDialogImplBaseT : public CWindowImplRoot< TBase >
+ {
+ public:
++ using CWindowImplRoot< TBase >::m_hWnd;
+ virtual DLGPROC GetDialogProc()
+ {
+ return DialogProc;
+@@ -2344,6 +2359,9 @@
+ class ATL_NO_VTABLE CDialogImpl : public CDialogImplBaseT< TBase >
+ {
+ public:
++ using CDialogImplBaseT< TBase >::m_hWnd;
++ using CDialogImplBaseT< TBase >::m_thunk;
++ typedef CDialogImplBaseT< TBase > CDialogImplBase_Class;
+ #ifdef _DEBUG
+ bool m_bModal;
+ CDialogImpl() : m_bModal(false) { }
+@@ -2422,6 +2440,8 @@
+ class ATL_NO_VTABLE CAxDialogImpl : public CDialogImplBaseT< TBase >
+ {
+ public:
++ using CDialogImplBaseT< TBase >::m_hWnd;
++ using CDialogImplBaseT< TBase >::m_thunk;
+ #ifdef _DEBUG
+ bool m_bModal;
+ CAxDialogImpl() : m_bModal(false) { }
+@@ -2515,6 +2535,8 @@
+ class CContainedWindowT : public TBase
+ {
+ public:
++ using TBase::m_hWnd;
++ using TBase::GetWndClassName;
+ CWndProcThunk m_thunk;
+ LPCTSTR m_lpszClassName;
+ WNDPROC m_pfnSuperWindowProc;
+@@ -2536,7 +2558,7 @@
+ { }
+
+ CContainedWindowT(CMessageMap* pObject, DWORD dwMsgMapID = 0)
+- : m_lpszClassName(TBase::GetWndClassName()),
++ : m_lpszClassName(GetWndClassName()),
+ m_pfnSuperWindowProc(::DefWindowProc),
+ m_pObject(pObject), m_dwMsgMapID(dwMsgMapID),
+ m_pCurrentMsg(NULL)
+@@ -2666,7 +2688,7 @@
+ LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0,
+ UINT nID = 0, LPVOID lpCreateParam = NULL)
+ {
+- m_lpszClassName = TBase::GetWndClassName();
++ m_lpszClassName = GetWndClassName();
+ m_pfnSuperWindowProc = ::DefWindowProc;
+ m_pObject = pObject;
+ m_dwMsgMapID = dwMsgMapID;
+@@ -2959,8 +2981,11 @@
+ {
+
+ ::EnterCriticalSection(&pM->m_csWindowCreate);
+- __try
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
+ {
++ _sehandler.Set(_sejmpbuf, &pM->m_csWindowCreate, EXCEPTION_CONTINUE_SEARCH, NULL, atlfinalleavecriticalsection);
+ if(p->m_atom == 0)
+ {
+ HINSTANCE hInst = pM->m_hInst;
+@@ -2979,7 +3004,7 @@
+ if(!::GetClassInfoExA(_Module.GetModuleInstance(), p->m_lpszOrigName, &wc))
+ {
+ fFail = TRUE;
+- __leave;
++ __builtin_longjmp(_sejmpbuf, 1);
+ }
+ }
+ memcpy(&p->m_wc, &wc, sizeof(WNDCLASSEX));
+@@ -3011,10 +3036,7 @@
+ p->m_atom = ::RegisterClassExA(&p->m_wc);
+ }
+ }
+- __finally
+- {
+- ::LeaveCriticalSection(&pM->m_csWindowCreate);
+- }
++ _sehandler.Reset();
+ }
+
+ if (fFail)
+@@ -3038,8 +3060,11 @@
+ if (p->m_atom == 0)
+ {
+ ::EnterCriticalSection(&pM->m_csWindowCreate);
+- __try
++ jmp_buf _sejmpbuf;
++ __SEHandler _sehandler;
++ if (__builtin_setjmp(_sejmpbuf) == 0)
+ {
++ _sehandler.Set(_sejmpbuf, &pM->m_csWindowCreate, EXCEPTION_CONTINUE_SEARCH, NULL, atlfinalleavecriticalsection);
+ if(p->m_atom == 0)
+ {
+ HINSTANCE hInst = pM->m_hInst;
+@@ -3058,7 +3083,7 @@
+ if(!::GetClassInfoExW(_Module.GetModuleInstance(), p->m_lpszOrigName, &wc))
+ {
+ fFail = TRUE;
+- __leave;
++ __builtin_longjmp(_sejmpbuf, -1);
+ }
+ }
+ memcpy(&p->m_wc, &wc, sizeof(WNDCLASSEX));
+@@ -3090,10 +3115,7 @@
+ p->m_atom = ::RegisterClassExW(&p->m_wc);
+ }
+ }
+- __finally
+- {
+- ::LeaveCriticalSection(&pM->m_csWindowCreate);
+- }
++ _sehandler.Reset();
+ }
+
+ if (fFail)
+--- include/atl/statreg.h.orig 2005-04-14 17:54:34.000000000 +0900
++++ include/atl/statreg.h 2006-09-18 20:05:01.468750000 +0900
+@@ -573,15 +573,16 @@
+ return hRes;
+ }
+
+-__declspec(selectany) LPCTSTR CRegParser::rgszNeverDelete[] = //Component Catagories
++#ifdef _INIT_ATL_COMMON_VARS
++LPCTSTR CRegParser::rgszNeverDelete[] = //Component Catagories
+ {
+ _T("CLSID"), _T("TYPELIB")
+ };
+
+-__declspec(selectany) const int CRegParser::cbNeverDelete = sizeof(rgszNeverDelete) / sizeof(LPCTSTR*);
+-__declspec(selectany) const int CRegParser::MAX_VALUE=4096;
+-__declspec(selectany) const int CRegParser::MAX_TYPE=MAX_VALUE;
+-
++const int CRegParser::cbNeverDelete = sizeof(rgszNeverDelete) / sizeof(LPCTSTR*);
++const int CRegParser::MAX_VALUE=4096;
++const int CRegParser::MAX_TYPE=MAX_VALUE;
++#endif
+
+ inline BOOL CRegParser::VTFromRegType(LPCTSTR szValueType, VARTYPE& vt)
+ {
+--- include/objfwd.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/objfwd.h 2006-03-26 09:21:42.000000000 +0900
+@@ -27,7 +27,7 @@
+ typedef interface IEnumFORMATETC *LPENUMFORMATETC;
+ typedef interface IEnumSTATDATA *LPENUMSTATDATA;
+ typedef interface IEnumSTATSTG *LPENUMSTATSTG;
+-typedef interface IEnumSTATPROPSTG LPENUMSTATPROPSTG;
++typedef interface IEnumSTATPROPSTG *LPENUMSTATPROPSTG;
+ typedef interface IEnumString *LPENUMSTRING;
+ typedef interface IEnumUnknown *LPENUMUNKNOWN;
+ typedef interface IStorage *LPSTORAGE;
+--- include/ocidl.h.orig 2006-01-18 04:12:08.000000000 +0900
++++ include/ocidl.h 2006-04-03 07:04:58.000000000 +0900
+@@ -9,6 +9,7 @@
+ #endif
+
+ #include <ole2.h>
++#include <urlmon.h>
+
+ typedef interface IErrorLog *LPERRORLOG;
+ typedef interface IPropertyBag *LPPROPERTYBAG;
+--- include/rpcndr.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/rpcndr.h 2006-03-26 09:21:42.000000000 +0900
+@@ -48,6 +48,7 @@
+ #endif
+ #define small char
+ typedef unsigned char byte;
++typedef unsigned char boolean;
+ #define NDRSContextValue(hContext) (&(hContext)->userContext)
+ #define cbNDRContext 20
+ #define byte_from_ndr(source, target) { *(target) = *(*(char**)&(source)->Buffer)++; }
+--- include/tchar.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/tchar.h 2006-03-26 09:21:42.000000000 +0900
+@@ -210,6 +210,9 @@
+ #define _trewinddir _wrewinddir
+ #define _ttelldir _wtelldir
+ #define _tseekdir _wseekdir
++
++#define _ttempnam _wtempnam
++
+ #else /* Not _UNICODE */
+
+ /*
+@@ -386,6 +389,8 @@
+ #define _ttelldir telldir
+ #define _tseekdir seekdir
+
++#define _ttempnam _tempnam
++
+ #endif /* Not _UNICODE */
+
+ /*
+--- include/winbase.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/winbase.h 2006-04-04 23:18:14.000000000 +0900
+@@ -963,12 +963,14 @@
+ WORD Reserved2;
+ CHAR szPathName[OFS_MAXPATHNAME];
+ } OFSTRUCT,*LPOFSTRUCT,*POFSTRUCT;
++#if 0
+ typedef struct _WIN_CERTIFICATE {
+ DWORD dwLength;
+ WORD wRevision;
+ WORD wCertificateType;
+ BYTE bCertificate[1];
+ } WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
++#endif
+ #if (_WIN32_WINNT >= 0x0501)
+ typedef struct tagACTCTXA {
+ ULONG cbSize;
+@@ -1286,8 +1288,8 @@
+ WINBASEAPI HANDLE WINAPI FindFirstFileExW(LPCWSTR,FINDEX_INFO_LEVELS,PVOID,FINDEX_SEARCH_OPS,PVOID,DWORD);
+ WINBASEAPI BOOL WINAPI FindFirstFreeAce(PACL,PVOID*);
+ #if (_WIN32_WINNT >= 0x0500)
+-WINBASEAPI HANDLE WINAPI FindFirstVolumeA(LPCSTR,DWORD);
+-WINBASEAPI HANDLE WINAPI FindFirstVolumeW(LPCWSTR,DWORD);
++WINBASEAPI HANDLE WINAPI FindFirstVolumeA(LPSTR,DWORD);
++WINBASEAPI HANDLE WINAPI FindFirstVolumeW(LPWSTR,DWORD);
+ WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointA(LPSTR,LPSTR,DWORD);
+ WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointW(LPWSTR,LPWSTR,DWORD);
+ #endif
+@@ -1295,7 +1297,7 @@
+ WINBASEAPI BOOL WINAPI FindNextFileA(HANDLE,LPWIN32_FIND_DATAA);
+ WINBASEAPI BOOL WINAPI FindNextFileW(HANDLE,LPWIN32_FIND_DATAW);
+ #if (_WIN32_WINNT >= 0x0500)
+-WINBASEAPI BOOL WINAPI FindNextVolumeA(HANDLE,LPCSTR,DWORD);
++WINBASEAPI BOOL WINAPI FindNextVolumeA(HANDLE,LPSTR,DWORD);
+ WINBASEAPI BOOL WINAPI FindNextVolumeW(HANDLE,LPWSTR,DWORD);
+ WINBASEAPI BOOL WINAPI FindNextVolumeMountPointA(HANDLE,LPSTR,DWORD);
+ WINBASEAPI BOOL WINAPI FindNextVolumeMountPointW(HANDLE,LPWSTR,DWORD);
+--- include/winnt.h.orig 2006-03-26 09:21:36.000000000 +0900
++++ include/winnt.h 2006-03-26 09:21:42.000000000 +0900
+@@ -2536,6 +2536,7 @@
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_OPTIONAL_HEADER OptionalHeader;
+ } IMAGE_NT_HEADERS,*PIMAGE_NT_HEADERS;
++#define PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
+ typedef struct _IMAGE_ROM_HEADERS {
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
+--- include/wtypes.h.orig 2006-01-18 04:12:12.000000000 +0900
++++ include/wtypes.h 2006-04-08 22:05:48.000000000 +0900
+@@ -72,6 +72,29 @@
+ unsigned short asData[1];
+ }FLAGGED_WORD_BLOB;
+
++typedef struct _COAUTHIDENTITY
++ {
++ /* [size_is] */ USHORT *User;
++ /* [range] */ ULONG UserLength;
++ /* [size_is] */ USHORT *Domain;
++ /* [range] */ ULONG DomainLength;
++ /* [size_is] */ USHORT *Password;
++ /* [range] */ ULONG PasswordLength;
++ ULONG Flags;
++ } COAUTHIDENTITY;
++
++typedef struct _COAUTHINFO
++ {
++ DWORD dwAuthnSvc;
++ DWORD dwAuthzSvc;
++ LPWSTR pwszServerPrincName;
++ DWORD dwAuthnLevel;
++ DWORD dwImpersonationLevel;
++ COAUTHIDENTITY *pAuthIdentityData;
++ DWORD dwCapabilities;
++ } COAUTHINFO;
++typedef WORD CLIPFORMAT,*LPCLIPFORMAT;
++
+ #ifndef OLE2ANSI
+ typedef WCHAR OLECHAR;
+ typedef LPWSTR LPOLESTR;
+@@ -100,6 +123,7 @@
+ }_STRUCT_NAME(s);
+ LONGLONG int64;
+ } CY;
++typedef union tagCY *LPCY;
+ typedef double DATE;
+ typedef struct tagBSTRBLOB {
+ ULONG cbSize;
+@@ -163,7 +187,49 @@
+ ULONGLONG Lo64;
+ } DUMMYUNIONNAME2;
+ } DECIMAL;
++typedef DECIMAL *LPDECIMAL;
+ typedef void *HMETAFILEPICT;
++
++typedef enum tagTYSPEC {
++ TYSPEC_CLSID,
++ TYSPEC_FILEEXT,
++ TYSPEC_MIMETYPE,
++ TYSPEC_FILENAME,
++ TYSPEC_PROGID,
++ TYSPEC_PACKAGENAME,
++ TYSPEC_OBJECTID
++} TYSPEC;
++
++typedef union {
++ CLSID clsid;
++ LPOLESTR pFileExt;
++ LPOLESTR pMimeType;
++ LPOLESTR pProgId;
++ LPOLESTR pFileName;
++ struct {
++ LPOLESTR pPackageName;
++ GUID PolicyId;
++ } ByName;
++ struct {
++ GUID ObjectId;
++ GUID PolicyId;
++ } ByObjectId;
++} uCLSSPEC;
++
++typedef struct tagCSPLATFORM {
++ DWORD dwContext;
++ DWORD dwVersionHi;
++ DWORD dwVersionLo;
++ DWORD dwProcessorArch;
++} CSPLATFORM;
++
++typedef struct tagQUERYCONTEXT {
++ DWORD dwContext;
++ CSPLATFORM Platform;
++ LCID Locale;
++ DWORD dwVersionHi;
++ DWORD dwVersionLo;
++} QUERYCONTEXT;
+ #ifdef __cplusplus
+ }
+ #endif
+--- include/adoint.h.orig 2005-04-04 18:50:18.000000000 +0900
++++ include/adoint.h 2006-03-11 15:06:04.000000000 +0900
+@@ -4273,7 +4273,7 @@
+ #endif /* __ADOConnectionConstruction_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Connection;
+ #ifdef __cplusplus
+-Connection;
++//Connection;
+ #endif
+ #ifndef ___Record_INTERFACE_DEFINED__
+ #define ___Record_INTERFACE_DEFINED__
+@@ -4740,7 +4740,7 @@
+ #endif /* ___Record_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Record;
+ #ifdef __cplusplus
+-Record;
++//Record;
+ #endif
+ #ifndef ___Stream_INTERFACE_DEFINED__
+ #define ___Stream_INTERFACE_DEFINED__
+@@ -5281,7 +5281,7 @@
+ #endif /* ___Stream_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Stream;
+ #ifdef __cplusplus
+-Stream;
++//Stream;
+ #endif
+ #ifndef __ADORecordConstruction_INTERFACE_DEFINED__
+ #define __ADORecordConstruction_INTERFACE_DEFINED__
+@@ -5616,11 +5616,11 @@
+ #endif /* __ADOCommandConstruction_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Command;
+ #ifdef __cplusplus
+-Command;
++//Command;
+ #endif
+ EXTERN_C const CLSID CLSID_Recordset;
+ #ifdef __cplusplus
+-Recordset;
++//Recordset;
+ #endif
+ #ifndef __Recordset15_INTERFACE_DEFINED__
+ #define __Recordset15_INTERFACE_DEFINED__
+@@ -10662,7 +10662,7 @@
+ #endif /* ___Parameter_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Parameter;
+ #ifdef __cplusplus
+-Parameter;
++//Parameter;
+ #endif
+ #ifndef __Parameters_INTERFACE_DEFINED__
+ #define __Parameters_INTERFACE_DEFINED__
+@@ -11124,4 +11124,4 @@
+ #define ADOStream _ADOStream
+
+
+-#endif // _ADOINT_H_
+\ No newline at end of file
++#endif // _ADOINT_H_
+--- include/commctrl.h.orig 2005-04-14 17:54:38.000000000 +0900
++++ include/commctrl.h 2006-04-01 00:40:44.000000000 +0900
+@@ -7319,6 +7319,7 @@
+ #if defined(ISOLATION_AWARE_ENABLED) && (ISOLATION_AWARE_ENABLED != 0)
+
+
++#if 0
+ #if !defined(ISOLATION_AWARE_USE_STATIC_LIBRARY)
+ #define ISOLATION_AWARE_USE_STATIC_LIBRARY 0
+ #endif
+@@ -10499,6 +10500,7 @@
+ #define Str_SetPtrW IsolationAwareStr_SetPtrW
+ #define UninitializeFlatSB IsolationAwareUninitializeFlatSB
+ #define _TrackMouseEvent IsolationAware_TrackMouseEvent
++#endif
+
+ #endif /* ISOLATION_AWARE_ENABLED */
+ #endif /* RC */
+--- include/gdiplusenums.h.orig 2003-03-26 16:34:34.000000000 +0900
++++ include/gdiplusenums.h 2004-12-30 20:42:34.000000000 +0900
+@@ -531,11 +531,11 @@
+ // We have to change the WMF record numbers so that they don't conflict with
+ // the EMF and EMF+ record numbers.
+
+-enum EmfPlusRecordType;
++// enum EmfPlusRecordType;
+
+ #define GDIP_EMFPLUS_RECORD_BASE 0x00004000
+ #define GDIP_WMF_RECORD_BASE 0x00010000
+-#define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE))
++#define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((n) | GDIP_WMF_RECORD_BASE)
+ #define GDIP_EMFPLUS_RECORD_TO_WMF(n) ((n) & (~GDIP_WMF_RECORD_BASE))
+ #define GDIP_IS_WMF_RECORDTYPE(n) (((n) & GDIP_WMF_RECORD_BASE) != 0)
+
+--- include/gdiplusheaders.h.orig 2003-03-26 16:34:34.000000000 +0900
++++ include/gdiplusheaders.h 2004-12-30 20:58:22.000000000 +0900
+@@ -650,7 +650,7 @@
+
+ class CachedBitmap : public GdiplusBase
+ {
+- friend Graphics;
++ friend class Graphics;
+
+ public:
+ CachedBitmap(IN Bitmap *bitmap,
+--- include/gdiplusimaging.h.orig 2003-03-26 16:34:34.000000000 +0900
++++ include/gdiplusimaging.h 2004-12-30 21:15:38.000000000 +0900
+@@ -153,7 +153,7 @@
+ UINT Width;
+ UINT Height;
+ INT Stride;
+- PixelFormat PixelFormat;
++ PixelFormat aPixelFormat;
+ VOID* Scan0;
+ UINT_PTR Reserved;
+ };
+--- include/imagehlp.h.orig 2005-04-14 17:54:44.000000000 +0900
++++ include/imagehlp.h 2006-04-04 23:22:28.000000000 +0900
+@@ -376,7 +376,7 @@
+ IMAGEAPI
+ TouchFileTimes (
+ HANDLE FileHandle,
+- PSYSTEMTIME pSystemTime
++ LPSYSTEMTIME pSystemTime
+ );
+
+ BOOL
+@@ -2592,7 +2592,7 @@
+ // ThreadId must be 4 bytes on all architectures.
+ //
+
+-C_ASSERT (sizeof ( ((PPROCESS_INFORMATION)0)->dwThreadId ) == 4);
++//C_ASSERT (sizeof ( ((PPROCESS_INFORMATION)0)->dwThreadId ) == 4);
+
+ typedef struct _MINIDUMP_THREAD {
+ ULONG32 ThreadId;
+--- include/mapiwin.h.orig 2003-03-26 16:34:38.000000000 +0900
++++ include/mapiwin.h 2004-12-28 21:41:14.000000000 +0900
+@@ -428,4 +428,4 @@
+ #endif
+
+ #endif /* __MAPIWIN_H__ */
+-
++
+--- include/objidl.h.orig 2005-04-14 17:54:54.000000000 +0900
++++ include/objidl.h 2006-03-30 23:50:30.000000000 +0900
+@@ -6594,6 +6594,7 @@
+ } uSTGMEDIUM;
+
+ #endif /* !NONAMELESSUNION */
++#if 0
+ typedef struct _GDI_OBJECT
+ {
+ DWORD ObjectType;
+@@ -6626,15 +6627,17 @@
+ } userSTGMEDIUM;
+
+ typedef /* [unique] */ userSTGMEDIUM *wireSTGMEDIUM;
++#endif
+
+ typedef /* [wire_marshal] */ uSTGMEDIUM STGMEDIUM;
+
+-typedef /* [unique] */ userSTGMEDIUM *wireASYNC_STGMEDIUM;
++//typedef /* [unique] */ userSTGMEDIUM *wireASYNC_STGMEDIUM;
+
+ typedef /* [wire_marshal] */ STGMEDIUM ASYNC_STGMEDIUM;
+
+ typedef STGMEDIUM *LPSTGMEDIUM;
+
++#if 0
+ typedef struct _userFLAG_STGMEDIUM
+ {
+ long ContextFlags;
+@@ -6643,6 +6646,7 @@
+ } userFLAG_STGMEDIUM;
+
+ typedef /* [unique] */ userFLAG_STGMEDIUM *wireFLAG_STGMEDIUM;
++#endif
+
+ typedef /* [wire_marshal] */ struct _FLAG_STGMEDIUM
+ {
+--- include/oleauto.h.orig 2005-04-14 17:54:54.000000000 +0900
++++ include/oleauto.h 2006-04-08 22:33:24.000000000 +0900
+@@ -392,6 +392,9 @@
+ WINOLEAUTAPI VarBoolFromUI8(ULONG64 i64In, VARIANT_BOOL FAR* pboolOut);
+ WINOLEAUTAPI VarBoolFromDec(DECIMAL *pdecIn, VARIANT_BOOL *pboolOut);
+
++#define __in
++#define __out
++
+ WINOLEAUTAPI
+ VarI1FromUI1(
+ __in BYTE bIn,
+@@ -485,6 +488,9 @@
+ __out CHAR *pcOut
+ );
+
++#undef __in
++#undef __out
++
+ WINOLEAUTAPI VarUI2FromUI1(BYTE bIn, USHORT *puiOut);
+ WINOLEAUTAPI VarUI2FromI2(SHORT uiIn, USHORT *puiOut);
+ WINOLEAUTAPI VarUI2FromI4(LONG lIn, USHORT *puiOut);
+@@ -880,6 +886,9 @@
+ /* ICreateTypeLib */
+ /*---------------------------------------------------------------------*/
+
++typedef interface ICreateTypeLib ICreateTypeLib;
++typedef interface ICreateTypeLib2 ICreateTypeLib2;
++typedef interface ICreateTypeInfo ICreateTypeInfo;
+ typedef ICreateTypeLib * LPCREATETYPELIB;
+
+ typedef ICreateTypeInfo * LPCREATETYPEINFO;
+@@ -1068,7 +1077,7 @@
+
+ // Declare variant access functions.
+
+-#if __STDC__ || defined(NONAMELESSUNION)
++#ifdef NONAMELESSUNION
+ #define V_UNION(X, Y) ((X)->n1.n2.n3.Y)
+ #define V_VT(X) ((X)->n1.n2.vt)
+ #define V_RECORDINFO(X) ((X)->n1.n2.n3.brecVal.pRecInfo)
+--- include/oledb.h.orig 2005-04-04 18:50:18.000000000 +0900
++++ include/oledb.h 2006-04-03 06:41:04.000000000 +0900
+@@ -788,7 +788,7 @@
+
+ //@@@+ V2.0
+ #if( OLEDBVER >= 0x0200 )
+-#if !defined(_WINBASE_) && !defined(_FILETIME_)
++#if !defined(_WINBASE_H) && !defined(_FILETIME_)
+ #define _FILETIME_
+ typedef struct _FILETIME {
+ DWORD dwLowDateTime;
+--- include/propidl.h.orig 2005-04-14 17:54:56.000000000 +0900
++++ include/propidl.h 2006-04-01 08:26:46.000000000 +0900
+@@ -307,7 +307,7 @@
+ /* [case()] */ FLOAT fltVal;
+ /* [case()] */ DOUBLE dblVal;
+ /* [case()] */ VARIANT_BOOL boolVal;
+- /* [case()] */ _VARIANT_BOOL bool;
++// /* [case()] */ _VARIANT_BOOL bool;
+ /* [case()] */ SCODE scode;
+ /* [case()] */ CY cyVal;
+ /* [case()] */ DATE date;
+--- include/qedit.h.orig 2005-04-14 17:54:56.000000000 +0900
++++ include/qedit.h 2006-05-12 22:25:46.000000000 +0900
+@@ -10205,10 +10205,10 @@
+ #define DEX_IDS_GRAPH_ERROR 1427
+ #define DEX_IDS_GRID_ERROR 1428
+ #define DEX_IDS_INTERFACE_ERROR 1429
+-EXTERN_GUID(CLSID_VideoEffects1Category, 0xcc7bfb42, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+-EXTERN_GUID(CLSID_VideoEffects2Category, 0xcc7bfb43, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+-EXTERN_GUID(CLSID_AudioEffects1Category, 0xcc7bfb44, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+-EXTERN_GUID(CLSID_AudioEffects2Category, 0xcc7bfb45, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_VideoEffects1Category, 0xcc7bfb42, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_VideoEffects2Category, 0xcc7bfb43, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_AudioEffects1Category, 0xcc7bfb44, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
++DEFINE_GUID(CLSID_AudioEffects2Category, 0xcc7bfb45, 0xf175, 0x11d1, 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59);
+
+
+ extern RPC_IF_HANDLE __MIDL_itf_qedit_0495_v0_0_c_ifspec;
+--- include/shlobj.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/shlobj.h 2006-04-01 15:49:26.000000000 +0900
+@@ -1383,7 +1383,7 @@
+
+ // no POF_ flags currently defined
+
+-typedef UINT PRINTEROP_FLAGS;
++//typedef UINT PRINTEROP_FLAGS;
+
+ #endif // FO_MOVE
+
+--- include/shtypes.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/shtypes.h 2006-03-31 06:51:02.000000000 +0900
+@@ -122,7 +122,7 @@
+ } ITEMIDLIST;
+
+ #include <poppack.h>
+-typedef /* [unique] */ BYTE_BLOB *wirePIDL;
++//typedef /* [unique] */ BYTE_BLOB *wirePIDL;
+
+ typedef /* [wire_marshal] */ ITEMIDLIST __unaligned *LPITEMIDLIST;
+
+--- include/specstrings.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/specstrings.h 2005-05-25 06:42:00.000000000 +0900
+@@ -8,6 +8,8 @@
+ * *
+ \***************************************************************/
+
++#include <wchar.h>
++
+ // @@BEGIN_DDKSPLIT
+
+ // -------------------------------------------------------------------------------
+@@ -445,7 +447,7 @@
+
+ // @@END_DDKSPLIT
+
+- #define __null
++// #define __null
+ #define __notnull
+ #define __maybenull
+ #define __readonly
+--- include/strmif.h.orig 2005-04-14 17:54:58.000000000 +0900
++++ include/strmif.h 2006-04-05 19:36:02.000000000 +0900
+@@ -20566,7 +20566,7 @@
+ #define _IAMFilterGraphCallback_
+ // Note: Because this interface was not defined as a proper interface it is
+ // supported under C++ only. Methods aren't stdcall.
+-EXTERN_GUID(IID_IAMFilterGraphCallback,0x56a868fd,0x0ad4,0x11ce,0xb0,0xa3,0x0,0x20,0xaf,0x0b,0xa7,0x70);
++DEFINE_GUID(IID_IAMFilterGraphCallback,0x56a868fd,0x0ad4,0x11ce,0xb0,0xa3,0x0,0x20,0xaf,0x0b,0xa7,0x70);
+ interface IAMFilterGraphCallback : public IUnknown
+ {
+ // S_OK means rendering complete, S_FALSE means retry now.
+@@ -28962,7 +28962,7 @@
+ typedef struct tagVMRGUID
+ {
+ GUID *pGUID;
+- GUID GUID;
++ GUID aGUID;
+ } VMRGUID;
+
+ typedef struct tagVMRMONITORINFO
+--- include/wincrypt.h.orig 2005-04-14 17:55:02.000000000 +0900
++++ include/wincrypt.h 2006-03-29 00:13:26.000000000 +0900
+@@ -14713,8 +14713,8 @@
+ IN DWORD dwFlags,
+ OPTIONAL PCRYPT_KEY_PROV_INFO pKeyProvInfo,
+ OPTIONAL PCRYPT_ALGORITHM_IDENTIFIER pSignatureAlgorithm,
+- OPTIONAL PSYSTEMTIME pStartTime,
+- OPTIONAL PSYSTEMTIME pEndTime,
++ OPTIONAL LPSYSTEMTIME pStartTime,
++ OPTIONAL LPSYSTEMTIME pEndTime,
+ OPTIONAL PCERT_EXTENSIONS pExtensions
+ );
+
+--- include/wingdi.h.orig 2005-04-14 17:55:02.000000000 +0900
++++ include/wingdi.h 2006-03-31 23:27:00.000000000 +0900
+@@ -2751,7 +2751,26 @@
+ typedef FARPROC LINEDDAPROC;
+ #endif
+
+-
++#define __in
++#define __in_ecount(x)
++#define __in_bcount(x)
++#define __in_opt
++#define __in_ecount_opt(x)
++#define __in_bcount_opt(x)
++#define __out
++#define __out_ecount(x)
++#define __out_bcount(x)
++#define __out_opt
++#define __out_ecount_opt(x)
++#define __out_bcount_opt(x)
++#define __out_bcount_part_opt(x,y)
++#define __out_ecount_part_opt(x,y)
++#define __inout
++#define __inout_ecount(x)
++#define __reserved
++#define __deref_opt_out
++#define __typefix(x)
++WINGDIAPI int WINAPI FillRect(HDC,LPCRECT,HBRUSH);
+
+ WINGDIAPI int WINAPI AddFontResourceA(__in LPCSTR);
+ WINGDIAPI int WINAPI AddFontResourceW(__in LPCWSTR);
+@@ -4140,6 +4159,26 @@
+ WINGDIAPI BOOL WINAPI ColorCorrectPalette( __in HDC hdc, __in HPALETTE hPal, __in DWORD deFirst, __in DWORD num);
+ #endif
+
++#undef __in
++#undef __in_ecount(x)
++#undef __in_bcount(x)
++#undef __in_opt
++#undef __in_ecount_opt(x)
++#undef __in_bcount_opt(x)
++#undef __out
++#undef __out_ecount(x)
++#undef __out_bcount(x)
++#undef __out_opt
++#undef __out_ecount_opt(x)
++#undef __out_bcount_opt(x)
++#undef __out_bcount_part_opt(x,y)
++#undef __out_ecount_part_opt(x,y)
++#undef __inout
++#undef __inout_ecount(x)
++#undef __reserved
++#undef __deref_opt_out
++#undef __typefix(x)
++
+ #ifndef NOMETAFILE
+
+ // Enhanced metafile constants.
+--- include/winsock2.h.orig 2005-04-14 17:55:02.000000000 +0900
++++ include/winsock2.h 2006-04-08 23:36:00.000000000 +0900
+@@ -10,9 +10,9 @@
+ * conditions for redistribution.
+ */
+
+-#ifndef _WINSOCK2API_
+-#define _WINSOCK2API_
+-#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
++#ifndef _WINSOCK2_H
++#define _WINSOCK2_H
++#define _WINSOCK_H /* to prevent later inclusion of winsock.h */
+
+ /*
+ * Ensure structures are packed consistently.
+@@ -1293,10 +1293,8 @@
+ * registration (RNR) API
+ */
+
+-#ifndef _tagBLOB_DEFINED
+-#define _tagBLOB_DEFINED
+-#define _BLOB_DEFINED
+-#define _LPBLOB_DEFINED
++#ifndef __BLOB_T_DEFINED
++#define __BLOB_T_DEFINED
+ typedef struct _BLOB {
+ ULONG cbSize ;
+ #ifdef MIDL_PASS
+@@ -3858,4 +3856,4 @@
+ #include <wsipv6ok.h>
+ #endif // IPV6STRICT
+
+-#endif /* _WINSOCK2API_ */
++#endif /* _WINSOCK2_H */
+--- include/ws2tcpip.h.orig 2005-04-14 17:55:04.000000000 +0900
++++ include/ws2tcpip.h 2006-04-01 01:37:10.000000000 +0900
+@@ -396,6 +396,8 @@
+ UINT ipi_ifindex; // received interface index
+ } IN_PKTINFO;
+
++#define C_ASSERT(x)
++
+ C_ASSERT(sizeof(IN_PKTINFO) == 8);
+
+ // structure for IPV6_PKTINFO option
+--- include/wspiapi.h.orig 2005-04-14 17:55:04.000000000 +0900
++++ include/wspiapi.h 2006-05-03 12:32:14.000000000 +0900
+@@ -76,6 +76,11 @@
+
+ #ifdef __cplusplus
+ extern "C" {
++#define _inline inline
++#define __inline inline
++#else
++#define _inline static
++#define __inline static
+ #endif
+
+ ////////////////////////////////////////////////////////////
+@@ -1043,6 +1048,8 @@
+ (*pfFreeAddrInfo)(ai);
+ }
+
++#undef _inline
++#undef __inline
+ #ifdef __cplusplus
+ }
+ #endif
+--- include/adoctint.h.orig 2006-02-26 07:54:34.000000000 +0900
++++ include/adoctint.h 2006-03-11 15:18:50.000000000 +0900
+@@ -3312,11 +3312,11 @@
+ #endif /* __Procedure_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Catalog;
+ #ifdef __cplusplus
+-Catalog;
++//Catalog;
+ #endif
+ EXTERN_C const CLSID CLSID_Table;
+ #ifdef __cplusplus
+-Table;
++//Table;
+ #endif
+ #ifndef __Property_INTERFACE_DEFINED__
+ #define __Property_INTERFACE_DEFINED__
+@@ -3505,23 +3505,23 @@
+ #endif /* __Property_INTERFACE_DEFINED__ */
+ EXTERN_C const CLSID CLSID_Group;
+ #ifdef __cplusplus
+-Group;
++//Group;
+ #endif
+ EXTERN_C const CLSID CLSID_User;
+ #ifdef __cplusplus
+-User;
++//User;
+ #endif
+ EXTERN_C const CLSID CLSID_Column;
+ #ifdef __cplusplus
+-Column;
++//Column;
+ #endif
+ EXTERN_C const CLSID CLSID_Index;
+ #ifdef __cplusplus
+-Index;
++//Index;
+ #endif
+ EXTERN_C const CLSID CLSID_Key;
+ #ifdef __cplusplus
+-Key;
++//Key;
+ #endif
+ #ifndef __Tables_INTERFACE_DEFINED__
+ #define __Tables_INTERFACE_DEFINED__