Re: [patch] rpcrt4_conn_np_read needs to expect and accept ERROR_MORE_DATA
Hi Luke, @@ -382,7 +382,14 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection, { DWORD bytes_read; ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL); - if (!ret || !bytes_read) + if (!ret) + { + TRACE("ReadFile error, status %x\n", GetLastError()); + if (GetLastError() != ERROR_MORE_DATA) + break; + ret = TRUE; /* ERROR_MORE_DATA is an expected acceptable error code */ + } + if (!bytes_read) break; Style nit: it would be simpler to do: DWORD bytes_read; ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL); + if (!ret && GetLastError() == ERROR_MORE_DATA) + ret = TRUE; if (!ret || !bytes_read) break; Don't you think? --Juan
On Fri, Feb 6, 2009 at 12:35 PM, Juan Lang <juan.lang(a)gmail.com> wrote:
Hi Luke,
@@ -382,7 +382,14 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection,
Style nit: it would be simpler to do: DWORD bytes_read; ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL); + if (!ret && GetLastError() == ERROR_MORE_DATA) + ret = TRUE; if (!ret || !bytes_read) break;
Don't you think?
... oh yeah :) well, i wanted to know what was going on, so i added the TRACE. rob, this is clearly much better. oh - the nice thing that you should find is that given that the current wine NtReadFile() implementation never returns ERROR_MORE_DATA, is that all checks that you add to treat ERROR_MORE_DATA as "not actually an error but actually to be expected" should have _zero_ impact. until NamedPipes messagemode gets fixed, of course. l.
participants (2)
-
Juan Lang -
Luke Kenneth Casson Leighton