Author: gschneider
Date: Fri Dec 11 10:45:07 2009
New Revision: 44533
URL:
http://svn.reactos.org/svn/reactos?rev=44533&view=rev
Log:
[msfs] Mail slot file system driver bring up 2/2:
- Don't allow to create two mail slots with the same name
- Pass a timeout return status when no message are found after waiting
- Clients aren't allowed to query mail slot info, this works now - add the code back
Modified:
trunk/reactos/drivers/filesystems/msfs/create.c
trunk/reactos/drivers/filesystems/msfs/finfo.c
trunk/reactos/drivers/filesystems/msfs/rw.c
Modified: trunk/reactos/drivers/filesystems/msfs/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/msfs/c…
==============================================================================
--- trunk/reactos/drivers/filesystems/msfs/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/msfs/create.c [iso-8859-1] Fri Dec 11 10:45:07 2009
@@ -16,6 +16,7 @@
/* FUNCTIONS *****************************************************************/
+/* Creates the client side */
NTSTATUS DEFAULTAPI
MsfsCreate(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
@@ -99,6 +100,7 @@
}
+/* Creates the server side */
NTSTATUS DEFAULTAPI
MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
@@ -197,7 +199,14 @@
ExFreePool(Fcb->Name.Buffer);
ExFreePool(Fcb);
- Fcb = current;
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return STATUS_UNSUCCESSFUL;
}
else
{
Modified: trunk/reactos/drivers/filesystems/msfs/finfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/msfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/msfs/finfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/msfs/finfo.c [iso-8859-1] Fri Dec 11 10:45:07 2009
@@ -95,6 +95,19 @@
DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
+ /* querying information is not permitted on client side */
+ if (Fcb->ServerCcb != Ccb)
+ {
+ Status = STATUS_ACCESS_DENIED;
+
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return Status;
+ }
+
SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
BufferLength = IoStack->Parameters.QueryFile.Length;
Modified: trunk/reactos/drivers/filesystems/msfs/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/msfs/r…
==============================================================================
--- trunk/reactos/drivers/filesystems/msfs/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/msfs/rw.c [iso-8859-1] Fri Dec 11 10:45:07 2009
@@ -62,25 +62,33 @@
KernelMode,
FALSE,
&Fcb->TimeOut);
- if ((NT_SUCCESS(Status)) && (Fcb->MessageCount > 0))
+ if (NT_SUCCESS(Status))
{
- /* copy current message into buffer */
- Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
- MSFS_MESSAGE,
- MessageListEntry);
+ if (Fcb->MessageCount > 0)
+ {
+ /* copy current message into buffer */
+ Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
+ MSFS_MESSAGE,
+ MessageListEntry);
- memcpy(Buffer, &Message->Buffer, min(Message->Size,Length));
- LengthRead = Message->Size;
+ memcpy(Buffer, &Message->Buffer, min(Message->Size,Length));
+ LengthRead = Message->Size;
- KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
- RemoveHeadList(&Fcb->MessageListHead);
- KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+ RemoveHeadList(&Fcb->MessageListHead);
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
- ExFreePool(Message);
- Fcb->MessageCount--;
- if (Fcb->MessageCount == 0)
+ ExFreePool(Message);
+ Fcb->MessageCount--;
+ if (Fcb->MessageCount == 0)
+ {
+ KeClearEvent(&Fcb->MessageEvent);
+ }
+ }
+ else if (Fcb->TimeOut.QuadPart != 0LL)
{
- KeClearEvent(&Fcb->MessageEvent);
+ /* No message found after waiting */
+ Status = STATUS_IO_TIMEOUT;
}
}