Simplified the access to FCBs and CCBs.

svn path=/trunk/; revision=21816
This commit is contained in:
Eric Kohl 2006-05-07 07:33:40 +00:00
parent c5fa9029dc
commit 9c0250f71c
3 changed files with 10 additions and 14 deletions

View file

@ -79,7 +79,6 @@ MsfsCreate(PDEVICE_OBJECT DeviceObject,
} }
Fcb = current; Fcb = current;
DPRINT1("Fcb: %p\n", Fcb);
KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql); KeAcquireSpinLock(&Fcb->CcbListLock, &oldIrql);
InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry); InsertTailList(&Fcb->CcbListHead, &Ccb->CcbListEntry);

View file

@ -18,18 +18,15 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
static NTSTATUS static NTSTATUS
MsfsQueryMailslotInformation(PMSFS_CCB Ccb, MsfsQueryMailslotInformation(PMSFS_FCB Fcb,
PFILE_MAILSLOT_QUERY_INFORMATION Buffer, PFILE_MAILSLOT_QUERY_INFORMATION Buffer,
PULONG BufferLength) PULONG BufferLength)
{ {
PMSFS_FCB Fcb;
KIRQL oldIrql; KIRQL oldIrql;
if (*BufferLength < sizeof(FILE_MAILSLOT_QUERY_INFORMATION)) if (*BufferLength < sizeof(FILE_MAILSLOT_QUERY_INFORMATION))
return(STATUS_BUFFER_OVERFLOW); return(STATUS_BUFFER_OVERFLOW);
Fcb = Ccb->Fcb;
Buffer->MaximumMessageSize = Fcb->MaxMessageSize; Buffer->MaximumMessageSize = Fcb->MaxMessageSize;
Buffer->ReadTimeout = Fcb->TimeOut; Buffer->ReadTimeout = Fcb->TimeOut;
@ -53,14 +50,14 @@ MsfsQueryMailslotInformation(PMSFS_CCB Ccb,
static NTSTATUS static NTSTATUS
MsfsSetMailslotInformation(PMSFS_CCB Ccb, MsfsSetMailslotInformation(PMSFS_FCB Fcb,
PFILE_MAILSLOT_SET_INFORMATION Buffer, PFILE_MAILSLOT_SET_INFORMATION Buffer,
PULONG BufferLength) PULONG BufferLength)
{ {
if (*BufferLength < sizeof(FILE_MAILSLOT_SET_INFORMATION)) if (*BufferLength < sizeof(FILE_MAILSLOT_SET_INFORMATION))
return(STATUS_BUFFER_OVERFLOW); return(STATUS_BUFFER_OVERFLOW);
Ccb->Fcb->TimeOut = *Buffer->ReadTimeout; Fcb->TimeOut = *Buffer->ReadTimeout;
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -86,13 +83,13 @@ MsfsQueryInformation(PDEVICE_OBJECT DeviceObject,
FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass; FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
DeviceExtension = DeviceObject->DeviceExtension; DeviceExtension = DeviceObject->DeviceExtension;
FileObject = IoStack->FileObject; FileObject = IoStack->FileObject;
Fcb = (PMSFS_FCB)FileObject->FsContext;
Ccb = (PMSFS_CCB)FileObject->FsContext2; Ccb = (PMSFS_CCB)FileObject->FsContext2;
Fcb = Ccb->Fcb;
DPRINT("Mailslot name: %wZ\n", &Fcb->Name); DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
/* querying information is not permitted on client side */ /* querying information is not permitted on client side */
if (Ccb->Fcb->ServerCcb != Ccb) if (Fcb->ServerCcb != Ccb)
{ {
Status = STATUS_ACCESS_DENIED; Status = STATUS_ACCESS_DENIED;
@ -111,7 +108,7 @@ MsfsQueryInformation(PDEVICE_OBJECT DeviceObject,
switch (FileInformationClass) switch (FileInformationClass)
{ {
case FileMailslotQueryInformation: case FileMailslotQueryInformation:
Status = MsfsQueryMailslotInformation(Ccb, Status = MsfsQueryMailslotInformation(Fcb,
SystemBuffer, SystemBuffer,
&BufferLength); &BufferLength);
break; break;
@ -150,13 +147,13 @@ MsfsSetInformation(PDEVICE_OBJECT DeviceObject,
IoStack = IoGetCurrentIrpStackLocation (Irp); IoStack = IoGetCurrentIrpStackLocation (Irp);
FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass; FileInformationClass = IoStack->Parameters.QueryFile.FileInformationClass;
FileObject = IoStack->FileObject; FileObject = IoStack->FileObject;
Fcb = (PMSFS_FCB)FileObject->FsContext;
Ccb = (PMSFS_CCB)FileObject->FsContext2; Ccb = (PMSFS_CCB)FileObject->FsContext2;
Fcb = Ccb->Fcb;
DPRINT("Mailslot name: %wZ\n", &Fcb->Name); DPRINT("Mailslot name: %wZ\n", &Fcb->Name);
/* setting information is not permitted on client side */ /* setting information is not permitted on client side */
if (Ccb->Fcb->ServerCcb != Ccb) if (Fcb->ServerCcb != Ccb)
{ {
Status = STATUS_ACCESS_DENIED; Status = STATUS_ACCESS_DENIED;
@ -178,7 +175,7 @@ MsfsSetInformation(PDEVICE_OBJECT DeviceObject,
switch (FileInformationClass) switch (FileInformationClass)
{ {
case FileMailslotSetInformation: case FileMailslotSetInformation:
Status = MsfsSetMailslotInformation(Ccb, Status = MsfsSetMailslotInformation(Fcb,
SystemBuffer, SystemBuffer,
&BufferLength); &BufferLength);
break; break;

View file

@ -31,8 +31,8 @@ MsfsFileSystemControl(PDEVICE_OBJECT DeviceObject,
IoStack = IoGetCurrentIrpStackLocation(Irp); IoStack = IoGetCurrentIrpStackLocation(Irp);
FileObject = IoStack->FileObject; FileObject = IoStack->FileObject;
Fcb = FileObject->FsContext;
Ccb = FileObject->FsContext2; Ccb = FileObject->FsContext2;
Fcb = Ccb->Fcb;
DPRINT1("Mailslot name: %wZ\n", &Fcb->Name); DPRINT1("Mailslot name: %wZ\n", &Fcb->Name);