launcher, launchctl: refactoring

This commit is contained in:
Bill Zissimopoulos 2016-05-13 10:00:54 -07:00
parent 2c51251cb7
commit 8ccd44a1f7
2 changed files with 6 additions and 9 deletions

View File

@ -78,16 +78,15 @@ static int call_pipe_and_report(PWSTR PipeBuf, ULONG SendSize, ULONG RecvSize)
info("OK"); info("OK");
else else
{ {
ULONG Count = 0;
for (PWSTR P = PipeBuf, PipeBufEnd = P + BytesTransferred / sizeof(WCHAR); for (PWSTR P = PipeBuf, PipeBufEnd = P + BytesTransferred / sizeof(WCHAR);
PipeBufEnd > P; P++) PipeBufEnd > P; P++)
switch (*P) if (L'\0' == *P)
{ {
case L'\0': /* print a newline every 2 nulls; this works for both list and info */
*P = L'\n'; *P = 1 == Count % 2 ? L'\n' : L' ';
break; Count++;
case L'\1':
*P = L' ';
break;
} }
if (BytesTransferred < RecvSize) if (BytesTransferred < RecvSize)

View File

@ -443,9 +443,7 @@ NTSTATUS SvcInstanceGetNameList(HANDLE ClientToken,
if (BufferEnd < P + ClassNameSize + InstanceNameSize) if (BufferEnd < P + ClassNameSize + InstanceNameSize)
break; break;
ClassNameSize--;
memcpy(P, SvcInstance->ClassName, ClassNameSize * sizeof(WCHAR)); P += ClassNameSize; memcpy(P, SvcInstance->ClassName, ClassNameSize * sizeof(WCHAR)); P += ClassNameSize;
*Buffer++ = L'\1';
memcpy(P, SvcInstance->InstanceName, InstanceNameSize * sizeof(WCHAR)); P += InstanceNameSize; memcpy(P, SvcInstance->InstanceName, InstanceNameSize * sizeof(WCHAR)); P += InstanceNameSize;
} }