From 3ee8c4958259efa07968818ae62ba6078e319d1b Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sun, 18 Dec 2022 02:24:32 -0800 Subject: [PATCH] windows: Map EXE_MACHINE_TYPE_MISMATCH to InvalidExe Seems to happen if the command trying to be executed has the extension .exe and it's an invalid executable. --- lib/std/os/windows.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 6ad3ac62b2..556d32c8ea 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -1624,6 +1624,9 @@ pub fn CreateProcessW( .RING2SEG_MUST_BE_MOVABLE, .RELOC_CHAIN_XEEDS_SEGLIM, .INFLOOP_IN_RELOC_CHAIN, // MAX_EXEC_ERROR in errno.cpp + // This one is not mapped to ENOEXEC but it is possible, for example + // when calling CreateProcessW on a plain text file with a .exe extension + .EXE_MACHINE_TYPE_MISMATCH, => return error.InvalidExe, else => |err| return unexpectedError(err), }