diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2023-09-25 10:41:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 10:41:00 (GMT) |
commit | f64267fd947697649b45efeab04c241584b549cb (patch) | |
tree | 4cc4fa9c03e17a88f65a0eebdb514424e21a6be0 | |
parent | 08cfea52fcd535d32bbca6abf893164c8bb2f7e9 (diff) | |
parent | eddafdd7e733241f92900035953f6bcf7c7677e3 (diff) | |
download | Ninja-f64267fd947697649b45efeab04c241584b549cb.zip Ninja-f64267fd947697649b45efeab04c241584b549cb.tar.gz Ninja-f64267fd947697649b45efeab04c241584b549cb.tar.bz2 |
Merge pull request #2329 from digit-google/fix-mingw-compilation
Fix Mingw cross-compilation.
-rw-r--r-- | src/disk_interface.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc index ed064e1..0f27e9d 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -23,10 +23,10 @@ #include <sys/types.h> #ifdef _WIN32 -#include <sstream> -#include <windows.h> #include <direct.h> // _mkdir -#include <atlcore.h> +#include <windows.h> + +#include <sstream> #else #include <unistd.h> #endif @@ -162,10 +162,16 @@ RealDiskInterface::RealDiskInterface() #ifdef _WIN32 : use_cache_(false), long_paths_enabled_(false) { setlocale(LC_ALL, ""); - IFDYNAMICGETCACHEDFUNCTIONTYPEDEF(L"ntdll", BOOLEAN(WINAPI*)(), - "RtlAreLongPathsEnabled", - RtlAreLongPathsEnabled) { - long_paths_enabled_ = RtlAreLongPathsEnabled(); + + // Probe ntdll.dll for RtlAreLongPathsEnabled, and call it if it exists. + HINSTANCE ntdll_lib = ::GetModuleHandleW(L"ntdll"); + if (ntdll_lib) { + typedef BOOLEAN(WINAPI FunctionType)(); + auto* func_ptr = reinterpret_cast<FunctionType*>( + ::GetProcAddress(ntdll_lib, "RtlAreLongPathsEnabled")); + if (func_ptr) { + long_paths_enabled_ = (*func_ptr)(); + } } } #else |