2016-07-08 82 views
0

我想通过NSIS从Windows注册表中读出我的应用程序名称。
应用程序的名称可以是“应用程序(86)”或“应用程序(64)”我使用以下代码 :阅读注册表项检查六十四分之三十二位应用

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

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

回答

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安装程序,所以你可以看到你正在阅读的注册表中的实际位置和值返回给应用程序。

+0

问题是 - 32/64位视图。通过使用“SetRegView 32”和“SetRegView 64”解决它。 – Joe