Here's Dynative, much like Aeonhack's CreateAPI<T>() function it can map native function pointer to delegates, and get address of (or load) modules. In my implementation you can choose not to specify the string name of the function, but ONLY if the delegate name matches the function name.
Methods:
Example usage:
Download source code of: Dynative.cs
Methods:
Code
public static IntPtr GetModule(string name)
public static T GetFunction<T>(IntPtr module, string name)
public static T GetFunction<T>(IntPtr module)Example usage:
Code
static class Program
{
// your native function delegate
delegate DialogResult MessageBoxA(IntPtr hwnd, string text, string title, MessageBoxButtons buttons);
// user32.dll library
static IntPtr user32 = Dynative.GetModule("user32.dll");
// the MessageBoxA function, mapped to our delegate
static MessageBoxA msgbox = Dynative.GetFunction<MessageBoxA>(user32);
static void Main()
{
// invoke our MessageBoxA function
msgbox.Invoke(IntPtr.Zero, "Hello world", "title", MessageBoxButtons.OK);
}
}Download source code of: Dynative.cs
![[Image: Syr3DlV.png]](https://i.imgur.com/Syr3DlV.png)



