View Single Post
Old 21st October 2015, 15:19   #10
xliner78
Junior Member
 
Join Date: Jun 2011
Posts: 7
Hi Anders.
Thanks for the help .
I finally found how to also edit it with php on the fly without changing the installer.exe every time.
Here is the full solution
Here is the php code you will need
code:
<?php
$txt ="mydata:testvariable";
$filename = "installer.exe";
$outputfilename = "exportedexename.exe";

header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . basename($outputfilename) . "\";" );
header("Content-Transfer-Encoding: binary");
readfile("$filename");
readfile($txt.PHP_EOL);
?>



Add this function to your script
code:
Function ReadCustomerData
; arguments
Exch $R1 ; customer data magic value
; locals
Push $1 ; file name or (later) file handle
Push $2 ; current trial offset
Push $3 ; current trial string (which will match $R1 when customer data is found)
Push $4 ; length of $R1

FileOpen $1 $EXEPATH r

; change 1024 here to, e.g., 2048 to scan the last 2Kb of EXE file
IntOp $2 0 - 1024
StrLen $4 $R1

loop:
FileSeek $1 $2 END
FileRead $1 $3 $4
StrCmp $3 $R1 found
IntOp $2 $2 + 1
IntCmp $2 0 loop loop

StrCpy $R1 ""
goto fin

found:
IntOp $2 $2 + $4
FileSeek $1 $2 END
FileRead $1 $3
StrCpy $R1 $3

fin:
Pop $4
Pop $3
Pop $2
Pop $1
Exch $R1
FunctionEnd




And to get the appended data use this
code:
Push "mydata:"
Call ReadCustomerData
Pop $R1
StrCmp $R1 "" 0 +3


Where $R1 is your appended data.
xliner78 is offline   Reply With Quote