该程序用于ReadProcessMemory
扫描内存块以获取特定值。不幸的是,当我打电话时,ReadProcessMemory
我收到错误 299。
void update_memblock(MEMBLOCK *mb)
{
//variables
static unsigned char tempbuf[128*1024];
size_t bytes_left;
size_t total_read;
size_t bytes_to_read;
size_t bytes_read;
size_t sizeMem;
size_t MemoryBase;
bytes_left = mb->size;
total_read = 0;
while (bytes_left)
{
bytes_to_read = (bytes_left > sizeof(tempbuf)) ? sizeof(tempbuf) : bytes_left;
ReadProcessMemory(mb->hProc ,mb->addr + total_read,mb->buffer, bytes_to_read, (SIZE_T*)&bytes_read);
if (bytes_read != bytes_to_read)break;
memcpy(mb->buffer + total_read, tempbuf,bytes_read);
bytes_left -= bytes_read;
total_read += bytes_read;
}
mb->size = total_read;
}