如何找到dll的最小和最大地址

How to find minimal and maximal address of dll

我通过注入 dll 扫描进程内存并读取它的内存。 问题是我也读取了dll的内存。有人知道该怎么做吗?

使用GetModuleInformation, which can accept both an HPROCESS for your remote process and a HMODULE for your injected DLL, and which returns the following information in a MODULEINFO结构:

typedef struct _MODULEINFO {
  LPVOID lpBaseOfDll;
  DWORD  SizeOfImage;
  LPVOID EntryPoint;
} MODULEINFO, *LPMODULEINFO;

因此您可以通过 lpBaseOfDll 字段知道注入的 DLL 的起始地址,通过 lpBaseOfDll + SizeOfImage.

知道结束地址

这也适用于您当前进程中使用 GetCurrentProcess 的 DLL,例如GetModuleHandle.