Index: dll/win32/rpcrt4/rpc_transport.c =================================================================== --- dll/win32/rpcrt4/rpc_transport.c (revision 51014) +++ dll/win32/rpcrt4/rpc_transport.c (working copy) @@ -219,13 +219,20 @@ if (pipe != INVALID_HANDLE_VALUE) break; err = GetLastError(); if (err == ERROR_PIPE_BUSY) { - TRACE("connection failed, error=%x\n", err); + ERR("connection to %s failed, error=%x\n", pname, err); return RPC_S_SERVER_TOO_BUSY; } - if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { - err = GetLastError(); - WARN("connection failed, error=%x\n", err); - return RPC_S_SERVER_UNAVAILABLE; + if (wait) ERR("Waiting for Pipe Instance\n"); + if (wait) { + if (!WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { + err = GetLastError(); + ERR("connection to %s failed, error=%x, wait %x\n", pname, err, wait); + return RPC_S_SERVER_UNAVAILABLE; + } + else + { + ERR("Pipe Instance Ready!!!!!!!!!!!!!!!!!!\n"); + } } } @@ -314,7 +321,7 @@ /* protseq=ncacn_np: named pipes */ pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1); strcat(strcpy(pname, prefix), Connection->Endpoint); - r = rpcrt4_conn_open_pipe(Connection, pname, FALSE); + r = rpcrt4_conn_open_pipe(Connection, pname, TRUE); I_RpcFree(pname); return r; Index: dll/win32/kernel32/file/npipe.c =================================================================== --- dll/win32/kernel32/file/npipe.c (revision 51014) +++ dll/win32/kernel32/file/npipe.c (working copy) @@ -501,19 +501,19 @@ } /* Check what timeout we got */ - if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT) + if (nTimeOut == NMPWAIT_WAIT_FOREVER) { /* Don't use a timeout */ WaitPipe.TimeoutSpecified = FALSE; } else { - /* Check if we should wait forever */ - if (nTimeOut == NMPWAIT_WAIT_FOREVER) + /* Check if default */ + if (nTimeOut == NMPWAIT_USE_DEFAULT_WAIT) { - /* Set the max */ + /* Set it to 0 */ WaitPipe.Timeout.LowPart = 0; - WaitPipe.Timeout.HighPart = 0x80000000; + WaitPipe.Timeout.HighPart = 0; } else { Index: dll/win32/syssetup/install.c =================================================================== --- dll/win32/syssetup/install.c (revision 51014) +++ dll/win32/syssetup/install.c (working copy) @@ -481,6 +481,7 @@ if (hSCManager == NULL) { DPRINT1("Unable to open the service control manager.\n"); + DPRINT1("Last Error %d\n", GetLastError()); goto cleanup; } Index: drivers/filesystems/npfs/fsctrl.c =================================================================== --- drivers/filesystems/npfs/fsctrl.c (revision 51014) +++ drivers/filesystems/npfs/fsctrl.c (working copy) @@ -317,7 +317,6 @@ return Status; } - static NTSTATUS NpfsWaitPipe(PIRP Irp, PNPFS_CCB Ccb) @@ -326,6 +325,103 @@ PNPFS_FCB Fcb; PNPFS_CCB ServerCcb; PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe; + PLARGE_INTEGER TimeOut; + NTSTATUS Status; + PEXTENDED_IO_STACK_LOCATION IoStack; + PFILE_OBJECT FileObject; + PNPFS_VCB Vcb; + + IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack); + FileObject = IoStack->FileObject; + ASSERT(FileObject); + + DPRINT1("Waiting on Pipe %wZ\n", &FileObject->FileName); + + WaitPipe = (PFILE_PIPE_WAIT_FOR_BUFFER)Irp->AssociatedIrp.SystemBuffer; + + ASSERT(Ccb->Fcb); + ASSERT(Ccb->Fcb->Vcb); + + /* Get the VCB */ + Vcb = Ccb->Fcb->Vcb; + + /* Lock the pipe list */ + KeLockMutex(&Vcb->PipeListLock); + + /* File a pipe with the given name */ + Fcb = NpfsFindPipe(Vcb, + &FileObject->FileName); + + /* Unlock the pipe list */ + KeUnlockMutex(&Vcb->PipeListLock); + + /* Fail if not pipe was found */ + if (Fcb == NULL) + { + DPRINT1("No pipe found!\n", Fcb); + return STATUS_OBJECT_NAME_NOT_FOUND; + } + + /* search for listening server */ + current_entry = Fcb->ServerCcbListHead.Flink; + while (current_entry != &Fcb->ServerCcbListHead) + { + ServerCcb = CONTAINING_RECORD(current_entry, + NPFS_CCB, + CcbListEntry); + + if (ServerCcb->PipeState == FILE_PIPE_LISTENING_STATE) + { + /* found a listening server CCB */ + DPRINT("Listening server CCB found -- connecting\n"); + + return STATUS_SUCCESS; + } + + current_entry = current_entry->Flink; + } + + /* No listening server fcb found, so wait for one */ + + /* If a timeout specified */ + if (WaitPipe->TimeoutSpecified) + { + /* NMPWAIT_USE_DEFAULT_WAIT = 0 */ + if (WaitPipe->Timeout.QuadPart == 0) + { + TimeOut = &Fcb->TimeOut; + } + else + { + TimeOut = &WaitPipe->Timeout; + } + } + else + { + /* Wait forever */ + TimeOut = NULL; + } + + Status = KeWaitForSingleObject(&Ccb->ConnectEvent, + UserRequest, + KernelMode, + TRUE, + TimeOut); + + DPRINT("KeWaitForSingleObject() returned (Status %lx)\n", Status); + + return Status; +} + +NTSTATUS +NpfsWaitPipe2(PIRP Irp, + PNPFS_CCB Ccb) +{ + PLIST_ENTRY current_entry; + PNPFS_FCB Fcb; + PNPFS_CCB ServerCcb; + PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe; LARGE_INTEGER TimeOut; NTSTATUS Status; #ifdef USING_PROPER_NPFS_WAIT_SEMANTICS