home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / alt / hackers / 1838 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  3.6 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!decwrl!access.usask.ca!mizar.cc.umanitoba.ca!news!buhr
  2. From: buhr@umanitoba.ca (Kevin Andrew Buhr)
  3. Newsgroups: alt.hackers
  4. Subject: Re: Why so simple?
  5. Message-ID: <BUHR.92Dec16101206@ccu.umanitoba.ca>
  6. Date: 16 Dec 92 16:12:06 GMT
  7. References: <1992Dec9.154952.9524@dcs.warwick.ac.uk>
  8.     <1992Dec10.112237.14659@neptune.inf.ethz.ch>
  9. Sender: news@ccu.umanitoba.ca
  10. Organization: University of Manitoba, Canada
  11. Lines: 95
  12. Approved: buhr@ccu.UManitoba.CA
  13. In-Reply-To: weingart@inf.ethz.ch's message of Thu, 10 Dec 1992 11:22:37 GMT
  14. Nntp-Posting-Host: ccu.umanitoba.ca
  15.  
  16. Ahhh....  This thread reminds me of a generic "gaming hack".  I've
  17. used it to cheat at Ultima 6 and debug an interesting real-time
  18. process or two.  (I used it in that big Telemate terminal emulation
  19. hack I posted a few months ago, too.)  Basically, it hooks the "Print
  20. Screen" function deep within the keyboard handler, pops a
  21. BIOS-dependent number of bytes off the stack, and generates an "INT 3"
  22. followed by an "IRET" to the point in the code where the interrupt
  23. occurred.
  24.  
  25. Typical use:
  26.  
  27.     <C:\WHEREVER> getdebug
  28.     GETDEBUG v 1.0 by Kevin Buhr
  29.  
  30.     <C:\WHEREVER> debug ultima6.exe
  31.     -g
  32.  
  33. Then, when I Shift-PrtScrn, up pops a register dump pointing at the
  34. "INT 3".  Hopping past it, I can execute the far return and get back
  35. into the code that was executing.  It's great for scanning for "secret
  36. codes" and for bypassing irritating installation routines when you
  37. want to hack something in the "middle" of a program.
  38.  
  39. Here's some generic assembler code for it, for all who are interested.
  40. Keep in mind, unless your BIOS happens to have the same stack frame
  41. mine does and stores all the registers in the same order mine does,
  42. you'll have to hack through your own BIOS and then modify it to get it
  43. to work.
  44.  
  45.     ;getdebug.8
  46.  
  47.     ;This program waits patiently for a SHIFT-PRTSC.  When
  48.     ;received, the program restores all the variables from the
  49.     ;program that was interrupted and sends interrupt 03 just
  50.     ;before its IRET.
  51.     
  52.     DOS                     equ 021h
  53.     TSR                     equ 027h
  54.     SetInterruptVector      equ 025h
  55.     PrintScreenInterrupt    equ 05h
  56.     PrintString             equ 09h
  57.     
  58.     FirstByte:      jmp MAIN
  59.     
  60.     ;This is the code called on interrupt
  61.     
  62.     NewInterrupt:   add sp,6        ;Dump 6 bytes to return to
  63.                     ;PRTSC interrupt
  64.                     pop si
  65.                     pop cx
  66.                     pop bx
  67.                     pop ds          ;es still holds keyboard
  68.                     ;routine dataseg in MY BIOS
  69.                     pop ax
  70.                     add sp,6        ;Add 6 byte return to
  71.                     ;keyboard interrupt
  72.                     mov bp,sp
  73.                     es: mov bp,[bp]
  74.                     es: mov ss,[bp+4];Restore caller's SS
  75.                     es: mov sp,[bp+2];Restore caller's SP
  76.                     es: mov byte [bp+0],0
  77.                     mov es,0070     ;Keyboard routine code segment
  78.                     es: mov [19fh],bp ;Store the keyboard's BP
  79.                     pop es          ;Recover caller's ES
  80.                     pop bp
  81.                     pop ax
  82.     
  83.                     int 3           ;invoke debug just before...
  84.                     iret            ;returning to original caller
  85.     
  86.     LastByte:
  87.     ;This is our code to change the interrupt
  88.     
  89.     MAIN:           mov dx,IntroText
  90.                     mov ah,PrintString
  91.                     int DOS
  92.     
  93.                     cli
  94.     
  95.                     mov al,PrintScreenInterrupt
  96.                     mov ah,SetInterruptVector
  97.                     mov dx,NewInterrupt
  98.                     int DOS
  99.     
  100.                     sti
  101.     
  102.                     mov dx,LastByte                 ;Last Byte plus 1
  103.                     int TSR
  104.     
  105.     IntroText:    db 'GETDEBUG v 1.0 by Kevin Buhr',0d,0a,0a,'$'
  106.  
  107.  
  108. Enjoy!
  109.  
  110. Kevin <buhr@ccu.UManitoba.CA>
  111.