NSIS VPatch无法找到注册表值

问题描述 投票:0回答:1

我在修补我的应用程序时遇到问题。使用NSIS编写的安装程序安装了我的应用程序。使用

将安装路径保存在注册表中

WriteRegStr HKCU "Software\APP" "InstallPath" $InstDir

这有效,安装后我可以在注册表GUI中找到键和值。

在我的补丁安装程序中,我使用此功能来找到安装路径:

!include "VPatchLib.nsh"
!include x64.nsh
!include LogicLib.nsh

; Show details
ShowInstDetails show

Function FindInstallPath
   ${If} ${RunningX64}
       SetRegView 64
       ReadRegStr $0 HKCU "Software\APP" "InstallPath"
       ${If} $0 != ""
           MessageBox MB_OK "reading from 64-bit: $0"
           StrCpy $INSTDIR $0
           SetRegView LastUsed
           return
       ${EndIF}
       SetRegView LastUsed
       MessageBox MB_OK "No install path: $0"
   ${Else}
       ReadRegStr $0 HKCU "Software\APP" "InstallPath"
       ${If} $0 != ""
           MessageBox MB_OK "reading from 32-bit: $0"
           StrCpy $INSTDIR $0
           SetRegView LastUsed
           return
       ${EndIf}
       MessageBox MB_OK "No install path: $0"
   ${EndIf}
FunctionEnd

找不到路径,无法应用补丁。如果我尝试读取任何其他键fx:ReadRegStr $0 HKCU "Software\Realtek\Audio\RtkAudUService\General" "InstallPath",则将按预期返回该值。

我使用的是我在自己的计算机上创建的测试用户个人资料。我的安装程序和补丁均会触发Windows UAC,我输入管理员密码。

我非常感谢您的帮助。

谢谢,安德烈亚斯

installer nsis patch
1个回答
0
投票

SetRegView 64不应仅因为在64位系统上运行而被使用。仅在以下情况下才应使用它:A)您正在安装64位应用程序。 B)您需要读取/写入Windows特定的注册表值。

通常,当您找不到所写内容时,是因为您没有使用正确的注册表视图。尝试按Process Monitor可以查看正在写入的键以及在何处读取。

您不应该真正使用提升的安装程序写信给HKCU,请使用HKLM。

© www.soinside.com 2019 - 2024. All rights reserved.