launcher, launchctl: add quit command on debug version of launcher

This commit is contained in:
Bill Zissimopoulos 2016-05-14 21:00:02 -07:00
parent 08a02d7b35
commit 768a393342
3 changed files with 33 additions and 1 deletions

View File

@ -193,6 +193,21 @@ int list(PWSTR PipeBuf, ULONG PipeBufSize)
return call_pipe_and_report(PipeBuf, (ULONG)((P - PipeBuf) * sizeof(WCHAR)), PipeBufSize);
}
int quit(PWSTR PipeBuf, ULONG PipeBufSize)
{
/* works only against DEBUG version of launcher */
PWSTR P;
if (PipeBufSize < 1 * sizeof(WCHAR))
return ERROR_INVALID_PARAMETER;
P = PipeBuf;
*P++ = LauncherQuit;
return call_pipe_and_report(PipeBuf, (ULONG)((P - PipeBuf) * sizeof(WCHAR)), PipeBufSize);
}
int wmain(int argc, wchar_t **argv)
{
PWSTR PipeBuf = 0;
@ -239,6 +254,15 @@ int wmain(int argc, wchar_t **argv)
return list(PipeBuf, PIPE_BUFFER_SIZE);
}
else
if (0 == lstrcmpW(L"quit", argv[0]))
{
if (1 != argc)
usage();
/* works only against DEBUG version of launcher */
return quit(PipeBuf, PIPE_BUFFER_SIZE);
}
else
usage();

View File

@ -951,6 +951,13 @@ static VOID SvcPipeTransact(HANDLE ClientToken, PWSTR PipeBuf, PULONG PSize)
SvcPipeTransactResult(Result, PipeBuf, PSize);
break;
#if !defined(NDEBUG)
case LauncherQuit:
SetEvent(SvcEvent);
SvcPipeTransactResult(STATUS_SUCCESS, PipeBuf, PSize);
break;
#endif
default:
SvcPipeTransactResult(STATUS_INVALID_PARAMETER, PipeBuf, PSize);
break;

View File

@ -57,8 +57,9 @@ enum
{
LauncherSvcInstanceStart = 'S', /* requires: SERVICE_START */
LauncherSvcInstanceStop = 'T', /* requires: SERVICE_STOP */
LauncherSvcInstanceList = 'L', /* requires: none*/
LauncherSvcInstanceInfo = 'I', /* requires: SERVICE_QUERY_STATUS */
LauncherSvcInstanceList = 'L', /* requires: none*/
LauncherQuit = 'Q', /* DEBUG version only */
};
#endif