Commit 519400bf75ec7846e50a70f620d6dd4d570b258d

Pali Rohár 2023-05-21T14:26:47

Fix compilation with the first NT SDK First NT SDK available in the first 32-bit MSVC NT compiler does not provide some defines. Add them for compatibility.

diff --git a/src/dlfcn.c b/src/dlfcn.c
index 8dc0359..c4563d2 100644
--- a/src/dlfcn.c
+++ b/src/dlfcn.c
@@ -45,6 +45,19 @@ typedef ULONG ULONG_PTR;
 #ifndef GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
 #define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT 0x2
 #endif
+#ifndef IMAGE_NT_OPTIONAL_HDR_MAGIC
+#ifdef _WIN64
+#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x20b
+#else
+#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#endif
+#endif
+#ifndef IMAGE_DIRECTORY_ENTRY_IAT
+#define IMAGE_DIRECTORY_ENTRY_IAT 12
+#endif
+#ifndef LOAD_WITH_ALTERED_SEARCH_PATH
+#define LOAD_WITH_ALTERED_SEARCH_PATH 0x8
+#endif
 
 #ifdef _MSC_VER
 #if _MSC_VER >= 1000