One thing to keep in mind is that 64-bit Windows redirects some registry keys when the process is 32-bit. For example, attempts to open HKEY_LOCAL_MACHINE\Software\* from a 32-bit process will be redirected to HKEY_LOCAL_MACHINE\Software\Wow6432Node\*.
To disable the redirection, OR KEY_WOW64_64KEY to the samDesired parameter.