-use ExAllocatePoolWithTag instead of ExAllocatePool

-add missing critical region acquiring to the NtfsCreate routine.

svn path=/trunk/; revision=31753
This commit is contained in:
Christoph von Wittich 2008-01-13 11:36:54 +00:00
parent e48805d7fc
commit e23f06ce53
5 changed files with 18 additions and 14 deletions

View file

@ -60,7 +60,7 @@ NtfsMakeAbsoluteFilename(PFILE_OBJECT pFileObject,
/* construct absolute path name */
ASSERT(wcslen (Fcb->PathName) + 1 + wcslen (pRelativeFileName) + 1
<= MAX_PATH);
rcName = ExAllocatePool(NonPagedPool, MAX_PATH * sizeof(WCHAR));
rcName = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH * sizeof(WCHAR), TAG_NTFS);
if (!rcName)
{
return(STATUS_INSUFFICIENT_RESOURCES);
@ -223,11 +223,13 @@ NtfsCreate(PDEVICE_OBJECT DeviceObject,
DeviceExt = DeviceObject->DeviceExtension;
FsRtlEnterFileSystem();
ExAcquireResourceExclusiveLite(&DeviceExt->DirResource,
TRUE);
Status = NtfsCreateFile(DeviceObject,
Irp);
ExReleaseResourceLite(&DeviceExt->DirResource);
FsRtlExitFileSystem();
ByeBye:
Irp->IoStatus.Status = Status;

View file

@ -521,7 +521,7 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
{
First = TRUE;
Ccb->DirectorySearchPattern =
ExAllocatePool(NonPagedPool, SearchPattern->Length + sizeof(WCHAR));
ExAllocatePoolWithTag(NonPagedPool, SearchPattern->Length + sizeof(WCHAR), TAG_NTFS);
if (!Ccb->DirectorySearchPattern)
{
return(STATUS_INSUFFICIENT_RESOURCES);
@ -536,7 +536,7 @@ NtfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
else if (!Ccb->DirectorySearchPattern)
{
First = TRUE;
Ccb->DirectorySearchPattern = ExAllocatePool(NonPagedPool, 2 * sizeof(WCHAR));
Ccb->DirectorySearchPattern = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_NTFS);
if (!Ccb->DirectorySearchPattern)
{
return(STATUS_INSUFFICIENT_RESOURCES);

View file

@ -91,8 +91,8 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
}
DPRINT1("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
BootSector = ExAllocatePool(NonPagedPool,
DiskGeometry.BytesPerSector);
BootSector = ExAllocatePoolWithTag(NonPagedPool,
DiskGeometry.BytesPerSector, TAG_NTFS);
if (BootSector == NULL)
{
return(STATUS_INSUFFICIENT_RESOURCES);
@ -150,8 +150,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
}
DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
BootSector = ExAllocatePool(NonPagedPool,
DiskGeometry.BytesPerSector);
BootSector = ExAllocatePoolWithTag(NonPagedPool,
DiskGeometry.BytesPerSector, TAG_NTFS);
if (BootSector == NULL)
{
return(STATUS_INSUFFICIENT_RESOURCES);
@ -201,8 +201,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
ExFreePool(BootSector);
MftRecord = ExAllocatePool(NonPagedPool,
NtfsInfo->BytesPerFileRecord);
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
NtfsInfo->BytesPerFileRecord, TAG_NTFS);
if (MftRecord == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
@ -220,7 +220,7 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
return Status;
}
VolumeRecord = ExAllocatePool(NonPagedPool, NtfsInfo->BytesPerFileRecord);
VolumeRecord = ExAllocatePoolWithTag(NonPagedPool, NtfsInfo->BytesPerFileRecord, TAG_NTFS);
if (VolumeRecord == NULL)
{
ExFreePool (MftRecord);

View file

@ -58,8 +58,8 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
BytesPerFileRecord = Vcb->NtfsInfo.BytesPerFileRecord;
MftRecord = ExAllocatePool(NonPagedPool,
BytesPerFileRecord);
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
BytesPerFileRecord, TAG_NTFS);
if (MftRecord == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
@ -86,7 +86,7 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
n = AttributeDataLength (FindAttribute (MftRecord, AttributeData, 0))
/ BytesPerFileRecord;
FileRecord = ExAllocatePool(NonPagedPool, BytesPerFileRecord);
FileRecord = ExAllocatePoolWithTag(NonPagedPool, BytesPerFileRecord, TAG_NTFS);
if (FileRecord == NULL)
{
ExFreePool(MftRecord);
@ -198,7 +198,7 @@ ReadFileRecord (PDEVICE_EXTENSION Vcb,
LONG m = (Vcb->NtfsInfo.BytesPerCluster / BytesPerFileRecord) - 1;
ULONG n = m > 0 ? (index & m) : 0;
p = ExAllocatePool(NonPagedPool, clusters * Vcb->NtfsInfo.BytesPerCluster);
p = ExAllocatePoolWithTag(NonPagedPool, clusters * Vcb->NtfsInfo.BytesPerCluster, TAG_NTFS);
ReadVCN (Vcb, Mft, AttributeData, vcn, clusters, p);

View file

@ -16,6 +16,8 @@
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
#endif
#define TAG_NTFS TAG('N', 'T', 'F', 'S')
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
#define DEVICE_NAME L"\\Ntfs"