code cleanup and a few edits (#520)

* Fixed parameter error for x64 architecture.

* code cleanup and a few edits

* libcef library added

---------

Co-authored-by: Yolilad <Yolilad@>
This commit is contained in:
Yolilad 2024-02-24 10:36:49 +03:00 committed by GitHub
parent 40dd9b2ce0
commit 1992deedc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 1071 additions and 2267 deletions

View file

@ -2,74 +2,34 @@
#ifndef NDEBUG
#include <intrin.h>
//void print_test() {
// // Example colors vector
// std::vector<Color> colors = { Color::Red, Color::Green, Color::Blue };
//
// // Example 6: Uppercase hexadecimal formatting
// int hex_value = 255;
// Print(colors, L"The uppercase hexadecimal value is {:X}.", hex_value);
// // Output: The uppercase hexadecimal value is FF.
//
// // Example 7: Hexadecimal formatting with "0x" prefix
// int hex_value_with_prefix = 123;
// Print(colors, L"The hexadecimal value with prefix is {:#x}.", hex_value_with_prefix);
// // Output: The hexadecimal value with prefix is 0x7b.
//
// // Example 8: Multiple arguments with different format specifiers
// double temperature = 23.5;
// int year = 2023;
// std::wstring location = L"New York";
// Print(colors, L"Date: {}, Temperature: {:.1f} °C, Year: {:d}, Location: {}.", L"July 22", temperature, year, location);
// // Output: Date: July 22, Temperature: 23.5 °C, Year: 2023, Location: New York.
//
// // Example 9: Handling missing arguments
// Print(colors, L"{} + {} = {}.", 2, 3);
// // Output: 2 + 3 = {}.
//
// // Example 10: Using the same argument multiple times
// int value = 7;
// Print(colors, L"{} * {} = {} and {} + {} = {}.", value, 3, value * 3, value, 5, value + 5);
// // Output: 7 * 3 = 21 and 7 + 5 = 12.
//
// // Example 11: Using non-default colors
// std::vector<Color> custom_colors = { Color::Yellow, Color::Magenta };
// Print(custom_colors, L"Custom colors: {} and {}.", L"Yellow", L"Magenta");
// // Output: Custom colors: Yellow and Magenta.
//}
//typedef void(__stdcall* cef_string_utf16_clear_t)(void*);
//cef_string_utf16_clear_t cef_string_utf16_clear_orig = nullptr;
//
//void __stdcall hook_cef_string_utf16_clear(void* str) {
// std::wstring wstr(*reinterpret_cast<wchar_t**>(str));
// if (wstr == L"xpui.js") {
// Print({ Color::Yellow }, L"[{}]: {:#x} | {}", L"cef_string_utf16_clear", _ReturnAddress(), wstr);
// _wsystem(L"pause");
// }
//
// return cef_string_utf16_clear_orig(str);
//}
DWORD WINAPI Debug(LPVOID lpParam)
{
try
{
try {
const auto cef_request_t_get_url = offsetof(cef_request_t, get_url);
const auto cef_zip_reader_get_file_name = offsetof(cef_zip_reader_t, get_file_name);
const auto cef_zip_reader_t_read_file = offsetof(cef_zip_reader_t, read_file);
if (cef_request_t_get_url != cef_request_t_get_url_offset) {
PrintError(L"The offset of cef_request_t::get_url has changed: {}", cef_request_t_get_url);
}
if (cef_zip_reader_get_file_name != cef_zip_reader_get_file_name_offset) {
PrintError(L"The offset of cef_zip_reader_t::get_file_name has changed: {}", cef_zip_reader_get_file_name);
}
if (cef_zip_reader_t_read_file != cef_zip_reader_t_read_file_offset) {
PrintError(L"The offset of cef_zip_reader_t::read_file has changed: {}", cef_zip_reader_t_read_file);
}
//Utils::PrintSymbols(L"chrome_elf.dll");
Utils::MeasureExecutionTime([&]() {
//Utils::PrintSymbols(L"chrome_elf.dll");
//print_test();
//const auto cef_string_utf16_clear_func = PatternScanner::GetFunctionAddress(L"libcef.dll", L"cef_string_utf16_clear");
//cef_string_utf16_clear_orig = (cef_string_utf16_clear_t)cef_string_utf16_clear_func.data();
//cef_string_utf16_clear_func.hook((PVOID)hook_cef_string_utf16_clear);
}, L"DEBUG");
});
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
catch (const std::exception& e) {
Print(e.what());
}
return 0;
}