Fix more warnings

This commit is contained in:
momo5502
2025-05-31 10:47:42 +02:00
parent c50fdd17a4
commit 37dd387560
4 changed files with 93 additions and 81 deletions

View File

@@ -1,14 +1,16 @@
include_guard()
find_program(SCCACHE sccache)
if(CMAKE_GENERATOR STREQUAL "Ninja")
find_program(SCCACHE sccache)
if (SCCACHE)
file(TO_CMAKE_PATH "${SCCACHE}" SCCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE})
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
if (SCCACHE)
file(TO_CMAKE_PATH "${SCCACHE}" SCCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE})
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
if(POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
if(POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
endif()
endif()
endif()
endif()

View File

@@ -473,45 +473,50 @@ namespace
return options;
}
int run_main(const int argc, char** argv)
{
try
{
auto args = bundle_arguments(argc, argv);
if (args.empty())
{
print_help();
return 1;
}
const auto options = parse_options(args);
bool result{};
do
{
result = run(options, args);
} while (options.use_gdb);
return result ? 0 : 1;
}
catch (std::exception& e)
{
puts(e.what());
#if defined(_WIN32) && 0
MessageBoxA(nullptr, e.what(), "ERROR", MB_ICONERROR);
#endif
}
return 1;
}
}
int main(const int argc, char** argv)
{
try
{
auto args = bundle_arguments(argc, argv);
if (args.empty())
{
print_help();
return 1;
}
const auto options = parse_options(args);
bool result{};
do
{
result = run(options, args);
} while (options.use_gdb);
return result ? 0 : 1;
}
catch (std::exception& e)
{
puts(e.what());
#if defined(_WIN32) && 0
MessageBoxA(nullptr, e.what(), "ERROR", MB_ICONERROR);
#endif
}
return 1;
return run_main(argc, argv);
}
#ifdef _WIN32
int WINAPI WinMain(HINSTANCE, HINSTANCE, PSTR, int)
{
return main(__argc, __argv);
return run_main(__argc, __argv);
}
#endif

View File

@@ -166,46 +166,51 @@ namespace
forward_emulator(win_emu);
run_fuzzer(win_emu);
}
int run_main(const int argc, char** argv)
{
if (argc <= 1)
{
puts("Application not specified!");
return 1;
}
// setvbuf(stdout, nullptr, _IOFBF, 0x10000);
if (argc > 2 && argv[1] == "-d"s)
{
use_gdb = true;
}
try
{
do
{
run(argv[use_gdb ? 2 : 1]);
} while (use_gdb);
return 0;
}
catch (std::exception& e)
{
puts(e.what());
#if defined(_WIN32) && 0
MessageBoxA(nullptr, e.what(), "ERROR", MB_ICONERROR);
#endif
}
return 1;
}
}
int main(const int argc, char** argv)
{
if (argc <= 1)
{
puts("Application not specified!");
return 1;
}
// setvbuf(stdout, nullptr, _IOFBF, 0x10000);
if (argc > 2 && argv[1] == "-d"s)
{
use_gdb = true;
}
try
{
do
{
run(argv[use_gdb ? 2 : 1]);
} while (use_gdb);
return 0;
}
catch (std::exception& e)
{
puts(e.what());
#if defined(_WIN32) && 0
MessageBoxA(nullptr, e.what(), "ERROR", MB_ICONERROR);
#endif
}
return 1;
return run_main(argc, argv);
}
#ifdef _WIN32
int WINAPI WinMain(HINSTANCE, HINSTANCE, PSTR, int)
{
return main(__argc, __argv);
return run_main(__argc, __argv);
}
#endif

View File

@@ -24,14 +24,14 @@ int main()
const auto peb = static_cast<PPEB64>(GetCurrentProcessPeb());
const auto api_set_map = reinterpret_cast<API_SET_NAMESPACE*>(peb->ApiSetMap);
printf("APISET: 0x%p\n", api_set_map);
printf("Version: %d\n", api_set_map->Version);
printf("Size: %08X\n", api_set_map->Size);
printf("Flags: %08X\n", api_set_map->Flags);
printf("Count: %d\n", api_set_map->Count);
printf("EntryOffset: %08X\n", api_set_map->EntryOffset);
printf("HashOffset: %08X\n", api_set_map->HashOffset);
printf("HashFactor: %08X\n", api_set_map->HashFactor);
printf("APISET: 0x%p\n", static_cast<void*>(api_set_map));
printf("Version: %lu\n", api_set_map->Version);
printf("Size: %08lX\n", api_set_map->Size);
printf("Flags: %08lX\n", api_set_map->Flags);
printf("Count: %lu\n", api_set_map->Count);
printf("EntryOffset: %08lX\n", api_set_map->EntryOffset);
printf("HashOffset: %08lX\n", api_set_map->HashOffset);
printf("HashFactor: %08lX\n", api_set_map->HashFactor);
// print_apiset(apiSetMap);
// Compress the API-SET binary blob
@@ -68,7 +68,7 @@ void print_apiset(PAPI_SET_NAMESPACE api_set_map)
std::wstring name(reinterpret_cast<wchar_t*>(reinterpret_cast<ULONG_PTR>(api_set_map) + entry->NameOffset),
entry->NameLength / sizeof(wchar_t));
printf("-----------\n[%05d]: Contract Name: %ls\n", i, name.data());
printf("-----------\n[%05lu]: Contract Name: %ls\n", i, name.data());
for (ULONG x = 0; x < entry->ValueCount; x++)
{