Update Indentation (tab->4spaces).
authorEric Kohl <eric.kohl@reactos.org>
Sun, 7 May 2006 11:14:41 +0000 (11:14 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 7 May 2006 11:14:41 +0000 (11:14 +0000)
svn path=/trunk/; revision=21825

reactos/drivers/filesystems/ms/create.c
reactos/drivers/filesystems/ms/finfo.c
reactos/drivers/filesystems/ms/fsctrl.c
reactos/drivers/filesystems/ms/msfs.c
reactos/drivers/filesystems/ms/msfs.h
reactos/drivers/filesystems/ms/msfs.rbuild
reactos/drivers/filesystems/ms/rw.c

index a529a79..b88ae29 100644 (file)
@@ -2,9 +2,9 @@
  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/ms/create.c
+ * FILE:       drivers/filesystems/ms/create.c
  * PURPOSE:    Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
+ * PROGRAMMER: Eric Kohl
  */
 
 /* INCLUDES ******************************************************************/
 
 NTSTATUS DEFAULTAPI
 MsfsCreate(PDEVICE_OBJECT DeviceObject,
-          PIRP Irp)
+           PIRP Irp)
 {
-   PIO_STACK_LOCATION IoStack;
-   PFILE_OBJECT FileObject;
-   PMSFS_DEVICE_EXTENSION DeviceExtension;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   PMSFS_FCB current = NULL;
-   PLIST_ENTRY current_entry;
-   KIRQL oldIrql;
+    PIO_STACK_LOCATION IoStack;
+    PFILE_OBJECT FileObject;
+    PMSFS_DEVICE_EXTENSION DeviceExtension;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    PMSFS_FCB current = NULL;
+    PLIST_ENTRY current_entry;
+    KIRQL oldIrql;
 
-   DPRINT("MsfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+    DPRINT("MsfsCreate(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
 
-   IoStack = IoGetCurrentIrpStackLocation(Irp);
-   DeviceExtension = DeviceObject->DeviceExtension;
-   FileObject = IoStack->FileObject;
+    IoStack = IoGetCurrentIrpStackLocation(Irp);
+    DeviceExtension = DeviceObject->DeviceExtension;
+    FileObject = IoStack->FileObject;
 
-   DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
+    DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
 
-   Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
-   if (Ccb == NULL)
-     {
-       Irp->IoStatus.Status = STATUS_NO_MEMORY;
-       Irp->IoStatus.Information = 0;
+    Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
+    if (Ccb == NULL)
+    {
+        Irp->IoStatus.Status = STATUS_NO_MEMORY;
+        Irp->IoStatus.Information = 0;
 
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return STATUS_NO_MEMORY;
+    }
 
-       return(STATUS_NO_MEMORY);
-     }
+    KeLockMutex(&DeviceExtension->FcbListLock);
+    current_entry = DeviceExtension->FcbListHead.Flink;
+    while (current_entry != &DeviceExtension->FcbListHead)
+    {
+        current = CONTAINING_RECORD(current_entry,
+                                    MSFS_FCB,
+                                    FcbListEntry);
 
-   KeLockMutex(&DeviceExtension->FcbListLock);
-   current_entry = DeviceExtension->FcbListHead.Flink;
-   while (current_entry != &DeviceExtension->FcbListHead)
-     {
-       current = CONTAINING_RECORD(current_entry,
-                                   MSFS_FCB,
-                                   FcbListEntry);
+        if (!RtlCompareUnicodeString(&FileObject->FileName, &current->Name, TRUE))
+            break;
 
-       if (!RtlCompareUnicodeString(&FileObject->FileName, &current->Name, TRUE))
-         {
-            break;
-         }
+        current_entry = current_entry->Flink;
+    }
 
-       current_entry = current_entry->Flink;
-     }
+    if (current_entry == &DeviceExtension->FcbListHead)
+    {
+        ExFreePool(Ccb);
+        KeUnlockMutex(&DeviceExtension->FcbListLock);
 
-   if (current_entry == &DeviceExtension->FcbListHead)
-     {
-       ExFreePool(Ccb);
-       KeUnlockMutex(&DeviceExtension->FcbListLock);
+        Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+        Irp->IoStatus.Information = 0;
 
-       Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
-       Irp->IoStatus.Information = 0;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return STATUS_UNSUCCESSFUL;
+    }
 
-       return(STATUS_UNSUCCESSFUL);
-     }
+    Fcb = current;
 
-   Fcb = current;
+    KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
+    InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
+    KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
 
-   KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
-   InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
-   KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+    Fcb->ReferenceCount++;
 
-   Fcb->ReferenceCount++;
+    Ccb->Fcb = Fcb;
 
-   Ccb->Fcb = Fcb;
+    KeUnlockMutex(&DeviceExtension->FcbListLock);
 
-   KeUnlockMutex(&DeviceExtension->FcbListLock);
+    FileObject->FsContext = Fcb;
+    FileObject->FsContext2 = Ccb;
+    FileObject->Flags |= FO_MAILSLOT;
 
-   FileObject->FsContext = Fcb;
-   FileObject->FsContext2 = Ccb;
-   FileObject->Flags |= FO_MAILSLOT;
+    Irp->IoStatus.Status = STATUS_SUCCESS;
+    Irp->IoStatus.Information = 0;
 
-   Irp->IoStatus.Status = STATUS_SUCCESS;
-   Irp->IoStatus.Information = 0;
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-   IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-   return(STATUS_SUCCESS);
+    return STATUS_SUCCESS;
 }
 
 
 NTSTATUS DEFAULTAPI
 MsfsCreateMailslot(PDEVICE_OBJECT DeviceObject,
-                  PIRP Irp)
+                   PIRP Irp)
 {
-   PEXTENDED_IO_STACK_LOCATION IoStack;
-   PFILE_OBJECT FileObject;
-   PMSFS_DEVICE_EXTENSION DeviceExtension;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   KIRQL oldIrql;
-   PLIST_ENTRY current_entry;
-   PMSFS_FCB current;
-   PMAILSLOT_CREATE_PARAMETERS Buffer;
-
-   DPRINT("MsfsCreateMailslot(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
-   IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp);
-   DeviceExtension = DeviceObject->DeviceExtension;
-   FileObject = IoStack->FileObject;
-   Buffer = IoStack->Parameters.CreateMailslot.Parameters;
-
-   DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
-
-   Fcb = ExAllocatePool(NonPagedPool, sizeof(MSFS_FCB));
-   if (Fcb == NULL)
-     {
-       Irp->IoStatus.Status = STATUS_NO_MEMORY;
-       Irp->IoStatus.Information = 0;
-
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-       return(STATUS_NO_MEMORY);
-     }
-
-   Fcb->Name.Length = FileObject->FileName.Length;
-   Fcb->Name.MaximumLength = Fcb->Name.Length + sizeof(UNICODE_NULL);
-   Fcb->Name.Buffer = ExAllocatePool(NonPagedPool, Fcb->Name.MaximumLength);
-   if (Fcb->Name.Buffer == NULL)
-     {
-       ExFreePool(Fcb);
-
-       Irp->IoStatus.Status = STATUS_NO_MEMORY;
-       Irp->IoStatus.Information = 0;
-
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-       return(STATUS_NO_MEMORY);
-     }
-
-   RtlCopyUnicodeString(&Fcb->Name, &FileObject->FileName);
-
-   Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
-   if (Ccb == NULL)
-     {
-       ExFreePool(Fcb->Name.Buffer);
-       ExFreePool(Fcb);
-
-       Irp->IoStatus.Status = STATUS_NO_MEMORY;
-       Irp->IoStatus.Information = 0;
-
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-       return(STATUS_NO_MEMORY);
-     }
-
-   Fcb->ReferenceCount = 0;
-   InitializeListHead(&Fcb->CcbListHead);
-   KeInitializeSpinLock(&Fcb->CcbListLock);
-
-   Fcb->MaxMessageSize = Buffer->MaximumMessageSize;
-   Fcb->MessageCount = 0;
-   Fcb->TimeOut = Buffer->ReadTimeout;
-   KeInitializeEvent(&Fcb->MessageEvent,
-                    NotificationEvent,
-                    FALSE);
-
-   InitializeListHead(&Fcb->MessageListHead);
-   KeInitializeSpinLock(&Fcb->MessageListLock);
-
-   KeLockMutex(&DeviceExtension->FcbListLock);
-   current_entry = DeviceExtension->FcbListHead.Flink;
-   while (current_entry != &DeviceExtension->FcbListHead)
-     {
-       current = CONTAINING_RECORD(current_entry,
-                                   MSFS_FCB,
-                                   FcbListEntry);
-
-       if (!RtlCompareUnicodeString(&Fcb->Name, &current->Name, TRUE))
-         {
-            break;
-         }
-
-       current_entry = current_entry->Flink;
-     }
-
-   if (current_entry != &DeviceExtension->FcbListHead)
-     {
-       ExFreePool(Fcb->Name.Buffer);
-       ExFreePool(Fcb);
-
-       Fcb = current;
-     }
-   else
-     {
-       InsertTailList(&DeviceExtension->FcbListHead,
-                      &Fcb->FcbListEntry);
-     }
+    PEXTENDED_IO_STACK_LOCATION IoStack;
+    PFILE_OBJECT FileObject;
+    PMSFS_DEVICE_EXTENSION DeviceExtension;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    KIRQL oldIrql;
+    PLIST_ENTRY current_entry;
+    PMSFS_FCB current;
+    PMAILSLOT_CREATE_PARAMETERS Buffer;
+
+    DPRINT("MsfsCreateMailslot(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+
+    IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp);
+    DeviceExtension = DeviceObject->DeviceExtension;
+    FileObject = IoStack->FileObject;
+    Buffer = IoStack->Parameters.CreateMailslot.Parameters;
+
+    DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
+
+    Fcb = ExAllocatePool(NonPagedPool, sizeof(MSFS_FCB));
+    if (Fcb == NULL)
+    {
+        Irp->IoStatus.Status = STATUS_NO_MEMORY;
+        Irp->IoStatus.Information = 0;
+
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+        return STATUS_NO_MEMORY;
+    }
+
+    Fcb->Name.Length = FileObject->FileName.Length;
+    Fcb->Name.MaximumLength = Fcb->Name.Length + sizeof(UNICODE_NULL);
+    Fcb->Name.Buffer = ExAllocatePool(NonPagedPool, Fcb->Name.MaximumLength);
+    if (Fcb->Name.Buffer == NULL)
+    {
+        ExFreePool(Fcb);
+
+        Irp->IoStatus.Status = STATUS_NO_MEMORY;
+        Irp->IoStatus.Information = 0;
+
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+        return STATUS_NO_MEMORY;
+    }
+
+    RtlCopyUnicodeString(&Fcb->Name, &FileObject->FileName);
+
+    Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
+    if (Ccb == NULL)
+    {
+        ExFreePool(Fcb->Name.Buffer);
+        ExFreePool(Fcb);
+
+        Irp->IoStatus.Status = STATUS_NO_MEMORY;
+        Irp->IoStatus.Information = 0;
 
-   KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
-   InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
-   KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-   Fcb->ReferenceCount++;
-   Fcb->ServerCcb = Ccb;
-   Ccb->Fcb = Fcb;
+        return STATUS_NO_MEMORY;
+    }
 
-   KeUnlockMutex(&DeviceExtension->FcbListLock);
+    Fcb->ReferenceCount = 0;
+    InitializeListHead(&Fcb->CcbListHead);
+    KeInitializeSpinLock(&Fcb->CcbListLock);
 
-   FileObject->FsContext = Fcb;
-   FileObject->FsContext2 = Ccb;
-   FileObject->Flags |= FO_MAILSLOT;
+    Fcb->MaxMessageSize = Buffer->MaximumMessageSize;
+    Fcb->MessageCount = 0;
+    Fcb->TimeOut = Buffer->ReadTimeout;
+    KeInitializeEvent(&Fcb->MessageEvent,
+                      NotificationEvent,
+                      FALSE);
 
-   Irp->IoStatus.Status = STATUS_SUCCESS;
-   Irp->IoStatus.Information = 0;
+    InitializeListHead(&Fcb->MessageListHead);
+    KeInitializeSpinLock(&Fcb->MessageListLock);
 
-   IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    KeLockMutex(&DeviceExtension->FcbListLock);
+    current_entry = DeviceExtension->FcbListHead.Flink;
+    while (current_entry != &DeviceExtension->FcbListHead)
+    {
+        current = CONTAINING_RECORD(current_entry,
+                                    MSFS_FCB,
+                                    FcbListEntry);
 
-   return(STATUS_SUCCESS);
+        if (!RtlCompareUnicodeString(&Fcb->Name, &current->Name, TRUE))
+            break;
+
+        current_entry = current_entry->Flink;
+    }
+
+    if (current_entry != &DeviceExtension->FcbListHead)
+    {
+        ExFreePool(Fcb->Name.Buffer);
+        ExFreePool(Fcb);
+
+        Fcb = current;
+    }
+    else
+    {
+        InsertTailList(&DeviceExtension->FcbListHead,
+                       &Fcb->FcbListEntry);
+    }
+
+    KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
+    InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
+    KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+
+    Fcb->ReferenceCount++;
+    Fcb->ServerCcb = Ccb;
+    Ccb->Fcb = Fcb;
+
+    KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+    FileObject->FsContext = Fcb;
+    FileObject->FsContext2 = Ccb;
+    FileObject->Flags |= FO_MAILSLOT;
+
+    Irp->IoStatus.Status = STATUS_SUCCESS;
+    Irp->IoStatus.Information = 0;
+
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+    return STATUS_SUCCESS;
 }
 
 
 NTSTATUS DEFAULTAPI
 MsfsClose(PDEVICE_OBJECT DeviceObject,
-         PIRP Irp)
+          PIRP Irp)
 {
-   PIO_STACK_LOCATION IoStack;
-   PFILE_OBJECT FileObject;
-   PMSFS_DEVICE_EXTENSION DeviceExtension;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   PMSFS_MESSAGE Message;
-   KIRQL oldIrql;
+    PIO_STACK_LOCATION IoStack;
+    PFILE_OBJECT FileObject;
+    PMSFS_DEVICE_EXTENSION DeviceExtension;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    PMSFS_MESSAGE Message;
+    KIRQL oldIrql;
+
+    DPRINT("MsfsClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
 
-   DPRINT("MsfsClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+    IoStack = IoGetCurrentIrpStackLocation(Irp);
+    DeviceExtension = DeviceObject->DeviceExtension;
+    FileObject = IoStack->FileObject;
 
-   IoStack = IoGetCurrentIrpStackLocation(Irp);
-   DeviceExtension = DeviceObject->DeviceExtension;
-   FileObject = IoStack->FileObject;
+    KeLockMutex(&DeviceExtension->FcbListLock);
 
-   KeLockMutex(&DeviceExtension->FcbListLock);
+    if (DeviceExtension->FcbListHead.Flink == &DeviceExtension->FcbListHead)
+    {
+        KeUnlockMutex(&DeviceExtension->FcbListLock);
 
-   if (DeviceExtension->FcbListHead.Flink == &DeviceExtension->FcbListHead)
-     {
-       KeUnlockMutex(&DeviceExtension->FcbListLock);
+        Irp->IoStatus.Status = STATUS_SUCCESS;
+        Irp->IoStatus.Information = 0;
 
-       Irp->IoStatus.Status = STATUS_SUCCESS;
-       Irp->IoStatus.Information = 0;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return STATUS_SUCCESS;
+    }
 
-       return(STATUS_SUCCESS);
-     }
+    Fcb = FileObject->FsContext;
+    Ccb = FileObject->FsContext2;
 
-   Fcb = FileObject->FsContext;
-   Ccb = FileObject->FsContext2;
+    DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
 
-   DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
+    Fcb->ReferenceCount--;
+    if (Fcb->ServerCcb == Ccb)
+    {
+        /* delete all messages from message-list */
+        KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
 
-   Fcb->ReferenceCount--;
-   if (Fcb->ServerCcb == Ccb)
-     {
-       /* delete all messages from message-list */
-       KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+        while (Fcb->MessageListHead.Flink != &Fcb->MessageListHead)
+        {
+            Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
+                                        MSFS_MESSAGE,
+                                        MessageListEntry);
+            RemoveEntryList(Fcb->MessageListHead.Flink);
+            ExFreePool(Message);
+        }
 
-       while (Fcb->MessageListHead.Flink != &Fcb->MessageListHead)
-         {
-            Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
-                                        MSFS_MESSAGE,
-                                        MessageListEntry);
-            RemoveEntryList(Fcb->MessageListHead.Flink);
-            ExFreePool(Message);
-         }
-       Fcb->MessageCount = 0;
+        Fcb->MessageCount = 0;
 
-       KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
-       Fcb->ServerCcb = NULL;
-     }
+        KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+        Fcb->ServerCcb = NULL;
+    }
 
-   KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
-   RemoveEntryList(&Ccb->CcbListEntry);
-   KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
-   ExFreePool(Ccb);
-   FileObject->FsContext2 = NULL;
+    KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
+    RemoveEntryList(&Ccb->CcbListEntry);
+    KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+    ExFreePool(Ccb);
+    FileObject->FsContext2 = NULL;
 
-   if (Fcb->ReferenceCount == 0)
-     {
-       DPRINT1("ReferenceCount == 0: Deleting mailslot data\n");
-       RemoveEntryList(&Fcb->FcbListEntry);
-       ExFreePool(Fcb->Name.Buffer);
-       ExFreePool(Fcb);
-     }
+    if (Fcb->ReferenceCount == 0)
+    {
+        DPRINT1("ReferenceCount == 0: Deleting mailslot data\n");
+        RemoveEntryList(&Fcb->FcbListEntry);
+        ExFreePool(Fcb->Name.Buffer);
+        ExFreePool(Fcb);
+    }
 
-   KeUnlockMutex(&DeviceExtension->FcbListLock);
+    KeUnlockMutex(&DeviceExtension->FcbListLock);
 
-   Irp->IoStatus.Status = STATUS_SUCCESS;
-   Irp->IoStatus.Information = 0;
+    Irp->IoStatus.Status = STATUS_SUCCESS;
+    Irp->IoStatus.Information = 0;
 
-   IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-   return(STATUS_SUCCESS);
+    return STATUS_SUCCESS;
 }
 
 /* EOF */
index 1655819..2796b5a 100644 (file)
@@ -2,9 +2,9 @@
  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/ms/finfo.c
+ * FILE:       drivers/filesystems/ms/finfo.c
  * PURPOSE:    Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
+ * PROGRAMMER: Eric Kohl
  */
 
 /* INCLUDES ******************************************************************/
 
 static NTSTATUS
 MsfsQueryMailslotInformation(PMSFS_FCB Fcb,
-                            PFILE_MAILSLOT_QUERY_INFORMATION Buffer,
-                            PULONG BufferLength)
+                             PFILE_MAILSLOT_QUERY_INFORMATION Buffer,
+                             PULONG BufferLength)
 {
-   KIRQL oldIrql;
-
-   if (*BufferLength < sizeof(FILE_MAILSLOT_QUERY_INFORMATION))
-     return(STATUS_BUFFER_OVERFLOW);
-
-   Buffer->MaximumMessageSize = Fcb->MaxMessageSize;
-   Buffer->ReadTimeout = Fcb->TimeOut;
-
-   KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
-   Buffer->MessagesAvailable = Fcb->MessageCount;
-   if (Fcb->MessageCount == 0)
-     {
-       Buffer->NextMessageSize = MAILSLOT_NO_MESSAGE;
-     }
-   else
-     {
-       /* FIXME: read size of first message (head) */
-       Buffer->NextMessageSize = 0;
-     }
-   KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
-
-   *BufferLength -= sizeof(FILE_MAILSLOT_QUERY_INFORMATION);
-
-   return(STATUS_SUCCESS);
+    KIRQL oldIrql;
+
+    if (*BufferLength < sizeof(FILE_MAILSLOT_QUERY_INFORMATION))
+        return STATUS_BUFFER_OVERFLOW;
+
+    Buffer->MaximumMessageSize = Fcb->MaxMessageSize;
+    Buffer->ReadTimeout = Fcb->TimeOut;
+
+    KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+    Buffer->MessagesAvailable = Fcb->MessageCount;
+    if (Fcb->MessageCount == 0)
+    {
+        Buffer->NextMessageSize = MAILSLOT_NO_MESSAGE;
+    }
+    else
+    {
+        /* FIXME: read size of first message (head) */
+        Buffer->NextMessageSize = 0;
+    }
+    KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+
+    *BufferLength -= sizeof(FILE_MAILSLOT_QUERY_INFORMATION);
+
+    return STATUS_SUCCESS;
 }
 
 
 static NTSTATUS
 MsfsSetMailslotInformation(PMSFS_FCB Fcb,
-                          PFILE_MAILSLOT_SET_INFORMATION Buffer,
-                          PULONG BufferLength)
+                           PFILE_MAILSLOT_SET_INFORMATION Buffer,
+                           PULONG BufferLength)
 {
-   if (*BufferLength < sizeof(FILE_MAILSLOT_SET_INFORMATION))
-     return(STATUS_BUFFER_OVERFLOW);
+    if (*BufferLength < sizeof(FILE_MAILSLOT_SET_INFORMATION))
+        return STATUS_BUFFER_OVERFLOW;
 
-   Fcb->TimeOut = *Buffer->ReadTimeout;
+    Fcb->TimeOut = *Buffer->ReadTimeout;
 
-   return(STATUS_SUCCESS);
+    return STATUS_SUCCESS;
 }
 
 
 NTSTATUS DEFAULTAPI
 MsfsQueryInformation(PDEVICE_OBJECT DeviceObject,
-                    PIRP Irp)
+                     PIRP Irp)
 {
-   PIO_STACK_LOCATION IoStack;
-   FILE_INFORMATION_CLASS FileInformationClass;
-   PFILE_OBJECT FileObject;
-   PMSFS_DEVICE_EXTENSION DeviceExtension;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   PVOID SystemBuffer;
-   ULONG BufferLength;
-   NTSTATUS Status;
-
-   DPRINT("MsfsQueryInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
-   IoStack = IoGetCurrentIrpStackLocation (Irp);
-   FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
-   DeviceExtension = DeviceObject->DeviceExtension;
-   FileObject = IoStack->FileObject;
-   Fcb = (PMSFS_FCB)FileObject->FsContext;
-   Ccb = (PMSFS_CCB)FileObject->FsContext2;
-
-   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;
-
-   switch (FileInformationClass)
-     {
-     case FileMailslotQueryInformation:
-       Status = MsfsQueryMailslotInformation(Fcb,
-                                             SystemBuffer,
-                                             &BufferLength);
-       break;
-     default:
-       Status = STATUS_NOT_IMPLEMENTED;
-     }
-
-   Irp->IoStatus.Status = Status;
-   if (NT_SUCCESS(Status))
-     Irp->IoStatus.Information =
-       IoStack->Parameters.QueryFile.Length - BufferLength;
-   else
-     Irp->IoStatus.Information = 0;
-   IoCompleteRequest(Irp,
-                    IO_NO_INCREMENT);
-
-   return(Status);
+    PIO_STACK_LOCATION IoStack;
+    FILE_INFORMATION_CLASS FileInformationClass;
+    PFILE_OBJECT FileObject;
+    PMSFS_DEVICE_EXTENSION DeviceExtension;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    PVOID SystemBuffer;
+    ULONG BufferLength;
+    NTSTATUS Status;
+
+    DPRINT("MsfsQueryInformation(DeviceObject %p Irp %p)\n",
+           DeviceObject, Irp);
+
+    IoStack = IoGetCurrentIrpStackLocation (Irp);
+    FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
+    DeviceExtension = DeviceObject->DeviceExtension;
+    FileObject = IoStack->FileObject;
+    Fcb = (PMSFS_FCB)FileObject->FsContext;
+    Ccb = (PMSFS_CCB)FileObject->FsContext2;
+
+    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;
+
+    switch (FileInformationClass)
+    {
+    case FileMailslotQueryInformation:
+        Status = MsfsQueryMailslotInformation(Fcb,
+                                              SystemBuffer,
+                                              &BufferLength);
+        break;
+
+    default:
+        Status = STATUS_NOT_IMPLEMENTED;
+    }
+
+    Irp->IoStatus.Status = Status;
+    if (NT_SUCCESS(Status))
+        Irp->IoStatus.Information =
+             IoStack->Parameters.QueryFile.Length - BufferLength;
+    else
+        Irp->IoStatus.Information = 0;
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+    return Status;
 }
 
 
 NTSTATUS DEFAULTAPI
 MsfsSetInformation(PDEVICE_OBJECT DeviceObject,
-                  PIRP Irp)
+                   PIRP Irp)
 {
-   PIO_STACK_LOCATION IoStack;
-   FILE_INFORMATION_CLASS FileInformationClass;
-   PFILE_OBJECT FileObject;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   PVOID SystemBuffer;
-   ULONG BufferLength;
-   NTSTATUS Status;
-
-   DPRINT("MsfsSetInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
-   IoStack = IoGetCurrentIrpStackLocation (Irp);
-   FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
-   FileObject = IoStack->FileObject;
-   Fcb = (PMSFS_FCB)FileObject->FsContext;
-   Ccb = (PMSFS_CCB)FileObject->FsContext2;
-
-   DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
-
-   /* setting 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;
-
-   DPRINT("FileInformationClass %d\n", FileInformationClass);
-   DPRINT("SystemBuffer %x\n", SystemBuffer);
-
-   switch (FileInformationClass)
-     {
-     case FileMailslotSetInformation:
-       Status = MsfsSetMailslotInformation(Fcb,
-                                           SystemBuffer,
-                                           &BufferLength);
-       break;
+    PIO_STACK_LOCATION IoStack;
+    FILE_INFORMATION_CLASS FileInformationClass;
+    PFILE_OBJECT FileObject;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    PVOID SystemBuffer;
+    ULONG BufferLength;
+    NTSTATUS Status;
+
+    DPRINT("MsfsSetInformation(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+
+    IoStack = IoGetCurrentIrpStackLocation (Irp);
+    FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
+    FileObject = IoStack->FileObject;
+    Fcb = (PMSFS_FCB)FileObject->FsContext;
+    Ccb = (PMSFS_CCB)FileObject->FsContext2;
+
+    DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
+
+    /* setting 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;
+
+    DPRINT("FileInformationClass %d\n", FileInformationClass);
+    DPRINT("SystemBuffer %x\n", SystemBuffer);
+
+    switch (FileInformationClass)
+    {
+    case FileMailslotSetInformation:
+        Status = MsfsSetMailslotInformation(Fcb,
+                                            SystemBuffer,
+                                            &BufferLength);
+        break;
+
      default:
-       Status = STATUS_NOT_IMPLEMENTED;
-     }
+        Status = STATUS_NOT_IMPLEMENTED;
+    }
 
-   Irp->IoStatus.Status = Status;
-   Irp->IoStatus.Information = 0;
-   IoCompleteRequest(Irp,
-                    IO_NO_INCREMENT);
+    Irp->IoStatus.Status = Status;
+    Irp->IoStatus.Information = 0;
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-   return(Status);
+    return Status;
 }
 
 /* EOF */
index deaf44f..9e3cb45 100644 (file)
@@ -2,9 +2,9 @@
  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/ms/fsctrl.c
+ * FILE:       drivers/filesystems/ms/fsctrl.c
  * PURPOSE:    Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
+ * PROGRAMMER: Eric Kohl
  */
 
 /* INCLUDES ******************************************************************/
 
 NTSTATUS DEFAULTAPI
 MsfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
-                     PIRP Irp)
+                      PIRP Irp)
 {
-   PIO_STACK_LOCATION IoStack;
-   PFILE_OBJECT FileObject;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   NTSTATUS Status;
+    PIO_STACK_LOCATION IoStack;
+    PFILE_OBJECT FileObject;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    NTSTATUS Status;
 
-   DPRINT1("MsfsFileSystemControl(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+    DPRINT1("MsfsFileSystemControl(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
 
-   IoStack = IoGetCurrentIrpStackLocation(Irp);
-   FileObject = IoStack->FileObject;
-   Fcb = FileObject->FsContext;
-   Ccb = FileObject->FsContext2;
+    IoStack = IoGetCurrentIrpStackLocation(Irp);
+    FileObject = IoStack->FileObject;
+    Fcb = FileObject->FsContext;
+    Ccb = FileObject->FsContext2;
 
-   DPRINT1("Mailslot name: %wZ\n", &Fcb->Name);
+    DPRINT1("Mailslot name: %wZ\n", &Fcb->Name);
 
-   switch (IoStack->Parameters.FileSystemControl.FsControlCode)
-     {
+    switch (IoStack->Parameters.FileSystemControl.FsControlCode)
+    {
 #if 0
-      case FSCTL_WAIT_PIPE:
-       break;
-
-      case FSCTL_LISTEN:
-       break;
-
-      case FSCTL_SET_STATE:
-       break;
-
-      case FSCTL_GET_STATE:
-         {
-
-
-            break;
-         }
 
 #endif
-     default:
-       Status = STATUS_NOT_IMPLEMENTED;
-     }
+    default:
+        Status = STATUS_NOT_IMPLEMENTED;
+    }
 
-   Irp->IoStatus.Status = Status;
-   Irp->IoStatus.Information = 0;
-   IoCompleteRequest (Irp, IO_NO_INCREMENT);
+    Irp->IoStatus.Status = Status;
+    Irp->IoStatus.Information = 0;
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-   return(Status);
+    return Status;
 }
 
 /* EOF */
index 87ff4a7..2ebb4ba 100644 (file)
@@ -4,7 +4,7 @@
  * PROJECT:    ReactOS kernel
  * FILE:       services/fs/ms/msfs.c
  * PURPOSE:    Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
+ * PROGRAMMER: Eric Kohl
  */
 
 /* INCLUDES ******************************************************************/
 
 NTSTATUS NTAPI
 DriverEntry(PDRIVER_OBJECT DriverObject,
-           PUNICODE_STRING RegistryPath)
+            PUNICODE_STRING RegistryPath)
 {
-   PMSFS_DEVICE_EXTENSION DeviceExtension;
-   PDEVICE_OBJECT DeviceObject;
-   UNICODE_STRING DeviceName;
-   NTSTATUS Status;
+    PMSFS_DEVICE_EXTENSION DeviceExtension;
+    PDEVICE_OBJECT DeviceObject;
+    UNICODE_STRING DeviceName;
+    NTSTATUS Status;
 
-   DPRINT("Mailslot FSD 0.0.1\n");
+    DPRINT("Mailslot FSD 0.0.1\n");
 
-   DriverObject->Flags = 0;
-   DriverObject->MajorFunction[IRP_MJ_CREATE] = MsfsCreate;
-   DriverObject->MajorFunction[IRP_MJ_CREATE_MAILSLOT] =
-     MsfsCreateMailslot;
-   DriverObject->MajorFunction[IRP_MJ_CLOSE] = MsfsClose;
-   DriverObject->MajorFunction[IRP_MJ_READ] = MsfsRead;
-   DriverObject->MajorFunction[IRP_MJ_WRITE] = MsfsWrite;
-   DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
-     MsfsQueryInformation;
-   DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
-     MsfsSetInformation;
-//   DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
-//     MsfsDirectoryControl;
-//   DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = MsfsFlushBuffers;
-//   DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = MsfsShutdown;
-//   DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] =
-//     MsfsQuerySecurity;
-//   DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
-//     MsfsSetSecurity;
-   DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
-     MsfsFileSystemControl;
+    DriverObject->Flags = 0;
+    DriverObject->MajorFunction[IRP_MJ_CREATE] = MsfsCreate;
+    DriverObject->MajorFunction[IRP_MJ_CREATE_MAILSLOT] =
+        MsfsCreateMailslot;
+    DriverObject->MajorFunction[IRP_MJ_CLOSE] = MsfsClose;
+    DriverObject->MajorFunction[IRP_MJ_READ] = MsfsRead;
+    DriverObject->MajorFunction[IRP_MJ_WRITE] = MsfsWrite;
+    DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
+        MsfsQueryInformation;
+    DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
+        MsfsSetInformation;
+//    DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
+//        MsfsDirectoryControl;
+//    DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = MsfsFlushBuffers;
+//    DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = MsfsShutdown;
+//    DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] =
+//        MsfsQuerySecurity;
+//    DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] =
+//        MsfsSetSecurity;
+    DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
+        MsfsFileSystemControl;
 
-   DriverObject->DriverUnload = NULL;
+    DriverObject->DriverUnload = NULL;
 
-   RtlInitUnicodeString(&DeviceName,
-                       L"\\Device\\MailSlot");
-   Status = IoCreateDevice(DriverObject,
-                          sizeof(MSFS_DEVICE_EXTENSION),
-                          &DeviceName,
-                          FILE_DEVICE_MAILSLOT,
-                          0,
-                          FALSE,
-                          &DeviceObject);
-   if (!NT_SUCCESS(Status))
-     {
-       return(Status);
-     }
+    RtlInitUnicodeString(&DeviceName,
+                         L"\\Device\\MailSlot");
+    Status = IoCreateDevice(DriverObject,
+                            sizeof(MSFS_DEVICE_EXTENSION),
+                            &DeviceName,
+                            FILE_DEVICE_MAILSLOT,
+                            0,
+                            FALSE,
+                            &DeviceObject);
+    if (!NT_SUCCESS(Status))
+    {
+        return Status;
+    }
 
-   /* initialize the device object */
-   DeviceObject->Flags = DO_DIRECT_IO;
+    /* initialize the device object */
+    DeviceObject->Flags = DO_DIRECT_IO;
 
-   /* initialize device extension */
-   DeviceExtension = DeviceObject->DeviceExtension;
-   InitializeListHead(&DeviceExtension->FcbListHead);
-   KeInitializeMutex(&DeviceExtension->FcbListLock,
-                    0);
+    /* initialize device extension */
+    DeviceExtension = DeviceObject->DeviceExtension;
+    InitializeListHead(&DeviceExtension->FcbListHead);
+    KeInitializeMutex(&DeviceExtension->FcbListLock,
+                      0);
 
-   return(STATUS_SUCCESS);
+    return STATUS_SUCCESS;
 }
 
 /* EOF */
index 4ba9ba2..a9776f0 100644 (file)
@@ -1,5 +1,13 @@
-#ifndef __SERVICES_FS_MS_MSFS_H
-#define __SERVICES_FS_MS_MSFS_H
+/*
+ * COPYRIGHT:  See COPYING in the top level directory
+ * PROJECT:    ReactOS kernel
+ * FILE:       services/fs/ms/msfs.h
+ * PURPOSE:    Mailslot filesystem
+ * PROGRAMMER: Eric Kohl
+ */
+
+#ifndef __DRIVERS_FS_MS_MSFS_H
+#define __DRIVERS_FS_MS_MSFS_H
 
 #include <ntifs.h>
 #include <ndk/ntndk.h>
 
 typedef struct _MSFS_DEVICE_EXTENSION
 {
-   LIST_ENTRY FcbListHead;
-   KMUTEX FcbListLock;
+    LIST_ENTRY FcbListHead;
+    KMUTEX FcbListLock;
 } MSFS_DEVICE_EXTENSION, *PMSFS_DEVICE_EXTENSION;
 
+
 typedef struct _MSFS_FCB
 {
-   UNICODE_STRING Name;
-   LIST_ENTRY FcbListEntry;
-   KSPIN_LOCK CcbListLock;
-   LIST_ENTRY CcbListHead;
-   struct _MSFS_CCB *ServerCcb;
-   ULONG ReferenceCount;
-   LARGE_INTEGER TimeOut;
-   KEVENT MessageEvent;
-   ULONG MaxMessageSize;
-   ULONG MessageCount;
-   KSPIN_LOCK MessageListLock;
-   LIST_ENTRY MessageListHead;
+    UNICODE_STRING Name;
+    LIST_ENTRY FcbListEntry;
+    KSPIN_LOCK CcbListLock;
+    LIST_ENTRY CcbListHead;
+    struct _MSFS_CCB *ServerCcb;
+    ULONG ReferenceCount;
+    LARGE_INTEGER TimeOut;
+    KEVENT MessageEvent;
+    ULONG MaxMessageSize;
+    ULONG MessageCount;
+    KSPIN_LOCK MessageListLock;
+    LIST_ENTRY MessageListHead;
 } MSFS_FCB, *PMSFS_FCB;
 
+
 typedef struct _MSFS_CCB
 {
-   LIST_ENTRY CcbListEntry;
-   PMSFS_FCB Fcb;
+    LIST_ENTRY CcbListEntry;
+    PMSFS_FCB Fcb;
 } MSFS_CCB, *PMSFS_CCB;
 
+
 typedef struct _MSFS_MESSAGE
 {
-   LIST_ENTRY MessageListEntry;
-   ULONG Size;
-   UCHAR Buffer[1];
+    LIST_ENTRY MessageListEntry;
+    ULONG Size;
+    UCHAR Buffer[1];
 } MSFS_MESSAGE, *PMSFS_MESSAGE;
 
 
@@ -78,6 +89,6 @@ NTSTATUS DEFAULTAPI MsfsFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
 NTSTATUS NTAPI
 DriverEntry(PDRIVER_OBJECT DriverObject,
-           PUNICODE_STRING RegistryPath);
+            PUNICODE_STRING RegistryPath);
 
-#endif /* __SERVICES_FS_NP_NPFS_H */
+#endif /* __DRIVERS_FS_MS_MSFS_H */
index 24edd00..790fa9a 100644 (file)
@@ -1,6 +1,6 @@
 <module name="msfs" type="kernelmodedriver" installbase="system32/drivers" installname="msfs.sys">
        <include base="msfs">.</include>
-        <define name="__USE_W32API" />
+       <define name="__USE_W32API" />
        <library>ntoskrnl</library>
        <library>hal</library>
        <file>create.c</file>
index 606d716..555876d 100644 (file)
@@ -2,9 +2,9 @@
  *
  * COPYRIGHT:  See COPYING in the top level directory
  * PROJECT:    ReactOS kernel
- * FILE:       services/fs/ms/rw.c
+ * FILE:       drivers/filesystems/ms/rw.c
  * PURPOSE:    Mailslot filesystem
- * PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
+ * PROGRAMMER: Eric Kohl
  */
 
 /* INCLUDES ******************************************************************/
 
 NTSTATUS DEFAULTAPI
 MsfsRead(PDEVICE_OBJECT DeviceObject,
-        PIRP Irp)
+         PIRP Irp)
 {
-   PIO_STACK_LOCATION IoStack;
-   PFILE_OBJECT FileObject;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   PMSFS_MESSAGE Message;
-   KIRQL oldIrql;
-   ULONG Length;
-   ULONG LengthRead = 0;
-   PVOID Buffer;
-   NTSTATUS Status;
-
-   DPRINT("MsfsRead(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
-
-   IoStack = IoGetCurrentIrpStackLocation (Irp);
-   FileObject = IoStack->FileObject;
-   Fcb = (PMSFS_FCB)FileObject->FsContext;
-   Ccb = (PMSFS_CCB)FileObject->FsContext2;
-
-   DPRINT("MailslotName: %wZ\n", &Fcb->Name);
-
-   /* reading is not permitted on client side */
-   if (Fcb->ServerCcb != Ccb)
-     {
-       Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
-       Irp->IoStatus.Information = 0;
-
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-       return(STATUS_ACCESS_DENIED);
+    PIO_STACK_LOCATION IoStack;
+    PFILE_OBJECT FileObject;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    PMSFS_MESSAGE Message;
+    KIRQL oldIrql;
+    ULONG Length;
+    ULONG LengthRead = 0;
+    PVOID Buffer;
+    NTSTATUS Status;
+
+    DPRINT("MsfsRead(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+
+    IoStack = IoGetCurrentIrpStackLocation (Irp);
+    FileObject = IoStack->FileObject;
+    Fcb = (PMSFS_FCB)FileObject->FsContext;
+    Ccb = (PMSFS_CCB)FileObject->FsContext2;
+
+    DPRINT("MailslotName: %wZ\n", &Fcb->Name);
+
+    /* reading is not permitted on client side */
+    if (Fcb->ServerCcb != Ccb)
+    {
+        Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
+        Irp->IoStatus.Information = 0;
+
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+        return STATUS_ACCESS_DENIED;
+    }
+
+    Length = IoStack->Parameters.Read.Length;
+    if (Irp->MdlAddress)
+        Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
+    else
+        Buffer = Irp->UserBuffer;
+
+    Status = KeWaitForSingleObject(&Fcb->MessageEvent,
+                                   UserRequest,
+                                   KernelMode,
+                                   FALSE,
+                                   NULL); /* FIXME: handle timeout */
+    if ((NT_SUCCESS(Status)) && (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;
+
+        KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+        RemoveHeadList(&Fcb->MessageListHead);
+        KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+
+        ExFreePool(Message);
+        Fcb->MessageCount--;
+        if (Fcb->MessageCount == 0)
+        {
+            KeClearEvent(&Fcb->MessageEvent);
+        }
      }
 
-   Length = IoStack->Parameters.Read.Length;
-   if (Irp->MdlAddress)
-     Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
-   else
-     Buffer = Irp->UserBuffer;
-
-   Status = KeWaitForSingleObject(&Fcb->MessageEvent,
-                                 UserRequest,
-                                 KernelMode,
-                                 FALSE,
-                                 NULL); /* FIXME: handle timeout */
-   if ((NT_SUCCESS(Status)) && (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;
-
-       KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
-       RemoveHeadList(&Fcb->MessageListHead);
-       KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
-
-       ExFreePool(Message);
-       Fcb->MessageCount--;
-       if (Fcb->MessageCount == 0)
-         {
-            KeClearEvent(&Fcb->MessageEvent);
-         }
-     }
-
-   Irp->IoStatus.Status = Status;
-   Irp->IoStatus.Information = LengthRead;
+    Irp->IoStatus.Status = Status;
+    Irp->IoStatus.Information = LengthRead;
 
-   IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-   return(Status);
+    return Status;
 }
 
 
 NTSTATUS DEFAULTAPI
 MsfsWrite(PDEVICE_OBJECT DeviceObject,
-         PIRP Irp)
+          PIRP Irp)
 {
-   PIO_STACK_LOCATION IoStack;
-   PFILE_OBJECT FileObject;
-   PMSFS_FCB Fcb;
-   PMSFS_CCB Ccb;
-   PMSFS_MESSAGE Message;
-   KIRQL oldIrql;
-   ULONG Length;
-   PVOID Buffer;
+    PIO_STACK_LOCATION IoStack;
+    PFILE_OBJECT FileObject;
+    PMSFS_FCB Fcb;
+    PMSFS_CCB Ccb;
+    PMSFS_MESSAGE Message;
+    KIRQL oldIrql;
+    ULONG Length;
+    PVOID Buffer;
 
-   DPRINT("MsfsWrite(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
+    DPRINT("MsfsWrite(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
 
-   IoStack = IoGetCurrentIrpStackLocation (Irp);
-   FileObject = IoStack->FileObject;
-   Fcb = (PMSFS_FCB)FileObject->FsContext;
-   Ccb = (PMSFS_CCB)FileObject->FsContext2;
+    IoStack = IoGetCurrentIrpStackLocation (Irp);
+    FileObject = IoStack->FileObject;
+    Fcb = (PMSFS_FCB)FileObject->FsContext;
+    Ccb = (PMSFS_CCB)FileObject->FsContext2;
 
-   DPRINT("MailslotName: %wZ\n", &Fcb->Name);
+    DPRINT("MailslotName: %wZ\n", &Fcb->Name);
 
-   /* writing is not permitted on server side */
-   if (Fcb->ServerCcb == Ccb)
-     {
-       Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
-       Irp->IoStatus.Information = 0;
+    /* writing is not permitted on server side */
+    if (Fcb->ServerCcb == Ccb)
+    {
+        Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
+        Irp->IoStatus.Information = 0;
 
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-       return(STATUS_ACCESS_DENIED);
-     }
+        return STATUS_ACCESS_DENIED;
+    }
 
-   Length = IoStack->Parameters.Write.Length;
-   if (Irp->MdlAddress)
-     Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
-   else
-     Buffer = Irp->UserBuffer;
+    Length = IoStack->Parameters.Write.Length;
+    if (Irp->MdlAddress)
+        Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
+    else
+        Buffer = Irp->UserBuffer;
 
-   DPRINT("Length: %lu Message: %s\n", Length, (PUCHAR)Buffer);
+    DPRINT("Length: %lu Message: %s\n", Length, (PUCHAR)Buffer);
 
-   /* Allocate new message */
-   Message = ExAllocatePool(NonPagedPool,
-                           sizeof(MSFS_MESSAGE) + Length);
-   if (Message == NULL)
-     {
-       Irp->IoStatus.Status = STATUS_NO_MEMORY;
-       Irp->IoStatus.Information = 0;
+    /* Allocate new message */
+    Message = ExAllocatePool(NonPagedPool,
+                             sizeof(MSFS_MESSAGE) + Length);
+    if (Message == NULL)
+    {
+        Irp->IoStatus.Status = STATUS_NO_MEMORY;
+        Irp->IoStatus.Information = 0;
 
-       IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-       return(STATUS_NO_MEMORY);
-     }
+        return STATUS_NO_MEMORY;
+    }
 
-   Message->Size = Length;
-   memcpy(&Message->Buffer, Buffer, Length);
+    Message->Size = Length;
+    memcpy(&Message->Buffer, Buffer, Length);
 
-   KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
-   InsertTailList(&Fcb->MessageListHead, &Message->MessageListEntry);
-   KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+    KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+    InsertTailList(&Fcb->MessageListHead, &Message->MessageListEntry);
+    KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
 
-   Fcb->MessageCount++;
-   if (Fcb->MessageCount == 1)
-     {
-       KeSetEvent(&Fcb->MessageEvent,
-                  0,
-                  FALSE);
-     }
+    Fcb->MessageCount++;
+    if (Fcb->MessageCount == 1)
+    {
+        KeSetEvent(&Fcb->MessageEvent,
+                   0,
+                   FALSE);
+    }
 
-   Irp->IoStatus.Status = STATUS_SUCCESS;
-   Irp->IoStatus.Information = Length;
+    Irp->IoStatus.Status = STATUS_SUCCESS;
+    Irp->IoStatus.Information = Length;
 
-   IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
 
-   return(STATUS_SUCCESS);
+    return STATUS_SUCCESS;
 }
 
 /* EOF */