Sunday, January 30, 2011

Writing Data to an area of memory in a specified process

Tip - WriteProcessMemory()

Details - WriteProcessMemory() API copies the data from the specified buffer in the current process to the address range of the specified process.

BOOL WINAPI WriteProcessMemory(
  __in   HANDLE hProcess,
  __in   LPVOID lpBaseAddress,
  __in   LPCVOID lpBuffer,
  __in   SIZE_T nSize,
  __out  SIZE_T *lpNumberOfBytesWritten
Any process that has a handle with PROCESS_VM_WRITE and PROCESS_VM_OPERATION access to the process to be written to, can call the function. The entire area to be written to must be accessible, and if it is not accessible, the function fails. The parameter lpBaseAddress is a pointer to the base address in the specified process to which data is written. 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, and if it is not accessible, the function fails.

Reference   -

Posted By : Velayudhan Pillai K

No comments:

Post a Comment