Training
Certifications
Books
Special Offers
Community




 
Inside Microsoft® .NET IL Assembler
Author Serge Lidin
Pages 496
Disk 1 Companion CD(s)
Level All Levels
Published 02/06/2002
ISBN 9780735615472
ISBN-10 0-7356-1547-0
Price(USD) $49.99
To see this book's discounted price, select a reseller below.
 

More Information

About the Book
Table of Contents
Sample Chapter
Index
Related Series
Related Books
About the Author

Support: Book & CD

Rate this book
Barnes Noble Amazon Quantum Books

 

Table of Contents


    Introductionxvii
PART I   QUICK START 
1   Simple Sample 3
    Basics of the Common Language Runtime 4
    A Simple Sample 8
        Program Header 9
        Class Declaration 10
        Field Declaration 13
        Method Declaration 14
        Global Items 19
        Mapped Fields 21
        Data Declaration 22
        Value Type as Placeholder 22
        Calling Unmanaged Code 23
    Forward Declaration of Classes 25
    Summary26
2   Enhancing the Code27
    Code Retention 27
    Protecting the Code 30
    Summary36
PART II   UNDERLYING STRUCTURES 
3   The Structure of a Managed Executable File 39
    PE/COFF Headers 41
        MS-DOS Stub and PE Signature 42
        COFF Header 42
        PE Header 47
        Section Headers 53
    Common Language Runtime Header 56
        Header Structure 56
        Flags Field 58
        EntryPointToken Field 59
        VTableFixups Field 60
        StrongNameSignature Field 61
    Relocation Section 61
    Text Section 63
    Data Sections 65
        Data Constants 65
        V-Table 66
        Unmanaged Export Table 66
        Thread Local Storage 68
    Resources 70
        Unmanaged Resources 70
        Managed Resources 72
    Summary 73
4   Metadata Tables Organization 75
    What Is Metadata? 75
    Heaps and Tables 78
        Heaps 78
        General Metadata Header 79
        Metadata Table Streams 82
    RIDs and Tokens 87
        RIDs 87
        Tokens 87
        Coded Tokens 89
    Metadata Validation 93
    Summary 94
PART III   FUNDAMENTAL COMPONENTS 
5   Modules and Assemblies97
    What Is an Assembly? 97
        Private and Shared Assemblies 98
        Application Domains as Logical Units of Execution 99
    Manifest 101
        Assembly Metadata Table and Declaration 103
        AssemblyRef Metadata Table and Declaration 104
        The Loader in Search of Assemblies 107
        Module Metadata Table and Declaration 109
        ModuleRef Metadata Table and Declaration 110
        File Metadata Table and Declaration 110
        Managed Resource Metadata and Declaration 112
        ExportedType Metadata Table and Declaration 115
    Order of Manifest Declarations in ILAsm 117
    Single-Module and Multimodule Assemblies 118
    Metadata Validity Rules119
        Assembly Table Validity Rules 120
        AssemblyRef Table Validity Rules 120
        Module Table Validity Rules 121
        ModuleRef Table Validity Rules 121
        File Table Validity Rules 121
        ManifestResource Table Validity Rules 122
        ExportedType Table Validity Rules122
6   Namespaces and Classes 125
    Class Metadata 127
        TypeDef Metadata Table 128
        TypeRef Metadata Table 129
        InterfaceImpl Metadata Table 129
        NestedClass Metadata Table 130
        ClassLayout Metadata Table 130
    Namespace and Full Class Name 130
        ILAsm Naming Conventions 131
        Namespaces 132
        Full Class Names 133
    Class Attributes 135
        Flags 135
        Class References 138
        Parent of the Type 138
        Interface Implementations 139
        Class Layout Information 140
    Interfaces 140
    Value Types 141
        Boxed and Unboxed Values 142
        Instance Members of Value Types 142
        Derivation of Value Types 143
    Enumerators 143
    Delegates 144
    Nested Types 147
    Class Augmentation 149
    Metadata Validity Rules 151
        TypeDef Table Validity Rules 151
        Enumerator-Specific Validity Rules 152
        TypeRef Table Validity Rules 153
        InterfaceImpl Table Validity Rules 153
        NestedClass Table Validity Rules 154
        ClassLayout Table Validity Rules 154
7   Primitive Types and Signatures 155
    Primitive Types in the Common Language Runtime 155
        Primitive Data Types 156
        Data Pointer Types 157
        Function Pointer Types 160
        Vectors and Arrays 160
        Modifiers 162
        Native Types 165
        Variant Types 168
    Representing Classes in Signatures 170
    Signatures 171
        Calling Conventions 171
        Field Signatures 172
        Method and Property Signatures 173
        MemberRef Signatures 174
        Indirect Call Signatures 174
        Local Variables Signatures 175
        Type Specifications 175
    Signature Validity Rules 176
8   Fields and Data Constants 179
    Field Metadata 180
    Instance and Static Fields 184
    Default Values 184
    Mapped Fields 187
    Data Constants Declaration 189
    Explicit Layouts and Union Declaration 191
    Global Fields 194
    Constructors vs. Data Constants 195
    Metadata Validity Rules 198
        Field Table Validity Rules 198
        FieldLayout Table Validity Rules 199
        FieldRVA Table Validity Rules 199
        FieldMarshal Table Validity Rules 199
        Constant Table Validity Rules 200
        MemberRef Table Validity Rules 200
9   Methods 201
    Method Metadata 202
        Method Table Record Entries 202
        Method Flags 204
        Method Name 206
        Method Implementation Flags 207
        Method Parameters 208
        Referencing the Methods 210
        Method Implementation Metadata 211
    Static, Instance, Virtual Methods 212
    Explicit Method Overriding 216
    Method Header Attributes 220
    Local Variables 221
    Class Constructors 224
    Instance Constructors 224
    Instance Finalizers 226
    Variable Argument Lists 227
    Global Methods 229
    Metadata Validity Rules 230
        Method Table Validity Rules 230
        Param Table Validity Rules 232
        MethodImpl Table Validity Rules 233
PART IV   INSIDE THE EXECUTION ENGINE 
10   IL Instructions 237
    Long-Parameter and Short-Parameter Instructions 239
    Labels and Flow Control Instructions 239
        Unconditional Branching Instructions 239
        Conditional Branching Instructions 240
        Comparative Branching Instructions 240
        The switch Instruction 242
        The break Instruction 243
        SEH Block Exiting Instructions 243
        SEH Block Ending Instructions 243
        The ret Instruction 244
    Arithmetical Instructions 244
        Stack Manipulation 244
        Constant Loading 245
        Indirect Loading 246
        Indirect Storing 246
        Arithmetical Operations 247
        Overflow Arithmetical Operations 248
        Bitwise Operations 249
        Shift Operations 250
        Conversion Operations 250
        Overflow Conversion Operations 251
        Logical Condition Check Operations252
        Block Operations 253
    Addressing Arguments and Local Variables 254
        Method Argument Loading 254
        Method Argument Address Loading 254
        Method Argument Storing 255
        Method Argument List 255
        Local Variable Loading 255
        Local Variable Reference Loading 256
        Local Variable Storing 256
        Local Block Allocation 256
        Prefix Instructions 257
    Addressing Fields 257
    Calling Methods 258
        Direct Calls 259
        Indirect Calls 260
        Tail Calls 261
    Addressing Classes and Value Types 261
    Vector Instructions 265
        Vector Creation 265
        Element Address Loading 266
        Element Loading 266
        Element Storing 267
    Code Verifiability 268
11   Structured Exception Handling 271
    SEH Clause Internal Representation 272
    Types of SEH Clauses 274
    Label Form of SEH Clause Declaration 275
    Scope Form of SEH Clause Declaration 278
    Processing the Exceptions 281
    Exception Types 283
        Loader Exceptions 283
        JIT Compiler Exceptions 284
        Execution Engine Exceptions 284
        Interoperability Exceptions 286
        Subclassing the Exceptions 286
        Unmanaged Exception Mapping 287
    SEH Clause Structuring Rules 287
PART V   SPECIAL COMPONENTS 
12   Events and Properties 291
    Events and Delegates 291
    Event Metadata 294
        The Event Table 295
        The EventMap Table 296
        The MethodSemantics Table 296
    Event Declaration 297
    Property Metadata 300
        The Property Table 301
        The PropertyMap Table 302
    Property Declaration 302
    Metadata Validity Rules 304
        Event Table Validity Rules 304
        EventMap Table Validity Rules 304
        Property Table Validity Rules 304
        PropertyMap Table Validity Rules 305
        MethodSemantics Table Validity Rules 305
13   Custom Attributes 307
    Concept of a Custom Attribute 308
    CustomAttribute Metadata Table 309
    Custom Attribute Value Encoding 310
    Custom Attribute Declaration 312
    Classification of Custom Attributes 315
        Execution Engine and JIT Compiler 317
        Interoperation Subsystem 318
        Security 320
        Remoting Subsystem 322
        Visual Studio .NET Debugger 323
        Assembly Linker 323
        Common Language Specification (CLS) Compliance 325
        Pseudocustom Attributes 325
    Metadata Validity Rules 327
14   Security Attributes 329
    Declarative Security 330
    Declarative Actions 331
    Security Permissions 333
        Access Permissions 333
        Identity Permissions 338
        Custom Permissions 340
        Permission Sets 343
    Declarative Security Metadata 343
    Security Attribute Declaration 345
    Metadata Validity Rules 346
PART VI   INTEROPERATION 
15   Managed and Unmanaged Code Interoperation 349
    Thunks and Wrappers 350
        P/Invoke Thunks 351
        Implementation Map Metadata and Validity Rules 353
        IJW Thunks 353
        COM Callable Wrappers 354
        Runtime Callable Wrappers 355
    Data Marshaling 357
        Blittable Types 358
        In/Out Parameters 358
        String Marshaling 359
        Object Marshaling 361
        Class Marshaling 363
        Array Marshaling 363
        Delegate Marshaling 364
    Providing Managed Methods as Callback for Unmanaged 365
    Managed Methods as Unmanaged Exports 369
16   Multilanguage Projects 377
    IL Disassembler 378
    Principles of Round-Tripping 383
    Creative Round-Tripping 384
    Using Class Augmentation 385
    Module Linking Through Round-Tripping 386
    Compiling in Debug Mode 388
APPENDIXES 
A   IL Assembler Grammar Reference 393
    Lexical Tokens 393
    Data Type Nonterminals 393
    Identifier Nonterminals 394
    Module-Level Declarations 394
    External Source Declarations 394
    V-Table Fixup Declaration 395
    Namespace and Type Declarations 395
    Signature Type Specifications 396
    Native Type Declarations 397
    Field Declarations 399
    Data Declarations 400
    Method Header Declarations 401
    Method Body Declarations 402
    Event Declarations 404
    Property Declarations 405
    Custom Attribute Declarations 405
    Security Declarations 406
    Manifest Declarations406
B   Metadata Tables Reference 409
C   IL Instruction Set Reference421
D   IL Assembler and Disassembler Command-Line Options429
    IL Assembler429
    IL Disassembler431
        Options for Output Redirection431
        ILSAsm Code Formatting Options (PE Files Only)431
        Options for File Output (PE Files Only)432
        Options for File or Console Output (PE Files Only)432
        Metadata Summary Option433
E   Offline Verification Tool Reference435
    Error Codes and Messages437
INDEX453



Last Updated: January 22, 2002
Top of Page