public static void Init2() { var mSize = 0; var mAddr = IntPtr.Zero; foreach (ProcessModule m in Process.GetCurrentProcess().Modules) { if (m.ModuleName == "vstdlib.dll") { mSize = m.ModuleMemorySize; mAddr = m.BaseAddress; } } var addr = WinApi.GetProcAddress(mAddr, "KeyValuesSystem"); Console.WriteLine(addr); var ctr = Marshal.GetDelegateForFunctionPointer <New>(addr); var key = ctr(addr); var key2 = ctr(addr); Console.WriteLine(key); Console.WriteLine(key2); }
public static (IntPtr, IntPtr, int) CreateInterface(string interface_name, string module_name) { IntPtr mHandle = IntPtr.Zero; int mSize = 0; foreach (ProcessModule m in Process.GetCurrentProcess().Modules) { if (m.ModuleName == module_name) { mHandle = m.BaseAddress; mSize = m.ModuleMemorySize; } } var createInterface = Marshal.GetDelegateForFunctionPointer <d_CreateInterface>(WinApi.GetProcAddress(mHandle, "CreateInterface")); return(createInterface(interface_name, IntPtr.Zero), mHandle, mSize); }