asm help

Marcus Meissner marcus at jet.franken.de
Tue Nov 11 15:54:31 CST 2003


On Tue, Nov 11, 2003 at 04:51:12PM +0300, flyker wrote:
> Can anybody help me write the function for Linux :
> 
> __declspec(naked) BOOL WINAPI 
> _InitCommonControlsEx(INITCOMMONCONTROLSEX* lpInitCtrls)
> {
>    if(!dwLPA_InitCommonControlsEx)
>    {
>        __asm mov eax, 0
>        __asm ret 4
>    }
>    else
>    {
>        __asm jmp dwLPA_InitCommonControlsEx
>    }
> }
> 
> 
> May be :
> __declspec(naked) BOOL WINAPI 
> _InitCommonControlsEx(WINGS_INITCOMMONCONTROLSEX* lpInitCtrls)
> {
>    if(!dwLPA_InitCommonControlsEx)
>    {
>    __asm__ __volatile__("movl 0, %eax");
>    __asm__ __volatile__("ret");
>    }
>    else
>    {
>    __asm__ __volatile__("jmp %0" : : "q"(dwLPA_InitCommonControlsEx));
>    }
> }

Would be something like:

BOOL WINAPI 
_InitCommonControlsEx(WINGS_INITCOMMONCONTROLSEX* lpInitCtrls)
{
  if(!dwLPA_InitCommonControlsEx)
  {
   return FALSE;
  } else {
   return dwLPA_InitCommonControlsEx();
  }
}

But you shouldn't use reverse engineering like this for WINE development.

Ciao, Marcus



More information about the wine-devel mailing list