I have four .exe files. I make a winforms application with four buttons. When you click on the button, one of the four .exe files is launched.

The difficulty is that .exe files must be inside the program. As an option, we will add the files to the program resources and when compiling we will get the application in a single file with embedded .exe files.

It is necessary to learn, when pressing one of the four buttons, to launch the corresponding .exe file. In general, use .exe directly from the resources of the program.

Unfortunately, the option of copying from file resources to a temp folder and running this file is not an option. You can not give access to these .exe files.

Please tell me how to solve this problem?

  • This is not an easy task, you can look here . In any case, it will not protect against access to exe. You can remove the dump of the running process, correct the addresses of the entry point / import table - and get the desired exe in almost its original form. - kmv
  • @kmv if they are in the resources in their original form - even it will not be necessary to run anything, they are torn out by EXE from there at a time. - Vladimir Martyanov
  • And these 4 exe - .net or native? - VladD
  • Vladimir Martyanov, I didn’t manage to launch from resources Can you tell me the code if you are 100% sure of your words - Maxim Sazhin
  • VladD mmm, .exe files are the product of the work of another application - Maxim Sazhin

2 answers 2

The solution is to write your own loader: allocate memory, decompose sections of your file into it, set up (if necessary) imports, and transfer control to the entry point.

  • no examples? so in words it's hard for me to understand what to do (( - Maxim Sazhin
  • @MaximSazhin there are examples, in trojans, in packers. If you have no idea what VirtualAlloc is, what is the format of EXE files - you won’t be able to do it anyway. - Vladimir Martyanov

Antivirals will get mad from such decisions. I will say that the task is not simple.

I'll have to dance with kernel32.dll and ntdll.dll. Once did this. But alas, Windows development is long gone.

If the applications were yours, you could organize them as a DLL file and call them from the main program. But in any case, if someone wants to get them from there, they will get them.

  • one
    what does development under windows mean in the past?) I was thinking about putting .exe into dll, but as I understood it, it was a completely wrong idea)) - Maxim Sazhin
  • one
    Only PHP remains from programming, and everywhere (at home, at work, etc. Linux). The sources are also formatted, so in the past. Yes, the idea is bad as for me. Do you want to sell other people's programs?) - Ninazu
  • I don’t understand you at all)) applications need to be written, programs are different No, not strangers)) - Maxim Sazhin
  • You thought of something extra)) I was given a 4 .exe file (everyone can run, something happens) told me to make a form with 4 buttons, clicking on which the .exe will start and the end result should be one winforms project file that runs .exe .exe themselves were created by people who asked to solve this problem for me - Maxim Sazhin
  • Moving away from the topic)) PS Does system programming bring you significant profit? This is an extremely narrow specialization, as for me, compared to promising Web and Mobile directions. Maybe in the future something else will be related to VR. Soon most applications will be in the clouds - Ninazu