Archive: x86 and x64 InstallDirRegKey


x86 and x64 InstallDirRegKey
Hey guys I am trying to create an installer for a patch for a game and I am having a problem. I am using x64.nsh to find out if the version of windows is 32 or 64 bit. Depending on which version of windows it is I need to look for the installdirregkey in a different spot of the registry. Here is the code I am trying to use but it leaves a blank value for the install directory. Any help would be appreciated


InstallDirRegKey HKLM "Software\Team Avalanche\" Install

Function .onInit

${If} ${RunningX64}
MessageBox MB_OK "running on x64"
ReadRegStr $0 HKLM "SOFTWARE\Wow6432Node\Square Soft, Inc.\Final Fantasy VII\1.00\Graphics\" Driver
ReadRegStr $1 HKLM "SOFTWARE\Wow6432Node\Square Soft, Inc.\Final Fantasy VII\" AppPath

${If} "$0" != "3"
MessageBox MB_OK "Aali's custom driver is not installed, or not installed correctly. Please re-install and

try again. To download driver go to http://forums.qhimm.com/index.php?topic=8306.0"
Abort ; causes installer to quit.
${EndIf}
${Else}
ReadRegStr $0 HKLM "SOFTWARE\Square Soft, Inc.\Final Fantasy VII\1.00\Graphics\" Driver
ReadRegStr $1 HKLM "SOFTWARE\Square Soft, Inc.\Final Fantasy VII\" AppPath
MessageBox MB_OK "running on x86, $0"
WriteRegStr HKLM "Software\Team Avalanche\" "Install" "$1"

${If} "$0" != "3"
MessageBox MB_OK "Aali's custom driver is not installed, or not installed correctly. Please re-install and

try again. Please re-install and try again. To download driver go to http://forums.qhimm.com/index.php?

topic=8306.0"
Abort ; causes installer to quit.
${EndIf}
${EndIf}

MessageBox MB_OK "$1"
;$INSTDIR "$1"
!define InstallDirRegKey HKLM "Software\Team Avalanche\" Install
FunctionEnd

I am thinking for some reason the installer tries to get the Install Dir before the oninit function writes the correct install directory into the registry, but I cannot figure out how to fix it.


might have to use SetRegView


Thats not really the problem. I can write to the registry fine. Its just that the installer doesnt read the key i write to the registry. Its like the order is backwards. It tries to read the key and then it writes it afterwards. I am working with the assumption that the function oninit should be the first thing that runs in the script