Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi inline assembler pointer to structure

Hi people is there a way i can access a pointer to a structure member directly from in line assembler i tried this

procedure test(eu:PImageDosHeader);assembler;
asm
    push eu._lfanew
end;

It won't compile but if i use this

procedure test(eu:Pointer); 
var   
 xx:TImageDosHeader;
 begin    
 xx:=TImageDosHeader(eu^);  
 asm
     push xx._lfanew
 end;
 end;

It works great.Any idea how can i access a structure trough a pointer in inline asm? is a matter of optimizing the code

like image 216
opc0de Avatar asked Oct 01 '11 15:10

opc0de


1 Answers

Yet another workaround:

procedure test(eu:PImageDosHeader);
asm
    push eu.TImageDosHeader._lfanew
end;
like image 80
kludg Avatar answered Oct 14 '22 21:10

kludg