Share Pastebin
Guest
Public paste!

bugaga

By: a guest | Jul 4th, 2009 | Syntax: Delphi | Size: 1.06 KB | Hits: 34 | Expires: Never
Copy text to clipboard
  1. {$apptype console}
  2. program CR3Info; uses DrvUnit;
  3.  
  4. var
  5.     R : cardinal = 0;
  6.     LinearAddr : cardinal = 0;
  7.  
  8. procedure SkipExcept;
  9. asm mov esp, fs:0
  10.     pop dword ptr fs:0 // restore some shit
  11.     pop ebp      // get fucking address
  12.     add ebp, 5+5 // skip jmp &call SEH fucking shit for R3
  13.     xchg ebp,[esp] // get ebp and set correct ret addr
  14. end;  
  15.  
  16. procedure R0;
  17. var i:integer;
  18.     IDT:^TIDT64;
  19.     SaveVect:array[0..$13] of int64;
  20. begin
  21.     IDT:=GetIDT();
  22.     for i:= 0 to $13 do SaveVect[i] := IDT[i];
  23.     for i:= 0 to $13 do IDT[i] := A32ToV64(@SkipExcept);
  24.  
  25. try //fs:0 prolog with offset to fucking jmp & call
  26.  
  27.     R:= pInteger(LinearAddr shr 10 + $C0000000)^;
  28.  
  29. except //a fucking jmp  @@HandleAnyException
  30. end;   //call  @@DoneExcept
  31.  
  32.     for i:= 0 to $13 do IDT[i] := SaveVect[i];
  33. end;
  34.  
  35. var i:integer;
  36.  
  37. BEGIN
  38. for i:=$0000 to $FFFFF do begin
  39.     LinearAddr := i shl 12;
  40.     CallR0(@R0);
  41.  if (R and not $FFF) =$FEC00000
  42.  then  
  43.  writeln(
  44.     'lin: ', IntToHex(LinearAddr, 8),
  45.     ' - phys; ',IntToHex(R, 8));
  46. end;
  47. end.