有什么方法可以使用 NSIS 以通用方式读取注册表版本号密钥?

Is there any way that we can read the registry version number key in a generic way using NSIS?

在安装较新版本的软件时使用 NSIS,从特定的旧版本号(例如 3.01.00)我通过卸载旧版本并安装较新版本自动将其升级到较新版本,如下所示如下所示:

注意:这里我的旧版本软件安装程序使用的是WIX,而较新版本的安装程序使用的是NULLSOFT

 ReadRegStr $R1 HKLM "SOFTWARE\Millinnium.01.00" "InstallPath"
  ReadRegStr $R2 HKLM "SOFTWARE\Millinnium.02.00" "InstallPath"

${If} $R1 != ""

MessageBox MB_YESNO|MB_ICONQUESTION "$(UninstallPrevVer)" IDYES noUninstOld

Abort
 noUninstOld:
 ExecWait '"MsiExec.exe" /X{8ED262EE-FC73-47A9-BB86-D92223246881} /qb!'  


${ElseIf} $R2 != ""

MessageBox MB_YESNO|MB_ICONQUESTION "$(UninstallPrevVer)" IDYES noUninstOld

Abort
 noUninstOld:
 ExecWait '"MsiExec.exe" /X{8ED262EE-FC73-47A9-BB86-D92223246881} /qb!'  

${EndIf}

但是如果我有很多旧版本,例如 <3.01.00(即 3.0 或 3.0.0.1 或 2.0 或更低版本),我想显示一条通用消息,说明在安装之前手动卸载现有版本较新的版本。

有什么方法可以以通用方式读取注册表版本号密钥?

或者我是否需要按照如下所示的每个版本进行操作?

 ReadRegStr $R1 HKLM "SOFTWARE\Millinnium.0" "InstallPath"
  ReadRegStr $R2 HKLM "SOFTWARE\Millinnium.0.0.1" "InstallPath"
ReadRegStr $R2 HKLM "SOFTWARE\Millinnium.0" "InstallPath"

使用EnumRegKey枚举键:

Section
StrCpy [=10=] 0
loop:
  EnumRegKey  HKLM "SOFTWARE\Millinnium" [=10=]
  StrCmp  "" done
  IntOp [=10=] [=10=] + 1
  DetailPrint "Key: "
  Goto loop
done:
SectionEnd

小节结束