Author: pschweitzer
Date: Sat Mar 15 04:47:00 2008
New Revision: 32694
URL:
http://svn.reactos.org/svn/reactos?rev=3D32694&view=3Drev
Log:
- Fill in Identifier field when creating NTFS_xCB
- Changed a memset call to RtlZeroMemory
Modified:
trunk/reactos/drivers/filesystems/ntfs/fcb.c
trunk/reactos/drivers/filesystems/ntfs/fsctl.c
Modified: trunk/reactos/drivers/filesystems/ntfs/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/n=
tfs/fcb.c?rev=3D32694&r1=3D32693&r2=3D32694&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/drivers/filesystems/ntfs/fcb.c (original)
+++ trunk/reactos/drivers/filesystems/ntfs/fcb.c Sat Mar 15 04:47:00 2008
@@ -75,6 +75,9 @@
Fcb =3D ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_FCB), TAG_FCB);
RtlZeroMemory(Fcb, sizeof(NTFS_FCB));
=
+ Fcb->Identifier.Type =3D NTFS_TYPE_FCB;
+ Fcb->Identifier.Size =3D sizeof(NTFS_TYPE_FCB);
+
if (FileName)
{
wcscpy(Fcb->PathName, FileName);
@@ -230,6 +233,9 @@
return(STATUS_INSUFFICIENT_RESOURCES);
}
RtlZeroMemory(newCCB, sizeof(NTFS_CCB));
+
+ newCCB->Identifier.Type =3D NTFS_TYPE_CCB;
+ newCCB->Identifier.Size =3D sizeof(NTFS_TYPE_CCB);
=
FileObject->SectionObjectPointer =3D &Fcb->SectionObjectPointers;
FileObject->FsContext =3D Fcb;
@@ -396,7 +402,10 @@
{
return(STATUS_INSUFFICIENT_RESOURCES);
}
- memset(newCCB, 0, sizeof(NTFS_CCB));
+ RtlZeroMemory(newCCB, sizeof(NTFS_CCB));
+
+ newCCB->Identifier.Type =3D NTFS_TYPE_CCB;
+ newCCB->Identifier.Size =3D sizeof(NTFS_TYPE_CCB);
=
FileObject->SectionObjectPointer =3D &Fcb->SectionObjectPointers;
FileObject->FsContext =3D Fcb;
Modified: trunk/reactos/drivers/filesystems/ntfs/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/n=
tfs/fsctl.c?rev=3D32694&r1=3D32693&r2=3D32694&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/drivers/filesystems/ntfs/fsctl.c (original)
+++ trunk/reactos/drivers/filesystems/ntfs/fsctl.c Sat Mar 15 04:47:00 2008
@@ -304,12 +304,12 @@
NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
- PDEVICE_EXTENSION DeviceExt =3D NULL;
PDEVICE_OBJECT NewDeviceObject =3D NULL;
PDEVICE_OBJECT DeviceToMount;
PIO_STACK_LOCATION Stack;
PNTFS_FCB Fcb =3D NULL;
PNTFS_CCB Ccb =3D NULL;
+ PNTFS_VCB Vcb =3D NULL;
PVPB Vpb;
NTSTATUS Status;
=
@@ -343,26 +343,28 @@
goto ByeBye;
=
NewDeviceObject->Flags =3D NewDeviceObject->Flags | DO_DIRECT_IO;
- DeviceExt =3D (PVOID)NewDeviceObject->DeviceExtension;
- RtlZeroMemory(DeviceExt,
- sizeof(DEVICE_EXTENSION));
+ Vcb =3D (PVOID)NewDeviceObject->DeviceExtension;
+ RtlZeroMemory(Vcb, sizeof(NTFS_VCB));
+
+ Vcb->Identifier.Type =3D NTFS_TYPE_VCB;
+ Vcb->Identifier.Size =3D sizeof(NTFS_TYPE_VCB);
=
Status =3D NtfsGetVolumeData(DeviceToMount,
- DeviceExt);
+ Vcb);
if (!NT_SUCCESS(Status))
goto ByeBye;
=
NewDeviceObject->Vpb =3D DeviceToMount->Vpb;
=
- DeviceExt->StorageDevice =3D DeviceToMount;
- DeviceExt->StorageDevice->Vpb->DeviceObject =3D NewDeviceObject;
- DeviceExt->StorageDevice->Vpb->RealDevice =3D DeviceExt->StorageDevice;
- DeviceExt->StorageDevice->Vpb->Flags |=3D VPB_MOUNTED;
- NewDeviceObject->StackSize =3D DeviceExt->StorageDevice->StackSize + 1;
+ Vcb->StorageDevice =3D DeviceToMount;
+ Vcb->StorageDevice->Vpb->DeviceObject =3D NewDeviceObject;
+ Vcb->StorageDevice->Vpb->RealDevice =3D Vcb->StorageDevice;
+ Vcb->StorageDevice->Vpb->Flags |=3D VPB_MOUNTED;
+ NewDeviceObject->StackSize =3D Vcb->StorageDevice->StackSize + 1;
NewDeviceObject->Flags &=3D ~DO_DEVICE_INITIALIZING;
=
- DeviceExt->StreamFileObject =3D IoCreateStreamFileObject(NULL,
- DeviceExt->Storag=
eDevice);
+ Vcb->StreamFileObject =3D IoCreateStreamFileObject(NULL,
+ Vcb->StorageDevice);
=
=
Fcb =3D NtfsCreateFCB(NULL);
@@ -380,47 +382,49 @@
Status =3D STATUS_INSUFFICIENT_RESOURCES;
goto ByeBye;
}
- RtlZeroMemory(Ccb,
- sizeof(NTFS_CCB));
-
- DeviceExt->StreamFileObject->FsContext =3D Fcb;
- DeviceExt->StreamFileObject->FsContext2 =3D Ccb;
- DeviceExt->StreamFileObject->SectionObjectPointer =3D &Fcb->SectionObjec=
tPointers;
- DeviceExt->StreamFileObject->PrivateCacheMap =3D NULL;
- DeviceExt->StreamFileObject->Vpb =3D DeviceExt->Vpb;
- Ccb->PtrFileObject =3D DeviceExt->StreamFileObject;
- Fcb->FileObject =3D DeviceExt->StreamFileObject;
- Fcb->DevExt =3D (PDEVICE_EXTENSION)DeviceExt->StorageDevice;
+ RtlZeroMemory(Ccb, sizeof(NTFS_CCB));
+
+ Ccb->Identifier.Type =3D NTFS_TYPE_CCB;
+ Ccb->Identifier.Size =3D sizeof(NTFS_TYPE_CCB);
+
+ Vcb->StreamFileObject->FsContext =3D Fcb;
+ Vcb->StreamFileObject->FsContext2 =3D Ccb;
+ Vcb->StreamFileObject->SectionObjectPointer =3D &Fcb->SectionObjectPoint=
ers;
+ Vcb->StreamFileObject->PrivateCacheMap =3D NULL;
+ Vcb->StreamFileObject->Vpb =3D Vcb->Vpb;
+ Ccb->PtrFileObject =3D Vcb->StreamFileObject;
+ Fcb->FileObject =3D Vcb->StreamFileObject;
+ Fcb->DevExt =3D (PDEVICE_EXTENSION)Vcb->StorageDevice;
=
Fcb->Flags =3D FCB_IS_VOLUME_STREAM;
=
- Fcb->RFCB.FileSize.QuadPart =3D DeviceExt->NtfsInfo.SectorCount * Device=
Ext->NtfsInfo.BytesPerSector;
- Fcb->RFCB.ValidDataLength.QuadPart =3D DeviceExt->NtfsInfo.SectorCount *=
DeviceExt->NtfsInfo.BytesPerSector;
- Fcb->RFCB.AllocationSize.QuadPart =3D DeviceExt->NtfsInfo.SectorCount * =
DeviceExt->NtfsInfo.BytesPerSector; /* Correct? */
+ Fcb->RFCB.FileSize.QuadPart =3D Vcb->NtfsInfo.SectorCount * Vcb->NtfsInf=
o.BytesPerSector;
+ Fcb->RFCB.ValidDataLength.QuadPart =3D Vcb->NtfsInfo.SectorCount * Vcb->=
NtfsInfo.BytesPerSector;
+ Fcb->RFCB.AllocationSize.QuadPart =3D Vcb->NtfsInfo.SectorCount * Vcb->N=
tfsInfo.BytesPerSector; /* Correct? */
=
// Fcb->Entry.ExtentLocationL =3D 0;
// Fcb->Entry.DataLengthL =3D DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSI=
ZE;
=
- CcInitializeCacheMap(DeviceExt->StreamFileObject,
+ CcInitializeCacheMap(Vcb->StreamFileObject,
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
FALSE,
&(NtfsGlobalData->CacheMgrCallbacks),
Fcb);
=
- ExInitializeResourceLite(&DeviceExt->DirResource);
+ ExInitializeResourceLite(&Vcb->DirResource);
// ExInitializeResourceLite(&DeviceExt->FatResource);
=
- KeInitializeSpinLock(&DeviceExt->FcbListLock);
- InitializeListHead(&DeviceExt->FcbListHead);
+ KeInitializeSpinLock(&Vcb->FcbListLock);
+ InitializeListHead(&Vcb->FcbListHead);
=
/* Get serial number */
- NewDeviceObject->Vpb->SerialNumber =3D DeviceExt->NtfsInfo.SerialNumber;
+ NewDeviceObject->Vpb->SerialNumber =3D Vcb->NtfsInfo.SerialNumber;
=
/* Get volume label */
- NewDeviceObject->Vpb->VolumeLabelLength =3D DeviceExt->NtfsInfo.VolumeLa=
belLength;
- RtlCopyMemory (NewDeviceObject->Vpb->VolumeLabel,
- DeviceExt->NtfsInfo.VolumeLabel,
- DeviceExt->NtfsInfo.VolumeLabelLength);
+ NewDeviceObject->Vpb->VolumeLabelLength =3D Vcb->NtfsInfo.VolumeLabelLen=
gth;
+ RtlCopyMemory(NewDeviceObject->Vpb->VolumeLabel,
+ Vcb->NtfsInfo.VolumeLabel,
+ Vcb->NtfsInfo.VolumeLabelLength);
=
Status =3D STATUS_SUCCESS;
=
@@ -428,8 +432,8 @@
if (!NT_SUCCESS(Status))
{
/* Cleanup */
- if (DeviceExt && DeviceExt->StreamFileObject)
- ObDereferenceObject(DeviceExt->StreamFileObject);
+ if (Vcb && Vcb->StreamFileObject)
+ ObDereferenceObject(Vcb->StreamFileObject);
if (Fcb)
ExFreePool(Fcb);
if (Ccb)