ntopenprocess WriteProcessMemory

ntopenprocess WriteProcessMemory
EN:
This function writes memory in a specified process. The entire area to be written to must beaccessible, or the operation fails.
BOOL WriteProcessMemory(
HANDLE hProcess,
LPVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesWritten
);
Parameters
hProcess
[in] Handle returned from the OpenProcess function that provided full access to the process.
lpBaseAddress
[in] Pointer to thebase addressin the specified process.
Before 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 so, the functionproceeds; otherwise, the function fails.
lpBuffer
[in] Pointer to the buffer that supplies data to be written into the address space of the specified process.
nSize
[in] Specifies the requested number of bytes to write into the specified process.
lpNumberOfBytesWritten
[out] Pointer to the number of bytes transferred into the specified process.
This parameter is optional.
If lpNumberOfBytesWritten is NULL, the parameter is ignored.
Return Values
Nonzero indicates success.
Zero indicates failure.
To get extended error information, call GetLastError.
The function fails if the requested write operation crosses into an area of the process that isinaccessible.
Remarks
WriteProcessMemory copies data from the specified buffer in the current process to the address range of the specified process. The process whose address space is being written to is typically, but not necessarily, being debugged.
The entire area to be written to must be accessible. If it is not, the function fails.
Requirements
OS Versions: Windows CE 2.0 and later.
Header: Winbase.h.
Link Library: Nk.lib.
See Also
OpenProcess |ReadProcessMemory
---------------------------------------------------------------------------------------------
ch:
WriteProcessMemory
VB函数原型:
Declare Function WriteProcessMemory Lib kernel32 (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
作用:写内存
说明:
hProcess , 进程的句柄
lpBaseAddress, 进程地址
lpBuffer, 数据存放地址
nSize, 数据的长度
lpNumberOfBytesWritten,实际数据的长度
nSize以字节为单位,一个字节Byte等于8位
基本数据类型的长度
ShortInt 8位 = 1Byte
SmallInt 16位 = 2Byte
Integer 16位 = 2Byte
LongInt 32位 = 4Byte
Word 16位 = 2Byte
LongWord 32位 = 4Byte
Boolean 8位 = 1Byte
WordBool 16位 = 2Byte
LongBool 32位 = 4Byte
比如要写入Integer类型的数据,那么Integer长度2Byte
所以nSize = 2

  

爱华网本文地址 » http://www.413yy.cn/a/8103400103/86779.html

更多阅读

梅威瑟炫富新境界 新战略 新境界

  一、对战略与战略规划的再认识     1、要客观认识战略的作用——既不能拔高,更不可贬低。现在有一种不好的现象就是做战略咨询的,把战略的作用无限拔高;做销售代理的,认为营销的作用天大;做物业管理的,认为物业管理天大;做运营策划

2016个人工作总结范文 2016学生个人期末总结800字范文

 2016学生个人期末总结800字  2016学生个人期末总结800字范文1  今年是我进入大学的第三年。两年来,在各级领导和同学们的关心、帮助下,通过自身不断努力,各方面均取得一定的进步。现总结如下:  思想政治方面。始终保持与

如何规避创业风险 教你如何规避创业风险

   要避免创业风险,必须首先知道风险来自哪里。风险来自三个矛盾:一是演习与实战的矛盾。在创业初期所做的事情都具有探索的性质,这便产生了一个矛盾:本来属于探索的对象,却当成了确定的对象,本来属于实验的内容,却当成了真实的内容来

声明:《ntopenprocess WriteProcessMemory》为网友让人沉醉的爱情分享!如侵犯到您的合法权益请联系我们删除