asm help
Shachar Shemesh
wine-devel at shemesh.biz
Tue Nov 11 16:36:38 CST 2003
Marcus Meissner wrote:
>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
>> }
>>}
>>
>>
>
>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
>
>
>
Actually, it would be:
BOOL WINAPI
_InitCommonControlsEx(WINGS_INITCOMMONCONTROLSEX* lpInitCtrls)
{
if(!dwLPA_InitCommonControlsEx)
{
return FALSE;
} else {
return dwLPA_InitCommonControlsEx(lpInitCtrls);
}
}
The "jmp" is an optimization step, where the new function is called with
the same parameters as the old one.
I do agree with you about not using direct ASM->C conversions like this.
--
Shachar Shemesh
Open Source integration consultant
Home page & resume - http://www.shemesh.biz/
More information about the wine-devel
mailing list