diff --git a/SkinInstaller/DialogInstall.cpp b/SkinInstaller/DialogInstall.cpp index 803fae03..5af1e997 100644 --- a/SkinInstaller/DialogInstall.cpp +++ b/SkinInstaller/DialogInstall.cpp @@ -808,8 +808,7 @@ bool DialogInstall::InstallPackage() error = !ExtractCurrentFile(targetPath); if (!error) { - // Clear the [Rainmeter] section. - WritePrivateProfileSection(L"Rainmeter", L"", targetPath.c_str()); + CleanLayoutFile(targetPath.c_str()); } } } @@ -1043,6 +1042,25 @@ void DialogInstall::LaunchRainmeter() } } +void DialogInstall::CleanLayoutFile(const WCHAR* file) +{ + // Clear the [Rainmeter] section. + WritePrivateProfileSection(L"Rainmeter", L"", file); + + // Remove the UseD2D key from all sections. + WCHAR buffer[4096]; + if (GetPrivateProfileSectionNames(buffer, _countof(buffer), file) > 0) + { + const WCHAR* section = buffer; + size_t sectionLength = 0; + while ((sectionLength = wcslen(section)) > 0) + { + WritePrivateProfileString(section, L"UseD2D", nullptr, file); + section += sectionLength + 1; + } + } +} + // Helper for the IsIgnore... functions. bool IsIgnoredName(const WCHAR* name, const WCHAR* names[], int namesCount) { diff --git a/SkinInstaller/DialogInstall.h b/SkinInstaller/DialogInstall.h index 3e24bced..9fbff284 100644 --- a/SkinInstaller/DialogInstall.h +++ b/SkinInstaller/DialogInstall.h @@ -88,6 +88,8 @@ private: void LaunchRainmeter(); void KeepVariables(); + static void CleanLayoutFile(const WCHAR* file); + static bool IsIgnoredSkin(const WCHAR* name); static bool IsIgnoredLayout(const WCHAR* name); static bool IsIgnoredAddon(const WCHAR* name);