mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
launcher, launchctl: fixes
This commit is contained in:
parent
08e697c52c
commit
41764f7b41
@ -54,9 +54,10 @@ static void usage(void)
|
||||
"usage: %s COMMAND ARGS\n"
|
||||
"\n"
|
||||
"commands:\n"
|
||||
" start ClassName InstanceName Args...\n"
|
||||
" stop ClassName InstanceName\n"
|
||||
" info ClassName InstanceName\n"
|
||||
" start ClassName InstanceName Args...\n"
|
||||
" startWithSecret ClassName InstanceName Args... Secret\n"
|
||||
" stop ClassName InstanceName\n"
|
||||
" info ClassName InstanceName\n"
|
||||
" list\n",
|
||||
PROGNAME);
|
||||
}
|
||||
@ -237,7 +238,7 @@ int wmain(int argc, wchar_t **argv)
|
||||
else
|
||||
if (0 == lstrcmpW(L"startWithSecret", argv[0]))
|
||||
{
|
||||
if (3 > argc || argc > 12)
|
||||
if (4 > argc || argc > 13)
|
||||
usage();
|
||||
|
||||
return start(PipeBuf, LAUNCHER_PIPE_BUFFER_SIZE, argv[1], argv[2], argc - 3, argv + 3,
|
||||
|
@ -648,7 +648,9 @@ NTSTATUS SvcInstanceStart(HANDLE ClientToken,
|
||||
SVC_INSTANCE *SvcInstance;
|
||||
NTSTATUS Result;
|
||||
|
||||
HasSecret = HasSecret && 0 < Argc && L'\0' != Argv[Argc - 1][0];
|
||||
if (HasSecret && (0 == Argc || L'\0' == Argv[Argc - 1][0]))
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
HasSecret = !!HasSecret;
|
||||
|
||||
Result = SvcInstanceCreate(ClientToken, ClassName, InstanceName,
|
||||
Argc - HasSecret, Argv, Job, HasSecret,
|
||||
@ -667,13 +669,12 @@ NTSTATUS SvcInstanceStart(HANDLE ClientToken,
|
||||
OVERLAPPED Overlapped;
|
||||
|
||||
if (0 == (BytesTransferred =
|
||||
WideCharToMultiByte(CP_UTF8, 0, Secret, -1, ReqBuf, sizeof ReqBuf, 0, 0)))
|
||||
WideCharToMultiByte(CP_UTF8, 0, Secret, lstrlenW(Secret), ReqBuf, sizeof ReqBuf, 0, 0)))
|
||||
{
|
||||
Result = FspNtStatusFromWin32(GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* also send the term-0 */
|
||||
if (!WriteFile(SvcInstance->StdioHandles[0], ReqBuf, BytesTransferred, &BytesTransferred, 0))
|
||||
{
|
||||
Result = FspNtStatusFromWin32(GetLastError());
|
||||
|
Loading…
x
Reference in New Issue
Block a user