title: NSIS: reading DWORD from the registry?
body: <p>I'm trying to update an existing installer to read a registry value (if it exists) and change the install settings to match existing installation settings when doing upgrade installations. </p>
  
  <p>But I'm getting hung up on not being able to sucessfully read the registry value. </p>
  
  <p>I write the key like this in the installer:</p>
  
  <pre><code>WriteRegDWORD HKLM "Software\${PRODUCT}" "IniPath" 0x00000026
  </code></pre>
  
  <p>This part works just fine, the key is created or modified, and is of type DWORD, all is well.</p>
  
  <p>But then if I try to read that value back, I seem to be getting an empty value every time.</p>
  
  <pre><code>ReadRegDWORD $IniPath HKCU "Software\${PRODUCT}" "IniPath"
  MessageBox MB_OK "$$IniPath=$IniPath" 
  </code></pre>
  
  <p>Results in printing <code>$IniPath=</code></p>
  
  <p>I also tried doing <code>ClearErrors</code> before reading and <code>IfErrors</code> after, and it does appear to be getting into IfErrors...but I don't understand why it would be having errors and not seeing the key. I am running 32 bit windows, so I doubt this is 64bit "wrong section of the registry" error.</p>
  
  <p>The line to write the DWORD is working just fine. If I delete the registry key, and examine the registry using regedit immediately after, the key is there. But regardless of whether the key existed.</p>
  
  <p>So what could be going wrong to cause it to fail to read the value, or how to debug this? </p>