HEX TO .EXE

220 views
Skip to first unread message

hherrera

unread,
Mar 9, 2023, 12:58:35 PM3/9/23
to Harbour Users
Hi friends!!
I have an idea, but I don't know if it can be done.

I have created an .exe application that generates various configuration files in text mode.
in turn I have to indicate where a small executable is and copy it.
What I dislike is having to carry an additional .exe.

If with those programs that convert from .exe to Hex I copy that information, paste it into a file and store it inside my installer, created from harbour.

 It could generate an .exe

Thanks

Henry Herrera

Brunello Pulix

unread,
Mar 9, 2023, 1:12:46 PM3/9/23
to Harbour Users
hb_Base64Decode(cFile) or UUencode-UUedecode

Brunello Pulix

hherrera

unread,
Mar 9, 2023, 2:04:54 PM3/9/23
to Harbour Users
Thanks Brunello.

Brunello Pulix

unread,
Mar 9, 2023, 3:46:49 PM3/9/23
to Harbour Users
another idea

PROCEDURE RunScript
   LOCAL cCONTENT, hHANDLE_HRB, cPRG, cHRBCODE
   LOCAL cFILE := "script.hrb", cPASSWORD := "MyPasswordKey"
   IF !FILE( cFILE )
      cPRG := ;
         "proc p()" + hb_eol() + ;
         "   SetProperty ( 'Win_Main', 'StatusBar' , 'Item' , 1 , 'Hello World!' ) " + hb_eol() + ;
         "   MsgInfo( 'Hello World!' )" + hb_eol() + ;
         "return"
      cHRBCODE := hb_compileFromBuf( cPRG, "harbour", "-n", "-w3", "-es2", "-q0" )
      MEMOWRIT( cFILE, sx_encrypt( cHRBCODE, cPASSWORD ) )
   ENDIF
   cCONTENT := sx_decrypt( MEMOREAD( cFILE ), cPASSWORD )
   hHANDLE_HRB := hb_hrbload( cCONTENT )
   hb_hrbDo( hHANDLE_HRB )
   hb_hrbunload( hHANDLE_HRB )
RETURN

Brunello Pulix

Diego F

unread,
Mar 10, 2023, 5:13:23 AM3/10/23
to Harbour Users
Hi, 

#xcommand SOURCE <(cFile)> TO <var> => ;
   #pragma __binarystreaminclude <(cFile)>|<var> := %s

FUNCTION Main()

   SOURCE "yourexe.exe" TO a
   hb_memowrit("yourexe_new.exe", a)

RETURN NIL

Diego.

hherrera

unread,
Mar 13, 2023, 1:43:18 PM3/13/23
to Harbour Users
Thanks for your answer
Reply all
Reply to author
Forward
0 new messages