ReactOS  0.4.14-dev-1233-gf5658fd
disk.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (C) Microsoft Corporation, 1991 - 1999
4 
5 Module Name:
6 
7  disk.c
8 
9 Abstract:
10 
11  SCSI disk class driver
12 
13 Environment:
14 
15  kernel mode only
16 
17 Notes:
18 
19 Revision History:
20 
21 --*/
22 
23 #ifndef _DISK_NEW_H_
24 #define _DISK_NEW_H_
25 
26 #undef _WIN32_WINNT
27 #define _WIN32_WINNT 0x0501
28 #define NTDDI_VERSION NTDDI_WINXP
29 
30 #include <ntddk.h>
31 #include <wmidata.h>
32 #include <classpnp.h>
33 
34 #if defined(JAPAN) && defined(_X86_)
35 #include <machine.h>
36 #endif
37 
38 #if defined(_X86_)
39 #include <mountdev.h>
40 #endif
41 
42 #ifdef ExAllocatePool
43 #undef ExAllocatePool
44 #define ExAllocatePool #assert(FALSE)
45 #endif
46 
47 #define DISK_TAG_GENERAL ' DcS' // "ScD " - generic tag
48 #define DISK_TAG_SMART 'aDcS' // "ScDa" - SMART allocations
49 #define DISK_TAG_INFO_EXCEPTION 'ADcS' // "ScDA" - Info Exceptions
50 #define DISK_TAG_DISABLE_CACHE 'CDcS' // "ScDC" - disable cache paths
51 #define DISK_TAG_CCONTEXT 'cDcS' // "ScDc" - disk allocated completion context
52 #define DISK_TAG_DISK_GEOM 'GDcS' // "ScDG" - disk geometry buffer
53 #define DISK_TAG_UPDATE_GEOM 'gDcS' // "ScDg" - update disk geometry paths
54 #define DISK_TAG_SENSE_INFO 'IDcS' // "ScDI" - sense info buffers
55 #define DISK_TAG_PNP_ID 'iDcS' // "ScDp" - pnp ids
56 #define DISK_TAG_MODE_DATA 'MDcS' // "ScDM" - mode data buffer
57 #define DISK_CACHE_MBR_CHECK 'mDcS' // "ScDM" - mbr checksum code
58 #define DISK_TAG_NAME 'NDcS' // "ScDN" - disk name code
59 #define DISK_TAG_READ_CAP 'PDcS' // "ScDP" - read capacity buffer
60 #define DISK_TAG_PART_LIST 'pDcS' // "ScDp" - disk partition lists
61 #define DISK_TAG_SRB 'SDcS' // "ScDS" - srb allocation
62 #define DISK_TAG_START 'sDcS' // "ScDs" - start device paths
63 #define DISK_TAG_UPDATE_CAP 'UDcS' // "ScDU" - update capacity path
64 #define DISK_TAG_WI_CONTEXT 'WDcS' // "ScDW" - work-item context
65 
66 typedef
67 VOID
69  IN PDEVICE_OBJECT Fdo,
71  );
72 
73 #if defined(_X86_)
74 
75 //
76 // Disk device data
77 //
78 
79 typedef enum _DISK_GEOMETRY_SOURCE {
80  DiskGeometryUnknown,
81  DiskGeometryFromBios,
82  DiskGeometryFromPort,
83  DiskGeometryFromNec98,
84  DiskGeometryGuessedFromBios,
85  DiskGeometryFromDefault
86 } DISK_GEOMETRY_SOURCE, *PDISK_GEOMETRY_SOURCE;
87 #endif
88 
89 //
90 
91 typedef struct _DISK_DATA {
92 
93  //
94  // This field is the ordinal of a partition as it appears on a disk.
95  //
96 
98 
99  //
100  // How has this disk been partitioned? Either EFI or MBR.
101  //
102 
104 
105  union {
106 
107  struct {
108 
109  //
110  // Disk signature (from MBR)
111  //
112 
114 
115  //
116  // MBR checksum
117  //
118 
120 
121  //
122  // Number of hidden sectors for BPB.
123  //
124 
126 
127  //
128  // Partition type of this device object
129  //
130  // This field is set by:
131  //
132  // 1. Initially set according to the partition list entry
133  // partition type returned by IoReadPartitionTable.
134  //
135  // 2. Subsequently set by the
136  // IOCTL_DISK_SET_PARTITION_INFORMATION I/O control
137  // function when IoSetPartitionInformation function
138  // successfully updates the partition type on the disk.
139  //
140 
142 
143  //
144  // Boot indicator - indicates whether this partition is a
145  // bootable (active) partition for this device
146  //
147  // This field is set according to the partition list entry boot
148  // indicator returned by IoReadPartitionTable.
149  //
150 
152 
153  } Mbr;
154 
155  struct {
156 
157  //
158  // The DiskGUID field from the EFI partition header.
159  //
160 
162 
163  //
164  // Partition type of this device object.
165  //
166 
168 
169  //
170  // Unique partition identifier for this partition.
171  //
172 
174 
175  //
176  // EFI partition attributes for this partition.
177  //
178 
180 
181  //
182  // EFI partition name of this partition.
183  //
184 
186 
187  } Efi;
188 
189  }; // unnamed union
190 
191  struct {
192  //
193  // This flag is set when the well known name is created (through
194  // DiskCreateSymbolicLinks) and cleared when destroying it
195  // (by calling DiskDeleteSymbolicLinks).
196  //
197 
199 
200  //
201  // This flag is set when the PhysicalDriveN link is created (through
202  // DiskCreateSymbolicLinks) and is cleared when destroying it (through
203  // DiskDeleteSymbolicLinks)
204  //
205 
207 
208  } LinkStatus;
209 
210  //
211  // ReadyStatus - STATUS_SUCCESS indicates that the drive is ready for
212  // use. Any error status is to be returned as an explanation for why
213  // a request is failed.
214  //
215  // This was done solely for the zero-length partition case of having no
216  // media in a removable disk drive. When that occurs, and a read is sent
217  // to the zero-length non-partition-zero PDO that was created, we had to
218  // be able to fail the request with a reasonable value. This may not have
219  // been the best way to do this, but it works.
220  //
221 
223 
224  //
225  // Routine to be called when updating the disk partitions. This routine
226  // is different for removable and non-removable media and is called by
227  // (among other things) DiskEnumerateDevice
228  //
229 
231 
232  //
233  // SCSI address used for SMART operations.
234  //
235 
237 
238  //
239  // Event used to synchronize partitioning operations and enumerations.
240  //
241 
243 
244  //
245  // These unicode strings hold the disk and volume interface strings. If
246  // the interfaces were not registered or could not be set then the string
247  // buffer will be NULL.
248  //
249 
252 
253  //
254  // What type of failure prediction mechanism is available
255  //
256 
259 
260 #if defined(_X86_)
261  //
262  // This flag indicates that a non-default geometry for this drive has
263  // already been determined by the disk driver. This field is ignored
264  // for removable media drives.
265  //
266 
267  DISK_GEOMETRY_SOURCE GeometrySource;
268 
269  //
270  // If GeometryDetermined is TRUE this will contain the geometry which was
271  // reported by the firmware or by the BIOS. For removable media drives
272  // this will contain the last geometry used when media was present.
273  //
274 
275  DISK_GEOMETRY RealGeometry;
276 #endif
277 
278  //
279  // Indicates that the cached partition table is valid when set.
280  //
281 
283 
284  //
285  // The cached partition table - this is only valid if the previous
286  // flag is set. When invalidated the cached partition table will be
287  // freed and replaced the next time one of the partitioning functions is
288  // called. This allows the error handling routines to invalidate it by
289  // setting the flag and doesn't require that they obtain a lock.
290  //
291 
293 
294  //
295  // This mutex prevents more than one IOCTL_DISK_VERIFY from being
296  // sent down to the disk. This greatly reduces the possibility of
297  // a Denial-of-Service attack
298  //
299 
301 
303 
304 // Define a general structure of identifying disk controllers with bad
305 // hardware.
306 //
307 
308 #define HackDisableTaggedQueuing (0x01)
309 #define HackDisableSynchronousTransfers (0x02)
310 #define HackDisableSpinDown (0x04)
311 #define HackDisableWriteCache (0x08)
312 #define HackCauseNotReportableHack (0x10)
313 #define HackRequiresStartUnitCommand (0x20)
314 #define HackDisableWriteCacheNotSupported (0x40)
315 
316 
317 #define DiskDeviceParameterSubkey L"Disk"
318 #define DiskDeviceSpecialFlags L"SpecialFlags"
319 #define DiskDeviceUserWriteCacheSetting L"UserWriteCacheSetting"
320 
321 
322 #define FUNCTIONAL_EXTENSION_SIZE sizeof(FUNCTIONAL_DEVICE_EXTENSION) + sizeof(DISK_DATA)
323 #define PHYSICAL_EXTENSION_SIZE sizeof(PHYSICAL_DEVICE_EXTENSION) + sizeof(DISK_DATA)
324 
325 #define MODE_DATA_SIZE 192
326 #define VALUE_BUFFER_SIZE 2048
327 #define SCSI_DISK_TIMEOUT 10
328 #define PARTITION0_LIST_SIZE 4
329 
330 #define MAX_MEDIA_TYPES 4
331 typedef struct _DISK_MEDIA_TYPES_LIST {
339 
340 //
341 // WMI reregistration structures used for reregister work item
342 //
343 typedef struct
344 {
349 
350 //
351 // Write cache setting as defined by the user
352 //
354 {
358 
360 
361 #define MAX_SECTORS_PER_VERIFY 0x200
362 
363 //
364 // This is based off 100ns units
365 //
366 #define ONE_MILLI_SECOND ((ULONGLONG)10 * 1000)
367 
368 //
369 // Context for the work-item
370 //
372 {
376 
378 
379 //
380 // Poll for Failure Prediction every hour
381 //
382 #define DISK_DEFAULT_FAILURE_POLLING_PERIOD 1 * 60 * 60
383 
384 //
385 // Static global lookup tables.
386 //
387 
390 
391 //
392 // Macros
393 //
394 
395 //
396 // Routine prototypes.
397 //
398 
399 NTSTATUS
400 NTAPI
404  );
405 
406 VOID
407 NTAPI
408 DiskUnload(
410  );
411 
412 NTSTATUS
413 NTAPI
417  );
418 
419 NTSTATUS
420 NTAPI
422  IN PDEVICE_OBJECT Fdo
423  );
424 
425 NTSTATUS
426 NTAPI
429  );
430 
431 NTSTATUS
432 NTAPI
434  IN PDEVICE_OBJECT Fdo
435  );
436 
437 NTSTATUS
438 NTAPI
441  );
442 
443 NTSTATUS
444 NTAPI
447  IN UCHAR Type
448  );
449 
450 NTSTATUS
451 NTAPI
454  IN UCHAR Type
455  );
456 
457 NTSTATUS
458 NTAPI
461  IN PIRP Irp
462  );
463 
464 NTSTATUS
465 NTAPI
468  IN PIRP Irp
469  );
470 
471 VOID
472 NTAPI
476  NTSTATUS *Status,
477  BOOLEAN *Retry
478  );
479 
480 NTSTATUS
481 NTAPI
484  IN PIRP Irp
485  );
486 
487 NTSTATUS
488 NTAPI
491  IN PDISK_CACHE_INFORMATION CacheInfo
492  );
493 
494 NTSTATUS
495 NTAPI
498  IN PDISK_CACHE_INFORMATION CacheInfo
499  );
500 
501 VOID
502 NTAPI
505  IN PIO_WORKITEM WorkItem
506  );
507 
508 VOID
509 NTAPI
513  );
514 
515 NTSTATUS
516 NTAPI
519  IN PCHAR ModeSelectBuffer,
520  IN ULONG Length,
521  IN BOOLEAN SavePage
522  );
523 
524 //
525 // We need to validate that the self test subcommand is valid and
526 // appropriate. Right now we allow subcommands 0, 1 and 2 which are non
527 // captive mode tests. Once we figure out a way to know if it is safe to
528 // run a captive test then we can allow captive mode tests. Also if the
529 // atapi 5 spec is ever updated to denote that bit 7 is the captive
530 // mode bit, we can allow any request that does not have bit 7 set. Until
531 // that is done we want to be sure
532 //
533 #define DiskIsValidSmartSelfTest(Subcommand) \
534  ( ((Subcommand) == SMART_OFFLINE_ROUTINE_OFFLINE) || \
535  ((Subcommand) == SMART_SHORT_SELFTEST_OFFLINE) || \
536  ((Subcommand) == SMART_EXTENDED_SELFTEST_OFFLINE) )
537 
538 
539 NTSTATUS
540 NTAPI
543  IN ULONG SrbControlCode,
544  IN UCHAR Command,
545  IN UCHAR Feature,
547  IN UCHAR SectorNumber,
548  IN OUT PSRB_IO_CONTROL SrbControl,
550  );
551 
552 NTSTATUS
553 NTAPI
556  OUT PMODE_INFO_EXCEPTIONS ReturnPageData
557  );
558 
559 NTSTATUS
560 NTAPI
563  IN PMODE_INFO_EXCEPTIONS PageData
564  );
565 
566 NTSTATUS
567 NTAPI
570  PFAILURE_PREDICTION_METHOD FailurePredictCapability
571  );
572 
573 BOOLEAN
574 NTAPI
576  IN PFUNCTIONAL_DEVICE_EXTENSION DeviceExtension,
577  HANDLE BusKey,
578  PULONG DiskNumber
579  );
580 
581 NTSTATUS
582 NTAPI
587  IN BOOLEAN DasdAccessOnly
588  );
589 
590 VOID
591 NTAPI
594  IN PIRP Irp
595  );
596 
597 VOID
598 NTAPI
602  );
603 
604 VOID
605 NTAPI
608  );
609 
610 VOID
611 NTAPI
612 ResetBus(
614  );
615 
616 NTSTATUS
617 NTAPI
619  IN PDEVICE_OBJECT Fdo
620  );
621 
622 NTSTATUS
623 NTAPI
627  IN PUNICODE_STRING UnicodeIdString
628  );
629 
630 NTSTATUS
631 NTAPI
635  );
636 
637 NTSTATUS
638 NTAPI
640  IN BOOLEAN IsFdo,
644  IN OPTIONAL PLARGE_INTEGER PartitionLength,
645  OUT PUCHAR *RawName
646  );
647 
648 VOID
649 NTAPI
652  );
653 
654 VOID
655 NTAPI
657  IN PDEVICE_OBJECT Fdo,
659  );
660 
661 VOID
662 NTAPI
664  IN PDEVICE_OBJECT Fdo,
666  );
667 
668 NTSTATUS
669 NTAPI
671  IN PDEVICE_OBJECT Fdo,
672  IN ULONG PartitionOrdinal,
673  IN PPARTITION_INFORMATION_EX PartitionEntry,
674  IN PARTITION_STYLE PartitionStyle,
676  );
677 
678 VOID
679 NTAPI
682  );
683 
684 NTSTATUS
685 NTAPI
688  OUT ULONG *RegFlags,
690  );
691 
692 NTSTATUS
693 NTAPI
696  IN PIRP Irp,
700  );
701 
702 NTSTATUS
703 NTAPI
706  IN PIRP Irp,
710  );
711 
712 NTSTATUS
713 NTAPI
716  IN PIRP Irp,
721  );
722 
723 NTSTATUS
724 NTAPI
727  IN PIRP Irp,
729  IN ULONG MethodId,
733  );
734 
735 NTSTATUS
736 NTAPI
739  OUT ULONG *RegFlags,
741  );
742 
743 NTSTATUS
744 NTAPI
747  OUT ULONG *RegFlags,
749  OUT PUNICODE_STRING MofName
750  );
751 
752 NTSTATUS
753 NTAPI
756  IN PIRP Irp,
760  );
761 
762 NTSTATUS
763 NTAPI
766  IN PIRP Irp,
770  );
771 
772 NTSTATUS
773 NTAPI
776  IN PIRP Irp,
781  );
782 
783 NTSTATUS
784 NTAPI
787  IN PIRP Irp,
789  IN ULONG MethodId,
793  );
794 
795 NTSTATUS
796 NTAPI
799  IN PIRP Irp,
803  );
804 
805 NTSTATUS
806 NTAPI
809  PSTORAGE_FAILURE_PREDICT_STATUS DiskSmartStatus
810  );
811 
812 NTSTATUS
813 NTAPI
816  PSTORAGE_FAILURE_PREDICT_DATA DiskSmartData
817  );
818 
819 NTSTATUS
820 NTAPI
824  );
825 
826 NTSTATUS
827 NTAPI
830  BOOLEAN Enable,
831  ULONG PollTimeInSeconds
832  );
833 
834 VOID
835 NTAPI
838  );
839 
840 VOID
841 NTAPI
844  );
845 
847  void
848  );
849 
852 
853 #if defined(_X86_)
854 NTSTATUS
855 NTAPI
857  IN PDEVICE_OBJECT Fdo
858  );
859 #else
860 #define DiskReadDriveCapacity(Fdo) ClassReadDriveCapacity(Fdo)
861 #endif
862 
863 
864 #if defined(_X86_)
865 
866 #if 0
867 NTSTATUS
868 DiskQuerySuggestedLinkName(
870  IN PIRP Irp
871  );
872 #endif
873 
874 NTSTATUS
875 NTAPI
876 DiskSaveDetectInfo(
878  );
879 
880 VOID
881 NTAPI
882 DiskCleanupDetectInfo(
884  );
885 
886 VOID
887 NTAPI
888 DiskDriverReinitialization (
890  IN PVOID Nothing,
891  IN ULONG Count
892  );
893 
894 #endif
895 
896 VOID
897 NTAPI
899  IN PPARTITION_INFORMATION Partition,
900  OUT PPARTITION_INFORMATION_EX PartitionEx
901  );
902 
904 NTAPI
907  );
908 
910 NTAPI
913  );
914 
915 NTSTATUS
916 NTAPI
919  IN BOOLEAN BypassCache,
920  OUT PDRIVE_LAYOUT_INFORMATION_EX* DriveLayout
921  );
922 
923 NTSTATUS
924 NTAPI
927  IN PDRIVE_LAYOUT_INFORMATION_EX DriveLayout
928  );
929 
930 NTSTATUS
931 NTAPI
936  );
937 
938 NTSTATUS
939 NTAPI
945  );
946 
947 NTSTATUS
948 NTAPI
952  );
953 
954 BOOLEAN
955 NTAPI
958  IN BOOLEAN PartitionLockHeld
959  );
960 
961 #if defined (_X86_)
962 NTSTATUS
963 NTAPI
966  OUT PDISK_DETECTION_INFO DetectInfo
967  );
968 
969 NTSTATUS
970 NTAPI
971 DiskReadSignature(
972  IN PDEVICE_OBJECT Fdo
973  );
974 
975 #else
976 #define DiskGetDetectInfo(FdoExtension, DetectInfo) (STATUS_UNSUCCESSFUL)
977 #endif
978 
979 
980 #define DiskHashGuid(Guid) (((PULONG) &Guid)[0] ^ ((PULONG) &Guid)[0] ^ ((PULONG) &Guid)[0] ^ ((PULONG) &Guid)[0])
981 
982 #endif /* _DISK_NEW_H_ */
#define DiskGetDetectInfo(FdoExtension, DetectInfo)
Definition: disk.h:976
signed char * PCHAR
Definition: retypes.h:7
VOID NTAPI DiskUpdatePartitions(IN PDEVICE_OBJECT Fdo, IN OUT PDRIVE_LAYOUT_INFORMATION_EX PartitionList)
Definition: enum.c:592
CLASSPNP_SCAN_FOR_SPECIAL_INFO DiskBadControllers[]
Definition: data.c:38
struct _DISK_DATA::@1020 LinkStatus
GUID PartitionId
Definition: disk.h:173
#define IN
Definition: typedefs.h:39
NTSTATUS NTAPI DiskDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
enum _BUS_QUERY_ID_TYPE BUS_QUERY_ID_TYPE
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:301
Type
Definition: Type.h:6
NTSTATUS NTAPI DiskFdoQueryWmiRegInfo(IN PDEVICE_OBJECT DeviceObject, OUT ULONG *RegFlags, OUT PUNICODE_STRING InstanceName)
Definition: diskwmi.c:2014
NTSTATUS NTAPI DiskStartFdo(IN PDEVICE_OBJECT Fdo)
Definition: pnp.c:1162
PDRIVE_LAYOUT_INFORMATION_EX CachedPartitionTable
Definition: disk.h:292
VOID NTAPI DiskConvertPartitionToExtended(IN PPARTITION_INFORMATION Partition, OUT PPARTITION_INFORMATION_EX PartitionEx)
Definition: enum.c:102
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:282
NTSTATUS NTAPI DiskEnableDisableFailurePredictPolling(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, BOOLEAN Enable, ULONG PollTimeInSeconds)
Definition: diskwmi.c:949
Definition: ntbasedef.h:635
_In_ PIRP Irp
Definition: csq.h:116
_In_ PIRP _In_ ULONG _In_ ULONG DataItemId
Definition: classpnp.h:419
BOOLEAN BootIndicator
Definition: disk.c:104
NTSTATUS NTAPI DiskGetInfoExceptionInformation(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, OUT PMODE_INFO_EXCEPTIONS ReturnPageData)
NTSTATUS NTAPI DiskEnumerateDevice(IN PDEVICE_OBJECT Fdo)
Definition: enum.c:223
unsigned char * PUCHAR
Definition: retypes.h:3
_In_z_ PCCHAR _In_ PDEVICE_OBJECT _In_ BOOLEAN IsFdo
Definition: classpnp.h:789
NTSTATUS ReadyStatus
Definition: disk.h:222
PDEVICE_OBJECT DeviceObject
Definition: disk.h:346
NTSTATUS NTAPI DiskSetCacheInformation(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN PDISK_CACHE_INFORMATION CacheInfo)
Definition: disk.c:4432
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
VOID NTAPI DiskScanRegistryForSpecial(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: disk.c:4112
VOID NTAPI UpdateDeviceObjects(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: disk.c:4978
SCSI_ADDRESS ScsiAddress
Definition: disk.h:236
ULONG64 Attributes
Definition: disk.h:179
VOID NTAPI DiskSetSpecialHacks(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN ULONG_PTR Data)
Definition: disk.c:4009
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG OutBufferSize
Definition: classpnp.h:429
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
NTSTATUS NTAPI DiskPdoQueryWmiRegInfo(IN PDEVICE_OBJECT DeviceObject, OUT ULONG *RegFlags, OUT PUNICODE_STRING InstanceName)
VOID NTAPI DiskUnload(IN PDRIVER_OBJECT DriverObject)
Definition: disk.c:361
struct _DISK_MEDIA_TYPES_LIST DISK_MEDIA_TYPES_LIST
NTSTATUS NTAPI DiskModeSelect(IN PDEVICE_OBJECT DeviceObject, IN PCHAR ModeSelectBuffer, IN ULONG Length, IN BOOLEAN SavePage)
Definition: disk.c:3475
NTSTATUS NTAPI DiskInitPdo(IN PDEVICE_OBJECT Pdo)
Definition: pnp.c:561
ULONG HiddenSectors
Definition: disk.c:64
WCHAR PartitionName[36]
Definition: disk.h:185
NTSTATUS NTAPI DiskStopDevice(IN PDEVICE_OBJECT DeviceObject, IN UCHAR Type)
Definition: pnp.c:640
Definition: shell.h:41
GUID PartitionType
Definition: disk.h:167
NTSTATUS NTAPI DiskFdoQueryWmiRegInfoEx(IN PDEVICE_OBJECT DeviceObject, OUT ULONG *RegFlags, OUT PUNICODE_STRING InstanceName, OUT PUNICODE_STRING MofName)
Definition: diskwmi.c:2112
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
VOID NTAPI DiskCreateSymbolicLinks(IN PDEVICE_OBJECT DeviceObject)
Definition: pnp.c:864
NTSTATUS NTAPI DiskFdoQueryWmiDataBlock(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG BufferAvail, OUT PUCHAR Buffer)
Definition: diskwmi.c:2170
BOOLEAN AllowFPPerfHit
Definition: disk.h:258
NTSTATUS NTAPI DiskFdoSetWmiDataItem(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG DataItemId, IN ULONG BufferSize, IN PUCHAR Buffer)
Definition: diskwmi.c:2507
ULONG PartitionOrdinal
Definition: disk.c:79
const DISK_MEDIA_TYPES_LIST DiskMediaTypes[]
Definition: data.c:68
enum _STORAGE_MEDIA_TYPE STORAGE_MEDIA_TYPE
PDISK_UPDATE_PARTITIONS UpdatePartitionRoutine
Definition: disk.h:230
uint32_t ULONG_PTR
Definition: typedefs.h:64
UNICODE_STRING PartitionInterfaceString
Definition: disk.h:251
PDRIVE_LAYOUT_INFORMATION NTAPI DiskConvertExtendedToLayout(IN CONST PDRIVE_LAYOUT_INFORMATION_EX LayoutEx)
Definition: enum.c:40
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
struct _DISK_VERIFY_WORKITEM_CONTEXT * PDISK_VERIFY_WORKITEM_CONTEXT
NTSTATUS NTAPI DiskSetPartitionInformation(IN PFUNCTIONAL_DEVICE_EXTENSION Fdo, IN ULONG SectorSize, IN ULONG PartitionNumber, IN ULONG PartitionType)
Definition: part.c:270
ULONG DeviceCount
Definition: mpu401.c:26
NTSTATUS NTAPI DiskVerifyPartitionTable(IN PFUNCTIONAL_DEVICE_EXTENSION Fdo, IN BOOLEAN FixErrors)
Definition: part.c:317
#define MAX_MEDIA_TYPES
Definition: disk.h:330
unsigned char BOOLEAN
NTSTATUS NTAPI DiskGetCacheInformation(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN PDISK_CACHE_INFORMATION CacheInfo)
Definition: disk.c:4314
_Out_ ULONG * RegFlags
Definition: classpnp.h:386
const ULONG NumberOfTypes
Definition: disk.h:335
UCHAR PartitionType
Definition: disk.c:94
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
_In_ PIRP _In_ ULONG GuidIndex
Definition: classpnp.h:401
IN PSCSI_REQUEST_BLOCK IN OUT NTSTATUS IN OUT BOOLEAN * Retry
Definition: class2.h:49
NTSTATUS NTAPI DiskGenerateDeviceName(IN BOOLEAN IsFdo, IN ULONG DeviceNumber, IN OPTIONAL ULONG PartitionNumber, IN OPTIONAL PLARGE_INTEGER StartingOffset, IN OPTIONAL PLARGE_INTEGER PartitionLength, OUT PUCHAR *RawName)
Definition: pnp.c:783
Definition: bufpool.h:45
_In_ BUS_QUERY_ID_TYPE IdType
Definition: classpnp.h:357
NTSTATUS NTAPI DiskInitFdo(IN PDEVICE_OBJECT Fdo)
Definition: pnp.c:190
KEVENT PartitioningEvent
Definition: disk.h:242
struct _DISK_DATA DISK_DATA
const STORAGE_MEDIA_TYPE MediaTypes[MAX_MEDIA_TYPES]
Definition: disk.h:337
PARTITION_STYLE PartitionStyle
Definition: disk.h:103
_In_ PIRP _In_ ULONG _In_ ULONG MethodId
Definition: classpnp.h:429
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG InBufferSize
Definition: classpnp.h:429
NTSTATUS NTAPI DiskSetInfoExceptionInformation(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN PMODE_INFO_EXCEPTIONS PageData)
Definition: disk.c:4954
GUIDREGINFO DiskWmiPdoGuidList[]
PSCSI_REQUEST_BLOCK Srb
Definition: disk.h:374
ULONG Signature
Definition: disk.c:52
NTSTATUS NTAPI DiskReadFailurePredictData(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, PSTORAGE_FAILURE_PREDICT_DATA DiskSmartData)
Definition: diskwmi.c:1083
struct _DISK_MEDIA_TYPES_LIST * PDISK_MEDIA_TYPES_LIST
NTSTATUS NTAPI DiskAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT Pdo)
Definition: pnp.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSTATUS NTAPI DiskReadWriteVerification(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: disk.c:647
#define DiskReadDriveCapacity(Fdo)
Definition: disk.h:860
NTSTATUS NTAPI DiskPdoSetWmiDataItem(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG DataItemId, IN ULONG BufferSize, IN PUCHAR Buffer)
NTSTATUS NTAPI DiskQueryPnpCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_CAPABILITIES Capabilities)
Definition: disk.c:4272
NTSTATUS NTAPI DiskDetectFailurePrediction(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, PFAILURE_PREDICTION_METHOD FailurePredictCapability)
Definition: diskwmi.c:1778
enum FAILURE_PREDICTION_METHOD * PFAILURE_PREDICTION_METHOD
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2101
#define BufferSize
Definition: classpnp.h:419
NTSTATUS NTAPI DiskInitializeReregistration(void)
Definition: diskwmi.c:1301
enum _DISK_USER_WRITE_CACHE_SETTING * PDISK_USER_WRITE_CACHE_SETTING
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOLEAN PhysicalDriveLinkCreated
Definition: disk.h:206
static PPARTLIST PartitionList
Definition: usetup.c:73
PDRIVE_LAYOUT_INFORMATION_EX NTAPI DiskConvertLayoutToExtended(IN CONST PDRIVE_LAYOUT_INFORMATION Layout)
Definition: enum.c:147
unsigned __int64 ULONG64
Definition: imports.h:198
NTSTATUS NTAPI DiskFdoExecuteWmiMethod(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG MethodId, IN ULONG InBufferSize, IN ULONG OutBufferSize, IN PUCHAR Buffer)
Definition: diskwmi.c:2576
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI DiskQueryId(IN PDEVICE_OBJECT Pdo, IN BUS_QUERY_ID_TYPE IdType, IN PUNICODE_STRING UnicodeIdString)
Definition: pnp.c:659
NTSTATUS NTAPI DiskPdoExecuteWmiMethod(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG MethodId, IN ULONG InBufferSize, IN ULONG OutBufferSize, IN PUCHAR Buffer)
SINGLE_LIST_ENTRY Next
Definition: disk.h:345
CLASSENABLEDISABLEFUNCTION
Definition: classpnp.h:224
#define VOID
Definition: acefi.h:82
struct _DISK_DATA * PDISK_DATA
_In_z_ PCCHAR _In_ PDEVICE_OBJECT LowerDeviceObject
Definition: classpnp.h:789
VOID NTAPI DiskFdoProcessError(PDEVICE_OBJECT DeviceObject, PSCSI_REQUEST_BLOCK Srb, NTSTATUS *Status, BOOLEAN *Retry)
Definition: disk.c:3803
enum _PARTITION_STYLE PARTITION_STYLE
VOID NTAPI DiskReleasePartitioningLock(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: enum.c:1234
FAILURE_PREDICTION_METHOD FailurePredictionCapability
Definition: disk.h:257
NTSTATUS NTAPI DiskPerformSmartCommand(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, IN ULONG SrbControlCode, IN UCHAR Command, IN UCHAR Feature, IN UCHAR SectorCount, IN UCHAR SectorNumber, IN OUT PSRB_IO_CONTROL SrbControl, OUT PULONG BufferSize)
Definition: diskwmi.c:493
const ULONG NumberOfSides
Definition: disk.h:336
_In_ PIRP _In_ ULONG _In_ ULONG BufferAvail
Definition: classpnp.h:401
NTSTATUS NTAPI DiskPdoQueryWmiDataBlock(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG BufferAvail, OUT PUCHAR Buffer)
VOID NTAPI DiskIoctlVerify(IN PDEVICE_OBJECT DeviceObject, IN PDISK_VERIFY_WORKITEM_CONTEXT Context)
Definition: disk.c:3688
NTSTATUS NTAPI DiskShutdownFlush(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: disk.c:3285
NTSTATUS NTAPI DiskCreatePdo(IN PDEVICE_OBJECT Fdo, IN ULONG PartitionOrdinal, IN PPARTITION_INFORMATION_EX PartitionEntry, IN PARTITION_STYLE PartitionStyle, OUT PDEVICE_OBJECT *Pdo)
Definition: enum.c:1025
ULONG SectorCount
Definition: part_xbox.c:31
NTSTATUS NTAPI DiskSetPartitionInformationEx(IN PFUNCTIONAL_DEVICE_EXTENSION Fdo, IN ULONG PartitionNumber, IN struct _SET_PARTITION_INFORMATION_EX *PartitionInfo)
Definition: part.c:245
NTSTATUS NTAPI DiskEnableDisableFailurePrediction(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, BOOLEAN Enable)
Definition: diskwmi.c:885
* PDEVICE_CAPABILITIES
Definition: iotypes.h:928
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS NTAPI DiskFdoSetWmiDataBlock(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG BufferSize, IN PUCHAR Buffer)
Definition: diskwmi.c:2402
GUIDREGINFO DiskWmiFdoGuidList[]
Definition: diskwmi.c:96
struct _DISK_DATA::@1018::@1022 Efi
NTSTATUS NTAPI DiskWmiFunctionControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN CLASSENABLEDISABLEFUNCTION Function, IN BOOLEAN Enable)
Definition: diskwmi.c:1901
VOID NTAPI ResetBus(IN PDEVICE_OBJECT DeviceObject)
Definition: disk.c:4162
VOID NTAPI DiskDeleteSymbolicLinks(IN PDEVICE_OBJECT DeviceObject)
Definition: pnp.c:988
VOID(NTAPI * PDISK_UPDATE_PARTITIONS)(IN PDEVICE_OBJECT Fdo, IN OUT PDRIVE_LAYOUT_INFORMATION_EX PartitionList)
Definition: disk.h:68
struct _DISK_VERIFY_WORKITEM_CONTEXT DISK_VERIFY_WORKITEM_CONTEXT
NTSTATUS NTAPI DiskStartPdo(IN PDEVICE_OBJECT Pdo)
Definition: pnp.c:619
NTSTATUS NTAPI DiskCreateFdo(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT LowerDeviceObject, IN PULONG DeviceCount, IN BOOLEAN DasdAccessOnly)
Definition: disk.c:375
unsigned int * PULONG
Definition: retypes.h:1
VOID NTAPI DiskUpdateRemovablePartitions(IN PDEVICE_OBJECT Fdo, IN OUT PDRIVE_LAYOUT_INFORMATION_EX PartitionList)
Definition: enum.c:364
FAILURE_PREDICTION_METHOD
Definition: classpnp.h:229
enum _DISK_USER_WRITE_CACHE_SETTING DISK_USER_WRITE_CACHE_SETTING
BOOLEAN NTAPI EnumerateBusKey(IN PFUNCTIONAL_DEVICE_EXTENSION DeviceExtension, HANDLE BusKey, PULONG DiskNumber)
BOOL FixErrors
Definition: chkdsk.c:69
NTSTATUS NTAPI DiskReadPartitionTableEx(IN PFUNCTIONAL_DEVICE_EXTENSION Fdo, IN BOOLEAN BypassCache, OUT PDRIVE_LAYOUT_INFORMATION_EX *DriveLayout)
Definition: part.c:49
struct _DISK_DATA::@1018::@1021 Mbr
struct DISKREREGREQUEST * PDISKREREGREQUEST
VOID NTAPI DisableWriteCache(IN PDEVICE_OBJECT DeviceObject, IN PIO_WORKITEM WorkItem)
Definition: disk.c:3616
_Must_inspect_result_ _Inout_ PFLT_VOLUME _In_opt_ PCUNICODE_STRING InstanceName
Definition: fltkernel.h:1162
#define OUT
Definition: typedefs.h:40
CHAR PartitionType
Definition: part_xbox.c:32
PIO_WORKITEM WorkItem
Definition: disk.h:375
unsigned int ULONG
Definition: retypes.h:1
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:28
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: beep.c:367
BOOLEAN WellKnownNameCreated
Definition: disk.h:198
NTSTATUS NTAPI DiskWritePartitionTableEx(IN PFUNCTIONAL_DEVICE_EXTENSION Fdo, IN PDRIVE_LAYOUT_INFORMATION_EX DriveLayout)
Definition: part.c:199
_In_ ULONG SectorSize
Definition: halfuncs.h:291
ULONG MbrCheckSum
Definition: disk.c:58
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1036
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
GUID DiskId
Definition: disk.h:161
NTSTATUS NTAPI DiskRemoveDevice(IN PDEVICE_OBJECT DeviceObject, IN UCHAR Type)
Definition: pnp.c:1054
ULONG CachedPartitionTableValid
Definition: disk.h:282
KMUTEX VerifyMutex
Definition: disk.h:300
BOOLEAN NTAPI DiskInvalidatePartitionTable(IN PFUNCTIONAL_DEVICE_EXTENSION Fdo, IN BOOLEAN PartitionLockHeld)
Definition: part.c:291
VOID NTAPI DiskAcquirePartitioningLock(IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension)
Definition: enum.c:1214
NTSTATUS NTAPI DiskReadFailurePredictStatus(PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, PSTORAGE_FAILURE_PREDICT_STATUS DiskSmartStatus)
Definition: diskwmi.c:1007
#define CONST
Definition: pedump.c:81
NTSTATUS NTAPI DiskPdoSetWmiDataBlock(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG BufferSize, IN PUCHAR Buffer)
UNICODE_STRING DiskInterfaceString
Definition: disk.h:250
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
_DISK_USER_WRITE_CACHE_SETTING
Definition: disk.h:353