Hello, i have a little big problem.

I have an application that needs to 'download' two exe files but i don't want to make internet connections and ...
So my application verifies the system time and should 'extract' the .exe for x64 or x86.
But i don't know how to 'embed' that 2 exes in my app.

Ex :

I have APP.EXE

and 164.exe
and 286.exe

I want an example for doing that :

When i start app.exe, my applications 'extracts' 164.exe from himself and outputs that file near him.

Please, help !

Recommended Answers

You can use something like this to turn the binaries into code, then write them out using the standard library.

If you want to get fancy with the linker, you can also …

Jump to Post

if i open with notepad the original file ( from that i obtined that .h ) and the outputed file .. they are the same.
But if i open the outputed file it is closing when i start it :|

If they're really the same, there shouldn't be any difference, …

Jump to Post

All 5 Replies

Oh goog ... i like that bin2h.
But how to transform that code ( ex myapp.h ) into .exe near my app. ?

Sorry for double :
I tried :


std::ofstream file;
file.open("ADRIAN2.EXE");

file.write( (const char*)nosize, nosize_size);
file.close();

But .... if i open with notepad the original file ( from that i obtined that .h ) and the outputed file .. they are the same.
But if i open the outputed file it is closing when i start it :|

If i make an .bat, write ADRIAN2.exe then pause ...
The console outputs :

''

C:\Users\Adrian\Documents\Visual Studio 2010\Projects\ZekProject\Release>ADRIAN2

This program cannot be run in DOS mode.

C:\Users\Adrian\DOCUME~1\VISUAL~1\Projects\ZEKPRO~1\Release>pause 1>null

''

if i open with notepad the original file ( from that i obtined that .h ) and the outputed file .. they are the same.
But if i open the outputed file it is closing when i start it :|

If they're really the same, there shouldn't be any difference, so something must have changed.

I tried :

std::ofstream file;
file.open("ADRIAN2.EXE");

file.write( (const char*)nosize, nosize_size);
file.close();

Hm. Have you tried opening the file in binary mode? You'll definitely want to do that with an executable.

Milllion of thanks ! Opening file in binary mod solved !
Thank you soo much !


[solved]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.