diff options
Diffstat (limited to 'src/syscall/exec_windows.go')
| -rw-r--r-- | src/syscall/exec_windows.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/syscall/exec_windows.go b/src/syscall/exec_windows.go index cafce1eff6..d5b4a013ef 100644 --- a/src/syscall/exec_windows.go +++ b/src/syscall/exec_windows.go @@ -222,6 +222,7 @@ type SysProcAttr struct { HideWindow bool CmdLine string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess CreationFlags uint32 + Token Handle // if set, runs new process in the security context represented by the token } var zeroProcAttr ProcAttr @@ -321,7 +322,11 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle pi := new(ProcessInformation) flags := sys.CreationFlags | CREATE_UNICODE_ENVIRONMENT - err = CreateProcess(argv0p, argvp, nil, nil, true, flags, createEnvBlock(attr.Env), dirp, si, pi) + if sys.Token != 0 { + err = CreateProcessAsUser(sys.Token, argv0p, argvp, nil, nil, true, flags, createEnvBlock(attr.Env), dirp, si, pi) + } else { + err = CreateProcess(argv0p, argvp, nil, nil, true, flags, createEnvBlock(attr.Env), dirp, si, pi) + } if err != nil { return 0, 0, err } |
