estoy tratando de establecer SEH
sin utilizar try except
(Esto es para mi propio conocimiento personal para tener una mejor idea de cómo funciona SEH)estructurado manejador de excepción y Delphi
El código siguiente no funciona
type
TSeh = packed record
OldSeh:DWORD;
NewSeh:DWORD;
end;
procedure test;
begin
WriteLn('Hello from seh');
end;
var
eu:TSeh;
old_seh:DWORD;
begin
asm
mov eax,fs:[0]
mov old_seh,eax
end;
eu.OldSeh := old_seh;
eu.NewSeh := DWORD(@test);
asm
mov eax,offset eu
mov fs:[0],eax
ret //This will cause an exception because jumps on an invalid memory address
end;
end.
Pero esto hace
procedure test;
begin
WriteLn('Hello from seh');
end;
begin
asm
push offset test
push fs:[0]
mov fs:[0],esp
ret //This will cause an exception because jumps on an invalid memory address
end;
end.
¿Qué estoy haciendo mal? ¿Cuál es la diferencia entre el primer código y el segundo?
+1 por intentar algo raro. –
+1 también para intentar algo raro en Delphi y con asm – EMBarbosa