Jump to content
2 minutes ago, mattonfire said:

I have a EXE file that I would like to include in my project that I am not able to get the source code from, is there a way I can implement the compiled exe file into my code, then compile it all together? Sounds extremely wacky I know :P

No - sadly that is not possible. You will need a header file along with the .cpp file or a .lib library file. When you include the header file, I believe the compiler/linker searches for the library / source file with the same name, and takes only the definitions of the functions you have used in your program. An exe file cannot be parsed by the compiler/linker as it doesn't conform to the above necessities. Good luck with your program! :)

Nothing to see here ;)

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284458
Share on other sites

Link to post
Share on other sites

Just now, Anand_Geforce said:

No - sadly that is not possible. You will need a header file along with the .cpp file or a .lib library file. When you include the header file, I believe the compiler/linker searches for the library / source file with the same name, and takes only the definitions of the functions you have used in your program. An exe file cannot be parsed by the compiler/linker as it doesn't conform to the above necessities. Good luck with your program! :)

Is there a way of decompiling a exe file then?

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284463
Share on other sites

Link to post
Share on other sites

8 minutes ago, mattonfire said:

Is there a way of decompiling a exe file then?

Technically yes, you can kind of do that using something called reverse-engineering using specialized software tools. But if it isn't an open-source application, it's illegal to reverse-engineer it. But if it is open-source, you can obviously get the source files from the relevant website with dignity! :)

Nothing to see here ;)

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284491
Share on other sites

Link to post
Share on other sites

Just now, Anand_Geforce said:

Technically yes, you can kind of do that using something called reverse-engineering using specialized software tools. But if it isn't an open-source application, it's illegal to reverse-engineer it. But if it is open-source, you can obviously get the source files from the relevant website with dignity! :)

Well, it said it was opensource so I was expecting a zip with C files but no.. it gave me a compiled exe file which bugged me.

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284494
Share on other sites

Link to post
Share on other sites

2 minutes ago, mattonfire said:

Well, it said it was opensource so I was expecting a zip with C files but no.. it gave me a compiled exe file which bugged me.

Can you link me to the webpage of the specific version of the product?

Nothing to see here ;)

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284504
Share on other sites

Link to post
Share on other sites

1 minute ago, Anand_Geforce said:

Can you link me to the webpage of the specific version of the product?

It was quite a while ago now but it was chromium. I got the exe I just want to make a launcher for it. So I can launch it at school without admin privilages.

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284507
Share on other sites

Link to post
Share on other sites

4 minutes ago, mattonfire said:

It was quite a while ago now but it was chromium. I got the exe I just want to make a launcher for it. So I can launch it at school without admin privilages.

Can't it be accomplished with a simple batch file? Just asking...

Nothing to see here ;)

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284524
Share on other sites

Link to post
Share on other sites

Just now, mattonfire said:

I guess, haven't tried that. I heard system() isn't good to use lots of times in one code.

It's just a little sluggish - not good for realtime applications, but is not a problem for creating launchers...

Nothing to see here ;)

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284548
Share on other sites

Link to post
Share on other sites

31 minutes ago, mattonfire said:

I have a EXE file that I would like to include in my project that I am not able to get the source code from, is there a way I can implement the compiled exe file into my code, then compile it all together? Sounds extremely wacky I know :P

It is possible. Put the entire contents of the EXE file in a char array. (Write a tool to automate this). The array will be loaded to memory when your program is loaded and all you need then is a way to execute a image in memory rather then from file.

 

It's rather complicated and I've never attempted it but it seems this guy wrote a function to do exactly that: http://www.rohitab.com/discuss/topic/31681-c-run-program-from-memory-and-not-file/

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8284557
Share on other sites

Link to post
Share on other sites

2 hours ago, Anand_Geforce said:

It's just a little sluggish - not good for realtime applications, but is not a problem for creating launchers...

Its more than a little sluggish. It's a big security risk. The application that System() attempts to launch an executable can be replaced with any executable that has the same name. So a malicious program could disguise it self as your secondary exe by simply taking its name and cause all sorts of horrible things when your application is started. 

 

TL;DR Don't use System() for anything.

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8285271
Share on other sites

Link to post
Share on other sites

10 hours ago, mattonfire said:

Alright, I'll give it a try.

Give @trag1c's post a read... system() is much more stupid than I thought. But there is also another way....

Nothing to see here ;)

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8287107
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...
On 14.8.2016 at 4:09 PM, mattonfire said:

I have a EXE file that I would like to include in my project that I am not able to get the source code from, is there a way I can implement the compiled exe file into my code, then compile it all together? Sounds extremely wacky I know :P

git clone https://chromium.googlesource.com/chromium/chromium

Link to comment
https://linustechtips.com/topic/643200-c-coding-exe-in-a-exe/#findComment-8395020
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×