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