This commit is contained in:
Birunthan Mohanathas 2013-03-10 18:03:23 +02:00
parent ad59b70768
commit 5717c38577
2 changed files with 0 additions and 54 deletions

View File

@ -660,12 +660,6 @@ bool CDialogInstall::ReadOptions(const WCHAR* file)
bool CDialogInstall::InstallPackage() bool CDialogInstall::InstallPackage()
{ {
if (IsPackageBlacklisted())
{
m_ErrorMessage = L"This package has been identified as malware by the Rainmeter Team and will not be installed.";
return false;
}
if ((!m_MergeSkins && m_BackupSkins) || m_BackupPackage) if ((!m_MergeSkins && m_BackupSkins) || m_BackupPackage)
{ {
// Move skins into backup folder // Move skins into backup folder
@ -957,52 +951,6 @@ UINT __stdcall CDialogInstall::InstallThread(void* pParam)
return 0; return 0;
} }
bool CDialogInstall::IsPackageBlacklisted()
{
std::string fileName = ConvertToAscii(PathFindFileName(m_PackageFileName.c_str()));
const char* fileNameSz = fileName.c_str();
const char* regex = "(?siU)^.*_by_([0-9A-Za-z\\-]+)-d[0-9a-z]{6}\\.rmskin$";
const char* error;
int errorOffset;
pcre* re = pcre_compile(regex, PCRE_UTF8, &error, &errorOffset, NULL);
int offsets[6];
bool match = pcre_exec(re, NULL, fileNameSz, fileName.length(), 0, 0, offsets, _countof(offsets)) == 2;
pcre_free(re);
if (!match)
{
return false;
}
bool isBlacklisted = false;
// Author is the 2nd substring
std::string author(fileNameSz + offsets[2], offsets[3] - offsets[2]);
std::wstring url = L"http://blacklist.rainmeter.googlecode.com/git/user/" + ConvertToWide(author.c_str());
HINTERNET internet = InternetOpen(L"Mozilla/5.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (internet)
{
DWORD openFlags = INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_NO_UI;
HINTERNET internetUrl = InternetOpenUrl(internet, url.c_str(), NULL, 0, openFlags, 0);
if (internetUrl)
{
DWORD queryFlags = HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER;
DWORD statusCode;
DWORD size = sizeof(DWORD);
BOOL query = HttpQueryInfo(internetUrl, queryFlags, &statusCode, &size, NULL);
InternetCloseHandle(internetUrl);
isBlacklisted = query && statusCode == HTTP_STATUS_OK;
}
InternetCloseHandle(internet);
}
return isBlacklisted;
}
void CDialogInstall::KeepVariables() void CDialogInstall::KeepVariables()
{ {
WCHAR keyname[32767]; // Max size returned by GetPrivateProfileSection WCHAR keyname[32767]; // Max size returned by GetPrivateProfileSection

View File

@ -85,8 +85,6 @@ private:
static UINT __stdcall InstallThread(void* pParam); static UINT __stdcall InstallThread(void* pParam);
bool ExtractCurrentFile(const std::wstring& fileName); bool ExtractCurrentFile(const std::wstring& fileName);
bool IsPackageBlacklisted();
void LaunchRainmeter(); void LaunchRainmeter();
void KeepVariables(); void KeepVariables();