inno打包写注册表
如果我默认目录,那么注册表还是我ROOT下面的,如果我更改了路径,这注册表的目录就不是ROOT下面的了,求指教,这是什么原因???
[Files]
Source: D:\Inno Setup 5\test\*.*; DestDir: {app}
[Registry]
Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\MyApp; ValueType: string; ValueName: Path; ValueData: {app}\unins000.exe; Flags: uninsdeletekey
Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\MyApp; ValueType: string; ValueName: version; ValueData: 1.0; Flags: uninsdeletekey
[UninstallDelete]
Name: {app}; Type: filesandordirs
[Setup]
AppName=测试程序
AppVerName=测试程序1.0
InfoBeforeFile=D:\Inno Setup 5\test\Readme.txt
LicenseFile=D:\Inno Setup 5\test\ISPPExample1License.txt
DefaultDirName={pf}\测试程序
AppID={{F1CFFC3D-2198-4221-9665-917CECB68229}
UninstallLogMode=overwrite
[Code]
function InitializeSetup(): boolean;
var
PathStr : String;
VersionStr : String;
ErrorCode: Integer;
begin
result := true;
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\MyApp', 'Path', PathStr) and
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\MyApp', 'Version', VersionStr) then
begin
if MsgBox('检测到已存在版本[' + VersionStr + '],是否卸载原版本', mbConfirmation, MB_YESNO) = idYes then begin
PathStr := RemoveQuotes(PathStr);
Exec(PathStr, '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode)
end else
result := false;
end;
end;
//第一次运行ISTool软件先要在菜单的“文件”“参数”中制定Inno Setup的位置
//编译时若提示某些变量没有定义,大部分在工具栏的“选项”“应用程序中”
// Code段的代码是检测是否安装了以前版本,有则提示用户删除
// 最好是在工具栏的“选项”“卸载”页把“卸载日志模式”改为覆盖,这样卸载程序就固定为“unins000.exe”
// 默认是生成32位安装程序,所以注册表信息在64位操作系统下是放在Wow6432Node节点下。