Jacek Caban : atl: Allow version-based differences in struct layouts.

Alexandre Julliard julliard at winehq.org
Mon Dec 10 14:00:39 CST 2012


Module: wine
Branch: master
Commit: f1e41255e3cef650740948d0be1d81d6578cbe61
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f1e41255e3cef650740948d0be1d81d6578cbe61

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Dec 10 12:27:03 2012 +0100

atl: Allow version-based differences in struct layouts.

---

 dlls/atl/Makefile.in       |    1 +
 dlls/atl/atl_main.c        |    2 +-
 dlls/atl/tests/Makefile.in |    1 +
 dlls/atl100/Makefile.in    |    5 +++--
 dlls/atl100/atl.c          |    2 +-
 dlls/atl80/Makefile.in     |    4 +++-
 dlls/atl80/atl80.c         |    3 ++-
 dlls/kernel32/except.c     |    2 +-
 include/atlbase.h          |   26 ++++++++++++++++++++++++++
 9 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/dlls/atl/Makefile.in b/dlls/atl/Makefile.in
index 350db90..8af9e8b 100644
--- a/dlls/atl/Makefile.in
+++ b/dlls/atl/Makefile.in
@@ -1,6 +1,7 @@
 MODULE    = atl.dll
 IMPORTLIB = atl
 IMPORTS   = uuid atl100 oleaut32 ole32 user32
+EXTRADEFS = -D_ATL_VER=_ATL_VER_30
 
 C_SRCS = \
 	atl_main.c \
diff --git a/dlls/atl/atl_main.c b/dlls/atl/atl_main.c
index f215151..eee6fee 100644
--- a/dlls/atl/atl_main.c
+++ b/dlls/atl/atl_main.c
@@ -478,5 +478,5 @@ void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM)
  */
 DWORD WINAPI AtlGetVersion(void *pReserved)
 {
-   return 0x0300;
+   return _ATL_VER;
 }
diff --git a/dlls/atl/tests/Makefile.in b/dlls/atl/tests/Makefile.in
index b397c85..b573713 100644
--- a/dlls/atl/tests/Makefile.in
+++ b/dlls/atl/tests/Makefile.in
@@ -1,5 +1,6 @@
 TESTDLL   = atl.dll
 IMPORTS   = uuid atl oleaut32 ole32 rpcrt4 user32 gdi32 advapi32
+EXTRADEFS = -D_ATL_VER=_ATL_VER_30
 
 C_SRCS = \
 	atl_ax.c \
diff --git a/dlls/atl100/Makefile.in b/dlls/atl100/Makefile.in
index 65cae11..19cfcad 100644
--- a/dlls/atl100/Makefile.in
+++ b/dlls/atl100/Makefile.in
@@ -1,6 +1,7 @@
-MODULE = atl100.dll
+MODULE    = atl100.dll
 IMPORTLIB = atl100
-IMPORTS = uuid ole32 oleaut32 user32 gdi32 advapi32
+IMPORTS   = uuid ole32 oleaut32 user32 gdi32 advapi32
+EXTRADEFS = -D_ATL_VER=_ATL_VER_100
 
 C_SRCS = \
 	atl.c \
diff --git a/dlls/atl100/atl.c b/dlls/atl100/atl.c
index f1b76a5..88cdce4 100644
--- a/dlls/atl100/atl.c
+++ b/dlls/atl100/atl.c
@@ -231,5 +231,5 @@ HRESULT WINAPI AtlIPersistStreamInit_Save(LPSTREAM pStm, BOOL fClearDirty,
  */
 DWORD WINAPI AtlGetVersion(void *pReserved)
 {
-   return 0x0a00;
+   return _ATL_VER;
 }
diff --git a/dlls/atl80/Makefile.in b/dlls/atl80/Makefile.in
index c310fdb..70f416f 100644
--- a/dlls/atl80/Makefile.in
+++ b/dlls/atl80/Makefile.in
@@ -1,4 +1,6 @@
-MODULE = atl80.dll
+MODULE    = atl80.dll
+EXTRADEFS = -D_ATL_VER=_ATL_VER_80
+
 
 C_SRCS = atl80.c
 
diff --git a/dlls/atl80/atl80.c b/dlls/atl80/atl80.c
index ec9a515..b250d32 100644
--- a/dlls/atl80/atl80.c
+++ b/dlls/atl80/atl80.c
@@ -19,11 +19,12 @@
 #include <stdarg.h>
 #include "windef.h"
 #include "winbase.h"
+#include "atlbase.h"
 
 /***********************************************************************
  *           AtlGetVersion              [atl80.@]
  */
 DWORD WINAPI AtlGetVersion(void *pReserved)
 {
-   return 0x0800;
+   return _ATL_VER;
 }
diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c
index 54be105..49e5c25 100644
--- a/dlls/kernel32/except.c
+++ b/dlls/kernel32/except.c
@@ -154,7 +154,7 @@ static int format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, in
         len = snprintf( buffer, size, "Unhandled PIC return in vm86 mode");
         break;
     default:
-        len = snprintf( buffer, size, "Unhandled exception 0x%08x", rec->ExceptionCode);
+        len = snprintf( buffer, size, "Unhandled exception 0x%08x in thread %x", rec->ExceptionCode, GetCurrentThreadId());
         break;
     }
     if ((len<0) || (len>=size))
diff --git a/include/atlbase.h b/include/atlbase.h
index 4033f9a..794a099 100644
--- a/include/atlbase.h
+++ b/include/atlbase.h
@@ -23,6 +23,16 @@
 
 #include <atliface.h>
 
+/* Wine extention: we (ab)use _ATL_VER to handle truct layout differences between ATL versions. */
+#define _ATL_VER_30  0x0300
+#define _ATL_VER_70  0x0700
+#define _ATL_VER_80  0x0800
+#define _ATL_VER_100 0x0a00
+
+#ifndef _ATL_VER
+#define _ATL_VER _ATL_VER_100
+#endif
+
 typedef HRESULT (WINAPI _ATL_CREATORFUNC)(void* pv, REFIID riid, LPVOID* ppv);
 typedef HRESULT (WINAPI _ATL_CREATORARGFUNC)(void* pv, REFIID riid, LPVOID* ppv, DWORD dw);
 typedef HRESULT (WINAPI _ATL_MODULEFUNC)(DWORD dw);
@@ -31,6 +41,8 @@ typedef LPCWSTR (WINAPI _ATL_DESCRIPTIONFUNCW)(void);
 typedef const struct _ATL_CATMAP_ENTRY* (_ATL_CATMAPFUNC)(void);
 typedef void (WINAPI _ATL_TERMFUNC)(DWORD dw);
 
+typedef CRITICAL_SECTION CComCriticalSection;
+
 typedef struct _ATL_OBJMAP_ENTRYA_V1_TAG
 {
     const CLSID* pclsid;
@@ -148,6 +160,20 @@ typedef struct _ATL_MODULEW_TAG
     _ATL_TERMFUNC_ELEM* m_pTermFuncs;
 } _ATL_MODULEW;
 
+typedef struct _ATL_MODULE70
+{
+    UINT cbSize;
+    LONG m_nLockCnt;
+    _ATL_TERMFUNC_ELEM *m_pTermFuncs;
+    CComCriticalSection m_csStaticDataInitAndTypeInfo;
+} _ATL_MODULE70;
+
+#if _ATL_VER >= _ATL_VER_70
+typedef _ATL_MODULE70 _ATL_MODULE;
+#else
+typedef _ATL_MODULEW _ATL_MODULE;
+#endif
+
 typedef struct _ATL_INTMAP_ENTRY_TAG
 {
     const IID* piid;




More information about the wine-cvs mailing list