473,756 Members | 8,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difference between Portable Executable (PE) file and a Assembly

Dear All,

What is difference between Portable Executable (PE) file and a Assembly?

Thanks,
Mahesh

Nov 19 '05 #1
8 7074
PE is the name given to standard 32 bit Windows executables and defined the
structure of the .exe file format. These files contain header information,
resource and the raw machine code compiled from an applications souirce
code.

An assembly on the other hand can be a dll or exe file compiled using a .NET
compiler and actually contain pseudo assembly code called IL, or
Intermediary Language. IL was devised by Microsoft to promote cross-platform
compatibility.

When an assembly is first executed, JIT compiling (Just-in-time) is invoked
and the assembly is then compiled using platofrm specific compilers to turn
the IL into native machine code specific to the platform on which it's
running. In principle, the same assembly can run on any platform that
supports the .NET Framework and has it's own JIT compiler.

That's my understanding of it.

Ben Fidge

"suresh_C#" <su*****@discus sions.microsoft .com> wrote in message
news:03******** *************** ***********@mic rosoft.com...
Dear All,

What is difference between Portable Executable (PE) file and a Assembly?

Thanks,
Mahesh

Nov 19 '05 #2
Hi Mahesh:

PE is a file format.

An assembly is the smallest unit of deployment for .NET applications
and consist of one or more modules. These modules use the PE file
format.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 1 May 2005 12:17:05 -0700, suresh_C#
<su*****@discus sions.microsoft .com> wrote:
Dear All,

What is difference between Portable Executable (PE) file and a Assembly?

Thanks,
Mahesh


Nov 19 '05 #3

Thanks Ben, Thanks Scott.

But, following is definition of Ilasm.exe
--
When you compile managed code, the compiler converts the source code to MSIL
code. MSIL is a CPU-independent language and its code can be converted to
native code. ***You can use the Ilasm tool, Ilasm.exe, to generate a portable
executable file from the MSIL code. *** You can then run the resulting
executable file to determine the performance of your application. This
enables you to generate the MSIL code and the metadata without emitting MSIL
in the portable executable file format. In addition, Ilasm.exe does not
create intermediate object files. It also does not have a linking stage to
generate a portable executable file.
--

***You can use the Ilasm tool, Ilasm.exe, to generate a portable executable
file from the MSIL code. ***

Considering this point, I think it generates a portable executable file (
??? different file ) from the MSIL code (Assembly ???)

Am I right? If right please I don’t understand what is PE and why it is used
then.

"Scott Allen" wrote:
Hi Mahesh:

PE is a file format.

An assembly is the smallest unit of deployment for .NET applications
and consist of one or more modules. These modules use the PE file
format.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 1 May 2005 12:17:05 -0700, suresh_C#
<su*****@discus sions.microsoft .com> wrote:
Dear All,

What is difference between Portable Executable (PE) file and a Assembly?

Thanks,
Mahesh


Nov 19 '05 #4
Yes you are right, a PE executable is created from the IL. PE is the file
format used to define 32bit Windows Executables. This is the native format
used by Windows. As mentioned, your .NET assembly is first compiled to IL
which is a platform independant assembly language. This is then compiled
into the platform specific binary, which for us Windows developers is called
PE.

PE has been around since the first versions of Windows NT and all versions
of Windows since Win95 have also been made to expect that particular format
to store binary executables. Obviously, as no current processors know how to
execute IL, it needs recompiling for the processor and platform it's running
on.

For more info on the format have a look here:

http://www.wotsit.org/search.asp?page=2&s=binary

"suresh_C#" <su*****@discus sions.microsoft .com> wrote in message
news:47******** *************** ***********@mic rosoft.com...

Thanks Ben, Thanks Scott.

But, following is definition of Ilasm.exe
--
When you compile managed code, the compiler converts the source code to
MSIL
code. MSIL is a CPU-independent language and its code can be converted to
native code. ***You can use the Ilasm tool, Ilasm.exe, to generate a
portable
executable file from the MSIL code. *** You can then run the resulting
executable file to determine the performance of your application. This
enables you to generate the MSIL code and the metadata without emitting
MSIL
in the portable executable file format. In addition, Ilasm.exe does not
create intermediate object files. It also does not have a linking stage to
generate a portable executable file.
--

***You can use the Ilasm tool, Ilasm.exe, to generate a portable
executable
file from the MSIL code. ***

Considering this point, I think it generates a portable executable file (
??? different file ) from the MSIL code (Assembly ???)

Am I right? If right please I don't understand what is PE and why it is
used
then.

"Scott Allen" wrote:
Hi Mahesh:

PE is a file format.

An assembly is the smallest unit of deployment for .NET applications
and consist of one or more modules. These modules use the PE file
format.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 1 May 2005 12:17:05 -0700, suresh_C#
<su*****@discus sions.microsoft .com> wrote:
>Dear All,
>
>What is difference between Portable Executable (PE) file and a Assembly?
>
>Thanks,
>Mahesh
>
>


Nov 19 '05 #5

Thanks Ben. This is clear to me now.

I would be grateful if you answer to this question also.

I assume that JIT compiler and Ilasm.exe convert the IL code into machine
dependent code.

I knew that there are 2 tools ie JIT and one more tool [I forgot name] which
do the above. Then in .NET who uses the Ilasm.exe tool.

"Ben Fidge" wrote:
Yes you are right, a PE executable is created from the IL. PE is the file
format used to define 32bit Windows Executables. This is the native format
used by Windows. As mentioned, your .NET assembly is first compiled to IL
which is a platform independant assembly language. This is then compiled
into the platform specific binary, which for us Windows developers is called
PE.

PE has been around since the first versions of Windows NT and all versions
of Windows since Win95 have also been made to expect that particular format
to store binary executables. Obviously, as no current processors know how to
execute IL, it needs recompiling for the processor and platform it's running
on.

For more info on the format have a look here:

http://www.wotsit.org/search.asp?page=2&s=binary

"suresh_C#" <su*****@discus sions.microsoft .com> wrote in message
news:47******** *************** ***********@mic rosoft.com...

Thanks Ben, Thanks Scott.

But, following is definition of Ilasm.exe
--
When you compile managed code, the compiler converts the source code to
MSIL
code. MSIL is a CPU-independent language and its code can be converted to
native code. ***You can use the Ilasm tool, Ilasm.exe, to generate a
portable
executable file from the MSIL code. *** You can then run the resulting
executable file to determine the performance of your application. This
enables you to generate the MSIL code and the metadata without emitting
MSIL
in the portable executable file format. In addition, Ilasm.exe does not
create intermediate object files. It also does not have a linking stage to
generate a portable executable file.
--

***You can use the Ilasm tool, Ilasm.exe, to generate a portable
executable
file from the MSIL code. ***

Considering this point, I think it generates a portable executable file (
??? different file ) from the MSIL code (Assembly ???)

Am I right? If right please I don't understand what is PE and why it is
used
then.

"Scott Allen" wrote:
Hi Mahesh:

PE is a file format.

An assembly is the smallest unit of deployment for .NET applications
and consist of one or more modules. These modules use the PE file
format.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 1 May 2005 12:17:05 -0700, suresh_C#
<su*****@discus sions.microsoft .com> wrote:

>Dear All,
>
>What is difference between Portable Executable (PE) file and a Assembly?
>
>Thanks,
>Mahesh
>
>


Nov 19 '05 #6
I've never used the ILASM tool day-to-day, only for experimentation .

Referring back to the MS documentation, ILASM is a tool for vendors creating
IL generators. It allows them to concentrate on the actual renderring of IL
from their custom language compilers without the need to write an IL to
machine-code compiler.

I may be wrong but JIT may also use ILASM when compiling IL to native
machine code for the first time, but you may want to check up on this. I
certainly don't consider myself an expert on all thing IL!!

http://msdn.microsoft.com/library/de...erIlasmexe.asp
Ben
"suresh_C#" <su*****@discus sions.microsoft .com> wrote in message
news:15******** *************** ***********@mic rosoft.com...

Thanks Ben. This is clear to me now.

I would be grateful if you answer to this question also.

I assume that JIT compiler and Ilasm.exe convert the IL code into machine
dependent code.

I knew that there are 2 tools ie JIT and one more tool [I forgot name]
which
do the above. Then in .NET who uses the Ilasm.exe tool.

"Ben Fidge" wrote:
Yes you are right, a PE executable is created from the IL. PE is the file
format used to define 32bit Windows Executables. This is the native
format
used by Windows. As mentioned, your .NET assembly is first compiled to IL
which is a platform independant assembly language. This is then compiled
into the platform specific binary, which for us Windows developers is
called
PE.

PE has been around since the first versions of Windows NT and all
versions
of Windows since Win95 have also been made to expect that particular
format
to store binary executables. Obviously, as no current processors know how
to
execute IL, it needs recompiling for the processor and platform it's
running
on.

For more info on the format have a look here:

http://www.wotsit.org/search.asp?page=2&s=binary

"suresh_C#" <su*****@discus sions.microsoft .com> wrote in message
news:47******** *************** ***********@mic rosoft.com...
>
> Thanks Ben, Thanks Scott.
>
> But, following is definition of Ilasm.exe
> --
> When you compile managed code, the compiler converts the source code to
> MSIL
> code. MSIL is a CPU-independent language and its code can be converted
> to
> native code. ***You can use the Ilasm tool, Ilasm.exe, to generate a
> portable
> executable file from the MSIL code. *** You can then run the resulting
> executable file to determine the performance of your application. This
> enables you to generate the MSIL code and the metadata without emitting
> MSIL
> in the portable executable file format. In addition, Ilasm.exe does not
> create intermediate object files. It also does not have a linking stage
> to
> generate a portable executable file.
> --
>
> ***You can use the Ilasm tool, Ilasm.exe, to generate a portable
> executable
> file from the MSIL code. ***
>
> Considering this point, I think it generates a portable executable file
> (
> ??? different file ) from the MSIL code (Assembly ???)
>
> Am I right? If right please I don't understand what is PE and why it is
> used
> then.
>
>
>
> "Scott Allen" wrote:
>
>> Hi Mahesh:
>>
>> PE is a file format.
>>
>> An assembly is the smallest unit of deployment for .NET applications
>> and consist of one or more modules. These modules use the PE file
>> format.
>>
>> --
>> Scott
>> http://www.OdeToCode.com/blogs/scott/
>>
>> On Sun, 1 May 2005 12:17:05 -0700, suresh_C#
>> <su*****@discus sions.microsoft .com> wrote:
>>
>> >Dear All,
>> >
>> >What is difference between Portable Executable (PE) file and a
>> >Assembly?
>> >
>> >Thanks,
>> >Mahesh
>> >
>> >
>>
>>
>


Nov 19 '05 #7
ILASM is more of a repackaging tool. It takes IL code and packages the
code into a file in the PE format. If you wrote your own compiler that
generated MSIL, then you could use ILASM to put the MSIL into a
managed executable. ILASM doesn't generate native code.

NGEN.EXE can be used to generate native code for an assembly. I'd only
recommend using NGEN if you have a good reason to avoid JIT compiling.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sun, 1 May 2005 15:11:14 -0700, suresh_C#
<su*****@discus sions.microsoft .com> wrote:

Thanks Ben. This is clear to me now.

I would be grateful if you answer to this question also.

I assume that JIT compiler and Ilasm.exe convert the IL code into machine
dependent code.

I knew that there are 2 tools ie JIT and one more tool [I forgot name] which
do the above. Then in .NET who uses the Ilasm.exe tool.

"Ben Fidge" wrote:
Yes you are right, a PE executable is created from the IL. PE is the file
format used to define 32bit Windows Executables. This is the native format
used by Windows. As mentioned, your .NET assembly is first compiled to IL
which is a platform independant assembly language. This is then compiled
into the platform specific binary, which for us Windows developers is called
PE.

PE has been around since the first versions of Windows NT and all versions
of Windows since Win95 have also been made to expect that particular format
to store binary executables. Obviously, as no current processors know how to
execute IL, it needs recompiling for the processor and platform it's running
on.

For more info on the format have a look here:

http://www.wotsit.org/search.asp?page=2&s=binary

"suresh_C#" <su*****@discus sions.microsoft .com> wrote in message
news:47******** *************** ***********@mic rosoft.com...
>
> Thanks Ben, Thanks Scott.
>
> But, following is definition of Ilasm.exe
> --
> When you compile managed code, the compiler converts the source code to
> MSIL
> code. MSIL is a CPU-independent language and its code can be converted to
> native code. ***You can use the Ilasm tool, Ilasm.exe, to generate a
> portable
> executable file from the MSIL code. *** You can then run the resulting
> executable file to determine the performance of your application. This
> enables you to generate the MSIL code and the metadata without emitting
> MSIL
> in the portable executable file format. In addition, Ilasm.exe does not
> create intermediate object files. It also does not have a linking stage to
> generate a portable executable file.
> --
>
> ***You can use the Ilasm tool, Ilasm.exe, to generate a portable
> executable
> file from the MSIL code. ***
>
> Considering this point, I think it generates a portable executable file (
> ??? different file ) from the MSIL code (Assembly ???)
>
> Am I right? If right please I don't understand what is PE and why it is
> used
> then.
>
>
>
> "Scott Allen" wrote:
>
>> Hi Mahesh:
>>
>> PE is a file format.
>>
>> An assembly is the smallest unit of deployment for .NET applications
>> and consist of one or more modules. These modules use the PE file
>> format.
>>
>> --
>> Scott
>> http://www.OdeToCode.com/blogs/scott/
>>
>> On Sun, 1 May 2005 12:17:05 -0700, suresh_C#
>> <su*****@discus sions.microsoft .com> wrote:
>>
>> >Dear All,
>> >
>> >What is difference between Portable Executable (PE) file and a Assembly?
>> >
>> >Thanks,
>> >Mahesh
>> >
>> >
>>
>>
>



Nov 19 '05 #8
Thanks Scott, thanks Ben.

"Scott Allen" wrote:
ILASM is more of a repackaging tool. It takes IL code and packages the
code into a file in the PE format. If you wrote your own compiler that
generated MSIL, then you could use ILASM to put the MSIL into a
managed executable. ILASM doesn't generate native code.

NGEN.EXE can be used to generate native code for an assembly. I'd only
recommend using NGEN if you have a good reason to avoid JIT compiling.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sun, 1 May 2005 15:11:14 -0700, suresh_C#
<su*****@discus sions.microsoft .com> wrote:

Thanks Ben. This is clear to me now.

I would be grateful if you answer to this question also.

I assume that JIT compiler and Ilasm.exe convert the IL code into machine
dependent code.

I knew that there are 2 tools ie JIT and one more tool [I forgot name] which
do the above. Then in .NET who uses the Ilasm.exe tool.

"Ben Fidge" wrote:
Yes you are right, a PE executable is created from the IL. PE is the file
format used to define 32bit Windows Executables. This is the native format
used by Windows. As mentioned, your .NET assembly is first compiled to IL
which is a platform independant assembly language. This is then compiled
into the platform specific binary, which for us Windows developers is called
PE.

PE has been around since the first versions of Windows NT and all versions
of Windows since Win95 have also been made to expect that particular format
to store binary executables. Obviously, as no current processors know how to
execute IL, it needs recompiling for the processor and platform it's running
on.

For more info on the format have a look here:

http://www.wotsit.org/search.asp?page=2&s=binary

"suresh_C#" <su*****@discus sions.microsoft .com> wrote in message
news:47******** *************** ***********@mic rosoft.com...
>
> Thanks Ben, Thanks Scott.
>
> But, following is definition of Ilasm.exe
> --
> When you compile managed code, the compiler converts the source code to
> MSIL
> code. MSIL is a CPU-independent language and its code can be converted to
> native code. ***You can use the Ilasm tool, Ilasm.exe, to generate a
> portable
> executable file from the MSIL code. *** You can then run the resulting
> executable file to determine the performance of your application. This
> enables you to generate the MSIL code and the metadata without emitting
> MSIL
> in the portable executable file format. In addition, Ilasm.exe does not
> create intermediate object files. It also does not have a linking stage to
> generate a portable executable file.
> --
>
> ***You can use the Ilasm tool, Ilasm.exe, to generate a portable
> executable
> file from the MSIL code. ***
>
> Considering this point, I think it generates a portable executable file (
> ??? different file ) from the MSIL code (Assembly ???)
>
> Am I right? If right please I don't understand what is PE and why it is
> used
> then.
>
>
>
> "Scott Allen" wrote:
>
>> Hi Mahesh:
>>
>> PE is a file format.
>>
>> An assembly is the smallest unit of deployment for .NET applications
>> and consist of one or more modules. These modules use the PE file
>> format.
>>
>> --
>> Scott
>> http://www.OdeToCode.com/blogs/scott/
>>
>> On Sun, 1 May 2005 12:17:05 -0700, suresh_C#
>> <su*****@discus sions.microsoft .com> wrote:
>>
>> >Dear All,
>> >
>> >What is difference between Portable Executable (PE) file and a Assembly?
>> >
>> >Thanks,
>> >Mahesh
>> >
>> >
>>
>>
>


Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2228
by: Jane Doe | last post by:
Hi, I'd like to write a PHP script that opens a Windows binary file (EXE, DLL, OCX, etc.), and extracts its version number, if any. Does anyone know if a module is available to do this? Thank you JD.
9
11544
by: Eric | last post by:
Problem: -------- I'm trying to create an executable jar file. I can do so as long as I don't use the "package" statement in my source code. Once I put the package statement in I can't execute the jar file. Here is the criteria of what I am working with: ----------------------------------------------- Working directory: ------------------
4
4673
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
11
20206
by: zealot | last post by:
What is the relation/difference between a header file, dll and library?
2
13930
by: keith | last post by:
In my app, an executable (app.exe) calls functions from an assembly dll (subapp.dll). app.exe has config file: app.exe.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="configVal" value="exe config" /> </appSettings> </configuration>
2
1787
by: Bernd | last post by:
I'm stumped. I would like to create a single file executable for a vb project that also calls a c# project
2
1643
by: pooja | last post by:
what is an assembly and how does it related with portable executable in ..net architecture?
0
918
by: Renil | last post by:
Hi, I am getting an error "Cannot take the address of, get the size of, or declare a pointer to a managed type" while working with PE file reading.. I'm adding the code below byte Data = new byte; FileStream fStream = new FileStream("\\Program Files\\SmsAll\\SmsAll.exe", FileMode.Open, FileAccess.Read); fStream.Read(Data, 0, 4096); unsafe
4
2897
by: =?Utf-8?B?aWduaGVucnk=?= | last post by:
I have mixed-mode multi-file assembly of several netmodules and a dll. All are generated using c# compiler, vc++ compiler and vc++ linker from command prompt. I can browse the content of the assembly from vs.net ide and roeder's ..net reflector, but when I run a c# console project that references to the dll, it throws BadImageFormatException. I'm guessing the error probably has to do with compiler/linker option bits that are used to...
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9886
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9857
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6542
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.