| author | |
| committer | |
| log | 5843b7987e705ec01d07cd98a7f7bb10aa579587 |
| tree | 8a674a778f34a041c24de8018df53d6244d6929b |
| parent | b362cbbc9fb4ab09c6a52948476d3d7dff27d795 |
2 files changed, 25 insertions(+), 2 deletions(-)
lib/std/child_process.zig+3-2| ... | ... | @@ -966,7 +966,7 @@ pub const ChildProcess = struct { |
| 966 | 966 | defer self.allocator.free(cmd_line_w); |
| 967 | 967 | |
| 968 | 968 | windowsCreateProcess(app_path_w.ptr, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo) catch |no_path_err| { |
| 969 | if (no_path_err != error.FileNotFound) return no_path_err; | |
| 969 | if (no_path_err != error.FileNotFound and no_path_err != error.InvalidExe) return no_path_err; | |
| 970 | 970 | |
| 971 | 971 | const PATH: [:0]const u16 = std.os.getenvW(unicode.utf8ToUtf16LeStringLiteral("PATH")) orelse &[_:0]u16{}; |
| 972 | 972 | const PATHEXT: [:0]const u16 = std.os.getenvW(unicode.utf8ToUtf16LeStringLiteral("PATHEXT")) orelse &[_:0]u16{}; |
| ... | ... | @@ -991,7 +991,7 @@ pub const ChildProcess = struct { |
| 991 | 991 | if (windowsCreateProcess(path_no_ext.ptr, cmd_line_w.ptr, envp_ptr, cwd_w_ptr, &siStartInfo, &piProcInfo)) |_| { |
| 992 | 992 | break :retry; |
| 993 | 993 | } else |err| switch (err) { |
| 994 | error.FileNotFound, error.AccessDenied => {}, | |
| 994 | error.FileNotFound, error.AccessDenied, error.InvalidExe => {}, | |
| 995 | 995 | else => return err, |
| 996 | 996 | } |
| 997 | 997 | |
| ... | ... | @@ -1007,6 +1007,7 @@ pub const ChildProcess = struct { |
| 1007 | 1007 | } else |err| switch (err) { |
| 1008 | 1008 | error.FileNotFound => continue, |
| 1009 | 1009 | error.AccessDenied => continue, |
| 1010 | error.InvalidExe => continue, | |
| 1010 | 1011 | else => return err, |
| 1011 | 1012 | } |
| 1012 | 1013 | } |
lib/std/os/windows.zig+22| ... | ... | @@ -1569,6 +1569,7 @@ pub const CreateProcessError = error{ |
| 1569 | 1569 | AccessDenied, |
| 1570 | 1570 | InvalidName, |
| 1571 | 1571 | NameTooLong, |
| 1572 | InvalidExe, | |
| 1572 | 1573 | Unexpected, |
| 1573 | 1574 | }; |
| 1574 | 1575 | |
| ... | ... | @@ -1603,6 +1604,27 @@ pub fn CreateProcessW( |
| 1603 | 1604 | .INVALID_PARAMETER => unreachable, |
| 1604 | 1605 | .INVALID_NAME => return error.InvalidName, |
| 1605 | 1606 | .FILENAME_EXCED_RANGE => return error.NameTooLong, |
| 1607 | // These are all the system errors that are mapped to ENOEXEC by | |
| 1608 | // the undocumented _dosmaperr (old CRT) or __acrt_errno_map_os_error | |
| 1609 | // (newer CRT) functions. Their code can be found in crt/src/dosmap.c (old SDK) | |
| 1610 | // or urt/misc/errno.cpp (newer SDK) in the Windows SDK. | |
| 1611 | .BAD_FORMAT, | |
| 1612 | .INVALID_STARTING_CODESEG, // MIN_EXEC_ERROR in errno.cpp | |
| 1613 | .INVALID_STACKSEG, | |
| 1614 | .INVALID_MODULETYPE, | |
| 1615 | .INVALID_EXE_SIGNATURE, | |
| 1616 | .EXE_MARKED_INVALID, | |
| 1617 | .BAD_EXE_FORMAT, | |
| 1618 | .ITERATED_DATA_EXCEEDS_64k, | |
| 1619 | .INVALID_MINALLOCSIZE, | |
| 1620 | .DYNLINK_FROM_INVALID_RING, | |
| 1621 | .IOPL_NOT_ENABLED, | |
| 1622 | .INVALID_SEGDPL, | |
| 1623 | .AUTODATASEG_EXCEEDS_64k, | |
| 1624 | .RING2SEG_MUST_BE_MOVABLE, | |
| 1625 | .RELOC_CHAIN_XEEDS_SEGLIM, | |
| 1626 | .INFLOOP_IN_RELOC_CHAIN, // MAX_EXEC_ERROR in errno.cpp | |
| 1627 | => return error.InvalidExe, | |
| 1606 | 1628 | else => |err| return unexpectedError(err), |
| 1607 | 1629 | } |
| 1608 | 1630 | } |