delphi ReadProcessMemory WriteProcessMemory读写内存


var  
Num:THandle;  
a,b:Integer;  
ParamAdd: THandle;  
lpNumberOfBytes:THandle;  
begin  
a:= 1234567;  
b:= 11111;  
//GetWindowThreadProcessId(Ghwnd,PID);  
PID:= FindProcessID('project2.exe');  
ProcessID:=OpenProcess(PROCESS_ALL_ACCESS,False,PID);   // 打开进程  
 
ParamAdd:= VirtualAllocEx(ProcessID,nil,20,MEM_COMMIT,PAGE_READWRITE);    //开辟一个空间  
WriteProcessMemory(ProcessID, @a, @b, SizeOf(b), lpNumberOfBytes);   // 将地址b内容写到地址a中  
ReadProcessMemory(ProcessID,Pointer(@a),@sBase,6,Num);   // 读取地址a内容放进地址sBase中  
ShowMessage(IntToStr(sBase));  
 
end;  

联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678