[英]cast from 'BYTE* {aka unsigned char*}' to 'DWORD {aka long unsigned int}' loses precision [-fpermissive]
im trying to add an address to a module base address 我试图将地址添加到模块基地址
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pId);
MODULEENTRY32 module;
module.dwSize = sizeof(MODULEENTRY32);
Module32First(snapshot, &module);
CloseHandle(snapshot);
DWORD addr = 0x1D4192 + (DWORD)module.modBaseAddr;
i don't know what is wrong 我不知道怎么了
As mentioned in a comment, pointers vary in size depending on the platform (64 bits or 32 bits), while integers (int, long, long int...) are usually 32 bits in both. 如评论中所述,指针的大小取决于平台(64位或32位),而整数(int,long,long int ...)通常都是32位。 Casting a pointer to an integer may produce a loose of precision in 64 bits compilations, that's the reason of the warning. 将指针强制转换为整数可能会导致64位编译时精度下降,这就是发出警告的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.