Temporary fix for false positive issues with some AVs.

This commit is contained in:
Birunthan Mohanathas 2011-11-27 18:18:34 +00:00
parent 2e22c542cc
commit 30117612d1
4 changed files with 62 additions and 17 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;
@ -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");

View File

@ -96,8 +96,8 @@
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;ZLIB_WINAPI;NOUNCRYPT;NOCRYPT;ASMV;ASMINF;NOOLDPENTIUMCODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -113,8 +113,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<ExceptionHandling>false</ExceptionHandling>
<IntrinsicFunctions>true</IntrinsicFunctions>
<OmitFramePointers>true</OmitFramePointers>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -131,6 +129,8 @@
<AdditionalDependencies>Version.lib;UxTheme.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
<MergeSections>.rdata=.text</MergeSections>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
@ -153,8 +153,8 @@
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;ZLIB_WINAPI;NOUNCRYPT;NOCRYPT;ASMV;ASMINF;NOOLDPENTIUMCODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@ -170,8 +170,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<ExceptionHandling>false</ExceptionHandling>
<IntrinsicFunctions>true</IntrinsicFunctions>
<OmitFramePointers>true</OmitFramePointers>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -187,6 +185,8 @@
<AdditionalDependencies>Version.lib;UxTheme.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EntryPointSymbol>wWinMainCRTStartup</EntryPointSymbol>
<MergeSections>.rdata=.text</MergeSections>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>