--- libxml2-2.13.8/catalog.c.orig	2025-07-03 08:52:27.341264600 +0200
+++ libxml2-2.13.8/catalog.c	2025-07-03 09:11:36.330242700 +0200
@@ -59,6 +59,38 @@
 #define XML_SGML_DEFAULT_CATALOG "file://" XML_SYSCONFDIR "/sgml/catalog"
 #endif
 
+#ifdef __MINGW32__
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+static const char* _get_xml_default_catalog(void) {
+    static char reloc_path[MAX_PATH * 2] = {0};
+    static int initialized = 0;
+    if (!initialized) {
+        HMODULE module_handle;
+        char module_path[MAX_PATH];
+        char* last_slash;
+        if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+                               GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+                               (LPCSTR)&_get_xml_default_catalog, 
+                               &module_handle) ||
+            !GetModuleFileNameA(module_handle, module_path, sizeof(module_path))) {
+            return "file://" XML_SYSCONFDIR "/xml/catalog";
+        }
+        last_slash = strrchr(module_path, '\\');
+        if (last_slash) {
+            *last_slash = '\0';
+        }
+        snprintf(reloc_path, sizeof(reloc_path), "%s\\..\\etc\\xml\\catalog", module_path);
+        initialized = 1;
+    }
+    return reloc_path;
+}
+
+#undef XML_XML_DEFAULT_CATALOG
+#define XML_XML_DEFAULT_CATALOG _get_xml_default_catalog()
+#endif
+
 static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID);
 static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename);
 
--- libxml2-2.13.8/xmllint.c.orig	2025-04-17 13:51:37.000000000 +0200
+++ libxml2-2.13.8/xmllint.c	2025-07-03 09:12:52.266746000 +0200
@@ -91,6 +91,38 @@
 #define XML_XML_DEFAULT_CATALOG "file://" XML_SYSCONFDIR "/xml/catalog"
 #endif
 
+#ifdef __MINGW32__
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+static const char* _get_xml_default_catalog(void) {
+    static char reloc_path[MAX_PATH * 2] = {0};
+    static int initialized = 0;
+    if (!initialized) {
+        HMODULE module_handle;
+        char module_path[MAX_PATH];
+        char* last_slash;
+        if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+                               GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+                               (LPCSTR)&_get_xml_default_catalog, 
+                               &module_handle) ||
+            !GetModuleFileNameA(module_handle, module_path, sizeof(module_path))) {
+            return "file://" XML_SYSCONFDIR "/xml/catalog";
+        }
+        last_slash = strrchr(module_path, '\\');
+        if (last_slash) {
+            *last_slash = '\0';
+        }
+        snprintf(reloc_path, sizeof(reloc_path), "%s\\..\\etc\\xml\\catalog", module_path);
+        initialized = 1;
+    }
+    return reloc_path;
+}
+
+#undef XML_XML_DEFAULT_CATALOG
+#define XML_XML_DEFAULT_CATALOG _get_xml_default_catalog()
+#endif
+
 #ifndef STDIN_FILENO
   #define STDIN_FILENO 0
 #endif
--- libxml2-2.13.8/xmlcatalog.c.orig	2025-04-17 13:51:37.000000000 +0200
+++ libxml2-2.13.8/xmlcatalog.c	2025-07-03 09:11:05.140189000 +0200
@@ -42,6 +42,38 @@
 #define XML_SGML_DEFAULT_CATALOG XML_SYSCONFDIR "/sgml/catalog"
 #endif
 
+#ifdef __MINGW32__
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+static const char* _get_sgml_default_catalog(void) {
+    static char reloc_path[MAX_PATH * 2] = {0};
+    static int initialized = 0;
+    if (!initialized) {
+        HMODULE module_handle;
+        char module_path[MAX_PATH];
+        char* last_slash;
+        if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+                               GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+                               (LPCSTR)&_get_sgml_default_catalog, 
+                               &module_handle) ||
+            !GetModuleFileNameA(module_handle, module_path, sizeof(module_path))) {
+            return XML_SYSCONFDIR "/sgml/catalog";
+        }
+        last_slash = strrchr(module_path, '\\');
+        if (last_slash) {
+            *last_slash = '\0';
+        }
+        snprintf(reloc_path, sizeof(reloc_path), "%s\\..\\etc\\sgml\\catalog", module_path);
+        initialized = 1;
+    }
+    return reloc_path;
+}
+
+#undef XML_SGML_DEFAULT_CATALOG
+#define XML_SGML_DEFAULT_CATALOG _get_sgml_default_catalog()
+#endif
+
 /************************************************************************
  *									*
  *			Shell Interface					*
