Visual Pro/5 (BBx) - utilidad para recuperar programas guardados con "savep"

 
Vista:
Imágen de perfil de Carlos Mendoza

utilidad para recuperar programas guardados con "savep"

Publicado por Carlos Mendoza (5 intervenciones) el 23/08/2015 12:39:26
Para aquellos programadores de BBx/Pro5 & V/Pro5 que por alguna razón han guardado sus programas con el comando "savep" y perdieron los fuentes, y para quienes no usan el comando "savep" por temor a perder los fuentes, aquí les dejo un programa para recuperaros:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
0010 REM 0010"unsavep""unprotected program""CEMS""2015/08/23,05:43AM
0020 LET Z$=STBL("unsavep",ERR=0100)
0030 IF Z$=PGM(-1) THEN GOTO 0200
0100 REM ^100
0110 REM "Determina la linea a usar
0120 BEGIN
0130 LET Z$=STBL("unsavep",PGM(-1))
0140 LET Z$="65534 if err<>21 FOR LINE=1 TO 100; LET Z$=STR(LINE:""0000"")+"" ""; SETERR 65534; EXECUTE ""edit ""+Z$+""c[""+Z$+""
0150 EXECUTE Z$
0160 LET Z$="goto 65534"+$0D0A$+"run"+$0D0A$+"load """+PGM(-1)+""""+$0D0A$+"call ""unsavep"""+$0D0A$
0170 PRINT 'FL'+"9"+CHR(LEN(Z$))+Z$,
0180 EXIT 
0200 REM ^100
0210 REM "Desproteje el programa
0220 LET Z$=STBL("unsavep","")
0230 LET C$=" "
0240 FOR Z=65 TO 90; LET C$=C$+CHR(Z); NEXT Z
0250 FOR Z=97 TO 122; LET C$=C$+CHR(Z); NEXT Z
0260 FOR Z=33 TO 64; LET C$=C$+CHR(Z); NEXT Z
0270 FOR Z=91 TO 96; LET C$=C$+CHR(Z); NEXT Z
0280 FOR Z=0 TO 31; LET C$=C$+CHR(Z); NEXT Z
0290 FOR Z=123 TO 255; LET C$=C$+CHR(Z); NEXT Z
0300 LET Z$=STBL("ch",C$)
0310 LET C=-1,L=0,CODE$="",LINE$=""
0320 LET PGM$=PGM(-1)+".unsavep"
0330 STRING PGM$,ERR=0420
0340 LET OUT=UNT; OPEN (OUT)PGM$
0350 LET LINE=65534,LINE=NUM(STBL("LINE",ERR=0360))
0360 LET Z$="????? IF C=-1 OR (C=1 AND ERR=21) THEN IF CODE$<>LINE$ THEN PRINT (OUT)CODE$ FI; LET L=L+1,C=0; IF L>65534 THEN END ELSE LET LINE$=STR(L:""0000""),CODE$=LINE$ FI FI; LET C=C+1; IF C>256 THEN LET C=-1; GOTO ????? FI; SETERR ?????; EXECUTE ""edit ""+LINE$+""c[""+CO
0370 LET Z=POS("?????"=Z$); IF Z THEN LET Z$(Z,5)=STR(LINE:"0000"); GOTO 0370
0380 EXECUTE Z$
0390 LET Z$="c$=stbl(""ch""),c=-1,l=0,out=1;goto "+STR(LINE)+$0D0A$+"run"+$0D0A$+"start"+$0D0A$+"open(9)"""+PGM(-1)+".unsavep"";merge(9)"+$0D0A$
0400 PRINT 'FL'+"9"+CHR(LEN(Z$))+Z$,
0410 EXIT
0420 ERASE PGM$; RETRY




como usar:


Desde la linea de comando ejecutar lo siguiente:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
>load "PROGRAMA_PROTEGIDO"
>
>READY
>LIST
 
!ERROR=62  (Protected program)
>call "unsavep"
.........
.........
.........
>open (9)"PROGRAMA_PROTEGIDO.unsavep";merge(9)
 
!ERROR=2   (End of File)
>
>LIST
(se listara el programa protegido!!!)...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
1
Responder

utilidad para recuperar programas guardados con "savep"

Publicado por Tania (1 intervención) el 08/02/2017 22:38:09
Hola Carlos,

Probé tu programa y funciona, aunque obtengo resultados parciales.
Mira tengo este programa:
1
2
3
4
5
6
0010 REM "test2
0020 PRINT "prueba"
0030 REM
10000 REM "parte no desencriptada
10010 PRINT "hola"
10020 STOP

Pero al ejecutar la rutina obtengo lo siguiente:
1
2
3
4
5
6
7
8
9
10
>RUN
 
0010 REM "test2
0020 PRINT "prueba"
0030 REM                            
!ERROR=43  (Mask error or overflow) 
0001 PGM=test                       
                                    
READY                               
>

El resultado es que desencripta solo hasta la línea 0030, y de la 10000 en adelante no lo hace.

Hay que hacerle alguna corrección a la rutina para que funcione más allá de la línea 10000.

Agradezco tu apoyo.

Tania
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
Imágen de perfil de Carlos

utilidad para recuperar programas guardados con "savep"

Publicado por Carlos (5 intervenciones) el 01/03/2018 03:46:34
Estimada Tania,

el !ERROR=43 puedes suprimirlo asignando a la variable de sistema SETOPTS en la posición 2 el valor $08$.

Ejemplo:

Tipea en consola los siguientes comandos antes de ejecutar tu test

1
2
3
4
>let SETOPTS$=opts,SETOPTS$(2,1)=ior(SETOPTS$(2,1),$08$); rem "ignore mask overflows
>setopts Z$
>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Carlos

utilidad para recuperar programas guardados con "savep"

Publicado por Carlos (5 intervenciones) el 01/03/2018 02:43:23
Nueva versión al mejor estilo de BASIS International Ltd,

corrige los errores comentados. 100% funcional,

Espero la disfruten!!! ;))...


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
0010 setesc ESCTRAP; seterr ERRTRAP
0020 rem " Public Routine for Unprotected Program Files <_unsavep.pub> Ver:1.0
0030 rem " Modified:  $Date: 2015/08/24 08:47:59 $
0040 rem " Copyright (C) 2015-&up INGENIX Consulting-VE.  All rights reserved.
0100 rem ^100
0110 begin 
0120 let PGM$=stbl("_unsavep.pub",err=0130); if PGM$=pgm(-1) then goto 0300
0130 let PGM$=stbl("_unsavep.pub",pgm(-1))
0200 rem ^100
0210 rem "Determina la linea a usar
0220 let CMD$="65534 if err<>21 for LINE=1 TO 65534; let Z$=str(LINE:""0000"")
0220:;       seterr 65534; execute ""edit ""+Z$+""c[""+Z$+"" ][REM ]""; next L
0220:INE else let Z$=stbl(""LINE"",str(LINE))"
0230 execute CMD$
0240 let CMD$="goto 65534"+$0D0A$+"run"+$0D0A$+"load """+pgm(-1)+""""+$0D0A$+"
0240:call """+pgm(-2)+""""+$0D0A$
0250 print 'FL'+"9"+chr(len(CMD$))+CMD$,
0260 exit
0300 rem ^100
0310 rem "Desproteje el programa
0320 gosub 9010
0330 let CMD$="????? if err=31 XCODE$=XCODE$(int(len(XCODE$)/2)+1),C=max(0,C-1
0330:) else if C=-1 or (C=1 and err=21) if CODE$<>LINE$ if pos(LINE$+"" END""=
0330:cvs(CODE$,4))=1 and pos(LINE$+"" ENDTRACE""=cvs(CODE$,4))<>1 CODE$=LINE$+
0330:"" STOP""+CODE$(len(LINE$)+5) fi; print (9)CODE$; if stbl(""VERBOSE"")=""
0330:1"" print CODE$ fi fi; L=L+1,C=0,LINE$=str(L:""0000""),CODE$=LINE$,XCODE$
0330:=CODE$,REM$=""rem "" fi fi; if L<65535 C=C+1; if L="+str(LINE)+" or C>256
0330: C=-1; goto ????? else XTBL$=TBL$(C,1); if pos(XTBL$=""[]{}"") if pos(XTB
0330:L$=""[]"") X$=""{}"" else X$=""[]"" FI FI; seterr ?????; execute ""edit "
0330:"+LINE$+""c""+X$(1,1)+XCODE$+XTBL$+X$(2,1)+X$(1,1)+REM$+X$(2,1); if pos(X
0330:TBL$=""[]{}"") XTBL$=""?""; execute ""edit ""+LINE$+""c""+X$(1,1)+XCODE$+
0330:X$(2,1)+""r""+X$(1,1)+XTBL$+X$(2,1) fi; XCODE$=XCODE$+XTBL$+REM$,CODE$=CO
0330:DE$+TBL$(C,1),REM$="""",C=0; goto ????? else Z$=""start""+$0D0A$+""open(9
0330:)"""""+pgm(-1)+".usp""""""+$0D0A$+""merge(9)""+$0D0A$; print 'FL'+""9""+c
0330:hr(len(Z$))+Z$,; end"
0340 let POS=pos("?????"=CMD$); if POS then let CMD$(POS,5)=str(LINE:"0000");
0340:goto 0340
0350 execute CMD$
0360 let CMD$="TBL$=stbl(""TBL""),C=-1,X$=""[]"";gotO "+str(LINE)+$0D0A$; rem
0360:+"run"+$0D0A$
0370 print 'FL'+"9"+chr(len(CMD$))+CMD$,
0380 exit
9000 rem 9000
9010 rem "INIT PROGRAM
9020 let TBL$=$204142434445464748494A4B4C4D4E4F505152535455565758595A616263646
9020:5666768696A6B6C6D6E6F707172737475767778797A2122232425262728292A2B2C2D2E2F
9020:303132333435363738393A3B3C3D3E3F405C5E5F60000102030405060708090A0B0C0D0E0
9020:F101112131415161718191A1B1C1D1E1F7C7E7F808182838485868788898A8B8C8D8E8F90
9020:9192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B
9020:5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9
9020:DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDF
9020:EFF5B5D7B7D$
9030 let VERBOSE$="1",VERBOSE$=stbl("VERBOSE",err=9040)
9040 let TRASH$=stbl("VERBOSE",VERBOSE$)
9050 let TRASH$=stbl("TBL",TBL$)
9060 let TRASH$=stbl("_unsavep.pub","")
9070 let LINE=65534,LINE=num(stbl("LINE",err=9080))
9080 let PGM$=pgm(-1)+".usp"
9090 string PGM$,err=9160
9100 open (9)PGM$
9110 let Z$=opts
9120 let Z$(1,1)=ior(Z$(1,1),$01$); setopts Z$; rem "LIST in lower case
9130 let Z$(2,1)=ior(Z$(2,1),$08$); setopts Z$; rem "ignore mask overflows
9140 setopts Z$
9150 return 
9160 erase PGM$; retry
9999 rem 9999
10000 rem ^100 - (esctrap) 50000-50025
10010 ESCTRAP: 
10020 let ERRMES$="User interrupt"+$0A0A$+"Do you wish to quit?"
10030 gosub ERRMES
10040 on pos(ERRTMP$="YN") goto ESCTRAP,YES_ABORT,NO_ABORT
10050 YES_ABORT: 
10060 let ABORT=1
10070 exitto EXIT
10080 NO_ABORT: 
10090 return 
10100 rem ^100 - (errtrap) 50100-50160
10110 ERRTRAP: 
10120 if err=199 then let ABORT=1; goto EXIT
10130 let ERRMES$="An error "+str(err)+" occured in"+$0A$+"program <"+pgm(-2)+
10130:"> at line "+str(tcb(5))+$0A$+"TCB(10) is "+str(tcb(10))+$0A0A$+"CR to r
10130:etry, ESC to quit:"
10140 ERRRESP: 
10150 gosub ERRMES
10160 on pos(ERRTMP$=$0D1B$) goto ERRRESP,ERR_RETRY,ERRABORT
10170 ERRABORT: 
10180 let ABORT=2
10190 goto EXIT
10200 ERR_RETRY: 
10210 retry
10300 rem ^100 - (errmes) 50600-50680
10310 ERRMES: 
10320 print 'KU',
10330 if SCR_COLS=0 then gosub SCREENINFO
10340 let ERRCOLS=0,ERRROWS=0,ERRTMP=1,ERRTMP$=ERRMES$+$0A$
10350 while ERRTMP<=len(ERRTMP$)
10360 let ERRROWS=ERRROWS+1,ERRTMP0=pos($0A$=ERRTMP$(ERRTMP)),ERRCOLS=max(ERRC
10360:OLS,ERRTMP0-1),ERRTMP=ERRTMP+ERRTMP0
10370 wend
10380 let ERRTMP0=int((SCR_COLS-ERRCOLS)/2)-4,ERRTMP1=int((SCR_ROWS-ERRROWS)/2
10380:)-2
10390 print 'CI','RB','WINDOW'(ERRTMP0,ERRTMP1,ERRCOLS+8,ERRROWS+4,""),'CS','S
10390:CROLL'(4,2,ERRCOLS+3,ERRROWS),'CH',ERRMES$," ",
10400 read record(0,siz=1)ERRTMP$
10410 let ERRTMP$=cvs(ERRTMP$,4)
10420 print 'POP',
10430 return 
10500 rem ^100 - (screeninfo) 50700-50740
10510 SCREENINFO: 
10520 let SCR_FIN$=fin(0),SCR_COLS=asc(SCR_FIN$(3)),SCR_ROWS=asc(SCR_FIN$(4)),
10520:WIN_COLS=asc(SCR_FIN$(7)),WIN_ROWS=asc(SCR_FIN$(8)),CURWIN=dec(SCR_FIN$(
10520:9,2))
10530 if SCR_ROWS=0 or SCR_COLS=0 then print "Sorry this utility will not work
10530: when BBx is in I/O mode."+$0D0A$+"I/O mode means that BBx thinks you ar
10530:e not on a terminal.  If you are on a"+$0D0A$+"terminal, be certain you
10530:have proper ALIAS for this terminal device in your"+$0D0A$+"config.bbx f
10530:ile."+$0D0A07070707$,; stop
10540 return 
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

utilidad para recuperar programas guardados con "savep"

Publicado por serock (1 intervención) el 27/03/2018 21:38:45
Hola Carlos, puede ser que no funcione con BBX4 y que solo funcione con pro5, ya que lo probé en BBX4 y no obtengo ningún resultado, desde ya muchas gracias.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
Imágen de perfil de Carlos

utilidad para recuperar programas guardados con "savep"

Publicado por Carlos (5 intervenciones) el 29/03/2018 19:14:39
Revisa la linea 360, esta contiene un rem al final, eliminalo y funcionara

la linea 360 debe quedar asi:

1
0360 let CMD$="TBL$=stbl(""TBL""),C=-1,X$=""[]"";gotO "+str(LINE)+$0D0A$+"run"+$0D0A$
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

utilidad para recuperar programas guardados con "savep"

Publicado por MALUCADA (1 intervención) el 02/06/2020 05:01:20
mil gracias, carlos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar