aboutsummaryrefslogtreecommitdiff
path: root/win32/mingw.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/mingw.c')
-rw-r--r--win32/mingw.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index 7a5198ccf..061e7bac6 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -2538,3 +2538,34 @@ char * FAST_FUNC exe_relative_path(const char *tail)
2538 free(exepath); 2538 free(exepath);
2539 return relpath; 2539 return relpath;
2540} 2540}
2541
2542int mingw_shell_execute(SHELLEXECUTEINFO *info)
2543{
2544 DECLARE_PROC_ADDR(BOOL, ShellExecuteExA, SHELLEXECUTEINFOA *);
2545 char *lpath;
2546 int ret;
2547
2548 if (!INIT_PROC_ADDR(shell32.dll, ShellExecuteExA)) {
2549 errno = ENOSYS;
2550 return FALSE;
2551 }
2552
2553 // ShellExecuteEx() needs backslash as separator in UNC paths.
2554 lpath = xstrdup(info->lpFile);
2555 slash_to_bs(lpath);
2556 info->lpFile = lpath;
2557
2558 ret = ShellExecuteExA(info);
2559
2560 free(lpath);
2561 return ret;
2562}
2563
2564#if ENABLE_FEATURE_USE_CNG_API
2565void mingw_die_if_error(NTSTATUS status, const char *function_name) {
2566 if (!NT_SUCCESS(status)) {
2567 bb_error_msg_and_die("call to %s failed: 0x%08lX",
2568 function_name, (unsigned long)status);
2569 }
2570}
2571#endif