开发者

Thunk and ATL Thunk?

开发者 https://www.devze.com 2023-01-08 23:54 出处:网络
Can someone explain to me what a 开发者_StackOverflowThunk is? and an ATL Thunk? I know a thunk has something to do with the vtbl and execution of code to find the right function pointer.Am I right?

Can someone explain to me what a 开发者_StackOverflowThunk is?

and an ATL Thunk?

I know a thunk has something to do with the vtbl and execution of code to find the right function pointer. Am I right?


It is a generic term for a piece of adapter code that fundamentally changes the execution environment. I saw it first being used during the 16-bit to 32-bit Windows transition, a thunk was used to allow code that was running in 16-bit mode to call 32-bit code.

Something similar for ATL thunks. It knows how to turn a Windows callback, a pure C execution environment with nothing but a window handle to distinguish the context, into a virtual method call on a class object. The thunk takes care of mapping the window handle to the ATL class instance that wraps it, and translate the message number to the corresponding virtual method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号