Author: ekohl
Date: Sun May 7 00:04:30 2006
New Revision: 21815
URL:
http://svn.reactos.ru/svn/reactos?rev=21815&view=rev
Log:
The MSFS_MAILSLOT struct is actually an FCB (File Control Block). Rename it accordingly
and store pointers to it in FileObject->FsContext.
Modified:
trunk/reactos/drivers/filesystems/ms/create.c
trunk/reactos/drivers/filesystems/ms/finfo.c
trunk/reactos/drivers/filesystems/ms/fsctrl.c
trunk/reactos/drivers/filesystems/ms/msfs.c
trunk/reactos/drivers/filesystems/ms/msfs.h
trunk/reactos/drivers/filesystems/ms/rw.c
Modified: trunk/reactos/drivers/filesystems/ms/create.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/crea…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/create.c (original)
+++ trunk/reactos/drivers/filesystems/ms/create.c Sun May 7 00:04:30 2006
@@ -24,9 +24,9 @@
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
PMSFS_DEVICE_EXTENSION DeviceExtension;
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
- PMSFS_MAILSLOT current = NULL;
+ PMSFS_FCB current = NULL;
PLIST_ENTRY current_entry;
KIRQL oldIrql;
@@ -49,13 +49,13 @@
return(STATUS_NO_MEMORY);
}
- KeLockMutex(&DeviceExtension->MailslotListLock);
- current_entry = DeviceExtension->MailslotListHead.Flink;
- while (current_entry != &DeviceExtension->MailslotListHead)
+ KeLockMutex(&DeviceExtension->FcbListLock);
+ current_entry = DeviceExtension->FcbListHead.Flink;
+ while (current_entry != &DeviceExtension->FcbListHead)
{
current = CONTAINING_RECORD(current_entry,
- MSFS_MAILSLOT,
- MailslotListEntry);
+ MSFS_FCB,
+ FcbListEntry);
if (!RtlCompareUnicodeString(&FileObject->FileName, ¤t->Name,
TRUE))
{
@@ -65,10 +65,10 @@
current_entry = current_entry->Flink;
}
- if (current_entry == &DeviceExtension->MailslotListHead)
+ if (current_entry == &DeviceExtension->FcbListHead)
{
ExFreePool(Ccb);
- KeUnlockMutex(&DeviceExtension->MailslotListLock);
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
Irp->IoStatus.Information = 0;
@@ -78,18 +78,20 @@
return(STATUS_UNSUCCESSFUL);
}
- Mailslot = current;
-
- KeAcquireSpinLock(&Mailslot->CcbListLock, &oldIrql);
- InsertTailList(&Mailslot->CcbListHead, &Ccb->CcbListEntry);
- KeReleaseSpinLock(&Mailslot->CcbListLock, oldIrql);
-
- Mailslot->ReferenceCount++;
-
- Ccb->Mailslot = Mailslot;
-
- KeUnlockMutex(&DeviceExtension->MailslotListLock);
-
+ Fcb = current;
+ DPRINT1("Fcb: %p\n", Fcb);
+
+ KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
+ InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);
+ KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
+
+ Fcb->ReferenceCount++;
+
+ Ccb->Fcb = Fcb;
+
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
+
+ FileObject->FsContext = Fcb;
FileObject->FsContext2 = Ccb;
FileObject->Flags |= FO_MAILSLOT;
@@ -109,11 +111,11 @@
PEXTENDED_IO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
PMSFS_DEVICE_EXTENSION DeviceExtension;
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
KIRQL oldIrql;
PLIST_ENTRY current_entry;
- PMSFS_MAILSLOT current;
+ PMSFS_FCB current;
PMAILSLOT_CREATE_PARAMETERS Buffer;
DPRINT("MsfsCreateMailslot(DeviceObject %p Irp %p)\n", DeviceObject, Irp);
@@ -125,8 +127,8 @@
DPRINT("Mailslot name: %wZ\n", &FileObject->FileName);
- Mailslot = ExAllocatePool(NonPagedPool, sizeof(MSFS_MAILSLOT));
- if (Mailslot == NULL)
+ Fcb = ExAllocatePool(NonPagedPool, sizeof(MSFS_FCB));
+ if (Fcb == NULL)
{
Irp->IoStatus.Status = STATUS_NO_MEMORY;
Irp->IoStatus.Information = 0;
@@ -136,12 +138,12 @@
return(STATUS_NO_MEMORY);
}
- Mailslot->Name.Length = FileObject->FileName.Length;
- Mailslot->Name.MaximumLength = Mailslot->Name.Length + sizeof(UNICODE_NULL);
- Mailslot->Name.Buffer = ExAllocatePool(NonPagedPool,
Mailslot->Name.MaximumLength);
- if (Mailslot->Name.Buffer == NULL)
- {
- ExFreePool(Mailslot);
+ 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;
@@ -151,12 +153,13 @@
return(STATUS_NO_MEMORY);
}
- RtlCopyUnicodeString(&Mailslot->Name, &FileObject->FileName);
+ RtlCopyUnicodeString(&Fcb->Name, &FileObject->FileName);
Ccb = ExAllocatePool(NonPagedPool, sizeof(MSFS_CCB));
if (Ccb == NULL)
{
- ExFreePool(Mailslot);
+ ExFreePool(Fcb->Name.Buffer);
+ ExFreePool(Fcb);
Irp->IoStatus.Status = STATUS_NO_MEMORY;
Irp->IoStatus.Information = 0;
@@ -166,29 +169,29 @@
return(STATUS_NO_MEMORY);
}
- Mailslot->ReferenceCount = 0;
- InitializeListHead(&Mailslot->CcbListHead);
- KeInitializeSpinLock(&Mailslot->CcbListLock);
-
- Mailslot->MaxMessageSize = Buffer->MaximumMessageSize;
- Mailslot->MessageCount = 0;
- Mailslot->TimeOut = Buffer->ReadTimeout;
- KeInitializeEvent(&Mailslot->MessageEvent,
+ 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(&Mailslot->MessageListHead);
- KeInitializeSpinLock(&Mailslot->MessageListLock);
-
- KeLockMutex(&DeviceExtension->MailslotListLock);
- current_entry = DeviceExtension->MailslotListHead.Flink;
- while (current_entry != &DeviceExtension->MailslotListHead)
+ 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_MAILSLOT,
- MailslotListEntry);
-
- if (!RtlCompareUnicodeString(&Mailslot->Name, ¤t->Name, TRUE))
+ MSFS_FCB,
+ FcbListEntry);
+
+ if (!RtlCompareUnicodeString(&Fcb->Name, ¤t->Name, TRUE))
{
break;
}
@@ -196,29 +199,30 @@
current_entry = current_entry->Flink;
}
- if (current_entry != &DeviceExtension->MailslotListHead)
- {
- RtlFreeUnicodeString(&Mailslot->Name);
- ExFreePool(Mailslot);
-
- Mailslot = current;
+ if (current_entry != &DeviceExtension->FcbListHead)
+ {
+ ExFreePool(Fcb->Name.Buffer);
+ ExFreePool(Fcb);
+
+ Fcb = current;
}
else
{
- InsertTailList(&DeviceExtension->MailslotListHead,
- &Mailslot->MailslotListEntry);
- }
-
- KeAcquireSpinLock(&Mailslot->CcbListLock, &oldIrql);
- InsertTailList(&Mailslot->CcbListHead, &Ccb->CcbListEntry);
- KeReleaseSpinLock(&Mailslot->CcbListLock, oldIrql);
-
- Mailslot->ReferenceCount++;
- Mailslot->ServerCcb = Ccb;
- Ccb->Mailslot = Mailslot;
-
- KeUnlockMutex(&DeviceExtension->MailslotListLock);
-
+ 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;
@@ -238,7 +242,7 @@
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
PMSFS_DEVICE_EXTENSION DeviceExtension;
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
PMSFS_MESSAGE Message;
KIRQL oldIrql;
@@ -249,11 +253,11 @@
DeviceExtension = DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject;
- KeLockMutex(&DeviceExtension->MailslotListLock);
-
- if (DeviceExtension->MailslotListHead.Flink ==
&DeviceExtension->MailslotListHead)
- {
- KeUnlockMutex(&DeviceExtension->MailslotListLock);
+ KeLockMutex(&DeviceExtension->FcbListLock);
+
+ if (DeviceExtension->FcbListHead.Flink == &DeviceExtension->FcbListHead)
+ {
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
@@ -263,46 +267,46 @@
return(STATUS_SUCCESS);
}
+ Fcb = FileObject->FsContext;
Ccb = FileObject->FsContext2;
- Mailslot = Ccb->Mailslot;
-
- DPRINT("Mailslot name: %wZ\n", &Mailslot->Name);
-
- Mailslot->ReferenceCount--;
- if (Mailslot->ServerCcb == Ccb)
+
+ DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
+
+ Fcb->ReferenceCount--;
+ if (Fcb->ServerCcb == Ccb)
{
/* delete all messages from message-list */
- KeAcquireSpinLock(&Mailslot->MessageListLock, &oldIrql);
-
- while (Mailslot->MessageListHead.Flink != &Mailslot->MessageListHead)
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+
+ while (Fcb->MessageListHead.Flink != &Fcb->MessageListHead)
{
- Message = CONTAINING_RECORD(Mailslot->MessageListHead.Flink,
+ Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
MSFS_MESSAGE,
MessageListEntry);
- RemoveEntryList(Mailslot->MessageListHead.Flink);
+ RemoveEntryList(Fcb->MessageListHead.Flink);
ExFreePool(Message);
}
- Mailslot->MessageCount = 0;
-
- KeReleaseSpinLock(&Mailslot->MessageListLock, oldIrql);
- Mailslot->ServerCcb = NULL;
- }
-
- KeAcquireSpinLock(&Mailslot->CcbListLock, &oldIrql);
+ Fcb->MessageCount = 0;
+
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
+ Fcb->ServerCcb = NULL;
+ }
+
+ KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
RemoveEntryList(&Ccb->CcbListEntry);
- KeReleaseSpinLock(&Mailslot->CcbListLock, oldIrql);
+ KeReleaseSpinLock(&Fcb->CcbListLock, oldIrql);
ExFreePool(Ccb);
FileObject->FsContext2 = NULL;
- if (Mailslot->ReferenceCount == 0)
+ if (Fcb->ReferenceCount == 0)
{
DPRINT1("ReferenceCount == 0: Deleting mailslot data\n");
- RtlFreeUnicodeString(&Mailslot->Name);
- RemoveEntryList(&Mailslot->MailslotListEntry);
- ExFreePool(Mailslot);
- }
-
- KeUnlockMutex(&DeviceExtension->MailslotListLock);
+ RemoveEntryList(&Fcb->FcbListEntry);
+ ExFreePool(Fcb->Name.Buffer);
+ ExFreePool(Fcb);
+ }
+
+ KeUnlockMutex(&DeviceExtension->FcbListLock);
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
Modified: trunk/reactos/drivers/filesystems/ms/finfo.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/finf…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/finfo.c (original)
+++ trunk/reactos/drivers/filesystems/ms/finfo.c Sun May 7 00:04:30 2006
@@ -22,20 +22,20 @@
PFILE_MAILSLOT_QUERY_INFORMATION Buffer,
PULONG BufferLength)
{
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
KIRQL oldIrql;
if (*BufferLength < sizeof(FILE_MAILSLOT_QUERY_INFORMATION))
return(STATUS_BUFFER_OVERFLOW);
- Mailslot = Ccb->Mailslot;
+ Fcb = Ccb->Fcb;
- Buffer->MaximumMessageSize = Mailslot->MaxMessageSize;
- Buffer->ReadTimeout = Mailslot->TimeOut;
+ Buffer->MaximumMessageSize = Fcb->MaxMessageSize;
+ Buffer->ReadTimeout = Fcb->TimeOut;
- KeAcquireSpinLock(&Mailslot->MessageListLock, &oldIrql);
- Buffer->MessagesAvailable = Mailslot->MessageCount;
- if (Mailslot->MessageCount == 0)
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+ Buffer->MessagesAvailable = Fcb->MessageCount;
+ if (Fcb->MessageCount == 0)
{
Buffer->NextMessageSize = MAILSLOT_NO_MESSAGE;
}
@@ -44,7 +44,7 @@
/* FIXME: read size of first message (head) */
Buffer->NextMessageSize = 0;
}
- KeReleaseSpinLock(&Mailslot->MessageListLock, oldIrql);
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
*BufferLength -= sizeof(FILE_MAILSLOT_QUERY_INFORMATION);
@@ -60,7 +60,7 @@
if (*BufferLength < sizeof(FILE_MAILSLOT_SET_INFORMATION))
return(STATUS_BUFFER_OVERFLOW);
- Ccb->Mailslot->TimeOut = *Buffer->ReadTimeout;
+ Ccb->Fcb->TimeOut = *Buffer->ReadTimeout;
return(STATUS_SUCCESS);
}
@@ -74,8 +74,8 @@
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_OBJECT FileObject;
PMSFS_DEVICE_EXTENSION DeviceExtension;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
- PMSFS_MAILSLOT Mailslot;
PVOID SystemBuffer;
ULONG BufferLength;
NTSTATUS Status;
@@ -87,12 +87,12 @@
DeviceExtension = DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject;
Ccb = (PMSFS_CCB)FileObject->FsContext2;
- Mailslot = Ccb->Mailslot;
+ Fcb = Ccb->Fcb;
- DPRINT("Mailslot name: %wZ\n", &Mailslot->Name);
+ DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
/* querying information is not permitted on client side */
- if (Ccb->Mailslot->ServerCcb != Ccb)
+ if (Ccb->Fcb->ServerCcb != Ccb)
{
Status = STATUS_ACCESS_DENIED;
@@ -139,8 +139,8 @@
PIO_STACK_LOCATION IoStack;
FILE_INFORMATION_CLASS FileInformationClass;
PFILE_OBJECT FileObject;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
- PMSFS_MAILSLOT Mailslot;
PVOID SystemBuffer;
ULONG BufferLength;
NTSTATUS Status;
@@ -151,12 +151,12 @@
FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
FileObject = IoStack->FileObject;
Ccb = (PMSFS_CCB)FileObject->FsContext2;
- Mailslot = Ccb->Mailslot;
+ Fcb = Ccb->Fcb;
- DPRINT("Mailslot name: %wZ\n", &Mailslot->Name);
+ DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
/* setting information is not permitted on client side */
- if (Ccb->Mailslot->ServerCcb != Ccb)
+ if (Ccb->Fcb->ServerCcb != Ccb)
{
Status = STATUS_ACCESS_DENIED;
Modified: trunk/reactos/drivers/filesystems/ms/fsctrl.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/fsct…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/fsctrl.c (original)
+++ trunk/reactos/drivers/filesystems/ms/fsctrl.c Sun May 7 00:04:30 2006
@@ -23,7 +23,7 @@
{
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
NTSTATUS Status;
@@ -32,9 +32,9 @@
IoStack = IoGetCurrentIrpStackLocation(Irp);
FileObject = IoStack->FileObject;
Ccb = FileObject->FsContext2;
- Mailslot = Ccb->Mailslot;
+ Fcb = Ccb->Fcb;
- DPRINT1("Mailslot name: %wZ\n", &Mailslot->Name);
+ DPRINT1("Mailslot name: %wZ\n", &Fcb->Name);
switch (IoStack->Parameters.FileSystemControl.FsControlCode)
{
Modified: trunk/reactos/drivers/filesystems/ms/msfs.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/msfs…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/msfs.c (original)
+++ trunk/reactos/drivers/filesystems/ms/msfs.c Sun May 7 00:04:30 2006
@@ -71,8 +71,8 @@
/* initialize device extension */
DeviceExtension = DeviceObject->DeviceExtension;
- InitializeListHead(&DeviceExtension->MailslotListHead);
- KeInitializeMutex(&DeviceExtension->MailslotListLock,
+ InitializeListHead(&DeviceExtension->FcbListHead);
+ KeInitializeMutex(&DeviceExtension->FcbListLock,
0);
return(STATUS_SUCCESS);
Modified: trunk/reactos/drivers/filesystems/ms/msfs.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/msfs…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/msfs.h (original)
+++ trunk/reactos/drivers/filesystems/ms/msfs.h Sun May 7 00:04:30 2006
@@ -22,14 +22,14 @@
typedef struct _MSFS_DEVICE_EXTENSION
{
- LIST_ENTRY MailslotListHead;
- KMUTEX MailslotListLock;
+ LIST_ENTRY FcbListHead;
+ KMUTEX FcbListLock;
} MSFS_DEVICE_EXTENSION, *PMSFS_DEVICE_EXTENSION;
-typedef struct _MSFS_MAILSLOT
+typedef struct _MSFS_FCB
{
UNICODE_STRING Name;
- LIST_ENTRY MailslotListEntry;
+ LIST_ENTRY FcbListEntry;
KSPIN_LOCK CcbListLock;
LIST_ENTRY CcbListHead;
struct _MSFS_CCB *ServerCcb;
@@ -40,12 +40,12 @@
ULONG MessageCount;
KSPIN_LOCK MessageListLock;
LIST_ENTRY MessageListHead;
-} MSFS_MAILSLOT, *PMSFS_MAILSLOT;
+} MSFS_FCB, *PMSFS_FCB;
typedef struct _MSFS_CCB
{
LIST_ENTRY CcbListEntry;
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
} MSFS_CCB, *PMSFS_CCB;
typedef struct _MSFS_MESSAGE
Modified: trunk/reactos/drivers/filesystems/ms/rw.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/ms/rw.c…
==============================================================================
--- trunk/reactos/drivers/filesystems/ms/rw.c (original)
+++ trunk/reactos/drivers/filesystems/ms/rw.c Sun May 7 00:04:30 2006
@@ -23,7 +23,7 @@
{
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
PMSFS_MESSAGE Message;
KIRQL oldIrql;
@@ -36,13 +36,13 @@
IoStack = IoGetCurrentIrpStackLocation (Irp);
FileObject = IoStack->FileObject;
+ Fcb = (PMSFS_FCB)FileObject->FsContext;
Ccb = (PMSFS_CCB)FileObject->FsContext2;
- Mailslot = Ccb->Mailslot;
- DPRINT("MailslotName: %wZ\n", &Mailslot->Name);
+ DPRINT("MailslotName: %wZ\n", &Fcb->Name);
/* reading is not permitted on client side */
- if (Ccb->Mailslot->ServerCcb != Ccb)
+ if (Fcb->ServerCcb != Ccb)
{
Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
Irp->IoStatus.Information = 0;
@@ -58,29 +58,29 @@
else
Buffer = Irp->UserBuffer;
- Status = KeWaitForSingleObject(&Mailslot->MessageEvent,
+ Status = KeWaitForSingleObject(&Fcb->MessageEvent,
UserRequest,
KernelMode,
FALSE,
NULL); /* FIXME: handle timeout */
- if ((NT_SUCCESS(Status)) && (Mailslot->MessageCount > 0))
+ if ((NT_SUCCESS(Status)) && (Fcb->MessageCount > 0))
{
/* copy current message into buffer */
- Message = CONTAINING_RECORD(Mailslot->MessageListHead.Flink,
+ Message = CONTAINING_RECORD(Fcb->MessageListHead.Flink,
MSFS_MESSAGE,
MessageListEntry);
memcpy(Buffer, &Message->Buffer, min(Message->Size,Length));
LengthRead = Message->Size;
- KeAcquireSpinLock(&Mailslot->MessageListLock, &oldIrql);
- RemoveHeadList(&Mailslot->MessageListHead);
- KeReleaseSpinLock(&Mailslot->MessageListLock, oldIrql);
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+ RemoveHeadList(&Fcb->MessageListHead);
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
ExFreePool(Message);
- Mailslot->MessageCount--;
- if (Mailslot->MessageCount == 0)
+ Fcb->MessageCount--;
+ if (Fcb->MessageCount == 0)
{
- KeClearEvent(&Mailslot->MessageEvent);
+ KeClearEvent(&Fcb->MessageEvent);
}
}
@@ -99,7 +99,7 @@
{
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
- PMSFS_MAILSLOT Mailslot;
+ PMSFS_FCB Fcb;
PMSFS_CCB Ccb;
PMSFS_MESSAGE Message;
KIRQL oldIrql;
@@ -110,13 +110,13 @@
IoStack = IoGetCurrentIrpStackLocation (Irp);
FileObject = IoStack->FileObject;
+ Fcb = (PMSFS_FCB)FileObject->FsContext;
Ccb = (PMSFS_CCB)FileObject->FsContext2;
- Mailslot = Ccb->Mailslot;
- DPRINT("MailslotName: %wZ\n", &Mailslot->Name);
+ DPRINT("MailslotName: %wZ\n", &Fcb->Name);
/* writing is not permitted on server side */
- if (Ccb->Mailslot->ServerCcb == Ccb)
+ if (Fcb->ServerCcb == Ccb)
{
Irp->IoStatus.Status = STATUS_ACCESS_DENIED;
Irp->IoStatus.Information = 0;
@@ -150,14 +150,14 @@
Message->Size = Length;
memcpy(&Message->Buffer, Buffer, Length);
- KeAcquireSpinLock(&Mailslot->MessageListLock, &oldIrql);
- InsertTailList(&Mailslot->MessageListHead, &Message->MessageListEntry);
- KeReleaseSpinLock(&Mailslot->MessageListLock, oldIrql);
+ KeAcquireSpinLock(&Fcb->MessageListLock, &oldIrql);
+ InsertTailList(&Fcb->MessageListHead, &Message->MessageListEntry);
+ KeReleaseSpinLock(&Fcb->MessageListLock, oldIrql);
- Mailslot->MessageCount++;
- if (Mailslot->MessageCount == 1)
+ Fcb->MessageCount++;
+ if (Fcb->MessageCount == 1)
{
- KeSetEvent(&Mailslot->MessageEvent,
+ KeSetEvent(&Fcb->MessageEvent,
0,
FALSE);
}