Commit: a7d7ea1dd212eea6c4d76bf43d220ddc493418e7 Parent: 76bec95f22dc009170b04712f4440773de1fea27 Author: Randy Palamar Date: Thu, 10 Oct 2024 10:22:33 -0600 fix w32_file_info struct layout Diffstat:
M | os_win32.c | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/os_win32.c b/os_win32.c @@ -33,7 +33,11 @@ typedef struct { u16 wProcessorRevision; } w32_sys_info; -typedef struct { +/* NOTE: this is packed because the w32 api designers are dumb and ordered the members + * incorrectly. They worked around it be making the ft* members a struct {u32, u32} which + * is aligned on a 4-byte boundary. Then in their documentation they explicitly tell you not + * to cast to u64 because "it can cause alignment faults on 64-bit Windows" - go figure */ +typedef struct __attribute__((packed)) { u32 dwFileAttributes; u64 ftCreationTime; u64 ftLastAccessTime;