Path: utzoo!attcan!uunet!clyde.concordia.ca!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali!uakari.primate.wisc.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!ux1.cso.uiuc.edu!tank!gargoyle!igloo!ddsw1!obdient!vpnet!cgordon From: cgordon@vpnet.chi.il.us (Gordon Hlavenka) Newsgroups: comp.sys.ibm.pc Subject: Need help with encrypted GW-BASIC files... Keywords: MS-DOS, GW-BASIC, encryption, decryption, children's game, etc Message-ID: <266403d7-1d89.1comp.sys.ibm.pc-1@vpnet.chi.il.us> Date: 30 May 90 17:55:04 GMT References: <3837@pikes.Colorado.EDU> Lines: 47 >Is there a utility which will unprotect the ",p" saved code? Easy! Use DEBUG to make a two-byte file: C>debug -e xxxx:0100 xx:ff xx:1a -rcx cx: 0000 2 -nmagic.bas -w Writing 2 bytes -q C> This will create a file with a length of 2, the contents 0FFH 01AH. The file can be created from GWBASIC also, but some versions don't handle the length properly. It MUST be two bytes. Now load the program in question. Then load MAGIC right on top of it. LOAD"PROGRAM" ok LOAD"MAGIC" ok The program should now be unprotected. -What's happening- BASIC stores a byte in the first position of its program files to identify the file type. For normal programs this byte is 0FFH. For BSAVEd files I think it's 0FDH. For protected files the byte is 0FEH. Protected files are also stored in a different format, so just changing the byte with a file editor doesn't work. When you load the file, BASIC translates it into a meaningful format, but retains that 0FEH byte as a flag to prevent you from listing it. When you load MAGIC, you change that first byte, but nothing else. Now when you LIST, BASIC checks the type byte and sees that it's OK to list the program. As always, keep a copy of the original in a safe place until you _know_ the new stuff works right. Gordon S. Hlavenka cgordon@vpnet.chi.il.us DISCLAIMER: He's lying.