Hi, On Thu, Jun 23, 2016 at 10:39:15AM -0400, Selva Nair wrote: > > How does the GUI currently handle return messages? As in, does this > > need GUI changes, or is the GUI prepared to handle anything that comes > > along? > > Currently the GUI interpretes two custom error codes (0x2000000 and > 0x20000001) and ignores the rest. So it will just a log a message and > ignore this one. Unless the PID happens to match one of those two numbers. > Though I've never seen PIDs that large. > > An alternative is to set error = 0 and pass PID as the second line: > > "0x00000000\nPID\Process ID" > > where PID may be formatted as 0x%08x. May be that is better?
I think this is better - define a convention for "informational messages"
(which this could be) and then use it at both ends :-)
> > > +static VOID
> > > +ReturnProcessId (HANDLE pipe, DWORD pid, DWORD count, LPHANDLE events)
> > > +{
> > > + const WCHAR msg[] = L"\nProcess ID\n";
> > > + WCHAR buf[10 + _countof(msg)]; /* 10 characters for the pid in 0x%08x
> > format */
> > > +
> > > + /* A 3-line string like an error message but with pid in place of
> > error number */
> > > + _snwprintf (buf, _countof(buf), L"0x%08x%s", pid, msg);
> > > + buf[_countof(buf) - 1] = '\0';
> > > +
> > > + WritePipeAsync (pipe, buf, wcslen (buf) * 2, count, events);
> > > +}
> >
> > Where does the extra blank line come from? If I'm not all confused
> > (this is before my first cup of tea) this will write
> >
> > %08x\nProcess ID\n
> >
> > into the buffer, and not \n\n...
>
>
> May be its my terminology of what is a "line", not your tea. The currently
> used format is NUMBER\nLINE2\nLINE3 so there is no \n at the end of line
> 3. In the present case that would be "%08x\nProcess ID\n"
Indeed, terminology. For me, a line ends with a "\n" - but it certainly
does not *have* to. If service and gui agree on "thee parts, separated
by two \n, no trailing \n", this is good enough (and in which case the
code does what is expected).
gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]
fax: +49-89-35655025 [email protected]
signature.asc
Description: PGP signature
