[RSHELL]
[reactos.git] / lib / atl / atlwin.h
index fa5550e..7cfc38d 100644 (file)
@@ -153,21 +153,32 @@ struct thunkCode
 class CWndProcThunk
 {
 public:
-       thunkCode                                                               m_thunk;
+       thunkCode                                                               *m_pthunk;
        _AtlCreateWndData                                               cd;
 public:
+
+    CWndProcThunk()
+    {
+        m_pthunk = (thunkCode*)VirtualAlloc(NULL, sizeof(thunkCode), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+    }
+
+    ~CWndProcThunk()
+    {
+        VirtualFree(m_pthunk, 0, MEM_RELEASE);
+    }
+
        BOOL Init(WNDPROC proc, void *pThis)
        {
-               m_thunk.m_mov = 0x042444C7;
-               m_thunk.m_this = PtrToUlong(pThis);
-               m_thunk.m_jmp = 0xe9;
-               m_thunk.m_relproc = DWORD(reinterpret_cast<char *>(proc) - (reinterpret_cast<char *>(this) + sizeof(thunkCode)));
+               m_pthunk->m_mov = 0x042444C7;
+               m_pthunk->m_this = PtrToUlong(pThis);
+               m_pthunk->m_jmp = 0xe9;
+               m_pthunk->m_relproc = DWORD(reinterpret_cast<char *>(proc) - (reinterpret_cast<char *>(m_pthunk) + sizeof(thunkCode)));
                return TRUE;
        }
 
        WNDPROC GetWNDPROC()
        {
-               return reinterpret_cast<WNDPROC>(&m_thunk);
+               return reinterpret_cast<WNDPROC>(m_pthunk);
        }
 };
 
@@ -360,7 +371,7 @@ public:
        }
 };
 
-_declspec(selectany) RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 };
+__declspec(selectany) RECT CWindow::rcDefault = { CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 };
 
 template <class TBase = CWindow, class TWinTraits = CControlWinTraits>
 class CWindowImplBaseT : public TBase, public CMessageMap
@@ -585,10 +596,7 @@ public:
 
        LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
        {
-               CWindowImplBaseT<TBase, TWinTraits>     *pThis;
-
-               pThis = reinterpret_cast<CWindowImplBaseT<TBase, TWinTraits> *>(this);
-               return ::CallWindowProc(m_pfnSuperWindowProc, pThis->m_hWnd, uMsg, wParam, lParam);
+               return ::CallWindowProc(m_pfnSuperWindowProc, this->m_hWnd, uMsg, wParam, lParam);
        }
 
        BOOL SubclassWindow(HWND hWnd)
@@ -688,6 +696,10 @@ public:                                                                                                                                                                                                                                            \
                {                                                                                                                                                                                                                                       \
                case 0:
 
+#define ALT_MSG_MAP(map)                                                                                                                                               \
+            break;                                                                                                                                                             \
+        case map:
+
 #define END_MSG_MAP()                                                                                                                                                  \
                        break;                                                                                                                                                          \
                default:                                                                                                                                                                \