Kernel32 readprocessmemory

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
tiganan88
Newbie
Posts: 1
Joined: Wed Jun 06, 2018 9:00 pm

Kernel32 readprocessmemory

Post by tiganan88 » Mon Feb 03, 2020 10:22 am

Hi, im trying to use this script from kernel32 for read some vaule from an running application but i dont know how to set parameters of processmemory function
That parameters could be read from CheatEngine but i would read them in Macro Scheduler

That is the function from microsoft c++

Code: Select all

BOOL ReadProcessMemory(
  HANDLE  hProcess,
  LPCVOID lpBaseAddress,
  LPVOID  lpBuffer,
  SIZE_T  nSize,
  SIZE_T  *lpNumberOfBytesRead
);
hProcess

A handle to the process with memory that is being read. The handle must have PROCESS_VM_READ access to the process.

lpBaseAddress

A pointer to the base address in the specified process from which to read. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for read access, and if it is not accessible the function fails.

lpBuffer

A pointer to a buffer that receives the contents from the address space of the specified process.

nSize

The number of bytes to be read from the specified process.

lpNumberOfBytesRead

A pointer to a variable that receives the number of bytes transferred into the specified buffer. If lpNumberOfBytesRead is NULL, the parameter is ignored.
My script would be

Code: Select all

GetWindowHandle>"PSOCESS NAME"
LibFunc>Kernel32,ReadProcessMemory,result,nhandle
MessageModal>result
Result could be string or integer number

Thanks

Alberto

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Kernel32 readprocessmemory

Post by JRL » Mon Feb 03, 2020 6:07 pm

AFAIK, if the windows API wants you to set a "pointer", the function will not work within Macro Scheduler. I have wondered whether "memory pointer needed" APIs might work using Python in Macro Scheduler but I have not yet tried.

Read Marcus' comments in THIS THREAD.

Maybe something like THIS will help

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts