00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#include "UdfProcs.h"
00023
00024
00025
00026
00027
00028 #define BugCheckFileId (UDFS_BUG_CHECK_VOLINFO)
00029
00030
00031
00032
00033
00034 #define Dbg (UDFS_DEBUG_LEVEL_VOLINFO)
00035
00036
00037
00038
00039
00040
NTSTATUS
00041
UdfQueryFsVolumeInfo (
00042 IN
PIRP_CONTEXT IrpContext,
00043 IN
PVCB Vcb,
00044 IN PFILE_FS_VOLUME_INFORMATION Buffer,
00045 IN OUT PULONG Length
00046 );
00047
00048
NTSTATUS
00049
UdfQueryFsSizeInfo (
00050 IN
PIRP_CONTEXT IrpContext,
00051 IN
PVCB Vcb,
00052 IN PFILE_FS_SIZE_INFORMATION Buffer,
00053 IN OUT PULONG Length
00054 );
00055
00056
NTSTATUS
00057
UdfQueryFsDeviceInfo (
00058 IN
PIRP_CONTEXT IrpContext,
00059 IN
PVCB Vcb,
00060 IN PFILE_FS_DEVICE_INFORMATION Buffer,
00061 IN OUT PULONG Length
00062 );
00063
00064
NTSTATUS
00065
UdfQueryFsAttributeInfo (
00066 IN
PIRP_CONTEXT IrpContext,
00067 IN
PVCB Vcb,
00068 IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
00069 IN OUT PULONG Length
00070 );
00071
00072
#ifdef ALLOC_PRAGMA
00073
#pragma alloc_text(PAGE, UdfCommonQueryVolInfo)
00074
#pragma alloc_text(PAGE, UdfQueryFsAttributeInfo)
00075
#pragma alloc_text(PAGE, UdfQueryFsDeviceInfo)
00076
#pragma alloc_text(PAGE, UdfQueryFsSizeInfo)
00077
#pragma alloc_text(PAGE, UdfQueryFsVolumeInfo)
00078
#endif
00079
00080
00081
NTSTATUS
00082 UdfCommonQueryVolInfo (
00083 IN
PIRP_CONTEXT IrpContext,
00084 IN
PIRP Irp
00085 )
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 {
00105
NTSTATUS Status = STATUS_INVALID_PARAMETER;
00106
PIO_STACK_LOCATION IrpSp =
IoGetCurrentIrpStackLocation(
Irp );
00107
00108 ULONG Length;
00109
00110
TYPE_OF_OPEN TypeOfOpen;
00111
PFCB Fcb;
00112
PCCB Ccb;
00113
00114
PAGED_CODE();
00115
00116
00117
00118
00119
00120 Length = IrpSp->
Parameters.QueryVolume.Length;
00121
00122
00123
00124
00125
00126 TypeOfOpen =
UdfDecodeFileObject( IrpSp->
FileObject, &Fcb, &Ccb );
00127
00128
if (TypeOfOpen ==
UnopenedFileObject) {
00129
00130
UdfCompleteRequest( IrpContext,
Irp, STATUS_INVALID_PARAMETER );
00131
return STATUS_INVALID_PARAMETER;
00132 }
00133
00134
00135
00136
00137
00138
UdfAcquireVcbShared( IrpContext, Fcb->
Vcb,
FALSE );
00139
00140
00141
00142
00143
00144
try {
00145
00146
00147
00148
00149
00150
UdfVerifyVcb( IrpContext, Fcb->
Vcb );
00151
00152
00153
00154
00155
00156
00157
00158
00159
switch (IrpSp->
Parameters.QueryVolume.FsInformationClass) {
00160
00161
case FileFsSizeInformation:
00162
00163
Status =
UdfQueryFsSizeInfo( IrpContext, Fcb->
Vcb,
Irp->
AssociatedIrp.SystemBuffer, &Length );
00164
break;
00165
00166
case FileFsVolumeInformation:
00167
00168
Status =
UdfQueryFsVolumeInfo( IrpContext, Fcb->
Vcb,
Irp->
AssociatedIrp.SystemBuffer, &Length );
00169
break;
00170
00171
case FileFsDeviceInformation:
00172
00173
Status =
UdfQueryFsDeviceInfo( IrpContext, Fcb->
Vcb,
Irp->
AssociatedIrp.SystemBuffer, &Length );
00174
break;
00175
00176
case FileFsAttributeInformation:
00177
00178
Status =
UdfQueryFsAttributeInfo( IrpContext, Fcb->
Vcb,
Irp->
AssociatedIrp.SystemBuffer, &Length );
00179
break;
00180 }
00181
00182
00183
00184
00185
00186
Irp->
IoStatus.Information = IrpSp->
Parameters.QueryVolume.Length - Length;
00187
00188 } finally {
00189
00190
00191
00192
00193
00194
UdfReleaseVcb( IrpContext, Fcb->
Vcb );
00195 }
00196
00197
00198
00199
00200
00201
UdfCompleteRequest( IrpContext,
Irp,
Status );
00202
00203
return Status;
00204 }
00205
00206
00207
00208
00209
00210
00211
NTSTATUS
00212 UdfQueryFsVolumeInfo (
00213 IN
PIRP_CONTEXT IrpContext,
00214 IN
PVCB Vcb,
00215 IN PFILE_FS_VOLUME_INFORMATION Buffer,
00216 IN OUT PULONG Length
00217 )
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241 {
00242 ULONG BytesToCopy;
00243
00244
NTSTATUS Status = STATUS_SUCCESS;
00245
00246
PAGED_CODE();
00247
00248
00249
00250
00251
00252
Buffer->VolumeCreationTime = Vcb->VolumeDasdFcb->Timestamps.CreationTime;
00253
Buffer->VolumeSerialNumber = Vcb->Vpb->SerialNumber;
00254
00255
Buffer->SupportsObjects =
FALSE;
00256
00257 *Length -= FIELD_OFFSET( FILE_FS_VOLUME_INFORMATION, VolumeLabel[0] );
00258
00259
00260
00261
00262
00263
if (*Length >= (ULONG) Vcb->Vpb->VolumeLabelLength) {
00264
00265 BytesToCopy = Vcb->Vpb->VolumeLabelLength;
00266
00267 }
else {
00268
00269 BytesToCopy = *Length;
00270
00271
Status = STATUS_BUFFER_OVERFLOW;
00272 }
00273
00274
00275
00276
00277
00278
Buffer->VolumeLabelLength = BytesToCopy;
00279
00280
if (BytesToCopy) {
00281
00282 RtlCopyMemory( &
Buffer->VolumeLabel[0],
00283 &Vcb->Vpb->VolumeLabel[0],
00284 BytesToCopy );
00285 }
00286
00287 *Length -= BytesToCopy;
00288
00289
00290
00291
00292
00293
return Status;
00294 }
00295
00296
00297
00298
00299
00300
00301
NTSTATUS
00302 UdfQueryFsSizeInfo (
00303 IN
PIRP_CONTEXT IrpContext,
00304 IN
PVCB Vcb,
00305 IN PFILE_FS_SIZE_INFORMATION Buffer,
00306 IN OUT PULONG Length
00307 )
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331 {
00332
PAGED_CODE();
00333
00334
00335
00336
00337
00338
Buffer->TotalAllocationUnits.QuadPart =
LlBlocksFromBytes( Vcb, Vcb->VolumeDasdFcb->AllocationSize.QuadPart );
00339
00340
Buffer->AvailableAllocationUnits.QuadPart = 0;
00341
Buffer->SectorsPerAllocationUnit =
SectorsFromBytes( Vcb,
BlockSize( Vcb ));
00342
Buffer->BytesPerSector =
SectorSize( Vcb );
00343
00344
00345
00346
00347
00348 *Length -=
sizeof( FILE_FS_SIZE_INFORMATION );
00349
00350
00351
00352
00353
00354
return STATUS_SUCCESS;
00355 }
00356
00357
00358
00359
00360
00361
00362
NTSTATUS
00363 UdfQueryFsDeviceInfo (
00364 IN
PIRP_CONTEXT IrpContext,
00365 IN
PVCB Vcb,
00366 IN PFILE_FS_DEVICE_INFORMATION Buffer,
00367 IN OUT PULONG Length
00368 )
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392 {
00393
PAGED_CODE();
00394
00395
00396
00397
00398
00399
Buffer->Characteristics = Vcb->TargetDeviceObject->Characteristics;
00400
Buffer->DeviceType = FILE_DEVICE_CD_ROM;
00401
00402
00403
00404
00405
00406 *Length -=
sizeof( FILE_FS_DEVICE_INFORMATION );
00407
00408
00409
00410
00411
00412
return STATUS_SUCCESS;
00413 }
00414
00415
00416
00417
00418
00419
00420
NTSTATUS
00421 UdfQueryFsAttributeInfo (
00422 IN
PIRP_CONTEXT IrpContext,
00423 IN
PVCB Vcb,
00424 IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
00425 IN OUT PULONG Length
00426 )
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450 {
00451 ULONG BytesToCopy;
00452
00453
NTSTATUS Status = STATUS_SUCCESS;
00454
00455
PAGED_CODE();
00456
00457
00458
00459
00460
00461
Buffer->FileSystemAttributes = FILE_CASE_SENSITIVE_SEARCH |
00462 FILE_UNICODE_ON_DISK;
00463
00464
Buffer->MaximumComponentNameLength = 255;
00465
00466 *Length -= FIELD_OFFSET( FILE_FS_ATTRIBUTE_INFORMATION, FileSystemName );
00467
00468
00469
00470
00471
00472
ClearFlag( *Length, 1 );
00473
00474
00475
00476
00477
00478
if (*Length >= 6) {
00479
00480 BytesToCopy = 6;
00481
00482 }
else {
00483
00484 BytesToCopy = *Length;
00485
Status = STATUS_BUFFER_OVERFLOW;
00486 }
00487
00488 *Length -= BytesToCopy;
00489
00490
00491
00492
00493
00494
00495
Buffer->FileSystemNameLength = BytesToCopy;
00496
00497 RtlCopyMemory( &
Buffer->FileSystemName[0],
L"UDF", BytesToCopy );
00498
00499
00500
00501
00502
00503
return Status;
00504 }