Showing error 32

User: Jiri Slaby
Error type: Reachable Error Location
Error type description: A specified error location is reachable in some program path
File location: ntdrivers/parport.BUG.i.cil.c
Line in file: 2243
Project: SV-COMP 2012
Tools: Manual Work
Entered: 2012-11-19 13:47:39 UTC


Source:

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