home *** CD-ROM | disk | FTP | other *** search
/ Various Unprotection Examples / unprotect.zip / unprotect / COPYPROT / ULTIMA.UNP < prev    next >
Text File  |  1985-08-22  |  3KB  |  56 lines

  1. The copy-protection scheme used in ULTIMA II is also used by
  2. PROKEY 3.0 and several other programs. The approach I outline
  3. here works with any of these that are in COM file format. If
  4. anyone can improve it to work for EXE files PLEASE post it.
  5.   This general copy scheme uses a short sector of 256 bytes to
  6. store an essential piece of the program code. On startup, location
  7. 100H contains a JMP instruction to the code which reads this
  8. short sector. Locations 103H - 110H contain HLT instructions (hex F4).
  9. After the sector is read, its contents are overlayed onto locations
  10. 100H - 110H, replacing the dummy instruction codes. A branch to 100H
  11. then begins the actual program.
  12.    All we need to do is to stop execution after the changes are
  13. made and write down the contents of 100H - 110H; reloading the
  14. program and POKEing these changes results in an unprotected program.
  15.    Here's how its done:
  16. (1) Put PROTECTED disk in A: (you can write-protect it for safety)
  17.    and a disk containing DEBUG in B:
  18. (2) A:               Make A: the default.
  19. (3) B:DEBUG ULTIMAII.COM      (or PKLOAD.COM, LAYOUT.COM...)
  20. (4) -u 0100        Tell DEBUG to disassemble 0100-0120
  21. DEBUG responds with:
  22.   0100 JMP 88A0        (or whatever)
  23.   0103 HLT
  24.   0104 HLT             ...etc.
  25. (5) -u 88A0            Look at short-sector decrypting code.
  26. DEBUG responds with:
  27.   88A0 JMPS 88A7       Next "statements" are data locations; ignore.
  28. (6) -u 88A7            Now look for where program restarts at 100H.
  29. DEBUG responds with:
  30.   88A7 CALL 88C4
  31.   88AA CALL 892E
  32.   88AD JC 88BF      (If Carry is set, the disk is a copy. Go to DOS!)
  33. ...
  34.   88BA MOV AX,0100
  35.   88BD JMP AX         Paydirt! If you got this far, the program has
  36. ...                    written the REAL code into 0100 - 0120H.
  37. (7) -g 88BD           Tell DEBUG to run the program, stop here.
  38. (8) -d 0100 011F      Dump out the changed code.
  39. DEBUG responds with:
  40.   8C C8 05 25 07 8E D8 05-10 03 8E D0...  Two lines. WRITE DOWN for (12)
  41. (9) -q         Get out of DEBUG. You must reload to deprotect.
  42. (10) Make a copy of the disk; you can use copy *.*   Put copy in A:
  43. (11) B:DEBUG ULTIMAII.COM     load copy
  44. (12) -e 0100             Patch locations 0100 - 011F with what you
  45.                          wrote down above. Follow each entry with
  46.                          a SPACE until last entry; then hit ENTER.
  47. (13) -w               Write out new version of ULTIMAII.COM
  48. (14) -q               You've done it!
  49.  
  50.   I've been detailed because this works generally for any COM file.
  51. This method doesn't work for EXE files because while DEBUG can load
  52. relocatable modules and execute them with breakpoints (step 7 above),
  53. you cannot use debug to write an EXE file in relocatable form.
  54. Any suggestions?
  55.     L.Brenkus
  56.