00164 :
00165
00166 This routine walks
the Volume Recognition Sequence to determine
00167 whether
this volume contains an NSR02 (ISO 13346 Section 4) image.
00168
00169 Note:
this routine
is pretty much diked
out of UdfsRecognizeVolume
00170 in
the real filesystem, modulo fitting
it into
the fs recognizer.
00171
00172 Arguments:
00173
00174 DeviceObject - device we are checking
00175
00176
SectorSize - size of a physical sector on
this device
00177
00178 Return Value:
00179
00180
Boolean TRUE if we found NSR02,
FALSE otherwise.
00181
00182 --*/
00183
00184 {
00185 BOOLEAN FoundNSR =
FALSE;
00186
00187 BOOLEAN FoundBEA =
FALSE;
00188 BOOLEAN Resolved =
FALSE;
00189
00190
PVSD_GENERIC VolumeStructureDescriptor =
NULL;
00191 ULONGLONG
Offset =
SectorAlignN( SectorSize, VRA_BOUNDARY_LOCATION );
00192
00193
PAGED_CODE();
00194
00195
DebugTrace(( +1, Dbg,
00196
"IsUdfsVolume, DevObj %08x SectorSize %08x\n",
00197 DeviceObject,
00198 SectorSize ));
00199
00200
while (!Resolved) {
00201
00202
if (!
FsRecReadBlock( DeviceObject,
00203 (PLARGE_INTEGER)&Offset,
00204
sizeof(
VSD_GENERIC),
00205 SectorSize,
00206 (PVOID) &VolumeStructureDescriptor,
00207 NULL )) {
00208
00209
break;
00210 }
00211
00212
00213
00214
00215
00216
00217
00218
if (VolumeStructureDescriptor->
Type == 0) {
00219
00220
00221
00222
00223
00224
00225
00226
switch (
UdfsFindInParseTable( VsdIdentParseTable,
00227 VolumeStructureDescriptor->
Ident,
00228 VSD_LENGTH_IDENT )) {
00229
case VsdIdentBEA01:
00230
00231
00232
00233
00234
00235
DebugTrace(( 0, Dbg,
"IsUdfsVolume, got a BEA01\n" ));
00236
00237
00238
if ((FoundBEA &&
00239
DebugTrace(( 0, Dbg,
00240
"IsUdfsVolume, ... but it is a duplicate!\n" ))) ||
00241
00242 (VolumeStructureDescriptor->
Version != 1 &&
00243
DebugTrace(( 0, Dbg,
00244
"IsUdfsVolume, ... but it has a wacky version number %02x != 1!\n",
00245 VolumeStructureDescriptor->
Version )))) {
00246
00247 Resolved =
TRUE;
00248
break;
00249 }
00250
00251 FoundBEA =
TRUE;
00252
break;
00253
00254
case VsdIdentTEA01:
00255
00256
00257
00258
00259
00260
DebugTrace(( 0, Dbg,
"IsUdfsVolume, got a TEA01\n" ));
00261
00262 Resolved =
TRUE;
00263
break;
00264
00265
case VsdIdentNSR02:
00266
00267
00268
00269
00270
00271
00272
00273
00274
DebugTrace(( 0, Dbg,
"IsUdfsVolume, got an NSR02\n" ));
00275
00276
if ((FoundBEA ||
00277 !
DebugTrace(( 0, Dbg,
"IsUdfsVolume, ... but we haven't seen a BEA01 yet!\n" ))) &&
00278
00279 (VolumeStructureDescriptor->
Version == 1 ||
00280 !
DebugTrace(( 0, Dbg,
"IsUdfsVolume, ... but it has a wacky version number %02x != 1\n",
00281 VolumeStructureDescriptor->
Version )))) {
00282
00283 FoundNSR = Resolved =
TRUE;
00284
break;
00285 }
00286
00287
break;
00288
00289
case VsdIdentCD001:
00290
case VsdIdentCDW01:
00291
case VsdIdentNSR01:
00292
case VsdIdentCDW02:
00293
case VsdIdentBOOT2:
00294
00295
DebugTrace(( 0, Dbg,
"IsUdfsVolume, got a valid but uninteresting 13346 descriptor\n" ));
00296
00297
00298
00299
00300
00301
break;
00302
00303
default:
00304
00305
DebugTrace(( 0, Dbg,
"IsUdfsVolume, got an invalid 13346 descriptor\n" ));
00306
00307
00308
00309
00310
00311
00312 Resolved =
TRUE;
00313
break;
00314
00315 }
00316
00317 }
else if (!FoundBEA && (VolumeStructureDescriptor->
Type < 3 ||
00318 VolumeStructureDescriptor->
Type == 255)) {
00319
00320
DebugTrace(( 0, Dbg,
"IsUdfsVolume, got a 9660 descriptor\n" ));
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
switch (
UdfsFindInParseTable( VsdIdentParseTable,
00333 VolumeStructureDescriptor->
Ident,
00334 VSD_LENGTH_IDENT )) {
00335
case VsdIdentCDROM:
00336
case VsdIdentCD001:
00337
00338
DebugTrace(( 0, Dbg,
"IsUdfsVolume, ... seems we have 9660 here\n" ));
00339
00340
00341
00342
00343
00344
break;
00345
00346
default:
00347
00348
DebugTrace(( 0, Dbg,
"IsUdfsVolume, ... but it looks wacky\n" ));
00349
00350
00351
00352
00353
00354
00355 Resolved =
TRUE;
00356
break;
00357 }
00358
00359 }
else {
00360
00361
00362
00363
00364
00365
DebugTrace(( 0, Dbg,
"IsUdfsVolume, got an unrecognizeable descriptor, probably not 13346/9660\n" ));
00366
break;
00367 }
00368
00369
00370
00371
00372
00373
Offset +=
SectorAlignN( SectorSize,
sizeof(VSD_GENERIC) );
00374 }
00375
00376
DebugTrace(( -1, Dbg,
"IsUdfsVolume -> %c\n", ( FoundNSR ?
'T' :
'F' )));
00377
00378
00379
00380
00381
00382
if (VolumeStructureDescriptor) {
00383
00384
ExFreePool( VolumeStructureDescriptor );
00385 }
00386
00387
return FoundNSR;
00388 }