mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-08 04:52:10 -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"
|
"usage: %s COMMAND ARGS\n"
|
||||||
"\n"
|
"\n"
|
||||||
"commands:\n"
|
"commands:\n"
|
||||||
" start ClassName InstanceName Args...\n"
|
" start ClassName InstanceName Args...\n"
|
||||||
" stop ClassName InstanceName\n"
|
" startWithSecret ClassName InstanceName Args... Secret\n"
|
||||||
" info ClassName InstanceName\n"
|
" stop ClassName InstanceName\n"
|
||||||
|
" info ClassName InstanceName\n"
|
||||||
" list\n",
|
" list\n",
|
||||||
PROGNAME);
|
PROGNAME);
|
||||||
}
|
}
|
||||||
@ -237,7 +238,7 @@ int wmain(int argc, wchar_t **argv)
|
|||||||
else
|
else
|
||||||
if (0 == lstrcmpW(L"startWithSecret", argv[0]))
|
if (0 == lstrcmpW(L"startWithSecret", argv[0]))
|
||||||
{
|
{
|
||||||
if (3 > argc || argc > 12)
|
if (4 > argc || argc > 13)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
return start(PipeBuf, LAUNCHER_PIPE_BUFFER_SIZE, argv[1], argv[2], argc - 3, argv + 3,
|
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;
|
SVC_INSTANCE *SvcInstance;
|
||||||
NTSTATUS Result;
|
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,
|
Result = SvcInstanceCreate(ClientToken, ClassName, InstanceName,
|
||||||
Argc - HasSecret, Argv, Job, HasSecret,
|
Argc - HasSecret, Argv, Job, HasSecret,
|
||||||
@ -667,13 +669,12 @@ NTSTATUS SvcInstanceStart(HANDLE ClientToken,
|
|||||||
OVERLAPPED Overlapped;
|
OVERLAPPED Overlapped;
|
||||||
|
|
||||||
if (0 == (BytesTransferred =
|
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());
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* also send the term-0 */
|
|
||||||
if (!WriteFile(SvcInstance->StdioHandles[0], ReqBuf, BytesTransferred, &BytesTransferred, 0))
|
if (!WriteFile(SvcInstance->StdioHandles[0], ReqBuf, BytesTransferred, &BytesTransferred, 0))
|
||||||
{
|
{
|
||||||
Result = FspNtStatusFromWin32(GetLastError());
|
Result = FspNtStatusFromWin32(GetLastError());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user