diff --git a/SkinInstaller/Application.cpp b/SkinInstaller/Application.cpp
index 6e78d1da..872678fc 100644
--- a/SkinInstaller/Application.cpp
+++ b/SkinInstaller/Application.cpp
@@ -245,6 +245,36 @@ bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMov
return SHFileOperation(&fo) != 0;
}
+OSPLATFORM GetOSPlatform()
+{
+ OSVERSIONINFOEX osvi = {sizeof(OSVERSIONINFOEX)};
+ if (GetVersionEx((OSVERSIONINFO*)&osvi))
+ {
+ if (osvi.dwMajorVersion == 5)
+ {
+ // Not checking for osvi.dwMinorVersion >= 1 because Rainmeter won't run on pre-XP
+ return OSPLATFORM_XP;
+ }
+ else if (osvi.dwMajorVersion == 6)
+ {
+ if (osvi.dwMinorVersion == 0)
+ {
+ return OSPLATFORM_VISTA; // Vista, Server 2008
+ }
+ else
+ {
+ return OSPLATFORM_7; // 7, Server 2008R2
+ }
+ }
+ else // newer OS
+ {
+ return OSPLATFORM_7;
+ }
+ }
+
+ return OSPLATFORM_UNKNOWN;
+}
+
std::string ConvertToAscii(LPCTSTR str)
{
std::string szAscii;
diff --git a/SkinInstaller/Application.h b/SkinInstaller/Application.h
index 08c5f14a..fa286269 100644
--- a/SkinInstaller/Application.h
+++ b/SkinInstaller/Application.h
@@ -44,9 +44,18 @@ struct GLOBALDATA
std::wstring iniFile;
};
+enum OSPLATFORM
+{
+ OSPLATFORM_UNKNOWN = 0,
+ OSPLATFORM_XP,
+ OSPLATFORM_VISTA,
+ OSPLATFORM_7
+};
+
bool CloseRainmeterIfActive();
void LoadTheme(const WCHAR* name);
void PreserveSetting(const std::wstring& from, LPCTSTR key, bool replace = true);
+OSPLATFORM GetOSPlatform();
bool IsRunning(const WCHAR* name, HANDLE* hMutex);
bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMove = false);
diff --git a/SkinInstaller/DialogBackup.cpp b/SkinInstaller/DialogBackup.cpp
index 2e6b0a79..5a649538 100644
--- a/SkinInstaller/DialogBackup.cpp
+++ b/SkinInstaller/DialogBackup.cpp
@@ -105,8 +105,11 @@ INT_PTR CDialogBackup::OnInitDialog(WPARAM wParam, LPARAM lParam)
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_INSTALLER), IMAGE_ICON, 16, 16, LR_SHARED);
SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
- // TODO CHECK VISTA
- SetDialogFont();
+ if (GetOSPlatform() >= OSPLATFORM_VISTA)
+ {
+ // F-Secure et al. detect SetDialogFont() as malware..
+ //SetDialogFont();
+ }
HWND item = GetDlgItem(m_Window, IDC_BACKUP_TAB);
TCITEM tci = {0};
@@ -130,7 +133,10 @@ INT_PTR CDialogBackup::OnCommand(WPARAM wParam, LPARAM lParam)
case IDCLOSE:
if (m_ThreadHandle)
{
- MessageBox(NULL, L"The backup is still in progress. Are you sure you want to cancel?", NULL, MB_YESNO | MB_TOPMOST | MB_ICONHAND);
+ if (IDYES != MessageBox(NULL, L"The backup is still in progress. Are you sure you want to cancel?", NULL, MB_YESNO | MB_TOPMOST | MB_ICONHAND))
+ {
+ break;
+ }
}
EndDialog(m_Window, 0);
break;
@@ -268,13 +274,13 @@ uLong filetime(const char *f, tm_zip *tmzip, uLong *dt)
HANDLE hFind;
WIN32_FIND_DATAA ff32;
- hFind = FindFirstFileA(f,&ff32);
+ hFind = FindFirstFileA(f, &ff32);
if (hFind != INVALID_HANDLE_VALUE)
{
- FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
- FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
- FindClose(hFind);
- ret = 1;
+ FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
+ FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
+ FindClose(hFind);
+ ret = 1;
}
}
return ret;
@@ -285,7 +291,7 @@ bool CDialogBackup::AddFileToBackup(const char* realPath, const char* zipPath)
zip_fileinfo zi = {0};
filetime(realPath, &zi.tmz_date, &zi.dosDate);
- int err = zipOpenNewFileInZip3(m_ZipFile, zipPath, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, NULL, 0);
+ int err = zipOpenNewFileInZip(m_ZipFile, zipPath, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
if (err != ZIP_OK) return false;
FILE* fin = fopen(realPath, "rb");
diff --git a/SkinInstaller/SkinInstaller.vcxproj b/SkinInstaller/SkinInstaller.vcxproj
index 23dbd94c..5c2bbcf2 100644
--- a/SkinInstaller/SkinInstaller.vcxproj
+++ b/SkinInstaller/SkinInstaller.vcxproj
@@ -96,8 +96,8 @@
- Full
- AnySuitable
+ MaxSpeed
+ OnlyExplicitInline
WIN32;NDEBUG;_WINDOWS;ZLIB_WINAPI;NOUNCRYPT;NOCRYPT;ASMV;ASMINF;NOOLDPENTIUMCODE;%(PreprocessorDefinitions)
true
MultiThreadedDLL
@@ -113,8 +113,6 @@
true
false
true
- true
- Speed
NDEBUG;%(PreprocessorDefinitions)
@@ -131,6 +129,8 @@
Version.lib;UxTheme.lib;shlwapi.lib;%(AdditionalDependencies)
wWinMainCRTStartup
.rdata=.text
+ true
+ true
true
@@ -153,8 +153,8 @@
- Full
- AnySuitable
+ MaxSpeed
+ OnlyExplicitInline
WIN32;NDEBUG;_WINDOWS;ZLIB_WINAPI;NOUNCRYPT;NOCRYPT;ASMV;ASMINF;NOOLDPENTIUMCODE;%(PreprocessorDefinitions)
true
MultiThreadedDLL
@@ -170,8 +170,6 @@
true
false
true
- true
- Speed
NDEBUG;_WIN64;%(PreprocessorDefinitions)
@@ -187,6 +185,8 @@
Version.lib;UxTheme.lib;shlwapi.lib;%(AdditionalDependencies)
wWinMainCRTStartup
.rdata=.text
+ true
+ true
true