Originally Posted by
Jadd
Just use DllExports. It will load the CLR for you. Then you can load it via export call, just like you are trying to do.
Code:
[DllExport("Init", CallingConvention.WinApi)]
public static void Init() {
...
}
Thanks for the quick reply!
Sadly, that does not seem to work. Actually I cannot even call the "MessageBoxW" function from "kernel32", it seems. There is an example on their website which doesnt work for me (Binarysharp :: Products - MemorySharp)
For some reason, it seems like I cannot call any functions.
Code:
var proc = Process.GetProcessesByName("Wow").FirstOrDefault();
var ms = new MemorySharp(proc.Id);
// Neither of those work:
var func = ms["user32"]["MessageBox"];
// var func = ms["kernel32"]["MessageBoxW"];
func.Execute(0, "Hey", "Title", 0);
Code:
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in MemorySharp.dll
Additional information: Couldn't get the function address of MessageBoxW.
// Edit: I got it to "find" the MessageBoxW-Function by setting my build output to strictly x86. But now, once I call the function WoW crashes immediately:
Code:
0xC0000005 (ACCESS_VIOLATION) at 0023:1046FFDC
The instruction at "0x1046FFDC" referenced memory at "0x1046FFDC".
The memory could not be "written".