Index: C:/ROS/reactos/drivers/filesystems/npfs/rw.c =================================================================== --- drivers/filesystems/npfs/rw.c (revision 57359) +++ drivers/filesystems/npfs/rw.c (working copy) @@ -1,7 +1,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel -* FILE: drivers/fs/np/rw.c +* FILE: drivers/filesystems/npfs/rw.c * PURPOSE: Named pipe filesystem * PROGRAMMER: David Welch * Michael Martin @@ -115,10 +115,11 @@ } } +static KSTART_ROUTINE NpfsWaiterThread; static VOID NTAPI NpfsWaiterThread(PVOID InitContext) { - PNPFS_THREAD_CONTEXT ThreadContext = (PNPFS_THREAD_CONTEXT) InitContext; + PNPFS_THREAD_CONTEXT ThreadContext = InitContext; ULONG CurrentCount; ULONG Count = 0, i; PIRP Irp = NULL; @@ -175,7 +176,7 @@ } else { - /* someone has add a new wait request or cancelled an old one */ + /* someone has added a new wait request or cancelled an old one */ Irp = NULL; /* Look for cancelled requests */ @@ -183,19 +184,21 @@ { if (ThreadContext->WaitIrpArray[i] == NULL) { - ThreadContext->Count--; - ThreadContext->Vcb->EmptyWaiterCount++; - ThreadContext->WaitObjectArray[i] = ThreadContext->WaitObjectArray[ThreadContext->Count]; - ThreadContext->WaitIrpArray[i] = ThreadContext->WaitIrpArray[ThreadContext->Count]; + ThreadContext->Count--; + ThreadContext->Vcb->EmptyWaiterCount++; + ThreadContext->WaitObjectArray[i] = ThreadContext->WaitObjectArray[ThreadContext->Count]; + ThreadContext->WaitIrpArray[i] = ThreadContext->WaitIrpArray[ThreadContext->Count]; } } } if (ThreadContext->Count == 1 && ThreadContext->Vcb->EmptyWaiterCount >= MAXIMUM_WAIT_OBJECTS) { - /* it exist an other thread with empty wait slots, we can remove our thread from the list */ + /* there is another thread with empty wait slots, we can remove our thread from the list */ + ASSERT(Irp == NULL); + ThreadContext->Vcb->EmptyWaiterCount -= MAXIMUM_WAIT_OBJECTS - 1; RemoveEntryList(&ThreadContext->ListEntry); + KeUnlockMutex(&ThreadContext->Vcb->PipeListLock); ExFreePoolWithTag(ThreadContext, TAG_NPFS_THREAD_CONTEXT); - KeUnlockMutex(&ThreadContext->Vcb->PipeListLock); break; } } @@ -390,6 +393,7 @@ { /* this is a new request */ Irp->IoStatus.Information = 0; + KeResetEvent(&Ccb->ReadEvent); Context->WaitEvent = &Ccb->ReadEvent; InsertTailList(&Ccb->ReadRequestListHead, &Context->ListEntry); if (Ccb->ReadRequestListHead.Flink != &Context->ListEntry) @@ -416,10 +420,11 @@ while (1) { - Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); + Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, + NormalPagePriority); Information = Irp->IoStatus.Information; Length = IoGetCurrentIrpStackLocation(Irp)->Parameters.Read.Length; - ASSERT (Information <= Length); + ASSERT(Information <= Length); Buffer = (PVOID)((ULONG_PTR)Buffer + Information); Length -= Information; Status = STATUS_SUCCESS; @@ -443,18 +448,18 @@ { break; } - if (((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) || (!Ccb->OtherSide)) && (Ccb->ReadDataAvailable == 0)) + ASSERT(Ccb->ReadDataAvailable == 0); + if ((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) || (!Ccb->OtherSide)) { - DPRINT("PipeState: %x\n", Ccb->PipeState); Status = STATUS_PIPE_BROKEN; break; } + KeResetEvent(&Ccb->ReadEvent); ExReleaseFastMutex(&Ccb->DataListLock); if (IoIsOperationSynchronous(Irp)) { /* Wait for ReadEvent to become signaled */ - DPRINT("Waiting for readable data (%wZ)\n", &Ccb->Fcb->PipeName); Status = KeWaitForSingleObject(&Ccb->ReadEvent, UserRequest, @@ -496,7 +501,7 @@ /* If the pipe type and read mode are both byte stream */ if (Ccb->Fcb->PipeType == FILE_PIPE_BYTE_STREAM_TYPE) { - DPRINT("Byte stream mode: Ccb->Data %x\n", Ccb->Data); + DPRINT("Byte stream mode: Ccb->Data %p\n", Ccb->Data); /* Byte stream mode */ while (Length > 0 && Ccb->ReadDataAvailable > 0) { @@ -532,13 +537,12 @@ { KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE); } - KeResetEvent(&Ccb->ReadEvent); break; } } else if (Ccb->Fcb->PipeType == FILE_PIPE_MESSAGE_TYPE) { - DPRINT("Message mode: Ccb>Data %x\n", Ccb->Data); + DPRINT("Message mode: Ccb>Data %p\n", Ccb->Data); /* Check if buffer is full and the read pointer is not at the start of the buffer */ if ((Ccb->WriteQuotaAvailable == 0) && (Ccb->ReadPtr > Ccb->Data)) @@ -556,7 +560,7 @@ { ULONG NextMessageLength = 0; - /*First get the size of the message */ + /* First get the size of the message */ memcpy(&NextMessageLength, Ccb->ReadPtr, sizeof(NextMessageLength)); if ((NextMessageLength == 0) || (NextMessageLength > Ccb->ReadDataAvailable)) @@ -579,7 +583,7 @@ /* Client only requested part of the message */ { /* Calculate the remaining message new size */ - ULONG NewMessageSize = NextMessageLength-CopyLength; + ULONG NewMessageSize = NextMessageLength - CopyLength; /* Update ReadPtr to point to new Message size location */ Ccb->ReadPtr = (PVOID)((ULONG_PTR)Ccb->ReadPtr + CopyLength); @@ -608,7 +612,7 @@ Ccb->ReadPtr = Ccb->Data; } #ifndef NDEBUG - DPRINT("Length %d Buffer %x\n",CopyLength,Buffer); + DPRINT("Length %d Buffer %x\n", CopyLength, Buffer); HexDump((PUCHAR)Buffer, CopyLength); #endif @@ -616,7 +620,7 @@ Ccb->ReadDataAvailable -= CopyLength; - if ((ULONG)Ccb->WriteQuotaAvailable > (ULONG)Ccb->MaxDataLength) ASSERT(FALSE); + ASSERT(Ccb->WriteQuotaAvailable <= Ccb->MaxDataLength); } if (Information > 0) @@ -633,8 +637,6 @@ } else { - KeResetEvent(&Ccb->ReadEvent); - if ((Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) && (Ccb->WriteQuotaAvailable > 0) && (Ccb->OtherSide)) { KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE); @@ -740,6 +742,8 @@ ULONG CopyLength; ULONG TempLength; + UNREFERENCED_PARAMETER(DeviceObject); + DPRINT("NpfsWrite()\n"); IoStack = IoGetCurrentIrpStackLocation(Irp); @@ -794,7 +798,7 @@ } Status = STATUS_SUCCESS; - Buffer = MmGetSystemAddressForMdlSafe (Irp->MdlAddress, NormalPagePriority); + Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); if (!Buffer) { @@ -807,13 +811,13 @@ ExAcquireFastMutex(&ReaderCcb->DataListLock); - DPRINT("Length %d Buffer %x Offset %x\n",Length,Buffer,Offset); + DPRINT("Length %lu Buffer %p Offset %lu\n", Length, Buffer, Offset); #ifndef NDEBUG HexDump(Buffer, Length); #endif - while(1) + while (1) { if (ReaderCcb->WriteQuotaAvailable == 0) { @@ -824,6 +828,7 @@ goto done; } KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE); + KeResetEvent(&Ccb->WriteEvent); ExReleaseFastMutex(&ReaderCcb->DataListLock); DPRINT("Write Waiting for buffer space (%wZ)\n", &Fcb->PipeName); @@ -849,7 +854,7 @@ */ if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide) { - DPRINT("PipeState: %x\n", Ccb->PipeState); + DPRINT("PipeState: %lx\n", Ccb->PipeState); Status = STATUS_PIPE_BROKEN; goto done; } @@ -864,7 +869,7 @@ if (Ccb->Fcb->PipeType == FILE_PIPE_BYTE_STREAM_TYPE) { - DPRINT("Byte stream mode: Ccb->Data %x, Ccb->WritePtr %x\n", ReaderCcb->Data, ReaderCcb->WritePtr); + DPRINT("Byte stream mode: Ccb->Data %p, Ccb->WritePtr %p\n", ReaderCcb->Data, ReaderCcb->WritePtr); while (Length > 0 && ReaderCcb->WriteQuotaAvailable > 0) { @@ -901,14 +906,13 @@ if (Length == 0) { KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE); - KeResetEvent(&Ccb->WriteEvent); break; } } else if (Ccb->Fcb->PipeType == FILE_PIPE_MESSAGE_TYPE) { /* For Message Type Pipe, the Pipes memory will be used to store the size of each message */ - DPRINT("Message mode: Ccb->Data %x, Ccb->WritePtr %x\n",ReaderCcb->Data, ReaderCcb->WritePtr); + DPRINT("Message mode: Ccb->Data %p, Ccb->WritePtr %p\n", ReaderCcb->Data, ReaderCcb->WritePtr); if (Length > 0) { /* Verify the WritePtr is still inside the buffer */ @@ -916,7 +920,7 @@ ((ULONG_PTR)ReaderCcb->WritePtr < (ULONG_PTR)ReaderCcb->Data)) { DPRINT1("NPFS is writing out of its buffer. Report to developer!\n"); - DPRINT1("ReaderCcb->WritePtr %x, ReaderCcb->Data %x, ReaderCcb->MaxDataLength %lu\n", + DPRINT1("ReaderCcb->WritePtr %p, ReaderCcb->Data %p, ReaderCcb->MaxDataLength %lu\n", ReaderCcb->WritePtr, ReaderCcb->Data, ReaderCcb->MaxDataLength); ASSERT(FALSE); } @@ -954,7 +958,6 @@ if (Information > 0) { KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE); - KeResetEvent(&Ccb->WriteEvent); break; } } Index: C:/ROS/reactos/modules/rostests/winetests/qmgr/testlist.c =================================================================== --- modules/rostests/winetests/qmgr/testlist.c (revision 57355) +++ modules/rostests/winetests/qmgr/testlist.c (working copy) @@ -12,21 +12,12 @@ extern void func_job(void); extern void func_qmgr(void); -#ifdef __REACTOS__ -void func_skipped(void) { skip("qmgr tests skipped due to CORE-6536\n"); } -#endif - const struct test winetest_testlist[] = { -/* Skipped because of testbot timeouts. See CORE-6536. */ -#ifdef __REACTOS__ - { "skipped", func_skipped }, -#else { "enum_files", func_enum_files }, { "enum_jobs", func_enum_jobs }, { "file", func_file }, { "job", func_job }, { "qmgr", func_qmgr }, -#endif { 0, 0 } };