Frédéric Delanoy <[email protected]> writes: > @@ -181,13 +181,21 @@ WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **where, > WCHAR **end) { > * the LF (or CRLF) from the line. > */ > > -WCHAR *WCMD_fgets (WCHAR *s, int noChars, HANDLE h) { > - > - DWORD bytes; > - BOOL status; > +WCHAR *WCMD_fgets (WCHAR *s, int noChars, HANDLE h) > +{ > + DWORD bytes, charsRead, dummy; > + BOOL status, is_console_handle; > WCHAR *p; > > p = s; > + is_console_handle = !!GetConsoleMode(h, &dummy); > + if (is_console_handle) { > + status = ReadConsoleW(h, s, noChars, &charsRead, NULL);
ReadConsole will fail if it's not a console, the check is redundant. -- Alexandre Julliard [email protected]
