On 8/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have done as the following. But what I get is RVA Value , not his
> offset :((. Can you tell me more how I can get the RVA Offset???
> *******
> Mono.Cecil.Binary.Image imgPatch =
> Mono.Cecil.Binary.Image.GetImage(strFileName);
> for (int nIndex = 0; nIndex <
> imgPatch.MetadataRoot.Streams.TablesHeap.Tables.Count;nIndex++)
> {
> if
> (imgPatch.MetadataRoot.Streams.TablesHeap.Tables[nIndex] == null)
> continue;
> if
> (imgPatch.MetadataRoot.Streams.TablesHeap.Tables[nIndex].Rows[0].ToString()
> == "Mono.Cecil.Metadata.MethodRow")
> {
> for (int nIndexRow = 0; nIndexRow <
> imgPatch.MetadataRoot.Streams.TablesHeap.Tables[nIndex].Rows.Count;
> nIndexRow++)
> {
> Mono.Cecil.Metadata.MethodRow mrTemp =
> (Mono.Cecil.Metadata.MethodRow)
> imgPatch.MetadataRoot.Streams.TablesHeap.Tables[nIndex].Rows[nIndexRow];
> mrTemp.RVA.ToString();
> }
> }
> }
outch.
Image imgPatch = Image.GetImage(strFileName);
MethodTable mt = imgPatch.MetadataRoot.Streams.TablesHeap
[MethodTable.RId] as MethodTable;
foreach (MethodRow row in mt.Rows) {
Console.WriteLine (row.RVA);
}
Image.ResolveVirtualAddress will return the offset in the file,
Image.GetReaderAtVirtualAddress will return a BinaryReader pointing to
the proper offset in the file.
--
Jb Evain <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---