简体   繁体   中英

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. Casting a pointer to an integer may produce a loose of precision in 64 bits compilations, that's the reason of the warning.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM