Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add file an .EXE after it is built?
Message
From
16/04/2019 09:24:39
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01668100
Message ID:
01668103
Views:
74
>Hi,
>
>Is it possible to add/include a file to an EXE file? As if the file was included at design/compile time?
>
>TIA

In traditional .exe files, yes. They use something called a resource map, which maps internal storage of data (right-click on many .exe files using 7-Zip and you'll see how it opens them up and you can extract out the files it contains within, icons, images, sometimes other files). Traditional .exe files (C/C++) allow access to those components.

VFP9 doesn't store things the same way. But, if you open up a VFP9-generated .exe in a hex editor, you can see the forms in there, the classes, the compiled .FXP programs, etc.

So if you wanted to introduce a file AFTER it's already been created, you could use a placeholder. Create a large empty file and include it in your .exe like normal, and then you can later on introduce some information into that file which gives you SUBSTR(, nStart, nLength) values to retrieve data that's added after the fact.

It's a little hacky and complex, but you can do it.

The easiest thing to do is just re-create the .exe and copy it back out to where you need it.

One thing we've done on our systems is version control. We have a tiny launcher.exe type program, which reads a database and then determines which version to run. With the age of the Internet, you could retrieve some remote web content using the "wget" command line program or a command like this (I've added spaces so LevelExtreme doesn't automatically convert it to a website URL, but ordinarily it would be a normal url without extra spaces):
c:\> cscript /nologo wget.js https : // www . remote_website . com / path / to / program.exe program.exe
And the contents of wget.js:
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();

BinStream = new ActiveXObject("ADODB.Stream");
BinStream.Type = 1;
BinStream.Open();
BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile(WScript.Arguments(1));
In doing this, you can retrieve your version.dbf file indicating what version of the .exe they should be using, and then use the local one if it hasn't been updated. If it has been updated, then retrieve the new one and launch it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform