Jump to content
Tuts 4 You
Sign in to follow this  
CodeExplorer

AsmPointers (source code C#)

Recommended Posts

CodeExplorer

AsmPointers (source code C#):

AsmPointers will enumerate all assemblies and modules and will eventually call
mbase.MethodHandle.GetFunctionPointer() for each method of a module.For testing purpose change in Program.cs:        /// <summary>
        /// Program entry point.
        /// </summary>
        [sTAThread]
        public static void Main(string[] args)
        {
    string target = @"D:\\ModuleToAssembly.exe";
    Assembly asm = Assembly.LoadFile(target);
    SendToJit.SendModuleToJit(asm.ManifestModule);the line
string target = @"D:\\ModuleToAssembly.exe";
shoul be changed to load your simple assembly, for testing purpose only.
And the program will only show right asm address for static methods,
I don't know why doesn't work for rest of methods.For real usage you should inject AsmPointers.exe assembly in
the target .NET process:
use SimpleManagedInjector to inject AsmPointers.exe in the target .NET process:
File name: AsmPointers.exe
Class name: AsmPointers.MyClass
Method name: MyMethod
 

Why doesn't work for non static methods is still a mistery to me!

 

AsmPointers.zip

  • Like 3

Share this post


Link to post
cob_258

I tested it and it works with non static methods (I could obtain a pointer ) 


 


I added IsStatic to logs :



Module: FileRename.exe token: 06000001 name: FileRename.Properties.Settings:get_Default address: 00BDC650 IsStatic: True
Module: FileRename.exe token: 06000002 name: FileRename.Properties.Settings:.ctor address: 00BDC658 IsStatic: False
Module: FileRename.exe token: 06000003 name: FileRename.Properties.Settings:.cctor address: 00BDC660 IsStatic: True
Module: FileRename.exe token: 06000004 name: FileRename.Properties.Resources:.ctor address: 00BDC678 IsStatic: False
Module: FileRename.exe token: 06000005 name: FileRename.Properties.Resources:get_ResourceManager address: 00BDC680 IsStatic: True
Module: FileRename.exe token: 06000006 name: FileRename.Properties.Resources:get_Culture address: 00BDC688 IsStatic: True
Module: FileRename.exe token: 06000007 name: FileRename.Properties.Resources:set_Culture address: 00BDC690 IsStatic: True
Module: FileRename.exe token: 06000008 name: FileRename.Program:Main address: 00BDC6B0 IsStatic: True
Module: FileRename.exe token: 06000009 name: FileRename.Form1:Dispose address: 00BDC7F4 IsStatic: False
Module: FileRename.exe token: 0600000A name: FileRename.Form1:InitializeComponent address: 00BDC758 IsStatic: False
Module: FileRename.exe token: 0600000B name: FileRename.Form1:.ctor address: 00BDC768 IsStatic: False
Module: FileRename.exe token: 0600000C name: FileRename.Form1:button1_Click address: 00BDC778 IsStatic: False
Module: FileRename.exe token: 0600000D name: FileRename.Form1:PaintBG address: 00BDC788 IsStatic: False
Module: FileRename.exe token: 0600000E name: FileRename.Form1:CreateRoundRectRgn address: 00BDC7E8 IsStatic: True
Module: FileRename.exe token: 0600000F name: FileRename.Form1:button2_Click address: 00BDC798 IsStatic: False
Module: FileRename.exe token: 06000010 name: FileRename.Form1:checkBox1_CheckedChanged address: 00BDC7A8 IsStatic: False
Module: FileRename.exe token: 06000011 name: FileRename.Form1:checkBox2_CheckedChanged address: 00BDC7B8 IsStatic: False
Module: FileRename.exe token: 06000012 name: FileRename.Form1:button3_Click address: 00BDC7C8 IsStatic: False
Module: FileRename.exe token: 06000013 name: FileRename.Form1:radioNormal_CheckedChanged address: 00BDC7D8 IsStatic: False

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×
×
  • Create New...