[ATL]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 5 Jan 2010 17:38:03 +0000 (17:38 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 5 Jan 2010 17:38:03 +0000 (17:38 +0000)
Merged from amd64 branch:
- add amd64 specific thunkCode
- get rid of a cast

svn path=/trunk/; revision=44950

reactos/lib/atl/atlcom.h
reactos/lib/atl/atlwin.h

index e7e6d34..04a4521 100644 (file)
@@ -33,7 +33,7 @@ class CComEnum;
 class CComObjectRootBase
 {
 public:
-       long                                                                    m_dwRef;
+       LONG                                                                    m_dwRef;
 public:
        CComObjectRootBase()
        {
@@ -99,13 +99,13 @@ public:
        ULONG InternalAddRef()
        {
                ATLASSERT(m_dwRef >= 0);
-               return ThreadModel::Increment(reinterpret_cast<int *>(&m_dwRef));
+               return ThreadModel::Increment(&m_dwRef);
        }
 
        ULONG InternalRelease()
        {
                ATLASSERT(m_dwRef > 0);
-               return ThreadModel::Decrement(reinterpret_cast<int *>(&m_dwRef));
+               return ThreadModel::Decrement(&m_dwRef);
        }
 
        void Lock()
index 08bdbdd..c1a212b 100644 (file)
@@ -172,8 +172,39 @@ public:
        }
 };
 
+#elif _AMD64_ //WARNING: NOT VERIFIED
+#pragma pack(push,1)
+struct thunkCode
+{
+       DWORD_PTR                                                               m_mov;
+       DWORD_PTR                                                               m_this;
+       BYTE                                                                    m_jmp;
+       DWORD_PTR                                                               m_relproc;
+};
+#pragma pack(pop)
+
+class CWndProcThunk
+{
+public:
+       thunkCode                                                               m_thunk;
+       _AtlCreateWndData                                               cd;
+public:
+       BOOL Init(WNDPROC proc, void *pThis)
+       {
+               m_thunk.m_mov = 0xffff8000042444C7LL;
+               m_thunk.m_this = (DWORD_PTR)pThis;
+               m_thunk.m_jmp = 0xe9;
+               m_thunk.m_relproc = DWORD_PTR(reinterpret_cast<char *>(proc) - (reinterpret_cast<char *>(this) + sizeof(thunkCode)));
+               return TRUE;
+       }
+
+       WNDPROC GetWNDPROC()
+       {
+               return reinterpret_cast<WNDPROC>(&m_thunk);
+       }
+};
 #else
-#error Only X86 supported
+#error ARCH not supported
 #endif
 
 class CMessageMap