Author Topic: Binder?  (Read 9455 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Re: Binder?
« Reply #15 on: August 27, 2013, 01:24:45 AM »
You have to oxygen-compile the embeded script with the source of your runtime, so the runtime can process the embedded script. Is that what you intend?

Aurel

  • Guest
Re: Binder?
« Reply #16 on: August 27, 2013, 03:18:13 AM »
Yes .
I don't know why you talk about compiled,of course runtime will be compiled PE exe file
without dll.
So only this runtime.exe + bindedScript.txt
And of course this bindedScript must be added on the end of runtime.exe...
So that is why iask how to connect this both files,and that is why i ask for memory functions.
I hope now Charles that you understand me ;)

Charles Pegge

  • Guest
Re: Binder?
« Reply #17 on: August 27, 2013, 06:00:29 AM »
There is no provision for post-insertion of a script/token code into an exe file, So you have to use your runtime/script engine source code and compile the whole thing into one PE

JRS

  • Guest
Re: Binder?
« Reply #18 on: August 27, 2013, 10:41:51 AM »
Quote
This is what my binder written in EB do.

The only time I use the binding method with SB is if I want to use a script I wrote as part of a batch file which may require redirection and using scriba to start the script becomes problematic. The association method works best in general and I always have the option to translate (-C) my SB script to C.

« Last Edit: August 27, 2013, 06:24:17 PM by JRS »

Aurel

  • Guest
Re: Binder?
« Reply #19 on: August 27, 2013, 02:24:57 PM »
I just say that this method work...
so pleae any piece of code ?

JRS

  • Guest
Re: Binder?
« Reply #20 on: August 27, 2013, 03:12:08 PM »
Personally I think the benefit of binding isn't worth all the effort and band-aiding your doing with your interpreter. Is this feature of binding a show stopper for you?


Charles Pegge

  • Guest
Re: Binder?
« Reply #21 on: August 27, 2013, 09:28:27 PM »
Aurel, could you post some code showing what you do in 'CB / EB'.

Aurel

  • Guest
Re: Binder?
« Reply #22 on: August 28, 2013, 03:35:32 AM »
Yes Charles
What i have is old code from ionicwind forum...only
because i have lost latest binder code...
so here is CB code:
Code: [Select]
'Exe binder ,Thanks to Johnny ....
Def w1:window
DECLARE "kernel32",SetFileAttributesA(lpFileName AS STRING,dwFileAttributes AS INT),INT
CONST FILE_ATTRIBUTE_ARCHIVE = 0x20
CONST FILE_ATTRIBUTE_NORMAL = 0x80
CONST FILE_EXECUTE = 0x20
'declare variables
def runtimeExe:BFILE
def sourceCode:BFILE
def NewExe:BFILE
def membuffer:memory
def membuffer2:memory
def runtimesize:INT
def sourcesize:INT
def newsize:int
def zero:char
def sizeMembuffer:INT
def runtimeName:string
def sourceName:string
def finalSize:INT

'open window
Window w1,0,0,500,400,@minbox,0,"MainGUI",main
Setwindowcolor w1,rgb(200,200,205)

CONTROL w1,"B,LoadRuntimeExe,56,50,120,20,0,1"
Setfont w1,"MS Sans Serif",8,400,0,1
CONTROL w1,"B,LoadSourceCode,56,100,120,20,0,2"
Setfont w1,"MS Sans Serif",8,400,0,2
CONTROL w1,"B,SaveBindedExe,56,150,120,20,0,3"
Setfont w1,"MS Sans Serif",8,400,0,3
'--------------------------------------------------------
'--------------------------------------------------------
run=1
waituntil run=0
'stoptimer w1

'Free the memory in case this was allocated before ending the program
IF Len(membuffer)>0 then FreeMem membuffer
IF Len(membuffer2)>0 then FreeMem membuffer2

closewindow w1
end

'-------------------------------------------------------
Sub main
Select @class
Case @idclosewindow
run=0

'/////////////////////////////////////////////////////////
case @IDCONTROL

IF @CONTROLID = 1
    LoadRuntime()
ENDIF

IF @CONTROLID = 2
    LoadSource()
ENDIF

IF @CONTROLID = 3
    CreateExe()
ENDIF
'////////////////////////////////////////////////////////
Endselect
Return
'-------------------------------------------------------
' load Runtime to memory
SUB LoadRuntime
zero=0

IF (Openfile(runtimeExe,"C:\minGUI.exe","R") = 0)
    runtimesize = Len(runtimeExe) :'runtime=FileSize(runtimeexe)
Messagebox 0,"RuntimeLen(bytes):"+str$(runtimesize),"RUNTIME SIZE"

    AllocMem membuffer,1,runtimesize
READ(runtimeExe,membuffer)

Messagebox 0,"MEMbuffersize(bytes):"+str$(Len(membuffer)),"R-MEMBUFFER SIZE"
CloseFile runtimeExe
ENDIF

RETURN

'-----------------------------------------------------
'load Source to memory
SUB LoadSource
zero=0

IF (Openfile(sourceCode,"C:\CaptionString.abp","R") = 0)
    sourcesize = Len(sourceCode) :'sourcesize=FileSize(sourcecode)
Messagebox 0,"SourceLen(bytes):"+str$(sourcesize),"SOURCE CODE SIZE"

    AllocMem membuffer2,1,sourcesize
READ(sourceCode,membuffer2)

Messagebox 0,"CompleteLen(bytes):"+str$(LEN(membuffer2)),"MEMBUFFER-COMPLETE-SIZE"

CloseFile sourceCode
ENDIF


RETURN

'-----------------------------------------------------
'Create Exe / Write final exe to disk
SUB CreateExe
'Check first that both buffers are already filled with data before writing to a new file
IF runtimesize > 0 & sourcesize > 0
newsize = runtimesize + sourcesize
Messagebox 0,"CompleteLen(bytes):"+str$(newsize),"COMPLETE-SIZE"

IF (Openfile(newExe,"C:\MRuntime.exe","W") = 0)

Write newexe,membuffer,membuffer2
finalsize=Seek(newexe)
CloseFile newexe

Messagebox 0,"FinalLen(bytes):"+str$(finalsize),"BINDED EXE SIZE"
ENDIF
ENDIF
RETURN

Charles Pegge

  • Guest
Re: Binder?
« Reply #23 on: August 28, 2013, 03:20:21 PM »
Thanks Aurel,

It seems that this code is simply tacking the two files together, without further processing.

In Oxygen:

exe=getfile "C:\minGUI.exe"
src=getfile "C:\CaptionString.abp"
putfile "C:\MRuntime.exe",exe+src

Aurel

  • Guest
Re: Binder?
« Reply #24 on: August 29, 2013, 02:11:35 AM »
Hi Charles hmmm
this looks to simple ,infact it is simple operation but ...
ok i wil try ;)