unsigned char* Data::getAddress(unsigned char* address)
{
strcpy((char*)address, (char*)this->_address);
return (unsigned char*)address;
}
int main()
{
Data d;
d.makealinkedlisthere();
while (d)
{
unsigned char address[256];
printf("0x%08x \r\n",d.getAddress(address));
d = d.getNext();
}
return 0;
}
它返回前两个(相同,并且应该不同[可以从调试器中看出] ...)然后崩溃。
它只是制作一个链表。受保护的成员Data* _next
......他们的链条。
unsigned char* 来自它返回的数据结构的 Windows 函数VirtualQueryEx
部分。MEMORY_BASIC_INFORMATION
this->_address = (unsigned char*)meminfo->BaseAddress; // casted from void*
它是 void*,但我看到它在其他代码中转换为 unsigned char*。在调试器中,我可以看到它表示为十六进制数字。
D1: + _address 0x7ffd5000 <Bad Ptr> unsigned char *
D1->_next:+ _address 0x7f6f0000 "áå•ú`©" unsigned char *
D1->_next->_next+ _address 0x7ffb0000 " " unsigned char *