Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenvolinfo.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS kernel 00003 * Copyright (C) 2002, 2003 ReactOS Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 /* $Id: volinfo.c 44442 2009-12-06 18:49:19Z spetreolle $ 00020 * 00021 * COPYRIGHT: See COPYING in the top level directory 00022 * PROJECT: ReactOS kernel 00023 * FILE: services/fs/vfat/volume.c 00024 * PURPOSE: CDROM (ISO 9660) filesystem driver 00025 * PROGRAMMER: Art Yerkes 00026 * Eric Kohl 00027 */ 00028 00029 /* INCLUDES *****************************************************************/ 00030 00031 #include "cdfs.h" 00032 00033 #define NDEBUG 00034 #include <debug.h> 00035 00036 /* FUNCTIONS ****************************************************************/ 00037 00038 static NTSTATUS 00039 CdfsGetFsVolumeInformation(PDEVICE_OBJECT DeviceObject, 00040 PFILE_FS_VOLUME_INFORMATION FsVolumeInfo, 00041 PULONG BufferLength) 00042 { 00043 DPRINT("CdfsGetFsVolumeInformation() called\n"); 00044 DPRINT("FsVolumeInfo = %p\n", FsVolumeInfo); 00045 DPRINT("BufferLength %lu\n", *BufferLength); 00046 00047 DPRINT("Vpb %p\n", DeviceObject->Vpb); 00048 00049 DPRINT("Required length %lu\n", (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength)); 00050 DPRINT("LabelLength %hu\n", DeviceObject->Vpb->VolumeLabelLength); 00051 DPRINT("Label %*.S\n", DeviceObject->Vpb->VolumeLabelLength / sizeof(WCHAR), DeviceObject->Vpb->VolumeLabel); 00052 00053 if (*BufferLength < sizeof(FILE_FS_VOLUME_INFORMATION)) 00054 return STATUS_INFO_LENGTH_MISMATCH; 00055 00056 if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength)) 00057 return STATUS_BUFFER_OVERFLOW; 00058 00059 /* valid entries */ 00060 FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber; 00061 FsVolumeInfo->VolumeLabelLength = DeviceObject->Vpb->VolumeLabelLength; 00062 memcpy(FsVolumeInfo->VolumeLabel, 00063 DeviceObject->Vpb->VolumeLabel, 00064 DeviceObject->Vpb->VolumeLabelLength); 00065 00066 /* dummy entries */ 00067 FsVolumeInfo->VolumeCreationTime.QuadPart = 0; 00068 FsVolumeInfo->SupportsObjects = FALSE; 00069 00070 DPRINT("Finished FsdGetFsVolumeInformation()\n"); 00071 00072 *BufferLength -= (sizeof(FILE_FS_VOLUME_INFORMATION) + DeviceObject->Vpb->VolumeLabelLength); 00073 00074 DPRINT("BufferLength %lu\n", *BufferLength); 00075 00076 return(STATUS_SUCCESS); 00077 } 00078 00079 00080 static NTSTATUS 00081 CdfsGetFsAttributeInformation(PDEVICE_EXTENSION DeviceExt, 00082 PFILE_FS_ATTRIBUTE_INFORMATION FsAttributeInfo, 00083 PULONG BufferLength) 00084 { 00085 DPRINT("CdfsGetFsAttributeInformation()\n"); 00086 DPRINT("FsAttributeInfo = %p\n", FsAttributeInfo); 00087 DPRINT("BufferLength %lu\n", *BufferLength); 00088 DPRINT("Required length %lu\n", (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)); 00089 00090 if (*BufferLength < sizeof (FILE_FS_ATTRIBUTE_INFORMATION)) 00091 return STATUS_INFO_LENGTH_MISMATCH; 00092 00093 if (*BufferLength < (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8)) 00094 return STATUS_BUFFER_OVERFLOW; 00095 00096 FsAttributeInfo->FileSystemAttributes = 00097 FILE_CASE_PRESERVED_NAMES | FILE_UNICODE_ON_DISK; 00098 FsAttributeInfo->MaximumComponentNameLength = 255; 00099 FsAttributeInfo->FileSystemNameLength = 8; 00100 00101 memcpy(FsAttributeInfo->FileSystemName, L"CDFS", 8); 00102 00103 DPRINT("Finished FsdGetFsAttributeInformation()\n"); 00104 00105 *BufferLength -= (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 8); 00106 DPRINT("BufferLength %lu\n", *BufferLength); 00107 00108 return(STATUS_SUCCESS); 00109 } 00110 00111 00112 static NTSTATUS 00113 CdfsGetFsSizeInformation(PDEVICE_OBJECT DeviceObject, 00114 PFILE_FS_SIZE_INFORMATION FsSizeInfo, 00115 PULONG BufferLength) 00116 { 00117 PDEVICE_EXTENSION DeviceExt; 00118 NTSTATUS Status = STATUS_SUCCESS; 00119 00120 DPRINT("CdfsGetFsSizeInformation()\n"); 00121 DPRINT("FsSizeInfo = %p\n", FsSizeInfo); 00122 00123 if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION)) 00124 return(STATUS_BUFFER_OVERFLOW); 00125 00126 DeviceExt = DeviceObject->DeviceExtension; 00127 00128 FsSizeInfo->AvailableAllocationUnits.QuadPart = 0; 00129 FsSizeInfo->TotalAllocationUnits.QuadPart = DeviceExt->CdInfo.VolumeSpaceSize; 00130 FsSizeInfo->SectorsPerAllocationUnit = 1; 00131 FsSizeInfo->BytesPerSector = BLOCKSIZE; 00132 00133 DPRINT("Finished FsdGetFsSizeInformation()\n"); 00134 if (NT_SUCCESS(Status)) 00135 *BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION); 00136 00137 return(Status); 00138 } 00139 00140 00141 static NTSTATUS 00142 CdfsGetFsDeviceInformation 00143 ( 00144 PDEVICE_OBJECT DeviceObject, 00145 PFILE_FS_DEVICE_INFORMATION FsDeviceInfo, 00146 PULONG BufferLength 00147 ) 00148 { 00149 DPRINT("CdfsGetFsDeviceInformation()\n"); 00150 DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo); 00151 DPRINT("BufferLength %lu\n", *BufferLength); 00152 DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION)); 00153 00154 if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION)) 00155 return(STATUS_BUFFER_OVERFLOW); 00156 00157 FsDeviceInfo->DeviceType = FILE_DEVICE_CD_ROM; 00158 FsDeviceInfo->Characteristics = DeviceObject->Characteristics; 00159 00160 DPRINT("FsdGetFsDeviceInformation() finished.\n"); 00161 00162 *BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION); 00163 DPRINT("BufferLength %lu\n", *BufferLength); 00164 00165 return(STATUS_SUCCESS); 00166 } 00167 00168 00169 NTSTATUS NTAPI 00170 CdfsQueryVolumeInformation(PDEVICE_OBJECT DeviceObject, 00171 PIRP Irp) 00172 { 00173 FS_INFORMATION_CLASS FsInformationClass; 00174 PIO_STACK_LOCATION Stack; 00175 NTSTATUS Status = STATUS_SUCCESS; 00176 PVOID SystemBuffer; 00177 ULONG BufferLength; 00178 00179 DPRINT("CdfsQueryVolumeInformation() called\n"); 00180 00181 Stack = IoGetCurrentIrpStackLocation(Irp); 00182 FsInformationClass = Stack->Parameters.QueryVolume.FsInformationClass; 00183 BufferLength = Stack->Parameters.QueryVolume.Length; 00184 SystemBuffer = Irp->AssociatedIrp.SystemBuffer; 00185 00186 DPRINT("FsInformationClass %d\n", FsInformationClass); 00187 DPRINT("SystemBuffer %x\n", SystemBuffer); 00188 00189 switch (FsInformationClass) 00190 { 00191 case FileFsVolumeInformation: 00192 Status = CdfsGetFsVolumeInformation(DeviceObject, 00193 SystemBuffer, 00194 &BufferLength); 00195 break; 00196 00197 case FileFsAttributeInformation: 00198 Status = CdfsGetFsAttributeInformation(DeviceObject->DeviceExtension, 00199 SystemBuffer, 00200 &BufferLength); 00201 break; 00202 00203 case FileFsSizeInformation: 00204 Status = CdfsGetFsSizeInformation(DeviceObject, 00205 SystemBuffer, 00206 &BufferLength); 00207 break; 00208 00209 case FileFsDeviceInformation: 00210 Status = CdfsGetFsDeviceInformation(DeviceObject, 00211 SystemBuffer, 00212 &BufferLength); 00213 break; 00214 00215 default: 00216 Status = STATUS_NOT_SUPPORTED; 00217 } 00218 00219 Irp->IoStatus.Status = Status; 00220 if (NT_SUCCESS(Status)) 00221 Irp->IoStatus.Information = 00222 Stack->Parameters.QueryVolume.Length - BufferLength; 00223 else 00224 Irp->IoStatus.Information = 0; 00225 IoCompleteRequest(Irp, IO_NO_INCREMENT); 00226 00227 return(Status); 00228 } 00229 00230 00231 NTSTATUS NTAPI 00232 CdfsSetVolumeInformation(PDEVICE_OBJECT DeviceObject, 00233 PIRP Irp) 00234 { 00235 DPRINT("CdfsSetVolumeInformation() called\n"); 00236 00237 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; 00238 Irp->IoStatus.Information = 0; 00239 IoCompleteRequest(Irp, IO_NO_INCREMENT); 00240 00241 return(STATUS_NOT_SUPPORTED); 00242 } 00243 00244 /* EOF */ Generated on Sat May 26 2012 04:26:16 for ReactOS by
1.7.6.1
|