Author: fireball Date: Wed Jan 9 23:38:52 2008 New Revision: 31691
URL: http://svn.reactos.org/svn/reactos?rev=31691&view=rev Log: - Make WaitNamedPipe (copied from the new implementation #ifdef USING_PROPER_NPFS_WAIT_SEMANTICS) and corresponding part in npfs.sys actually respect the timeout.
Modified: trunk/reactos/dll/win32/kernel32/file/npipe.c trunk/reactos/drivers/filesystems/npfs/fsctrl.c
Modified: trunk/reactos/dll/win32/kernel32/file/npipe.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/npi... ============================================================================== --- trunk/reactos/dll/win32/kernel32/file/npipe.c (original) +++ trunk/reactos/dll/win32/kernel32/file/npipe.c Wed Jan 9 23:38:52 2008 @@ -498,7 +498,30 @@ 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,
Modified: trunk/reactos/drivers/filesystems/npfs/fsctrl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/fs... ============================================================================== --- trunk/reactos/drivers/filesystems/npfs/fsctrl.c (original) +++ trunk/reactos/drivers/filesystems/npfs/fsctrl.c Wed Jan 9 23:38:52 2008 @@ -289,6 +289,7 @@ PNPFS_CCB ServerCcb; PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe; NTSTATUS Status; + LARGE_INTEGER TimeOut;
DPRINT("NpfsWaitPipe\n");
@@ -320,12 +321,20 @@ 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);