[comp.sys.ibm.pc] Need help with encrypted GW-BASIC files...

kawolcot@pikes.Colorado.EDU (Kenneth A. Wolcott) (05/30/90)

Hello!

Steve Pitts at the University of Colorado at Denver asked me to post a
request for help for him.  He got some software somewhere written in
GW-BASIC for his kids.  He thinks that the software could use a little
improvement -- and he'd like to enhance the code a little.  He thinks
that the GW-BASIC was saved with a ",p" option, which supposedly makes
the code unlistable (unmodifiable??) but still loadable (it is still
interpreted, not compiled)...is it possible that an older version of
MS-DOS and an older version of GW-BASIC will allow him to modify the
code?  Is there a utility which will unprotect the ",p" saved code?
He's not sure which version of GW-BASIC created the code.  (I don't
think he's totally convinced it's GW-BASIC either!)...  He's tried to
look at the file via binary read methods unsuccessfully also.  He'd
rather modify the code than to rewrite it!  He has no desire to sell or
give away the code once it is modified -- just to improve the games for
his kids...

Thanks for whatever help you can provide!

Kenneth A. Wolcott
University of Colorado at Denver
Computing Services Advising and Operations

-- 
******************************************************************************
* Kenneth A. Wolcott              kwolcott%cudnvr@ccnucd.denver.colorado.edu *
* University of Colorado at Denver        kwolcott@pikes.denver.colorado.edu *
* Computing Services Advising and Operations       BITNET: kwolcott@cudenver *

cgordon@vpnet.chi.il.us (Gordon Hlavenka) (05/31/90)

>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.

mic119y@vaxc.cc.monash.edu.au (06/04/90)

IN item 12232 of 4 June 1990, Kenneth A. Wolcott
(kwolcott@pikes.denver.colorado.edu) asked if there was a utility that would
"unprotect" a BASIC file saved with the ",p" option.
The following was published in Australian Personal Computer, volume 9, number
12, December 1988/January 1990.........

PROGRAM UNPROBAS

10 DEF SEG
20 BSAVE "UNPROBAS",1124,1
RUN

To use :
  1. Create UNPROBAS and store it with your BASIC files
  2. Get into GWBASIC
  3. Type in the following.....
   
     LOAD"FRED       (assuming the file's name is FRED.BAS
     BLOAD"UNPROBAS
     SAVE"SECRET


I have used this several times and it seems to work, I hope this helps


Tony Stott
Department of Microbiology
Monash University
Clayton 3168
Victoria
Australia

MIC119y@vaxc.cc.monash.edu.au

 

mic119y@vaxc.cc.monash.edu.au (06/05/90)

In item 12263, my answer to K.A.Wolcott's question, I just realised I made a
slight "stuff-up".

The instruction to use UNPROBAS.BAS should read

LOAD"FRED     (assuming the file's name is FRED.BAS)
BLOAD"UNPROBAS
SAVE"FRED	

not....

LOAD"FRED
BLOAD"UNPROBAS
SAVE"SECRET

Tony Stott
Department of Microbiology
Monash University
Clayton 3168
Victoria Australia

MIC119y@vaxc.cc.monash.edu.au

gharring@enprt.Wichita.NCR.COM (Gary Harrington) (06/13/90)

>>Is there a utility which will unprotect the ",p" saved code?

>Easy!  Use DEBUG to make a two-byte file . . .

>     LOAD"PROGRAM"
>     ok
>     LOAD"MAGIC"
>     ok

>The program should now be unprotected.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Wrong!  I keep seeing this method touted as the definitive way to
unprotect a protected BASIC file.  The GW-BASIC interpreter I have does
NOT allow a LOAD command after it has loaded a protected file.

Now, with this in mind, how can a protected BASIC file be unprotected?
I sure would like to see a method that would work with my BASIC.
Thank you.
---
Gary.Harrington@Wichita.NCR.COM
Wichita, KS