PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
PULONG BufferLength)
{
- ULONG LabelLength;
-
DPRINT("FsdGetFsVolumeInformation()\n");
DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo);
DPRINT("BufferLength %lu\n", *BufferLength);
- LabelLength = DeviceObject->Vpb->VolumeLabelLength;
-
- DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength*sizeof(WCHAR)));
- DPRINT("LabelLength %lu\n", LabelLength);
- DPRINT("Label %S\n", DeviceObject->Vpb->VolumeLabel);
+ DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength));
+ DPRINT("LabelLength %lu\n", DeviceObject->Vpb->VolumeLabelLength);
+ DPRINT("Label %*.S\n", DeviceObject->Vpb->VolumeLabelLength / sizeof(WCHAR), DeviceObject->Vpb->VolumeLabel);
if (*BufferLength < sizeof(FILE_FS_VOLUME_INFORMATION))
return STATUS_INFO_LENGTH_MISMATCH;
- if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength*sizeof(WCHAR)))
+ if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength))
return STATUS_BUFFER_OVERFLOW;
/* valid entries */
FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
- FsVolumeInfo->VolumeLabelLength = LabelLength * sizeof (WCHAR);
- wcscpy(FsVolumeInfo->VolumeLabel, DeviceObject->Vpb->VolumeLabel);
+ FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
+ memcpy(FsVolumeInfo->VolumeLabel, DeviceObject->Vpb->VolumeLabel, FsVolumeInfo->VolumeLabelLength);
/* dummy entries */
FsVolumeInfo->VolumeCreationTime.QuadPart = 0;
DPRINT("Finished FsdGetFsVolumeInformation()\n");
- *BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength * sizeof(WCHAR));
+ *BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength);
DPRINT("BufferLength %lu\n", *BufferLength);
PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo,
PULONG BufferLength)
{
- ULONG Length = DeviceExt->FatInfo.FatType == FAT32 ? 10 : 6;
-
+ WCHAR* pName; ULONG Length;
DPRINT("FsdGetFsAttributeInformation()\n");
DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo);
DPRINT("BufferLength %lu\n", *BufferLength);
if (*BufferLength < sizeof (FILE_FS_ATTRIBUTE_INFORMATION))
return STATUS_INFO_LENGTH_MISMATCH;
+ if (DeviceExt->FatInfo.FatType == FAT32)
+ {
+ Length = 10;
+ pName = L"FAT32";
+ }
+ else
+ {
+ Length = 6;
+ pName = L"FAT";
+ }
+
if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + Length))
return STATUS_BUFFER_OVERFLOW;
FsAttributeInfo->FileSystemAttributes =
FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK;
+
FsAttributeInfo->MaximumComponentNameLength = 255;
+
FsAttributeInfo->FileSystemNameLength = Length;
- if (DeviceExt->FatInfo.FatType == FAT32)
- {
- memcpy(FsAttributeInfo->FileSystemName, L"FAT32", 10);
- }
- else
- {
- memcpy(FsAttributeInfo->FileSystemName, L"FAT", 6);
- }
+
+ memcpy(FsAttributeInfo->FileSystemName, pName, Length );
DPRINT("Finished FsdGetFsAttributeInformation()\n");
DPRINT("VfatQueryVolumeInformation(IrpContext %x)\n", IrpContext);
- if (!ExAcquireResourceSharedLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
+ if (!ExAcquireResourceSharedLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
+ (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}
NTSTATUS Status = STATUS_SUCCESS;
PVOID SystemBuffer;
ULONG BufferLength;
+ PEXTENDED_IO_STACK_LOCATION Stack = (PEXTENDED_IO_STACK_LOCATION) IrpContext->Stack;
/* PRECONDITION */
assert(IrpContext);
DPRINT1("VfatSetVolumeInformation(IrpContext %x)\n", IrpContext);
- if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
+ if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
+ (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}
- FsInformationClass = IrpContext->Stack->Parameters.SetVolume.FsInformationClass;
- BufferLength = IrpContext->Stack->Parameters.SetVolume.Length;
+ FsInformationClass = Stack->Parameters.SetVolume.FsInformationClass;
+ BufferLength = Stack->Parameters.SetVolume.Length;
SystemBuffer = IrpContext->Irp->AssociatedIrp.SystemBuffer;
DPRINT1("FsInformationClass %d\n", FsInformationClass);