Hey Giannis.

How big qre the thunks ? A whole page for each of them looks like a lot of 
resources. What about a special heap ?

Keep it up!

Regards
Jérôme

Le jeudi 6 février 2014, 13:07:37 gadamopou...@svn.reactos.org a écrit :
> Author: gadamopoulos
> Date: Thu Feb  6 13:07:37 2014
> New Revision: 62011
> 
> URL: http://svn.reactos.org/svn/reactos?rev=62011&view=rev
> Log:
> [atl]
> - Fix atl thunks to be allocated in executable memory and not from the stack
> in order to run libraries that use atl (such as browseui) in windows with
> DEP enabled
> 
> Modified:
>     branches/shell-experiments/lib/atl/atlwin.h
> 
> Modified: branches/shell-experiments/lib/atl/atlwin.h
> URL:
> http://svn.reactos.org/svn/reactos/branches/shell-experiments/lib/atl/atlwi
> n.h?rev=62011&r1=62010&r2=62011&view=diff
> ===========================================================================
> === --- branches/shell-experiments/lib/atl/atlwin.h   [iso-8859-1] (original)
> +++ branches/shell-experiments/lib/atl/atlwin.h       [iso-8859-1] Thu Feb  6
> 13:07:37 2014 @@ -153,21 +153,32 @@
>  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, sizeof(thunkCode), 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);
>       }
>  };


_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to