此部分代码无效:
public void WriteNOP(int Address)
{
byte[] buffer = new byte[] { 0x90, 0x90 };
IntPtr zero = IntPtr.Zero;
WriteProcessMemory(this.pHandel, (IntPtr) Address, buffer, (uint) buffer.Length, out zero);
错误:
The best overloaded method match for 'Send_to_Console_CSharp.Form1.WriteProcessMemory(SYstem.IntPtr,SystemIntPtr, byte[], uint, int)' has some invalid arguments
有关错误原因的任何猜测?
编辑:我删除了最后一个参数,但现在出现了一个新错误:
No overload for the 'Writeprocessmemory' method, it takes '4' arguments
答案 0 :(得分:0)
仔细查看您的方法签名,如下所示,最后一个参数只是int
类型,而不是out int
,而您将其作为out
参数传递给IntPtr
} type cause zero
声明为IntPtr zero = IntPtr.Zero;
。
WriteProcessMemory(SYstem.IntPtr,SystemIntPtr, byte[], uint, int)
您的方法电话
WriteProcessMemory(this.pHandel, (IntPtr) Address, buffer, (uint) buffer.Length, out zero);
<-- Here