Fixing crash issues on 64 bit machines

DWORD is 32 bit and casting a pointer to it causes sadness.