come recuperare il codice fivewin da .c file

Moderator: Enrico Maria Giordano

come recuperare il codice fivewin da .c file

Postby lorenzoazz » Tue Jan 16, 2024 9:02 am

Buongiorno, ho sovrascritto inavvertitamente il codice di un file prg compilato con harbour e mi sono accorto di avere perso l'ultima modifica fatta con due nuove funzioni abbastanza complesse. L'unica traccia che ho è il file compilato in c dove ho la funzione in formato hb_func

E' possibile riportarle in formato prg?
Basterebbe farlo anche solo per le due funzioni "perse".

questo è l'inizio della funzione nel file lefunz.c
Code: Select all  Expand view
HB_FUNC( FKTDOPPI )
{
   static const BYTE pcode[] =
   {
    HB_P_FRAME, 6, 9,   /* locals, params */
/* 00003 */ HB_P_BASELINE, 155, 2/* 667 */
    HB_P_PUSHSTRSHORT, 9,   /* 9 */
    'D', 'o', 'm', 'e', 'n', 'i', 'c', 'a', 0,


Grazie
Lorenzo
lorenzoazz
 
Posts: 37
Joined: Mon Jun 29, 2015 7:41 am

Re: come recuperare il codice fivewin da .c file

Postby Antonio Linares » Wed Jan 17, 2024 6:46 am

Dear Lorenzo,

Please post the complete contents of lefunz.c here
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: come recuperare il codice fivewin da .c file

Postby lorenzoazz » Mon Feb 12, 2024 12:19 pm

THe file is too long 148k and i do not know how to attach a file
Thank You Antonio
Lorenzo
lorenzoazz
 
Posts: 37
Joined: Mon Jun 29, 2015 7:41 am

Re: come recuperare il codice fivewin da .c file

Postby Antonio Linares » Mon Feb 12, 2024 3:22 pm

Please upload it to https://wormhole.app/ and copy here the download url
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: come recuperare il codice fivewin da .c file

Postby lorenzoazz » Mon Feb 12, 2024 9:04 pm

lorenzoazz
 
Posts: 37
Joined: Mon Jun 29, 2015 7:41 am

Re: come recuperare il codice fivewin da .c file

Postby Antonio Linares » Mon Feb 12, 2024 9:55 pm

You can try it using chatgpt:
recover the original PRG code from this pcode: HB_FUNC( APRIDBCONPASSWORD )
{
static const BYTE pcode[] =
{
HB_P_FRAME, 0, 2, /* locals, params */
/* 00003 */ HB_P_BASELINE, 138, 0, /* 138 */
HB_P_PUSHLOCALNEAR, 2, /* PASSWORD */
HB_P_PUSHNIL,
HB_P_EXACTLYEQUAL,
HB_P_JUMPFALSENEAR, 12, /* 12 (abs: 00022) */
HB_P_PUSHSTRSHORT, 6, /* 6 */
'L', 'O', 'R', 'R', 'Y', 0,
HB_P_JUMPNEAR, 4, /* 4 (abs: 00024) */
HB_P_PUSHLOCALNEAR, 2, /* PASSWORD */
HB_P_POPLOCALNEAR, 2, /* PASSWORD */
HB_P_PUSHSYMNEAR, 1, /* SELECT */
HB_P_PUSHNIL,
HB_P_FUNCTIONSHORT, 0,
HB_P_POPVARIABLE, 2, 0, /* CD */
/* 00034 */ HB_P_LINEOFFSET, 2, /* 140 */
HB_P_PUSHSYMNEAR, 3, /* DBUSEAREA */
HB_P_PUSHNIL,
HB_P_TRUE,
HB_P_PUSHNIL,
HB_P_PUSHLOCALNEAR, 1, /* NOME */
HB_P_PUSHNIL,
HB_P_PUSHNIL,
HB_P_FALSE,
HB_P_PUSHNIL,
HB_P_DOSHORT, 7,
/* 00049 */ HB_P_LINEOFFSET, 3, /* 141 */
HB_P_PUSHSYMNEAR, 4, /* DBINFO */
HB_P_PUSHNIL,
HB_P_PUSHINT, 131, 0, /* 131 */
HB_P_PUSHLOCALNEAR, 2, /* PASSWORD */
HB_P_DOSHORT, 2,
/* 00061 */ HB_P_LINEOFFSET, 4, /* 142 */
HB_P_PUSHSYMNEAR, 5, /* DBGOTOP */
HB_P_PUSHNIL,
HB_P_DOSHORT, 0,
/* 00068 */ HB_P_LINEOFFSET, 6, /* 144 */
HB_P_PUSHSYMNEAR, 6, /* WQOUT */
HB_P_PUSHNIL,
HB_P_PUSHSYMNEAR, 7, /* FIELDNAME */
HB_P_PUSHNIL,
HB_P_ONE,
HB_P_FUNCTIONSHORT, 1,
HB_P_PUSHSTRSHORT, 4, /* 4 */
' ', '=', ' ', 0,
HB_P_PLUS,
HB_P_PUSHSYMNEAR, 8, /* CVALTOCHAR */
HB_P_PUSHNIL,
HB_P_PUSHSYMNEAR, 9, /* FIELDGET */
HB_P_PUSHNIL,
HB_P_ONE,
HB_P_FUNCTIONSHORT, 1,
HB_P_FUNCTIONSHORT, 1,
HB_P_PLUS,
HB_P_ARRAYGEN, 1, 0, /* 1 */
HB_P_DOSHORT, 1,
/* 00103 */ HB_P_LINEOFFSET, 7, /* 145 */
HB_P_PUSHSYMNEAR, 10, /* DBCLOSEAREA */
HB_P_PUSHNIL,
HB_P_DOSHORT, 0,
/* 00110 */ HB_P_LINEOFFSET, 9, /* 147 */
HB_P_PUSHSYMNEAR, 11, /* DBSELECTAREA */
HB_P_PUSHNIL,
HB_P_PUSHVARIABLE, 2, 0, /* CD */
HB_P_DOSHORT, 1,
HB_P_ENDPROC
/* 00121 */
};

hb_vmExecute( pcode, symbols, NULL );
}

Code: Select all  Expand view
PROCEDURE APRIDBCONPASSWORD( PASSWORD, NOME )
   IF PASSWORD == NIL
      PASSWORD := "LORRY"
   ENDIF
   CD := SELECT()
   DBUSEAREA( .T., CD, NOME, , , .F. )
   DBINFO( 131, PASSWORD )
   DBGOTOP()
   DO WHILE ! EOF()
      ? FIELDNAME( 1 ) + " = " + CVALTOCHAR( FIELDGET( 1 ) )
      SKIP
   ENDDO
   DBCLOSEAREA()
   DBSELECTAREA( CD )
RETURN
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: come recuperare il codice fivewin da .c file

Postby Antonio Linares » Mon Feb 12, 2024 9:58 pm

Code: Select all  Expand view
PROCEDURE BLOCCASBLOCCADBF( FILENOME, CODE )
   LNHANDLE := FOPEN( FILENOME, 1 )
   FSEEK( LNHANDLE, 0, 0 )
   FWRITE( LNHANDLE, CHR( CODE ) )
   FCLOSE( LNHANDLE )
RETURN
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: come recuperare il codice fivewin da .c file

Postby Antonio Linares » Mon Feb 12, 2024 10:01 pm

Just do it function by function :-)

Code: Select all  Expand view
PROCEDURE SALVAESEGUIPYTHON( MEMO, NOMFIL, VEDI, ASPETTA )
   IF VEDI == NIL
      VEDI := 1
   ELSE
      VEDI := VEDI
   ENDIF

   IF ASPETTA == NIL
      ASPETTA := "ASPETTARE"
   ELSE
      ASPETTA := ASPETTA
   ENDIF

   ASPETTA := TRIM(UPPER(ASPETTA))
   IF ASPETTA == "NON ASPETTARE" OR ASPETTA == "/C"
      ASPETTA := "/c"
   ELSE
      ASPETTA := "/k"
   ENDIF

   VEDI := TRIM(UPPER(VEDI))
   IF VEDI == "NON VISIBILE" OR VEDI == "0"
      VEDI := 0
   ELSE
      VEDI := 1
   ENDIF

   SALVAMEMOINFILE( MEMO, NOMFIL )
   WAITRUN( "cmd /c autopep8 --in-place --aggressive --aggressive ", NOMFIL + "0" )
   MEMOREAD( NOMFIL )
   RESTA := RIGHT(TESTO, 10)

   FRASE := ""
   X := 1
   DO WHILE X <= 10
      FRASE := FRASE + STR(ASC(SUBSTR(RESTA, X, 1))) + "-"
      X++
   ENDDO

   WAITRUN( "cmd ", ASPETTA + " python.exe ", NOMFIL + VEDI )
RETURN
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to All products support

Who is online

Users browsing this forum: No registered users and 0 guests