fix compilation of cold client loader on msys2

This commit is contained in:
otavepto 2024-05-24 06:22:14 +03:00
parent e38172dc1b
commit 72f25c7b3b
3 changed files with 19 additions and 5 deletions

View File

@ -6,6 +6,7 @@
#include <string>
#include <string_view>
#include <cstdint>
namespace pe_helpers
{

View File

@ -345,7 +345,6 @@ filter { "action:vs*", }
-- source of emittoolversioninfo: https://developercommunity.visualstudio.com/t/add-linker-option-to-strip-rich-stamp-from-exe-hea/740443
"/NOLOGO", "/emittoolversioninfo:no"
}
-- GNU make common compiler/linker options
filter { "action:gmake*", }
buildoptions {
@ -359,11 +358,24 @@ filter { "action:gmake*" , "files:*.cpp or *.cc or *.hpp", }
buildoptions {
"-fno-char8_t", -- GCC gives a warning when a .c file is compiled with this
}
-- MinGw on Windows cannot compile 'creatwth.cpp' from Detours lib (error: 'DWordMult' was not declared in this scope)
-- because intsafe.h isn't included by default
-- MinGw on Windows common compiler/linker options
filter { "system:windows", "action:gmake*", }
buildoptions {
"-include intsafe.h"
-- MinGw on Windows cannot compile 'creatwth.cpp' from Detours lib (error: 'DWordMult' was not declared in this scope)
-- because intsafe.h isn't included by default
"-include intsafe.h",
}
-- source: https://gcc.gnu.org/onlinedocs/gcc/Cygwin-and-MinGW-Options.html
linkoptions {
-- MinGW on Windows cannot link wWinMain by default
"-municode",
-- from docs: "specifies that the typical Microsoft Windows predefined macros are to be set in the pre-processor,
-- but does not influence the choice of runtime library/startup code"
-- optional really
'-mwin32',
}
filter { "system:windows", "action:gmake*", "platforms:x64" }
buildoptions {
}
filter {} -- reset the filter and remove all active keywords

View File

@ -15,6 +15,7 @@
#include <filesystem>
#include <set>
#include <thread>
#include <algorithm>
static std::wstring IniFile{};
@ -60,7 +61,7 @@ std::wstring get_ini_value(LPCWSTR section, LPCWSTR key, LPCWSTR default_val = N
static std::vector<uint8_t> get_pe_header(const std::wstring &filepath)
{
try {
std::ifstream file(filepath, std::ios::binary);
std::ifstream file(std::filesystem::path(filepath), std::ios::binary);
if (!file.is_open()) throw;
file.seekg(0, std::ios::beg);