How to get lpBaseAddress to pass it to :

BOOL WINAPI Toolhelp32ReadProcessMemory(
DWORD th32ProcessID,
LPCVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD cbRead,
LPDWORD lpNumberOfBytesRead
);
It will be very helpful to me if someone can provide a snippet of code how to achieve that.
Thanks a lot.

Dani AI

Generated

Short answer: lpBaseAddress is simply the target address inside the other process — most often the base address of the module (EXE/DLL) that contains the data you want. The common, reliable way to get that base is to take a toolhelp snapshot and enumerate modules; the module entry exposes the base pointer.

A minimal workflow:

Example sketch (conceptual):

HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE|TH32CS_SNAPMODULE32, pid);
MODULEENTRY32 me = { sizeof(me) };
if (Module32First(snap, &me)) {
    LPCVOID base = me.modBaseAddr; // pass this as lpBaseAddress
}
CloseHandle(snap);

Notes and cautions: on desktop Win32 you normally use ReadProcessMemory with a handle from OpenProcess (ReadProcessMemory); some embedded/CE environments expose a Toolhelp read variant. You need appropriate access rights (PROCESS_VM_READ or Debug privileges), and be careful about bitness (a 32-bit tracer vs a 64-bit target) — use the snapshot flags or run a matching-architecture build. Since reported they solved it and confirmed, the steps above are likely what they used; this pattern reproduces that approach for future readers.

I know how to do that. It took less time then I thought.
Thanks a lot to all of us who wanted to help me.

glad we could help

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.