Quote Originally Posted by matsp View Post
If you want to extract a DWORD out of an array of BYTE, then you need to take the address and cast it to pointer to DWORD, then dereference that pointer. Otherwise, we'll be converting a BYTE to DWORD by filling then other 3 bytes with zero, which I doubt is what abachler actually wanted.

Exactly. &pTemp gives the base address with byte resolution
(DWORD*)&pTemp recasts the pointer as a DWORD pointer so that
*(DWORD*)&pTemp yields the DWORD that occupies the 4 bytes starting at pTemp.

This is so say pTemp == 0x0100 for this discussion adn the mremory at that address looks liek this

0x0100 01 02 03 04
0x0104 00 00 00 00

in the end dwNew would == 0x04030201 not 0x00000001 (on a little endian machine).