mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
launcher: startWithSecret testing
This commit is contained in:
parent
2c651b1bd8
commit
9dfdd19616
@ -285,7 +285,7 @@ NTSTATUS SvcInstanceCreateProcess(PWSTR Executable, PWSTR CommandLine,
|
||||
PPROCESS_INFORMATION ProcessInfo)
|
||||
{
|
||||
STARTUPINFOEXW StartupInfoEx;
|
||||
HANDLE ChildHandles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
|
||||
HANDLE ChildHandles[3] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0/* DO NOT CLOSE!*/ };
|
||||
HANDLE ParentHandles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
|
||||
SECURITY_ATTRIBUTES PipeAttributes = { sizeof(SECURITY_ATTRIBUTES), 0, TRUE };
|
||||
PPROC_THREAD_ATTRIBUTE_LIST AttrList = 0;
|
||||
@ -320,6 +320,8 @@ NTSTATUS SvcInstanceCreateProcess(PWSTR Executable, PWSTR CommandLine,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ChildHandles[2] = GetStdHandle(STD_ERROR_HANDLE);
|
||||
|
||||
Size = 0;
|
||||
if (!InitializeProcThreadAttributeList(0, 1, 0, &Size) &&
|
||||
ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
||||
@ -349,15 +351,16 @@ NTSTATUS SvcInstanceCreateProcess(PWSTR Executable, PWSTR CommandLine,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
StartupInfoEx.StartupInfo.cb = sizeof StartupInfoEx;
|
||||
StartupInfoEx.lpAttributeList = AttrList;
|
||||
StartupInfoEx.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
|
||||
StartupInfoEx.StartupInfo.hStdInput = ChildHandles[0];
|
||||
StartupInfoEx.StartupInfo.hStdOutput = ChildHandles[1];
|
||||
StartupInfoEx.StartupInfo.hStdError = INVALID_HANDLE_VALUE;
|
||||
StartupInfoEx.StartupInfo.hStdError = ChildHandles[2];
|
||||
|
||||
if (!CreateProcessW(Executable, CommandLine, 0, 0, TRUE,
|
||||
CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP | EXTENDED_STARTUPINFO_PRESENT, 0, 0,
|
||||
(PVOID)&StartupInfoEx, ProcessInfo))
|
||||
&StartupInfoEx.StartupInfo, ProcessInfo))
|
||||
{
|
||||
Result = FspNtStatusFromWin32(GetLastError());
|
||||
goto exit;
|
||||
@ -382,7 +385,7 @@ exit:
|
||||
if (INVALID_HANDLE_VALUE != ParentHandles[0])
|
||||
CloseHandle(ParentHandles[0]);
|
||||
if (INVALID_HANDLE_VALUE != ParentHandles[0])
|
||||
CloseHandle(ParentHandles[0]);
|
||||
CloseHandle(ParentHandles[1]);
|
||||
}
|
||||
else if (0 != StdioHandles)
|
||||
{
|
||||
@ -550,7 +553,7 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
|
||||
Result = SvcInstanceCreateProcess(Executable, CommandLine,
|
||||
Result = SvcInstanceCreateProcess(Executable, SvcInstance->CommandLine,
|
||||
RedirectStdio ? SvcInstance->StdioHandles : 0, &ProcessInfo);
|
||||
if (!NT_SUCCESS(Result))
|
||||
goto exit;
|
||||
@ -697,6 +700,9 @@ NTSTATUS SvcInstanceStart(HANDLE ClientToken,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
CloseHandle(SvcInstance->StdioHandles[0]);
|
||||
SvcInstance->StdioHandles[0] = INVALID_HANDLE_VALUE;
|
||||
|
||||
memset(&Overlapped, 0, sizeof Overlapped);
|
||||
if (!ReadFile(SvcInstance->StdioHandles[1], RspBuf, sizeof RspBuf, 0, &Overlapped) &&
|
||||
ERROR_IO_PENDING != GetLastError())
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define LAUNCHER_PIPE_BUFFER_SIZE 4096
|
||||
#define LAUNCHER_PIPE_DEFAULT_TIMEOUT 3000
|
||||
|
||||
#define LAUNCHER_START_WITH_SECRET_TIMEOUT 30000
|
||||
#define LAUNCHER_START_WITH_SECRET_TIMEOUT 15000
|
||||
|
||||
/*
|
||||
* The launcher named pipe SDDL gives full access to LocalSystem and Administrators and
|
||||
|
Loading…
x
Reference in New Issue
Block a user