How Windows knows .Net EXE's?
-
Hi folks, How the windows API differenciate Normal EXE'x from the .Net EXE's, for example when you click the .Net exe file then it should be load the CLR into memory and execute the exe otherwise it never load CLR to execute. If any one knows please share with me. Advance Thanks,
friendly, ranandbe
-
Hi folks, How the windows API differenciate Normal EXE'x from the .Net EXE's, for example when you click the .Net exe file then it should be load the CLR into memory and execute the exe otherwise it never load CLR to execute. If any one knows please share with me. Advance Thanks,
friendly, ranandbe
ranandbe wrote:
How the windows API differenciate Normal EXE'x from the .Net EXE's, for example when you click the .Net exe file then it should be load the CLR into memory and execute the exe otherwise it never load CLR to execute. If any one knows please share with me.
A .NET executable contains a special CLR Header, which is only available in .NET executables. The PE (portable executable) header will redirect the OS to this section. It's worthwhile getting to know how the PE format is used and what it does.
Deja View - the feeling that you've seen this post before.
-
ranandbe wrote:
How the windows API differenciate Normal EXE'x from the .Net EXE's, for example when you click the .Net exe file then it should be load the CLR into memory and execute the exe otherwise it never load CLR to execute. If any one knows please share with me.
A .NET executable contains a special CLR Header, which is only available in .NET executables. The PE (portable executable) header will redirect the OS to this section. It's worthwhile getting to know how the PE format is used and what it does.
Deja View - the feeling that you've seen this post before.
Thank You. After you say that i go and open the EXE with ILDASM utility. It Shows the following at the program entry point. .method private hidebysig static void Main() cil managed { .entrypoint .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) // Code size 26 (0x1a) .maxstack 8 IL_0000: nop IL_0001: call void [System.Windows.Forms]System.Windows.Forms.Application::EnableVisualStyles() IL_0006: nop IL_0007: ldc.i4.0 IL_0008: call void [System.Windows.Forms] ****************************** } // end of method Program::Main What it tells?
friendly, ranandbe
-
Thank You. After you say that i go and open the EXE with ILDASM utility. It Shows the following at the program entry point. .method private hidebysig static void Main() cil managed { .entrypoint .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 ) // Code size 26 (0x1a) .maxstack 8 IL_0000: nop IL_0001: call void [System.Windows.Forms]System.Windows.Forms.Application::EnableVisualStyles() IL_0006: nop IL_0007: ldc.i4.0 IL_0008: call void [System.Windows.Forms] ****************************** } // end of method Program::Main What it tells?
friendly, ranandbe
That is is a windows forms application. However, this is not the PE header that was discussed before. This is the .NET entry point. The OS must be aware this is a .NET executable assembly already by this point.
Upcoming FREE developer events: * Glasgow: db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website