I2R.ru

Rambler's Top100

...

-...

...

  ! !    toodoo
  :   
...»
I2R » »

.NET CLR

Microsoft. , ( 2002) .NET FrameWork SDK . - Microsoft Visual Studio.NET ( Studio .NET, , - . ..), .NET. , - . , - . ...

MS .NET?

Microsoft .NET - , , . .NET . .NET FrameWork SDK - .NET non-dotnet . .NET WinXP. , Microsoft Win32s - Win32 Win16 . .NET FrameWork SDK - .NET , Win32s Win32. .NET FrameWork SDK .NET Common Language Runtime. .NET .

( [ ]. .)

- EXE- - . . (EXE), (DLL/OCX), (TLB), (RES) , . , , . - .

MSIL

.NET CLR. (MicroSoft Intermediate Language). C# (sample.cs): 

<------------------ ------------------> 

using System; 
class Sample { 
public static void Main () {
Console.WriteLine("Hello world");
}
} 

<------------------ ------------------> 

: CSC sample.cs sample.exe. , PE File. , "" . MSIL sample.cs. 

ILDASM.EXE MSIL. : 

<------------------ ------------------> 

___[MOD] D:\!!work\.net\sample.exe
| M A N I F E S T
|___[CLS] Sample
| | .class private auto ansi beforefieldinit
| |___[MET] method .ctor : void()
| |___[STM] method Main : void()
| 

<------------------ ------------------> 

(, , ..), (sample.il): 

<------------------ ------------------> 

assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
.ver 1:0:2411:0
}
.assembly sample
{
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module sample.exe
.imagebase 0x00400000
.subsystem 0x00000003
.file alignment 512
.corflags 0x00000001
.class private auto ansi beforefieldinit Sample
extends [mscorlib]System.Object
{
.method public hidebysig static
void Main() cil managed
{
.entrypoint
// Method begins at RVA 0x2050
// Code size 11 (0xb)
.maxstack 8
IL_0000: /* 72 | (70)000001 */ ldstr "Hello world"
IL_0005: /* 28 | (0A)000001 */ call void [mscorlib]System.Console::WriteLine(string)
IL_000a: /* 2A | */ ret
}
} 

<------------------ ------------------> 

. . "mscorlib" - , . 

, MSIL (, ) ILASM.EXE MSIL EXE: ILASM sample.il 

< >. 

? . PE File MSIL? : 

<------------------ ------------------> 

File type: WINDOWS EXECUTABLE  
File Header:
Machine: 0x014C (Intel x86)
Number of Sections: 2
Time Date Stamp: 0x3C3886C7 (6. 1. 2002 18:17:59)
Pointer to Symbol Table: 0x00000000
Number of Symbols: 0
Size of Optional Header: 0x00E0 (224)
Characteristics: 0x010E
File is executable.
Line numbers stripped from file.
Local symbols stripped from file.
32 bit word machine.  

Optional Header:
Magic: 0x010B
Linker Version: 6.00
Size of Code: 0x00000400 (1024)
Size of Initialized Data: 0x00000200 (512)
Size of Uninitialized Data: 0x00000000 (0)
Adress of Entry Point: 0x0000229E
Base of Code: 0x00002000
Base of Data: 0x00004000
Image Base: 0x00400000
Section Align: 0x00002000
File Align: 0x00000200
Operating System Version: 4.00
Image Version: 0.00
Subsystem Version: 4.00
Size of Image: 0x00006000 (24576)
Size of Headers: 0x00000200 (512)
Checksum: 0x00000000
Subsystem: 0x0003 (Windows character subsytem)
DLL Characteristics: 0x0000
Size of Stack Reserve: 0x00100000 (1048576)
Size of Stack Commit: 0x00001000 (4096)
Size of Heap Reserve: 0x00100000 (1048576)
Size of Heap Commit: 0x00001000 (4096)
Loader Flags: 0x00000000
Number of Rva and Sizes: 16 

<------------------ ------------------> 

. .

<------------------ ------------------> 

Data Directory:
Export directory: VA: 0 Size: 0
Import directory: VA: 0x00002250 Size: 0x0000004B (75)
Resource directory: VA: 0 Size: 0
Exception directory: VA: 0 Size: 0
Security directory: VA: 0 Size: 0
Base relocation table: VA: 0x00004000 Size: 0x0000000C (12)
Debug directory: VA: 0 Size: 0
Architecture-specific data: VA: 0 Size: 0
RVA of global pointer: VA: 0 Size: 0
Thread local storage directory: VA: 0 Size: 0
Load configuration directory: VA: 0 Size: 0
Bound import directory: VA: 0 Size: 0
Import address table: VA: 0x00002000 Size: 0x00000008 (8)
Delay load import descriptors: VA: 0 Size: 0
COM run-time descriptor: VA: 0x00002008 Size: 0x00000048 (72)
(unknown directory entry): VA: 0 Size: 0 

Import Table:
mscoree.dll
Import Adress Table: 0x00002000
Import Name Table: 0x00002278
Time Date Stamp: 0x00000000
Index of first forwarder reference: 0x00000000  

0x00002280 0 _CorExeMain 

Section Table:
Section Header #1
Name: .text
Virtual Size: 0x000002A4 (676)
Virtual Address: 0x00002000
Size of Raw Data: 0x00000400 (1024)
File Pointer to Raw Data: 0x00000200
File Pointer to Relocation Table: 0x00000000
File Pointer to Line Numbers: 0x00000000
Number of Relocations: 0
Number of Line Numbers: 0
Characteristics: 0x60000020
Section contains code.
Section is executable.
Section is readable. 

Section Header #2

Name: .reloc
Virtual Size: 0x0000000C (12)
Virtual Address: 0x00004000
Size of Raw Data: 0x00000200 (512)
File Pointer to Raw Data: 0x00000600
File Pointer to Relocation Table: 0x00000000
File Pointer to Line Numbers: 0x00000000
Number of Relocations: 0
Number of Line Numbers: 0
Characteristics: 0x42000040
Section contains initialized data.
Section can be discarded.
Section is readable. 

<------------------ ------------------> 

! , MSIL PE ".text". API "_CorExeMain" , 40229Eh: 

:0040229E FF2500204000 jmp [SAMPLE.00402000] 

MSCOREE.DLL. , _CorExeMain - , .  

8 ".text" _CorExeMain API, 72 CLR. (72 ). (, , ) (data directory), PE .

- , , Strong Name , CodeManager, VTableFixups , . RVA . 80- (402050h), (402010h) . 

. , . - .

, () () (402050h) - \ . , . 424A5342h ("BSJB") magic number , o ( , , ..)  

- MSIL/CLR, .  

, ? - , Microsoft . MSDN .NET , MSIL PE . - CLR, , MSIL .NET . Java, ?

Benny, wirepuller
Industrial safety

Subscribe.Ru








I2R-
I2R Business
I2R Web Creation
I2R Computer
+
2
Windows


Linux
I2R
Amicus Studio
NunDesign
 ,  MegaTIS.Ru

2000-2008 .   
.
Rambler's Top100