1extern char __VERIFIER_nondet_char(void);
2extern int __VERIFIER_nondet_int(void);
3extern long __VERIFIER_nondet_long(void);
4extern void *__VERIFIER_nondet_pointer(void);
5
6
7
8#pragma pack(push,8)
9typedef unsigned int size_t;
10typedef unsigned short wchar_t;
11#pragma pack(pop)
12#pragma pack(push,8)
13#pragma pack(pop)
14typedef unsigned long ULONG_PTR;
15typedef unsigned long *PULONG_PTR;
16typedef ULONG_PTR SIZE_T;
17typedef void *PVOID;
18typedef char CHAR;
19typedef short SHORT;
20typedef long LONG;
21typedef wchar_t WCHAR;
22typedef WCHAR *PWSTR;
23typedef WCHAR const *PCWSTR;
24typedef CHAR *PCHAR;
25typedef LONG *PLONG;
26typedef unsigned char UCHAR;
27typedef unsigned short USHORT;
28typedef unsigned long ULONG;
29typedef UCHAR *PUCHAR;
30typedef ULONG *PULONG;
31typedef void *HANDLE;
32typedef HANDLE *PHANDLE;
33typedef char CCHAR;
34typedef short CSHORT;
35typedef ULONG LCID;
36typedef LONG NTSTATUS;
37typedef long long LONGLONG;
38struct __anonstruct____missing_field_name_1 {
39 ULONG LowPart ;
40 LONG HighPart ;
41};
42struct __anonstruct_u_2 {
43 ULONG LowPart ;
44 LONG HighPart ;
45};
46union _LARGE_INTEGER {
47 struct __anonstruct____missing_field_name_1 __annonCompField1 ;
48 struct __anonstruct_u_2 u ;
49 LONGLONG QuadPart ;
50};
51typedef union _LARGE_INTEGER LARGE_INTEGER;
52typedef LARGE_INTEGER *PLARGE_INTEGER;
53struct _LUID {
54 ULONG LowPart ;
55 LONG HighPart ;
56};
57typedef struct _LUID LUID;
58typedef LARGE_INTEGER PHYSICAL_ADDRESS;
59enum _EVENT_TYPE {
60 NotificationEvent = 0,
61 SynchronizationEvent = 1
62} ;
63typedef enum _EVENT_TYPE EVENT_TYPE;
64typedef char const *PCSZ;
65struct _STRING {
66 USHORT Length ;
67 USHORT MaximumLength ;
68 PCHAR Buffer ;
69};
70typedef struct _STRING STRING;
71typedef STRING *PSTRING;
72typedef PSTRING PANSI_STRING;
73struct _UNICODE_STRING {
74 USHORT Length ;
75 USHORT MaximumLength ;
76 PWSTR Buffer ;
77};
78typedef struct _UNICODE_STRING UNICODE_STRING;
79typedef UNICODE_STRING *PUNICODE_STRING;
80typedef UCHAR BOOLEAN;
81struct _LIST_ENTRY {
82 struct _LIST_ENTRY *Flink ;
83 struct _LIST_ENTRY *Blink ;
84};
85typedef struct _LIST_ENTRY LIST_ENTRY;
86typedef struct _LIST_ENTRY *PLIST_ENTRY;
87struct _OBJECT_ATTRIBUTES {
88 ULONG Length ;
89 HANDLE RootDirectory ;
90 PUNICODE_STRING ObjectName ;
91 ULONG Attributes ;
92 PVOID SecurityDescriptor ;
93 PVOID SecurityQualityOfService ;
94};
95typedef struct _OBJECT_ATTRIBUTES OBJECT_ATTRIBUTES;
96typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
97struct _GUID {
98 unsigned long Data1 ;
99 unsigned short Data2 ;
100 unsigned short Data3 ;
101 unsigned char Data4[8] ;
102};
103typedef struct _GUID GUID;
104typedef UCHAR KIRQL;
105enum _NT_PRODUCT_TYPE {
106 NtProductWinNt = 1,
107 NtProductLanManNt = 2,
108 NtProductServer = 3
109} ;
110typedef enum _NT_PRODUCT_TYPE NT_PRODUCT_TYPE;
111struct _KTHREAD;
112typedef struct _KTHREAD *PKTHREAD;
113struct _ETHREAD;
114typedef struct _ETHREAD *PETHREAD;
115struct _EPROCESS;
116typedef struct _EPROCESS *PEPROCESS;
117struct _IO_TIMER;
118typedef struct _IO_TIMER *PIO_TIMER;
119struct _OBJECT_TYPE;
120typedef struct _OBJECT_TYPE *POBJECT_TYPE;
121typedef CCHAR KPROCESSOR_MODE;
122struct _KAPC;
123struct _KAPC;
124typedef void (*PKNORMAL_ROUTINE)(PVOID NormalContext , PVOID SystemArgument1 , PVOID SystemArgument2 );
125struct _KAPC {
126 CSHORT Type ;
127 CSHORT Size ;
128 ULONG Spare0 ;
129 struct _KTHREAD *Thread ;
130 LIST_ENTRY ApcListEntry ;
131 void (*KernelRoutine)(struct _KAPC *Apc , PKNORMAL_ROUTINE *NormalRoutine , PVOID *NormalContext ,
132 PVOID *SystemArgument1 , PVOID *SystemArgument2 ) ;
133 void (*RundownRoutine)(struct _KAPC *Apc ) ;
134 void (*NormalRoutine)(PVOID NormalContext , PVOID SystemArgument1 , PVOID SystemArgument2 ) ;
135 PVOID NormalContext ;
136 PVOID SystemArgument1 ;
137 PVOID SystemArgument2 ;
138 CCHAR ApcStateIndex ;
139 KPROCESSOR_MODE ApcMode ;
140 BOOLEAN Inserted ;
141};
142typedef struct _KAPC KAPC;
143struct _KDPC;
144struct _KDPC;
145struct _KDPC {
146 CSHORT Type ;
147 UCHAR Number ;
148 UCHAR Importance ;
149 LIST_ENTRY DpcListEntry ;
150 void (*DeferredRoutine)(struct _KDPC *Dpc , PVOID DeferredContext , PVOID SystemArgument1 ,
151 PVOID SystemArgument2 ) ;
152 PVOID DeferredContext ;
153 PVOID SystemArgument1 ;
154 PVOID SystemArgument2 ;
155 PULONG_PTR Lock ;
156};
157typedef struct _KDPC KDPC;
158typedef struct _KDPC *PKDPC;
159struct _MDL {
160 struct _MDL *Next ;
161 CSHORT Size ;
162 CSHORT MdlFlags ;
163 struct _EPROCESS *Process ;
164 PVOID MappedSystemVa ;
165 PVOID StartVa ;
166 ULONG ByteCount ;
167 ULONG ByteOffset ;
168};
169typedef struct _MDL MDL;
170typedef struct _MDL *PMDL;
171typedef PVOID PACCESS_TOKEN;
172typedef PVOID PSECURITY_DESCRIPTOR;
173typedef ULONG ACCESS_MASK;
174#pragma pack(push,4)
175struct _LUID_AND_ATTRIBUTES {
176 LUID Luid ;
177 ULONG Attributes ;
178};
179typedef struct _LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES;
180#pragma pack(pop)
181struct _PRIVILEGE_SET {
182 ULONG PrivilegeCount ;
183 ULONG Control ;
184 LUID_AND_ATTRIBUTES Privilege[1] ;
185};
186typedef struct _PRIVILEGE_SET PRIVILEGE_SET;
187enum _SECURITY_IMPERSONATION_LEVEL {
188 SecurityAnonymous = 0,
189 SecurityIdentification = 1,
190 SecurityImpersonation = 2,
191 SecurityDelegation = 3
192} ;
193typedef enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL;
194typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE;
195struct _SECURITY_QUALITY_OF_SERVICE {
196 ULONG Length ;
197 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel ;
198 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode ;
199 BOOLEAN EffectiveOnly ;
200};
201typedef struct _SECURITY_QUALITY_OF_SERVICE *PSECURITY_QUALITY_OF_SERVICE;
202typedef ULONG SECURITY_INFORMATION;
203typedef LONG KPRIORITY;
204typedef ULONG_PTR KSPIN_LOCK;
205typedef KSPIN_LOCK *PKSPIN_LOCK;
206struct _RTL_QUERY_REGISTRY_TABLE {
207 NTSTATUS (*QueryRoutine)(PWSTR ValueName , ULONG ValueType ,
208 PVOID ValueData , ULONG ValueLength ,
209 PVOID Context , PVOID EntryContext ) ;
210 ULONG Flags ;
211 PWSTR Name ;
212 PVOID EntryContext ;
213 ULONG DefaultType ;
214 PVOID DefaultData ;
215 ULONG DefaultLength ;
216};
217typedef struct _RTL_QUERY_REGISTRY_TABLE RTL_QUERY_REGISTRY_TABLE;
218typedef struct _RTL_QUERY_REGISTRY_TABLE *PRTL_QUERY_REGISTRY_TABLE;
219union __anonunion____missing_field_name_6 {
220 NTSTATUS Status ;
221 PVOID Pointer ;
222};
223struct _IO_STATUS_BLOCK {
224 union __anonunion____missing_field_name_6 __annonCompField4 ;
225 ULONG_PTR Information ;
226};
227typedef struct _IO_STATUS_BLOCK IO_STATUS_BLOCK;
228typedef struct _IO_STATUS_BLOCK *PIO_STATUS_BLOCK;
229enum _FILE_INFORMATION_CLASS {
230 FileDirectoryInformation = 1,
231 FileFullDirectoryInformation = 2,
232 FileBothDirectoryInformation = 3,
233 FileBasicInformation = 4,
234 FileStandardInformation = 5,
235 FileInternalInformation = 6,
236 FileEaInformation = 7,
237 FileAccessInformation = 8,
238 FileNameInformation = 9,
239 FileRenameInformation = 10,
240 FileLinkInformation = 11,
241 FileNamesInformation = 12,
242 FileDispositionInformation = 13,
243 FilePositionInformation = 14,
244 FileFullEaInformation = 15,
245 FileModeInformation = 16,
246 FileAlignmentInformation = 17,
247 FileAllInformation = 18,
248 FileAllocationInformation = 19,
249 FileEndOfFileInformation = 20,
250 FileAlternateNameInformation = 21,
251 FileStreamInformation = 22,
252 FilePipeInformation = 23,
253 FilePipeLocalInformation = 24,
254 FilePipeRemoteInformation = 25,
255 FileMailslotQueryInformation = 26,
256 FileMailslotSetInformation = 27,
257 FileCompressionInformation = 28,
258 FileObjectIdInformation = 29,
259 FileCompletionInformation = 30,
260 FileMoveClusterInformation = 31,
261 FileQuotaInformation = 32,
262 FileReparsePointInformation = 33,
263 FileNetworkOpenInformation = 34,
264 FileAttributeTagInformation = 35,
265 FileTrackingInformation = 36,
266 FileMaximumInformation = 37
267} ;
268typedef enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS;
269struct _FILE_BASIC_INFORMATION {
270 LARGE_INTEGER CreationTime ;
271 LARGE_INTEGER LastAccessTime ;
272 LARGE_INTEGER LastWriteTime ;
273 LARGE_INTEGER ChangeTime ;
274 ULONG FileAttributes ;
275};
276typedef struct _FILE_BASIC_INFORMATION *PFILE_BASIC_INFORMATION;
277struct _FILE_STANDARD_INFORMATION {
278 LARGE_INTEGER AllocationSize ;
279 LARGE_INTEGER EndOfFile ;
280 ULONG NumberOfLinks ;
281 BOOLEAN DeletePending ;
282 BOOLEAN Directory ;
283};
284typedef struct _FILE_STANDARD_INFORMATION *PFILE_STANDARD_INFORMATION;
285struct _FILE_NETWORK_OPEN_INFORMATION {
286 LARGE_INTEGER CreationTime ;
287 LARGE_INTEGER LastAccessTime ;
288 LARGE_INTEGER LastWriteTime ;
289 LARGE_INTEGER ChangeTime ;
290 LARGE_INTEGER AllocationSize ;
291 LARGE_INTEGER EndOfFile ;
292 ULONG FileAttributes ;
293};
294typedef struct _FILE_NETWORK_OPEN_INFORMATION *PFILE_NETWORK_OPEN_INFORMATION;
295enum _FSINFOCLASS {
296 FileFsVolumeInformation = 1,
297 FileFsLabelInformation = 2,
298 FileFsSizeInformation = 3,
299 FileFsDeviceInformation = 4,
300 FileFsAttributeInformation = 5,
301 FileFsControlInformation = 6,
302 FileFsFullSizeInformation = 7,
303 FileFsObjectIdInformation = 8,
304 FileFsMaximumInformation = 9
305} ;
306typedef enum _FSINFOCLASS FS_INFORMATION_CLASS;
307enum _INTERFACE_TYPE {
308 InterfaceTypeUndefined = -1,
309 Internal = 0,
310 Isa = 1,
311 Eisa = 2,
312 MicroChannel = 3,
313 TurboChannel = 4,
314 PCIBus = 5,
315 VMEBus = 6,
316 NuBus = 7,
317 PCMCIABus = 8,
318 CBus = 9,
319 MPIBus = 10,
320 MPSABus = 11,
321 ProcessorInternal = 12,
322 InternalPowerBus = 13,
323 PNPISABus = 14,
324 PNPBus = 15,
325 MaximumInterfaceType = 16
326} ;
327typedef enum _INTERFACE_TYPE INTERFACE_TYPE;
328typedef enum _INTERFACE_TYPE *PINTERFACE_TYPE;
329struct _KEY_VALUE_FULL_INFORMATION {
330 ULONG TitleIndex ;
331 ULONG Type ;
332 ULONG DataOffset ;
333 ULONG DataLength ;
334 ULONG NameLength ;
335 WCHAR Name[1] ;
336};
337typedef struct _KEY_VALUE_FULL_INFORMATION *PKEY_VALUE_FULL_INFORMATION;
338struct _CLIENT_ID {
339 HANDLE UniqueProcess ;
340 HANDLE UniqueThread ;
341};
342typedef struct _CLIENT_ID CLIENT_ID;
343typedef CLIENT_ID *PCLIENT_ID;
344enum _SYSTEM_POWER_STATE {
345 PowerSystemUnspecified = 0,
346 PowerSystemWorking = 1,
347 PowerSystemSleeping1 = 2,
348 PowerSystemSleeping2 = 3,
349 PowerSystemSleeping3 = 4,
350 PowerSystemHibernate = 5,
351 PowerSystemShutdown = 6,
352 PowerSystemMaximum = 7
353} ;
354typedef enum _SYSTEM_POWER_STATE SYSTEM_POWER_STATE;
355enum __anonenum_POWER_ACTION_11 {
356 PowerActionNone = 0,
357 PowerActionReserved = 1,
358 PowerActionSleep = 2,
359 PowerActionHibernate = 3,
360 PowerActionShutdown = 4,
361 PowerActionShutdownReset = 5,
362 PowerActionShutdownOff = 6,
363 PowerActionWarmEject = 7
364} ;
365typedef enum __anonenum_POWER_ACTION_11 POWER_ACTION;
366enum _DEVICE_POWER_STATE {
367 PowerDeviceUnspecified = 0,
368 PowerDeviceD0 = 1,
369 PowerDeviceD1 = 2,
370 PowerDeviceD2 = 3,
371 PowerDeviceD3 = 4,
372 PowerDeviceMaximum = 5
373} ;
374typedef enum _DEVICE_POWER_STATE DEVICE_POWER_STATE;
375union _POWER_STATE {
376 SYSTEM_POWER_STATE SystemState ;
377 DEVICE_POWER_STATE DeviceState ;
378};
379typedef union _POWER_STATE POWER_STATE;
380enum _POWER_STATE_TYPE {
381 SystemPowerState = 0,
382 DevicePowerState = 1
383} ;
384typedef enum _POWER_STATE_TYPE POWER_STATE_TYPE;
385struct _KSYSTEM_TIME {
386 ULONG LowPart ;
387 LONG High1Time ;
388 LONG High2Time ;
389};
390typedef struct _KSYSTEM_TIME KSYSTEM_TIME;
391enum _ALTERNATIVE_ARCHITECTURE_TYPE {
392 StandardDesign = 0,
393 NEC98x86 = 1,
394 EndAlternatives = 2
395} ;
396typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE ALTERNATIVE_ARCHITECTURE_TYPE;
397struct _KUSER_SHARED_DATA {
398 ULONG volatile TickCountLow ;
399 ULONG TickCountMultiplier ;
400 KSYSTEM_TIME volatile InterruptTime ;
401 KSYSTEM_TIME volatile SystemTime ;
402 KSYSTEM_TIME volatile TimeZoneBias ;
403 USHORT ImageNumberLow ;
404 USHORT ImageNumberHigh ;
405 WCHAR NtSystemRoot[260] ;
406 ULONG MaxStackTraceDepth ;
407 ULONG CryptoExponent ;
408 ULONG TimeZoneId ;
409 ULONG Reserved2[8] ;
410 NT_PRODUCT_TYPE NtProductType ;
411 BOOLEAN ProductTypeIsValid ;
412 ULONG NtMajorVersion ;
413 ULONG NtMinorVersion ;
414 BOOLEAN ProcessorFeatures[64] ;
415 ULONG Reserved1 ;
416 ULONG Reserved3 ;
417 ULONG volatile TimeSlip ;
418 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture ;
419 LARGE_INTEGER SystemExpirationDate ;
420 ULONG SuiteMask ;
421 BOOLEAN KdDebuggerEnabled ;
422};
423typedef struct _KUSER_SHARED_DATA KUSER_SHARED_DATA;
424typedef PVOID PASSIGNED_RESOURCE;
425#pragma pack(push,4)
426struct __anonstruct_Generic_16 {
427 PHYSICAL_ADDRESS Start ;
428 ULONG Length ;
429};
430struct __anonstruct_Port_17 {
431 PHYSICAL_ADDRESS Start ;
432 ULONG Length ;
433};
434struct __anonstruct_Interrupt_18 {
435 ULONG Level ;
436 ULONG Vector ;
437 ULONG Affinity ;
438};
439struct __anonstruct_Memory_19 {
440 PHYSICAL_ADDRESS Start ;
441 ULONG Length ;
442};
443struct __anonstruct_Dma_20 {
444 ULONG Channel ;
445 ULONG Port ;
446 ULONG Reserved1 ;
447};
448struct __anonstruct_DevicePrivate_21 {
449 ULONG Data[3] ;
450};
451struct __anonstruct_BusNumber_22 {
452 ULONG Start ;
453 ULONG Length ;
454 ULONG Reserved ;
455};
456struct __anonstruct_DeviceSpecificData_23 {
457 ULONG DataSize ;
458 ULONG Reserved1 ;
459 ULONG Reserved2 ;
460};
461union __anonunion_u_15 {
462 struct __anonstruct_Generic_16 Generic ;
463 struct __anonstruct_Port_17 Port ;
464 struct __anonstruct_Interrupt_18 Interrupt ;
465 struct __anonstruct_Memory_19 Memory ;
466 struct __anonstruct_Dma_20 Dma ;
467 struct __anonstruct_DevicePrivate_21 DevicePrivate ;
468 struct __anonstruct_BusNumber_22 BusNumber ;
469 struct __anonstruct_DeviceSpecificData_23 DeviceSpecificData ;
470};
471struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
472 UCHAR Type ;
473 UCHAR ShareDisposition ;
474 USHORT Flags ;
475 union __anonunion_u_15 u ;
476};
477typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR;
478typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
479#pragma pack(pop)
480struct _CM_PARTIAL_RESOURCE_LIST {
481 USHORT Version ;
482 USHORT Revision ;
483 ULONG Count ;
484 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1] ;
485};
486typedef struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST;
487struct _CM_FULL_RESOURCE_DESCRIPTOR {
488 INTERFACE_TYPE InterfaceType ;
489 ULONG BusNumber ;
490 CM_PARTIAL_RESOURCE_LIST PartialResourceList ;
491};
492typedef struct _CM_FULL_RESOURCE_DESCRIPTOR CM_FULL_RESOURCE_DESCRIPTOR;
493typedef struct _CM_FULL_RESOURCE_DESCRIPTOR *PCM_FULL_RESOURCE_DESCRIPTOR;
494struct _CM_RESOURCE_LIST {
495 ULONG Count ;
496 CM_FULL_RESOURCE_DESCRIPTOR List[1] ;
497};
498typedef struct _CM_RESOURCE_LIST *PCM_RESOURCE_LIST;
499#pragma pack(push,1)
500#pragma pack(pop)
501struct _CM_FLOPPY_DEVICE_DATA {
502 USHORT Version ;
503 USHORT Revision ;
504 CHAR Size[8] ;
505 ULONG MaxDensity ;
506 ULONG MountDensity ;
507 UCHAR StepRateHeadUnloadTime ;
508 UCHAR HeadLoadTime ;
509 UCHAR MotorOffTime ;
510 UCHAR SectorLengthCode ;
511 UCHAR SectorPerTrack ;
512 UCHAR ReadWriteGapLength ;
513 UCHAR DataTransferLength ;
514 UCHAR FormatGapLength ;
515 UCHAR FormatFillCharacter ;
516 UCHAR HeadSettleTime ;
517 UCHAR MotorSettleTime ;
518 UCHAR MaximumTrackValue ;
519 UCHAR DataTransferRate ;
520};
521typedef struct _CM_FLOPPY_DEVICE_DATA *PCM_FLOPPY_DEVICE_DATA;
522struct __anonstruct_Port_25 {
523 ULONG Length ;
524 ULONG Alignment ;
525 PHYSICAL_ADDRESS MinimumAddress ;
526 PHYSICAL_ADDRESS MaximumAddress ;
527};
528struct __anonstruct_Memory_26 {
529 ULONG Length ;
530 ULONG Alignment ;
531 PHYSICAL_ADDRESS MinimumAddress ;
532 PHYSICAL_ADDRESS MaximumAddress ;
533};
534struct __anonstruct_Interrupt_27 {
535 ULONG MinimumVector ;
536 ULONG MaximumVector ;
537};
538struct __anonstruct_Dma_28 {
539 ULONG MinimumChannel ;
540 ULONG MaximumChannel ;
541};
542struct __anonstruct_Generic_29 {
543 ULONG Length ;
544 ULONG Alignment ;
545 PHYSICAL_ADDRESS MinimumAddress ;
546 PHYSICAL_ADDRESS MaximumAddress ;
547};
548struct __anonstruct_DevicePrivate_30 {
549 ULONG Data[3] ;
550};
551struct __anonstruct_BusNumber_31 {
552 ULONG Length ;
553 ULONG MinBusNumber ;
554 ULONG MaxBusNumber ;
555 ULONG Reserved ;
556};
557struct __anonstruct_AssignedResource_32 {
558 PASSIGNED_RESOURCE AssignedResource ;
559};
560struct __anonstruct_SubAllocateFrom_33 {
561 UCHAR Type ;
562 UCHAR Reserved[3] ;
563 PASSIGNED_RESOURCE AssignedResource ;
564 PHYSICAL_ADDRESS Transformation ;
565};
566struct __anonstruct_ConfigData_34 {
567 ULONG Priority ;
568 ULONG Reserved1 ;
569 ULONG Reserved2 ;
570};
571union __anonunion_u_24 {
572 struct __anonstruct_Port_25 Port ;
573 struct __anonstruct_Memory_26 Memory ;
574 struct __anonstruct_Interrupt_27 Interrupt ;
575 struct __anonstruct_Dma_28 Dma ;
576 struct __anonstruct_Generic_29 Generic ;
577 struct __anonstruct_DevicePrivate_30 DevicePrivate ;
578 struct __anonstruct_BusNumber_31 BusNumber ;
579 struct __anonstruct_AssignedResource_32 AssignedResource ;
580 struct __anonstruct_SubAllocateFrom_33 SubAllocateFrom ;
581 struct __anonstruct_ConfigData_34 ConfigData ;
582};
583struct _IO_RESOURCE_DESCRIPTOR {
584 UCHAR Option ;
585 UCHAR Type ;
586 UCHAR ShareDisposition ;
587 UCHAR Spare1 ;
588 USHORT Flags ;
589 USHORT Spare2 ;
590 union __anonunion_u_24 u ;
591};
592typedef struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR;
593struct _IO_RESOURCE_LIST {
594 USHORT Version ;
595 USHORT Revision ;
596 ULONG Count ;
597 IO_RESOURCE_DESCRIPTOR Descriptors[1] ;
598};
599typedef struct _IO_RESOURCE_LIST IO_RESOURCE_LIST;
600struct _IO_RESOURCE_REQUIREMENTS_LIST {
601 ULONG ListSize ;
602 INTERFACE_TYPE InterfaceType ;
603 ULONG BusNumber ;
604 ULONG SlotNumber ;
605 ULONG Reserved[3] ;
606 ULONG AlternativeLists ;
607 IO_RESOURCE_LIST List[1] ;
608};
609typedef struct _IO_RESOURCE_REQUIREMENTS_LIST *PIO_RESOURCE_REQUIREMENTS_LIST;
610enum _CONFIGURATION_TYPE {
611 ArcSystem = 0,
612 CentralProcessor = 1,
613 FloatingPointProcessor = 2,
614 PrimaryIcache = 3,
615 PrimaryDcache = 4,
616 SecondaryIcache = 5,
617 SecondaryDcache = 6,
618 SecondaryCache = 7,
619 EisaAdapter = 8,
620 TcAdapter = 9,
621 ScsiAdapter = 10,
622 DtiAdapter = 11,
623 MultiFunctionAdapter = 12,
624 DiskController = 13,
625 TapeController = 14,
626 CdromController = 15,
627 WormController = 16,
628 SerialController = 17,
629 NetworkController = 18,
630 DisplayController = 19,
631 ParallelController = 20,
632 PointerController = 21,
633 KeyboardController = 22,
634 AudioController = 23,
635 OtherController = 24,
636 DiskPeripheral = 25,
637 FloppyDiskPeripheral = 26,
638 TapePeripheral = 27,
639 ModemPeripheral = 28,
640 MonitorPeripheral = 29,
641 PrinterPeripheral = 30,
642 PointerPeripheral = 31,
643 KeyboardPeripheral = 32,
644 TerminalPeripheral = 33,
645 OtherPeripheral = 34,
646 LinePeripheral = 35,
647 NetworkPeripheral = 36,
648 SystemMemory = 37,
649 DockingInformation = 38,
650 RealModeIrqRoutingTable = 39,
651 MaximumType = 40
652} ;
653typedef enum _CONFIGURATION_TYPE CONFIGURATION_TYPE;
654typedef enum _CONFIGURATION_TYPE *PCONFIGURATION_TYPE;
655enum _KWAIT_REASON {
656 Executive = 0,
657 FreePage = 1,
658 PageIn = 2,
659 PoolAllocation = 3,
660 DelayExecution = 4,
661 Suspended = 5,
662 UserRequest = 6,
663 WrExecutive = 7,
664 WrFreePage = 8,
665 WrPageIn = 9,
666 WrPoolAllocation = 10,
667 WrDelayExecution = 11,
668 WrSuspended = 12,
669 WrUserRequest = 13,
670 WrEventPair = 14,
671 WrQueue = 15,
672 WrLpcReceive = 16,
673 WrLpcReply = 17,
674 WrVirtualMemory = 18,
675 WrPageOut = 19,
676 WrRendezvous = 20,
677 Spare2 = 21,
678 Spare3 = 22,
679 Spare4 = 23,
680 Spare5 = 24,
681 Spare6 = 25,
682 WrKernel = 26,
683 MaximumWaitReason = 27
684} ;
685typedef enum _KWAIT_REASON KWAIT_REASON;
686struct _DISPATCHER_HEADER {
687 UCHAR Type ;
688 UCHAR Absolute ;
689 UCHAR Size ;
690 UCHAR Inserted ;
691 LONG SignalState ;
692 LIST_ENTRY WaitListHead ;
693};
694typedef struct _DISPATCHER_HEADER DISPATCHER_HEADER;
695struct _KDEVICE_QUEUE {
696 CSHORT Type ;
697 CSHORT Size ;
698 LIST_ENTRY DeviceListHead ;
699 KSPIN_LOCK Lock ;
700 BOOLEAN Busy ;
701};
702typedef struct _KDEVICE_QUEUE KDEVICE_QUEUE;
703struct _KDEVICE_QUEUE_ENTRY {
704 LIST_ENTRY DeviceListEntry ;
705 ULONG SortKey ;
706 BOOLEAN Inserted ;
707};
708typedef struct _KDEVICE_QUEUE_ENTRY KDEVICE_QUEUE_ENTRY;
709struct _KEVENT {
710 DISPATCHER_HEADER Header ;
711};
712typedef struct _KEVENT KEVENT;
713typedef struct _KEVENT *PKEVENT;
714typedef struct _KEVENT *PRKEVENT;
715struct _KSEMAPHORE {
716 DISPATCHER_HEADER Header ;
717 LONG Limit ;
718};
719typedef struct _KSEMAPHORE KSEMAPHORE;
720typedef struct _KSEMAPHORE *PKSEMAPHORE;
721typedef struct _KSEMAPHORE *PRKSEMAPHORE;
722enum _MEMORY_CACHING_TYPE {
723 MmNonCached = 0,
724 MmCached = 1,
725 MmWriteCombined = 2,
726 MmHardwareCoherentCached = 3,
727 MmNonCachedUnordered = 4,
728 MmUSWCCached = 5,
729 MmMaximumCacheType = 6
730} ;
731typedef enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE;
732enum _POOL_TYPE {
733 NonPagedPool = 0,
734 PagedPool = 1,
735 NonPagedPoolMustSucceed = 2,
736 DontUseThisType = 3,
737 NonPagedPoolCacheAligned = 4,
738 PagedPoolCacheAligned = 5,
739 NonPagedPoolCacheAlignedMustS = 6,
740 MaxPoolType = 7,
741 NonPagedPoolSession = 32,
742 PagedPoolSession = 33,
743 NonPagedPoolMustSucceedSession = 34,
744 DontUseThisTypeSession = 35,
745 NonPagedPoolCacheAlignedSession = 36,
746 PagedPoolCacheAlignedSession = 37,
747 NonPagedPoolCacheAlignedMustSSession = 38
748} ;
749typedef enum _POOL_TYPE POOL_TYPE;
750struct _FAST_MUTEX {
751 LONG Count ;
752 PKTHREAD Owner ;
753 ULONG Contention ;
754 KEVENT Event ;
755 ULONG OldIrql ;
756};
757typedef struct _FAST_MUTEX FAST_MUTEX;
758typedef struct _FAST_MUTEX *PFAST_MUTEX;
759typedef ULONG_PTR ERESOURCE_THREAD;
760union __anonunion____missing_field_name_38 {
761 LONG OwnerCount ;
762 ULONG TableSize ;
763};
764struct _OWNER_ENTRY {
765 ERESOURCE_THREAD OwnerThread ;
766 union __anonunion____missing_field_name_38 __annonCompField10 ;
767};
768typedef struct _OWNER_ENTRY OWNER_ENTRY;
769typedef struct _OWNER_ENTRY *POWNER_ENTRY;
770union __anonunion____missing_field_name_39 {
771 PVOID Address ;
772 ULONG_PTR CreatorBackTraceIndex ;
773};
774struct _ERESOURCE {
775 LIST_ENTRY SystemResourcesList ;
776 POWNER_ENTRY OwnerTable ;
777 SHORT ActiveCount ;
778 USHORT Flag ;
779 PKSEMAPHORE SharedWaiters ;
780 PKEVENT ExclusiveWaiters ;
781 OWNER_ENTRY OwnerThreads[2] ;
782 ULONG ContentionCount ;
783 USHORT NumberOfSharedWaiters ;
784 USHORT NumberOfExclusiveWaiters ;
785 union __anonunion____missing_field_name_39 __annonCompField11 ;
786 KSPIN_LOCK SpinLock ;
787};
788enum _LOCK_OPERATION {
789 IoReadAccess = 0,
790 IoWriteAccess = 1,
791 IoModifyAccess = 2
792} ;
793typedef enum _LOCK_OPERATION LOCK_OPERATION;
794enum _MM_PAGE_PRIORITY {
795 LowPagePriority = 0,
796 NormalPagePriority = 16,
797 HighPagePriority = 32
798} ;
799typedef enum _MM_PAGE_PRIORITY MM_PAGE_PRIORITY;
800struct _DRIVER_OBJECT;
801struct _DRIVER_OBJECT;
802struct _SECURITY_SUBJECT_CONTEXT {
803 PACCESS_TOKEN ClientToken ;
804 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel ;
805 PACCESS_TOKEN PrimaryToken ;
806 PVOID ProcessAuditId ;
807};
808typedef struct _SECURITY_SUBJECT_CONTEXT SECURITY_SUBJECT_CONTEXT;
809struct _INITIAL_PRIVILEGE_SET {
810 ULONG PrivilegeCount ;
811 ULONG Control ;
812 LUID_AND_ATTRIBUTES Privilege[3] ;
813};
814typedef struct _INITIAL_PRIVILEGE_SET INITIAL_PRIVILEGE_SET;
815union __anonunion_Privileges_40 {
816 INITIAL_PRIVILEGE_SET InitialPrivilegeSet ;
817 PRIVILEGE_SET PrivilegeSet ;
818};
819struct _ACCESS_STATE {
820 LUID OperationID ;
821 BOOLEAN SecurityEvaluated ;
822 BOOLEAN GenerateAudit ;
823 BOOLEAN GenerateOnClose ;
824 BOOLEAN PrivilegesAllocated ;
825 ULONG Flags ;
826 ACCESS_MASK RemainingDesiredAccess ;
827 ACCESS_MASK PreviouslyGrantedAccess ;
828 ACCESS_MASK OriginalDesiredAccess ;
829 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext ;
830 PSECURITY_DESCRIPTOR SecurityDescriptor ;
831 PVOID AuxData ;
832 union __anonunion_Privileges_40 Privileges ;
833 BOOLEAN AuditPrivileges ;
834 UNICODE_STRING ObjectName ;
835 UNICODE_STRING ObjectTypeName ;
836};
837typedef struct _ACCESS_STATE *PACCESS_STATE;
838struct _DEVICE_OBJECT;
839struct _DEVICE_OBJECT;
840struct _DRIVER_OBJECT;
841struct _FILE_OBJECT;
842struct _FILE_OBJECT;
843struct _IRP;
844struct _IRP;
845struct _SCSI_REQUEST_BLOCK;
846struct _SCSI_REQUEST_BLOCK;
847typedef NTSTATUS (*PDRIVER_DISPATCH)(struct _DEVICE_OBJECT *DeviceObject , struct _IRP *Irp );
848struct _COMPRESSED_DATA_INFO;
849struct _FAST_IO_DISPATCH {
850 ULONG SizeOfFastIoDispatch ;
851 BOOLEAN (*FastIoCheckIfPossible)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
852 ULONG Length , BOOLEAN Wait , ULONG LockKey ,
853 BOOLEAN CheckForReadOperation , PIO_STATUS_BLOCK IoStatus ,
854 struct _DEVICE_OBJECT *DeviceObject ) ;
855 BOOLEAN (*FastIoRead)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
856 ULONG Length , BOOLEAN Wait , ULONG LockKey , PVOID Buffer ,
857 PIO_STATUS_BLOCK IoStatus , struct _DEVICE_OBJECT *DeviceObject ) ;
858 BOOLEAN (*FastIoWrite)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
859 ULONG Length , BOOLEAN Wait , ULONG LockKey , PVOID Buffer ,
860 PIO_STATUS_BLOCK IoStatus , struct _DEVICE_OBJECT *DeviceObject ) ;
861 BOOLEAN (*FastIoQueryBasicInfo)(struct _FILE_OBJECT *FileObject , BOOLEAN Wait ,
862 PFILE_BASIC_INFORMATION Buffer , PIO_STATUS_BLOCK IoStatus ,
863 struct _DEVICE_OBJECT *DeviceObject ) ;
864 BOOLEAN (*FastIoQueryStandardInfo)(struct _FILE_OBJECT *FileObject , BOOLEAN Wait ,
865 PFILE_STANDARD_INFORMATION Buffer , PIO_STATUS_BLOCK IoStatus ,
866 struct _DEVICE_OBJECT *DeviceObject ) ;
867 BOOLEAN (*FastIoLock)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
868 PLARGE_INTEGER Length , PEPROCESS ProcessId , ULONG Key ,
869 BOOLEAN FailImmediately , BOOLEAN ExclusiveLock , PIO_STATUS_BLOCK IoStatus ,
870 struct _DEVICE_OBJECT *DeviceObject ) ;
871 BOOLEAN (*FastIoUnlockSingle)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
872 PLARGE_INTEGER Length , PEPROCESS ProcessId , ULONG Key ,
873 PIO_STATUS_BLOCK IoStatus , struct _DEVICE_OBJECT *DeviceObject ) ;
874 BOOLEAN (*FastIoUnlockAll)(struct _FILE_OBJECT *FileObject , PEPROCESS ProcessId ,
875 PIO_STATUS_BLOCK IoStatus , struct _DEVICE_OBJECT *DeviceObject ) ;
876 BOOLEAN (*FastIoUnlockAllByKey)(struct _FILE_OBJECT *FileObject , PVOID ProcessId ,
877 ULONG Key , PIO_STATUS_BLOCK IoStatus , struct _DEVICE_OBJECT *DeviceObject ) ;
878 BOOLEAN (*FastIoDeviceControl)(struct _FILE_OBJECT *FileObject , BOOLEAN Wait ,
879 PVOID InputBuffer , ULONG InputBufferLength , PVOID OutputBuffer ,
880 ULONG OutputBufferLength , ULONG IoControlCode ,
881 PIO_STATUS_BLOCK IoStatus , struct _DEVICE_OBJECT *DeviceObject ) ;
882 void (*AcquireFileForNtCreateSection)(struct _FILE_OBJECT *FileObject ) ;
883 void (*ReleaseFileForNtCreateSection)(struct _FILE_OBJECT *FileObject ) ;
884 void (*FastIoDetachDevice)(struct _DEVICE_OBJECT *SourceDevice , struct _DEVICE_OBJECT *TargetDevice ) ;
885 BOOLEAN (*FastIoQueryNetworkOpenInfo)(struct _FILE_OBJECT *FileObject , BOOLEAN Wait ,
886 struct _FILE_NETWORK_OPEN_INFORMATION *Buffer ,
887 struct _IO_STATUS_BLOCK *IoStatus , struct _DEVICE_OBJECT *DeviceObject ) ;
888 NTSTATUS (*AcquireForModWrite)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER EndingOffset ,
889 struct _ERESOURCE **ResourceToRelease , struct _DEVICE_OBJECT *DeviceObject ) ;
890 BOOLEAN (*MdlRead)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
891 ULONG Length , ULONG LockKey , PMDL *MdlChain , PIO_STATUS_BLOCK IoStatus ,
892 struct _DEVICE_OBJECT *DeviceObject ) ;
893 BOOLEAN (*MdlReadComplete)(struct _FILE_OBJECT *FileObject , PMDL MdlChain , struct _DEVICE_OBJECT *DeviceObject ) ;
894 BOOLEAN (*PrepareMdlWrite)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
895 ULONG Length , ULONG LockKey , PMDL *MdlChain , PIO_STATUS_BLOCK IoStatus ,
896 struct _DEVICE_OBJECT *DeviceObject ) ;
897 BOOLEAN (*MdlWriteComplete)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
898 PMDL MdlChain , struct _DEVICE_OBJECT *DeviceObject ) ;
899 BOOLEAN (*FastIoReadCompressed)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
900 ULONG Length , ULONG LockKey , PVOID Buffer , PMDL *MdlChain ,
901 PIO_STATUS_BLOCK IoStatus , struct _COMPRESSED_DATA_INFO *CompressedDataInfo ,
902 ULONG CompressedDataInfoLength , struct _DEVICE_OBJECT *DeviceObject ) ;
903 BOOLEAN (*FastIoWriteCompressed)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
904 ULONG Length , ULONG LockKey , PVOID Buffer ,
905 PMDL *MdlChain , PIO_STATUS_BLOCK IoStatus , struct _COMPRESSED_DATA_INFO *CompressedDataInfo ,
906 ULONG CompressedDataInfoLength , struct _DEVICE_OBJECT *DeviceObject ) ;
907 BOOLEAN (*MdlReadCompleteCompressed)(struct _FILE_OBJECT *FileObject , PMDL MdlChain ,
908 struct _DEVICE_OBJECT *DeviceObject ) ;
909 BOOLEAN (*MdlWriteCompleteCompressed)(struct _FILE_OBJECT *FileObject , PLARGE_INTEGER FileOffset ,
910 PMDL MdlChain , struct _DEVICE_OBJECT *DeviceObject ) ;
911 BOOLEAN (*FastIoQueryOpen)(struct _IRP *Irp , PFILE_NETWORK_OPEN_INFORMATION NetworkInformation ,
912 struct _DEVICE_OBJECT *DeviceObject ) ;
913 NTSTATUS (*ReleaseForModWrite)(struct _FILE_OBJECT *FileObject , struct _ERESOURCE *ResourceToRelease ,
914 struct _DEVICE_OBJECT *DeviceObject ) ;
915 NTSTATUS (*AcquireForCcFlush)(struct _FILE_OBJECT *FileObject , struct _DEVICE_OBJECT *DeviceObject ) ;
916 NTSTATUS (*ReleaseForCcFlush)(struct _FILE_OBJECT *FileObject , struct _DEVICE_OBJECT *DeviceObject ) ;
917};
918typedef struct _FAST_IO_DISPATCH *PFAST_IO_DISPATCH;
919enum _IO_ALLOCATION_ACTION {
920 KeepObject = 1,
921 DeallocateObject = 2,
922 DeallocateObjectKeepRegisters = 3
923} ;
924typedef enum _IO_ALLOCATION_ACTION IO_ALLOCATION_ACTION;
925struct _IO_SECURITY_CONTEXT {
926 PSECURITY_QUALITY_OF_SERVICE SecurityQos ;
927 PACCESS_STATE AccessState ;
928 ACCESS_MASK DesiredAccess ;
929 ULONG FullCreateOptions ;
930};
931typedef struct _IO_SECURITY_CONTEXT *PIO_SECURITY_CONTEXT;
932struct _VPB {
933 CSHORT Type ;
934 CSHORT Size ;
935 USHORT Flags ;
936 USHORT VolumeLabelLength ;
937 struct _DEVICE_OBJECT *DeviceObject ;
938 struct _DEVICE_OBJECT *RealDevice ;
939 ULONG SerialNumber ;
940 ULONG ReferenceCount ;
941 WCHAR VolumeLabel[(32U * sizeof(WCHAR )) / sizeof(WCHAR )] ;
942};
943typedef struct _VPB *PVPB;
944struct _WAIT_CONTEXT_BLOCK {
945 KDEVICE_QUEUE_ENTRY WaitQueueEntry ;
946 IO_ALLOCATION_ACTION (*DeviceRoutine)(struct _DEVICE_OBJECT *DeviceObject , struct _IRP *Irp ,
947 PVOID MapRegisterBase , PVOID Context ) ;
948 PVOID DeviceContext ;
949 ULONG NumberOfMapRegisters ;
950 PVOID DeviceObject ;
951 PVOID CurrentIrp ;
952 PKDPC BufferChainingDpc ;
953};
954typedef struct _WAIT_CONTEXT_BLOCK WAIT_CONTEXT_BLOCK;
955union __anonunion_Queue_43 {
956 LIST_ENTRY ListEntry ;
957 WAIT_CONTEXT_BLOCK Wcb ;
958};
959struct _DEVOBJ_EXTENSION;
960struct _DEVICE_OBJECT {
961 CSHORT Type ;
962 USHORT Size ;
963 LONG ReferenceCount ;
964 struct _DRIVER_OBJECT *DriverObject ;
965 struct _DEVICE_OBJECT *NextDevice ;
966 struct _DEVICE_OBJECT *AttachedDevice ;
967 struct _IRP *CurrentIrp ;
968 PIO_TIMER Timer ;
969 ULONG Flags ;
970 ULONG Characteristics ;
971 PVPB Vpb ;
972 PVOID DeviceExtension ;
973 ULONG DeviceType ;
974 CCHAR StackSize ;
975 union __anonunion_Queue_43 Queue ;
976 ULONG AlignmentRequirement ;
977 KDEVICE_QUEUE DeviceQueue ;
978 KDPC Dpc ;
979 ULONG ActiveThreadCount ;
980 PSECURITY_DESCRIPTOR SecurityDescriptor ;
981 KEVENT DeviceLock ;
982 USHORT SectorSize ;
983 USHORT Spare1 ;
984 struct _DEVOBJ_EXTENSION *DeviceObjectExtension ;
985 PVOID Reserved ;
986};
987typedef struct _DEVICE_OBJECT DEVICE_OBJECT;
988typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
989struct _DEVOBJ_EXTENSION {
990 CSHORT Type ;
991 USHORT Size ;
992 PDEVICE_OBJECT DeviceObject ;
993};
994struct _DRIVER_EXTENSION {
995 struct _DRIVER_OBJECT *DriverObject ;
996 NTSTATUS (*AddDevice)(struct _DRIVER_OBJECT *DriverObject , struct _DEVICE_OBJECT *PhysicalDeviceObject ) ;
997 ULONG Count ;
998 UNICODE_STRING ServiceKeyName ;
999};
1000typedef struct _DRIVER_EXTENSION *PDRIVER_EXTENSION;
1001struct _DRIVER_OBJECT {
1002 CSHORT Type ;
1003 CSHORT Size ;
1004 PDEVICE_OBJECT DeviceObject ;
1005 ULONG Flags ;
1006 PVOID DriverStart ;
1007 ULONG DriverSize ;
1008 PVOID DriverSection ;
1009 PDRIVER_EXTENSION DriverExtension ;
1010 UNICODE_STRING DriverName ;
1011 PUNICODE_STRING HardwareDatabase ;
1012 PFAST_IO_DISPATCH FastIoDispatch ;
1013 NTSTATUS (*DriverInit)(struct _DRIVER_OBJECT *DriverObject , PUNICODE_STRING RegistryPath ) ;
1014 void (*DriverStartIo)(struct _DEVICE_OBJECT *DeviceObject , struct _IRP *Irp ) ;
1015 void (*DriverUnload)(struct _DRIVER_OBJECT *DriverObject ) ;
1016 PDRIVER_DISPATCH MajorFunction[28] ;
1017};
1018typedef struct _DRIVER_OBJECT DRIVER_OBJECT;
1019typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
1020struct _SECTION_OBJECT_POINTERS {
1021 PVOID DataSectionObject ;
1022 PVOID SharedCacheMap ;
1023 PVOID ImageSectionObject ;
1024};
1025typedef struct _SECTION_OBJECT_POINTERS SECTION_OBJECT_POINTERS;
1026typedef SECTION_OBJECT_POINTERS *PSECTION_OBJECT_POINTERS;
1027struct _IO_COMPLETION_CONTEXT {
1028 PVOID Port ;
1029 PVOID Key ;
1030};
1031typedef struct _IO_COMPLETION_CONTEXT *PIO_COMPLETION_CONTEXT;
1032struct _FILE_OBJECT {
1033 CSHORT Type ;
1034 CSHORT Size ;
1035 PDEVICE_OBJECT DeviceObject ;
1036 PVPB Vpb ;
1037 PVOID FsContext ;
1038 PVOID FsContext2 ;
1039 PSECTION_OBJECT_POINTERS SectionObjectPointer ;
1040 PVOID PrivateCacheMap ;
1041 NTSTATUS FinalStatus ;
1042 struct _FILE_OBJECT *RelatedFileObject ;
1043 BOOLEAN LockOperation ;
1044 BOOLEAN DeletePending ;
1045 BOOLEAN ReadAccess ;
1046 BOOLEAN WriteAccess ;
1047 BOOLEAN DeleteAccess ;
1048 BOOLEAN SharedRead ;
1049 BOOLEAN SharedWrite ;
1050 BOOLEAN SharedDelete ;
1051 ULONG Flags ;
1052 UNICODE_STRING FileName ;
1053 LARGE_INTEGER CurrentByteOffset ;
1054 ULONG Waiters ;
1055 ULONG Busy ;
1056 PVOID LastLock ;
1057 KEVENT Lock ;
1058 KEVENT Event ;
1059 PIO_COMPLETION_CONTEXT CompletionContext ;
1060};
1061typedef struct _FILE_OBJECT *PFILE_OBJECT;
1062union __anonunion_AssociatedIrp_44 {
1063 struct _IRP *MasterIrp ;
1064 LONG IrpCount ;
1065 PVOID SystemBuffer ;
1066};
1067struct __anonstruct_AsynchronousParameters_46 {
1068 void (*UserApcRoutine)(PVOID ApcContext , PIO_STATUS_BLOCK IoStatusBlock ,
1069 ULONG Reserved ) ;
1070 PVOID UserApcContext ;
1071};
1072union __anonunion_Overlay_45 {
1073 struct __anonstruct_AsynchronousParameters_46 AsynchronousParameters ;
1074 LARGE_INTEGER AllocationSize ;
1075};
1076struct __anonstruct____missing_field_name_50 {
1077 PVOID DriverContext[4] ;
1078};
1079union __anonunion____missing_field_name_49 {
1080 KDEVICE_QUEUE_ENTRY DeviceQueueEntry ;
1081 struct __anonstruct____missing_field_name_50 __annonCompField14 ;
1082};
1083struct _IO_STACK_LOCATION;
1084union __anonunion____missing_field_name_52 {
1085 struct _IO_STACK_LOCATION *CurrentStackLocation ;
1086 ULONG PacketType ;
1087};
1088struct __anonstruct____missing_field_name_51 {
1089 LIST_ENTRY ListEntry ;
1090 union __anonunion____missing_field_name_52 __annonCompField16 ;
1091};
1092struct __anonstruct_Overlay_48 {
1093 union __anonunion____missing_field_name_49 __annonCompField15 ;
1094 PETHREAD Thread ;
1095 PCHAR AuxiliaryBuffer ;
1096 struct __anonstruct____missing_field_name_51 __annonCompField17 ;
1097 PFILE_OBJECT OriginalFileObject ;
1098};
1099union __anonunion_Tail_47 {
1100 struct __anonstruct_Overlay_48 Overlay ;
1101 KAPC Apc ;
1102 PVOID CompletionKey ;
1103};
1104struct _IRP {
1105 CSHORT Type ;
1106 USHORT Size ;
1107 PMDL MdlAddress ;
1108 ULONG Flags ;
1109 union __anonunion_AssociatedIrp_44 AssociatedIrp ;
1110 LIST_ENTRY ThreadListEntry ;
1111 IO_STATUS_BLOCK IoStatus ;
1112 KPROCESSOR_MODE RequestorMode ;
1113 BOOLEAN PendingReturned ;
1114 CHAR StackCount ;
1115 CHAR CurrentLocation ;
1116 BOOLEAN Cancel ;
1117 KIRQL CancelIrql ;
1118 CCHAR ApcEnvironment ;
1119 UCHAR AllocationFlags ;
1120 PIO_STATUS_BLOCK UserIosb ;
1121 PKEVENT UserEvent ;
1122 union __anonunion_Overlay_45 Overlay ;
1123 void (*CancelRoutine)(struct _DEVICE_OBJECT *DeviceObject , struct _IRP *Irp ) ;
1124 PVOID UserBuffer ;
1125 union __anonunion_Tail_47 Tail ;
1126};
1127typedef struct _IRP IRP;
1128typedef struct _IRP *PIRP;
1129enum _DEVICE_RELATION_TYPE {
1130 BusRelations = 0,
1131 EjectionRelations = 1,
1132 PowerRelations = 2,
1133 RemovalRelations = 3,
1134 TargetDeviceRelation = 4
1135} ;
1136typedef enum _DEVICE_RELATION_TYPE DEVICE_RELATION_TYPE;
1137enum _DEVICE_USAGE_NOTIFICATION_TYPE {
1138 DeviceUsageTypeUndefined = 0,
1139 DeviceUsageTypePaging = 1,
1140 DeviceUsageTypeHibernation = 2,
1141 DeviceUsageTypeDumpFile = 3
1142} ;
1143typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE DEVICE_USAGE_NOTIFICATION_TYPE;
1144struct _INTERFACE {
1145 USHORT Size ;
1146 USHORT Version ;
1147 PVOID Context ;
1148 void (*InterfaceReference)(PVOID Context ) ;
1149 void (*InterfaceDereference)(PVOID Context ) ;
1150};
1151typedef struct _INTERFACE *PINTERFACE;
1152struct _DEVICE_CAPABILITIES {
1153 USHORT Size ;
1154 USHORT Version ;
1155 ULONG DeviceD1 : 1 ;
1156 ULONG DeviceD2 : 1 ;
1157 ULONG LockSupported : 1 ;
1158 ULONG EjectSupported : 1 ;
1159 ULONG Removable : 1 ;
1160 ULONG DockDevice : 1 ;
1161 ULONG UniqueID : 1 ;
1162 ULONG SilentInstall : 1 ;
1163 ULONG RawDeviceOK : 1 ;
1164 ULONG SurpriseRemovalOK : 1 ;
1165 ULONG WakeFromD0 : 1 ;
1166 ULONG WakeFromD1 : 1 ;
1167 ULONG WakeFromD2 : 1 ;
1168 ULONG WakeFromD3 : 1 ;
1169 ULONG HardwareDisabled : 1 ;
1170 ULONG NonDynamic : 1 ;
1171 ULONG WarmEjectSupported : 1 ;
1172 ULONG Reserved : 15 ;
1173 ULONG Address ;
1174 ULONG UINumber ;
1175 DEVICE_POWER_STATE DeviceState[7] ;
1176 SYSTEM_POWER_STATE SystemWake ;
1177 DEVICE_POWER_STATE DeviceWake ;
1178 ULONG D1Latency ;
1179 ULONG D2Latency ;
1180 ULONG D3Latency ;
1181};
1182typedef struct _DEVICE_CAPABILITIES *PDEVICE_CAPABILITIES;
1183struct _POWER_SEQUENCE {
1184 ULONG SequenceD1 ;
1185 ULONG SequenceD2 ;
1186 ULONG SequenceD3 ;
1187};
1188typedef struct _POWER_SEQUENCE *PPOWER_SEQUENCE;
1189enum __anonenum_BUS_QUERY_ID_TYPE_53 {
1190 BusQueryDeviceID = 0,
1191 BusQueryHardwareIDs = 1,
1192 BusQueryCompatibleIDs = 2,
1193 BusQueryInstanceID = 3,
1194 BusQueryDeviceSerialNumber = 4
1195} ;
1196typedef enum __anonenum_BUS_QUERY_ID_TYPE_53 BUS_QUERY_ID_TYPE;
1197enum __anonenum_DEVICE_TEXT_TYPE_54 {
1198 DeviceTextDescription = 0,
1199 DeviceTextLocationInformation = 1
1200} ;
1201typedef enum __anonenum_DEVICE_TEXT_TYPE_54 DEVICE_TEXT_TYPE;
1202#pragma pack(push,4)
1203struct __anonstruct_Create_56 {
1204 PIO_SECURITY_CONTEXT SecurityContext ;
1205 ULONG Options ;
1206 USHORT FileAttributes ;
1207 USHORT ShareAccess ;
1208 ULONG EaLength ;
1209};
1210struct __anonstruct_Read_57 {
1211 ULONG Length ;
1212 ULONG Key ;
1213 LARGE_INTEGER ByteOffset ;
1214};
1215struct __anonstruct_Write_58 {
1216 ULONG Length ;
1217 ULONG Key ;
1218 LARGE_INTEGER ByteOffset ;
1219};
1220struct __anonstruct_QueryFile_59 {
1221 ULONG Length ;
1222 FILE_INFORMATION_CLASS FileInformationClass ;
1223};
1224struct __anonstruct____missing_field_name_62 {
1225 BOOLEAN ReplaceIfExists ;
1226 BOOLEAN AdvanceOnly ;
1227};
1228union __anonunion____missing_field_name_61 {
1229 struct __anonstruct____missing_field_name_62 __annonCompField18 ;
1230 ULONG ClusterCount ;
1231 HANDLE DeleteHandle ;
1232};
1233struct __anonstruct_SetFile_60 {
1234 ULONG Length ;
1235 FILE_INFORMATION_CLASS FileInformationClass ;
1236 PFILE_OBJECT FileObject ;
1237 union __anonunion____missing_field_name_61 __annonCompField19 ;
1238};
1239struct __anonstruct_QueryVolume_63 {
1240 ULONG Length ;
1241 FS_INFORMATION_CLASS FsInformationClass ;
1242};
1243struct __anonstruct_DeviceIoControl_64 {
1244 ULONG OutputBufferLength ;
1245 ULONG InputBufferLength ;
1246 ULONG IoControlCode ;
1247 PVOID Type3InputBuffer ;
1248};
1249struct __anonstruct_QuerySecurity_65 {
1250 SECURITY_INFORMATION SecurityInformation ;
1251 ULONG Length ;
1252};
1253struct __anonstruct_SetSecurity_66 {
1254 SECURITY_INFORMATION SecurityInformation ;
1255 PSECURITY_DESCRIPTOR SecurityDescriptor ;
1256};
1257struct __anonstruct_MountVolume_67 {
1258 PVPB Vpb ;
1259 PDEVICE_OBJECT DeviceObject ;
1260};
1261struct __anonstruct_VerifyVolume_68 {
1262 PVPB Vpb ;
1263 PDEVICE_OBJECT DeviceObject ;
1264};
1265struct __anonstruct_Scsi_69 {
1266 struct _SCSI_REQUEST_BLOCK *Srb ;
1267};
1268struct __anonstruct_QueryDeviceRelations_70 {
1269 DEVICE_RELATION_TYPE Type ;
1270};
1271struct __anonstruct_QueryInterface_71 {
1272 GUID const *InterfaceType ;
1273 USHORT Size ;
1274 USHORT Version ;
1275 PINTERFACE Interface ;
1276 PVOID InterfaceSpecificData ;
1277};
1278struct __anonstruct_DeviceCapabilities_72 {
1279 PDEVICE_CAPABILITIES Capabilities ;
1280};
1281struct __anonstruct_FilterResourceRequirements_73 {
1282 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList ;
1283};
1284struct __anonstruct_ReadWriteConfig_74 {
1285 ULONG WhichSpace ;
1286 PVOID Buffer ;
1287 ULONG Offset ;
1288 ULONG Length ;
1289};
1290struct __anonstruct_SetLock_75 {
1291 BOOLEAN Lock ;
1292};
1293struct __anonstruct_QueryId_76 {
1294 BUS_QUERY_ID_TYPE IdType ;
1295};
1296struct __anonstruct_QueryDeviceText_77 {
1297 DEVICE_TEXT_TYPE DeviceTextType ;
1298 LCID LocaleId ;
1299};
1300struct __anonstruct_UsageNotification_78 {
1301 BOOLEAN InPath ;
1302 BOOLEAN Reserved[3] ;
1303 DEVICE_USAGE_NOTIFICATION_TYPE Type ;
1304};
1305struct __anonstruct_WaitWake_79 {
1306 SYSTEM_POWER_STATE PowerState ;
1307};
1308struct __anonstruct_PowerSequence_80 {
1309 PPOWER_SEQUENCE PowerSequence ;
1310};
1311struct __anonstruct_Power_81 {
1312 ULONG SystemContext ;
1313 POWER_STATE_TYPE Type ;
1314 POWER_STATE State ;
1315 POWER_ACTION ShutdownType ;
1316};
1317struct __anonstruct_StartDevice_82 {
1318 PCM_RESOURCE_LIST AllocatedResources ;
1319 PCM_RESOURCE_LIST AllocatedResourcesTranslated ;
1320};
1321struct __anonstruct_WMI_83 {
1322 ULONG_PTR ProviderId ;
1323 PVOID DataPath ;
1324 ULONG BufferSize ;
1325 PVOID Buffer ;
1326};
1327struct __anonstruct_Others_84 {
1328 PVOID Argument1 ;
1329 PVOID Argument2 ;
1330 PVOID Argument3 ;
1331 PVOID Argument4 ;
1332};
1333union __anonunion_Parameters_55 {
1334 struct __anonstruct_Create_56 Create ;
1335 struct __anonstruct_Read_57 Read ;
1336 struct __anonstruct_Write_58 Write ;
1337 struct __anonstruct_QueryFile_59 QueryFile ;
1338 struct __anonstruct_SetFile_60 SetFile ;
1339 struct __anonstruct_QueryVolume_63 QueryVolume ;
1340 struct __anonstruct_DeviceIoControl_64 DeviceIoControl ;
1341 struct __anonstruct_QuerySecurity_65 QuerySecurity ;
1342 struct __anonstruct_SetSecurity_66 SetSecurity ;
1343 struct __anonstruct_MountVolume_67 MountVolume ;
1344 struct __anonstruct_VerifyVolume_68 VerifyVolume ;
1345 struct __anonstruct_Scsi_69 Scsi ;
1346 struct __anonstruct_QueryDeviceRelations_70 QueryDeviceRelations ;
1347 struct __anonstruct_QueryInterface_71 QueryInterface ;
1348 struct __anonstruct_DeviceCapabilities_72 DeviceCapabilities ;
1349 struct __anonstruct_FilterResourceRequirements_73 FilterResourceRequirements ;
1350 struct __anonstruct_ReadWriteConfig_74 ReadWriteConfig ;
1351 struct __anonstruct_SetLock_75 SetLock ;
1352 struct __anonstruct_QueryId_76 QueryId ;
1353 struct __anonstruct_QueryDeviceText_77 QueryDeviceText ;
1354 struct __anonstruct_UsageNotification_78 UsageNotification ;
1355 struct __anonstruct_WaitWake_79 WaitWake ;
1356 struct __anonstruct_PowerSequence_80 PowerSequence ;
1357 struct __anonstruct_Power_81 Power ;
1358 struct __anonstruct_StartDevice_82 StartDevice ;
1359 struct __anonstruct_WMI_83 WMI ;
1360 struct __anonstruct_Others_84 Others ;
1361};
1362struct _IO_STACK_LOCATION {
1363 UCHAR MajorFunction ;
1364 UCHAR MinorFunction ;
1365 UCHAR Flags ;
1366 UCHAR Control ;
1367 union __anonunion_Parameters_55 Parameters ;
1368 PDEVICE_OBJECT DeviceObject ;
1369 PFILE_OBJECT FileObject ;
1370 NTSTATUS (*CompletionRoutine)(PDEVICE_OBJECT DeviceObject , PIRP Irp , PVOID Context ) ;
1371 PVOID Context ;
1372};
1373typedef struct _IO_STACK_LOCATION IO_STACK_LOCATION;
1374typedef struct _IO_STACK_LOCATION *PIO_STACK_LOCATION;
1375#pragma pack(pop)
1376struct _CONFIGURATION_INFORMATION {
1377 ULONG DiskCount ;
1378 ULONG FloppyCount ;
1379 ULONG CdRomCount ;
1380 ULONG TapeCount ;
1381 ULONG ScsiPortCount ;
1382 ULONG SerialCount ;
1383 ULONG ParallelCount ;
1384 BOOLEAN AtDiskPrimaryAddressClaimed ;
1385 BOOLEAN AtDiskSecondaryAddressClaimed ;
1386 ULONG Version ;
1387 ULONG MediumChangerCount ;
1388};
1389typedef struct _CONFIGURATION_INFORMATION CONFIGURATION_INFORMATION;
1390typedef struct _CONFIGURATION_INFORMATION *PCONFIGURATION_INFORMATION;
1391struct _OBJECT_HANDLE_INFORMATION {
1392 ULONG HandleAttributes ;
1393 ACCESS_MASK GrantedAccess ;
1394};
1395typedef struct _OBJECT_HANDLE_INFORMATION *POBJECT_HANDLE_INFORMATION;
1396enum _MEDIA_TYPE {
1397 Unknown = 0,
1398 F5_1Pt2_512 = 1,
1399 F3_1Pt44_512 = 2,
1400 F3_2Pt88_512 = 3,
1401 F3_20Pt8_512 = 4,
1402 F3_720_512 = 5,
1403 F5_360_512 = 6,
1404 F5_320_512 = 7,
1405 F5_320_1024 = 8,
1406 F5_180_512 = 9,
1407 F5_160_512 = 10,
1408 RemovableMedia = 11,
1409 FixedMedia = 12,
1410 F3_120M_512 = 13,
1411 F3_640_512 = 14,
1412 F5_640_512 = 15,
1413 F5_720_512 = 16,
1414 F3_1Pt2_512 = 17,
1415 F3_1Pt23_1024 = 18,
1416 F5_1Pt23_1024 = 19,
1417 F3_128Mb_512 = 20,
1418 F3_230Mb_512 = 21,
1419 F8_256_128 = 22
1420} ;
1421typedef enum _MEDIA_TYPE MEDIA_TYPE;
1422struct _FORMAT_PARAMETERS {
1423 MEDIA_TYPE MediaType ;
1424 ULONG StartCylinderNumber ;
1425 ULONG EndCylinderNumber ;
1426 ULONG StartHeadNumber ;
1427 ULONG EndHeadNumber ;
1428};
1429typedef struct _FORMAT_PARAMETERS FORMAT_PARAMETERS;
1430typedef struct _FORMAT_PARAMETERS *PFORMAT_PARAMETERS;
1431typedef USHORT BAD_TRACK_NUMBER;
1432typedef USHORT *PBAD_TRACK_NUMBER;
1433struct _FORMAT_EX_PARAMETERS {
1434 MEDIA_TYPE MediaType ;
1435 ULONG StartCylinderNumber ;
1436 ULONG EndCylinderNumber ;
1437 ULONG StartHeadNumber ;
1438 ULONG EndHeadNumber ;
1439 USHORT FormatGapLength ;
1440 USHORT SectorsPerTrack ;
1441 USHORT SectorNumber[1] ;
1442};
1443typedef struct _FORMAT_EX_PARAMETERS FORMAT_EX_PARAMETERS;
1444typedef struct _FORMAT_EX_PARAMETERS *PFORMAT_EX_PARAMETERS;
1445struct _DISK_GEOMETRY {
1446 LARGE_INTEGER Cylinders ;
1447 MEDIA_TYPE MediaType ;
1448 ULONG TracksPerCylinder ;
1449 ULONG SectorsPerTrack ;
1450 ULONG BytesPerSector ;
1451};
1452typedef struct _DISK_GEOMETRY DISK_GEOMETRY;
1453typedef struct _DISK_GEOMETRY *PDISK_GEOMETRY;
1454#pragma pack(push,1)
1455#pragma pack(pop)
1456#pragma pack(push,1)
1457#pragma pack(pop)
1458#pragma pack(push,1)
1459#pragma pack(pop)
1460#pragma pack(push,1)
1461#pragma pack(pop)
1462#pragma pack(push,1)
1463#pragma pack(pop)
1464struct _TRANSFER_BUFFER {
1465 PHYSICAL_ADDRESS Logical ;
1466 PVOID Virtual ;
1467};
1468typedef struct _TRANSFER_BUFFER TRANSFER_BUFFER;
1469struct _ACPI_FDI_DATA {
1470 ULONG DriveNumber ;
1471 ULONG DeviceType ;
1472 ULONG MaxCylinderNumber ;
1473 ULONG MaxSectorNumber ;
1474 ULONG MaxHeadNumber ;
1475 ULONG StepRateHeadUnloadTime ;
1476 ULONG HeadLoadTime ;
1477 ULONG MotorOffTime ;
1478 ULONG SectorLengthCode ;
1479 ULONG SectorPerTrack ;
1480 ULONG ReadWriteGapLength ;
1481 ULONG DataTransferLength ;
1482 ULONG FormatGapLength ;
1483 ULONG FormatFillCharacter ;
1484 ULONG HeadSettleTime ;
1485 ULONG MotorSettleTime ;
1486};
1487typedef struct _ACPI_FDI_DATA ACPI_FDI_DATA;
1488enum _ACPI_FDI_DEVICE_TYPE {
1489 CmosProblem = 0,
1490 Form525Capacity360 = 1,
1491 Form525Capacity1200 = 2,
1492 Form35Capacity720 = 3,
1493 Form35Capacity1440 = 4,
1494 Form35Capacity2880 = 5
1495} ;
1496struct _FDC_INFO {
1497 UCHAR FloppyControllerType ;
1498 UCHAR SpeedsAvailable ;
1499 ULONG AdapterBufferSize ;
1500 INTERFACE_TYPE BusType ;
1501 ULONG BusNumber ;
1502 ULONG ControllerNumber ;
1503 ULONG PeripheralNumber ;
1504 ULONG UnitNumber ;
1505 ULONG MaxTransferSize ;
1506 BOOLEAN AcpiBios ;
1507 BOOLEAN AcpiFdiSupported ;
1508 ACPI_FDI_DATA AcpiFdiData ;
1509 ULONG BufferCount ;
1510 ULONG BufferSize ;
1511 TRANSFER_BUFFER BufferAddress[] ;
1512};
1513typedef struct _FDC_INFO FDC_INFO;
1514typedef struct _FDC_INFO *PFDC_INFO;
1515struct _FDC_ENABLE_PARMS {
1516 UCHAR DriveOnValue ;
1517 USHORT TimeToWait ;
1518 BOOLEAN MotorStarted ;
1519};
1520typedef struct _FDC_ENABLE_PARMS FDC_ENABLE_PARMS;
1521struct _FDC_DISK_CHANGE_PARMS {
1522 UCHAR DriveStatus ;
1523 UCHAR DriveOnValue ;
1524};
1525typedef struct _FDC_DISK_CHANGE_PARMS FDC_DISK_CHANGE_PARMS;
1526struct _ISSUE_FDC_COMMAND_PARMS {
1527 PUCHAR FifoInBuffer ;
1528 PUCHAR FifoOutBuffer ;
1529 PVOID IoHandle ;
1530 ULONG IoOffset ;
1531 ULONG TransferBytes ;
1532 ULONG TimeOut ;
1533};
1534typedef struct _ISSUE_FDC_COMMAND_PARMS ISSUE_FDC_COMMAND_PARMS;
1535struct _SET_HD_BIT_PARMS {
1536 BOOLEAN DriveType144MB ;
1537 BOOLEAN Media144MB ;
1538 BOOLEAN More120MB ;
1539 UCHAR DeviceUnit ;
1540 BOOLEAN ChangedHdBit ;
1541};
1542typedef struct _SET_HD_BIT_PARMS SET_HD_BIT_PARMS;
1543struct _MOUNTDEV_NAME {
1544 USHORT NameLength ;
1545 WCHAR Name[1] ;
1546};
1547typedef struct _MOUNTDEV_NAME MOUNTDEV_NAME;
1548typedef struct _MOUNTDEV_NAME *PMOUNTDEV_NAME;
1549struct _MOUNTDEV_UNIQUE_ID {
1550 USHORT UniqueIdLength ;
1551 UCHAR UniqueId[1] ;
1552};
1553typedef struct _MOUNTDEV_UNIQUE_ID MOUNTDEV_UNIQUE_ID;
1554typedef struct _MOUNTDEV_UNIQUE_ID *PMOUNTDEV_UNIQUE_ID;
1555struct _MOUNTDEV_SUGGESTED_LINK_NAME {
1556 BOOLEAN UseOnlyIfThereAreNoOtherLinks ;
1557 USHORT NameLength ;
1558 WCHAR Name[1] ;
1559};
1560typedef struct _MOUNTDEV_SUGGESTED_LINK_NAME MOUNTDEV_SUGGESTED_LINK_NAME;
1561typedef struct _MOUNTDEV_SUGGESTED_LINK_NAME *PMOUNTDEV_SUGGESTED_LINK_NAME;
1562struct _BOOT_SECTOR_INFO {
1563 UCHAR JumpByte[1] ;
1564 UCHAR Ignore1[2] ;
1565 UCHAR OemData[8] ;
1566 UCHAR BytesPerSector[2] ;
1567 UCHAR Ignore2[6] ;
1568 UCHAR NumberOfSectors[2] ;
1569 UCHAR MediaByte[1] ;
1570 UCHAR Ignore3[2] ;
1571 UCHAR SectorsPerTrack[2] ;
1572 UCHAR NumberOfHeads[2] ;
1573};
1574typedef struct _BOOT_SECTOR_INFO *PBOOT_SECTOR_INFO;
1575enum _DRIVE_MEDIA_TYPE {
1576 Drive360Media160 = 0,
1577 Drive360Media180 = 1,
1578 Drive360Media320 = 2,
1579 Drive360Media32X = 3,
1580 Drive360Media360 = 4,
1581 Drive720Media720 = 5,
1582 Drive120Media160 = 6,
1583 Drive120Media180 = 7,
1584 Drive120Media320 = 8,
1585 Drive120Media32X = 9,
1586 Drive120Media360 = 10,
1587 Drive120Media120 = 11,
1588 Drive144Media720 = 12,
1589 Drive144Media144 = 13,
1590 Drive288Media720 = 14,
1591 Drive288Media144 = 15,
1592 Drive288Media288 = 16
1593} ;
1594typedef enum _DRIVE_MEDIA_TYPE DRIVE_MEDIA_TYPE;
1595enum _DRIVE_MEDIA_TYPE_NEC98 {
1596 Drive360Media160Nec98 = 0,
1597 Drive360Media180Nec98 = 1,
1598 Drive360Media320Nec98 = 2,
1599 Drive360Media32XNec98 = 3,
1600 Drive360Media360Nec98 = 4,
1601 Drive120Media160Nec98 = 5,
1602 Drive120Media180Nec98 = 6,
1603 Drive120Media320Nec98 = 7,
1604 Drive120Media32XNec98 = 8,
1605 Drive120Media360Nec98 = 9,
1606 Drive120Media640Nec98 = 10,
1607 Drive120Media720Nec98 = 11,
1608 Drive120Media120Nec98 = 12,
1609 Drive120Media123Nec98 = 13,
1610 Drive144Media640Nec98 = 14,
1611 Drive144Media720Nec98 = 15,
1612 Drive144Media120Nec98 = 16,
1613 Drive144Media123Nec98 = 17,
1614 Drive144Media144Nec98 = 18,
1615 Drive12EMedia120Nec98 = 19,
1616 Drive12EMedia123Nec98 = 20
1617} ;
1618typedef enum _DRIVE_MEDIA_TYPE_NEC98 DRIVE_MEDIA_TYPE_NEC98;
1619struct _DRIVE_MEDIA_LIMITS {
1620 DRIVE_MEDIA_TYPE HighestDriveMediaType ;
1621 DRIVE_MEDIA_TYPE LowestDriveMediaType ;
1622};
1623typedef struct _DRIVE_MEDIA_LIMITS DRIVE_MEDIA_LIMITS;
1624typedef struct _DRIVE_MEDIA_LIMITS *PDRIVE_MEDIA_LIMITS;
1625struct _DRIVE_MEDIA_LIMITS_NEC98 {
1626 DRIVE_MEDIA_TYPE_NEC98 HighestDriveMediaType ;
1627 DRIVE_MEDIA_TYPE_NEC98 LowestDriveMediaType ;
1628};
1629typedef struct _DRIVE_MEDIA_LIMITS_NEC98 DRIVE_MEDIA_LIMITS_NEC98;
1630struct _DRIVE_MEDIA_CONSTANTS {
1631 MEDIA_TYPE MediaType ;
1632 UCHAR StepRateHeadUnloadTime ;
1633 UCHAR HeadLoadTime ;
1634 UCHAR MotorOffTime ;
1635 UCHAR SectorLengthCode ;
1636 USHORT BytesPerSector ;
1637 UCHAR SectorsPerTrack ;
1638 UCHAR ReadWriteGapLength ;
1639 UCHAR FormatGapLength ;
1640 UCHAR FormatFillCharacter ;
1641 UCHAR HeadSettleTime ;
1642 USHORT MotorSettleTimeRead ;
1643 USHORT MotorSettleTimeWrite ;
1644 UCHAR MaximumTrack ;
1645 UCHAR CylinderShift ;
1646 UCHAR DataTransferRate ;
1647 UCHAR NumberOfHeads ;
1648 UCHAR DataLength ;
1649 UCHAR MediaByte ;
1650 UCHAR SkewDelta ;
1651};
1652typedef struct _DRIVE_MEDIA_CONSTANTS DRIVE_MEDIA_CONSTANTS;
1653typedef struct _DRIVE_MEDIA_CONSTANTS *PDRIVE_MEDIA_CONSTANTS;
1654struct _DISKETTE_EXTENSION {
1655 KSPIN_LOCK FlCancelSpinLock ;
1656 PDEVICE_OBJECT UnderlyingPDO ;
1657 PDEVICE_OBJECT TargetObject ;
1658 BOOLEAN IsStarted ;
1659 BOOLEAN IsRemoved ;
1660 BOOLEAN HoldNewRequests ;
1661 LIST_ENTRY NewRequestQueue ;
1662 KSPIN_LOCK NewRequestQueueSpinLock ;
1663 PDEVICE_OBJECT DeviceObject ;
1664 KSEMAPHORE RequestSemaphore ;
1665 KSPIN_LOCK ListSpinLock ;
1666 FAST_MUTEX ThreadReferenceMutex ;
1667 LONG ThreadReferenceCount ;
1668 PKTHREAD FloppyThread ;
1669 LIST_ENTRY ListEntry ;
1670 BOOLEAN HardwareFailed ;
1671 UCHAR HardwareFailCount ;
1672 ULONG MaxTransferSize ;
1673 UCHAR FifoBuffer[10] ;
1674 PUCHAR IoBuffer ;
1675 PMDL IoBufferMdl ;
1676 ULONG IoBufferSize ;
1677 PDRIVER_OBJECT DriverObject ;
1678 DRIVE_MEDIA_TYPE LastDriveMediaType ;
1679 BOOLEAN FloppyControllerAllocated ;
1680 BOOLEAN ACPI_BIOS ;
1681 UCHAR DriveType ;
1682 ULONG BytesPerSector ;
1683 ULONG ByteCapacity ;
1684 MEDIA_TYPE MediaType ;
1685 DRIVE_MEDIA_TYPE DriveMediaType ;
1686 UCHAR DeviceUnit ;
1687 UCHAR DriveOnValue ;
1688 BOOLEAN IsReadOnly ;
1689 DRIVE_MEDIA_CONSTANTS BiosDriveMediaConstants ;
1690 DRIVE_MEDIA_CONSTANTS DriveMediaConstants ;
1691 UCHAR PerpendicularMode ;
1692 BOOLEAN ControllerConfigurable ;
1693 UNICODE_STRING DeviceName ;
1694 UNICODE_STRING InterfaceString ;
1695 UNICODE_STRING ArcName ;
1696 BOOLEAN ReleaseFdcWithMotorRunning ;
1697 BOOLEAN PoweringDown ;
1698 FAST_MUTEX PowerDownMutex ;
1699 FAST_MUTEX HoldNewReqMutex ;
1700};
1701typedef struct _DISKETTE_EXTENSION DISKETTE_EXTENSION;
1702typedef DISKETTE_EXTENSION *PDISKETTE_EXTENSION;
1703struct _SENSE_DEVISE_STATUS_PTOS {
1704 UCHAR ST3_PTOS ;
1705};
1706typedef struct _SENSE_DEVISE_STATUS_PTOS SENSE_DEVISE_STATUS_PTOS;
1707typedef struct _SENSE_DEVISE_STATUS_PTOS *PSENSE_DEVISE_STATUS_PTOS;
1708#pragma pack(push,8)
1709#pragma pack(pop)
1710struct _KAPC;
1711struct _KDPC;
1712#pragma pack(push,4)
1713#pragma pack(pop)
1714#pragma pack(push,4)
1715#pragma pack(pop)
1716#pragma pack(push,1)
1717#pragma pack(pop)
1718struct _DRIVER_OBJECT;
1719struct _DEVICE_OBJECT;
1720struct _DRIVER_OBJECT;
1721struct _FILE_OBJECT;
1722struct _IRP;
1723struct _SCSI_REQUEST_BLOCK;
1724#pragma pack(push,4)
1725#pragma pack(pop)
1726#pragma once
1727extern int sprintf(char * , char const * , ...) ;
1728extern int swprintf(wchar_t * , wchar_t const * , ...) ;
1729#pragma once
1730#pragma once
1731#pragma once
1732#pragma once
1733#pragma warning(push)
1734#pragma warning(disable:4035)
1735#pragma warning(pop)
1736#pragma once
1737extern void *memcpy(void * , void const * , size_t ) ;
1738extern void *memset(void * , int , size_t ) ;
1739extern void *memmove(void * , void const * , size_t ) ;
1740extern PKTHREAD KeGetCurrentThread() ;
1741#pragma warning(disable:4103)
1742#pragma warning(disable:4103)
1743 NTSTATUS RtlQueryRegistryValues(ULONG RelativeTo ,
1744 PCWSTR Path ,
1745 PRTL_QUERY_REGISTRY_TABLE QueryTable ,
1746 PVOID Context ,
1747 PVOID Environment ) ;
1748 NTSTATUS RtlDeleteRegistryValue(ULONG RelativeTo ,
1749 PCWSTR Path ,
1750 PCWSTR ValueName ) ;
1751 void RtlInitString(PSTRING DestinationString ,
1752 PCSZ SourceString ) ;
1753 void RtlInitUnicodeString(PUNICODE_STRING DestinationString ,
1754 PCWSTR SourceString ) ;
1755 NTSTATUS RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString ,
1756 PANSI_STRING SourceString ,
1757 BOOLEAN AllocateDestinationString ) ;
1758 void RtlCopyUnicodeString(PUNICODE_STRING DestinationString ,
1759 PUNICODE_STRING SourceString ) ;
1760 void RtlFreeUnicodeString(PUNICODE_STRING UnicodeString ) ;
1761 SIZE_T RtlCompareMemory(void const *Source1 ,
1762 void const *Source2 ,
1763 SIZE_T Length ) ;
1764#pragma warning(push)
1765#pragma warning(disable:4035)
1766#pragma warning(pop)
1767extern LONG InterlockedExchange(PLONG Target ,
1768 LONG Value ) ;
1769#pragma warning(disable:4035)
1770#pragma warning(push)
1771#pragma warning(disable:4164)
1772#pragma function(_enable)
1773#pragma function(_disable)
1774#pragma warning(pop)
1775#pragma warning(disable:4103)
1776#pragma warning(disable:4103)
1777#pragma warning(disable:4103)
1778#pragma warning(disable:4103)
1779 void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type ,
1780 BOOLEAN State ) ;
1781 LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment ,
1782 BOOLEAN Wait ) ;
1783 void KeInitializeSemaphore(PRKSEMAPHORE Semaphore ,
1784 LONG Count , LONG Limit ) ;
1785 LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment ,
1786 LONG Adjustment , BOOLEAN Wait ) ;
1787 NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode ,
1788 BOOLEAN Alertable ,
1789 PLARGE_INTEGER Interval ) ;
1790extern KPRIORITY KeSetPriorityThread(PKTHREAD Thread ,
1791 KPRIORITY Priority ) ;
1792 NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason ,
1793 KPROCESSOR_MODE WaitMode ,
1794 BOOLEAN Alertable ,
1795 PLARGE_INTEGER Timeout ) ;
1796 void KeInitializeSpinLock(PKSPIN_LOCK SpinLock ) ;
1797extern KIRQL KfAcquireSpinLock(PKSPIN_LOCK SpinLock ) ;
1798 void KfReleaseSpinLock(PKSPIN_LOCK SpinLock ,
1799 KIRQL NewIrql ) ;
1800 PVOID ExAllocatePoolWithTag(POOL_TYPE PoolType ,
1801 SIZE_T NumberOfBytes ,
1802 ULONG Tag ) ;
1803 void ExFreePool(PVOID P ) ;
1804 void ExAcquireFastMutex(PFAST_MUTEX FastMutex ) ;
1805 void ExReleaseFastMutex(PFAST_MUTEX FastMutex ) ;
1806 PLIST_ENTRY ExfInterlockedInsertHeadList(PLIST_ENTRY ListHead ,
1807 PLIST_ENTRY ListEntry ,
1808 PKSPIN_LOCK Lock ) ;
1809 PLIST_ENTRY ExfInterlockedInsertTailList(PLIST_ENTRY ListHead ,
1810 PLIST_ENTRY ListEntry ,
1811 PKSPIN_LOCK Lock ) ;
1812 PLIST_ENTRY ExfInterlockedRemoveHeadList(PLIST_ENTRY ListHead ,
1813 PKSPIN_LOCK Lock ) ;
1814extern void MmProbeAndLockPages(PMDL MemoryDescriptorList ,
1815 KPROCESSOR_MODE AccessMode ,
1816 LOCK_OPERATION Operation ) ;
1817 void MmUnlockPages(PMDL MemoryDescriptorList ) ;
1818 PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList ,
1819 KPROCESSOR_MODE AccessMode ,
1820 MEMORY_CACHING_TYPE CacheType ,
1821 PVOID BaseAddress ,
1822 ULONG BugCheckOnFailure ,
1823 MM_PAGE_PRIORITY Priority ) ;
1824 PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes ,
1825 PHYSICAL_ADDRESS HighestAcceptableAddress ) ;
1826 void MmFreeContiguousMemory(PVOID BaseAddress ) ;
1827 void MmResetDriverPaging(PVOID AddressWithinSection ) ;
1828 PVOID MmPageEntireDriver(PVOID AddressWithinSection ) ;
1829 NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle ,
1830 ULONG DesiredAccess ,
1831 POBJECT_ATTRIBUTES ObjectAttributes ,
1832 HANDLE ProcessHandle ,
1833 PCLIENT_ID ClientId ,
1834 void (*StartRoutine)(PVOID StartContext ) ,
1835 PVOID StartContext ) ;
1836 NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) ;
1837#pragma warning(disable:4103)
1838#pragma warning(disable:4103)
1839 PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length ,
1840 BOOLEAN SecondaryBuffer , BOOLEAN ChargeQuota ,
1841 PIRP Irp ) ;
1842 PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice ,
1843 PDEVICE_OBJECT TargetDevice ) ;
1844 PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction ,
1845 PDEVICE_OBJECT DeviceObject ,
1846 PVOID Buffer ,
1847 ULONG Length ,
1848 PLARGE_INTEGER StartingOffset ,
1849 PIO_STATUS_BLOCK IoStatusBlock ) ;
1850 PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode ,
1851 PDEVICE_OBJECT DeviceObject ,
1852 PVOID InputBuffer ,
1853 ULONG InputBufferLength ,
1854 PVOID OutputBuffer ,
1855 ULONG OutputBufferLength ,
1856 BOOLEAN InternalDeviceIoControl ,
1857 PKEVENT Event ,
1858 PIO_STATUS_BLOCK IoStatusBlock ) ;
1859 NTSTATUS IofCallDriver(PDEVICE_OBJECT DeviceObject ,
1860 PIRP Irp ) ;
1861 void IofCompleteRequest(PIRP Irp ,
1862 CCHAR PriorityBoost ) ;
1863 NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject ,
1864 ULONG DeviceExtensionSize ,
1865 PUNICODE_STRING DeviceName ,
1866 ULONG DeviceType , ULONG DeviceCharacteristics ,
1867 BOOLEAN Exclusive , PDEVICE_OBJECT *DeviceObject ) ;
1868 NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName ,
1869 PUNICODE_STRING DeviceName ) ;
1870 void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) ;
1871 NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) ;
1872 void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) ;
1873 void IoFreeIrp(PIRP Irp ) ;
1874 void IoFreeMdl(PMDL Mdl ) ;
1875 PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) ;
1876 NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType ,
1877 PULONG BusNumber ,
1878 PCONFIGURATION_TYPE ControllerType ,
1879 PULONG ControllerNumber ,
1880 PCONFIGURATION_TYPE PeripheralType ,
1881 PULONG PeripheralNumber ,
1882 NTSTATUS (*CalloutRoutine)(PVOID Context ,
1883 PUNICODE_STRING PathName ,
1884 INTERFACE_TYPE BusType ,
1885 ULONG BusNumber ,
1886 PKEY_VALUE_FULL_INFORMATION *BusInformation ,
1887 CONFIGURATION_TYPE ControllerType ,
1888 ULONG ControllerNumber ,
1889 PKEY_VALUE_FULL_INFORMATION *ControllerInformation ,
1890 CONFIGURATION_TYPE PeripheralType ,
1891 ULONG PeripheralNumber ,
1892 PKEY_VALUE_FULL_INFORMATION *PeripheralInformation ) ,
1893 PVOID Context ) ;
1894 void IoReleaseCancelSpinLock(KIRQL Irql ) ;
1895 void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject ) ;
1896 NTSTATUS IoRegisterDeviceInterface(PDEVICE_OBJECT PhysicalDeviceObject ,
1897 GUID const *InterfaceClassGuid ,
1898 PUNICODE_STRING ReferenceString ,
1899 PUNICODE_STRING SymbolicLinkName ) ;
1900 NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName ,
1901 BOOLEAN Enable ) ;
1902#pragma warning(disable:4200)
1903#pragma warning(default:4200)
1904 NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject ,
1905 PIRP Irp ) ;
1906 void PoStartNextPowerIrp(PIRP Irp ) ;
1907 NTSTATUS ObReferenceObjectByHandle(HANDLE Handle ,
1908 ACCESS_MASK DesiredAccess ,
1909 POBJECT_TYPE ObjectType ,
1910 KPROCESSOR_MODE AccessMode ,
1911 PVOID *Object ,
1912 POBJECT_HANDLE_INFORMATION HandleInformation ) ;
1913 void ObfDereferenceObject(PVOID Object ) ;
1914 NTSTATUS ZwClose(HANDLE Handle ) ;
1915#pragma once
1916#pragma warning(disable:4103)
1917#pragma warning(disable:4103)
1918#pragma warning(disable:4103)
1919#pragma warning(disable:4103)
1920#pragma warning(disable:4103)
1921#pragma warning(disable:4103)
1922#pragma warning(disable:4103)
1923#pragma warning(disable:4103)
1924#pragma warning(disable:4103)
1925#pragma warning(disable:4103)
1926#pragma once
1927#pragma once
1928 struct _GUID const MOUNTDEV_MOUNTED_DEVICE_GUID = {1408590605,
1929 46783, 4560, {148, 242, 0, 160, 201, 30, 251, 139}};
1930#pragma once
1931DRIVE_MEDIA_LIMITS _DriveMediaLimits[5] = { {4, 0},
1932 {11, 6},
1933 {5, 5},
1934 {13, 12},
1935 {16, 14}};
1936DRIVE_MEDIA_LIMITS_NEC98 _DriveMediaLimits_NEC98[6] = { {4, 0},
1937 {13, 5},
1938 {11, 5},
1939 {18, 14},
1940 {18, 14},
1941 {20, 19}};
1942PDRIVE_MEDIA_LIMITS DriveMediaLimits ;
1943DRIVE_MEDIA_CONSTANTS _DriveMediaConstants[17] =
1944 { {10, 223, 2, 37, 2, 512, 8, 42, 80, 246, 15, 1000, 1000, 39, 0, 2, 1, 255, 254,
1945 0},
1946 {9, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 1000, 1000, 39, 0, 2, 1, 255, 252,
1947 0},
1948 {7, 223, 2, 37, 2, 512, 8, 42, 80, 246, 15, 1000, 1000, 39, 0, 2, 2, 255, 255,
1949 0},
1950 {8, 223, 2, 37, 3, 1024, 4, 128, 240, 246, 15, 1000, 1000, 39, 0, 2, 2, 255,
1951 255, 0},
1952 {6, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 250, 1000, 39, 0, 2, 2, 255, 253,
1953 0},
1954 {5, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 500, 1000, 79, 0, 2, 2, 255, 249,
1955 2},
1956 {10, 223, 2, 37, 2, 512, 8, 42, 80, 246, 15, 1000, 1000, 39, 1, 1, 1, 255, 254,
1957 0},
1958 {9, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 1000, 1000, 39, 1, 1, 1, 255, 252,
1959 0},
1960 {7, 223, 2, 37, 2, 512, 8, 42, 80, 246, 15, 1000, 1000, 39, 1, 1, 2, 255, 255,
1961 0},
1962 {8, 223, 2, 37, 3, 1024, 4, 128, 240, 246, 15, 1000, 1000, 39, 1, 1, 2, 255,
1963 255, 0},
1964 {6, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 625, 1000, 39, 1, 1, 2, 255, 253,
1965 0},
1966 {1, 223, 2, 37, 2, 512, 15, 27, 84, 246, 15, 625, 1000, 79, 0, 0, 2, 255, 249,
1967 0},
1968 {5, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 500, 1000, 79, 0, 2, 2, 255, 249,
1969 2},
1970 {2, 175, 2, 37, 2, 512, 18, 27, 101, 246, 15, 500, 1000, 79, 0, 0, 2, 255, 240,
1971 3},
1972 {5, 225, 2, 37, 2, 512, 9, 42, 80, 246, 15, 500, 1000, 79, 0, 2, 2, 255, 249,
1973 2},
1974 {2, 209, 2, 37, 2, 512, 18, 27, 101, 246, 15, 500, 1000, 79, 0, 0, 2, 255, 240,
1975 3},
1976 {3, 161, 2, 37, 2, 512, 36, 56, 83, 246, 15, 500, 1000, 79, 0, 3, 2, 255, 240,
1977 6}};
1978DRIVE_MEDIA_CONSTANTS _DriveMediaConstants_NEC98[21] =
1979 { {10, 223, 2, 37, 2, 512, 8, 42, 80, 246, 15, 1000, 1000, 39, 0, 2, 1, 255, 254,
1980 0},
1981 {9, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 1000, 1000, 39, 0, 2, 1, 255, 252,
1982 0},
1983 {7, 223, 2, 37, 2, 512, 8, 42, 80, 246, 15, 1000, 1000, 39, 0, 2, 2, 255, 255,
1984 0},
1985 {8, 223, 2, 37, 3, 1024, 4, 128, 240, 246, 15, 1000, 1000, 39, 0, 2, 2, 255,
1986 255, 0},
1987 {6, 223, 2, 37, 2, 512, 9, 42, 80, 246, 15, 250, 1000, 39, 0, 2, 2, 255, 253,
1988 0},
1989 {10, 223, 22, 37, 2, 512, 8, 42, 80, 229, 15, 1000, 1000, 39, 1, 2, 1, 255, 254,
1990 0},
1991 {9, 223, 22, 37, 2, 512, 9, 42, 80, 229, 15, 1000, 1000, 39, 1, 2, 1, 255, 252,
1992 0},
1993 {7, 223, 22, 37, 2, 512, 8, 42, 80, 229, 15, 1000, 1000, 39, 1, 2, 2, 255, 255,
1994 0},
1995 {8, 223, 22, 37, 3, 1024, 4, 128, 240, 229, 15, 1000, 1000, 39, 1, 2, 2, 255,
1996 255, 0},
1997 {6, 223, 22, 37, 2, 512, 9, 42, 80, 229, 15, 1000, 1000, 39, 1, 2, 2, 255, 253,
1998 0},
1999 {15, 223, 22, 37, 2, 512, 8, 42, 80, 229, 15, 1000, 1000, 79, 0, 0, 2, 255, 251,
2000 0},
2001 {16, 223, 22, 37, 2, 512, 9, 42, 80, 229, 15, 1000, 1000, 79, 0, 0, 2, 255, 249,
2002 2},
2003 {1, 207, 36, 37, 2, 512, 15, 27, 84, 229, 15, 1000, 1000, 79, 0, 0, 2, 255, 249,
2004 0},
2005 {19, 207, 36, 37, 3, 1024, 8, 53, 116, 229, 15, 1000, 1000, 76, 0, 0, 2, 255,
2006 254, 0},
2007 {14, 223, 22, 37, 2, 512, 8, 42, 80, 229, 15, 1000, 1000, 79, 0, 0, 2, 255, 251,
2008 0},
2009 {5, 223, 22, 37, 2, 512, 9, 42, 80, 229, 15, 1000, 1000, 79, 0, 0, 2, 255, 249,
2010 2},
2011 {17, 207, 36, 37, 2, 512, 15, 27, 84, 229, 15, 1000, 1000, 79, 0, 0, 2, 255,
2012 249, 0},
2013 {18, 207, 36, 37, 3, 1024, 8, 53, 116, 229, 15, 1000, 1000, 76, 0, 0, 2, 255,
2014 254, 0},
2015 {2, 223, 36, 37, 2, 512, 18, 27, 108, 229, 15, 1000, 1000, 79, 0, 0, 2, 255,
2016 240, 3},
2017 {1, 191, 50, 37, 2, 512, 15, 27, 84, 229, 15, 1000, 1000, 79, 0, 0, 2, 255, 249,
2018 0},
2019 {19, 191, 50, 37, 3, 1024, 8, 53, 116, 229, 15, 1000, 1000, 76, 0, 0, 2, 255,
2020 254, 0}};
2021PDRIVE_MEDIA_CONSTANTS DriveMediaConstants ;
2022SENSE_DEVISE_STATUS_PTOS Result_Status3_PTOS[4] ;
2023NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject , PUNICODE_STRING RegistryPath ) ;
2024void FloppyUnload(PDRIVER_OBJECT DriverObject ) ;
2025NTSTATUS FlConfigCallBack(PVOID Context , PUNICODE_STRING PathName , INTERFACE_TYPE BusType ,
2026 ULONG BusNumber , PKEY_VALUE_FULL_INFORMATION *BusInformation ,
2027 CONFIGURATION_TYPE ControllerType , ULONG ControllerNumber ,
2028 PKEY_VALUE_FULL_INFORMATION *ControllerInformation , CONFIGURATION_TYPE PeripheralType ,
2029 ULONG PeripheralNumber , PKEY_VALUE_FULL_INFORMATION *PeripheralInformation ) ;
2030NTSTATUS FlInitializeControllerHardware(PDISKETTE_EXTENSION DisketteExtension ) ;
2031NTSTATUS FloppyCreateClose(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ;
2032NTSTATUS FloppyDeviceControl(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ;
2033NTSTATUS FloppyReadWrite(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ;
2034NTSTATUS FlRecalibrateDrive(PDISKETTE_EXTENSION DisketteExtension ) ;
2035NTSTATUS FlDatarateSpecifyConfigure(PDISKETTE_EXTENSION DisketteExtension ) ;
2036NTSTATUS FlStartDrive(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp , BOOLEAN WriteOperation ,
2037 BOOLEAN SetUpMedia , BOOLEAN IgnoreChange ) ;
2038void FlFinishOperation(PIRP Irp , PDISKETTE_EXTENSION DisketteExtension ) ;
2039NTSTATUS FlDetermineMediaType(PDISKETTE_EXTENSION DisketteExtension ) ;
2040void FloppyThread(PVOID Context ) ;
2041NTSTATUS FlReadWrite(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp , BOOLEAN DriveStarted ) ;
2042NTSTATUS FlFormat(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp ) ;
2043NTSTATUS FlIssueCommand(PDISKETTE_EXTENSION DisketteExtension , PUCHAR FifoInBuffer ,
2044 PUCHAR FifoOutBuffer , PMDL IoMdl , ULONG IoOffset , ULONG TransferBytes ) ;
2045BOOLEAN FlCheckFormatParameters(PDISKETTE_EXTENSION DisketteExtension , PFORMAT_PARAMETERS FormatParameters ) ;
2046NTSTATUS FlQueueIrpToThread(PIRP Irp , PDISKETTE_EXTENSION DisketteExtension ) ;
2047NTSTATUS FlInterpretError(UCHAR StatusRegister1 , UCHAR StatusRegister2 ) ;
2048void FlAllocateIoBuffer(PDISKETTE_EXTENSION DisketteExtension , ULONG BufferSize ) ;
2049void FlFreeIoBuffer(PDISKETTE_EXTENSION DisketteExtension ) ;
2050void FlConsolidateMediaTypeWithBootSector(PDISKETTE_EXTENSION DisketteExtension ,
2051 PBOOT_SECTOR_INFO BootSector ) ;
2052void FlCheckBootSector(PDISKETTE_EXTENSION DisketteExtension ) ;
2053NTSTATUS FlReadWriteTrack(PDISKETTE_EXTENSION DisketteExtension , PMDL IoMdl , ULONG IoOffset ,
2054 BOOLEAN WriteOperation , UCHAR Cylinder , UCHAR Head , UCHAR Sector ,
2055 UCHAR NumberOfSectors , BOOLEAN NeedSeek ) ;
2056NTSTATUS FlFdcDeviceIo(PDEVICE_OBJECT DeviceObject , ULONG Ioctl , PVOID Data ) ;
2057NTSTATUS FloppyAddDevice(PDRIVER_OBJECT DriverObject , PDEVICE_OBJECT PhysicalDeviceObject ) ;
2058NTSTATUS FloppyPnp(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ;
2059NTSTATUS FloppyPower(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ;
2060NTSTATUS FloppyPnpComplete(PDEVICE_OBJECT DeviceObject , PIRP Irp , PVOID Context ) ;
2061NTSTATUS FloppyQueueRequest(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp ) ;
2062NTSTATUS FloppyStartDevice(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ;
2063void FloppyProcessQueuedRequests(PDISKETTE_EXTENSION DisketteExtension ) ;
2064void FloppyCancelQueuedRequest(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ;
2065NTSTATUS FlAcpiConfigureFloppy(PDISKETTE_EXTENSION DisketteExtension , PFDC_INFO FdcInfo ) ;
2066NTSTATUS FlHdbit(PDISKETTE_EXTENSION DisketteExtension ) ;
2067#pragma alloc_text(INIT,DriverEntry)
2068#pragma alloc_text(PAGE,FloppyAddDevice)
2069#pragma alloc_text(PAGE,FloppyPnp)
2070#pragma alloc_text(PAGE,FloppyPower)
2071#pragma alloc_text(PAGE,FlConfigCallBack)
2072#pragma alloc_text(PAGE,FlInitializeControllerHardware)
2073#pragma alloc_text(PAGE,FlInterpretError)
2074#pragma alloc_text(PAGE,FlDatarateSpecifyConfigure)
2075#pragma alloc_text(PAGE,FlRecalibrateDrive)
2076#pragma alloc_text(PAGE,FlDetermineMediaType)
2077#pragma alloc_text(PAGE,FlCheckBootSector)
2078#pragma alloc_text(PAGE,FlConsolidateMediaTypeWithBootSector)
2079#pragma alloc_text(PAGE,FlIssueCommand)
2080#pragma alloc_text(PAGE,FlReadWriteTrack)
2081#pragma alloc_text(PAGE,FlReadWrite)
2082#pragma alloc_text(PAGE,FlFormat)
2083#pragma alloc_text(PAGE,FlFinishOperation)
2084#pragma alloc_text(PAGE,FlStartDrive)
2085#pragma alloc_text(PAGE,FloppyThread)
2086#pragma alloc_text(PAGE,FlAllocateIoBuffer)
2087#pragma alloc_text(PAGE,FlFreeIoBuffer)
2088#pragma alloc_text(PAGE,FloppyCreateClose)
2089#pragma alloc_text(PAGE,FloppyDeviceControl)
2090#pragma alloc_text(PAGE,FloppyReadWrite)
2091#pragma alloc_text(PAGE,FlCheckFormatParameters)
2092#pragma alloc_text(PAGE,FlFdcDeviceIo)
2093#pragma alloc_text(PAGE,FlHdbit)
2094void errorFn(void)
2095{
2096
2097 {
2098 ERROR:
2099 goto ERROR;
2100}
2101}
2102NTSTATUS myStatus ;
2103int s ;
2104int UNLOADED ;
2105int NP ;
2106int DC ;
2107int SKIP1 ;
2108int SKIP2 ;
2109int MPR1 ;
2110int MPR3 ;
2111int IPC ;
2112int pended ;
2113NTSTATUS (*compFptr)(PDEVICE_OBJECT DeviceObject , PIRP Irp , PVOID Context ) ;
2114int compRegistered ;
2115int lowerDriverReturn ;
2116int setEventCalled ;
2117int customIrp ;
2118void _BLAST_init(void)
2119{
2120
2121 {
2122 UNLOADED = 0;
2123 NP = 1;
2124 DC = 2;
2125 SKIP1 = 3;
2126 SKIP2 = 4;
2127 MPR1 = 5;
2128 MPR3 = 6;
2129 IPC = 7;
2130 s = UNLOADED;
2131 pended = 0;
2132 compFptr = 0;
2133 compRegistered = 0;
2134 lowerDriverReturn = 0;
2135 setEventCalled = 0;
2136 customIrp = 0;
2137 return;
2138}
2139}
2140ULONG PagingReferenceCount = 0;
2141PFAST_MUTEX PagingMutex = (void *)0;
2142NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject , PUNICODE_STRING RegistryPath )
2143{ NTSTATUS ntStatus ;
2144 PVOID tmp ;
2145
2146 {
2147 ntStatus = 0L;
2148 {
2149 }
2150 {
2151 DriverObject->MajorFunction[0] = & FloppyCreateClose;
2152 DriverObject->MajorFunction[2] = & FloppyCreateClose;
2153 DriverObject->MajorFunction[3] = & FloppyReadWrite;
2154 DriverObject->MajorFunction[4] = & FloppyReadWrite;
2155 DriverObject->MajorFunction[14] = & FloppyDeviceControl;
2156 DriverObject->MajorFunction[27] = & FloppyPnp;
2157 DriverObject->MajorFunction[22] = & FloppyPower;
2158 DriverObject->DriverUnload = & FloppyUnload;
2159 (DriverObject->DriverExtension)->AddDevice = & FloppyAddDevice;
2160 tmp = ExAllocatePoolWithTag(0, sizeof(FAST_MUTEX ), 1886350406UL);
2161 PagingMutex = tmp;
2162 }
2163 if ((unsigned int )PagingMutex == (unsigned int )((void *)0)) {
2164 return (-1073741670L);
2165 } else {
2166
2167 }
2168 {
2169 PagingMutex->Count = 1;
2170 PagingMutex->Contention = 0;
2171
2172
2173 }
2174 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
2175 DriveMediaLimits = (struct _DRIVE_MEDIA_LIMITS *)(_DriveMediaLimits_NEC98);
2176 } else {
2177 DriveMediaLimits = _DriveMediaLimits;
2178 }
2179 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
2180 DriveMediaConstants = _DriveMediaConstants_NEC98;
2181 } else {
2182 DriveMediaConstants = _DriveMediaConstants;
2183 }
2184 return (ntStatus);
2185}
2186}
2187void FloppyUnload(PDRIVER_OBJECT DriverObject )
2188{
2189
2190 {
2191 {
2192 }
2193 {
2194
2195 }
2196 return;
2197}
2198}
2199NTSTATUS FloppyAddDevice(PDRIVER_OBJECT DriverObject , PDEVICE_OBJECT PhysicalDeviceObject )
2200{ NTSTATUS ntStatus ;
2201 PDEVICE_OBJECT deviceObject ;
2202 PDISKETTE_EXTENSION disketteExtension ;
2203 FDC_INFO fdcInfo ;
2204 UCHAR arcNameBuffer[256] ;
2205 STRING arcNameString ;
2206 WCHAR deviceNameBuffer[20] ;
2207 UNICODE_STRING deviceName ;
2208 USHORT i ;
2209 USHORT tmp ;
2210 PVOID tmp___0 ;
2211 PCONFIGURATION_INFORMATION tmp___1 ;
2212
2213 {
2214 ntStatus = 0L;
2215 {
2216 }
2217 {
2218 fdcInfo.BufferCount = 0;
2219 fdcInfo.BufferSize = 0;
2220 ntStatus = FlFdcDeviceIo(PhysicalDeviceObject, ((7 << 16) | (770 << 2)) | 3, & fdcInfo);
2221 }
2222 if (ntStatus >= 0L) {
2223 i = 0;
2224 {
2225 while (1) {
2226 while_3_continue: ;
2227 {
2228 tmp = i;
2229 i = (USHORT )((int )i + 1);
2230 swprintf(deviceNameBuffer, "\\\000D\000e\000v\000i\000c\000e\000\\\000F\000l\000o\000p\000p\000y\000%\000d\000",
2231 tmp);
2232
2233 ntStatus = IoCreateDevice(DriverObject, sizeof(DISKETTE_EXTENSION ), & deviceName,
2234 7, 261, 0, & deviceObject);
2235 }
2236 if (ntStatus == -1073741771L) {
2237
2238 } else {
2239 goto while_3_break;
2240 }
2241 }
2242 while_3_break: ;
2243 }
2244 if (ntStatus >= 0L) {
2245 disketteExtension = (DISKETTE_EXTENSION *)deviceObject->DeviceExtension;
2246 {
2247 }
2248 {
2249 tmp___0 = ExAllocatePoolWithTag(1, deviceName.Length, 1886350406UL);
2250 disketteExtension->DeviceName.Buffer = tmp___0;
2251 }
2252 if ((unsigned int )disketteExtension->DeviceName.Buffer == (unsigned int )((void *)0)) {
2253 {
2254
2255 }
2256 return (-1073741670L);
2257 } else {
2258
2259 }
2260 {
2261 disketteExtension->DeviceName.Length = 0;
2262 disketteExtension->DeviceName.MaximumLength = deviceName.Length;
2263
2264 tmp___1 = IoGetConfigurationInformation();
2265 tmp___1->FloppyCount += 1UL;
2266 sprintf(arcNameBuffer, "%s(%d)disk(%d)fdisk(%d)", "\\ArcName\\multi", fdcInfo.BusNumber,
2267 fdcInfo.ControllerNumber, fdcInfo.PeripheralNumber);
2268
2269 ntStatus = RtlAnsiStringToUnicodeString(& disketteExtension->ArcName, & arcNameString,
2270 1);
2271 }
2272 if (ntStatus >= 0L) {
2273 {
2274 IoCreateSymbolicLink(& disketteExtension->ArcName, & deviceName);
2275 }
2276 } else {
2277
2278 }
2279 deviceObject->Flags |= 8208UL;
2280 if (deviceObject->AlignmentRequirement < 1UL) {
2281 deviceObject->AlignmentRequirement = 1;
2282 } else {
2283
2284 }
2285 deviceObject->Flags &= 4294967167UL;
2286 disketteExtension->DriverObject = DriverObject;
2287 disketteExtension->UnderlyingPDO = PhysicalDeviceObject;
2288 {
2289 }
2290 {
2291 disketteExtension->TargetObject = IoAttachDeviceToDeviceStack(deviceObject,
2292 PhysicalDeviceObject);
2293 }
2294 {
2295 }
2296 {
2297
2298 disketteExtension->PowerDownMutex.Count = 1;
2299 disketteExtension->PowerDownMutex.Contention = 0;
2300
2301
2302 disketteExtension->ThreadReferenceMutex.Count = 1;
2303 disketteExtension->ThreadReferenceMutex.Contention = 0;
2304
2305 disketteExtension->HoldNewReqMutex.Count = 1;
2306 disketteExtension->HoldNewReqMutex.Contention = 0;
2307
2308 disketteExtension->ListEntry.Blink = & disketteExtension->ListEntry;
2309 disketteExtension->ListEntry.Flink = disketteExtension->ListEntry.Blink;
2310 disketteExtension->ThreadReferenceCount = -1;
2311 disketteExtension->IsStarted = 0;
2312 disketteExtension->IsRemoved = 0;
2313 disketteExtension->HoldNewRequests = 0;
2314 disketteExtension->NewRequestQueue.Blink = & disketteExtension->NewRequestQueue;
2315 disketteExtension->NewRequestQueue.Flink = disketteExtension->NewRequestQueue.Blink;
2316
2317
2318 disketteExtension->FloppyControllerAllocated = 0;
2319 disketteExtension->ReleaseFdcWithMotorRunning = 0;
2320 disketteExtension->DeviceObject = deviceObject;
2321 disketteExtension->IsReadOnly = 0;
2322 disketteExtension->MediaType = -1;
2323 }
2324 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
2325 disketteExtension->ControllerConfigurable = 0;
2326 } else {
2327 disketteExtension->ControllerConfigurable = 1;
2328 }
2329 } else {
2330
2331 }
2332 } else {
2333
2334 }
2335 return (ntStatus);
2336}
2337}
2338NTSTATUS FlConfigCallBack(PVOID Context , PUNICODE_STRING PathName , INTERFACE_TYPE BusType ,
2339 ULONG BusNumber , PKEY_VALUE_FULL_INFORMATION *BusInformation ,
2340 CONFIGURATION_TYPE ControllerType , ULONG ControllerNumber ,
2341 PKEY_VALUE_FULL_INFORMATION *ControllerInformation , CONFIGURATION_TYPE PeripheralType ,
2342 ULONG PeripheralNumber , PKEY_VALUE_FULL_INFORMATION *PeripheralInformation )
2343{ PDISKETTE_EXTENSION disketteExtension ;
2344 ULONG i ;
2345 PCM_FULL_RESOURCE_DESCRIPTOR peripheralData ;
2346 PCM_PARTIAL_RESOURCE_DESCRIPTOR partial ;
2347 PCM_FLOPPY_DEVICE_DATA fDeviceData ;
2348 UCHAR driveType ;
2349 PDRIVE_MEDIA_CONSTANTS biosDriveMediaConstants ;
2350
2351 {
2352 disketteExtension = Context;
2353 if (! ((UCHAR *)*(PeripheralInformation + 1) + (*(PeripheralInformation + 1))->DataLength)) {
2354 return (-1073741811L);
2355 } else {
2356
2357 }
2358 peripheralData = (struct _CM_FULL_RESOURCE_DESCRIPTOR *)((UCHAR *)*(PeripheralInformation + 1) + (*(PeripheralInformation + 1))->DataOffset);
2359 i = 0;
2360 {
2361 while (1) {
2362 while_7_continue: ;
2363 if (i < peripheralData->PartialResourceList.Count) {
2364
2365 } else {
2366 goto while_7_break;
2367 }
2368 partial = & peripheralData->PartialResourceList.PartialDescriptors[i];
2369 if ((int )partial->Type == 5) {
2370 biosDriveMediaConstants = & disketteExtension->BiosDriveMediaConstants;
2371 fDeviceData = (struct _CM_FLOPPY_DEVICE_DATA *)(partial + 1);
2372 if (fDeviceData->MaxDensity == 360) {
2373 goto switch_8_360;
2374 } else {
2375 if (fDeviceData->MaxDensity == 1200) {
2376 goto switch_8_1200;
2377 } else {
2378 if (fDeviceData->MaxDensity == 1185) {
2379 goto switch_8_1185;
2380 } else {
2381 if (fDeviceData->MaxDensity == 1423) {
2382 goto switch_8_1423;
2383 } else {
2384 if (fDeviceData->MaxDensity == 1440) {
2385 goto switch_8_1440;
2386 } else {
2387 if (fDeviceData->MaxDensity == 2880) {
2388 goto switch_8_2880;
2389 } else {
2390 if (fDeviceData->MaxDensity == 1201) {
2391 goto switch_8_1201;
2392 } else {
2393 {
2394 goto switch_8_default;
2395 if (0) {
2396 switch_8_360:
2397 driveType = 0;
2398 goto switch_8_break;
2399 switch_8_1200:
2400 driveType = 1;
2401 goto switch_8_break;
2402 switch_8_1185:
2403 driveType = 1;
2404 goto switch_8_break;
2405 switch_8_1423:
2406 driveType = 3;
2407 goto switch_8_break;
2408 switch_8_1440:
2409 driveType = 3;
2410 goto switch_8_break;
2411 switch_8_2880:
2412 driveType = 4;
2413 goto switch_8_break;
2414 switch_8_1201: ;
2415 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
2416 driveType = 5;
2417 goto switch_8_break;
2418 } else {
2419
2420 }
2421 switch_8_default: ;
2422 {
2423 }
2424 driveType = 1;
2425 {
2426 }
2427 goto switch_8_break;
2428 } else {
2429 switch_8_break: ;
2430 }
2431 }
2432 }
2433 }
2434 }
2435 }
2436 }
2437 }
2438 }
2439 disketteExtension->DriveType = driveType;
2440 *biosDriveMediaConstants = *(DriveMediaConstants + (DriveMediaLimits + driveType)->HighestDriveMediaType);
2441 if ((int )fDeviceData->Version >= 2) {
2442 biosDriveMediaConstants->StepRateHeadUnloadTime = fDeviceData->StepRateHeadUnloadTime;
2443 biosDriveMediaConstants->HeadLoadTime = fDeviceData->HeadLoadTime;
2444 biosDriveMediaConstants->MotorOffTime = fDeviceData->MotorOffTime;
2445 biosDriveMediaConstants->SectorLengthCode = fDeviceData->SectorLengthCode;
2446 if ((int )fDeviceData->SectorPerTrack == 0) {
2447 return (0L);
2448 } else {
2449
2450 }
2451 if (fDeviceData->MaxDensity == 0UL) {
2452 return (0L);
2453 } else {
2454
2455 }
2456 biosDriveMediaConstants->SectorsPerTrack = fDeviceData->SectorPerTrack;
2457 biosDriveMediaConstants->ReadWriteGapLength = fDeviceData->ReadWriteGapLength;
2458 biosDriveMediaConstants->FormatGapLength = fDeviceData->FormatGapLength;
2459 biosDriveMediaConstants->FormatFillCharacter = fDeviceData->FormatFillCharacter;
2460 biosDriveMediaConstants->HeadSettleTime = fDeviceData->HeadSettleTime;
2461 biosDriveMediaConstants->MotorSettleTimeRead = ((int )fDeviceData->MotorSettleTime * 1000) / 8;
2462 biosDriveMediaConstants->MotorSettleTimeWrite = ((int )fDeviceData->MotorSettleTime * 1000) / 8;
2463 if ((int )fDeviceData->MaximumTrackValue == 0) {
2464 return (0L);
2465 } else {
2466
2467 }
2468 biosDriveMediaConstants->MaximumTrack = fDeviceData->MaximumTrackValue;
2469 biosDriveMediaConstants->DataLength = fDeviceData->DataTransferLength;
2470 } else {
2471
2472 }
2473 } else {
2474
2475 }
2476 i += 1UL;
2477 }
2478 while_7_break: ;
2479 }
2480 return (0L);
2481}
2482}
2483NTSTATUS FlAcpiConfigureFloppy(PDISKETTE_EXTENSION DisketteExtension , PFDC_INFO FdcInfo )
2484{ UCHAR driveType ;
2485 PDRIVE_MEDIA_CONSTANTS biosDriveMediaConstants ;
2486
2487 {
2488 biosDriveMediaConstants = & DisketteExtension->BiosDriveMediaConstants;
2489 if (! FdcInfo->AcpiFdiSupported) {
2490 return (-1073741823L);
2491 } else {
2492
2493 }
2494 if ((enum _ACPI_FDI_DEVICE_TYPE )FdcInfo->AcpiFdiData.DeviceType == 1) {
2495 goto switch_11_1;
2496 } else {
2497 if ((enum _ACPI_FDI_DEVICE_TYPE )FdcInfo->AcpiFdiData.DeviceType == 2) {
2498 goto switch_11_2;
2499 } else {
2500 if ((enum _ACPI_FDI_DEVICE_TYPE )FdcInfo->AcpiFdiData.DeviceType == 3) {
2501 goto switch_11_3;
2502 } else {
2503 if ((enum _ACPI_FDI_DEVICE_TYPE )FdcInfo->AcpiFdiData.DeviceType == 4) {
2504 goto switch_11_4;
2505 } else {
2506 if ((enum _ACPI_FDI_DEVICE_TYPE )FdcInfo->AcpiFdiData.DeviceType == 5) {
2507 goto switch_11_5;
2508 } else {
2509 {
2510 goto switch_11_default;
2511 if (0) {
2512 switch_11_1:
2513 driveType = 0;
2514 goto switch_11_break;
2515 switch_11_2:
2516 driveType = 1;
2517 goto switch_11_break;
2518 switch_11_3:
2519 driveType = 2;
2520 goto switch_11_break;
2521 switch_11_4:
2522 driveType = 3;
2523 goto switch_11_break;
2524 switch_11_5:
2525 driveType = 4;
2526 goto switch_11_break;
2527 switch_11_default:
2528 driveType = 1;
2529 goto switch_11_break;
2530 } else {
2531 switch_11_break: ;
2532 }
2533 }
2534 }
2535 }
2536 }
2537 }
2538 }
2539 DisketteExtension->DriveType = driveType;
2540 *biosDriveMediaConstants = *(DriveMediaConstants + (DriveMediaLimits + driveType)->HighestDriveMediaType);
2541 biosDriveMediaConstants->StepRateHeadUnloadTime = (unsigned char )FdcInfo->AcpiFdiData.StepRateHeadUnloadTime;
2542 biosDriveMediaConstants->HeadLoadTime = (unsigned char )FdcInfo->AcpiFdiData.HeadLoadTime;
2543 biosDriveMediaConstants->MotorOffTime = (unsigned char )FdcInfo->AcpiFdiData.MotorOffTime;
2544 biosDriveMediaConstants->SectorLengthCode = (unsigned char )FdcInfo->AcpiFdiData.SectorLengthCode;
2545 biosDriveMediaConstants->SectorsPerTrack = (unsigned char )FdcInfo->AcpiFdiData.SectorPerTrack;
2546 biosDriveMediaConstants->ReadWriteGapLength = (unsigned char )FdcInfo->AcpiFdiData.ReadWriteGapLength;
2547 biosDriveMediaConstants->FormatGapLength = (unsigned char )FdcInfo->AcpiFdiData.FormatGapLength;
2548 biosDriveMediaConstants->FormatFillCharacter = (unsigned char )FdcInfo->AcpiFdiData.FormatFillCharacter;
2549 biosDriveMediaConstants->HeadSettleTime = (unsigned char )FdcInfo->AcpiFdiData.HeadSettleTime;
2550 biosDriveMediaConstants->MotorSettleTimeRead = ((int )((unsigned char )FdcInfo->AcpiFdiData.MotorSettleTime) * 1000) / 8;
2551 biosDriveMediaConstants->MotorSettleTimeWrite = ((int )((unsigned short )FdcInfo->AcpiFdiData.MotorSettleTime) * 1000) / 8;
2552 biosDriveMediaConstants->MaximumTrack = (unsigned char )FdcInfo->AcpiFdiData.MaxCylinderNumber;
2553 biosDriveMediaConstants->DataLength = (unsigned char )FdcInfo->AcpiFdiData.DataTransferLength;
2554 return (0L);
2555}
2556}
2557NTSTATUS FlQueueIrpToThread(PIRP Irp , PDISKETTE_EXTENSION DisketteExtension )
2558{ NTSTATUS status ;
2559 HANDLE threadHandle ;
2560 PIO_STACK_LOCATION irpSp ;
2561 OBJECT_ATTRIBUTES ObjAttributes ;
2562
2563 {
2564 {
2565 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
2566
2567 }
2568 if ((int )DisketteExtension->PoweringDown == 1) {
2569 {
2570
2571 }
2572 {
2573 }
2574 myStatus = -1073741101L;
2575 Irp->IoStatus.__annonCompField4.Status = -1073741101L;
2576 Irp->IoStatus.Information = 0;
2577 return (-1073741101L);
2578 } else {
2579
2580 }
2581 {
2582
2583 }
2584 {
2585 }
2586 {
2587
2588 DisketteExtension->ThreadReferenceCount += 1L;
2589 }
2590 if (DisketteExtension->ThreadReferenceCount == 0L) {
2591 {
2592 DisketteExtension->ThreadReferenceCount += 1L;
2593
2594 PagingReferenceCount += 1UL;
2595 }
2596 if (PagingReferenceCount == 1UL) {
2597 {
2598
2599 }
2600 } else {
2601
2602 }
2603 {
2604
2605 ObjAttributes.Length = sizeof(OBJECT_ATTRIBUTES );
2606 ObjAttributes.RootDirectory = (void *)0;
2607 ObjAttributes.Attributes = 512L;
2608 ObjAttributes.ObjectName = (void *)0;
2609 ObjAttributes.SecurityDescriptor = (void *)0;
2610 ObjAttributes.SecurityQualityOfService = (void *)0;
2611 status = PsCreateSystemThread(& threadHandle, 0UL, & ObjAttributes, (void *)0L,
2612 (void *)0, & FloppyThread, DisketteExtension);
2613 }
2614 if (! (status >= 0L)) {
2615 {
2616 DisketteExtension->ThreadReferenceCount = -1;
2617
2618 PagingReferenceCount -= 1UL;
2619 }
2620 if (PagingReferenceCount == 0UL) {
2621 {
2622
2623 }
2624 } else {
2625
2626 }
2627 {
2628
2629
2630 }
2631 return (status);
2632 } else {
2633
2634 }
2635 {
2636 status = ObReferenceObjectByHandle(threadHandle, 1048576L, (void *)0, 0, & DisketteExtension->FloppyThread,
2637 (void *)0);
2638 ZwClose(threadHandle);
2639
2640 }
2641 if (! (status >= 0L)) {
2642 return (status);
2643 } else {
2644
2645 }
2646 } else {
2647 {
2648
2649 }
2650 }
2651 (Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation)->Control = (int )(Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation)->Control | 1;
2652 if (pended == 0) {
2653 pended = 1;
2654 } else {
2655 {
2656 errorFn();
2657 }
2658 }
2659 {
2660 ExfInterlockedInsertTailList(& DisketteExtension->ListEntry, & Irp->Tail.Overlay.__annonCompField17.ListEntry,
2661 & DisketteExtension->ListSpinLock);
2662 KeReleaseSemaphore(& DisketteExtension->RequestSemaphore, 0L, 1, 0);
2663 }
2664 return (259L);
2665}
2666}
2667NTSTATUS FloppyCreateClose(PDEVICE_OBJECT DeviceObject , PIRP Irp )
2668{
2669
2670 {
2671 {
2672 }
2673 {
2674 myStatus = 0L;
2675 Irp->IoStatus.__annonCompField4.Status = 0L;
2676 Irp->IoStatus.Information = 1;
2677 IofCompleteRequest(Irp, 0);
2678 }
2679 return (0L);
2680}
2681}
2682NTSTATUS FloppyDeviceControl(PDEVICE_OBJECT DeviceObject , PIRP Irp )
2683{ PIO_STACK_LOCATION irpSp ;
2684 PDISKETTE_EXTENSION disketteExtension ;
2685 PDISK_GEOMETRY outputBuffer ;
2686 NTSTATUS ntStatus ;
2687 ULONG outputBufferLength ;
2688 UCHAR i ;
2689 DRIVE_MEDIA_TYPE lowestDriveMediaType ;
2690 DRIVE_MEDIA_TYPE highestDriveMediaType ;
2691 ULONG formatExParametersSize ;
2692 PFORMAT_EX_PARAMETERS formatExParameters ;
2693 NTSTATUS tmp ;
2694 PMOUNTDEV_NAME mountName ;
2695 PMOUNTDEV_UNIQUE_ID uniqueId ;
2696 BOOLEAN tmp___0 ;
2697 PMOUNTDEV_SUGGESTED_LINK_NAME suggestedName ;
2698 WCHAR driveLetterNameBuffer[10] ;
2699 RTL_QUERY_REGISTRY_TABLE queryTable[2] ;
2700 PWSTR valueName ;
2701 UNICODE_STRING driveLetterName ;
2702 PVOID tmp___1 ;
2703 int tmp___2 ;
2704
2705 {
2706 {
2707 }
2708 {
2709 disketteExtension = DeviceObject->DeviceExtension;
2710 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
2711
2712 }
2713 if (disketteExtension->HoldNewRequests) {
2714 if (irpSp->Parameters.DeviceIoControl.IoControlCode != (ULONG )((50 << 16) | (3 << 14))) {
2715 {
2716 ntStatus = FloppyQueueRequest(disketteExtension, Irp);
2717
2718 }
2719 return (ntStatus);
2720 } else {
2721
2722 }
2723 } else {
2724
2725 }
2726 {
2727
2728 }
2729 if (disketteExtension->IsRemoved) {
2730 {
2731 Irp->IoStatus.Information = 0;
2732 Irp->IoStatus.__annonCompField4.Status = -1073741738L;
2733 myStatus = -1073741738L;
2734 IofCompleteRequest(Irp, 0);
2735 }
2736 return (-1073741738L);
2737 } else {
2738
2739 }
2740 if (! disketteExtension->IsStarted) {
2741 if (s == NP) {
2742 s = SKIP1;
2743 } else {
2744 {
2745 errorFn();
2746 }
2747 }
2748 {
2749 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
2750 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
2751 tmp = IofCallDriver(disketteExtension->TargetObject, Irp);
2752 }
2753 return (tmp);
2754 } else {
2755
2756 }
2757 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((77UL << 16) | (unsigned long )(2 << 2))) {
2758 goto switch_16_exp_0;
2759 } else {
2760 if (irpSp->Parameters.DeviceIoControl.IoControlCode == 77UL << 16) {
2761 goto switch_16_exp_1;
2762 } else {
2763 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((7 << 16) | (3 << 14)) | (6 << 2))) {
2764 goto switch_16_exp_2;
2765 } else {
2766 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((7 << 16) | (3 << 14)) | (11 << 2))) {
2767 goto switch_16_exp_3;
2768 } else {
2769 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((7 << 16) | (1 << 14)) | (512 << 2))) {
2770 goto switch_16_exp_4;
2771 } else {
2772 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((45 << 16) | (1 << 14)) | (512 << 2))) {
2773 goto switch_16_exp_5;
2774 } else {
2775 if (irpSp->Parameters.DeviceIoControl.IoControlCode == 7 << 16) {
2776 goto switch_16_exp_6;
2777 } else {
2778 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((7 << 16) | (9 << 2))) {
2779 goto switch_16_exp_7;
2780 } else {
2781 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((7 << 16) | (768 << 2))) {
2782 goto switch_16_exp_8;
2783 } else {
2784 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((45 << 16) | (768 << 2))) {
2785 goto switch_16_exp_9;
2786 } else {
2787 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((77UL << 16) | (unsigned long )(3 << 2))) {
2788 goto switch_16_exp_10;
2789 } else {
2790 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((7 << 16) | (248 << 2))) {
2791 goto switch_16_exp_11;
2792 } else {
2793 {
2794 goto switch_16_default;
2795 if (0) {
2796 switch_16_exp_0: ;
2797 {
2798 }
2799 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < (ULONG )sizeof(MOUNTDEV_NAME )) {
2800 ntStatus = -1073741811L;
2801 goto switch_16_break;
2802 } else {
2803
2804 }
2805 mountName = Irp->AssociatedIrp.SystemBuffer;
2806 mountName->NameLength = disketteExtension->DeviceName.Length;
2807 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < (ULONG )(sizeof(USHORT ) + (unsigned int )mountName->NameLength)) {
2808 ntStatus = -2147483643L;
2809 Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME );
2810 goto switch_16_break;
2811 } else {
2812
2813 }
2814 {
2815 memcpy(mountName->Name, disketteExtension->DeviceName.Buffer,
2816 mountName->NameLength);
2817 ntStatus = 0L;
2818 Irp->IoStatus.Information = sizeof(USHORT ) + (unsigned int )mountName->NameLength;
2819 }
2820 goto switch_16_break;
2821 switch_16_exp_1: ;
2822 {
2823 }
2824 if (! disketteExtension->InterfaceString.Buffer) {
2825 ntStatus = -1073741811L;
2826 goto switch_16_break;
2827 } else {
2828 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < (ULONG )sizeof(MOUNTDEV_UNIQUE_ID )) {
2829 ntStatus = -1073741811L;
2830 goto switch_16_break;
2831 } else {
2832
2833 }
2834 }
2835 uniqueId = Irp->AssociatedIrp.SystemBuffer;
2836 uniqueId->UniqueIdLength = disketteExtension->InterfaceString.Length;
2837 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < (ULONG )(sizeof(USHORT ) + (unsigned int )uniqueId->UniqueIdLength)) {
2838 ntStatus = -2147483643L;
2839 Irp->IoStatus.Information = sizeof(MOUNTDEV_UNIQUE_ID );
2840 goto switch_16_break;
2841 } else {
2842
2843 }
2844 {
2845 memcpy(uniqueId->UniqueId, disketteExtension->InterfaceString.Buffer,
2846 uniqueId->UniqueIdLength);
2847 ntStatus = 0L;
2848 Irp->IoStatus.Information = sizeof(USHORT ) + (unsigned int )uniqueId->UniqueIdLength;
2849 }
2850 goto switch_16_break;
2851 switch_16_exp_2: ;
2852 switch_16_exp_3: ;
2853 if (irpSp->Parameters.DeviceIoControl.InputBufferLength < (ULONG )sizeof(FORMAT_PARAMETERS )) {
2854 {
2855 }
2856 ntStatus = -1073741811L;
2857 goto switch_16_break;
2858 } else {
2859
2860 }
2861 {
2862 tmp___0 = FlCheckFormatParameters(disketteExtension, (struct _FORMAT_PARAMETERS *)Irp->AssociatedIrp.SystemBuffer);
2863 }
2864 if (tmp___0) {
2865
2866 } else {
2867 {
2868 }
2869 ntStatus = -1073741811L;
2870 goto switch_16_break;
2871 }
2872 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (ULONG )(((7 << 16) | (3 << 14)) | (11 << 2))) {
2873 if (irpSp->Parameters.DeviceIoControl.InputBufferLength < (ULONG )sizeof(FORMAT_EX_PARAMETERS )) {
2874 ntStatus = -1073741811L;
2875 goto switch_16_break;
2876 } else {
2877
2878 }
2879 formatExParameters = (struct _FORMAT_EX_PARAMETERS *)Irp->AssociatedIrp.SystemBuffer;
2880 formatExParametersSize = (unsigned long )((long )(& ((FORMAT_EX_PARAMETERS *)0)->SectorNumber)) + (unsigned long )((unsigned int )formatExParameters->SectorsPerTrack * sizeof(USHORT ));
2881 if (irpSp->Parameters.DeviceIoControl.InputBufferLength < formatExParametersSize) {
2882 ntStatus = -1073741811L;
2883 goto switch_16_break;
2884 } else {
2885 if ((int )formatExParameters->FormatGapLength >= 256) {
2886 ntStatus = -1073741811L;
2887 goto switch_16_break;
2888 } else {
2889 if ((int )formatExParameters->SectorsPerTrack >= 256) {
2890 ntStatus = -1073741811L;
2891 goto switch_16_break;
2892 } else {
2893
2894 }
2895 }
2896 }
2897 } else {
2898
2899 }
2900 switch_16_exp_4: ;
2901 switch_16_exp_5: ;
2902 switch_16_exp_6: ;
2903 switch_16_exp_7: ;
2904 {
2905 }
2906 {
2907 ntStatus = FlQueueIrpToThread(Irp, disketteExtension);
2908 }
2909 goto switch_16_break;
2910 switch_16_exp_8: ;
2911 switch_16_exp_9: ;
2912 {
2913 }
2914 lowestDriveMediaType = (DriveMediaLimits + disketteExtension->DriveType)->LowestDriveMediaType;
2915 highestDriveMediaType = (DriveMediaLimits + disketteExtension->DriveType)->HighestDriveMediaType;
2916 outputBufferLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
2917 if (outputBufferLength < (ULONG )sizeof(DISK_GEOMETRY )) {
2918 {
2919 }
2920 ntStatus = -1073741789L;
2921 goto switch_16_break;
2922 } else {
2923
2924 }
2925 ntStatus = 0L;
2926 if (outputBufferLength < (ULONG )(sizeof(DISK_GEOMETRY ) * (unsigned int )(((int )highestDriveMediaType - (int )lowestDriveMediaType) + 1))) {
2927 {
2928 }
2929 ntStatus = -2147483643L;
2930 highestDriveMediaType = (enum _DRIVE_MEDIA_TYPE )((ULONG )((int )lowestDriveMediaType - 1) + outputBufferLength / (ULONG )sizeof(DISK_GEOMETRY ));
2931 } else {
2932
2933 }
2934 outputBuffer = (struct _DISK_GEOMETRY *)Irp->AssociatedIrp.SystemBuffer;
2935 i = (unsigned char )lowestDriveMediaType;
2936 {
2937 while (1) {
2938 while_25_continue: ;
2939 if ((int )i <= (int )((unsigned char )highestDriveMediaType)) {
2940
2941 } else {
2942 goto while_25_break;
2943 }
2944 outputBuffer->MediaType = (DriveMediaConstants + i)->MediaType;
2945 outputBuffer->Cylinders.__annonCompField1.LowPart = (int )(DriveMediaConstants + i)->MaximumTrack + 1;
2946 outputBuffer->Cylinders.__annonCompField1.HighPart = 0;
2947 outputBuffer->TracksPerCylinder = (DriveMediaConstants + i)->NumberOfHeads;
2948 outputBuffer->SectorsPerTrack = (DriveMediaConstants + i)->SectorsPerTrack;
2949 outputBuffer->BytesPerSector = (DriveMediaConstants + i)->BytesPerSector;
2950 {
2951 }
2952 outputBuffer += 1;
2953 Irp->IoStatus.Information += (ULONG_PTR )sizeof(DISK_GEOMETRY );
2954 i = (UCHAR )((int )i + 1);
2955 }
2956 while_25_break: ;
2957 }
2958 goto switch_16_break;
2959 switch_16_exp_10: ;
2960 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
2961 {
2962 }
2963 if (! (DeviceObject->Characteristics & 1UL)) {
2964 ntStatus = -1073741275L;
2965 goto switch_16_break;
2966 } else {
2967
2968 }
2969 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < (ULONG )sizeof(MOUNTDEV_SUGGESTED_LINK_NAME )) {
2970 ntStatus = -1073741811L;
2971 goto switch_16_break;
2972 } else {
2973
2974 }
2975 {
2976 tmp___1 = ExAllocatePoolWithTag(1, sizeof(WCHAR ) * 64U,
2977 1886350406UL);
2978 valueName = tmp___1;
2979 }
2980 if (! valueName) {
2981 ntStatus = -1073741670L;
2982 goto switch_16_break;
2983 } else {
2984
2985 }
2986 {
2987 memset(valueName, 0, sizeof(WCHAR ) * 64U);
2988 memcpy(valueName, disketteExtension->DeviceName.Buffer,
2989 disketteExtension->DeviceName.Length);
2990 driveLetterName.Buffer = driveLetterNameBuffer;
2991 driveLetterName.MaximumLength = 20;
2992 driveLetterName.Length = 0;
2993 memset(queryTable, 0, 2U * sizeof(RTL_QUERY_REGISTRY_TABLE ));
2994 queryTable[0].Flags = 36;
2995 queryTable[0].Name = valueName;
2996 queryTable[0].EntryContext = & driveLetterName;
2997 ntStatus = RtlQueryRegistryValues(0, "\\\000R\000e\000g\000i\000s\000t\000r\000y\000\\\000M\000a\000c\000h\000i\000n\000e\000\\\000S\000y\000s\000t\000e\000m\000\\\000D\000I\000S\000K\000",
2998 queryTable, (void *)0,
2999 (void *)0);
3000 }
3001 if (! (ntStatus >= 0L)) {
3002 {
3003
3004 }
3005 goto switch_16_break;
3006 } else {
3007
3008 }
3009 if ((int )driveLetterName.Length != 4) {
3010 {
3011 ntStatus = -1073741275L;
3012
3013 }
3014 goto switch_16_break;
3015 } else {
3016 if ((int )*(driveLetterName.Buffer + 0) < 65) {
3017 {
3018 ntStatus = -1073741275L;
3019
3020 }
3021 goto switch_16_break;
3022 } else {
3023 if ((int )*(driveLetterName.Buffer + 0) > 90) {
3024 {
3025 ntStatus = -1073741275L;
3026
3027 }
3028 goto switch_16_break;
3029 } else {
3030 if ((int )*(driveLetterName.Buffer + 1) != 58) {
3031 {
3032 ntStatus = -1073741275L;
3033
3034 }
3035 goto switch_16_break;
3036 } else {
3037
3038 }
3039 }
3040 }
3041 }
3042 suggestedName = Irp->AssociatedIrp.SystemBuffer;
3043 suggestedName->UseOnlyIfThereAreNoOtherLinks = 1;
3044 suggestedName->NameLength = 28;
3045 Irp->IoStatus.Information = (long )(& ((MOUNTDEV_SUGGESTED_LINK_NAME *)0)->Name) + 28L;
3046 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < Irp->IoStatus.Information) {
3047 {
3048 Irp->IoStatus.Information = sizeof(MOUNTDEV_SUGGESTED_LINK_NAME );
3049 ntStatus = -2147483643L;
3050
3051 }
3052 goto switch_16_break;
3053 } else {
3054
3055 }
3056 {
3057 RtlDeleteRegistryValue(0, "\\\000R\000e\000g\000i\000s\000t\000r\000y\000\\\000M\000a\000c\000h\000i\000n\000e\000\\\000S\000y\000s\000t\000e\000m\000\\\000D\000I\000S\000K\000",
3058 valueName);
3059
3060 memcpy(suggestedName->Name, "\\\000D\000o\000s\000D\000e\000v\000i\000c\000e\000s\000\\\000",
3061 24);
3062 suggestedName->Name[12] = *(driveLetterName.Buffer + 0);
3063 suggestedName->Name[13] = ':';
3064 }
3065 goto switch_16_break;
3066 } else {
3067
3068 }
3069 switch_16_exp_11: ;
3070 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
3071 {
3072 }
3073 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < (ULONG )sizeof(SENSE_DEVISE_STATUS_PTOS )) {
3074 {
3075 }
3076 ntStatus = -1073741811L;
3077 goto switch_16_break;
3078 } else {
3079
3080 }
3081 {
3082 }
3083 {
3084 ntStatus = FlQueueIrpToThread(Irp, disketteExtension);
3085 }
3086 goto switch_16_break;
3087 } else {
3088
3089 }
3090 switch_16_default: ;
3091 if (s == NP) {
3092 s = SKIP1;
3093 } else {
3094 {
3095 errorFn();
3096 }
3097 }
3098 {
3099 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3100 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3101 ntStatus = IofCallDriver(disketteExtension->TargetObject,
3102 Irp);
3103 }
3104 return (ntStatus);
3105 } else {
3106 switch_16_break: ;
3107 }
3108 }
3109 }
3110 }
3111 }
3112 }
3113 }
3114 }
3115 }
3116 }
3117 }
3118 }
3119 }
3120 }
3121 if (ntStatus != 259L) {
3122 Irp->IoStatus.__annonCompField4.Status = ntStatus;
3123 myStatus = ntStatus;
3124 if (! (ntStatus >= 0L)) {
3125 if (ntStatus == -1073741661L) {
3126 tmp___2 = 1;
3127 } else {
3128 if (ntStatus == -1073741643L) {
3129 tmp___2 = 1;
3130 } else {
3131 if (ntStatus == -1073741662L) {
3132 tmp___2 = 1;
3133 } else {
3134 if (ntStatus == -1073741805L) {
3135 tmp___2 = 1;
3136 } else {
3137 if (ntStatus == -2147483626L) {
3138 tmp___2 = 1;
3139 } else {
3140 if (ntStatus == -1073741804L) {
3141 tmp___2 = 1;
3142 } else {
3143 if (ntStatus == -1073741806L) {
3144 tmp___2 = 1;
3145 } else {
3146 tmp___2 = 0;
3147 }
3148 }
3149 }
3150 }
3151 }
3152 }
3153 }
3154 if ((unsigned char )tmp___2) {
3155 {
3156
3157 }
3158 } else {
3159
3160 }
3161 } else {
3162
3163 }
3164 {
3165 IofCompleteRequest(Irp, 0);
3166 }
3167 } else {
3168
3169 }
3170 return (ntStatus);
3171}
3172}
3173NTSTATUS FloppyPnp(PDEVICE_OBJECT DeviceObject , PIRP Irp )
3174{ PIO_STACK_LOCATION irpSp ;
3175 PDISKETTE_EXTENSION disketteExtension ;
3176 NTSTATUS ntStatus ;
3177 KEVENT doneEvent ;
3178 PIO_STACK_LOCATION irpSp___0 ;
3179 PIO_STACK_LOCATION nextIrpSp ;
3180 PIO_STACK_LOCATION irpSp___1 ;
3181 PCONFIGURATION_INFORMATION tmp ;
3182
3183 {
3184 ntStatus = 0L;
3185 {
3186 }
3187 {
3188
3189 PagingReferenceCount += 1UL;
3190 }
3191 if (PagingReferenceCount == 1UL) {
3192 {
3193
3194 }
3195 } else {
3196
3197 }
3198 {
3199
3200 disketteExtension = DeviceObject->DeviceExtension;
3201 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
3202 }
3203 if (disketteExtension->IsRemoved) {
3204 {
3205 Irp->IoStatus.Information = 0;
3206 Irp->IoStatus.__annonCompField4.Status = -1073741738L;
3207 myStatus = -1073741738L;
3208 IofCompleteRequest(Irp, 0);
3209 }
3210 return (-1073741738L);
3211 } else {
3212
3213 }
3214 if (irpSp->MinorFunction == 0) {
3215 goto switch_32_0;
3216 } else {
3217 if (irpSp->MinorFunction == 5) {
3218 goto switch_32_5;
3219 } else {
3220 if (irpSp->MinorFunction == 1) {
3221 goto switch_32_1;
3222 } else {
3223 if (irpSp->MinorFunction == 6) {
3224 goto switch_32_6;
3225 } else {
3226 if (irpSp->MinorFunction == 3) {
3227 goto switch_32_3;
3228 } else {
3229 if (irpSp->MinorFunction == 4) {
3230 goto switch_32_4;
3231 } else {
3232 if (irpSp->MinorFunction == 2) {
3233 goto switch_32_2;
3234 } else {
3235 {
3236 goto switch_32_default;
3237 if (0) {
3238 switch_32_0:
3239 {
3240 ntStatus = FloppyStartDevice(DeviceObject, Irp);
3241 }
3242 goto switch_32_break;
3243 switch_32_5: ;
3244 switch_32_1: ;
3245 if ((int )irpSp->MinorFunction == 5) {
3246 {
3247 }
3248 } else {
3249 {
3250 }
3251 }
3252 if (! disketteExtension->IsStarted) {
3253 if (s == NP) {
3254 s = SKIP1;
3255 } else {
3256 {
3257 errorFn();
3258 }
3259 }
3260 {
3261 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3262 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3263 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3264 }
3265 return (ntStatus);
3266 } else {
3267
3268 }
3269 {
3270
3271 disketteExtension->HoldNewRequests = 1;
3272
3273 ntStatus = FlQueueIrpToThread(Irp, disketteExtension);
3274 }
3275 if (ntStatus == 259L) {
3276 {
3277 KeWaitForSingleObject(disketteExtension->FloppyThread, 0, 0, 0,
3278 (void *)0);
3279 }
3280 if ((unsigned int )disketteExtension->FloppyThread != (unsigned int )((void *)0)) {
3281 {
3282
3283 }
3284 } else {
3285
3286 }
3287 disketteExtension->FloppyThread = (void *)0;
3288 Irp->IoStatus.__annonCompField4.Status = 0L;
3289 myStatus = 0L;
3290 if (s == NP) {
3291 s = SKIP1;
3292 } else {
3293 {
3294 errorFn();
3295 }
3296 }
3297 {
3298 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3299 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3300 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3301 }
3302 } else {
3303 {
3304 ntStatus = -1073741823L;
3305 Irp->IoStatus.__annonCompField4.Status = ntStatus;
3306 myStatus = ntStatus;
3307 Irp->IoStatus.Information = 0;
3308 IofCompleteRequest(Irp, 0);
3309 }
3310 }
3311 goto switch_32_break;
3312 switch_32_6: ;
3313 switch_32_3: ;
3314 if ((int )irpSp->MinorFunction == 6) {
3315 {
3316 }
3317 } else {
3318 {
3319 }
3320 }
3321 if (! disketteExtension->IsStarted) {
3322 Irp->IoStatus.__annonCompField4.Status = 0L;
3323 myStatus = 0L;
3324 if (s == NP) {
3325 s = SKIP1;
3326 } else {
3327 {
3328 errorFn();
3329 }
3330 }
3331 {
3332 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3333 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3334 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3335 }
3336 } else {
3337 {
3338 Irp->IoStatus.__annonCompField4.Status = 0L;
3339 myStatus = 0L;
3340 irpSp___0 = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
3341 nextIrpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation - 1;
3342 memcpy(nextIrpSp, irpSp___0, (long )(& ((IO_STACK_LOCATION *)0)->CompletionRoutine));
3343 nextIrpSp->Control = 0;
3344
3345 }
3346 if (s != NP) {
3347 {
3348 errorFn();
3349 }
3350 } else {
3351 if (compRegistered != 0) {
3352 {
3353 errorFn();
3354 }
3355 } else {
3356 compRegistered = 1;
3357 compFptr = & FloppyPnpComplete;
3358 }
3359 }
3360 {
3361 irpSp___1 = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation - 1;
3362 irpSp___1->CompletionRoutine = & FloppyPnpComplete;
3363 irpSp___1->Context = & doneEvent;
3364 irpSp___1->Control = 0;
3365 irpSp___1->Control = 64;
3366 irpSp___1->Control = (int )irpSp___1->Control | 128;
3367 irpSp___1->Control = (int )irpSp___1->Control | 32;
3368 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3369 }
3370 if (ntStatus == 259L) {
3371 {
3372 KeWaitForSingleObject(& doneEvent, 0, 0, 0, (void *)0);
3373 ntStatus = myStatus;
3374 }
3375 } else {
3376
3377 }
3378 {
3379
3380 disketteExtension->HoldNewRequests = 0;
3381
3382 FloppyProcessQueuedRequests(disketteExtension);
3383 Irp->IoStatus.__annonCompField4.Status = ntStatus;
3384 myStatus = ntStatus;
3385 Irp->IoStatus.Information = 0;
3386 IofCompleteRequest(Irp, 0);
3387 }
3388 }
3389 goto switch_32_break;
3390 switch_32_4: ;
3391 {
3392 }
3393 disketteExtension->IsStarted = 0;
3394 Irp->IoStatus.__annonCompField4.Status = 0L;
3395 myStatus = 0L;
3396 if (s == NP) {
3397 s = SKIP1;
3398 } else {
3399 {
3400 errorFn();
3401 }
3402 }
3403 {
3404 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3405 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3406 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3407 }
3408 goto switch_32_break;
3409 switch_32_2: ;
3410 {
3411 }
3412 {
3413
3414 disketteExtension->HoldNewRequests = 0;
3415
3416 disketteExtension->IsStarted = 0;
3417 disketteExtension->IsRemoved = 1;
3418 FloppyProcessQueuedRequests(disketteExtension);
3419 }
3420 if (s == NP) {
3421 s = SKIP1;
3422 } else {
3423 {
3424 errorFn();
3425 }
3426 }
3427 {
3428 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3429 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3430 Irp->IoStatus.__annonCompField4.Status = 0L;
3431 myStatus = 0L;
3432 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3433 }
3434 if ((unsigned int )disketteExtension->InterfaceString.Buffer != (unsigned int )((void *)0)) {
3435 {
3436 IoSetDeviceInterfaceState(& disketteExtension->InterfaceString,
3437 0);
3438
3439
3440 }
3441 } else {
3442
3443 }
3444 {
3445
3446
3447 }
3448 if ((int )disketteExtension->ArcName.Length != 0) {
3449 {
3450 IoDeleteSymbolicLink(& disketteExtension->ArcName);
3451
3452
3453 }
3454 } else {
3455
3456 }
3457 {
3458
3459
3460 tmp = IoGetConfigurationInformation();
3461 tmp->FloppyCount -= 1UL;
3462 }
3463 goto switch_32_break;
3464 switch_32_default: ;
3465 {
3466 }
3467 if (s == NP) {
3468 s = SKIP1;
3469 } else {
3470 {
3471 errorFn();
3472 }
3473 }
3474 {
3475 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3476 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3477 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3478 }
3479 } else {
3480 switch_32_break: ;
3481 }
3482 }
3483 }
3484 }
3485 }
3486 }
3487 }
3488 }
3489 }
3490 {
3491
3492 PagingReferenceCount -= 1UL;
3493 }
3494 if (PagingReferenceCount == 0UL) {
3495 {
3496
3497 }
3498 } else {
3499
3500 }
3501 {
3502
3503 }
3504 return (ntStatus);
3505}
3506}
3507NTSTATUS FloppyStartDevice(PDEVICE_OBJECT DeviceObject , PIRP Irp )
3508{ NTSTATUS ntStatus ;
3509 NTSTATUS pnpStatus ;
3510 KEVENT doneEvent ;
3511 FDC_INFO fdcInfo ;
3512 CONFIGURATION_TYPE Dc ;
3513 CONFIGURATION_TYPE Fp ;
3514 PDISKETTE_EXTENSION disketteExtension ;
3515 PIO_STACK_LOCATION irpSp ;
3516 PIO_STACK_LOCATION irpSp___0 ;
3517 PIO_STACK_LOCATION nextIrpSp ;
3518 PIO_STACK_LOCATION irpSp___1 ;
3519 INTERFACE_TYPE InterfaceType ;
3520
3521 {
3522 Dc = 13;
3523 Fp = 26;
3524 disketteExtension = (DISKETTE_EXTENSION *)DeviceObject->DeviceExtension;
3525 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
3526 {
3527 }
3528 {
3529 }
3530 {
3531 }
3532 {
3533
3534 irpSp___0 = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
3535 nextIrpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation - 1;
3536 memcpy(nextIrpSp, irpSp___0, (long )(& ((IO_STACK_LOCATION *)0)->CompletionRoutine));
3537 nextIrpSp->Control = 0;
3538 }
3539 if (s != NP) {
3540 {
3541 errorFn();
3542 }
3543 } else {
3544 if (compRegistered != 0) {
3545 {
3546 errorFn();
3547 }
3548 } else {
3549 compRegistered = 1;
3550 compFptr = & FloppyPnpComplete;
3551 }
3552 }
3553 {
3554 irpSp___1 = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation - 1;
3555 irpSp___1->CompletionRoutine = & FloppyPnpComplete;
3556 irpSp___1->Context = & doneEvent;
3557 irpSp___1->Control = 0;
3558 irpSp___1->Control = 64;
3559 irpSp___1->Control = (int )irpSp___1->Control | 128;
3560 irpSp___1->Control = (int )irpSp___1->Control | 32;
3561 ntStatus = IofCallDriver(disketteExtension->TargetObject, Irp);
3562 }
3563 if (ntStatus == 259L) {
3564 {
3565 ntStatus = KeWaitForSingleObject(& doneEvent, 0, 0, 0, (void *)0);
3566 ntStatus = myStatus;
3567 }
3568 } else {
3569
3570 }
3571 {
3572 fdcInfo.BufferCount = 0;
3573 fdcInfo.BufferSize = 0;
3574 ntStatus = FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (770 << 2)) | 3,
3575 & fdcInfo);
3576 }
3577 if (ntStatus >= 0L) {
3578 disketteExtension->MaxTransferSize = fdcInfo.MaxTransferSize;
3579 if (fdcInfo.AcpiBios) {
3580 if (fdcInfo.AcpiFdiSupported) {
3581 {
3582 ntStatus = FlAcpiConfigureFloppy(disketteExtension, & fdcInfo);
3583 }
3584 if ((int )disketteExtension->DriveType == 4) {
3585 disketteExtension->PerpendicularMode = (int )disketteExtension->PerpendicularMode | (1 << fdcInfo.PeripheralNumber);
3586 } else {
3587
3588 }
3589 } else {
3590 goto _L;
3591 }
3592 } else {
3593 _L:
3594 if ((int )disketteExtension->DriveType == 4) {
3595 disketteExtension->PerpendicularMode = (int )disketteExtension->PerpendicularMode | (1 << fdcInfo.PeripheralNumber);
3596 } else {
3597
3598 }
3599 InterfaceType = 0;
3600 {
3601 while (1) {
3602 while_43_continue: ;
3603 if ((int )InterfaceType < 16) {
3604
3605 } else {
3606 goto while_43_break;
3607 }
3608 {
3609 fdcInfo.BusType = InterfaceType;
3610 ntStatus = IoQueryDeviceDescription(& fdcInfo.BusType, & fdcInfo.BusNumber,
3611 & Dc, & fdcInfo.ControllerNumber, & Fp,
3612 & fdcInfo.PeripheralNumber, & FlConfigCallBack,
3613 disketteExtension);
3614 }
3615 if (ntStatus >= 0L) {
3616 {
3617 }
3618 goto while_43_break;
3619 } else {
3620
3621 }
3622 InterfaceType = (INTERFACE_TYPE )((int )InterfaceType + 1);
3623 }
3624 while_43_break: ;
3625 }
3626 }
3627 if (ntStatus >= 0L) {
3628 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
3629 disketteExtension->DeviceUnit = (unsigned char )fdcInfo.UnitNumber;
3630 disketteExtension->DriveOnValue = (unsigned char )fdcInfo.UnitNumber;
3631 } else {
3632 disketteExtension->DeviceUnit = (unsigned char )fdcInfo.PeripheralNumber;
3633 disketteExtension->DriveOnValue = (unsigned char )(fdcInfo.PeripheralNumber | (unsigned long )(16 << fdcInfo.PeripheralNumber));
3634 }
3635 {
3636 pnpStatus = IoRegisterDeviceInterface(disketteExtension->UnderlyingPDO, (GUID *)(& MOUNTDEV_MOUNTED_DEVICE_GUID),
3637 (void *)0, & disketteExtension->InterfaceString);
3638 }
3639 if (pnpStatus >= 0L) {
3640 {
3641 pnpStatus = IoSetDeviceInterfaceState(& disketteExtension->InterfaceString,
3642 1);
3643 }
3644 } else {
3645
3646 }
3647 {
3648 disketteExtension->IsStarted = 1;
3649
3650 disketteExtension->HoldNewRequests = 0;
3651
3652 FloppyProcessQueuedRequests(disketteExtension);
3653 }
3654 } else {
3655
3656 }
3657 } else {
3658
3659 }
3660 {
3661 Irp->IoStatus.__annonCompField4.Status = ntStatus;
3662 myStatus = ntStatus;
3663 IofCompleteRequest(Irp, 0);
3664 }
3665 return (ntStatus);
3666}
3667}
3668NTSTATUS FloppyPnpComplete(PDEVICE_OBJECT DeviceObject , PIRP Irp , PVOID Context )
3669{
3670
3671 {
3672 {
3673 KeSetEvent((struct _KEVENT *)Context, 1, 0);
3674 }
3675 return (-1073741802L);
3676}
3677}
3678NTSTATUS FloppyPower(PDEVICE_OBJECT DeviceObject , PIRP Irp )
3679{ PDISKETTE_EXTENSION disketteExtension ;
3680 NTSTATUS ntStatus ;
3681 PIO_STACK_LOCATION irpSp ;
3682 POWER_STATE_TYPE type ;
3683 POWER_STATE state ;
3684 BOOLEAN WaitForCompletion ;
3685
3686 {
3687 ntStatus = myStatus;
3688 WaitForCompletion = 1;
3689 {
3690 }
3691 disketteExtension = DeviceObject->DeviceExtension;
3692 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
3693 type = irpSp->Parameters.Power.Type;
3694 state = irpSp->Parameters.Power.State;
3695 if (irpSp->MinorFunction == 3) {
3696 goto switch_46_3;
3697 } else {
3698 if (irpSp->MinorFunction == 2) {
3699 goto switch_46_2;
3700 } else {
3701 {
3702 goto switch_46_default;
3703 if (0) {
3704 switch_46_3: ;
3705 {
3706 }
3707 if ((int )type == 0) {
3708 if ((int )state.SystemState > 5) {
3709 ntStatus = 0L;
3710 goto switch_46_break;
3711 } else {
3712
3713 }
3714 } else {
3715
3716 }
3717 {
3718
3719 }
3720 if (disketteExtension->ThreadReferenceCount >= 0L) {
3721 {
3722
3723 }
3724 {
3725 }
3726 {
3727
3728 Irp->IoStatus.Information = 0;
3729 Irp->IoStatus.__annonCompField4.Status = -2147483631L;
3730 myStatus = -2147483631L;
3731 IofCompleteRequest(Irp, 0);
3732 }
3733 return (-2147483631L);
3734 } else {
3735
3736 }
3737 {
3738
3739 ntStatus = 0L;
3740 }
3741 goto switch_46_break;
3742 switch_46_2: ;
3743 if ((int )type == 0) {
3744 {
3745
3746 }
3747 if ((int )state.SystemState == 1) {
3748 {
3749 }
3750 disketteExtension->PoweringDown = 0;
3751 WaitForCompletion = 0;
3752 } else {
3753 {
3754 }
3755 WaitForCompletion = 1;
3756 disketteExtension->PoweringDown = 1;
3757 }
3758 {
3759
3760 }
3761 if ((unsigned int )disketteExtension->FloppyThread != (unsigned int )((void *)0)) {
3762 if ((int )WaitForCompletion == 1) {
3763 {
3764 KeWaitForSingleObject(disketteExtension->FloppyThread, 0, 0, 0, (void *)0);
3765 }
3766 } else {
3767
3768 }
3769 } else {
3770
3771 }
3772 } else {
3773
3774 }
3775 {
3776 }
3777 ntStatus = 0L;
3778 goto switch_46_break;
3779 switch_46_default: ;
3780 goto switch_46_break;
3781 } else {
3782 switch_46_break: ;
3783 }
3784 }
3785 }
3786 }
3787 {
3788
3789 }
3790 if (s == NP) {
3791 s = SKIP1;
3792 } else {
3793 {
3794 errorFn();
3795 }
3796 }
3797 {
3798 Irp->CurrentLocation = (CHAR )((int )Irp->CurrentLocation + 1);
3799 Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation += 1;
3800 ntStatus = PoCallDriver(disketteExtension->TargetObject, Irp);
3801 }
3802 return (ntStatus);
3803}
3804}
3805NTSTATUS FloppyReadWrite(PDEVICE_OBJECT DeviceObject , PIRP Irp )
3806{ PIO_STACK_LOCATION irpSp ;
3807 NTSTATUS ntStatus ;
3808 PDISKETTE_EXTENSION disketteExtension ;
3809
3810 {
3811 {
3812 }
3813 {
3814 disketteExtension = DeviceObject->DeviceExtension;
3815 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
3816
3817 }
3818 if (disketteExtension->HoldNewRequests) {
3819 {
3820 ntStatus = FloppyQueueRequest(disketteExtension, Irp);
3821
3822 }
3823 return (ntStatus);
3824 } else {
3825
3826 }
3827 {
3828
3829 }
3830 if (disketteExtension->IsRemoved) {
3831 goto _L;
3832 } else {
3833 if (! disketteExtension->IsStarted) {
3834 _L:
3835 if (disketteExtension->IsRemoved) {
3836 ntStatus = -1073741738L;
3837 } else {
3838 ntStatus = -1073741823L;
3839 }
3840 {
3841 Irp->IoStatus.Information = 0;
3842 Irp->IoStatus.__annonCompField4.Status = ntStatus;
3843 myStatus = ntStatus;
3844 IofCompleteRequest(Irp, 0);
3845 }
3846 return (ntStatus);
3847 } else {
3848
3849 }
3850 }
3851 if ((int )disketteExtension->MediaType > 0) {
3852 if (irpSp->Parameters.Read.ByteOffset.__annonCompField1.LowPart + irpSp->Parameters.Read.Length > disketteExtension->ByteCapacity) {
3853 goto _L___1;
3854 } else {
3855 if ((irpSp->Parameters.Read.Length & (disketteExtension->BytesPerSector - 1UL)) != 0UL) {
3856 _L___1:
3857 {
3858 }
3859 {
3860 }
3861 ntStatus = -1073741811L;
3862 } else {
3863 goto _L___0;
3864 }
3865 }
3866 } else {
3867 _L___0:
3868 if (irpSp->Parameters.Read.Length) {
3869 {
3870 }
3871 {
3872 ntStatus = FlQueueIrpToThread(Irp, disketteExtension);
3873 }
3874 } else {
3875 Irp->IoStatus.Information = 0;
3876 Irp->IoStatus.__annonCompField4.Status = 0L;
3877 myStatus = 0L;
3878 {
3879 }
3880 {
3881 IofCompleteRequest(Irp, 0);
3882 }
3883 return (0L);
3884 }
3885 }
3886 if (ntStatus != 259L) {
3887 Irp->IoStatus.__annonCompField4.Status = ntStatus;
3888 myStatus = ntStatus;
3889 {
3890 }
3891 {
3892 IofCompleteRequest(Irp, 0);
3893 }
3894 } else {
3895
3896 }
3897 return (ntStatus);
3898}
3899}
3900NTSTATUS FlInterpretError(UCHAR StatusRegister1 , UCHAR StatusRegister2 )
3901{
3902
3903 {
3904 if ((int )StatusRegister1 & 32) {
3905 goto _L;
3906 } else {
3907 if ((int )StatusRegister2 & 32) {
3908 _L:
3909 {
3910 }
3911 return (-1073741761L);
3912 } else {
3913
3914 }
3915 }
3916 if ((int )StatusRegister1 & 16) {
3917 {
3918 }
3919 return (-1073741764L);
3920 } else {
3921
3922 }
3923 if ((int )StatusRegister1 & 4) {
3924 goto _L___0;
3925 } else {
3926 if ((int )StatusRegister1 & 128) {
3927 _L___0:
3928 {
3929 }
3930 return (-1073741803L);
3931 } else {
3932
3933 }
3934 }
3935 if ((int )StatusRegister2 & 1) {
3936 goto _L___1;
3937 } else {
3938 if ((int )StatusRegister2 & 2) {
3939 goto _L___1;
3940 } else {
3941 if ((int )StatusRegister2 & 64) {
3942 _L___1:
3943 {
3944 }
3945 return (-1073741668L);
3946 } else {
3947
3948 }
3949 }
3950 }
3951 if ((int )StatusRegister1 & 2) {
3952 {
3953 }
3954 return (-1073741662L);
3955 } else {
3956
3957 }
3958 if ((int )StatusRegister1 & 1) {
3959 {
3960 }
3961 return (-1073741467L);
3962 } else {
3963
3964 }
3965 if ((int )StatusRegister2 & 16) {
3966 {
3967 }
3968 return (-1073741466L);
3969 } else {
3970
3971 }
3972 {
3973 }
3974 return (-1073741465L);
3975}
3976}
3977void FlFinishOperation(PIRP Irp , PDISKETTE_EXTENSION DisketteExtension )
3978{ NTSTATUS ntStatus ;
3979 int tmp ;
3980
3981 {
3982 {
3983 }
3984 if (myStatus != 0L) {
3985 if (DisketteExtension->HardwareFailed) {
3986 DisketteExtension->HardwareFailCount = (UCHAR )((int )DisketteExtension->HardwareFailCount + 1);
3987 if ((int )DisketteExtension->HardwareFailCount < 2) {
3988 {
3989 ntStatus = FlInitializeControllerHardware(DisketteExtension);
3990 }
3991 if (ntStatus >= 0L) {
3992 {
3993 }
3994 DisketteExtension->MediaType = -1;
3995 {
3996 }
3997 {
3998
3999 DisketteExtension->ThreadReferenceCount += 1L;
4000
4001 ExfInterlockedInsertHeadList(& DisketteExtension->ListEntry, & Irp->Tail.Overlay.__annonCompField17.ListEntry,
4002 & DisketteExtension->ListSpinLock);
4003 }
4004 return;
4005 } else {
4006
4007 }
4008 {
4009 }
4010 } else {
4011
4012 }
4013 } else {
4014
4015 }
4016 } else {
4017
4018 }
4019 DisketteExtension->HardwareFailCount = 0;
4020 if (! (myStatus >= 0L)) {
4021 if (myStatus == -1073741661L) {
4022 tmp = 1;
4023 } else {
4024 if (myStatus == -1073741643L) {
4025 tmp = 1;
4026 } else {
4027 if (myStatus == -1073741662L) {
4028 tmp = 1;
4029 } else {
4030 if (myStatus == -1073741805L) {
4031 tmp = 1;
4032 } else {
4033 if (myStatus == -2147483626L) {
4034 tmp = 1;
4035 } else {
4036 if (myStatus == -1073741804L) {
4037 tmp = 1;
4038 } else {
4039 if (myStatus == -1073741806L) {
4040 tmp = 1;
4041 } else {
4042 tmp = 0;
4043 }
4044 }
4045 }
4046 }
4047 }
4048 }
4049 }
4050 if ((unsigned char )tmp) {
4051 {
4052
4053 }
4054 } else {
4055
4056 }
4057 } else {
4058
4059 }
4060 if (myStatus != 0L) {
4061 if (myStatus != -2147483626L) {
4062 if (myStatus != -1073741805L) {
4063 {
4064 }
4065 } else {
4066 goto _L___0;
4067 }
4068 } else {
4069 goto _L___0;
4070 }
4071 } else {
4072 _L___0:
4073 {
4074 }
4075 }
4076 {
4077 }
4078 {
4079 }
4080 {
4081 IofCompleteRequest(Irp, 1);
4082 }
4083 return;
4084}
4085}
4086NTSTATUS FlStartDrive(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp , BOOLEAN WriteOperation ,
4087 BOOLEAN SetUpMedia , BOOLEAN IgnoreChange )
4088{ LARGE_INTEGER delay ;
4089 BOOLEAN motorStarted ;
4090 UCHAR driveStatus ;
4091 NTSTATUS ntStatus ;
4092 FDC_ENABLE_PARMS fdcEnableParms ;
4093 FDC_DISK_CHANGE_PARMS fdcDiskChangeParms ;
4094
4095 {
4096 ntStatus = 0L;
4097 {
4098 }
4099 *(DriveMediaConstants + (DriveMediaLimits + DisketteExtension->DriveType)->HighestDriveMediaType) = DisketteExtension->BiosDriveMediaConstants;
4100 if ((int )DisketteExtension->MediaType == -1) {
4101 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + 0);
4102 } else {
4103 if ((int )DisketteExtension->MediaType == 0) {
4104 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + 0);
4105 } else {
4106
4107 }
4108 }
4109 fdcEnableParms.DriveOnValue = DisketteExtension->DriveOnValue;
4110 if (WriteOperation) {
4111 fdcEnableParms.TimeToWait = DisketteExtension->DriveMediaConstants.MotorSettleTimeWrite;
4112 } else {
4113 fdcEnableParms.TimeToWait = DisketteExtension->DriveMediaConstants.MotorSettleTimeRead;
4114 }
4115 {
4116 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (774 << 2)) | 3,
4117 & fdcEnableParms);
4118 motorStarted = fdcEnableParms.MotorStarted;
4119 }
4120 if (ntStatus >= 0L) {
4121 {
4122 fdcDiskChangeParms.DriveOnValue = DisketteExtension->DriveOnValue;
4123 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (776 << 2)) | 3,
4124 & fdcDiskChangeParms);
4125 driveStatus = fdcDiskChangeParms.DriveStatus;
4126 }
4127 } else {
4128
4129 }
4130 if (! (ntStatus >= 0L)) {
4131 return (ntStatus);
4132 } else {
4133
4134 }
4135 if ((int )DisketteExtension->DriveType == 0) {
4136 if (motorStarted) {
4137 goto _L___1;
4138 } else {
4139 goto _L___3;
4140 }
4141 } else {
4142 _L___3:
4143 if ((int )DisketteExtension->DriveType != 0) {
4144 if ((int )driveStatus & 128) {
4145 _L___1:
4146 {
4147 }
4148 DisketteExtension->MediaType = -1;
4149 if ((int )((DisketteExtension->DeviceObject)->Vpb)->Flags & 1) {
4150 if (Irp) {
4151 {
4152
4153 }
4154 } else {
4155
4156 }
4157 (DisketteExtension->DeviceObject)->Flags |= 2UL;
4158 } else {
4159
4160 }
4161 if ((int )DisketteExtension->DriveType != 0) {
4162 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4163 {
4164 DisketteExtension->FifoBuffer[0] = 14;
4165 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
4166 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4167 DisketteExtension->FifoBuffer, (void *)0, 0,
4168 0);
4169 }
4170 if (! (ntStatus >= 0L)) {
4171 {
4172 }
4173 return (ntStatus);
4174 } else {
4175
4176 }
4177 if ((int )DisketteExtension->FifoBuffer[0] & 32) {
4178 driveStatus = 127;
4179 } else {
4180 driveStatus = 128;
4181 }
4182 if ((int )driveStatus & 128) {
4183 {
4184 }
4185 if ((int )((DisketteExtension->DeviceObject)->Vpb)->Flags & 1) {
4186 (DisketteExtension->DeviceObject)->Flags &= 4294967293UL;
4187 } else {
4188
4189 }
4190 return (-1073741805L);
4191 } else {
4192
4193 }
4194 } else {
4195
4196 }
4197 {
4198 DisketteExtension->FifoBuffer[0] = 16;
4199 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
4200 DisketteExtension->FifoBuffer[2] = 1;
4201 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4202 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
4203 }
4204 if (! (ntStatus >= 0L)) {
4205 {
4206 }
4207 return (ntStatus);
4208 } else {
4209 if (! ((int )DisketteExtension->FifoBuffer[0] & 32)) {
4210 goto _L;
4211 } else {
4212 if ((int )DisketteExtension->FifoBuffer[1] != 1) {
4213 _L:
4214 {
4215 }
4216 DisketteExtension->HardwareFailed = 1;
4217 return (-1073741464L);
4218 } else {
4219
4220 }
4221 }
4222 }
4223 {
4224 DisketteExtension->FifoBuffer[0] = 16;
4225 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
4226 DisketteExtension->FifoBuffer[2] = 0;
4227 delay.__annonCompField1.LowPart = 4294966396UL;
4228 delay.__annonCompField1.HighPart = -1;
4229 KeDelayExecutionThread(0, 0, & delay);
4230 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4231 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
4232 delay.__annonCompField1.LowPart = 4294967291UL;
4233 delay.__annonCompField1.HighPart = -1;
4234 KeDelayExecutionThread(0, 0, & delay);
4235 }
4236 if (! (ntStatus >= 0L)) {
4237 {
4238 }
4239 return (ntStatus);
4240 } else {
4241 if (! ((int )DisketteExtension->FifoBuffer[0] & 32)) {
4242 goto _L___0;
4243 } else {
4244 if ((int )DisketteExtension->FifoBuffer[1] != 0) {
4245 _L___0:
4246 {
4247 }
4248 DisketteExtension->HardwareFailed = 1;
4249 return (-1073741464L);
4250 } else {
4251
4252 }
4253 }
4254 }
4255 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4256 {
4257 DisketteExtension->FifoBuffer[0] = 14;
4258 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
4259 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4260 DisketteExtension->FifoBuffer, (void *)0, 0,
4261 0);
4262 }
4263 if (! (ntStatus >= 0L)) {
4264 {
4265 }
4266 return (ntStatus);
4267 } else {
4268
4269 }
4270 if ((int )DisketteExtension->FifoBuffer[0] & 32) {
4271 driveStatus = 127;
4272 } else {
4273 driveStatus = 128;
4274 }
4275 } else {
4276 {
4277 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (776 << 2)) | 3,
4278 & fdcDiskChangeParms);
4279 driveStatus = fdcDiskChangeParms.DriveStatus;
4280 }
4281 if (! (ntStatus >= 0L)) {
4282 return (ntStatus);
4283 } else {
4284
4285 }
4286 }
4287 if ((int )driveStatus & 128) {
4288 {
4289 }
4290 if ((int )((DisketteExtension->DeviceObject)->Vpb)->Flags & 1) {
4291 (DisketteExtension->DeviceObject)->Flags &= 4294967293UL;
4292 } else {
4293
4294 }
4295 return (-1073741805L);
4296 } else {
4297
4298 }
4299 } else {
4300
4301 }
4302 if ((int )IgnoreChange == 0) {
4303 if ((int )((DisketteExtension->DeviceObject)->Vpb)->Flags & 1) {
4304 {
4305 }
4306 return (-2147483626L);
4307 } else {
4308 return (-1073741435L);
4309 }
4310 } else {
4311
4312 }
4313 } else {
4314 goto _L___2;
4315 }
4316 } else {
4317 _L___2:
4318 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4319 {
4320 FlHdbit(DisketteExtension);
4321 }
4322 } else {
4323
4324 }
4325 }
4326 }
4327 if (SetUpMedia) {
4328 if ((int )DisketteExtension->MediaType == -1) {
4329 {
4330 ntStatus = FlDetermineMediaType(DisketteExtension);
4331 }
4332 } else {
4333 if ((int )DisketteExtension->MediaType == 0) {
4334 {
4335 }
4336 return (-1073741804L);
4337 } else {
4338 if ((int )DisketteExtension->DriveMediaType != (int )DisketteExtension->LastDriveMediaType) {
4339 {
4340 ntStatus = FlDatarateSpecifyConfigure(DisketteExtension);
4341 }
4342 if (! (ntStatus >= 0L)) {
4343 {
4344 }
4345 } else {
4346
4347 }
4348 } else {
4349
4350 }
4351 }
4352 }
4353 } else {
4354
4355 }
4356 if (WriteOperation) {
4357 if (ntStatus >= 0L) {
4358 {
4359 DisketteExtension->FifoBuffer[0] = 14;
4360 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
4361 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4362 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
4363 }
4364 if (! (ntStatus >= 0L)) {
4365 {
4366 }
4367 return (ntStatus);
4368 } else {
4369
4370 }
4371 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4372 if (! ((int )DisketteExtension->FifoBuffer[0] & 32)) {
4373 {
4374 }
4375 return (-1073741805L);
4376 } else {
4377
4378 }
4379 } else {
4380
4381 }
4382 if ((int )DisketteExtension->FifoBuffer[0] & 64) {
4383 {
4384 }
4385 return (-1073741662L);
4386 } else {
4387
4388 }
4389 } else {
4390
4391 }
4392 } else {
4393
4394 }
4395 return (ntStatus);
4396}
4397}
4398NTSTATUS FlDatarateSpecifyConfigure(PDISKETTE_EXTENSION DisketteExtension )
4399{ NTSTATUS ntStatus ;
4400
4401 {
4402 ntStatus = 0L;
4403 if (DisketteExtension->ControllerConfigurable) {
4404 DisketteExtension->FifoBuffer[0] = 17;
4405 DisketteExtension->FifoBuffer[1] = 0;
4406 DisketteExtension->FifoBuffer[2] = 15;
4407 DisketteExtension->FifoBuffer[2] = (int )DisketteExtension->FifoBuffer[2] + 16;
4408 if (! DisketteExtension->DriveMediaConstants.CylinderShift) {
4409 DisketteExtension->FifoBuffer[2] = (int )DisketteExtension->FifoBuffer[2] + 64;
4410 } else {
4411
4412 }
4413 {
4414 DisketteExtension->FifoBuffer[3] = 0;
4415 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer, DisketteExtension->FifoBuffer,
4416 (void *)0, 0, 0);
4417 }
4418 if (ntStatus == -1073741661L) {
4419 DisketteExtension->ControllerConfigurable = 0;
4420 ntStatus = 0L;
4421 } else {
4422
4423 }
4424 } else {
4425
4426 }
4427 if (ntStatus >= 0L) {
4428 goto _L;
4429 } else {
4430 if (ntStatus == -1073741661L) {
4431 _L:
4432 {
4433 DisketteExtension->FifoBuffer[0] = 13;
4434 DisketteExtension->FifoBuffer[1] = DisketteExtension->DriveMediaConstants.StepRateHeadUnloadTime;
4435 DisketteExtension->FifoBuffer[2] = DisketteExtension->DriveMediaConstants.HeadLoadTime;
4436 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4437 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
4438 }
4439 if (ntStatus >= 0L) {
4440 {
4441 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (777 << 2)) | 3,
4442 & DisketteExtension->DriveMediaConstants.DataTransferRate);
4443 }
4444 if (ntStatus >= 0L) {
4445 {
4446 ntStatus = FlRecalibrateDrive(DisketteExtension);
4447 }
4448 } else {
4449
4450 }
4451 } else {
4452 {
4453 }
4454 }
4455 } else {
4456 {
4457 }
4458 }
4459 }
4460 if (ntStatus >= 0L) {
4461 DisketteExtension->LastDriveMediaType = DisketteExtension->DriveMediaType;
4462 } else {
4463 DisketteExtension->LastDriveMediaType = 0;
4464 {
4465 }
4466 }
4467 return (ntStatus);
4468}
4469}
4470NTSTATUS FlRecalibrateDrive(PDISKETTE_EXTENSION DisketteExtension )
4471{ NTSTATUS ntStatus ;
4472 UCHAR recalibrateCount ;
4473 UCHAR fifoBuffer[2] ;
4474
4475 {
4476 recalibrateCount = 0;
4477 {
4478 while (1) {
4479 while_93_continue: ;
4480 {
4481 DisketteExtension->FifoBuffer[0] = 11;
4482 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
4483 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer, DisketteExtension->FifoBuffer,
4484 (void *)0, 0, 0);
4485 }
4486 if (! (ntStatus >= 0L)) {
4487 {
4488 }
4489 } else {
4490
4491 }
4492 if (ntStatus >= 0L) {
4493 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4494 {
4495 fifoBuffer[0] = DisketteExtension->FifoBuffer[0];
4496 fifoBuffer[1] = DisketteExtension->FifoBuffer[1];
4497 DisketteExtension->FifoBuffer[0] = 14;
4498 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
4499 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4500 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
4501 }
4502 if (! (ntStatus >= 0L)) {
4503 {
4504 }
4505 return (ntStatus);
4506 } else {
4507
4508 }
4509 DisketteExtension->FifoBuffer[0] = fifoBuffer[0];
4510 DisketteExtension->FifoBuffer[1] = fifoBuffer[1];
4511 } else {
4512
4513 }
4514 if (! ((int )DisketteExtension->FifoBuffer[0] & 32)) {
4515 goto _L;
4516 } else {
4517 if ((int )DisketteExtension->FifoBuffer[1] != 0) {
4518 _L:
4519 {
4520 }
4521 DisketteExtension->HardwareFailed = 1;
4522 ntStatus = -1073741464L;
4523 } else {
4524
4525 }
4526 }
4527 } else {
4528
4529 }
4530 recalibrateCount = (UCHAR )((int )recalibrateCount + 1);
4531 if (! (ntStatus >= 0L)) {
4532 if ((int )recalibrateCount < 2) {
4533
4534 } else {
4535 goto while_93_break;
4536 }
4537 } else {
4538 goto while_93_break;
4539 }
4540 }
4541 while_93_break: ;
4542 }
4543 {
4544 }
4545 return (ntStatus);
4546}
4547}
4548NTSTATUS FlDetermineMediaType(PDISKETTE_EXTENSION DisketteExtension )
4549{ NTSTATUS ntStatus ;
4550 PDRIVE_MEDIA_CONSTANTS driveMediaConstants ;
4551 BOOLEAN mediaTypesExhausted ;
4552 ULONG retries ;
4553 USHORT sectorLengthCode ;
4554 PBOOT_SECTOR_INFO bootSector ;
4555 LARGE_INTEGER offset ;
4556 PIRP irp ;
4557 int tmp ;
4558 PVOID tmp___0 ;
4559 int tmp___1 ;
4560
4561 {
4562 retries = 0;
4563 {
4564 }
4565 DisketteExtension->IsReadOnly = 0;
4566 retries = 0;
4567 {
4568 while (1) {
4569 while_99_continue: ;
4570 if (retries < 3UL) {
4571
4572 } else {
4573 goto while_99_break;
4574 }
4575 if (retries) {
4576 {
4577 }
4578 {
4579 FlInitializeControllerHardware(DisketteExtension);
4580 }
4581 } else {
4582
4583 }
4584 DisketteExtension->DriveMediaType = (DriveMediaLimits + DisketteExtension->DriveType)->HighestDriveMediaType;
4585 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + DisketteExtension->DriveMediaType);
4586 mediaTypesExhausted = 0;
4587 {
4588 while (1) {
4589 while_101_continue: ;
4590 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4591 {
4592 sectorLengthCode = (DriveMediaConstants + DisketteExtension->DriveMediaType)->SectorLengthCode;
4593 FlHdbit(DisketteExtension);
4594 }
4595 } else {
4596
4597 }
4598 {
4599 ntStatus = FlDatarateSpecifyConfigure(DisketteExtension);
4600 }
4601 if (! (ntStatus >= 0L)) {
4602 {
4603 }
4604 mediaTypesExhausted = 1;
4605 } else {
4606 {
4607 driveMediaConstants = DriveMediaConstants + DisketteExtension->DriveMediaType;
4608 DisketteExtension->FifoBuffer[1] = (unsigned char )((int )DisketteExtension->DeviceUnit | (((int )driveMediaConstants->NumberOfHeads - 1) << 2));
4609 DisketteExtension->FifoBuffer[0] = 84;
4610 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
4611 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
4612 }
4613 if (! (ntStatus >= 0L)) {
4614 goto _L;
4615 } else {
4616 if (((int )DisketteExtension->FifoBuffer[0] & -33) != (int )((unsigned char )((int )DisketteExtension->DeviceUnit | (((int )driveMediaConstants->NumberOfHeads - 1) << 2)))) {
4617 goto _L;
4618 } else {
4619 if ((int )DisketteExtension->FifoBuffer[1] != 0) {
4620 goto _L;
4621 } else {
4622 if ((int )DisketteExtension->FifoBuffer[2] != 0) {
4623 goto _L;
4624 } else {
4625 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4626 if ((int )DisketteExtension->FifoBuffer[6] != (int )sectorLengthCode) {
4627 _L:
4628 {
4629 }
4630 DisketteExtension->DriveMediaType = (DRIVE_MEDIA_TYPE )((int )DisketteExtension->DriveMediaType - 1);
4631 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + DisketteExtension->DriveMediaType);
4632 if (ntStatus != -1073741661L) {
4633 ntStatus = -1073741804L;
4634 } else {
4635
4636 }
4637 if ((int )((char )DisketteExtension->DriveMediaType) < (int )((char )(DriveMediaLimits + DisketteExtension->DriveType)->LowestDriveMediaType)) {
4638 DisketteExtension->MediaType = 0;
4639 mediaTypesExhausted = 1;
4640 {
4641 }
4642 } else {
4643
4644 }
4645 } else {
4646 goto _L___0;
4647 }
4648 } else {
4649 _L___0:
4650 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4651 DisketteExtension->MediaType = driveMediaConstants->MediaType;
4652 DisketteExtension->BytesPerSector = driveMediaConstants->BytesPerSector;
4653 {
4654 }
4655 DisketteExtension->ByteCapacity = (((int )driveMediaConstants->BytesPerSector * (int )driveMediaConstants->SectorsPerTrack) * (1 + (int )driveMediaConstants->MaximumTrack)) * (int )driveMediaConstants->NumberOfHeads;
4656 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + DisketteExtension->DriveMediaType);
4657 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4658 tmp = 1024;
4659 } else {
4660 tmp = 512;
4661 }
4662 {
4663 tmp___0 = ExAllocatePoolWithTag(4, tmp, 1886350406UL);
4664 bootSector = tmp___0;
4665 }
4666 if (! bootSector) {
4667 return (-1073741670L);
4668 } else {
4669
4670 }
4671 offset.__annonCompField1.HighPart = 0;
4672 offset.__annonCompField1.LowPart = offset.__annonCompField1.HighPart;
4673 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4674 tmp___1 = 1024;
4675 } else {
4676 tmp___1 = 512;
4677 }
4678 {
4679 irp = IoBuildAsynchronousFsdRequest(3, DisketteExtension->DeviceObject,
4680 bootSector, tmp___1, & offset,
4681 (void *)0);
4682 }
4683 if (! irp) {
4684 {
4685 }
4686 {
4687
4688 }
4689 return (-1073741670L);
4690 } else {
4691
4692 }
4693 {
4694 irp->CurrentLocation = (CHAR )((int )irp->CurrentLocation - 1);
4695 irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation -= 1;
4696 ntStatus = FlReadWrite(DisketteExtension, irp, 1);
4697 }
4698 {
4699 }
4700 {
4701
4702
4703
4704
4705 }
4706 if (! (ntStatus >= 0L)) {
4707 {
4708 }
4709 DisketteExtension->DriveMediaType = (DRIVE_MEDIA_TYPE )((int )DisketteExtension->DriveMediaType - 1);
4710 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + DisketteExtension->DriveMediaType);
4711 if (ntStatus != -1073741661L) {
4712 ntStatus = -1073741804L;
4713 } else {
4714
4715 }
4716 if ((int )((char )DisketteExtension->DriveMediaType) < (int )((char )(DriveMediaLimits + DisketteExtension->DriveType)->LowestDriveMediaType)) {
4717 DisketteExtension->MediaType = 0;
4718 mediaTypesExhausted = 1;
4719 {
4720 }
4721 } else {
4722
4723 }
4724 } else {
4725
4726 }
4727 } else {
4728
4729 }
4730 }
4731 }
4732 }
4733 }
4734 }
4735 }
4736 if (! (ntStatus >= 0L)) {
4737 if (! mediaTypesExhausted) {
4738
4739 } else {
4740 goto while_101_break;
4741 }
4742 } else {
4743 goto while_101_break;
4744 }
4745 }
4746 while_101_break: ;
4747 }
4748 if (ntStatus >= 0L) {
4749 {
4750 }
4751 goto while_99_break;
4752 } else {
4753
4754 }
4755 retries += 1UL;
4756 }
4757 while_99_break: ;
4758 }
4759 if (! (ntStatus >= 0L)) {
4760 goto _L___1;
4761 } else {
4762 if (mediaTypesExhausted) {
4763 _L___1:
4764 {
4765 }
4766 return (ntStatus);
4767 } else {
4768
4769 }
4770 }
4771 DisketteExtension->MediaType = driveMediaConstants->MediaType;
4772 DisketteExtension->BytesPerSector = driveMediaConstants->BytesPerSector;
4773 DisketteExtension->ByteCapacity = (((int )driveMediaConstants->BytesPerSector * (int )driveMediaConstants->SectorsPerTrack) * (1 + (int )driveMediaConstants->MaximumTrack)) * (int )driveMediaConstants->NumberOfHeads;
4774 {
4775 }
4776 {
4777 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + DisketteExtension->DriveMediaType);
4778 FlCheckBootSector(DisketteExtension);
4779 }
4780 return (ntStatus);
4781}
4782}
4783void FlAllocateIoBuffer(PDISKETTE_EXTENSION DisketteExtension , ULONG BufferSize )
4784{ BOOLEAN allocateContiguous ;
4785 LARGE_INTEGER maxDmaAddress ;
4786 PVOID tmp ;
4787 PVOID tmp___0 ;
4788
4789 {
4790 if (DisketteExtension->IoBuffer) {
4791 if (DisketteExtension->IoBufferSize >= BufferSize) {
4792 return;
4793 } else {
4794
4795 }
4796 {
4797 FlFreeIoBuffer(DisketteExtension);
4798 }
4799 } else {
4800
4801 }
4802 if (BufferSize > DisketteExtension->MaxTransferSize) {
4803 allocateContiguous = 1;
4804 } else {
4805 allocateContiguous = 0;
4806 }
4807 if (allocateContiguous) {
4808 {
4809 maxDmaAddress.QuadPart = 16777215;
4810 tmp = MmAllocateContiguousMemory(BufferSize, maxDmaAddress);
4811 DisketteExtension->IoBuffer = tmp;
4812 }
4813 } else {
4814 {
4815 tmp___0 = ExAllocatePoolWithTag(4, BufferSize, 1886350406UL);
4816 DisketteExtension->IoBuffer = tmp___0;
4817 }
4818 }
4819 if (! DisketteExtension->IoBuffer) {
4820 return;
4821 } else {
4822
4823 }
4824 {
4825 DisketteExtension->IoBufferMdl = IoAllocateMdl(DisketteExtension->IoBuffer, BufferSize,
4826 0, 0, (void *)0);
4827 }
4828 if (! DisketteExtension->IoBufferMdl) {
4829 if (allocateContiguous) {
4830 {
4831
4832 }
4833 } else {
4834 {
4835
4836 }
4837 }
4838 DisketteExtension->IoBuffer = (void *)0;
4839 return;
4840 } else {
4841
4842 }
4843 {
4844 MmProbeAndLockPages(DisketteExtension->IoBufferMdl, 0, 2);
4845 }
4846 {
4847 }
4848 if (allocateContiguous) {
4849 {
4850
4851 }
4852 } else {
4853 {
4854
4855 }
4856 }
4857 DisketteExtension->IoBuffer = (void *)0;
4858 return;
4859 DisketteExtension->IoBufferSize = BufferSize;
4860}
4861}
4862void FlFreeIoBuffer(PDISKETTE_EXTENSION DisketteExtension )
4863{ BOOLEAN contiguousBuffer ;
4864
4865 {
4866 if (! DisketteExtension->IoBuffer) {
4867 return;
4868 } else {
4869
4870 }
4871 if (DisketteExtension->IoBufferSize > DisketteExtension->MaxTransferSize) {
4872 contiguousBuffer = 1;
4873 } else {
4874 contiguousBuffer = 0;
4875 }
4876 {
4877 DisketteExtension->IoBufferSize = 0;
4878
4879
4880 DisketteExtension->IoBufferMdl = (void *)0;
4881 }
4882 if (contiguousBuffer) {
4883 {
4884
4885 }
4886 } else {
4887 {
4888
4889 }
4890 }
4891 DisketteExtension->IoBuffer = (void *)0;
4892 return;
4893}
4894}
4895void FloppyThread(PVOID Context )
4896{ PIRP irp ;
4897 PIO_STACK_LOCATION irpSp ;
4898 PLIST_ENTRY request ;
4899 PDISKETTE_EXTENSION disketteExtension ;
4900 NTSTATUS ntStatus ;
4901 NTSTATUS waitStatus ;
4902 LARGE_INTEGER queueWait ;
4903 LARGE_INTEGER acquireWait ;
4904 PKTHREAD tmp ;
4905 PDISK_GEOMETRY outputBuffer ;
4906 PSENSE_DEVISE_STATUS_PTOS outputBuffer___0 ;
4907
4908 {
4909 {
4910 disketteExtension = Context;
4911 ntStatus = 0L;
4912 tmp = KeGetCurrentThread();
4913 KeSetPriorityThread(tmp, 16);
4914 queueWait.QuadPart = -30000000;
4915 acquireWait.QuadPart = -150000000;
4916 }
4917 {
4918 while (1) {
4919 while_114_continue: ;
4920 {
4921 waitStatus = KeWaitForSingleObject((void *)(& disketteExtension->RequestSemaphore),
4922 0, 0, 0, & queueWait);
4923 }
4924 if (waitStatus == 258L) {
4925 if (! ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1)) {
4926 if (disketteExtension->FloppyControllerAllocated) {
4927 {
4928 }
4929 {
4930 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (775 << 2)) | 3,
4931 (void *)0);
4932 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (769 << 2)) | 3,
4933 disketteExtension->DeviceObject);
4934 disketteExtension->FloppyControllerAllocated = 0;
4935 }
4936 } else {
4937
4938 }
4939 } else {
4940
4941 }
4942 {
4943
4944 }
4945 if (disketteExtension->ThreadReferenceCount == 0L) {
4946 disketteExtension->ThreadReferenceCount = -1;
4947 if ((unsigned int )disketteExtension->FloppyThread != (unsigned int )((void *)0)) {
4948 {
4949
4950 disketteExtension->FloppyThread = (void *)0;
4951 }
4952 } else {
4953
4954 }
4955 {
4956
4957 }
4958 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
4959 if (disketteExtension->ReleaseFdcWithMotorRunning) {
4960 {
4961 ntStatus = FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (768 << 2)) | 3,
4962 & acquireWait);
4963 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (775 << 2)) | 3,
4964 (void *)0);
4965 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (769 << 2)) | 3,
4966 disketteExtension->DeviceObject);
4967 disketteExtension->FloppyControllerAllocated = 0;
4968 disketteExtension->ReleaseFdcWithMotorRunning = 0;
4969 }
4970 } else {
4971
4972 }
4973 } else {
4974
4975 }
4976 {
4977
4978 PagingReferenceCount -= 1UL;
4979 }
4980 if (PagingReferenceCount == 0UL) {
4981 {
4982
4983 }
4984 } else {
4985
4986 }
4987 {
4988
4989 }
4990 {
4991 }
4992 {
4993 PsTerminateSystemThread(0L);
4994 }
4995 } else {
4996
4997 }
4998 {
4999
5000 }
5001 goto __Cont;
5002 } else {
5003
5004 }
5005 {
5006 while (1) {
5007 while_117_continue: ;
5008 {
5009 request = (void *)0;
5010 }
5011 if (request) {
5012
5013 } else {
5014 goto while_117_break;
5015 }
5016 {
5017
5018 disketteExtension->ThreadReferenceCount -= 1L;
5019
5020 disketteExtension->HardwareFailed = 0;
5021 irp = (IRP *)((CHAR *)request - (unsigned long )(& ((IRP *)0)->Tail.Overlay.__annonCompField17.ListEntry));
5022
5023 }
5024 if ((int )disketteExtension->PoweringDown == 1) {
5025 {
5026
5027 }
5028 {
5029 }
5030 {
5031 irp = (IRP *)((CHAR *)request - (unsigned long )(& ((IRP *)0)->Tail.Overlay.__annonCompField17.ListEntry));
5032 irp->IoStatus.__annonCompField4.Status = -1073741101L;
5033 irp->IoStatus.Information = 0;
5034 IofCompleteRequest(irp, 0);
5035 }
5036 goto while_117_continue;
5037 } else {
5038
5039 }
5040 {
5041
5042 }
5043 {
5044 }
5045 irpSp = irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
5046 {
5047 }
5048 if (irpSp->MajorFunction == 27) {
5049 goto switch_121_27;
5050 } else {
5051 if (irpSp->MajorFunction == 3) {
5052 goto switch_121_3;
5053 } else {
5054 if (irpSp->MajorFunction == 4) {
5055 goto switch_121_4;
5056 } else {
5057 if (irpSp->MajorFunction == 14) {
5058 goto switch_121_14;
5059 } else {
5060 {
5061 goto switch_121_default;
5062 if (0) {
5063 switch_121_27: ;
5064 {
5065 }
5066 if ((int )irpSp->MinorFunction == 1) {
5067 goto _L;
5068 } else {
5069 if ((int )irpSp->MinorFunction == 5) {
5070 _L:
5071 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5072 if (disketteExtension->ReleaseFdcWithMotorRunning) {
5073 {
5074 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (768 << 2)) | 3,
5075 & acquireWait);
5076 disketteExtension->ReleaseFdcWithMotorRunning = 0;
5077 disketteExtension->FloppyControllerAllocated = 1;
5078 }
5079 } else {
5080
5081 }
5082 } else {
5083
5084 }
5085 if (disketteExtension->FloppyControllerAllocated) {
5086 {
5087 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (775 << 2)) | 3,
5088 (void *)0);
5089 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (769 << 2)) | 3,
5090 disketteExtension->DeviceObject);
5091 disketteExtension->FloppyControllerAllocated = 0;
5092 }
5093 } else {
5094
5095 }
5096 {
5097
5098 disketteExtension->ThreadReferenceCount = -1;
5099
5100
5101 PagingReferenceCount -= 1UL;
5102 }
5103 if (PagingReferenceCount == 0UL) {
5104 {
5105
5106 }
5107 } else {
5108
5109 }
5110 {
5111
5112 PsTerminateSystemThread(0L);
5113 }
5114 } else {
5115 ntStatus = -1073741808L;
5116 }
5117 }
5118 goto switch_121_break;
5119 switch_121_3: ;
5120 switch_121_4: ;
5121 if (! disketteExtension->FloppyControllerAllocated) {
5122 {
5123 ntStatus = FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (768 << 2)) | 3,
5124 & acquireWait);
5125 }
5126 if (ntStatus >= 0L) {
5127 disketteExtension->FloppyControllerAllocated = 1;
5128 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5129 disketteExtension->ReleaseFdcWithMotorRunning = 0;
5130 } else {
5131
5132 }
5133 } else {
5134 goto switch_121_break;
5135 }
5136 } else {
5137
5138 }
5139 if ((disketteExtension->DeviceObject)->Flags & 2UL) {
5140 if (! ((int )irpSp->Flags & 2)) {
5141 {
5142 }
5143 ntStatus = -2147483626L;
5144 } else {
5145 {
5146 ntStatus = FlReadWrite(disketteExtension, irp, 0);
5147 }
5148 }
5149 } else {
5150 {
5151 ntStatus = FlReadWrite(disketteExtension, irp, 0);
5152 }
5153 }
5154 goto switch_121_break;
5155 switch_121_14: ;
5156 if (! disketteExtension->FloppyControllerAllocated) {
5157 {
5158 ntStatus = FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (768 << 2)) | 3,
5159 & acquireWait);
5160 }
5161 if (ntStatus >= 0L) {
5162 disketteExtension->FloppyControllerAllocated = 1;
5163 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5164 disketteExtension->ReleaseFdcWithMotorRunning = 0;
5165 } else {
5166
5167 }
5168 } else {
5169 goto switch_121_break;
5170 }
5171 } else {
5172
5173 }
5174 if ((disketteExtension->DeviceObject)->Flags & 2UL) {
5175 if (! ((int )irpSp->Flags & 2)) {
5176 {
5177 }
5178 ntStatus = -2147483626L;
5179 } else {
5180 goto _L___2;
5181 }
5182 } else {
5183 _L___2:
5184 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((45 << 16) | (1 << 14)) | (512 << 2))) {
5185 goto switch_125_exp_12;
5186 } else {
5187 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((7 << 16) | (1 << 14)) | (512 << 2))) {
5188 goto switch_125_exp_13;
5189 } else {
5190 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((7 << 16) | (9 << 2))) {
5191 goto switch_125_exp_14;
5192 } else {
5193 if (irpSp->Parameters.DeviceIoControl.IoControlCode == 7 << 16) {
5194 goto switch_125_exp_15;
5195 } else {
5196 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((7 << 16) | (3 << 14)) | (11 << 2))) {
5197 goto switch_125_exp_16;
5198 } else {
5199 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (((7 << 16) | (3 << 14)) | (6 << 2))) {
5200 goto switch_125_exp_17;
5201 } else {
5202 if (irpSp->Parameters.DeviceIoControl.IoControlCode == ((7 << 16) | (248 << 2))) {
5203 goto switch_125_exp_18;
5204 } else {
5205 if (0) {
5206 switch_125_exp_12: ;
5207 switch_125_exp_13: ;
5208 {
5209 }
5210 {
5211 ntStatus = FlStartDrive(disketteExtension, irp,
5212 0, 0, (unsigned char )(! (! ((int )irpSp->Flags & 2))));
5213 }
5214 goto switch_125_break;
5215 switch_125_exp_14: ;
5216 {
5217 }
5218 if (disketteExtension->IsReadOnly) {
5219 ntStatus = -1073741811L;
5220 } else {
5221 {
5222 ntStatus = FlStartDrive(disketteExtension, irp,
5223 1, 0, 1);
5224 }
5225 }
5226 goto switch_125_break;
5227 switch_125_exp_15: ;
5228 {
5229 }
5230 if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < (ULONG )sizeof(DISK_GEOMETRY )) {
5231 ntStatus = -1073741811L;
5232 } else {
5233 {
5234 ntStatus = FlStartDrive(disketteExtension, irp,
5235 0, 1, (unsigned char )(! (! ((int )irpSp->Flags & 2))));
5236 }
5237 }
5238 if (ntStatus >= 0L) {
5239 goto _L___0;
5240 } else {
5241 if (ntStatus == -1073741804L) {
5242 _L___0:
5243 outputBuffer = (struct _DISK_GEOMETRY *)irp->AssociatedIrp.SystemBuffer;
5244 ntStatus = 0L;
5245 outputBuffer->MediaType = disketteExtension->MediaType;
5246 if ((int )disketteExtension->MediaType == 0) {
5247 {
5248 }
5249 outputBuffer->Cylinders.__annonCompField1.LowPart = 0;
5250 outputBuffer->Cylinders.__annonCompField1.HighPart = 0;
5251 outputBuffer->TracksPerCylinder = 0;
5252 outputBuffer->SectorsPerTrack = 0;
5253 outputBuffer->BytesPerSector = 0;
5254 } else {
5255 {
5256 }
5257 outputBuffer->Cylinders.__annonCompField1.LowPart = (int )disketteExtension->DriveMediaConstants.MaximumTrack + 1;
5258 outputBuffer->Cylinders.__annonCompField1.HighPart = 0;
5259 outputBuffer->TracksPerCylinder = disketteExtension->DriveMediaConstants.NumberOfHeads;
5260 outputBuffer->SectorsPerTrack = disketteExtension->DriveMediaConstants.SectorsPerTrack;
5261 outputBuffer->BytesPerSector = disketteExtension->DriveMediaConstants.BytesPerSector;
5262 }
5263 {
5264 }
5265 } else {
5266
5267 }
5268 }
5269 irp->IoStatus.Information = sizeof(DISK_GEOMETRY );
5270 goto switch_125_break;
5271 switch_125_exp_16: ;
5272 switch_125_exp_17: ;
5273 {
5274 }
5275 {
5276 ntStatus = FlStartDrive(disketteExtension, irp,
5277 1, 0, 0);
5278 }
5279 if (ntStatus >= 0L) {
5280 goto _L___1;
5281 } else {
5282 if (ntStatus == -1073741804L) {
5283 _L___1:
5284 {
5285 FlAllocateIoBuffer(disketteExtension, 4096);
5286 }
5287 if (disketteExtension->IoBuffer) {
5288 {
5289 ntStatus = FlFormat(disketteExtension, irp);
5290 }
5291 } else {
5292 ntStatus = -1073741670L;
5293 }
5294 } else {
5295
5296 }
5297 }
5298 goto switch_125_break;
5299 switch_125_exp_18: ;
5300 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5301 {
5302 disketteExtension->FifoBuffer[0] = 14;
5303 disketteExtension->FifoBuffer[1] = disketteExtension->DeviceUnit;
5304 ntStatus = FlIssueCommand(disketteExtension, disketteExtension->FifoBuffer,
5305 disketteExtension->FifoBuffer,
5306 (void *)0, 0, 0);
5307 }
5308 if (ntStatus >= 0L) {
5309 outputBuffer___0 = (struct _SENSE_DEVISE_STATUS_PTOS *)irp->AssociatedIrp.SystemBuffer;
5310 outputBuffer___0->ST3_PTOS = Result_Status3_PTOS[0].ST3_PTOS;
5311 irp->IoStatus.Information = sizeof(SENSE_DEVISE_STATUS_PTOS );
5312 } else {
5313
5314 }
5315 goto switch_125_break;
5316 } else {
5317
5318 }
5319 } else {
5320 switch_125_break: ;
5321 }
5322 }
5323 }
5324 }
5325 }
5326 }
5327 }
5328 }
5329 }
5330 goto switch_121_break;
5331 switch_121_default: ;
5332 {
5333 }
5334 ntStatus = -1073741822L;
5335 } else {
5336 switch_121_break: ;
5337 }
5338 }
5339 }
5340 }
5341 }
5342 }
5343 if (ntStatus == -2147483631L) {
5344 {
5345 while (1) {
5346 while_134_continue: ;
5347 {
5348 disketteExtension->HardwareFailed = 0;
5349 irp->IoStatus.__annonCompField4.Status = -2147483631L;
5350 IofCompleteRequest(irp, 1);
5351 request = (void *)0;
5352 }
5353 if (! request) {
5354 goto while_134_break;
5355 } else {
5356
5357 }
5358 {
5359
5360 disketteExtension->ThreadReferenceCount -= 1L;
5361
5362 irp = (IRP *)((CHAR *)request - (unsigned long )(& ((IRP *)0)->Tail.Overlay.__annonCompField17.ListEntry));
5363 }
5364 }
5365 while_134_break: ;
5366 }
5367 } else {
5368 irp->IoStatus.__annonCompField4.Status = ntStatus;
5369 if (disketteExtension->IoBuffer) {
5370 {
5371 FlFreeIoBuffer(disketteExtension);
5372 }
5373 } else {
5374
5375 }
5376 {
5377 FlFinishOperation(irp, disketteExtension);
5378 }
5379 }
5380 }
5381 while_117_break: ;
5382 }
5383 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5384 if (disketteExtension->FloppyControllerAllocated) {
5385 {
5386 FlFdcDeviceIo(disketteExtension->TargetObject, ((7 << 16) | (769 << 2)) | 3,
5387 disketteExtension->DeviceObject);
5388 disketteExtension->FloppyControllerAllocated = 0;
5389 disketteExtension->ReleaseFdcWithMotorRunning = 1;
5390 }
5391 } else {
5392
5393 }
5394 } else {
5395
5396 }
5397 __Cont: ;
5398 }
5399 while_114_break: ;
5400 }
5401}
5402}
5403void FlConsolidateMediaTypeWithBootSector(PDISKETTE_EXTENSION DisketteExtension ,
5404 PBOOT_SECTOR_INFO BootSector )
5405{ USHORT bpbNumberOfSectors ;
5406 USHORT bpbNumberOfHeads ;
5407 USHORT bpbSectorsPerTrack ;
5408 USHORT bpbBytesPerSector ;
5409 USHORT bpbMediaByte ;
5410 USHORT bpbMaximumTrack ;
5411 MEDIA_TYPE bpbMediaType ;
5412 ULONG i ;
5413 ULONG n ;
5414 PDRIVE_MEDIA_CONSTANTS readidDriveMediaConstants ;
5415 BOOLEAN changeToBpbMedia ;
5416 int tmp ;
5417 SIZE_T tmp___0 ;
5418
5419 {
5420 {
5421 }
5422 if ((int )BootSector->JumpByte[0] != 235) {
5423 if ((int )BootSector->JumpByte[0] != 233) {
5424 return;
5425 } else {
5426
5427 }
5428 } else {
5429
5430 }
5431 bpbNumberOfSectors = (int )BootSector->NumberOfSectors[1] * 256 + (int )BootSector->NumberOfSectors[0];
5432 bpbNumberOfHeads = (int )BootSector->NumberOfHeads[1] * 256 + (int )BootSector->NumberOfHeads[0];
5433 bpbSectorsPerTrack = (int )BootSector->SectorsPerTrack[1] * 256 + (int )BootSector->SectorsPerTrack[0];
5434 bpbBytesPerSector = (int )BootSector->BytesPerSector[1] * 256 + (int )BootSector->BytesPerSector[0];
5435 bpbMediaByte = BootSector->MediaByte[0];
5436 if (! bpbNumberOfHeads) {
5437 return;
5438 } else {
5439 if (! bpbSectorsPerTrack) {
5440 return;
5441 } else {
5442
5443 }
5444 }
5445 bpbMaximumTrack = ((int )bpbNumberOfSectors / (int )bpbNumberOfHeads) / (int )bpbSectorsPerTrack - 1;
5446 bpbMediaType = 0;
5447 i = 0;
5448 {
5449 while (1) {
5450 while_136_continue: ;
5451 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5452 tmp = 21;
5453 } else {
5454 tmp = 17;
5455 }
5456 if (i < (unsigned long )tmp) {
5457
5458 } else {
5459 goto while_136_break;
5460 }
5461 if ((int )bpbBytesPerSector == (int )(DriveMediaConstants + i)->BytesPerSector) {
5462 if ((int )bpbSectorsPerTrack == (int )(DriveMediaConstants + i)->SectorsPerTrack) {
5463 if ((int )bpbMaximumTrack == (int )(DriveMediaConstants + i)->MaximumTrack) {
5464 if ((int )bpbNumberOfHeads == (int )(DriveMediaConstants + i)->NumberOfHeads) {
5465 if ((int )bpbMediaByte == (int )(DriveMediaConstants + i)->MediaByte) {
5466 bpbMediaType = (DriveMediaConstants + i)->MediaType;
5467 goto while_136_break;
5468 } else {
5469
5470 }
5471 } else {
5472
5473 }
5474 } else {
5475
5476 }
5477 } else {
5478
5479 }
5480 } else {
5481
5482 }
5483 i += 1UL;
5484 }
5485 while_136_break: ;
5486 }
5487 if ((int )DisketteExtension->DriveType == 3) {
5488 if (bpbMediaType == 15) {
5489 goto switch_137_15;
5490 } else {
5491 if (bpbMediaType == 16) {
5492 goto switch_137_16;
5493 } else {
5494 if (bpbMediaType == 1) {
5495 goto switch_137_1;
5496 } else {
5497 if (bpbMediaType == 19) {
5498 goto switch_137_19;
5499 } else {
5500 {
5501 goto switch_137_default;
5502 if (0) {
5503 switch_137_15:
5504 bpbMediaType = 14;
5505 goto switch_137_break;
5506 switch_137_16:
5507 bpbMediaType = 5;
5508 goto switch_137_break;
5509 switch_137_1:
5510 bpbMediaType = 17;
5511 goto switch_137_break;
5512 switch_137_19:
5513 bpbMediaType = 18;
5514 goto switch_137_break;
5515 switch_137_default: ;
5516 goto switch_137_break;
5517 } else {
5518 switch_137_break: ;
5519 }
5520 }
5521 }
5522 }
5523 }
5524 }
5525 } else {
5526
5527 }
5528 {
5529 }
5530 {
5531 }
5532 if ((int )bpbMediaType == (int )DisketteExtension->MediaType) {
5533 changeToBpbMedia = 0;
5534 {
5535 }
5536 } else {
5537 readidDriveMediaConstants = & DisketteExtension->DriveMediaConstants;
5538 if ((int )bpbBytesPerSector == (int )readidDriveMediaConstants->BytesPerSector) {
5539 if ((int )bpbSectorsPerTrack < 256) {
5540 if ((int )bpbMaximumTrack == (int )readidDriveMediaConstants->MaximumTrack) {
5541 if ((int )bpbNumberOfHeads <= (int )readidDriveMediaConstants->NumberOfHeads) {
5542 changeToBpbMedia = 1;
5543 } else {
5544 changeToBpbMedia = 0;
5545 }
5546 } else {
5547 changeToBpbMedia = 0;
5548 }
5549 } else {
5550 changeToBpbMedia = 0;
5551 }
5552 } else {
5553 changeToBpbMedia = 0;
5554 }
5555 {
5556 }
5557 if ((int )bpbMediaType == 0) {
5558 bpbMediaType = readidDriveMediaConstants->MediaType;
5559 DisketteExtension->DriveMediaConstants.SkewDelta = 0;
5560 } else {
5561
5562 }
5563 }
5564 if (changeToBpbMedia) {
5565 i = (DriveMediaLimits + DisketteExtension->DriveType)->LowestDriveMediaType;
5566 n = (DriveMediaLimits + DisketteExtension->DriveType)->HighestDriveMediaType;
5567 {
5568 while (1) {
5569 while_142_continue: ;
5570 if (i <= n) {
5571
5572 } else {
5573 goto while_142_break;
5574 }
5575 if ((int )bpbMediaType == (int )(DriveMediaConstants + i)->MediaType) {
5576 DisketteExtension->DriveMediaType = i;
5577 goto while_142_break;
5578 } else {
5579
5580 }
5581 i += 1UL;
5582 }
5583 while_142_break: ;
5584 }
5585 {
5586 DisketteExtension->MediaType = bpbMediaType;
5587 DisketteExtension->ByteCapacity = (int )bpbNumberOfSectors * (int )bpbBytesPerSector;
5588 DisketteExtension->DriveMediaConstants.SectorsPerTrack = (unsigned char )bpbSectorsPerTrack;
5589 DisketteExtension->DriveMediaConstants.NumberOfHeads = (unsigned char )bpbNumberOfHeads;
5590 tmp___0 = RtlCompareMemory(BootSector->OemData, "MSDMF3.", 7);
5591 }
5592 if (tmp___0 == 7UL) {
5593 DisketteExtension->IsReadOnly = 1;
5594 } else {
5595
5596 }
5597 } else {
5598
5599 }
5600 return;
5601}
5602}
5603void FlCheckBootSector(PDISKETTE_EXTENSION DisketteExtension )
5604{ PBOOT_SECTOR_INFO bootSector ;
5605 LARGE_INTEGER offset ;
5606 PIRP irp ;
5607 NTSTATUS status ;
5608 int tmp ;
5609 PVOID tmp___0 ;
5610 int tmp___1 ;
5611
5612 {
5613 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5614 tmp = 1024;
5615 } else {
5616 tmp = 512;
5617 }
5618 {
5619 tmp___0 = ExAllocatePoolWithTag(4, tmp, 1886350406UL);
5620 bootSector = tmp___0;
5621 }
5622 if (! bootSector) {
5623 return;
5624 } else {
5625
5626 }
5627 offset.__annonCompField1.HighPart = 0;
5628 offset.__annonCompField1.LowPart = offset.__annonCompField1.HighPart;
5629 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5630 tmp___1 = 1024;
5631 } else {
5632 tmp___1 = 512;
5633 }
5634 {
5635 irp = IoBuildAsynchronousFsdRequest(3, DisketteExtension->DeviceObject, bootSector,
5636 tmp___1, & offset, (void *)0);
5637 }
5638 if (! irp) {
5639 {
5640
5641 }
5642 return;
5643 } else {
5644
5645 }
5646 {
5647 irp->CurrentLocation = (CHAR )((int )irp->CurrentLocation - 1);
5648 irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation -= 1;
5649 status = FlReadWrite(DisketteExtension, irp, 1);
5650
5651
5652
5653
5654 }
5655 return;
5656}
5657}
5658NTSTATUS FlReadWriteTrack(PDISKETTE_EXTENSION DisketteExtension , PMDL IoMdl , ULONG IoOffset ,
5659 BOOLEAN WriteOperation , UCHAR Cylinder , UCHAR Head , UCHAR Sector ,
5660 UCHAR NumberOfSectors , BOOLEAN NeedSeek )
5661{ PDRIVE_MEDIA_CONSTANTS driveMediaConstants ;
5662 ULONG byteToSectorShift ;
5663 ULONG transferBytes ;
5664 LARGE_INTEGER headSettleTime ;
5665 NTSTATUS status ;
5666 ULONG seekRetry ;
5667 ULONG ioRetry ;
5668 BOOLEAN recalibrateDrive ;
5669 UCHAR i ;
5670
5671 {
5672 recalibrateDrive = 0;
5673 {
5674 }
5675 driveMediaConstants = & DisketteExtension->DriveMediaConstants;
5676 byteToSectorShift = 7 + (int )driveMediaConstants->SectorLengthCode;
5677 transferBytes = (unsigned long )NumberOfSectors << byteToSectorShift;
5678 headSettleTime.__annonCompField1.LowPart = - (10000 * (int )driveMediaConstants->HeadSettleTime);
5679 headSettleTime.__annonCompField1.HighPart = -1;
5680 seekRetry = 0;
5681 ioRetry = 0;
5682 {
5683 while (1) {
5684 while_144_continue: ;
5685 if (seekRetry < 3UL) {
5686
5687 } else {
5688 goto while_144_break;
5689 }
5690 if (recalibrateDrive) {
5691 {
5692 }
5693 {
5694 FlRecalibrateDrive(DisketteExtension);
5695 }
5696 } else {
5697
5698 }
5699 if (recalibrateDrive) {
5700 goto _L___0;
5701 } else {
5702 if (NeedSeek) {
5703 if (! DisketteExtension->ControllerConfigurable) {
5704 goto _L___0;
5705 } else {
5706 if ((int )driveMediaConstants->CylinderShift != 0) {
5707 _L___0:
5708 {
5709 DisketteExtension->FifoBuffer[0] = 16;
5710 DisketteExtension->FifoBuffer[1] = ((int )Head << 2) | (int )DisketteExtension->DeviceUnit;
5711 DisketteExtension->FifoBuffer[2] = (int )Cylinder << (int )driveMediaConstants->CylinderShift;
5712 status = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
5713 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
5714 }
5715 if (status >= 0L) {
5716 if (! ((int )DisketteExtension->FifoBuffer[0] & 32)) {
5717 DisketteExtension->HardwareFailed = 1;
5718 status = -1073741464L;
5719 } else {
5720 if ((int )DisketteExtension->FifoBuffer[1] != (int )Cylinder << (int )driveMediaConstants->CylinderShift) {
5721 DisketteExtension->HardwareFailed = 1;
5722 status = -1073741464L;
5723 } else {
5724
5725 }
5726 }
5727 if (status >= 0L) {
5728 {
5729 KeDelayExecutionThread(0, 0, & headSettleTime);
5730 DisketteExtension->FifoBuffer[0] = 84;
5731 DisketteExtension->FifoBuffer[1] = ((int )Head << 2) | (int )DisketteExtension->DeviceUnit;
5732 status = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
5733 DisketteExtension->FifoBuffer, (void *)0,
5734 0, 0);
5735 }
5736 if (status >= 0L) {
5737 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5738 if ((int )DisketteExtension->FifoBuffer[0] & 8) {
5739 return (-1073741661L);
5740 } else {
5741
5742 }
5743 } else {
5744
5745 }
5746 if ((int )DisketteExtension->FifoBuffer[0] != (((int )Head << 2) | (int )DisketteExtension->DeviceUnit)) {
5747 {
5748 DisketteExtension->HardwareFailed = 1;
5749 status = FlInterpretError(DisketteExtension->FifoBuffer[1], DisketteExtension->FifoBuffer[2]);
5750 }
5751 } else {
5752 if ((int )DisketteExtension->FifoBuffer[1] != 0) {
5753 {
5754 DisketteExtension->HardwareFailed = 1;
5755 status = FlInterpretError(DisketteExtension->FifoBuffer[1],
5756 DisketteExtension->FifoBuffer[2]);
5757 }
5758 } else {
5759 if ((int )DisketteExtension->FifoBuffer[2] != 0) {
5760 {
5761 DisketteExtension->HardwareFailed = 1;
5762 status = FlInterpretError(DisketteExtension->FifoBuffer[1],
5763 DisketteExtension->FifoBuffer[2]);
5764 }
5765 } else {
5766 if ((int )DisketteExtension->FifoBuffer[3] != (int )Cylinder) {
5767 {
5768 DisketteExtension->HardwareFailed = 1;
5769 status = FlInterpretError(DisketteExtension->FifoBuffer[1],
5770 DisketteExtension->FifoBuffer[2]);
5771 }
5772 } else {
5773
5774 }
5775 }
5776 }
5777 }
5778 } else {
5779 {
5780 }
5781 }
5782 } else {
5783
5784 }
5785 } else {
5786 {
5787 }
5788 }
5789 } else {
5790 status = 0L;
5791 }
5792 }
5793 } else {
5794 status = 0L;
5795 }
5796 }
5797 if (! (status >= 0L)) {
5798 {
5799 }
5800 recalibrateDrive = 1;
5801 goto __Cont;
5802 } else {
5803
5804 }
5805 {
5806 while (1) {
5807 while_149_continue: ;
5808 DisketteExtension->FifoBuffer[1] = ((int )Head << 2) | (int )DisketteExtension->DeviceUnit;
5809 DisketteExtension->FifoBuffer[2] = Cylinder;
5810 DisketteExtension->FifoBuffer[3] = Head;
5811 DisketteExtension->FifoBuffer[4] = (int )Sector + 1;
5812 DisketteExtension->FifoBuffer[5] = driveMediaConstants->SectorLengthCode;
5813 DisketteExtension->FifoBuffer[6] = (int )Sector + (int )NumberOfSectors;
5814 DisketteExtension->FifoBuffer[7] = driveMediaConstants->ReadWriteGapLength;
5815 DisketteExtension->FifoBuffer[8] = driveMediaConstants->DataLength;
5816 if (WriteOperation) {
5817 DisketteExtension->FifoBuffer[0] = 66;
5818 } else {
5819 DisketteExtension->FifoBuffer[0] = 64;
5820 }
5821 {
5822 status = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer, DisketteExtension->FifoBuffer,
5823 IoMdl, IoOffset, transferBytes);
5824 }
5825 if (status >= 0L) {
5826 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5827 if ((int )DisketteExtension->FifoBuffer[0] & 8) {
5828 return (-1073741661L);
5829 } else {
5830
5831 }
5832 } else {
5833
5834 }
5835 if (((int )DisketteExtension->FifoBuffer[0] & 192) != 0) {
5836 if (((int )DisketteExtension->FifoBuffer[0] & 192) != 64) {
5837 {
5838 DisketteExtension->HardwareFailed = 1;
5839 status = FlInterpretError(DisketteExtension->FifoBuffer[1], DisketteExtension->FifoBuffer[2]);
5840 }
5841 } else {
5842 if ((int )DisketteExtension->FifoBuffer[1] != 128) {
5843 {
5844 DisketteExtension->HardwareFailed = 1;
5845 status = FlInterpretError(DisketteExtension->FifoBuffer[1], DisketteExtension->FifoBuffer[2]);
5846 }
5847 } else {
5848 if ((int )DisketteExtension->FifoBuffer[2] != 0) {
5849 {
5850 DisketteExtension->HardwareFailed = 1;
5851 status = FlInterpretError(DisketteExtension->FifoBuffer[1], DisketteExtension->FifoBuffer[2]);
5852 }
5853 } else {
5854 goto _L___1;
5855 }
5856 }
5857 }
5858 } else {
5859 _L___1:
5860 if ((int )DisketteExtension->FifoBuffer[5] != 1) {
5861 DisketteExtension->HardwareFailed = 1;
5862 status = -1073741465L;
5863 } else {
5864
5865 }
5866 }
5867 } else {
5868 {
5869 }
5870 }
5871 if (status >= 0L) {
5872 goto while_149_break;
5873 } else {
5874
5875 }
5876 if (ioRetry >= 2UL) {
5877 {
5878 }
5879 goto while_149_break;
5880 } else {
5881
5882 }
5883 ioRetry += 1UL;
5884 }
5885 while_149_break: ;
5886 }
5887 if (status >= 0L) {
5888 goto while_144_break;
5889 } else {
5890
5891 }
5892 recalibrateDrive = 1;
5893 __Cont:
5894 seekRetry += 1UL;
5895 }
5896 while_144_break: ;
5897 }
5898 if (! (status >= 0L)) {
5899 if ((int )NumberOfSectors > 1) {
5900 {
5901 }
5902 i = 0;
5903 {
5904 while (1) {
5905 while_153_continue: ;
5906 if ((int )i < (int )NumberOfSectors) {
5907
5908 } else {
5909 goto while_153_break;
5910 }
5911 {
5912 status = FlReadWriteTrack(DisketteExtension, IoMdl, IoOffset + ((unsigned long )i << byteToSectorShift),
5913 WriteOperation, Cylinder, Head, (unsigned char )((int )Sector + (int )i),
5914 1, 0);
5915 }
5916 if (! (status >= 0L)) {
5917 {
5918 }
5919 DisketteExtension->HardwareFailed = 1;
5920 goto while_153_break;
5921 } else {
5922
5923 }
5924 i = (UCHAR )((int )i + 1);
5925 }
5926 while_153_break: ;
5927 }
5928 } else {
5929
5930 }
5931 } else {
5932
5933 }
5934 return (status);
5935}
5936}
5937NTSTATUS FlReadWrite(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp , BOOLEAN DriveStarted )
5938{ PIO_STACK_LOCATION irpSp ;
5939 BOOLEAN writeOperation ;
5940 NTSTATUS status ;
5941 PDRIVE_MEDIA_CONSTANTS driveMediaConstants ;
5942 ULONG byteToSectorShift ;
5943 ULONG currentSector ;
5944 ULONG firstSector ;
5945 ULONG lastSector ;
5946 ULONG trackSize ;
5947 UCHAR sectorsPerTrack ;
5948 UCHAR numberOfHeads ;
5949 UCHAR currentHead ;
5950 UCHAR currentCylinder ;
5951 UCHAR trackSector ;
5952 PCHAR userBuffer ;
5953 UCHAR skew ;
5954 UCHAR skewDelta ;
5955 UCHAR numTransferSectors ;
5956 PMDL mdl ;
5957 PCHAR ioBuffer ;
5958 ULONG ioOffset ;
5959 PVOID tmp___0 ;
5960
5961 {
5962 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
5963 {
5964 }
5965 if ((int )irpSp->MajorFunction == 4) {
5966 if (DisketteExtension->IsReadOnly) {
5967 {
5968 }
5969 return (-1073741811L);
5970 } else {
5971
5972 }
5973 writeOperation = 1;
5974 } else {
5975 writeOperation = 0;
5976 }
5977 {
5978 }
5979 if (DriveStarted) {
5980 status = 0L;
5981 } else {
5982 {
5983 status = FlStartDrive(DisketteExtension, Irp, writeOperation, 1, (unsigned char )(! (! ((int )irpSp->Flags & 2))));
5984 }
5985 }
5986 if (! (status >= 0L)) {
5987 {
5988 }
5989 return (status);
5990 } else {
5991
5992 }
5993 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
5994 {
5995 FlHdbit(DisketteExtension);
5996 }
5997 } else {
5998
5999 }
6000 if ((int )DisketteExtension->MediaType == 0) {
6001 {
6002 }
6003 return (-1073741804L);
6004 } else {
6005
6006 }
6007 driveMediaConstants = & DisketteExtension->DriveMediaConstants;
6008 byteToSectorShift = 7 + (int )driveMediaConstants->SectorLengthCode;
6009 firstSector = irpSp->Parameters.Read.ByteOffset.__annonCompField1.LowPart >> byteToSectorShift;
6010 lastSector = firstSector + (irpSp->Parameters.Read.Length >> byteToSectorShift);
6011 sectorsPerTrack = driveMediaConstants->SectorsPerTrack;
6012 numberOfHeads = driveMediaConstants->NumberOfHeads;
6013 if ((int )(Irp->MdlAddress)->MdlFlags & 5) {
6014 userBuffer = (Irp->MdlAddress)->MappedSystemVa;
6015 } else {
6016 {
6017 tmp___0 = (void *)0;
6018 userBuffer = tmp___0;
6019 }
6020 }
6021 if ((unsigned int )userBuffer == (unsigned int )((void *)0)) {
6022 {
6023 }
6024 return (-1073741670L);
6025 } else {
6026
6027 }
6028 trackSize = (unsigned long )sectorsPerTrack << byteToSectorShift;
6029 skew = 0;
6030 skewDelta = driveMediaConstants->SkewDelta;
6031 currentSector = firstSector;
6032 {
6033 while (1) {
6034 while_161_continue: ;
6035 if (currentSector < lastSector) {
6036
6037 } else {
6038 goto while_161_break;
6039 }
6040 currentCylinder = (unsigned char )((currentSector / (ULONG )sectorsPerTrack) / (ULONG )numberOfHeads);
6041 trackSector = (unsigned char )(currentSector % (unsigned long )sectorsPerTrack);
6042 currentHead = (unsigned char )((currentSector / (ULONG )sectorsPerTrack) % (unsigned long )numberOfHeads);
6043 numTransferSectors = (int )sectorsPerTrack - (int )trackSector;
6044 if (lastSector - currentSector < (ULONG )numTransferSectors) {
6045 numTransferSectors = (unsigned char )(lastSector - currentSector);
6046 } else {
6047
6048 }
6049 if (trackSize > DisketteExtension->MaxTransferSize) {
6050 {
6051 }
6052 {
6053 FlAllocateIoBuffer(DisketteExtension, trackSize);
6054 }
6055 if (! DisketteExtension->IoBuffer) {
6056 {
6057 }
6058 return (-1073741670L);
6059 } else {
6060
6061 }
6062 mdl = DisketteExtension->IoBufferMdl;
6063 ioBuffer = DisketteExtension->IoBuffer;
6064 ioOffset = 0;
6065 if (writeOperation) {
6066 {
6067 memmove(ioBuffer, userBuffer + ((currentSector - firstSector) << byteToSectorShift),
6068 (unsigned long )numTransferSectors << byteToSectorShift);
6069 }
6070 } else {
6071
6072 }
6073 } else {
6074 mdl = Irp->MdlAddress;
6075 ioOffset = (currentSector - firstSector) << byteToSectorShift;
6076 }
6077 if ((int )skew >= (int )numTransferSectors + (int )trackSector) {
6078 skew = 0;
6079 } else {
6080
6081 }
6082 if ((int )skew < (int )trackSector) {
6083 skew = trackSector;
6084 } else {
6085
6086 }
6087 {
6088 status = FlReadWriteTrack(DisketteExtension, mdl, ioOffset + (((unsigned long )skew - (unsigned long )trackSector) << byteToSectorShift),
6089 writeOperation, currentCylinder, currentHead, skew,
6090 (unsigned char )(((int )numTransferSectors + (int )trackSector) - (int )skew),
6091 1);
6092 }
6093 if (status >= 0L) {
6094 if ((int )skew > (int )trackSector) {
6095 {
6096 status = FlReadWriteTrack(DisketteExtension, mdl, ioOffset, writeOperation,
6097 currentCylinder, currentHead, trackSector, (unsigned char )((int )skew - (int )trackSector),
6098 0);
6099 }
6100 } else {
6101 skew = ((int )numTransferSectors + (int )trackSector) % (int )sectorsPerTrack;
6102 }
6103 } else {
6104 skew = ((int )numTransferSectors + (int )trackSector) % (int )sectorsPerTrack;
6105 }
6106 if (! (status >= 0L)) {
6107 goto while_161_break;
6108 } else {
6109
6110 }
6111 if (! writeOperation) {
6112 if (trackSize > DisketteExtension->MaxTransferSize) {
6113 {
6114 memmove(userBuffer + ((currentSector - firstSector) << byteToSectorShift),
6115 ioBuffer, (unsigned long )numTransferSectors << byteToSectorShift);
6116 }
6117 } else {
6118
6119 }
6120 } else {
6121
6122 }
6123 skew = ((int )skew + (int )skewDelta) % (int )sectorsPerTrack;
6124 currentSector += (ULONG )numTransferSectors;
6125 }
6126 while_161_break: ;
6127 }
6128 Irp->IoStatus.Information = (currentSector - firstSector) << byteToSectorShift;
6129 if (status >= 0L) {
6130 if (firstSector == 0UL) {
6131 {
6132 FlConsolidateMediaTypeWithBootSector(DisketteExtension, (struct _BOOT_SECTOR_INFO *)userBuffer);
6133 }
6134 } else {
6135
6136 }
6137 } else {
6138
6139 }
6140 {
6141 }
6142 return (status);
6143}
6144}
6145NTSTATUS FlFormat(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp )
6146{ LARGE_INTEGER headSettleTime ;
6147 PIO_STACK_LOCATION irpSp ;
6148 PBAD_TRACK_NUMBER badTrackBuffer ;
6149 PFORMAT_PARAMETERS formatParameters ;
6150 PFORMAT_EX_PARAMETERS formatExParameters ;
6151 PDRIVE_MEDIA_CONSTANTS driveMediaConstants ;
6152 NTSTATUS ntStatus ;
6153 ULONG badTrackBufferLength ;
6154 DRIVE_MEDIA_TYPE driveMediaType ;
6155 UCHAR driveStatus ;
6156 UCHAR numberOfBadTracks ;
6157 UCHAR currentTrack ;
6158 UCHAR endTrack ;
6159 UCHAR whichSector ;
6160 UCHAR retryCount ;
6161 BOOLEAN bufferOverflow ;
6162 FDC_DISK_CHANGE_PARMS fdcDiskChangeParms ;
6163 ULONG length ;
6164 UCHAR tmp ;
6165
6166 {
6167 numberOfBadTracks = 0;
6168 bufferOverflow = 0;
6169 {
6170 }
6171 irpSp = Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
6172 formatParameters = (struct _FORMAT_PARAMETERS *)Irp->AssociatedIrp.SystemBuffer;
6173 if (irpSp->Parameters.DeviceIoControl.IoControlCode == (ULONG )(((7 << 16) | (3 << 14)) | (11 << 2))) {
6174 formatExParameters = (struct _FORMAT_EX_PARAMETERS *)Irp->AssociatedIrp.SystemBuffer;
6175 } else {
6176 formatExParameters = (void *)0;
6177 }
6178 {
6179 }
6180 badTrackBufferLength = irpSp->Parameters.DeviceIoControl.OutputBufferLength;
6181 driveMediaType = (DriveMediaLimits + DisketteExtension->DriveType)->HighestDriveMediaType;
6182 {
6183 while (1) {
6184 while_167_continue: ;
6185 if ((int )(DriveMediaConstants + driveMediaType)->MediaType != (int )formatParameters->MediaType) {
6186 if ((int )driveMediaType > (int )(DriveMediaLimits + DisketteExtension->DriveType)->LowestDriveMediaType) {
6187
6188 } else {
6189 goto while_167_break;
6190 }
6191 } else {
6192 goto while_167_break;
6193 }
6194 driveMediaType = (DRIVE_MEDIA_TYPE )((int )driveMediaType - 1);
6195 }
6196 while_167_break: ;
6197 }
6198 driveMediaConstants = DriveMediaConstants + driveMediaType;
6199 DisketteExtension->MediaType = formatParameters->MediaType;
6200 DisketteExtension->DriveMediaType = driveMediaType;
6201 DisketteExtension->DriveMediaConstants = *(DriveMediaConstants + driveMediaType);
6202 if (formatExParameters) {
6203 DisketteExtension->DriveMediaConstants.SectorsPerTrack = (unsigned char )formatExParameters->SectorsPerTrack;
6204 DisketteExtension->DriveMediaConstants.FormatGapLength = (unsigned char )formatExParameters->FormatGapLength;
6205 } else {
6206
6207 }
6208 driveMediaConstants = & DisketteExtension->DriveMediaConstants;
6209 DisketteExtension->BytesPerSector = driveMediaConstants->BytesPerSector;
6210 DisketteExtension->ByteCapacity = (((int )driveMediaConstants->BytesPerSector * (int )driveMediaConstants->SectorsPerTrack) * (1 + (int )driveMediaConstants->MaximumTrack)) * (int )driveMediaConstants->NumberOfHeads;
6211 currentTrack = (unsigned char )(formatParameters->StartCylinderNumber * (ULONG )driveMediaConstants->NumberOfHeads + formatParameters->StartHeadNumber);
6212 endTrack = (unsigned char )(formatParameters->EndCylinderNumber * (ULONG )driveMediaConstants->NumberOfHeads + formatParameters->EndHeadNumber);
6213 {
6214 }
6215 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
6216 {
6217 FlHdbit(DisketteExtension);
6218 }
6219 } else {
6220
6221 }
6222 if ((int )DisketteExtension->LastDriveMediaType != (int )driveMediaType) {
6223 {
6224 ntStatus = FlDatarateSpecifyConfigure(DisketteExtension);
6225 }
6226 if (! (ntStatus >= 0L)) {
6227 return (ntStatus);
6228 } else {
6229
6230 }
6231 } else {
6232
6233 }
6234 DisketteExtension->IsReadOnly = 0;
6235 {
6236 while (1) {
6237 while_169_continue: ;
6238 DisketteExtension->FifoBuffer[0] = 16;
6239 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
6240 DisketteExtension->FifoBuffer[2] = (unsigned char )((int )currentTrack / (int )driveMediaConstants->NumberOfHeads << (int )driveMediaConstants->CylinderShift);
6241 {
6242 }
6243 {
6244 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer, DisketteExtension->FifoBuffer,
6245 (void *)0, 0, 0);
6246 }
6247 if (ntStatus >= 0L) {
6248 if ((int )DisketteExtension->FifoBuffer[0] & 32) {
6249 if ((int )DisketteExtension->FifoBuffer[1] == (int )((unsigned char )((int )currentTrack / (int )driveMediaConstants->NumberOfHeads << (int )driveMediaConstants->CylinderShift))) {
6250 {
6251 headSettleTime.__annonCompField1.LowPart = - (10000 * (int )driveMediaConstants->HeadSettleTime);
6252 headSettleTime.__annonCompField1.HighPart = -1;
6253 KeDelayExecutionThread(0, 0, & headSettleTime);
6254 }
6255 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
6256
6257 } else {
6258 {
6259 DisketteExtension->FifoBuffer[0] = 84;
6260 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
6261 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
6262 DisketteExtension->FifoBuffer, (void *)0, 0,
6263 0);
6264 }
6265 }
6266 } else {
6267 goto _L;
6268 }
6269 } else {
6270 _L:
6271 {
6272 }
6273 DisketteExtension->HardwareFailed = 1;
6274 ntStatus = -1073741464L;
6275 }
6276 } else {
6277
6278 }
6279 if (! (ntStatus >= 0L)) {
6280 {
6281 }
6282 return (ntStatus);
6283 } else {
6284
6285 }
6286 whichSector = 0;
6287 {
6288 while (1) {
6289 while_173_continue: ;
6290 if ((int )whichSector < (int )driveMediaConstants->SectorsPerTrack) {
6291
6292 } else {
6293 goto while_173_break;
6294 }
6295 *(DisketteExtension->IoBuffer + (int )whichSector * 4) = (int )currentTrack / (int )driveMediaConstants->NumberOfHeads;
6296 *(DisketteExtension->IoBuffer + ((int )whichSector * 4 + 1)) = (int )currentTrack % (int )driveMediaConstants->NumberOfHeads;
6297 if (formatExParameters) {
6298 *(DisketteExtension->IoBuffer + ((int )whichSector * 4 + 2)) = (unsigned char )formatExParameters->SectorNumber[whichSector];
6299 } else {
6300 *(DisketteExtension->IoBuffer + ((int )whichSector * 4 + 2)) = (int )whichSector + 1;
6301 }
6302 *(DisketteExtension->IoBuffer + ((int )whichSector * 4 + 3)) = driveMediaConstants->SectorLengthCode;
6303 {
6304 }
6305 whichSector = (UCHAR )((int )whichSector + 1);
6306 }
6307 while_173_break: ;
6308 }
6309 retryCount = 0;
6310 {
6311 while (1) {
6312 while_175_continue: ;
6313 length = driveMediaConstants->BytesPerSector;
6314 DisketteExtension->FifoBuffer[0] = 71;
6315 DisketteExtension->FifoBuffer[1] = (unsigned char )(((int )currentTrack % (int )driveMediaConstants->NumberOfHeads << 2) | (int )DisketteExtension->DeviceUnit);
6316 DisketteExtension->FifoBuffer[2] = driveMediaConstants->SectorLengthCode;
6317 DisketteExtension->FifoBuffer[3] = driveMediaConstants->SectorsPerTrack;
6318 DisketteExtension->FifoBuffer[4] = driveMediaConstants->FormatGapLength;
6319 DisketteExtension->FifoBuffer[5] = driveMediaConstants->FormatFillCharacter;
6320 {
6321 }
6322 {
6323 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
6324 DisketteExtension->FifoBuffer, DisketteExtension->IoBufferMdl,
6325 0, length);
6326 }
6327 if (! (ntStatus >= 0L)) {
6328 {
6329 }
6330 } else {
6331
6332 }
6333 if (ntStatus >= 0L) {
6334 if ((int )DisketteExtension->FifoBuffer[0] & 208) {
6335 goto _L___0;
6336 } else {
6337 if ((int )DisketteExtension->FifoBuffer[1] & 16) {
6338 goto _L___0;
6339 } else {
6340 if ((int )DisketteExtension->FifoBuffer[2] != 0) {
6341 _L___0:
6342 {
6343 }
6344 {
6345 DisketteExtension->HardwareFailed = 1;
6346 ntStatus = FlInterpretError(DisketteExtension->FifoBuffer[1], DisketteExtension->FifoBuffer[2]);
6347 }
6348 } else {
6349
6350 }
6351 }
6352 }
6353 } else {
6354
6355 }
6356 if (! (ntStatus >= 0L)) {
6357 tmp = retryCount;
6358 retryCount = (UCHAR )((int )retryCount + 1);
6359 if (tmp < 3) {
6360
6361 } else {
6362 goto while_175_break;
6363 }
6364 } else {
6365 goto while_175_break;
6366 }
6367 }
6368 while_175_break: ;
6369 }
6370 if (! (ntStatus >= 0L)) {
6371 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
6372 {
6373 DisketteExtension->FifoBuffer[0] = 14;
6374 DisketteExtension->FifoBuffer[1] = DisketteExtension->DeviceUnit;
6375 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
6376 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
6377 }
6378 if (! (ntStatus >= 0L)) {
6379 {
6380 }
6381 return (ntStatus);
6382 } else {
6383
6384 }
6385 if ((int )DisketteExtension->FifoBuffer[0] & 32) {
6386 driveStatus = 127;
6387 } else {
6388 driveStatus = 128;
6389 }
6390 } else {
6391 {
6392 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (776 << 2)) | 3,
6393 & fdcDiskChangeParms);
6394 driveStatus = fdcDiskChangeParms.DriveStatus;
6395 }
6396 }
6397 if ((int )DisketteExtension->DriveType != 0) {
6398 if ((int )driveStatus & 128) {
6399 return (-1073741805L);
6400 } else {
6401
6402 }
6403 } else {
6404
6405 }
6406 {
6407 }
6408 if (badTrackBufferLength >= (unsigned long )((unsigned int )((int )numberOfBadTracks + 1) * sizeof(BAD_TRACK_NUMBER ))) {
6409 badTrackBuffer = (USHORT *)Irp->AssociatedIrp.SystemBuffer;
6410 *(badTrackBuffer + numberOfBadTracks) = (unsigned short )currentTrack;
6411 } else {
6412 bufferOverflow = 1;
6413 }
6414 numberOfBadTracks = (UCHAR )((int )numberOfBadTracks + 1);
6415 } else {
6416
6417 }
6418 currentTrack = (UCHAR )((int )currentTrack + 1);
6419 if ((int )currentTrack <= (int )endTrack) {
6420
6421 } else {
6422 goto while_169_break;
6423 }
6424 }
6425 while_169_break: ;
6426 }
6427 if (ntStatus >= 0L) {
6428 if (bufferOverflow) {
6429 ntStatus = -2147483643L;
6430 } else {
6431
6432 }
6433 } else {
6434
6435 }
6436 return (ntStatus);
6437}
6438}
6439BOOLEAN FlCheckFormatParameters(PDISKETTE_EXTENSION DisketteExtension , PFORMAT_PARAMETERS FormatParameters )
6440{ PDRIVE_MEDIA_CONSTANTS driveMediaConstants ;
6441 DRIVE_MEDIA_TYPE driveMediaType ;
6442
6443 {
6444 driveMediaType = (DriveMediaLimits + DisketteExtension->DriveType)->HighestDriveMediaType;
6445 {
6446 while (1) {
6447 while_181_continue: ;
6448 if ((int )(DriveMediaConstants + driveMediaType)->MediaType != (int )FormatParameters->MediaType) {
6449 if ((int )driveMediaType > (int )(DriveMediaLimits + DisketteExtension->DriveType)->LowestDriveMediaType) {
6450
6451 } else {
6452 goto while_181_break;
6453 }
6454 } else {
6455 goto while_181_break;
6456 }
6457 driveMediaType = (DRIVE_MEDIA_TYPE )((int )driveMediaType - 1);
6458 }
6459 while_181_break: ;
6460 }
6461 if ((int )(DriveMediaConstants + driveMediaType)->MediaType != (int )FormatParameters->MediaType) {
6462 return (0);
6463 } else {
6464 driveMediaConstants = DriveMediaConstants + driveMediaType;
6465 if (FormatParameters->StartHeadNumber > (unsigned long )((int )driveMediaConstants->NumberOfHeads - 1)) {
6466 return (0);
6467 } else {
6468 if (FormatParameters->EndHeadNumber > (unsigned long )((int )driveMediaConstants->NumberOfHeads - 1)) {
6469 return (0);
6470 } else {
6471 if (FormatParameters->StartCylinderNumber > (ULONG )driveMediaConstants->MaximumTrack) {
6472 return (0);
6473 } else {
6474 if (FormatParameters->EndCylinderNumber > (ULONG )driveMediaConstants->MaximumTrack) {
6475 return (0);
6476 } else {
6477 if (FormatParameters->EndCylinderNumber < FormatParameters->StartCylinderNumber) {
6478 return (0);
6479 } else {
6480 if ((int )((KUSER_SHARED_DATA * const )4292804608U)->AlternativeArchitecture == 1) {
6481 if ((int )FormatParameters->MediaType == 6) {
6482 return (0);
6483 } else {
6484 if ((int )FormatParameters->MediaType == 7) {
6485 return (0);
6486 } else {
6487 if ((int )FormatParameters->MediaType == 8) {
6488 return (0);
6489 } else {
6490 if ((int )FormatParameters->MediaType == 9) {
6491 return (0);
6492 } else {
6493 if ((int )FormatParameters->MediaType == 10) {
6494 return (0);
6495 } else {
6496
6497 }
6498 }
6499 }
6500 }
6501 }
6502 } else {
6503
6504 }
6505 return (1);
6506 }
6507 }
6508 }
6509 }
6510 }
6511 }
6512}
6513}
6514NTSTATUS FlIssueCommand(PDISKETTE_EXTENSION DisketteExtension , PUCHAR FifoInBuffer ,
6515 PUCHAR FifoOutBuffer , PMDL IoMdl , ULONG IoOffset , ULONG TransferBytes )
6516{ NTSTATUS ntStatus ;
6517 ISSUE_FDC_COMMAND_PARMS issueCommandParms ;
6518
6519 {
6520 issueCommandParms.FifoInBuffer = FifoInBuffer;
6521 issueCommandParms.FifoOutBuffer = FifoOutBuffer;
6522 issueCommandParms.IoHandle = (void *)IoMdl;
6523 issueCommandParms.IoOffset = IoOffset;
6524 issueCommandParms.TransferBytes = TransferBytes;
6525 issueCommandParms.TimeOut = 4;
6526 {
6527 }
6528 {
6529 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (771 << 2)) | 3,
6530 & issueCommandParms);
6531 }
6532 if (ntStatus == -1073741661L) {
6533 DisketteExtension->HardwareFailed = 1;
6534 } else {
6535 if (ntStatus == -1073741464L) {
6536 DisketteExtension->HardwareFailed = 1;
6537 } else {
6538
6539 }
6540 }
6541 return (ntStatus);
6542}
6543}
6544NTSTATUS FlInitializeControllerHardware(PDISKETTE_EXTENSION DisketteExtension )
6545{ NTSTATUS ntStatus ;
6546
6547 {
6548 {
6549 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (773 << 2)) | 3,
6550 (void *)0);
6551 }
6552 if (ntStatus >= 0L) {
6553 if ((int )DisketteExtension->PerpendicularMode != 0) {
6554 {
6555 DisketteExtension->FifoBuffer[0] = 21;
6556 DisketteExtension->FifoBuffer[1] = (unsigned char )(128 | ((int )DisketteExtension->PerpendicularMode << 2));
6557 ntStatus = FlIssueCommand(DisketteExtension, DisketteExtension->FifoBuffer,
6558 DisketteExtension->FifoBuffer, (void *)0, 0, 0);
6559 }
6560 } else {
6561
6562 }
6563 } else {
6564
6565 }
6566 return (ntStatus);
6567}
6568}
6569NTSTATUS FlFdcDeviceIo(PDEVICE_OBJECT DeviceObject , ULONG Ioctl , PVOID Data )
6570{ NTSTATUS ntStatus ;
6571 PIRP irp ;
6572 PIO_STACK_LOCATION irpStack ;
6573 KEVENT doneEvent ;
6574 IO_STATUS_BLOCK ioStatus ;
6575
6576 {
6577 {
6578 }
6579 {
6580
6581 irp = IoBuildDeviceIoControlRequest(Ioctl, DeviceObject, (void *)0, 0, (void *)0,
6582 0, 1, & doneEvent, & ioStatus);
6583 }
6584 if ((unsigned int )irp == (unsigned int )((void *)0)) {
6585 {
6586 }
6587 return (-1073741670L);
6588 } else {
6589
6590 }
6591 {
6592 irpStack = irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation - 1;
6593 irpStack->Parameters.DeviceIoControl.Type3InputBuffer = Data;
6594 ntStatus = IofCallDriver(DeviceObject, irp);
6595 }
6596 if (ntStatus == 259L) {
6597 {
6598 KeWaitForSingleObject(& doneEvent, 5, 0, 0, (void *)0);
6599 ntStatus = ioStatus.__annonCompField4.Status;
6600 }
6601 } else {
6602
6603 }
6604 return (ntStatus);
6605}
6606}
6607NTSTATUS FlHdbit(PDISKETTE_EXTENSION DisketteExtension )
6608{ NTSTATUS ntStatus ;
6609 SHORT st5 ;
6610 BOOLEAN media144MB ;
6611 BOOLEAN mediaUpTo120MB ;
6612 BOOLEAN supportDrive ;
6613 SET_HD_BIT_PARMS setHdBitParameter ;
6614
6615 {
6616 st5 = 0;
6617 media144MB = 0;
6618 mediaUpTo120MB = 0;
6619 supportDrive = 1;
6620 {
6621 }
6622 if (DisketteExtension->DriveMediaType == 18) {
6623 goto switch_186_18;
6624 } else {
6625 if (DisketteExtension->DriveMediaType == 16) {
6626 goto switch_186_16;
6627 } else {
6628 if (DisketteExtension->DriveMediaType == 17) {
6629 goto switch_186_17;
6630 } else {
6631 if (DisketteExtension->DriveMediaType == 12) {
6632 goto switch_186_12;
6633 } else {
6634 if (DisketteExtension->DriveMediaType == 13) {
6635 goto switch_186_13;
6636 } else {
6637 if (DisketteExtension->DriveMediaType == 19) {
6638 goto switch_186_19;
6639 } else {
6640 if (DisketteExtension->DriveMediaType == 20) {
6641 goto switch_186_20;
6642 } else {
6643 if (DisketteExtension->DriveMediaType == 0) {
6644 goto switch_186_0;
6645 } else {
6646 if (DisketteExtension->DriveMediaType == 1) {
6647 goto switch_186_1;
6648 } else {
6649 if (DisketteExtension->DriveMediaType == 2) {
6650 goto switch_186_2;
6651 } else {
6652 if (DisketteExtension->DriveMediaType == 3) {
6653 goto switch_186_3;
6654 } else {
6655 if (DisketteExtension->DriveMediaType == 4) {
6656 goto switch_186_4;
6657 } else {
6658 if (DisketteExtension->DriveMediaType == 5) {
6659 goto switch_186_5;
6660 } else {
6661 if (DisketteExtension->DriveMediaType == 6) {
6662 goto switch_186_6;
6663 } else {
6664 if (DisketteExtension->DriveMediaType == 7) {
6665 goto switch_186_7;
6666 } else {
6667 if (DisketteExtension->DriveMediaType == 8) {
6668 goto switch_186_8;
6669 } else {
6670 if (DisketteExtension->DriveMediaType == 9) {
6671 goto switch_186_9;
6672 } else {
6673 if (DisketteExtension->DriveMediaType == 10) {
6674 goto switch_186_10;
6675 } else {
6676 if (DisketteExtension->DriveMediaType == 11) {
6677 goto switch_186_11;
6678 } else {
6679 if (DisketteExtension->DriveMediaType == 14) {
6680 goto switch_186_14;
6681 } else {
6682 if (DisketteExtension->DriveMediaType == 15) {
6683 goto switch_186_15;
6684 } else {
6685 {
6686 goto switch_186_default;
6687 if (0) {
6688 switch_186_18:
6689 media144MB = 1;
6690 switch_186_16: ;
6691 switch_186_17: ;
6692 switch_186_12: ;
6693 switch_186_13: ;
6694 switch_186_19: ;
6695 switch_186_20:
6696 mediaUpTo120MB = 1;
6697 switch_186_0: ;
6698 switch_186_1: ;
6699 switch_186_2: ;
6700 switch_186_3: ;
6701 switch_186_4: ;
6702 switch_186_5: ;
6703 switch_186_6: ;
6704 switch_186_7: ;
6705 switch_186_8: ;
6706 switch_186_9: ;
6707 switch_186_10: ;
6708 switch_186_11: ;
6709 switch_186_14: ;
6710 switch_186_15: ;
6711 goto switch_186_break;
6712 switch_186_default:
6713 mediaUpTo120MB = 1;
6714 goto switch_186_break;
6715 } else {
6716 switch_186_break: ;
6717 }
6718 }
6719 }
6720 }
6721 }
6722 }
6723 }
6724 }
6725 }
6726 }
6727 }
6728 }
6729 }
6730 }
6731 }
6732 }
6733 }
6734 }
6735 }
6736 }
6737 }
6738 }
6739 }
6740 setHdBitParameter.Media144MB = media144MB;
6741 setHdBitParameter.More120MB = mediaUpTo120MB;
6742 setHdBitParameter.DeviceUnit = DisketteExtension->DeviceUnit;
6743 if ((int )DisketteExtension->DriveType == 3) {
6744 setHdBitParameter.DriveType144MB = 1;
6745 } else {
6746 setHdBitParameter.DriveType144MB = 0;
6747 }
6748 {
6749 ntStatus = FlFdcDeviceIo(DisketteExtension->TargetObject, ((7 << 16) | (785 << 2)) | 3,
6750 & setHdBitParameter);
6751 }
6752 if (! (ntStatus >= 0L)) {
6753 return (ntStatus);
6754 } else {
6755
6756 }
6757 if (setHdBitParameter.ChangedHdBit) {
6758 {
6759 ntStatus = FlDatarateSpecifyConfigure(DisketteExtension);
6760 }
6761 } else {
6762
6763 }
6764 return (ntStatus);
6765}
6766}
6767NTSTATUS FloppyQueueRequest(PDISKETTE_EXTENSION DisketteExtension , PIRP Irp )
6768{ KIRQL oldIrql ;
6769 NTSTATUS ntStatus ;
6770 LONG tmp ;
6771
6772 {
6773 {
6774
6775 PagingReferenceCount += 1UL;
6776 }
6777 if (PagingReferenceCount == 1UL) {
6778 {
6779
6780 }
6781 } else {
6782
6783 }
6784 {
6785
6786 oldIrql = KfAcquireSpinLock(& DisketteExtension->FlCancelSpinLock);
6787 InterlockedExchange((LONG *)((PVOID *)(& Irp->CancelRoutine)), (long )((void *)(& FloppyCancelQueuedRequest)));
6788 }
6789 if (Irp->Cancel) {
6790 {
6791 tmp = InterlockedExchange((LONG *)((PVOID *)(& Irp->CancelRoutine)), (long )((void *)0));
6792 }
6793 if ((void (*)(struct _DEVICE_OBJECT *DeviceObject , struct _IRP *Irp ))((void *)tmp)) {
6794 {
6795 Irp->IoStatus.__annonCompField4.Status = -1073741536L;
6796 myStatus = -1073741536L;
6797 Irp->IoStatus.Information = 0;
6798
6799 IofCompleteRequest(Irp, 0);
6800
6801 PagingReferenceCount -= 1UL;
6802 }
6803 if (PagingReferenceCount == 0UL) {
6804 {
6805
6806 }
6807 } else {
6808
6809 }
6810 {
6811
6812 ntStatus = -1073741536L;
6813 }
6814 } else {
6815 goto _L;
6816 }
6817 } else {
6818 _L:
6819 Irp->IoStatus.__annonCompField4.Status = 259L;
6820 myStatus = 259L;
6821 (Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation)->Control = (int )(Irp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation)->Control | 1;
6822 if (pended == 0) {
6823 pended = 1;
6824 } else {
6825 {
6826 errorFn();
6827 }
6828 }
6829 {
6830 ExfInterlockedInsertTailList(& DisketteExtension->NewRequestQueue, & Irp->Tail.Overlay.__annonCompField17.ListEntry,
6831 & DisketteExtension->NewRequestQueueSpinLock);
6832
6833 ntStatus = 259L;
6834 }
6835 }
6836 return (ntStatus);
6837}
6838}
6839void FloppyCancelQueuedRequest(PDEVICE_OBJECT DeviceObject , PIRP Irp )
6840{ PDISKETTE_EXTENSION disketteExtension ;
6841 KIRQL oldIrql ;
6842 PLIST_ENTRY _EX_Blink ;
6843 PLIST_ENTRY _EX_Flink ;
6844
6845 {
6846 disketteExtension = DeviceObject->DeviceExtension;
6847 {
6848 }
6849 {
6850 oldIrql = KfAcquireSpinLock(& disketteExtension->FlCancelSpinLock);
6851 Irp->IoStatus.__annonCompField4.Status = -1073741536L;
6852 myStatus = -1073741536L;
6853 Irp->IoStatus.Information = 0;
6854 }
6855 if (Irp->Tail.Overlay.__annonCompField17.ListEntry.Flink) {
6856 _EX_Flink = Irp->Tail.Overlay.__annonCompField17.ListEntry.Flink;
6857 _EX_Blink = Irp->Tail.Overlay.__annonCompField17.ListEntry.Blink;
6858 _EX_Blink->Flink = _EX_Flink;
6859 _EX_Flink->Blink = _EX_Blink;
6860 } else {
6861
6862 }
6863 {
6864
6865
6866 IofCompleteRequest(Irp, 0);
6867
6868 PagingReferenceCount -= 1UL;
6869 }
6870 if (PagingReferenceCount == 0UL) {
6871 {
6872
6873 }
6874 } else {
6875
6876 }
6877 {
6878
6879 }
6880 return;
6881}
6882}
6883void FloppyProcessQueuedRequests(PDISKETTE_EXTENSION DisketteExtension )
6884{ KIRQL oldIrql ;
6885 PLIST_ENTRY headOfList ;
6886 PIRP currentIrp ;
6887 PIO_STACK_LOCATION irpSp ;
6888 LONG tmp ;
6889
6890 {
6891 {
6892 oldIrql = KfAcquireSpinLock(& DisketteExtension->FlCancelSpinLock);
6893 }
6894 {
6895 while (1) {
6896 while_188_continue: ;
6897 {
6898 headOfList = ExfInterlockedRemoveHeadList(& DisketteExtension->NewRequestQueue,
6899 & DisketteExtension->NewRequestQueueSpinLock);
6900 }
6901 if ((unsigned int )headOfList != (unsigned int )((void *)0)) {
6902
6903 } else {
6904 goto while_188_break;
6905 }
6906 {
6907 currentIrp = (IRP *)((CHAR *)headOfList - (unsigned long )(& ((IRP *)0)->Tail.Overlay.__annonCompField17.ListEntry));
6908 tmp = InterlockedExchange((LONG *)((PVOID *)(& currentIrp->CancelRoutine)), (long )((void *)0));
6909 }
6910 if ((void (*)(struct _DEVICE_OBJECT *DeviceObject , struct _IRP *Irp ))((void *)tmp)) {
6911 irpSp = currentIrp->Tail.Overlay.__annonCompField17.__annonCompField16.CurrentStackLocation;
6912 } else {
6913 currentIrp->Tail.Overlay.__annonCompField17.ListEntry.Flink = (void *)0;
6914 currentIrp = (void *)0;
6915 }
6916 {
6917
6918 }
6919 if (currentIrp) {
6920 if (DisketteExtension->IsRemoved) {
6921 {
6922 currentIrp->IoStatus.Information = 0;
6923 currentIrp->IoStatus.__annonCompField4.Status = -1073741738L;
6924 IofCompleteRequest(currentIrp, 0);
6925 }
6926 } else {
6927 if (irpSp->MajorFunction == 3) {
6928 goto switch_189_3;
6929 } else {
6930 if (irpSp->MajorFunction == 4) {
6931 goto switch_189_4;
6932 } else {
6933 if (irpSp->MajorFunction == 14) {
6934 goto switch_189_14;
6935 } else {
6936 {
6937 goto switch_189_default;
6938 if (0) {
6939 switch_189_3: ;
6940 switch_189_4:
6941 {
6942 FloppyReadWrite(DisketteExtension->DeviceObject, currentIrp);
6943 }
6944 goto switch_189_break;
6945 switch_189_14:
6946 {
6947 FloppyDeviceControl(DisketteExtension->DeviceObject, currentIrp);
6948 }
6949 goto switch_189_break;
6950 switch_189_default:
6951 {
6952 currentIrp->IoStatus.Information = 0;
6953 currentIrp->IoStatus.__annonCompField4.Status = -1073741823L;
6954 IofCompleteRequest(currentIrp, 0);
6955 }
6956 } else {
6957 switch_189_break: ;
6958 }
6959 }
6960 }
6961 }
6962 }
6963 }
6964 } else {
6965
6966 }
6967 if (currentIrp) {
6968 {
6969
6970 PagingReferenceCount -= 1UL;
6971 }
6972 if (PagingReferenceCount == 0UL) {
6973 {
6974
6975 }
6976 } else {
6977
6978 }
6979 {
6980
6981 }
6982 } else {
6983
6984 }
6985 {
6986 oldIrql = KfAcquireSpinLock(& DisketteExtension->FlCancelSpinLock);
6987 }
6988 }
6989 while_188_break: ;
6990 }
6991 {
6992
6993 }
6994 return;
6995}
6996}
6997#pragma once
6998#pragma once
6999#pragma once
7000#pragma once
7001#pragma warning(push)
7002#pragma warning(disable:4035)
7003#pragma warning(pop)
7004#pragma once
7005#pragma warning(disable:4103)
7006#pragma warning(disable:4103)
7007#pragma warning(push)
7008#pragma warning(disable:4035)
7009#pragma warning(pop)
7010#pragma warning(disable:4035)
7011#pragma warning(push)
7012#pragma warning(disable:4164)
7013#pragma function(_enable)
7014#pragma function(_disable)
7015#pragma warning(pop)
7016#pragma warning(disable:4103)
7017#pragma warning(disable:4103)
7018#pragma warning(disable:4103)
7019#pragma warning(disable:4103)
7020#pragma warning(disable:4103)
7021#pragma warning(disable:4103)
7022#pragma warning(disable:4200)
7023#pragma warning(default:4200)
7024IRP *pirp ;
7025void stub_driver_init(void)
7026{
7027
7028 {
7029 s = NP;
7030 pended = 0;
7031 compFptr = 0;
7032 compRegistered = 0;
7033 lowerDriverReturn = 0;
7034 setEventCalled = 0;
7035 customIrp = 0;
7036 return;
7037}
7038}
7039int main(void)
7040{ DRIVER_OBJECT d ;
7041 UNICODE_STRING u ;
7042 NTSTATUS status ;
7043 int we_should_unload = __VERIFIER_nondet_int() ;
7044 IRP irp ;
7045 int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7046 int irp_choice = __VERIFIER_nondet_int() ;
7047 DEVICE_OBJECT devobj ;
7048
7049 {
7050 {
7051 status = 0;
7052 pirp = & irp;
7053 _BLAST_init();
7054 status = DriverEntry(& d, & u);
7055 }
7056 if (status >= 0L) {
7057 s = NP;
7058 customIrp = 0;
7059 setEventCalled = customIrp;
7060 lowerDriverReturn = setEventCalled;
7061 compRegistered = lowerDriverReturn;
7062 compFptr = compRegistered;
7063 pended = compFptr;
7064 pirp->IoStatus.__annonCompField4.Status = 0L;
7065 myStatus = 0L;
7066 if (irp_choice == 0) {
7067 pirp->IoStatus.__annonCompField4.Status = -1073741637L;
7068 myStatus = -1073741637L;
7069 } else {
7070
7071 }
7072 {
7073 stub_driver_init();
7074 }
7075 if (! (status >= 0L)) {
7076 return (-1);
7077 } else {
7078
7079 }
7080 if (__BLAST_NONDET == 0) {
7081 goto switch_190_0;
7082 } else {
7083 if (__BLAST_NONDET == 1) {
7084 goto switch_190_1;
7085 } else {
7086 if (__BLAST_NONDET == 2) {
7087 goto switch_190_2;
7088 } else {
7089 if (__BLAST_NONDET == 3) {
7090 goto switch_190_3;
7091 } else {
7092 if (__BLAST_NONDET == 4) {
7093 goto switch_190_4;
7094 } else {
7095 {
7096 goto switch_190_default;
7097 if (0) {
7098 switch_190_0:
7099 {
7100 status = FloppyCreateClose(& devobj, pirp);
7101 }
7102 goto switch_190_break;
7103 switch_190_1:
7104 {
7105 status = FloppyCreateClose(& devobj, pirp);
7106 }
7107 goto switch_190_break;
7108 switch_190_2:
7109 {
7110 status = FloppyDeviceControl(& devobj, pirp);
7111 }
7112 goto switch_190_break;
7113 switch_190_3:
7114 {
7115 status = FloppyPnp(& devobj, pirp);
7116 }
7117 goto switch_190_break;
7118 switch_190_4:
7119 {
7120 status = FloppyPower(& devobj, pirp);
7121 }
7122 goto switch_190_break;
7123 switch_190_default: ;
7124 return (-1);
7125 } else {
7126 switch_190_break: ;
7127 }
7128 }
7129 }
7130 }
7131 }
7132 }
7133 }
7134 if (we_should_unload) {
7135 {
7136 FloppyUnload(& d);
7137 }
7138 } else {
7139
7140 }
7141 } else {
7142
7143 }
7144 if (pended == 1) {
7145 if (s == NP) {
7146 s = NP;
7147 } else {
7148 goto _L___2;
7149 }
7150 } else {
7151 _L___2:
7152 if (pended == 1) {
7153 if (s == MPR3) {
7154 s = MPR3;
7155 } else {
7156 goto _L___1;
7157 }
7158 } else {
7159 _L___1:
7160 if (s == UNLOADED) {
7161
7162 } else {
7163 if (status == -1L) {
7164
7165 } else {
7166 if (s != SKIP2) {
7167 if (s != IPC) {
7168 if (s != DC) {
7169 {
7170 errorFn();
7171 }
7172 } else {
7173 goto _L___0;
7174 }
7175 } else {
7176 goto _L___0;
7177 }
7178 } else {
7179 _L___0:
7180 if (pended == 1) {
7181 if (status != 259L) {
7182 status = 0;
7183 } else {
7184
7185 }
7186 } else {
7187 if (s == DC) {
7188 {
7189 errorFn();
7190 }
7191 } else {
7192 if (status != (NTSTATUS )lowerDriverReturn) {
7193 {
7194 errorFn();
7195 }
7196 } else {
7197
7198 }
7199 }
7200 }
7201 }
7202 }
7203 }
7204 }
7205 }
7206 status = 0;
7207 return (status);
7208}
7209}
7210char _SLAM_alloc_dummy ;
7211char *malloc(int i )
7212{
7213
7214 {
7215 return (& _SLAM_alloc_dummy);
7216}
7217}
7218 void ExAcquireFastMutex(PFAST_MUTEX FastMutex ) ;
7219void ExAcquireFastMutex(PFAST_MUTEX FastMutex )
7220{
7221
7222 {
7223 return;
7224}
7225}
7226 void ExReleaseFastMutex(PFAST_MUTEX FastMutex ) ;
7227void ExReleaseFastMutex(PFAST_MUTEX FastMutex )
7228{
7229
7230 {
7231 return;
7232}
7233}
7234 PVOID ExAllocatePoolWithTag(POOL_TYPE PoolType ,
7235 SIZE_T NumberOfBytes ,
7236 ULONG Tag ) ;
7237PVOID ExAllocatePoolWithTag(POOL_TYPE PoolType , SIZE_T NumberOfBytes ,
7238 ULONG Tag )
7239{ PVOID x ;
7240 char *tmp ;
7241
7242 {
7243 {
7244 tmp = & _SLAM_alloc_dummy;
7245 x = tmp;
7246 }
7247 return (x);
7248}
7249}
7250 void ExFreePool(PVOID P ) ;
7251void ExFreePool(PVOID P )
7252{
7253
7254 {
7255 return;
7256}
7257}
7258 PLIST_ENTRY ExfInterlockedInsertHeadList(PLIST_ENTRY ListHead ,
7259 PLIST_ENTRY ListEntry ,
7260 PKSPIN_LOCK Lock ) ;
7261PLIST_ENTRY ExfInterlockedInsertHeadList(PLIST_ENTRY ListHead ,
7262 PLIST_ENTRY ListEntry ,
7263 PKSPIN_LOCK Lock )
7264{
7265
7266 {
7267 return ((void *)0);
7268}
7269}
7270 PLIST_ENTRY ExfInterlockedInsertTailList(PLIST_ENTRY ListHead ,
7271 PLIST_ENTRY ListEntry ,
7272 PKSPIN_LOCK Lock ) ;
7273PLIST_ENTRY ExfInterlockedInsertTailList(PLIST_ENTRY ListHead ,
7274 PLIST_ENTRY ListEntry ,
7275 PKSPIN_LOCK Lock )
7276{
7277
7278 {
7279 return ((void *)0);
7280}
7281}
7282 PLIST_ENTRY ExfInterlockedRemoveHeadList(PLIST_ENTRY ListHead ,
7283 PKSPIN_LOCK Lock ) ;
7284PLIST_ENTRY ExfInterlockedRemoveHeadList(PLIST_ENTRY ListHead ,
7285 PKSPIN_LOCK Lock )
7286{
7287
7288 {
7289 return ((void *)0);
7290}
7291}
7292 PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length ,
7293 BOOLEAN SecondaryBuffer , BOOLEAN ChargeQuota ,
7294 PIRP Irp ) ;
7295PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length , BOOLEAN SecondaryBuffer ,
7296 BOOLEAN ChargeQuota , PIRP Irp )
7297{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7298 char *tmp ;
7299
7300 {
7301 if (__BLAST_NONDET == 0) {
7302 goto switch_191_0;
7303 } else {
7304 {
7305 goto switch_191_default;
7306 if (0) {
7307 switch_191_0:
7308 {
7309 tmp = & _SLAM_alloc_dummy;
7310 }
7311 return ((void *)tmp);
7312 switch_191_default: ;
7313 return ((void *)0);
7314 } else {
7315 switch_191_break: ;
7316 }
7317 }
7318 }
7319}
7320}
7321 PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice ,
7322 PDEVICE_OBJECT TargetDevice ) ;
7323PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice , PDEVICE_OBJECT TargetDevice )
7324{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7325
7326 {
7327 if (__BLAST_NONDET == 0) {
7328 goto switch_192_0;
7329 } else {
7330 {
7331 goto switch_192_default;
7332 if (0) {
7333 switch_192_0: ;
7334 return (TargetDevice);
7335 switch_192_default: ;
7336 return ((void *)0);
7337 } else {
7338 switch_192_break: ;
7339 }
7340 }
7341 }
7342}
7343}
7344 PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction ,
7345 PDEVICE_OBJECT DeviceObject ,
7346 PVOID Buffer ,
7347 ULONG Length ,
7348 PLARGE_INTEGER StartingOffset ,
7349 PIO_STATUS_BLOCK IoStatusBlock ) ;
7350PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction , PDEVICE_OBJECT DeviceObject ,
7351 PVOID Buffer , ULONG Length , PLARGE_INTEGER StartingOffset ,
7352 PIO_STATUS_BLOCK IoStatusBlock )
7353{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7354 char *tmp ;
7355
7356 {
7357 customIrp = 1;
7358 if (__BLAST_NONDET == 0) {
7359 goto switch_193_0;
7360 } else {
7361 {
7362 goto switch_193_default;
7363 if (0) {
7364 switch_193_0:
7365 {
7366 tmp = & _SLAM_alloc_dummy;
7367 }
7368 return ((void *)tmp);
7369 switch_193_default: ;
7370 return ((void *)0);
7371 } else {
7372 switch_193_break: ;
7373 }
7374 }
7375 }
7376}
7377}
7378 PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode ,
7379 PDEVICE_OBJECT DeviceObject ,
7380 PVOID InputBuffer ,
7381 ULONG InputBufferLength ,
7382 PVOID OutputBuffer ,
7383 ULONG OutputBufferLength ,
7384 BOOLEAN InternalDeviceIoControl ,
7385 PKEVENT Event ,
7386 PIO_STATUS_BLOCK IoStatusBlock ) ;
7387PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode , PDEVICE_OBJECT DeviceObject ,
7388 PVOID InputBuffer , ULONG InputBufferLength , PVOID OutputBuffer ,
7389 ULONG OutputBufferLength , BOOLEAN InternalDeviceIoControl ,
7390 PKEVENT Event , PIO_STATUS_BLOCK IoStatusBlock )
7391{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7392 char *tmp ;
7393
7394 {
7395 customIrp = 1;
7396 if (__BLAST_NONDET == 0) {
7397 goto switch_194_0;
7398 } else {
7399 {
7400 goto switch_194_default;
7401 if (0) {
7402 switch_194_0:
7403 {
7404 tmp = & _SLAM_alloc_dummy;
7405 }
7406 return ((void *)tmp);
7407 switch_194_default: ;
7408 return ((void *)0);
7409 } else {
7410 switch_194_break: ;
7411 }
7412 }
7413 }
7414}
7415}
7416 NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject ,
7417 ULONG DeviceExtensionSize ,
7418 PUNICODE_STRING DeviceName ,
7419 ULONG DeviceType , ULONG DeviceCharacteristics ,
7420 BOOLEAN Exclusive , PDEVICE_OBJECT *DeviceObject ) ;
7421NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject , ULONG DeviceExtensionSize ,
7422 PUNICODE_STRING DeviceName , ULONG DeviceType , ULONG DeviceCharacteristics ,
7423 BOOLEAN Exclusive , PDEVICE_OBJECT *DeviceObject )
7424{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7425 char *tmp ;
7426
7427 {
7428 if (__BLAST_NONDET == 0) {
7429 goto switch_195_0;
7430 } else {
7431 {
7432 goto switch_195_default;
7433 if (0) {
7434 switch_195_0:
7435 {
7436 tmp = & _SLAM_alloc_dummy;
7437 *DeviceObject = (void *)tmp;
7438 }
7439 return (0L);
7440 switch_195_default: ;
7441 return (-1073741823L);
7442 } else {
7443 switch_195_break: ;
7444 }
7445 }
7446 }
7447}
7448}
7449 NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName ,
7450 PUNICODE_STRING DeviceName ) ;
7451NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName , PUNICODE_STRING DeviceName )
7452{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7453
7454 {
7455 if (__BLAST_NONDET == 0) {
7456 goto switch_196_0;
7457 } else {
7458 {
7459 goto switch_196_default;
7460 if (0) {
7461 switch_196_0: ;
7462 return (0L);
7463 switch_196_default: ;
7464 return (-1073741823L);
7465 } else {
7466 switch_196_break: ;
7467 }
7468 }
7469 }
7470}
7471}
7472 void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) ;
7473void IoDeleteDevice(PDEVICE_OBJECT DeviceObject )
7474{
7475
7476 {
7477 return;
7478}
7479}
7480 NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) ;
7481NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName )
7482{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7483
7484 {
7485 if (__BLAST_NONDET == 0) {
7486 goto switch_197_0;
7487 } else {
7488 {
7489 goto switch_197_default;
7490 if (0) {
7491 switch_197_0: ;
7492 return (0L);
7493 switch_197_default: ;
7494 return (-1073741823L);
7495 } else {
7496 switch_197_break: ;
7497 }
7498 }
7499 }
7500}
7501}
7502 void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) ;
7503void IoDetachDevice(PDEVICE_OBJECT TargetDevice )
7504{
7505
7506 {
7507 return;
7508}
7509}
7510 void IoFreeIrp(PIRP Irp ) ;
7511void IoFreeIrp(PIRP Irp )
7512{
7513
7514 {
7515 return;
7516}
7517}
7518 void IoFreeMdl(PMDL Mdl ) ;
7519void IoFreeMdl(PMDL Mdl )
7520{
7521
7522 {
7523 return;
7524}
7525}
7526 PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) ;
7527PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void)
7528{ char *tmp ;
7529
7530 {
7531 {
7532 tmp = & _SLAM_alloc_dummy;
7533 }
7534 return ((void *)tmp);
7535}
7536}
7537 NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType ,
7538 PULONG BusNumber ,
7539 PCONFIGURATION_TYPE ControllerType ,
7540 PULONG ControllerNumber ,
7541 PCONFIGURATION_TYPE PeripheralType ,
7542 PULONG PeripheralNumber ,
7543 NTSTATUS (*CalloutRoutine)(PVOID Context ,
7544 PUNICODE_STRING PathName ,
7545 INTERFACE_TYPE BusType ,
7546 ULONG BusNumber ,
7547 PKEY_VALUE_FULL_INFORMATION *BusInformation ,
7548 CONFIGURATION_TYPE ControllerType ,
7549 ULONG ControllerNumber ,
7550 PKEY_VALUE_FULL_INFORMATION *ControllerInformation ,
7551 CONFIGURATION_TYPE PeripheralType ,
7552 ULONG PeripheralNumber ,
7553 PKEY_VALUE_FULL_INFORMATION *PeripheralInformation ) ,
7554 PVOID Context ) ;
7555NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType , PULONG BusNumber , PCONFIGURATION_TYPE ControllerType ,
7556 PULONG ControllerNumber , PCONFIGURATION_TYPE PeripheralType ,
7557 PULONG PeripheralNumber , NTSTATUS (*CalloutRoutine)(PVOID Context ,
7558 PUNICODE_STRING PathName ,
7559 INTERFACE_TYPE BusType ,
7560 ULONG BusNumber ,
7561 PKEY_VALUE_FULL_INFORMATION *BusInformation ,
7562 CONFIGURATION_TYPE ControllerType ,
7563 ULONG ControllerNumber ,
7564 PKEY_VALUE_FULL_INFORMATION *ControllerInformation ,
7565 CONFIGURATION_TYPE PeripheralType ,
7566 ULONG PeripheralNumber ,
7567 PKEY_VALUE_FULL_INFORMATION *PeripheralInformation ) ,
7568 PVOID Context )
7569{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7570
7571 {
7572 if (__BLAST_NONDET == 0) {
7573 goto switch_198_0;
7574 } else {
7575 {
7576 goto switch_198_default;
7577 if (0) {
7578 switch_198_0: ;
7579 return (0L);
7580 switch_198_default: ;
7581 return (-1073741823L);
7582 } else {
7583 switch_198_break: ;
7584 }
7585 }
7586 }
7587}
7588}
7589 NTSTATUS IoRegisterDeviceInterface(PDEVICE_OBJECT PhysicalDeviceObject ,
7590 GUID const *InterfaceClassGuid ,
7591 PUNICODE_STRING ReferenceString ,
7592 PUNICODE_STRING SymbolicLinkName ) ;
7593NTSTATUS IoRegisterDeviceInterface(PDEVICE_OBJECT PhysicalDeviceObject ,
7594 GUID const *InterfaceClassGuid ,
7595 PUNICODE_STRING ReferenceString ,
7596 PUNICODE_STRING SymbolicLinkName )
7597{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7598
7599 {
7600 if (__BLAST_NONDET == 0) {
7601 goto switch_199_0;
7602 } else {
7603 {
7604 goto switch_199_default;
7605 if (0) {
7606 switch_199_0: ;
7607 return (0L);
7608 switch_199_default: ;
7609 return (-1073741808L);
7610 } else {
7611 switch_199_break: ;
7612 }
7613 }
7614 }
7615}
7616}
7617 void IoReleaseCancelSpinLock(KIRQL Irql ) ;
7618void IoReleaseCancelSpinLock(KIRQL Irql )
7619{
7620
7621 {
7622 return;
7623}
7624}
7625 NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName ,
7626 BOOLEAN Enable ) ;
7627NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName , BOOLEAN Enable )
7628{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7629
7630 {
7631 if (__BLAST_NONDET == 0) {
7632 goto switch_200_0;
7633 } else {
7634 {
7635 goto switch_200_default;
7636 if (0) {
7637 switch_200_0: ;
7638 return (0L);
7639 switch_200_default: ;
7640 return (-1073741823L);
7641 } else {
7642 switch_200_break: ;
7643 }
7644 }
7645 }
7646}
7647}
7648 void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject ) ;
7649void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject )
7650{
7651
7652 {
7653 return;
7654}
7655}
7656void stubMoreProcessingRequired(void)
7657{
7658
7659 {
7660 if (s == NP) {
7661 s = MPR1;
7662 } else {
7663 {
7664 errorFn();
7665 }
7666 }
7667 return;
7668}
7669}
7670 NTSTATUS IofCallDriver(PDEVICE_OBJECT DeviceObject ,
7671 PIRP Irp ) ;
7672NTSTATUS IofCallDriver(PDEVICE_OBJECT DeviceObject ,
7673 PIRP Irp )
7674{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7675 NTSTATUS returnVal2 ;
7676 int compRetStatus1 ;
7677 PVOID lcontext = __VERIFIER_nondet_pointer() ;
7678 NTSTATUS tmp ;
7679
7680 {
7681 if (compRegistered) {
7682 {
7683 tmp = FloppyPnpComplete(DeviceObject, Irp, lcontext);
7684 compRetStatus1 = tmp;
7685 }
7686 if ((long )compRetStatus1 == -1073741802L) {
7687 {
7688 stubMoreProcessingRequired();
7689 }
7690 } else {
7691
7692 }
7693 } else {
7694
7695 }
7696 if (__BLAST_NONDET == 0) {
7697 goto switch_201_0;
7698 } else {
7699 if (__BLAST_NONDET == 1) {
7700 goto switch_201_1;
7701 } else {
7702 {
7703 goto switch_201_default;
7704 if (0) {
7705 switch_201_0:
7706 returnVal2 = 0L;
7707 goto switch_201_break;
7708 switch_201_1:
7709 returnVal2 = -1073741823L;
7710 goto switch_201_break;
7711 switch_201_default:
7712 returnVal2 = 259L;
7713 goto switch_201_break;
7714 } else {
7715 switch_201_break: ;
7716 }
7717 }
7718 }
7719 }
7720 if (s == NP) {
7721 s = IPC;
7722 lowerDriverReturn = returnVal2;
7723 } else {
7724 if (s == MPR1) {
7725 if (returnVal2 == 259L) {
7726 s = MPR3;
7727 lowerDriverReturn = returnVal2;
7728 } else {
7729 s = NP;
7730 lowerDriverReturn = returnVal2;
7731 }
7732 } else {
7733 if (s == SKIP1) {
7734 s = SKIP2;
7735 lowerDriverReturn = returnVal2;
7736 } else {
7737 {
7738 errorFn();
7739 }
7740 }
7741 }
7742 }
7743 return (returnVal2);
7744}
7745}
7746 void IofCompleteRequest(PIRP Irp ,
7747 CCHAR PriorityBoost ) ;
7748void IofCompleteRequest(PIRP Irp , CCHAR PriorityBoost )
7749{
7750
7751 {
7752 if (s == NP) {
7753 s = DC;
7754 } else {
7755 {
7756 errorFn();
7757 }
7758 }
7759 return;
7760}
7761}
7762 KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock ) ;
7763KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock )
7764{
7765
7766 {
7767 return ((unsigned char)0);
7768}
7769}
7770 NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode ,
7771 BOOLEAN Alertable ,
7772 PLARGE_INTEGER Interval ) ;
7773NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode , BOOLEAN Alertable , PLARGE_INTEGER Interval )
7774{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7775
7776 {
7777 if (__BLAST_NONDET == 0) {
7778 goto switch_202_0;
7779 } else {
7780 {
7781 goto switch_202_default;
7782 if (0) {
7783 switch_202_0: ;
7784 return (0L);
7785 switch_202_default: ;
7786 return (-1073741823L);
7787 } else {
7788 switch_202_break: ;
7789 }
7790 }
7791 }
7792}
7793}
7794 void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type ,
7795 BOOLEAN State ) ;
7796void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type , BOOLEAN State )
7797{
7798
7799 {
7800 return;
7801}
7802}
7803 void KeInitializeSemaphore(PRKSEMAPHORE Semaphore ,
7804 LONG Count , LONG Limit ) ;
7805void KeInitializeSemaphore(PRKSEMAPHORE Semaphore , LONG Count , LONG Limit )
7806{
7807
7808 {
7809 return;
7810}
7811}
7812 void KeInitializeSpinLock(PKSPIN_LOCK SpinLock ) ;
7813void KeInitializeSpinLock(PKSPIN_LOCK SpinLock )
7814{
7815
7816 {
7817 return;
7818}
7819}
7820 LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment ,
7821 LONG Adjustment , BOOLEAN Wait ) ;
7822LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment , LONG Adjustment ,
7823 BOOLEAN Wait )
7824{ LONG r = __VERIFIER_nondet_long() ;
7825
7826 {
7827 return (r);
7828}
7829}
7830 void KfReleaseSpinLock(PKSPIN_LOCK SpinLock ,
7831 KIRQL NewIrql ) ;
7832void KfReleaseSpinLock(PKSPIN_LOCK SpinLock , KIRQL NewIrql )
7833{
7834
7835 {
7836 return;
7837}
7838}
7839 LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment ,
7840 BOOLEAN Wait ) ;
7841LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment , BOOLEAN Wait )
7842{ LONG l = __VERIFIER_nondet_long() ;
7843
7844 {
7845 setEventCalled = 1;
7846 return (l);
7847}
7848}
7849 NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason ,
7850 KPROCESSOR_MODE WaitMode ,
7851 BOOLEAN Alertable ,
7852 PLARGE_INTEGER Timeout ) ;
7853NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason , KPROCESSOR_MODE WaitMode ,
7854 BOOLEAN Alertable , PLARGE_INTEGER Timeout )
7855{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7856
7857 {
7858 if (s == MPR3) {
7859 if (setEventCalled == 1) {
7860 s = NP;
7861 setEventCalled = 0;
7862 } else {
7863 goto _L;
7864 }
7865 } else {
7866 _L:
7867 if (customIrp == 1) {
7868 s = NP;
7869 customIrp = 0;
7870 } else {
7871 if (s == MPR3) {
7872 {
7873 errorFn();
7874 }
7875 } else {
7876
7877 }
7878 }
7879 }
7880 if (__BLAST_NONDET == 0) {
7881 goto switch_203_0;
7882 } else {
7883 {
7884 goto switch_203_default;
7885 if (0) {
7886 switch_203_0: ;
7887 return (0L);
7888 switch_203_default: ;
7889 return (-1073741823L);
7890 } else {
7891 switch_203_break: ;
7892 }
7893 }
7894 }
7895}
7896}
7897 PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes ,
7898 PHYSICAL_ADDRESS HighestAcceptableAddress ) ;
7899PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes , PHYSICAL_ADDRESS HighestAcceptableAddress )
7900{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7901 char *tmp ;
7902
7903 {
7904 if (__BLAST_NONDET == 0) {
7905 goto switch_204_0;
7906 } else {
7907 if (__BLAST_NONDET == 1) {
7908 goto switch_204_1;
7909 } else {
7910 if (0) {
7911 switch_204_0:
7912 {
7913 tmp = & _SLAM_alloc_dummy;
7914 }
7915 return (tmp);
7916 switch_204_1: ;
7917 return ((void *)0);
7918 } else {
7919 switch_204_break: ;
7920 }
7921 }
7922 }
7923 return ((void *)0);
7924}
7925}
7926 void MmFreeContiguousMemory(PVOID BaseAddress ) ;
7927void MmFreeContiguousMemory(PVOID BaseAddress )
7928{
7929
7930 {
7931 return;
7932}
7933}
7934 PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList ,
7935 KPROCESSOR_MODE AccessMode ,
7936 MEMORY_CACHING_TYPE CacheType ,
7937 PVOID BaseAddress ,
7938 ULONG BugCheckOnFailure ,
7939 MM_PAGE_PRIORITY Priority ) ;
7940PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList , KPROCESSOR_MODE AccessMode ,
7941 MEMORY_CACHING_TYPE CacheType , PVOID BaseAddress ,
7942 ULONG BugCheckOnFailure , MM_PAGE_PRIORITY Priority )
7943{
7944
7945 {
7946 return ((void *)0);
7947}
7948}
7949 PVOID MmPageEntireDriver(PVOID AddressWithinSection ) ;
7950PVOID MmPageEntireDriver(PVOID AddressWithinSection )
7951{
7952
7953 {
7954 return ((void *)0);
7955}
7956}
7957 void MmResetDriverPaging(PVOID AddressWithinSection ) ;
7958void MmResetDriverPaging(PVOID AddressWithinSection )
7959{
7960
7961 {
7962 return;
7963}
7964}
7965 void MmUnlockPages(PMDL MemoryDescriptorList ) ;
7966void MmUnlockPages(PMDL MemoryDescriptorList )
7967{
7968
7969 {
7970 return;
7971}
7972}
7973 NTSTATUS ObReferenceObjectByHandle(HANDLE Handle ,
7974 ACCESS_MASK DesiredAccess ,
7975 POBJECT_TYPE ObjectType ,
7976 KPROCESSOR_MODE AccessMode ,
7977 PVOID *Object ,
7978 POBJECT_HANDLE_INFORMATION HandleInformation ) ;
7979NTSTATUS ObReferenceObjectByHandle(HANDLE Handle , ACCESS_MASK DesiredAccess , POBJECT_TYPE ObjectType ,
7980 KPROCESSOR_MODE AccessMode , PVOID *Object , POBJECT_HANDLE_INFORMATION HandleInformation )
7981{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
7982
7983 {
7984 if (__BLAST_NONDET == 0) {
7985 goto switch_205_0;
7986 } else {
7987 {
7988 goto switch_205_default;
7989 if (0) {
7990 switch_205_0: ;
7991 return (0L);
7992 switch_205_default: ;
7993 return (-1073741823L);
7994 } else {
7995 switch_205_break: ;
7996 }
7997 }
7998 }
7999}
8000}
8001 void ObfDereferenceObject(PVOID Object ) ;
8002void ObfDereferenceObject(PVOID Object )
8003{
8004
8005 {
8006 return;
8007}
8008}
8009 NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject ,
8010 PIRP Irp ) ;
8011NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject , PIRP Irp )
8012{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
8013 int compRetStatus ;
8014 NTSTATUS returnVal ;
8015 PVOID lcontext = __VERIFIER_nondet_pointer() ;
8016 NTSTATUS tmp ;
8017
8018 {
8019 if (compRegistered) {
8020 {
8021 tmp = FloppyPnpComplete(DeviceObject, Irp, lcontext);
8022 compRetStatus = tmp;
8023 }
8024 if ((long )compRetStatus == -1073741802L) {
8025 {
8026 stubMoreProcessingRequired();
8027 }
8028 } else {
8029
8030 }
8031 } else {
8032
8033 }
8034 if (__BLAST_NONDET == 0) {
8035 goto switch_206_0;
8036 } else {
8037 if (__BLAST_NONDET == 1) {
8038 goto switch_206_1;
8039 } else {
8040 {
8041 goto switch_206_default;
8042 if (0) {
8043 switch_206_0:
8044 returnVal = 0L;
8045 goto switch_206_break;
8046 switch_206_1:
8047 returnVal = -1073741823L;
8048 goto switch_206_break;
8049 switch_206_default:
8050 returnVal = 259L;
8051 goto switch_206_break;
8052 } else {
8053 switch_206_break: ;
8054 }
8055 }
8056 }
8057 }
8058 if (s == NP) {
8059 s = IPC;
8060 lowerDriverReturn = returnVal;
8061 } else {
8062 if (s == MPR1) {
8063 if (returnVal == 259L) {
8064 s = MPR3;
8065 lowerDriverReturn = returnVal;
8066 } else {
8067 s = NP;
8068 lowerDriverReturn = returnVal;
8069 }
8070 } else {
8071 if (s == SKIP1) {
8072 s = SKIP2;
8073 lowerDriverReturn = returnVal;
8074 } else {
8075 {
8076 errorFn();
8077 }
8078 }
8079 }
8080 }
8081 return (returnVal);
8082}
8083}
8084 void PoStartNextPowerIrp(PIRP Irp ) ;
8085void PoStartNextPowerIrp(PIRP Irp )
8086{
8087
8088 {
8089 return;
8090}
8091}
8092 NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle ,
8093 ULONG DesiredAccess ,
8094 POBJECT_ATTRIBUTES ObjectAttributes ,
8095 HANDLE ProcessHandle ,
8096 PCLIENT_ID ClientId ,
8097 void (*StartRoutine)(PVOID StartContext ) ,
8098 PVOID StartContext ) ;
8099NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle , ULONG DesiredAccess , POBJECT_ATTRIBUTES ObjectAttributes ,
8100 HANDLE ProcessHandle , PCLIENT_ID ClientId , void (*StartRoutine)(PVOID StartContext ) ,
8101 PVOID StartContext )
8102{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
8103
8104 {
8105 if (__BLAST_NONDET == 0) {
8106 goto switch_207_0;
8107 } else {
8108 {
8109 goto switch_207_default;
8110 if (0) {
8111 switch_207_0: ;
8112 return (0L);
8113 switch_207_default: ;
8114 return (-1073741823L);
8115 } else {
8116 switch_207_break: ;
8117 }
8118 }
8119 }
8120}
8121}
8122 NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) ;
8123NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus )
8124{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
8125
8126 {
8127 if (__BLAST_NONDET == 0) {
8128 goto switch_208_0;
8129 } else {
8130 {
8131 goto switch_208_default;
8132 if (0) {
8133 switch_208_0: ;
8134 return (0L);
8135 switch_208_default: ;
8136 return (-1073741823L);
8137 } else {
8138 switch_208_break: ;
8139 }
8140 }
8141 }
8142}
8143}
8144 NTSTATUS RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString ,
8145 PANSI_STRING SourceString ,
8146 BOOLEAN AllocateDestinationString ) ;
8147NTSTATUS RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString ,
8148 PANSI_STRING SourceString ,
8149 BOOLEAN AllocateDestinationString )
8150{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
8151
8152 {
8153 if (__BLAST_NONDET == 0) {
8154 goto switch_209_0;
8155 } else {
8156 {
8157 goto switch_209_default;
8158 if (0) {
8159 switch_209_0: ;
8160 return (0L);
8161 switch_209_default: ;
8162 return (-1073741823L);
8163 } else {
8164 switch_209_break: ;
8165 }
8166 }
8167 }
8168}
8169}
8170 SIZE_T RtlCompareMemory(void const *Source1 ,
8171 void const *Source2 ,
8172 SIZE_T Length ) ;
8173SIZE_T RtlCompareMemory(void const *Source1 , void const *Source2 ,
8174 SIZE_T Length )
8175{ SIZE_T r = __VERIFIER_nondet_long() ;
8176
8177 {
8178 return (r);
8179}
8180}
8181 void RtlCopyUnicodeString(PUNICODE_STRING DestinationString ,
8182 PUNICODE_STRING SourceString ) ;
8183void RtlCopyUnicodeString(PUNICODE_STRING DestinationString ,
8184 PUNICODE_STRING SourceString )
8185{
8186
8187 {
8188 return;
8189}
8190}
8191 NTSTATUS RtlDeleteRegistryValue(ULONG RelativeTo ,
8192 PCWSTR Path ,
8193 PCWSTR ValueName ) ;
8194NTSTATUS RtlDeleteRegistryValue(ULONG RelativeTo ,
8195 PCWSTR Path , PCWSTR ValueName )
8196{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
8197
8198 {
8199 if (__BLAST_NONDET == 0) {
8200 goto switch_210_0;
8201 } else {
8202 {
8203 goto switch_210_default;
8204 if (0) {
8205 switch_210_0: ;
8206 return (0L);
8207 switch_210_default: ;
8208 return (-1073741823L);
8209 } else {
8210 switch_210_break: ;
8211 }
8212 }
8213 }
8214}
8215}
8216 void RtlFreeUnicodeString(PUNICODE_STRING UnicodeString ) ;
8217void RtlFreeUnicodeString(PUNICODE_STRING UnicodeString )
8218{
8219
8220 {
8221 return;
8222}
8223}
8224 void RtlInitString(PSTRING DestinationString ,
8225 PCSZ SourceString ) ;
8226void RtlInitString(PSTRING DestinationString , PCSZ SourceString )
8227{
8228
8229 {
8230 return;
8231}
8232}
8233 void RtlInitUnicodeString(PUNICODE_STRING DestinationString ,
8234 PCWSTR SourceString ) ;
8235void RtlInitUnicodeString(PUNICODE_STRING DestinationString ,
8236 PCWSTR SourceString )
8237{
8238
8239 {
8240 return;
8241}
8242}
8243 NTSTATUS RtlQueryRegistryValues(ULONG RelativeTo ,
8244 PCWSTR Path ,
8245 PRTL_QUERY_REGISTRY_TABLE QueryTable ,
8246 PVOID Context ,
8247 PVOID Environment ) ;
8248NTSTATUS RtlQueryRegistryValues(ULONG RelativeTo ,
8249 PCWSTR Path , PRTL_QUERY_REGISTRY_TABLE QueryTable ,
8250 PVOID Context , PVOID Environment )
8251{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
8252
8253 {
8254 if (__BLAST_NONDET == 0) {
8255 goto switch_211_0;
8256 } else {
8257 {
8258 goto switch_211_default;
8259 if (0) {
8260 switch_211_0: ;
8261 return (0L);
8262 switch_211_default: ;
8263 return (-1073741823L);
8264 } else {
8265 switch_211_break: ;
8266 }
8267 }
8268 }
8269}
8270}
8271 NTSTATUS ZwClose(HANDLE Handle ) ;
8272NTSTATUS ZwClose(HANDLE Handle )
8273{ int __BLAST_NONDET = __VERIFIER_nondet_int() ;
8274
8275 {
8276 if (__BLAST_NONDET == 0) {
8277 goto switch_212_0;
8278 } else {
8279 {
8280 goto switch_212_default;
8281 if (0) {
8282 switch_212_0: ;
8283 return (0L);
8284 switch_212_default: ;
8285 return (-1073741823L);
8286 } else {
8287 switch_212_break: ;
8288 }
8289 }
8290 }
8291}
8292}