aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loginutils/suw32.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/loginutils/suw32.c b/loginutils/suw32.c
index d51a7f58c..93fd145f1 100644
--- a/loginutils/suw32.c
+++ b/loginutils/suw32.c
@@ -28,17 +28,27 @@ int suw32_main(int argc UNUSED_PARAM, char **argv)
28{ 28{
29 char *opt_command = NULL; 29 char *opt_command = NULL;
30 SHELLEXECUTEINFO info; 30 SHELLEXECUTEINFO info;
31 char *bb_path, *s;
31 32
32 getopt32(argv, "c:", &opt_command); 33 getopt32(argv, "c:", &opt_command);
33 if (argv[optind]) 34 if (argv[optind])
34 bb_show_usage(); 35 bb_show_usage();
35 36
37 /* ShellExecuteEx() needs backslash as separator in UNC paths. */
38 bb_path = s = xstrdup(bb_busybox_exec_path);
39 for ( ; *s; ++s) {
40 if (*s == '/')
41 *s = '\\';
42 }
43
36 memset(&info, 0, sizeof(SHELLEXECUTEINFO)); 44 memset(&info, 0, sizeof(SHELLEXECUTEINFO));
37 info.cbSize = sizeof(SHELLEXECUTEINFO); 45 info.cbSize = sizeof(SHELLEXECUTEINFO);
38 /* info.fMask = SEE_MASK_DEFAULT; */ 46 /* info.fMask = SEE_MASK_DEFAULT; */
39 /* info.hwnd = NULL; */ 47 /* info.hwnd = NULL; */
40 info.lpVerb = "runas"; 48 info.lpVerb = "runas";
41 info.lpFile = bb_busybox_exec_path; 49 info.lpFile = bb_path;
50 /* ShellExecuteEx() always runs system binaries in C:\Windows\System32.
51 * Pass the directory we want to the shell. */
42 info.lpParameters = xasprintf("--busybox ash -d \"%s\"", getcwd(NULL, 0)); 52 info.lpParameters = xasprintf("--busybox ash -d \"%s\"", getcwd(NULL, 0));
43 if (opt_command) 53 if (opt_command)
44 info.lpParameters = 54 info.lpParameters =