
Originally Posted by
Nik08154
and what is this meaning?
Code:
DWORD pWeaponMgr = *(DWORD*)(CShell + WeaponMgr);
I mean what does this
*(DWORD
*) mean?
*(TYPE*) is a 2 step process. (and with Cshell + WeaponMgr; 3 steps)
In the example, DWORD pWeaponMgr = *(DWORD*) (an addr);
step 1. numeric add CShell + weaponMgr --> the result is simply a numeric : a memory address.
step 2. read an address from the location in step 1. If 32 bit cpu, read 4 bytes; if 64 bit, read 8 bytes.
--the value we read is ANOTHER MEMORY ADDRESS.
step 3. read a value from the addr we got in step 2
assuming CShell + WeaponMgr == some number, let's say 0x11223344
step 1. add CShell + weaponMgr == 0x11223344
step 2. (assuming 32 bit..as most current/old games were 32 bit) Read 4 bytes starting at 0x11223344
-Pretend those 4 bytes hold the value 0x22446688
step 3. Since we're going to store this in a DWORD, and dword size is 4 bytes, we read 4 bytes starting at 0x22446688
We dereferenced the pointer at 0x11223344 : ) The type inside *(TYPE*) dictates how many bytes are read from the final addr (22446688) in step 3.
big_struct myObj = *(big_struct*)0x11223344; would read a different number of bytes starting at 0x22446688.