Documents & code‎ > ‎

Function GET_CorILMethodEHTable()

Function GET_CorILMethodEHTable()   
post id76 
post length3202 
post datetime2/9/2011 8:30:09 PM 
post ip10.10.10.254 

 


Function GET_CorILMethodEHTable()


   Receives the block of exceptions for a method 


Parameters 

    Data 
        - Assembly Data 

    cofs 
        - offset to method header 






'|------------------------------| 
'|- CorILMethod_ExeptionHTable -| 
'|------------------------------| 
<StructLayout(LayoutKind.Sequential, Pack:=1)> _ 
Public Structure EXCEPTION_NANDING_CLAUSESES 
    Public IClauses As ArrayList _ 
         , ISize As Integer 
    <StructLayout(LayoutKind.Sequential, Pack:=1)> _ 
    Public Structure EXCEPTION_NANDING_CLAUSES_SMALL 
        Dim Flags As Int16 _ 
          , TryOffset As Int16 _ 
          , TryLength As Byte _ 
          , HandlerOffset As Int16 _ 
          , HandlerLength As Byte _ 
          , ClassToken As Int32 
    End Structure 
    <StructLayout(LayoutKind.Sequential, Pack:=1)> _ 
    Public Structure EXCEPTION_NANDING_CLAUSES_FAT 
        Dim Flags _ 
          , TryOffset _ 
          , TryLength _ 
          , HandlerOffset _ 
          , HandlerLength _ 
          , ClassToken As Int32 
    End Structure 
End Structure 

Public Function GET_CorILMethodEHTable(ByRef Data As Byte(), ByVal cofs As Integer) As Object 
    ' 
    Dim Ret As [Object] _ 
         = New [EXCEPTION_NANDING_CLAUSESES] 
    ' 
    Dim Delta As Integer _ 
             = (Buffer.GetByte(Data, cofs) >> 2) + 1 
    Select Case Buffer.GetByte(Data, cofs) << 6 >> 6 
        Case 3I 
            Delta = BitConverter.ToInt32(Data, cofs + 4) + 12 
    End Select 
    ' 
    Select Case Buffer.GetByte(Data, cofs) << 3 >> 6 
        Case 3I 
            ' 
            Ret.IClauses = New ArrayList 
            cofs = RoundUp(cofs + Delta, 4) 
            Select Case Buffer.GetByte(Data, cofs) 
                Case 1UI 
                    Ret.ISize = Buffer.GetByte(Data, cofs + 1) 
                    For EID As Integer = 0 To Ret.ISize / 12 - 1 
                        Dim IClauses As EXCEPTION_NANDING_CLAUSESES.[EXCEPTION_NANDING_CLAUSES_SMALL] _ 
                                           = ReadStructure(Data, New EXCEPTION_NANDING_CLAUSESES _ 
                                            .[EXCEPTION_NANDING_CLAUSES_SMALL] _ 
                                            , cofs + 4 + (EID * 12)) 
                        Ret.IClauses.Add(IClauses) 
                    Next 
                Case 65I 
                    Ret.ISize = BitConverter.ToInt32(Data, cofs) >> 8 
                    For EID As Integer = 0 To Ret.ISize / 24 - 1 
                        Dim IClauses As EXCEPTION_NANDING_CLAUSESES.[EXCEPTION_NANDING_CLAUSES_FAT] _ 
                                           = ReadStructure(Data, New EXCEPTION_NANDING_CLAUSESES _ 
                                            .[EXCEPTION_NANDING_CLAUSES_FAT] _ 
                                            , cofs + 4 + (EID * 24)) 
                        Ret.IClauses.Add(IClauses) 
                    Next 
            End Select 
            ' 
    End Select 
    ' 
    Return Ret 
    '' 
End Function 

Comments