I want to read the memory from a process for 16 MB (FFFFFF) and store it in a array, in a way that when I search inside the array like: array[i], i will be the real memory address.
我要说的是,我想从000人到FFFFFF,我想使这个规模(价值)从这个地址获得,并把它储存起来。
然后,如果(var=价值)返回地址。
i have this: ReadProcessMemory(phandle,(void*)address,buffer,0xFFFFFF,0);
EDIT:
i 有(由蓝瓦德尔回答):
class offset_buffer{ private: char *buf; int offset; public: offset_buffer(char *in_buf, int in_offset) : buf(in_buf), offset(in_offset){ } char & operator[](int in_index){ return buf[in_index - offset]; } void setOffset(int off){ offset=off; } void ReadMemory(){ LPBYTE point; DWORD primeiroAddress = 0x000000; DWORD finalAddress = 0xFFFFFF; //LPBYTE buffer = new BYTE[finalAddress-primeiroAddress]; HANDLE phandle = OpenProcess(PROCESS_VM_READ,0,TargetPID); ReadProcessMemory(phandle,(void*)primeiroAddress, buf, sizeof(buf), 0); CloseHandle(phandle); } }; main(){ char *buffer = new char[0xFFFFFFF-0x0000000]; int address = 0x0000000; offset_buffer b(buffer,address); std::ostringstream ss; int i=0; TListItem *ListIt; b.ReadMemory(); for(address=0x0000000;address<0xFFFFFFF;address+=sizeof(int)){ if(b[address]==StrToInt(Edit1->Text.c_str())){ ss << std::hex << address; showValue(); ss.str(std::string()); } }
什么是错的? 谁能帮助我? 为什么不工作