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");
else
{
ULONG Count = 0;
for (PWSTR P = PipeBuf, PipeBufEnd = P + BytesTransferred / sizeof(WCHAR);
PipeBufEnd > P; P++)
switch (*P)
if (L'\0' == *P)
{
case L'\0':
*P = L'\n';
break;
case L'\1':
*P = L' ';
break;
/* print a newline every 2 nulls; this works for both list and info */
*P = 1 == Count % 2 ? L'\n' : L' ';
Count++;
}
if (BytesTransferred < RecvSize)

View File

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