mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
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
This commit is contained in:
parent
b16c59e50e
commit
4bcca728f3
4 changed files with 116 additions and 12 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue