launcher, launchctl: command line arguments are now numbered %1 to %9

This commit is contained in:
Bill Zissimopoulos 2016-05-13 10:42:23 -07:00
parent ec2494433b
commit 5491187e1d
2 changed files with 7 additions and 7 deletions

View File

@ -210,7 +210,7 @@ int wmain(int argc, wchar_t **argv)
if (0 == lstrcmpW(L"start", argv[0]))
{
if (3 > argc || argc > 12)
if (3 > argc || argc > 11)
usage();
return start(PipeBuf, PIPE_BUFFER_SIZE, argv[1], argv[2], argc - 3, argv + 3);

View File

@ -96,8 +96,8 @@ static NTSTATUS SvcInstanceReplaceArguments(PWSTR String, ULONG Argc, PWSTR *Arg
{
case L'%':
P++;
if (L'0' <= *P && *P <= '9' && Argc > (ULONG)(*P - L'0'))
Length += SvcInstanceArgumentLength(Argv[*P - L'0']);
if (L'1' <= *P && *P <= '9' && Argc > (ULONG)(*P - L'1'))
Length += SvcInstanceArgumentLength(Argv[*P - L'1']);
break;
default:
Length++;
@ -116,8 +116,8 @@ static NTSTATUS SvcInstanceReplaceArguments(PWSTR String, ULONG Argc, PWSTR *Arg
{
case L'%':
P++;
if (L'0' <= *P && *P <= '9' && Argc > (ULONG)(*P - L'0'))
Q = SvcInstanceArgumentCopy(Q, Argv[*P - L'0']);
if (L'1' <= *P && *P <= '9' && Argc > (ULONG)(*P - L'1'))
Q = SvcInstanceArgumentCopy(Q, Argv[*P - L'1']);
break;
default:
Q++;
@ -708,7 +708,7 @@ static VOID SvcPipeTransact(HANDLE ClientToken, PWSTR PipeBuf, PULONG PSize)
PWSTR P = PipeBuf, PipeBufEnd = PipeBuf + *PSize / sizeof(WCHAR);
PWSTR ClassName, InstanceName;
ULONG Argc; PWSTR Argv[10];
ULONG Argc; PWSTR Argv[9];
NTSTATUS Result;
*PSize = 0;
@ -718,7 +718,7 @@ static VOID SvcPipeTransact(HANDLE ClientToken, PWSTR PipeBuf, PULONG PSize)
case LauncherSvcInstanceStart:
ClassName = SvcPipeTransactGetPart(&P, PipeBufEnd);
InstanceName = SvcPipeTransactGetPart(&P, PipeBufEnd);
for (Argc = 0; 10 > Argc; Argc++)
for (Argc = 0; sizeof Argv / sizeof Argv[0] > Argc; Argc++)
if (0 == (Argv[Argc] = SvcPipeTransactGetPart(&P, PipeBufEnd)))
break;