Хамик
Старожил
В составе Inno Ultra нашел скрипт создающего резервную копию ключа в реестре. Так вот мне нужно в том коде прописать HKU\{code:UsSID}\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts вместо HKCR, но у меня не получается, помогите, пожалуйста. На {code:UsSID} не обращайте внимание, мне главное покажите как ключ с подключами указать.
Код:
[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program
ChangesAssociations=yes
[Tasks]
Name: MostVideo; Description: "Most Video Files "; GroupDescription: Associate Video Files:
Name: MostVideo\DiracVideo; Description: Dirac; GroupDescription: Associate Video Files:
Name: MostVideo\AviVideo; Description: AVI; GroupDescription: Associate Video Files:
Name: MostVideo\MP4Video; Description: MP4; GroupDescription: Associate Video Files:
[Files]
Source: Files\new.ext1; DestDir: {app}
Source: Files\new.ext2; DestDir: {app}
Source: Files\new.ext3; DestDir: {app}
[Registry]
; .ext1
Root: HKCR; Subkey: .ext1; ValueType: string; ValueName: ; ValueData: MyProgramFile1; Flags: uninsdeletevalue; Tasks: MostVideo\DiracVideo; BeforeInstall: BackupData('ext1')
Root: HKCR; Subkey: MyProgramFile1; ValueType: string; ValueName: ; ValueData: "My Program File ¹1"; Flags: uninsdeletekey; Tasks: MostVideo\DiracVideo
Root: HKCR; Subkey: MyProgramFile1\DefaultIcon; ValueType: string; ValueName: ; ValueData: {sys}\notepad.exe,0; Tasks: MostVideo\DiracVideo
Root: HKCR; Subkey: MyProgramFile1\shell\open\command; ValueType: string; ValueName: ; ValueData: """{sys}\notepad.exe"" ""%1"""; Tasks: MostVideo\DiracVideo
; .ext2
Root: HKCR; Subkey: .ext2; ValueType: string; ValueName: ; ValueData: MyProgramFile2; Flags: uninsdeletevalue; Tasks: MostVideo\AviVideo; BeforeInstall: BackupData('ext2')
Root: HKCR; Subkey: MyProgramFile2; ValueType: string; ValueName: ; ValueData: "My Program File ¹2"; Flags: uninsdeletekey; Tasks: MostVideo\AviVideo
Root: HKCR; Subkey: MyProgramFile2\DefaultIcon; ValueType: string; ValueName: ; ValueData: {sys}\notepad.exe,0; Tasks: MostVideo\AviVideo
Root: HKCR; Subkey: MyProgramFile2\shell\open\command; ValueType: string; ValueName: ; ValueData: """{sys}\notepad.exe"" ""%1"""; Tasks: MostVideo\AviVideo
; .ext3
Root: HKCR; Subkey: .ext3; ValueType: string; ValueName: ; ValueData: MyProgramFile3; Flags: uninsdeletevalue; Tasks: MostVideo\MP4Video; BeforeInstall: BackupData('ext3')
Root: HKCR; Subkey: MyProgramFile3; ValueType: string; ValueName: ; ValueData: "My Program File ¹3"; Flags: uninsdeletekey; Tasks: MostVideo\MP4Video
Root: HKCR; Subkey: MyProgramFile3\DefaultIcon; ValueType: string; ValueName: ; ValueData: {sys}\notepad.exe,0; Tasks: MostVideo\MP4Video
Root: HKCR; Subkey: MyProgramFile3\shell\open\command; ValueType: string; ValueName: ; ValueData: """{sys}\notepad.exe"" ""%1"""; Tasks: MostVideo\MP4Video
[Code]
procedure BackupData(FileExt: String);
var
OldValueData: string;
begin
if RegKeyExists(HKCR, '.' + FileExt) then
begin
RegQueryStringValue(HKCR, '.' + FileExt, '', OldValueData);
RegWriteStringValue(HKCR, '.' + FileExt + '(backup)', '', OldValueData);
end;
end;
procedure RestoreData(FileExt: String);
var
OldValueData: string;
begin
if RegKeyExists(HKCR, '.' + FileExt + '(backup)') then
begin
RegQueryStringValue(HKCR, '.' + FileExt + '(backup)', '', OldValueData);
RegWriteStringValue(HKCR, '.' + FileExt, '', OldValueData);
RegDeleteKeyIncludingSubkeys(HKCR, '.' + FileExt + '(backup)');
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
RestoreData('ext1');
RestoreData('ext2');
RestoreData('ext3');
end;
end;
Последнее редактирование: