[fpc-pascal]wow quite cool example you made there :)

Harald Houppermans houppermans at home.nl
Thu Mar 18 03:35:38 CET 2004


Wow....

Did you just write this from scratch ?

That's a very cool trick you did there...

Replacing the CS ( code segment  )

And IP ( instruction pointer )

Seems like a dirty little hack lol... like a hacker could use to execute
code hehehe.

Anyway I was also wondering how to proof it...

This will proof it just fine :)

I wonder if you can also write this same example for free pascal 32 bit ?!

HEHE that will probably require a lot more code ?! :)

uses Dos, Crt;
{$F+}
var
  Int8Save: procedure;
const
  count: longint = 0;

procedure Subst;
begin
  writeln('Here we are!');
  repeat until false;
end;

procedure TimerHandler(Flags, CS, IP, AX, BX, CX, DX, SI, DI, DS, ES, BP:
Word); interrupt;
begin
  inc(count);
  asm
    pushf;
  end;
  Int8Save;
  { Uncomment the following 2 lines and see what happens. }
{
  CS := Seg(Subst);
  IP := Ofs(Subst);
}
end;

begin
  GetIntVec(8, @Int8Save);
  SetIntVec(8, Addr(TimerHandler));
  writeln('Press ANYKEY to exit');
  repeat
    write(count, '     '#13);
  until Keypressed;
  SetIntVec(8, @Int8Save);
end.

Skybuck.






More information about the fpc-pascal mailing list