Merge r51043 and r51044
authorColin Finck <colin@reactos.org>
Sun, 13 Mar 2011 22:10:29 +0000 (22:10 +0000)
committerColin Finck <colin@reactos.org>
Sun, 13 Mar 2011 22:10:29 +0000 (22:10 +0000)
svn path=/branches/ros-branch-0_3_13/; revision=51045

reactos/base/applications/rapps/rapps/mirc.txt
reactos/dll/win32/kernel32/file/npipe.c
reactos/dll/win32/rpcrt4/rpc_transport.c
reactos/dll/win32/syssetup/install.c
reactos/drivers/filesystems/npfs/fsctrl.c

index 6bb148c..d07b7c0 100644 (file)
@@ -2,7 +2,7 @@
 
 [Section]
 Name = mIRC
 
 [Section]
 Name = mIRC
-Version = 7.17
+Version = 7.19
 Licence = Shareware
 Description = The most popular client for the Internet Relay Chat (IRC).
 Size = 1.9M
 Licence = Shareware
 Description = The most popular client for the Internet Relay Chat (IRC).
 Size = 1.9M
index c014773..8915fb1 100644 (file)
@@ -501,19 +501,19 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName,
     }
 
     /* Check what timeout we got */
     }
 
     /* 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
     {
     {
         /* 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.LowPart = 0;
-            WaitPipe.Timeout.HighPart = 0x80000000;
+            WaitPipe.Timeout.HighPart = 0;
         }
         else
         {
         }
         else
         {
index 630c5bb..92588ba 100644 (file)
@@ -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) {
     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;
     }
       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);
   /* 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;
   I_RpcFree(pname);
 
   return r;
index 5980dca..17f3643 100644 (file)
@@ -481,6 +481,7 @@ EnableUserModePnpManager(VOID)
     if (hSCManager == NULL)
     {
         DPRINT1("Unable to open the service control manager.\n");
     if (hSCManager == NULL)
     {
         DPRINT1("Unable to open the service control manager.\n");
+        DPRINT1("Last Error %d\n", GetLastError());
         goto cleanup;
     }
 
         goto cleanup;
     }
 
index decae59..e7085af 100644 (file)
@@ -317,10 +317,106 @@ NpfsDisconnectPipe(PNPFS_CCB Ccb)
     return Status;
 }
 
     return Status;
 }
 
-
 static NTSTATUS
 NpfsWaitPipe(PIRP Irp,
              PNPFS_CCB Ccb)
 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;
 {
     PLIST_ENTRY current_entry;
     PNPFS_FCB Fcb;