Hi, how can i return arguments in my custom native dll like ReadProcessMemory api?
For example for readprocessmemory, byte arguments return readed value. Its mixed c# and c++ so if its wrong place to ask, sorry about that.
public byte[] ByteOku(uint BellekAdresi, int PID)
{
IntPtr readHandle = NativeMethods.OpenProcess(0x10, false, (uint)PID);
byte[] bytes = new byte[50];
uint rw = 0;
NativeMethods.ReadProcessMemory(readHandle, (IntPtr)BellekAdresi, bytes, (UIntPtr)50, ref rw);
return bytes;
}
[DllImport("test.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern void method_4(byte[] buffer);
private void button1_Click(object sender, EventArgs e)
{
byte[] b = new byte[] { 0x5D, 0x0, 0x0, 0x0, 0x0 };
method_4(b);
MessageBox.Show(b[0].ToString() + " " + b[1].ToString() + " " + b[2].ToString() + " " + b[3].ToString());
}
//in dll which is written in c++ mfc
extern "C" __declspec(dllexport) void method_4(int buffer[])
{
buffer[1] = 0x5;
buffer[2] = 0x5;
buffer[3] = 0x5;
buffer[4] = 0x5;
}
but buffer array is not modified on button1_click