Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add file an .EXE after it is built?
Message
 
 
To
16/04/2019 09:24:39
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01668100
Message ID:
01668104
Views:
54
>>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.

Hi Rick,

Thank you for your message.
For me, first, retrieving a web content from some web site is not applicable. I work for organizations that are very strict as to not allowing the app calling internet.
So, I need to learn, if possible, how to create a VFP9 add-on program that can be run on the customer server and add a file (.dbf) to the EXE in place.

>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.

Yes, this maybe not what I can do.

Again, thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform