mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Tweaks
This commit is contained in:
parent
ad59b70768
commit
5717c38577
@ -660,12 +660,6 @@ bool CDialogInstall::ReadOptions(const WCHAR* file)
|
||||
|
||||
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)
|
||||
{
|
||||
// Move skins into backup folder
|
||||
@ -957,52 +951,6 @@ UINT __stdcall CDialogInstall::InstallThread(void* pParam)
|
||||
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()
|
||||
{
|
||||
WCHAR keyname[32767]; // Max size returned by GetPrivateProfileSection
|
||||
|
@ -85,8 +85,6 @@ private:
|
||||
static UINT __stdcall InstallThread(void* pParam);
|
||||
bool ExtractCurrentFile(const std::wstring& fileName);
|
||||
|
||||
bool IsPackageBlacklisted();
|
||||
|
||||
void LaunchRainmeter();
|
||||
void KeepVariables();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user