读取注册表项以检查32/64位应用程序

时间:2016-07-08 08:54:18

标签: special-characters nsis

我想通过Windows注册表中的NSIS读出我的应用程序名称。
应用程序名称可以是“Application(x86)”或“Application(x64)” 我正在使用以下代码:

ReadRegStr $R1 HKLM "SOFTWARE\Something\Something\" "ApplicationName"

$R1值的输出始终为“应用”,不带括号。
ReadRegStr是否始终忽略特殊字符?
是有一些解决方法吗?

1 个答案:

答案 0 :(得分:1)

ReadRegStr不会以任何方式过滤字符串:

Section
; Write the test string first
WriteRegStr HKCU "Software\NSIS\Test\" "Application" "Application (x86)"

; ...and then read it and display the result
ReadRegStr $R1 HKCU "Software\NSIS\Test\" "Application" 
MessageBox MB_OK "$R1"

; Cleanup
DeleteRegKey HKCU "Software\NSIS\Test\"
SectionEnd

是否有可能是因为注册表重定向/反射或32对64位视图导致在注册表中的错误位置读取旧字符串?

使用Process Monitor监视安装程序,以便您可以看到正在读取的注册表中的实际位置以及返回给应用程序的值。