Fix Mailslot and Named Pipe Drivers

svn path=/trunk/; revision=11525
This commit is contained in:
Alex Ionescu 2004-11-01 22:54:24 +00:00
parent a10211cdc2
commit 7d6071de5d
2 changed files with 21 additions and 20 deletions

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.5 2004/07/03 17:40:20 navaraf Exp $
/* $Id: create.c,v 1.6 2004/11/01 22:54:23 ion Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -10,6 +10,7 @@
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <ddk/iotypes.h> /* FIXME: Temporary Until NDK implemented */
#include "msfs.h"
#define NDEBUG
@ -114,14 +115,14 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
KIRQL oldIrql;
PLIST_ENTRY current_entry;
PMSFS_MAILSLOT current;
PIO_MAILSLOT_CREATE_BUFFER Buffer;
PMAILSLOT_CREATE_PARAMETERS Buffer;
DPRINT("MsfsCreateMailslot(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
IoStack = IoGetCurrentIrpStackLocation(Irp);
DeviceExtension = DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject;
Buffer = (PIO_MAILSLOT_CREATE_BUFFER)Irp->Tail.Overlay.AuxiliaryBuffer;
Buffer = (PMAILSLOT_CREATE_PARAMETERS)Irp->Tail.Overlay.AuxiliaryBuffer;
DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
@ -165,9 +166,9 @@ MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
InitializeListHead(&Mailslot->FcbListHead);
KeInitializeSpinLock(&Mailslot->FcbListLock);
Mailslot->MaxMessageSize = Buffer->MaxMessageSize;
Mailslot->MaxMessageSize = Buffer->MaximumMessageSize;
Mailslot->MessageCount = 0;
Mailslot->TimeOut = Buffer->TimeOut;
Mailslot->TimeOut = Buffer->ReadTimeout;
KeInitializeEvent(&Mailslot->MessageEvent,
NotificationEvent,
FALSE);

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.24 2004/10/14 11:49:55 ekohl Exp $
/* $Id: create.c,v 1.25 2004/11/01 22:54:24 ion Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -223,7 +223,7 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
PNPFS_FCB Fcb;
PLIST_ENTRY current_entry;
PNPFS_PIPE current = NULL;
PIO_PIPE_CREATE_BUFFER Buffer;
PNAMED_PIPE_CREATE_PARAMETERS Buffer;
DPRINT("NpfsCreateNamedPipe(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
@ -233,7 +233,7 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
DPRINT("FileObject %p\n", FileObject);
DPRINT("Pipe name %wZ\n", &FileObject->FileName);
Buffer = (PIO_PIPE_CREATE_BUFFER)Irp->Tail.Overlay.AuxiliaryBuffer;
Buffer = (PNAMED_PIPE_CREATE_PARAMETERS)Irp->Tail.Overlay.AuxiliaryBuffer;
Irp->IoStatus.Information = 0;
@ -286,8 +286,8 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
}
/* FIXME: Check pipe modes also! */
if (Pipe->MaximumInstances != Buffer->MaxInstances ||
Pipe->TimeOut.QuadPart != Buffer->TimeOut.QuadPart)
if (Pipe->MaximumInstances != Buffer->MaximumInstances ||
Pipe->TimeOut.QuadPart != Buffer->DefaultTimeout.QuadPart)
{
DPRINT("Asked for invalid pipe mode.\n");
ExFreePool(Fcb);
@ -323,24 +323,24 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
InitializeListHead(&Pipe->ClientFcbListHead);
KeInitializeMutex(&Pipe->FcbListLock, 0);
Pipe->PipeType = Buffer->WriteModeMessage ? FILE_PIPE_MESSAGE_TYPE : FILE_PIPE_BYTE_STREAM_TYPE;
Pipe->PipeWriteMode = Buffer->WriteModeMessage ? FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
Pipe->PipeReadMode = Buffer->ReadModeMessage ? FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
Pipe->PipeBlockMode = Buffer->NonBlocking;
Pipe->PipeType = Buffer->NamedPipeType ? FILE_PIPE_MESSAGE_TYPE : FILE_PIPE_BYTE_STREAM_TYPE;
Pipe->PipeWriteMode = Buffer->NamedPipeType ? FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
Pipe->PipeReadMode = Buffer->ReadMode ? FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE;
Pipe->PipeBlockMode = Buffer->CompletionMode;
Pipe->PipeConfiguration = IoStack->Parameters.Create.Options & 0x3;
Pipe->MaximumInstances = Buffer->MaxInstances;
Pipe->MaximumInstances = Buffer->MaximumInstances;
Pipe->CurrentInstances = 0;
Pipe->TimeOut = Buffer->TimeOut;
Pipe->TimeOut = Buffer->DefaultTimeout;
if (!(IoStack->Parameters.Create.Options & FILE_PIPE_OUTBOUND) ||
IoStack->Parameters.Create.Options & FILE_PIPE_FULL_DUPLEX)
{
if (Buffer->InBufferSize == 0)
if (Buffer->InboundQuota == 0)
{
Pipe->InboundQuota = DeviceExt->DefaultQuota;
}
else
{
Pipe->InboundQuota = PAGE_ROUND_UP(Buffer->InBufferSize);
Pipe->InboundQuota = PAGE_ROUND_UP(Buffer->InboundQuota);
if (Pipe->InboundQuota < DeviceExt->MinQuota)
{
Pipe->InboundQuota = DeviceExt->MinQuota;
@ -357,13 +357,13 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject,
}
if (IoStack->Parameters.Create.Options & (FILE_PIPE_FULL_DUPLEX|FILE_PIPE_OUTBOUND))
{
if (Buffer->OutBufferSize == 0)
if (Buffer->OutboundQuota == 0)
{
Pipe->OutboundQuota = DeviceExt->DefaultQuota;
}
else
{
Pipe->OutboundQuota = PAGE_ROUND_UP(Buffer->OutBufferSize);
Pipe->OutboundQuota = PAGE_ROUND_UP(Buffer->OutboundQuota);
if (Pipe->OutboundQuota < DeviceExt->MinQuota)
{
Pipe->OutboundQuota = DeviceExt->MinQuota;