From: Colin Finck Date: Sun, 13 Mar 2011 21:55:49 +0000 (+0000) Subject: Michael Martin X-Git-Tag: ReactOS-0.3.13~4^2~4 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=4bcca728f3ffa2d810f420fa13c4cd59cf0dd221 Michael Martin - Fix "EnableUserModePnpManager() failed!" in second stage setup. Tested by Eric Kohl and igorko. See issue #5989 for more details. svn path=/trunk/; revision=51043 --- diff --git a/reactos/dll/win32/kernel32/file/npipe.c b/reactos/dll/win32/kernel32/file/npipe.c index c0147730bc8..8915fb18052 100644 --- a/reactos/dll/win32/kernel32/file/npipe.c +++ b/reactos/dll/win32/kernel32/file/npipe.c @@ -501,19 +501,19 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, } /* 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 { diff --git a/reactos/dll/win32/rpcrt4/rpc_transport.c b/reactos/dll/win32/rpcrt4/rpc_transport.c index 630c5bbecf4..92588bad087 100644 --- a/reactos/dll/win32/rpcrt4/rpc_transport.c +++ b/reactos/dll/win32/rpcrt4/rpc_transport.c @@ -219,13 +219,20 @@ static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname, 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 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection) /* 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; diff --git a/reactos/dll/win32/syssetup/install.c b/reactos/dll/win32/syssetup/install.c index 66f981be038..59b32470bc4 100644 --- a/reactos/dll/win32/syssetup/install.c +++ b/reactos/dll/win32/syssetup/install.c @@ -481,6 +481,7 @@ EnableUserModePnpManager(VOID) if (hSCManager == NULL) { DPRINT1("Unable to open the service control manager.\n"); + DPRINT1("Last Error %d\n", GetLastError()); goto cleanup; } diff --git a/reactos/drivers/filesystems/npfs/fsctrl.c b/reactos/drivers/filesystems/npfs/fsctrl.c index decae593b86..e7085af0610 100644 --- a/reactos/drivers/filesystems/npfs/fsctrl.c +++ b/reactos/drivers/filesystems/npfs/fsctrl.c @@ -317,10 +317,106 @@ NpfsDisconnectPipe(PNPFS_CCB Ccb) return Status; } - static NTSTATUS NpfsWaitPipe(PIRP Irp, PNPFS_CCB Ccb) +{ + PLIST_ENTRY current_entry; + 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;