def exec_command(command): log("exec_command(%s)", command) from xpra.platform.win32.create_process_lib import Popen, CREATIONINFO, CREATION_TYPE_TOKEN, LOGON_WITH_PROFILE, CREATE_NEW_PROCESS_GROUP, STARTUPINFO creation_info = CREATIONINFO() creation_info.dwCreationType = CREATION_TYPE_TOKEN creation_info.dwLogonFlags = LOGON_WITH_PROFILE creation_info.dwCreationFlags = CREATE_NEW_PROCESS_GROUP creation_info.hToken = logon_info.Token log("creation_info=%s", creation_info) startupinfo = STARTUPINFO() startupinfo.lpDesktop = "WinSta0\\Default" startupinfo.lpTitle = "Xpra-Shadow" cwd = get_app_dir() from subprocess import PIPE env = self.get_proxy_env() log("env=%s", env) proc = Popen(command, stdout=PIPE, stderr=PIPE, cwd=cwd, env=env, startupinfo=startupinfo, creationinfo=creation_info) log("Popen(%s)=%s", command, proc) log("poll()=%s", proc.poll()) try: log("stdout=%s", proc.stdout.read()) log("stderr=%s", proc.stderr.read()) except: pass if proc.poll() is not None: return None self.child_reaper.add_process(proc, "server-%s" % username, "xpra shadow", True, True) return proc
def exec_command(username, command, env): log("exec_command%s", (username, command, env)) from xpra.platform.win32.lsa_logon_lib import logon_msv1_s4u logon_info = logon_msv1_s4u(username) log("logon_msv1_s4u(%s)=%s", username, logon_info) from xpra.platform.win32.create_process_lib import ( Popen, CREATIONINFO, CREATION_TYPE_TOKEN, LOGON_WITH_PROFILE, CREATE_NEW_PROCESS_GROUP, STARTUPINFO, ) creation_info = CREATIONINFO() creation_info.dwCreationType = CREATION_TYPE_TOKEN creation_info.dwLogonFlags = LOGON_WITH_PROFILE creation_info.dwCreationFlags = CREATE_NEW_PROCESS_GROUP creation_info.hToken = logon_info.Token log("creation_info=%s", creation_info) startupinfo = STARTUPINFO() startupinfo.lpDesktop = "WinSta0\\Default" startupinfo.lpTitle = "Xpra-Shadow" cwd = get_app_dir() from subprocess import PIPE log("env=%s", env) proc = Popen(command, stdout=PIPE, stderr=PIPE, cwd=cwd, env=env, startupinfo=startupinfo, creationinfo=creation_info) log("Popen(%s)=%s", command, proc) return proc
def exec_command(username, args, exe, cwd, env): log("exec_command%s", (username, args, exe, cwd, env)) from xpra.platform.win32.lsa_logon_lib import logon_msv1_s4u logon_info = logon_msv1_s4u(username) log("logon_msv1_s4u(%s)=%s", username, logon_info) from xpra.platform.win32.create_process_lib import ( Popen, CREATIONINFO, CREATION_TYPE_TOKEN, STARTF_USESHOWWINDOW, LOGON_WITH_PROFILE, CREATE_NEW_PROCESS_GROUP, STARTUPINFO, ) creation_info = CREATIONINFO() creation_info.dwCreationType = CREATION_TYPE_TOKEN creation_info.dwLogonFlags = LOGON_WITH_PROFILE creation_info.dwCreationFlags = CREATE_NEW_PROCESS_GROUP creation_info.hToken = logon_info.Token log("creation_info=%s", creation_info) startupinfo = STARTUPINFO() startupinfo.dwFlags = STARTF_USESHOWWINDOW startupinfo.wShowWindow = 0 #aka win32.con.SW_HIDE startupinfo.lpDesktop = "WinSta0\\Default" startupinfo.lpTitle = "Xpra-Shadow" from subprocess import PIPE proc = Popen(args, executable=exe, stdout=PIPE, stderr=PIPE, cwd=cwd, env=env, startupinfo=startupinfo, creationinfo=creation_info) log("Popen(%s)=%s", args, proc) return proc