Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedded a *.exe into a dll

Tags:

c#

dll

exe

does somebody know how can I embedd an exe file into a dll ?

I have a tool which is an exe file that I call from c# code.

The thing is that I want to have 1 dll containing this tool (exe file) and the dll containg my c# code.

Is it possible to embedd this exe file within the resources?

Thx in advance

like image 697
GillouX Avatar asked Feb 21 '09 14:02

GillouX


People also ask

Can EXE be used as DLL?

Both of these include executable code, however, DLL and EXE operate differently from one another. The EXE will create its own thread and reserve resources for it if you run it. A DLL file, on the other hand, is an in-process server, so you cannot run a DLL file on its own.

What is DLL in embedded?

A dynamic link library (DLL) is a collection of small programs that larger programs can load when needed to complete specific tasks. The small program, called a DLL file, contains instructions that help the larger program handle what may not be a core function of the original program.

What is an EXE and a DLL with an example?

EXE file is a executable file which runs in a separate process which is managed by OS. 2)DLLs are not directly executable . They are separate files containing functions that can be called by programs and other DLLs to perform computations and functions. An EXE is a program that can be executed . Ex :Windows program.


1 Answers

Sure it is. You can add any file as RC_DATA in application as resource. But I believe you will need to extract it to disk first before calling it!

Which IDE/Language you are using?

[EDIT]

Sorry! you did mention that you are using C#.

  1. Add a resource file to you application (right click application in IDE and select "Add new item".
  2. Use the toolbar in resource editor to add an existing file.
  3. Then extract the exe whenever required by calling code something like: System.IO.File.WriteAllBytes (@"C:\MyEXE\", Resource1.MyEXE);
like image 90
Hemant Avatar answered Sep 28 '22 15:09

Hemant