commit f20d82f2139cc962ceffd8060d2e54b39e8c329f
parent ea01f03f2e47071ce36aae30a6de7f31bc5d9c8d
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Mon, 8 Jun 2026 23:27:59 -0700
env/windows: include windows.h before psapi.h (mingw cross-build)
mingw's <psapi.h>/<process.h> use windows.h types (WINBOOL/DWORD/LPVOID)
and do not self-include it, so the alphabetized include order (psapi before
windows) failed to compile under the llvm-mingw cross-toolchain. Pull
windows.h into its own leading include group so a formatter sort cannot
reorder it. Surfaced while standing up an aarch64-windows cross-build of
kit; the remaining windows.c host-env build issues (SEH __try, attribute
thread, dllimport) are separate and pre-existing.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/driver/env/windows.c b/driver/env/windows.c
@@ -36,12 +36,17 @@
#define _WIN32_WINNT \
0x0601 /* Windows 7+: SRWLock, AddVectoredExceptionHandler */
#endif
+/* windows.h must precede psapi.h/process.h: the mingw SDK headers use
+ * windows.h's WINBOOL/DWORD/LPVOID etc. and do not self-include it. Kept in
+ * its own include group so a formatter's alphabetic sort can't reorder it
+ * after psapi.h (which breaks the mingw cross-build). */
+#include <windows.h>
+
#include <io.h>
#include <process.h>
#include <psapi.h>
#include <stdint.h>
#include <stdio.h>
-#include <windows.h>
#define _CRT_RAND_S /* enable rand_s (OS CSPRNG) */
#include <setjmp.h>
#include <stdlib.h>