#6383 Refactor set startup info to a function
This commit is contained in:
parent
aca2605cb8
commit
8ef2e7edbc
|
@ -351,6 +351,17 @@ MSWindowsWatchdog::startProcess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MSWindowsWatchdog::setStartupInfo(STARTUPINFO& si)
|
||||||
|
{
|
||||||
|
ZeroMemory(&si, sizeof(STARTUPINFO));
|
||||||
|
si.cb = sizeof(STARTUPINFO);
|
||||||
|
si.lpDesktop = "winsta0\\Default"; // TODO: maybe this should be \winlogon if we have logonui.exe?
|
||||||
|
si.hStdError = m_stdOutWrite;
|
||||||
|
si.hStdOutput = m_stdOutWrite;
|
||||||
|
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
MSWindowsWatchdog::startProcessInForeground(String& command)
|
MSWindowsWatchdog::startProcessInForeground(String& command)
|
||||||
{
|
{
|
||||||
|
@ -358,12 +369,7 @@ MSWindowsWatchdog::startProcessInForeground(String& command)
|
||||||
ZeroMemory(&m_processInfo, sizeof(PROCESS_INFORMATION));
|
ZeroMemory(&m_processInfo, sizeof(PROCESS_INFORMATION));
|
||||||
|
|
||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
ZeroMemory(&si, sizeof(STARTUPINFO));
|
setStartupInfo(si);
|
||||||
si.cb = sizeof(STARTUPINFO);
|
|
||||||
si.lpDesktop = "winsta0\\Default"; // TODO: maybe this should be \winlogon if we have logonui.exe?
|
|
||||||
si.hStdError = m_stdOutWrite;
|
|
||||||
si.hStdOutput = m_stdOutWrite;
|
|
||||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
|
||||||
|
|
||||||
return CreateProcess(
|
return CreateProcess(
|
||||||
NULL, LPSTR(command.c_str()), NULL, NULL,
|
NULL, LPSTR(command.c_str()), NULL, NULL,
|
||||||
|
@ -377,12 +383,7 @@ MSWindowsWatchdog::startProcessAsUser(String& command, HANDLE userToken, LPSECUR
|
||||||
ZeroMemory(&m_processInfo, sizeof(PROCESS_INFORMATION));
|
ZeroMemory(&m_processInfo, sizeof(PROCESS_INFORMATION));
|
||||||
|
|
||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
ZeroMemory(&si, sizeof(STARTUPINFO));
|
setStartupInfo(si);
|
||||||
si.cb = sizeof(STARTUPINFO);
|
|
||||||
si.lpDesktop = "winsta0\\Default"; // TODO: maybe this should be \winlogon if we have logonui.exe?
|
|
||||||
si.hStdError = m_stdOutWrite;
|
|
||||||
si.hStdOutput = m_stdOutWrite;
|
|
||||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
|
||||||
|
|
||||||
LPVOID environment;
|
LPVOID environment;
|
||||||
BOOL blockRet = CreateEnvironmentBlock(&environment, userToken, FALSE);
|
BOOL blockRet = CreateEnvironmentBlock(&environment, userToken, FALSE);
|
||||||
|
|
|
@ -61,6 +61,7 @@ private:
|
||||||
void sendSas();
|
void sendSas();
|
||||||
void getActiveDesktop(LPSECURITY_ATTRIBUTES security);
|
void getActiveDesktop(LPSECURITY_ATTRIBUTES security);
|
||||||
void testOutput(String buffer);
|
void testOutput(String buffer);
|
||||||
|
void setStartupInfo(STARTUPINFO& si);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Thread* m_thread;
|
Thread* m_thread;
|
||||||
|
|
Loading…
Reference in New Issue