示例#1
0
static
NTSTATUS
FsdGetFsVolumeInformation(
    PDEVICE_OBJECT DeviceObject,
    PFILE_FS_VOLUME_INFORMATION FsVolumeInfo,
    PULONG BufferLength)
{
    PDEVICE_EXTENSION DeviceExt;

    DPRINT("FsdGetFsVolumeInformation()\n");
    DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo);
    DPRINT("BufferLength %lu\n", *BufferLength);

    DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength));
    DPRINT("LabelLength %hu\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) + DeviceObject->Vpb->VolumeLabelLength))
        return STATUS_BUFFER_OVERFLOW;

    DeviceExt = DeviceObject->DeviceExtension;

    /* valid entries */
    FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
    FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength;
    RtlCopyMemory(FsVolumeInfo->VolumeLabel, DeviceObject->Vpb->VolumeLabel, FsVolumeInfo->VolumeLabelLength);

    if (DeviceExt->VolumeFcb->Flags & FCB_IS_FATX_ENTRY)
    {
        FsdDosDateTimeToSystemTime(DeviceExt,
                                   DeviceExt->VolumeFcb->entry.FatX.CreationDate,
                                   DeviceExt->VolumeFcb->entry.FatX.CreationTime,
                                   &FsVolumeInfo->VolumeCreationTime);
    }
    else
    {
        FsdDosDateTimeToSystemTime(DeviceExt,
                                   DeviceExt->VolumeFcb->entry.Fat.CreationDate,
                                   DeviceExt->VolumeFcb->entry.Fat.CreationTime,
                                   &FsVolumeInfo->VolumeCreationTime);
    }

    FsVolumeInfo->SupportsObjects = FALSE;

    DPRINT("Finished FsdGetFsVolumeInformation()\n");

    *BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength);

    DPRINT("BufferLength %lu\n", *BufferLength);

    return STATUS_SUCCESS;
}
示例#2
0
static NTSTATUS
VfatGetFileFullDirectoryInformation (PVFAT_DIRENTRY_CONTEXT DirContext,
				     PDEVICE_EXTENSION DeviceExt,
				     PFILE_FULL_DIR_INFORMATION pInfo,
				     ULONG BufferLength)
{
  if ((sizeof (FILE_FULL_DIR_INFORMATION) + DirContext->LongNameU.Length) > BufferLength)
    return STATUS_BUFFER_OVERFLOW;
  pInfo->FileNameLength = DirContext->LongNameU.Length;
  pInfo->NextEntryOffset =
    ULONG_ROUND_UP (sizeof (FILE_FULL_DIR_INFORMATION) + DirContext->LongNameU.Length);
  RtlCopyMemory (pInfo->FileName, DirContext->LongNameU.Buffer, DirContext->LongNameU.Length);
//      pInfo->FileIndex=;
  if (DeviceExt->Flags & VCB_IS_FATX)
  {
    FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.FatX.CreationDate,
			      DirContext->DirEntry.FatX.CreationTime,
			      &pInfo->CreationTime);
    FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.FatX.AccessDate,
                              DirContext->DirEntry.FatX.AccessTime,
                              &pInfo->LastAccessTime);
    FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.FatX.UpdateDate,
                              DirContext->DirEntry.FatX.UpdateTime,
                              &pInfo->LastWriteTime);
    pInfo->ChangeTime = pInfo->LastWriteTime;
    pInfo->EndOfFile.u.HighPart = 0;
    pInfo->EndOfFile.u.LowPart = DirContext->DirEntry.FatX.FileSize;
    /* Make allocsize a rounded up multiple of BytesPerCluster */
    pInfo->AllocationSize.u.HighPart = 0;
    pInfo->AllocationSize.u.LowPart = ROUND_UP(DirContext->DirEntry.FatX.FileSize, DeviceExt->FatInfo.BytesPerCluster);
    pInfo->FileAttributes = DirContext->DirEntry.FatX.Attrib & 0x3f;
  }
  else
  {
    FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.Fat.CreationDate,
			      DirContext->DirEntry.Fat.CreationTime,
			      &pInfo->CreationTime);
    FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.Fat.AccessDate,
                              0, &pInfo->LastAccessTime);
    FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.Fat.UpdateDate,
                              DirContext->DirEntry.Fat.UpdateTime,
                              &pInfo->LastWriteTime);
    pInfo->ChangeTime = pInfo->LastWriteTime;
    pInfo->EndOfFile.u.HighPart = 0;
    pInfo->EndOfFile.u.LowPart = DirContext->DirEntry.Fat.FileSize;
    /* Make allocsize a rounded up multiple of BytesPerCluster */
    pInfo->AllocationSize.u.HighPart = 0;
    pInfo->AllocationSize.u.LowPart = ROUND_UP(DirContext->DirEntry.Fat.FileSize, DeviceExt->FatInfo.BytesPerCluster);
    pInfo->FileAttributes = DirContext->DirEntry.Fat.Attrib & 0x3f;
  }
//      pInfo->EaSize=;
  return STATUS_SUCCESS;
}