diff --git a/blockthespot_settings.json b/blockthespot_settings.json index 1c34f6d..8f302de 100644 --- a/blockthespot_settings.json +++ b/blockthespot_settings.json @@ -1,96 +1,96 @@ { - "Latest Release Date": "2024-05-24", - "Block List": [ - "/ads/", - "/ad-logic/", - "/gabo-receiver-service/" - ], - "Zip Reader": { - "home-hpto.css": { - "hptocss": { - "Signature": ".utUDWsORU96S7boXm2Aq{display:-webkit-box;display:-ms-flexbox;display:flex;", - "Value": "none", - "Offset": 70, - "Fill": 0, - "Address": -1 - } - }, - "xpui.js": { - "adsEnabled": { - "Signature": "adsEnabled:!0", - "Value": "1", - "Offset": 12, - "Fill": 0, - "Address": -1 - }, - "ishptohidden": { - "Signature": "isHptoHidden:!0", - "Value": "1", - "Offset": 14, - "Fill": 0, - "Address": -1 - }, - "sponsorship": { - "Signature": ".set(\"allSponsorships\",t.sponsorships)})}(e,t);", - "Value": "\"", - "Offset": 5, - "Fill": 15, - "Address": -1 - }, - "skipsentry": { - "Signature": "sentry.io", - "Value": "localhost", - "Offset": 0, - "Fill": 0, - "Address": -1 - }, - "hptoEnabled": { - "Signature": "hptoEnabled:!0", - "Value": "1", - "Offset": 13, - "Fill": 0, - "Address": -1 - }, - "sp_localhost": { - "Signature": "sp://ads/v1/ads/", - "Value": "sp://localhost//", - "Offset": 0, - "Fill": 0, - "Address": -1 - }, - "premium_free": { - "Signature": "\"free\"===(null===(t=e.session)", - "Value": "\"\"", - "Offset": 0, - "Fill": 4, - "Address": -1 - } + "Latest Release Date": "2024-06-16", + "Block List": [ + "/ads/", + "/ad-logic/", + "/gabo-receiver-service/" + ], + "Zip Reader": { + "home-hpto.css": { + "hptocss": { + "Signature": ".utUDWsORU96S7boXm2Aq{display:-webkit-box;display:-ms-flexbox;display:flex;", + "Value": "none", + "Offset": 70, + "Fill": 0, + "Address": -1 } }, - "Developer": { - "x64": { - "Signature": "80 E3 01 48 8B 95 ?? ?? ?? ?? 48 83 FA 10", - "Value": "B3 01 90", + "xpui.js": { + "adsEnabled": { + "Signature": "adsEnabled:!0", + "Value": "1", + "Offset": 12, + "Fill": 0, + "Address": -1 + }, + "ishptohidden": { + "Signature": "isHptoHidden:!0", + "Value": "1", + "Offset": 14, + "Fill": 0, + "Address": -1 + }, + "sponsorship": { + "Signature": ".set(\"allSponsorships\",t.sponsorships)})}(e,t);", + "Value": "\"", + "Offset": 5, + "Fill": 15, + "Address": -1 + }, + "skipsentry": { + "Signature": "sentry.io", + "Value": "localhost", + "Offset": 0, + "Fill": 0, + "Address": -1 + }, + "hptoEnabled": { + "Signature": "hptoEnabled:!0", + "Value": "1", + "Offset": 13, + "Fill": 0, + "Address": -1 + }, + "sp_localhost": { + "Signature": "sp://ads/v1/ads/", + "Value": "sp://localhost//", "Offset": 0, + "Fill": 0, "Address": -1 }, - "x32": { - "Signature": "25 01 FF FF FF 89 ?? ?? ?? FF FF", - "Value": "B8 03 00", + "premium_free": { + "Signature": "\"free\"===(null===(t=e.session)", + "Value": "\"", "Offset": 0, + "Fill": 4, "Address": -1 } + } + }, + "Developer": { + "x64": { + "Signature": "80 E3 01 48 8B 95 ?? ?? ?? ?? 48 83 FA 10", + "Value": "B3 01 90", + "Offset": 0, + "Address": -1 }, - "Cef Offsets": { - "x64": { - "cef_request_t_get_url": 48, - "cef_zip_reader_t_get_file_name": 72, - "cef_zip_reader_t_read_file": 112 - }, - "x32": { - "cef_request_t_get_url": 24, - "cef_zip_reader_t_get_file_name": 36, - "cef_zip_reader_t_read_file": 56 - } + "x32": { + "Signature": "25 01 FF FF FF 89 ?? ?? ?? FF FF", + "Value": "B8 03 00", + "Offset": 0, + "Address": -1 + } + }, + "Cef Offsets": { + "x64": { + "cef_request_t_get_url": 48, + "cef_zip_reader_t_get_file_name": 72, + "cef_zip_reader_t_read_file": 112 + }, + "x32": { + "cef_request_t_get_url": 24, + "cef_zip_reader_t_get_file_name": 36, + "cef_zip_reader_t_read_file": 56 } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/src/BasicUtils/Json.cpp b/src/BasicUtils/Json.cpp index 48d0bcb..c39ced1 100644 --- a/src/BasicUtils/Json.cpp +++ b/src/BasicUtils/Json.cpp @@ -407,7 +407,7 @@ Json Json::parse(std::wistream& is) } } catch (const std::exception& e) { - LogError(L"{}", e.what()); + LogError(Utils::ToString(e.what())); return Json(); } } diff --git a/src/BasicUtils/Utils.cpp b/src/BasicUtils/Utils.cpp index 6621902..965869d 100644 --- a/src/BasicUtils/Utils.cpp +++ b/src/BasicUtils/Utils.cpp @@ -303,25 +303,5 @@ namespace Utils SetConsoleTitleW(FormatString(L"Execution time: {:f} seconds", diff.count()).c_str()); } } - - void PrintSymbols(std::wstring_view module_name) - { - HMODULE hModule = GetModuleHandleW(module_name.data()); - if (!hModule && !(hModule = LoadLibraryW(module_name.data()))) { - PrintError(L"PrintSymbols: Failed to load module."); - return; - } - - PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)hModule; - PIMAGE_NT_HEADERS ntHeaders = (PIMAGE_NT_HEADERS)((BYTE*)dosHeader + dosHeader->e_lfanew); - PIMAGE_EXPORT_DIRECTORY exportDirectory = (PIMAGE_EXPORT_DIRECTORY)((BYTE*)dosHeader + ntHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress); - PDWORD functions = (PDWORD)((BYTE*)dosHeader + exportDirectory->AddressOfFunctions); - PDWORD names = (PDWORD)((BYTE*)dosHeader + exportDirectory->AddressOfNames); - PWORD ordinals = (PWORD)((BYTE*)dosHeader + exportDirectory->AddressOfNameOrdinals); - - for (DWORD i = 0; i < exportDirectory->NumberOfNames; i++) { - Print(L"{}", reinterpret_cast((BYTE*)dosHeader + names[i])); - } - } #endif // NDEBUG }; \ No newline at end of file diff --git a/src/BasicUtils/Utils.h b/src/BasicUtils/Utils.h index 4ea001c..1646133 100644 --- a/src/BasicUtils/Utils.h +++ b/src/BasicUtils/Utils.h @@ -33,8 +33,8 @@ namespace Utils bool Equals(std::string_view str1, std::string_view str2, bool case_sensitive = false); bool Equals(std::wstring_view str1, std::wstring_view str2, bool case_sensitive = false); - void WriteIniFile(std::wstring_view ini_path, std::wstring_view section, std::wstring_view key, std::wstring_view value); - std::wstring ReadIniFile(std::wstring_view ini_path, std::wstring_view section, std::wstring_view key); + void WriteIniFile(std::wstring_view ini_path, std::wstring_view section, std::wstring_view key, std::wstring_view value); + std::wstring ReadIniFile(std::wstring_view ini_path, std::wstring_view section, std::wstring_view key); bool ReadFile(const std::wstring_view filename, std::wstring& out); bool WriteFile(const std::wstring_view filename, const std::wstring_view content); @@ -43,29 +43,8 @@ namespace Utils #ifndef NDEBUG void MeasureExecutionTime(std::function func, bool total_duration = true); - void PrintSymbols(std::wstring_view module_name); #endif - template - const auto& TypeConvert(const T& arg) - { - if constexpr (std::is_same_v) { - return std::wstring_view(arg); - } - else if constexpr (std::is_same_v) { - return ToString(arg); - } - else if constexpr (std::is_same_v < T, void*>) { - return reinterpret_cast(arg); - } - else if constexpr (std::is_pointer_v) { - return *arg; - } - else { - return arg; - } - } - std::string FormatString(std::string_view fmt, const auto&... args) { return std::vformat(fmt, std::make_format_args(args...)); @@ -73,7 +52,7 @@ namespace Utils std::wstring FormatString(std::wstring_view fmt, const auto&... args) { - return std::vformat(fmt, std::make_wformat_args(TypeConvert(args)...)); + return std::vformat(fmt, std::make_wformat_args(args...)); } enum class Color : WORD diff --git a/src/SettingsManager.cpp b/src/SettingsManager.cpp index f2b6b19..7450114 100644 --- a/src/SettingsManager.cpp +++ b/src/SettingsManager.cpp @@ -23,7 +23,7 @@ void SettingsManager::Init() bool SettingsManager::Save() { - m_latest_release_date = L"2024-05-24"; // Update only when significant changes occur. + m_latest_release_date = L"2024-06-16"; // Update only when significant changes occur. m_block_list = { L"/ads/", @@ -86,7 +86,7 @@ bool SettingsManager::Save() }}, {L"premium_free", { {L"Signature", L"\"free\"===(null===(t=e.session)"}, - {L"Value", L"\"\""}, + {L"Value", L"\""}, {L"Offset", 0}, {L"Fill", 4}, {L"Address", -1} @@ -224,8 +224,8 @@ bool SettingsManager::UpdateSettingsFromServer() if (!CompareSettings(server_settings)) { const auto forced_update = m_latest_release_date != server_settings.at(L"Latest Release Date"); - - if (!Load(server_settings) && !Utils::WriteFile(m_app_settings_file, server_settings.dump(2))) { + + if (!Load(server_settings) || !Utils::WriteFile(m_app_settings_file, server_settings.dump(2))) { LogError(L"Failed to load server settings or write to the settings file: {}", m_app_settings_file); return false; }