function GetSIDTBaseAddress: DWORD; assembler; asm sub esp, 8 // create stack frame sidt qword ptr [esp] mov eax, dword ptr [esp+2] // write into EAX for return value add esp, 8 // clean up stack end;
… or if the sidt
opcode is unknown:
function GetSIDTBaseAddress: DWORD; assembler; asm sub esp, 8 // create stack frame { sidt qword ptr [esp] } db $0F, $01, $0C, $24 mov eax, dword ptr [esp+2] // write into EAX for return value add esp, 8 // clean up stack end;
… or, if even this fails:
function GetSIDTBaseAddress: DWORD; assembler; asm db $83, $EC, $08, $0F, $01, $0C, $24 db $8B, $44, $24, $02, $83, $C4, $08 end;
Why did I write this? No idea 😆 … someone asked in a German Delphi-forum for it and I had the answer, although I didn’t have it in Pascal/Delphi code until now. So I share it here for those who don’t speak/understand German but need this or similar code.
No copyright claimed, no liability on my side either, though!
// Oliver
PS: The ret
is inserted by FreePascal and Delphi automatically, so no worries 😉