223{
226
229 ULONG bytesPerSector;
230
232
234
236
237
238
239
240
241
242
245
247 {
249 }
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
267
270
272
273 }
274
275
276
277
278
280
281
282
283
284
287
288
289
290
291
295
297
298
299
300
301
302 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_PNP,
"DiskInitFdo: Can not allocate request sense buffer\n"));
303
306 }
307
308
309
310
311
313
314
315
316
317
318
320
321
322
323
324 if ( (fdoExtension->MiniportDescriptor !=
NULL) &&
325 (fdoExtension->MiniportDescriptor->IoTimeoutValue > 0) ) {
326
327
328
329 fdoExtension->
TimeOutValue = fdoExtension->MiniportDescriptor->IoTimeoutValue;
330 } else {
331
332
333
334 timeOut = ClassQueryTimeOutRegistryValue(
Fdo);
335
336 if (timeOut) {
338 } else {
340 }
341 }
342
343
344
345
346
347
348
350
351 ClassUpdateInformationInRegistry(
Fdo,
352 "PhysicalDrive",
355 0);
356
357
358
359 ClassInitializeMediaChangeDetection(fdoExtension,
361
362 } else {
363
366
367 }
368
369
370
371
372
373
374
376
377
378
379
380
381
382
383
385
386
387
388
389
390
391
392
393
394
395
396
397
398
400
401
402
403
404
405 if (bytesPerSector == 0) {
406
407
408
409
410
413 }
414
415
416
417
418
419
420
425
426 if (dmSkew) {
427
428
429
430
431
432
433
434 fdoExtension->
DMSkew = *dmSkew;
437
439 }
440
441#if defined(_X86_) || defined(_AMD64_)
442
443
444
445
446
447
448
450
451 DiskReadSignature(
Fdo);
453
454 if (diskData->GeometrySource == DiskGeometryUnknown)
455 {
456
457
458
459
460
461
462 if (DiskIsNT4Geometry(fdoExtension))
463 {
465 diskData->RealGeometry.SectorsPerTrack = 0x20;
466 diskData->RealGeometry.TracksPerCylinder = 0x40;
468
469 diskData->GeometrySource = DiskGeometryFromNT4;
470 }
471 }
472 }
473
474#endif
475
477
478
479
480
481
482
483
484 {
488
490
499 &statusBlock);
500
502
504
506
514 }
515 }
516 }
517
518
519
520
521
522
524 {
528
530 {
531
532
533
534
535
536
537
538
539
540
542
543
544
545
546
547
548
552
554 "%d for device %p, Status = %lx\n",
558 }
559 } else {
560
561
562
563
564
565
567
568 }
569
570
571
572
573
575
576
577
578
579
581
584
587
588
589
590
591
593
595
596}
#define DEV_SAFE_START_UNIT
#define TEST_FLAG(Flags, Bit)
#define SET_FLAG(Flags, Bit)
_Must_inspect_result_ NTSTATUS NTAPI ClassReadDriveCapacity(_In_ PDEVICE_OBJECT Fdo)
CLASSPNP_SCAN_FOR_SPECIAL_INFO DiskBadControllers[]
VOID NTAPI DiskSetSpecialHacks(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN ULONG_PTR Data)
NTSTATUS DiskDetectFailurePrediction(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, PFAILURE_PREDICTION_METHOD FailurePredictCapability, BOOLEAN ScsiAddressAvailable)
#define PARTITION0_LIST_SIZE
#define DISK_DEFAULT_FAILURE_POLLING_PERIOD
#define DiskReadDriveCapacity(Fdo)
#define MAX_SECTORS_PER_VERIFY
struct _DISK_DATA * PDISK_DATA
#define SCSI_DISK_TIMEOUT
NTSTATUS DiskEnableDisableFailurePredictPolling(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, BOOLEAN Enable, ULONG PollTimeInSeconds)
VOID DiskCreateSymbolicLinks(IN PDEVICE_OBJECT DeviceObject)
#define SRB_FLAGS_QUEUE_ACTION_ENABLE
#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE
#define SRB_FLAGS_NO_QUEUE_FREEZE
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define InitializeListHead(ListHead)
#define KeInitializeSpinLock(sl)
#define FILE_REMOVABLE_MEDIA
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
#define IOCTL_SCSI_GET_ADDRESS
#define SENSE_BUFFER_SIZE_EX
LARGE_INTEGER StartingOffset
PDEVICE_OBJECT DeviceObject
PDEVICE_OBJECT LowerDeviceObject
DISK_GROUP_CONTEXT FlushContext
FAILURE_PREDICTION_METHOD FailurePredictionCapability
DISK_GEOMETRY DiskGeometry
COMMON_DEVICE_EXTENSION CommonExtension
PSTORAGE_ADAPTER_DESCRIPTOR AdapterDescriptor
PSTORAGE_DEVICE_DESCRIPTOR DeviceDescriptor
#define RtlZeroMemory(Destination, Length)
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ _In_ WDFDEVICE Fdo