📄 jclmetadata.pas
字号:
protected
constructor Create(const ATable: TJclClrTable); override;
public
function DumpIL: string; override;
property ClassIdx: DWORD read FClassIdx;
property InterfaceIdx: DWORD read FInterfaceIdx;
property ImplClass: TJclClrTableRow read GetImplClass;
property ImplInterface: TJclClrTableRow read GetImplInterface;
end;
TJclClrTableInterfaceImpl = class(TJclClrTable)
private
function GetRow(const Idx: Integer): TJclClrTableInterfaceImplRow;
protected
class function TableRowClass: TJclClrTableRowClass; override;
public
property Rows[const Idx: Integer]: TJclClrTableInterfaceImplRow read GetRow; default;
end;
TJclClrTableManifestResourceVisibility = (rvPublic, rvPrivate);
TJclClrTableManifestResourceRow = class(TJclClrTableRow)
private
FOffset: DWORD;
FFlags: DWORD;
FImplementationIdx: DWORD;
FNameOffset: DWORD;
function GetName: WideString;
function GetVisibility: TJclClrTableManifestResourceVisibility;
function GetImplementationRow: TJclClrTableRow;
protected
constructor Create(const ATable: TJclClrTable); override;
public
function DumpIL: string; override;
property Offset: DWORD read FOffset;
property Flags: DWORD read FFlags;
property NameOffset: DWORD read FNameOffset;
property ImplementationIdx: DWORD read FImplementationIdx;
property Name: WideString read GetName;
property Visibility: TJclClrTableManifestResourceVisibility read GetVisibility;
property ImplementationRow: TJclClrTableRow read GetImplementationRow;
end;
TJclClrTableManifestResource = class(TJclClrTable, ITableCanDumpIL)
private
function GetRow(const Idx: Integer): TJclClrTableManifestResourceRow;
protected
class function TableRowClass: TJclClrTableRowClass; override;
public
property Rows[const Idx: Integer]: TJclClrTableManifestResourceRow read GetRow; default;
end;
TJclClrTableMemberRefRow = class(TJclClrTableRow)
private
FClassIdx: DWORD;
FNameOffset: DWORD;
FSignatureOffset: DWORD;
function GetName: WideString;
function GetSignature: TJclClrBlobRecord;
function GetParentClass: TJclClrTableRow;
function GetFullName: WideString;
protected
constructor Create(const ATable: TJclClrTable); override;
public
property ClassIdx: DWORD read FClassIdx;
property NameOffset: DWORD read FNameOffset;
property SignatureOffset: DWORD read FSignatureOffset;
property Name: WideString read GetName;
property FullName: WideString read GetFullName;
property Signature: TJclClrBlobRecord read GetSignature;
property ParentClass: TJclClrTableRow read GetParentClass;
end;
TJclClrTableMemberRef = class(TJclClrTable)
private
function GetRow(const Idx: Integer): TJclClrTableMemberRefRow;
protected
class function TableRowClass: TJclClrTableRowClass; override;
public
property Rows[const Idx: Integer]: TJclClrTableMemberRefRow read GetRow; default;
end;
TJclClrTableMethodDefRow = class;
TJclClrParamKind = (pkIn, pkOut, pkOptional, pkHasDefault, pkHasFieldMarshal);
TJclClrParamKinds = set of TJclClrParamKind;
TJclClrTableParamDefRow = class(TJclClrTableRow)
private
FFlagMask: Word;
FSequence: Word;
FNameOffset: DWORD;
FMethod: TJclClrTableMethodDefRow;
FFlags: TJclClrParamKinds;
function GetName: WideString;
protected
constructor Create(const ATable: TJclClrTable); override;
procedure SetMethod(const AMethod: TJclClrTableMethodDefRow);
public
function DumpIL: string; override;
class function ParamFlags(const AFlags: TJclClrParamKinds): Word; overload;
class function ParamFlags(const AFlags: Word): TJclClrParamKinds; overload;
property FlagMask: Word read FFlagMask;
property Sequence: Word read FSequence;
property NameOffset: DWORD read FNameOffset;
property Name: WideString read GetName;
property Method: TJclClrTableMethodDefRow read FMethod;
property Flags: TJclClrParamKinds read FFlags;
end;
TJclClrTableParamDef = class(TJclClrTable)
private
function GetRow(const Idx: Integer): TJclClrTableParamDefRow;
protected
class function TableRowClass: TJclClrTableRowClass; override;
public
property Rows[const Idx: Integer]: TJclClrTableParamDefRow read GetRow; default;
end;
TJclClrTableParamPtrRow = class(TJclClrTableRow)
private
FParamIdx: DWORD;
function GetParam: TJclClrTableParamDefRow;
protected
constructor Create(const ATable: TJclClrTable); override;
public
property ParamIdx: DWORD read FParamIdx;
property Param: TJclClrTableParamDefRow read GetParam;
end;
TJclClrTableParamPtr = class(TJclClrTable)
private
function GetRow(const Idx: Integer): TJclClrTableParamPtrRow;
protected
class function TableRowClass: TJclClrTableRowClass; override;
public
property Rows[const Idx: Integer]: TJclClrTableParamPtrRow read GetRow; default;
end;
IMAGE_COR_ILMETHOD_TINY = packed record
Flags_CodeSize: Byte;
end;
TImageCorILMethodTiny = IMAGE_COR_ILMETHOD_TINY;
PImageCorILMethodTiny = ^TImageCorILMethodTiny;
IMAGE_COR_ILMETHOD_FAT = packed record
Flags_Size,
MaxStack: Word;
CodeSize: DWORD;
LocalVarSigTok: TJclClrToken;
end;
TImageCorILMethodFat = IMAGE_COR_ILMETHOD_FAT;
PImageCorILMethodFat = ^TImageCorILMethodFat;
PImageCorILMethodHeader = ^TImageCorILMethodHeader;
TImageCorILMethodHeader = packed record
case Boolean of
True:
(Tiny: TImageCorILMethodTiny);
False:
(Fat: TImageCorILMethodFat);
end;
IMAGE_COR_ILMETHOD_SECT_SMALL = packed record
Kind: Byte;
Datasize: Byte;
Padding: Word;
end;
TImageCorILMethodSectSmall = IMAGE_COR_ILMETHOD_SECT_SMALL;
PImageCorILMethodSectSmall = ^TImageCorILMethodSectSmall;
IMAGE_COR_ILMETHOD_SECT_FAT = packed record
Kind_DataSize: DWORD;
end;
TImageCorILMethodSectFat = IMAGE_COR_ILMETHOD_SECT_FAT;
PImageCorILMethodSectFat = ^TImageCorILMethodSectFat;
PImageCorILMethodSectHeader = ^TImageCorILMethodSectHeader;
TImageCorILMethodSectHeader = packed record
case Boolean of
True:
(Small: TImageCorILMethodSectSmall);
False:
(Fat: TImageCorILMethodSectFat);
end;
IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT = packed record
Flags: DWORD;
TryOffset: DWORD;
TryLength: DWORD; // relative to start of try block
HandlerOffset: DWORD;
HandlerLength: DWORD; // relative to start of handler
case Boolean of
True:
(ClassToken: DWORD); // use for type-based exception handlers
False:
(FilterOffset: DWORD); // use for filter-based exception handlers (COR_ILEXCEPTION_FILTER is set)
end;
TImageCorILMethodSectEHClauseFat = IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT;
PImageCorILMethodSectEHClauseFat = ^TImageCorILMethodSectEHClauseFat;
IMAGE_COR_ILMETHOD_SECT_EH_FAT = packed record
SectFat: IMAGE_COR_ILMETHOD_SECT_FAT;
Clauses: array [0..MaxWord-1] of IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT; // actually variable size
end;
TImageCorILMethodSectEHFat = IMAGE_COR_ILMETHOD_SECT_EH_FAT;
PImageCorILMethodSectEHFat = ^TImageCorILMethodSectEHFat;
IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL = packed record
Flags,
TryOffset: Word;
TryLength: Byte; // relative to start of try block
HandlerOffset: Word;
HandlerLength: Byte; // relative to start of handler
case Boolean of
True:
(ClassToken: DWORD); // use for type-based exception handlers
False:
(FilterOffset: DWORD); // use for filter-based exception handlers (COR_ILEXCEPTION_FILTER is set)
end;
TImageCorILMethodSectEHClauseSmall = IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL;
PImageCorILMethodSectEHClauseSmall = ^TImageCorILMethodSectEHClauseSmall;
IMAGE_COR_ILMETHOD_SECT_EH_SMALL = packed record
SectSmall: IMAGE_COR_ILMETHOD_SECT_SMALL;
Clauses: array [0..MaxWord-1] of IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL; // actually variable size
end;
TImageCorILMethodSectEHSmall = IMAGE_COR_ILMETHOD_SECT_EH_SMALL;
PImageCorILMethodSectEHSmall = ^TImageCorILMethodSectEHSmall;
IMAGE_COR_ILMETHOD_SECT_EH = packed record
case Boolean of
True:
(Small: IMAGE_COR_ILMETHOD_SECT_EH_SMALL);
False:
(Fat: IMAGE_COR_ILMETHOD_SECT_EH_FAT);
end;
TImageCorILMethodSectEH = IMAGE_COR_ILMETHOD_SECT_EH;
PImageCorILMethodSectEH = ^TImageCorILMethodSectEH;
TJclClrCodeBlock = record
Offset: DWORD;
Length: DWORD;
end;
TJclClrExceptionClauseFlag = (cfException, cfFilter, cfFinally, cfFault);
TJclClrExceptionClauseFlags = set of TJclClrExceptionClauseFlag;
TJclClrExceptionHandler = class(TObject)
private
FFlags: DWORD;
FFilterOffset: DWORD;
FTryBlock: TJclClrCodeBlock;
FHandlerBlock: TJclClrCodeBlock;
FClassToken: TJclClrToken;
function GetFlags: TJclClrExceptionClauseFlags;
public
constructor Create(const EHClause: TImageCorILMethodSectEHClauseSmall); overload;
constructor Create(const EHClause: TImageCorILMethodSectEHClauseFat); overload;
property EHFlags: DWORD read FFlags;
property Flags: TJclClrExceptionClauseFlags read GetFlags;
property TryBlock: TJclClrCodeBlock read FTryBlock;
property HandlerBlock: TJclClrCodeBlock read FHandlerBlock;
property ClassToken: TJclClrToken read FClassToken;
property FilterOffset: DWORD read FFilterOffset;
end;
TJclClrSignature = class(TObject)
private
FBlob: TJclClrBlobRecord;
protected
function IsModifierType(const AElementType: TJclClrElementType): Boolean;
function IsPrimitiveType(const AElementType: TJclClrElementType): Boolean;
function Inc(var DataPtr: PByteArray; Step: Integer = 1): PByte;
function UncompressedDataSize(DataPtr: PByteArray): Integer;
function UncompressData(DataPtr: PByteArray; var Value: DWord): Integer;
function UncompressToken(DataPtr: PByteArray; var Token: TJclClrToken): Integer;
function UncompressCallingConv(DataPtr: PByteArray): Byte;
function UncompressSignedInt(DataPtr: PByteArray; var Value: Integer): Integer;
function UncompressElementType(DataPtr: PByteArray): TJclClrElementType;
function UncompressTypeSignature(DataPtr: PByteArray): string;
public
constructor Create(const ABlob: TJclClrBlobRecord);
function UncompressFieldSignature: string;
function ReadValue: DWORD;
function ReadByte: Byte;
function ReadInteger: Integer;
function ReadToken: TJclClrToken;
function ReadElementType: TJclClrElementType;
property Blob: TJclClrBlobRecord read FBlob;
end;
TJclClrArrayData = (adSize, adLowBound);
TJclClrArraySign = class(TJclClrSignature)
private
FBounds: array of array [TJclClrArrayData] of Integer;
public
constructor Create(const ABlob: TJclClrBlobRecord);
end;
TJclClrLocalVarFlag = (lvfPinned, lvfByRef);
TJclClrLocalVarFlags = set of TJclClrLocalVarFlag;
TJclClrLocalVar = class(TObject)
private
FElementType: TJclClrElementType;
FFlags: TJclClrLocalVarFlags;
FToken: TJclClrToken;
function GetName: WideString;
public
property ElementType: TJclClrElementType read FElementType write FElementType;
property Name: WideString read GetName;
property Flags: TJclClrLocalVarFlags read FFlags write FFlags;
property Token: TJclClrToken read FToken write FToken;
end;
TJclClrLocalVarSign = class(TJclClrSignature)
private
FLocalVars: TObjectList;
function GetLocalVar(const Idx: Integer): TJclClrLocalVar;
function GetLocalVarCount: Integer;
public
constructor Create(const ABlob: TJclClrBlobRecord);
destructor Destroy; override;
property LocalVars[const Idx: Integer]: TJclClrLocalVar read GetLocalVar;
property LocalVarCount: Integer read GetLocalVarCount;
end;
TJclClrMethodBody = class(TObject)
private
FMethod: TJclClrTableMethodDefRow;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -