Merged from amd64 branch:
- add amd64 specific thunkCode
- get rid of a cast

svn path=/trunk/; revision=44950
This commit is contained in:
Timo Kreuzer 2010-01-05 17:38:03 +00:00
parent bbf8c31b35
commit 05c33f5b6b
2 changed files with 35 additions and 4 deletions

View 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()

View 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