Showing error 1552

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: ntdrivers/floppy_safe.i.cil.c
Line in file: 2099
Project: SV-COMP 2013
Project version: 2.6.28
Tools: Manual Work
Entered: 2013-01-17 16:57:54 UTC


Source:

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