首页
社区
课程
招聘
[求助]WriteProcessMemroy问题
发表于: 2008-11-15 21:26 3126

[求助]WriteProcessMemroy问题

2008-11-15 21:26
3126
如何用WriteProcessMemroy修改某一处代码

[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 2110
活跃值: (21)
能力值: (RANK:260 )
在线值:
发帖
回帖
粉丝
2
如果你要改代码的话,首先必须有一个反汇编/汇编引擎,将指令解析,对于分支和跳转指令,就必须重新计算偏移量。把“汇编”后的机器码,直接写入到想要的地址去就可以。

资料:MSDN98中对该API的解释

BOOL WriteProcessMemory(
  HANDLE hProcess,  // handle to process whose memory is written to
  LPVOID lpBaseAddress,
                    // address to start writing to
  LPVOID lpBuffer,  // pointer to buffer to write data to
  DWORD nSize,      // number of bytes to write
  LPDWORD lpNumberOfBytesWritten
                    // actual number of bytes written
);

Parameters
hProcess
Handle to the process whose memory is to be modified. The handle must have PROCESS_VM_WRITE and PROCESS_VM_OPERATION access to the process.
lpBaseAddress
Pointer to the base address in the specified process to be written to. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for write access. If this is the case, the function proceeds; otherwise, the function fails.
lpBuffer
Pointer to the buffer that supplies data to be written into the address space of the specified process.
nSize
Specifies the requested number of bytes to write into the specified process.
lpNumberOfBytesWritten
Pointer to the actual number of bytes transferred into the specified process. This parameter is optional. If lpNumberOfBytesWritten is NULL, the parameter is ignored.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. The function will fail if the requested write operation crosses into an area of the process that is inaccessible.
2008-11-15 21:52
0
游客
登录 | 注册 方可回帖
返回
//