diff options
| author | Saikari <[email protected]> | 2026-02-05 22:48:58 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-02-05 22:48:58 +0300 |
| commit | bb7879934dca1ef7b26584f4dfadc29462d5a059 (patch) | |
| tree | 3cdb88086027d96f6d3e12dea0038ae361709df4 /xmake/core/sandbox/modules/os.lua | |
| parent | 728ead07ff58cd9d8330075414cfe21b1034b757 (diff) | |
create policy besides pe parser
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/os.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua index 197356ffa..5718f8dec 100644 --- a/xmake/core/sandbox/modules/os.lua +++ b/xmake/core/sandbox/modules/os.lua @@ -494,7 +494,24 @@ function sandbox_os.execv(program, argv, opt) -- run it opt = opt or {} + + -- check policy for GUI error dialogs (Windows only) + local old_mode + local winos + if os.is_host("windows") and opt.winos_error_mode_gui then + winos = require("sandbox/modules/winos") + if winos.seterrormode then + old_mode = winos.seterrormode(0) + end + end + local ok, errors = os.execv(program, argv, opt) + + -- restore error mode + if old_mode then + winos.seterrormode(old_mode) + end + if ok ~= 0 and not opt.try then -- get command @@ -509,6 +526,8 @@ function sandbox_os.execv(program, argv, opt) local missing_dlls = _get_missing_dlls(program) if #missing_dlls > 0 then errors = string.format("execv(%s) failed(%d): system error 0xC0000135 (STATUS_DLL_NOT_FOUND).\nThe application failed to start because the following DLLs were not found:\n - %s\nPlease check your PATH environment variable or copy the missing DLLs to the executable directory.", cmd, ok, table.concat(missing_dlls, "\n - ")) + else + errors = string.format("execv(%s) failed(%d): system error 0xC0000135 (STATUS_DLL_NOT_FOUND).\nThe application failed to start because a dependent DLL was not found.\nPlease check your PATH environment variable or copy the missing DLL to the executable directory.", cmd, ok) end else errors = string.format("execv(%s) failed(%d)", cmd, ok) |
