[installer] Remove cached indirect strings from MUI cache

This commit is contained in:
Waldi Ravens 2019-06-03 12:57:18 +02:00
parent d7f7dae208
commit 429f318347

View File

@ -70,6 +70,7 @@
#define keyApps "Software\Classes\Applications" #define keyApps "Software\Classes\Applications"
#define keyRegApps "Software\RegisteredApplications" #define keyRegApps "Software\RegisteredApplications"
#define keyAppPaths "Software\Microsoft\Windows\CurrentVersion\App Paths" #define keyAppPaths "Software\Microsoft\Windows\CurrentVersion\App Paths"
#define muiCache "\Software\Classes\Local Settings\MuiCache"
[Setup] [Setup]
@ -269,7 +270,7 @@ Source: {#bindir}\Languages\zh-TW.xml; DestDir: {app}\Languages;
#endif #endif
Source: {#bindir}\SubtitleEdit.exe; DestDir: {app}; Flags: ignoreversion; Components: main Source: {#bindir}\SubtitleEdit.exe; DestDir: {app}; Flags: ignoreversion; Components: main
Source: {#bindir}\SubtitleEdit.resources.dll; DestDir: {app}; Flags: ignoreversion; Components: main Source: {#bindir}\SubtitleEdit.resources.dll; DestDir: {app}; Flags: ignoreversion; Components: main; AfterInstall: ClearMUICache
Source: ..\Changelog.txt; DestDir: {app}; Flags: ignoreversion; Components: main Source: ..\Changelog.txt; DestDir: {app}; Flags: ignoreversion; Components: main
Source: ..\LICENSE.txt; DestDir: {app}; Flags: ignoreversion; Components: main Source: ..\LICENSE.txt; DestDir: {app}; Flags: ignoreversion; Components: main
Source: Icons\uninstall.ico; DestDir: {app}\Icons; Flags: ignoreversion; Components: main Source: Icons\uninstall.ico; DestDir: {app}\Icons; Flags: ignoreversion; Components: main
@ -495,6 +496,37 @@ begin
end; end;
// Remove cached indirect strings from MUI cache
procedure ClearMUICacheKey(const KeyName: String);
var
Names: TArrayOfString;
Index: Integer;
begin
if RegGetSubkeyNames(HKEY_USERS, KeyName, Names) then
begin
for Index := Low(Names) to High(Names) do
ClearMUICacheKey(KeyName + '\' + Names[Index]);
end;
if RegGetValueNames(HKEY_USERS, KeyName, Names) then
begin
for Index := Low(Names) to High(Names) do
if (Pos('\SubtitleEdit.resources.dll,-', Names[Index]) <> 0) then
RegDeleteValue(HKEY_USERS, KeyName, Names[Index]);
end;
end;
procedure ClearMUICache();
var
Users: TArrayOfString;
Index: Integer;
begin
if RegGetSubkeyNames(HKEY_USERS, '', Users) then
begin
for Index := Low(Users) to High(Users) do
ClearMUICacheKey(Users[Index] + '{#muiCache}');
end;
end;
procedure CleanUpDictionaries(); procedure CleanUpDictionaries();
begin begin
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_DK_user.xml')); DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_DK_user.xml'));