- Make WaitNamedPipe (copied from the new implementation #ifdef USING_PROPER_NPFS_WAIT_SEMANTICS) and corresponding part in npfs.sys actually respect the timeout.

svn path=/trunk/; revision=31691
This commit is contained in:
Aleksey Bragin 2008-01-09 20:38:52 +00:00
parent 5c1602ce91
commit bb5bf44217
2 changed files with 35 additions and 3 deletions

View file

@ -498,7 +498,30 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName,
return FALSE;
}
WaitPipe.Timeout.QuadPart = nTimeOut * -10000LL;
/* Check what timeout we got */
if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT)
{
/* Don't use a timeout */
WaitPipe.TimeoutSpecified = FALSE;
}
else
{
/* Check if we should wait forever */
if (nTimeOut == NMPWAIT_WAIT_FOREVER)
{
/* Set the max */
WaitPipe.Timeout.LowPart = 0;
WaitPipe.Timeout.HighPart = 0x80000000;
}
else
{
/* Convert to NT format */
WaitPipe.Timeout.QuadPart = UInt32x32To64(-10000, nTimeOut);
}
/* In both cases, we do have a timeout */
WaitPipe.TimeoutSpecified = FALSE;
}
Status = NtFsControlFile(FileHandle,
NULL,

View file

@ -289,6 +289,7 @@ NpfsWaitPipe(PIRP Irp,
PNPFS_CCB ServerCcb;
PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe;
NTSTATUS Status;
LARGE_INTEGER TimeOut;
DPRINT("NpfsWaitPipe\n");
@ -320,12 +321,20 @@ NpfsWaitPipe(PIRP Irp,
current_entry = current_entry->Flink;
}
/* no listening server fcb found -- wait for one */
/* No listening server fcb found */
/* If no timeout specified, use the default one */
if (WaitPipe->TimeoutSpecified)
TimeOut = WaitPipe->Timeout;
else
TimeOut = Fcb->TimeOut;
/* Wait for one */
Status = KeWaitForSingleObject(&Ccb->ConnectEvent,
UserRequest,
KernelMode,
FALSE,
&WaitPipe->Timeout);
&TimeOut);
DPRINT("KeWaitForSingleObject() returned (Status %lx)\n", Status);