* include/ddk: New subdir.
* lib/ddk: Ditto.
* include/ddk/(atm.h, batclass.h, cfg.h, cfgmgr32.h, d4drvif.h,
d4iface.h, ddkmapi.h, hidclass.h, hidpi.h, hidusage.h, mcd.h,
miniport.h, minitape.h, mountdev.h, mountmgr.h, ndis.h,
ndisquid.h, ndistapi.h, ndisvan.h, netevent.h, netpnp.h,
netdev.h, ntapi.h, ntdd8042.h, ntddbeep.h, ntddcdrm.h,
ntddcdvd.h, ntddchgr.h, ntdddisk.h, ntddk.h, ntddkbd.h,
ntddmou.h, ntddndis.h, ntddpar.h, ntddpcm.h, ntddscsi.h,
ntddser.h, ntddstor.h, ntddtape.h, ntddtdi.h, ntddvdeo.h,
ntddvol.h, ntifs.h, ntpoapi.h, ntstatus.h, parallel.h, pfhook.h,
poclass.h, scsi.h, scsiscan.h, scsiwmi.h, smbus.h, srb.h,
storport.h, tdi.h, tdiinfo.h, tdikrnl.h, tdistat.h, tvout.h,
upssvc.h, usb.h, usb100.h, usbcamdi.h, usbdi.h, usbioctl.h,
usbiodef.h, usbscan.h, usbuser.h, video.h, videoagp.h, win2k.h,
winddi.h, winddk.h, winnt4.h, winxp.h, ws2san.h,
xfilter.h): New files.
* lib/ddk/(Makefile.in, apcups.def, cfgmgr32.def, dxapi.def,
hal.def, hid.def, hidparse.def, mcd.def, ndis.def, ntoskrnl.def,
scsiport.def, tdi.def, usbcamd.def, usbcamd2.def, videoprt.def,
win32k.def): Ditto.
+2002-10-06 Casper Hornstrup <chorns@it.dk>
+
+ * include/ddk: New subdir.
+ * lib/ddk: Ditto.
+ * include/ddk/(atm.h, batclass.h, cfg.h, cfgmgr32.h, d4drvif.h,
+ d4iface.h, ddkmapi.h, hidclass.h, hidpi.h, hidusage.h, mcd.h,
+ miniport.h, minitape.h, mountdev.h, mountmgr.h, ndis.h,
+ ndisquid.h, ndistapi.h, ndisvan.h, netevent.h, netpnp.h,
+ netdev.h, ntapi.h, ntdd8042.h, ntddbeep.h, ntddcdrm.h,
+ ntddcdvd.h, ntddchgr.h, ntdddisk.h, ntddk.h, ntddkbd.h,
+ ntddmou.h, ntddndis.h, ntddpar.h, ntddpcm.h, ntddscsi.h,
+ ntddser.h, ntddstor.h, ntddtape.h, ntddtdi.h, ntddvdeo.h,
+ ntddvol.h, ntifs.h, ntpoapi.h, ntstatus.h, parallel.h, pfhook.h,
+ poclass.h, scsi.h, scsiscan.h, scsiwmi.h, smbus.h, srb.h,
+ storport.h, tdi.h, tdiinfo.h, tdikrnl.h, tdistat.h, tvout.h,
+ upssvc.h, usb.h, usb100.h, usbcamdi.h, usbdi.h, usbioctl.h,
+ usbiodef.h, usbscan.h, usbuser.h, video.h, videoagp.h, win2k.h,
+ winddi.h, winddk.h, winnt4.h, winxp.h, ws2san.h,
+ xfilter.h): New files.
+ * lib/ddk/(Makefile.in, apcups.def, cfgmgr32.def, dxapi.def,
+ hal.def, hid.def, hidparse.def, mcd.def, ndis.def, ntoskrnl.def,
+ scsiport.def, tdi.def, usbcamd.def, usbcamd2.def, videoprt.def,
+ win32k.def): Ditto.
+
2002-10-04 Steven Edwards <Steven_Ed4153@yahoo.com>
* lib/ntdll.def (NtAccessCheck, NtAdjustPrivilegesToken,
--- /dev/null
+/*
+ * atm.h
+ *
+ * ATM support
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __ATM_H
+#define __ATM_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+typedef ULONG ATM_ADDRESSTYPE;
+
+#define SAP_TYPE_NSAP 1
+#define SAP_TYPE_E164 2
+
+#define ATM_MEDIA_SPECIFIC 1
+
+#define CALLMGR_SPECIFIC_Q2931 1
+
+#define ATM_NSAP 0
+#define ATM_E164 1
+
+#define ATM_MAC_ADDRESS_LENGTH 6
+#define ATM_ADDRESS_LENGTH 20
+
+typedef ULONG ATM_AAL_TYPE, *PATM_AAL_TYPE;
+
+#define AAL_TYPE_AAL0 1
+#define AAL_TYPE_AAL1 2
+#define AAL_TYPE_AAL34 4
+#define AAL_TYPE_AAL5 8
+
+#define ATM_ADDR_BLANK_CHAR L' '
+#define ATM_ADDR_E164_START_CHAR L'+'
+#define ATM_ADDR_PUNCTUATION_CHAR L'.'
+
+typedef enum {
+ IE_AALParameters,
+ IE_TrafficDescriptor,
+ IE_BroadbandBearerCapability,
+ IE_BHLI,
+ IE_BLLI,
+ IE_CalledPartyNumber,
+ IE_CalledPartySubaddress,
+ IE_CallingPartyNumber,
+ IE_CallingPartySubaddress,
+ IE_Cause,
+ IE_QOSClass,
+ IE_TransitNetworkSelection,
+ IE_BroadbandSendingComplete,
+ IE_LIJCallId,
+ IE_Raw
+} Q2931_IE_TYPE;
+
+typedef struct _Q2931_IE {
+ Q2931_IE_TYPE IEType;
+ ULONG IELength;
+ UCHAR IE[1];
+} Q2931_IE, *PQ2931_IE;
+
+typedef struct _AAL1_PARAMETERS {
+ UCHAR Subtype;
+ UCHAR CBRRate;
+ USHORT Multiplier;
+ UCHAR SourceClockRecoveryMethod;
+ UCHAR ErrorCorrectionMethod;
+ USHORT StructuredDataTransferBlocksize;
+ UCHAR PartiallyFilledCellsMethod;
+} AAL1_PARAMETERS, *PAAL1_PARAMETERS;
+
+typedef struct _AAL34_PARAMETERS {
+ USHORT ForwardMaxCPCSSDUSize;
+ USHORT BackwardMaxCPCSSDUSize;
+ USHORT LowestMID;
+ USHORT HighestMID;
+ UCHAR SSCSType;
+} AAL34_PARAMETERS, *PAAL34_PARAMETERS;
+
+/* AAL5_PARAMETERS.Mode constants */
+#define AAL5_MODE_MESSAGE 0x01
+#define AAL5_MODE_STREAMING 0x02
+
+/* AAL5_PARAMETERS.SSCSType constants */
+#define AAL5_SSCS_NULL 0x00
+#define AAL5_SSCS_SSCOP_ASSURED 0x01
+#define AAL5_SSCS_SSCOP_NON_ASSURED 0x02
+#define AAL5_SSCS_FRAME_RELAY 0x04
+
+typedef struct _AAL5_PARAMETERS {
+ ULONG ForwardMaxCPCSSDUSize;
+ ULONG BackwardMaxCPCSSDUSize;
+ UCHAR Mode;
+ UCHAR SSCSType;
+} AAL5_PARAMETERS, *PAAL5_PARAMETERS;
+
+typedef struct _AALUSER_PARAMETERS {
+ ULONG UserDefined;
+} AALUSER_PARAMETERS, *PAALUSER_PARAMETERS;
+
+typedef struct _AAL_PARAMETERS_IE {
+ ATM_AAL_TYPE AALType;
+ union {
+ AAL1_PARAMETERS AAL1Parameters;
+ AAL34_PARAMETERS AAL34Parameters;
+ AAL5_PARAMETERS AAL5Parameters;
+ AALUSER_PARAMETERS AALUserParameters;
+ } AALSpecificParameters;
+} AAL_PARAMETERS_IE, *PAAL_PARAMETERS_IE;
+
+typedef struct _ATM_AAL_OOB_INFO
+{
+ ATM_AAL_TYPE AalType;
+ union {
+ struct _ATM_AAL5_INFO {
+ BOOLEAN CellLossPriority;
+ UCHAR UserToUserIndication;
+ UCHAR CommonPartIndicator;
+ } ATM_AAL5_INFO;
+
+ struct _ATM_AAL0_INFO {
+ BOOLEAN CellLossPriority;
+ UCHAR PayLoadTypeIdentifier;
+ } ATM_AAL0_INFO;
+#ifdef __cplusplus
+ } u;
+#else
+ };
+#endif
+} ATM_AAL_OOB_INFO, *PATM_AAL_OOB_INFO;
+
+typedef struct _ATM_ADDRESS {
+ ATM_ADDRESSTYPE AddressType;
+ ULONG NumberOfDigits;
+ UCHAR Address[ATM_ADDRESS_LENGTH];
+} ATM_ADDRESS, *PATM_ADDRESS;
+
+/* ATM_BHLI_IE.HighLayerInfoType constants */
+#define BHLI_ISO 0x00
+#define BHLI_UserSpecific 0x01
+#define BHLI_HighLayerProfile 0x02
+#define BHLI_VendorSpecificAppId 0x03
+
+typedef struct _ATM_BHLI_IE {
+ ULONG HighLayerInfoType;
+ ULONG HighLayerInfoLength;
+ UCHAR HighLayerInfo[8];
+} ATM_BHLI_IE, *PATM_BHLI_IE;
+
+/* ATM_BLLI_IE.Layer2Protocol constants */
+#define BLLI_L2_ISO_1745 0x01
+#define BLLI_L2_Q921 0x02
+#define BLLI_L2_X25L 0x06
+#define BLLI_L2_X25M 0x07
+#define BLLI_L2_ELAPB 0x08
+#define BLLI_L2_HDLC_ARM 0x09
+#define BLLI_L2_HDLC_NRM 0x0A
+#define BLLI_L2_HDLC_ABM 0x0B
+#define BLLI_L2_LLC 0x0C
+#define BLLI_L2_X75 0x0D
+#define BLLI_L2_Q922 0x0E
+#define BLLI_L2_USER_SPECIFIED 0x10
+#define BLLI_L2_ISO_7776 0x11
+
+/* ATM_BLLI_IE.Layer3Protocol constants */
+#define BLLI_L3_X25 0x06
+#define BLLI_L3_ISO_8208 0x07
+#define BLLI_L3_X223 0x08
+#define BLLI_L3_SIO_8473 0x09
+#define BLLI_L3_T70 0x0A
+#define BLLI_L3_ISO_TR9577 0x0B
+#define BLLI_L3_USER_SPECIFIED 0x10
+
+/* ATM_BLLI_IE.Layer3IPI constants */
+#define BLLI_L3_IPI_SNAP 0x80
+#define BLLI_L3_IPI_IP 0xCC
+
+typedef struct _ATM_BLLI_IE {
+ ULONG Layer2Protocol;
+ UCHAR Layer2Mode;
+ UCHAR Layer2WindowSize;
+ ULONG Layer2UserSpecifiedProtocol;
+ ULONG Layer3Protocol;
+ UCHAR Layer3Mode;
+ UCHAR Layer3DefaultPacketSize;
+ UCHAR Layer3PacketWindowSize;
+ ULONG Layer3UserSpecifiedProtocol;
+ ULONG Layer3IPI;
+ UCHAR SnapId[5];
+} ATM_BLLI_IE, *PATM_BLLI_IE;
+
+/* ATM_BROADBAND_BEARER_CAPABILITY_IE.BearerClass constants */
+#define BCOB_A 0x00
+#define BCOB_C 0x01
+#define BCOB_X 0x02
+
+/* ATM_BROADBAND_BEARER_CAPABILITY_IE.TrafficType constants */
+#define TT_NOIND 0x00
+#define TT_CBR 0x04
+#define TT_VBR 0x08
+
+/* ATM_BROADBAND_BEARER_CAPABILITY_IE.TimingRequirements constants */
+#define TR_NOIND 0x00
+#define TR_END_TO_END 0x01
+#define TR_NO_END_TO_END 0x02
+
+/* ATM_BROADBAND_BEARER_CAPABILITY_IE.ClippingSusceptability constants */
+#define CLIP_NOT 0x00
+#define CLIP_SUS 0x20
+
+/* ATM_BROADBAND_BEARER_CAPABILITY_IE.UserPlaneConnectionConfig constants */
+#define UP_P2P 0x00
+#define UP_P2MP 0x01
+
+typedef struct _ATM_BROADBAND_BEARER_CAPABILITY_IE {
+ UCHAR BearerClass;
+ UCHAR TrafficType;
+ UCHAR TimingRequirements;
+ UCHAR ClippingSusceptability;
+ UCHAR UserPlaneConnectionConfig;
+} ATM_BROADBAND_BEARER_CAPABILITY_IE, *PATM_BROADBAND_BEARER_CAPABILITY_IE;
+
+typedef struct _ATM_BROADBAND_SENDING_COMPLETE_IE {
+ UCHAR SendingComplete;
+} ATM_BROADBAND_SENDING_COMPLETE_IE, *PATM_BROADBAND_SENDING_COMPLETE_IE;
+
+typedef struct _ATM_CALLING_PARTY_NUMBER_IE {
+ ATM_ADDRESS Number;
+ UCHAR PresentationIndication;
+ UCHAR ScreeningIndicator;
+} ATM_CALLING_PARTY_NUMBER_IE, *PATM_CALLING_PARTY_NUMBER_IE;
+
+/* ATM_CAUSE_IE.Location constants */
+#define ATM_CAUSE_LOC_USER 0x00
+#define ATM_CAUSE_LOC_PRIVATE_LOCAL 0x01
+#define ATM_CAUSE_LOC_PUBLIC_LOCAL 0x02
+#define ATM_CAUSE_LOC_TRANSIT_NETWORK 0x03
+#define ATM_CAUSE_LOC_PUBLIC_REMOTE 0x04
+#define ATM_CAUSE_LOC_PRIVATE_REMOTE 0x05
+#define ATM_CAUSE_LOC_INTERNATIONAL_NETWORK 0x07
+#define ATM_CAUSE_LOC_BEYOND_INTERWORKING 0x0A
+
+/* ATM_CAUSE_IE.Cause constants */
+#define ATM_CAUSE_UNALLOCATED_NUMBER 0x01
+#define ATM_CAUSE_NO_ROUTE_TO_TRANSIT_NETWORK 0x02
+#define ATM_CAUSE_NO_ROUTE_TO_DESTINATION 0x03
+#define ATM_CAUSE_VPI_VCI_UNACCEPTABLE 0x0A
+#define ATM_CAUSE_NORMAL_CALL_CLEARING 0x10
+#define ATM_CAUSE_USER_BUSY 0x11
+#define ATM_CAUSE_NO_USER_RESPONDING 0x12
+#define ATM_CAUSE_CALL_REJECTED 0x15
+#define ATM_CAUSE_NUMBER_CHANGED 0x16
+#define ATM_CAUSE_USER_REJECTS_CLIR 0x17
+#define ATM_CAUSE_DESTINATION_OUT_OF_ORDER 0x1B
+#define ATM_CAUSE_INVALID_NUMBER_FORMAT 0x1C
+#define ATM_CAUSE_STATUS_ENQUIRY_RESPONSE 0x1E
+#define ATM_CAUSE_NORMAL_UNSPECIFIED 0x1F
+#define ATM_CAUSE_VPI_VCI_UNAVAILABLE 0x23
+#define ATM_CAUSE_NETWORK_OUT_OF_ORDER 0x26
+#define ATM_CAUSE_TEMPORARY_FAILURE 0x29
+#define ATM_CAUSE_ACCESS_INFORMAION_DISCARDED 0x2B
+#define ATM_CAUSE_NO_VPI_VCI_AVAILABLE 0x2D
+#define ATM_CAUSE_RESOURCE_UNAVAILABLE 0x2F
+#define ATM_CAUSE_QOS_UNAVAILABLE 0x31
+#define ATM_CAUSE_USER_CELL_RATE_UNAVAILABLE 0x33
+#define ATM_CAUSE_BEARER_CAPABILITY_UNAUTHORIZED 0x39
+#define ATM_CAUSE_BEARER_CAPABILITY_UNAVAILABLE 0x3A
+#define ATM_CAUSE_OPTION_UNAVAILABLE 0x3F
+#define ATM_CAUSE_BEARER_CAPABILITY_UNIMPLEMENTED 0x41
+#define ATM_CAUSE_UNSUPPORTED_TRAFFIC_PARAMETERS 0x49
+#define ATM_CAUSE_INVALID_CALL_REFERENCE 0x51
+#define ATM_CAUSE_CHANNEL_NONEXISTENT 0x52
+#define ATM_CAUSE_INCOMPATIBLE_DESTINATION 0x58
+#define ATM_CAUSE_INVALID_ENDPOINT_REFERENCE 0x59
+#define ATM_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION 0x5B
+#define ATM_CAUSE_TOO_MANY_PENDING_ADD_PARTY 0x5C
+#define ATM_CAUSE_AAL_PARAMETERS_UNSUPPORTED 0x5D
+#define ATM_CAUSE_MANDATORY_IE_MISSING 0x60
+#define ATM_CAUSE_UNIMPLEMENTED_MESSAGE_TYPE 0x61
+#define ATM_CAUSE_UNIMPLEMENTED_IE 0x63
+#define ATM_CAUSE_INVALID_IE_CONTENTS 0x64
+#define ATM_CAUSE_INVALID_STATE_FOR_MESSAGE 0x65
+#define ATM_CAUSE_RECOVERY_ON_TIMEOUT 0x66
+#define ATM_CAUSE_INCORRECT_MESSAGE_LENGTH 0x68
+#define ATM_CAUSE_PROTOCOL_ERROR 0x6F
+
+/* ATM_CAUSE_IE.Diagnostics constants */
+#define ATM_CAUSE_COND_UNKNOWN 0x00
+#define ATM_CAUSE_COND_PERMANENT 0x01
+#define ATM_CAUSE_COND_TRANSIENT 0x02
+#define ATM_CAUSE_REASON_USER 0x00
+#define ATM_CAUSE_REASON_IE_MISSING 0x04
+#define ATM_CAUSE_REASON_IE_INSUFFICIENT 0x08
+#define ATM_CAUSE_PU_PROVIDER 0x00
+#define ATM_CAUSE_PU_USER 0x08
+#define ATM_CAUSE_NA_NORMAL 0x00
+#define ATM_CAUSE_NA_ABNORMAL 0x04
+
+typedef struct _ATM_CAUSE_IE {
+ UCHAR Location;
+ UCHAR Cause;
+ UCHAR DiagnosticsLength;
+ UCHAR Diagnostics[4];
+} ATM_CAUSE_IE, *PATM_CAUSE_IE;
+
+
+typedef ULONG ATM_SERVICE_CATEGORY, *PATM_SERVICE_CATEGORY;
+
+/* ATM_FLOW_PARAMETERS.ServiceCategory constants */
+#define ATM_SERVICE_CATEGORY_CBR 1
+#define ATM_SERVICE_CATEGORY_VBR 2
+#define ATM_SERVICE_CATEGORY_UBR 4
+#define ATM_SERVICE_CATEGORY_ABR 8
+
+/* ATM_FLOW_PARAMETERS.Reserved1 constants */
+#define ATM_FLOW_PARAMS_RSVD1_MPP 0x01
+
+typedef struct _ATM_FLOW_PARAMETERS {
+ ATM_SERVICE_CATEGORY ServiceCategory;
+ ULONG AverageCellRate;
+ ULONG PeakCellRate;
+ ULONG MinimumCellRate;
+ ULONG InitialCellRate;
+ ULONG BurstLengthCells;
+ ULONG MaxSduSize;
+ ULONG TransientBufferExposure;
+ ULONG CumulativeRMFixedRTT;
+ UCHAR RateIncreaseFactor;
+ UCHAR RateDecreaseFactor;
+ USHORT ACRDecreaseTimeFactor;
+ UCHAR MaximumCellsPerForwardRMCell;
+ UCHAR MaximumForwardRMCellInterval;
+ UCHAR CutoffDecreaseFactor;
+ UCHAR Reserved1;
+ ULONG MissingRMCellCount;
+ ULONG Reserved2;
+ ULONG Reserved3;
+} ATM_FLOW_PARAMETERS, *PATM_FLOW_PARAMETERS;
+
+typedef struct _ATM_VPIVCI {
+ ULONG Vpi;
+ ULONG Vci;
+} ATM_VPIVCI, *PATM_VPIVCI;
+
+typedef struct _ATM_MEDIA_PARAMETERS {
+ ATM_VPIVCI ConnectionId;
+ ATM_AAL_TYPE AALType;
+ ULONG CellDelayVariationCLP0;
+ ULONG CellDelayVariationCLP1;
+ ULONG CellLossRatioCLP0;
+ ULONG CellLossRatioCLP1;
+ ULONG CellTransferDelayCLP0;
+ ULONG CellTransferDelayCLP1;
+ ULONG DefaultCLP;
+ ATM_FLOW_PARAMETERS Transmit;
+ ATM_FLOW_PARAMETERS Receive;
+} ATM_MEDIA_PARAMETERS, *PATM_MEDIA_PARAMETERS;
+
+typedef struct _ATM_PVC_SAP {
+ ATM_BLLI_IE Blli;
+ ATM_BHLI_IE Bhli;
+} ATM_PVC_SAP, *PATM_PVC_SAP;
+
+/* ATM_QOS_CLASS_IE constants */
+#define QOS_CLASS0 0x00
+#define QOS_CLASS1 0x01
+#define QOS_CLASS2 0x02
+#define QOS_CLASS3 0x03
+#define QOS_CLASS4 0x04
+
+typedef struct _ATM_QOS_CLASS_IE {
+ UCHAR QOSClassForward;
+ UCHAR QOSClassBackward;
+} ATM_QOS_CLASS_IE, *PATM_QOS_CLASS_IE;
+
+typedef struct _ATM_RAW_IE {
+ ULONG RawIELength;
+ ULONG RawIEType;
+ UCHAR RawIEValue[1];
+} ATM_RAW_IE, *PATM_RAW_IE;
+
+typedef struct _ATM_SAP {
+ ATM_BLLI_IE Blli;
+ ATM_BHLI_IE Bhli;
+ ULONG NumberOfAddresses;
+ UCHAR Addresses[1];
+} ATM_SAP, *PATM_SAP;
+
+typedef struct _ATM_TRAFFIC_DESCRIPTOR {
+ ULONG PeakCellRateCLP0;
+ ULONG PeakCellRateCLP01;
+ ULONG SustainableCellRateCLP0;
+ ULONG SustainableCellRateCLP01;
+ ULONG MaximumBurstSizeCLP0;
+ ULONG MaximumBurstSizeCLP01;
+ BOOLEAN BestEffort;
+ BOOLEAN Tagging;
+} ATM_TRAFFIC_DESCRIPTOR, *PATM_TRAFFIC_DESCRIPTOR;
+
+typedef struct _ATM_TRAFFIC_DESCRIPTOR_IE {
+ ATM_TRAFFIC_DESCRIPTOR ForwardTD;
+ ATM_TRAFFIC_DESCRIPTOR BackwardTD;
+} ATM_TRAFFIC_DESCRIPTOR_IE, *PATM_TRAFFIC_DESCRIPTOR_IE;
+
+/* ATM_TRANSIT_NETWORK_SELECTION_IE.TypeOfNetworkId constants */
+#define TNS_TYPE_NATIONAL 0x40
+
+/* ATM_TRANSIT_NETWORK_SELECTION_IE.NetworkIdPlan constants */
+#define TNS_PLAN_CARRIER_ID_CODE 0x01
+
+typedef struct _ATM_TRANSIT_NETWORK_SELECTION_IE {
+ UCHAR TypeOfNetworkId;
+ UCHAR NetworkIdPlan;
+ UCHAR NetworkIdLength;
+ UCHAR NetworkId[1];
+} ATM_TRANSIT_NETWORK_SELECTION_IE, *PATM_TRANSIT_NETWORK_SELECTION_IE;
+
+typedef struct _ATM_LIJ_CALLID_IE {
+ ULONG Identifier;
+} ATM_LIJ_CALLID_IE, *PATM_LIJ_CALLID_IE;
+
+/* Q2931_ADD_PVC.Flags constants */
+#define CO_FLAG_SIGNALING_VC 0x00000001
+#define CO_FLAG_NO_DEST_SAP 0x00000002
+
+typedef struct _Q2931_ADD_PVC {
+ ATM_ADDRESS CalledParty;
+ ATM_ADDRESS CallingParty;
+ ATM_VPIVCI ConnectionId;
+ ATM_AAL_TYPE AALType;
+ ATM_FLOW_PARAMETERS ForwardFP;
+ ATM_FLOW_PARAMETERS BackwardFP;
+ ULONG Flags;
+ ATM_PVC_SAP LocalSap;
+ ATM_PVC_SAP DestinationSap;
+ BOOLEAN LIJIdPresent;
+ ATM_LIJ_CALLID_IE LIJId;
+} Q2931_ADD_PVC, *PQ2931_ADD_PVC;
+
+typedef struct _Q2931_DELETE_PVC {
+ ATM_VPIVCI ConnectionId;
+} Q2931_DELETE_PVC, *PQ2931_DELETE_PVC;
+
+typedef ATM_ADDRESS ATM_CALLED_PARTY_NUMBER_IE;
+typedef ATM_ADDRESS ATM_CALLED_PARTY_SUBADDRESS_IE;
+typedef ATM_ADDRESS ATM_CALLING_PARTY_SUBADDRESS_IE;
+
+typedef struct _Q2931_CALLMGR_PARAMETERS {
+ ATM_ADDRESS CalledParty;
+ ATM_ADDRESS CallingParty;
+ ULONG InfoElementCount;
+ UCHAR InfoElements[1];
+} Q2931_CALLMGR_PARAMETERS, *PQ2931_CALLMGR_PARAMETERS;
+
+typedef struct _ATM_VC_RATES_SUPPORTED {
+ ULONG MinCellRate;
+ ULONG MaxCellRate;
+} ATM_VC_RATES_SUPPORTED, *PATM_VC_RATES_SUPPORTED;
+
+typedef ULONG ATM_SERVICE_REGISTRY_TYPE;
+
+/* ATM_SERVICE_ADDRESS_LIST.ServiceRegistryType constants */
+#define ATM_SERVICE_REGISTRY_LECS 1
+#define ATM_SERVICE_REGISTRY_ANS 2
+
+typedef struct _ATM_SERVICE_ADDRESS_LIST {
+ ATM_SERVICE_REGISTRY_TYPE ServiceRegistryType;
+ ULONG NumberOfAddressesAvailable;
+ ULONG NumberOfAddressesReturned;
+ ATM_ADDRESS Address[1];
+} ATM_SERVICE_ADDRESS_LIST, *PATM_SERVICE_ADDRESS_LIST;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ATM_H */
--- /dev/null
+/*
+ * batclass.h
+ *
+ * Battery class driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __BATCLASS_H
+#define __BATCLASS_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#if defined(_BATTERYCLASS_)
+ #define BCLASSAPI DECLSPEC_EXPORT
+#else
+ #define BCLASSAPI DECLSPEC_IMPORT
+#endif
+
+
+/* Battery device GUIDs */
+
+DEFINE_GUID(GUID_DEVICE_BATTERY,
+ 0x72631e54L, 0x78A4, 0x11d0, 0xbc, 0xf7, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a);
+
+DEFINE_GUID(BATTERY_STATUS_WMI_GUID,
+ 0xfc4670d1, 0xebbf, 0x416e, 0x87, 0xce, 0x37, 0x4a, 0x4e, 0xbc, 0x11, 0x1a);
+
+DEFINE_GUID(BATTERY_RUNTIME_WMI_GUID,
+ 0x535a3767, 0x1ac2, 0x49bc, 0xa0, 0x77, 0x3f, 0x7a, 0x02, 0xe4, 0x0a, 0xec);
+
+DEFINE_GUID(BATTERY_TEMPERATURE_WMI_GUID,
+ 0x1a52a14d, 0xadce, 0x4a44, 0x9a, 0x3e, 0xc8, 0xd8, 0xf1, 0x5f, 0xf2, 0xc2);
+
+DEFINE_GUID(BATTERY_FULL_CHARGED_CAPACITY_WMI_GUID,
+ 0x40b40565, 0x96f7, 0x4435, 0x86, 0x94, 0x97, 0xe0, 0xe4, 0x39, 0x59, 0x05);
+
+DEFINE_GUID(BATTERY_CYCLE_COUNT_WMI_GUID,
+ 0xef98db24, 0x0014, 0x4c25, 0xa5, 0x0b, 0xc7, 0x24, 0xae, 0x5c, 0xd3, 0x71);
+
+DEFINE_GUID(BATTERY_STATIC_DATA_WMI_GUID,
+ 0x05e1e463, 0xe4e2, 0x4ea9, 0x80, 0xcb, 0x9b, 0xd4, 0xb3, 0xca, 0x06, 0x55);
+
+DEFINE_GUID(BATTERY_STATUS_CHANGE_WMI_GUID,
+ 0xcddfa0c3, 0x7c5b, 0x4e43, 0xa0, 0x34, 0x05, 0x9f, 0xa5, 0xb8, 0x43, 0x64);
+
+DEFINE_GUID(BATTERY_TAG_CHANGE_WMI_GUID,
+ 0x5e1f6e19, 0x8786, 0x4d23, 0x94, 0xfc, 0x9e, 0x74, 0x6b, 0xd5, 0xd8, 0x88);
+
+
+/* BATTERY_INFORMATION.Capabilities constants */
+#define BATTERY_SET_CHARGE_SUPPORTED 0x00000001
+#define BATTERY_SET_DISCHARGE_SUPPORTED 0x00000002
+#define BATTERY_SET_RESUME_SUPPORTED 0x00000004
+#define BATTERY_IS_SHORT_TERM 0x20000000
+#define BATTERY_CAPACITY_RELATIVE 0x40000000
+#define BATTERY_SYSTEM_BATTERY 0x80000000
+
+typedef struct _BATTERY_INFORMATION {
+ ULONG Capabilities;
+ UCHAR Technology;
+ UCHAR Reserved[3];
+ UCHAR Chemistry[4];
+ ULONG DesignedCapacity;
+ ULONG FullChargedCapacity;
+ ULONG DefaultAlert1;
+ ULONG DefaultAlert2;
+ ULONG CriticalBias;
+ ULONG CycleCount;
+} BATTERY_INFORMATION, *PBATTERY_INFORMATION;
+
+typedef struct _BATTERY_MANUFACTURE_DATE {
+ UCHAR Day;
+ UCHAR Month;
+ USHORT Year;
+} BATTERY_MANUFACTURE_DATE, *PBATTERY_MANUFACTURE_DATE;
+
+typedef struct _BATTERY_NOTIFY {
+ ULONG PowerState;
+ ULONG LowCapacity;
+ ULONG HighCapacity;
+} BATTERY_NOTIFY, *PBATTERY_NOTIFY;
+
+typedef struct _BATTERY_REPORTING_SCALE {
+ ULONG Granularity;
+ ULONG Capacity;
+} BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
+
+/* BATTERY_STATUS.PowerState flags */
+#define BATTERY_POWER_ON_LINE 0x00000001
+#define BATTERY_DISCHARGING 0x00000002
+#define BATTERY_CHARGING 0x00000004
+#define BATTERY_CRITICAL 0x00000008
+
+/* BATTERY_STATUS.Voltage constant */
+#define BATTERY_UNKNOWN_VOLTAGE 0xFFFFFFFF
+
+/* BATTERY_STATUS.Rate constant */
+#define BATTERY_UNKNOWN_RATE 0x80000000
+
+typedef struct _BATTERY_STATUS {
+ ULONG PowerState;
+ ULONG Capacity;
+ ULONG Voltage;
+ LONG Rate;
+} BATTERY_STATUS, *PBATTERY_STATUS;
+
+
+/* BATTERY_INFORMATION.Capacity constants */
+#define BATTERY_UNKNOWN_CAPACITY 0xFFFFFFFF
+
+typedef enum _BATTERY_QUERY_INFORMATION_LEVEL {
+ BatteryInformation = 0,
+ BatteryGranularityInformation,
+ BatteryTemperature,
+ BatteryEstimatedTime,
+ BatteryDeviceName,
+ BatteryManufactureDate,
+ BatteryManufactureName,
+ BatteryUniqueID,
+ BatterySerialNumber
+} BATTERY_QUERY_INFORMATION_LEVEL;
+
+/* BatteryEstimatedTime constant */
+#define BATTERY_UNKNOWN_TIME 0x80000000
+
+/* NTSTATUS possibly returned by BCLASS_QUERY_STATUS */
+#define BATTERY_TAG_INVALID 0
+
+typedef struct _BATTERY_QUERY_INFORMATION {
+ ULONG BatteryTag;
+ BATTERY_QUERY_INFORMATION_LEVEL InformationLevel;
+ LONG AtRate;
+} BATTERY_QUERY_INFORMATION, *PBATTERY_QUERY_INFORMATION;
+
+typedef enum _BATTERY_SET_INFORMATION_LEVEL {
+ BatteryCriticalBias = 0,
+ BatteryCharge,
+ BatteryDischarge
+} BATTERY_SET_INFORMATION_LEVEL;
+
+#define MAX_BATTERY_STRING_SIZE 128
+
+typedef struct _BATTERY_SET_INFORMATION {
+ ULONG BatteryTag;
+ BATTERY_SET_INFORMATION_LEVEL InformationLevel;
+ UCHAR Buffer[1];
+} BATTERY_SET_INFORMATION, *PBATTERY_SET_INFORMATION;
+
+typedef struct _BATTERY_WAIT_STATUS {
+ ULONG BatteryTag;
+ ULONG Timeout;
+ ULONG PowerState;
+ ULONG LowCapacity;
+ ULONG HighCapacity;
+} BATTERY_WAIT_STATUS, *PBATTERY_WAIT_STATUS;
+
+
+#define IOCTL_BATTERY_QUERY_TAG \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x10, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_BATTERY_QUERY_INFORMATION \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x11, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_BATTERY_SET_INFORMATION \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x12, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_BATTERY_QUERY_STATUS \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x13, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+
+typedef NTSTATUS DDKAPI
+(*BCLASS_DISABLE_STATUS_NOTIFY)(
+ IN PVOID Context);
+
+typedef NTSTATUS DDKAPI
+(*BCLASS_QUERY_INFORMATION)(
+ IN PVOID Context,
+ IN ULONG BatteryTag,
+ IN BATTERY_QUERY_INFORMATION_LEVEL Level,
+ IN LONG AtRate OPTIONAL,
+ OUT PVOID Buffer,
+ IN ULONG BufferLength,
+ OUT PULONG ReturnedLength);
+
+typedef NTSTATUS DDKAPI
+(*BCLASS_QUERY_STATUS)(
+ IN PVOID Context,
+ IN ULONG BatteryTag,
+ OUT PBATTERY_STATUS BatteryStatus);
+
+typedef NTSTATUS DDKAPI
+(*BCLASS_QUERY_TAG)(
+ IN PVOID Context,
+ OUT PULONG BatteryTag);
+
+typedef NTSTATUS DDKAPI
+(*BCLASS_SET_INFORMATION)(
+ IN PVOID Context,
+ IN ULONG BatteryTag,
+ IN BATTERY_SET_INFORMATION_LEVEL Level,
+ IN PVOID Buffer OPTIONAL);
+
+typedef NTSTATUS DDKAPI
+(*BCLASS_SET_STATUS_NOTIFY)(
+ IN PVOID Context,
+ IN ULONG BatteryTag,
+ IN PBATTERY_NOTIFY BatteryNotify);
+
+
+typedef struct _BATTERY_MINIPORT_INFO {
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ PVOID Context;
+ BCLASS_QUERY_TAG QueryTag;
+ BCLASS_QUERY_INFORMATION QueryInformation;
+ BCLASS_SET_INFORMATION SetInformation;
+ BCLASS_QUERY_STATUS QueryStatus;
+ BCLASS_SET_STATUS_NOTIFY SetStatusNotify;
+ BCLASS_DISABLE_STATUS_NOTIFY DisableStatusNotify;
+ PDEVICE_OBJECT Pdo;
+ PUNICODE_STRING DeviceName;
+} BATTERY_MINIPORT_INFO, *PBATTERY_MINIPORT_INFO;
+
+/* BATTERY_MINIPORT_INFO.XxxVersion */
+#define BATTERY_CLASS_MAJOR_VERSION 0x0001
+#define BATTERY_CLASS_MINOR_VERSION 0x0000
+
+
+BCLASSAPI
+NTSTATUS
+DDKAPI
+BatteryClassInitializeDevice(
+ IN PBATTERY_MINIPORT_INFO MiniportInfo,
+ IN PVOID *ClassData);
+
+BCLASSAPI
+NTSTATUS
+DDKAPI
+BatteryClassIoctl(
+ IN PVOID ClassData,
+ IN PIRP Irp);
+
+BCLASSAPI
+NTSTATUS
+DDKAPI
+BatteryClassQueryWmiDataBlock(
+ IN PVOID ClassData,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN ULONG GuidIndex,
+ IN OUT PULONG InstanceLengthArray,
+ IN ULONG OutBufferSize,
+ OUT PUCHAR Buffer);
+
+BCLASSAPI
+NTSTATUS
+DDKAPI
+BatteryClassStatusNotify(
+ IN PVOID ClassData);
+
+BCLASSAPI
+NTSTATUS
+DDKAPI
+BatteryClassSystemControl(
+ IN PVOID ClassData,
+ IN PWMILIB_CONTEXT WmiLibContext,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ OUT PSYSCTL_IRP_DISPOSITION Disposition);
+
+BCLASSAPI
+NTSTATUS
+DDKAPI
+BatteryClassUnload(
+ IN PVOID ClassData);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BATCLASS_H */
--- /dev/null
+/*
+ * cfg.h
+ *
+ * PnP Configuration Manager shared definitions between user mode and kernel mode code
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __CFG_H
+#define __CFG_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#define CM_PROB_NOT_CONFIGURED 0x00000001
+#define CM_PROB_DEVLOADER_FAILED 0x00000002
+#define CM_PROB_OUT_OF_MEMORY 0x00000003
+#define CM_PROB_ENTRY_IS_WRONG_TYPE 0x00000004
+#define CM_PROB_LACKED_ARBITRATOR 0x00000005
+#define CM_PROB_BOOT_CONFIG_CONFLICT 0x00000006
+#define CM_PROB_FAILED_FILTER 0x00000007
+#define CM_PROB_DEVLOADER_NOT_FOUND 0x00000008
+#define CM_PROB_INVALID_DATA 0x00000009
+#define CM_PROB_FAILED_START 0x0000000A
+#define CM_PROB_LIAR 0x0000000B
+#define CM_PROB_NORMAL_CONFLICT 0x0000000C
+#define CM_PROB_NOT_VERIFIED 0x0000000D
+#define CM_PROB_NEED_RESTART 0x0000000E
+#define CM_PROB_REENUMERATION 0x0000000F
+#define CM_PROB_PARTIAL_LOG_CONF 0x00000010
+#define CM_PROB_UNKNOWN_RESOURCE 0x00000011
+#define CM_PROB_REINSTALL 0x00000012
+#define CM_PROB_REGISTRY 0x00000013
+#define CM_PROB_VXDLDR 0x00000014
+#define CM_PROB_WILL_BE_REMOVED 0x00000015
+#define CM_PROB_DISABLED 0x00000016
+#define CM_PROB_DEVLOADER_NOT_READY 0x00000017
+#define CM_PROB_DEVICE_NOT_THERE 0x00000018
+#define CM_PROB_MOVED 0x00000019
+#define CM_PROB_TOO_EARLY 0x0000001A
+#define CM_PROB_NO_VALID_LOG_CONF 0x0000001B
+#define CM_PROB_FAILED_INSTALL 0x0000001C
+#define CM_PROB_HARDWARE_DISABLED 0x0000001D
+#define CM_PROB_CANT_SHARE_IRQ 0x0000001E
+#define CM_PROB_FAILED_ADD 0x0000001F
+#define CM_PROB_DISABLED_SERVICE 0x00000020
+#define CM_PROB_TRANSLATION_FAILED 0x00000021
+#define CM_PROB_NO_SOFTCONFIG 0x00000022
+#define CM_PROB_BIOS_TABLE 0x00000023
+#define CM_PROB_IRQ_TRANSLATION_FAILED 0x00000024
+#define CM_PROB_FAILED_DRIVER_ENTRY 0x00000025
+#define CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD 0x00000026
+#define CM_PROB_DRIVER_FAILED_LOAD 0x00000027
+#define CM_PROB_DRIVER_SERVICE_KEY_INVALID 0x00000028
+#define CM_PROB_LEGACY_SERVICE_NO_DEVICES 0x00000029
+#define CM_PROB_DUPLICATE_DEVICE 0x0000002A
+#define CM_PROB_FAILED_POST_START 0x0000002B
+#define CM_PROB_HALTED 0x0000002C
+#define CM_PROB_PHANTOM 0x0000002D
+#define CM_PROB_SYSTEM_SHUTDOWN 0x0000002E
+#define CM_PROB_HELD_FOR_EJECT 0x0000002F
+#define CM_PROB_DRIVER_BLOCKED 0x00000030
+#define CM_PROB_REGISTRY_TOO_LARGE 0x00000031
+
+#define LCPRI_FORCECONFIG 0x00000000
+#define LCPRI_BOOTCONFIG 0x00000001
+#define LCPRI_DESIRED 0x00002000
+#define LCPRI_NORMAL 0x00003000
+#define LCPRI_LASTBESTCONFIG 0x00003FFF
+#define LCPRI_SUBOPTIMAL 0x00005000
+#define LCPRI_LASTSOFTCONFIG 0x00007FFF
+#define LCPRI_RESTART 0x00008000
+#define LCPRI_REBOOT 0x00009000
+#define LCPRI_POWEROFF 0x0000A000
+#define LCPRI_HARDRECONFIG 0x0000C000
+#define LCPRI_HARDWIRED 0x0000E000
+#define LCPRI_IMPOSSIBLE 0x0000F000
+#define LCPRI_DISABLED 0x0000FFFF
+#define MAX_LCPRI 0x0000FFFF
+
+typedef enum _PNP_VETO_TYPE {
+ PNP_VetoTypeUnknown,
+ PNP_VetoLegacyDevice,
+ PNP_VetoPendingClose,
+ PNP_VetoWindowsApp,
+ PNP_VetoWindowsService,
+ PNP_VetoOutstandingOpen,
+ PNP_VetoDevice,
+ PNP_VetoDriver,
+ PNP_VetoIllegalDeviceRequest,
+ PNP_VetoInsufficientPower,
+ PNP_VetoNonDisableable,
+ PNP_VetoLegacyDriver,
+} PNP_VETO_TYPE, *PPNP_VETO_TYPE;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CFG_H */
--- /dev/null
+/*
+ * cfgmgr32.h
+ *
+ * PnP configuration manager
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __CFGMGR32_H
+#define __CFGMGR32_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#if defined(_CFGMGR32_)
+#define CMAPI DECLSPEC_EXPORT
+#else
+#define CMAPI DECLSPEC_IMPORT
+#endif
+
+#include "cfg.h"
+
+#define CR_SUCCESS 0x00000000
+#define CR_DEFAULT 0x00000001
+#define CR_OUT_OF_MEMORY 0x00000002
+#define CR_INVALID_POINTER 0x00000003
+#define CR_INVALID_FLAG 0x00000004
+#define CR_INVALID_DEVNODE 0x00000005
+#define CR_INVALID_DEVINST CR_INVALID_DEVNODE
+#define CR_INVALID_RES_DES 0x00000006
+#define CR_INVALID_LOG_CONF 0x00000007
+#define CR_INVALID_ARBITRATOR 0x00000008
+#define CR_INVALID_NODELIST 0x00000009
+#define CR_DEVNODE_HAS_REQS 0x0000000A
+#define CR_DEVINST_HAS_REQS CR_DEVNODE_HAS_REQS
+#define CR_INVALID_RESOURCEID 0x0000000B
+#define CR_DLVXD_NOT_FOUND 0x0000000C
+#define CR_NO_SUCH_DEVNODE 0x0000000D
+#define CR_NO_SUCH_DEVINST CR_NO_SUCH_DEVNODE
+#define CR_NO_MORE_LOG_CONF 0x0000000E
+#define CR_NO_MORE_RES_DES 0x0000000F
+#define CR_ALREADY_SUCH_DEVNODE 0x00000010
+#define CR_ALREADY_SUCH_DEVINST CR_ALREADY_SUCH_DEVNODE
+#define CR_INVALID_RANGE_LIST 0x00000011
+#define CR_INVALID_RANGE 0x00000012
+#define CR_FAILURE 0x00000013
+#define CR_NO_SUCH_LOGICAL_DEV 0x00000014
+#define CR_CREATE_BLOCKED 0x00000015
+#define CR_NOT_SYSTEM_VM 0x00000016
+#define CR_REMOVE_VETOED 0x00000017
+#define CR_APM_VETOED 0x00000018
+#define CR_INVALID_LOAD_TYPE 0x00000019
+#define CR_BUFFER_SMALL 0x0000001A
+#define CR_NO_ARBITRATOR 0x0000001B
+#define CR_NO_REGISTRY_HANDLE 0x0000001C
+#define CR_REGISTRY_ERROR 0x0000001D
+#define CR_INVALID_DEVICE_ID 0x0000001E
+#define CR_INVALID_DATA 0x0000001F
+#define CR_INVALID_API 0x00000020
+#define CR_DEVLOADER_NOT_READY 0x00000021
+#define CR_NEED_RESTART 0x00000022
+#define CR_NO_MORE_HW_PROFILES 0x00000023
+#define CR_DEVICE_NOT_THERE 0x00000024
+#define CR_NO_SUCH_VALUE 0x00000025
+#define CR_WRONG_TYPE 0x00000026
+#define CR_INVALID_PRIORITY 0x00000027
+#define CR_NOT_DISABLEABLE 0x00000028
+#define CR_FREE_RESOURCES 0x00000029
+#define CR_QUERY_VETOED 0x0000002A
+#define CR_CANT_SHARE_IRQ 0x0000002B
+#define CR_NO_DEPENDENT 0x0000002C
+#define CR_SAME_RESOURCES 0x0000002D
+#define CR_NO_SUCH_REGISTRY_KEY 0x0000002E
+#define CR_INVALID_MACHINENAME 0x0000002F
+#define CR_REMOTE_COMM_FAILURE 0x00000030
+#define CR_MACHINE_UNAVAILABLE 0x00000031
+#define CR_NO_CM_SERVICES 0x00000032
+#define CR_ACCESS_DENIED 0x00000033
+#define CR_CALL_NOT_IMPLEMENTED 0x00000034
+#define CR_INVALID_PROPERTY 0x00000035
+#define CR_DEVICE_INTERFACE_ACTIVE 0x00000036
+#define CR_NO_SUCH_DEVICE_INTERFACE 0x00000037
+#define CR_INVALID_REFERENCE_STRING 0x00000038
+#define CR_INVALID_CONFLICT_LIST 0x00000039
+#define CR_INVALID_INDEX 0x0000003A
+#define CR_INVALID_STRUCTURE_SIZE 0x0000003B
+
+
+typedef DWORD RETURN_TYPE;
+typedef RETURN_TYPE CONFIGRET;
+
+typedef HANDLE HMACHINE;
+typedef HMACHINE *PHMACHINE;
+
+typedef DWORD_PTR RES_DES;
+typedef RES_DES *PRES_DES;
+
+typedef DWORD_PTR RANGE_ELEMENT;
+typedef RANGE_ELEMENT *PRANGE_ELEMENT;
+
+typedef ULONG_PTR CONFLICT_LIST;
+typedef CONFLICT_LIST *PCONFLICT_LIST;
+
+typedef DWORD_PTR LOG_CONF;
+typedef LOG_CONF *PLOG_CONF;
+
+typedef ULONG PRIORITY;
+typedef PRIORITY *PPRIORITY;
+
+typedef DWORD_PTR RANGE_LIST;
+typedef RANGE_LIST *PRANGE_LIST;
+
+typedef DWORD DEVNODE, DEVINST;
+typedef DEVNODE *PDEVNODE, *PDEVINST;
+
+typedef CHAR *DEVNODEID_A, *DEVINSTID_A;
+typedef WCHAR *DEVNODEID_W, *DEVINSTID_W;
+
+#ifdef UNICODE
+typedef DEVNODEID_W DEVNODEID;
+typedef DEVINSTID_W DEVINSTID;
+#else
+typedef DEVNODEID_A DEVNODEID;
+typedef DEVINSTID_A DEVINSTID;
+#endif
+
+typedef ULONG REGDISPOSITION;
+
+typedef ULONG RESOURCEID;
+typedef RESOURCEID *PRESOURCEID;
+
+#define CM_RESDES_WIDTH_DEFAULT 0x00000000
+#define CM_RESDES_WIDTH_32 0x00000001
+#define CM_RESDES_WIDTH_64 0x00000002
+#define CM_RESDES_WIDTH_BITS 0x00000003
+
+
+#define MAX_CONFIG_VALUE 9999
+#define MAX_INSTANCE_VALUE 9999
+
+#define MAX_DEVICE_ID_LEN 200
+#define MAX_DEVNODE_ID_LEN MAX_DEVICE_ID_LEN
+
+#define MAX_CLASS_NAME_LEN 32
+#define MAX_GUID_STRING_LEN 39
+#define MAX_PROFILE_LEN 80
+
+
+#define ResType_All 0x00000000
+#define ResType_None 0x00000000
+#define ResType_Mem 0x00000001
+#define ResType_IO 0x00000002
+#define ResType_DMA 0x00000003
+#define ResType_IRQ 0x00000004
+#define ResType_DoNotUse 0x00000005
+#define ResType_BusNumber 0x00000006
+#define ResType_MAX 0x00000006
+#define ResType_Ignored_Bit 0x00008000
+#define ResType_ClassSpecific 0x0000FFFF
+#define ResType_Reserved 0x00008000
+#define ResType_DevicePrivate 0x00008001
+#define ResType_PcCardConfig 0x00008002
+#define ResType_MfCardConfig 0x00008003
+
+#define CM_GETIDLIST_FILTER_NONE 0x00000000
+#define CM_GETIDLIST_FILTER_ENUMERATOR 0x00000001
+#define CM_GETIDLIST_FILTER_SERVICE 0x00000002
+#define CM_GETIDLIST_FILTER_EJECTRELATIONS 0x00000004
+#define CM_GETIDLIST_FILTER_REMOVALRELATIONS 0x00000008
+#define CM_GETIDLIST_FILTER_POWERRELATIONS 0x00000010
+#define CM_GETIDLIST_FILTER_BUSRELATIONS 0x00000020
+#define CM_GETIDLIST_DONOTGENERATE 0x10000040
+#define CM_GETIDLIST_FILTER_BITS 0x1000007F
+
+#define CM_GET_DEVICE_INTERFACE_LIST_PRESENT 0x00000000
+#define CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES 0x00000001
+#define CM_GET_DEVICE_INTERFACE_LIST_BITS 0x00000001
+
+
+typedef struct BusNumber_Des_s {
+ DWORD BUSD_Count;
+ DWORD BUSD_Type;
+ DWORD BUSD_Flags;
+ ULONG BUSD_Alloc_Base;
+ ULONG BUSD_Alloc_End;
+} BUSNUMBER_DES, *PBUSNUMBER_DES;
+
+typedef struct BusNumber_Range_s {
+ ULONG BUSR_Min;
+ ULONG BUSR_Max;
+ ULONG BUSR_nBusNumbers;
+ ULONG BUSR_Flags;
+} BUSNUMBER_RANGE, *PBUSNUMBER_RANGE;
+
+#define BusNumberType_Range sizeof(BUSNUMBER_RANGE)
+
+typedef struct BusNumber_Resource_s {
+ BUSNUMBER_DES BusNumber_Header;
+ BUSNUMBER_RANGE BusNumber_Data[ANYSIZE_ARRAY];
+} BUSNUMBER_RESOURCE, *PBUSNUMBER_RESOURCE;
+
+typedef struct CS_Des_s {
+ DWORD CSD_SignatureLength;
+ DWORD CSD_LegacyDataOffset;
+ DWORD CSD_LegacyDataSize;
+ DWORD CSD_Flags;
+ GUID CSD_ClassGuid;
+ BYTE CSD_Signature[ANYSIZE_ARRAY];
+} CS_DES, *PCS_DES;
+
+typedef struct CS_Resource_s {
+ CS_DES CS_Header;
+} CS_RESOURCE, *PCS_RESOURCE;
+
+typedef struct DevPrivate_Des_s {
+ DWORD PD_Count;
+ DWORD PD_Type;
+ DWORD PD_Data1;
+ DWORD PD_Data2;
+ DWORD PD_Data3;
+ DWORD PD_Flags;
+} DEVPRIVATE_DES, *PDEVPRIVATE_DES;
+
+typedef struct DevPrivate_Range_s {
+ DWORD PR_Data1;
+ DWORD PR_Data2;
+ DWORD PR_Data3;
+} DEVPRIVATE_RANGE, *PDEVPRIVATE_RANGE;
+
+#define PType_Range sizeof(DEVPRIVATE_RANGE)
+
+typedef struct DevPrivate_Resource_s {
+ DEVPRIVATE_DES PRV_Header;
+ DEVPRIVATE_RANGE PRV_Data[ANYSIZE_ARRAY];
+} DEVPRIVATE_RESOURCE, *PDEVPRIVATE_RESOURCE;
+
+/* DMA_DES.DD_Flags constants and masks */
+#define mDD_Width 0x3
+#define fDD_BYTE 0x0
+#define fDD_WORD 0x1
+#define fDD_DWORD 0x2
+#define fDD_BYTE_AND_WORD 0x3
+
+#define mDD_BusMaster 0x4
+#define fDD_NoBusMaster 0x0
+#define fDD_BusMaster 0x4
+
+#define mDD_Type 0x18
+#define fDD_TypeStandard 0x00
+#define fDD_TypeA 0x08
+#define fDD_TypeB 0x10
+#define fDD_TypeF 0x18
+
+typedef struct DMA_Des_s {
+ DWORD DD_Count;
+ DWORD DD_Type;
+ DWORD DD_Flags;
+ ULONG DD_Alloc_Chan;
+} DMA_DES, *PDMA_DES;
+
+typedef struct DMA_Range_s {
+ ULONG DR_Min;
+ ULONG DR_Max;
+ ULONG DR_Flags;
+} DMA_RANGE, *PDMA_RANGE;
+
+#define DType_Range sizeof(DMA_RANGE)
+
+typedef struct DMA_Resource_s {
+ DMA_DES DMA_Header;
+ DMA_RANGE DMA_Data[ANYSIZE_ARRAY];
+} DMA_RESOURCE, *PDMA_RESOURCE;
+
+/* IO_DES.Type constants and masks */
+#define fIOD_PortType 0x1
+#define fIOD_Memory 0x0
+#define fIOD_IO 0x1
+#define fIOD_DECODE 0x00fc
+#define fIOD_10_BIT_DECODE 0x0004
+#define fIOD_12_BIT_DECODE 0x0008
+#define fIOD_16_BIT_DECODE 0x0010
+#define fIOD_POSITIVE_DECODE 0x0020
+#define fIOD_PASSIVE_DECODE 0x0040
+#define fIOD_WINDOW_DECODE 0x0080
+
+typedef struct IO_Des_s {
+ DWORD IOD_Count;
+ DWORD IOD_Type;
+ DWORDLONG IOD_Alloc_Base;
+ DWORDLONG IOD_Alloc_End;
+ DWORD IOD_DesFlags;
+} IO_DES, *PIO_DES;
+
+/* IO_RANGE.IOR_Alias constants */
+#define IO_ALIAS_10_BIT_DECODE 0x00000004
+#define IO_ALIAS_12_BIT_DECODE 0x00000010
+#define IO_ALIAS_16_BIT_DECODE 0x00000000
+#define IO_ALIAS_POSITIVE_DECODE 0x000000FF
+
+typedef struct IO_Range_s {
+ DWORDLONG IOR_Align;
+ DWORD IOR_nPorts;
+ DWORDLONG IOR_Min;
+ DWORDLONG IOR_Max;
+ DWORD IOR_RangeFlags;
+ DWORDLONG IOR_Alias;
+} IO_RANGE, *PIO_RANGE;
+
+#define IOType_Range sizeof(IO_RANGE)
+
+typedef struct IO_Resource_s {
+ IO_DES IO_Header;
+ IO_RANGE IO_Data[ANYSIZE_ARRAY];
+} IO_RESOURCE, *PIO_RESOURCE;
+
+/* IRQ_DES.IRQD_flags constants */
+#define mIRQD_Share 0x1
+#define fIRQD_Exclusive 0x0
+#define fIRQD_Share 0x1
+
+#define fIRQD_Share_Bit 0
+#define fIRQD_Level_Bit 1
+
+#define mIRQD_Edge_Level 0x2
+#define fIRQD_Level 0x0
+#define fIRQD_Edge 0x2
+
+typedef struct IRQ_Des_32_s {
+ DWORD IRQD_Count;
+ DWORD IRQD_Type;
+ DWORD IRQD_Flags;
+ ULONG IRQD_Alloc_Num;
+ ULONG32 IRQD_Affinity;
+} IRQ_DES_32, *PIRQ_DES_32;
+
+typedef struct IRQ_Des_64_s {
+ DWORD IRQD_Count;
+ DWORD IRQD_Type;
+ DWORD IRQD_Flags;
+ ULONG IRQD_Alloc_Num;
+ ULONG64 IRQD_Affinity;
+} IRQ_DES_64, *PIRQ_DES_64;
+
+#ifdef _WIN64
+typedef IRQ_DES_64 IRQ_DES;
+typedef PIRQ_DES_64 PIRQ_DES;
+#else
+typedef IRQ_DES_32 IRQ_DES;
+typedef PIRQ_DES_32 PIRQ_DES;
+#endif
+
+typedef struct IRQ_Range_s {
+ ULONG IRQR_Min;
+ ULONG IRQR_Max;
+ ULONG IRQR_Flags;
+} IRQ_RANGE, *PIRQ_RANGE;
+
+#define IRQType_Range sizeof(IRQ_RANGE)
+
+typedef struct IRQ_Resource_s {
+ IRQ_DES IRQ_Header;
+ IRQ_RANGE IRQ_Data[ANYSIZE_ARRAY];
+} IRQ_RESOURCE, *PIRQ_RESOURCE;
+
+/* MEM_DES.MD_Flags constants */
+#define mMD_MemoryType 0x1
+#define fMD_MemoryType mMD_MemoryType
+#define fMD_ROM 0x0
+#define fMD_RAM 0x1
+
+#define mMD_32_24 0x2
+#define fMD_32_24 mMD_32_24
+#define fMD_24 0x0
+#define fMD_32 0x2
+
+#define mMD_Prefetchable 0x4
+#define fMD_Prefetchable mMD_Prefetchable
+#define fMD_Pref mMD_Prefetchable
+#define fMD_PrefetchDisallowed 0x0
+#define fMD_PrefetchAllowed 0x4
+
+#define mMD_Readable 0x8
+#define fMD_Readable mMD_Readable
+#define fMD_ReadAllowed 0x0
+#define fMD_ReadDisallowed 0x8
+
+#define mMD_CombinedWrite 0x10
+#define fMD_CombinedWrite mMD_CombinedWrite
+#define fMD_CombinedWriteDisallowed 0x0
+#define fMD_CombinedWriteAllowed 0x10
+
+#define mMD_Cacheable 0x20
+#define fMD_NonCacheable 0x0
+#define fMD_Cacheable 0x20
+
+typedef struct Mem_Des_s {
+ DWORD MD_Count;
+ DWORD MD_Type;
+ DWORDLONG MD_Alloc_Base;
+ DWORDLONG MD_Alloc_End;
+ DWORD MD_Flags;
+ DWORD MD_Reserved;
+} MEM_DES, *PMEM_DES;
+
+typedef struct Mem_Range_s {
+ DWORDLONG MR_Align;
+ ULONG MR_nBytes;
+ DWORDLONG MR_Min;
+ DWORDLONG MR_Max;
+ DWORD MR_Flags;
+ DWORD MR_Reserved;
+} MEM_RANGE, *PMEM_RANGE;
+
+#define MType_Range sizeof(MEM_RANGE)
+
+typedef struct Mem_Resource_s {
+ MEM_DES MEM_Header;
+ MEM_RANGE MEM_Data[ANYSIZE_ARRAY];
+} MEM_RESOURCE, *PMEM_RESOURCE;
+
+/* MFCARD_DES.PMF_Flags constants */
+#define fPMF_AUDIO_ENABLE 0x8
+#define mPMF_AUDIO_ENABLE fPMF_AUDIO_ENABLE
+
+typedef struct MfCard_Des_s {
+ DWORD PMF_Count;
+ DWORD PMF_Type;
+ DWORD PMF_Flags;
+ BYTE PMF_ConfigOptions;
+ BYTE PMF_IoResourceIndex;
+ BYTE PMF_Reserved[2];
+ DWORD PMF_ConfigRegisterBase;
+} MFCARD_DES, *PMFCARD_DES;
+
+typedef struct MfCard_Resource_s {
+ MFCARD_DES MfCard_Header;
+} MFCARD_RESOURCE, *PMFCARD_RESOURCE;
+
+/* PCCARD_DES.PCD_Flags constants */
+
+typedef struct PcCard_Des_s {
+ DWORD PCD_Count;
+ DWORD PCD_Type;
+ DWORD PCD_Flags;
+ BYTE PCD_ConfigIndex;
+ BYTE PCD_Reserved[3];
+ DWORD PCD_MemoryCardBase1;
+ DWORD PCD_MemoryCardBase2;
+} PCCARD_DES, *PPCCARD_DES;
+
+#define mPCD_IO_8_16 0x1
+#define fPCD_IO_8 0x0
+#define fPCD_IO_16 0x1
+#define mPCD_MEM_8_16 0x2
+#define fPCD_MEM_8 0x0
+#define fPCD_MEM_16 0x2
+#define mPCD_MEM_A_C 0xC
+#define fPCD_MEM1_A 0x4
+#define fPCD_MEM2_A 0x8
+#define fPCD_IO_ZW_8 0x10
+#define fPCD_IO_SRC_16 0x20
+#define fPCD_IO_WS_16 0x40
+#define mPCD_MEM_WS 0x300
+#define fPCD_MEM_WS_ONE 0x100
+#define fPCD_MEM_WS_TWO 0x200
+#define fPCD_MEM_WS_THREE 0x300
+
+#define fPCD_MEM_A 0x4
+
+#define fPCD_ATTRIBUTES_PER_WINDOW 0x8000
+
+#define fPCD_IO1_16 0x00010000
+#define fPCD_IO1_ZW_8 0x00020000
+#define fPCD_IO1_SRC_16 0x00040000
+#define fPCD_IO1_WS_16 0x00080000
+
+#define fPCD_IO2_16 0x00100000
+#define fPCD_IO2_ZW_8 0x00200000
+#define fPCD_IO2_SRC_16 0x00400000
+#define fPCD_IO2_WS_16 0x00800000
+
+#define mPCD_MEM1_WS 0x03000000
+#define fPCD_MEM1_WS_ONE 0x01000000
+#define fPCD_MEM1_WS_TWO 0x02000000
+#define fPCD_MEM1_WS_THREE 0x03000000
+#define fPCD_MEM1_16 0x04000000
+
+#define mPCD_MEM2_WS 0x30000000
+#define fPCD_MEM2_WS_ONE 0x10000000
+#define fPCD_MEM2_WS_TWO 0x20000000
+#define fPCD_MEM2_WS_THREE 0x30000000
+#define fPCD_MEM2_16 0x40000000
+
+#define PCD_MAX_MEMORY 2
+#define PCD_MAX_IO 2
+
+typedef struct PcCard_Resource_s {
+ PCCARD_DES PcCard_Header;
+} PCCARD_RESOURCE, *PPCCARD_RESOURCE;
+
+
+/* CONFLICT_DETAILS.CD.ulMask constants */
+#define CM_CDMASK_DEVINST 0x00000001
+#define CM_CDMASK_RESDES 0x00000002
+#define CM_CDMASK_FLAGS 0x00000004
+#define CM_CDMASK_DESCRIPTION 0x00000008
+#define CM_CDMASK_VALID 0x0000000F
+
+/* CONFLICT_DETAILS.CD.ulFlags constants */
+#define CM_CDFLAGS_DRIVER 0x00000001
+#define CM_CDFLAGS_ROOT_OWNED 0x00000002
+#define CM_CDFLAGS_RESERVED 0x00000004
+
+typedef struct _CONFLICT_DETAILS_A {
+ ULONG CD_ulSize;
+ ULONG CD_ulMask;
+ DEVINST CD_dnDevInst;
+ RES_DES CD_rdResDes;
+ ULONG CD_ulFlags;
+ CHAR CD_szDescription[MAX_PATH];
+} CONFLICT_DETAILS_A , *PCONFLICT_DETAILS_A;
+
+typedef struct _CONFLICT_DETAILS_W {
+ ULONG CD_ulSize;
+ ULONG CD_ulMask;
+ DEVINST CD_dnDevInst;
+ RES_DES CD_rdResDes;
+ ULONG CD_ulFlags;
+ WCHAR CD_szDescription[MAX_PATH];
+} CONFLICT_DETAILS_W , *PCONFLICT_DETAILS_W;
+
+#ifdef UNICODE
+typedef CONFLICT_DETAILS_W CONFLICT_DETAILS;
+typedef PCONFLICT_DETAILS_W PCONFLICT_DETAILS;
+#else
+typedef CONFLICT_DETAILS_A CONFLICT_DETAILS;
+typedef PCONFLICT_DETAILS_A PCONFLICT_DETAILS;
+#endif
+
+
+
+/* CM_Add_Empty_Log_Conf.ulFlags constants */
+#define PRIORITY_EQUAL_FIRST 0x00000008
+#define PRIORITY_EQUAL_LAST 0x00000000
+#define PRIORITY_BIT 0x00000008
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_Empty_Log_Conf(
+ OUT PLOG_CONF plcLogConf,
+ IN DEVINST dnDevInst,
+ IN PRIORITY Priority,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_Empty_Log_Conf_Ex(
+ OUT PLOG_CONF plcLogConf,
+ IN DEVINST dnDevInst,
+ IN PRIORITY Priority,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+/* CM_Add_ID.ulFlags constants */
+#define CM_ADD_ID_HARDWARE 0x00000000
+#define CM_ADD_ID_COMPATIBLE 0x00000001
+#define CM_ADD_ID_BITS 0x00000001
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_IDA(
+ IN DEVINST dnDevInst,
+ IN PSTR pszID,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_ID_ExA(
+ IN DEVINST dnDevInst,
+ IN PSTR pszID,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_ID_ExW(
+ IN DEVINST dnDevInst,
+ IN PWSTR pszID,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_IDW(
+ IN DEVINST dnDevInst,
+ IN PWSTR pszID,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+#ifdef UNICODE
+#define CM_Add_ID CM_Add_IDW
+#define CM_Add_ID_Ex CM_Add_ID_ExW
+#else
+#define CM_Add_ID CM_Add_IDA
+#define CM_Add_ID_Ex CM_Add_ID_ExA
+#endif /* UNICODE */
+
+/* FIXME: Obsolete CM_Add_Range */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_Res_Des(
+ OUT PRES_DES prdResDes,
+ IN LOG_CONF lcLogConf,
+ IN RESOURCEID ResourceID,
+ IN PCVOID ResourceData,
+ IN ULONG ResourceLen,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Add_Res_Des_Ex(
+ OUT PRES_DES prdResDes,
+ IN LOG_CONF lcLogConf,
+ IN RESOURCEID ResourceID,
+ IN PCVOID ResourceData,
+ IN ULONG ResourceLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Connect_MachineA(
+ IN PCSTR UNCServerName,
+ OUT PHMACHINE phMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Connect_MachineW(
+ IN PCWSTR UNCServerName,
+ OUT PHMACHINE phMachine);
+
+#ifdef UNICODE
+#define CM_Connect_Machine CM_Connect_MachineW
+#else
+#define CM_Connect_Machine CM_Connect_MachineA
+#endif /* UNICODE */
+
+/* FIXME: Obsolete CM_Create_DevNode */
+/* FIXME: Obsolete CM_Create_DevNodeEx */
+/* FIXME: Obsolete CM_Create_Range_List */
+/* FIXME: Obsolete CM_Delete_Class_Key */
+/* FIXME: Obsolete CM_Delete_Class_Key_Ex */
+/* FIXME: Obsolete CM_Delete_DevNode_Key */
+/* FIXME: Obsolete CM_Delete_DevNode_Key_Ex */
+/* FIXME: Obsolete CM_Delete_Range */
+/* FIXME: Obsolete CM_Detected_Resource_Conflict */
+/* FIXME: Obsolete CM_Detected_Resource_Conflict_Ex */
+/* FIXME: Obsolete CM_Disable_DevNode */
+/* FIXME: Obsolete CM_Disable_DevNodeEx */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Disconnect_Machine(
+ IN HMACHINE hMachine);
+
+/* FIXME: Obsolete CM_Enable_DevNode */
+/* FIXME: Obsolete CM_Enable_DevNodeEx */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Enumerate_Classes(
+ IN ULONG ulClassIndex,
+ OUT LPGUID ClassGuid,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Enumerate_Classes_Ex(
+ IN ULONG ulClassIndex,
+ OUT LPGUID ClassGuid,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Enumerate_EnumeratorsA(
+ IN ULONG ulEnumIndex,
+ OUT PCHAR Buffer,
+ IN OUT PULONG pulLength,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Enumerate_Enumerators_ExA(
+ IN ULONG ulEnumIndex,
+ OUT PCHAR Buffer,
+ IN OUT PULONG pulLength,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Enumerate_Enumerators_ExW(
+ IN ULONG ulEnumIndex,
+ OUT PWCHAR Buffer,
+ IN OUT PULONG pulLength,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Enumerate_EnumeratorsW(
+ IN ULONG ulEnumIndex,
+ OUT PWCHAR Buffer,
+ IN OUT PULONG pulLength,
+ IN ULONG ulFlags);
+
+#ifdef UNICODE
+#define CM_Enumerate_Enumerators CM_Enumerate_EnumeratorsW
+#define CM_Enumerate_Enumerators_Ex CM_Enumerate_Enumerators_ExW
+#else
+#define CM_Enumerate_Enumerators CM_Enumerate_EnumeratorsA
+#define CM_Enumerate_Enumerators_Ex CM_Enumerate_Enumerators_ExW
+#endif /* UNICODE */
+
+/* FIXME: Obsolete CM_Find_Range */
+/* FIXME: Obsolete CM_First_Range */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Free_Log_Conf(
+ IN LOG_CONF lcLogConfToBeFreed,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Free_Log_Conf_Ex(
+ IN LOG_CONF lcLogConfToBeFreed,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Free_Log_Conf_Handle(
+ IN LOG_CONF lcLogConf);
+
+/* FIXME: Obsolete CM_Free_Range_List */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Free_Res_Des(
+ OUT PRES_DES prdResDes,
+ IN RES_DES rdResDes,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Free_Res_Des_Ex(
+ OUT PRES_DES prdResDes,
+ IN RES_DES rdResDes,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Free_Res_Des_Handle(
+ IN RES_DES rdResDes);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Free_Resource_Conflict_Handle(
+ IN CONFLICT_LIST clConflictList);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Child(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Child_Ex(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+/* FIXME: Obsolete CM_Get_Class_Name */
+/* FIXME: Obsolete CM_Get_Class_Name_Ex */
+/* FIXME: Obsolete CM_Get_Class_Key_Name */
+/* FIXME: Obsolete CM_Get_Class_Key_Name_Ex */
+/* FIXME: Obsolete CM_Get_Class_Registry_Property */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Depth(
+ OUT PULONG pulDepth,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Depth_Ex(
+ OUT PULONG pulDepth,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_IDA(
+ IN DEVINST dnDevInst,
+ OUT PCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_ExA(
+ IN DEVINST dnDevInst,
+ OUT PCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_ExW(
+ IN DEVINST dnDevInst,
+ OUT PWCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_IDW(
+ IN DEVINST dnDevInst,
+ OUT PWCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags);
+
+#ifdef UNICODE
+#define CM_Get_Device_ID CM_Get_Device_IDW
+#define CM_Get_Device_ID_Ex CM_Get_Device_ID_ExW
+#else
+#define CM_Get_Device_ID CM_Get_Device_IDA
+#define CM_Get_Device_ID_Ex CM_Get_Device_ID_ExW
+#endif /* UNICODE */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_ListA(
+ IN PCSTR pszFilter, OPTIONAL
+ OUT PCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_List_ExA(
+ IN PCSTR pszFilter, OPTIONAL
+ OUT PCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_List_ExW(
+ IN PCWSTR pszFilter, OPTIONAL
+ OUT PWCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_ListW(
+ IN PCWSTR pszFilter, OPTIONAL
+ OUT PWCHAR Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags);
+
+#ifdef UNICODE
+#define CM_Get_Device_ID_List CM_Get_Device_ID_ListW
+#define CM_Get_Device_ID_List_Ex CM_Get_Device_ID_List_ExW
+#else
+#define CM_Get_Device_ID_List CM_Get_Device_ID_ListA
+#define CM_Get_Device_ID_List_Ex CM_Get_Device_ID_List_ExA
+#endif /* UNICODE */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_List_SizeA(
+ OUT PULONG pulLen,
+ IN PCSTR pszFilter, OPTIONAL
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_List_Size_ExA(
+ OUT PULONG pulLen,
+ IN PCSTR pszFilter, OPTIONAL
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_List_Size_ExW(
+ OUT PULONG pulLen,
+ IN PCWSTR pszFilter, OPTIONAL
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_List_SizeW(
+ OUT PULONG pulLen,
+ IN PCWSTR pszFilter, OPTIONAL
+ IN ULONG ulFlags);
+
+#ifdef UNICODE
+#define CM_Get_Device_ID_List_Size CM_Get_Device_ID_List_SizeW
+#define CM_Get_Device_ID_List_Size_Ex CM_Get_Device_ID_List_Size_ExW
+#else
+#define CM_Get_Device_ID_List_Size CM_Get_Device_ID_List_SizeA
+#define CM_Get_Device_ID_List_Size_Ex CM_Get_Device_ID_List_Size_ExA
+#endif /* UNICODE */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_Size(
+ OUT PULONG pulLen,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Device_ID_Size_Ex(
+ OUT PULONG pulLen,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+/* FIXME: Obsolete CM_Get_Device_Interface_Alias */
+/* FIXME: Obsolete CM_Get_Device_Interface_Alias_Ex */
+/* FIXME: Obsolete CM_Get_Device_Interface_List */
+/* FIXME: Obsolete CM_Get_Device_Interface_List_Ex */
+/* FIXME: Obsolete CM_Get_Device_Interface_List_Size */
+/* FIXME: Obsolete CM_Get_Device_Interface_List_Size_Ex */
+/* FIXME: Obsolete CM_Get_DevNode_Custom_Property */
+/* FIXME: Obsolete CM_Get_DevNode_Custom_Property_Ex */
+/* FIXME: Obsolete CM_Get_DevNode_Registry_Property */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_DevNode_Status(
+ OUT PULONG pulStatus,
+ OUT PULONG pulProblemNumber,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_DevNode_Status_Ex(
+ OUT PULONG pulStatus,
+ OUT PULONG pulProblemNumber,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+#define CM_Get_DevInst_Status CM_Get_DevNode_Status
+#define CM_Get_DevInst_Status_Ex CM_Get_DevNode_Status_Ex
+
+/* CM_Get_First_Log_Conf.ulFlags constants */
+#define BASIC_LOG_CONF 0x00000000 // Specifies the req list.
+#define FILTERED_LOG_CONF 0x00000001 // Specifies the filtered req list.
+#define ALLOC_LOG_CONF 0x00000002 // Specifies the Alloc Element.
+#define BOOT_LOG_CONF 0x00000003 // Specifies the RM Alloc Element.
+#define FORCED_LOG_CONF 0x00000004 // Specifies the Forced Log Conf
+#define OVERRIDE_LOG_CONF 0x00000005 // Specifies the Override req list.
+#define NUM_LOG_CONF 0x00000006 // Number of Log Conf type
+#define LOG_CONF_BITS 0x00000007 // The bits of the log conf type.
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_First_Log_Conf(
+ OUT PLOG_CONF plcLogConf, OPTIONAL
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_First_Log_Conf_Ex(
+ OUT PLOG_CONF plcLogConf, OPTIONAL
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+/* FIXME: Obsolete CM_Get_Global_State */
+/* FIXME: Obsolete CM_Get_Global_State_Ex */
+/* FIXME: Obsolete CM_Get_Hardware_Profile_Info */
+/* FIXME: Obsolete CM_Get_Hardware_Profile_Info_Ex */
+/* FIXME: Obsolete CM_Get_HW_Prof_Flags */
+/* FIXME: Obsolete CM_Get_HW_Prof_Flags_Ex */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Log_Conf_Priority(
+ IN LOG_CONF lcLogConf,
+ OUT PPRIORITY pPriority,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Log_Conf_Priority_Ex(
+ IN LOG_CONF lcLogConf,
+ OUT PPRIORITY pPriority,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Next_Log_Conf(
+ OUT PLOG_CONF plcLogConf, OPTIONAL
+ IN LOG_CONF lcLogConf,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Next_Log_Conf_Ex(
+ OUT PLOG_CONF plcLogConf, OPTIONAL
+ IN LOG_CONF lcLogConf,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Next_Res_Des(
+ OUT PRES_DES prdResDes,
+ IN RES_DES rdResDes,
+ IN RESOURCEID ForResource,
+ OUT PRESOURCEID pResourceID,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Next_Res_Des_Ex(
+ OUT PRES_DES prdResDes,
+ IN RES_DES rdResDes,
+ IN RESOURCEID ForResource,
+ OUT PRESOURCEID pResourceID,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Parent(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Parent_Ex(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Res_Des_Data(
+ IN RES_DES rdResDes,
+ OUT PVOID Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Res_Des_Data_Ex(
+ IN RES_DES rdResDes,
+ OUT PVOID Buffer,
+ IN ULONG BufferLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Res_Des_Data_Size(
+ OUT PULONG pulSize,
+ IN RES_DES rdResDes,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Res_Des_Data_Size_Ex(
+ OUT PULONG pulSize,
+ IN RES_DES rdResDes,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Resource_Conflict_Count(
+ IN CONFLICT_LIST clConflictList,
+ OUT PULONG pulCount);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Resource_Conflict_DetailsA(
+ IN CONFLICT_LIST clConflictList,
+ IN ULONG ulIndex,
+ IN OUT PCONFLICT_DETAILS_A pConflictDetails);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Resource_Conflict_DetailsW(
+ IN CONFLICT_LIST clConflictList,
+ IN ULONG ulIndex,
+ IN OUT PCONFLICT_DETAILS_W pConflictDetails);
+
+#ifdef UNICODE
+#define CM_Get_Resource_Conflict_Details CM_Get_Resource_Conflict_DetailsW
+#else
+#define CM_Get_Resource_Conflict_Details CM_Get_Resource_Conflict_DetailsA
+#endif /* UNICODE */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Sibling(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINST DevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Get_Sibling_Ex(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINST DevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+WORD
+WINAPI
+CM_Get_Version(
+ VOID);
+
+CMAPI
+WORD
+WINAPI
+CM_Get_Version_Ex(
+ IN HMACHINE hMachine);
+
+/* FIXME: Obsolete CM_Intersect_Range_List */
+/* FIXME: Obsolete CM_Invert_Range_List */
+/* FIXME: Obsolete CM_Is_Dock_Station_Present */
+/* FIXME: Obsolete CM_Is_Dock_Station_Present_Ex */
+
+/* CM_Locate_DevNode.ulFlags constants */
+#define CM_LOCATE_DEVNODE_NORMAL 0x00000000
+#define CM_LOCATE_DEVNODE_PHANTOM 0x00000001
+#define CM_LOCATE_DEVNODE_CANCELREMOVE 0x00000002
+#define CM_LOCATE_DEVNODE_NOVALIDATION 0x00000004
+#define CM_LOCATE_DEVNODE_BITS 0x00000007
+
+#define CM_LOCATE_DEVINST_NORMAL CM_LOCATE_DEVNODE_NORMAL
+#define CM_LOCATE_DEVINST_PHANTOM CM_LOCATE_DEVNODE_PHANTOM
+#define CM_LOCATE_DEVINST_CANCELREMOVE CM_LOCATE_DEVNODE_CANCELREMOVE
+#define CM_LOCATE_DEVINST_NOVALIDATION CM_LOCATE_DEVNODE_NOVALIDATION
+#define CM_LOCATE_DEVINST_BITS CM_LOCATE_DEVNODE_BITS
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Locate_DevNodeA(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINSTID_A pDeviceID, OPTIONAL
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Locate_DevNode_ExA(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINSTID_A pDeviceID, OPTIONAL
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Locate_DevNode_ExW(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINSTID_W pDeviceID, OPTIONAL
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Locate_DevNodeW(
+ OUT PDEVINST pdnDevInst,
+ IN DEVINSTID_W pDeviceID, OPTIONAL
+ IN ULONG ulFlags);
+
+#define CM_Locate_DevInstA CM_Locate_DevNodeA
+#define CM_Locate_DevInstW CM_Locate_DevNodeW
+#define CM_Locate_DevInst_ExA CM_Locate_DevNode_ExA
+#define CM_Locate_DevInst_ExW CM_Locate_DevNode_ExW
+
+#ifdef UNICODE
+#define CM_Locate_DevNode CM_Locate_DevNodeW
+#define CM_Locate_DevInst CM_Locate_DevNodeW
+#define CM_Locate_DevNode_Ex CM_Locate_DevNode_ExW
+#define CM_Locate_DevInst_Ex CM_Locate_DevNode_ExW
+#else
+#define CM_Locate_DevNode CM_Locate_DevNodeA
+#define CM_Locate_DevInst CM_Locate_DevNodeA
+#define CM_Locate_DevNode_Ex CM_Locate_DevNode_ExA
+#define CM_Locate_DevInst_Ex CM_Locate_DevNode_ExA
+#endif /* UNICODE */
+
+/* FIXME: Obsolete CM_Merge_Range_List */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Modify_Res_Des(
+ OUT PRES_DES prdResDes,
+ IN RES_DES rdResDes,
+ IN RESOURCEID ResourceID,
+ IN PCVOID ResourceData,
+ IN ULONG ResourceLen,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Modify_Res_Des_Ex(
+ OUT PRES_DES prdResDes,
+ IN RES_DES rdResDes,
+ IN RESOURCEID ResourceID,
+ IN PCVOID ResourceData,
+ IN ULONG ResourceLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+/* FIXME: Obsolete CM_Move_DevNode */
+/* FIXME: Obsolete CM_Move_DevNode_Ex */
+/* FIXME: Obsolete CM_Next_Range */
+/* FIXME: Obsolete CM_Open_Class_Key */
+/* FIXME: Obsolete CM_Open_Class_Key_Ex */
+/* FIXME: Obsolete CM_Open_DevNode_Key */
+/* FIXME: Obsolete CM_Open_DevNode_Key_Ex */
+
+/* CM_Query_And_Remove_SubTree.ulFlags constants */
+#define CM_REMOVE_UI_OK 0x00000000
+#define CM_REMOVE_UI_NOT_OK 0x00000001
+#define CM_REMOVE_NO_RESTART 0x00000002
+#define CM_REMOVE_BITS 0x00000003
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Query_And_Remove_SubTreeA(
+ IN DEVINST dnAncestor,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Query_And_Remove_SubTreeW(
+ IN DEVINST dnAncestor,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPWSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Query_And_Remove_SubTree_ExA(
+ IN DEVINST dnAncestor,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Query_And_Remove_SubTree_ExW(
+ IN DEVINST dnAncestor,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPWSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+/* FIXME: Obsolete CM_Query_Arbitrator_Free_Data */
+/* FIXME: Obsolete CM_Query_Arbitrator_Free_Data_Ex */
+/* FIXME: Obsolete CM_Query_Arbitrator_Free_Size */
+/* FIXME: Obsolete CM_Query_Arbitrator_Free_Size_Ex */
+/* FIXME: Obsolete CM_Query_Arbitrator_Free_Size_Ex */
+/* FIXME: Obsolete CM_Query_Remove_SubTree */
+/* FIXME: Obsolete CM_Query_Remove_SubTree_Ex */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Query_Resource_Conflict_List(
+ OUT PCONFLICT_LIST pclConflictList,
+ IN DEVINST dnDevInst,
+ IN RESOURCEID ResourceID,
+ IN PCVOID ResourceData,
+ IN ULONG ResourceLen,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+/* CM_Reenumerate_DevNode.ulFlags constants */
+#define CM_REENUMERATE_NORMAL 0x00000000
+#define CM_REENUMERATE_SYNCHRONOUS 0x00000001
+#define CM_REENUMERATE_RETRY_INSTALLATION 0x00000002
+#define CM_REENUMERATE_ASYNCHRONOUS 0x00000004
+#define CM_REENUMERATE_BITS 0x00000007
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Reenumerate_DevNode(
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Reenumerate_DevNode_Ex(
+ IN DEVINST dnDevInst,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+#define CM_Reenumerate_DevInst CM_Reenumerate_DevNode
+#define CM_Reenumerate_DevInst_Ex CM_Reenumerate_DevNode_Ex
+
+/* FIXME: Obsolete CM_Register_Device_Driver */
+/* FIXME: Obsolete CM_Register_Device_Driver_Ex */
+/* FIXME: Obsolete CM_Register_Device_Interface */
+/* FIXME: Obsolete CM_Register_Device_Interface_Ex */
+/* FIXME: Obsolete CM_Remove_SubTree */
+/* FIXME: Obsolete CM_Remove_SubTree_Ex */
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Request_Device_EjectA(
+ IN DEVINST dnDevInst,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Request_Device_Eject_ExW(
+ IN DEVINST dnDevInst,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPWSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Request_Device_Eject_ExA(
+ IN DEVINST dnDevInst,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags,
+ IN HMACHINE hMachine);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Request_Device_EjectW(
+ IN DEVINST dnDevInst,
+ OUT PPNP_VETO_TYPE pVetoType,
+ OUT LPWSTR pszVetoName,
+ IN ULONG ulNameLength,
+ IN ULONG ulFlags);
+
+#ifdef UNICODE
+#define CM_Request_Device_Eject CM_Request_Device_EjectW
+#define CM_Request_Device_Eject_Ex CM_Request_Device_Eject_ExW
+#else
+#define CM_Request_Device_Eject CM_Request_Device_EjectA
+#define CM_Request_Device_Eject_Ex CM_Request_Device_Eject_ExA
+#endif /* UNICODE */
+
+/* FIXME: Obsolete CM_Request_Eject_PC */
+/* FIXME: Obsolete CM_Request_Eject_PC_Ex */
+/* FIXME: Obsolete CM_Run_Detection */
+/* FIXME: Obsolete CM_Run_Detection_Ex */
+/* FIXME: Obsolete CM_Set_Class_Registry_Property */
+/* FIXME: Obsolete CM_Set_DevNode_Problem */
+/* FIXME: Obsolete CM_Set_DevNode_Problem_Ex */
+/* FIXME: Obsolete CM_Set_DevNode_Registry_Property */
+/* FIXME: Obsolete CM_Set_DevNode_Registry_Property_Ex */
+/* FIXME: Obsolete CM_Set_HW_Prof */
+/* FIXME: Obsolete CM_Set_HW_Prof_Ex */
+/* FIXME: Obsolete CM_Set_HW_Prof_Flags */
+/* FIXME: Obsolete CM_Set_HW_Prof_Flags_Ex */
+/* FIXME: Obsolete CM_Setup_DevNode */
+/* FIXME: Obsolete CM_Setup_DevNode_Ex */
+/* FIXME: Obsolete CM_Test_Range_Available */
+/* FIXME: Obsolete CM_Uninstall_DevNode */
+/* FIXME: Obsolete CM_Uninstall_DevNode_Ex */
+/* FIXME: Obsolete CM_Unregister_Device_Interface */
+/* FIXME: Obsolete CM_Unregister_Device_Interface_Ex */
+
+#define CM_WaitNoPendingInstallEvents CMP_WaitNoPendingInstallEvents
+
+CMAPI
+DWORD
+WINAPI
+CMP_WaitNoPendingInstallEvents(
+ IN DWORD dwTimeout);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CFGMGR32_H */
--- /dev/null
+/*
+ * d4drvif.h
+ *
+ * DOT4 driver IOCTL interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __D4DRVIF_H
+#define __D4DRVIF_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "d4iface.h"
+
+#define FILE_DEVICE_DOT4 0x3a
+#define IOCTL_DOT4_USER_BASE 2049
+
+#define IOCTL_DOT4_ADD_ACTIVITY_BROADCAST \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_CLOSE_CHANNEL \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_CREATE_SOCKET \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 7, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_DESTROY_SOCKET \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 9, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_OPEN_CHANNEL \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_READ \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 2, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_REMOVE_ACTIVITY_BROADCAST \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_WAIT_ACTIVITY_BROADCAST \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 6, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_WAIT_FOR_CHANNEL \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 8, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_DOT4_WRITE \
+ CTL_CODE(FILE_DEVICE_DOT4, IOCTL_DOT4_USER_BASE + 3, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
+
+
+#define MAX_SERVICE_LENGTH 40
+
+typedef struct _DOT4_DC_CREATE_DATA {
+ unsigned char bPsid;
+ CHAR pServiceName[MAX_SERVICE_LENGTH + 1];
+ unsigned char bType;
+ ULONG ulBufferSize;
+ USHORT usMaxHtoPPacketSize;
+ USHORT usMaxPtoHPacketSize;
+ unsigned char bHsid;
+} DOT4_DC_CREATE_DATA, *PDOT4_DC_CREATE_DATA;
+
+typedef struct _DOT4_DC_DESTROY_DATA {
+ unsigned char bHsid;
+} DOT4_DC_DESTROY_DATA, *PDOT4_DC_DESTROY_DATA;
+
+typedef struct _DOT4_DC_OPEN_DATA {
+ unsigned char bHsid;
+ unsigned char fAddActivity;
+ CHANNEL_HANDLE hChannelHandle;
+} DOT4_DC_OPEN_DATA, *PDOT4_DC_OPEN_DATA;
+
+typedef struct _DOT4_DRIVER_CMD {
+ CHANNEL_HANDLE hChannelHandle;
+ ULONG ulSize;
+ ULONG ulOffset;
+ ULONG ulTimeout;
+} DOT4_DRIVER_CMD, *PDOT4_DRIVER_CMD;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __D4DRVIF_H */
--- /dev/null
+/*
+ * d4iface.h
+ *
+ * DOT4 interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __D4IFACE_H
+#define __D4IFACE_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#define DOT4_MAX_CHANNELS 128
+#define NO_TIMEOUT 0
+
+#define DOT4_CHANNEL 0
+#define HP_MESSAGE_PROCESSOR 1
+#define PRINTER_CHANNEL 2
+#define SCANNER_CHANNEL 4
+#define MIO_COMMAND_PROCESSOR 5
+#define ECHO_CHANNEL 6
+#define FAX_SEND_CHANNEL 7
+#define FAX_RECV_CHANNEL 8
+#define DIAGNOSTIC_CHANNEL 9
+#define HP_RESERVED 10
+#define IMAGE_DOWNLOAD 11
+#define HOST_DATASTORE_UPLOAD 12
+#define HOST_DATASTORE_DOWNLOAD 13
+#define CONFIG_UPLOAD 14
+#define CONFIG_DOWNLOAD 15
+
+#define STREAM_TYPE_CHANNEL 1
+#define PACKET_TYPE_CHANNEL 2
+
+/* DOT4_ACTIVITY.ulMessage flags */
+#define DOT4_STREAM_RECEIVED 0x100
+#define DOT4_STREAM_CREDITS 0x101
+#define DOT4_MESSAGE_RECEIVED 0x102
+#define DOT4_DISCONNECT 0x103
+#define DOT4_CHANNEL_CLOSED 0x105
+
+typedef unsigned long CHANNEL_HANDLE, *PCHANNEL_HANDLE;
+
+typedef struct _DOT4_ACTIVITY {
+ ULONG ulMessage;
+ ULONG ulByteCount;
+ CHANNEL_HANDLE hChannel;
+} DOT4_ACTIVITY, *PDOT4_ACTIVITY;
+
+typedef struct _DOT4_WMI_XFER_INFO {
+ ULONG ulStreamBytesWritten;
+ ULONG ulStreamBytesRead;
+ ULONG ulPacketBytesWritten;
+ ULONG ulPacketBytesRead;
+} DOT4_WMI_XFER_INFO, *PDOT4_WMI_XFER_INFO;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __D4IFACE_H */
--- /dev/null
+/*
+ * ddkmapi.h
+ *
+ * DirectDraw support for DxApi function
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __DDKMAPI_H
+#define __DDKMAPI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#if defined(_DXAPI_)
+ #define DXAPI DECLSPEC_EXPORT
+#else
+ #define DXAPI DECLSPEC_IMPORT
+#endif
+
+DXAPI
+DWORD
+FAR PASCAL
+DxApi(
+ IN DWORD dwFunctionNum,
+ IN LPVOID lpvInBuffer,
+ IN DWORD cbInBuffer,
+ OUT LPVOID lpvOutBuffer,
+ OUT DWORD cbOutBuffer);
+
+typedef DWORD (FAR PASCAL *LPDXAPI)(
+ DWORD dwFunctionNum,
+ LPVOID lpvInBuffer,
+ DWORD cbInBuffer,
+ LPVOID lpvOutBuffer,
+ DWORD cbOutBuffer);
+
+
+#define DXAPI_MAJORVERSION 1
+#define DXAPI_MINORVERSION 0
+
+#define DD_FIRST_DXAPI 0x500
+
+#define DD_DXAPI_GETVERSIONNUMBER (DD_FIRST_DXAPI)
+#define DD_DXAPI_CLOSEHANDLE (DD_FIRST_DXAPI+1)
+#define DD_DXAPI_OPENDIRECTDRAW (DD_FIRST_DXAPI+2)
+#define DD_DXAPI_OPENSURFACE (DD_FIRST_DXAPI+3)
+#define DD_DXAPI_OPENVIDEOPORT (DD_FIRST_DXAPI+4)
+#define DD_DXAPI_GETKERNELCAPS (DD_FIRST_DXAPI+5)
+#define DD_DXAPI_GET_VP_FIELD_NUMBER (DD_FIRST_DXAPI+6)
+#define DD_DXAPI_SET_VP_FIELD_NUMBER (DD_FIRST_DXAPI+7)
+#define DD_DXAPI_SET_VP_SKIP_FIELD (DD_FIRST_DXAPI+8)
+#define DD_DXAPI_GET_SURFACE_STATE (DD_FIRST_DXAPI+9)
+#define DD_DXAPI_SET_SURFACE_STATE (DD_FIRST_DXAPI+10)
+#define DD_DXAPI_LOCK (DD_FIRST_DXAPI+11)
+#define DD_DXAPI_FLIP_OVERLAY (DD_FIRST_DXAPI+12)
+#define DD_DXAPI_FLIP_VP (DD_FIRST_DXAPI+13)
+#define DD_DXAPI_GET_CURRENT_VP_AUTOFLIP_SURFACE (DD_FIRST_DXAPI+14)
+#define DD_DXAPI_GET_LAST_VP_AUTOFLIP_SURFACE (DD_FIRST_DXAPI+15)
+#define DD_DXAPI_REGISTER_CALLBACK (DD_FIRST_DXAPI+16)
+#define DD_DXAPI_UNREGISTER_CALLBACK (DD_FIRST_DXAPI+17)
+#define DD_DXAPI_GET_POLARITY (DD_FIRST_DXAPI+18)
+#define DD_DXAPI_OPENVPCAPTUREDEVICE (DD_FIRST_DXAPI+19)
+#define DD_DXAPI_ADDVPCAPTUREBUFFER (DD_FIRST_DXAPI+20)
+#define DD_DXAPI_FLUSHVPCAPTUREBUFFERS (DD_FIRST_DXAPI+21)
+
+
+typedef struct _DDCAPBUFFINFO {
+ DWORD dwFieldNumber;
+ DWORD bPolarity;
+ LARGE_INTEGER liTimeStamp;
+ DWORD ddRVal;
+} DDCAPBUFFINFO, FAR * LPDDCAPBUFFINFO;
+
+/* DDADDVPCAPTUREBUFF.dwFlags constants */
+#define DDADDBUFF_SYSTEMMEMORY 0x0001
+#define DDADDBUFF_NONLOCALVIDMEM 0x0002
+#define DDADDBUFF_INVERT 0x0004
+
+typedef struct _DDADDVPCAPTUREBUFF {
+ HANDLE hCapture;
+ DWORD dwFlags;
+ PMDL pMDL;
+ PKEVENT pKEvent;
+ LPDDCAPBUFFINFO lpBuffInfo;
+} DDADDVPCAPTUREBUFF, FAR * LPDDADDVPCAPTUREBUFF;
+
+typedef struct _DDCLOSEHANDLE {
+ HANDLE hHandle;
+} DDCLOSEHANDLE, FAR *LPDDCLOSEHANDLE;
+
+typedef struct _DDFLIPOVERLAY {
+ HANDLE hDirectDraw;
+ HANDLE hCurrentSurface;
+ HANDLE hTargetSurface;
+ DWORD dwFlags;
+} DDFLIPOVERLAY, FAR *LPDDFLIPOVERLAY;
+
+typedef struct _DDFLIPVIDEOPORT {
+ HANDLE hDirectDraw;
+ HANDLE hVideoPort;
+ HANDLE hCurrentSurface;
+ HANDLE hTargetSurface;
+ DWORD dwFlags;
+} DDFLIPVIDEOPORT, FAR *LPDDFLIPVIDEOPORT;
+
+typedef struct _DDGETAUTOFLIPIN {
+ HANDLE hDirectDraw;
+ HANDLE hVideoPort;
+} DDGETAUTOFLIPIN, FAR *LPDDGETAUTOFLIPIN;
+
+typedef struct _DDGETAUTOFLIPOUT {
+ DWORD ddRVal;
+ HANDLE hVideoSurface;
+ HANDLE hVBISurface;
+ BOOL bPolarity;
+} DDGETAUTOFLIPOUT, FAR *LPDDGETAUTOFLIPOUT;
+
+typedef struct _DDGETPOLARITYIN {
+ HANDLE hDirectDraw;
+ HANDLE hVideoPort;
+} DDGETPOLARITYIN, FAR *LPDDGETPOLARITYIN;
+
+typedef struct _DDGETPOLARITYOUT {
+ DWORD ddRVal;
+ BOOL bPolarity;
+} DDGETPOLARITYOUT, FAR *LPDDGETPOLARITYOUT;
+
+typedef struct _DDGETSURFACESTATEIN {
+ HANDLE hDirectDraw;
+ HANDLE hSurface;
+} DDGETSURFACESTATEIN, FAR *LPDDGETSURFACESTATEIN;
+
+/* DDGETSURFACESTATEOUT.dwStateCaps/dwStateStatus constants */
+#define DDSTATE_BOB 0x0001
+#define DDSTATE_WEAVE 0x0002
+#define DDSTATE_EXPLICITLY_SET 0x0004
+#define DDSTATE_SOFTWARE_AUTOFLIP 0x0008
+#define DDSTATE_SKIPEVENFIELDS 0x0010
+
+typedef struct _DDGETSURFACESTATEOUT {
+ DWORD ddRVal;
+ DWORD dwStateCaps;
+ DWORD dwStateStatus;
+} DDGETSURFACESTATEOUT, FAR *LPDDGETSURFACESTATEOUT;
+
+typedef struct _DDGETFIELDNUMIN {
+ HANDLE hDirectDraw;
+ HANDLE hVideoPort;
+} DDGETFIELDNUMIN, FAR *LPDDGETFIELDNUMIN;
+
+typedef struct _DDGETFIELDNUMOUT {
+ DWORD ddRVal;
+ DWORD dwFieldNum;
+} DDGETFIELDNUMOUT, FAR *LPDDGETFIELDNUMOUT;
+
+typedef struct _DDGETKERNELCAPSOUT {
+ DWORD ddRVal;
+ DWORD dwCaps;
+ DWORD dwIRQCaps;
+} DDGETKERNELCAPSOUT, FAR *LPDDGETKERNELCAPSOUT;
+
+typedef struct _DDGETVERSIONNUMBER {
+ DWORD ddRVal;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+} DDGETVERSIONNUMBER, FAR *LPDDGETVERSIONNUMBER;
+
+typedef struct _DDLOCKIN {
+ HANDLE hDirectDraw;
+ HANDLE hSurface;
+} DDLOCKIN, FAR *LPDDLOCKIN;
+
+typedef struct _DDLOCKOUT {
+ DWORD ddRVal;
+ DWORD dwSurfHeight;
+ DWORD dwSurfWidth;
+ LONG lSurfPitch;
+ PVOID lpSurface;
+ DWORD SurfaceCaps;
+ DWORD dwFormatFlags;
+ DWORD dwFormatFourCC;
+ DWORD dwFormatBitCount;
+ union {
+ DWORD dwRBitMask;
+ DWORD dwYBitMask;
+ };
+ union {
+ DWORD dwGBitMask;
+ DWORD dwUBitMask;
+ };
+ union {
+ DWORD dwBBitMask;
+ DWORD dwVBitMask;
+ };
+} DDLOCKOUT, FAR *LPDDLOCKOUT;
+
+/* LPDD_NOTIFYCALLBACK.dwFlags constants */
+#define DDNOTIFY_DISPLAY_VSYNC 0x0001
+#define DDNOTIFY_VP_VSYNC 0x0002
+#define DDNOTIFY_VP_LINE 0x0004
+#define DDNOTIFY_PRERESCHANGE 0x0008
+#define DDNOTIFY_POSTRESCHANGE 0x0010
+#define DDNOTIFY_PREDOSBOX 0x0020
+#define DDNOTIFY_POSTDOSBOX 0x0040
+#define DDNOTIFY_CLOSEDIRECTDRAW 0x0080
+#define DDNOTIFY_CLOSESURFACE 0x0100
+#define DDNOTIFY_CLOSEVIDEOPORT 0x0200
+#define DDNOTIFY_CLOSECAPTURE 0x0400
+
+typedef ULONG (FAR PASCAL *LPDD_NOTIFYCALLBACK)(
+ DWORD dwFlags,
+ PVOID pContext,
+ DWORD dwParam1,
+ DWORD dwParam2);
+
+typedef struct _DDOPENDIRECTDRAWIN {
+ ULONG_PTR dwDirectDrawHandle;
+ LPDD_NOTIFYCALLBACK pfnDirectDrawClose;
+ PVOID pContext;
+} DDOPENDIRECTDRAWIN, FAR *LPDDOPENDIRECTDRAWIN;
+
+typedef struct _DDOPENDIRECTDRAWOUT {
+ DWORD ddRVal;
+ HANDLE hDirectDraw;
+} DDOPENDIRECTDRAWOUT, FAR *LPDDOPENDIRECTDRAWOUT;
+
+typedef struct _DDOPENSURFACEIN {
+ HANDLE hDirectDraw;
+ ULONG_PTR dwSurfaceHandle;
+ LPDD_NOTIFYCALLBACK pfnSurfaceClose;
+ PVOID pContext;
+} DDOPENSURFACEIN, FAR *LPDDOPENSURFACEIN;
+
+typedef struct _DDOPENSURFACEOUT {
+ DWORD ddRVal;
+ HANDLE hSurface;
+} DDOPENSURFACEOUT, FAR *LPDDOPENSURFACEOUT;
+
+typedef struct _DDOPENVIDEOPORTIN {
+ HANDLE hDirectDraw;
+ ULONG dwVideoPortHandle;
+ LPDD_NOTIFYCALLBACK pfnVideoPortClose;
+ PVOID pContext;
+} DDOPENVIDEOPORTIN, FAR *LPDDOPENVIDEOPORTIN;
+
+typedef struct _DDOPENVIDEOPORTOUT {
+ DWORD ddRVal;
+ HANDLE hVideoPort;
+} DDOPENVIDEOPORTOUT, FAR *LPDDOPENVIDEOPORTOUT;
+
+/* DDOPENVPCAPTUREDEVICEIN.dwFlags constants */
+#define DDOPENCAPTURE_VIDEO 0x0001
+#define DDOPENCAPTURE_VBI 0x0002
+
+typedef struct _DDOPENVPCAPTUREDEVICEIN {
+ HANDLE hDirectDraw;
+ HANDLE hVideoPort;
+ DWORD dwStartLine;
+ DWORD dwEndLine;
+ DWORD dwCaptureEveryNFields;
+ LPDD_NOTIFYCALLBACK pfnCaptureClose;
+ PVOID pContext;
+ DWORD dwFlags;
+} DDOPENVPCAPTUREDEVICEIN, FAR * LPDDOPENVPCAPTUREDEVICEIN;
+
+typedef struct _DDOPENVPCAPTUREDEVICEOUT {
+ DWORD ddRVal;
+ HANDLE hCapture;
+} DDOPENVPCAPTUREDEVICEOUT, FAR * LPDDOPENVPCAPTUREDEVICEOUT;
+
+/* DDREGISTERCALLBACK.dwEvents constants */
+#define DDEVENT_DISPLAY_VSYNC 0x0001
+#define DDEVENT_VP_VSYNC 0x0002
+#define DDEVENT_VP_LINE 0x0004
+#define DDEVENT_PRERESCHANGE 0x0008
+#define DDEVENT_POSTRESCHANGE 0x0010
+#define DDEVENT_PREDOSBOX 0x0020
+#define DDEVENT_POSTDOSBOX 0x0040
+
+typedef struct _DDREGISTERCALLBACK {
+ HANDLE hDirectDraw;
+ ULONG dwEvents;
+ LPDD_NOTIFYCALLBACK pfnCallback;
+ ULONG_PTR dwParam1;
+ ULONG_PTR dwParam2;
+ PVOID pContext;
+} DDREGISTERCALLBACK, FAR *LPDDREGISTERCALLBACK;
+
+typedef struct _DDSETSURFACETATE {
+ HANDLE hDirectDraw;
+ HANDLE hSurface;
+ DWORD dwState;
+ DWORD dwStartField;
+} DDSETSURFACESTATE, FAR *LPDDSETSURFACESTATE;
+
+typedef struct _DDSETFIELDNUM {
+ HANDLE hDirectDraw;
+ HANDLE hVideoPort;
+ DWORD dwFieldNum;
+} DDSETFIELDNUM, FAR *LPDDSETFIELDNUM;
+
+typedef struct _DDSETSKIPFIELD {
+ HANDLE hDirectDraw;
+ HANDLE hVideoPort;
+ DWORD dwStartField;
+} DDSETSKIPFIELD, FAR *LPDDSETSKIPFIELD;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DDKMAPI_H */
--- /dev/null
+/*
+ * hidclass.h
+ *
+ * HID class driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __HIDCLASS_H
+#define __HIDCLASS_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "hidpi.h"
+
+#define HID_REVISION 0x00000001
+
+DEFINE_GUID (GUID_DEVINTERFACE_HID, \
+ 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30);
+DEFINE_GUID (GUID_HID_INTERFACE_NOTIFY, \
+ 0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81);
+DEFINE_GUID (GUID_HID_INTERFACE_HIDPARSE, \
+ 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b);
+
+#define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID
+
+#define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030"
+
+
+#define HID_CTL_CODE(id) \
+ CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
+#define HID_BUFFER_CTL_CODE(id) \
+ CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define HID_IN_CTL_CODE(id) \
+ CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
+#define HID_OUT_CTL_CODE(id) \
+ CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+
+#define IOCTL_GET_PHYSICAL_DESCRIPTOR HID_OUT_CTL_CODE(102)
+#define IOCTL_HID_FLUSH_QUEUE HID_CTL_CODE(101)
+#define IOCTL_HID_GET_COLLECTION_DESCRIPTOR HID_CTL_CODE(100)
+#define IOCTL_HID_GET_COLLECTION_INFORMATION HID_BUFFER_CTL_CODE(106)
+#define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
+#define IOCTL_HID_GET_HARDWARE_ID HID_OUT_CTL_CODE(103)
+#define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120)
+#define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104)
+#define IOCTL_HID_GET_MANUFACTURER_STRING HID_OUT_CTL_CODE(110)
+#define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(104)
+#define IOCTL_HID_GET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(102)
+#define IOCTL_HID_GET_PRODUCT_STRING HID_OUT_CTL_CODE(111)
+#define IOCTL_HID_GET_SERIALNUMBER_STRING HID_OUT_CTL_CODE(112)
+#define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100)
+#define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(105)
+#define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101)
+#define IOCTL_HID_SET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(103)
+
+#define IOCTL_HID_GET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(100)
+#define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101)
+#define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
+
+
+enum DeviceObjectState {
+ DeviceObjectStarted = 0,
+ DeviceObjectStopped,
+ DeviceObjectRemoved
+};
+
+typedef VOID DDKAPI (*PHID_STATUS_CHANGE)(
+ PVOID Context,
+ enum DeviceObjectState State);
+
+typedef NTSTATUS DDKAPI (*PHIDP_GETCAPS)(
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ OUT PHIDP_CAPS Capabilities);
+
+typedef struct _HID_COLLECTION_INFORMATION {
+ ULONG DescriptorSize;
+ BOOLEAN Polled;
+ UCHAR Reserved1[1];
+ USHORT VendorID;
+ USHORT ProductID;
+ USHORT VersionNumber;
+} HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
+
+typedef struct _HID_DRIVER_CONFIG {
+ ULONG Size;
+ ULONG RingBufferSize;
+} HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG;
+
+typedef struct _HID_INTERFACE_HIDPARSE {
+#if 0
+/* FIXME: COM stuff */
+#ifdef __cplusplus
+ INTERFACE i;
+#else
+ INTERFACE;
+#endif
+#endif
+ PHIDP_GETCAPS HidpGetCaps;
+} HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE;
+
+typedef struct _HID_INTERFACE_NOTIFY_PNP {
+#if 0
+/* FIXME: COM stuff */
+#ifdef __cplusplus
+ INTERFACE i;
+#else
+ INTERFACE;
+#endif
+#endif
+ PHID_STATUS_CHANGE StatusChangeFn;
+ PVOID CallbackContext;
+} HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP;
+
+typedef struct _HID_XFER_PACKET {
+ PUCHAR reportBuffer;
+ ULONG reportBufferLen;
+ UCHAR reportId;
+} HID_XFER_PACKET, *PHID_XFER_PACKET;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HIDCLASS_H */
--- /dev/null
+/*
+ * hidpi.h
+ *
+ * Public Interface for HID parsing library.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __HIDPI_H
+#define __HIDPI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "hidusage.h"
+
+#if defined(_HIDPI_)
+ #define HIDAPI DECLSPEC_EXPORT
+#else
+ #define HIDAPI DECLSPEC_IMPORT
+#endif
+
+typedef PUCHAR PHIDP_REPORT_DESCRIPTOR;
+typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
+
+typedef struct _HIDP_UNKNOWN_TOKEN {
+ UCHAR Token;
+ UCHAR Reserved[3];
+ ULONG BitField;
+} HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN;
+
+typedef enum _HIDP_KEYBOARD_DIRECTION {
+ HidP_Keyboard_Break,
+ HidP_Keyboard_Make
+} HIDP_KEYBOARD_DIRECTION;
+
+typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
+ union {
+ struct {
+ ULONG LeftControl : 1;
+ ULONG LeftShift : 1;
+ ULONG LeftAlt : 1;
+ ULONG LeftGUI : 1;
+ ULONG RightControl : 1;
+ ULONG RightShift : 1;
+ ULONG RightAlt : 1;
+ ULONG RigthGUI : 1;
+ ULONG CapsLock : 1;
+ ULONG ScollLock : 1;
+ ULONG NumLock : 1;
+ ULONG Reserved : 21;
+ };
+ ULONG ul;
+ };
+} HIDP_KEYBOARD_MODIFIER_STATE, *PHIDP_KEYBOARD_MODIFIER_STATE;
+
+typedef BOOLEAN (DDKAPI *PHIDP_INSERT_SCANCODES)(
+ IN PVOID Context,
+ IN PCHAR NewScanCodes,
+ IN ULONG Length);
+
+typedef struct _USAGE_AND_PAGE {
+ USAGE Usage;
+ USAGE UsagePage;
+} USAGE_AND_PAGE, *PUSAGE_AND_PAGE;
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_TranslateUsageAndPagesToI8042ScanCodes(
+ IN PUSAGE_AND_PAGE ChangedUsageList,
+ IN ULONG UsageListLength,
+ IN HIDP_KEYBOARD_DIRECTION KeyAction,
+ IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
+ IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
+ IN PVOID InsertCodesContext);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_TranslateUsagesToI8042ScanCodes(
+ IN PUSAGE ChangedUsageList,
+ IN ULONG UsageListLength,
+ IN HIDP_KEYBOARD_DIRECTION KeyAction,
+ IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
+ IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
+ IN PVOID InsertCodesContext);
+
+typedef struct _HIDP_BUTTON_CAPS {
+ USAGE UsagePage;
+ UCHAR ReportID;
+ BOOLEAN IsAlias;
+ USHORT BitField;
+ USHORT LinkCollection;
+ USAGE LinkUsage;
+ USAGE LinkUsagePage;
+ BOOLEAN IsRange;
+ BOOLEAN IsStringRange;
+ BOOLEAN IsDesignatorRange;
+ BOOLEAN IsAbsolute;
+ ULONG Reserved[10];
+ union {
+ struct {
+ USAGE UsageMin, UsageMax;
+ USHORT StringMin, StringMax;
+ USHORT DesignatorMin, DesignatorMax;
+ USHORT DataIndexMin, DataIndexMax;
+ } Range;
+ struct {
+ USAGE Usage, Reserved1;
+ USHORT StringIndex, Reserved2;
+ USHORT DesignatorIndex, Reserved3;
+ USHORT DataIndex, Reserved4;
+ } NotRange;
+ };
+} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
+
+typedef struct _HIDP_CAPS {
+ USAGE Usage;
+ USAGE UsagePage;
+ USHORT InputReportByteLength;
+ USHORT OutputReportByteLength;
+ USHORT FeatureReportByteLength;
+ USHORT Reserved[17];
+ USHORT NumberLinkCollectionNodes;
+ USHORT NumberInputButtonCaps;
+ USHORT NumberInputValueCaps;
+ USHORT NumberInputDataIndices;
+ USHORT NumberOutputButtonCaps;
+ USHORT NumberOutputValueCaps;
+ USHORT NumberOutputDataIndices;
+ USHORT NumberFeatureButtonCaps;
+ USHORT NumberFeatureValueCaps;
+ USHORT NumberFeatureDataIndices;
+} HIDP_CAPS, *PHIDP_CAPS;
+
+typedef struct _HIDP_DATA {
+ USHORT DataIndex;
+ USHORT Reserved;
+ union {
+ ULONG RawValue;
+ BOOLEAN On;
+ };
+} HIDP_DATA, *PHIDP_DATA;
+
+typedef struct _HIDP_EXTENDED_ATTRIBUTES {
+ UCHAR NumGlobalUnknowns;
+ UCHAR Reserved[3];
+ PHIDP_UNKNOWN_TOKEN GlobalUnknowns;
+ ULONG Data[1];
+} HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES;
+
+#define HIDP_LINK_COLLECTION_ROOT ((USHORT) -1)
+#define HIDP_LINK_COLLECTION_UNSPECIFIED ((USHORT) 0)
+
+typedef struct _HIDP_LINK_COLLECTION_NODE {
+ USAGE LinkUsage;
+ USAGE LinkUsagePage;
+ USHORT Parent;
+ USHORT NumberOfChildren;
+ USHORT NextSibling;
+ USHORT FirstChild;
+ ULONG CollectionType: 8;
+ ULONG IsAlias: 1;
+ ULONG Reserved: 23;
+ PVOID UserContext;
+} HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE;
+
+typedef struct _HIDP_VALUE_CAPS {
+ USAGE UsagePage;
+ UCHAR ReportID;
+ BOOLEAN IsAlias;
+ USHORT BitField;
+ USHORT LinkCollection;
+ USAGE LinkUsage;
+ USAGE LinkUsagePage;
+ BOOLEAN IsRange;
+ BOOLEAN IsStringRange;
+ BOOLEAN IsDesignatorRange;
+ BOOLEAN IsAbsolute;
+ BOOLEAN HasNull;
+ UCHAR Reserved;
+ USHORT BitSize;
+ USHORT ReportCount;
+ USHORT Reserved2[5];
+ ULONG UnitsExp;
+ ULONG Units;
+ LONG LogicalMin, LogicalMax;
+ LONG PhysicalMin, PhysicalMax;
+ union {
+ struct {
+ USAGE UsageMin, UsageMax;
+ USHORT StringMin, StringMax;
+ USHORT DesignatorMin, DesignatorMax;
+ USHORT DataIndexMin, DataIndexMax;
+ } Range;
+ struct {
+ USAGE Usage, Reserved1;
+ USHORT StringIndex, Reserved2;
+ USHORT DesignatorIndex, Reserved3;
+ USHORT DataIndex, Reserved4;
+ } NotRange;
+ };
+} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
+
+typedef enum _HIDP_REPORT_TYPE {
+ HidP_Input,
+ HidP_Output,
+ HidP_Feature
+} HIDP_REPORT_TYPE;
+
+#define FACILITY_HID_ERROR_CODE 0x11
+
+#define HIDP_ERROR_CODES(SEV, CODE) \
+ ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE)))
+
+#define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0, 0))
+#define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8, 1))
+#define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xC, 1))
+#define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xC, 2))
+#define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xC, 3))
+#define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xC, 4))
+#define HIDP_STATUS_VALUE_OUT_OF_RANGE (HIDP_ERROR_CODES(0xC, 5))
+#define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xC, 6))
+#define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xC, 7))
+#define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xC, 8))
+#define HIDP_STATUS_I8042_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xC, 9))
+#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xC, 0xA))
+#define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xC, 0xB))
+#define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xC, 0xC))
+#define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xC, 0xD))
+#define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE (HIDP_ERROR_CODES(0xC, 0xE))
+#define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xC, 0xF))
+#define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xC, 0x10))
+#define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xC, 0x20))
+#define HIDP_STATUS_I8242_TRANS_UNKNOWN HIDP_STATUS_I8042_TRANS_UNKNOWN
+
+
+
+/*
+ * NTSTATUS
+ * HidP_GetButtonCaps(
+ * IN HIDP_REPORT_TYPE ReportType,
+ * OUT PHIDP_BUTTON_CAPS ButtonCaps,
+ * IN OUT PULONG ButtonCapsLength,
+ * IN PHIDP_PREPARSED_DATA PreparsedData);
+ */
+#define HidP_GetButtonCaps(_Type_, _Caps_, _Len_, _Data_) \
+ HidP_GetSpecificButtonCaps(_Type_, 0, 0, 0, _Caps_, _Len_, _Data_)
+
+/*
+ * NTSTATUS
+ * HidP_GetButtons(
+ * IN HIDP_REPORT_TYPE ReportType,
+ * IN USAGE UsagePage,
+ * IN USHORT LinkCollection,
+ * OUT USAGE *UsageList,
+ * IN OUT ULONG *UsageLength,
+ * IN PHIDP_PREPARSED_DATA PreparsedData,
+ * IN PCHAR Report,
+ * IN ULONG ReportLength);
+ */
+#define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \
+ HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe)
+
+#define HidP_GetButtonListLength(RTy, UPa, Ppd) \
+ HidP_GetUsageListLength(Rty, UPa, Ppd)
+
+
+/*
+ * NTSTATUS
+ * HidP_GetButtonsEx(
+ * IN HIDP_REPORT_TYPE ReportType,
+ * IN USHORT LinkCollection,
+ * OUT PUSAGE_AND_PAGE ButtonList,
+ * IN OUT ULONG *UsageLength,
+ * IN PHIDP_PREPARSED_DATA PreparsedData,
+ * IN PCHAR Report,
+ * IN ULONG ReportLength);
+ */
+#define HidP_GetButtonsEx(RT, LC, BL, UL, PD, R, RL) \
+ HidP_GetUsagesEx(RT, LC, BL, UL, PD, R, RL)
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetCaps(
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ OUT PHIDP_CAPS Capabilities);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetData(
+ IN HIDP_REPORT_TYPE ReportType,
+ OUT PHIDP_DATA DataList,
+ IN OUT PULONG DataLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetExtendedAttributes(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USHORT DataIndex,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ OUT PHIDP_EXTENDED_ATTRIBUTES Attributes,
+ IN OUT PULONG LengthAttributes);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetLinkCollectionNodes(
+ OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
+ IN OUT PULONG LinkCollectionNodesLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetScaledUsageValue(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection OPTIONAL,
+ IN USAGE Usage,
+ OUT PLONG UsageValue,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetSpecificButtonCaps(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection,
+ IN USAGE Usage,
+ OUT PHIDP_BUTTON_CAPS ButtonCaps,
+ IN OUT PULONG ButtonCapsLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetSpecificValueCaps(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection,
+ IN USAGE Usage,
+ OUT PHIDP_VALUE_CAPS ValueCaps,
+ IN OUT PULONG ValueCapsLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetUsages(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection OPTIONAL,
+ OUT USAGE *UsageList,
+ IN OUT ULONG *UsageLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetUsagesEx(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USHORT LinkCollection,
+ OUT PUSAGE_AND_PAGE ButtonList,
+ IN OUT ULONG *UsageLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetUsageValue(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection,
+ IN USAGE Usage,
+ OUT PULONG UsageValue,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_GetUsageValueArray(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection OPTIONAL,
+ IN USAGE Usage,
+ OUT PCHAR UsageValue,
+ IN USHORT UsageValueByteLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN PCHAR Report,
+ IN ULONG ReportLength);
+
+/*
+ * NTSTATUS
+ * HidP_GetValueCaps(
+ * IN HIDP_REPORT_TYPE ReportType,
+ * OUT PHIDP_VALUE_CAPS ValueCaps,
+ * IN OUT PULONG ValueCapsLength,
+ * IN PHIDP_PREPARSED_DATA PreparsedData);
+ */
+#define HidP_GetValueCaps(_Type_, _Caps_, _Len_, _Data_) \
+ HidP_GetSpecificValueCaps (_Type_, 0, 0, 0, _Caps_, _Len_, _Data_)
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_InitializeReportForID(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN UCHAR ReportID,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN OUT PCHAR Report,
+ IN ULONG ReportLength);
+
+/*
+ * BOOLEAN
+ * HidP_IsSameUsageAndPage(
+ * USAGE_AND_PAGE u1,
+ * USAGE_AND_PAGE u2);
+ */
+#define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2))
+
+HIDAPI
+ULONG
+DDKAPI
+HidP_MaxDataListLength(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN PHIDP_PREPARSED_DATA PreparsedData);
+
+HIDAPI
+ULONG
+DDKAPI
+HidP_MaxUsageListLength(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage OPTIONAL,
+ IN PHIDP_PREPARSED_DATA PreparsedData);
+
+/*
+ * NTSTATUS
+ * HidP_SetButtons(
+ * IN HIDP_REPORT_TYPE ReportType,
+ * IN USAGE UsagePage,
+ * IN USHORT LinkCollection,
+ * IN PUSAGE UsageList,
+ * IN OUT PULONG UsageLength,
+ * IN PHIDP_PREPARSED_DATA PreparsedData,
+ * IN OUT PCHAR Report,
+ * IN ULONG ReportLength);
+ */
+#define HidP_SetButtons(RT, UP, LC, UL1, UL2, PD, R, RL) \
+ HidP_SetUsages(RT, UP, LC, UL1, UL2, PD, R, RL)
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_SetData(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN PHIDP_DATA DataList,
+ IN OUT PULONG DataLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN OUT PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_SetScaledUsageValue(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection OPTIONAL,
+ IN USAGE Usage,
+ IN LONG UsageValue,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN OUT PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_SetUsages(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection, // Optional
+ IN PUSAGE UsageList,
+ IN OUT PULONG UsageLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN OUT PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_SetUsageValue(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection,
+ IN USAGE Usage,
+ IN ULONG UsageValue,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN OUT PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_SetUsageValueArray(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection OPTIONAL,
+ IN USAGE Usage,
+ IN PCHAR UsageValue,
+ IN USHORT UsageValueByteLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ OUT PCHAR Report,
+ IN ULONG ReportLength);
+
+/*
+ * NTSTATUS
+ * HidP_UnsetButtons(
+ * IN HIDP_REPORT_TYPE ReportType,
+ * IN USAGE UsagePage,
+ * IN USHORT LinkCollection,
+ * IN PUSAGE UsageList,
+ * IN OUT PULONG UsageLength,
+ * IN PHIDP_PREPARSED_DATA PreparsedData,
+ * IN OUT PCHAR Report,
+ * IN ULONG ReportLength);
+ */
+#define HidP_UnsetButtons(RT, UP, LC, UL1, UL2, PD, R, RL) \
+ HidP_UnsetUsages(RT, UP, LC, UL1, UL2, PD, R, RL)
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_UnsetUsages(
+ IN HIDP_REPORT_TYPE ReportType,
+ IN USAGE UsagePage,
+ IN USHORT LinkCollection,
+ IN PUSAGE UsageList,
+ IN OUT PULONG UsageLength,
+ IN PHIDP_PREPARSED_DATA PreparsedData,
+ IN OUT PCHAR Report,
+ IN ULONG ReportLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_UsageAndPageListDifference(
+ IN PUSAGE_AND_PAGE PreviousUsageList,
+ IN PUSAGE_AND_PAGE CurrentUsageList,
+ OUT PUSAGE_AND_PAGE BreakUsageList,
+ OUT PUSAGE_AND_PAGE MakeUsageList,
+ IN ULONG UsageListLength);
+
+HIDAPI
+NTSTATUS
+DDKAPI
+HidP_UsageListDifference(
+ IN PUSAGE PreviousUsageList,
+ IN PUSAGE CurrentUsageList,
+ OUT PUSAGE BreakUsageList,
+ OUT PUSAGE MakeUsageList,
+ IN ULONG UsageListLength);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HIDPI_H */
--- /dev/null
+/*
+ * hidusage.h
+ *
+ * HID usages
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __HIDUSAGE_H
+#define __HIDUSAGE_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+typedef USHORT USAGE, *PUSAGE;
+
+#define HID_USAGE_GENERIC_POINTER ((USAGE) 0x01)
+#define HID_USAGE_GENERIC_MOUSE ((USAGE) 0x02)
+#define HID_USAGE_GENERIC_JOYSTICK ((USAGE) 0x04)
+#define HID_USAGE_GENERIC_GAMEPAD ((USAGE) 0x05)
+#define HID_USAGE_GENERIC_KEYBOARD ((USAGE) 0x06)
+#define HID_USAGE_GENERIC_KEYPAD ((USAGE) 0x07)
+#define HID_USAGE_GENERIC_SYSTEM_CTL ((USAGE) 0x80)
+#define HID_USAGE_GENERIC_X ((USAGE) 0x30)
+#define HID_USAGE_GENERIC_Y ((USAGE) 0x31)
+#define HID_USAGE_GENERIC_Z ((USAGE) 0x32)
+#define HID_USAGE_GENERIC_RX ((USAGE) 0x33)
+#define HID_USAGE_GENERIC_RY ((USAGE) 0x34)
+#define HID_USAGE_GENERIC_RZ ((USAGE) 0x35)
+#define HID_USAGE_GENERIC_SLIDER ((USAGE) 0x36)
+#define HID_USAGE_GENERIC_DIAL ((USAGE) 0x37)
+#define HID_USAGE_GENERIC_WHEEL ((USAGE) 0x38)
+#define HID_USAGE_GENERIC_HATSWITCH ((USAGE) 0x39)
+#define HID_USAGE_GENERIC_COUNTED_BUFFER ((USAGE) 0x3A)
+#define HID_USAGE_GENERIC_BYTE_COUNT ((USAGE) 0x3B)
+#define HID_USAGE_GENERIC_MOTION_WAKEUP ((USAGE) 0x3C)
+#define HID_USAGE_GENERIC_VX ((USAGE) 0x40)
+#define HID_USAGE_GENERIC_VY ((USAGE) 0x41)
+#define HID_USAGE_GENERIC_VZ ((USAGE) 0x42)
+#define HID_USAGE_GENERIC_VBRX ((USAGE) 0x43)
+#define HID_USAGE_GENERIC_VBRY ((USAGE) 0x44)
+#define HID_USAGE_GENERIC_VBRZ ((USAGE) 0x45)
+#define HID_USAGE_GENERIC_VNO ((USAGE) 0x46)
+#define HID_USAGE_GENERIC_SYSCTL_POWER ((USAGE) 0x81)
+#define HID_USAGE_GENERIC_SYSCTL_SLEEP ((USAGE) 0x82)
+#define HID_USAGE_GENERIC_SYSCTL_WAKE ((USAGE) 0x83)
+#define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU ((USAGE) 0x84)
+#define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU ((USAGE) 0x85)
+#define HID_USAGE_GENERIC_SYSCTL_APP_MENU ((USAGE) 0x86)
+#define HID_USAGE_GENERIC_SYSCTL_HELP_MENU ((USAGE) 0x87)
+#define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT ((USAGE) 0x88)
+#define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT ((USAGE) 0x89)
+#define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT ((USAGE) 0x8A)
+#define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT ((USAGE) 0x8B)
+#define HID_USAGE_GENERIC_SYSCTL_MENU_UP ((USAGE) 0x8C)
+#define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN ((USAGE) 0x8D)
+
+#define HID_USAGE_KEYBOARD_NOEVENT ((USAGE) 0x00)
+#define HID_USAGE_KEYBOARD_ROLLOVER ((USAGE) 0x01)
+#define HID_USAGE_KEYBOARD_POSTFAIL ((USAGE) 0x02)
+#define HID_USAGE_KEYBOARD_UNDEFINED ((USAGE) 0x03)
+#define HID_USAGE_KEYBOARD_aA ((USAGE) 0x04)
+#define HID_USAGE_KEYBOARD_zZ ((USAGE) 0x1D)
+#define HID_USAGE_KEYBOARD_ONE ((USAGE) 0x1E)
+#define HID_USAGE_KEYBOARD_ZERO ((USAGE) 0x27)
+#define HID_USAGE_KEYBOARD_LCTRL ((USAGE) 0xE0)
+#define HID_USAGE_KEYBOARD_LSHFT ((USAGE) 0xE1)
+#define HID_USAGE_KEYBOARD_LALT ((USAGE) 0xE2)
+#define HID_USAGE_KEYBOARD_LGUI ((USAGE) 0xE3)
+#define HID_USAGE_KEYBOARD_RCTRL ((USAGE) 0xE4)
+#define HID_USAGE_KEYBOARD_RSHFT ((USAGE) 0xE5)
+#define HID_USAGE_KEYBOARD_RALT ((USAGE) 0xE6)
+#define HID_USAGE_KEYBOARD_RGUI ((USAGE) 0xE7)
+#define HID_USAGE_KEYBOARD_SCROLL_LOCK ((USAGE) 0x47)
+#define HID_USAGE_KEYBOARD_NUM_LOCK ((USAGE) 0x53)
+#define HID_USAGE_KEYBOARD_CAPS_LOCK ((USAGE) 0x39)
+#define HID_USAGE_KEYBOARD_F1 ((USAGE) 0x3A)
+#define HID_USAGE_KEYBOARD_F12 ((USAGE) 0x45)
+#define HID_USAGE_KEYBOARD_RETURN ((USAGE) 0x28)
+#define HID_USAGE_KEYBOARD_ESCAPE ((USAGE) 0x29)
+#define HID_USAGE_KEYBOARD_DELETE ((USAGE) 0x2A)
+#define HID_USAGE_KEYBOARD_PRINT_SCREEN ((USAGE) 0x46)
+
+#define HID_USAGE_LED_NUM_LOCK ((USAGE) 0x01)
+#define HID_USAGE_LED_CAPS_LOCK ((USAGE) 0x02)
+#define HID_USAGE_LED_SCROLL_LOCK ((USAGE) 0x03)
+#define HID_USAGE_LED_COMPOSE ((USAGE) 0x04)
+#define HID_USAGE_LED_KANA ((USAGE) 0x05)
+#define HID_USAGE_LED_POWER ((USAGE) 0x06)
+#define HID_USAGE_LED_SHIFT ((USAGE) 0x07)
+#define HID_USAGE_LED_DO_NOT_DISTURB ((USAGE) 0x08)
+#define HID_USAGE_LED_MUTE ((USAGE) 0x09)
+#define HID_USAGE_LED_TONE_ENABLE ((USAGE) 0x0A)
+#define HID_USAGE_LED_HIGH_CUT_FILTER ((USAGE) 0x0B)
+#define HID_USAGE_LED_LOW_CUT_FILTER ((USAGE) 0x0C)
+#define HID_USAGE_LED_EQUALIZER_ENABLE ((USAGE) 0x0D)
+#define HID_USAGE_LED_SOUND_FIELD_ON ((USAGE) 0x0E)
+#define HID_USAGE_LED_SURROUND_FIELD_ON ((USAGE) 0x0F)
+#define HID_USAGE_LED_REPEAT ((USAGE) 0x10)
+#define HID_USAGE_LED_STEREO ((USAGE) 0x11)
+#define HID_USAGE_LED_SAMPLING_RATE_DETECT ((USAGE) 0x12)
+#define HID_USAGE_LED_SPINNING ((USAGE) 0x13)
+#define HID_USAGE_LED_CAV ((USAGE) 0x14)
+#define HID_USAGE_LED_CLV ((USAGE) 0x15)
+#define HID_USAGE_LED_RECORDING_FORMAT_DET ((USAGE) 0x16)
+#define HID_USAGE_LED_OFF_HOOK ((USAGE) 0x17)
+#define HID_USAGE_LED_RING ((USAGE) 0x18)
+#define HID_USAGE_LED_MESSAGE_WAITING ((USAGE) 0x19)
+#define HID_USAGE_LED_DATA_MODE ((USAGE) 0x1A)
+#define HID_USAGE_LED_BATTERY_OPERATION ((USAGE) 0x1B)
+#define HID_USAGE_LED_BATTERY_OK ((USAGE) 0x1C)
+#define HID_USAGE_LED_BATTERY_LOW ((USAGE) 0x1D)
+#define HID_USAGE_LED_SPEAKER ((USAGE) 0x1E)
+#define HID_USAGE_LED_HEAD_SET ((USAGE) 0x1F)
+#define HID_USAGE_LED_HOLD ((USAGE) 0x20)
+#define HID_USAGE_LED_MICROPHONE ((USAGE) 0x21)
+#define HID_USAGE_LED_COVERAGE ((USAGE) 0x22)
+#define HID_USAGE_LED_NIGHT_MODE ((USAGE) 0x23)
+#define HID_USAGE_LED_SEND_CALLS ((USAGE) 0x24)
+#define HID_USAGE_LED_CALL_PICKUP ((USAGE) 0x25)
+#define HID_USAGE_LED_CONFERENCE ((USAGE) 0x26)
+#define HID_USAGE_LED_STAND_BY ((USAGE) 0x27)
+#define HID_USAGE_LED_CAMERA_ON ((USAGE) 0x28)
+#define HID_USAGE_LED_CAMERA_OFF ((USAGE) 0x29)
+#define HID_USAGE_LED_ON_LINE ((USAGE) 0x2A)
+#define HID_USAGE_LED_OFF_LINE ((USAGE) 0x2B)
+#define HID_USAGE_LED_BUSY ((USAGE) 0x2C)
+#define HID_USAGE_LED_READY ((USAGE) 0x2D)
+#define HID_USAGE_LED_PAPER_OUT ((USAGE) 0x2E)
+#define HID_USAGE_LED_PAPER_JAM ((USAGE) 0x2F)
+#define HID_USAGE_LED_REMOTE ((USAGE) 0x30)
+#define HID_USAGE_LED_FORWARD ((USAGE) 0x31)
+#define HID_USAGE_LED_REVERSE ((USAGE) 0x32)
+#define HID_USAGE_LED_STOP ((USAGE) 0x33)
+#define HID_USAGE_LED_REWIND ((USAGE) 0x34)
+#define HID_USAGE_LED_FAST_FORWARD ((USAGE) 0x35)
+#define HID_USAGE_LED_PLAY ((USAGE) 0x36)
+#define HID_USAGE_LED_PAUSE ((USAGE) 0x37)
+#define HID_USAGE_LED_RECORD ((USAGE) 0x38)
+#define HID_USAGE_LED_ERROR ((USAGE) 0x39)
+#define HID_USAGE_LED_SELECTED_INDICATOR ((USAGE) 0x3A)
+#define HID_USAGE_LED_IN_USE_INDICATOR ((USAGE) 0x3B)
+#define HID_USAGE_LED_MULTI_MODE_INDICATOR ((USAGE) 0x3C)
+#define HID_USAGE_LED_INDICATOR_ON ((USAGE) 0x3D)
+#define HID_USAGE_LED_INDICATOR_FLASH ((USAGE) 0x3E)
+#define HID_USAGE_LED_INDICATOR_SLOW_BLINK ((USAGE) 0x3F)
+#define HID_USAGE_LED_INDICATOR_FAST_BLINK ((USAGE) 0x40)
+#define HID_USAGE_LED_INDICATOR_OFF ((USAGE) 0x41)
+#define HID_USAGE_LED_FLASH_ON_TIME ((USAGE) 0x42)
+#define HID_USAGE_LED_SLOW_BLINK_ON_TIME ((USAGE) 0x43)
+#define HID_USAGE_LED_SLOW_BLINK_OFF_TIME ((USAGE) 0x44)
+#define HID_USAGE_LED_FAST_BLINK_ON_TIME ((USAGE) 0x45)
+#define HID_USAGE_LED_FAST_BLINK_OFF_TIME ((USAGE) 0x46)
+#define HID_USAGE_LED_INDICATOR_COLOR ((USAGE) 0x47)
+#define HID_USAGE_LED_RED ((USAGE) 0x48)
+#define HID_USAGE_LED_GREEN ((USAGE) 0x49)
+#define HID_USAGE_LED_AMBER ((USAGE) 0x4A)
+#define HID_USAGE_LED_GENERIC_INDICATOR ((USAGE) 0x3B)
+
+#define HID_USAGE_PAGE_UNDEFINED ((USAGE) 0x00)
+#define HID_USAGE_PAGE_GENERIC ((USAGE) 0x01)
+#define HID_USAGE_PAGE_SIMULATION ((USAGE) 0x02)
+#define HID_USAGE_PAGE_VR ((USAGE) 0x03)
+#define HID_USAGE_PAGE_SPORT ((USAGE) 0x04)
+#define HID_USAGE_PAGE_GAME ((USAGE) 0x05)
+#define HID_USAGE_PAGE_KEYBOARD ((USAGE) 0x07)
+#define HID_USAGE_PAGE_LED ((USAGE) 0x08)
+#define HID_USAGE_PAGE_BUTTON ((USAGE) 0x09)
+#define HID_USAGE_PAGE_ORDINAL ((USAGE) 0x0A)
+#define HID_USAGE_PAGE_TELEPHONY ((USAGE) 0x0B)
+#define HID_USAGE_PAGE_CONSUMER ((USAGE) 0x0C)
+#define HID_USAGE_PAGE_DIGITIZER ((USAGE) 0x0D)
+#define HID_USAGE_PAGE_UNICODE ((USAGE) 0x10)
+#define HID_USAGE_PAGE_ALPHANUMERIC ((USAGE) 0x14)
+
+#define HID_USAGE_TELEPHONY_PHONE ((USAGE) 0x01)
+#define HID_USAGE_TELEPHONY_ANSWERING_MACHINE ((USAGE) 0x02)
+#define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS ((USAGE) 0x03)
+#define HID_USAGE_TELEPHONY_HANDSET ((USAGE) 0x04)
+#define HID_USAGE_TELEPHONY_HEADSET ((USAGE) 0x05)
+#define HID_USAGE_TELEPHONY_KEYPAD ((USAGE) 0x06)
+#define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON ((USAGE) 0x07)
+
+#define HID_USAGE_SIMULATION_RUDDER ((USAGE) 0xBA)
+#define HID_USAGE_SIMULATION_THROTTLE ((USAGE) 0xBB)
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HIDUSAGE_H */
--- /dev/null
+/*
+ * mcd.h
+ *
+ * Media changer driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __MCD_H
+#define __MCD_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "srb.h"
+#include "scsi.h"
+#include "ntddchgr.h"
+
+#if defined(_MCD_)
+ #define CHANGERAPI DECLSPEC_EXPORT
+#else
+ #define CHANGERAPI DECLSPEC_IMPORT
+#endif
+
+#ifdef DebugPrint
+#undef DebugPrint
+#endif
+
+#if DBG
+#define DebugPrint(x) ChangerClassDebugPrint x
+#else
+#define DebugPrint(x)
+#endif
+
+#define MAXIMUM_CHANGER_INQUIRY_DATA 252
+
+CHANGERAPI
+PVOID
+DDKAPI
+ChangerClassAllocatePool(
+ IN POOL_TYPE PoolType,
+ IN ULONG NumberOfBytes);
+
+VOID
+ChangerClassDebugPrint(
+ ULONG DebugPrintLevel,
+ PCCHAR DebugMessage,
+ ...);
+
+CHANGERAPI
+PVOID
+DDKAPI
+ChangerClassFreePool(
+ IN PVOID PoolToFree);
+
+CHANGERAPI
+NTSTATUS
+DDKAPI
+ChangerClassSendSrbSynchronous(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PSCSI_REQUEST_BLOCK Srb,
+ IN PVOID Buffer,
+ IN ULONG BufferSize,
+ IN BOOLEAN WriteToDevice);
+
+
+typedef NTSTATUS DDKAPI
+(*CHANGER_INITIALIZE)(
+ IN PDEVICE_OBJECT DeviceObject);
+
+typedef ULONG DDKAPI
+(*CHANGER_EXTENSION_SIZE)(
+ VOID);
+
+typedef VOID DDKAPI
+(*CHANGER_ERROR_ROUTINE)(
+ PDEVICE_OBJECT DeviceObject,
+ PSCSI_REQUEST_BLOCK Srb,
+ NTSTATUS *Status,
+ BOOLEAN *Retry);
+
+typedef NTSTATUS DDKAPI
+(*CHANGER_COMMAND_ROUTINE)(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
+
+typedef NTSTATUS DDKAPI
+(*CHANGER_PERFORM_DIAGNOSTICS)(
+ IN PDEVICE_OBJECT DeviceObject,
+ OUT PWMI_CHANGER_PROBLEM_DEVICE_ERROR ChangerDeviceError);
+
+typedef struct _MCD_INIT_DATA {
+ ULONG InitDataSize;
+ CHANGER_EXTENSION_SIZE ChangerAdditionalExtensionSize;
+ CHANGER_INITIALIZE ChangerInitialize;
+ CHANGER_ERROR_ROUTINE ChangerError;
+ CHANGER_PERFORM_DIAGNOSTICS ChangerPerformDiagnostics;
+ CHANGER_COMMAND_ROUTINE ChangerGetParameters;
+ CHANGER_COMMAND_ROUTINE ChangerGetStatus;
+ CHANGER_COMMAND_ROUTINE ChangerGetProductData;
+ CHANGER_COMMAND_ROUTINE ChangerSetAccess;
+ CHANGER_COMMAND_ROUTINE ChangerGetElementStatus;
+ CHANGER_COMMAND_ROUTINE ChangerInitializeElementStatus;
+ CHANGER_COMMAND_ROUTINE ChangerSetPosition;
+ CHANGER_COMMAND_ROUTINE ChangerExchangeMedium;
+ CHANGER_COMMAND_ROUTINE ChangerMoveMedium;
+ CHANGER_COMMAND_ROUTINE ChangerReinitializeUnit;
+ CHANGER_COMMAND_ROUTINE ChangerQueryVolumeTags;
+} MCD_INIT_DATA, *PMCD_INIT_DATA;
+
+CHANGERAPI
+NTSTATUS
+DDKAPI
+ChangerClassInitialize(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PUNICODE_STRING RegistryPath,
+ IN PMCD_INIT_DATA MCDInitData);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MCD_H */
--- /dev/null
+/*
+ * miniport.h
+ *
+ * Type definitions for miniport drivers
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __MINIPORT_H
+#define __MINIPORT_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define EMULATOR_READ_ACCESS 0x01
+#define EMULATOR_WRITE_ACCESS 0x02
+
+typedef struct _EMULATOR_ACCESS_ENTRY {
+ ULONG BasePort;
+ ULONG NumConsecutivePorts;
+ EMULATOR_PORT_ACCESS_TYPE AccessType;
+ UCHAR AccessMode;
+ UCHAR StringSupport;
+ PVOID Routine;
+} EMULATOR_ACCESS_ENTRY, *PEMULATOR_ACCESS_ENTRY;
+
+typedef enum _EMULATOR_PORT_ACCESS_TYPE {
+ Uchar,
+ Ushort,
+ Ulong
+} EMULATOR_PORT_ACCESS_TYPE, *PEMULATOR_PORT_ACCESS_TYPE;
+
+typedef struct _VIDEO_ACCESS_RANGE {
+ PHYSICAL_ADDRESS RangeStart;
+ ULONG RangeLength;
+ UCHAR RangeInIoSpace;
+ UCHAR RangeVisible;
+ UCHAR RangeShareable;
+ UCHAR RangePassive;
+} VIDEO_ACCESS_RANGE, *PVIDEO_ACCESS_RANGE;
+
+typedef VOID DDKAPI
+(*PBANKED_SECTION_ROUTINE)(
+ IN ULONG ReadBank,
+ IN ULONG WriteBank,
+ IN PVOID Context);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MINIPORT_H */
--- /dev/null
+/*
+ * minitape.h
+ *
+ * Minitape driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+#ifndef __MINITAPE_H
+#define __MINITAPE_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#define MEDIA_ERASEABLE 0x00000001
+#define MEDIA_WRITE_ONCE 0x00000002
+#define MEDIA_READ_ONLY 0x00000004
+#define MEDIA_READ_WRITE 0x00000008
+#define MEDIA_WRITE_PROTECTED 0x00000100
+#define MEDIA_CURRENTLY_MOUNTED 0x80000000
+
+typedef enum _TAPE_STATUS {
+ TAPE_STATUS_SEND_SRB_AND_CALLBACK,
+ TAPE_STATUS_CALLBACK,
+ TAPE_STATUS_CHECK_TEST_UNIT_READY,
+ TAPE_STATUS_SUCCESS,
+ TAPE_STATUS_INSUFFICIENT_RESOURCES,
+ TAPE_STATUS_NOT_IMPLEMENTED,
+ TAPE_STATUS_INVALID_DEVICE_REQUEST,
+ TAPE_STATUS_INVALID_PARAMETER,
+ TAPE_STATUS_MEDIA_CHANGED,
+ TAPE_STATUS_BUS_RESET,
+ TAPE_STATUS_SETMARK_DETECTED,
+ TAPE_STATUS_FILEMARK_DETECTED,
+ TAPE_STATUS_BEGINNING_OF_MEDIA,
+ TAPE_STATUS_END_OF_MEDIA,
+ TAPE_STATUS_BUFFER_OVERFLOW,
+ TAPE_STATUS_NO_DATA_DETECTED,
+ TAPE_STATUS_EOM_OVERFLOW,
+ TAPE_STATUS_NO_MEDIA,
+ TAPE_STATUS_IO_DEVICE_ERROR,
+ TAPE_STATUS_UNRECOGNIZED_MEDIA,
+ TAPE_STATUS_DEVICE_NOT_READY,
+ TAPE_STATUS_MEDIA_WRITE_PROTECTED,
+ TAPE_STATUS_DEVICE_DATA_ERROR,
+ TAPE_STATUS_NO_SUCH_DEVICE,
+ TAPE_STATUS_INVALID_BLOCK_LENGTH,
+ TAPE_STATUS_IO_TIMEOUT,
+ TAPE_STATUS_DEVICE_NOT_CONNECTED,
+ TAPE_STATUS_DATA_OVERRUN,
+ TAPE_STATUS_DEVICE_BUSY,
+ TAPE_STATUS_REQUIRES_CLEANING,
+ TAPE_STATUS_CLEANER_CARTRIDGE_INSTALLED
+} TAPE_STATUS, *PTAPE_STATUS;
+
+#define INQUIRYDATABUFFERSIZE 36
+
+typedef struct _INQUIRYDATA {
+ UCHAR DeviceType : 5;
+ UCHAR DeviceTypeQualifier : 3;
+ UCHAR DeviceTypeModifier : 7;
+ UCHAR RemovableMedia : 1;
+ union {
+ UCHAR Versions;
+ struct {
+ UCHAR ANSIVersion : 3;
+ UCHAR ECMAVersion : 3;
+ UCHAR ISOVersion : 2;
+ };
+ };
+ UCHAR ResponseDataFormat : 4;
+ UCHAR HiSupport : 1;
+ UCHAR NormACA : 1;
+ UCHAR TerminateTask : 1;
+ UCHAR AERC : 1;
+ UCHAR AdditionalLength;
+ UCHAR Reserved;
+ UCHAR Addr16 : 1;
+ UCHAR Addr32 : 1;
+ UCHAR AckReqQ: 1;
+ UCHAR MediumChanger : 1;
+ UCHAR MultiPort : 1;
+ UCHAR ReservedBit2 : 1;
+ UCHAR EnclosureServices : 1;
+ UCHAR ReservedBit3 : 1;
+ UCHAR SoftReset : 1;
+ UCHAR CommandQueue : 1;
+ UCHAR TransferDisable : 1;
+ UCHAR LinkedCommands : 1;
+ UCHAR Synchronous : 1;
+ UCHAR Wide16Bit : 1;
+ UCHAR Wide32Bit : 1;
+ UCHAR RelativeAddressing : 1;
+ UCHAR VendorId[8];
+ UCHAR ProductId[16];
+ UCHAR ProductRevisionLevel[4];
+ UCHAR VendorSpecific[20];
+ UCHAR Reserved3[40];
+} INQUIRYDATA, *PINQUIRYDATA;
+
+typedef struct _MODE_CAPABILITIES_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved1 : 2;
+ UCHAR PageLength;
+ UCHAR Reserved2[2];
+ UCHAR RO : 1;
+ UCHAR Reserved3 : 4;
+ UCHAR SPREV : 1;
+ UCHAR Reserved4 : 2;
+ UCHAR Reserved5 : 3;
+ UCHAR EFMT : 1;
+ UCHAR Reserved6 : 1;
+ UCHAR QFA : 1;
+ UCHAR Reserved7 : 2;
+ UCHAR LOCK : 1;
+ UCHAR LOCKED : 1;
+ UCHAR PREVENT : 1;
+ UCHAR UNLOAD : 1;
+ UCHAR Reserved8 : 2;
+ UCHAR ECC : 1;
+ UCHAR CMPRS : 1;
+ UCHAR Reserved9 : 1;
+ UCHAR BLK512 : 1;
+ UCHAR BLK1024 : 1;
+ UCHAR Reserved10 : 4;
+ UCHAR SLOWB : 1;
+ UCHAR MaximumSpeedSupported[2];
+ UCHAR MaximumStoredDefectedListEntries[2];
+ UCHAR ContinuousTransferLimit[2];
+ UCHAR CurrentSpeedSelected[2];
+ UCHAR BufferSize[2];
+ UCHAR Reserved11[2];
+} MODE_CAPABILITIES_PAGE, *PMODE_CAPABILITIES_PAGE;
+
+typedef BOOLEAN DDKAPI
+(*TAPE_VERIFY_INQUIRY_ROUTINE)(
+ IN PINQUIRYDATA InquiryData,
+ IN PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage);
+
+typedef VOID DDKAPI
+(*TAPE_EXTENSION_INIT_ROUTINE)(
+ IN PVOID MinitapeExtension,
+ IN PINQUIRYDATA InquiryData,
+ IN PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage);
+
+typedef VOID DDKAPI
+(*TAPE_ERROR_ROUTINE)(
+ IN PVOID MinitapeExtension,
+ IN PSCSI_REQUEST_BLOCK Srb,
+ IN OUT PTAPE_STATUS TapeStatus);
+
+typedef TAPE_STATUS DDKAPI
+(*TAPE_PROCESS_COMMAND_ROUTINE)(
+ IN OUT PVOID MinitapeExtension,
+ IN OUT PVOID CommandExtension,
+ IN OUT PVOID CommandParameters,
+ IN OUT PSCSI_REQUEST_BLOCK Srb,
+ IN ULONG CallNumber,
+ IN TAPE_STATUS StatusOfLastCommand,
+ IN OUT PULONG RetryFlags);
+
+#define TAPE_RETRY_MASK 0x0000FFFF
+#define IGNORE_ERRORS 0x00010000
+#define RETURN_ERRORS 0x00020000
+
+typedef struct _TAPE_INIT_DATA {
+ TAPE_VERIFY_INQUIRY_ROUTINE VerifyInquiry;
+ BOOLEAN QueryModeCapabilitiesPage;
+ ULONG MinitapeExtensionSize;
+ TAPE_EXTENSION_INIT_ROUTINE ExtensionInit;
+ ULONG DefaultTimeOutValue;
+ TAPE_ERROR_ROUTINE TapeError;
+ ULONG CommandExtensionSize;
+ TAPE_PROCESS_COMMAND_ROUTINE CreatePartition;
+ TAPE_PROCESS_COMMAND_ROUTINE Erase;
+ TAPE_PROCESS_COMMAND_ROUTINE GetDriveParameters;
+ TAPE_PROCESS_COMMAND_ROUTINE GetMediaParameters;
+ TAPE_PROCESS_COMMAND_ROUTINE GetPosition;
+ TAPE_PROCESS_COMMAND_ROUTINE GetStatus;
+ TAPE_PROCESS_COMMAND_ROUTINE Prepare;
+ TAPE_PROCESS_COMMAND_ROUTINE SetDriveParameters;
+ TAPE_PROCESS_COMMAND_ROUTINE SetMediaParameters;
+ TAPE_PROCESS_COMMAND_ROUTINE SetPosition;
+ TAPE_PROCESS_COMMAND_ROUTINE WriteMarks;
+ TAPE_PROCESS_COMMAND_ROUTINE PreProcessReadWrite; /* optional */
+} TAPE_INIT_DATA, *PTAPE_INIT_DATA;
+
+typedef struct _TAPE_PHYS_POSITION {
+ ULONG SeekBlockAddress;
+ ULONG SpaceBlockCount;
+} TAPE_PHYS_POSITION, PTAPE_PHYS_POSITION;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MINITAPE_H */
--- /dev/null
+/*
+ * mountdev.h
+ *
+ * Mount point manager/mounted devices interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __MOUNTDEV_H
+#define __MOUNTDEV_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "mountmgr.h"
+
+
+#define IOCTL_MOUNTDEV_QUERY_DEVICE_NAME \
+ CTL_CODE(MOUNTDEVCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_MOUNTDEV_QUERY_UNIQUE_ID \
+ CTL_CODE(MOUNTDEVCONTROLTYPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY \
+ CTL_CODE(MOUNTDEVCONTROLTYPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME \
+ CTL_CODE(MOUNTDEVCONTROLTYPE, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_MOUNTDEV_LINK_CREATED \
+ CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_MOUNTDEV_LINK_DELETED \
+ CTL_CODE(MOUNTDEVCONTROLTYPE, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+typedef struct _MOUNTDEV_SUGGESTED_LINK_NAME {
+ BOOLEAN UseOnlyIfThereAreNoOtherLinks;
+ USHORT NameLength;
+ WCHAR Name[1];
+} MOUNTDEV_SUGGESTED_LINK_NAME, *PMOUNTDEV_SUGGESTED_LINK_NAME;
+
+typedef struct _MOUNTDEV_UNIQUE_ID {
+ USHORT UniqueIdLength;
+ UCHAR UniqueId[1];
+} MOUNTDEV_UNIQUE_ID, *PMOUNTDEV_UNIQUE_ID;
+
+typedef struct _MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY_OUTPUT {
+ ULONG Size;
+ USHORT OldUniqueIdOffset;
+ USHORT OldUniqueIdLength;
+ USHORT NewUniqueIdOffset;
+ USHORT NewUniqueIdLength;
+} MOUNTDEV_UNIQUE_ID_CHANGE_NOTIFY_OUTPUT;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MOUNTDEV_H */
--- /dev/null
+/*
+ * mountmgr.h
+ *
+ * Mount point manager interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __MOUNTMGR_H
+#define __MOUNTMGR_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+DEFINE_GUID(MOUNTDEV_MOUNTED_DEVICE_GUID,
+ 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+#define MOUNTMGRCONTROLTYPE ((ULONG)'m')
+#define MOUNTDEVCONTROLTYPE ((ULONG)'M')
+
+#define MOUNTMGR_DEVICE_NAME L"\\Device\\MountPointManager"
+#define MOUNTMGR_DOS_DEVICE_NAME L"\\\\.\\MountPointManager"
+
+#define IOCTL_MOUNTMGR_CREATE_POINT \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_QUERY_POINTS \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_MOUNTMGR_DELETE_POINTS \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 4, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 5, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 6, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_CHANGE_NOTIFY \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 8, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 9, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION \
+ CTL_CODE(MOUNTMGRCONTROLTYPE, 11, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+
+typedef struct _MOUNTDEV_NAME {
+ USHORT NameLength;
+ WCHAR Name[1];
+} MOUNTDEV_NAME, *PMOUNTDEV_NAME;
+
+typedef struct _MOUNTMGR_CHANGE_NOTIFY_INFO {
+ ULONG EpicNumber;
+} MOUNTMGR_CHANGE_NOTIFY_INFO, *PMOUNTMGR_CHANGE_NOTIFY_INFO;
+
+typedef struct _MOUNTMGR_CREATE_POINT_INPUT {
+ USHORT SymbolicLinkNameOffset;
+ USHORT SymbolicLinkNameLength;
+ USHORT DeviceNameOffset;
+ USHORT DeviceNameLength;
+} MOUNTMGR_CREATE_POINT_INPUT, *PMOUNTMGR_CREATE_POINT_INPUT;
+
+typedef struct _MOUNTMGR_DRIVE_LETTER_INFORMATION {
+ BOOLEAN DriveLetterWasAssigned;
+ UCHAR CurrentDriveLetter;
+} MOUNTMGR_DRIVE_LETTER_INFORMATION, *PMOUNTMGR_DRIVE_LETTER_INFORMATION;
+
+typedef struct _MOUNTMGR_DRIVE_LETTER_TARGET {
+ USHORT DeviceNameLength;
+ WCHAR DeviceName[1];
+} MOUNTMGR_DRIVE_LETTER_TARGET, *PMOUNTMGR_DRIVE_LETTER_TARGET;
+
+typedef struct _MOUNTMGR_MOUNT_POINT {
+ ULONG SymbolicLinkNameOffset;
+ USHORT SymbolicLinkNameLength;
+ ULONG UniqueIdOffset;
+ USHORT UniqueIdLength;
+ ULONG DeviceNameOffset;
+ USHORT DeviceNameLength;
+} MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT;
+
+typedef struct _MOUNTMGR_MOUNT_POINTS {
+ ULONG Size;
+ ULONG NumberOfMountPoints;
+ MOUNTMGR_MOUNT_POINT MountPoints[1];
+} MOUNTMGR_MOUNT_POINTS, *PMOUNTMGR_MOUNT_POINTS;
+
+typedef struct _MOUNTMGR_TARGET_NAME {
+ USHORT DeviceNameLength;
+ WCHAR DeviceName[1];
+} MOUNTMGR_TARGET_NAME, *PMOUNTMGR_TARGET_NAME;
+
+typedef struct _MOUNTMGR_VOLUME_MOUNT_POINT {
+ USHORT SourceVolumeNameOffset;
+ USHORT SourceVolumeNameLength;
+ USHORT TargetVolumeNameOffset;
+ USHORT TargetVolumeNameLength;
+} MOUNTMGR_VOLUME_MOUNT_POINT, *PMOUNTMGR_VOLUME_MOUNT_POINT;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MOUNTMGR_H */
--- /dev/null
+/*
+ * ndis.h
+ *
+ * Network Device Interface Specification definitions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * DEFINES: i386 - Target platform is i386
+ * _NDIS_ - Define only for NDIS library
+ * NDIS_MINIPORT_DRIVER - Define only for NDIS miniport drivers
+ * NDIS40 - Use NDIS 4.0 structures by default
+ * NDIS50 - Use NDIS 5.0 structures by default
+ * NDIS50_MINIPORT - Building NDIS 5.0 miniport driver
+ * NDIS51_MINIPORT - Building NDIS 5.1 miniport driver
+ */
+#ifndef __NDIS_H
+#define __NDIS_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddndis.h"
+#include "netpnp.h"
+#include "netevent.h"
+#include <winsock2.h>
+
+#if defined(_NDIS_)
+ #define NDISAPI DECLSPEC_EXPORT
+#else
+ #define NDISAPI DECLSPEC_IMPORT
+#endif
+
+#if defined(NDIS50_MINIPORT)
+#ifndef NDIS50
+#define NDIS50
+#endif
+#endif /* NDIS50_MINIPORT */
+
+#if defined(NDIS51_MINIPORT)
+#ifndef NDIS51
+#define NDIS51
+#endif
+#endif /* NDIS51_MINIPORT */
+
+/* NDIS 3.0 is default */
+#if !defined(NDIS30) || !defined(NDIS40) || !defined(NDIS50) || !defined(NDIS51)
+#define NDIS30
+#endif /* !NDIS30 || !NDIS40 || !NDIS50 || !NDIS51 */
+
+#if 1
+/* FIXME: */
+typedef PVOID QUEUED_CLOSE;
+#endif
+
+typedef ULONG NDIS_OID, *PNDIS_OID;
+
+typedef struct _X_FILTER FDDI_FILTER, *PFDDI_FILTER;
+typedef struct _X_FILTER TR_FILTER, *PTR_FILTER;
+typedef struct _X_FILTER NULL_FILTER, *PNULL_FILTER;
+
+typedef struct _REFERENCE {
+ KSPIN_LOCK SpinLock;
+ USHORT ReferenceCount;
+ BOOLEAN Closing;
+} REFERENCE, * PREFERENCE;
+
+
+/* NDIS base types */
+
+typedef struct _NDIS_SPIN_LOCK {
+ KSPIN_LOCK SpinLock;
+ KIRQL OldIrql;
+} NDIS_SPIN_LOCK, * PNDIS_SPIN_LOCK;
+
+typedef struct _NDIS_EVENT {
+ KEVENT Event;
+} NDIS_EVENT, *PNDIS_EVENT;
+
+typedef PVOID NDIS_HANDLE, *PNDIS_HANDLE;
+typedef int NDIS_STATUS, *PNDIS_STATUS;
+
+typedef ANSI_STRING NDIS_ANSI_STRING, *PNDIS_ANSI_STRING;
+typedef UNICODE_STRING NDIS_STRING, *PNDIS_STRING;
+
+typedef MDL NDIS_BUFFER, *PNDIS_BUFFER;
+typedef ULONG NDIS_ERROR_CODE, *PNDIS_ERROR_CODE;
+
+
+/* NDIS_STATUS constants */
+#define NDIS_STATUS_SUCCESS ((NDIS_STATUS)STATUS_SUCCESS)
+#define NDIS_STATUS_PENDING ((NDIS_STATUS)STATUS_PENDING)
+#define NDIS_STATUS_NOT_RECOGNIZED ((NDIS_STATUS)0x00010001L)
+#define NDIS_STATUS_NOT_COPIED ((NDIS_STATUS)0x00010002L)
+#define NDIS_STATUS_NOT_ACCEPTED ((NDIS_STATUS)0x00010003L)
+#define NDIS_STATUS_CALL_ACTIVE ((NDIS_STATUS)0x00010007L)
+#define NDIS_STATUS_ONLINE ((NDIS_STATUS)0x40010003L)
+#define NDIS_STATUS_RESET_START ((NDIS_STATUS)0x40010004L)
+#define NDIS_STATUS_RESET_END ((NDIS_STATUS)0x40010005L)
+#define NDIS_STATUS_RING_STATUS ((NDIS_STATUS)0x40010006L)
+#define NDIS_STATUS_CLOSED ((NDIS_STATUS)0x40010007L)
+#define NDIS_STATUS_WAN_LINE_UP ((NDIS_STATUS)0x40010008L)
+#define NDIS_STATUS_WAN_LINE_DOWN ((NDIS_STATUS)0x40010009L)
+#define NDIS_STATUS_WAN_FRAGMENT ((NDIS_STATUS)0x4001000AL)
+#define NDIS_STATUS_MEDIA_CONNECT ((NDIS_STATUS)0x4001000BL)
+#define NDIS_STATUS_MEDIA_DISCONNECT ((NDIS_STATUS)0x4001000CL)
+#define NDIS_STATUS_HARDWARE_LINE_UP ((NDIS_STATUS)0x4001000DL)
+#define NDIS_STATUS_HARDWARE_LINE_DOWN ((NDIS_STATUS)0x4001000EL)
+#define NDIS_STATUS_INTERFACE_UP ((NDIS_STATUS)0x4001000FL)
+#define NDIS_STATUS_INTERFACE_DOWN ((NDIS_STATUS)0x40010010L)
+#define NDIS_STATUS_MEDIA_BUSY ((NDIS_STATUS)0x40010011L)
+#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION ((NDIS_STATUS)0x40010012L)
+#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION
+#define NDIS_STATUS_LINK_SPEED_CHANGE ((NDIS_STATUS)0x40010013L)
+#define NDIS_STATUS_WAN_GET_STATS ((NDIS_STATUS)0x40010014L)
+#define NDIS_STATUS_WAN_CO_FRAGMENT ((NDIS_STATUS)0x40010015L)
+#define NDIS_STATUS_WAN_CO_LINKPARAMS ((NDIS_STATUS)0x40010016L)
+
+#define NDIS_STATUS_NOT_RESETTABLE ((NDIS_STATUS)0x80010001L)
+#define NDIS_STATUS_SOFT_ERRORS ((NDIS_STATUS)0x80010003L)
+#define NDIS_STATUS_HARD_ERRORS ((NDIS_STATUS)0x80010004L)
+#define NDIS_STATUS_BUFFER_OVERFLOW ((NDIS_STATUS)STATUS_BUFFER_OVERFLOW)
+
+#define NDIS_STATUS_FAILURE ((NDIS_STATUS)STATUS_UNSUCCESSFUL)
+#define NDIS_STATUS_RESOURCES ((NDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES)
+#define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L)
+#define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)
+#define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L)
+#define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L)
+#define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L)
+#define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L)
+#define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L)
+#define NDIS_STATUS_MULTICAST_EXISTS ((NDIS_STATUS)0xC001000AL)
+#define NDIS_STATUS_MULTICAST_NOT_FOUND ((NDIS_STATUS)0xC001000BL)
+#define NDIS_STATUS_REQUEST_ABORTED ((NDIS_STATUS)0xC001000CL)
+#define NDIS_STATUS_RESET_IN_PROGRESS ((NDIS_STATUS)0xC001000DL)
+#define NDIS_STATUS_CLOSING_INDICATING ((NDIS_STATUS)0xC001000EL)
+#define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED)
+#define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL)
+#define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L)
+#define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L)
+#define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L)
+#define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L)
+#define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
+#define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L)
+#define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
+#define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L)
+#define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L)
+#define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L)
+#define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL)
+#define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL)
+#define NDIS_STATUS_ERROR_READING_FILE ((NDIS_STATUS)0xC001001CL)
+#define NDIS_STATUS_ALREADY_MAPPED ((NDIS_STATUS)0xC001001DL)
+#define NDIS_STATUS_RESOURCE_CONFLICT ((NDIS_STATUS)0xC001001EL)
+#define NDIS_STATUS_NO_CABLE ((NDIS_STATUS)0xC001001FL)
+
+#define NDIS_STATUS_INVALID_SAP ((NDIS_STATUS)0xC0010020L)
+#define NDIS_STATUS_SAP_IN_USE ((NDIS_STATUS)0xC0010021L)
+#define NDIS_STATUS_INVALID_ADDRESS ((NDIS_STATUS)0xC0010022L)
+#define NDIS_STATUS_VC_NOT_ACTIVATED ((NDIS_STATUS)0xC0010023L)
+#define NDIS_STATUS_DEST_OUT_OF_ORDER ((NDIS_STATUS)0xC0010024L)
+#define NDIS_STATUS_VC_NOT_AVAILABLE ((NDIS_STATUS)0xC0010025L)
+#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((NDIS_STATUS)0xC0010026L)
+#define NDIS_STATUS_INCOMPATABLE_QOS ((NDIS_STATUS)0xC0010027L)
+#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((NDIS_STATUS)0xC0010028L)
+#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((NDIS_STATUS)0xC0010029L)
+
+#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR ((NDIS_STATUS)0xC0011000L)
+#define NDIS_STATUS_INVALID_DEVICE_REQUEST ((NDIS_STATUS)STATUS_INVALID_DEVICE_REQUEST)
+#define NDIS_STATUS_NETWORK_UNREACHABLE ((NDIS_STATUS)STATUS_NETWORK_UNREACHABLE)
+
+
+/* NDIS error codes for error logging */
+
+#define NDIS_ERROR_CODE_RESOURCE_CONFLICT EVENT_NDIS_RESOURCE_CONFLICT
+#define NDIS_ERROR_CODE_OUT_OF_RESOURCES EVENT_NDIS_OUT_OF_RESOURCE
+#define NDIS_ERROR_CODE_HARDWARE_FAILURE EVENT_NDIS_HARDWARE_FAILURE
+#define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND EVENT_NDIS_ADAPTER_NOT_FOUND
+#define NDIS_ERROR_CODE_INTERRUPT_CONNECT EVENT_NDIS_INTERRUPT_CONNECT
+#define NDIS_ERROR_CODE_DRIVER_FAILURE EVENT_NDIS_DRIVER_FAILURE
+#define NDIS_ERROR_CODE_BAD_VERSION EVENT_NDIS_BAD_VERSION
+#define NDIS_ERROR_CODE_TIMEOUT EVENT_NDIS_TIMEOUT
+#define NDIS_ERROR_CODE_NETWORK_ADDRESS EVENT_NDIS_NETWORK_ADDRESS
+#define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION EVENT_NDIS_UNSUPPORTED_CONFIGURATION
+#define NDIS_ERROR_CODE_INVALID_VALUE_FROM_ADAPTER EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER
+#define NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER
+#define NDIS_ERROR_CODE_BAD_IO_BASE_ADDRESS EVENT_NDIS_BAD_IO_BASE_ADDRESS
+#define NDIS_ERROR_CODE_RECEIVE_SPACE_SMALL EVENT_NDIS_RECEIVE_SPACE_SMALL
+#define NDIS_ERROR_CODE_ADAPTER_DISABLED EVENT_NDIS_ADAPTER_DISABLED
+
+
+/* Memory allocation flags. Used by Ndis[Allocate|Free]Memory */
+#define NDIS_MEMORY_CONTIGUOUS 0x00000001
+#define NDIS_MEMORY_NONCACHED 0x00000002
+
+/* NIC attribute flags. Used by NdisMSetAttributes(Ex) */
+#define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001
+#define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002
+#define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004
+#define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008
+#define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010
+#define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020
+#define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040
+#define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080
+#define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100
+#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200
+
+
+/* Lock */
+
+typedef union _NDIS_RW_LOCK_REFCOUNT {
+ UINT RefCount;
+ UCHAR cacheLine[16];
+} NDIS_RW_LOCK_REFCOUNT;
+
+typedef struct _NDIS_RW_LOCK {
+ union {
+ struct {
+ KSPIN_LOCK SpinLock;
+ PVOID Context;
+ } s;
+ UCHAR Reserved[16];
+ } u;
+
+ NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS];
+} NDIS_RW_LOCK, *PNDIS_RW_LOCK;
+
+typedef struct _LOCK_STATE {
+ USHORT LockState;
+ KIRQL OldIrql;
+} LOCK_STATE, *PLOCK_STATE;
+
+
+
+/* Timer */
+
+typedef VOID DDKAPI
+(*PNDIS_TIMER_FUNCTION)(
+ IN PVOID SystemSpecific1,
+ IN PVOID FunctionContext,
+ IN PVOID SystemSpecific2,
+ IN PVOID SystemSpecific3);
+
+typedef struct _NDIS_TIMER {
+ KTIMER Timer;
+ KDPC Dpc;
+} NDIS_TIMER, *PNDIS_TIMER;
+
+
+
+/* Hardware */
+
+typedef CM_MCA_POS_DATA NDIS_MCA_POS_DATA, *PNDIS_MCA_POS_DATA;
+typedef CM_EISA_SLOT_INFORMATION NDIS_EISA_SLOT_INFORMATION, *PNDIS_EISA_SLOT_INFORMATION;
+typedef CM_EISA_FUNCTION_INFORMATION NDIS_EISA_FUNCTION_INFORMATION, *PNDIS_EISA_FUNCTION_INFORMATION;
+typedef CM_PARTIAL_RESOURCE_LIST NDIS_RESOURCE_LIST, *PNDIS_RESOURCE_LIST;
+
+/* Hardware status codes (OID_GEN_HARDWARE_STATUS) */
+typedef enum _NDIS_HARDWARE_STATUS {
+ NdisHardwareStatusReady,
+ NdisHardwareStatusInitializing,
+ NdisHardwareStatusReset,
+ NdisHardwareStatusClosing,
+ NdisHardwareStatusNotReady
+} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS;
+
+/* OID_GEN_GET_TIME_CAPS */
+typedef struct _GEN_GET_TIME_CAPS {
+ ULONG Flags;
+ ULONG ClockPrecision;
+} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS;
+
+/* Flag bits */
+#define READABLE_LOCAL_CLOCK 0x00000001
+#define CLOCK_NETWORK_DERIVED 0x00000002
+#define CLOCK_PRECISION 0x00000004
+#define RECEIVE_TIME_INDICATION_CAPABLE 0x00000008
+#define TIMED_SEND_CAPABLE 0x00000010
+#define TIME_STAMP_CAPABLE 0x00000020
+
+/* OID_GEN_GET_NETCARD_TIME */
+typedef struct _GEN_GET_NETCARD_TIME {
+ ULONGLONG ReadTime;
+} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME;
+
+/* NDIS driver medium (OID_GEN_MEDIA_SUPPORTED / OID_GEN_MEDIA_IN_USE) */
+typedef enum _NDIS_MEDIUM {
+ NdisMedium802_3,
+ NdisMedium802_5,
+ NdisMediumFddi,
+ NdisMediumWan,
+ NdisMediumLocalTalk,
+ NdisMediumDix,
+ NdisMediumArcnetRaw,
+ NdisMediumArcnet878_2,
+ NdisMediumAtm,
+ NdisMediumWirelessWan,
+ NdisMediumIrda,
+ NdisMediumBpc,
+ NdisMediumCoWan,
+ NdisMedium1394,
+ NdisMediumMax
+} NDIS_MEDIUM, *PNDIS_MEDIUM;
+
+/* NDIS packet filter bits (OID_GEN_CURRENT_PACKET_FILTER) */
+#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
+#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
+#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
+#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
+#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
+#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
+#define NDIS_PACKET_TYPE_SMT 0x00000040
+#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
+#define NDIS_PACKET_TYPE_GROUP 0x00001000
+#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
+#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
+#define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
+
+/* NDIS protocol option bits (OID_GEN_PROTOCOL_OPTIONS) */
+#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001
+#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002
+#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004
+
+/* NDIS MAC option bits (OID_GEN_MAC_OPTIONS) */
+#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
+#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
+#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
+#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
+#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
+#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
+#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
+#define NDIS_MAC_OPTION_RESERVED 0x80000000
+
+/* State of the LAN media (OID_GEN_MEDIA_CONNECT_STATUS) */
+typedef enum _NDIS_MEDIA_STATE {
+ NdisMediaStateConnected,
+ NdisMediaStateDisconnected
+} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE;
+
+/* OID_GEN_SUPPORTED_GUIDS */
+typedef struct _NDIS_GUID {
+ GUID Guid;
+ union {
+ NDIS_OID Oid;
+ NDIS_STATUS Status;
+ } u;
+ ULONG Size;
+ ULONG Flags;
+} NDIS_GUID, *PNDIS_GUID;
+
+#define NDIS_GUID_TO_OID 0x00000001
+#define NDIS_GUID_TO_STATUS 0x00000002
+#define NDIS_GUID_ANSI_STRING 0x00000004
+#define NDIS_GUID_UNICODE_STRING 0x00000008
+#define NDIS_GUID_ARRAY 0x00000010
+
+
+typedef struct _NDIS_PACKET_POOL {
+ NDIS_SPIN_LOCK SpinLock;
+ struct _NDIS_PACKET *FreeList;
+ UINT PacketLength;
+ UCHAR Buffer[1];
+} NDIS_PACKET_POOL, * PNDIS_PACKET_POOL;
+
+/* NDIS_PACKET_PRIVATE.Flags constants */
+#define fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40
+#define fPACKET_ALLOCATED_BY_NDIS 0x80
+
+typedef struct _NDIS_PACKET_PRIVATE {
+ UINT PhysicalCount;
+ UINT TotalLength;
+ PNDIS_BUFFER Head;
+ PNDIS_BUFFER Tail;
+ PNDIS_PACKET_POOL Pool;
+ UINT Count;
+ ULONG Flags;
+ BOOLEAN ValidCounts;
+ UCHAR NdisPacketFlags;
+ USHORT NdisPacketOobOffset;
+} NDIS_PACKET_PRIVATE, * PNDIS_PACKET_PRIVATE;
+
+typedef struct _NDIS_PACKET {
+ NDIS_PACKET_PRIVATE Private;
+ union {
+ struct {
+ UCHAR MiniportReserved[2 * sizeof(PVOID)];
+ UCHAR WrapperReserved[2 * sizeof(PVOID)];
+ } s1;
+ struct {
+ UCHAR MiniportReservedEx[3 * sizeof(PVOID)];
+ UCHAR WrapperReservedEx[sizeof(PVOID)];
+ } s2;
+ struct {
+ UCHAR MacReserved[4 * sizeof(PVOID)];
+ } s3;
+ } u;
+ ULONG_PTR Reserved[2];
+ UCHAR ProtocolReserved[1];
+} NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
+
+typedef enum _NDIS_CLASS_ID {
+ NdisClass802_3Priority,
+ NdisClassWirelessWanMbxMailbox,
+ NdisClassIrdaPacketInfo,
+ NdisClassAtmAALInfo
+} NDIS_CLASS_ID;
+
+typedef struct MediaSpecificInformation {
+ UINT NextEntryOffset;
+ NDIS_CLASS_ID ClassId;
+ UINT Size;
+ UCHAR ClassInformation[1];
+} MEDIA_SPECIFIC_INFORMATION;
+
+typedef struct _NDIS_PACKET_OOB_DATA {
+ union {
+ ULONGLONG TimeToSend;
+ ULONGLONG TimeSent;
+ };
+ ULONGLONG TimeReceived;
+ UINT HeaderSize;
+ UINT SizeMediaSpecificInfo;
+ PVOID MediaSpecificInformation;
+ NDIS_STATUS Status;
+} NDIS_PACKET_OOB_DATA, *PNDIS_PACKET_OOB_DATA;
+
+typedef struct _NDIS_PM_PACKET_PATTERN {
+ ULONG Priority;
+ ULONG Reserved;
+ ULONG MaskSize;
+ ULONG PatternOffset;
+ ULONG PatternSize;
+ ULONG PatternFlags;
+} NDIS_PM_PACKET_PATTERN, *PNDIS_PM_PACKET_PATTERN;
+
+
+/* Request types used by NdisRequest */
+typedef enum _NDIS_REQUEST_TYPE {
+ NdisRequestQueryInformation,
+ NdisRequestSetInformation,
+ NdisRequestQueryStatistics,
+ NdisRequestOpen,
+ NdisRequestClose,
+ NdisRequestSend,
+ NdisRequestTransferData,
+ NdisRequestReset,
+ NdisRequestGeneric1,
+ NdisRequestGeneric2,
+ NdisRequestGeneric3,
+ NdisRequestGeneric4
+} NDIS_REQUEST_TYPE, *PNDIS_REQUEST_TYPE;
+
+typedef struct _NDIS_REQUEST {
+ UCHAR MacReserved[4 * sizeof(PVOID)];
+ NDIS_REQUEST_TYPE RequestType;
+ union _DATA {
+ struct QUERY_INFORMATION {
+ NDIS_OID Oid;
+ PVOID InformationBuffer;
+ UINT InformationBufferLength;
+ UINT BytesWritten;
+ UINT BytesNeeded;
+ } QUERY_INFORMATION;
+ struct SET_INFORMATION {
+ NDIS_OID Oid;
+ PVOID InformationBuffer;
+ UINT InformationBufferLength;
+ UINT BytesRead;
+ UINT BytesNeeded;
+ } SET_INFORMATION;
+ } DATA;
+#if (defined(NDIS50) || defined(NDIS51))
+ UCHAR NdisReserved[9 * sizeof(PVOID)];
+ union {
+ UCHAR CallMgrReserved[2 * sizeof(PVOID)];
+ UCHAR ProtocolReserved[2 * sizeof(PVOID)];
+ };
+ UCHAR MiniportReserved[2 * sizeof(PVOID)];
+#endif
+} NDIS_REQUEST, *PNDIS_REQUEST;
+
+
+
+/* Wide Area Networks definitions */
+
+typedef struct _NDIS_WAN_PACKET {
+ LIST_ENTRY WanPacketQueue;
+ PUCHAR CurrentBuffer;
+ ULONG CurrentLength;
+ PUCHAR StartBuffer;
+ PUCHAR EndBuffer;
+ PVOID ProtocolReserved1;
+ PVOID ProtocolReserved2;
+ PVOID ProtocolReserved3;
+ PVOID ProtocolReserved4;
+ PVOID MacReserved1;
+ PVOID MacReserved2;
+ PVOID MacReserved3;
+ PVOID MacReserved4;
+} NDIS_WAN_PACKET, *PNDIS_WAN_PACKET;
+
+
+
+/* DMA channel information */
+
+typedef struct _NDIS_DMA_DESCRIPTION {
+ BOOLEAN DemandMode;
+ BOOLEAN AutoInitialize;
+ BOOLEAN DmaChannelSpecified;
+ DMA_WIDTH DmaWidth;
+ DMA_SPEED DmaSpeed;
+ ULONG DmaPort;
+ ULONG DmaChannel;
+} NDIS_DMA_DESCRIPTION, *PNDIS_DMA_DESCRIPTION;
+
+typedef struct _NDIS_DMA_BLOCK {
+ PVOID MapRegisterBase;
+ KEVENT AllocationEvent;
+ PADAPTER_OBJECT SystemAdapterObject;
+ BOOLEAN InProgress;
+} NDIS_DMA_BLOCK, *PNDIS_DMA_BLOCK;
+
+
+/* Possible hardware architecture */
+typedef enum _NDIS_INTERFACE_TYPE {
+ NdisInterfaceInternal = Internal,
+ NdisInterfaceIsa = Isa,
+ NdisInterfaceEisa = Eisa,
+ NdisInterfaceMca = MicroChannel,
+ NdisInterfaceTurboChannel = TurboChannel,
+ NdisInterfacePci = PCIBus,
+ NdisInterfacePcMcia = PCMCIABus,
+ NdisInterfaceCBus = CBus,
+ NdisInterfaceMPIBus = MPIBus,
+ NdisInterfaceMPSABus = MPSABus,
+ NdisInterfaceProcessorInternal = ProcessorInternal,
+ NdisInterfaceInternalPowerBus = InternalPowerBus,
+ NdisInterfacePNPISABus = PNPISABus,
+ NdisInterfacePNPBus = PNPBus,
+ NdisMaximumInterfaceType
+} NDIS_INTERFACE_TYPE, *PNDIS_INTERFACE_TYPE;
+
+#define NdisInterruptLevelSensitive LevelSensitive
+#define NdisInterruptLatched Latched
+typedef KINTERRUPT_MODE NDIS_INTERRUPT_MODE, *PNDIS_INTERRUPT_MODE;
+
+
+typedef enum _NDIS_PARAMETER_TYPE {
+ NdisParameterInteger,
+ NdisParameterHexInteger,
+ NdisParameterString,
+ NdisParameterMultiString,
+ NdisParameterBinary
+} NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE;
+
+typedef struct {
+ USHORT Length;
+ PVOID Buffer;
+} BINARY_DATA;
+
+typedef struct _NDIS_CONFIGURATION_PARAMETER {
+ NDIS_PARAMETER_TYPE ParameterType;
+ union {
+ ULONG IntegerData;
+ NDIS_STRING StringData;
+ BINARY_DATA BinaryData;
+ } ParameterData;
+} NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;
+
+
+typedef PHYSICAL_ADDRESS NDIS_PHYSICAL_ADDRESS, *PNDIS_PHYSICAL_ADDRESS;
+
+typedef struct _NDIS_PHYSICAL_ADDRESS_UNIT {
+ NDIS_PHYSICAL_ADDRESS PhysicalAddress;
+ UINT Length;
+} NDIS_PHYSICAL_ADDRESS_UNIT, *PNDIS_PHYSICAL_ADDRESS_UNIT;
+
+typedef struct _NDIS_WAN_LINE_DOWN {
+ UCHAR RemoteAddress[6];
+ UCHAR LocalAddress[6];
+} NDIS_WAN_LINE_DOWN, *PNDIS_WAN_LINE_DOWN;
+
+typedef struct _NDIS_WAN_LINE_UP {
+ ULONG LinkSpeed;
+ ULONG MaximumTotalSize;
+ NDIS_WAN_QUALITY Quality;
+ USHORT SendWindow;
+ UCHAR RemoteAddress[6];
+ OUT UCHAR LocalAddress[6];
+ ULONG ProtocolBufferLength;
+ PUCHAR ProtocolBuffer;
+ USHORT ProtocolType;
+ NDIS_STRING DeviceName;
+} NDIS_WAN_LINE_UP, *PNDIS_WAN_LINE_UP;
+
+
+typedef VOID DDKAPI
+(*ADAPTER_SHUTDOWN_HANDLER)(
+ IN PVOID ShutdownContext);
+
+
+typedef struct _OID_LIST OID_LIST, *POID_LIST;
+
+/* PnP state */
+
+typedef enum _NDIS_PNP_DEVICE_STATE {
+ NdisPnPDeviceAdded,
+ NdisPnPDeviceStarted,
+ NdisPnPDeviceQueryStopped,
+ NdisPnPDeviceStopped,
+ NdisPnPDeviceQueryRemoved,
+ NdisPnPDeviceRemoved,
+ NdisPnPDeviceSurpriseRemoved
+} NDIS_PNP_DEVICE_STATE;
+
+#define NDIS_DEVICE_NOT_STOPPABLE 0x00000001
+#define NDIS_DEVICE_NOT_REMOVEABLE 0x00000002
+#define NDIS_DEVICE_NOT_SUSPENDABLE 0x00000004
+#define NDIS_DEVICE_DISABLE_PM 0x00000008
+#define NDIS_DEVICE_DISABLE_WAKE_UP 0x00000010
+#define NDIS_DEVICE_DISABLE_WAKE_ON_RECONNECT 0x00000020
+#define NDIS_DEVICE_RESERVED 0x00000040
+#define NDIS_DEVICE_DISABLE_WAKE_ON_MAGIC_PACKET 0x00000080
+#define NDIS_DEVICE_DISABLE_WAKE_ON_PATTERN_MATCH 0x00000100
+
+
+/* OID_GEN_NETWORK_LAYER_ADDRESSES */
+typedef struct _NETWORK_ADDRESS {
+ USHORT AddressLength;
+ USHORT AddressType;
+ UCHAR Address[1];
+} NETWORK_ADDRESS, *PNETWORK_ADDRESS;
+
+typedef struct _NETWORK_ADDRESS_LIST {
+ LONG AddressCount;
+ USHORT AddressType;
+ NETWORK_ADDRESS Address[1];
+} NETWORK_ADDRESS_LIST, *PNETWORK_ADDRESS_LIST;
+
+/* Protocol types supported by NDIS */
+#define NDIS_PROTOCOL_ID_DEFAULT 0x00
+#define NDIS_PROTOCOL_ID_TCP_IP 0x02
+#define NDIS_PROTOCOL_ID_IPX 0x06
+#define NDIS_PROTOCOL_ID_NBF 0x07
+#define NDIS_PROTOCOL_ID_MAX 0x0F
+#define NDIS_PROTOCOL_ID_MASK 0x0F
+
+
+/* OID_GEN_TRANSPORT_HEADER_OFFSET */
+typedef struct _TRANSPORT_HEADER_OFFSET {
+ USHORT ProtocolType;
+ USHORT HeaderOffset;
+} TRANSPORT_HEADER_OFFSET, *PTRANSPORT_HEADER_OFFSET;
+
+
+/* OID_GEN_CO_LINK_SPEED / OID_GEN_CO_MINIMUM_LINK_SPEED */
+typedef struct _NDIS_CO_LINK_SPEED {
+ ULONG Outbound;
+ ULONG Inbound;
+} NDIS_CO_LINK_SPEED, *PNDIS_CO_LINK_SPEED;
+
+typedef ULONG NDIS_AF, *PNDIS_AF;
+#define CO_ADDRESS_FAMILY_Q2931 ((NDIS_AF)0x1)
+#define CO_ADDRESS_FAMILY_PSCHED ((NDIS_AF)0x2)
+#define CO_ADDRESS_FAMILY_L2TP ((NDIS_AF)0x3)
+#define CO_ADDRESS_FAMILY_IRDA ((NDIS_AF)0x4)
+#define CO_ADDRESS_FAMILY_1394 ((NDIS_AF)0x5)
+#define CO_ADDRESS_FAMILY_PPP ((NDIS_AF)0x6)
+#define CO_ADDRESS_FAMILY_TAPI ((NDIS_AF)0x800)
+#define CO_ADDRESS_FAMILY_TAPI_PROXY ((NDIS_AF)0x801)
+
+#define CO_ADDRESS_FAMILY_PROXY 0x80000000
+
+typedef struct {
+ NDIS_AF AddressFamily;
+ ULONG MajorVersion;
+ ULONG MinorVersion;
+} CO_ADDRESS_FAMILY, *PCO_ADDRESS_FAMILY;
+
+typedef struct _CO_FLOW_PARAMETERS {
+ ULONG TokenRate;
+ ULONG TokenBucketSize;
+ ULONG PeakBandwidth;
+ ULONG Latency;
+ ULONG DelayVariation;
+ GUARANTEE LevelOfGuarantee;
+ ULONG CostOfCall;
+ ULONG NetworkAvailability;
+ ULONG MaxSduSize;
+} CO_FLOW_PARAMETERS, *PCO_FLOW_PARAMETERS;
+
+typedef struct _CO_SPECIFIC_PARAMETERS {
+ ULONG ParamType;
+ ULONG Length;
+ UCHAR Parameters[1];
+} CO_SPECIFIC_PARAMETERS, *PCO_SPECIFIC_PARAMETERS;
+
+typedef struct _CO_CALL_MANAGER_PARAMETERS {
+ CO_FLOW_PARAMETERS Transmit;
+ CO_FLOW_PARAMETERS Receive;
+ CO_SPECIFIC_PARAMETERS CallMgrSpecific;
+} CO_CALL_MANAGER_PARAMETERS, *PCO_CALL_MANAGER_PARAMETERS;
+
+/* CO_MEDIA_PARAMETERS.Flags constants */
+#define RECEIVE_TIME_INDICATION 0x00000001
+#define USE_TIME_STAMPS 0x00000002
+#define TRANSMIT_VC 0x00000004
+#define RECEIVE_VC 0x00000008
+#define INDICATE_ERRED_PACKETS 0x00000010
+#define INDICATE_END_OF_TX 0x00000020
+#define RESERVE_RESOURCES_VC 0x00000040
+#define ROUND_DOWN_FLOW 0x00000080
+#define ROUND_UP_FLOW 0x00000100
+
+typedef struct _CO_MEDIA_PARAMETERS {
+ ULONG Flags;
+ ULONG ReceivePriority;
+ ULONG ReceiveSizeHint;
+ CO_SPECIFIC_PARAMETERS MediaSpecific;
+} CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS;
+
+/* CO_CALL_PARAMETERS.Flags constants */
+#define PERMANENT_VC 0x00000001
+#define CALL_PARAMETERS_CHANGED 0x00000002
+#define QUERY_CALL_PARAMETERS 0x00000004
+#define BROADCAST_VC 0x00000008
+#define MULTIPOINT_VC 0x00000010
+
+typedef struct _CO_CALL_PARAMETERS {
+ ULONG Flags;
+ PCO_CALL_MANAGER_PARAMETERS CallMgrParameters;
+ PCO_MEDIA_PARAMETERS MediaParameters;
+} CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS;
+
+typedef struct _CO_SAP {
+ ULONG SapType;
+ ULONG SapLength;
+ UCHAR Sap[1];
+} CO_SAP, *PCO_SAP;
+
+typedef struct _NDIS_IPSEC_PACKET_INFO {
+ union {
+ struct {
+ NDIS_HANDLE OffloadHandle;
+ NDIS_HANDLE NextOffloadHandle;
+ } Transmit;
+ struct {
+ ULONG SA_DELETE_REQ : 1;
+ ULONG CRYPTO_DONE : 1;
+ ULONG NEXT_CRYPTO_DONE : 1;
+ ULONG CryptoStatus;
+ } Receive;
+ };
+} NDIS_IPSEC_PACKET_INFO, *PNDIS_IPSEC_PACKET_INFO;
+
+/* NDIS_MAC_FRAGMENT.Errors constants */
+#define WAN_ERROR_CRC 0x00000001
+#define WAN_ERROR_FRAMING 0x00000002
+#define WAN_ERROR_HARDWAREOVERRUN 0x00000004
+#define WAN_ERROR_BUFFEROVERRUN 0x00000008
+#define WAN_ERROR_TIMEOUT 0x00000010
+#define WAN_ERROR_ALIGNMENT 0x00000020
+
+typedef struct _NDIS_MAC_FRAGMENT {
+ NDIS_HANDLE NdisLinkContext;
+ ULONG Errors;
+} NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT;
+
+typedef struct _NDIS_MAC_LINE_DOWN {
+ NDIS_HANDLE NdisLinkContext;
+} NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN;
+
+typedef struct _NDIS_MAC_LINE_UP {
+ ULONG LinkSpeed;
+ NDIS_WAN_QUALITY Quality;
+ USHORT SendWindow;
+ NDIS_HANDLE ConnectionWrapperID;
+ NDIS_HANDLE NdisLinkHandle;
+ NDIS_HANDLE NdisLinkContext;
+} NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP;
+
+typedef struct _NDIS_PACKET_8021Q_INFO {
+ union {
+ struct {
+ UINT32 UserPriority : 3;
+ UINT32 CanonicalFormatId : 1;
+ UINT32 VlanId : 12;
+ UINT32 Reserved : 16;
+ } TagHeader;
+ PVOID Value;
+ };
+} NDIS_PACKET_8021Q_INFO, *PNDIS_PACKET_8021Q_INFO;
+
+typedef enum _NDIS_PER_PACKET_INFO {
+ TcpIpChecksumPacketInfo,
+ IpSecPacketInfo,
+ TcpLargeSendPacketInfo,
+ ClassificationHandlePacketInfo,
+ NdisReserved,
+ ScatterGatherListPacketInfo,
+ Ieee8021QInfo,
+ OriginalPacketInfo,
+ PacketCancelId,
+ MaxPerPacketInfo
+} NDIS_PER_PACKET_INFO, *PNDIS_PER_PACKET_INFO;
+
+typedef struct _NDIS_PACKET_EXTENSION {
+ PVOID NdisPacketInfo[MaxPerPacketInfo];
+} NDIS_PACKET_EXTENSION, *PNDIS_PACKET_EXTENSION;
+
+/*
+ * PNDIS_PACKET
+ * NDIS_GET_ORIGINAL_PACKET(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_ORIGINAL_PACKET(Packet) \
+ NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo)
+
+/*
+ * PVOID
+ * NDIS_GET_PACKET_CANCEL_ID(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_CANCEL_ID(Packet) \
+ NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId)
+
+/*
+ * PNDIS_PACKET_EXTENSION
+ * NDIS_PACKET_EXTENSION_FROM_PACKET(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_PACKET_EXTENSION_FROM_PACKET(Packet) \
+ ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) \
+ + (Packet)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA)))
+
+/*
+ * PVOID
+ * NDIS_PER_PACKET_INFO_FROM_PACKET(
+ * IN OUT PNDIS_PACKET Packet,
+ * IN NDIS_PER_PACKET_INFO InfoType);
+ */
+#define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType) \
+ ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) + (Packet)->Private.NdisPacketOobOffset \
+ + sizeof(NDIS_PACKET_OOB_DATA)))->NdisPacketInfo[(InfoType)]
+
+/*
+ * VOID
+ * NDIS_SET_ORIGINAL_PACKET(
+ * IN OUT PNDIS_PACKET Packet,
+ * IN PNDIS_PACKET OriginalPacket);
+ */
+#define NDIS_SET_ORIGINAL_PACKET(Packet, OriginalPacket) \
+ NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo) = (OriginalPacket)
+
+/*
+ * VOID
+ * NDIS_SET_PACKET_CANCEL_ID(
+ * IN PNDIS_PACKET Packet
+ * IN ULONG_PTR CancelId);
+ */
+#define NDIS_SET_PACKET_CANCEL_ID(Packet, CancelId) \
+ NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId) = (CancelId)
+
+typedef enum _NDIS_TASK {
+ TcpIpChecksumNdisTask,
+ IpSecNdisTask,
+ TcpLargeSendNdisTask,
+ MaxNdisTask
+} NDIS_TASK, *PNDIS_TASK;
+
+typedef struct _NDIS_TASK_IPSEC {
+ struct {
+ ULONG AH_ESP_COMBINED;
+ ULONG TRANSPORT_TUNNEL_COMBINED;
+ ULONG V4_OPTIONS;
+ ULONG RESERVED;
+ } Supported;
+
+ struct {
+ ULONG MD5 : 1;
+ ULONG SHA_1 : 1;
+ ULONG Transport : 1;
+ ULONG Tunnel : 1;
+ ULONG Send : 1;
+ ULONG Receive : 1;
+ } V4AH;
+
+ struct {
+ ULONG DES : 1;
+ ULONG RESERVED : 1;
+ ULONG TRIPLE_DES : 1;
+ ULONG NULL_ESP : 1;
+ ULONG Transport : 1;
+ ULONG Tunnel : 1;
+ ULONG Send : 1;
+ ULONG Receive : 1;
+ } V4ESP;
+} NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
+
+typedef struct _NDIS_TASK_OFFLOAD {
+ ULONG Version;
+ ULONG Size;
+ NDIS_TASK Task;
+ ULONG OffsetNextTask;
+ ULONG TaskBufferLength;
+ UCHAR TaskBuffer[1];
+} NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
+
+/* NDIS_TASK_OFFLOAD_HEADER.Version constants */
+#define NDIS_TASK_OFFLOAD_VERSION 1
+
+typedef enum _NDIS_ENCAPSULATION {
+ UNSPECIFIED_Encapsulation,
+ NULL_Encapsulation,
+ IEEE_802_3_Encapsulation,
+ IEEE_802_5_Encapsulation,
+ LLC_SNAP_ROUTED_Encapsulation,
+ LLC_SNAP_BRIDGED_Encapsulation
+} NDIS_ENCAPSULATION;
+
+typedef struct _NDIS_ENCAPSULATION_FORMAT {
+ NDIS_ENCAPSULATION Encapsulation;
+ struct {
+ ULONG FixedHeaderSize : 1;
+ ULONG Reserved : 31;
+ } Flags;
+ ULONG EncapsulationHeaderSize;
+} NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
+
+typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
+ struct {
+ ULONG IpOptionsSupported:1;
+ ULONG TcpOptionsSupported:1;
+ ULONG TcpChecksum:1;
+ ULONG UdpChecksum:1;
+ ULONG IpChecksum:1;
+ } V4Transmit;
+
+ struct {
+ ULONG IpOptionsSupported : 1;
+ ULONG TcpOptionsSupported : 1;
+ ULONG TcpChecksum : 1;
+ ULONG UdpChecksum : 1;
+ ULONG IpChecksum : 1;
+ } V4Receive;
+
+ struct {
+ ULONG IpOptionsSupported : 1;
+ ULONG TcpOptionsSupported : 1;
+ ULONG TcpChecksum : 1;
+ ULONG UdpChecksum : 1;
+ } V6Transmit;
+
+ struct {
+ ULONG IpOptionsSupported : 1;
+ ULONG TcpOptionsSupported : 1;
+ ULONG TcpChecksum : 1;
+ ULONG UdpChecksum : 1;
+ } V6Receive;
+} NDIS_TASK_TCP_IP_CHECKSUM, *PNDIS_TASK_TCP_IP_CHECKSUM;
+
+typedef struct _NDIS_TASK_TCP_LARGE_SEND {
+ ULONG Version;
+ ULONG MaxOffLoadSize;
+ ULONG MinSegmentCount;
+ BOOLEAN TcpOptions;
+ BOOLEAN IpOptions;
+} NDIS_TASK_TCP_LARGE_SEND, *PNDIS_TASK_TCP_LARGE_SEND;
+
+typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO {
+ union {
+ struct {
+ ULONG NdisPacketChecksumV4 : 1;
+ ULONG NdisPacketChecksumV6 : 1;
+ ULONG NdisPacketTcpChecksum : 1;
+ ULONG NdisPacketUdpChecksum : 1;
+ ULONG NdisPacketIpChecksum : 1;
+ } Transmit;
+
+ struct {
+ ULONG NdisPacketTcpChecksumFailed : 1;
+ ULONG NdisPacketUdpChecksumFailed : 1;
+ ULONG NdisPacketIpChecksumFailed : 1;
+ ULONG NdisPacketTcpChecksumSucceeded : 1;
+ ULONG NdisPacketUdpChecksumSucceeded : 1;
+ ULONG NdisPacketIpChecksumSucceeded : 1;
+ ULONG NdisPacketLoopback : 1;
+ } Receive;
+ ULONG Value;
+ };
+} NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO;
+
+typedef struct _NDIS_WAN_CO_FRAGMENT {
+ ULONG Errors;
+} NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT;
+
+typedef struct _NDIS_WAN_FRAGMENT {
+ UCHAR RemoteAddress[6];
+ UCHAR LocalAddress[6];
+} NDIS_WAN_FRAGMENT, *PNDIS_WAN_FRAGMENT;
+
+typedef struct _WAN_CO_LINKPARAMS {
+ ULONG TransmitSpeed;
+ ULONG ReceiveSpeed;
+ ULONG SendWindow;
+} WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS;
+
+
+/* Call Manager */
+
+typedef VOID DDKAPI
+(*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE CallMgrVcContext,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_ADD_PARTY_HANDLER)(
+ IN NDIS_HANDLE CallMgrVcContext,
+ IN OUT PCO_CALL_PARAMETERS CallParameters,
+ IN NDIS_HANDLE NdisPartyHandle,
+ OUT PNDIS_HANDLE CallMgrPartyContext);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_CLOSE_AF_HANDLER)(
+ IN NDIS_HANDLE CallMgrAfContext);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_CLOSE_CALL_HANDLER)(
+ IN NDIS_HANDLE CallMgrVcContext,
+ IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
+ IN PVOID CloseData OPTIONAL,
+ IN UINT Size OPTIONAL);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_DEREG_SAP_HANDLER)(
+ IN NDIS_HANDLE CallMgrSapContext);
+
+typedef VOID DDKAPI
+(*CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE CallMgrVcContext);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_DROP_PARTY_HANDLER)(
+ IN NDIS_HANDLE CallMgrPartyContext,
+ IN PVOID CloseData OPTIONAL,
+ IN UINT Size OPTIONAL);
+
+typedef VOID DDKAPI
+(*CM_INCOMING_CALL_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE CallMgrVcContext,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_MAKE_CALL_HANDLER)(
+ IN NDIS_HANDLE CallMgrVcContext,
+ IN OUT PCO_CALL_PARAMETERS CallParameters,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
+ OUT PNDIS_HANDLE CallMgrPartyContext OPTIONAL);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_MODIFY_CALL_QOS_HANDLER)(
+ IN NDIS_HANDLE CallMgrVcContext,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_OPEN_AF_HANDLER)(
+ IN NDIS_HANDLE CallMgrBindingContext,
+ IN PCO_ADDRESS_FAMILY AddressFamily,
+ IN NDIS_HANDLE NdisAfHandle,
+ OUT PNDIS_HANDLE CallMgrAfContext);
+
+typedef NDIS_STATUS DDKAPI
+(*CM_REG_SAP_HANDLER)(
+ IN NDIS_HANDLE CallMgrAfContext,
+ IN PCO_SAP Sap,
+ IN NDIS_HANDLE NdisSapHandle,
+ OUT PNDIS_HANDLE CallMgrSapContext);
+
+typedef NDIS_STATUS DDKAPI
+(*CO_CREATE_VC_HANDLER)(
+ IN NDIS_HANDLE ProtocolAfContext,
+ IN NDIS_HANDLE NdisVcHandle,
+ OUT PNDIS_HANDLE ProtocolVcContext);
+
+typedef NDIS_STATUS DDKAPI
+(*CO_DELETE_VC_HANDLER)(
+ IN NDIS_HANDLE ProtocolVcContext);
+
+typedef VOID DDKAPI
+(*CO_REQUEST_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
+ IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
+ IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
+ IN PNDIS_REQUEST NdisRequest);
+
+typedef NDIS_STATUS DDKAPI
+(*CO_REQUEST_HANDLER)(
+ IN NDIS_HANDLE ProtocolAfContext,
+ IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
+ IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
+ IN OUT PNDIS_REQUEST NdisRequest);
+
+typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
+ UCHAR MajorVersion;
+ UCHAR MinorVersion;
+ USHORT Filler;
+ UINT Reserved;
+ CO_CREATE_VC_HANDLER CmCreateVcHandler;
+ CO_DELETE_VC_HANDLER CmDeleteVcHandler;
+ CM_OPEN_AF_HANDLER CmOpenAfHandler;
+ CM_CLOSE_AF_HANDLER CmCloseAfHandler;
+ CM_REG_SAP_HANDLER CmRegisterSapHandler;
+ CM_DEREG_SAP_HANDLER CmDeregisterSapHandler;
+ CM_MAKE_CALL_HANDLER CmMakeCallHandler;
+ CM_CLOSE_CALL_HANDLER CmCloseCallHandler;
+ CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler;
+ CM_ADD_PARTY_HANDLER CmAddPartyHandler;
+ CM_DROP_PARTY_HANDLER CmDropPartyHandler;
+ CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler;
+ CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler;
+ CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler;
+ CO_REQUEST_HANDLER CmRequestHandler;
+ CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
+} NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS;
+
+
+
+/* Call Manager clients */
+
+typedef VOID (*CL_OPEN_AF_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolAfContext,
+ IN NDIS_HANDLE NdisAfHandle);
+
+typedef VOID DDKAPI
+(*CL_CLOSE_AF_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolAfContext);
+
+typedef VOID DDKAPI
+(*CL_REG_SAP_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolSapContext,
+ IN PCO_SAP Sap,
+ IN NDIS_HANDLE NdisSapHandle);
+
+typedef VOID DDKAPI
+(*CL_DEREG_SAP_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolSapContext);
+
+typedef VOID DDKAPI
+(*CL_MAKE_CALL_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+typedef VOID DDKAPI
+(*CL_MODIFY_CALL_QOS_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+typedef VOID DDKAPI
+(*CL_CLOSE_CALL_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN NDIS_HANDLE ProtocolPartyContext OPTIONAL);
+
+typedef VOID DDKAPI
+(*CL_ADD_PARTY_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolPartyContext,
+ IN NDIS_HANDLE NdisPartyHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+typedef VOID DDKAPI
+(*CL_DROP_PARTY_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolPartyContext);
+
+typedef NDIS_STATUS DDKAPI
+(*CL_INCOMING_CALL_HANDLER)(
+ IN NDIS_HANDLE ProtocolSapContext,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN OUT PCO_CALL_PARAMETERS CallParameters);
+
+typedef VOID DDKAPI
+(*CL_INCOMING_CALL_QOS_CHANGE_HANDLER)(
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+typedef VOID DDKAPI
+(*CL_INCOMING_CLOSE_CALL_HANDLER)(
+ IN NDIS_STATUS CloseStatus,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN PVOID CloseData OPTIONAL,
+ IN UINT Size OPTIONAL);
+
+typedef VOID DDKAPI
+(*CL_INCOMING_DROP_PARTY_HANDLER)(
+ IN NDIS_STATUS DropStatus,
+ IN NDIS_HANDLE ProtocolPartyContext,
+ IN PVOID CloseData OPTIONAL,
+ IN UINT Size OPTIONAL);
+
+typedef VOID DDKAPI
+(*CL_CALL_CONNECTED_HANDLER)(
+ IN NDIS_HANDLE ProtocolVcContext);
+
+
+typedef struct _NDIS_CLIENT_CHARACTERISTICS {
+ UCHAR MajorVersion;
+ UCHAR MinorVersion;
+ USHORT Filler;
+ UINT Reserved;
+ CO_CREATE_VC_HANDLER ClCreateVcHandler;
+ CO_DELETE_VC_HANDLER ClDeleteVcHandler;
+ CO_REQUEST_HANDLER ClRequestHandler;
+ CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
+ CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler;
+ CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler;
+ CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler;
+ CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler;
+ CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
+ CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler;
+ CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
+ CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler;
+ CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler;
+ CL_INCOMING_CALL_HANDLER ClIncomingCallHandler;
+ CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler;
+ CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
+ CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler;
+ CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler;
+} NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS;
+
+
+/* NDIS protocol structures */
+
+/* Prototypes for NDIS 3.0 protocol characteristics */
+
+typedef VOID DDKAPI
+(*OPEN_ADAPTER_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_STATUS Status,
+ IN NDIS_STATUS OpenErrorStatus);
+
+typedef VOID DDKAPI
+(*CLOSE_ADAPTER_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_STATUS Status);
+
+typedef VOID DDKAPI
+(*RESET_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_STATUS Status);
+
+typedef VOID DDKAPI
+(*REQUEST_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PNDIS_REQUEST NdisRequest,
+ IN NDIS_STATUS Status);
+
+typedef VOID DDKAPI
+(*STATUS_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_STATUS GeneralStatus,
+ IN PVOID StatusBuffer,
+ IN UINT StatusBufferSize);
+
+typedef VOID DDKAPI
+(*STATUS_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext);
+
+typedef VOID DDKAPI
+(*SEND_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PNDIS_PACKET Packet,
+ IN NDIS_STATUS Status);
+
+typedef VOID DDKAPI
+(*WAN_SEND_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PNDIS_WAN_PACKET Packet,
+ IN NDIS_STATUS Status);
+
+typedef VOID DDKAPI
+(*TRANSFER_DATA_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PNDIS_PACKET Packet,
+ IN NDIS_STATUS Status,
+ IN UINT BytesTransferred);
+
+typedef VOID DDKAPI
+(*WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
+ VOID);
+
+
+typedef NDIS_STATUS DDKAPI
+(*RECEIVE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_HANDLE MacReceiveContext,
+ IN PVOID HeaderBuffer,
+ IN UINT HeaderBufferSize,
+ IN PVOID LookAheadBuffer,
+ IN UINT LookaheadBufferSize,
+ IN UINT PacketSize);
+
+typedef NDIS_STATUS DDKAPI
+(*WAN_RECEIVE_HANDLER)(
+ IN NDIS_HANDLE NdisLinkHandle,
+ IN PUCHAR Packet,
+ IN ULONG PacketSize);
+
+typedef VOID DDKAPI
+(*RECEIVE_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext);
+
+
+/* Protocol characteristics for NDIS 3.0 protocols */
+
+#define NDIS30_PROTOCOL_CHARACTERISTICS_S \
+ UCHAR MajorNdisVersion; \
+ UCHAR MinorNdisVersion; \
+ union { \
+ UINT Reserved; \
+ UINT Flags; \
+ }; \
+ OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; \
+ CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; \
+ union { \
+ SEND_COMPLETE_HANDLER SendCompleteHandler; \
+ WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; \
+ }; \
+ union { \
+ TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
+ WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; \
+ }; \
+ RESET_COMPLETE_HANDLER ResetCompleteHandler; \
+ REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
+ union { \
+ RECEIVE_HANDLER ReceiveHandler; \
+ WAN_RECEIVE_HANDLER WanReceiveHandler; \
+ }; \
+ RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
+ STATUS_HANDLER StatusHandler; \
+ STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
+ NDIS_STRING Name;
+
+typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS {
+ NDIS30_PROTOCOL_CHARACTERISTICS_S;
+} NDIS30_PROTOCOL_CHARACTERISTICS, *PNDIS30_PROTOCOL_CHARACTERISTICS;
+
+
+/* Prototypes for NDIS 4.0 protocol characteristics */
+
+typedef INT DDKAPI
+(*RECEIVE_PACKET_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PNDIS_PACKET Packet);
+
+typedef VOID DDKAPI
+(*BIND_HANDLER)(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE BindContext,
+ IN PNDIS_STRING DeviceName,
+ IN PVOID SystemSpecific1,
+ IN PVOID SystemSpecific2);
+
+typedef VOID DDKAPI
+(*UNBIND_HANDLER)(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_HANDLE UnbindContext);
+
+typedef NDIS_STATUS DDKAPI
+(*PNP_EVENT_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PNET_PNP_EVENT NetPnPEvent);
+
+typedef VOID DDKAPI
+(*UNLOAD_PROTOCOL_HANDLER)(
+ VOID);
+
+
+/* Protocol characteristics for NDIS 4.0 protocols */
+
+#ifdef __cplusplus
+
+#define NDIS40_PROTOCOL_CHARACTERISTICS_S \
+ NDIS30_PROTOCOL_CHARACTERISTICS Ndis30Chars; \
+ RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
+ BIND_HANDLER BindAdapterHandler; \
+ UNBIND_HANDLER UnbindAdapterHandler; \
+ PNP_EVENT_HANDLER PnPEventHandler; \
+ UNLOAD_PROTOCOL_HANDLER UnloadHandler;
+
+#else /* !__cplusplus */
+
+#define NDIS40_PROTOCOL_CHARACTERISTICS_S \
+ NDIS30_PROTOCOL_CHARACTERISTICS_S; \
+ RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
+ BIND_HANDLER BindAdapterHandler; \
+ UNBIND_HANDLER UnbindAdapterHandler; \
+ PNP_EVENT_HANDLER PnPEventHandler; \
+ UNLOAD_PROTOCOL_HANDLER UnloadHandler;
+
+#endif /* __cplusplus */
+
+typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS {
+ NDIS40_PROTOCOL_CHARACTERISTICS_S;
+} NDIS40_PROTOCOL_CHARACTERISTICS, *PNDIS40_PROTOCOL_CHARACTERISTICS;
+
+/* Prototypes for NDIS 5.0 protocol characteristics */
+
+typedef VOID DDKAPI
+(*CO_SEND_COMPLETE_HANDLER)(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN PNDIS_PACKET Packet);
+
+typedef VOID DDKAPI
+(*CO_STATUS_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
+ IN NDIS_STATUS GeneralStatus,
+ IN PVOID StatusBuffer,
+ IN UINT StatusBufferSize);
+
+typedef UINT DDKAPI
+(*CO_RECEIVE_PACKET_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN PNDIS_PACKET Packet);
+
+typedef VOID DDKAPI
+(*CO_AF_REGISTER_NOTIFY_HANDLER)(
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PCO_ADDRESS_FAMILY AddressFamily);
+
+#ifdef __cplusplus \
+
+#define NDIS50_PROTOCOL_CHARACTERISTICS_S \
+ NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars; \
+ PVOID ReservedHandlers[4]; \
+ CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
+ CO_STATUS_HANDLER CoStatusHandler; \
+ CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
+ CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
+
+#else /* !__cplusplus */
+
+#define NDIS50_PROTOCOL_CHARACTERISTICS_S \
+ NDIS40_PROTOCOL_CHARACTERISTICS_S; \
+ PVOID ReservedHandlers[4]; \
+ CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
+ CO_STATUS_HANDLER CoStatusHandler; \
+ CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
+ CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
+
+#endif /* !__cplusplus */
+
+typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS {
+ NDIS50_PROTOCOL_CHARACTERISTICS_S;
+} NDIS50_PROTOCOL_CHARACTERISTICS, *PNDIS50_PROTOCOL_CHARACTERISTICS;
+
+#if defined(NDIS50) || defined(NDIS51)
+typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
+ NDIS50_PROTOCOL_CHARACTERISTICS_S;
+} NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
+#elif defined(NDIS40)
+typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
+ NDIS40_PROTOCOL_CHARACTERISTICS_S;
+} NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
+#elif defined(NDIS30)
+typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
+ NDIS30_PROTOCOL_CHARACTERISTICS_S;
+} NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
+#else
+#error Define an NDIS version
+#endif /* NDIS30 */
+
+
+
+/* Buffer management routines */
+
+NDISAPI
+VOID
+DDKAPI
+NdisAllocateBuffer(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_BUFFER *Buffer,
+ IN NDIS_HANDLE PoolHandle,
+ IN PVOID VirtualAddress,
+ IN UINT Length);
+
+
+NDISAPI
+VOID
+DDKAPI
+NdisAllocateBufferPool(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_HANDLE PoolHandle,
+ IN UINT NumberOfDescriptors);
+
+NDISAPI
+VOID
+DDKAPI
+NdisAllocatePacket(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_PACKET *Packet,
+ IN NDIS_HANDLE PoolHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisAllocatePacketPool(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_HANDLE PoolHandle,
+ IN UINT NumberOfDescriptors,
+ IN UINT ProtocolReservedLength);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCopyBuffer(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_BUFFER *Buffer,
+ IN NDIS_HANDLE PoolHandle,
+ IN PVOID MemoryDescriptor,
+ IN UINT Offset,
+ IN UINT Length);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCopyFromPacketToPacket(
+ IN PNDIS_PACKET Destination,
+ IN UINT DestinationOffset,
+ IN UINT BytesToCopy,
+ IN PNDIS_PACKET Source,
+ IN UINT SourceOffset,
+ OUT PUINT BytesCopied);
+
+NDISAPI
+VOID
+DDKAPI
+NdisDprAllocatePacket(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_PACKET *Packet,
+ IN NDIS_HANDLE PoolHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisDprAllocatePacketNonInterlocked(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_PACKET *Packet,
+ IN NDIS_HANDLE PoolHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisDprFreePacket(
+ IN PNDIS_PACKET Packet);
+
+NDISAPI
+VOID
+DDKAPI
+NdisDprFreePacketNonInterlocked(
+ IN PNDIS_PACKET Packet);
+
+NDISAPI
+VOID
+DDKAPI
+NdisFreeBufferPool(
+ IN NDIS_HANDLE PoolHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisFreePacket(
+ IN PNDIS_PACKET Packet);
+
+NDISAPI
+VOID
+DDKAPI
+NdisFreePacketPool(
+ IN NDIS_HANDLE PoolHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisReturnPackets(
+ IN PNDIS_PACKET *PacketsToReturn,
+ IN UINT NumberOfPackets);
+
+NDISAPI
+VOID
+DDKAPI
+NdisUnchainBufferAtBack(
+ IN OUT PNDIS_PACKET Packet,
+ OUT PNDIS_BUFFER *Buffer);
+
+NDISAPI
+VOID
+DDKAPI
+NdisUnchainBufferAtFront(
+ IN OUT PNDIS_PACKET Packet,
+ OUT PNDIS_BUFFER *Buffer);
+
+NDISAPI
+VOID
+DDKAPI
+NdisAdjustBufferLength(
+ IN PNDIS_BUFFER Buffer,
+ IN UINT Length);
+
+NDISAPI
+ULONG
+DDKAPI
+NdisBufferLength(
+ IN PNDIS_BUFFER Buffer);
+
+NDISAPI
+PVOID
+DDKAPI
+NdisBufferVirtualAddress(
+ IN PNDIS_BUFFER Buffer);
+
+NDISAPI
+ULONG
+DDKAPI
+NDIS_BUFFER_TO_SPAN_PAGES(
+ IN PNDIS_BUFFER Buffer);
+
+NDISAPI
+VOID
+DDKAPI
+NdisFreeBuffer(
+ IN PNDIS_BUFFER Buffer);
+
+NDISAPI
+VOID
+DDKAPI
+NdisGetBufferPhysicalArraySize(
+ IN PNDIS_BUFFER Buffer,
+ OUT PUINT ArraySize);
+
+NDISAPI
+VOID
+DDKAPI
+NdisGetFirstBufferFromPacket(
+ IN PNDIS_PACKET _Packet,
+ OUT PNDIS_BUFFER *_FirstBuffer,
+ OUT PVOID *_FirstBufferVA,
+ OUT PUINT _FirstBufferLength,
+ OUT PUINT _TotalBufferLength);
+
+NDISAPI
+VOID
+DDKAPI
+NdisQueryBuffer(
+ IN PNDIS_BUFFER Buffer,
+ OUT PVOID *VirtualAddress OPTIONAL,
+ OUT PUINT Length);
+
+NDISAPI
+VOID
+DDKAPI
+NdisQueryBufferOffset(
+ IN PNDIS_BUFFER Buffer,
+ OUT PUINT Offset,
+ OUT PUINT Length);
+
+NDISAPI
+VOID
+DDKAPI
+NdisFreeBuffer(
+ IN PNDIS_BUFFER Buffer);
+
+
+/*
+ * VOID
+ * NdisGetBufferPhysicalArraySize(
+ * IN PNDIS_BUFFER Buffer,
+ * OUT PUINT ArraySize);
+ */
+#define NdisGetBufferPhysicalArraySize(Buffer, \
+ ArraySize) \
+{ \
+ (*(ArraySize) = NDIS_BUFFER_TO_SPAN_PAGES(Buffer)) \
+}
+
+
+/*
+ * VOID
+ * NdisGetFirstBufferFromPacket(
+ * IN PNDIS_PACKET _Packet,
+ * OUT PNDIS_BUFFER * _FirstBuffer,
+ * OUT PVOID * _FirstBufferVA,
+ * OUT PUINT _FirstBufferLength,
+ * OUT PUINT _TotalBufferLength)
+ */
+#define NdisGetFirstBufferFromPacket(_Packet, \
+ _FirstBuffer, \
+ _FirstBufferVA, \
+ _FirstBufferLength, \
+ _TotalBufferLength) \
+{ \
+ PNDIS_BUFFER _Buffer; \
+ \
+ _Buffer = (_Packet)->Private.Head; \
+ *(_FirstBuffer) = _Buffer; \
+ if (_Buffer != NULL) \
+ { \
+ *(_FirstBufferVA) = MmGetSystemAddressForMdl(_Buffer); \
+ *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
+ _Buffer = _Buffer->Next; \
+ *(_TotalBufferLength) = *(_FirstBufferLength); \
+ while (_Buffer != NULL) { \
+ *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
+ _Buffer = _Buffer->Next; \
+ } \
+ } \
+ else \
+ { \
+ *(_FirstBufferVA) = 0; \
+ *(_FirstBufferLength) = 0; \
+ *(_TotalBufferLength) = 0; \
+ } \
+}
+
+/*
+ * VOID
+ * NdisQueryBuffer(
+ * IN PNDIS_BUFFER Buffer,
+ * OUT PVOID *VirtualAddress OPTIONAL,
+ * OUT PUINT Length)
+ */
+#define NdisQueryBuffer(Buffer, \
+ VirtualAddress, \
+ Length) \
+{ \
+ if (VirtualAddress) \
+ *((PVOID*)VirtualAddress) = MmGetSystemAddressForMdl(Buffer); \
+ \
+ *((PUINT)Length) = MmGetMdlByteCount(Buffer); \
+}
+
+
+/*
+ * VOID
+ * NdisQueryBufferOffset(
+ * IN PNDIS_BUFFER Buffer,
+ * OUT PUINT Offset,
+ * OUT PUINT Length);
+ */
+#define NdisQueryBufferOffset(Buffer, \
+ Offset, \
+ Length) \
+{ \
+ *((PUINT)Offset) = MmGetMdlByteOffset(Buffer); \
+ *((PUINT)Length) = MmGetMdlByteCount(Buffer); \
+}
+
+
+/*
+ * PVOID
+ * NDIS_BUFFER_LINKAGE(
+ * IN PNDIS_BUFFER Buffer);
+ */
+#define NDIS_BUFFER_LINKAGE(Buffer)(Buffer)->Next;
+
+
+/*
+ * VOID
+ * NdisChainBufferAtBack(
+ * IN OUT PNDIS_PACKET Packet,
+ * IN OUT PNDIS_BUFFER Buffer)
+ */
+#define NdisChainBufferAtBack(Packet, \
+ Buffer) \
+{ \
+ PNDIS_BUFFER NdisBuffer = (Buffer); \
+ \
+ while (NdisBuffer->Next != NULL) \
+ NdisBuffer = NdisBuffer->Next; \
+ \
+ NdisBuffer->Next = NULL; \
+ \
+ if ((Packet)->Private.Head != NULL) \
+ (Packet)->Private.Tail->Next = (Buffer); \
+ else \
+ (Packet)->Private.Head = (Buffer); \
+ \
+ (Packet)->Private.Tail = NdisBuffer; \
+ (Packet)->Private.ValidCounts = FALSE; \
+}
+
+
+/*
+ * VOID
+ * NdisChainBufferAtFront(
+ * IN OUT PNDIS_PACKET Packet,
+ * IN OUT PNDIS_BUFFER Buffer)
+ */
+#define NdisChainBufferAtFront(Packet, \
+ Buffer) \
+{ \
+ PNDIS_BUFFER _NdisBuffer = (Buffer); \
+ \
+ while (_NdisBuffer->Next != NULL) \
+ _NdisBuffer = _NdisBuffer->Next; \
+ \
+ if ((Packet)->Private.Head == NULL) \
+ (Packet)->Private.Tail = _NdisBuffer; \
+ \
+ _NdisBuffer->Next = (Packet)->Private.Head; \
+ (Packet)->Private.Head = (Buffer); \
+ (Packet)->Private.ValidCounts = FALSE; \
+}
+
+
+/*
+ * VOID
+ * NdisGetNextBuffer(
+ * IN PNDIS_BUFFER CurrentBuffer,
+ * OUT PNDIS_BUFFER * NextBuffer)
+ */
+#define NdisGetNextBuffer(CurrentBuffer, \
+ NextBuffer) \
+{ \
+ *(NextBuffer) = (CurrentBuffer)->Next; \
+}
+
+
+/*
+ * UINT
+ * NdisGetPacketFlags(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NdisGetPacketFlags(Packet)(Packet)->Private.Flags;
+
+
+/*
+ * VOID
+ * NdisClearPacketFlags(
+ * IN PNDIS_PACKET Packet,
+ * IN UINT Flags);
+ */
+#define NdisClearPacketFlags(Packet, Flags) \
+ (Packet)->Private.Flags &= ~(Flags)
+
+
+/*
+ * VOID
+ * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
+ * IN PNDIS_PACKET Packet,
+ * IN PPVOID pMediaSpecificInfo,
+ * IN PUINT pSizeMediaSpecificInfo);
+ */
+#define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
+ _pMediaSpecificInfo, \
+ _pSizeMediaSpecificInfo) \
+{ \
+ if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) || \
+ !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO)) \
+ { \
+ *(_pMediaSpecificInfo) = NULL; \
+ *(_pSizeMediaSpecificInfo) = 0; \
+ } \
+ else \
+ { \
+ *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation; \
+ *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo; \
+ } \
+}
+
+
+/*
+ * ULONG
+ * NDIS_GET_PACKET_PROTOCOL_TYPE(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
+ ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
+
+/*
+ * ULONG
+ * NDIS_GET_PACKET_HEADER_SIZE(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_HEADER_SIZE(_Packet) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
+
+
+/*
+ * NDIS_STATUS
+ * NDIS_GET_PACKET_STATUS(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_STATUS(_Packet) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->Status
+
+
+/*
+ * ULONGLONG
+ * NDIS_GET_PACKET_TIME_RECEIVED(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_TIME_RECEIVED(_Packet) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
+
+
+/*
+ * ULONGLONG
+ * NDIS_GET_PACKET_TIME_SENT(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_TIME_SENT(_Packet) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->TimeSent
+
+
+/*
+ * ULONGLONG
+ * NDIS_GET_PACKET_TIME_TO_SEND(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_GET_PACKET_TIME_TO_SEND(_Packet) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
+
+
+/*
+ * PNDIS_PACKET_OOB_DATA
+ * NDIS_OOB_DATA_FROM_PACKET(
+ * IN PNDIS_PACKET Packet);
+ */
+#define NDIS_OOB_DATA_FROM_PACKET(_Packet) \
+ (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset)
+
+
+/*
+ * VOID
+ * NdisQueryPacket(
+ * IN PNDIS_PACKET Packet,
+ * OUT PUINT PhysicalBufferCount OPTIONAL,
+ * OUT PUINT BufferCount OPTIONAL,
+ * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
+ * OUT PUINT TotalPacketLength OPTIONAL);
+ */
+#define NdisQueryPacket(Packet, \
+ PhysicalBufferCount, \
+ BufferCount, \
+ FirstBuffer, \
+ TotalPacketLength) \
+{ \
+ if (FirstBuffer) \
+ *((PNDIS_BUFFER*)FirstBuffer) = (Packet)->Private.Head; \
+ if ((TotalPacketLength) || (BufferCount) || (PhysicalBufferCount)) \
+ { \
+ if (!(Packet)->Private.ValidCounts) { \
+ UINT _Offset; \
+ UINT _PacketLength; \
+ PNDIS_BUFFER _NdisBuffer; \
+ UINT _PhysicalBufferCount = 0; \
+ UINT _TotalPacketLength = 0; \
+ UINT _Count = 0; \
+ \
+ for (_NdisBuffer = (Packet)->Private.Head; \
+ _NdisBuffer != (PNDIS_BUFFER)NULL; \
+ _NdisBuffer = _NdisBuffer->Next) \
+ { \
+ _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \
+ NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \
+ _TotalPacketLength += _PacketLength; \
+ _Count++; \
+ } \
+ (Packet)->Private.PhysicalCount = _PhysicalBufferCount; \
+ (Packet)->Private.TotalLength = _TotalPacketLength; \
+ (Packet)->Private.Count = _Count; \
+ (Packet)->Private.ValidCounts = TRUE; \
+ } \
+ \
+ if (PhysicalBufferCount) \
+ *((PUINT)PhysicalBufferCount) = (Packet)->Private.PhysicalCount; \
+ \
+ if (BufferCount) \
+ *((PUINT)BufferCount) = (Packet)->Private.Count; \
+ \
+ if (TotalPacketLength) \
+ *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \
+ } \
+}
+
+
+/*
+ * VOID
+ * NdisRecalculatePacketCounts(
+ * IN OUT PNDIS_PACKET Packet);
+ */
+#define NdisRecalculatePacketCounts(Packet) \
+{ \
+ PNDIS_BUFFER _Buffer = (Packet)->Private.Head; \
+ if (_Buffer != NULL) \
+ { \
+ while (_Buffer->Next != NULL) \
+ { \
+ ´_Buffer = _Buffer->Next; \
+ } \
+ (Packet)->Private.Tail = _Buffer; \
+ } \
+ (Packet)->Private.ValidCounts = FALSE; \
+}
+
+
+/*
+ * VOID
+ * NdisReinitializePacket(
+ * IN OUT PNDIS_PACKET Packet);
+ */
+#define NdisReinitializePacketCounts(Packet) \
+{ \
+ (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
+ (Packet)->Private.ValidCounts = FALSE; \
+}
+
+
+/*
+ * VOID
+ * NdisSetPacketFlags(
+ * IN PNDIS_PACKET Packet,
+ * IN UINT Flags);
+ */
+#define NdisSetPacketFlags(Packet, Flags) \
+ (Packet)->Private.Flags |= (Flags);
+
+
+/*
+ * VOID
+ * NDIS_SET_PACKET_HEADER_SIZE(
+ * IN PNDIS_PACKET Packet,
+ * IN UINT HdrSize);
+ */
+#define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
+
+
+/*
+ * VOID
+ * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
+ * IN PNDIS_PACKET Packet,
+ * IN PVOID MediaSpecificInfo,
+ * IN UINT SizeMediaSpecificInfo);
+ */
+#define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
+ _MediaSpecificInfo, \
+ _SizeMediaSpecificInfo) \
+{ \
+ if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) \
+ { \
+ (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
+ (_MediaSpecificInfo); \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
+ (_SizeMediaSpecificInfo); \
+ } \
+}
+
+
+/*
+ * VOID
+ * NDIS_SET_PACKET_STATUS(
+ * IN PNDIS_PACKET Packet,
+ * IN NDIS_STATUS Status);
+ */
+#define NDIS_SET_PACKET_STATUS(_Packet, _Status) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
+
+
+/*
+ * VOID
+ * NDIS_SET_PACKET_TIME_RECEIVED(
+ * IN PNDIS_PACKET Packet,
+ * IN ULONGLONG TimeReceived);
+ */
+#define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
+
+
+/*
+ * VOID
+ * NDIS_SET_PACKET_TIME_SENT(
+ * IN PNDIS_PACKET Packet,
+ * IN ULONGLONG TimeSent);
+ */
+#define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
+
+
+/*
+ * VOID
+ * NDIS_SET_PACKET_TIME_TO_SEND(
+ * IN PNDIS_PACKET Packet,
+ * IN ULONGLONG TimeToSend);
+ */
+#define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend) \
+ ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
+ (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
+
+
+/*
+ * VOID
+ * NdisSetSendFlags(
+ * IN PNDIS_PACKET Packet,
+ * IN UINT Flags);
+ */
+#define NdisSetSendFlags(_Packet,_Flags)(_Packet)->Private.Flags = (_Flags)
+
+
+
+/* Memory management routines */
+
+/*
+ * VOID
+ * NdisCreateLookaheadBufferFromSharedMemory(
+ * IN PVOID pSharedMemory,
+ * IN UINT LookaheadLength,
+ * OUT PVOID *pLookaheadBuffer)
+ */
+#define NdisCreateLookaheadBufferFromSharedMemory(_pSharedMemory, \
+ _LookaheadLength, \
+ _pLookaheadBuffer) \
+ ((*(_pLookaheadBuffer)) = (_pSharedMemory))
+
+/*
+ * VOID
+ * NdisDestroyLookaheadBufferFromSharedMemory(
+ * IN PVOID pLookaheadBuffer)
+ */
+#define NdisDestroyLookaheadBufferFromSharedMemory(_pLookaheadBuffer)
+
+#if defined(i386)
+
+/*
+ * VOID
+ * NdisMoveFromMappedMemory(
+ * OUT PVOID Destination,
+ * IN PVOID Source,
+ * IN ULONG Length);
+ */
+#define NdisMoveFromMappedMemory(Destination, Source, Length) \
+ NdisMoveMappedMemory(Destination, Source, Length)
+
+/*
+ * VOID
+ * NdisMoveMappedMemory(
+ * OUT PVOID Destination,
+ * IN PVOID Source,
+ * IN ULONG Length);
+ */
+#define NdisMoveMappedMemory(Destination, Source, Length) \
+ RtlCopyMemory(Destination, Source, Length)
+
+/*
+ * VOID
+ * NdisMoveToMappedMemory(
+ * OUT PVOID Destination,
+ * IN PVOID Source,
+ * IN ULONG Length);
+ */
+#define NdisMoveToMappedMemory(Destination, Source, Length) \
+ NdisMoveMappedMemory(Destination, Source, Length)
+
+#endif /* i386 */
+
+/*
+ * VOID
+ * NdisMUpdateSharedMemory(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN ULONG Length,
+ * IN PVOID VirtualAddress,
+ * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
+ */
+#define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
+ NdisUpdateSharedMemory(_H, _L, _V, _P)
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisAllocateMemory(
+ OUT PVOID *VirtualAddress,
+ IN UINT Length,
+ IN UINT MemoryFlags,
+ IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
+
+NDISAPI
+VOID
+DDKAPI
+NdisFreeMemory(
+ IN PVOID VirtualAddress,
+ IN UINT Length,
+ IN UINT MemoryFlags);
+
+NDISAPI
+VOID
+DDKAPI
+NdisImmediateReadSharedMemory(
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ IN ULONG SharedMemoryAddress,
+ OUT PUCHAR Buffer,
+ IN ULONG Length);
+
+NDISAPI
+VOID
+DDKAPI
+NdisImmediateWriteSharedMemory(
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ IN ULONG SharedMemoryAddress,
+ IN PUCHAR Buffer,
+ IN ULONG Length);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMAllocateSharedMemory(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN ULONG Length,
+ IN BOOLEAN Cached,
+ OUT PVOID *VirtualAddress,
+ OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMAllocateSharedMemoryAsync(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN ULONG Length,
+ IN BOOLEAN Cached,
+ IN PVOID Context);
+
+#if defined(NDIS50)
+
+#define NdisUpdateSharedMemory(NdisAdapterHandle, \
+ Length, \
+ VirtualAddress, \
+ PhysicalAddress)
+
+#else
+
+NDISAPI
+VOID
+DDKAPI
+NdisUpdateSharedMemory(
+ IN NDIS_HANDLE NdisAdapterHandle,
+ IN ULONG Length,
+ IN PVOID VirtualAddress,
+ IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
+
+#endif /* defined(NDIS50) */
+
+/*
+ * ULONG
+ * NdisGetPhysicalAddressHigh(
+ * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
+ */
+#define NdisGetPhysicalAddressHigh(PhysicalAddress) \
+ ((PhysicalAddress).HighPart)
+
+/*
+ * VOID
+ * NdisSetPhysicalAddressHigh(
+ * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
+ * IN ULONG Value);
+ */
+#define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
+ ((PhysicalAddress).HighPart) = (Value)
+
+/*
+ * ULONG
+ * NdisGetPhysicalAddressLow(
+ * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
+ */
+#define NdisGetPhysicalAddressLow(PhysicalAddress) \
+ ((PhysicalAddress).LowPart)
+
+
+/*
+ * VOID
+ * NdisSetPhysicalAddressLow(
+ * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
+ * IN ULONG Value);
+ */
+#define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
+ ((PhysicalAddress).LowPart) = (Value)
+
+/*
+ * VOID
+ * NDIS_PHYSICAL_ADDRESS_CONST(
+ * IN ULONG Low,
+ * IN LONG High);
+ */
+#define NDIS_PHYSICAL_ADDRESS_CONST(Low, High) \
+ { {(ULONG)(Low), (LONG)(High)} }
+
+/*
+ * ULONG
+ * NdisEqualMemory(
+ * IN CONST VOID *Source1,
+ * IN CONST VOID *Source2,
+ * IN ULONG Length);
+ */
+#define NdisEqualMemory(Source1, Source2, Length) \
+ RtlEqualMemory(Source1, Source2, Length)
+
+/*
+ * VOID
+ * NdisFillMemory(
+ * IN PVOID Destination,
+ * IN ULONG Length,
+ * IN UCHAR Fill);
+ */
+#define NdisFillMemory(Destination, Length, Fill) \
+ RtlFillMemory(Destination, Length, Fill)
+
+/*
+ * VOID
+ * NdisZeroMappedMemory(
+ * IN PVOID Destination,
+ * IN ULONG Length);
+ */
+#define NdisZeroMappedMemory(Destination, Length) \
+ RtlZeroMemory(Destination, Length)
+
+/*
+ * VOID
+ * NdisMoveMemory(
+ * OUT PVOID Destination,
+ * IN PVOID Source,
+ * IN ULONG Length);
+ */
+#define NdisMoveMemory(Destination, Source, Length) \
+ RtlCopyMemory(Destination, Source, Length)
+
+
+/*
+ * VOID
+ * NdisRetrieveUlong(
+ * IN PULONG DestinationAddress,
+ * IN PULONG SourceAddress);
+ */
+#define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
+ RtlRetrieveUlong(DestinationAddress, SourceAddress)
+
+
+/*
+ * VOID
+ * NdisStoreUlong(
+ * IN PULONG DestinationAddress,
+ * IN ULONG Value);
+ */
+#define NdisStoreUlong(DestinationAddress, Value) \
+ RtlStoreUlong(DestinationAddress, Value)
+
+
+/*
+ * VOID
+ * NdisZeroMemory(
+ * IN PVOID Destination,
+ * IN ULONG Length)
+ */
+#define NdisZeroMemory(Destination, Length) \
+ RtlZeroMemory(Destination, Length)
+
+
+
+/* Configuration routines */
+
+NDISAPI
+VOID
+DDKAPI
+NdisOpenConfiguration(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_HANDLE ConfigurationHandle,
+ IN NDIS_HANDLE WrapperConfigurationContext);
+
+NDISAPI
+VOID
+DDKAPI
+NdisReadNetworkAddress(
+ OUT PNDIS_STATUS Status,
+ OUT PVOID *NetworkAddress,
+ OUT PUINT NetworkAddressLength,
+ IN NDIS_HANDLE ConfigurationHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisReadEisaSlotInformation(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ OUT PUINT SlotNumber,
+ OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData);
+
+NDISAPI
+VOID
+DDKAPI
+NdisReadEisaSlotInformationEx(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ OUT PUINT SlotNumber,
+ OUT PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
+ OUT PUINT NumberOfFunctions);
+
+NDISAPI
+ULONG
+DDKAPI
+NdisReadPciSlotInformation(
+ IN NDIS_HANDLE NdisAdapterHandle,
+ IN ULONG SlotNumber,
+ IN ULONG Offset,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+NDISAPI
+ULONG
+DDKAPI
+NdisWritePciSlotInformation(
+ IN NDIS_HANDLE NdisAdapterHandle,
+ IN ULONG SlotNumber,
+ IN ULONG Offset,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+
+
+/* String management routines */
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisAnsiStringToUnicodeString(
+ IN OUT PNDIS_STRING DestinationString,
+ IN PNDIS_ANSI_STRING SourceString);
+
+/*
+ * BOOLEAN
+ * NdisEqualString(
+ * IN PNDIS_STRING String1,
+ * IN PNDIS_STRING String2,
+ * IN BOOLEAN CaseInsensitive);
+ */
+#define NdisEqualString(_String1, _String2, _CaseInsensitive) \
+ RtlEqualUnicodeString(_String1, _String2, _CaseInsensitive)
+
+NDISAPI
+VOID
+DDKAPI
+NdisInitAnsiString(
+ IN OUT PNDIS_ANSI_STRING DestinationString,
+ IN PCSTR SourceString);
+
+NDISAPI
+VOID
+DDKAPI
+NdisInitUnicodeString(
+ IN OUT PNDIS_STRING DestinationString,
+ IN PCWSTR SourceString);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisUnicodeStringToAnsiString(
+ IN OUT PNDIS_ANSI_STRING DestinationString,
+ IN PNDIS_STRING SourceString);
+
+#define NdisFreeString(_s) NdisFreeMemory((_s).Buffer, (_s).MaximumLength, 0)
+#define NdisPrintString(_s) DbgPrint("%ls", (_s).Buffer)
+
+
+/* Spin lock reoutines */
+
+/*
+ * VOID
+ * NdisAllocateSpinLock(
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisAllocateSpinLock(SpinLock) \
+ KeInitializeSpinLock(&(SpinLock)->SpinLock)
+
+/*
+ * VOID
+ * NdisFreeSpinLock(
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisFreeSpinLock(SpinLock)
+
+/*
+ * VOID
+ * NdisAcquireSpinLock(
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisAcquireSpinLock(SpinLock) \
+ KeAcquireSpinLock(&(SpinLock)->SpinLock, &(SpinLock)->OldIrql)
+
+/*
+ * VOID
+ * NdisReleaseSpinLock(
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisReleaseSpinLock(SpinLock) \
+ KeReleaseSpinLock(&(SpinLock)->SpinLock,(SpinLock)->OldIrql)
+
+/*
+ * VOID
+ * NdisDprAcquireSpinLock(
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisDprAcquireSpinLock(SpinLock) \
+{ \
+ KeAcquireSpinLockAtDpcLevel(&(SpinLock)->SpinLock); \
+ (SpinLock)->OldIrql = DISPATCH_LEVEL; \
+}
+
+/*
+ * VOID
+ * NdisDprReleaseSpinLock(
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisDprReleaseSpinLock(SpinLock) \
+ KeReleaseSpinLockFromDpcLevel(&(SpinLock)->SpinLock)
+
+
+
+/* I/O routines */
+
+/*
+ * VOID
+ * NdisRawReadPortBufferUchar(
+ * IN ULONG Port,
+ * OUT PUCHAR Buffer,
+ * IN ULONG Length);
+ */
+#define NdisRawReadPortBufferUchar(Port, Buffer, Length) \
+ READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
+
+/*
+ * VOID
+ * NdisRawReadPortBufferUlong(
+ * IN ULONG Port,
+ * OUT PULONG Buffer,
+ * IN ULONG Length);
+ */
+#define NdisRawReadPortBufferUlong(Port, Buffer, Length) \
+ READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
+
+/*
+ * VOID
+ * NdisRawReadPortBufferUshort(
+ * IN ULONG Port,
+ * OUT PUSHORT Buffer,
+ * IN ULONG Length);
+ */
+#define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
+ READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
+
+
+/*
+ * VOID
+ * NdisRawReadPortUchar(
+ * IN ULONG Port,
+ * OUT PUCHAR Data);
+ */
+#define NdisRawReadPortUchar(Port, Data) \
+ *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
+
+/*
+ * VOID
+ * NdisRawReadPortUlong(
+ * IN ULONG Port,
+ * OUT PULONG Data);
+ */
+#define NdisRawReadPortUlong(Port, Data) \
+ *(Data) = READ_PORT_ULONG((PULONG)(Port))
+
+/*
+ * VOID
+ * NdisRawReadPortUshort(
+ * IN ULONG Port,
+ * OUT PUSHORT Data);
+ */
+#define NdisRawReadPortUshort(Port, Data) \
+ *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
+
+
+/*
+ * VOID
+ * NdisRawWritePortBufferUchar(
+ * IN ULONG Port,
+ * IN PUCHAR Buffer,
+ * IN ULONG Length);
+ */
+#define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
+ WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
+
+/*
+ * VOID
+ * NdisRawWritePortBufferUlong(
+ * IN ULONG Port,
+ * IN PULONG Buffer,
+ * IN ULONG Length);
+ */
+#define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
+ WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
+
+/*
+ * VOID
+ * NdisRawWritePortBufferUshort(
+ * IN ULONG Port,
+ * IN PUSHORT Buffer,
+ * IN ULONG Length);
+ */
+#define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
+ WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
+
+
+/*
+ * VOID
+ * NdisRawWritePortUchar(
+ * IN ULONG Port,
+ * IN UCHAR Data);
+ */
+#define NdisRawWritePortUchar(Port, Data) \
+ WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
+
+/*
+ * VOID
+ * NdisRawWritePortUlong(
+ * IN ULONG Port,
+ * IN ULONG Data);
+ */
+#define NdisRawWritePortUlong(Port, Data) \
+ WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
+
+/*
+ * VOID
+ * NdisRawWritePortUshort(
+ * IN ULONG Port,
+ * IN USHORT Data);
+ */
+#define NdisRawWritePortUshort(Port, Data) \
+ WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
+
+
+/*
+ * VOID
+ * NdisReadRegisterUchar(
+ * IN PUCHAR Register,
+ * OUT PUCHAR Data);
+ */
+#define NdisReadRegisterUchar(Register, Data) \
+ *(Data) = *(Register)
+
+/*
+ * VOID
+ * NdisReadRegisterUlong(
+ * IN PULONG Register,
+ * OUT PULONG Data);
+ */
+#define NdisReadRegisterUlong(Register, Data) \
+ *(Data) = *(Register)
+
+/*
+ * VOID
+ * NdisReadRegisterUshort(
+ * IN PUSHORT Register,
+ * OUT PUSHORT Data);
+ */
+#define NdisReadRegisterUshort(Register, Data) \
+ *(Data) = *(Register)
+
+/*
+ * VOID
+ * NdisReadRegisterUchar(
+ * IN PUCHAR Register,
+ * IN UCHAR Data);
+ */
+#define NdisWriteRegisterUchar(Register, Data) \
+ WRITE_REGISTER_UCHAR((Register), (Data))
+
+/*
+ * VOID
+ * NdisReadRegisterUlong(
+ * IN PULONG Register,
+ * IN ULONG Data);
+ */
+#define NdisWriteRegisterUlong(Register, Data) \
+ WRITE_REGISTER_ULONG((Register), (Data))
+
+/*
+ * VOID
+ * NdisReadRegisterUshort(
+ * IN PUSHORT Register,
+ * IN USHORT Data);
+ */
+#define NdisWriteRegisterUshort(Register, Data) \
+ WRITE_REGISTER_USHORT((Register), (Data))
+
+
+/* Linked lists */
+
+/*
+ * VOID
+ * NdisInitializeListHead(
+ * IN PLIST_ENTRY ListHead);
+ */
+#define NdisInitializeListHead(_ListHead) \
+ InitializeListHead(_ListHead)
+
+/*
+ * PLIST_ENTRY
+ * NdisInterlockedInsertHeadList(
+ * IN PLIST_ENTRY ListHead,
+ * IN PLIST_ENTRY ListEntry,
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \
+ ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
+
+/*
+ * PLIST_ENTRY
+ * NdisInterlockedInsertTailList(
+ * IN PLIST_ENTRY ListHead,
+ * IN PLIST_ENTRY ListEntry,
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \
+ ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
+
+/*
+ * PLIST_ENTRY
+ * NdisInterlockedRemoveHeadList(
+ * IN PLIST_ENTRY ListHead,
+ * IN PNDIS_SPIN_LOCK SpinLock);
+*/
+#define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \
+ ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock)
+
+/*
+ * VOID
+ * NdisInitializeSListHead(
+ * IN PSLIST_HEADER SListHead);
+ */
+#define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead)
+
+/*
+ * USHORT NdisQueryDepthSList(
+ * IN PSLIST_HEADER SListHead);
+ */
+#define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead)
+
+
+
+/* Interlocked routines */
+
+/*
+ * LONG
+ * NdisInterlockedDecrement(
+ * IN PLONG Addend);
+ */
+#define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend)
+
+/*
+ * LONG
+ * NdisInterlockedIncrement(
+ * IN PLONG Addend);
+ */
+#define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend)
+
+/*
+ * VOID
+ * NdisInterlockedAddUlong(
+ * IN PULONG Addend,
+ * IN ULONG Increment,
+ * IN PNDIS_SPIN_LOCK SpinLock);
+ */
+#define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \
+ ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock)
+
+
+
+/* Miscellaneous routines */
+
+NDISAPI
+VOID
+DDKAPI
+NdisCloseConfiguration(
+ IN NDIS_HANDLE ConfigurationHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisReadConfiguration(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
+ IN NDIS_HANDLE ConfigurationHandle,
+ IN PNDIS_STRING Keyword,
+ IN NDIS_PARAMETER_TYPE ParameterType);
+
+NDISAPI
+VOID
+DDKAPI
+NdisWriteConfiguration(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ IN PNDIS_STRING Keyword,
+ IN PNDIS_CONFIGURATION_PARAMETER *ParameterValue);
+
+NDISAPI
+VOID
+DDKCDECLAPI
+NdisWriteErrorLogEntry(
+ IN NDIS_HANDLE NdisAdapterHandle,
+ IN NDIS_ERROR_CODE ErrorCode,
+ IN ULONG NumberOfErrorValues,
+ IN ...);
+
+/*
+ * VOID
+ * NdisStallExecution(
+ * IN UINT MicrosecondsToStall)
+ */
+#define NdisStallExecution KeStallExecutionProcessor
+
+/*
+ * VOID
+ * NdisGetCurrentSystemTime(
+ * IN PLARGE_INTEGER pSystemTime);
+ */
+#define NdisGetCurrentSystemTime KeQuerySystemTime
+
+NDISAPI
+VOID
+DDKAPI
+NdisGetCurrentProcessorCpuUsage(
+ OUT PULONG pCpuUsage);
+
+
+
+/* NDIS helper macros */
+
+/*
+ * VOID
+ * NDIS_INIT_FUNCTION(FunctionName)
+ */
+#define NDIS_INIT_FUNCTION(FunctionName) \
+ alloc_text(init, FunctionName)
+
+/*
+ * VOID
+ * NDIS_PAGABLE_FUNCTION(FunctionName)
+ */
+#define NDIS_PAGEABLE_FUNCTION(FunctionName) \
+ alloc_text(page, FunctionName)
+
+#define NDIS_PAGABLE_FUNCTION NDIS_PAGEABLE_FUNCTION
+
+
+/* NDIS 4.0 extensions */
+
+NDISAPI
+VOID
+DDKAPI
+NdisMFreeSharedMemory(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN ULONG Length,
+ IN BOOLEAN Cached,
+ IN PVOID VirtualAddress,
+ IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMWanIndicateReceive(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE NdisLinkContext,
+ IN PUCHAR PacketBuffer,
+ IN UINT PacketSize);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMWanIndicateReceiveComplete(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMWanSendComplete(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PNDIS_WAN_PACKET Packet,
+ IN NDIS_STATUS Status);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisPciAssignResources(
+ IN NDIS_HANDLE NdisMacHandle,
+ IN NDIS_HANDLE NdisWrapperHandle,
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ IN ULONG SlotNumber,
+ OUT PNDIS_RESOURCE_LIST *AssignedResources);
+
+
+/* NDIS 5.0 extensions */
+
+NDISAPI
+VOID
+DDKAPI
+NdisAcquireReadWriteLock(
+ IN PNDIS_RW_LOCK Lock,
+ IN BOOLEAN fWrite,
+ IN PLOCK_STATE LockState);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisAllocateMemoryWithTag(
+ OUT PVOID *VirtualAddress,
+ IN UINT Length,
+ IN ULONG Tag);
+
+NDISAPI
+VOID
+DDKAPI
+NdisAllocatePacketPoolEx(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_HANDLE PoolHandle,
+ IN UINT NumberOfDescriptors,
+ IN UINT NumberOfOverflowDescriptors,
+ IN UINT ProtocolReservedLength);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCompletePnPEvent(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN PNET_PNP_EVENT NetPnPEvent);
+
+NDISAPI
+VOID
+DDKAPI
+NdisGetCurrentProcessorCounts(
+ OUT PULONG pIdleCount,
+ OUT PULONG pKernelAndUser,
+ OUT PULONG pIndex);
+
+NDISAPI
+VOID
+DDKAPI
+NdisGetDriverHandle(
+ IN PNDIS_HANDLE NdisBindingHandle,
+ OUT PNDIS_HANDLE NdisDriverHandle);
+
+NDISAPI
+PNDIS_PACKET
+DDKAPI
+NdisGetReceivedPacket(
+ IN PNDIS_HANDLE NdisBindingHandle,
+ IN PNDIS_HANDLE MacContext);
+
+NDISAPI
+VOID
+DDKAPI
+NdisGetSystemUptime(
+ OUT PULONG pSystemUpTime);
+
+NDISAPI
+VOID
+DDKAPI
+NdisInitializeReadWriteLock(
+ IN PNDIS_RW_LOCK Lock);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMDeregisterDevice(
+ IN NDIS_HANDLE NdisDeviceHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMGetDeviceProperty(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN OUT PDEVICE_OBJECT *PhysicalDeviceObject OPTIONAL,
+ IN OUT PDEVICE_OBJECT *FunctionalDeviceObject OPTIONAL,
+ IN OUT PDEVICE_OBJECT *NextDeviceObject OPTIONAL,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResources OPTIONAL,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResourcesTranslated OPTIONAL);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMInitializeScatterGatherDma(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN BOOLEAN Dma64BitAddresses,
+ IN ULONG MaximumPhysicalMapping);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMPromoteMiniport(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMQueryAdapterInstanceName(
+ OUT PNDIS_STRING AdapterInstanceName,
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMRegisterDevice(
+ IN NDIS_HANDLE NdisWrapperHandle,
+ IN PNDIS_STRING DeviceName,
+ IN PNDIS_STRING SymbolicName,
+ IN PDRIVER_DISPATCH MajorFunctions[],
+ OUT PDEVICE_OBJECT *pDeviceObject,
+ OUT NDIS_HANDLE *NdisDeviceHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMRegisterUnloadHandler(
+ IN NDIS_HANDLE NdisWrapperHandle,
+ IN PDRIVER_UNLOAD UnloadHandler);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMRemoveMiniport(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMSetMiniportSecondary(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE PrimaryMiniportAdapterHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisOpenConfigurationKeyByIndex(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE ConfigurationHandle,
+ IN ULONG Index,
+ OUT PNDIS_STRING KeyName,
+ OUT PNDIS_HANDLE KeyHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisOpenConfigurationKeyByName(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE ConfigurationHandle,
+ IN PNDIS_STRING SubKeyName,
+ OUT PNDIS_HANDLE SubKeyHandle);
+
+NDISAPI
+UINT
+DDKAPI
+NdisPacketPoolUsage(
+ IN NDIS_HANDLE PoolHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisQueryAdapterInstanceName(
+ OUT PNDIS_STRING AdapterInstanceName,
+ IN NDIS_HANDLE NdisBindingHandle);
+
+NDISAPI
+ULONG
+DDKAPI
+NdisReadPcmciaAttributeMemory(
+ IN NDIS_HANDLE NdisAdapterHandle,
+ IN ULONG Offset,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+NDISAPI
+VOID
+DDKAPI
+NdisReleaseReadWriteLock(
+ IN PNDIS_RW_LOCK Lock,
+ IN PLOCK_STATE LockState);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisWriteEventLogEntry(
+ IN PVOID LogHandle,
+ IN NDIS_STATUS EventCode,
+ IN ULONG UniqueEventValue,
+ IN USHORT NumStrings,
+ IN PVOID StringsList OPTIONAL,
+ IN ULONG DataSize,
+ IN PVOID Data OPTIONAL);
+
+NDISAPI
+ULONG
+DDKAPI
+NdisWritePcmciaAttributeMemory(
+ IN NDIS_HANDLE NdisAdapterHandle,
+ IN ULONG Offset,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+
+/* Connectionless services */
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClAddParty(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN NDIS_HANDLE ProtocolPartyContext,
+ IN OUT PCO_CALL_PARAMETERS CallParameters,
+ OUT PNDIS_HANDLE NdisPartyHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClCloseAddressFamily(
+ IN NDIS_HANDLE NdisAfHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClCloseCall(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
+ IN PVOID Buffer OPTIONAL,
+ IN UINT Size);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClDeregisterSap(
+ IN NDIS_HANDLE NdisSapHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClDropParty(
+ IN NDIS_HANDLE NdisPartyHandle,
+ IN PVOID Buffer OPTIONAL,
+ IN UINT Size);
+
+NDISAPI
+VOID
+DDKAPI
+NdisClIncomingCallComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClMakeCall(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN OUT PCO_CALL_PARAMETERS CallParameters,
+ IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
+ OUT PNDIS_HANDLE NdisPartyHandle OPTIONAL);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClModifyCallQoS(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClOpenAddressFamily(
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN PCO_ADDRESS_FAMILY AddressFamily,
+ IN NDIS_HANDLE ProtocolAfContext,
+ IN PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics,
+ IN UINT SizeOfClCharacteristics,
+ OUT PNDIS_HANDLE NdisAfHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisClRegisterSap(
+ IN NDIS_HANDLE NdisAfHandle,
+ IN NDIS_HANDLE ProtocolSapContext,
+ IN PCO_SAP Sap,
+ OUT PNDIS_HANDLE NdisSapHandle);
+
+
+/* Call Manager services */
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisCmActivateVc(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN OUT PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmAddPartyComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisPartyHandle,
+ IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmCloseAddressFamilyComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisAfHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmCloseCallComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisCmDeactivateVc(
+ IN NDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmDeregisterSapComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisSapHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmDispatchCallConnected(
+ IN NDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisCmDispatchIncomingCall(
+ IN NDIS_HANDLE NdisSapHandle,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmDispatchIncomingCallQoSChange(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmDispatchIncomingCloseCall(
+ IN NDIS_STATUS CloseStatus,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PVOID Buffer OPTIONAL,
+ IN UINT Size);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmDispatchIncomingDropParty(
+ IN NDIS_STATUS DropStatus,
+ IN NDIS_HANDLE NdisPartyHandle,
+ IN PVOID Buffer OPTIONAL,
+ IN UINT Size);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmDropPartyComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisPartyHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmMakeCallComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
+ IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmModifyCallQoSComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmOpenAddressFamilyComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisAfHandle,
+ IN NDIS_HANDLE CallMgrAfContext);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisCmRegisterAddressFamily(
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN PCO_ADDRESS_FAMILY AddressFamily,
+ IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
+ IN UINT SizeOfCmCharacteristics);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCmRegisterSapComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisSapHandle,
+ IN NDIS_HANDLE CallMgrSapContext);
+
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMCmActivateVc(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMCmCreateVc(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE NdisAfHandle,
+ IN NDIS_HANDLE MiniportVcContext,
+ OUT PNDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMCmDeactivateVc(
+ IN NDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMCmDeleteVc(
+ IN NDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMCmRegisterAddressFamily(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PCO_ADDRESS_FAMILY AddressFamily,
+ IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
+ IN UINT SizeOfCmCharacteristics);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMCmRequest(
+ IN NDIS_HANDLE NdisAfHandle,
+ IN NDIS_HANDLE NdisVcHandle OPTIONAL,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
+ IN OUT PNDIS_REQUEST NdisRequest);
+
+
+/* Connection-oriented services */
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisCoCreateVc(
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN NDIS_HANDLE NdisAfHandle OPTIONAL,
+ IN NDIS_HANDLE ProtocolVcContext,
+ IN OUT PNDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisCoDeleteVc(
+ IN NDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisCoRequest(
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN NDIS_HANDLE NdisAfHandle OPTIONAL,
+ IN NDIS_HANDLE NdisVcHandle OPTIONAL,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
+ IN OUT PNDIS_REQUEST NdisRequest);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCoRequestComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisAfHandle,
+ IN NDIS_HANDLE NdisVcHandle OPTIONAL,
+ IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
+ IN PNDIS_REQUEST NdisRequest);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCoSendPackets(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PPNDIS_PACKET PacketArray,
+ IN UINT NumberOfPackets);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCoActivateVcComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PCO_CALL_PARAMETERS CallParameters);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCoDeactivateVcComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisVcHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCoIndicateReceivePacket(
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PPNDIS_PACKET PacketArray,
+ IN UINT NumberOfPackets);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCoIndicateStatus(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE NdisVcHandle OPTIONAL,
+ IN NDIS_STATUS GeneralStatus,
+ IN PVOID StatusBuffer OPTIONAL,
+ IN ULONG StatusBufferSize);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCoReceiveComplete(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCoRequestComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PNDIS_REQUEST Request);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCoSendComplete(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisVcHandle,
+ IN PNDIS_PACKET Packet);
+
+
+/* NDIS 5.0 extensions for intermediate drivers */
+
+NDISAPI
+VOID
+DDKAPI
+NdisIMAssociateMiniport(
+ IN NDIS_HANDLE DriverHandle,
+ IN NDIS_HANDLE ProtocolHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisIMCancelInitializeDeviceInstance(
+ IN NDIS_HANDLE DriverHandle,
+ IN PNDIS_STRING DeviceInstance);
+
+NDISAPI
+VOID
+DDKAPI
+NdisIMCopySendCompletePerPacketInfo(
+ IN PNDIS_PACKET DstPacket,
+ IN PNDIS_PACKET SrcPacket);
+
+NDISAPI
+VOID
+DDKAPI
+NdisIMCopySendPerPacketInfo(
+ IN PNDIS_PACKET DstPacket,
+ IN PNDIS_PACKET SrcPacket);
+
+NDISAPI
+VOID
+DDKAPI
+NdisIMDeregisterLayeredMiniport(
+ IN NDIS_HANDLE DriverHandle);
+
+NDISAPI
+NDIS_HANDLE
+DDKAPI
+NdisIMGetBindingContext(
+ IN NDIS_HANDLE NdisBindingHandle);
+
+NDISAPI
+NDIS_HANDLE
+DDKAPI
+NdisIMGetDeviceContext(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisIMInitializeDeviceInstanceEx(
+ IN NDIS_HANDLE DriverHandle,
+ IN PNDIS_STRING DriverInstance,
+ IN NDIS_HANDLE DeviceContext OPTIONAL);
+
+NDISAPI
+PSINGLE_LIST_ENTRY
+DDKAPI
+NdisInterlockedPopEntrySList(
+ IN PSLIST_HEADER ListHead,
+ IN PKSPIN_LOCK Lock);
+
+NDISAPI
+PSINGLE_LIST_ENTRY
+DDKAPI
+NdisInterlockedPushEntrySList(
+ IN PSLIST_HEADER ListHead,
+ IN PSINGLE_LIST_ENTRY ListEntry,
+ IN PKSPIN_LOCK Lock);
+
+NDISAPI
+VOID
+DDKAPI
+NdisQueryBufferSafe(
+ IN PNDIS_BUFFER Buffer,
+ OUT PVOID *VirtualAddress OPTIONAL,
+ OUT PUINT Length,
+ IN UINT Priority);
+
+
+/* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
+
+typedef BOOLEAN DDKAPI
+(*W_CHECK_FOR_HANG_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext);
+
+typedef VOID DDKAPI
+(*W_DISABLE_INTERRUPT_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext);
+
+typedef VOID DDKAPI
+(*W_ENABLE_INTERRUPT_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext);
+
+typedef VOID DDKAPI
+(*W_HALT_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext);
+
+typedef VOID DDKAPI
+(*W_HANDLE_INTERRUPT_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext);
+
+typedef NDIS_STATUS DDKAPI
+(*W_INITIALIZE_HANDLER)(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ OUT PUINT SelectedMediumIndex,
+ IN PNDIS_MEDIUM MediumArray,
+ IN UINT MediumArraySize,
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_HANDLE WrapperConfigurationContext);
+
+typedef VOID DDKAPI
+(*W_ISR_HANDLER)(
+ OUT PBOOLEAN InterruptRecognized,
+ OUT PBOOLEAN QueueMiniportHandleInterrupt,
+ IN NDIS_HANDLE MiniportAdapterContext);
+
+typedef NDIS_STATUS DDKAPI
+(*W_QUERY_INFORMATION_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesWritten,
+ OUT PULONG BytesNeeded);
+
+typedef NDIS_STATUS DDKAPI
+(*W_RECONFIGURE_HANDLER)(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_HANDLE WrapperConfigurationContext);
+
+typedef NDIS_STATUS DDKAPI
+(*W_RESET_HANDLER)(
+ OUT PBOOLEAN AddressingReset,
+ IN NDIS_HANDLE MiniportAdapterContext);
+
+typedef NDIS_STATUS DDKAPI
+(*W_SEND_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN PNDIS_PACKET Packet,
+ IN UINT Flags);
+
+typedef NDIS_STATUS DDKAPI
+(*WM_SEND_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_HANDLE NdisLinkHandle,
+ IN PNDIS_WAN_PACKET Packet);
+
+typedef NDIS_STATUS DDKAPI
+(*W_SET_INFORMATION_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_OID Oid,
+ IN PVOID InformationBuffer,
+ IN ULONG InformationBufferLength,
+ OUT PULONG BytesRead,
+ OUT PULONG BytesNeeded);
+
+typedef NDIS_STATUS DDKAPI
+(*W_TRANSFER_DATA_HANDLER)(
+ OUT PNDIS_PACKET Packet,
+ OUT PUINT BytesTransferred,
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_HANDLE MiniportReceiveContext,
+ IN UINT ByteOffset,
+ IN UINT BytesToTransfer);
+
+typedef NDIS_STATUS DDKAPI
+(*WM_TRANSFER_DATA_HANDLER)(
+ VOID);
+
+
+/* NDIS structures available only to miniport drivers */
+
+#define NDIS30_MINIPORT_CHARACTERISTICS_S \
+ UCHAR MajorNdisVersion; \
+ UCHAR MinorNdisVersion; \
+ UINT Reserved; \
+ W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; \
+ W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; \
+ W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; \
+ W_HALT_HANDLER HaltHandler; \
+ W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; \
+ W_INITIALIZE_HANDLER InitializeHandler; \
+ W_ISR_HANDLER ISRHandler; \
+ W_QUERY_INFORMATION_HANDLER QueryInformationHandler; \
+ W_RECONFIGURE_HANDLER ReconfigureHandler; \
+ W_RESET_HANDLER ResetHandler; \
+ union { \
+ W_SEND_HANDLER SendHandler; \
+ WM_SEND_HANDLER WanSendHandler; \
+ } u1; \
+ W_SET_INFORMATION_HANDLER SetInformationHandler; \
+ union { \
+ W_TRANSFER_DATA_HANDLER TransferDataHandler; \
+ WM_TRANSFER_DATA_HANDLER WanTransferDataHandler; \
+ } u2;
+
+typedef struct _NDIS30_MINIPORT_CHARACTERISTICS {
+ NDIS30_MINIPORT_CHARACTERISTICS_S;
+} NDIS30_MINIPORT_CHARACTERISTICS, *PSNDIS30_MINIPORT_CHARACTERISTICS;
+
+
+/* Extensions for NDIS 4.0 miniports */
+
+typedef VOID DDKAPI
+(*W_SEND_PACKETS_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN PPNDIS_PACKET PacketArray,
+ IN UINT NumberOfPackets);
+
+typedef VOID DDKAPI
+(*W_RETURN_PACKET_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN PNDIS_PACKET Packet);
+
+typedef VOID DDKAPI
+(*W_ALLOCATE_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN PVOID VirtualAddress,
+ IN PNDIS_PHYSICAL_ADDRESS PhysicalAddress,
+ IN ULONG Length,
+ IN PVOID Context);
+
+#ifdef __cplusplus
+
+#define NDIS40_MINIPORT_CHARACTERISTICS_S \
+ NDIS30_MINIPORT_CHARACTERISTICS Ndis30Chars; \
+ W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
+ W_SEND_PACKETS_HANDLER SendPacketsHandler; \
+ W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
+
+#else /* !__cplusplus */
+
+#define NDIS40_MINIPORT_CHARACTERISTICS_S \
+ NDIS30_MINIPORT_CHARACTERISTICS_S; \
+ W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
+ W_SEND_PACKETS_HANDLER SendPacketsHandler; \
+ W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
+
+#endif /* !__cplusplus */
+
+typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
+ NDIS40_MINIPORT_CHARACTERISTICS_S;
+} NDIS40_MINIPORT_CHARACTERISTICS, *PNDIS40_MINIPORT_CHARACTERISTICS;
+
+
+/* Extensions for NDIS 5.0 miniports */
+
+typedef NDIS_STATUS DDKAPI
+(*W_CO_CREATE_VC_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_HANDLE NdisVcHandle,
+ OUT PNDIS_HANDLE MiniportVcContext);
+
+typedef NDIS_STATUS DDKAPI
+(*W_CO_DELETE_VC_HANDLER)(
+ IN NDIS_HANDLE MiniportVcContext);
+
+typedef NDIS_STATUS DDKAPI
+(*W_CO_ACTIVATE_VC_HANDLER)(
+ IN NDIS_HANDLE MiniportVcContext,
+ IN OUT PCO_CALL_PARAMETERS CallParameters);
+
+typedef NDIS_STATUS DDKAPI
+(*W_CO_DEACTIVATE_VC_HANDLER)(
+ IN NDIS_HANDLE MiniportVcContext);
+
+typedef VOID DDKAPI
+(*W_CO_SEND_PACKETS_HANDLER)(
+ IN NDIS_HANDLE MiniportVcContext,
+ IN PPNDIS_PACKET PacketArray,
+ IN UINT NumberOfPackets);
+
+typedef NDIS_STATUS DDKAPI
+(*W_CO_REQUEST_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN NDIS_HANDLE MiniportVcContext OPTIONAL,
+ IN OUT PNDIS_REQUEST NdisRequest);
+
+#ifdef __cplusplus
+
+#define NDIS50_MINIPORT_CHARACTERISTICS_S \
+ NDIS40_MINIPORT_CHARACTERISTICS_S Ndis40Chars; \
+ W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
+ W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
+ W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
+ W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
+ W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
+ W_CO_REQUEST_HANDLER CoRequestHandler;
+
+#else /* !__cplusplus */
+
+#define NDIS50_MINIPORT_CHARACTERISTICS_S \
+ NDIS40_MINIPORT_CHARACTERISTICS_S; \
+ W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
+ W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
+ W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
+ W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
+ W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
+ W_CO_REQUEST_HANDLER CoRequestHandler;
+
+#endif /* !__cplusplus */
+
+typedef struct _NDIS50_MINIPORT_CHARACTERISTICS {
+ NDIS50_MINIPORT_CHARACTERISTICS_S;
+} NDIS50_MINIPORT_CHARACTERISTICS, *PSNDIS50_MINIPORT_CHARACTERISTICS;
+
+
+/* Extensions for NDIS 5.1 miniports */
+
+typedef VOID DDKAPI
+(*W_CANCEL_SEND_PACKETS_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN PVOID CancelId);
+
+
+#if defined(NDIS51)
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+ NDIS50_MINIPORT_CHARACTERISTICS_S;
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#elif defined(NDIS50)
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+ NDIS50_MINIPORT_CHARACTERISTICS_S;
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#elif defined(NDIS40)
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+ NDIS40_MINIPORT_CHARACTERISTICS_S;
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#elif defined(NDIS30)
+typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
+ NDIS30_MINIPORT_CHARACTERISTICS_S;
+} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
+#endif /* NDIS30 */
+
+
+typedef NDIS_STATUS DDKAPI
+(*SEND_HANDLER)(
+ IN NDIS_HANDLE MacBindingHandle,
+ IN PNDIS_PACKET Packet);
+
+typedef NDIS_STATUS DDKAPI
+(*TRANSFER_DATA_HANDLER)(
+ IN NDIS_HANDLE MacBindingHandle,
+ IN NDIS_HANDLE MacReceiveContext,
+ IN UINT ByteOffset,
+ IN UINT BytesToTransfer,
+ OUT PNDIS_PACKET Packet,
+ OUT PUINT BytesTransferred);
+
+typedef NDIS_STATUS DDKAPI
+(*RESET_HANDLER)(
+ IN NDIS_HANDLE MacBindingHandle);
+
+typedef NDIS_STATUS DDKAPI
+(*REQUEST_HANDLER)(
+ IN NDIS_HANDLE MacBindingHandle,
+ IN PNDIS_REQUEST NdisRequest);
+
+
+
+/* Structures available only to full MAC drivers */
+
+typedef BOOLEAN DDKAPI
+(*PNDIS_INTERRUPT_SERVICE)(
+ IN PVOID InterruptContext);
+
+typedef VOID DDKAPI
+(*PNDIS_DEFERRED_PROCESSING)(
+ IN PVOID SystemSpecific1,
+ IN PVOID InterruptContext,
+ IN PVOID SystemSpecific2,
+ IN PVOID SystemSpecific3);
+
+
+
+typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK, *PNDIS_MINIPORT_BLOCK;
+typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
+typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK;
+typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
+typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST;
+
+
+typedef struct _NDIS_MINIPORT_INTERRUPT {
+ PKINTERRUPT InterruptObject;
+ KSPIN_LOCK DpcCountLock;
+ PVOID MiniportIdField;
+ W_ISR_HANDLER MiniportIsr;
+ W_HANDLE_INTERRUPT_HANDLER MiniportDpc;
+ KDPC InterruptDpc;
+ PNDIS_MINIPORT_BLOCK Miniport;
+ UCHAR DpcCount;
+ BOOLEAN Filler1;
+ KEVENT DpcsCompletedEvent;
+ BOOLEAN SharedInterrupt;
+ BOOLEAN IsrRequested;
+} NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
+
+typedef struct _NDIS_MINIPORT_TIMER {
+ KTIMER Timer;
+ KDPC Dpc;
+ PNDIS_TIMER_FUNCTION MiniportTimerFunction;
+ PVOID MiniportTimerContext;
+ PNDIS_MINIPORT_BLOCK Miniport;
+ struct _NDIS_MINIPORT_TIMER *NextDeferredTimer;
+} NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
+
+typedef struct _NDIS_INTERRUPT {
+ PKINTERRUPT InterruptObject;
+ KSPIN_LOCK DpcCountLock;
+ PNDIS_INTERRUPT_SERVICE MacIsr;
+ PNDIS_DEFERRED_PROCESSING MacDpc;
+ KDPC InterruptDpc;
+ PVOID InterruptContext;
+ UCHAR DpcCount;
+ BOOLEAN Removing;
+ KEVENT DpcsCompletedEvent;
+} NDIS_INTERRUPT, *PNDIS_INTERRUPT;
+
+
+typedef struct _MAP_REGISTER_ENTRY {
+ PVOID MapRegister;
+ BOOLEAN WriteToDevice;
+} MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY;
+
+
+typedef enum _NDIS_WORK_ITEM_TYPE {
+ NdisWorkItemRequest,
+ NdisWorkItemSend,
+ NdisWorkItemReturnPackets,
+ NdisWorkItemResetRequested,
+ NdisWorkItemResetInProgress,
+ NdisWorkItemHalt,
+ NdisWorkItemSendLoopback,
+ NdisWorkItemMiniportCallback,
+ NdisMaxWorkItems
+} NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
+
+#define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
+#define NUMBER_OF_SINGLE_WORK_ITEMS 6
+
+typedef struct _NDIS_MINIPORT_WORK_ITEM {
+ SINGLE_LIST_ENTRY Link;
+ NDIS_WORK_ITEM_TYPE WorkItemType;
+ PVOID WorkItemContext;
+} NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
+
+
+typedef struct _NDIS_BIND_PATHS {
+ UINT Number;
+ NDIS_STRING Paths[1];
+} NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
+
+#define DECLARE_UNKNOWN_STRUCT(BaseName) \
+ typedef struct _##BaseName BaseName, *P##BaseName;
+
+#define DECLARE_UNKNOWN_PROTOTYPE(Name) \
+ typedef VOID (*##Name)(VOID);
+
+#define ETH_LENGTH_OF_ADDRESS 6
+
+DECLARE_UNKNOWN_STRUCT(ETH_BINDING_INFO);
+
+DECLARE_UNKNOWN_PROTOTYPE(ETH_ADDRESS_CHANGE)
+DECLARE_UNKNOWN_PROTOTYPE(ETH_FILTER_CHANGE)
+DECLARE_UNKNOWN_PROTOTYPE(ETH_DEFERRED_CLOSE)
+
+typedef struct _ETH_FILTER {
+ PNDIS_SPIN_LOCK Lock;
+ CHAR (*MCastAddressBuf)[ETH_LENGTH_OF_ADDRESS];
+ struct _NDIS_MINIPORT_BLOCK *Miniport;
+ UINT CombinedPacketFilter;
+ PETH_BINDING_INFO OpenList;
+ ETH_ADDRESS_CHANGE AddressChangeAction;
+ ETH_FILTER_CHANGE FilterChangeAction;
+ ETH_DEFERRED_CLOSE CloseAction;
+ UINT MaxMulticastAddresses;
+ UINT NumAddresses;
+ UCHAR AdapterAddress[ETH_LENGTH_OF_ADDRESS];
+ UINT OldCombinedPacketFilter;
+ CHAR (*OldMCastAddressBuf)[ETH_LENGTH_OF_ADDRESS];
+ UINT OldNumAddresses;
+ PETH_BINDING_INFO DirectedList;
+ PETH_BINDING_INFO BMList;
+ PETH_BINDING_INFO MCastSet;
+#if defined(_NDIS_)
+ UINT NumOpens;
+ PVOID BindListLock;
+#endif
+} ETH_FILTER, *PETH_FILTER;
+
+typedef VOID DDKAPI
+(*ETH_RCV_COMPLETE_HANDLER)(
+ IN PETH_FILTER Filter);
+
+typedef VOID DDKAPI
+(*ETH_RCV_INDICATE_HANDLER)(
+ IN PETH_FILTER Filter,
+ IN NDIS_HANDLE MacReceiveContext,
+ IN PCHAR Address,
+ IN PVOID HeaderBuffer,
+ IN UINT HeaderBufferSize,
+ IN PVOID LookaheadBuffer,
+ IN UINT LookaheadBufferSize,
+ IN UINT PacketSize);
+
+typedef VOID DDKAPI
+(*FDDI_RCV_COMPLETE_HANDLER)(
+ IN PFDDI_FILTER Filter);
+
+typedef VOID DDKAPI
+(*FDDI_RCV_INDICATE_HANDLER)(
+ IN PFDDI_FILTER Filter,
+ IN NDIS_HANDLE MacReceiveContext,
+ IN PCHAR Address,
+ IN UINT AddressLength,
+ IN PVOID HeaderBuffer,
+ IN UINT HeaderBufferSize,
+ IN PVOID LookaheadBuffer,
+ IN UINT LookaheadBufferSize,
+ IN UINT PacketSize);
+
+typedef VOID DDKAPI
+(*FILTER_PACKET_INDICATION_HANDLER)(
+ IN NDIS_HANDLE Miniport,
+ IN PPNDIS_PACKET PacketArray,
+ IN UINT NumberOfPackets);
+
+typedef VOID DDKAPI
+(*TR_RCV_COMPLETE_HANDLER)(
+ IN PTR_FILTER Filter);
+
+typedef VOID DDKAPI
+(*TR_RCV_INDICATE_HANDLER)(
+ IN PTR_FILTER Filter,
+ IN NDIS_HANDLE MacReceiveContext,
+ IN PVOID HeaderBuffer,
+ IN UINT HeaderBufferSize,
+ IN PVOID LookaheadBuffer,
+ IN UINT LookaheadBufferSize,
+ IN UINT PacketSize);
+
+typedef VOID DDKAPI
+(*WAN_RCV_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE NdisLinkContext);
+
+typedef VOID DDKAPI
+(*WAN_RCV_HANDLER)(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE NdisLinkContext,
+ IN PUCHAR Packet,
+ IN ULONG PacketSize);
+
+typedef VOID DDKFASTAPI
+(*NDIS_M_DEQUEUE_WORK_ITEM)(
+ IN PNDIS_MINIPORT_BLOCK Miniport,
+ IN NDIS_WORK_ITEM_TYPE WorkItemType,
+ OUT PVOID *WorkItemContext);
+
+typedef NDIS_STATUS DDKFASTAPI
+(*NDIS_M_QUEUE_NEW_WORK_ITEM)(
+ IN PNDIS_MINIPORT_BLOCK Miniport,
+ IN NDIS_WORK_ITEM_TYPE WorkItemType,
+ IN PVOID WorkItemContext);
+
+typedef NDIS_STATUS DDKFASTAPI
+(*NDIS_M_QUEUE_WORK_ITEM)(
+ IN PNDIS_MINIPORT_BLOCK Miniport,
+ IN NDIS_WORK_ITEM_TYPE WorkItemType,
+ IN PVOID WorkItemContext);
+
+typedef VOID DDKAPI
+(*NDIS_M_REQ_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_STATUS Status);
+
+typedef VOID DDKAPI
+(*NDIS_M_RESET_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_STATUS Status,
+ IN BOOLEAN AddressingReset);
+
+typedef VOID DDKAPI
+(*NDIS_M_SEND_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PNDIS_PACKET Packet,
+ IN NDIS_STATUS Status);
+
+typedef VOID DDKAPI
+(*NDIS_M_SEND_RESOURCES_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+typedef BOOLEAN DDKFASTAPI
+(*NDIS_M_START_SENDS)(
+ IN PNDIS_MINIPORT_BLOCK Miniport);
+
+typedef VOID DDKAPI
+(*NDIS_M_STATUS_HANDLER)(
+ IN NDIS_HANDLE MiniportHandle,
+ IN NDIS_STATUS GeneralStatus,
+ IN PVOID StatusBuffer,
+ IN UINT StatusBufferSize);
+
+typedef VOID DDKAPI
+(*NDIS_M_STS_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+typedef VOID DDKAPI
+(*NDIS_M_TD_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PNDIS_PACKET Packet,
+ IN NDIS_STATUS Status,
+ IN UINT BytesTransferred);
+
+typedef VOID (DDKAPI *NDIS_WM_SEND_COMPLETE_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PVOID Packet,
+ IN NDIS_STATUS Status);
+
+
+#if ARCNET
+
+#define ARC_SEND_BUFFERS 8
+#define ARC_HEADER_SIZE 4
+
+typedef struct _NDIS_ARC_BUF {
+ NDIS_HANDLE ArcnetBufferPool;
+ PUCHAR ArcnetLookaheadBuffer;
+ UINT NumFree;
+ ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
+} NDIS_ARC_BUF, *PNDIS_ARC_BUF;
+
+#endif /* ARCNET */
+
+#define NDIS_MINIPORT_WORK_QUEUE_SIZE 10
+
+typedef struct _NDIS_LOG {
+ PNDIS_MINIPORT_BLOCK Miniport;
+ KSPIN_LOCK LogLock;
+ PIRP Irp;
+ UINT TotalSize;
+ UINT CurrentSize;
+ UINT InPtr;
+ UINT OutPtr;
+ UCHAR LogBuf[1];
+} NDIS_LOG, *PNDIS_LOG;
+
+typedef struct _FILTERDBS {
+ union {
+ PETH_FILTER EthDB;
+ PNULL_FILTER NullDB;
+ };
+ PTR_FILTER TrDB;
+ PFDDI_FILTER FddiDB;
+#if ARCNET
+ PARC_FILTER ArcDB;
+#else /* !ARCNET */
+ PVOID XXXDB;
+#endif /* !ARCNET */
+} FILTERDBS, *PFILTERDBS;
+
+
+struct _NDIS_MINIPORT_BLOCK {
+ PVOID Signature;
+ PNDIS_MINIPORT_BLOCK NextMiniport;
+ PNDIS_M_DRIVER_BLOCK DriverHandle;
+ NDIS_HANDLE MiniportAdapterContext;
+ UNICODE_STRING MiniportName;
+ PNDIS_BIND_PATHS BindPaths;
+ NDIS_HANDLE OpenQueue;
+ REFERENCE Ref;
+ NDIS_HANDLE DeviceContext;
+ UCHAR Padding1;
+ UCHAR LockAcquired;
+ UCHAR PmodeOpens;
+ UCHAR AssignedProcessor;
+ KSPIN_LOCK Lock;
+ PNDIS_REQUEST MediaRequest;
+ PNDIS_MINIPORT_INTERRUPT Interrupt;
+ ULONG Flags;
+ ULONG PnPFlags;
+ LIST_ENTRY PacketList;
+ PNDIS_PACKET FirstPendingPacket;
+ PNDIS_PACKET ReturnPacketsQueue;
+ ULONG RequestBuffer;
+ PVOID SetMCastBuffer;
+ PNDIS_MINIPORT_BLOCK PrimaryMiniport;
+ PVOID WrapperContext;
+ PVOID BusDataContext;
+ ULONG PnPCapabilities;
+ PCM_RESOURCE_LIST Resources;
+ NDIS_TIMER WakeUpDpcTimer;
+ UNICODE_STRING BaseName;
+ UNICODE_STRING SymbolicLinkName;
+ ULONG CheckForHangSeconds;
+ USHORT CFHangTicks;
+ USHORT CFHangCurrentTick;
+ NDIS_STATUS ResetStatus;
+ NDIS_HANDLE ResetOpen;
+ FILTERDBS FilterDbs;
+ FILTER_PACKET_INDICATION_HANDLER PacketIndicateHandler;
+ NDIS_M_SEND_COMPLETE_HANDLER SendCompleteHandler;
+ NDIS_M_SEND_RESOURCES_HANDLER SendResourcesHandler;
+ NDIS_M_RESET_COMPLETE_HANDLER ResetCompleteHandler;
+ NDIS_MEDIUM MediaType;
+ ULONG BusNumber;
+ NDIS_INTERFACE_TYPE BusType;
+ NDIS_INTERFACE_TYPE AdapterType;
+ PDEVICE_OBJECT DeviceObject;
+ PDEVICE_OBJECT PhysicalDeviceObject;
+ PDEVICE_OBJECT NextDeviceObject;
+ PMAP_REGISTER_ENTRY MapRegisters;
+ PNDIS_AF_LIST CallMgrAfList;
+ PVOID MiniportThread;
+ PVOID SetInfoBuf;
+ USHORT SetInfoBufLen;
+ USHORT MaxSendPackets;
+ NDIS_STATUS FakeStatus;
+ PVOID LockHandler;
+ PUNICODE_STRING pAdapterInstanceName;
+ PNDIS_MINIPORT_TIMER TimerQueue;
+ UINT MacOptions;
+ PNDIS_REQUEST PendingRequest;
+ UINT MaximumLongAddresses;
+ UINT MaximumShortAddresses;
+ UINT CurrentLookahead;
+ UINT MaximumLookahead;
+ W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler;
+ W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler;
+ W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler;
+ W_SEND_PACKETS_HANDLER SendPacketsHandler;
+ NDIS_M_START_SENDS DeferredSendHandler;
+ ETH_RCV_INDICATE_HANDLER EthRxIndicateHandler;
+ TR_RCV_INDICATE_HANDLER TrRxIndicateHandler;
+ FDDI_RCV_INDICATE_HANDLER FddiRxIndicateHandler;
+ ETH_RCV_COMPLETE_HANDLER EthRxCompleteHandler;
+ TR_RCV_COMPLETE_HANDLER TrRxCompleteHandler;
+ FDDI_RCV_COMPLETE_HANDLER FddiRxCompleteHandler;
+ NDIS_M_STATUS_HANDLER StatusHandler;
+ NDIS_M_STS_COMPLETE_HANDLER StatusCompleteHandler;
+ NDIS_M_TD_COMPLETE_HANDLER TDCompleteHandler;
+ NDIS_M_REQ_COMPLETE_HANDLER QueryCompleteHandler;
+ NDIS_M_REQ_COMPLETE_HANDLER SetCompleteHandler;
+ NDIS_WM_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
+ WAN_RCV_HANDLER WanRcvHandler;
+ WAN_RCV_COMPLETE_HANDLER WanRcvCompleteHandler;
+#if defined(_NDIS_)
+ PNDIS_MINIPORT_BLOCK NextGlobalMiniport;
+ SINGLE_LIST_ENTRY WorkQueue[NUMBER_OF_WORK_ITEM_TYPES];
+ SINGLE_LIST_ENTRY SingleWorkItems[NUMBER_OF_SINGLE_WORK_ITEMS];
+ UCHAR SendFlags;
+ UCHAR TrResetRing;
+ UCHAR ArcnetAddress;
+ UCHAR XState;
+ union {
+#if ARCNET
+ PNDIS_ARC_BUF ArcBuf;
+#endif
+ PVOID BusInterface;
+ };
+ PNDIS_LOG Log;
+ ULONG SlotNumber;
+ PCM_RESOURCE_LIST AllocatedResources;
+ PCM_RESOURCE_LIST AllocatedResourcesTranslated;
+ SINGLE_LIST_ENTRY PatternList;
+ NDIS_PNP_CAPABILITIES PMCapabilities;
+ DEVICE_CAPABILITIES DeviceCaps;
+ ULONG WakeUpEnable;
+ DEVICE_POWER_STATE CurrentDevicePowerState;
+ PIRP pIrpWaitWake;
+ SYSTEM_POWER_STATE WaitWakeSystemState;
+ LARGE_INTEGER VcIndex;
+ KSPIN_LOCK VcCountLock;
+ LIST_ENTRY WmiEnabledVcs;
+ PNDIS_GUID pNdisGuidMap;
+ PNDIS_GUID pCustomGuidMap;
+ USHORT VcCount;
+ USHORT cNdisGuidMap;
+ USHORT cCustomGuidMap;
+ USHORT CurrentMapRegister;
+ PKEVENT AllocationEvent;
+ USHORT BaseMapRegistersNeeded;
+ USHORT SGMapRegistersNeeded;
+ ULONG MaximumPhysicalMapping;
+ NDIS_TIMER MediaDisconnectTimer;
+ USHORT MediaDisconnectTimeOut;
+ USHORT InstanceNumber;
+ NDIS_EVENT OpenReadyEvent;
+ NDIS_PNP_DEVICE_STATE PnPDeviceState;
+ NDIS_PNP_DEVICE_STATE OldPnPDeviceState;
+ PGET_SET_DEVICE_DATA SetBusData;
+ PGET_SET_DEVICE_DATA GetBusData;
+ KDPC DeferredDpc;
+#if 0
+ /* FIXME: */
+ NDIS_STATS NdisStats;
+#else
+ ULONG NdisStats;
+#endif
+ PNDIS_PACKET IndicatedPacket[MAXIMUM_PROCESSORS];
+ PKEVENT RemoveReadyEvent;
+ PKEVENT AllOpensClosedEvent;
+ PKEVENT AllRequestsCompletedEvent;
+ ULONG InitTimeMs;
+ NDIS_MINIPORT_WORK_ITEM WorkItemBuffer[NUMBER_OF_SINGLE_WORK_ITEMS];
+ PDMA_ADAPTER SystemAdapterObject;
+ ULONG DriverVerifyFlags;
+ POID_LIST OidList;
+ USHORT InternalResetCount;
+ USHORT MiniportResetCount;
+ USHORT MediaSenseConnectCount;
+ USHORT MediaSenseDisconnectCount;
+ PNDIS_PACKET *xPackets;
+ ULONG UserModeOpenReferences;
+ union {
+ PVOID SavedSendHandler;
+ PVOID SavedWanSendHandler;
+ };
+ PVOID SavedSendPacketsHandler;
+ PVOID SavedCancelSendPacketsHandler;
+ W_SEND_PACKETS_HANDLER WSendPacketsHandler;
+ ULONG MiniportAttributes;
+ PDMA_ADAPTER SavedSystemAdapterObject;
+ USHORT NumOpens;
+ USHORT CFHangXTicks;
+ ULONG RequestCount;
+ ULONG IndicatedPacketsCount;
+ ULONG PhysicalMediumType;
+ PNDIS_REQUEST LastRequest;
+ LONG DmaAdapterRefCount;
+ PVOID FakeMac;
+ ULONG LockDbg;
+ ULONG LockDbgX;
+ PVOID LockThread;
+ ULONG InfoFlags;
+ KSPIN_LOCK TimerQueueLock;
+ PKEVENT ResetCompletedEvent;
+ PKEVENT QueuedBindingCompletedEvent;
+ PKEVENT DmaResourcesReleasedEvent;
+ FILTER_PACKET_INDICATION_HANDLER SavedPacketIndicateHandler;
+ ULONG RegisteredInterrupts;
+ PNPAGED_LOOKASIDE_LIST SGListLookasideList;
+ ULONG ScatterGatherListSize;
+#endif /* _NDIS_ */
+};
+
+
+/* Handler prototypes for NDIS_OPEN_BLOCK */
+
+typedef NDIS_STATUS (DDKAPI *WAN_SEND_HANDLER)(
+ IN NDIS_HANDLE MacBindingHandle,
+ IN NDIS_HANDLE LinkHandle,
+ IN PVOID Packet);
+
+/* NDIS 4.0 extension */
+
+typedef VOID (DDKAPI *SEND_PACKETS_HANDLER)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN PPNDIS_PACKET PacketArray,
+ IN UINT NumberOfPackets);
+
+
+typedef struct _NDIS_COMMON_OPEN_BLOCK {
+ PVOID MacHandle;
+ NDIS_HANDLE BindingHandle;
+ PNDIS_MINIPORT_BLOCK MiniportHandle;
+ PNDIS_PROTOCOL_BLOCK ProtocolHandle;
+ NDIS_HANDLE ProtocolBindingContext;
+ PNDIS_OPEN_BLOCK MiniportNextOpen;
+ PNDIS_OPEN_BLOCK ProtocolNextOpen;
+ NDIS_HANDLE MiniportAdapterContext;
+ BOOLEAN Reserved1;
+ BOOLEAN Reserved2;
+ BOOLEAN Reserved3;
+ BOOLEAN Reserved4;
+ PNDIS_STRING BindDeviceName;
+ KSPIN_LOCK Reserved5;
+ PNDIS_STRING RootDeviceName;
+ union {
+ SEND_HANDLER SendHandler;
+ WAN_SEND_HANDLER WanSendHandler;
+ };
+ TRANSFER_DATA_HANDLER TransferDataHandler;
+ SEND_COMPLETE_HANDLER SendCompleteHandler;
+ TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler;
+ RECEIVE_HANDLER ReceiveHandler;
+ RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler;
+ WAN_RECEIVE_HANDLER WanReceiveHandler;
+ REQUEST_COMPLETE_HANDLER RequestCompleteHandler;
+ RECEIVE_PACKET_HANDLER ReceivePacketHandler;
+ SEND_PACKETS_HANDLER SendPacketsHandler;
+ RESET_HANDLER ResetHandler;
+ REQUEST_HANDLER RequestHandler;
+ RESET_COMPLETE_HANDLER ResetCompleteHandler;
+ STATUS_HANDLER StatusHandler;
+ STATUS_COMPLETE_HANDLER StatusCompleteHandler;
+#if defined(_NDIS_)
+ ULONG Flags;
+ ULONG References;
+ KSPIN_LOCK SpinLock;
+ NDIS_HANDLE FilterHandle;
+ ULONG ProtocolOptions;
+ USHORT CurrentLookahead;
+ USHORT ConnectDampTicks;
+ USHORT DisconnectDampTicks;
+ W_SEND_HANDLER WSendHandler;
+ W_TRANSFER_DATA_HANDLER WTransferDataHandler;
+ W_SEND_PACKETS_HANDLER WSendPacketsHandler;
+ W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler;
+ ULONG WakeUpEnable;
+ PKEVENT CloseCompleteEvent;
+ QUEUED_CLOSE QC;
+ ULONG AfReferences;
+ PNDIS_OPEN_BLOCK NextGlobalOpen;
+#endif /* _NDIS_ */
+} NDIS_COMMON_OPEN_BLOCK;
+
+struct _NDIS_OPEN_BLOCK
+{
+ NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock;
+#if defined(_NDIS_)
+ struct _NDIS_OPEN_CO
+ {
+ struct _NDIS_CO_AF_BLOCK * NextAf;
+ W_CO_CREATE_VC_HANDLER MiniportCoCreateVcHandler;
+ W_CO_REQUEST_HANDLER MiniportCoRequestHandler;
+ CO_CREATE_VC_HANDLER CoCreateVcHandler;
+ CO_DELETE_VC_HANDLER CoDeleteVcHandler;
+ PVOID CmActivateVcCompleteHandler;
+ PVOID CmDeactivateVcCompleteHandler;
+ PVOID CoRequestCompleteHandler;
+ LIST_ENTRY ActiveVcHead;
+ LIST_ENTRY InactiveVcHead;
+ LONG PendingAfNotifications;
+ PKEVENT AfNotifyCompleteEvent;
+ };
+#endif /* _NDIS_ */
+};
+
+
+
+/* Routines for NDIS miniport drivers */
+
+NDISAPI
+VOID
+DDKAPI
+NdisInitializeWrapper(
+ OUT PNDIS_HANDLE NdisWrapperHandle,
+ IN PVOID SystemSpecific1,
+ IN PVOID SystemSpecific2,
+ IN PVOID SystemSpecific3);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMAllocateMapRegisters(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN UINT DmaChannel,
+ IN BOOLEAN Dma32BitAddresses,
+ IN ULONG PhysicalMapRegistersNeeded,
+ IN ULONG MaximumPhysicalMapping);
+
+/*
+ * VOID
+ * NdisMArcIndicateReceive(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN PUCHAR HeaderBuffer,
+ * IN PUCHAR DataBuffer,
+ * IN UINT Length);
+ */
+#define NdisMArcIndicateReceive(MiniportAdapterHandle, \
+ HeaderBuffer, \
+ DataBuffer, \
+ Length) \
+{ \
+ ArcFilterDprIndicateReceive( \
+ (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.ArcDB), \
+ (HeaderBuffer), \
+ (DataBuffer), \
+ (Length)); \
+}
+
+/*
+ * VOID
+ * NdisMArcIndicateReceiveComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle);
+ */
+#define NdisMArcIndicateReceiveComplete(MiniportAdapterHandle) \
+{ \
+ if (((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->EthDB) \
+ { \
+ NdisMEthIndicateReceiveComplete(_H); \
+ } \
+ \
+ ArcFilterDprIndicateReceiveComplete( \
+ ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->ArcDB); \
+}
+
+NDISAPI
+VOID
+DDKAPI
+NdisMCloseLog(
+ IN NDIS_HANDLE LogHandle);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMCreateLog(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN UINT Size,
+ OUT PNDIS_HANDLE LogHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMDeregisterAdapterShutdownHandler(
+ IN NDIS_HANDLE MiniportHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMDeregisterInterrupt(
+ IN PNDIS_MINIPORT_INTERRUPT Interrupt);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMDeregisterIoPortRange(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN UINT InitialPort,
+ IN UINT NumberOfPorts,
+ IN PVOID PortOffset);
+
+/*
+ * VOID
+ * NdisMEthIndicateReceive(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_HANDLE MiniportReceiveContext,
+ * IN PVOID HeaderBuffer,
+ * IN UINT HeaderBufferSize,
+ * IN PVOID LookaheadBuffer,
+ * IN UINT LookaheadBufferSize,
+ * IN UINT PacketSize);
+ */
+#define NdisMEthIndicateReceive(MiniportAdapterHandle, \
+ MiniportReceiveContext, \
+ HeaderBuffer, \
+ HeaderBufferSize, \
+ LookaheadBuffer, \
+ LookaheadBufferSize, \
+ PacketSize) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthRxIndicateHandler)( \
+ (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.EthDB), \
+ (MiniportReceiveContext), \
+ (HeaderBuffer), \
+ (HeaderBuffer), \
+ (HeaderBufferSize), \
+ (LookaheadBuffer), \
+ (LookaheadBufferSize), \
+ (PacketSize)); \
+}
+
+/*
+ * VOID
+ * NdisMEthIndicateReceiveComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle);
+ */
+#define NdisMEthIndicateReceiveComplete(MiniportAdapterHandle) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthRxCompleteHandler)( \
+ ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FilterDbs.EthDB); \
+}
+
+/*
+ * VOID
+ * NdisMFddiIndicateReceive(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_HANDLE MiniportReceiveContext,
+ * IN PVOID HeaderBuffer,
+ * IN UINT HeaderBufferSize,
+ * IN PVOID LookaheadBuffer,
+ * IN UINT LookaheadBufferSize,
+ * IN UINT PacketSize);
+ */
+#define NdisMFddiIndicateReceive(MiniportAdapterHandle, \
+ MiniportReceiveContext, \
+ HeaderBuffer, \
+ HeaderBufferSize, \
+ LookaheadBuffer, \
+ LookaheadBufferSize, \
+ PacketSize) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FddiRxIndicateHandler)( \
+ (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.FddiDB), \
+ (MiniportReceiveContext), \
+ (PUCHAR)(HeaderBuffer) + 1, \
+ (((*(PUCHAR*)(HeaderBuffer)) & 0x40) ? \
+ FDDI_LENGTH_OF_LONG_ADDRESS : \
+ FDDI_LENGTH_OF_SHORT_ADDRESS), \
+ (HeaderBuffer), \
+ (HeaderBufferSize), \
+ (LookaheadBuffer), \
+ (LookaheadBufferSize), \
+ (PacketSize)); \
+}
+
+
+
+/*
+ * VOID
+ * NdisMFddiIndicateReceiveComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle);
+ */
+#define NdisMFddiIndicateReceiveComplete(MiniportAdapterHandle) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FddiRxCompleteHandler)( \
+ ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FilterDbs.FddiDB); \
+}
+
+NDISAPI
+VOID
+DDKAPI
+NdisMFlushLog(
+ IN NDIS_HANDLE LogHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMFreeMapRegisters(
+ IN NDIS_HANDLE MiniportAdapterHandle);
+
+/*
+ * VOID
+ * NdisMIndicateStatus(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_STATUS GeneralStatus,
+ * IN PVOID StatusBuffer,
+ * IN UINT StatusBufferSize);
+ */
+
+#define NdisMIndicateStatus(MiniportAdapterHandle, \
+ GeneralStatus, StatusBuffer, StatusBufferSize) \
+ (*((PNDIS_MINIPORT_BLOCK)(_M))->StatusHandler)( \
+ MiniportAdapterHandle, GeneralStatus, StatusBuffer, StatusBufferSize)
+
+/*
+ * VOID
+ * NdisMIndicateStatusComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle);
+ */
+#define NdisMIndicateStatusComplete(MiniportAdapterHandle) \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->StatusCompleteHandler)( \
+ MiniportAdapterHandle)
+
+/*
+ * VOID
+ * NdisMInitializeWrapper(
+ * OUT PNDIS_HANDLE NdisWrapperHandle,
+ * IN PVOID SystemSpecific1,
+ * IN PVOID SystemSpecific2,
+ * IN PVOID SystemSpecific3);
+ */
+#define NdisMInitializeWrapper(NdisWrapperHandle, \
+ SystemSpecific1, \
+ SystemSpecific2, \
+ SystemSpecific3) \
+ NdisInitializeWrapper((NdisWrapperHandle), \
+ (SystemSpecific1), \
+ (SystemSpecific2), \
+ (SystemSpecific3))
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMMapIoSpace(
+ OUT PVOID *VirtualAddress,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
+ IN UINT Length);
+
+/*
+ * VOID
+ * NdisMQueryInformationComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_STATUS Status);
+ */
+#define NdisMQueryInformationComplete(MiniportAdapterHandle, Status) \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->QueryCompleteHandler)(MiniportAdapterHandle, Status)
+
+NDISAPI
+VOID
+DDKAPI
+NdisMRegisterAdapterShutdownHandler(
+ IN NDIS_HANDLE MiniportHandle,
+ IN PVOID ShutdownContext,
+ IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMRegisterInterrupt(
+ OUT PNDIS_MINIPORT_INTERRUPT Interrupt,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN UINT InterruptVector,
+ IN UINT InterruptLevel,
+ IN BOOLEAN RequestIsr,
+ IN BOOLEAN SharedInterrupt,
+ IN NDIS_INTERRUPT_MODE InterruptMode);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMRegisterIoPortRange(
+ OUT PVOID *PortOffset,
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN UINT InitialPort,
+ IN UINT NumberOfPorts);
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMRegisterMiniport(
+ IN NDIS_HANDLE NdisWrapperHandle,
+ IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
+ IN UINT CharacteristicsLength);
+
+
+#if !defined(_NDIS_)
+
+/*
+ * VOID
+ * NdisMResetComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_STATUS Status,
+ * IN BOOLEAN AddressingReset);
+ */
+#define NdisMResetComplete(MiniportAdapterHandle, \
+ Status, \
+ AddressingReset) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->ResetCompleteHandler)( \
+ MiniportAdapterHandle, Status, AddressingReset); \
+}
+
+/*
+ * VOID
+ * NdisMSendComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN PNDIS_PACKET Packet,
+ * IN NDIS_STATUS Status);
+ */
+#define NdisMSendComplete(MiniportAdapterHandle, \
+ Packet, \
+ Status) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SendCompleteHandler)( \
+ MiniportAdapterHandle, Packet, Status); \
+}
+
+/*
+ * VOID
+ * NdisMSendResourcesAvailable(
+ * IN NDIS_HANDLE MiniportAdapterHandle);
+ */
+#define NdisMSendResourcesAvailable(MiniportAdapterHandle) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SendResourcesHandler)( \
+ MiniportAdapterHandle); \
+}
+
+/*
+ * VOID
+ * NdisMTransferDataComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN PNDIS_PACKET Packet,
+ * IN NDIS_STATUS Status,
+ * IN UINT BytesTransferred);
+ */
+#define NdisMTransferDataComplete(MiniportAdapterHandle, \
+ Packet, \
+ Status, \
+ BytesTransferred) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TDCompleteHandler)( \
+ MiniportAdapterHandle, Packet, Status, BytesTransferred) \
+}
+
+#endif /* !_NDIS_ */
+
+
+/*
+ * VOID
+ * NdisMSetAttributes(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_HANDLE MiniportAdapterContext,
+ * IN BOOLEAN BusMaster,
+ * IN NDIS_INTERFACE_TYPE AdapterType);
+ */
+#define NdisMSetAttributes(MiniportAdapterHandle, \
+ MiniportAdapterContext, \
+ BusMaster, \
+ AdapterType) \
+ NdisMSetAttributesEx(MiniportAdapterHandle, \
+ MiniportAdapterContext, \
+ 0, \
+ (BusMaster) ? NDIS_ATTRIBUTE_BUS_MASTER : 0, \
+ AdapterType)
+
+NDISAPI
+VOID
+DDKAPI
+NdisMSetAttributesEx(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN UINT CheckForHangTimeInSeconds OPTIONAL,
+ IN ULONG AttributeFlags,
+ IN NDIS_INTERFACE_TYPE AdapterType);
+
+/*
+ * VOID
+ * NdisMSetInformationComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_STATUS Status);
+ */
+#define NdisMSetInformationComplete(MiniportAdapterHandle, \
+ Status) \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SetCompleteHandler)( \
+ MiniportAdapterHandle, Status)
+
+NDISAPI
+VOID
+DDKAPI
+NdisMSleep(
+ IN ULONG MicrosecondsToSleep);
+
+NDISAPI
+BOOLEAN
+DDKAPI
+NdisMSynchronizeWithInterrupt(
+ IN PNDIS_MINIPORT_INTERRUPT Interrupt,
+ IN PVOID SynchronizeFunction,
+ IN PVOID SynchronizeContext);
+
+/*
+ * VOID
+ * NdisMTrIndicateReceive(
+ * IN NDIS_HANDLE MiniportAdapterHandle,
+ * IN NDIS_HANDLE MiniportReceiveContext,
+ * IN PVOID HeaderBuffer,
+ * IN UINT HeaderBufferSize,
+ * IN PVOID LookaheadBuffer,
+ * IN UINT LookaheadBufferSize,
+ * IN UINT PacketSize);
+ */
+#define NdisMTrIndicateReceive(MiniportAdapterHandle, \
+ MiniportReceiveContext, \
+ HeaderBuffer, \
+ HeaderBufferSize, \
+ LookaheadBuffer, \
+ LookaheadBufferSize, \
+ PacketSize) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TrRxIndicateHandler)( \
+ (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.TrDB), \
+ (MiniportReceiveContext), \
+ (HeaderBuffer), \
+ (HeaderBuffer), \
+ (HeaderBufferSize), \
+ (LookaheadBuffer), \
+ (LookaheadBufferSize), \
+ (PacketSize)); \
+}
+
+/*
+ * VOID
+ * NdisMTrIndicateReceiveComplete(
+ * IN NDIS_HANDLE MiniportAdapterHandle);
+ */
+#define NdisMTrIndicateReceiveComplete(MiniportAdapterHandle) \
+{ \
+ (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TrRxCompleteHandler)( \
+ ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FilterDbs.TrDB); \
+}
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisMWriteLogData(
+ IN NDIS_HANDLE LogHandle,
+ IN PVOID LogBuffer,
+ IN UINT LogBufferSize);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMQueryAdapterResources(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ OUT PNDIS_RESOURCE_LIST ResourceList,
+ IN OUT PUINT BufferSize);
+
+NDISAPI
+VOID
+DDKAPI
+NdisTerminateWrapper(
+ IN NDIS_HANDLE NdisWrapperHandle,
+ IN PVOID SystemSpecific);
+
+NDISAPI
+VOID
+DDKAPI
+NdisMUnmapIoSpace(
+ IN NDIS_HANDLE MiniportAdapterHandle,
+ IN PVOID VirtualAddress,
+ IN UINT Length);
+
+
+
+/* NDIS intermediate miniport structures */
+
+typedef VOID (DDKAPI *W_MINIPORT_CALLBACK)(
+ IN NDIS_HANDLE MiniportAdapterContext,
+ IN PVOID CallbackContext);
+
+
+
+/* Routines for intermediate miniport drivers */
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisIMDeInitializeDeviceInstance(
+ IN NDIS_HANDLE NdisMiniportHandle);
+
+/*
+ * NDIS_STATUS
+ * NdisIMInitializeDeviceInstance(
+ * IN NDIS_HANDLE DriverHandle,
+ * IN PNDIS_STRING DeviceInstance);
+ */
+#define NdisIMInitializeDeviceInstance(DriverHandle, DeviceInstance) \
+ NdisIMInitializeDeviceInstanceEx(DriverHandle, DeviceInstance, NULL)
+
+NDISAPI
+NDIS_STATUS
+DDKAPI
+NdisIMRegisterLayeredMiniport(
+ IN NDIS_HANDLE NdisWrapperHandle,
+ IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
+ IN UINT CharacteristicsLength,
+ OUT PNDIS_HANDLE DriverHandle);
+
+
+/* Functions obsoleted by NDIS 5.0 */
+
+NDISAPI
+VOID
+DDKAPI
+NdisFreeDmaChannel(
+ IN PNDIS_HANDLE NdisDmaHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisSetupDmaTransfer(
+ OUT PNDIS_STATUS Status,
+ IN PNDIS_HANDLE NdisDmaHandle,
+ IN PNDIS_BUFFER Buffer,
+ IN ULONG Offset,
+ IN ULONG Length,
+ IN BOOLEAN WriteToDevice);
+
+NDISAPI
+NTSTATUS
+DDKAPI
+NdisUpcaseUnicodeString(
+ OUT PUNICODE_STRING DestinationString,
+ IN PUNICODE_STRING SourceString);
+
+
+/* Routines for NDIS protocol drivers */
+
+NDISAPI
+VOID
+DDKAPI
+NdisRequest(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN PNDIS_REQUEST NdisRequest);
+
+NDISAPI
+VOID
+DDKAPI
+NdisReset(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE NdisBindingHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisSend(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN PNDIS_PACKET Packet);
+
+NDISAPI
+VOID
+DDKAPI
+NdisSendPackets(
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN PPNDIS_PACKET PacketArray,
+ IN UINT NumberOfPackets);
+
+NDISAPI
+VOID
+DDKAPI
+NdisTransferData(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN NDIS_HANDLE MacReceiveContext,
+ IN UINT ByteOffset,
+ IN UINT BytesToTransfer,
+ IN OUT PNDIS_PACKET Packet,
+ OUT PUINT BytesTransferred);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCloseAdapter(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE NdisBindingHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCompleteBindAdapter(
+ IN NDIS_HANDLE BindAdapterContext,
+ IN NDIS_STATUS Status,
+ IN NDIS_STATUS OpenStatus);
+
+NDISAPI
+VOID
+DDKAPI
+NdisCompleteUnbindAdapter(
+ IN NDIS_HANDLE UnbindAdapterContext,
+ IN NDIS_STATUS Status);
+
+NDISAPI
+VOID
+DDKAPI
+NdisDeregisterProtocol(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE NdisProtocolHandle);
+
+NDISAPI
+VOID
+DDKAPI
+NdisOpenAdapter(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_STATUS OpenErrorStatus,
+ OUT PNDIS_HANDLE NdisBindingHandle,
+ OUT PUINT SelectedMediumIndex,
+ IN PNDIS_MEDIUM MediumArray,
+ IN UINT MediumArraySize,
+ IN NDIS_HANDLE NdisProtocolHandle,
+ IN NDIS_HANDLE ProtocolBindingContext,
+ IN PNDIS_STRING AdapterName,
+ IN UINT OpenOptions,
+ IN PSTRING AddressingInformation);
+
+NDISAPI
+VOID
+DDKAPI
+NdisOpenProtocolConfiguration(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_HANDLE ConfigurationHandle,
+ IN PNDIS_STRING ProtocolSection);
+
+NDISAPI
+VOID
+DDKAPI
+NdisRegisterProtocol(
+ OUT PNDIS_STATUS Status,
+ OUT PNDIS_HANDLE NdisProtocolHandle,
+ IN PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics,
+ IN UINT CharacteristicsLength);
+
+/* Obsoleted in Windows XP */
+
+/* Prototypes for NDIS_MAC_CHARACTERISTICS */
+
+typedef NDIS_STATUS (*OPEN_ADAPTER_HANDLER)(
+ OUT PNDIS_STATUS OpenErrorStatus,
+ OUT NDIS_HANDLE *MacBindingHandle,
+ OUT PUINT SelectedMediumIndex,
+ IN PNDIS_MEDIUM MediumArray,
+ IN UINT MediumArraySize,
+ IN NDIS_HANDLE NdisBindingContext,
+ IN NDIS_HANDLE MacAdapterContext,
+ IN UINT OpenOptions,
+ IN PSTRING AddressingInformation OPTIONAL);
+
+typedef NDIS_STATUS (DDKAPI *CLOSE_ADAPTER_HANDLER)(
+ IN NDIS_HANDLE MacBindingHandle);
+
+typedef NDIS_STATUS (DDKAPI *WAN_TRANSFER_DATA_HANDLER)(
+ VOID);
+
+typedef NDIS_STATUS (DDKAPI *QUERY_GLOBAL_STATISTICS_HANDLER)(
+ IN NDIS_HANDLE MacAdapterContext,
+ IN PNDIS_REQUEST NdisRequest);
+
+typedef VOID (DDKAPI *UNLOAD_MAC_HANDLER)(
+ IN NDIS_HANDLE MacMacContext);
+
+typedef NDIS_STATUS (DDKAPI *ADD_ADAPTER_HANDLER)(
+ IN NDIS_HANDLE MacMacContext,
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ IN PNDIS_STRING AdapterName);
+
+typedef VOID (*REMOVE_ADAPTER_HANDLER)(
+ IN NDIS_HANDLE MacAdapterContext);
+
+typedef struct _NDIS_MAC_CHARACTERISTICS {
+ UCHAR MajorNdisVersion;
+ UCHAR MinorNdisVersion;
+ UINT Reserved;
+ OPEN_ADAPTER_HANDLER OpenAdapterHandler;
+ CLOSE_ADAPTER_HANDLER CloseAdapterHandler;
+ SEND_HANDLER SendHandler;
+ TRANSFER_DATA_HANDLER TransferDataHandler;
+ RESET_HANDLER ResetHandler;
+ REQUEST_HANDLER RequestHandler;
+ QUERY_GLOBAL_STATISTICS_HANDLER QueryGlobalStatisticsHandler;
+ UNLOAD_MAC_HANDLER UnloadMacHandler;
+ ADD_ADAPTER_HANDLER AddAdapterHandler;
+ REMOVE_ADAPTER_HANDLER RemoveAdapterHandler;
+ NDIS_STRING Name;
+} NDIS_MAC_CHARACTERISTICS, *PNDIS_MAC_CHARACTERISTICS;
+
+typedef NDIS_MAC_CHARACTERISTICS NDIS_WAN_MAC_CHARACTERISTICS;
+typedef NDIS_WAN_MAC_CHARACTERISTICS *PNDIS_WAN_MAC_CHARACTERISTICS;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NDIS_H */
+
+/* EOF */
--- /dev/null
+/*
+ * ndisguid.h
+ *
+ * GUIDs for NDIS drivers
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NDISGUID_H
+#define __NDISGUID_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+DEFINE_GUID(GUID_NDIS_LAN_CLASS,
+ 0xad498944, 0x762f, 0x11d0, 0x8d, 0xcb, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ENUMERATE_ADAPTER,
+ 0x981f2d7f, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ENUMERATE_VC,
+ 0x981f2d82, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_NOTIFY_ADAPTER_ARRIVAL,
+ 0x981f2d81, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_NOTIFY_ADAPTER_REMOVAL,
+ 0x981f2d80, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_NOTIFY_VC_ARRIVAL,
+ 0x182f9e0c, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_NOTIFY_VC_REMOVAL,
+ 0x981f2d79, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_NOTIFY_BIND,
+ 0x5413531c, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_NOTIFY_UNBIND,
+ 0x6e3ce1ec, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_WAKE_ON_MAGIC_PACKET_ONLY,
+ 0xa14f1c97, 0x8839, 0x4f8a, 0x99, 0x96, 0xa2, 0x89, 0x96, 0xeb, 0xbf, 0x1d);
+
+
+DEFINE_GUID(GUID_NDIS_802_3_CURRENT_ADDRESS,
+ 0x44795700, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_3_MAC_OPTIONS,
+ 0x44795703, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_3_MAXIMUM_LIST_SIZE,
+ 0x44795702, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_3_MULTICAST_LIST,
+ 0x44795701, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_3_PERMANENT_ADDRESS,
+ 0x447956ff, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_3_RCV_ERROR_ALIGNMENT,
+ 0x44795704, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_3_XMIT_MORE_COLLISIONS,
+ 0x44795706, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_3_XMIT_ONE_COLLISION,
+ 0x44795705, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_CURRENT_ADDRESS,
+ 0x44795708, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_CURRENT_FUNCTIONAL,
+ 0x44795709, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_CURRENT_GROUP,
+ 0x4479570a, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_CURRENT_RING_STATE,
+ 0xacf14032, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_CURRENT_RING_STATUS,
+ 0x890a36ec, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_LAST_OPEN_STATUS,
+ 0x4479570b, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_PERMANENT_ADDRESS,
+ 0x44795707, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_LINE_ERRORS,
+ 0xacf14033, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_802_5_LOST_FRAMES,
+ 0xacf14034, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_802_11_ADD_WEP,
+ 0x4307bff0, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_AUTHENTICATION_MODE,
+ 0x43920a24, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_BSSID,
+ 0x2504b6c2, 0x1fa5, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_BSSID_LIST,
+ 0x69526f9a, 0x2062, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_BASIC_RATES,
+ 0x4a198516, 0x2068, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_CONFIGURATION,
+ 0x4a4df982, 0x2068, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_DESIRED_RATES,
+ 0x452ee08e, 0x2536, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_DISASSOCIATE,
+ 0x43671f40, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_FRAGMENTATION_THRESHOLD,
+ 0x69aaa7c4, 0x2062, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_INFRASTRUCTURE_MODE,
+ 0x697d5a7e, 0x2062, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_NETWORK_TYPES_SUPPORTED,
+ 0x8531d6e6, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_NETWORK_TYPE_IN_USE,
+ 0x857e2326, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_NUMBER_OF_ANTENNAS,
+ 0x01779336, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_POWER_MODE,
+ 0x85be837c, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_RATES_SUPPORTED,
+ 0x49db8722, 0x2068, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_REMOVE_WEP,
+ 0x433c345c, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_PRIVACY_FILTER,
+ 0x6733c4e9, 0x4792, 0x11d4, 0x97, 0xf1, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_RSSI,
+ 0x1507db16, 0x2053, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_RSSI_TRIGGER,
+ 0x155689b8, 0x2053, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_RTS_THRESHOLD,
+ 0x0134d07e, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_RX_ANTENNA_SELECTED,
+ 0x01ac07a2, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_SSID,
+ 0x7d2a90ea, 0x2041, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_STATISTICS,
+ 0x42bb73b0, 0x2129, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_TX_POWER_LEVEL,
+ 0x11e6ba76, 0x2053, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+DEFINE_GUID(GUID_NDIS_802_11_TX_ANTENNA_SELECTED,
+ 0x01dbb74a, 0x2064, 0x11d4, 0x97, 0xeb, 0x00, 0xc0, 0x4f, 0x79, 0xc4, 0x03);
+
+
+DEFINE_GUID(GUID_NDIS_ATM_HW_CURRENT_ADDRESS,
+ 0x791ad1a1, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_MAX_AAL0_PACKET_SIZE,
+ 0x791ad1a5, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_MAX_AAL1_PACKET_SIZE,
+ 0x791ad1a6, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_MAX_AAL34_PACKET_SIZE,
+ 0x791ad1a7, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_MAX_AAL5_PACKET_SIZE,
+ 0x791ad191, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_MAX_ACTIVE_VCI_BITS,
+ 0x791ad1a3, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_MAX_ACTIVE_VCS,
+ 0x791ad1a2, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_MAX_ACTIVE_VPI_BITS,
+ 0x791ad1a4, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_SUPPORTED_AAL_TYPES,
+ 0x791ad1a0, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_SUPPORTED_SERVICE_CATEGORY,
+ 0x791ad19f, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_SUPPORTED_VC_RATES,
+ 0x791ad19e, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_ATM_RCV_CELLS_DROPPED,
+ 0x0a21480c, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_RCV_CELLS_OK,
+ 0x0a21480a, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_ATM_XMIT_CELLS_OK,
+ 0x0a21480b, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_FDDI_LONG_CURRENT_ADDR,
+ 0xacf14036, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_LONG_MAX_LIST_SIZE,
+ 0xacf14038, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_LONG_MULTICAST_LIST,
+ 0xacf14037, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_LONG_PERMANENT_ADDR,
+ 0xacf14035, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_SHORT_CURRENT_ADDR,
+ 0xacf1403a, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_SHORT_MAX_LIST_SIZE,
+ 0xacf1403c, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_SHORT_MULTICAST_LIST,
+ 0xacf1403b, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_SHORT_PERMANENT_ADDR,
+ 0xacf14039, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_FDDI_ATTACHMENT_TYPE,
+ 0xacf1403d, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_DOWNSTREAM_NODE_LONG,
+ 0xacf1403f, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_FRAME_ERRORS,
+ 0xacf14040, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_FRAMES_LOST,
+ 0xacf14041, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_LCT_FAILURES,
+ 0xacf14043, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_LCONNECTION_STATE,
+ 0xacf14045, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_LEM_REJECTS,
+ 0xacf14044, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_RING_MGT_STATE,
+ 0xacf14042, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_FDDI_UPSTREAM_NODE_LONG,
+ 0xacf1403e, 0xa61c, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_GEN_CURRENT_LOOKAHEAD,
+ 0x5ec10361, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CURRENT_PACKET_FILTER,
+ 0x5ec10360, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_DRIVER_VERSION,
+ 0x5ec10362, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_HARDWARE_STATUS,
+ 0x5ec10354, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MEDIA_IN_USE,
+ 0x5ec10356, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MEDIA_SUPPORTED,
+ 0x5ec10355, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_LINK_SPEED,
+ 0x5ec10359, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MAC_OPTIONS,
+ 0x5ec10365, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_LOOKAHEAD,
+ 0x5ec10357, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_FRAME_SIZE,
+ 0x5ec10358, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_SEND_PACKETS,
+ 0x5ec10367, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MAXIMUM_TOTAL_SIZE,
+ 0x5ec10363, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_MEDIA_CONNECT_STATUS,
+ 0x5ec10366, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_RECEIVE_BLOCK_SIZE,
+ 0x5ec1035d, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_RECEIVE_BUFFER_SPACE,
+ 0x5ec1035b, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_TRANSMIT_BUFFER_SPACE,
+ 0x5ec1035a, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_TRANSMIT_BLOCK_SIZE,
+ 0x5ec1035c, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_VENDOR_DESCRIPTION,
+ 0x5ec1035f, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_VENDOR_DRIVER_VERSION,
+ 0x447956f9, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_VENDOR_ID,
+ 0x5ec1035e, 0xa61a, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_GEN_RCV_ERROR,
+ 0x447956fd, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_RCV_NO_BUFFER,
+ 0x447956fe, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_RCV_OK,
+ 0x447956fb, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_XMIT_ERROR,
+ 0x447956fc, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_XMIT_OK,
+ 0x447956fa, 0xa61b, 0x11d0, 0x8d, 0xd4, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_DRIVER_VERSION,
+ 0x791ad198, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_HARDWARE_STATUS,
+ 0x791ad192, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_LINK_SPEED,
+ 0x791ad195, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_MAC_OPTIONS,
+ 0x791ad19a, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_MEDIA_SUPPORTED,
+ 0x791ad193, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_MEDIA_IN_USE,
+ 0x791ad194, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_MEDIA_CONNECT_STATUS,
+ 0x791ad19b, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_MINIMUM_LINK_SPEED,
+ 0x791ad19d, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_VENDOR_DESCRIPTION,
+ 0x791ad197, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_VENDOR_DRIVER_VERSION,
+ 0x791ad19c, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_VENDOR_ID,
+ 0x791ad196, 0xe35c, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_RCV_PDUS_ERROR,
+ 0x0a214808, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_RCV_PDUS_OK,
+ 0x0a214806, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_RCV_PDUS_NO_BUFFER,
+ 0x0a214809, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_XMIT_PDUS_ERROR,
+ 0x0a214807, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_GEN_CO_XMIT_PDUS_OK,
+ 0x0a214805, 0xe35f, 0x11d0, 0x96, 0x92, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+
+DEFINE_GUID(GUID_NDIS_STATUS_LINK_SPEED_CHANGE,
+ 0x981f2d85, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_STATUS_MEDIA_CONNECT,
+ 0x981f2d7d, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_STATUS_MEDIA_DISCONNECT,
+ 0x981f2d7e, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_STATUS_MEDIA_SPECIFIC_INDICATION,
+ 0x981f2d84, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_STATUS_RESET_END,
+ 0x981f2d77, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+DEFINE_GUID(GUID_NDIS_STATUS_RESET_START,
+ 0x981f2d76, 0xb1f3, 0x11d0, 0x8d, 0xd7, 0x00, 0xc0, 0x4f, 0xc3, 0x35, 0x8c);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NDISGUID_H */
--- /dev/null
+/*
+ * ndistapi.h
+ *
+ * NDIS Telephony API
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NDISTAPI_H
+#define __NDISTAPI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ndis.h"
+
+#ifndef NDIS_TAPI_CURRENT_VERSION
+#define NDIS_TAPI_CURRENT_VERSION 0x00010003
+#endif
+
+typedef ULONG_PTR HTAPI_LINE;
+typedef ULONG_PTR HDRV_LINE;
+typedef ULONG_PTR HTAPI_CALL;
+typedef ULONG_PTR HDRV_CALL;
+
+#define NDIS_STATUS_TAPI_ADDRESSBLOCKED ((NDIS_STATUS)0xC0012000L)
+#define NDIS_STATUS_TAPI_BEARERMODEUNAVAIL ((NDIS_STATUS)0xC0012001L)
+#define NDIS_STATUS_TAPI_CALLUNAVAIL ((NDIS_STATUS)0xC0012002L)
+#define NDIS_STATUS_TAPI_DIALBILLING ((NDIS_STATUS)0xC0012003L)
+#define NDIS_STATUS_TAPI_DIALDIALTONE ((NDIS_STATUS)0xC0012004L)
+#define NDIS_STATUS_TAPI_DIALPROMPT ((NDIS_STATUS)0xC0012005L)
+#define NDIS_STATUS_TAPI_DIALQUIET ((NDIS_STATUS)0xC0012006L)
+#define NDIS_STATUS_TAPI_INCOMPATIBLEEXTVERSION ((NDIS_STATUS)0xC0012007L)
+#define NDIS_STATUS_TAPI_INUSE ((NDIS_STATUS)0xC0012008L)
+#define NDIS_STATUS_TAPI_INVALADDRESS ((NDIS_STATUS)0xC0012009L)
+#define NDIS_STATUS_TAPI_INVALADDRESSID ((NDIS_STATUS)0xC001200AL)
+#define NDIS_STATUS_TAPI_INVALADDRESSMODE ((NDIS_STATUS)0xC001200BL)
+#define NDIS_STATUS_TAPI_INVALBEARERMODE ((NDIS_STATUS)0xC001200CL)
+#define NDIS_STATUS_TAPI_INVALCALLHANDLE ((NDIS_STATUS)0xC001200DL)
+#define NDIS_STATUS_TAPI_INVALCALLPARAMS ((NDIS_STATUS)0xC001200EL)
+#define NDIS_STATUS_TAPI_INVALCALLSTATE ((NDIS_STATUS)0xC001200FL)
+#define NDIS_STATUS_TAPI_INVALDEVICECLASS ((NDIS_STATUS)0xC0012010L)
+#define NDIS_STATUS_TAPI_INVALLINEHANDLE ((NDIS_STATUS)0xC0012011L)
+#define NDIS_STATUS_TAPI_INVALLINESTATE ((NDIS_STATUS)0xC0012012L)
+#define NDIS_STATUS_TAPI_INVALMEDIAMODE ((NDIS_STATUS)0xC0012013L)
+#define NDIS_STATUS_TAPI_INVALRATE ((NDIS_STATUS)0xC0012014L)
+#define NDIS_STATUS_TAPI_NODRIVER ((NDIS_STATUS)0xC0012015L)
+#define NDIS_STATUS_TAPI_OPERATIONUNAVAIL ((NDIS_STATUS)0xC0012016L)
+#define NDIS_STATUS_TAPI_RATEUNAVAIL ((NDIS_STATUS)0xC0012017L)
+#define NDIS_STATUS_TAPI_RESOURCEUNAVAIL ((NDIS_STATUS)0xC0012018L)
+#define NDIS_STATUS_TAPI_STRUCTURETOOSMALL ((NDIS_STATUS)0xC0012019L)
+#define NDIS_STATUS_TAPI_USERUSERINFOTOOBIG ((NDIS_STATUS)0xC001201AL)
+#define NDIS_STATUS_TAPI_ALLOCATED ((NDIS_STATUS)0xC001201BL)
+#define NDIS_STATUS_TAPI_INVALADDRESSSTATE ((NDIS_STATUS)0xC001201CL)
+#define NDIS_STATUS_TAPI_INVALPARAM ((NDIS_STATUS)0xC001201DL)
+#define NDIS_STATUS_TAPI_NODEVICE ((NDIS_STATUS)0xC001201EL)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_NORMAL ((NDIS_STATUS)0xC0012020L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_UNKNOWN ((NDIS_STATUS)0xC0012021L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_REJECT ((NDIS_STATUS)0xC0012022L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_PICKUP ((NDIS_STATUS)0xC0012023L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_FORWARDED ((NDIS_STATUS)0xC0012024L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_BUSY ((NDIS_STATUS)0xC0012025L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_NOANSWER ((NDIS_STATUS)0xC0012026L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_BADADDRESS ((NDIS_STATUS)0xC0012027L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_UNREACHABLE ((NDIS_STATUS)0xC0012028L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_CONGESTION ((NDIS_STATUS)0xC0012029L)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_INCOMPATIBLE ((NDIS_STATUS)0xC001202AL)
+#define NDIS_STATUS_TAPI_DISCONNECTMODE_UNAVAIL ((NDIS_STATUS)0xC001202BL)
+#define NDIS_STATUS_TAPI_RECV_DIGIT ((NDIS_STATUS)0x40010020L)
+
+#define LINE_ADDRESSSTATE 0L
+#define LINE_CALLINFO 1L
+#define LINE_CALLSTATE 2L
+#define LINE_CLOSE 3L
+#define LINE_DEVSPECIFIC 4L
+#define LINE_DEVSPECIFICFEATURE 5L
+#define LINE_GATHERDIGITS 6L
+#define LINE_GENERATE 7L
+#define LINE_LINEDEVSTATE 8L
+#define LINE_MONITORDIGITS 9L
+#define LINE_MONITORMEDIA 10L
+#define LINE_MONITORTONE 11L
+#define LINE_REPLY 12L
+#define LINE_REQUEST 13L
+#define LINE_CREATE 19L
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINE_AGENTSPECIFIC 21L
+#define LINE_AGENTSTATUS 22L
+#define LINE_APPNEWCALL 23L
+#define LINE_PROXYREQUEST 24L
+#define LINE_REMOVE 25L
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020002)
+#define LINE_AGENTSESSIONSTATUS 27L
+#define LINE_QUEUESTATUS 28L
+#define LINE_AGENTSTATUSEX 29L
+#define LINE_GROUPSTATUS 30L
+#define LINE_PROXYSTATUS 31L
+#endif
+#if (TAPI_CURRENT_VERSION >= 0x00030000)
+#define LINE_APPNEWCALLHUB 32L
+#define LINE_CALLHUBCLOSE 33L
+#define LINE_DEVSPECIFICEX 34L
+#endif
+
+#define TSPI_MESSAGE_BASE 500L
+#define LINE_NEWCALL TSPI_MESSAGE_BASE
+#define LINE_CALLDEVSPECIFIC (TSPI_MESSAGE_BASE + 1L)
+#define STRINGFORMAT_ASCII 0x00000001
+#define STRINGFORMAT_DBCS 0x00000002
+#define STRINGFORMAT_UNICODE 0x00000003
+#define STRINGFORMAT_BINARY 0x00000004
+
+#define LINEADDRCAPFLAGS_FWDNUMRINGS 0x00000001
+#define LINEADDRCAPFLAGS_PICKUPGROUPID 0x00000002
+#define LINEADDRCAPFLAGS_SECURE 0x00000004
+#define LINEADDRCAPFLAGS_BLOCKIDDEFAULT 0x00000008
+#define LINEADDRCAPFLAGS_BLOCKIDOVERRIDE 0x00000010
+#define LINEADDRCAPFLAGS_DIALED 0x00000020
+#define LINEADDRCAPFLAGS_ORIGOFFHOOK 0x00000040
+#define LINEADDRCAPFLAGS_DESTOFFHOOK 0x00000080
+#define LINEADDRCAPFLAGS_FWDCONSULT 0x00000100
+#define LINEADDRCAPFLAGS_SETUPCONFNULL 0x00000200
+#define LINEADDRCAPFLAGS_AUTORECONNECT 0x00000400
+#define LINEADDRCAPFLAGS_COMPLETIONID 0x00000800
+#define LINEADDRCAPFLAGS_TRANSFERHELD 0x00001000
+#define LINEADDRCAPFLAGS_TRANSFERMAKE 0x00002000
+#define LINEADDRCAPFLAGS_CONFERENCEHELD 0x00004000
+#define LINEADDRCAPFLAGS_CONFERENCEMAKE 0x00008000
+#define LINEADDRCAPFLAGS_PARTIALDIAL 0x00010000
+#define LINEADDRCAPFLAGS_FWDSTATUSVALID 0x00020000
+#define LINEADDRCAPFLAGS_FWDINTEXTADDR 0x00040000
+#define LINEADDRCAPFLAGS_FWDBUSYNAADDR 0x00080000
+#define LINEADDRCAPFLAGS_ACCEPTTOALERT 0x00100000
+#define LINEADDRCAPFLAGS_CONFDROP 0x00200000
+#define LINEADDRCAPFLAGS_PICKUPCALLWAIT 0x00400000
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINEADDRCAPFLAGS_PREDICTIVEDIALER 0x00800000
+#define LINEADDRCAPFLAGS_QUEUE 0x01000000
+#define LINEADDRCAPFLAGS_ROUTEPOINT 0x02000000
+#define LINEADDRCAPFLAGS_HOLDMAKESNEW 0x04000000
+#define LINEADDRCAPFLAGS_NOINTERNALCALLS 0x08000000
+#define LINEADDRCAPFLAGS_NOEXTERNALCALLS 0x10000000
+#define LINEADDRCAPFLAGS_SETCALLINGID 0x20000000
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+#define LINEADDRCAPFLAGS_ACDGROUP 0x40000000
+#define LINEADDRCAPFLAGS_NOPSTNADDRESSTRANSLATION \
+ 0x80000000
+#endif
+
+#define LINEADDRESSMODE_ADDRESSID 0x00000001
+#define LINEADDRESSMODE_DIALABLEADDR 0x00000002
+#define LINEADDRESSSHARING_PRIVATE 0x00000001
+#define LINEADDRESSSHARING_BRIDGEDEXCL 0x00000002
+#define LINEADDRESSSHARING_BRIDGEDNEW 0x00000004
+#define LINEADDRESSSHARING_BRIDGEDSHARED 0x00000008
+#define LINEADDRESSSHARING_MONITORED 0x00000010
+#define LINEADDRESSSTATE_OTHER 0x00000001
+#define LINEADDRESSSTATE_DEVSPECIFIC 0x00000002
+#define LINEADDRESSSTATE_INUSEZERO 0x00000004
+#define LINEADDRESSSTATE_INUSEONE 0x00000008
+#define LINEADDRESSSTATE_INUSEMANY 0x00000010
+#define LINEADDRESSSTATE_NUMCALLS 0x00000020
+#define LINEADDRESSSTATE_FORWARD 0x00000040
+#define LINEADDRESSSTATE_TERMINALS 0x00000080
+
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+#define LINEADDRESSTYPE_PHONENUMBER 0x00000001
+#define LINEADDRESSTYPE_SDP 0x00000002
+#define LINEADDRESSTYPE_EMAILNAME 0x00000004
+#define LINEADDRESSTYPE_DOMAINNAME 0x00000008
+#define LINEADDRESSTYPE_IPADDRESS 0x00000010
+#endif
+
+#define LINEADDRFEATURE_FORWARD 0x00000001
+#define LINEADDRFEATURE_MAKECALL 0x00000002
+#define LINEADDRFEATURE_PICKUP 0x00000004
+#define LINEADDRFEATURE_SETMEDIACONTROL 0x00000008
+#define LINEADDRFEATURE_SETTERMINAL 0x00000010
+#define LINEADDRFEATURE_SETUPCONF 0x00000020
+#define LINEADDRFEATURE_UNCOMPLETECALL 0x00000040
+#define LINEADDRFEATURE_UNPARK 0x00000080
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINEADDRFEATURE_PICKUPHELD 0x00000100
+#define LINEADDRFEATURE_PICKUPGROUP 0x00000200
+#define LINEADDRFEATURE_PICKUPDIRECT 0x00000400
+#define LINEADDRFEATURE_PICKUPWAITING 0x00000800
+#define LINEADDRFEATURE_FORWARDFWD 0x00001000
+#define LINEADDRFEATURE_FORWARDDND 0x00002000
+#endif
+
+#define LINEANSWERMODE_NONE 0x00000001
+#define LINEANSWERMODE_DROP 0x00000002
+#define LINEANSWERMODE_HOLD 0x00000004
+
+#define LINEBEARERMODE_VOICE 0x00000001
+#define LINEBEARERMODE_SPEECH 0x00000002
+#define LINEBEARERMODE_MULTIUSE 0x00000004
+#define LINEBEARERMODE_DATA 0x00000008
+#define LINEBEARERMODE_ALTSPEECHDATA 0x00000010
+#define LINEBEARERMODE_NONCALLSIGNALING 0x00000020
+#define LINEBEARERMODE_PASSTHROUGH 0x00000040
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINEBEARERMODE_RESTRICTEDDATA 0x00000080
+#endif
+
+#define LINEBUSYMODE_STATION 0x00000001
+#define LINEBUSYMODE_TRUNK 0x00000002
+#define LINEBUSYMODE_UNKNOWN 0x00000004
+#define LINEBUSYMODE_UNAVAIL 0x00000008
+
+#define LINECALLCOMPLCOND_BUSY 0x00000001
+#define LINECALLCOMPLCOND_NOANSWER 0x00000002
+
+#define LINECALLCOMPLMODE_CAMPON 0x00000001
+#define LINECALLCOMPLMODE_CALLBACK 0x00000002
+#define LINECALLCOMPLMODE_INTRUDE 0x00000004
+#define LINECALLCOMPLMODE_MESSAGE 0x00000008
+
+#define LINECALLFEATURE_ACCEPT 0x00000001
+#define LINECALLFEATURE_ADDTOCONF 0x00000002
+#define LINECALLFEATURE_ANSWER 0x00000004
+#define LINECALLFEATURE_BLINDTRANSFER 0x00000008
+#define LINECALLFEATURE_COMPLETECALL 0x00000010
+#define LINECALLFEATURE_COMPLETETRANSF 0x00000020
+#define LINECALLFEATURE_DIAL 0x00000040
+#define LINECALLFEATURE_DROP 0x00000080
+#define LINECALLFEATURE_GATHERDIGITS 0x00000100
+#define LINECALLFEATURE_GENERATEDIGITS 0x00000200
+#define LINECALLFEATURE_GENERATETONE 0x00000400
+#define LINECALLFEATURE_HOLD 0x00000800
+#define LINECALLFEATURE_MONITORDIGITS 0x00001000
+#define LINECALLFEATURE_MONITORMEDIA 0x00002000
+#define LINECALLFEATURE_MONITORTONES 0x00004000
+#define LINECALLFEATURE_PARK 0x00008000
+#define LINECALLFEATURE_PREPAREADDCONF 0x00010000
+#define LINECALLFEATURE_REDIRECT 0x00020000
+#define LINECALLFEATURE_REMOVEFROMCONF 0x00040000
+#define LINECALLFEATURE_SECURECALL 0x00080000
+#define LINECALLFEATURE_SENDUSERUSER 0x00100000
+#define LINECALLFEATURE_SETCALLPARAMS 0x00200000
+#define LINECALLFEATURE_SETMEDIACONTROL 0x00400000
+#define LINECALLFEATURE_SETTERMINAL 0x00800000
+#define LINECALLFEATURE_SETUPCONF 0x01000000
+#define LINECALLFEATURE_SETUPTRANSFER 0x02000000
+#define LINECALLFEATURE_SWAPHOLD 0x04000000
+#define LINECALLFEATURE_UNHOLD 0x08000000
+#define LINECALLFEATURE_RELEASEUSERUSERINFO \
+ 0x10000000
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINECALLFEATURE_SETTREATMENT 0x20000000
+#define LINECALLFEATURE_SETQOS 0x40000000
+#define LINECALLFEATURE_SETCALLDATA 0x80000000
+#endif
+
+#define LINECALLINFOSTATE_OTHER 0x00000001
+#define LINECALLINFOSTATE_DEVSPECIFIC 0x00000002
+#define LINECALLINFOSTATE_BEARERMODE 0x00000004
+#define LINECALLINFOSTATE_RATE 0x00000008
+#define LINECALLINFOSTATE_MEDIAMODE 0x00000010
+#define LINECALLINFOSTATE_APPSPECIFIC 0x00000020
+#define LINECALLINFOSTATE_CALLID 0x00000040
+#define LINECALLINFOSTATE_RELATEDCALLID 0x00000080
+#define LINECALLINFOSTATE_ORIGIN 0x00000100
+#define LINECALLINFOSTATE_REASON 0x00000200
+#define LINECALLINFOSTATE_COMPLETIONID 0x00000400
+#define LINECALLINFOSTATE_NUMOWNERINCR 0x00000800
+#define LINECALLINFOSTATE_NUMOWNERDECR 0x00001000
+#define LINECALLINFOSTATE_NUMMONITORS 0x00002000
+#define LINECALLINFOSTATE_TRUNK 0x00004000
+#define LINECALLINFOSTATE_CALLERID 0x00008000
+#define LINECALLINFOSTATE_CALLEDID 0x00010000
+#define LINECALLINFOSTATE_CONNECTEDID 0x00020000
+#define LINECALLINFOSTATE_REDIRECTIONID 0x00040000
+#define LINECALLINFOSTATE_REDIRECTINGID 0x00080000
+#define LINECALLINFOSTATE_DISPLAY 0x00100000
+#define LINECALLINFOSTATE_USERUSERINFO 0x00200000
+#define LINECALLINFOSTATE_HIGHLEVELCOMP 0x00400000
+#define LINECALLINFOSTATE_LOWLEVELCOMP 0x00800000
+#define LINECALLINFOSTATE_CHARGINGINFO 0x01000000
+#define LINECALLINFOSTATE_TERMINAL 0x02000000
+#define LINECALLINFOSTATE_DIALPARAMS 0x04000000
+#define LINECALLINFOSTATE_MONITORMODES 0x08000000
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINECALLINFOSTATE_TREATMENT 0x10000000
+#define LINECALLINFOSTATE_QOS 0x20000000
+#define LINECALLINFOSTATE_CALLDATA 0x40000000
+#endif
+
+#define LINECALLORIGIN_OUTBOUND 0x00000001
+#define LINECALLORIGIN_INTERNAL 0x00000002
+#define LINECALLORIGIN_EXTERNAL 0x00000004
+#define LINECALLORIGIN_UNKNOWN 0x00000010
+#define LINECALLORIGIN_UNAVAIL 0x00000020
+#define LINECALLORIGIN_CONFERENCE 0x00000040
+#define LINECALLORIGIN_INBOUND 0x00000080
+
+#define LINECALLPARAMFLAGS_SECURE 0x00000001
+#define LINECALLPARAMFLAGS_IDLE 0x00000002
+#define LINECALLPARAMFLAGS_BLOCKID 0x00000004
+#define LINECALLPARAMFLAGS_ORIGOFFHOOK 0x00000008
+#define LINECALLPARAMFLAGS_DESTOFFHOOK 0x00000010
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINECALLPARAMFLAGS_NOHOLDCONFERENCE \
+ 0x00000020
+#define LINECALLPARAMFLAGS_PREDICTIVEDIAL 0x00000040
+#define LINECALLPARAMFLAGS_ONESTEPTRANSFER \
+ 0x00000080
+#endif
+
+#define LINECALLPARTYID_BLOCKED 0x00000001
+#define LINECALLPARTYID_OUTOFAREA 0x00000002
+#define LINECALLPARTYID_NAME 0x00000004
+#define LINECALLPARTYID_ADDRESS 0x00000008
+#define LINECALLPARTYID_PARTIAL 0x00000010
+#define LINECALLPARTYID_UNKNOWN 0x00000020
+#define LINECALLPARTYID_UNAVAIL 0x00000040
+
+#define LINECALLPRIVILEGE_NONE 0x00000001
+#define LINECALLPRIVILEGE_MONITOR 0x00000002
+#define LINECALLPRIVILEGE_OWNER 0x00000004
+
+#define LINECALLREASON_DIRECT 0x00000001
+#define LINECALLREASON_FWDBUSY 0x00000002
+#define LINECALLREASON_FWDNOANSWER 0x00000004
+#define LINECALLREASON_FWDUNCOND 0x00000008
+#define LINECALLREASON_PICKUP 0x00000010
+#define LINECALLREASON_UNPARK 0x00000020
+#define LINECALLREASON_REDIRECT 0x00000040
+#define LINECALLREASON_CALLCOMPLETION 0x00000080
+#define LINECALLREASON_TRANSFER 0x00000100
+#define LINECALLREASON_REMINDER 0x00000200
+#define LINECALLREASON_UNKNOWN 0x00000400
+#define LINECALLREASON_UNAVAIL 0x00000800
+#define LINECALLREASON_INTRUDE 0x00001000
+#define LINECALLREASON_PARKED 0x00002000
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINECALLREASON_CAMPEDON 0x00004000
+#define LINECALLREASON_ROUTEREQUEST 0x00008000
+#endif
+
+#define LINECALLSELECT_LINE 0x00000001
+#define LINECALLSELECT_ADDRESS 0x00000002
+#define LINECALLSELECT_CALL 0x00000004
+#if (NDIS_TAPI_CURRENT_VERSION > 0x00020000)
+#define LINECALLSELECT_DEVICEID 0x00000008
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+#define LINECALLSELECT_CALLID 0x00000010
+#endif
+
+#define LINECALLSTATE_IDLE 0x00000001
+#define LINECALLSTATE_OFFERING 0x00000002
+#define LINECALLSTATE_ACCEPTED 0x00000004
+#define LINECALLSTATE_DIALTONE 0x00000008
+#define LINECALLSTATE_DIALING 0x00000010
+#define LINECALLSTATE_RINGBACK 0x00000020
+#define LINECALLSTATE_BUSY 0x00000040
+#define LINECALLSTATE_SPECIALINFO 0x00000080
+#define LINECALLSTATE_CONNECTED 0x00000100
+#define LINECALLSTATE_PROCEEDING 0x00000200
+#define LINECALLSTATE_ONHOLD 0x00000400
+#define LINECALLSTATE_CONFERENCED 0x00000800
+#define LINECALLSTATE_ONHOLDPENDCONF 0x00001000
+#define LINECALLSTATE_ONHOLDPENDTRANSFER 0x00002000
+#define LINECALLSTATE_DISCONNECTED 0x00004000
+#define LINECALLSTATE_UNKNOWN 0x00008000
+
+#define LINEDEVCAPFLAGS_CROSSADDRCONF 0x00000001
+#define LINEDEVCAPFLAGS_HIGHLEVCOMP 0x00000002
+#define LINEDEVCAPFLAGS_LOWLEVCOMP 0x00000004
+#define LINEDEVCAPFLAGS_MEDIACONTROL 0x00000008
+#define LINEDEVCAPFLAGS_MULTIPLEADDR 0x00000010
+#define LINEDEVCAPFLAGS_CLOSEDROP 0x00000020
+#define LINEDEVCAPFLAGS_DIALBILLING 0x00000040
+#define LINEDEVCAPFLAGS_DIALQUIET 0x00000080
+#define LINEDEVCAPFLAGS_DIALDIALTONE 0x00000100
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+#define LINEDEVCAPFLAGS_MSP 0x00000200
+#define LINEDEVCAPFLAGS_CALLHUB 0x00000400
+#define LINEDEVCAPFLAGS_CALLHUBTRACKING 0x00000800
+#define LINEDEVCAPFLAGS_PRIVATEOBJECTS 0x00001000
+#endif
+
+#define LINEDEVSTATE_OTHER 0x00000001
+#define LINEDEVSTATE_RINGING 0x00000002
+#define LINEDEVSTATE_CONNECTED 0x00000004
+#define LINEDEVSTATE_DISCONNECTED 0x00000008
+#define LINEDEVSTATE_MSGWAITON 0x00000010
+#define LINEDEVSTATE_MSGWAITOFF 0x00000020
+#define LINEDEVSTATE_INSERVICE 0x00000040
+#define LINEDEVSTATE_OUTOFSERVICE 0x00000080
+#define LINEDEVSTATE_MAINTENANCE 0x00000100
+#define LINEDEVSTATE_OPEN 0x00000200
+#define LINEDEVSTATE_CLOSE 0x00000400
+#define LINEDEVSTATE_NUMCALLS 0x00000800
+#define LINEDEVSTATE_NUMCOMPLETIONS 0x00001000
+#define LINEDEVSTATE_TERMINALS 0x00002000
+#define LINEDEVSTATE_ROAMMODE 0x00004000
+#define LINEDEVSTATE_BATTERY 0x00008000
+#define LINEDEVSTATE_SIGNAL 0x00010000
+#define LINEDEVSTATE_DEVSPECIFIC 0x00020000
+#define LINEDEVSTATE_REINIT 0x00040000
+#define LINEDEVSTATE_LOCK 0x00080000
+
+#define LINEDEVSTATUSFLAGS_CONNECTED 0x00000001
+#define LINEDEVSTATUSFLAGS_MSGWAIT 0x00000002
+#define LINEDEVSTATUSFLAGS_INSERVICE 0x00000004
+#define LINEDEVSTATUSFLAGS_LOCKED 0x00000008
+
+#define LINEDIALTONEMODE_NORMAL 0x00000001
+#define LINEDIALTONEMODE_SPECIAL 0x00000002
+#define LINEDIALTONEMODE_INTERNAL 0x00000004
+#define LINEDIALTONEMODE_EXTERNAL 0x00000008
+#define LINEDIALTONEMODE_UNKNOWN 0x00000010
+#define LINEDIALTONEMODE_UNAVAIL 0x00000020
+
+#define LINEDIGITMODE_PULSE 0x00000001
+#define LINEDIGITMODE_DTMF 0x00000002
+#define LINEDIGITMODE_DTMFEND 0x00000004
+
+#define LINEDISCONNECTMODE_NORMAL 0x00000001
+#define LINEDISCONNECTMODE_UNKNOWN 0x00000002
+#define LINEDISCONNECTMODE_REJECT 0x00000004
+#define LINEDISCONNECTMODE_PICKUP 0x00000008
+#define LINEDISCONNECTMODE_FORWARDED 0x00000010
+#define LINEDISCONNECTMODE_BUSY 0x00000020
+#define LINEDISCONNECTMODE_NOANSWER 0x00000040
+#define LINEDISCONNECTMODE_BADADDRESS 0x00000080
+#define LINEDISCONNECTMODE_UNREACHABLE 0x00000100
+#define LINEDISCONNECTMODE_CONGESTION 0x00000200
+#define LINEDISCONNECTMODE_INCOMPATIBLE 0x00000400
+#define LINEDISCONNECTMODE_UNAVAIL 0x00000800
+#define LINEDISCONNECTMODE_NODIALTONE 0x00001000
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINEDISCONNECTMODE_NUMBERCHANGED 0x00002000
+#define LINEDISCONNECTMODE_OUTOFORDER 0x00004000
+#define LINEDISCONNECTMODE_TEMPFAILURE 0x00008000
+#define LINEDISCONNECTMODE_QOSUNAVAIL 0x00010000
+#define LINEDISCONNECTMODE_BLOCKED 0x00020000
+#define LINEDISCONNECTMODE_DONOTDISTURB 0x00040000
+#define LINEDISCONNECTMODE_CANCELLED 0x00080000
+#endif
+
+#define LINEFEATURE_DEVSPECIFIC 0x00000001
+#define LINEFEATURE_DEVSPECIFICFEAT 0x00000002
+#define LINEFEATURE_FORWARD 0x00000004
+#define LINEFEATURE_MAKECALL 0x00000008
+#define LINEFEATURE_SETMEDIACONTROL 0x00000010
+#define LINEFEATURE_SETTERMINAL 0x00000020
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINEFEATURE_SETDEVSTATUS 0x00000040
+#define LINEFEATURE_FORWARDFWD 0x00000080
+#define LINEFEATURE_FORWARDDND 0x00000100
+#endif
+
+#define LINEFORWARDMODE_UNCOND 0x00000001
+#define LINEFORWARDMODE_UNCONDINTERNAL 0x00000002
+#define LINEFORWARDMODE_UNCONDEXTERNAL 0x00000004
+#define LINEFORWARDMODE_UNCONDSPECIFIC 0x00000008
+#define LINEFORWARDMODE_BUSY 0x00000010
+#define LINEFORWARDMODE_BUSYINTERNAL 0x00000020
+#define LINEFORWARDMODE_BUSYEXTERNAL 0x00000040
+#define LINEFORWARDMODE_BUSYSPECIFIC 0x00000080
+#define LINEFORWARDMODE_NOANSW 0x00000100
+#define LINEFORWARDMODE_NOANSWINTERNAL 0x00000200
+#define LINEFORWARDMODE_NOANSWEXTERNAL 0x00000400
+#define LINEFORWARDMODE_NOANSWSPECIFIC 0x00000800
+#define LINEFORWARDMODE_BUSYNA 0x00001000
+#define LINEFORWARDMODE_BUSYNAINTERNAL 0x00002000
+#define LINEFORWARDMODE_BUSYNAEXTERNAL 0x00004000
+#define LINEFORWARDMODE_BUSYNASPECIFIC 0x00008000
+
+#define LINEGATHERTERM_BUFFERFULL 0x00000001
+#define LINEGATHERTERM_TERMDIGIT 0x00000002
+#define LINEGATHERTERM_FIRSTTIMEOUT 0x00000004
+#define LINEGATHERTERM_INTERTIMEOUT 0x00000008
+#define LINEGATHERTERM_CANCEL 0x00000010
+
+#define LINEGENERATETERM_DONE 0x00000001
+#define LINEGENERATETERM_CANCEL 0x00000002
+
+#define LINEMEDIACONTROL_NONE 0x00000001
+#define LINEMEDIACONTROL_START 0x00000002
+#define LINEMEDIACONTROL_RESET 0x00000004
+#define LINEMEDIACONTROL_PAUSE 0x00000008
+#define LINEMEDIACONTROL_RESUME 0x00000010
+#define LINEMEDIACONTROL_RATEUP 0x00000020
+#define LINEMEDIACONTROL_RATEDOWN 0x00000040
+#define LINEMEDIACONTROL_RATENORMAL 0x00000080
+#define LINEMEDIACONTROL_VOLUMEUP 0x00000100
+#define LINEMEDIACONTROL_VOLUMEDOWN 0x00000200
+#define LINEMEDIACONTROL_VOLUMENORMAL 0x00000400
+
+#define LINEMEDIAMODE_UNKNOWN 0x00000002
+#define LINEMEDIAMODE_INTERACTIVEVOICE 0x00000004
+#define LINEMEDIAMODE_AUTOMATEDVOICE 0x00000008
+#define LINEMEDIAMODE_DATAMODEM 0x00000010
+#define LINEMEDIAMODE_G3FAX 0x00000020
+#define LINEMEDIAMODE_TDD 0x00000040
+#define LINEMEDIAMODE_G4FAX 0x00000080
+#define LINEMEDIAMODE_DIGITALDATA 0x00000100
+#define LINEMEDIAMODE_TELETEX 0x00000200
+#define LINEMEDIAMODE_VIDEOTEX 0x00000400
+#define LINEMEDIAMODE_TELEX 0x00000800
+#define LINEMEDIAMODE_MIXED 0x00001000
+#define LINEMEDIAMODE_ADSI 0x00002000
+
+#define LINEMEDIAMODE_VOICEVIEW 0x00004000
+#define LAST_LINEMEDIAMODE 0x00004000
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020001)
+#define LINEMEDIAMODE_VIDEO 0x00008000
+#define LAST_LINEMEDIAMODE 0x00008000
+#endif
+
+#define LINEPARKMODE_DIRECTED 0x00000001
+#define LINEPARKMODE_NONDIRECTED 0x00000002
+
+#define LINEREMOVEFROMCONF_NONE 0x00000001
+#define LINEREMOVEFROMCONF_LAST 0x00000002
+#define LINEREMOVEFROMCONF_ANY 0x00000003
+
+#define LINEREQUESTMODE_MAKECALL 0x00000001
+#define LINEREQUESTMODE_MEDIACALL 0x00000002
+#define LINEREQUESTMODE_DROP 0x00000004
+
+#define LAST_LINEREQUESTMODE LINEREQUESTMODE_MEDIACALL
+
+#define LINEROAMMODE_UNKNOWN 0x00000001
+#define LINEROAMMODE_UNAVAIL 0x00000002
+#define LINEROAMMODE_HOME 0x00000004
+#define LINEROAMMODE_ROAMA 0x00000008
+#define LINEROAMMODE_ROAMB 0x00000010
+
+#define LINESPECIALINFO_NOCIRCUIT 0x00000001
+#define LINESPECIALINFO_CUSTIRREG 0x00000002
+#define LINESPECIALINFO_REORDER 0x00000004
+#define LINESPECIALINFO_UNKNOWN 0x00000008
+#define LINESPECIALINFO_UNAVAIL 0x00000010
+
+#define LINETERMDEV_PHONE 0x00000001
+#define LINETERMDEV_HEADSET 0x00000002
+#define LINETERMDEV_SPEAKER 0x00000004
+
+#define LINETERMMODE_BUTTONS 0x00000001
+#define LINETERMMODE_LAMPS 0x00000002
+#define LINETERMMODE_DISPLAY 0x00000004
+#define LINETERMMODE_RINGER 0x00000008
+#define LINETERMMODE_HOOKSWITCH 0x00000010
+#define LINETERMMODE_MEDIATOLINE 0x00000020
+#define LINETERMMODE_MEDIAFROMLINE 0x00000040
+#define LINETERMMODE_MEDIABIDIRECT 0x00000080
+
+#define LINETERMSHARING_PRIVATE 0x00000001
+#define LINETERMSHARING_SHAREDEXCL 0x00000002
+#define LINETERMSHARING_SHAREDCONF 0x00000004
+
+#define LINETONEMODE_CUSTOM 0x00000001
+#define LINETONEMODE_RINGBACK 0x00000002
+#define LINETONEMODE_BUSY 0x00000004
+#define LINETONEMODE_BEEP 0x00000008
+#define LINETONEMODE_BILLING 0x00000010
+
+#define LINETRANSFERMODE_TRANSFER 0x00000001
+#define LINETRANSFERMODE_CONFERENCE 0x00000002
+
+#define LINETOLLLISTOPTION_ADD 0x00000001
+#define LINETOLLLISTOPTION_REMOVE 0x00000002
+
+#define LINETRANSLATEOPTION_CARDOVERRIDE 0x00000001
+
+#define LINETRANSLATERESULT_CANONICAL 0x00000001
+#define LINETRANSLATERESULT_INTERNATIONAL 0x00000002
+#define LINETRANSLATERESULT_LONGDISTANCE 0x00000004
+#define LINETRANSLATERESULT_LOCAL 0x00000008
+#define LINETRANSLATERESULT_INTOLLLIST 0x00000010
+#define LINETRANSLATERESULT_NOTINTOLLLIST 0x00000020
+#define LINETRANSLATERESULT_DIALBILLING 0x00000040
+#define LINETRANSLATERESULT_DIALQUIET 0x00000080
+#define LINETRANSLATERESULT_DIALDIALTONE 0x00000100
+#define LINETRANSLATERESULT_DIALPROMPT 0x00000200
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+#define LINETRANSLATERESULT_VOICEDETECT 0x00000400
+#endif
+
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+#define LINETRANSLATERESULT_NOTRANSLATION 0x00000800
+#endif
+
+
+typedef struct _NDIS_VAR_DATA_DESC {
+ USHORT Length;
+ USHORT MaximumLength;
+ LONG Offset;
+} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC;
+
+typedef struct _LINE_DIAL_PARAMS {
+ ULONG ulDialPause;
+ ULONG ulDialSpeed;
+ ULONG ulDigitDuration;
+ ULONG ulWaitForDialtone;
+} LINE_DIAL_PARAMS, *PLINE_DIAL_PARAMS;
+
+typedef struct _LINE_ADDRESS_CAPS {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+ ULONG ulLineDeviceID;
+ ULONG ulAddressSize;
+ ULONG ulAddressOffset;
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+ ULONG ulAddressSharing;
+ ULONG ulAddressStates;
+ ULONG ulCallInfoStates;
+ ULONG ulCallerIDFlags;
+ ULONG ulCalledIDFlags;
+ ULONG ulConnectedIDFlags;
+ ULONG ulRedirectionIDFlags;
+ ULONG ulRedirectingIDFlags;
+ ULONG ulCallStates;
+ ULONG ulDialToneModes;
+ ULONG ulBusyModes;
+ ULONG ulSpecialInfo;
+ ULONG ulDisconnectModes;
+ ULONG ulMaxNumActiveCalls;
+ ULONG ulMaxNumOnHoldCalls;
+ ULONG ulMaxNumOnHoldPendingCalls;
+ ULONG ulMaxNumConference;
+ ULONG ulMaxNumTransConf;
+ ULONG ulAddrCapFlags;
+ ULONG ulCallFeatures;
+ ULONG ulRemoveFromConfCaps;
+ ULONG ulRemoveFromConfState;
+ ULONG ulTransferModes;
+ ULONG ulParkModes;
+ ULONG ulForwardModes;
+ ULONG ulMaxForwardEntries;
+ ULONG ulMaxSpecificEntries;
+ ULONG ulMinFwdNumRings;
+ ULONG ulMaxFwdNumRings;
+ ULONG ulMaxCallCompletions;
+ ULONG ulCallCompletionConds;
+ ULONG ulCallCompletionModes;
+ ULONG ulNumCompletionMessages;
+ ULONG ulCompletionMsgTextEntrySize;
+ ULONG ulCompletionMsgTextSize;
+ ULONG ulCompletionMsgTextOffset;
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00010004)
+ ULONG ulAddressFeatures;
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+ ULONG ulPredictiveAutoTransferStates;
+ ULONG ulNumCallTreatments;
+ ULONG ulCallTreatmentListSize;
+ ULONG ulCallTreatmentListOffset;
+ ULONG ulDeviceClassesSize;
+ ULONG ulDeviceClassesOffset;
+ ULONG ulMaxCallDataSize;
+ ULONG ulCallFeatures2;
+ ULONG ulMaxNoAnswerTimeout;
+ ULONG ulConnectedModes;
+ ULONG ulOfferingModes;
+ ULONG ulAvailableMediaModes;
+#endif
+#endif
+} LINE_ADDRESS_CAPS, *PLINE_ADDRESS_CAPS;
+
+typedef struct _LINE_ADDRESS_STATUS {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+ ULONG ulNumInUse;
+ ULONG ulNumActiveCalls;
+ ULONG ulNumOnHoldCalls;
+ ULONG ulNumOnHoldPendCalls;
+ ULONG ulAddressFeatures;
+ ULONG ulNumRingsNoAnswer;
+ ULONG ulForwardNumEntries;
+ ULONG ulForwardSize;
+ ULONG ulForwardOffset;
+ ULONG ulTerminalModesSize;
+ ULONG ulTerminalModesOffset;
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+} LINE_ADDRESS_STATUS, *PLINE_ADDRESS_STATUS;
+
+typedef struct _LINE_CALL_INFO {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+ ULONG hLine;
+ ULONG ulLineDeviceID;
+ ULONG ulAddressID;
+ ULONG ulBearerMode;
+ ULONG ulRate;
+ ULONG ulMediaMode;
+ ULONG ulAppSpecific;
+ ULONG ulCallID;
+ ULONG ulRelatedCallID;
+ ULONG ulCallParamFlags;
+ ULONG ulCallStates;
+ ULONG ulMonitorDigitModes;
+ ULONG ulMonitorMediaModes;
+ LINE_DIAL_PARAMS DialParams;
+ ULONG ulOrigin;
+ ULONG ulReason;
+ ULONG ulCompletionID;
+ ULONG ulNumOwners;
+ ULONG ulNumMonitors;
+ ULONG ulCountryCode;
+ ULONG ulTrunk;
+ ULONG ulCallerIDFlags;
+ ULONG ulCallerIDSize;
+ ULONG ulCallerIDOffset;
+ ULONG ulCallerIDNameSize;
+ ULONG ulCallerIDNameOffset;
+ ULONG ulCalledIDFlags;
+ ULONG ulCalledIDSize;
+ ULONG ulCalledIDOffset;
+ ULONG ulCalledIDNameSize;
+ ULONG ulCalledIDNameOffset;
+ ULONG ulConnectedIDFlags;
+ ULONG ulConnectedIDSize;
+ ULONG ulConnectedIDOffset;
+ ULONG ulConnectedIDNameSize;
+ ULONG ulConnectedIDNameOffset;
+ ULONG ulRedirectionIDFlags;
+ ULONG ulRedirectionIDSize;
+ ULONG ulRedirectionIDOffset;
+ ULONG ulRedirectionIDNameSize;
+ ULONG ulRedirectionIDNameOffset;
+ ULONG ulRedirectingIDFlags;
+ ULONG ulRedirectingIDSize;
+ ULONG ulRedirectingIDOffset;
+ ULONG ulRedirectingIDNameSize;
+ ULONG ulRedirectingIDNameOffset;
+ ULONG ulAppNameSize;
+ ULONG ulAppNameOffset;
+ ULONG ulDisplayableAddressSize;
+ ULONG ulDisplayableAddressOffset;
+ ULONG ulCalledPartySize;
+ ULONG ulCalledPartyOffset;
+ ULONG ulCommentSize;
+ ULONG ulCommentOffset;
+ ULONG ulDisplaySize;
+ ULONG ulDisplayOffset;
+ ULONG ulUserUserInfoSize;
+ ULONG ulUserUserInfoOffset;
+ ULONG ulHighLevelCompSize;
+ ULONG ulHighLevelCompOffset;
+ ULONG ulLowLevelCompSize;
+ ULONG ulLowLevelCompOffset;
+ ULONG ulChargingInfoSize;
+ ULONG ulChargingInfoOffset;
+ ULONG ulTerminalModesSize;
+ ULONG ulTerminalModesOffset;
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+ ULONG ulCallTreatment;
+ ULONG ulCallDataSize;
+ ULONG ulCallDataOffset;
+ ULONG ulSendingFlowspecSize;
+ ULONG ulSendingFlowspecOffset;
+ ULONG ulReceivingFlowspecSize;
+ ULONG ulReceivingFlowspecOffset;
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+ ULONG ulCallerIDAddressType;
+ ULONG ulCalledIDAddressType;
+ ULONG ulConnectedIDAddressType;
+ ULONG ulRedirectionIDAddressType;
+ ULONG ulRedirectingIDAddressType;
+#endif
+} LINE_CALL_INFO, *PLINE_CALL_INFO;
+
+typedef struct _LINE_CALL_PARAMS {
+ ULONG ulTotalSize;
+ ULONG ulBearerMode;
+ ULONG ulMinRate;
+ ULONG ulMaxRate;
+ ULONG ulMediaMode;
+ ULONG ulCallParamFlags;
+ ULONG ulAddressMode;
+ ULONG ulAddressID;
+ LINE_DIAL_PARAMS DialParams;
+ ULONG ulOrigAddressSize;
+ ULONG ulOrigAddressOffset;
+ ULONG ulDisplayableAddressSize;
+ ULONG ulDisplayableAddressOffset;
+ ULONG ulCalledPartySize;
+ ULONG ulCalledPartyOffset;
+ ULONG ulCommentSize;
+ ULONG ulCommentOffset;
+ ULONG ulUserUserInfoSize;
+ ULONG ulUserUserInfoOffset;
+ ULONG ulHighLevelCompSize;
+ ULONG ulHighLevelCompOffset;
+ ULONG ulLowLevelCompSize;
+ ULONG ulLowLevelCompOffset;
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+ ULONG ulPredictiveAutoTransferStates;
+ ULONG ulTargetAddressSize;
+ ULONG ulTargetAddressOffset;
+ ULONG ulSendingFlowspecSize;
+ ULONG ulSendingFlowspecOffset;
+ ULONG ulReceivingFlowspecSize;
+ ULONG ulReceivingFlowspecOffset;
+ ULONG ulDeviceClassSize;
+ ULONG ulDeviceClassOffset;
+ ULONG ulDeviceConfigSize;
+ ULONG ulDeviceConfigOffset;
+ ULONG ulCallDataSize;
+ ULONG ulCallDataOffset;
+ ULONG ulNoAnswerTimeout;
+ ULONG ulCallingPartyIDSize;
+ ULONG ulCallingPartyIDOffset;
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+ ULONG ulAddressType;
+#endif
+} LINE_CALL_PARAMS, *PLINE_CALL_PARAMS;
+
+typedef struct _LINE_CALL_STATUS {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+ ULONG ulCallState;
+ ULONG ulCallStateMode;
+ ULONG ulCallPrivilege;
+ ULONG ulCallFeatures;
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+} LINE_CALL_STATUS, *PLINE_CALL_STATUS;
+
+typedef struct _LINE_DEV_CAPS {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+ ULONG ulProviderInfoSize;
+ ULONG ulProviderInfoOffset;
+ ULONG ulSwitchInfoSize;
+ ULONG ulSwitchInfoOffset;
+ ULONG ulPermanentLineID;
+ ULONG ulLineNameSize;
+ ULONG ulLineNameOffset;
+ ULONG ulStringFormat;
+ ULONG ulAddressModes;
+ ULONG ulNumAddresses;
+ ULONG ulBearerModes;
+ ULONG ulMaxRate;
+ ULONG ulMediaModes;
+ ULONG ulGenerateToneModes;
+ ULONG ulGenerateToneMaxNumFreq;
+ ULONG ulGenerateDigitModes;
+ ULONG ulMonitorToneMaxNumFreq;
+ ULONG ulMonitorToneMaxNumEntries;
+ ULONG ulMonitorDigitModes;
+ ULONG ulGatherDigitsMinTimeout;
+ ULONG ulGatherDigitsMaxTimeout;
+ ULONG ulMedCtlDigitMaxListSize;
+ ULONG ulMedCtlMediaMaxListSize;
+ ULONG ulMedCtlToneMaxListSize;
+ ULONG ulMedCtlCallStateMaxListSize;
+ ULONG ulDevCapFlags;
+ ULONG ulMaxNumActiveCalls;
+ ULONG ulAnswerMode;
+ ULONG ulRingModes;
+ ULONG ulLineStates;
+ ULONG ulUUIAcceptSize;
+ ULONG ulUUIAnswerSize;
+ ULONG ulUUIMakeCallSize;
+ ULONG ulUUIDropSize;
+ ULONG ulUUISendUserUserInfoSize;
+ ULONG ulUUICallInfoSize;
+ LINE_DIAL_PARAMS MinDialParams;
+ LINE_DIAL_PARAMS MaxDialParams;
+ LINE_DIAL_PARAMS DefaultDialParams;
+ ULONG ulNumTerminals;
+ ULONG ulTerminalCapsSize;
+ ULONG ulTerminalCapsOffset;
+ ULONG ulTerminalTextEntrySize;
+ ULONG ulTerminalTextSize;
+ ULONG ulTerminalTextOffset;
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00010004)
+ ULONG ulLineFeatures;
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020000)
+ ULONG ulSettableDevStatus;
+ ULONG ulDeviceClassesSize;
+ ULONG ulDeviceClassesOffset;
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00020002)
+ GUID PermanentLineGuid;
+#endif
+#if (NDIS_TAPI_CURRENT_VERSION >= 0x00030000)
+ ULONG ulAddressTypes;
+ GUID ProtocolGuid;
+ ULONG ulAvailableTracking;
+#endif
+} LINE_DEV_CAPS, *PLINE_DEV_CAPS;
+
+typedef struct _LINE_DEV_STATUS {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+ ULONG ulNumOpens;
+ ULONG ulOpenMediaModes;
+ ULONG ulNumActiveCalls;
+ ULONG ulNumOnHoldCalls;
+ ULONG ulNumOnHoldPendCalls;
+ ULONG ulLineFeatures;
+ ULONG ulNumCallCompletions;
+ ULONG ulRingMode;
+ ULONG ulSignalLevel;
+ ULONG ulBatteryLevel;
+ ULONG ulRoamMode;
+ ULONG ulDevStatusFlags;
+ ULONG ulTerminalModesSize;
+ ULONG ulTerminalModesOffset;
+ ULONG ulDevSpecificSize;
+ ULONG ulDevSpecificOffset;
+} LINE_DEV_STATUS, *PLINE_DEV_STATUS;
+
+typedef struct _LINE_EXTENSION_ID {
+ ULONG ulExtensionID0;
+ ULONG ulExtensionID1;
+ ULONG ulExtensionID2;
+ ULONG ulExtensionID3;
+} LINE_EXTENSION_ID, *PLINE_EXTENSION_ID;
+
+typedef struct _VAR_STRING {
+ ULONG ulTotalSize;
+ ULONG ulNeededSize;
+ ULONG ulUsedSize;
+ ULONG ulStringFormat;
+ ULONG ulStringSize;
+ ULONG ulStringOffset;
+} VAR_STRING, *PVAR_STRING;
+
+typedef struct _NDIS_TAPI_ANSWER {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+} NDIS_TAPI_ANSWER, *PNDIS_TAPI_ANSWER;
+
+typedef struct _NDIS_TAPI_CLOSE {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+} NDIS_TAPI_CLOSE, *PNDIS_TAPI_CLOSE;
+
+typedef struct _NDIS_TAPI_CLOSE_CALL {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+} NDIS_TAPI_CLOSE_CALL, *PNDIS_TAPI_CLOSE_CALL;
+
+typedef struct _NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulMediaModes;
+ IN LINE_CALL_PARAMS LineCallParams;
+} NDIS_TAPI_CONDITIONAL_MEDIA_DETECTION, *PNDIS_TAPI_CONDITIONAL_MEDIA_DETECTION;
+
+typedef struct _NDIS_TAPI_DROP {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+} NDIS_TAPI_DROP, *PNDIS_TAPI_DROP;
+
+typedef struct _NDIS_TAPI_PROVIDER_SHUTDOWN {
+ IN ULONG ulRequestID;
+} NDIS_TAPI_PROVIDER_SHUTDOWN, *PNDIS_TAPI_PROVIDER_SHUTDOWN;
+
+typedef struct _NDIS_TAPI_SET_APP_SPECIFIC {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulAppSpecific;
+} NDIS_TAPI_SET_APP_SPECIFIC, *PNDIS_TAPI_SET_APP_SPECIFIC;
+
+typedef struct _NDIS_TAPI_SET_CALL_PARAMS {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulBearerMode;
+ IN ULONG ulMinRate;
+ IN ULONG ulMaxRate;
+ IN BOOLEAN bSetLineDialParams;
+ IN LINE_DIAL_PARAMS LineDialParams;
+} NDIS_TAPI_SET_CALL_PARAMS, *PNDIS_TAPI_SET_CALL_PARAMS;
+
+typedef struct _NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulMediaModes;
+} NDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION, *PNDIS_TAPI_SET_DEFAULT_MEDIA_DETECTION;
+
+typedef struct _NDIS_TAPI_SET_DEV_CONFIG {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ IN ULONG ulDeviceConfigSize;
+ IN UCHAR DeviceConfig[1];
+} NDIS_TAPI_SET_DEV_CONFIG, *PNDIS_TAPI_SET_DEV_CONFIG;
+
+typedef struct _NDIS_TAPI_SET_MEDIA_MODE {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulMediaMode;
+} NDIS_TAPI_SET_MEDIA_MODE, *PNDIS_TAPI_SET_MEDIA_MODE;
+
+typedef struct _NDIS_TAPI_SET_STATUS_MESSAGES {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulLineStates;
+ IN ULONG ulAddressStates;
+} NDIS_TAPI_SET_STATUS_MESSAGES, *PNDIS_TAPI_SET_STATUS_MESSAGES;
+
+typedef struct _NDIS_TAPI_ACCEPT {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+} NDIS_TAPI_ACCEPT, *PNDIS_TAPI_ACCEPT;
+
+typedef struct _NDIS_TAPI_DIAL {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulDestAddressSize;
+ IN CHAR szDestAddress[1];
+} NDIS_TAPI_DIAL, *PNDIS_TAPI_DIAL;
+
+typedef struct _NDIS_TAPI_EVENT {
+ IN HTAPI_LINE htLine;
+ IN HTAPI_CALL htCall;
+ IN ULONG ulMsg;
+ IN ULONG ulParam1;
+ IN ULONG ulParam2;
+ IN ULONG ulParam3;
+} NDIS_TAPI_EVENT, *PNDIS_TAPI_EVENT;
+
+typedef struct _NDIS_TAPI_OPEN {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN HTAPI_LINE htLine;
+ OUT HDRV_LINE hdLine;
+} NDIS_TAPI_OPEN, *PNDIS_TAPI_OPEN;
+
+typedef struct _NDIS_TAPI_SECURE_CALL {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+} NDIS_TAPI_SECURE_CALL, *PNDIS_TAPI_SECURE_CALL;
+
+typedef struct _NDIS_TAPI_SELECT_EXT_VERSION {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulExtVersion;
+} NDIS_TAPI_SELECT_EXT_VERSION, *PNDIS_TAPI_SELECT_EXT_VERSION;
+
+typedef struct _NDIS_TAPI_SEND_USER_USER_INFO {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulUserUserInfoSize;
+ IN UCHAR UserUserInfo[1];
+} NDIS_TAPI_SEND_USER_USER_INFO, *PNDIS_TAPI_SEND_USER_USER_INFO;
+
+
+typedef struct _NDIS_TAPI_CONFIG_DIALOG {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ IN ULONG ulLibraryNameTotalSize;
+ OUT ULONG ulLibraryNameNeededSize;
+ OUT CHAR szLibraryName[1];
+} NDIS_TAPI_CONFIG_DIALOG, *PNDIS_TAPI_CONFIG_DIALOG;
+
+typedef struct _NDIS_TAPI_DEV_SPECIFIC {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulAddressID;
+ IN HDRV_CALL hdCall;
+ IN OUT ULONG ulParamsSize;
+ IN OUT UCHAR Params[1];
+} NDIS_TAPI_DEV_SPECIFIC, *PNDIS_TAPI_DEV_SPECIFIC;
+
+typedef struct _NDIS_TAPI_GET_ADDRESS_CAPS {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulAddressID;
+ IN ULONG ulExtVersion;
+ OUT LINE_ADDRESS_CAPS LineAddressCaps;
+} NDIS_TAPI_GET_ADDRESS_CAPS, *PNDIS_TAPI_GET_ADDRESS_CAPS;
+
+typedef struct _NDIS_TAPI_GET_ADDRESS_ID {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ OUT ULONG ulAddressID;
+ IN ULONG ulAddressMode;
+ IN ULONG ulAddressSize;
+ IN CHAR szAddress[1];
+} NDIS_TAPI_GET_ADDRESS_ID, *PNDIS_TAPI_GET_ADDRESS_ID;
+
+typedef struct _NDIS_TAPI_GET_ADDRESS_STATUS {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulAddressID;
+ OUT LINE_ADDRESS_STATUS LineAddressStatus;
+} NDIS_TAPI_GET_ADDRESS_STATUS, *PNDIS_TAPI_GET_ADDRESS_STATUS;
+
+typedef struct _NDIS_TAPI_GET_CALL_ADDRESS_ID {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ OUT ULONG ulAddressID;
+} NDIS_TAPI_GET_CALL_ADDRESS_ID, *PNDIS_TAPI_GET_CALL_ADDRESS_ID;
+
+typedef struct _NDIS_TAPI_GET_CALL_INFO {
+ ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ OUT LINE_CALL_INFO LineCallInfo;
+} NDIS_TAPI_GET_CALL_INFO, *PNDIS_TAPI_GET_CALL_INFO;
+
+typedef struct _NDIS_TAPI_GET_CALL_STATUS {
+ IN ULONG ulRequestID;
+ IN HDRV_CALL hdCall;
+ OUT LINE_CALL_STATUS LineCallStatus;
+} NDIS_TAPI_GET_CALL_STATUS, *PNDIS_TAPI_GET_CALL_STATUS;
+
+typedef struct _NDIS_TAPI_GET_DEV_CAPS {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulExtVersion;
+ OUT LINE_DEV_CAPS LineDevCaps;
+} NDIS_TAPI_GET_DEV_CAPS, *PNDIS_TAPI_GET_DEV_CAPS;
+
+typedef struct _NDIS_TAPI_GET_DEV_CONFIG {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ OUT VAR_STRING DeviceConfig;
+} NDIS_TAPI_GET_DEV_CONFIG, *PNDIS_TAPI_GET_DEV_CONFIG;
+
+typedef struct _NDIS_TAPI_GET_EXTENSION_ID {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ OUT LINE_EXTENSION_ID LineExtensionID;
+} NDIS_TAPI_GET_EXTENSION_ID, *PNDIS_TAPI_GET_EXTENSION_ID;
+
+typedef struct _NDIS_TAPI_GET_ID {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN ULONG ulAddressID;
+ IN HDRV_CALL hdCall;
+ IN ULONG ulSelect;
+ IN ULONG ulDeviceClassSize;
+ IN ULONG ulDeviceClassOffset;
+ OUT VAR_STRING DeviceID;
+} NDIS_TAPI_GET_ID, *PNDIS_TAPI_GET_ID;
+
+typedef struct _NDIS_TAPI_GET_LINE_DEV_STATUS {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ OUT LINE_DEV_STATUS LineDevStatus;
+} NDIS_TAPI_GET_LINE_DEV_STATUS, *PNDIS_TAPI_GET_LINE_DEV_STATUS;
+
+typedef struct _NDIS_TAPI_MAKE_CALL {
+ IN ULONG ulRequestID;
+ IN HDRV_LINE hdLine;
+ IN HTAPI_CALL htCall;
+ OUT HDRV_CALL hdCall;
+ IN ULONG ulDestAddressSize;
+ IN ULONG ulDestAddressOffset;
+ IN BOOLEAN bUseDefaultLineCallParams;
+ IN LINE_CALL_PARAMS LineCallParams;
+} NDIS_TAPI_MAKE_CALL, *PNDIS_TAPI_MAKE_CALL;
+
+typedef struct _NDIS_TAPI_NEGOTIATE_EXT_VERSION {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceID;
+ IN ULONG ulLowVersion;
+ IN ULONG ulHighVersion;
+ OUT ULONG ulExtVersion;
+} NDIS_TAPI_NEGOTIATE_EXT_VERSION, *PNDIS_TAPI_NEGOTIATE_EXT_VERSION;
+
+typedef struct _NDIS_TAPI_PROVIDER_INITIALIZE {
+ IN ULONG ulRequestID;
+ IN ULONG ulDeviceIDBase;
+ OUT ULONG ulNumLineDevs;
+ OUT ULONG ulProviderID;
+} NDIS_TAPI_PROVIDER_INITIALIZE, *PNDIS_TAPI_PROVIDER_INITIALIZE;
+
+
+#define CO_TAPI_VERSION NDIS_TAPI_CURRENT_VERSION
+
+#define CO_TAPI_FLAG_OUTGOING_CALL 0x00000001
+#define CO_TAPI_FLAG_INCOMING_CALL 0x00000002
+#define CO_TAPI_FLAG_USE_DEFAULT_CALLPARAMS 0x00000004
+
+#define AF_TAPI_SAP_TYPE 0x00008000
+
+typedef struct _CO_TAPI_ADDRESS_CAPS {
+ IN ULONG ulLineID;
+ IN ULONG ulAddressID;
+ OUT ULONG ulFlags;
+ OUT LINE_ADDRESS_CAPS LineAddressCaps;
+} CO_TAPI_ADDRESS_CAPS, *PCO_TAPI_ADDRESS_CAPS;
+
+/* CO_TAPI_CM_CAPS.ulFlags constants */
+#define CO_TAPI_FLAG_PER_LINE_CAPS 0x00000001
+
+typedef struct _CO_TAPI_CM_CAPS {
+ OUT ULONG ulCoTapiVersion;
+ OUT ULONG ulNumLines;
+ OUT ULONG ulFlags;
+} CO_TAPI_CM_CAPS, *PCO_TAPI_CM_CAPS;
+
+typedef struct _CO_TAPI_CALL_DIAGNOSTICS {
+ OUT ULONG ulOrigin;
+ OUT ULONG ulReason;
+ OUT NDIS_VAR_DATA_DESC DiagInfo;
+} CO_TAPI_CALL_DIAGNOSTICS, *PCO_TAPI_CALL_DIAGNOSTICS;
+
+
+/* CO_TAPI_LINE_CAPS.ulFlags constants */
+#define CO_TAPI_FLAG_PER_ADDRESS_CAPS 0x00000001
+
+typedef struct _CO_TAPI_LINE_CAPS {
+ IN ULONG ulLineID;
+ OUT ULONG ulFlags;
+ OUT LINE_DEV_CAPS LineDevCaps;
+} CO_TAPI_LINE_CAPS, *PCO_TAPI_LINE_CAPS;
+
+typedef struct _CO_TAPI_TRANSLATE_NDIS_CALLPARAMS {
+ IN ULONG ulFlags;
+ IN NDIS_VAR_DATA_DESC NdisCallParams;
+ OUT NDIS_VAR_DATA_DESC LineCallInfo;
+} CO_TAPI_TRANSLATE_NDIS_CALLPARAMS, *PCO_TAPI_TRANSLATE_NDIS_CALLPARAMS;
+
+typedef struct _CO_TAPI_TRANSLATE_TAPI_CALLPARAMS {
+ IN ULONG ulLineID;
+ IN ULONG ulAddressID;
+ IN ULONG ulFlags;
+ IN NDIS_VAR_DATA_DESC DestAddress;
+ IN NDIS_VAR_DATA_DESC LineCallParams;
+ OUT NDIS_VAR_DATA_DESC NdisCallParams;
+} CO_TAPI_TRANSLATE_TAPI_CALLPARAMS, *PCO_TAPI_TRANSLATE_TAPI_CALLPARAMS;
+
+/* CO_TAPI_TRANSLATE_SAP.ulLineID constants */
+#define CO_TAPI_LINE_ID_UNSPECIFIED 0xFFFFFFFF
+
+/* CO_TAPI_TRANSLATE_SAP.ulAddressID constants */
+#define CO_TAPI_ADDRESS_ID_UNSPECIFIED 0xFFFFFFFF
+
+typedef struct _CO_TAPI_TRANSLATE_SAP {
+ IN ULONG ulLineID;
+ IN ULONG ulAddressID;
+ IN ULONG ulMediaModes;
+ IN ULONG Reserved;
+ OUT ULONG NumberOfSaps;
+ OUT NDIS_VAR_DATA_DESC NdisSapParams[1];
+} CO_AF_TAPI_SAP, *PCO_AF_TAPI_SAP;
+
+typedef struct _CO_AF_TAPI_INCOMING_CALL_PARAMETERS {
+ IN ULONG ulLineID;
+ IN ULONG ulAddressID;
+ IN ULONG ulFlags;
+ IN NDIS_VAR_DATA_DESC LineCallInfo;
+} CO_AF_TAPI_INCOMING_CALL_PARAMETERS, *PCO_AF_TAPI_INCOMING_CALL_PARAMETERS;
+
+typedef struct _CO_AF_TAPI_MAKE_CALL_PARAMETERS {
+ IN ULONG ulLineID;
+ IN ULONG ulAddressID;
+ IN ULONG ulFlags;
+ IN NDIS_VAR_DATA_DESC DestAddress;
+ IN NDIS_VAR_DATA_DESC LineCallParams;
+} CO_AF_TAPI_MAKE_CALL_PARAMETERS, *PCO_AF_TAPI_MAKE_CALL_PARAMETERS;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NDISTAPI_H */
--- /dev/null
+/*
+ * ndiswan.h
+ *
+ * Definitions for NDIS WAN miniport drivers
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NDISWAN_H
+#define __NDISWAN_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ndis.h"
+
+#define NDIS_USE_WAN_WRAPPER 0x00000001
+
+#define NDIS_STATUS_TAPI_INDICATION ((NDIS_STATUS)0x40010080L)
+
+/* NDIS_WAN_INFO.FramingBits constants */
+#define RAS_FRAMING 0x00000001
+#define RAS_COMPRESSION 0x00000002
+
+#define ARAP_V1_FRAMING 0x00000004
+#define ARAP_V2_FRAMING 0x00000008
+#define ARAP_FRAMING (ARAP_V1_FRAMING | ARAP_V2_FRAMING)
+
+#define PPP_MULTILINK_FRAMING 0x00000010
+#define PPP_SHORT_SEQUENCE_HDR_FORMAT 0x00000020
+#define PPP_MC_MULTILINK_FRAMING 0x00000040
+
+#define PPP_FRAMING 0x00000100
+#define PPP_COMPRESS_ADDRESS_CONTROL 0x00000200
+#define PPP_COMPRESS_PROTOCOL_FIELD 0x00000400
+#define PPP_ACCM_SUPPORTED 0x00000800
+
+#define SLIP_FRAMING 0x00001000
+#define SLIP_VJ_COMPRESSION 0x00002000
+#define SLIP_VJ_AUTODETECT 0x00004000
+
+#define MEDIA_NRZ_ENCODING 0x00010000
+#define MEDIA_NRZI_ENCODING 0x00020000
+#define MEDIA_NLPID 0x00040000
+
+#define RFC_1356_FRAMING 0x00100000
+#define RFC_1483_FRAMING 0x00200000
+#define RFC_1490_FRAMING 0x00400000
+#define LLC_ENCAPSULATION 0x00800000
+
+#define SHIVA_FRAMING 0x01000000
+#define NBF_PRESERVE_MAC_ADDRESS 0x01000000
+
+#define PASS_THROUGH_MODE 0x10000000
+#define RAW_PASS_THROUGH_MODE 0x20000000
+
+#define TAPI_PROVIDER 0x80000000
+
+typedef struct _NDIS_WAN_INFO {
+ OUT ULONG MaxFrameSize;
+ OUT ULONG MaxTransmit;
+ OUT ULONG HeaderPadding;
+ OUT ULONG TailPadding;
+ OUT ULONG Endpoints;
+ OUT UINT MemoryFlags;
+ OUT NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress;
+ OUT ULONG FramingBits;
+ OUT ULONG DesiredACCM;
+} NDIS_WAN_INFO, *PNDIS_WAN_INFO;
+
+typedef struct _NDIS_WAN_GET_LINK_INFO {
+ IN NDIS_HANDLE NdisLinkHandle;
+ OUT ULONG MaxSendFrameSize;
+ OUT ULONG MaxRecvFrameSize;
+ OUT ULONG HeaderPadding;
+ OUT ULONG TailPadding;
+ OUT ULONG SendFramingBits;
+ OUT ULONG RecvFramingBits;
+ OUT ULONG SendCompressionBits;
+ OUT ULONG RecvCompressionBits;
+ OUT ULONG SendACCM;
+ OUT ULONG RecvACCM;
+} NDIS_WAN_GET_LINK_INFO, *PNDIS_WAN_GET_LINK_INFO;
+
+typedef struct _NDIS_WAN_SET_LINK_INFO {
+ IN NDIS_HANDLE NdisLinkHandle;
+ IN ULONG MaxSendFrameSize;
+ IN ULONG MaxRecvFrameSize;
+ IN ULONG HeaderPadding;
+ IN ULONG TailPadding;
+ IN ULONG SendFramingBits;
+ IN ULONG RecvFramingBits;
+ IN ULONG SendCompressionBits;
+ IN ULONG RecvCompressionBits;
+ IN ULONG SendACCM;
+ IN ULONG RecvACCM;
+} NDIS_WAN_SET_LINK_INFO, *PNDIS_WAN_SET_LINK_INFO;
+
+/* NDIS_WAN_COMPRESS_INFO.MSCompType constants */
+#define NDISWAN_COMPRESSION 0x00000001
+#define NDISWAN_ENCRYPTION 0x00000010
+#define NDISWAN_40_ENCRYPTION 0x00000020
+#define NDISWAN_128_ENCRYPTION 0x00000040
+#define NDISWAN_56_ENCRYPTION 0x00000080
+#define NDISWAN_HISTORY_LESS 0x01000000
+
+/* NDIS_WAN_COMPRESS_INFO.CompType constants */
+#define COMPTYPE_OUI 0
+#define COMPTYPE_NT31RAS 254
+#define COMPTYPE_NONE 255
+
+typedef struct _NDIS_WAN_COMPRESS_INFO {
+ UCHAR SessionKey[8];
+ ULONG MSCompType;
+ UCHAR CompType;
+ USHORT CompLength;
+ union {
+ struct {
+ UCHAR CompOUI[3];
+ UCHAR CompSubType;
+ UCHAR CompValues[32];
+ } Proprietary;
+ struct {
+ UCHAR CompValues[32];
+ } Public;
+ };
+} NDIS_WAN_COMPRESS_INFO;
+
+typedef NDIS_WAN_COMPRESS_INFO *PNDIS_WAN_COMPRESS_INFO;
+
+typedef struct _NDIS_WAN_GET_COMP_INFO {
+ IN NDIS_HANDLE NdisLinkHandle;
+ OUT NDIS_WAN_COMPRESS_INFO SendCapabilities;
+ OUT NDIS_WAN_COMPRESS_INFO RecvCapabilities;
+} NDIS_WAN_GET_COMP_INFO, *PNDIS_WAN_GET_COMP_INFO;
+
+typedef struct _NDIS_WAN_SET_COMP_INFO {
+ IN NDIS_HANDLE NdisLinkHandle;
+ IN NDIS_WAN_COMPRESS_INFO SendCapabilities;
+ IN NDIS_WAN_COMPRESS_INFO RecvCapabilities;
+} NDIS_WAN_SET_COMP_INFO, *PNDIS_WAN_SET_COMP_INFO;
+
+typedef struct _NDIS_WAN_GET_STATS_INFO {
+ IN NDIS_HANDLE NdisLinkHandle;
+ OUT ULONG BytesSent;
+ OUT ULONG BytesRcvd;
+ OUT ULONG FramesSent;
+ OUT ULONG FramesRcvd;
+ OUT ULONG CRCErrors;
+ OUT ULONG TimeoutErrors;
+ OUT ULONG AlignmentErrors;
+ OUT ULONG SerialOverrunErrors;
+ OUT ULONG FramingErrors;
+ OUT ULONG BufferOverrunErrors;
+ OUT ULONG BytesTransmittedUncompressed;
+ OUT ULONG BytesReceivedUncompressed;
+ OUT ULONG BytesTransmittedCompressed;
+ OUT ULONG BytesReceivedCompressed;
+} NDIS_WAN_GET_STATS_INFO, *PNDIS_WAN_GET_STATS_INFO;
+
+#define NdisMWanInitializeWrapper(NdisWrapperHandle, \
+ SystemSpecific1, \
+ SystemSpecific2, \
+ SystemSpecific3) \
+{ \
+ NdisMInitializeWrapper(NdisWrapperHandle, \
+ SystemSpecific1, \
+ SystemSpecific2, \
+ SystemSpecific3); \
+}
+
+typedef struct _NDIS_WAN_CO_INFO {
+ OUT ULONG MaxFrameSize;
+ OUT ULONG MaxSendWindow;
+ OUT ULONG FramingBits;
+ OUT ULONG DesiredACCM;
+} NDIS_WAN_CO_INFO, *PNDIS_WAN_CO_INFO;
+
+typedef struct _NDIS_WAN_CO_GET_LINK_INFO {
+ OUT ULONG MaxSendFrameSize;
+ OUT ULONG MaxRecvFrameSize;
+ OUT ULONG SendFramingBits;
+ OUT ULONG RecvFramingBits;
+ OUT ULONG SendCompressionBits;
+ OUT ULONG RecvCompressionBits;
+ OUT ULONG SendACCM;
+ OUT ULONG RecvACCM;
+} NDIS_WAN_CO_GET_LINK_INFO, *PNDIS_WAN_CO_GET_LINK_INFO;
+
+typedef struct _NDIS_WAN_CO_SET_LINK_INFO {
+ IN ULONG MaxSendFrameSize;
+ IN ULONG MaxRecvFrameSize;
+ IN ULONG SendFramingBits;
+ IN ULONG RecvFramingBits;
+ IN ULONG SendCompressionBits;
+ IN ULONG RecvCompressionBits;
+ IN ULONG SendACCM;
+ IN ULONG RecvACCM;
+} NDIS_WAN_CO_SET_LINK_INFO, *PNDIS_WAN_CO_SET_LINK_INFO;
+
+typedef struct _NDIS_WAN_CO_GET_COMP_INFO {
+ OUT NDIS_WAN_COMPRESS_INFO SendCapabilities;
+ OUT NDIS_WAN_COMPRESS_INFO RecvCapabilities;
+} NDIS_WAN_CO_GET_COMP_INFO, *PNDIS_WAN_CO_GET_COMP_INFO;
+
+typedef struct _NDIS_WAN_CO_SET_COMP_INFO {
+ IN NDIS_WAN_COMPRESS_INFO SendCapabilities;
+ IN NDIS_WAN_COMPRESS_INFO RecvCapabilities;
+} NDIS_WAN_CO_SET_COMP_INFO, *PNDIS_WAN_CO_SET_COMP_INFO;
+
+typedef struct _NDIS_WAN_CO_GET_STATS_INFO {
+ OUT ULONG BytesSent;
+ OUT ULONG BytesRcvd;
+ OUT ULONG FramesSent;
+ OUT ULONG FramesRcvd;
+ OUT ULONG CRCErrors;
+ OUT ULONG TimeoutErrors;
+ OUT ULONG AlignmentErrors;
+ OUT ULONG SerialOverrunErrors;
+ OUT ULONG FramingErrors;
+ OUT ULONG BufferOverrunErrors;
+ OUT ULONG BytesTransmittedUncompressed;
+ OUT ULONG BytesReceivedUncompressed;
+ OUT ULONG BytesTransmittedCompressed;
+ OUT ULONG BytesReceivedCompressed;
+} NDIS_WAN_CO_GET_STATS_INFO, *PNDIS_WAN_CO_GET_STATS_INFO;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NDISWAN_H */
--- /dev/null
+/*
+ * netevent.h
+ *
+ * Network events
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NETEVENT_H
+#define __NETEVENT_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#define EVENT_TRANSPORT_REGISTER_FAILED 0xC000232CL
+
+#define EVENT_TRANSPORT_ADAPTER_NOT_FOUND 0xC000232EL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NETEVENT_H */
--- /dev/null
+/*
+ * netpnp.h
+ *
+ * Network Plug and Play event support
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NETPNP_H
+#define __NETPNP_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+typedef enum _NET_PNP_EVENT_CODE {
+ NetEventSetPower,
+ NetEventQueryPower,
+ NetEventQueryRemoveDevice,
+ NetEventCancelRemoveDevice,
+ NetEventReconfigure,
+ NetEventBindList,
+ NetEventBindsComplete,
+ NetEventPnPCapabilities,
+ NetEventMaximum
+} NET_PNP_EVENT_CODE, *PNET_PNP_EVENT_CODE;
+
+typedef struct _NET_PNP_EVENT {
+ NET_PNP_EVENT_CODE NetEvent;
+ PVOID Buffer;
+ ULONG BufferLength;
+ ULONG_PTR NdisReserved[4];
+ ULONG_PTR TransportReserved[4];
+ ULONG_PTR TdiReserved[4];
+ ULONG_PTR TdiClientReserved[4];
+} NET_PNP_EVENT, *PNET_PNP_EVENT;
+
+typedef enum _NET_DEVICE_POWER_STATE {
+ NetDeviceStateUnspecified,
+ NetDeviceStateD0,
+ NetDeviceStateD1,
+ NetDeviceStateD2,
+ NetDeviceStateD3,
+ NetDeviceStateMaximum
+} NET_DEVICE_POWER_STATE, *PNET_DEVICE_POWER_STATE;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NETPNP_H */
--- /dev/null
+/*
+ * newdev.h
+ *
+ * Driver installation DLL interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NEWDEV_H
+#define __NEWDEV_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+/* UpdateDriverForPlugAndPlayDevices.InstallFlags constants */
+#define INSTALLFLAG_FORCE 0x00000001
+#define INSTALLFLAG_READONLY 0x00000002
+#define INSTALLFLAG_NONINTERACTIVE 0x00000004
+#define INSTALLFLAG_BITS 0x00000007
+
+BOOL WINAPI
+UpdateDriverForPlugAndPlayDevicesA(
+ HWND hwndParent,
+ LPCSTR HardwareId,
+ LPCSTR FullInfPath,
+ DWORD InstallFlags,
+ PBOOL bRebootRequired OPTIONAL);
+
+BOOL WINAPI
+UpdateDriverForPlugAndPlayDevicesW(
+ HWND hwndParent,
+ LPCWSTR HardwareId,
+ LPCWSTR FullInfPath,
+ DWORD InstallFlags,
+ PBOOL bRebootRequired OPTIONAL);
+
+#ifdef UNICODE
+#define UpdateDriverForPlugAndPlayDevices UpdateDriverForPlugAndPlayDevicesW
+#else
+#define UpdateDriverForPlugAndPlayDevices UpdateDriverForPlugAndPlayDevicesA
+#endif /* UNICODE */
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NEWDEV_H */
--- /dev/null
+/*
+ * ntapi.h
+ *
+ * Windows NT Native API
+ *
+ * Most structures in this file is obtained from Windows NT/2000 Native API
+ * Reference by Gary Nebbett, ISBN 1578701996.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTAPI_H
+#define __NTAPI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include <stdarg.h>
+#include <winbase.h>
+#include "ntddk.h"
+#include "ntpoapi.h"
+
+typedef struct _PEB *PPEB;
+
+/* FIXME: Unknown definitions */
+typedef PVOID POBJECT_TYPE_LIST;
+typedef PVOID PEXECUTION_STATE;
+typedef PVOID PLANGID;
+
+
+/* System information and control */
+
+typedef enum _SYSTEM_INFORMATION_CLASS {
+ SystemInformationClassMin = 0,
+ SystemBasicInformation = 0,
+ SystemProcessorInformation = 1,
+ SystemPerformanceInformation = 2,
+ SystemTimeOfDayInformation = 3,
+ SystemPathInformation = 4,
+ SystemNotImplemented1 = 4,
+ SystemProcessInformation = 5,
+ SystemProcessesAndThreadsInformation = 5,
+ SystemCallCountInfoInformation = 6,
+ SystemCallCounts = 6,
+ SystemDeviceInformation = 7,
+ SystemConfigurationInformation = 7,
+ SystemProcessorPerformanceInformation = 8,
+ SystemProcessorTimes = 8,
+ SystemFlagsInformation = 9,
+ SystemGlobalFlag = 9,
+ SystemCallTimeInformation = 10,
+ SystemNotImplemented2 = 10,
+ SystemModuleInformation = 11,
+ SystemLocksInformation = 12,
+ SystemLockInformation = 12,
+ SystemStackTraceInformation = 13,
+ SystemNotImplemented3 = 13,
+ SystemPagedPoolInformation = 14,
+ SystemNotImplemented4 = 14,
+ SystemNonPagedPoolInformation = 15,
+ SystemNotImplemented5 = 15,
+ SystemHandleInformation = 16,
+ SystemObjectInformation = 17,
+ SystemPageFileInformation = 18,
+ SystemPagefileInformation = 18,
+ SystemVdmInstemulInformation = 19,
+ SystemInstructionEmulationCounts = 19,
+ SystemVdmBopInformation = 20,
+ SystemInvalidInfoClass1 = 20,
+ SystemFileCacheInformation = 21,
+ SystemCacheInformation = 21,
+ SystemPoolTagInformation = 22,
+ SystemInterruptInformation = 23,
+ SystemProcessorStatistics = 23,
+ SystemDpcBehaviourInformation = 24,
+ SystemDpcInformation = 24,
+ SystemFullMemoryInformation = 25,
+ SystemNotImplemented6 = 25,
+ SystemLoadImage = 26,
+ SystemUnloadImage = 27,
+ SystemTimeAdjustmentInformation = 28,
+ SystemTimeAdjustment = 28,
+ SystemSummaryMemoryInformation = 29,
+ SystemNotImplemented7 = 29,
+ SystemNextEventIdInformation = 30,
+ SystemNotImplemented8 = 30,
+ SystemEventIdsInformation = 31,
+ SystemNotImplemented9 = 31,
+ SystemCrashDumpInformation = 32,
+ SystemExceptionInformation = 33,
+ SystemCrashDumpStateInformation = 34,
+ SystemKernelDebuggerInformation = 35,
+ SystemContextSwitchInformation = 36,
+ SystemRegistryQuotaInformation = 37,
+ SystemLoadAndCallImage = 38,
+ SystemPrioritySeparation = 39,
+ SystemPlugPlayBusInformation = 40,
+ SystemNotImplemented10 = 40,
+ SystemDockInformation = 41,
+ SystemNotImplemented11 = 41,
+ //SystemPowerInformation = 42, Conflicts with POWER_INFORMATION_LEVEL
+ SystemInvalidInfoClass2 = 42,
+ SystemProcessorSpeedInformation = 43,
+ SystemInvalidInfoClass3 = 43,
+ SystemCurrentTimeZoneInformation = 44,
+ SystemTimeZoneInformation = 44,
+ SystemLookasideInformation = 45,
+ SystemSetTimeSlipEvent = 46,
+ SystemCreateSession = 47,
+ SystemDeleteSession = 48,
+ SystemInvalidInfoClass4 = 49,
+ SystemRangeStartInformation = 50,
+ SystemVerifierInformation = 51,
+ SystemAddVerifier = 52,
+ SystemSessionProcessesInformation = 53,
+ SystemInformationClassMax
+} SYSTEM_INFORMATION_CLASS;
+
+typedef struct _SYSTEM_BASIC_INFORMATION {
+ ULONG Unknown;
+ ULONG MaximumIncrement;
+ ULONG PhysicalPageSize;
+ ULONG NumberOfPhysicalPages;
+ ULONG LowestPhysicalPage;
+ ULONG HighestPhysicalPage;
+ ULONG AllocationGranularity;
+ ULONG LowestUserAddress;
+ ULONG HighestUserAddress;
+ ULONG ActiveProcessors;
+ UCHAR NumberProcessors;
+} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
+
+typedef struct _SYSTEM_PROCESSOR_INFORMATION {
+ USHORT ProcessorArchitecture;
+ USHORT ProcessorLevel;
+ USHORT ProcessorRevision;
+ USHORT Unknown;
+ ULONG FeatureBits;
+} SYSTEM_PROCESSOR_INFORMATION, *PSYSTEM_PROCESSOR_INFORMATION;
+
+typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
+ LARGE_INTEGER IdleTime;
+ LARGE_INTEGER ReadTransferCount;
+ LARGE_INTEGER WriteTransferCount;
+ LARGE_INTEGER OtherTransferCount;
+ ULONG ReadOperationCount;
+ ULONG WriteOperationCount;
+ ULONG OtherOperationCount;
+ ULONG AvailablePages;
+ ULONG TotalCommittedPages;
+ ULONG TotalCommitLimit;
+ ULONG PeakCommitment;
+ ULONG PageFaults;
+ ULONG WriteCopyFaults;
+ ULONG TransitionFaults;
+ ULONG CacheTransitionFaults;
+ ULONG DemandZeroFaults;
+ ULONG PagesRead;
+ ULONG PageReadIos;
+ ULONG CacheReads;
+ ULONG CacheIos;
+ ULONG PagefilePagesWritten;
+ ULONG PagefilePageWriteIos;
+ ULONG MappedFilePagesWritten;
+ ULONG MappedFilePageWriteIos;
+ ULONG PagedPoolUsage;
+ ULONG NonPagedPoolUsage;
+ ULONG PagedPoolAllocs;
+ ULONG PagedPoolFrees;
+ ULONG NonPagedPoolAllocs;
+ ULONG NonPagedPoolFrees;
+ ULONG TotalFreeSystemPtes;
+ ULONG SystemCodePage;
+ ULONG TotalSystemDriverPages;
+ ULONG TotalSystemCodePages;
+ ULONG SmallNonPagedLookasideListAllocateHits;
+ ULONG SmallPagedLookasideListAllocateHits;
+ ULONG Reserved3;
+ ULONG MmSystemCachePage;
+ ULONG PagedPoolPage;
+ ULONG SystemDriverPage;
+ ULONG FastReadNoWait;
+ ULONG FastReadWait;
+ ULONG FastReadResourceMiss;
+ ULONG FastReadNotPossible;
+ ULONG FastMdlReadNoWait;
+ ULONG FastMdlReadWait;
+ ULONG FastMdlReadResourceMiss;
+ ULONG FastMdlReadNotPossible;
+ ULONG MapDataNoWait;
+ ULONG MapDataWait;
+ ULONG MapDataNoWaitMiss;
+ ULONG MapDataWaitMiss;
+ ULONG PinMappedDataCount;
+ ULONG PinReadNoWait;
+ ULONG PinReadWait;
+ ULONG PinReadNoWaitMiss;
+ ULONG PinReadWaitMiss;
+ ULONG CopyReadNoWait;
+ ULONG CopyReadWait;
+ ULONG CopyReadNoWaitMiss;
+ ULONG CopyReadWaitMiss;
+ ULONG MdlReadNoWait;
+ ULONG MdlReadWait;
+ ULONG MdlReadNoWaitMiss;
+ ULONG MdlReadWaitMiss;
+ ULONG ReadAheadIos;
+ ULONG LazyWriteIos;
+ ULONG LazyWritePages;
+ ULONG DataFlushes;
+ ULONG DataPages;
+ ULONG ContextSwitches;
+ ULONG FirstLevelTbFills;
+ ULONG SecondLevelTbFills;
+ ULONG SystemCalls;
+} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
+
+typedef struct _SYSTEM_TIME_OF_DAY_INFORMATION {
+ LARGE_INTEGER BootTime;
+ LARGE_INTEGER CurrentTime;
+ LARGE_INTEGER TimeZoneBias;
+ ULONG CurrentTimeZoneId;
+} SYSTEM_TIME_OF_DAY_INFORMATION, *PSYSTEM_TIME_OF_DAY_INFORMATION;
+
+typedef struct _VM_COUNTERS {
+ ULONG PeakVirtualSize;
+ ULONG VirtualSize;
+ ULONG PageFaultCount;
+ ULONG PeakWorkingSetSize;
+ ULONG WorkingSetSize;
+ ULONG QuotaPeakPagedPoolUsage;
+ ULONG QuotaPagedPoolUsage;
+ ULONG QuotaPeakNonPagedPoolUsage;
+ ULONG QuotaNonPagedPoolUsage;
+ ULONG PagefileUsage;
+ ULONG PeakPagefileUsage;
+} VM_COUNTERS;
+
+typedef enum _THREAD_STATE {
+ StateInitialized,
+ StateReady,
+ StateRunning,
+ StateStandby,
+ StateTerminated,
+ StateWait,
+ StateTransition,
+ StateUnknown
+} THREAD_STATE;
+
+typedef struct _SYSTEM_THREADS {
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER CreateTime;
+ ULONG WaitTime;
+ PVOID StartAddress;
+ CLIENT_ID ClientId;
+ KPRIORITY Priority;
+ KPRIORITY BasePriority;
+ ULONG ContextSwitchCount;
+ THREAD_STATE State;
+ KWAIT_REASON WaitReason;
+} SYSTEM_THREADS, *PSYSTEM_THREADS;
+
+typedef struct _SYSTEM_PROCESSES {
+ ULONG NextEntryDelta;
+ ULONG ThreadCount;
+ ULONG Reserved1[6];
+ LARGE_INTEGER CreateTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER KernelTime;
+ UNICODE_STRING ProcessName;
+ KPRIORITY BasePriority;
+ ULONG ProcessId;
+ ULONG InheritedFromProcessId;
+ ULONG HandleCount;
+ ULONG Reserved2[2];
+ VM_COUNTERS VmCounters;
+ IO_COUNTERS IoCounters;
+ SYSTEM_THREADS Threads[1];
+} SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
+
+typedef struct _SYSTEM_CALLS_INFORMATION {
+ ULONG Size;
+ ULONG NumberOfDescriptorTables;
+ ULONG NumberOfRoutinesInTable[1];
+ ULONG CallCounts[ANYSIZE_ARRAY];
+} SYSTEM_CALLS_INFORMATION, *PSYSTEM_CALLS_INFORMATION;
+
+typedef struct _SYSTEM_CONFIGURATION_INFORMATION {
+ ULONG DiskCount;
+ ULONG FloppyCount;
+ ULONG CdRomCount;
+ ULONG TapeCount;
+ ULONG SerialCount;
+ ULONG ParallelCount;
+} SYSTEM_CONFIGURATION_INFORMATION, *PSYSTEM_CONFIGURATION_INFORMATION;
+
+typedef struct _SYSTEM_PROCESSOR_TIMES {
+ LARGE_INTEGER IdleTime;
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER DpcTime;
+ LARGE_INTEGER InterruptTime;
+ ULONG InterruptCount;
+} SYSTEM_PROCESSOR_TIMES, *PSYSTEM_PROCESSOR_TIMES;
+
+/* SYSTEM_GLOBAL_FLAG.GlobalFlag constants */
+#define FLG_STOP_ON_EXCEPTION 0x00000001
+#define FLG_SHOW_LDR_SNAPS 0x00000002
+#define FLG_DEBUG_INITIAL_COMMAND 0x00000004
+#define FLG_STOP_ON_HUNG_GUI 0x00000008
+#define FLG_HEAP_ENABLE_TAIL_CHECK 0x00000010
+#define FLG_HEAP_ENABLE_FREE_CHECK 0x00000020
+#define FLG_HEAP_VALIDATE_PARAMETERS 0x00000040
+#define FLG_HEAP_VALIDATE_ALL 0x00000080
+#define FLG_POOL_ENABLE_TAIL_CHECK 0x00000100
+#define FLG_POOL_ENABLE_FREE_CHECK 0x00000200
+#define FLG_POOL_ENABLE_TAGGING 0x00000400
+#define FLG_HEAP_ENABLE_TAGGING 0x00000800
+#define FLG_USER_STACK_TRACE_DB 0x00001000
+#define FLG_KERNEL_STACK_TRACE_DB 0x00002000
+#define FLG_MAINTAIN_OBJECT_TYPELIST 0x00004000
+#define FLG_HEAP_ENABLE_TAG_BY_DLL 0x00008000
+#define FLG_IGNORE_DEBUG_PRIV 0x00010000
+#define FLG_ENABLE_CSRDEBUG 0x00020000
+#define FLG_ENABLE_KDEBUG_SYMBOL_LOAD 0x00040000
+#define FLG_DISABLE_PAGE_KERNEL_STACKS 0x00080000
+#define FLG_HEAP_ENABLE_CALL_TRACING 0x00100000
+#define FLG_HEAP_DISABLE_COALESCING 0x00200000
+#define FLG_ENABLE_CLOSE_EXCEPTIONS 0x00400000
+#define FLG_ENABLE_EXCEPTION_LOGGING 0x00800000
+#define FLG_ENABLE_DBGPRINT_BUFFERING 0x08000000
+
+typedef struct _SYSTEM_GLOBAL_FLAG {
+ ULONG GlobalFlag;
+} SYSTEM_GLOBAL_FLAG, *PSYSTEM_GLOBAL_FLAG;
+
+typedef struct _SYSTEM_MODULE_INFORMATION_ENTRY {
+ ULONG Unknown1;
+ ULONG Unknown2;
+ PVOID Base;
+ ULONG Size;
+ ULONG Flags;
+ USHORT Index;
+ /* Length of module name not including the path, this
+ field contains valid value only for NTOSKRNL module */
+ USHORT NameLength;
+ USHORT LoadCount;
+ USHORT PathLength;
+ CHAR ImageName[256];
+} SYSTEM_MODULE_INFORMATION_ENTRY, *PSYSTEM_MODULE_INFORMATION_ENTRY;
+
+typedef struct _SYSTEM_MODULE_INFORMATION {
+ ULONG Count;
+ SYSTEM_MODULE_INFORMATION_ENTRY Module[1];
+} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
+
+typedef struct _SYSTEM_LOCK_INFORMATION {
+ PVOID Address;
+ USHORT Type;
+ USHORT Reserved1;
+ ULONG ExclusiveOwnerThreadId;
+ ULONG ActiveCount;
+ ULONG ContentionCount;
+ ULONG Reserved2[2];
+ ULONG NumberOfSharedWaiters;
+ ULONG NumberOfExclusiveWaiters;
+} SYSTEM_LOCK_INFORMATION, *PSYSTEM_LOCK_INFORMATION;
+
+/*SYSTEM_HANDLE_INFORMATION.Flags cosntants */
+#define PROTECT_FROM_CLOSE 0x01
+#define INHERIT 0x02
+
+typedef struct _SYSTEM_HANDLE_INFORMATION {
+ ULONG ProcessId;
+ UCHAR ObjectTypeNumber;
+ UCHAR Flags;
+ USHORT Handle;
+ PVOID Object;
+ ACCESS_MASK GrantedAccess;
+} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
+
+typedef struct _SYSTEM_OBJECT_TYPE_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG ObjectCount;
+ ULONG HandleCount;
+ ULONG TypeNumber;
+ ULONG InvalidAttributes;
+ GENERIC_MAPPING GenericMapping;
+ ACCESS_MASK ValidAccessMask;
+ POOL_TYPE PoolType;
+ UCHAR Unknown;
+ UNICODE_STRING Name;
+} SYSTEM_OBJECT_TYPE_INFORMATION, *PSYSTEM_OBJECT_TYPE_INFORMATION;
+
+/* SYSTEM_OBJECT_INFORMATION.Flags constants */
+#define FLG_SYSOBJINFO_SINGLE_HANDLE_ENTRY 0x40
+#define FLG_SYSOBJINFO_DEFAULT_SECURITY_QUOTA 0x20
+#define FLG_SYSOBJINFO_PERMANENT 0x10
+#define FLG_SYSOBJINFO_EXCLUSIVE 0x08
+#define FLG_SYSOBJINFO_CREATOR_INFO 0x04
+#define FLG_SYSOBJINFO_KERNEL_MODE 0x02
+
+typedef struct _SYSTEM_OBJECT_INFORMATION {
+ ULONG NextEntryOffset;
+ PVOID Object;
+ ULONG CreatorProcessId;
+ USHORT Unknown;
+ USHORT Flags;
+ ULONG PointerCount;
+ ULONG HandleCount;
+ ULONG PagedPoolUsage;
+ ULONG NonPagedPoolUsage;
+ ULONG ExclusiveProcessId;
+ PSECURITY_DESCRIPTOR SecurityDescriptor;
+ UNICODE_STRING Name;
+} SYSTEM_OBJECT_INFORMATION, *PSYSTEM_OBJECT_INFORMATION;
+
+typedef struct _SYSTEM_PAGEFILE_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG CurrentSize;
+ ULONG TotalUsed;
+ ULONG PeakUsed;
+ UNICODE_STRING FileName;
+} SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
+
+typedef struct _SYSTEM_INSTRUCTION_EMULATION_INFORMATION {
+ ULONG SegmentNotPresent;
+ ULONG TwoByteOpcode;
+ ULONG ESprefix;
+ ULONG CSprefix;
+ ULONG SSprefix;
+ ULONG DSprefix;
+ ULONG FSPrefix;
+ ULONG GSprefix;
+ ULONG OPER32prefix;
+ ULONG ADDR32prefix;
+ ULONG INSB;
+ ULONG INSW;
+ ULONG OUTSB;
+ ULONG OUTSW;
+ ULONG PUSHFD;
+ ULONG POPFD;
+ ULONG INTnn;
+ ULONG INTO;
+ ULONG IRETD;
+ ULONG INBimm;
+ ULONG INWimm;
+ ULONG OUTBimm;
+ ULONG OUTWimm;
+ ULONG INB;
+ ULONG INW;
+ ULONG OUTB;
+ ULONG OUTW;
+ ULONG LOCKprefix;
+ ULONG REPNEprefix;
+ ULONG REPprefix;
+ ULONG HLT;
+ ULONG CLI;
+ ULONG STI;
+ ULONG GenericInvalidOpcode;
+} SYSTEM_INSTRUCTION_EMULATION_INFORMATION, *PSYSTEM_INSTRUCTION_EMULATION_INFORMATION;
+
+typedef struct _SYSTEM_POOL_TAG_INFORMATION {
+ CHAR Tag[4];
+ ULONG PagedPoolAllocs;
+ ULONG PagedPoolFrees;
+ ULONG PagedPoolUsage;
+ ULONG NonPagedPoolAllocs;
+ ULONG NonPagedPoolFrees;
+ ULONG NonPagedPoolUsage;
+} SYSTEM_POOL_TAG_INFORMATION, *PSYSTEM_POOL_TAG_INFORMATION;
+
+typedef struct _SYSTEM_PROCESSOR_STATISTICS {
+ ULONG ContextSwitches;
+ ULONG DpcCount;
+ ULONG DpcRequestRate;
+ ULONG TimeIncrement;
+ ULONG DpcBypassCount;
+ ULONG ApcBypassCount;
+} SYSTEM_PROCESSOR_STATISTICS, *PSYSTEM_PROCESSOR_STATISTICS;
+
+typedef struct _SYSTEM_DPC_INFORMATION {
+ ULONG Reserved;
+ ULONG MaximumDpcQueueDepth;
+ ULONG MinimumDpcRate;
+ ULONG AdjustDpcThreshold;
+ ULONG IdealDpcRate;
+} SYSTEM_DPC_INFORMATION, *PSYSTEM_DPC_INFORMATION;
+
+typedef struct _SYSTEM_LOAD_IMAGE {
+ UNICODE_STRING ModuleName;
+ PVOID ModuleBase;
+ PVOID SectionPointer;
+ PVOID EntryPoint;
+ PVOID ExportDirectory;
+} SYSTEM_LOAD_IMAGE, *PSYSTEM_LOAD_IMAGE;
+
+typedef struct _SYSTEM_UNLOAD_IMAGE {
+ PVOID ModuleBase;
+} SYSTEM_UNLOAD_IMAGE, *PSYSTEM_UNLOAD_IMAGE;
+
+typedef struct _SYSTEM_QUERY_TIME_ADJUSTMENT {
+ ULONG TimeAdjustment;
+ ULONG MaximumIncrement;
+ BOOLEAN TimeSynchronization;
+} SYSTEM_QUERY_TIME_ADJUSTMENT, *PSYSTEM_QUERY_TIME_ADJUSTMENT;
+
+typedef struct _SYSTEM_SET_TIME_ADJUSTMENT {
+ ULONG TimeAdjustment;
+ BOOLEAN TimeSynchronization;
+} SYSTEM_SET_TIME_ADJUSTMENT, *PSYSTEM_SET_TIME_ADJUSTMENT;
+
+typedef struct _SYSTEM_CRASH_DUMP_INFORMATION {
+ HANDLE CrashDumpSectionHandle;
+ HANDLE Unknown;
+} SYSTEM_CRASH_DUMP_INFORMATION, *PSYSTEM_CRASH_DUMP_INFORMATION;
+
+typedef struct _SYSTEM_EXCEPTION_INFORMATION {
+ ULONG AlignmentFixupCount;
+ ULONG ExceptionDispatchCount;
+ ULONG FloatingEmulationCount;
+ ULONG Reserved;
+} SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
+
+typedef struct _SYSTEM_CRASH_DUMP_STATE_INFORMATION {
+ ULONG CrashDumpSectionExists;
+ ULONG Unknown;
+} SYSTEM_CRASH_DUMP_STATE_INFORMATION, *PSYSTEM_CRASH_DUMP_STATE_INFORMATION;
+
+typedef struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION {
+ BOOLEAN DebuggerEnabled;
+ BOOLEAN DebuggerNotPresent;
+} SYSTEM_KERNEL_DEBUGGER_INFORMATION, *PSYSTEM_KERNEL_DEBUGGER_INFORMATION;
+
+typedef struct _SYSTEM_CONTEXT_SWITCH_INFORMATION {
+ ULONG ContextSwitches;
+ ULONG ContextSwitchCounters[11];
+} SYSTEM_CONTEXT_SWITCH_INFORMATION, *PSYSTEM_CONTEXT_SWITCH_INFORMATION;
+
+typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
+ ULONG RegistryQuota;
+ ULONG RegistryQuotaInUse;
+ ULONG PagedPoolSize;
+} SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
+
+typedef struct _SYSTEM_LOAD_AND_CALL_IMAGE {
+ UNICODE_STRING ModuleName;
+} SYSTEM_LOAD_AND_CALL_IMAGE, *PSYSTEM_LOAD_AND_CALL_IMAGE;
+
+typedef struct _SYSTEM_PRIORITY_SEPARATION {
+ ULONG PrioritySeparation;
+} SYSTEM_PRIORITY_SEPARATION, *PSYSTEM_PRIORITY_SEPARATION;
+
+typedef struct _SYSTEM_TIME_ZONE_INFORMATION {
+ LONG Bias;
+ WCHAR StandardName[32];
+ LARGE_INTEGER StandardDate;
+ LONG StandardBias;
+ WCHAR DaylightName[32];
+ LARGE_INTEGER DaylightDate;
+ LONG DaylightBias;
+} SYSTEM_TIME_ZONE_INFORMATION, *PSYSTEM_TIME_ZONE_INFORMATION;
+
+typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
+ USHORT Depth;
+ USHORT MaximumDepth;
+ ULONG TotalAllocates;
+ ULONG AllocateMisses;
+ ULONG TotalFrees;
+ ULONG FreeMisses;
+ POOL_TYPE Type;
+ ULONG Tag;
+ ULONG Size;
+} SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
+
+typedef struct _SYSTEM_SET_TIME_SLIP_EVENT {
+ HANDLE TimeSlipEvent;
+} SYSTEM_SET_TIME_SLIP_EVENT, *PSYSTEM_SET_TIME_SLIP_EVENT;
+
+typedef struct _SYSTEM_CREATE_SESSION {
+ ULONG SessionId;
+} SYSTEM_CREATE_SESSION, *PSYSTEM_CREATE_SESSION;
+
+typedef struct _SYSTEM_DELETE_SESSION {
+ ULONG SessionId;
+} SYSTEM_DELETE_SESSION, *PSYSTEM_DELETE_SESSION;
+
+typedef struct _SYSTEM_RANGE_START_INFORMATION {
+ PVOID SystemRangeStart;
+} SYSTEM_RANGE_START_INFORMATION, *PSYSTEM_RANGE_START_INFORMATION;
+
+typedef struct _SYSTEM_SESSION_PROCESSES_INFORMATION {
+ ULONG SessionId;
+ ULONG BufferSize;
+ PVOID Buffer;
+} SYSTEM_SESSION_PROCESSES_INFORMATION, *PSYSTEM_SESSION_PROCESSES_INFORMATION;
+
+typedef struct _SYSTEM_POOL_BLOCK {
+ BOOLEAN Allocated;
+ USHORT Unknown;
+ ULONG Size;
+ CHAR Tag[4];
+} SYSTEM_POOL_BLOCK, *PSYSTEM_POOL_BLOCK;
+
+typedef struct _SYSTEM_POOL_BLOCKS_INFORMATION {
+ ULONG PoolSize;
+ PVOID PoolBase;
+ USHORT Unknown;
+ ULONG NumberOfBlocks;
+ SYSTEM_POOL_BLOCK PoolBlocks[1];
+} SYSTEM_POOL_BLOCKS_INFORMATION, *PSYSTEM_POOL_BLOCKS_INFORMATION;
+
+typedef struct _SYSTEM_MEMORY_USAGE {
+ PVOID Name;
+ USHORT Valid;
+ USHORT Standby;
+ USHORT Modified;
+ USHORT PageTables;
+} SYSTEM_MEMORY_USAGE, *PSYSTEM_MEMORY_USAGE;
+
+typedef struct _SYSTEM_MEMORY_USAGE_INFORMATION {
+ ULONG Reserved;
+ PVOID EndOfData;
+ SYSTEM_MEMORY_USAGE MemoryUsage[1];
+} SYSTEM_MEMORY_USAGE_INFORMATION, *PSYSTEM_MEMORY_USAGE_INFORMATION;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtQuerySystemInformation(
+ IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
+ IN OUT PVOID SystemInformation,
+ IN ULONG SystemInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQuerySystemInformation(
+ IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
+ IN OUT PVOID SystemInformation,
+ IN ULONG SystemInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetSystemInformation(
+ IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
+ IN OUT PVOID SystemInformation,
+ IN ULONG SystemInformationLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQuerySystemEnvironmentValue(
+ IN PUNICODE_STRING Name,
+ OUT PVOID Value,
+ IN ULONG ValueLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetSystemEnvironmentValue(
+ IN PUNICODE_STRING Name,
+ IN PUNICODE_STRING Value);
+
+typedef enum _SHUTDOWN_ACTION {
+ ShutdownNoReboot,
+ ShutdownReboot,
+ ShutdownPowerOff
+} SHUTDOWN_ACTION;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtShutdownSystem(
+ IN SHUTDOWN_ACTION Action);
+
+typedef enum _DEBUG_CONTROL_CODE {
+ DebugGetTraceInformation = 1,
+ DebugSetInternalBreakpoint,
+ DebugSetSpecialCall,
+ DebugClearSpecialCalls,
+ DebugQuerySpecialCalls,
+ DebugDbgBreakPoint,
+ DebugMaximum
+} DEBUG_CONTROL_CODE;
+
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSystemDebugControl(
+ IN DEBUG_CONTROL_CODE ControlCode,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+
+
+/* Objects, Object directories, and symbolic links */
+
+typedef enum _OBJECT_INFORMATION_CLASS {
+ ObjectBasicInformation,
+ ObjectNameInformation,
+ ObjectTypeInformation,
+ ObjectAllTypesInformation,
+ ObjectHandleInformation
+} OBJECT_INFORMATION_CLASS;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryObject(
+ IN HANDLE ObjectHandle,
+ IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
+ OUT PVOID ObjectInformation,
+ IN ULONG ObjectInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetInformationObject(
+ IN HANDLE ObjectHandle,
+ IN OBJECT_INFORMATION_CLASS ObjectInformationClass,
+ IN PVOID ObjectInformation,
+ IN ULONG ObjectInformationLength);
+
+/* OBJECT_BASIC_INFORMATION.Attributes constants */
+#define HANDLE_FLAG_INHERIT 0x01
+#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x02
+#define PERMANENT 0x10
+#define EXCLUSIVE 0x20
+
+typedef struct _OBJECT_BASIC_INFORMATION {
+ ULONG Attributes;
+ ACCESS_MASK GrantedAccess;
+ ULONG HandleCount;
+ ULONG PointerCount;
+ ULONG PagedPoolUsage;
+ ULONG NonPagedPoolUsage;
+ ULONG Reserved[3];
+ ULONG NameInformationLength;
+ ULONG TypeInformationLength;
+ ULONG SecurityDescriptorLength;
+ LARGE_INTEGER CreateTime;
+} OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION;
+#if 0
+// FIXME: Enable later
+typedef struct _OBJECT_TYPE_INFORMATION {
+ UNICODE_STRING Name;
+ ULONG ObjectCount;
+ ULONG HandleCount;
+ ULONG Reserved1[4];
+ ULONG PeakObjectCount;
+ ULONG PeakHandleCount;
+ ULONG Reserved2[4];
+ ULONG InvalidAttributes;
+ GENERIC_MAPPING GenericMapping;
+ ULONG ValidAccess;
+ UCHAR Unknown;
+ BOOLEAN MaintainHandleDatabase;
+ POOL_TYPE PoolType;
+ ULONG PagedPoolUsage;
+ ULONG NonPagedPoolUsage;
+} OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
+
+typedef struct _OBJECT_ALL_TYPES_INFORMATION {
+ ULONG NumberOfTypes;
+ OBJECT_TYPE_INFORMATION TypeInformation;
+} OBJECT_ALL_TYPES_INFORMATION, *POBJECT_ALL_TYPES_INFORMATION;
+#endif
+typedef struct _OBJECT_HANDLE_ATTRIBUTE_INFORMATION {
+ BOOLEAN Inherit;
+ BOOLEAN ProtectFromClose;
+} OBJECT_HANDLE_ATTRIBUTE_INFORMATION, *POBJECT_HANDLE_ATTRIBUTE_INFORMATION;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtDuplicateObject(
+ IN HANDLE SourceProcessHandle,
+ IN HANDLE SourceHandle,
+ IN HANDLE TargetProcessHandle,
+ OUT PHANDLE TargetHandle OPTIONAL,
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG Attributes,
+ IN ULONG Options);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwDuplicateObject(
+ IN HANDLE SourceProcessHandle,
+ IN HANDLE SourceHandle,
+ IN HANDLE TargetProcessHandle,
+ OUT PHANDLE TargetHandle OPTIONAL,
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG Attributes,
+ IN ULONG Options);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtQuerySecurityObject(
+ IN HANDLE Handle,
+ IN SECURITY_INFORMATION SecurityInformation,
+ OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN ULONG SecurityDescriptorLength,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQuerySecurityObject(
+ IN HANDLE Handle,
+ IN SECURITY_INFORMATION SecurityInformation,
+ OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN ULONG SecurityDescriptorLength,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtSetSecurityObject(
+ IN HANDLE Handle,
+ IN SECURITY_INFORMATION SecurityInformation,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetSecurityObject(
+ IN HANDLE Handle,
+ IN SECURITY_INFORMATION SecurityInformation,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwOpenDirectoryObject(
+ OUT PHANDLE DirectoryHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryDirectoryObject(
+ IN HANDLE DirectoryHandle,
+ OUT PVOID Buffer,
+ IN ULONG BufferLength,
+ IN BOOLEAN ReturnSingleEntry,
+ IN BOOLEAN RestartScan,
+ IN OUT PULONG Context,
+ OUT PULONG ReturnLength OPTIONAL);
+
+typedef struct _DIRECTORY_BASIC_INFORMATION {
+ UNICODE_STRING ObjectName;
+ UNICODE_STRING ObjectTypeName;
+} DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateSymbolicLinkObject(
+ OUT PHANDLE SymbolicLinkHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PUNICODE_STRING TargetName);
+
+
+
+
+/* Virtual memory */
+
+typedef enum _MEMORY_INFORMATION_CLASS {
+MemoryBasicInformation,
+MemoryWorkingSetList,
+MemorySectionName,
+MemoryBasicVlmInformation
+} MEMORY_INFORMATION_CLASS;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtAllocateVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN ULONG ZeroBits,
+ IN OUT PULONG AllocationSize,
+ IN ULONG AllocationType,
+ IN ULONG Protect);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAllocateVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN ULONG ZeroBits,
+ IN OUT PULONG AllocationSize,
+ IN ULONG AllocationType,
+ IN ULONG Protect);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtFreeVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG FreeSize,
+ IN ULONG FreeType);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwFreeVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG FreeSize,
+ IN ULONG FreeType);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress,
+ IN MEMORY_INFORMATION_CLASS MemoryInformationClass,
+ OUT PVOID MemoryInformation,
+ IN ULONG MemoryInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+/* MEMORY_WORKING_SET_LIST.WorkingSetList constants */
+#define WSLE_PAGE_READONLY 0x001
+#define WSLE_PAGE_EXECUTE 0x002
+#define WSLE_PAGE_READWRITE 0x004
+#define WSLE_PAGE_EXECUTE_READ 0x003
+#define WSLE_PAGE_WRITECOPY 0x005
+#define WSLE_PAGE_EXECUTE_READWRITE 0x006
+#define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
+#define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
+#define WSLE_PAGE_SHAREABLE 0x100
+
+typedef struct _MEMORY_WORKING_SET_LIST {
+ ULONG NumberOfPages;
+ ULONG WorkingSetList[1];
+} MEMORY_WORKING_SET_LIST, *PMEMORY_WORKING_SET_LIST;
+
+typedef struct _MEMORY_SECTION_NAME {
+ UNICODE_STRING SectionFileName;
+} MEMORY_SECTION_NAME, *PMEMORY_SECTION_NAME;
+
+/* Zw[Lock|Unlock]VirtualMemory.LockType constants */
+#define LOCK_VM_IN_WSL 0x01
+#define LOCK_VM_IN_RAM 0x02
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwLockVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG LockSize,
+ IN ULONG LockType);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwUnlockVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG LockSize,
+ IN ULONG LockType);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReadVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress,
+ OUT PVOID Buffer,
+ IN ULONG BufferLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwWriteVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress,
+ IN PVOID Buffer,
+ IN ULONG BufferLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwProtectVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG ProtectSize,
+ IN ULONG NewProtect,
+ OUT PULONG OldProtect);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwFlushVirtualMemory(
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG FlushSize,
+ OUT PIO_STATUS_BLOCK IoStatusBlock);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAllocateUserPhysicalPages(
+ IN HANDLE ProcessHandle,
+ IN PULONG NumberOfPages,
+ OUT PULONG PageFrameNumbers);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwFreeUserPhysicalPages(
+ IN HANDLE ProcessHandle,
+ IN OUT PULONG NumberOfPages,
+ IN PULONG PageFrameNumbers);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwMapUserPhysicalPages(
+ IN PVOID BaseAddress,
+ IN PULONG NumberOfPages,
+ IN PULONG PageFrameNumbers);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwMapUserPhysicalPagesScatter(
+ IN PVOID *BaseAddresses,
+ IN PULONG NumberOfPages,
+ IN PULONG PageFrameNumbers);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwGetWriteWatch(
+ IN HANDLE ProcessHandle,
+ IN ULONG Flags,
+ IN PVOID BaseAddress,
+ IN ULONG RegionSize,
+ OUT PULONG Buffer,
+ IN OUT PULONG BufferEntries,
+ OUT PULONG Granularity);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwResetWriteWatch(
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress,
+ IN ULONG RegionSize);
+
+
+
+
+/* Sections */
+
+typedef enum _SECTION_INFORMATION_CLASS {
+ SectionBasicInformation,
+ SectionImageInformation
+} SECTION_INFORMATION_CLASS;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtCreateSection(
+ OUT PHANDLE SectionHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PLARGE_INTEGER SectionSize OPTIONAL,
+ IN ULONG Protect,
+ IN ULONG Attributes,
+ IN HANDLE FileHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateSection(
+ OUT PHANDLE SectionHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PLARGE_INTEGER SectionSize OPTIONAL,
+ IN ULONG Protect,
+ IN ULONG Attributes,
+ IN HANDLE FileHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQuerySection(
+ IN HANDLE SectionHandle,
+ IN SECTION_INFORMATION_CLASS SectionInformationClass,
+ OUT PVOID SectionInformation,
+ IN ULONG SectionInformationLength,
+ OUT PULONG ResultLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwExtendSection(
+ IN HANDLE SectionHandle,
+ IN PLARGE_INTEGER SectionSize);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAreMappedFilesTheSame(
+ IN PVOID Address1,
+ IN PVOID Address2);
+
+
+
+
+/* Threads */
+
+typedef struct _USER_STACK {
+ PVOID FixedStackBase;
+ PVOID FixedStackLimit;
+ PVOID ExpandableStackBase;
+ PVOID ExpandableStackLimit;
+ PVOID ExpandableStackBottom;
+} USER_STACK, *PUSER_STACK;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateThread(
+ OUT PHANDLE ThreadHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN HANDLE ProcessHandle,
+ OUT PCLIENT_ID ClientId,
+ IN PCONTEXT ThreadContext,
+ IN PUSER_STACK UserStack,
+ IN BOOLEAN CreateSuspended);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtOpenThread(
+ OUT PHANDLE ThreadHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PCLIENT_ID ClientId);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwOpenThread(
+ OUT PHANDLE ThreadHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PCLIENT_ID ClientId);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwTerminateThread(
+ IN HANDLE ThreadHandle OPTIONAL,
+ IN NTSTATUS ExitStatus);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtQueryInformationThread(
+ IN HANDLE ThreadHandle,
+ IN THREADINFOCLASS ThreadInformationClass,
+ OUT PVOID ThreadInformation,
+ IN ULONG ThreadInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryInformationThread(
+ IN HANDLE ThreadHandle,
+ IN THREADINFOCLASS ThreadInformationClass,
+ OUT PVOID ThreadInformation,
+ IN ULONG ThreadInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtSetInformationThread(
+ IN HANDLE ThreadHandle,
+ IN THREADINFOCLASS ThreadInformationClass,
+ IN PVOID ThreadInformation,
+ IN ULONG ThreadInformationLength);
+
+typedef struct _THREAD_BASIC_INFORMATION {
+ NTSTATUS ExitStatus;
+ PNT_TIB TebBaseAddress;
+ CLIENT_ID ClientId;
+ KAFFINITY AffinityMask;
+ KPRIORITY Priority;
+ KPRIORITY BasePriority;
+} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
+
+typedef struct _KERNEL_USER_TIMES {
+ LARGE_INTEGER CreateTime;
+ LARGE_INTEGER ExitTime;
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+} KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSuspendThread(
+ IN HANDLE ThreadHandle,
+ OUT PULONG PreviousSuspendCount OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwResumeThread(
+ IN HANDLE ThreadHandle,
+ OUT PULONG PreviousSuspendCount OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwGetContextThread(
+ IN HANDLE ThreadHandle,
+ OUT PCONTEXT Context);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetContextThread(
+ IN HANDLE ThreadHandle,
+ IN PCONTEXT Context);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueueApcThread(
+ IN HANDLE ThreadHandle,
+ IN PKNORMAL_ROUTINE ApcRoutine,
+ IN PVOID ApcContext OPTIONAL,
+ IN PVOID Argument1 OPTIONAL,
+ IN PVOID Argument2 OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwTestAlert(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAlertThread(
+ IN HANDLE ThreadHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAlertResumeThread(
+ IN HANDLE ThreadHandle,
+ OUT PULONG PreviousSuspendCount OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwRegisterThreadTerminatePort(
+ IN HANDLE PortHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwImpersonateThread(
+ IN HANDLE ThreadHandle,
+ IN HANDLE TargetThreadHandle,
+ IN PSECURITY_QUALITY_OF_SERVICE SecurityQos);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwImpersonateAnonymousToken(
+ IN HANDLE ThreadHandle);
+
+
+
+
+/* Processes */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateProcess(
+ OUT PHANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN HANDLE InheritFromProcessHandle,
+ IN BOOLEAN InheritHandles,
+ IN HANDLE SectionHandle OPTIONAL,
+ IN HANDLE DebugPort OPTIONAL,
+ IN HANDLE ExceptionPort OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateProcess(
+ OUT PHANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN HANDLE InheritFromProcessHandle,
+ IN BOOLEAN InheritHandles,
+ IN HANDLE SectionHandle OPTIONAL,
+ IN HANDLE DebugPort OPTIONAL,
+ IN HANDLE ExceptionPort OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwTerminateProcess(
+ IN HANDLE ProcessHandle OPTIONAL,
+ IN NTSTATUS ExitStatus);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryInformationProcess(
+ IN HANDLE ProcessHandle,
+ IN PROCESSINFOCLASS ProcessInformationClass,
+ OUT PVOID ProcessInformation,
+ IN ULONG ProcessInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtSetInformationProcess(
+ IN HANDLE ProcessHandle,
+ IN PROCESSINFOCLASS ProcessInformationClass,
+ IN PVOID ProcessInformation,
+ IN ULONG ProcessInformationLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetInformationProcess(
+ IN HANDLE ProcessHandle,
+ IN PROCESSINFOCLASS ProcessInformationClass,
+ IN PVOID ProcessInformation,
+ IN ULONG ProcessInformationLength);
+
+typedef struct _PROCESS_BASIC_INFORMATION {
+ NTSTATUS ExitStatus;
+ PPEB PebBaseAddress;
+ KAFFINITY AffinityMask;
+ KPRIORITY BasePriority;
+ ULONG UniqueProcessId;
+ ULONG InheritedFromUniqueProcessId;
+} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
+
+typedef struct _PROCESS_ACCESS_TOKEN {
+ HANDLE Token;
+ HANDLE Thread;
+} PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN;
+
+/* DefaultHardErrorMode constants */
+#define SEM_FAILCRITICALERRORS 0x0001
+#define SEM_NOGPFAULTERRORBOX 0x0002
+#define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
+#define SEM_NOOPENFILEERRORBOX 0x8000
+
+typedef struct _POOLED_USAGE_AND_LIMITS {
+ ULONG PeakPagedPoolUsage;
+ ULONG PagedPoolUsage;
+ ULONG PagedPoolLimit;
+ ULONG PeakNonPagedPoolUsage;
+ ULONG NonPagedPoolUsage;
+ ULONG NonPagedPoolLimit;
+ ULONG PeakPagefileUsage;
+ ULONG PagefileUsage;
+ ULONG PagefileLimit;
+} POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS;
+
+typedef struct _PROCESS_WS_WATCH_INFORMATION {
+ PVOID FaultingPc;
+ PVOID FaultingVa;
+} PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION;
+
+/* PROCESS_PRIORITY_CLASS.PriorityClass constants */
+#define PC_IDLE 1
+#define PC_NORMAL 2
+#define PC_HIGH 3
+#define PC_REALTIME 4
+#define PC_BELOW_NORMAL 5
+#define PC_ABOVE_NORMAL 6
+
+typedef struct _PROCESS_PRIORITY_CLASS {
+ BOOLEAN Foreground;
+ UCHAR PriorityClass;
+} PROCESS_PRIORITY_CLASS, *PPROCESS_PRIORITY_CLASS;
+
+/* PROCESS_DEVICEMAP_INFORMATION.DriveType constants */
+#define DRIVE_UNKNOWN 0
+#define DRIVE_NO_ROOT_DIR 1
+#define DRIVE_REMOVABLE 2
+#define DRIVE_FIXED 3
+#define DRIVE_REMOTE 4
+#define DRIVE_CDROM 5
+#define DRIVE_RAMDISK 6
+
+typedef struct _PROCESS_DEVICEMAP_INFORMATION {
+ union {
+ struct {
+ HANDLE DirectoryHandle;
+ } Set;
+ struct {
+ ULONG DriveMap;
+ UCHAR DriveType[32];
+ } Query;
+ };
+} PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION;
+
+typedef struct _PROCESS_SESSION_INFORMATION {
+ ULONG SessionId;
+} PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
+
+typedef struct _RTL_USER_PROCESS_PARAMETERS {
+ ULONG AllocationSize;
+ ULONG Size;
+ ULONG Flags;
+ ULONG DebugFlags;
+ HANDLE hConsole;
+ ULONG ProcessGroup;
+ HANDLE hStdInput;
+ HANDLE hStdOutput;
+ HANDLE hStdError;
+ UNICODE_STRING CurrentDirectoryName;
+ HANDLE CurrentDirectoryHandle;
+ UNICODE_STRING DllPath;
+ UNICODE_STRING ImagePathName;
+ UNICODE_STRING CommandLine;
+ PWSTR Environment;
+ ULONG dwX;
+ ULONG dwY;
+ ULONG dwXSize;
+ ULONG dwYSize;
+ ULONG dwXCountChars;
+ ULONG dwYCountChars;
+ ULONG dwFillAttribute;
+ ULONG dwFlags;
+ ULONG wShowWindow;
+ UNICODE_STRING WindowTitle;
+ UNICODE_STRING DesktopInfo;
+ UNICODE_STRING ShellInfo;
+ UNICODE_STRING RuntimeInfo;
+} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
+
+NTSTATUS
+NTAPI
+RtlCreateProcessParameters(
+ OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
+ IN PUNICODE_STRING ImageFile,
+ IN PUNICODE_STRING DllPath OPTIONAL,
+ IN PUNICODE_STRING CurrentDirectory OPTIONAL,
+ IN PUNICODE_STRING CommandLine OPTIONAL,
+ IN PWSTR Environment OPTIONAL,
+ IN PUNICODE_STRING WindowTitle OPTIONAL,
+ IN PUNICODE_STRING DesktopInfo OPTIONAL,
+ IN PUNICODE_STRING ShellInfo OPTIONAL,
+ IN PUNICODE_STRING RuntimeInfo OPTIONAL);
+
+NTSTATUS
+NTAPI
+RtlDestroyProcessParameters(
+ IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
+
+typedef struct _DEBUG_BUFFER {
+ HANDLE SectionHandle;
+ PVOID SectionBase;
+ PVOID RemoteSectionBase;
+ ULONG SectionBaseDelta;
+ HANDLE EventPairHandle;
+ ULONG Unknown[2];
+ HANDLE RemoteThreadHandle;
+ ULONG InfoClassMask;
+ ULONG SizeOfInfo;
+ ULONG AllocatedSize;
+ ULONG SectionSize;
+ PVOID ModuleInformation;
+ PVOID BackTraceInformation;
+ PVOID HeapInformation;
+ PVOID LockInformation;
+ PVOID Reserved[8];
+} DEBUG_BUFFER, *PDEBUG_BUFFER;
+
+PDEBUG_BUFFER
+NTAPI
+RtlCreateQueryDebugBuffer(
+ IN ULONG Size,
+ IN BOOLEAN EventPair);
+
+/* RtlQueryProcessDebugInformation.DebugInfoClassMask constants */
+#define PDI_MODULES 0x01
+#define PDI_BACKTRACE 0x02
+#define PDI_HEAPS 0x04
+#define PDI_HEAP_TAGS 0x08
+#define PDI_HEAP_BLOCKS 0x10
+#define PDI_LOCKS 0x20
+
+NTSTATUS
+NTAPI
+RtlQueryProcessDebugInformation(
+ IN ULONG ProcessId,
+ IN ULONG DebugInfoClassMask,
+ IN OUT PDEBUG_BUFFER DebugBuffer);
+
+NTSTATUS
+NTAPI
+RtlDestroyQueryDebugBuffer(
+ IN PDEBUG_BUFFER DebugBuffer);
+
+/* DEBUG_MODULE_INFORMATION.Flags constants */
+#define LDRP_STATIC_LINK 0x00000002
+#define LDRP_IMAGE_DLL 0x00000004
+#define LDRP_LOAD_IN_PROGRESS 0x00001000
+#define LDRP_UNLOAD_IN_PROGRESS 0x00002000
+#define LDRP_ENTRY_PROCESSED 0x00004000
+#define LDRP_ENTRY_INSERTED 0x00008000
+#define LDRP_CURRENT_LOAD 0x00010000
+#define LDRP_FAILED_BUILTIN_LOAD 0x00020000
+#define LDRP_DONT_CALL_FOR_THREADS 0x00040000
+#define LDRP_PROCESS_ATTACH_CALLED 0x00080000
+#define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000
+#define LDRP_IMAGE_NOT_AT_BASE 0x00200000
+#define LDRP_WX86_IGNORE_MACHINETYPE 0x00400000
+
+typedef struct _DEBUG_MODULE_INFORMATION {
+ ULONG Reserved[2];
+ ULONG Base;
+ ULONG Size;
+ ULONG Flags;
+ USHORT Index;
+ USHORT Unknown;
+ USHORT LoadCount;
+ USHORT ModuleNameOffset;
+ CHAR ImageName[256];
+} DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
+
+typedef struct _DEBUG_HEAP_INFORMATION {
+ ULONG Base;
+ ULONG Flags;
+ USHORT Granularity;
+ USHORT Unknown;
+ ULONG Allocated;
+ ULONG Committed;
+ ULONG TagCount;
+ ULONG BlockCount;
+ ULONG Reserved[7];
+ PVOID Tags;
+ PVOID Blocks;
+} DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
+
+typedef struct _DEBUG_LOCK_INFORMATION {
+ PVOID Address;
+ USHORT Type;
+ USHORT CreatorBackTraceIndex;
+ ULONG OwnerThreadId;
+ ULONG ActiveCount;
+ ULONG ContentionCount;
+ ULONG EntryCount;
+ ULONG RecursionCount;
+ ULONG NumberOfSharedWaiters;
+ ULONG NumberOfExclusiveWaiters;
+} DEBUG_LOCK_INFORMATION, *PDEBUG_LOCK_INFORMATION;
+
+
+
+
+/* Jobs */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateJobObject(
+ OUT PHANDLE JobHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwOpenJobObject(
+ OUT PHANDLE JobHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwTerminateJobObject(
+ IN HANDLE JobHandle,
+ IN NTSTATUS ExitStatus);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAssignProcessToJobObject(
+ IN HANDLE JobHandle,
+ IN HANDLE ProcessHandle);
+
+typedef enum _JOBOBJECTINFOCLASS {
+ JobObjectBasicAccountingInformation = 1,
+ JobObjectBasicLimitInformation,
+ JobObjectBasicProcessIdList,
+ JobObjectBasicUIRestrictions,
+ JobObjectSecurityLimitInformation,
+ JobObjectEndOfJobTimeInformation,
+ JobObjectAssociateCompletionPortInformation,
+ JobObjectBasicAndIoAccountingInformation,
+ JobObjectExtendedLimitInformation
+} JOBOBJECTINFOCLASS;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryInformationJobObject(
+ IN HANDLE JobHandle,
+ IN JOBOBJECTINFOCLASS JobInformationClass,
+ OUT PVOID JobInformation,
+ IN ULONG JobInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetInformationJobObject(
+ IN HANDLE JobHandle,
+ IN JOBOBJECTINFOCLASS JobInformationClass,
+ IN PVOID JobInformation,
+ IN ULONG JobInformationLength);
+
+typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
+ LARGE_INTEGER TotalUserTime;
+ LARGE_INTEGER TotalKernelTime;
+ LARGE_INTEGER ThisPeriodTotalUserTime;
+ LARGE_INTEGER ThisPeriodTotalKernelTime;
+ ULONG TotalPageFaultCount;
+ ULONG TotalProcesses;
+ ULONG ActiveProcesses;
+ ULONG TotalTerminatedProcesses;
+} JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
+
+/* JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants */
+#define JOB_OBJECT_LIMIT_WORKINGSET 0x0001
+#define JOB_OBJECT_LIMIT_PROCESS_TIME 0x0002
+#define JOB_OBJECT_LIMIT_JOB_TIME 0x0004
+#define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x0008
+#define JOB_OBJECT_LIMIT_AFFINITY 0x0010
+#define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x0020
+#define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x0040
+#define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x0080
+#define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x0100
+#define JOB_OBJECT_LIMIT_JOB_MEMORY 0x0200
+#define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x0400
+#define JOB_OBJECT_BREAKAWAY_OK 0x0800
+#define JOB_OBJECT_SILENT_BREAKAWAY 0x1000
+
+typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION {
+ LARGE_INTEGER PerProcessUserTimeLimit;
+ LARGE_INTEGER PerJobUserTimeLimit;
+ ULONG LimitFlags;
+ ULONG MinimumWorkingSetSize;
+ ULONG MaximumWorkingSetSize;
+ ULONG ActiveProcessLimit;
+ ULONG Affinity;
+ ULONG PriorityClass;
+ ULONG SchedulingClass;
+} JOBOBJECT_BASIC_LIMIT_INFORMATION, *PJOBOBJECT_BASIC_LIMIT_INFORMATION;
+
+typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
+ ULONG NumberOfAssignedProcesses;
+ ULONG NumberOfProcessIdsInList;
+ ULONG_PTR ProcessIdList[1];
+} JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
+
+/* JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants */
+#define JOB_OBJECT_UILIMIT_HANDLES 0x0001
+#define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x0002
+#define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x0004
+#define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x0008
+#define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x0010
+#define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x0020
+#define JOB_OBJECT_UILIMIT_DESKTOP 0x0040
+#define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x0080
+
+typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS {
+ ULONG UIRestrictionsClass;
+} JOBOBJECT_BASIC_UI_RESTRICTIONS, *PJOBOBJECT_BASIC_UI_RESTRICTIONS;
+
+/* JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants */
+#define JOB_OBJECT_SECURITY_NO_ADMIN 0x0001
+#define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x0002
+#define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x0004
+#define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x0008
+
+typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
+ ULONG SecurityLimitFlags;
+ HANDLE JobToken;
+ PTOKEN_GROUPS SidsToDisable;
+ PTOKEN_PRIVILEGES PrivilegesToDelete;
+ PTOKEN_GROUPS RestrictedSids;
+} JOBOBJECT_SECURITY_LIMIT_INFORMATION, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
+
+/* JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants */
+#define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0
+#define JOB_OBJECT_POST_AT_END_OF_JOB 1
+
+typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
+ ULONG EndOfJobTimeAction;
+} JOBOBJECT_END_OF_JOB_TIME_INFORMATION, *PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
+
+#define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
+#define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
+#define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
+#define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
+#define JOB_OBJECT_MSG_NEW_PROCESS 6
+#define JOB_OBJECT_MSG_EXIT_PROCESS 7
+#define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
+#define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
+#define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
+
+typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
+ PVOID CompletionKey;
+ HANDLE CompletionPort;
+} JOBOBJECT_ASSOCIATE_COMPLETION_PORT, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
+
+typedef struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
+ JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
+ IO_COUNTERS IoInfo;
+} JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
+
+typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
+ JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
+ IO_COUNTERS IoInfo;
+ ULONG ProcessMemoryLimit;
+ ULONG JobMemoryLimit;
+ ULONG PeakProcessMemoryUsed;
+ ULONG PeakJobMemoryUsed;
+} JOBOBJECT_EXTENDED_LIMIT_INFORMATION, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
+
+
+
+
+/* Tokens */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateToken(
+OUT PHANDLE TokenHandle,
+IN ACCESS_MASK DesiredAccess,
+IN POBJECT_ATTRIBUTES ObjectAttributes,
+IN TOKEN_TYPE Type,
+IN PLUID AuthenticationId,
+IN PLARGE_INTEGER ExpirationTime,
+IN PTOKEN_USER User,
+IN PTOKEN_GROUPS Groups,
+IN PTOKEN_PRIVILEGES Privileges,
+IN PTOKEN_OWNER Owner,
+IN PTOKEN_PRIMARY_GROUP PrimaryGroup,
+IN PTOKEN_DEFAULT_DACL DefaultDacl,
+IN PTOKEN_SOURCE Source
+);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtOpenProcessToken(
+ IN HANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PHANDLE TokenHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwOpenProcessToken(
+ IN HANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PHANDLE TokenHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtOpenThreadToken(
+ IN HANDLE ThreadHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN BOOLEAN OpenAsSelf,
+ OUT PHANDLE TokenHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwOpenThreadToken(
+ IN HANDLE ThreadHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN BOOLEAN OpenAsSelf,
+ OUT PHANDLE TokenHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtDuplicateToken(
+ IN HANDLE ExistingTokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN BOOLEAN EffectiveOnly,
+ IN TOKEN_TYPE TokenType,
+ OUT PHANDLE NewTokenHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwDuplicateToken(
+ IN HANDLE ExistingTokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN BOOLEAN EffectiveOnly,
+ IN TOKEN_TYPE TokenType,
+ OUT PHANDLE NewTokenHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwFilterToken(
+ IN HANDLE ExistingTokenHandle,
+ IN ULONG Flags,
+ IN PTOKEN_GROUPS SidsToDisable,
+ IN PTOKEN_PRIVILEGES PrivilegesToDelete,
+ IN PTOKEN_GROUPS SidsToRestricted,
+ OUT PHANDLE NewTokenHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtAdjustPrivilegesToken(
+ IN HANDLE TokenHandle,
+ IN BOOLEAN DisableAllPrivileges,
+ IN PTOKEN_PRIVILEGES NewState,
+ IN ULONG BufferLength,
+ OUT PTOKEN_PRIVILEGES PreviousState OPTIONAL,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAdjustPrivilegesToken(
+ IN HANDLE TokenHandle,
+ IN BOOLEAN DisableAllPrivileges,
+ IN PTOKEN_PRIVILEGES NewState,
+ IN ULONG BufferLength,
+ OUT PTOKEN_PRIVILEGES PreviousState OPTIONAL,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAdjustGroupsToken(
+ IN HANDLE TokenHandle,
+ IN BOOLEAN ResetToDefault,
+ IN PTOKEN_GROUPS NewState,
+ IN ULONG BufferLength,
+ OUT PTOKEN_GROUPS PreviousState OPTIONAL,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtQueryInformationToken(
+ IN HANDLE TokenHandle,
+ IN TOKEN_INFORMATION_CLASS TokenInformationClass,
+ OUT PVOID TokenInformation,
+ IN ULONG TokenInformationLength,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryInformationToken(
+ IN HANDLE TokenHandle,
+ IN TOKEN_INFORMATION_CLASS TokenInformationClass,
+ OUT PVOID TokenInformation,
+ IN ULONG TokenInformationLength,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetInformationToken(
+ IN HANDLE TokenHandle,
+ IN TOKEN_INFORMATION_CLASS TokenInformationClass,
+ IN PVOID TokenInformation,
+ IN ULONG TokenInformationLength);
+
+
+
+
+/* Time */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQuerySystemTime(
+ OUT PLARGE_INTEGER CurrentTime);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetSystemTime(
+ IN PLARGE_INTEGER NewTime,
+ OUT PLARGE_INTEGER OldTime OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryPerformanceCounter(
+ OUT PLARGE_INTEGER PerformanceCount,
+ OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryPerformanceCounter(
+ OUT PLARGE_INTEGER PerformanceCount,
+ OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryTimerResolution(
+ OUT PULONG CoarsestResolution,
+ OUT PULONG FinestResolution,
+ OUT PULONG ActualResolution);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwDelayExecution(
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Interval);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwYieldExecution(
+ VOID);
+
+NTOSAPI
+ULONG
+NTAPI
+ZwGetTickCount(
+ VOID);
+
+
+
+
+/* Execution profiling */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateProfile(
+ OUT PHANDLE ProfileHandle,
+ IN HANDLE ProcessHandle,
+ IN PVOID Base,
+ IN ULONG Size,
+ IN ULONG BucketShift,
+ IN PULONG Buffer,
+ IN ULONG BufferLength,
+ IN KPROFILE_SOURCE Source,
+ IN ULONG ProcessorMask);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetIntervalProfile(
+ IN ULONG Interval,
+ IN KPROFILE_SOURCE Source);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryIntervalProfile(
+ IN KPROFILE_SOURCE Source,
+ OUT PULONG Interval);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwStartProfile(
+ IN HANDLE ProfileHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwStopProfile(
+ IN HANDLE ProfileHandle);
+
+
+
+
+/* Local Procedure Call (LPC) */
+
+typedef struct _LPC_MESSAGE {
+ USHORT DataSize;
+ USHORT MessageSize;
+ USHORT MessageType;
+ USHORT VirtualRangesOffset;
+ CLIENT_ID ClientId;
+ ULONG MessageId;
+ ULONG SectionSize;
+ UCHAR Data[ANYSIZE_ARRAY];
+} LPC_MESSAGE, *PLPC_MESSAGE;
+
+typedef enum _LPC_TYPE {
+ LPC_NEW_MESSAGE,
+ LPC_REQUEST,
+ LPC_REPLY,
+ LPC_DATAGRAM,
+ LPC_LOST_REPLY,
+ LPC_PORT_CLOSED,
+ LPC_CLIENT_DIED,
+ LPC_EXCEPTION,
+ LPC_DEBUG_EVENT,
+ LPC_ERROR_EVENT,
+ LPC_CONNECTION_REQUEST,
+ LPC_MAXIMUM
+} LPC_TYPE;
+
+typedef struct _LPC_SECTION_WRITE {
+ ULONG Length;
+ HANDLE SectionHandle;
+ ULONG SectionOffset;
+ ULONG ViewSize;
+ PVOID ViewBase;
+ PVOID TargetViewBase;
+} LPC_SECTION_WRITE, *PLPC_SECTION_WRITE;
+
+typedef struct _LPC_SECTION_READ {
+ ULONG Length;
+ ULONG ViewSize;
+ PVOID ViewBase;
+} LPC_SECTION_READ, *PLPC_SECTION_READ;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreatePort(
+ OUT PHANDLE PortHandle,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN ULONG MaxDataSize,
+ IN ULONG MaxMessageSize,
+ IN ULONG Reserved);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreateWaitablePort(
+ OUT PHANDLE PortHandle,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN ULONG MaxDataSize,
+ IN ULONG MaxMessageSize,
+ IN ULONG Reserved);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtConnectPort(
+ OUT PHANDLE PortHandle,
+ IN PUNICODE_STRING PortName,
+ IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
+ IN OUT PLPC_SECTION_WRITE WriteSection OPTIONAL,
+ IN OUT PLPC_SECTION_READ ReadSection OPTIONAL,
+ OUT PULONG MaxMessageSize OPTIONAL,
+ IN OUT PVOID ConnectData OPTIONAL,
+ IN OUT PULONG ConnectDataLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwConnectPort(
+ OUT PHANDLE PortHandle,
+ IN PUNICODE_STRING PortName,
+ IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
+ IN OUT PLPC_SECTION_WRITE WriteSection OPTIONAL,
+ IN OUT PLPC_SECTION_READ ReadSection OPTIONAL,
+ OUT PULONG MaxMessageSize OPTIONAL,
+ IN OUT PVOID ConnectData OPTIONAL,
+ IN OUT PULONG ConnectDataLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwConnectPort(
+ OUT PHANDLE PortHandle,
+ IN PUNICODE_STRING PortName,
+ IN PSECURITY_QUALITY_OF_SERVICE SecurityQos,
+ IN OUT PLPC_SECTION_WRITE WriteSection OPTIONAL,
+ IN OUT PLPC_SECTION_READ ReadSection OPTIONAL,
+ OUT PULONG MaxMessageSize OPTIONAL,
+ IN OUT PVOID ConnectData OPTIONAL,
+ IN OUT PULONG ConnectDataLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwListenPort(
+ IN HANDLE PortHandle,
+ OUT PLPC_MESSAGE Message);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAcceptConnectPort(
+ OUT PHANDLE PortHandle,
+ IN ULONG PortIdentifier,
+ IN PLPC_MESSAGE Message,
+ IN BOOLEAN Accept,
+ IN OUT PLPC_SECTION_WRITE WriteSection OPTIONAL,
+ IN OUT PLPC_SECTION_READ ReadSection OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCompleteConnectPort(
+ IN HANDLE PortHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtRequestPort(
+ IN HANDLE PortHandle,
+ IN PLPC_MESSAGE RequestMessage);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtRequestWaitReplyPort(
+ IN HANDLE PortHandle,
+ IN PLPC_MESSAGE RequestMessage,
+ OUT PLPC_MESSAGE ReplyMessage);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwRequestWaitReplyPort(
+ IN HANDLE PortHandle,
+ IN PLPC_MESSAGE RequestMessage,
+ OUT PLPC_MESSAGE ReplyMessage);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReplyPort(
+ IN HANDLE PortHandle,
+ IN PLPC_MESSAGE ReplyMessage);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReplyWaitReplyPort(
+ IN HANDLE PortHandle,
+ IN OUT PLPC_MESSAGE ReplyMessage);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReplyWaitReceivePort(
+ IN HANDLE PortHandle,
+ OUT PULONG PortIdentifier OPTIONAL,
+ IN PLPC_MESSAGE ReplyMessage OPTIONAL,
+ OUT PLPC_MESSAGE Message);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReplyWaitReceivePortEx(
+ IN HANDLE PortHandle,
+ OUT PULONG PortIdentifier OPTIONAL,
+ IN PLPC_MESSAGE ReplyMessage OPTIONAL,
+ OUT PLPC_MESSAGE Message,
+ IN PLARGE_INTEGER Timeout);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReadRequestData(
+ IN HANDLE PortHandle,
+ IN PLPC_MESSAGE Message,
+ IN ULONG Index,
+ OUT PVOID Buffer,
+ IN ULONG BufferLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwWriteRequestData(
+ IN HANDLE PortHandle,
+ IN PLPC_MESSAGE Message,
+ IN ULONG Index,
+ IN PVOID Buffer,
+ IN ULONG BufferLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+typedef enum _PORT_INFORMATION_CLASS {
+ PortBasicInformation
+} PORT_INFORMATION_CLASS;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryInformationPort(
+ IN HANDLE PortHandle,
+ IN PORT_INFORMATION_CLASS PortInformationClass,
+ OUT PVOID PortInformation,
+ IN ULONG PortInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwImpersonateClientOfPort(
+ IN HANDLE PortHandle,
+ IN PLPC_MESSAGE Message);
+
+
+
+
+/* Files */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtDeleteFile(
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwDeleteFile(
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwFlushBuffersFile(
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCancelIoFile(
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReadFileScatter(
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PFILE_SEGMENT_ELEMENT Buffer,
+ IN ULONG Length,
+ IN PLARGE_INTEGER ByteOffset OPTIONAL,
+ IN PULONG Key OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwWriteFileGather(
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PFILE_SEGMENT_ELEMENT Buffer,
+ IN ULONG Length,
+ IN PLARGE_INTEGER ByteOffset OPTIONAL,
+ IN PULONG Key OPTIONAL);
+
+
+
+
+/* Registry keys */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSaveKey(
+ IN HANDLE KeyHandle,
+ IN HANDLE FileHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSaveMergedKeys(
+ IN HANDLE KeyHandle1,
+ IN HANDLE KeyHandle2,
+ IN HANDLE FileHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwRestoreKey(
+ IN HANDLE KeyHandle,
+ IN HANDLE FileHandle,
+ IN ULONG Flags);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwLoadKey(
+ IN POBJECT_ATTRIBUTES KeyObjectAttributes,
+ IN POBJECT_ATTRIBUTES FileObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwLoadKey2(
+ IN POBJECT_ATTRIBUTES KeyObjectAttributes,
+ IN POBJECT_ATTRIBUTES FileObjectAttributes,
+ IN ULONG Flags);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwUnloadKey(
+ IN POBJECT_ATTRIBUTES KeyObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryOpenSubKeys(
+ IN POBJECT_ATTRIBUTES KeyObjectAttributes,
+ OUT PULONG NumberOfKeys);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwReplaceKey(
+ IN POBJECT_ATTRIBUTES NewFileObjectAttributes,
+ IN HANDLE KeyHandle,
+ IN POBJECT_ATTRIBUTES OldFileObjectAttributes);
+
+typedef enum _KEY_SET_INFORMATION_CLASS {
+ KeyLastWriteTimeInformation
+} KEY_SET_INFORMATION_CLASS;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetInformationKey(
+ IN HANDLE KeyHandle,
+ IN KEY_SET_INFORMATION_CLASS KeyInformationClass,
+ IN PVOID KeyInformation,
+ IN ULONG KeyInformationLength);
+
+typedef struct _KEY_LAST_WRITE_TIME_INFORMATION {
+ LARGE_INTEGER LastWriteTime;
+} KEY_LAST_WRITE_TIME_INFORMATION, *PKEY_LAST_WRITE_TIME_INFORMATION;
+
+typedef struct _KEY_NAME_INFORMATION {
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwNotifyChangeKey(
+ IN HANDLE KeyHandle,
+ IN HANDLE EventHandle OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG NotifyFilter,
+ IN BOOLEAN WatchSubtree,
+ IN PVOID Buffer,
+ IN ULONG BufferLength,
+ IN BOOLEAN Asynchronous);
+
+/* ZwNotifyChangeMultipleKeys.Flags constants */
+#define REG_MONITOR_SINGLE_KEY 0x00
+#define REG_MONITOR_SECOND_KEY 0x01
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwNotifyChangeMultipleKeys(
+ IN HANDLE KeyHandle,
+ IN ULONG Flags,
+ IN POBJECT_ATTRIBUTES KeyObjectAttributes,
+ IN HANDLE EventHandle OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG NotifyFilter,
+ IN BOOLEAN WatchSubtree,
+ IN PVOID Buffer,
+ IN ULONG BufferLength,
+ IN BOOLEAN Asynchronous);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryMultipleValueKey(
+ IN HANDLE KeyHandle,
+ IN OUT PKEY_VALUE_ENTRY ValueList,
+ IN ULONG NumberOfValues,
+ OUT PVOID Buffer,
+ IN OUT PULONG Length,
+ OUT PULONG ReturnLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwInitializeRegistry(
+ IN BOOLEAN Setup);
+
+
+
+
+/* Security and auditing */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwPrivilegeCheck(
+ IN HANDLE TokenHandle,
+ IN PPRIVILEGE_SET RequiredPrivileges,
+ OUT PBOOLEAN Result);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwPrivilegeObjectAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN HANDLE TokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN PPRIVILEGE_SET Privileges,
+ IN BOOLEAN AccessGranted);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwPrivilegeObjectAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN HANDLE TokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN PPRIVILEGE_SET Privileges,
+ IN BOOLEAN AccessGranted);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheck(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN HANDLE TokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN PPRIVILEGE_SET PrivilegeSet,
+ IN PULONG PrivilegeSetLength,
+ OUT PACCESS_MASK GrantedAccess,
+ OUT PBOOLEAN AccessStatus);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheckAndAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PUNICODE_STRING ObjectName,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN ACCESS_MASK DesiredAccess,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN BOOLEAN ObjectCreation,
+ OUT PACCESS_MASK GrantedAccess,
+ OUT PBOOLEAN AccessStatus,
+ OUT PBOOLEAN GenerateOnClose);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheckByType(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSID PrincipalSelfSid,
+ IN HANDLE TokenHandle,
+ IN ULONG DesiredAccess,
+ IN POBJECT_TYPE_LIST ObjectTypeList,
+ IN ULONG ObjectTypeListLength,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN PPRIVILEGE_SET PrivilegeSet,
+ IN PULONG PrivilegeSetLength,
+ OUT PACCESS_MASK GrantedAccess,
+ OUT PULONG AccessStatus);
+
+typedef enum _AUDIT_EVENT_TYPE {
+ AuditEventObjectAccess,
+ AuditEventDirectoryServiceAccess
+} AUDIT_EVENT_TYPE, *PAUDIT_EVENT_TYPE;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheckByTypeAndAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PUNICODE_STRING ObjectName,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSID PrincipalSelfSid,
+ IN ACCESS_MASK DesiredAccess,
+ IN AUDIT_EVENT_TYPE AuditType,
+ IN ULONG Flags,
+ IN POBJECT_TYPE_LIST ObjectTypeList,
+ IN ULONG ObjectTypeListLength,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN BOOLEAN ObjectCreation,
+ OUT PACCESS_MASK GrantedAccess,
+ OUT PULONG AccessStatus,
+ OUT PBOOLEAN GenerateOnClose);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheckByTypeResultList(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSID PrincipalSelfSid,
+ IN HANDLE TokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_TYPE_LIST ObjectTypeList,
+ IN ULONG ObjectTypeListLength,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN PPRIVILEGE_SET PrivilegeSet,
+ IN PULONG PrivilegeSetLength,
+ OUT PACCESS_MASK GrantedAccessList,
+ OUT PULONG AccessStatusList);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheckByTypeResultListAndAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PUNICODE_STRING ObjectName,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSID PrincipalSelfSid,
+ IN ACCESS_MASK DesiredAccess,
+ IN AUDIT_EVENT_TYPE AuditType,
+ IN ULONG Flags,
+ IN POBJECT_TYPE_LIST ObjectTypeList,
+ IN ULONG ObjectTypeListLength,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN BOOLEAN ObjectCreation,
+ OUT PACCESS_MASK GrantedAccessList,
+ OUT PULONG AccessStatusList,
+ OUT PULONG GenerateOnClose);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheckByTypeResultListAndAuditAlarmByHandle(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN HANDLE TokenHandle,
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PUNICODE_STRING ObjectName,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSID PrincipalSelfSid,
+ IN ACCESS_MASK DesiredAccess,
+ IN AUDIT_EVENT_TYPE AuditType,
+ IN ULONG Flags,
+ IN POBJECT_TYPE_LIST ObjectTypeList,
+ IN ULONG ObjectTypeListLength,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN BOOLEAN ObjectCreation,
+ OUT PACCESS_MASK GrantedAccessList,
+ OUT PULONG AccessStatusList,
+ OUT PULONG GenerateOnClose);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwOpenObjectAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID *HandleId,
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PUNICODE_STRING ObjectName,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN HANDLE TokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN ACCESS_MASK GrantedAccess,
+ IN PPRIVILEGE_SET Privileges OPTIONAL,
+ IN BOOLEAN ObjectCreation,
+ IN BOOLEAN AccessGranted,
+ OUT PBOOLEAN GenerateOnClose);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCloseObjectAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN BOOLEAN GenerateOnClose);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwDeleteObjectAuditAlarm(
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN BOOLEAN GenerateOnClose);
+
+
+
+
+/* Plug and play and power management */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwRequestWakeupLatency(
+ IN LATENCY_TIME Latency);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwRequestDeviceWakeup(
+ IN HANDLE DeviceHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCancelDeviceWakeupRequest(
+ IN HANDLE DeviceHandle);
+
+NTOSAPI
+BOOLEAN
+NTAPI
+ZwIsSystemResumeAutomatic(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetThreadExecutionState(
+ IN EXECUTION_STATE ExecutionState,
+ OUT PEXECUTION_STATE PreviousExecutionState);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwGetDevicePowerState(
+ IN HANDLE DeviceHandle,
+ OUT PDEVICE_POWER_STATE DevicePowerState);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetSystemPowerState(
+ IN POWER_ACTION SystemAction,
+ IN SYSTEM_POWER_STATE MinSystemState,
+ IN ULONG Flags);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwInitiatePowerAction(
+ IN POWER_ACTION SystemAction,
+ IN SYSTEM_POWER_STATE MinSystemState,
+ IN ULONG Flags,
+ IN BOOLEAN Asynchronous);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwPowerInformation(
+ IN POWER_INFORMATION_LEVEL PowerInformationLevel,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwPlugPlayControl(
+ IN ULONG ControlCode,
+ IN OUT PVOID Buffer,
+ IN ULONG BufferLength);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwGetPlugPlayEvent(
+ IN ULONG Reserved1,
+ IN ULONG Reserved2,
+ OUT PVOID Buffer,
+ IN ULONG BufferLength);
+
+
+
+
+/* Miscellany */
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwRaiseException(
+ IN PEXCEPTION_RECORD ExceptionRecord,
+ IN PCONTEXT Context,
+ IN BOOLEAN SearchFrames);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwContinue(
+ IN PCONTEXT Context,
+ IN BOOLEAN TestAlert);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwW32Call(
+ IN ULONG RoutineIndex,
+ IN PVOID Argument,
+ IN ULONG ArgumentLength,
+ OUT PVOID *Result OPTIONAL,
+ OUT PULONG ResultLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetLowWaitHighThread(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetHighWaitLowThread(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwLoadDriver(
+ IN PUNICODE_STRING DriverServiceName);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwUnloadDriver(
+ IN PUNICODE_STRING DriverServiceName);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwFlushInstructionCache(
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress OPTIONAL,
+ IN ULONG FlushSize);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwFlushWriteBuffer(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryDefaultLocale(
+ IN BOOLEAN ThreadOrSystem,
+ OUT PLCID Locale);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetDefaultLocale(
+ IN BOOLEAN ThreadOrSystem,
+ IN LCID Locale);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryDefaultUILanguage(
+ OUT PLANGID LanguageId);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetDefaultUILanguage(
+ IN LANGID LanguageId);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwQueryInstallUILanguage(
+ OUT PLANGID LanguageId);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtAllocateLocallyUniqueId(
+ OUT PLUID Luid);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtAllocateUuids(
+ OUT PLARGE_INTEGER UuidLastTimeAllocated,
+ OUT PULONG UuidDeltaTime,
+ OUT PULONG UuidSequenceNumber,
+ OUT PUCHAR UuidSeed);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetUuidSeed(
+ IN PUCHAR UuidSeed);
+
+typedef enum _HARDERROR_RESPONSE_OPTION {
+ OptionAbortRetryIgnore,
+ OptionOk,
+ OptionOkCancel,
+ OptionRetryCancel,
+ OptionYesNo,
+ OptionYesNoCancel,
+ OptionShutdownSystem
+} HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION;
+
+typedef enum _HARDERROR_RESPONSE {
+ ResponseReturnToCaller,
+ ResponseNotHandled,
+ ResponseAbort,
+ ResponseCancel,
+ ResponseIgnore,
+ ResponseNo,
+ ResponseOk,
+ ResponseRetry,
+ ResponseYes
+} HARDERROR_RESPONSE, *PHARDERROR_RESPONSE;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwRaiseHardError(
+ IN NTSTATUS Status,
+ IN ULONG NumberOfArguments,
+ IN ULONG StringArgumentsMask,
+ IN PULONG Arguments,
+ IN HARDERROR_RESPONSE_OPTION ResponseOption,
+ OUT PHARDERROR_RESPONSE Response);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetDefaultHardErrorPort(
+ IN HANDLE PortHandle);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwDisplayString(
+ IN PUNICODE_STRING String);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwCreatePagingFile(
+ IN PUNICODE_STRING FileName,
+ IN PULARGE_INTEGER InitialSize,
+ IN PULARGE_INTEGER MaximumSize,
+ IN ULONG Reserved);
+
+typedef USHORT RTL_ATOM, *PRTL_ATOM;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtAddAtom(
+ IN PWSTR AtomName,
+ IN ULONG AtomNameLength,
+ OUT PRTL_ATOM Atom);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtFindAtom(
+ IN PWSTR AtomName,
+ IN ULONG AtomNameLength,
+ OUT PRTL_ATOM Atom);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtDeleteAtom(
+ IN RTL_ATOM Atom);
+
+typedef enum _ATOM_INFORMATION_CLASS {
+ AtomBasicInformation,
+ AtomListInformation
+} ATOM_INFORMATION_CLASS;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtQueryInformationAtom(
+ IN RTL_ATOM Atom,
+ IN ATOM_INFORMATION_CLASS AtomInformationClass,
+ OUT PVOID AtomInformation,
+ IN ULONG AtomInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+typedef struct _ATOM_BASIC_INFORMATION {
+ USHORT ReferenceCount;
+ USHORT Pinned;
+ USHORT NameLength;
+ WCHAR Name[1];
+} ATOM_BASIC_INFORMATION, *PATOM_BASIC_INFORMATION;
+
+typedef struct _ATOM_LIST_INFORMATION {
+ ULONG NumberOfAtoms;
+ ATOM Atoms[1];
+} ATOM_LIST_INFORMATION, *PATOM_LIST_INFORMATION;
+
+NTOSAPI
+NTSTATUS
+NTAPI
+ZwSetLdtEntries(
+ IN ULONG Selector1,
+ IN LDT_ENTRY LdtEntry1,
+ IN ULONG Selector2,
+ IN LDT_ENTRY LdtEntry2);
+
+NTOSAPI
+NTSTATUS
+NTAPI
+NtVdmControl(
+ IN ULONG ControlCode,
+ IN PVOID ControlData);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTAPI_H */
--- /dev/null
+/*
+ * ntdd8042.h
+ *
+ * i8042 IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDD8042_H
+#define __NTDD8042_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddkbd.h"
+#include "ntddmou.h"
+
+
+#define IOCTL_INTERNAL_I8042_CONTROLLER_WRITE_BUFFER \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF2, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_I8042_HOOK_KEYBOARD \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF0, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_I8042_KEYBOARD_START_INFORMATION \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF3, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF1, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_I8042_HOOK_MOUSE \
+ CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF0, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_I8042_MOUSE_START_INFORMATION \
+ CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF3, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER \
+ CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF1, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define I8042_POWER_SYS_BUTTON 0x0001
+#define I8042_SLEEP_SYS_BUTTON 0x0002
+#define I8042_WAKE_SYS_BUTTON 0x0004
+#define I8042_SYS_BUTTONS (I8042_POWER_SYS_BUTTON | \
+ I8042_SLEEP_SYS_BUTTON | \
+ I8042_WAKE_SYS_BUTTON)
+
+typedef enum _TRANSMIT_STATE {
+ Idle = 0,
+ SendingBytes
+} TRANSMIT_STATE;
+
+typedef struct _OUTPUT_PACKET {
+ PUCHAR Bytes;
+ ULONG CurrentByte;
+ ULONG ByteCount;
+ TRANSMIT_STATE State;
+} OUTPUT_PACKET, *POUTPUT_PACKET;
+
+typedef enum _KEYBOARD_SCAN_STATE {
+ Normal,
+ GotE0,
+ GotE1
+} KEYBOARD_SCAN_STATE, *PKEYBOARD_SCAN_STATE;
+
+typedef enum _MOUSE_STATE {
+ MouseIdle,
+ XMovement,
+ YMovement,
+ ZMovement,
+ MouseExpectingACK,
+ MouseResetting
+} MOUSE_STATE, *PMOUSE_STATE;
+
+typedef enum _MOUSE_RESET_SUBSTATE {
+ ExpectingReset,
+ ExpectingResetId,
+ ExpectingGetDeviceIdACK,
+ ExpectingGetDeviceIdValue,
+ ExpectingSetResolutionDefaultACK,
+ ExpectingSetResolutionDefaultValueACK,
+ ExpectingSetResolutionACK,
+ ExpectingSetResolutionValueACK,
+ ExpectingSetScaling1to1ACK,
+ ExpectingSetScaling1to1ACK2,
+ ExpectingSetScaling1to1ACK3,
+ ExpectingReadMouseStatusACK,
+ ExpectingReadMouseStatusByte1,
+ ExpectingReadMouseStatusByte2,
+ ExpectingReadMouseStatusByte3,
+ StartPnPIdDetection,
+ ExpectingLoopSetSamplingRateACK,
+ ExpectingLoopSetSamplingRateValueACK,
+ ExpectingPnpIdByte1,
+ ExpectingPnpIdByte2,
+ ExpectingPnpIdByte3,
+ ExpectingPnpIdByte4,
+ ExpectingPnpIdByte5,
+ ExpectingPnpIdByte6,
+ ExpectingPnpIdByte7,
+ EnableWheel,
+ Enable5Buttons,
+ ExpectingGetDeviceId2ACK,
+ ExpectingGetDeviceId2Value,
+ ExpectingSetSamplingRateACK,
+ ExpectingSetSamplingRateValueACK,
+ ExpectingEnableACK,
+ ExpectingFinalResolutionACK,
+ ExpectingFinalResolutionValueACK,
+ ExpectingGetDeviceIdDetectACK,
+ ExpectingGetDeviceIdDetectValue,
+ CustomHookStateMinimum = 100,
+ CustomHookStateMaximum = 999,
+ I8042ReservedMinimum = 1000
+} MOUSE_RESET_SUBSTATE, *PMOUSE_RESET_SUBSTATE;
+
+typedef struct _INTERNAL_I8042_START_INFORMATION {
+ ULONG Size;
+ PKINTERRUPT InterruptObject;
+ ULONG Reserved[8];
+} INTERNAL_I8042_START_INFORMATION, *PINTERNAL_I8042_START_INFORMATION;
+
+typedef VOID DDKAPI
+(*PI8042_ISR_WRITE_PORT)(
+ IN PVOID Context,
+ IN UCHAR Value);
+
+typedef VOID DDKAPI
+(*PI8042_QUEUE_PACKET)(
+ IN PVOID Context);
+
+typedef NTSTATUS DDKAPI
+(*PI8042_SYNCH_READ_PORT) (
+ IN PVOID Context,
+ OUT PUCHAR Value,
+ IN BOOLEAN WaitForACK);
+
+typedef NTSTATUS DDKAPI
+(*PI8042_SYNCH_WRITE_PORT)(
+ IN PVOID Context,
+ IN UCHAR Value,
+ IN BOOLEAN WaitForACK);
+
+
+typedef NTSTATUS DDKAPI
+(*PI8042_KEYBOARD_INITIALIZATION_ROUTINE)(
+ IN PVOID InitializationContext,
+ IN PVOID SynchFuncContext,
+ IN PI8042_SYNCH_READ_PORT ReadPort,
+ IN PI8042_SYNCH_WRITE_PORT WritePort,
+ OUT PBOOLEAN TurnTranslationOn);
+
+typedef BOOLEAN DDKAPI
+(*PI8042_KEYBOARD_ISR)(
+ PVOID IsrContext,
+ PKEYBOARD_INPUT_DATA CurrentInput,
+ POUTPUT_PACKET CurrentOutput,
+ UCHAR StatusByte,
+ PUCHAR Byte,
+ PBOOLEAN ContinueProcessing,
+ PKEYBOARD_SCAN_STATE ScanState);
+
+typedef struct _INTERNAL_I8042_HOOK_KEYBOARD {
+ OUT PVOID Context;
+ OUT PI8042_KEYBOARD_INITIALIZATION_ROUTINE InitializationRoutine;
+ OUT PI8042_KEYBOARD_ISR IsrRoutine;
+ IN PI8042_ISR_WRITE_PORT IsrWritePort;
+ IN PI8042_QUEUE_PACKET QueueKeyboardPacket;
+ IN PVOID CallContext;
+} INTERNAL_I8042_HOOK_KEYBOARD, *PINTERNAL_I8042_HOOK_KEYBOARD;
+
+typedef BOOLEAN DDKAPI
+(*PI8042_MOUSE_ISR)(
+ PVOID IsrContext,
+ PMOUSE_INPUT_DATA CurrentInput,
+ POUTPUT_PACKET CurrentOutput,
+ UCHAR StatusByte,
+ PUCHAR Byte,
+ PBOOLEAN ContinueProcessing,
+ PMOUSE_STATE MouseState,
+ PMOUSE_RESET_SUBSTATE ResetSubState);
+
+typedef struct _INTERNAL_I8042_HOOK_MOUSE {
+ OUT PVOID Context;
+ OUT PI8042_MOUSE_ISR IsrRoutine;
+ IN PI8042_ISR_WRITE_PORT IsrWritePort;
+ IN PI8042_QUEUE_PACKET QueueMousePacket;
+ IN PVOID CallContext;
+} INTERNAL_I8042_HOOK_MOUSE, *PINTERNAL_I8042_HOOK_MOUSE;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDD8042_H */
--- /dev/null
+/*
+ * ntddbeep.h
+ *
+ * Beep device IOCTL interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDBEEP_H
+#define __NTDDBEEP_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define DD_BEEP_DEVICE_NAME "\\Device\\Beep"
+#define DD_BEEP_DEVICE_NAME_U L"\\Device\\Beep"
+
+#define IOCTL_BEEP_SET \
+ CTL_CODE(FILE_DEVICE_BEEP, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+typedef struct _BEEP_SET_PARAMETERS {
+ ULONG Frequency;
+ ULONG Duration;
+} BEEP_SET_PARAMETERS, *PBEEP_SET_PARAMETERS;
+
+#define BEEP_FREQUENCY_MINIMUM 0x25
+#define BEEP_FREQUENCY_MAXIMUM 0x7FFF
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDBEEP_H */
--- /dev/null
+/*
+ * ntddcdrm.h
+ *
+ * CDROM IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDCDRM_H
+#define __NTDDCDRM_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddstor.h"
+
+
+#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
+
+#define IOCTL_CDROM_CHECK_VERIFY \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_FIND_NEW_DEVICES \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_GET_CONTROL \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_GET_DRIVE_GEOMETRY \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_GET_LAST_SESSION \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_GET_VOLUME \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_PAUSE_AUDIO \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_PLAY_AUDIO_MSF \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_RAW_READ \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_READ_Q_CHANNEL \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_READ_TOC \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_READ_TOC_EX \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_RESUME_AUDIO \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_SEEK_AUDIO_MSF \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_SET_VOLUME \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_SIMBAD \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CDROM_STOP_AUDIO \
+ CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+
+#define MAXIMUM_NUMBER_TRACKS 100
+#define MAXIMUM_CDROM_SIZE 804
+#define MINIMUM_CDROM_READ_TOC_EX_SIZE 2
+
+typedef struct _TRACK_DATA {
+ UCHAR Reserved;
+ UCHAR Control : 4;
+ UCHAR Adr : 4;
+ UCHAR TrackNumber;
+ UCHAR Reserved1;
+ UCHAR Address[4];
+} TRACK_DATA, *PTRACK_DATA;
+
+/* CDROM_DISK_DATA.DiskData flags */
+#define CDROM_DISK_AUDIO_TRACK 0x00000001
+#define CDROM_DISK_DATA_TRACK 0x00000002
+
+typedef struct _CDROM_DISK_DATA {
+ ULONG DiskData;
+} CDROM_DISK_DATA, *PCDROM_DISK_DATA;
+
+typedef struct _CDROM_PLAY_AUDIO_MSF {
+ UCHAR StartingM;
+ UCHAR StartingS;
+ UCHAR StartingF;
+ UCHAR EndingM;
+ UCHAR EndingS;
+ UCHAR EndingF;
+} CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
+
+/* CDROM_READ_TOC_EX.Format constants */
+#define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
+#define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
+#define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
+#define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
+#define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
+#define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
+
+typedef struct _CDROM_READ_TOC_EX {
+ UCHAR Format : 4;
+ UCHAR Reserved1 : 3;
+ UCHAR Msf : 1;
+ UCHAR SessionTrack;
+ UCHAR Reserved2;
+ UCHAR Reserved3;
+} CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
+
+typedef struct _CDROM_SEEK_AUDIO_MSF {
+ UCHAR M;
+ UCHAR S;
+ UCHAR F;
+} CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
+
+/* CDROM_SUB_Q_DATA_FORMAT.Format constants */
+#define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
+#define IOCTL_CDROM_CURRENT_POSITION 0x01
+#define IOCTL_CDROM_MEDIA_CATALOG 0x02
+#define IOCTL_CDROM_TRACK_ISRC 0x03
+
+typedef struct _CDROM_SUB_Q_DATA_FORMAT {
+ UCHAR Format;
+ UCHAR Track;
+} CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
+
+typedef struct _CDROM_TOC {
+ UCHAR Length[2];
+ UCHAR FirstTrack;
+ UCHAR LastTrack;
+ TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
+} CDROM_TOC, *PCDROM_TOC;
+
+#define CDROM_TOC_SIZE sizeof(CDROM_TOC)
+
+typedef struct _CDROM_TOC_ATIP_DATA_BLOCK {
+ UCHAR CdrwReferenceSpeed : 3;
+ UCHAR Reserved3 : 1;
+ UCHAR WritePower : 3;
+ UCHAR True1 : 1;
+ UCHAR Reserved4 : 6;
+ UCHAR UnrestrictedUse : 1;
+ UCHAR Reserved5 : 1;
+ UCHAR A3Valid : 1;
+ UCHAR A2Valid : 1;
+ UCHAR A1Valid : 1;
+ UCHAR Reserved6 : 3;
+ UCHAR IsCdrw : 1;
+ UCHAR True2 : 1;
+ UCHAR Reserved7;
+ UCHAR LeadInMsf[3];
+ UCHAR Reserved8;
+ UCHAR LeadOutMsf[3];
+ UCHAR Reserved9;
+ UCHAR A1Values[3];
+ UCHAR Reserved10;
+ UCHAR A2Values[3];
+ UCHAR Reserved11;
+ UCHAR A3Values[3];
+ UCHAR Reserved12;
+} CDROM_TOC_ATIP_DATA_BLOCK, *PCDROM_TOC_ATIP_DATA_BLOCK;
+
+typedef struct _CDROM_TOC_ATIP_DATA {
+ UCHAR Length[2];
+ UCHAR Reserved1;
+ UCHAR Reserved2;
+ CDROM_TOC_ATIP_DATA_BLOCK Descriptors[0];
+} CDROM_TOC_ATIP_DATA, *PCDROM_TOC_ATIP_DATA;
+
+/* CDROM_TOC_CD_TEXT_DATA_BLOCK.PackType constants */
+#define CDROM_CD_TEXT_PACK_ALBUM_NAME 0x80
+#define CDROM_CD_TEXT_PACK_PERFORMER 0x81
+#define CDROM_CD_TEXT_PACK_SONGWRITER 0x82
+#define CDROM_CD_TEXT_PACK_COMPOSER 0x83
+#define CDROM_CD_TEXT_PACK_ARRANGER 0x84
+#define CDROM_CD_TEXT_PACK_MESSAGES 0x85
+#define CDROM_CD_TEXT_PACK_DISC_ID 0x86
+#define CDROM_CD_TEXT_PACK_GENRE 0x87
+#define CDROM_CD_TEXT_PACK_TOC_INFO 0x88
+#define CDROM_CD_TEXT_PACK_TOC_INFO2 0x89
+#define CDROM_CD_TEXT_PACK_UPC_EAN 0x8e
+#define CDROM_CD_TEXT_PACK_SIZE_INFO 0x8f
+
+typedef struct _CDROM_TOC_CD_TEXT_DATA_BLOCK {
+ UCHAR PackType;
+ UCHAR TrackNumber : 7;
+ UCHAR ExtensionFlag : 1;
+ UCHAR SequenceNumber;
+ UCHAR CharacterPosition : 4;
+ UCHAR BlockNumber : 3;
+ UCHAR Unicode : 1;
+ union {
+ UCHAR Text[12];
+ WCHAR WText[6];
+ };
+ UCHAR CRC[2];
+} CDROM_TOC_CD_TEXT_DATA_BLOCK, *PCDROM_TOC_CD_TEXT_DATA_BLOCK;
+
+typedef struct _CDROM_TOC_CD_TEXT_DATA {
+ UCHAR Length[2];
+ UCHAR Reserved1;
+ UCHAR Reserved2;
+ CDROM_TOC_CD_TEXT_DATA_BLOCK Descriptors[0];
+} CDROM_TOC_CD_TEXT_DATA, *PCDROM_TOC_CD_TEXT_DATA;
+
+/* CDROM_TOC_FULL_TOC_DATA_BLOCK.Adr constants */
+#define ADR_NO_MODE_INFORMATION 0x0
+#define ADR_ENCODES_CURRENT_POSITION 0x1
+#define ADR_ENCODES_MEDIA_CATALOG 0x2
+#define ADR_ENCODES_ISRC 0x3
+
+typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK {
+ UCHAR SessionNumber;
+ UCHAR Control : 4;
+ UCHAR Adr : 4;
+ UCHAR Reserved1;
+ UCHAR Point;
+ UCHAR MsfExtra[3];
+ UCHAR Zero;
+ UCHAR Msf[3];
+} CDROM_TOC_FULL_TOC_DATA_BLOCK, *PCDROM_TOC_FULL_TOC_DATA_BLOCK;
+
+typedef struct _CDROM_TOC_FULL_TOC_DATA {
+ UCHAR Length[2];
+ UCHAR FirstCompleteSession;
+ UCHAR LastCompleteSession;
+ CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
+} CDROM_TOC_FULL_TOC_DATA, *PCDROM_TOC_FULL_TOC_DATA;
+
+typedef struct _CDROM_TOC_PMA_DATA {
+ UCHAR Length[2];
+ UCHAR Reserved1;
+ UCHAR Reserved2;
+ CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
+} CDROM_TOC_PMA_DATA, *PCDROM_TOC_PMA_DATA;
+
+/* SUB_Q_HEADER.AudioStatus constants */
+#define AUDIO_STATUS_NOT_SUPPORTED 0x00
+#define AUDIO_STATUS_IN_PROGRESS 0x11
+#define AUDIO_STATUS_PAUSED 0x12
+#define AUDIO_STATUS_PLAY_COMPLETE 0x13
+#define AUDIO_STATUS_PLAY_ERROR 0x14
+#define AUDIO_STATUS_NO_STATUS 0x15
+
+typedef struct _SUB_Q_HEADER {
+ UCHAR Reserved;
+ UCHAR AudioStatus;
+ UCHAR DataLength[2];
+} SUB_Q_HEADER, *PSUB_Q_HEADER;
+
+typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
+ SUB_Q_HEADER Header;
+ UCHAR FormatCode;
+ UCHAR Reserved[3];
+ UCHAR Reserved1 : 7;
+ UCHAR Mcval :1;
+ UCHAR MediaCatalog[15];
+} SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
+
+typedef struct _SUB_Q_TRACK_ISRC {
+ SUB_Q_HEADER Header;
+ UCHAR FormatCode;
+ UCHAR Reserved0;
+ UCHAR Track;
+ UCHAR Reserved1;
+ UCHAR Reserved2 : 7;
+ UCHAR Tcval : 1;
+ UCHAR TrackIsrc[15];
+} SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
+
+typedef struct _SUB_Q_CURRENT_POSITION {
+ SUB_Q_HEADER Header;
+ UCHAR FormatCode;
+ UCHAR Control : 4;
+ UCHAR ADR : 4;
+ UCHAR TrackNumber;
+ UCHAR IndexNumber;
+ UCHAR AbsoluteAddress[4];
+ UCHAR TrackRelativeAddress[4];
+} SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
+
+typedef union _SUB_Q_CHANNEL_DATA {
+ SUB_Q_CURRENT_POSITION CurrentPosition;
+ SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
+ SUB_Q_TRACK_ISRC TrackIsrc;
+} SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
+
+/* CDROM_AUDIO_CONTROL.LbaFormat constants */
+#define AUDIO_WITH_PREEMPHASIS 0x1
+#define DIGITAL_COPY_PERMITTED 0x2
+#define AUDIO_DATA_TRACK 0x4
+#define TWO_FOUR_CHANNEL_AUDIO 0x8
+
+typedef struct _CDROM_AUDIO_CONTROL {
+ UCHAR LbaFormat;
+ USHORT LogicalBlocksPerSecond;
+} CDROM_AUDIO_CONTROL, *PCDROM_AUDIO_CONTROL;
+
+typedef struct _VOLUME_CONTROL {
+ UCHAR PortVolume[4];
+} VOLUME_CONTROL, *PVOLUME_CONTROL;
+
+typedef enum _TRACK_MODE_TYPE {
+ YellowMode2,
+ XAForm2,
+ CDDA
+} TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
+
+typedef struct __RAW_READ_INFO {
+ LARGE_INTEGER DiskOffset;
+ ULONG SectorCount;
+ TRACK_MODE_TYPE TrackMode;
+} RAW_READ_INFO, *PRAW_READ_INFO;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDCDRM_H */
--- /dev/null
+/*
+ * ntddcdvd.h
+ *
+ * DVD IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDCDVD_H
+#define __NTDDCDVD_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddstor.h"
+
+
+#define IOCTL_DVD_BASE FILE_DEVICE_DVD
+
+#define IOCTL_DVD_END_SESSION \
+ CTL_CODE(IOCTL_DVD_BASE, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DVD_GET_REGION \
+ CTL_CODE(IOCTL_DVD_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DVD_READ_KEY \
+ CTL_CODE(IOCTL_DVD_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DVD_READ_STRUCTURE \
+ CTL_CODE(IOCTL_DVD_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DVD_SEND_KEY \
+ CTL_CODE(IOCTL_DVD_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DVD_START_SESSION \
+ CTL_CODE(IOCTL_DVD_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DVD_SET_READ_AHEAD \
+ CTL_CODE(IOCTL_DVD_BASE, 0x0404, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+
+typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
+
+typedef struct _STORAGE_SET_READ_AHEAD {
+ LARGE_INTEGER TriggerAddress;
+ LARGE_INTEGER TargetAddress;
+} STORAGE_SET_READ_AHEAD, *PSTORAGE_SET_READ_AHEAD;
+
+typedef enum DVD_STRUCTURE_FORMAT {
+ DvdPhysicalDescriptor,
+ DvdCopyrightDescriptor,
+ DvdDiskKeyDescriptor,
+ DvdBCADescriptor,
+ DvdManufacturerDescriptor,
+ DvdMaxDescriptor
+} DVD_STRUCTURE_FORMAT, *PDVD_STRUCTURE_FORMAT;
+
+typedef struct DVD_READ_STRUCTURE {
+ LARGE_INTEGER BlockByteOffset;
+ DVD_STRUCTURE_FORMAT Format;
+ DVD_SESSION_ID SessionId;
+ UCHAR LayerNumber;
+} DVD_READ_STRUCTURE, *PDVD_READ_STRUCTURE;
+
+typedef struct _DVD_DESCRIPTOR_HEADER {
+ USHORT Length;
+ UCHAR Reserved[2];
+ UCHAR Data[0];
+} DVD_DESCRIPTOR_HEADER, *PDVD_DESCRIPTOR_HEADER;
+
+typedef struct _DVD_LAYER_DESCRIPTOR {
+ UCHAR BookVersion : 4;
+ UCHAR BookType : 4;
+ UCHAR MinimumRate : 4;
+ UCHAR DiskSize : 4;
+ UCHAR LayerType : 4;
+ UCHAR TrackPath : 1;
+ UCHAR NumberOfLayers : 2;
+ UCHAR Reserved1 : 1;
+ UCHAR TrackDensity : 4;
+ UCHAR LinearDensity : 4;
+ ULONG StartingDataSector;
+ ULONG EndDataSector;
+ ULONG EndLayerZeroSector;
+ UCHAR Reserved5 : 7;
+ UCHAR BCAFlag : 1;
+ UCHAR Reserved6;
+} DVD_LAYER_DESCRIPTOR, *PDVD_LAYER_DESCRIPTOR;
+
+typedef struct _DVD_COPYRIGHT_DESCRIPTOR {
+ UCHAR CopyrightProtectionType;
+ UCHAR RegionManagementInformation;
+ USHORT Reserved;
+} DVD_COPYRIGHT_DESCRIPTOR, *PDVD_COPYRIGHT_DESCRIPTOR;
+
+typedef struct _DVD_DISK_KEY_DESCRIPTOR {
+ UCHAR DiskKeyData[2048];
+} DVD_DISK_KEY_DESCRIPTOR, *PDVD_DISK_KEY_DESCRIPTOR;
+
+typedef enum _DVD_KEY_TYPE {
+ DvdChallengeKey = 0x01,
+ DvdBusKey1,
+ DvdBusKey2,
+ DvdTitleKey,
+ DvdAsf,
+ DvdSetRpcKey = 0x6,
+ DvdGetRpcKey = 0x8,
+ DvdDiskKey = 0x80,
+ DvdInvalidateAGID = 0x3f
+} DVD_KEY_TYPE;
+
+typedef struct _DVD_COPY_PROTECT_KEY {
+ ULONG KeyLength;
+ DVD_SESSION_ID SessionId;
+ DVD_KEY_TYPE KeyType;
+ ULONG KeyFlags;
+ union {
+ HANDLE FileHandle;
+ LARGE_INTEGER TitleOffset;
+ } Parameters;
+ UCHAR KeyData[0];
+} DVD_COPY_PROTECT_KEY, *PDVD_COPY_PROTECT_KEY;
+
+#define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
+#define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
+#define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
+#define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
+#define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
+#define DVD_SET_RPC_KEY_LENGTH (sizeof(DVD_SET_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
+#define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
+
+#define DVD_END_ALL_SESSIONS ((DVD_SESSION_ID) 0xffffffff)
+
+
+#define DVD_CGMS_RESERVED_MASK 0x00000078
+
+#define DVD_CGMS_COPY_PROTECT_MASK 0x00000018
+#define DVD_CGMS_COPY_PERMITTED 0x00000000
+#define DVD_CGMS_COPY_ONCE 0x00000010
+#define DVD_CGMS_NO_COPY 0x00000018
+
+#define DVD_COPYRIGHT_MASK 0x00000040
+#define DVD_NOT_COPYRIGHTED 0x00000000
+#define DVD_COPYRIGHTED 0x00000040
+
+#define DVD_SECTOR_PROTECT_MASK 0x00000020
+#define DVD_SECTOR_NOT_PROTECTED 0x00000000
+#define DVD_SECTOR_PROTECTED 0x00000020
+
+
+typedef struct _DVD_BCA_DESCRIPTOR {
+ UCHAR BCAInformation[0];
+} DVD_BCA_DESCRIPTOR, *PDVD_BCA_DESCRIPTOR;
+
+typedef struct _DVD_MANUFACTURER_DESCRIPTOR {
+ UCHAR ManufacturingInformation[2048];
+} DVD_MANUFACTURER_DESCRIPTOR, *PDVD_MANUFACTURER_DESCRIPTOR;
+
+typedef struct _DVD_RPC_KEY {
+ UCHAR UserResetsAvailable : 3;
+ UCHAR ManufacturerResetsAvailable : 3;
+ UCHAR TypeCode : 2;
+ UCHAR RegionMask;
+ UCHAR RpcScheme;
+ UCHAR Reserved2[1];
+} DVD_RPC_KEY, *PDVD_RPC_KEY;
+
+typedef struct _DVD_SET_RPC_KEY {
+ UCHAR PreferredDriveRegionCode;
+ UCHAR Reserved[3];
+} DVD_SET_RPC_KEY, *PDVD_SET_RPC_KEY;
+
+typedef struct _DVD_ASF {
+ UCHAR Reserved0[3];
+ UCHAR SuccessFlag : 1;
+ UCHAR Reserved1 : 7;
+} DVD_ASF, *PDVD_ASF;
+
+typedef struct _DVD_REGION {
+ UCHAR CopySystem;
+ UCHAR RegionData;
+ UCHAR SystemRegion;
+ UCHAR ResetCount;
+} DVD_REGION, *PDVD_REGION;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDCDVD_H */
--- /dev/null
+/*
+ * ntddchgr.h
+ *
+ * Media changer IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDCHGR_H
+#define __NTDDCHGR_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddstor.h"
+
+
+#define DD_CHANGER_DEVICE_NAME "\\Device\\Changer"
+#define DD_CHANGER_DEVICE_NAME_U L"\\Device\\Changer"
+
+#define IOCTL_CHANGER_BASE FILE_DEVICE_CHANGER
+
+#define IOCTL_CHANGER_EXCHANGE_MEDIUM \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CHANGER_GET_ELEMENT_STATUS \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_CHANGER_GET_PARAMETERS \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CHANGER_GET_PRODUCT_DATA \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CHANGER_GET_STATUS \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CHANGER_MOVE_MEDIUM \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0009, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CHANGER_QUERY_VOLUME_TAGS \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_CHANGER_REINITIALIZE_TRANSPORT \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_CHANGER_SET_ACCESS \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_CHANGER_SET_POSITION \
+ CTL_CODE(IOCTL_CHANGER_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+
+#define MAX_VOLUME_ID_SIZE 36
+#define MAX_VOLUME_TEMPLATE_SIZE 40
+
+typedef enum _ELEMENT_TYPE {
+ AllElements,
+ ChangerTransport,
+ ChangerSlot,
+ ChangerIEPort,
+ ChangerDrive,
+ ChangerDoor,
+ ChangerKeypad,
+ ChangerMaxElement
+} ELEMENT_TYPE, *PELEMENT_TYPE;
+
+typedef struct _CHANGER_ELEMENT {
+ ELEMENT_TYPE ElementType;
+ ULONG ElementAddress;
+} CHANGER_ELEMENT, *PCHANGER_ELEMENT;
+
+typedef struct _CHANGER_ELEMENT_LIST {
+ CHANGER_ELEMENT Element;
+ ULONG NumberOfElements;
+} CHANGER_ELEMENT_LIST, *PCHANGER_ELEMENT_LIST;
+
+typedef struct _CHANGER_INITIALIZE_ELEMENT_STATUS {
+ CHANGER_ELEMENT_LIST ElementList;
+ BOOLEAN BarCodeScan;
+} CHANGER_INITIALIZE_ELEMENT_STATUS, *PCHANGER_INITIALIZE_ELEMENT_STATUS;
+
+typedef struct _CHANGER_READ_ELEMENT_STATUS {
+ CHANGER_ELEMENT_LIST ElementList;
+ BOOLEAN VolumeTagInfo;
+} CHANGER_READ_ELEMENT_STATUS, *PCHANGER_READ_ELEMENT_STATUS;
+
+
+typedef struct _CHANGER_SET_POSITION {
+ CHANGER_ELEMENT Transport;
+ CHANGER_ELEMENT Destination;
+ BOOLEAN Flip;
+} CHANGER_SET_POSITION, *PCHANGER_SET_POSITION;
+
+typedef struct _CHANGER_EXCHANGE_MEDIUM {
+ CHANGER_ELEMENT Transport;
+ CHANGER_ELEMENT Source;
+ CHANGER_ELEMENT Destination1;
+ CHANGER_ELEMENT Destination2;
+ BOOLEAN Flip1;
+ BOOLEAN Flip2;
+} CHANGER_EXCHANGE_MEDIUM, *PCHANGER_EXCHANGE_MEDIUM;
+
+typedef struct _CHANGER_MOVE_MEDIUM {
+ CHANGER_ELEMENT Transport;
+ CHANGER_ELEMENT Source;
+ CHANGER_ELEMENT Destination;
+ BOOLEAN Flip;
+} CHANGER_MOVE_MEDIUM, *PCHANGER_MOVE_MEDIUM;
+
+#define VENDOR_ID_LENGTH 8
+#define PRODUCT_ID_LENGTH 16
+#define REVISION_LENGTH 4
+#define SERIAL_NUMBER_LENGTH 32
+
+typedef struct _CHANGER_PRODUCT_DATA {
+ UCHAR VendorId[VENDOR_ID_LENGTH];
+ UCHAR ProductId[PRODUCT_ID_LENGTH];
+ UCHAR Revision[REVISION_LENGTH];
+ UCHAR SerialNumber[SERIAL_NUMBER_LENGTH];
+ UCHAR DeviceType;
+} CHANGER_PRODUCT_DATA, *PCHANGER_PRODUCT_DATA;
+
+/* CHANGER_SET_ACCESS.Control constants */
+#define LOCK_ELEMENT 0
+#define UNLOCK_ELEMENT 1
+#define EXTEND_IEPORT 2
+#define RETRACT_IEPORT 3
+
+typedef struct _CHANGER_SET_ACCESS {
+ CHANGER_ELEMENT Element;
+ ULONG Control;
+} CHANGER_SET_ACCESS, *PCHANGER_SET_ACCESS;
+
+
+typedef enum _CHANGER_DEVICE_PROBLEM_TYPE {
+ DeviceProblemNone,
+ DeviceProblemHardware,
+ DeviceProblemCHMError,
+ DeviceProblemDoorOpen,
+ DeviceProblemCalibrationError,
+ DeviceProblemTargetFailure,
+ DeviceProblemCHMMoveError,
+ DeviceProblemCHMZeroError,
+ DeviceProblemCartridgeInsertError,
+ DeviceProblemPositionError,
+ DeviceProblemSensorError,
+ DeviceProblemCartridgeEjectError,
+ DeviceProblemGripperError,
+ DeviceProblemDriveError
+} CHANGER_DEVICE_PROBLEM_TYPE, *PCHANGER_DEVICE_PROBLEM_TYPE;
+
+/* CHANGER_ELEMENT_STATUS(_EX).Flags constants */
+#define ELEMENT_STATUS_FULL 0x00000001
+#define ELEMENT_STATUS_IMPEXP 0x00000002
+#define ELEMENT_STATUS_EXCEPT 0x00000004
+#define ELEMENT_STATUS_ACCESS 0x00000008
+#define ELEMENT_STATUS_EXENAB 0x00000010
+#define ELEMENT_STATUS_INENAB 0x00000020
+#define ELEMENT_STATUS_PRODUCT_DATA 0x00000040
+#define ELEMENT_STATUS_LUN_VALID 0x00001000
+#define ELEMENT_STATUS_ID_VALID 0x00002000
+#define ELEMENT_STATUS_NOT_BUS 0x00008000
+#define ELEMENT_STATUS_INVERT 0x00400000
+#define ELEMENT_STATUS_SVALID 0x00800000
+#define ELEMENT_STATUS_PVOLTAG 0x10000000
+#define ELEMENT_STATUS_AVOLTAG 0x20000000
+
+/* CHANGER_ELEMENT_STATUS(_EX).ExceptionCode constants */
+#define ERROR_LABEL_UNREADABLE 0x00000001
+#define ERROR_LABEL_QUESTIONABLE 0x00000002
+#define ERROR_SLOT_NOT_PRESENT 0x00000004
+#define ERROR_DRIVE_NOT_INSTALLED 0x00000008
+#define ERROR_TRAY_MALFUNCTION 0x00000010
+#define ERROR_INIT_STATUS_NEEDED 0x00000011
+#define ERROR_UNHANDLED_ERROR 0xFFFFFFFF
+
+typedef struct _CHANGER_ELEMENT_STATUS {
+ CHANGER_ELEMENT Element;
+ CHANGER_ELEMENT SrcElementAddress;
+ ULONG Flags;
+ ULONG ExceptionCode;
+ UCHAR TargetId;
+ UCHAR Lun;
+ USHORT Reserved;
+ UCHAR PrimaryVolumeID[MAX_VOLUME_ID_SIZE];
+ UCHAR AlternateVolumeID[MAX_VOLUME_ID_SIZE];
+} CHANGER_ELEMENT_STATUS, *PCHANGER_ELEMENT_STATUS;
+
+typedef struct _CHANGER_ELEMENT_STATUS_EX {
+ CHANGER_ELEMENT Element;
+ CHANGER_ELEMENT SrcElementAddress;
+ ULONG Flags;
+ ULONG ExceptionCode;
+ UCHAR TargetId;
+ UCHAR Lun;
+ USHORT Reserved;
+ UCHAR PrimaryVolumeID[MAX_VOLUME_ID_SIZE];
+ UCHAR AlternateVolumeID[MAX_VOLUME_ID_SIZE];
+ UCHAR VendorIdentification[VENDOR_ID_LENGTH];
+ UCHAR ProductIdentification[PRODUCT_ID_LENGTH];
+ UCHAR SerialNumber[SERIAL_NUMBER_LENGTH];
+} CHANGER_ELEMENT_STATUS_EX, *PCHANGER_ELEMENT_STATUS_EX;
+
+/* CHANGER_SEND_VOLUME_TAG_INFORMATION.ActionCode constants */
+#define SEARCH_ALL 0x0
+#define SEARCH_PRIMARY 0x1
+#define SEARCH_ALTERNATE 0x2
+#define SEARCH_ALL_NO_SEQ 0x4
+#define SEARCH_PRI_NO_SEQ 0x5
+#define SEARCH_ALT_NO_SEQ 0x6
+#define ASSERT_PRIMARY 0x8
+#define ASSERT_ALTERNATE 0x9
+#define REPLACE_PRIMARY 0xA
+#define REPLACE_ALTERNATE 0xB
+#define UNDEFINE_PRIMARY 0xC
+#define UNDEFINE_ALTERNATE 0xD
+
+typedef struct _CHANGER_SEND_VOLUME_TAG_INFORMATION {
+ CHANGER_ELEMENT StartingElement;
+ ULONG ActionCode;
+ UCHAR VolumeIDTemplate[MAX_VOLUME_TEMPLATE_SIZE];
+} CHANGER_SEND_VOLUME_TAG_INFORMATION, *PCHANGER_SEND_VOLUME_TAG_INFORMATION;
+
+/* GET_CHANGER_PARAMETERS.Features0 constants */
+#define CHANGER_BAR_CODE_SCANNER_INSTALLED 0x00000001
+#define CHANGER_INIT_ELEM_STAT_WITH_RANGE 0x00000002
+#define CHANGER_CLOSE_IEPORT 0x00000004
+#define CHANGER_OPEN_IEPORT 0x00000008
+#define CHANGER_STATUS_NON_VOLATILE 0x00000010
+#define CHANGER_EXCHANGE_MEDIA 0x00000020
+#define CHANGER_CLEANER_SLOT 0x00000040
+#define CHANGER_LOCK_UNLOCK 0x00000080
+#define CHANGER_CARTRIDGE_MAGAZINE 0x00000100
+#define CHANGER_MEDIUM_FLIP 0x00000200
+#define CHANGER_POSITION_TO_ELEMENT 0x00000400
+#define CHANGER_REPORT_IEPORT_STATE 0x00000800
+#define CHANGER_STORAGE_DRIVE 0x00001000
+#define CHANGER_STORAGE_IEPORT 0x00002000
+#define CHANGER_STORAGE_SLOT 0x00004000
+#define CHANGER_STORAGE_TRANSPORT 0x00008000
+#define CHANGER_DRIVE_CLEANING_REQUIRED 0x00010000
+#define CHANGER_PREDISMOUNT_EJECT_REQUIRED 0x00020000
+#define CHANGER_CLEANER_ACCESS_NOT_VALID 0x00040000
+#define CHANGER_PREMOUNT_EJECT_REQUIRED 0x00080000
+#define CHANGER_VOLUME_IDENTIFICATION 0x00100000
+#define CHANGER_VOLUME_SEARCH 0x00200000
+#define CHANGER_VOLUME_ASSERT 0x00400000
+#define CHANGER_VOLUME_REPLACE 0x00800000
+#define CHANGER_VOLUME_UNDEFINE 0x01000000
+#define CHANGER_SERIAL_NUMBER_VALID 0x04000000
+#define CHANGER_DEVICE_REINITIALIZE_CAPABLE 0x08000000
+#define CHANGER_KEYPAD_ENABLE_DISABLE 0x10000000
+#define CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS 0x20000000
+#define CHANGER_RESERVED_BIT 0x80000000
+
+/* GET_CHANGER_PARAMETERS.Features1 constants */
+#define CHANGER_PREDISMOUNT_ALIGN_TO_SLOT 0x80000001
+#define CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE 0x80000002
+#define CHANGER_CLEANER_AUTODISMOUNT 0x80000004
+#define CHANGER_TRUE_EXCHANGE_CAPABLE 0x80000008
+#define CHANGER_SLOTS_USE_TRAYS 0x80000010
+#define CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR 0x80000020
+#define CHANGER_CLEANER_OPS_NOT_SUPPORTED 0x80000040
+#define CHANGER_IEPORT_USER_CONTROL_OPEN 0x80000080
+#define CHANGER_IEPORT_USER_CONTROL_CLOSE 0x80000100
+#define CHANGER_MOVE_EXTENDS_IEPORT 0x80000200
+#define CHANGER_MOVE_RETRACTS_IEPORT 0x80000400
+
+/* GET_CHANGER_PARAMETERS.MoveFrom,ExchangeFrom,PositionCapabilities constants */
+#define CHANGER_TO_TRANSPORT 0x01
+#define CHANGER_TO_SLOT 0x02
+#define CHANGER_TO_IEPORT 0x04
+#define CHANGER_TO_DRIVE 0x08
+
+/* GET_CHANGER_PARAMETERS.LockUnlockCapabilities constants */
+#define LOCK_UNLOCK_IEPORT 0x01
+#define LOCK_UNLOCK_DOOR 0x02
+#define LOCK_UNLOCK_KEYPAD 0x04
+
+typedef struct _GET_CHANGER_PARAMETERS {
+ ULONG Size;
+ USHORT NumberTransportElements;
+ USHORT NumberStorageElements;
+ USHORT NumberCleanerSlots;
+ USHORT NumberIEElements;
+ USHORT NumberDataTransferElements;
+ USHORT NumberOfDoors;
+ USHORT FirstSlotNumber;
+ USHORT FirstDriveNumber;
+ USHORT FirstTransportNumber;
+ USHORT FirstIEPortNumber;
+ USHORT FirstCleanerSlotAddress;
+ USHORT MagazineSize;
+ ULONG DriveCleanTimeout;
+ ULONG Features0;
+ ULONG Features1;
+ UCHAR MoveFromTransport;
+ UCHAR MoveFromSlot;
+ UCHAR MoveFromIePort;
+ UCHAR MoveFromDrive;
+ UCHAR ExchangeFromTransport;
+ UCHAR ExchangeFromSlot;
+ UCHAR ExchangeFromIePort;
+ UCHAR ExchangeFromDrive;
+ UCHAR LockUnlockCapabilities;
+ UCHAR PositionCapabilities;
+ UCHAR Reserved1[2];
+ ULONG Reserved2[2];
+} GET_CHANGER_PARAMETERS, * PGET_CHANGER_PARAMETERS;
+
+typedef struct READ_ELEMENT_ADDRESS_INFO {
+ ULONG NumberOfElements;
+ CHANGER_ELEMENT_STATUS ElementStatus[1];
+} READ_ELEMENT_ADDRESS_INFO, *PREAD_ELEMENT_ADDRESS_INFO;
+
+typedef struct _TAPE_WMI_OPERATIONS {
+ ULONG Method;
+ ULONG DataBufferSize;
+ PVOID DataBuffer;
+} TAPE_WMI_OPERATIONS, *PTAPE_WMI_OPERATIONS;
+
+typedef struct _WMI_CHANGER_PROBLEM_DEVICE_ERROR {
+ ULONG ChangerProblemType;
+} WMI_CHANGER_PROBLEM_DEVICE_ERROR, *PWMI_CHANGER_PROBLEM_DEVICE_ERROR;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDCHGR_H */
--- /dev/null
+/*
+ * ntdddisk.h
+ *
+ * Disk IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDDISK_H
+#define __NTDDDISK_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddstor.h"
+
+
+#define DD_DISK_DEVICE_NAME "\\Device\\UNKNOWN"
+#define DD_DISK_DEVICE_NAME_U L"\\Device\\UNKNOWN"
+
+#define IOCTL_DISK_BASE FILE_DEVICE_DISK
+
+#define IOCTL_DISK_CHECK_VERIFY \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DISK_CONTROLLER_NUMBER \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0011, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_CREATE_DISK \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0016, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_DELETE_DRIVE_LAYOUT \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0040, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_FIND_NEW_DEVICES \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DISK_FORMAT_TRACKS \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_FORMAT_TRACKS_EX \
+ CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_GET_CACHE_INFORMATION \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0035, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DISK_GET_DRIVE_GEOMETRY \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0028, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_GET_DRIVE_LAYOUT \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0014, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_GET_MEDIA_TYPES \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_GET_LENGTH_INFO \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DISK_GET_PARTITION_INFO \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DISK_GET_PARTITION_INFO_EX \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0012, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_GROW_PARTITION \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0034, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_INTERNAL_CLEAR_VERIFY \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0101, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_INTERNAL_SET_VERIFY \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0100, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_IS_WRITABLE \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_PERFORMANCE \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_PERFORMANCE_OFF \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_DISK_REASSIGN_BLOCKS \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_RESERVE \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_DISK_SET_CACHE_INFORMATION \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0036, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_SET_DRIVE_LAYOUT \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_SET_DRIVE_LAYOUT_EX \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_SET_PARTITION_INFO \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_SET_PARTITION_INFO_EX \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_UPDATE_DRIVE_SIZE \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_DISK_VERIFY \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define SMART_GET_VERSION \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define SMART_RCV_DRIVE_DATA \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define SMART_SEND_DRIVE_COMMAND \
+ CTL_CODE(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+
+#define PARTITION_ENTRY_UNUSED 0x00
+#define PARTITION_FAT_12 0x01
+#define PARTITION_XENIX_1 0x02
+#define PARTITION_XENIX_2 0x03
+#define PARTITION_FAT_16 0x04
+#define PARTITION_EXTENDED 0x05
+#define PARTITION_HUGE 0x06
+#define PARTITION_IFS 0x07
+#define PARTITION_OS2BOOTMGR 0x0A
+#define PARTITION_FAT32 0x0B
+#define PARTITION_FAT32_XINT13 0x0C
+#define PARTITION_XINT13 0x0E
+#define PARTITION_XINT13_EXTENDED 0x0F
+#define PARTITION_PREP 0x41
+#define PARTITION_LDM 0x42
+#define PARTITION_UNIX 0x63
+#define VALID_NTFT 0xC0
+#define PARTITION_NTFT 0x80
+
+#define IsFTPartition( PartitionType ) \
+ (((PartitionType) & PARTITION_NTFT) && \
+ IsRecognizedPartition(PartitionType))
+
+#define IsContainerPartition(PartitionType) \
+ (((PartitionType) == PARTITION_EXTENDED) || \
+ ((PartitionType) == PARTITION_XINT13_EXTENDED))
+
+#define IsRecognizedPartition(PartitionType) ( \
+ (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT_12)) || \
+ (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_HUGE)) || \
+ (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_IFS)) || \
+ (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32)) || \
+ (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_FAT32_XINT13)) || \
+ (((PartitionType) & PARTITION_NTFT) && (((PartitionType) & ~0xC0) == PARTITION_XINT13)) || \
+ ((PartitionType) == PARTITION_FAT_12) || \
+ ((PartitionType) == PARTITION_FAT_16) || \
+ ((PartitionType) == PARTITION_HUGE) || \
+ ((PartitionType) == PARTITION_IFS) || \
+ ((PartitionType) == PARTITION_FAT32) || \
+ ((PartitionType) == PARTITION_FAT32_XINT13) || \
+ ((PartitionType) == PARTITION_XINT13))
+
+#define WMI_DISK_GEOMETRY_GUID \
+ {0x25007f51, 0x57c2, 0x11d1, {0xa5, 0x28, 0x0, 0xa0, 0xc9, 0x6, 0x29, 0x10}}
+
+typedef USHORT BAD_TRACK_NUMBER;
+typedef USHORT *PBAD_TRACK_NUMBER;
+
+typedef enum _MEDIA_TYPE {
+ Unknown,
+ F5_1Pt2_512,
+ F3_1Pt44_512,
+ F3_2Pt88_512,
+ F3_20Pt8_512,
+ F3_720_512,
+ F5_360_512,
+ F5_320_512,
+ F5_320_1024,
+ F5_180_512,
+ F5_160_512,
+ RemovableMedia,
+ FixedMedia,
+ F3_120M_512,
+ F3_640_512,
+ F5_640_512,
+ F5_720_512,
+ F3_1Pt2_512,
+ F3_1Pt23_1024,
+ F5_1Pt23_1024,
+ F3_128Mb_512,
+ F3_230Mb_512,
+ F8_256_128
+} MEDIA_TYPE, *PMEDIA_TYPE;
+
+typedef enum _DETECTION_TYPE {
+ DetectNone,
+ DetectInt13,
+ DetectExInt13
+} DETECTION_TYPE;
+
+typedef struct _DISK_CONTROLLER_NUMBER {
+ ULONG ControllerNumber;
+ ULONG DiskNumber;
+} DISK_CONTROLLER_NUMBER, *PDISK_CONTROLLER_NUMBER;
+
+typedef struct _DISK_INT13_INFO {
+ USHORT DriveSelect;
+ ULONG MaxCylinders;
+ USHORT SectorsPerTrack;
+ USHORT MaxHeads;
+ USHORT NumberDrives;
+} DISK_INT13_INFO, *PDISK_INT13_INFO;
+
+typedef struct _DISK_EX_INT13_INFO {
+ USHORT ExBufferSize;
+ USHORT ExFlags;
+ ULONG ExCylinders;
+ ULONG ExHeads;
+ ULONG ExSectorsPerTrack;
+ ULONG64 ExSectorsPerDrive;
+ USHORT ExSectorSize;
+ USHORT ExReserved;
+} DISK_EX_INT13_INFO, *PDISK_EX_INT13_INFO;
+
+typedef struct _DISK_DETECTION_INFO {
+ ULONG SizeOfDetectInfo;
+ DETECTION_TYPE DetectionType;
+ union {
+ struct {
+ DISK_INT13_INFO Int13;
+ DISK_EX_INT13_INFO ExInt13;
+ };
+ };
+} DISK_DETECTION_INFO, *PDISK_DETECTION_INFO;
+
+typedef struct _DISK_GEOMETRY {
+ LARGE_INTEGER Cylinders;
+ MEDIA_TYPE MediaType;
+ ULONG TracksPerCylinder;
+ ULONG SectorsPerTrack;
+ ULONG BytesPerSector;
+} DISK_GEOMETRY, *PDISK_GEOMETRY;
+
+typedef struct _DISK_GEOMETRY_EX {
+ DISK_GEOMETRY Geometry;
+ LARGE_INTEGER DiskSize;
+ UCHAR Data[1];
+} DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX;
+
+#define DiskGeometryGetPartition(Geometry) \
+ ((PDISK_PARTITION_INFO)((Geometry) + 1))
+
+#define DiskGeometryGetDetect(Geometry)\
+ ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \
+ DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
+
+typedef struct _PARTITION_INFORMATION {
+ LARGE_INTEGER StartingOffset;
+ LARGE_INTEGER PartitionLength;
+ DWORD HiddenSectors;
+ DWORD PartitionNumber;
+ BYTE PartitionType;
+ BOOLEAN BootIndicator;
+ BOOLEAN RecognizedPartition;
+ BOOLEAN RewritePartition;
+} PARTITION_INFORMATION, *PPARTITION_INFORMATION;
+
+typedef struct _PARTITION_INFORMATION_GPT {
+ GUID PartitionType;
+ GUID PartitionId;
+ ULONG64 Attributes;
+ WCHAR Name [36];
+} PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT;
+
+typedef struct _DISK_PARTITION_INFO {
+ ULONG SizeOfPartitionInfo;
+ PARTITION_STYLE PartitionStyle;
+ union {
+ struct {
+ ULONG Signature;
+ ULONG CheckSum;
+ } Mbr;
+ struct {
+ GUID DiskId;
+ } Gpt;
+ };
+} DISK_PARTITION_INFO, *PDISK_PARTITION_INFO;
+
+typedef struct _DISK_PERFORMANCE {
+ LARGE_INTEGER BytesRead;
+ LARGE_INTEGER BytesWritten;
+ LARGE_INTEGER ReadTime;
+ LARGE_INTEGER WriteTime;
+ LARGE_INTEGER IdleTime;
+ ULONG ReadCount;
+ ULONG WriteCount;
+ ULONG QueueDepth;
+ ULONG SplitCount;
+ LARGE_INTEGER QueryTime;
+ ULONG StorageDeviceNumber;
+ WCHAR StorageManagerName[8];
+} DISK_PERFORMANCE, *PDISK_PERFORMANCE;
+
+typedef struct _PARTITION_INFORMATION_EX {
+ PARTITION_STYLE PartitionStyle;
+ LARGE_INTEGER StartingOffset;
+ LARGE_INTEGER PartitionLength;
+ ULONG PartitionNumber;
+ BOOLEAN RewritePartition;
+ union {
+ PARTITION_INFORMATION_MBR Mbr;
+ PARTITION_INFORMATION_GPT Gpt;
+ };
+} PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX;
+
+typedef struct _FORMAT_EX_PARAMETERS {
+ MEDIA_TYPE MediaType;
+ ULONG StartCylinderNumber;
+ ULONG EndCylinderNumber;
+ ULONG StartHeadNumber;
+ ULONG EndHeadNumber;
+ USHORT FormatGapLength;
+ USHORT SectorsPerTrack;
+ USHORT SectorNumber[1];
+} FORMAT_EX_PARAMETERS, *PFORMAT_EX_PARAMETERS;
+
+typedef struct _FORMAT_PARAMETERS {
+ MEDIA_TYPE MediaType;
+ ULONG StartCylinderNumber;
+ ULONG EndCylinderNumber;
+ ULONG StartHeadNumber;
+ ULONG EndHeadNumber;
+} FORMAT_PARAMETERS, *PFORMAT_PARAMETERS;
+
+typedef struct _GET_LENGTH_INFORMATION {
+ LARGE_INTEGER Length;
+} GET_LENGTH_INFORMATION, *PGET_LENGTH_INFORMATION;
+
+typedef struct _REASSIGN_BLOCKS {
+ WORD Reserved;
+ WORD Count;
+ DWORD BlockNumber[1];
+} REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
+
+typedef struct _SET_PARTITION_INFORMATION {
+ UCHAR PartitionType;
+} SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
+
+typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR;
+typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT;
+
+typedef struct _SET_PARTITION_INFORMATION_EX {
+ PARTITION_STYLE PartitionStyle;
+ union {
+ SET_PARTITION_INFORMATION_MBR Mbr;
+ SET_PARTITION_INFORMATION_GPT Gpt;
+ };
+} SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX;
+
+typedef struct _VERIFY_INFORMATION {
+ LARGE_INTEGER StartingOffset;
+ DWORD Length;
+} VERIFY_INFORMATION, *PVERIFY_INFORMATION;
+
+typedef enum {
+ EqualPriority,
+ KeepPrefetchedData,
+ KeepReadData
+} DISK_CACHE_RETENTION_PRIORITY;
+
+typedef struct _DISK_CACHE_INFORMATION {
+ BOOLEAN ParametersSavable;
+ BOOLEAN ReadCacheEnabled;
+ BOOLEAN WriteCacheEnabled;
+ DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority;
+ DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority;
+ USHORT DisablePrefetchTransferLength;
+ BOOLEAN PrefetchScalar;
+ union {
+ struct {
+ USHORT Minimum;
+ USHORT Maximum;
+ USHORT MaximumBlocks;
+ } ScalarPrefetch;
+ struct {
+ USHORT Minimum;
+ USHORT Maximum;
+ } BlockPrefetch;
+ };
+} DISK_CACHE_INFORMATION, *PDISK_CACHE_INFORMATION;
+
+typedef struct _DISK_GROW_PARTITION {
+ ULONG PartitionNumber;
+ LARGE_INTEGER BytesToGrow;
+} DISK_GROW_PARTITION, *PDISK_GROW_PARTITION;
+
+/* GETVERSIONINPARAMS.fCapabilities constants */
+#define CAP_ATA_ID_CMD 1
+#define CAP_ATAPI_ID_CMD 2
+#define CAP_SMART_CMD 4
+
+typedef struct _GETVERSIONINPARAMS {
+ UCHAR bVersion;
+ UCHAR bRevision;
+ UCHAR bReserved;
+ UCHAR bIDEDeviceMap;
+ ULONG fCapabilities;
+ ULONG dwReserved[4];
+} GETVERSIONINPARAMS, *PGETVERSIONINPARAMS, *LPGETVERSIONINPARAMS;
+
+/* IDEREGS.bCommandReg constants */
+#define ATAPI_ID_CMD 0xA1
+#define ID_CMD 0xEC
+#define SMART_CMD 0xB0
+
+#define SMART_CYL_LOW 0x4F
+#define SMART_CYL_HI 0xC2
+
+typedef struct _IDEREGS {
+ UCHAR bFeaturesReg;
+ UCHAR bSectorCountReg;
+ UCHAR bSectorNumberReg;
+ UCHAR bCylLowReg;
+ UCHAR bCylHighReg;
+ UCHAR bDriveHeadReg;
+ UCHAR bCommandReg;
+ UCHAR bReserved;
+} IDEREGS, *PIDEREGS, *LPIDEREGS;
+
+typedef struct _SENDCMDINPARAMS {
+ ULONG cBufferSize;
+ IDEREGS irDriveRegs;
+ UCHAR bDriveNumber;
+ UCHAR bReserved[3];
+ ULONG dwReserved[4];
+ UCHAR bBuffer[1];
+} SENDCMDINPARAMS, *PSENDCMDINPARAMS, *LPSENDCMDINPARAMS;
+
+/* DRIVERSTATUS.bDriverError constants */
+#define SMART_NO_ERROR 0
+#define SMART_IDE_ERROR 1
+#define SMART_INVALID_FLAG 2
+#define SMART_INVALID_COMMAND 3
+#define SMART_INVALID_BUFFER 4
+#define SMART_INVALID_DRIVE 5
+#define SMART_INVALID_IOCTL 6
+#define SMART_ERROR_NO_MEM 7
+#define SMART_INVALID_REGISTER 8
+#define SMART_NOT_SUPPORTED 9
+#define SMART_NO_IDE_DEVICE 10
+
+#define SMART_OFFLINE_ROUTINE_OFFLINE 0
+#define SMART_SHORT_SELFTEST_OFFLINE 1
+#define SMART_EXTENDED_SELFTEST_OFFLINE 2
+#define SMART_ABORT_OFFLINE_SELFTEST 127
+#define SMART_SHORT_SELFTEST_CAPTIVE 129
+#define SMART_EXTENDED_SELFTEST_CAPTIVE 130
+
+typedef struct _DRIVERSTATUS {
+ UCHAR bDriverError;
+ UCHAR bIDEError;
+ UCHAR bReserved[2];
+ ULONG dwReserved[2];
+} DRIVERSTATUS, *PDRIVERSTATUS, *LPDRIVERSTATUS;
+
+#define READ_ATTRIBUTE_BUFFER_SIZE 512
+#define IDENTIFY_BUFFER_SIZE 512
+#define READ_THRESHOLD_BUFFER_SIZE 512
+#define SMART_LOG_SECTOR_SIZE 512
+
+typedef struct _SENDCMDOUTPARAMS {
+ ULONG cBufferSize;
+ DRIVERSTATUS DriverStatus;
+ UCHAR bBuffer[1];
+} SENDCMDOUTPARAMS, *PSENDCMDOUTPARAMS, *LPSENDCMDOUTPARAMS;
+
+#define READ_ATTRIBUTES 0xD0
+#define READ_THRESHOLDS 0xD1
+#define ENABLE_DISABLE_AUTOSAVE 0xD2
+#define SAVE_ATTRIBUTE_VALUES 0xD3
+#define EXECUTE_OFFLINE_DIAGS 0xD4
+#define SMART_READ_LOG 0xD5
+#define SMART_WRITE_LOG 0xd6
+#define ENABLE_SMART 0xD8
+#define DISABLE_SMART 0xD9
+#define RETURN_SMART_STATUS 0xDA
+#define ENABLE_DISABLE_AUTO_OFFLINE 0xDB
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDDISK_H */
--- /dev/null
+/*
+ * ntddk.h
+ *
+ * Windows Device Driver Kit
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * DEFINES:
+ * DBG - Debugging enabled/disabled (0/1)
+ * POOL_TAGGING - Enable pool tagging
+ * _X86_ - X86 environment
+ */
+
+#ifndef __NTDDK_H
+#define __NTDDK_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include <stdarg.h>
+#include <windef.h>
+#include <ntdef.h>
+#include <basetyps.h>
+
+/* Base types, structures and definitions */
+typedef short CSHORT;
+typedef CONST int CINT;
+typedef CONST char *PCSZ;
+
+#ifndef STATIC
+#define STATIC static
+#endif
+
+#ifndef CALLBACK
+#define CALLBACK
+#endif
+
+#ifndef DECL_IMPORT
+#define DECL_IMPORT __attribute__((dllimport))
+#endif
+
+#ifndef DECL_EXPORT
+#define DECL_EXPORT __attribute__((dllexport))
+#endif
+
+/* Windows NT status codes */
+#include "ntstatus.h"
+
+/* Windows NT definitions exported to user mode */
+#include "winnt.h"
+
+/* Windows Device Driver Kit */
+#include "winddk.h"
+
+/* Definitions only in Windows XP */
+#include "winxp.h"
+
+/* Definitions only in Windows 2000 */
+#include "win2k.h"
+
+/* Definitions only in Windows NT 4 */
+#include "winnt4.h"
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDK_H */
--- /dev/null
+/*
+ * ntddkbd.h
+ *
+ * Keyboard IOCTL interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDKBD_H
+#define __NTDDKBD_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define DD_KEYBOARD_DEVICE_NAME "\\Device\\KeyboardClass"
+#define DD_KEYBOARD_DEVICE_NAME_U L"\\Device\\KeyboardClass"
+
+#define IOCTL_KEYBOARD_QUERY_ATTRIBUTES \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_KEYBOARD_QUERY_INDICATORS \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_KEYBOARD_QUERY_TYPEMATIC \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_KEYBOARD_SET_TYPEMATIC \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0001, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_KEYBOARD_SET_INDICATORS \
+ CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0002, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+DEFINE_GUID(GUID_DEVINTERFACE_KEYBOARD, \
+ 0x884b96c3, 0x56ef, 0x11d1, 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd);
+
+#define KEYBOARD_ERROR_VALUE_BASE 10000
+
+/* KEYBOARD_INPUT_DATA.MakeCode constants */
+#define KEYBOARD_OVERRUN_MAKE_CODE 0xFF
+
+/* KEYBOARD_INPUT_DATA.Flags constants */
+#define KEY_MAKE 0
+#define KEY_BREAK 1
+#define KEY_E0 2
+#define KEY_E1 4
+
+typedef struct _KEYBOARD_INPUT_DATA {
+ USHORT UnitId;
+ USHORT MakeCode;
+ USHORT Flags;
+ USHORT Reserved;
+ ULONG ExtraInformation;
+} KEYBOARD_INPUT_DATA, *PKEYBOARD_INPUT_DATA;
+
+
+typedef struct _KEYBOARD_TYPEMATIC_PARAMETERS {
+ USHORT UnitId;
+ USHORT Rate;
+ USHORT Delay;
+} KEYBOARD_TYPEMATIC_PARAMETERS, *PKEYBOARD_TYPEMATIC_PARAMETERS;
+
+typedef struct _KEYBOARD_ID {
+ UCHAR Type;
+ UCHAR Subtype;
+} KEYBOARD_ID, *PKEYBOARD_ID;
+
+#define ENHANCED_KEYBOARD(Id) ((Id).Type == 2 || (Id).Type == 4 || FAREAST_KEYBOARD(Id))
+#define FAREAST_KEYBOARD(Id) ((Id).Type == 7 || (Id).Type == 8)
+
+typedef struct _KEYBOARD_INDICATOR_PARAMETERS {
+ USHORT UnitId;
+ USHORT LedFlags;
+} KEYBOARD_INDICATOR_PARAMETERS, *PKEYBOARD_INDICATOR_PARAMETERS;
+
+typedef struct _INDICATOR_LIST {
+ USHORT MakeCode;
+ USHORT IndicatorFlags;
+} INDICATOR_LIST, *PINDICATOR_LIST;
+
+typedef struct _KEYBOARD_INDICATOR_TRANSLATION {
+ USHORT NumberOfIndicatorKeys;
+ INDICATOR_LIST IndicatorList[1];
+} KEYBOARD_INDICATOR_TRANSLATION, *PKEYBOARD_INDICATOR_TRANSLATION;
+
+typedef struct _KEYBOARD_ATTRIBUTES {
+ KEYBOARD_ID KeyboardIdentifier;
+ USHORT KeyboardMode;
+ USHORT NumberOfFunctionKeys;
+ USHORT NumberOfIndicators;
+ USHORT NumberOfKeysTotal;
+ ULONG InputDataQueueLength;
+ KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum;
+ KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum;
+} KEYBOARD_ATTRIBUTES, *PKEYBOARD_ATTRIBUTES;
+
+typedef struct _KEYBOARD_UNIT_ID_PARAMETER {
+ USHORT UnitId;
+} KEYBOARD_UNIT_ID_PARAMETER, *PKEYBOARD_UNIT_ID_PARAMETER;
+
+typedef struct _KEYBOARD_IME_STATUS {
+ USHORT UnitId;
+ ULONG ImeOpen;
+ ULONG ImeConvMode;
+} KEYBOARD_IME_STATUS, *PKEYBOARD_IME_STATUS;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDKBD_H */
--- /dev/null
+/*
+ * ntddmou.h
+ *
+ * Mouse device IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDMOU_H
+#define __NTDDMOU_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define DD_MOUSE_DEVICE_NAME "\\Device\\PointerClass"
+#define DD_MOUSE_DEVICE_NAME_U L"\\Device\\PointerClass"
+
+#define IOCTL_MOUSE_QUERY_ATTRIBUTES \
+ CTL_CODE(FILE_DEVICE_MOUSE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+DEFINE_GUID(GUID_DEVINTERFACE_MOUSE, \
+ 0x378de44c, 0x56ef, 0x11d1, 0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd);
+
+#define MOUSE_ERROR_VALUE_BASE 20000
+
+/* MOUSE_INPUT_DATA.ButtonFlags constants */
+#define MOUSE_LEFT_BUTTON_DOWN 0x0001
+#define MOUSE_LEFT_BUTTON_UP 0x0002
+#define MOUSE_RIGHT_BUTTON_DOWN 0x0004
+#define MOUSE_RIGHT_BUTTON_UP 0x0008
+#define MOUSE_MIDDLE_BUTTON_DOWN 0x0010
+#define MOUSE_MIDDLE_BUTTON_UP 0x0020
+#define MOUSE_BUTTON_4_DOWN 0x0040
+#define MOUSE_BUTTON_4_UP 0x0080
+#define MOUSE_BUTTON_5_DOWN 0x0100
+#define MOUSE_BUTTON_5_UP 0x0200
+#define MOUSE_WHEEL 0x0400
+
+#define MOUSE_BUTTON_1_DOWN MOUSE_LEFT_BUTTON_DOWN
+#define MOUSE_BUTTON_1_UP MOUSE_LEFT_BUTTON_UP
+#define MOUSE_BUTTON_2_DOWN MOUSE_RIGHT_BUTTON_DOWN
+#define MOUSE_BUTTON_2_UP MOUSE_RIGHT_BUTTON_UP
+#define MOUSE_BUTTON_3_DOWN MOUSE_MIDDLE_BUTTON_DOWN
+#define MOUSE_BUTTON_3_UP MOUSE_MIDDLE_BUTTON_UP
+
+/* MOUSE_INPUT_DATA.Flags constants */
+#define MOUSE_MOVE_RELATIVE 0
+#define MOUSE_MOVE_ABSOLUTE 1
+#define MOUSE_VIRTUAL_DESKTOP 0x02
+#define MOUSE_ATTRIBUTES_CHANGED 0x04
+
+typedef struct _MOUSE_INPUT_DATA {
+ USHORT UnitId;
+ USHORT Flags;
+ union {
+ ULONG Buttons;
+ struct {
+ USHORT ButtonFlags;
+ USHORT ButtonData;
+ };
+ };
+ ULONG RawButtons;
+ LONG LastX;
+ LONG LastY;
+ ULONG ExtraInformation;
+} MOUSE_INPUT_DATA, *PMOUSE_INPUT_DATA;
+
+typedef struct _MOUSE_UNIT_ID_PARAMETER {
+ USHORT UnitId;
+} MOUSE_UNIT_ID_PARAMETER, *PMOUSE_UNIT_ID_PARAMETER;
+
+/* MOUSE_ATTRIBUTES.MouseIdentifier constants */
+#define MOUSE_INPORT_HARDWARE 0x0001
+#define MOUSE_I8042_HARDWARE 0x0002
+#define MOUSE_SERIAL_HARDWARE 0x0004
+#define BALLPOINT_I8042_HARDWARE 0x0008
+#define BALLPOINT_SERIAL_HARDWARE 0x0010
+#define WHEELMOUSE_I8042_HARDWARE 0x0020
+#define WHEELMOUSE_SERIAL_HARDWARE 0x0040
+#define MOUSE_HID_HARDWARE 0x0080
+#define WHEELMOUSE_HID_HARDWARE 0x0100
+
+typedef struct _MOUSE_ATTRIBUTES {
+ USHORT MouseIdentifier;
+ USHORT NumberOfButtons;
+ USHORT SampleRate;
+ ULONG InputDataQueueLength;
+} MOUSE_ATTRIBUTES, *PMOUSE_ATTRIBUTES;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDMOU_H */
--- /dev/null
+/*
+ * ntddndis.h
+ *
+ * NDIS device driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDNDIS_H
+#define __NTDDNDIS_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _NDIS_WAN_QUALITY {
+ NdisWanRaw,
+ NdisWanErrorControl,
+ NdisWanReliable
+} NDIS_WAN_QUALITY, *PNDIS_WAN_QUALITY;
+
+typedef enum _NDIS_DEVICE_POWER_STATE {
+ NdisDeviceStateUnspecified = 0,
+ NdisDeviceStateD0,
+ NdisDeviceStateD1,
+ NdisDeviceStateD2,
+ NdisDeviceStateD3,
+ NdisDeviceStateMaximum
+} NDIS_DEVICE_POWER_STATE, *PNDIS_DEVICE_POWER_STATE;
+
+typedef struct _NDIS_PM_WAKE_UP_CAPABILITIES {
+ NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp;
+ NDIS_DEVICE_POWER_STATE MinPatternWakeUp;
+ NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp;
+} NDIS_PM_WAKE_UP_CAPABILITIES, *PNDIS_PM_WAKE_UP_CAPABILITIES;
+
+/* NDIS_PNP_CAPABILITIES.Flags constants */
+#define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
+#define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
+#define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
+
+typedef struct _NDIS_PNP_CAPABILITIES {
+ ULONG Flags;
+ NDIS_PM_WAKE_UP_CAPABILITIES WakeUpCapabilities;
+} NDIS_PNP_CAPABILITIES, *PNDIS_PNP_CAPABILITIES;
+
+/* Required Object IDs (OIDs) */
+#define OID_GEN_SUPPORTED_LIST 0x00010101
+#define OID_GEN_HARDWARE_STATUS 0x00010102
+#define OID_GEN_MEDIA_SUPPORTED 0x00010103
+#define OID_GEN_MEDIA_IN_USE 0x00010104
+#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
+#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
+#define OID_GEN_LINK_SPEED 0x00010107
+#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
+#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
+#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
+#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
+#define OID_GEN_VENDOR_ID 0x0001010C
+#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
+#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
+#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
+#define OID_GEN_DRIVER_VERSION 0x00010110
+#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
+#define OID_GEN_PROTOCOL_OPTIONS 0x00010112
+#define OID_GEN_MAC_OPTIONS 0x00010113
+#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
+#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
+#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
+#define OID_GEN_SUPPORTED_GUIDS 0x00010117
+#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
+#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
+#define OID_GEN_MACHINE_NAME 0x0001021A
+#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
+#define OID_GEN_VLAN_ID 0x0001021C
+
+/* Optional OIDs */
+#define OID_GEN_MEDIA_CAPABILITIES 0x00010201
+#define OID_GEN_PHYSICAL_MEDIUM 0x00010202
+
+/* Required statistics OIDs */
+#define OID_GEN_XMIT_OK 0x00020101
+#define OID_GEN_RCV_OK 0x00020102
+#define OID_GEN_XMIT_ERROR 0x00020103
+#define OID_GEN_RCV_ERROR 0x00020104
+#define OID_GEN_RCV_NO_BUFFER 0x00020105
+
+/* Optional statistics OIDs */
+#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
+#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
+#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
+#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
+#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
+#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
+#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207
+#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
+#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209
+#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
+#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
+#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
+#define OID_GEN_RCV_CRC_ERROR 0x0002020D
+#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
+#define OID_GEN_GET_TIME_CAPS 0x0002020F
+#define OID_GEN_GET_NETCARD_TIME 0x00020210
+#define OID_GEN_NETCARD_LOAD 0x00020211
+#define OID_GEN_DEVICE_PROFILE 0x00020212
+#define OID_GEN_INIT_TIME_MS 0x00020213
+#define OID_GEN_RESET_COUNTS 0x00020214
+#define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
+#define OID_GEN_FRIENDLY_NAME 0x00020216
+#define OID_GEN_MINIPORT_INFO 0x00020217
+#define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
+
+/* IEEE 802.3 (Ethernet) OIDs */
+#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
+
+#define OID_802_3_PERMANENT_ADDRESS 0x01010101
+#define OID_802_3_CURRENT_ADDRESS 0x01010102
+#define OID_802_3_MULTICAST_LIST 0x01010103
+#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
+#define OID_802_3_MAC_OPTIONS 0x01010105
+#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
+#define OID_802_3_XMIT_ONE_COLLISION 0x01020102
+#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
+#define OID_802_3_XMIT_DEFERRED 0x01020201
+#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
+#define OID_802_3_RCV_OVERRUN 0x01020203
+#define OID_802_3_XMIT_UNDERRUN 0x01020204
+#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
+#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
+#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
+
+/* OID_GEN_MINIPORT_INFO constants */
+#define NDIS_MINIPORT_BUS_MASTER 0x00000001
+#define NDIS_MINIPORT_WDM_DRIVER 0x00000002
+#define NDIS_MINIPORT_SG_LIST 0x00000004
+#define NDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008
+#define NDIS_MINIPORT_INDICATES_PACKETS 0x00000010
+#define NDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020
+#define NDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040
+#define NDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080
+#define NDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100
+#define NDIS_MINIPORT_IS_NDIS_5 0x00000200
+#define NDIS_MINIPORT_IS_CO 0x00000400
+#define NDIS_MINIPORT_DESERIALIZE 0x00000800
+#define NDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000
+#define NDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000
+#define NDIS_MINIPORT_NETBOOT_CARD 0x00004000
+#define NDIS_MINIPORT_PM_SUPPORTED 0x00008000
+#define NDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000
+#define NDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000
+#define NDIS_MINIPORT_HIDDEN 0x00040000
+#define NDIS_MINIPORT_SWENUM 0x00080000
+#define NDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000
+#define NDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000
+#define NDIS_MINIPORT_HARDWARE_DEVICE 0x00400000
+#define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000
+#define NDIS_MINIPORT_64BITS_DMA 0x01000000
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDNDIS_H */
--- /dev/null
+/*
+ * ntddpar.h
+ *
+ * Parallel port driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDPAR_H
+#define __NTDDPAR_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+/* Parallel port device GUIDs */
+
+DEFINE_GUID (GUID_DEVINTERFACE_PARALLEL,
+ 0x97F76EF0, 0xF883, 0x11D0, 0xAF, 0x1F, 0x00, 0x00, 0xF8, 0x00, 0x84, 0x5C);
+DEFINE_GUID (GUID_DEVINTERFACE_PARCLASS,
+ 0x811FC6A5, 0xF728, 0x11D0, 0xA5, 0x37, 0x00, 0x00, 0xF8, 0x75, 0x3E, 0xD1);
+
+#define GUID_PARALLEL_DEVICE GUID_DEVINTERFACE_PARALLEL
+#define GUID_PARCLASS_DEVICE GUID_DEVINTERFACE_PARCLASS
+
+
+#define IOCTL_IEEE1284_GET_MODE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_IEEE1284_NEGOTIATE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_GET_DEFAULT_MODES \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_GET_DEVICE_CAPS \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_IS_PORT_FREE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_QUERY_DEVICE_ID \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_QUERY_DEVICE_ID_SIZE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_QUERY_INFORMATION \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_QUERY_LOCATION \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_QUERY_RAW_DEVICE_ID \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_SET_INFORMATION \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_SET_READ_ADDRESS \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_PAR_SET_WRITE_ADDRESS \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+typedef struct _PAR_DEVICE_ID_SIZE_INFORMATION {
+ ULONG DeviceIdSize;
+} PAR_DEVICE_ID_SIZE_INFORMATION, *PPAR_DEVICE_ID_SIZE_INFORMATION;
+
+#define PARALLEL_INIT 0x01
+#define PARALLEL_AUTOFEED 0x02
+#define PARALLEL_PAPER_EMPTY 0x04
+#define PARALLEL_OFF_LINE 0x08
+#define PARALLEL_POWER_OFF 0x10
+#define PARALLEL_NOT_CONNECTED 0x20
+#define PARALLEL_BUSY 0x40
+#define PARALLEL_SELECTED 0x80
+
+typedef struct _PAR_QUERY_INFORMATION {
+ UCHAR Status;
+} PAR_QUERY_INFORMATION, *PPAR_QUERY_INFORMATION;
+
+typedef struct _PAR_SET_INFORMATION {
+ UCHAR Init;
+} PAR_SET_INFORMATION, *PPAR_SET_INFORMATION;
+
+typedef struct _PARCLASS_NEGOTIATION_MASK {
+ USHORT usReadMask;
+ USHORT usWriteMask;
+} PARCLASS_NEGOTIATION_MASK, *PPARCLASS_NEGOTIATION_MASK;
+
+#define NONE 0x0000
+#define CENTRONICS 0x0001
+#define IEEE_COMPATIBILITY 0x0002
+#define NIBBLE 0x0004
+#define CHANNEL_NIBBLE 0x0008
+#define BYTE_BIDIR 0x0010
+#define EPP_HW 0x0020
+#define EPP_SW 0x0040
+#define EPP_ANY 0x0060
+#define BOUNDED_ECP 0x0080
+#define ECP_HW_NOIRQ 0x0100
+#define ECP_HW_IRQ 0x0200
+#define ECP_SW 0x0400
+#define ECP_ANY 0x0780
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDPAR_H */
--- /dev/null
+/*
+ * ntddpcm.h
+ *
+ * PCMCIA IOCTL interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDPCM_H
+#define __NTDDPCM_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define IOCTL_PCMCIA_BASE FILE_DEVICE_CONTROLLER
+
+#define DD_PCMCIA_DEVICE_NAME "\\\\.\\Pcmcia"
+#define DD_PCMCIA_DEVICE_NAME_U L"\\\\.\\Pcmcia"
+
+#define IOCTL_GET_TUPLE_DATA \
+ CTL_CODE(IOCTL_PCMCIA_BASE, 3000, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_SOCKET_INFORMATION \
+ CTL_CODE(IOCTL_PCMCIA_BASE, 3004, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define DEVICE_IDENTIFIER_LENGTH 64
+#define DRIVER_NAME_LENGTH 32
+#define MANUFACTURER_NAME_LENGTH 64
+
+#define PcmciaInvalidControllerType 0xffffffff
+
+typedef struct _TUPLE_REQUEST {
+ USHORT Socket;
+} TUPLE_REQUEST, *PTUPLE_REQUEST;
+
+typedef enum _PCMCIA_CONTROLLER_CLASS {
+ PcmciaInvalidControllerClass = -1,
+ PcmciaIntelCompatible,
+ PcmciaCardBusCompatible,
+ PcmciaElcController,
+ PcmciaDatabook,
+ PcmciaPciPcmciaBridge,
+ PcmciaCirrusLogic,
+ PcmciaTI,
+ PcmciaTopic,
+ PcmciaRicoh,
+ PcmciaDatabookCB,
+ PcmciaOpti,
+ PcmciaTrid,
+ PcmciaO2Micro,
+ PcmciaNEC,
+ PcmciaNEC_98
+} PCMCIA_CONTROLLER_CLASS, *PPCMCIA_CONTROLLER_CLASS;
+
+typedef struct _PCMCIA_SOCKET_INFORMATION {
+ USHORT Socket;
+ USHORT TupleCrc;
+ UCHAR Manufacturer[MANUFACTURER_NAME_LENGTH];
+ UCHAR Identifier[DEVICE_IDENTIFIER_LENGTH];
+ UCHAR DriverName[DRIVER_NAME_LENGTH];
+ UCHAR DeviceFunctionId;
+ UCHAR Reserved;
+ UCHAR CardInSocket;
+ UCHAR CardEnabled;
+ ULONG ControllerType;
+} PCMCIA_SOCKET_INFORMATION, *PPCMCIA_SOCKET_INFORMATION;
+
+#define PcmciaClassFromControllerType(type) ((PCMCIA_CONTROLLER_CLASS)((type) & 0xff))
+#define PcmciaModelFromControllerType(type) (((type) >> 8) & 0x3ffff)
+#define PcmciaRevisionFromControllerType(type) ((type) >> 26)
+
+
+DEFINE_GUID(GUID_PCMCIA_INTERFACE_STANDARD, \
+ 0xbed5dadfL, 0x38fb, 0x11d1, 0x94, 0x62, 0x00, 0xc0, 0x4f, 0xb9, 0x60, 0xee);
+
+typedef ULONG MEMORY_SPACE;
+
+typedef ULONG STDCALL
+(*PPCMCIA_READ_WRITE_CONFIG)(
+ IN PVOID Context,
+ IN ULONG WhichSpace,
+ IN PUCHAR Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+#define PCCARD_PCI_CONFIGURATION_SPACE 0
+#define PCCARD_ATTRIBUTE_MEMORY 1
+#define PCCARD_COMMON_MEMORY 2
+#define PCCARD_ATTRIBUTE_MEMORY_INDIRECT 3
+#define PCCARD_COMMON_MEMORY_INDIRECT 4
+
+typedef struct _PCMCIA_BUS_INTERFACE_STANDARD {
+ USHORT Size;
+ USHORT Version;
+ PVOID Context;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+ PPCMCIA_READ_WRITE_CONFIG ReadConfig;
+ PPCMCIA_READ_WRITE_CONFIG WriteConfig;
+} PCMCIA_BUS_INTERFACE_STANDARD, *PPCMCIA_BUS_INTERFACE_STANDARD;
+
+#define PCMCIA_MEMORY_8BIT_ACCESS 0
+#define PCMCIA_MEMORY_16BIT_ACCESS 1
+
+typedef BOOLEAN STDCALL
+(*PPCMCIA_MODIFY_MEMORY_WINDOW)(
+ IN PVOID Context,
+ IN ULONGLONG HostBase,
+ IN ULONGLONG CardBase,
+ IN BOOLEAN Enable,
+ IN ULONG WindowSize OPTIONAL,
+ IN UCHAR AccessSpeed OPTIONAL,
+ IN UCHAR BusWidth OPTIONAL,
+ IN BOOLEAN IsAttributeMemory OPTIONAL);
+
+#define PCMCIA_VPP_0V 0
+#define PCMCIA_VPP_12V 1
+#define PCMCIA_VPP_IS_VCC 2
+
+typedef BOOLEAN STDCALL
+(*PPCMCIA_SET_VPP)(
+ IN PVOID Context,
+ IN UCHAR VppLevel);
+
+typedef BOOLEAN STDCALL
+(*PPCMCIA_IS_WRITE_PROTECTED)(
+ IN PVOID Context);
+
+typedef struct _PCMCIA_INTERFACE_STANDARD {
+ USHORT Size;
+ USHORT Version;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+ PVOID Context;
+ PPCMCIA_MODIFY_MEMORY_WINDOW ModifyMemoryWindow;
+ PPCMCIA_SET_VPP SetVpp;
+ PPCMCIA_IS_WRITE_PROTECTED IsWriteProtected;
+} PCMCIA_INTERFACE_STANDARD, *PPCMCIA_INTERFACE_STANDARD;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDPCM_H */
--- /dev/null
+/*
+ * ntddscsi.h
+ *
+ * SCSI port IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDSCSI_H
+#define __NTDDSCSI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define DD_SCSI_DEVICE_NAME "\\Device\\ScsiPort"
+#define DD_SCSI_DEVICE_NAME_U L"\\Device\\ScsiPort"
+
+#define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER
+
+#define IOCTL_SCSI_GET_INQUIRY_DATA \
+ CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_SCSI_GET_CAPABILITIES \
+ CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_SCSI_GET_ADDRESS \
+ CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_SCSI_MINIPORT \
+ CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_SCSI_PASS_THROUGH \
+ CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_SCSI_PASS_THROUGH_DIRECT \
+ CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_SCSI_RESCAN_BUS \
+ CTL_CODE(IOCTL_SCSI_BASE, 0x0407, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+DEFINE_GUID(ScsiRawInterfaceGuid, \
+ 0x53f56309L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(WmiScsiAddressGuid, \
+ 0x53f5630fL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+typedef struct _SCSI_PASS_THROUGH {
+ USHORT Length;
+ UCHAR ScsiStatus;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR CdbLength;
+ UCHAR SenseInfoLength;
+ UCHAR DataIn;
+ ULONG DataTransferLength;
+ ULONG TimeOutValue;
+ ULONG_PTR DataBufferOffset;
+ ULONG SenseInfoOffset;
+ UCHAR Cdb[16];
+} SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
+
+typedef struct _SCSI_PASS_THROUGH_DIRECT {
+ USHORT Length;
+ UCHAR ScsiStatus;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR CdbLength;
+ UCHAR SenseInfoLength;
+ UCHAR DataIn;
+ ULONG DataTransferLength;
+ ULONG TimeOutValue;
+ PVOID DataBuffer;
+ ULONG SenseInfoOffset;
+ UCHAR Cdb[16];
+} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
+
+typedef struct _SRB_IO_CONTROL {
+ ULONG HeaderLength;
+ UCHAR Signature[8];
+ ULONG Timeout;
+ ULONG ControlCode;
+ ULONG ReturnCode;
+ ULONG Length;
+} SRB_IO_CONTROL, *PSRB_IO_CONTROL;
+
+typedef struct _SCSI_ADDRESS {
+ ULONG Length;
+ UCHAR PortNumber;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+} SCSI_ADDRESS, *PSCSI_ADDRESS;
+
+typedef struct _SCSI_BUS_DATA {
+ UCHAR NumberOfLogicalUnits;
+ UCHAR InitiatorBusId;
+ ULONG InquiryDataOffset;
+}SCSI_BUS_DATA, *PSCSI_BUS_DATA;
+
+typedef struct _SCSI_ADAPTER_BUS_INFO {
+ UCHAR NumberOfBuses;
+ SCSI_BUS_DATA BusData[1];
+} SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO;
+
+typedef struct _IO_SCSI_CAPABILITIES {
+ ULONG Length;
+ ULONG MaximumTransferLength;
+ ULONG MaximumPhysicalPages;
+ ULONG SupportedAsynchronousEvents;
+ ULONG AlignmentMask;
+ BOOLEAN TaggedQueuing;
+ BOOLEAN AdapterScansDown;
+ BOOLEAN AdapterUsesPio;
+} IO_SCSI_CAPABILITIES, *PIO_SCSI_CAPABILITIES;
+
+typedef struct _SCSI_INQUIRY_DATA {
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ BOOLEAN DeviceClaimed;
+ ULONG InquiryDataLength;
+ ULONG NextInquiryDataOffset;
+ UCHAR InquiryData[1];
+} SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
+
+#define SCSI_IOCTL_DATA_OUT 0
+#define SCSI_IOCTL_DATA_IN 1
+#define SCSI_IOCTL_DATA_UNSPECIFIED 2
+
+typedef struct _DUMP_POINTERS {
+ PADAPTER_OBJECT AdapterObject;
+ PVOID MappedRegisterBase;
+ PVOID DumpData;
+ PVOID CommonBufferVa;
+ LARGE_INTEGER CommonBufferPa;
+ ULONG CommonBufferSize;
+ BOOLEAN AllocateCommonBuffers;
+ BOOLEAN UseDiskDump;
+ UCHAR Spare1[2];
+ PVOID DeviceObject;
+} DUMP_POINTERS, *PDUMP_POINTERS;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDSCSI_H */
--- /dev/null
+/*
+ * ntddser.h
+ *
+ * Serial port driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDSER_H
+#define __NTDDSER_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+/* GUIDs */
+
+DEFINE_GUID(GUID_DEVINTERFACE_COMPORT,
+ 0x86e0d1e0L, 0x8089, 0x11d0, 0x9c, 0xe4, 0x08, 0x00, 0x3e, 0x30, 0x1f, 0x73);
+
+DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR,
+ 0x4D36E978L, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
+
+#define IOCTL_SERIAL_CLEAR_STATS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 36, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_CLR_DTR \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_CLR_RTS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_CONFIG_SIZE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 32, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_BAUD_RATE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_CHARS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_COMMSTATUS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 27, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_DTRRTS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_HANDFLOW \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_LINE_CONTROL \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_MODEM_CONTROL \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 37, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_MODEMSTATUS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_PROPERTIES \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_STATS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 35, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_TIMEOUTS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_GET_WAIT_MASK \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 16, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_IMMEDIATE_CHAR \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_LSRMST_INSERT \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_PURGE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_RESET_DEVICE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_BAUD_RATE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_BREAK_ON \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_BREAK_OFF \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_CHARS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_DTR \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_FIFO_CONTROL \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_HANDFLOW \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_LINE_CONTROL \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_MODEM_CONTROL \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 38, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_QUEUE_SIZE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_RTS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_TIMEOUTS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_WAIT_MASK \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 17, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_XOFF \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_SET_XON \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_WAIT_ON_MASK \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 18, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_XOFF_COUNTER \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 28, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_SERIAL_INTERNAL_BASIC_SETTINGS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_INTERNAL_CANCEL_WAIT_WAKE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_INTERNAL_DO_WAIT_WAKE \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERIAL_INTERNAL_RESTORE_SETTINGS \
+ CTL_CODE (FILE_DEVICE_SERIAL_PORT, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_SERENUM_PORT_DESC \
+ CTL_CODE (FILE_DEVICE_SERENUM, 130, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_SERENUM_GET_PORT_NAME \
+ CTL_CODE (FILE_DEVICE_SERENUM, 131, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_SERENUM_REMOVE_SELF \
+ CTL_CODE (FILE_DEVICE_SERENUM, 129, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+
+typedef struct _SERIAL_BAUD_RATE {
+ ULONG BaudRate;
+} SERIAL_BAUD_RATE, *PSERIAL_BAUD_RATE;
+
+/* SERIAL_BAUD_RATE.BaudRate constants */
+#define SERIAL_BAUD_075 0x00000001
+#define SERIAL_BAUD_110 0x00000002
+#define SERIAL_BAUD_134_5 0x00000004
+#define SERIAL_BAUD_150 0x00000008
+#define SERIAL_BAUD_300 0x00000010
+#define SERIAL_BAUD_600 0x00000020
+#define SERIAL_BAUD_1200 0x00000040
+#define SERIAL_BAUD_1800 0x00000080
+#define SERIAL_BAUD_2400 0x00000100
+#define SERIAL_BAUD_4800 0x00000200
+#define SERIAL_BAUD_7200 0x00000400
+#define SERIAL_BAUD_9600 0x00000800
+#define SERIAL_BAUD_14400 0x00001000
+#define SERIAL_BAUD_19200 0x00002000
+#define SERIAL_BAUD_38400 0x00004000
+#define SERIAL_BAUD_56K 0x00008000
+#define SERIAL_BAUD_128K 0x00010000
+#define SERIAL_BAUD_115200 0x00020000
+#define SERIAL_BAUD_57600 0x00040000
+#define SERIAL_BAUD_USER 0x10000000
+
+typedef struct _SERIAL_CHARS {
+ UCHAR EofChar;
+ UCHAR ErrorChar;
+ UCHAR BreakChar;
+ UCHAR EventChar;
+ UCHAR XonChar;
+ UCHAR XoffChar;
+} SERIAL_CHARS, *PSERIAL_CHARS;
+
+typedef struct _SERIAL_STATUS {
+ ULONG Errors;
+ ULONG HoldReasons;
+ ULONG AmountInInQueue;
+ ULONG AmountInOutQueue;
+ BOOLEAN EofReceived;
+ BOOLEAN WaitForImmediate;
+} SERIAL_STATUS, *PSERIAL_STATUS;
+
+typedef struct _SERIAL_HANDFLOW {
+ ULONG ControlHandShake;
+ ULONG FlowReplace;
+ LONG XonLimit;
+ LONG XoffLimit;
+} SERIAL_HANDFLOW, *PSERIAL_HANDFLOW;
+
+#define SERIAL_DTR_MASK 0x00000003
+#define SERIAL_DTR_CONTROL 0x00000001
+#define SERIAL_DTR_HANDSHAKE 0x00000002
+#define SERIAL_CTS_HANDSHAKE 0x00000008
+#define SERIAL_DSR_HANDSHAKE 0x00000010
+#define SERIAL_DCD_HANDSHAKE 0x00000020
+#define SERIAL_OUT_HANDSHAKEMASK 0x00000038
+#define SERIAL_DSR_SENSITIVITY 0x00000040
+#define SERIAL_ERROR_ABORT 0x80000000
+#define SERIAL_CONTROL_INVALID 0x7fffff84
+#define SERIAL_AUTO_TRANSMIT 0x00000001
+#define SERIAL_AUTO_RECEIVE 0x00000002
+#define SERIAL_ERROR_CHAR 0x00000004
+#define SERIAL_NULL_STRIPPING 0x00000008
+#define SERIAL_BREAK_CHAR 0x00000010
+#define SERIAL_RTS_MASK 0x000000c0
+#define SERIAL_RTS_CONTROL 0x00000040
+#define SERIAL_RTS_HANDSHAKE 0x00000080
+#define SERIAL_TRANSMIT_TOGGLE 0x000000c0
+#define SERIAL_XOFF_CONTINUE 0x80000000
+#define SERIAL_FLOW_INVALID 0x7fffff20
+
+typedef struct _SERIAL_LINE_CONTROL {
+ UCHAR StopBits;
+ UCHAR Parity;
+ UCHAR WordLength;
+} SERIAL_LINE_CONTROL, *PSERIAL_LINE_CONTROL;
+
+/* SERIAL_LINE_CONTROL.StopBits constants */
+#define STOP_BIT_1 0x00
+#define STOP_BITS_1_5 0x01
+#define STOP_BITS_2 0x02
+
+/* SERIAL_LINE_CONTROL.Parity constants */
+#define NO_PARITY 0x00
+#define ODD_PARITY 0x01
+#define EVEN_PARITY 0x02
+#define MARK_PARITY 0x03
+#define SPACE_PARITY 0x04
+
+/* IOCTL_SERIAL_(GET_MODEM_CONTROL, SET_MODEM_CONTROL) flags */
+#define SERIAL_IOC_MCR_DTR 0x00000001
+#define SERIAL_IOC_MCR_RTS 0x00000002
+#define SERIAL_IOC_MCR_OUT1 0x00000004
+#define SERIAL_IOC_MCR_OUT2 0x00000008
+#define SERIAL_IOC_MCR_LOOP 0x00000010
+
+typedef struct _SERIAL_COMMPROP {
+ USHORT PacketLength;
+ USHORT PacketVersion;
+ ULONG ServiceMask;
+ ULONG Reserved1;
+ ULONG MaxTxQueue;
+ ULONG MaxRxQueue;
+ ULONG MaxBaud;
+ ULONG ProvSubType;
+ ULONG ProvCapabilities;
+ ULONG SettableParams;
+ ULONG SettableBaud;
+ USHORT SettableData;
+ USHORT SettableStopParity;
+ ULONG CurrentTxQueue;
+ ULONG CurrentRxQueue;
+ ULONG ProvSpec1;
+ ULONG ProvSpec2;
+ WCHAR ProvChar[1];
+} SERIAL_COMMPROP, *PSERIAL_COMMPROP;
+
+/* SERIAL_COMMPROP.SettableParams flags */
+#define SERIAL_SP_PARITY 0x0001
+#define SERIAL_SP_BAUD 0x0002
+#define SERIAL_SP_DATABITS 0x0004
+#define SERIAL_SP_STOPBITS 0x0008
+#define SERIAL_SP_HANDSHAKING 0x0010
+#define SERIAL_SP_PARITY_CHECK 0x0020
+#define SERIAL_SP_CARRIER_DETECT 0x0040
+
+/* SERIAL_COMMPROP.ProvCapabilities flags */
+#define SERIAL_PCF_DTRDSR 0x00000001
+#define SERIAL_PCF_RTSCTS 0x00000002
+#define SERIAL_PCF_CD 0x00000004
+#define SERIAL_PCF_PARITY_CHECK 0x00000008
+#define SERIAL_PCF_XONXOFF 0x00000010
+#define SERIAL_PCF_SETXCHAR 0x00000020
+#define SERIAL_PCF_TOTALTIMEOUTS 0x00000040
+#define SERIAL_PCF_INTTIMEOUTS 0x00000080
+#define SERIAL_PCF_SPECIALCHARS 0x00000100
+#define SERIAL_PCF_16BITMODE 0x00000200
+
+/* SERIAL_COMMPROP.SettableData flags */
+#define SERIAL_DATABITS_5 0x0001
+#define SERIAL_DATABITS_6 0x0002
+#define SERIAL_DATABITS_7 0x0004
+#define SERIAL_DATABITS_8 0x0008
+#define SERIAL_DATABITS_16 0x0010
+#define SERIAL_DATABITS_16X 0x0020
+
+/* SERIAL_COMMPROP.SettableStopParity flags */
+#define SERIAL_STOPBITS_10 0x0001
+#define SERIAL_STOPBITS_15 0x0002
+#define SERIAL_STOPBITS_20 0x0004
+#define SERIAL_PARITY_NONE 0x0100
+#define SERIAL_PARITY_ODD 0x0200
+#define SERIAL_PARITY_EVEN 0x0400
+#define SERIAL_PARITY_MARK 0x0800
+#define SERIAL_PARITY_SPACE 0x1000
+
+typedef struct _SERIALPERF_STATS {
+ ULONG ReceivedCount;
+ ULONG TransmittedCount;
+ ULONG FrameErrorCount;
+ ULONG SerialOverrunErrorCount;
+ ULONG BufferOverrunErrorCount;
+ ULONG ParityErrorCount;
+} SERIALPERF_STATS, *PSERIALPERF_STATS;
+
+typedef struct _SERIAL_TIMEOUTS {
+ ULONG ReadIntervalTimeout;
+ ULONG ReadTotalTimeoutMultiplier;
+ ULONG ReadTotalTimeoutConstant;
+ ULONG WriteTotalTimeoutMultiplier;
+ ULONG WriteTotalTimeoutConstant;
+} SERIAL_TIMEOUTS, *PSERIAL_TIMEOUTS;
+
+/* IOCTL_SERIAL_(GET_WAIT_MASK, SET_WAIT_MASK, WAIT_ON_MASK) flags */
+#define SERIAL_EV_RXCHAR 0x0001
+#define SERIAL_EV_RXFLAG 0x0002
+#define SERIAL_EV_TXEMPTY 0x0004
+#define SERIAL_EV_CTS 0x0008
+#define SERIAL_EV_DSR 0x0010
+#define SERIAL_EV_RLSD 0x0020
+#define SERIAL_EV_BREAK 0x0040
+#define SERIAL_EV_ERR 0x0080
+#define SERIAL_EV_RING 0x0100
+#define SERIAL_EV_PERR 0x0200
+#define SERIAL_EV_RX80FULL 0x0400
+#define SERIAL_EV_EVENT1 0x0800
+#define SERIAL_EV_EVENT2 0x1000
+
+/* IOCTL_SERIAL_LSRMST_INSERT constants */
+#define SERIAL_LSRMST_LSR_DATA 0x01
+#define SERIAL_LSRMST_LSR_NODATA 0x02
+#define SERIAL_LSRMST_MST 0x03
+#define SERIAL_LSRMST_ESCAPE 0x00
+
+/* IOCTL_SERIAL_PURGE constants */
+#define SERIAL_PURGE_TXABORT 0x00000001
+#define SERIAL_PURGE_RXABORT 0x00000002
+#define SERIAL_PURGE_TXCLEAR 0x00000004
+#define SERIAL_PURGE_RXCLEAR 0x00000008
+
+/* IOCTL_SERIAL_SET_FIFO_CONTROL constants */
+#define SERIAL_IOC_FCR_FIFO_ENABLE 0x00000001
+#define SERIAL_IOC_FCR_RCVR_RESET 0x00000002
+#define SERIAL_IOC_FCR_XMIT_RESET 0x00000004
+#define SERIAL_IOC_FCR_DMA_MODE 0x00000008
+#define SERIAL_IOC_FCR_RES1 0x00000010
+#define SERIAL_IOC_FCR_RES2 0x00000020
+#define SERIAL_IOC_FCR_RCVR_TRIGGER_LSB 0x00000040
+#define SERIAL_IOC_FCR_RCVR_TRIGGER_MSB 0x00000080
+
+typedef struct _SERIAL_QUEUE_SIZE {
+ ULONG InSize;
+ ULONG OutSize;
+} SERIAL_QUEUE_SIZE, *PSERIAL_QUEUE_SIZE;
+
+typedef struct _SERIAL_XOFF_COUNTER {
+ ULONG Timeout;
+ LONG Counter;
+ UCHAR XoffChar;
+} SERIAL_XOFF_COUNTER, *PSERIAL_XOFF_COUNTER;
+
+typedef struct _SERIAL_BASIC_SETTINGS {
+ SERIAL_TIMEOUTS Timeouts;
+ SERIAL_HANDFLOW HandFlow;
+ ULONG RxFifo;
+ ULONG TxFifo;
+} SERIAL_BASIC_SETTINGS, *PSERIAL_BASIC_SETTINGS;
+
+typedef struct _SERENUM_PORT_DESC {
+ ULONG Size;
+ PVOID PortHandle;
+ PHYSICAL_ADDRESS PortAddress;
+ USHORT Reserved[1];
+} SERENUM_PORT_DESC, *PSERENUM_PORT_DESC;
+
+typedef UCHAR STDCALL
+(*PSERENUM_READPORT)(
+ PVOID SerPortAddress);
+
+typedef VOID STDCALL
+(*PSERENUM_WRITEPORT)(
+ PVOID SerPortAddress,
+ UCHAR Value);
+
+typedef enum _SERENUM_PORTION {
+ SerenumFirstHalf,
+ SerenumSecondHalf,
+ SerenumWhole
+} SERENUM_PORTION;
+
+typedef struct _SERENUM_PORT_PARAMETERS {
+ ULONG Size;
+ PSERENUM_READPORT ReadAccessor;
+ PSERENUM_WRITEPORT WriteAccessor;
+ PVOID SerPortAddress;
+ PVOID HardwareHandle;
+ SERENUM_PORTION Portion;
+ USHORT NumberAxis;
+ USHORT Reserved[3];
+} SERENUM_PORT_PARAMETERS, *PSERENUM_PORT_PARAMETERS;
+
+#define SERIAL_ERROR_BREAK 0x00000001
+#define SERIAL_ERROR_FRAMING 0x00000002
+#define SERIAL_ERROR_OVERRUN 0x00000004
+#define SERIAL_ERROR_QUEUEOVERRUN 0x00000008
+#define SERIAL_ERROR_PARITY 0x00000010
+
+#define SERIAL_SP_UNSPECIFIED 0x00000000
+#define SERIAL_SP_RS232 0x00000001
+#define SERIAL_SP_PARALLEL 0x00000002
+#define SERIAL_SP_RS422 0x00000003
+#define SERIAL_SP_RS423 0x00000004
+#define SERIAL_SP_RS449 0x00000005
+#define SERIAL_SP_MODEM 0X00000006
+#define SERIAL_SP_FAX 0x00000021
+#define SERIAL_SP_SCANNER 0x00000022
+#define SERIAL_SP_BRIDGE 0x00000100
+#define SERIAL_SP_LAT 0x00000101
+#define SERIAL_SP_TELNET 0x00000102
+#define SERIAL_SP_X25 0x00000103
+#define SERIAL_SP_SERIALCOMM 0x00000001
+
+#define SERIAL_TX_WAITING_FOR_CTS 0x00000001
+#define SERIAL_TX_WAITING_FOR_DSR 0x00000002
+#define SERIAL_TX_WAITING_FOR_DCD 0x00000004
+#define SERIAL_TX_WAITING_FOR_XON 0x00000008
+#define SERIAL_TX_WAITING_XOFF_SENT 0x00000010
+#define SERIAL_TX_WAITING_ON_BREAK 0x00000020
+#define SERIAL_RX_WAITING_FOR_DSR 0x00000040
+
+#define SERIAL_DTR_STATE 0x00000001
+#define SERIAL_RTS_STATE 0x00000002
+#define SERIAL_CTS_STATE 0x00000010
+#define SERIAL_DSR_STATE 0x00000020
+#define SERIAL_RI_STATE 0x00000040
+#define SERIAL_DCD_STATE 0x00000080
+
+typedef struct _SERIALCONFIG {
+ ULONG Size;
+ USHORT Version;
+ ULONG SubType;
+ ULONG ProvOffset;
+ ULONG ProviderSize;
+ WCHAR ProviderData[1];
+} SERIALCONFIG,*PSERIALCONFIG;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDSER_H */
--- /dev/null
+/*
+ * ntddstor.h
+ *
+ * Storage class IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDSTOR_H
+#define __NTDDSTOR_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
+
+#define IOCTL_STORAGE_CHECK_VERIFY \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_STORAGE_CHECK_VERIFY2 \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_EJECT_MEDIA \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_STORAGE_EJECTION_CONTROL \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_FIND_NEW_DEVICES \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_STORAGE_GET_DEVICE_NUMBER \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_GET_MEDIA_TYPES \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_LOAD_MEDIA \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_STORAGE_LOAD_MEDIA2 \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_MCN_CONTROL \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_MEDIA_REMOVAL \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_STORAGE_PREDICT_FAILURE \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_QUERY_PROPERTY \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_STORAGE_RELEASE \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_STORAGE_RESERVE \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_STORAGE_RESET_BUS \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_STORAGE_RESET_DEVICE \
+ CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+
+DEFINE_GUID(GUID_DEVINTERFACE_DISK,
+ 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_CDROM,
+ 0x53f56308L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_PARTITION,
+ 0x53f5630aL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_TAPE,
+ 0x53f5630bL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK,
+ 0x53f5630cL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_VOLUME,
+ 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER,
+ 0x53f56310L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY,
+ 0x53f56311L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER,
+ 0x53f56312L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT,
+ 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
+
+
+typedef enum _STORAGE_MEDIA_TYPE {
+ DDS_4mm = 0x20,
+ MiniQic,
+ Travan,
+ QIC,
+ MP_8mm,
+ AME_8mm,
+ AIT1_8mm,
+ DLT,
+ NCTP,
+ IBM_3480,
+ IBM_3490E,
+ IBM_Magstar_3590,
+ IBM_Magstar_MP,
+ STK_DATA_D3,
+ SONY_DTF,
+ DV_6mm,
+ DMI,
+ SONY_D2,
+ CLEANER_CARTRIDGE,
+ CD_ROM,
+ CD_R,
+ CD_RW,
+ DVD_ROM,
+ DVD_R,
+ DVD_RW,
+ MO_3_RW,
+ MO_5_WO,
+ MO_5_RW,
+ MO_5_LIMDOW,
+ PC_5_WO,
+ PC_5_RW,
+ PD_5_RW,
+ ABL_5_WO,
+ PINNACLE_APEX_5_RW,
+ SONY_12_WO,
+ PHILIPS_12_WO,
+ HITACHI_12_WO,
+ CYGNET_12_WO,
+ KODAK_14_WO,
+ MO_NFR_525,
+ NIKON_12_RW,
+ IOMEGA_ZIP,
+ IOMEGA_JAZ,
+ SYQUEST_EZ135,
+ SYQUEST_EZFLYER,
+ SYQUEST_SYJET,
+ AVATAR_F2,
+ MP2_8mm,
+ DST_S,
+ DST_M,
+ DST_L,
+ VXATape_1,
+ VXATape_2,
+ STK_9840,
+ LTO_Ultrium,
+ LTO_Accelis,
+ DVD_RAM,
+ AIT_8mm,
+ ADR_1,
+ ADR_2
+} STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
+
+typedef enum _STORAGE_BUS_TYPE {
+ BusTypeUnknown = 0x00,
+ BusTypeScsi,
+ BusTypeAtapi,
+ BusTypeAta,
+ BusType1394,
+ BusTypeSsa,
+ BusTypeFibre,
+ BusTypeUsb,
+ BusTypeRAID,
+ BusTypeMaxReserved = 0x7F
+} STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
+
+/* DEVICE_MEDIA_INFO.DeviceSpecific.DiskInfo.MediaCharacteristics constants */
+#define MEDIA_ERASEABLE 0x00000001
+#define MEDIA_WRITE_ONCE 0x00000002
+#define MEDIA_READ_ONLY 0x00000004
+#define MEDIA_READ_WRITE 0x00000008
+#define MEDIA_WRITE_PROTECTED 0x00000100
+#define MEDIA_CURRENTLY_MOUNTED 0x80000000
+
+typedef struct _DEVICE_MEDIA_INFO {
+ union {
+ struct {
+ LARGE_INTEGER Cylinders;
+ STORAGE_MEDIA_TYPE MediaType;
+ ULONG TracksPerCylinder;
+ ULONG SectorsPerTrack;
+ ULONG BytesPerSector;
+ ULONG NumberMediaSides;
+ ULONG MediaCharacteristics;
+ } DiskInfo;
+ struct {
+ LARGE_INTEGER Cylinders;
+ STORAGE_MEDIA_TYPE MediaType;
+ ULONG TracksPerCylinder;
+ ULONG SectorsPerTrack;
+ ULONG BytesPerSector;
+ ULONG NumberMediaSides;
+ ULONG MediaCharacteristics;
+ } RemovableDiskInfo;
+ struct {
+ STORAGE_MEDIA_TYPE MediaType;
+ ULONG MediaCharacteristics;
+ ULONG CurrentBlockSize;
+ STORAGE_BUS_TYPE BusType;
+ union {
+ struct {
+ UCHAR MediumType;
+ UCHAR DensityCode;
+ } ScsiInformation;
+ } BusSpecificData;
+ } TapeInfo;
+ } DeviceSpecific;
+} DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
+
+typedef struct _GET_MEDIA_TYPES {
+ ULONG DeviceType;
+ ULONG MediaInfoCount;
+ DEVICE_MEDIA_INFO MediaInfo[1];
+} GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
+
+typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
+ ULONG Version;
+ ULONG Size;
+ ULONG MaximumTransferLength;
+ ULONG MaximumPhysicalPages;
+ ULONG AlignmentMask;
+ BOOLEAN AdapterUsesPio;
+ BOOLEAN AdapterScansDown;
+ BOOLEAN CommandQueueing;
+ BOOLEAN AcceleratedTransfer;
+ STORAGE_BUS_TYPE BusType;
+ USHORT BusMajorVersion;
+ USHORT BusMinorVersion;
+} STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
+
+typedef struct _STORAGE_BUS_RESET_REQUEST {
+ UCHAR PathId;
+} STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
+
+typedef struct _STORAGE_DESCRIPTOR_HEADER {
+ ULONG Version;
+ ULONG Size;
+} STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
+
+typedef struct _STORAGE_DEVICE_DESCRIPTOR {
+ ULONG Version;
+ ULONG Size;
+ UCHAR DeviceType;
+ UCHAR DeviceTypeModifier;
+ BOOLEAN RemovableMedia;
+ BOOLEAN CommandQueueing;
+ ULONG VendorIdOffset;
+ ULONG ProductIdOffset;
+ ULONG ProductRevisionOffset;
+ ULONG SerialNumberOffset;
+ STORAGE_BUS_TYPE BusType;
+ ULONG RawPropertiesLength;
+ UCHAR RawDeviceProperties[1];
+} STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
+
+typedef struct _STORAGE_DEVICE_ID_DESCRIPTOR {
+ ULONG Version;
+ ULONG Size;
+ ULONG NumberOfIdentifiers;
+ UCHAR Identifiers[1];
+} STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
+
+typedef struct _STORAGE_DEVICE_NUMBER {
+ DEVICE_TYPE DeviceType;
+ ULONG DeviceNumber;
+ ULONG PartitionNumber;
+} STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
+
+typedef struct _STORAGE_PREDICT_FAILURE {
+ ULONG PredictFailure;
+ UCHAR VendorSpecific[512];
+} STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
+
+typedef enum _STORAGE_PROPERTY_ID {
+ StorageDeviceProperty = 0,
+ StorageAdapterProperty,
+ StorageDeviceIdProperty
+} STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
+
+typedef enum _STORAGE_QUERY_TYPE {
+ PropertyStandardQuery = 0,
+ PropertyExistsQuery,
+ PropertyMaskQuery,
+ PropertyQueryMaxDefined
+} STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
+
+typedef struct _STORAGE_PROPERTY_QUERY {
+ STORAGE_PROPERTY_ID PropertyId;
+ STORAGE_QUERY_TYPE QueryType;
+ UCHAR AdditionalParameters[1];
+} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDSTOR_H */
--- /dev/null
+/*
+ * ntddtape.h
+ *
+ * Tape device IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDTAPE_H
+#define __NTDDTAPE_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddstor.h"
+
+
+#define DD_TAPE_DEVICE_NAME "\\Device\\Tape"
+#define DD_TAPE_DEVICE_NAME_U L"\\Device\\Tape"
+
+#define IOCTL_TAPE_BASE FILE_DEVICE_TAPE
+
+#define IOCTL_TAPE_CHECK_VERIFY CTL_CODE(IOCTL_TAPE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_CREATE_PARTITION CTL_CODE(IOCTL_TAPE_BASE, 0x000a, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+#define IOCTL_TAPE_ERASE CTL_CODE(IOCTL_TAPE_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+#define IOCTL_TAPE_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_GET_DRIVE_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_GET_MEDIA_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_GET_POSITION CTL_CODE(IOCTL_TAPE_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_GET_STATUS CTL_CODE(IOCTL_TAPE_BASE, 0x0009, METHOD_BUFFERED, FILE_READ_ACCESS )
+
+#define IOCTL_TAPE_PREPARE CTL_CODE(IOCTL_TAPE_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_SET_DRIVE_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+#define IOCTL_TAPE_SET_MEDIA_PARAMS CTL_CODE(IOCTL_TAPE_BASE, 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_SET_POSITION CTL_CODE(IOCTL_TAPE_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
+#define IOCTL_TAPE_WRITE_MARKS CTL_CODE(IOCTL_TAPE_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+
+typedef enum _TAPE_DRIVE_PROBLEM_TYPE {
+ TapeDriveProblemNone,
+ TapeDriveReadWriteWarning,
+ TapeDriveReadWriteError,
+ TapeDriveReadWarning,
+ TapeDriveWriteWarning,
+ TapeDriveReadError,
+ TapeDriveWriteError,
+ TapeDriveHardwareError,
+ TapeDriveUnsupportedMedia,
+ TapeDriveScsiConnectionError,
+ TapeDriveTimetoClean,
+ TapeDriveCleanDriveNow,
+ TapeDriveMediaLifeExpired,
+ TapeDriveSnappedTape
+} TAPE_DRIVE_PROBLEM_TYPE;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDTAPE_H */
--- /dev/null
+/*
+ * ntddtdi.h
+ *
+ * TDI IOCTL interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDTDI_H
+#define __NTDDTDI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define DD_TDI_DEVICE_NAME "\\Device\\UNKNOWN"
+#define DD_TDI_DEVICE_NAME_U L"\\Device\\UNKNOWN"
+
+#define _TDI_CONTROL_CODE(Request, Method) \
+ CTL_CODE(FILE_DEVICE_TRANSPORT, Request, Method, FILE_ANY_ACCESS)
+
+#define IOCTL_TDI_ACCEPT _TDI_CONTROL_CODE(0, METHOD_BUFFERED)
+#define IOCTL_TDI_CONNECT _TDI_CONTROL_CODE(1, METHOD_BUFFERED)
+#define IOCTL_TDI_DISCONNECT _TDI_CONTROL_CODE(2, METHOD_BUFFERED)
+#define IOCTL_TDI_LISTEN _TDI_CONTROL_CODE(3, METHOD_BUFFERED)
+#define IOCTL_TDI_QUERY_INFORMATION _TDI_CONTROL_CODE(4, METHOD_OUT_DIRECT)
+#define IOCTL_TDI_RECEIVE _TDI_CONTROL_CODE(5, METHOD_OUT_DIRECT)
+#define IOCTL_TDI_RECEIVE_DATAGRAM _TDI_CONTROL_CODE(6, METHOD_OUT_DIRECT)
+#define IOCTL_TDI_SEND _TDI_CONTROL_CODE(7, METHOD_IN_DIRECT)
+#define IOCTL_TDI_SEND_DATAGRAM _TDI_CONTROL_CODE(8, METHOD_IN_DIRECT)
+#define IOCTL_TDI_SET_EVENT_HANDLER _TDI_CONTROL_CODE(9, METHOD_BUFFERED)
+#define IOCTL_TDI_SET_INFORMATION _TDI_CONTROL_CODE(10, METHOD_IN_DIRECT)
+#define IOCTL_TDI_ASSOCIATE_ADDRESS _TDI_CONTROL_CODE(11, METHOD_BUFFERED)
+#define IOCTL_TDI_DISASSOCIATE_ADDRESS _TDI_CONTROL_CODE(12, METHOD_BUFFERED)
+#define IOCTL_TDI_ACTION _TDI_CONTROL_CODE(13, METHOD_OUT_DIRECT)
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDTDI_H */
--- /dev/null
+/*
+ * ntddvdeo.h
+ *
+ * Definitions for video devices
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDVDEO_H
+#define __NTDDVDEO_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define VIDEO_DEVICE_NAME "DISPLAY%d"
+#define WVIDEO_DEVICE_NAME L"DISPLAY%d"
+
+#define DD_FULLSCREEN_VIDEO_DEVICE_NAME L"\\Device\\FSVideo"
+
+DEFINE_GUID(GUID_DEVINTERFACE_DISPLAY_ADAPTER, \
+ 0x5b45201d, 0xf2f2, 0x4f3b, 0x85, 0xbb, 0x30, 0xff, 0x1f, 0x95, 0x35, 0x99);
+
+
+#define IOCTL_VIDEO_DISABLE_CURSOR \
+ CTL_CODE (FILE_DEVICE_VIDEO, 0x109, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_DISABLE_POINTER \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x10f, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_ENABLE_CURSOR \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x108, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_ENABLE_POINTER \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x10e, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x119, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_GET_BANK_SELECT_CODE \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x115, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_GET_CHILD_STATE \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x120, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_GET_POWER_MANAGEMENT \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x11c, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_HANDLE_VIDEOPARAMETERS \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x08, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_LOAD_AND_SET_FONT \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x105, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_MAP_VIDEO_MEMORY \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x116, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_AVAIL_MODES \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x100, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x11a, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_CURRENT_MODE \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x102, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_CURSOR_ATTR \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x10b, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_CURSOR_POSITION \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x10d, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x101, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_POINTER_ATTR \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x111, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x114, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_POINTER_POSITION \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x113, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x118, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_RESET_DEVICE \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x104, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_RESTORE_HARDWARE_STATE \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x81, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SAVE_HARDWARE_STATE \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x80, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_CHILD_STATE_CONFIGURATION \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x122, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_COLOR_REGISTERS \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x107, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_CURRENT_MODE \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x103, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_CURSOR_ATTR \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x10a, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_CURSOR_POSITION \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x10c, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_PALETTE_REGISTERS \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x106, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_POINTER_ATTR \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x110, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_POINTER_POSITION \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x112, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SET_POWER_MANAGEMENT \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x11b, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SHARE_VIDEO_MEMORY \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x11d, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_SWITCH_DUALVIEW \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x123, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x117, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x11e, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VIDEO_VALIDATE_CHILD_STATE_CONFIGURATION \
+ CTL_CODE(FILE_DEVICE_VIDEO, 0x121, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+
+typedef struct _VIDEO_MEMORY {
+ PVOID RequestedVirtualAddress;
+} VIDEO_MEMORY, *PVIDEO_MEMORY;
+
+typedef struct _VIDEO_MEMORY_INFORMATION {
+ PVOID VideoRamBase;
+ ULONG VideoRamLength;
+ PVOID FrameBufferBase;
+ ULONG FrameBufferLength;
+} VIDEO_MEMORY_INFORMATION, *PVIDEO_MEMORY_INFORMATION;
+
+/* VIDEO_MODE.RequestedMode */
+#define VIDEO_MODE_MAP_MEM_LINEAR 0x40000000
+#define VIDEO_MODE_NO_ZERO_MEMORY 0x80000000
+
+typedef struct _VIDEO_MODE {
+ ULONG RequestedMode;
+} VIDEO_MODE, *PVIDEO_MODE;
+
+/* VIDEO_MODE_INFORMATION.AttributeFlags */
+#define VIDEO_MODE_COLOR 0x0001
+#define VIDEO_MODE_GRAPHICS 0x0002
+#define VIDEO_MODE_PALETTE_DRIVEN 0x0004
+#define VIDEO_MODE_MANAGED_PALETTE 0x0008
+#define VIDEO_MODE_INTERLACED 0x0010
+#define VIDEO_MODE_NO_OFF_SCREEN 0x0020
+#define VIDEO_MODE_NO_64_BIT_ACCESS 0x0040
+#define VIDEO_MODE_BANKED 0x0080
+#define VIDEO_MODE_LINEAR 0x0100
+
+typedef struct _VIDEO_MODE_INFORMATION {
+ ULONG Length;
+ ULONG ModeIndex;
+ ULONG VisScreenWidth;
+ ULONG VisScreenHeight;
+ ULONG ScreenStride;
+ ULONG NumberOfPlanes;
+ ULONG BitsPerPlane;
+ ULONG Frequency;
+ ULONG XMillimeter;
+ ULONG YMillimeter;
+ ULONG NumberRedBits;
+ ULONG NumberGreenBits;
+ ULONG NumberBlueBits;
+ ULONG RedMask;
+ ULONG GreenMask;
+ ULONG BlueMask;
+ ULONG AttributeFlags;
+ ULONG VideoMemoryBitmapWidth;
+ ULONG VideoMemoryBitmapHeight;
+ ULONG DriverSpecificAttributeFlags;
+} VIDEO_MODE_INFORMATION, *PVIDEO_MODE_INFORMATION;
+
+typedef struct _VIDEO_NUM_MODES {
+ ULONG NumModes;
+ ULONG ModeInformationLength;
+} VIDEO_NUM_MODES, *PVIDEO_NUM_MODES;
+
+typedef enum _VIDEO_POWER_STATE {
+ VideoPowerUnspecified = 0,
+ VideoPowerOn = 1,
+ VideoPowerStandBy,
+ VideoPowerSuspend,
+ VideoPowerOff,
+ VideoPowerHibernate,
+ VideoPowerShutdown,
+ VideoPowerMaximum
+} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
+
+typedef struct _VIDEO_POWER_MANAGEMENT {
+ ULONG Length;
+ ULONG DPMSVersion;
+ ULONG PowerState;
+} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
+
+typedef struct _VIDEO_PUBLIC_ACCESS_RANGES {
+ ULONG InIoSpace;
+ ULONG MappedInIoSpace;
+ PVOID VirtualAddress;
+} VIDEO_PUBLIC_ACCESS_RANGES, *PVIDEO_PUBLIC_ACCESS_RANGES;
+
+typedef struct _VIDEO_SHARE_MEMORY {
+ HANDLE ProcessHandle;
+ ULONG ViewOffset;
+ ULONG ViewSize;
+ PVOID RequestedVirtualAddress;
+} VIDEO_SHARE_MEMORY, *PVIDEO_SHARE_MEMORY;
+
+typedef struct _VIDEO_SHARE_MEMORY_INFORMATION {
+ ULONG SharedViewOffset;
+ ULONG SharedViewSize;
+ PVOID VirtualAddress;
+} VIDEO_SHARE_MEMORY_INFORMATION, *PVIDEO_SHARE_MEMORY_INFORMATION;
+
+/* VIDEO_BANK_SELECT.BankingFlags constants */
+#define PLANAR_HC 0x00000001
+
+/* VIDEO_BANK_SELECT.BankingType and PlanarHCBankingType constants */
+typedef enum _VIDEO_BANK_TYPE {
+ VideoNotBanked = 0,
+ VideoBanked1RW,
+ VideoBanked1R1W,
+ VideoBanked2RW,
+ NumVideoBankTypes
+} VIDEO_BANK_TYPE, *PVIDEO_BANK_TYPE;
+
+typedef struct _VIDEO_BANK_SELECT {
+ ULONG Length;
+ ULONG Size;
+ ULONG BankingFlags;
+ ULONG BankingType;
+ ULONG PlanarHCBankingType;
+ ULONG BitmapWidthInBytes;
+ ULONG BitmapSize;
+ ULONG Granularity;
+ ULONG PlanarHCGranularity;
+ ULONG CodeOffset;
+ ULONG PlanarHCBankCodeOffset;
+ ULONG PlanarHCEnableCodeOffset;
+ ULONG PlanarHCDisableCodeOffset;
+} VIDEO_BANK_SELECT, *PVIDEO_BANK_SELECT;
+
+typedef struct _VIDEO_LOAD_FONT_INFORMATION {
+ USHORT WidthInPixels;
+ USHORT HeightInPixels;
+ ULONG FontSize;
+ UCHAR Font[1];
+} VIDEO_LOAD_FONT_INFORMATION, *PVIDEO_LOAD_FONT_INFORMATION;
+
+/* VIDEO_COLOR_CAPABILITIES.AttributeFlags constants */
+#define VIDEO_DEVICE_COLOR 0x00000001
+#define VIDEO_OPTIONAL_GAMMET_TABLE 0x00000002
+
+typedef struct _VIDEO_COLOR_CAPABILITIES {
+ ULONG Length;
+ ULONG AttributeFlags;
+ LONG RedPhosphoreDecay;
+ LONG GreenPhosphoreDecay;
+ LONG BluePhosphoreDecay;
+ LONG WhiteChromaticity_x;
+ LONG WhiteChromaticity_y;
+ LONG WhiteChromaticity_Y;
+ LONG RedChromaticity_x;
+ LONG RedChromaticity_y;
+ LONG GreenChromaticity_x;
+ LONG GreenChromaticity_y;
+ LONG BlueChromaticity_x;
+ LONG BlueChromaticity_y;
+ LONG WhiteGamma;
+ LONG RedGamma;
+ LONG GreenGamma;
+ LONG BlueGamma;
+} VIDEO_COLOR_CAPABILITIES, *PVIDEO_COLOR_CAPABILITIES;
+
+typedef struct _VIDEO_CURSOR_ATTRIBUTES {
+ USHORT Width;
+ USHORT Height;
+ SHORT Column;
+ SHORT Row;
+ UCHAR Rate;
+ UCHAR Enable;
+} VIDEO_CURSOR_ATTRIBUTES, *PVIDEO_CURSOR_ATTRIBUTES;
+
+typedef struct _VIDEO_CURSOR_POSITION {
+ SHORT Column;
+ SHORT Row;
+} VIDEO_CURSOR_POSITION, *PVIDEO_CURSOR_POSITION;
+
+typedef struct _VIDEO_POINTER_ATTRIBUTES {
+ ULONG Flags;
+ ULONG Width;
+ ULONG Height;
+ ULONG WidthInBytes;
+ ULONG Enable;
+ SHORT Column;
+ SHORT Row;
+ UCHAR Pixels[1];
+} VIDEO_POINTER_ATTRIBUTES, *PVIDEO_POINTER_ATTRIBUTES;
+
+/* VIDEO_POINTER_CAPABILITIES.Flags */
+#define VIDEO_MODE_ASYNC_POINTER 0x01
+#define VIDEO_MODE_MONO_POINTER 0x02
+#define VIDEO_MODE_COLOR_POINTER 0x04
+#define VIDEO_MODE_ANIMATE_START 0x08
+#define VIDEO_MODE_ANIMATE_UPDATE 0x10
+
+typedef struct _VIDEO_POINTER_CAPABILITIES {
+ ULONG Flags;
+ ULONG MaxWidth;
+ ULONG MaxHeight;
+ ULONG HWPtrBitmapStart;
+ ULONG HWPtrBitmapEnd;
+} VIDEO_POINTER_CAPABILITIES, *PVIDEO_POINTER_CAPABILITIES;
+
+typedef struct _VIDEO_POINTER_POSITION {
+ SHORT Column;
+ SHORT Row;
+} VIDEO_POINTER_POSITION, *PVIDEO_POINTER_POSITION;
+
+
+/* VIDEO_HARDWARE_STATE_HEADER.VGAStateFlags constants */
+#define VIDEO_STATE_NON_STANDARD_VGA 0x00000001
+#define VIDEO_STATE_UNEMULATED_VGA_STATE 0x00000002
+#define VIDEO_STATE_PACKED_CHAIN4_MODE 0x00000004
+
+typedef struct _VIDEO_HARDWARE_STATE_HEADER {
+ ULONG Length;
+ UCHAR PortValue[0x30];
+ ULONG AttribIndexDataState;
+ ULONG BasicSequencerOffset;
+ ULONG BasicCrtContOffset;
+ ULONG BasicGraphContOffset;
+ ULONG BasicAttribContOffset;
+ ULONG BasicDacOffset;
+ ULONG BasicLatchesOffset;
+ ULONG ExtendedSequencerOffset;
+ ULONG ExtendedCrtContOffset;
+ ULONG ExtendedGraphContOffset;
+ ULONG ExtendedAttribContOffset;
+ ULONG ExtendedDacOffset;
+ ULONG ExtendedValidatorStateOffset;
+ ULONG ExtendedMiscDataOffset;
+ ULONG PlaneLength;
+ ULONG Plane1Offset;
+ ULONG Plane2Offset;
+ ULONG Plane3Offset;
+ ULONG Plane4Offset;
+ ULONG VGAStateFlags;
+ ULONG DIBOffset;
+ ULONG DIBBitsPerPixel;
+ ULONG DIBXResolution;
+ ULONG DIBYResolution;
+ ULONG DIBXlatOffset;
+ ULONG DIBXlatLength;
+ ULONG VesaInfoOffset;
+ PVOID FrameBufferData;
+} VIDEO_HARDWARE_STATE_HEADER, *PVIDEO_HARDWARE_STATE_HEADER;
+
+typedef struct _VIDEO_CLUTDATA {
+ UCHAR Red;
+ UCHAR Green;
+ UCHAR Blue;
+ UCHAR Unused;
+} VIDEO_CLUTDATA, *PVIDEO_CLUTDATA;
+
+typedef struct {
+ USHORT NumEntries;
+ USHORT FirstEntry;
+ union {
+ VIDEO_CLUTDATA RgbArray;
+ ULONG RgbLong;
+ } LookupTable[1];
+} VIDEO_CLUT, *PVIDEO_CLUT;
+
+typedef struct _VIDEO_PALETTE_DATA {
+ USHORT NumEntries;
+ USHORT FirstEntry;
+ USHORT Colors[1];
+} VIDEO_PALETTE_DATA, *PVIDEO_PALETTE_DATA;
+
+typedef struct _VIDEO_HARDWARE_STATE {
+ PVIDEO_HARDWARE_STATE_HEADER StateHeader;
+ ULONG StateLength;
+} VIDEO_HARDWARE_STATE, *PVIDEO_HARDWARE_STATE;
+
+#define VIDEO_CHILD_ACTIVE 0x00000001
+#define VIDEO_CHILD_DETACHED 0x00000002
+#define VIDEO_CHILD_NOPRUNE_FREQ 0x80000000
+#define VIDEO_CHILD_NOPRUNE_RESOLUTION 0x40000000
+
+#define VIDEO_DUALVIEW_REMOVABLE 0x00000001
+#define VIDEO_DUALVIEW_PRIMARY 0x80000000
+#define VIDEO_DUALVIEW_SECONDARY 0x40000000
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDVDEO_H */
--- /dev/null
+/*
+ * ntddvol.h
+ *
+ * Volume IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTDDVOL_H
+#define __NTDDVOL_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define IOCTL_VOLUME_BASE ((ULONG) 'V')
+
+#define IOCTL_VOLUME_LOGICAL_TO_PHYSICAL \
+ CTL_CODE(IOCTL_VOLUME_BASE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_PHYSICAL_TO_LOGICAL \
+ CTL_CODE(IOCTL_VOLUME_BASE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_READ_PLEX \
+ CTL_CODE(IOCTL_VOLUME_BASE, 11, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
+
+#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS \
+ CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_IS_CLUSTERED \
+ CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_QUERY_VOLUME_NUMBER \
+ CTL_CODE(IOCTL_VOLUME_BASE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_IS_PARTITION \
+ CTL_CODE(IOCTL_VOLUME_BASE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_SET_GPT_ATTRIBUTES \
+ CTL_CODE(IOCTL_VOLUME_BASE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_GET_GPT_ATTRIBUTES \
+ CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_SUPPORTS_ONLINE_OFFLINE \
+ CTL_CODE(IOCTL_VOLUME_BASE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_ONLINE \
+ CTL_CODE(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_VOLUME_OFFLINE \
+ CTL_CODE(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+#define IOCTL_VOLUME_IS_OFFLINE \
+ CTL_CODE(IOCTL_VOLUME_BASE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_IS_IO_CAPABLE \
+ CTL_CODE(IOCTL_VOLUME_BASE, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_VOLUME_QUERY_FAILOVER_SET \
+ CTL_CODE(IOCTL_VOLUME_BASE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+typedef struct _VOLUME_LOGICAL_OFFSET {
+ LONGLONG LogicalOffset;
+} VOLUME_LOGICAL_OFFSET, *PVOLUME_LOGICAL_OFFSET;
+
+typedef struct _VOLUME_PHYSICAL_OFFSET {
+ ULONG DiskNumber;
+ LONGLONG Offset;
+} VOLUME_PHYSICAL_OFFSET, *PVOLUME_PHYSICAL_OFFSET;
+
+typedef struct _VOLUME_PHYSICAL_OFFSETS {
+ ULONG NumberOfPhysicalOffsets;
+ VOLUME_PHYSICAL_OFFSET PhysicalOffset[1];
+} VOLUME_PHYSICAL_OFFSETS, *PVOLUME_PHYSICAL_OFFSETS;
+
+typedef struct _VOLUME_READ_PLEX_INPUT {
+ LARGE_INTEGER ByteOffset;
+ ULONG Length;
+ ULONG PlexNumber;
+} VOLUME_READ_PLEX_INPUT, *PVOLUME_READ_PLEX_INPUT;
+
+typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION {
+ ULONGLONG GptAttributes;
+} VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION;
+
+typedef struct _VOLUME_SET_GPT_ATTRIBUTES_INFORMATION {
+ ULONGLONG GptAttributes;
+ BOOLEAN RevertOnClose;
+ BOOLEAN ApplyToAllConnectedVolumes;
+ USHORT Reserved1;
+ ULONG Reserved2;
+} VOLUME_SET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_SET_GPT_ATTRIBUTES_INFORMATION;
+
+typedef struct _DISK_EXTENT {
+ ULONG DiskNumber;
+ LARGE_INTEGER StartingOffset;
+ LARGE_INTEGER ExtentLength;
+} DISK_EXTENT, *PDISK_EXTENT;
+
+typedef struct _VOLUME_DISK_EXTENTS {
+ ULONG NumberOfDiskExtents;
+ DISK_EXTENT Extents[1];
+} VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS;
+
+typedef struct _VOLUME_NUMBER {
+ ULONG VolumeNumber;
+ WCHAR VolumeManagerName[8];
+} VOLUME_NUMBER, *PVOLUME_NUMBER;
+
+typedef struct _VOLUME_FAILOVER_SET {
+ ULONG NumberOfDisks;
+ ULONG DiskNumbers[1];
+} VOLUME_FAILOVER_SET, *PVOLUME_FAILOVER_SET;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTDDVOL_H */
--- /dev/null
+/*
+ * ntifs.h
+ *
+ * Windows NT Filesystem Driver Developer Kit
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Bo Brantén <bosse@acc.umu.se>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef _NTIFS_
+#define _NTIFS_
+#define _GNU_NTIFS_
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntapi.h"
+
+#define VER_PRODUCTBUILD 10000
+
+#ifndef NTSYSAPI
+#define NTSYSAPI
+#endif
+
+#ifndef NTKERNELAPI
+#define NTKERNELAPI STDCALL
+#endif
+
+typedef struct _SE_EXPORTS *PSE_EXPORTS;
+
+extern PUCHAR *FsRtlLegalAnsiCharacterArray;
+extern PSE_EXPORTS SeExports;
+extern PACL SePublicDefaultDacl;
+extern PACL SeSystemDefaultDacl;
+
+#define ACCESS_ALLOWED_ACE_TYPE (0x0)
+#define ACCESS_DENIED_ACE_TYPE (0x1)
+#define SYSTEM_AUDIT_ACE_TYPE (0x2)
+#define SYSTEM_ALARM_ACE_TYPE (0x3)
+
+#define ANSI_DOS_STAR ('<')
+#define ANSI_DOS_QM ('>')
+#define ANSI_DOS_DOT ('"')
+
+#define DOS_STAR (L'<')
+#define DOS_QM (L'>')
+#define DOS_DOT (L'"')
+
+#define COMPRESSION_FORMAT_NONE (0x0000)
+#define COMPRESSION_FORMAT_DEFAULT (0x0001)
+#define COMPRESSION_FORMAT_LZNT1 (0x0002)
+#define COMPRESSION_ENGINE_STANDARD (0x0000)
+#define COMPRESSION_ENGINE_MAXIMUM (0x0100)
+#define COMPRESSION_ENGINE_HIBER (0x0200)
+
+#define FILE_ACTION_ADDED 0x00000001
+#define FILE_ACTION_REMOVED 0x00000002
+#define FILE_ACTION_MODIFIED 0x00000003
+#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
+#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
+#define FILE_ACTION_ADDED_STREAM 0x00000006
+#define FILE_ACTION_REMOVED_STREAM 0x00000007
+#define FILE_ACTION_MODIFIED_STREAM 0x00000008
+#define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
+#define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
+#define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
+
+#define FILE_EA_TYPE_BINARY 0xfffe
+#define FILE_EA_TYPE_ASCII 0xfffd
+#define FILE_EA_TYPE_BITMAP 0xfffb
+#define FILE_EA_TYPE_METAFILE 0xfffa
+#define FILE_EA_TYPE_ICON 0xfff9
+#define FILE_EA_TYPE_EA 0xffee
+#define FILE_EA_TYPE_MVMT 0xffdf
+#define FILE_EA_TYPE_MVST 0xffde
+#define FILE_EA_TYPE_ASN1 0xffdd
+#define FILE_EA_TYPE_FAMILY_IDS 0xff01
+
+#define FILE_NEED_EA 0x00000080
+
+#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
+#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
+#define FILE_NOTIFY_CHANGE_NAME 0x00000003
+#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
+#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
+#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
+#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
+#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
+#define FILE_NOTIFY_CHANGE_EA 0x00000080
+#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
+#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
+#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
+#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
+#define FILE_NOTIFY_VALID_MASK 0x00000fff
+
+#define FILE_OPLOCK_BROKEN_TO_LEVEL_2 0x00000007
+#define FILE_OPLOCK_BROKEN_TO_NONE 0x00000008
+
+#define FILE_OPBATCH_BREAK_UNDERWAY 0x00000009
+
+#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
+#define FILE_CASE_PRESERVED_NAMES 0x00000002
+#define FILE_UNICODE_ON_DISK 0x00000004
+#define FILE_PERSISTENT_ACLS 0x00000008
+#define FILE_FILE_COMPRESSION 0x00000010
+#define FILE_VOLUME_QUOTAS 0x00000020
+#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
+#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
+#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
+#define FS_LFN_APIS 0x00004000
+#define FILE_VOLUME_IS_COMPRESSED 0x00008000
+#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
+#define FILE_SUPPORTS_ENCRYPTION 0x00020000
+#define FILE_NAMED_STREAMS 0x00040000
+
+#define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000
+#define FILE_PIPE_MESSAGE_TYPE 0x00000001
+
+#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
+#define FILE_PIPE_MESSAGE_MODE 0x00000001
+
+#define FILE_PIPE_QUEUE_OPERATION 0x00000000
+#define FILE_PIPE_COMPLETE_OPERATION 0x00000001
+
+#define FILE_PIPE_INBOUND 0x00000000
+#define FILE_PIPE_OUTBOUND 0x00000001
+#define FILE_PIPE_FULL_DUPLEX 0x00000002
+
+#define FILE_PIPE_DISCONNECTED_STATE 0x00000001
+#define FILE_PIPE_LISTENING_STATE 0x00000002
+#define FILE_PIPE_CONNECTED_STATE 0x00000003
+#define FILE_PIPE_CLOSING_STATE 0x00000004
+
+#define FILE_PIPE_CLIENT_END 0x00000000
+#define FILE_PIPE_SERVER_END 0x00000001
+
+#define FILE_PIPE_READ_DATA 0x00000000
+#define FILE_PIPE_WRITE_SPACE 0x00000001
+
+#define FILE_STORAGE_TYPE_SPECIFIED 0x00000041 // FILE_DIRECTORY_FILE | FILE_NON_DIRECTORY_FILE
+#define FILE_STORAGE_TYPE_DEFAULT (StorageTypeDefault << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_DIRECTORY (StorageTypeDirectory << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_FILE (StorageTypeFile << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_DOCFILE (StorageTypeDocfile << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_JUNCTION_POINT (StorageTypeJunctionPoint << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_CATALOG (StorageTypeCatalog << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_STRUCTURED_STORAGE (StorageTypeStructuredStorage << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_EMBEDDING (StorageTypeEmbedding << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_STREAM (StorageTypeStream << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_MINIMUM_STORAGE_TYPE FILE_STORAGE_TYPE_DEFAULT
+#define FILE_MAXIMUM_STORAGE_TYPE FILE_STORAGE_TYPE_STREAM
+#define FILE_STORAGE_TYPE_MASK 0x000f0000
+#define FILE_STORAGE_TYPE_SHIFT 16
+
+#define FILE_VC_QUOTA_NONE 0x00000000
+#define FILE_VC_QUOTA_TRACK 0x00000001
+#define FILE_VC_QUOTA_ENFORCE 0x00000002
+#define FILE_VC_QUOTA_MASK 0x00000003
+
+#define FILE_VC_QUOTAS_LOG_VIOLATIONS 0x00000004
+#define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008
+
+#define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010
+#define FILE_VC_LOG_QUOTA_LIMIT 0x00000020
+#define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040
+#define FILE_VC_LOG_VOLUME_LIMIT 0x00000080
+
+#define FILE_VC_QUOTAS_INCOMPLETE 0x00000100
+#define FILE_VC_QUOTAS_REBUILDING 0x00000200
+
+#define FILE_VC_VALID_MASK 0x000003ff
+
+#define FSRTL_FLAG_FILE_MODIFIED (0x01)
+#define FSRTL_FLAG_FILE_LENGTH_CHANGED (0x02)
+#define FSRTL_FLAG_LIMIT_MODIFIED_PAGES (0x04)
+#define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX (0x08)
+#define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH (0x10)
+#define FSRTL_FLAG_USER_MAPPED_FILE (0x20)
+#define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80)
+
+#define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01)
+
+#define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
+#define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
+#define FSRTL_MOD_WRITE_TOP_LEVEL_IRP (0x03)
+#define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04)
+#define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04)
+
+#define FSRTL_VOLUME_DISMOUNT 1
+#define FSRTL_VOLUME_DISMOUNT_FAILED 2
+#define FSRTL_VOLUME_LOCK 3
+#define FSRTL_VOLUME_LOCK_FAILED 4
+#define FSRTL_VOLUME_UNLOCK 5
+#define FSRTL_VOLUME_MOUNT 6
+
+#define FSRTL_WILD_CHARACTER 0x08
+
+#ifdef _X86_
+#define HARDWARE_PTE HARDWARE_PTE_X86
+#define PHARDWARE_PTE PHARDWARE_PTE_X86
+#else
+#define HARDWARE_PTE ULONG
+#define PHARDWARE_PTE PULONG
+#endif
+
+#define IO_CHECK_CREATE_PARAMETERS 0x0200
+#define IO_ATTACH_DEVICE 0x0400
+
+#define IO_ATTACH_DEVICE_API 0x80000000
+
+#define IO_COMPLETION_QUERY_STATE 0x0001
+#define IO_COMPLETION_MODIFY_STATE 0x0002
+#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
+
+#define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64
+#define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024
+
+#define IO_TYPE_APC 18
+#define IO_TYPE_DPC 19
+#define IO_TYPE_DEVICE_QUEUE 20
+#define IO_TYPE_EVENT_PAIR 21
+#define IO_TYPE_INTERRUPT 22
+#define IO_TYPE_PROFILE 23
+
+#define IRP_BEING_VERIFIED 0x10
+
+#define MAILSLOT_CLASS_FIRSTCLASS 1
+#define MAILSLOT_CLASS_SECONDCLASS 2
+
+#define MAILSLOT_SIZE_AUTO 0
+
+#define MAP_PROCESS 1L
+#define MAP_SYSTEM 2L
+
+#define MEM_DOS_LIM 0x40000000
+#define MEM_IMAGE SEC_IMAGE
+
+#define OB_TYPE_TYPE 1
+#define OB_TYPE_DIRECTORY 2
+#define OB_TYPE_SYMBOLIC_LINK 3
+#define OB_TYPE_TOKEN 4
+#define OB_TYPE_PROCESS 5
+#define OB_TYPE_THREAD 6
+#define OB_TYPE_EVENT 7
+#define OB_TYPE_EVENT_PAIR 8
+#define OB_TYPE_MUTANT 9
+#define OB_TYPE_SEMAPHORE 10
+#define OB_TYPE_TIMER 11
+#define OB_TYPE_PROFILE 12
+#define OB_TYPE_WINDOW_STATION 13
+#define OB_TYPE_DESKTOP 14
+#define OB_TYPE_SECTION 15
+#define OB_TYPE_KEY 16
+#define OB_TYPE_PORT 17
+#define OB_TYPE_ADAPTER 18
+#define OB_TYPE_CONTROLLER 19
+#define OB_TYPE_DEVICE 20
+#define OB_TYPE_DRIVER 21
+#define OB_TYPE_IO_COMPLETION 22
+#define OB_TYPE_FILE 23
+
+#define PIN_WAIT (1)
+#define PIN_EXCLUSIVE (2)
+#define PIN_NO_READ (4)
+#define PIN_IF_BCB (8)
+
+#define PORT_CONNECT 0x0001
+#define PORT_ALL_ACCESS (STANDARD_RIGHTS_ALL |\
+ PORT_CONNECT)
+
+#define SEC_BASED 0x00200000
+#define SEC_NO_CHANGE 0x00400000
+#define SEC_FILE 0x00800000
+#define SEC_IMAGE 0x01000000
+#define SEC_COMMIT 0x08000000
+#define SEC_NOCACHE 0x10000000
+
+#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
+#define SECURITY_WORLD_RID (0x00000000L)
+
+#define SID_REVISION 1
+
+#define TOKEN_ASSIGN_PRIMARY (0x0001)
+#define TOKEN_DUPLICATE (0x0002)
+#define TOKEN_IMPERSONATE (0x0004)
+#define TOKEN_QUERY (0x0008)
+#define TOKEN_QUERY_SOURCE (0x0010)
+#define TOKEN_ADJUST_PRIVILEGES (0x0020)
+#define TOKEN_ADJUST_GROUPS (0x0040)
+#define TOKEN_ADJUST_DEFAULT (0x0080)
+
+#define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
+ TOKEN_ASSIGN_PRIMARY |\
+ TOKEN_DUPLICATE |\
+ TOKEN_IMPERSONATE |\
+ TOKEN_QUERY |\
+ TOKEN_QUERY_SOURCE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+
+#define TOKEN_READ (STANDARD_RIGHTS_READ |\
+ TOKEN_QUERY)
+
+#define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+
+#define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
+
+#define TOKEN_SOURCE_LENGTH 8
+
+#define TOKEN_HAS_TRAVERSE_PRIVILEGE 0x01
+#define TOKEN_HAS_BACKUP_PRIVILEGE 0x02
+#define TOKEN_HAS_RESTORE_PRIVILEGE 0x04
+#define TOKEN_HAS_ADMIN_GROUP 0x08
+#define TOKEN_IS_RESTRICTED 0x10
+
+#define VACB_MAPPING_GRANULARITY (0x40000)
+#define VACB_OFFSET_SHIFT (18)
+
+#define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
+
+
+#define FSCTL_MARK_AS_SYSTEM_HIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#if (VER_PRODUCTBUILD >= 1381)
+
+#define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_GET_HFS_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#endif // (VER_PRODUCTBUILD >= 1381)
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+#define FSCTL_READ_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 33, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_WRITE_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 34, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define FSCTL_DUMP_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 37, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_HSM_MSG CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 66, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_NSS_CONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 67, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_HSM_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 68, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_NSS_RCONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 70, METHOD_BUFFERED, FILE_READ_DATA)
+#define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, FILE_READ_DATA)
+#define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+#define FSCTL_MAILSLOT_PEEK CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA)
+
+#define FSCTL_NETWORK_SET_CONFIGURATION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 102, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_GET_CONFIGURATION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 103, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_GET_CONNECTION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 104, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_ENUMERATE_CONNECTIONS CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 105, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_DELETE_CONNECTION CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 107, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_GET_STATISTICS CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 116, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_SET_DOMAIN_NAME CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_REMOTE_BOOT_INIT_SCRT CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 250, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define FSCTL_PIPE_ASSIGN_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_PEEK CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA)
+#define FSCTL_PIPE_QUERY_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_PIPE_WAIT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_SET_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_QUERY_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_INTERNAL_READ CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA)
+#define FSCTL_PIPE_INTERNAL_WRITE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_PIPE_INTERNAL_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_PIPE_INTERNAL_READ_OVFLOW CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA)
+
+#define IOCTL_REDIR_QUERY_PATH CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 99, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+typedef PVOID PEJOB;
+typedef PVOID OPLOCK, *POPLOCK;
+typedef PVOID PWOW64_PROCESS;
+
+typedef struct _CACHE_MANAGER_CALLBACKS *PCACHE_MANAGER_CALLBACKS;
+typedef struct _EPROCESS_QUOTA_BLOCK *PEPROCESS_QUOTA_BLOCK;
+typedef struct _FILE_GET_QUOTA_INFORMATION *PFILE_GET_QUOTA_INFORMATION;
+typedef struct _HANDLE_TABLE *PHANDLE_TABLE;
+typedef struct _KEVENT_PAIR *PKEVENT_PAIR;
+typedef struct _KPROCESS *PKPROCESS;
+typedef struct _KQUEUE *PKQUEUE;
+typedef struct _KTRAP_FRAME *PKTRAP_FRAME;
+typedef struct _MAILSLOT_CREATE_PARAMETERS *PMAILSLOT_CREATE_PARAMETERS;
+typedef struct _MMWSL *PMMWSL;
+typedef struct _NAMED_PIPE_CREATE_PARAMETERS *PNAMED_PIPE_CREATE_PARAMETERS;
+typedef struct _OBJECT_DIRECTORY *POBJECT_DIRECTORY;
+typedef struct _PAGEFAULT_HISTORY *PPAGEFAULT_HISTORY;
+typedef struct _PS_IMPERSONATION_INFORMATION *PPS_IMPERSONATION_INFORMATION;
+typedef struct _SECTION_OBJECT *PSECTION_OBJECT;
+typedef struct _SHARED_CACHE_MAP *PSHARED_CACHE_MAP;
+typedef struct _TERMINATION_PORT *PTERMINATION_PORT;
+typedef struct _VACB *PVACB;
+typedef struct _VAD_HEADER *PVAD_HEADER;
+
+typedef struct _NOTIFY_SYNC
+{
+ ULONG Unknown0;
+ ULONG Unknown1;
+ ULONG Unknown2;
+ USHORT Unknown3;
+ USHORT Unknown4;
+ ULONG Unknown5;
+ ULONG Unknown6;
+ ULONG Unknown7;
+ ULONG Unknown8;
+ ULONG Unknown9;
+ ULONG Unknown10;
+} NOTIFY_SYNC, * PNOTIFY_SYNC;
+
+typedef enum _FAST_IO_POSSIBLE {
+ FastIoIsNotPossible,
+ FastIoIsPossible,
+ FastIoIsQuestionable
+} FAST_IO_POSSIBLE;
+
+typedef enum _FILE_STORAGE_TYPE {
+ StorageTypeDefault = 1,
+ StorageTypeDirectory,
+ StorageTypeFile,
+ StorageTypeJunctionPoint,
+ StorageTypeCatalog,
+ StorageTypeStructuredStorage,
+ StorageTypeEmbedding,
+ StorageTypeStream
+} FILE_STORAGE_TYPE;
+
+typedef enum _IO_COMPLETION_INFORMATION_CLASS {
+ IoCompletionBasicInformation
+} IO_COMPLETION_INFORMATION_CLASS;
+
+typedef enum _OBJECT_INFO_CLASS {
+ ObjectBasicInfo,
+ ObjectNameInfo,
+ ObjectTypeInfo,
+ ObjectAllTypesInfo,
+ ObjectProtectionInfo
+} OBJECT_INFO_CLASS;
+
+typedef struct _HARDWARE_PTE_X86 {
+ ULONG Valid : 1;
+ ULONG Write : 1;
+ ULONG Owner : 1;
+ ULONG WriteThrough : 1;
+ ULONG CacheDisable : 1;
+ ULONG Accessed : 1;
+ ULONG Dirty : 1;
+ ULONG LargePage : 1;
+ ULONG Global : 1;
+ ULONG CopyOnWrite : 1;
+ ULONG Prototype : 1;
+ ULONG reserved : 1;
+ ULONG PageFrameNumber : 20;
+} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
+
+typedef struct _KAPC_STATE {
+ LIST_ENTRY ApcListHead[2];
+ PKPROCESS Process;
+ BOOLEAN KernelApcInProgress;
+ BOOLEAN KernelApcPending;
+ BOOLEAN UserApcPending;
+} KAPC_STATE, *PKAPC_STATE;
+
+typedef struct _KGDTENTRY {
+ USHORT LimitLow;
+ USHORT BaseLow;
+ union {
+ struct {
+ UCHAR BaseMid;
+ UCHAR Flags1;
+ UCHAR Flags2;
+ UCHAR BaseHi;
+ } Bytes;
+ struct {
+ ULONG BaseMid : 8;
+ ULONG Type : 5;
+ ULONG Dpl : 2;
+ ULONG Pres : 1;
+ ULONG LimitHi : 4;
+ ULONG Sys : 1;
+ ULONG Reserved_0 : 1;
+ ULONG Default_Big : 1;
+ ULONG Granularity : 1;
+ ULONG BaseHi : 8;
+ } Bits;
+ } HighWord;
+} KGDTENTRY, *PKGDTENTRY;
+
+typedef struct _KIDTENTRY {
+ USHORT Offset;
+ USHORT Selector;
+ USHORT Access;
+ USHORT ExtendedOffset;
+} KIDTENTRY, *PKIDTENTRY;
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _MMSUPPORT_FLAGS {
+ ULONG SessionSpace : 1;
+ ULONG BeingTrimmed : 1;
+ ULONG SessionLeader : 1;
+ ULONG TrimHard : 1;
+ ULONG WorkingSetHard : 1;
+ ULONG AddressSpaceBeingDeleted : 1;
+ ULONG Available : 10;
+ ULONG AllowWorkingSetAdjustment : 8;
+ ULONG MemoryPriority : 8;
+} MMSUPPORT_FLAGS, *PMMSUPPORT_FLAGS;
+
+#else
+
+typedef struct _MMSUPPORT_FLAGS {
+ ULONG SessionSpace : 1;
+ ULONG BeingTrimmed : 1;
+ ULONG ProcessInSession : 1;
+ ULONG SessionLeader : 1;
+ ULONG TrimHard : 1;
+ ULONG WorkingSetHard : 1;
+ ULONG WriteWatch : 1;
+ ULONG Filler : 25;
+} MMSUPPORT_FLAGS, *PMMSUPPORT_FLAGS;
+
+#endif
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _MMSUPPORT {
+ LARGE_INTEGER LastTrimTime;
+ MMSUPPORT_FLAGS Flags;
+ ULONG PageFaultCount;
+ ULONG PeakWorkingSetSize;
+ ULONG WorkingSetSize;
+ ULONG MinimumWorkingSetSize;
+ ULONG MaximumWorkingSetSize;
+ PMMWSL VmWorkingSetList;
+ LIST_ENTRY WorkingSetExpansionLinks;
+ ULONG Claim;
+ ULONG NextEstimationSlot;
+ ULONG NextAgingSlot;
+ ULONG EstimatedAvailable;
+ ULONG GrowthSinceLastEstimate;
+} MMSUPPORT, *PMMSUPPORT;
+
+#else
+
+typedef struct _MMSUPPORT {
+ LARGE_INTEGER LastTrimTime;
+ ULONG LastTrimFaultCount;
+ ULONG PageFaultCount;
+ ULONG PeakWorkingSetSize;
+ ULONG WorkingSetSize;
+ ULONG MinimumWorkingSetSize;
+ ULONG MaximumWorkingSetSize;
+ PMMWSL VmWorkingSetList;
+ LIST_ENTRY WorkingSetExpansionLinks;
+ BOOLEAN AllowWorkingSetAdjustment;
+ BOOLEAN AddressSpaceBeingDeleted;
+ UCHAR ForegroundSwitchCount;
+ UCHAR MemoryPriority;
+#if (VER_PRODUCTBUILD >= 2195)
+ union {
+ ULONG LongFlags;
+ MMSUPPORT_FLAGS Flags;
+ } u;
+ ULONG Claim;
+ ULONG NextEstimationSlot;
+ ULONG NextAgingSlot;
+ ULONG EstimatedAvailable;
+ ULONG GrowthSinceLastEstimate;
+#endif // (VER_PRODUCTBUILD >= 2195)
+} MMSUPPORT, *PMMSUPPORT;
+
+#endif
+
+typedef struct _SE_AUDIT_PROCESS_CREATION_INFO {
+ POBJECT_NAME_INFORMATION ImageFileName;
+} SE_AUDIT_PROCESS_CREATION_INFO, *PSE_AUDIT_PROCESS_CREATION_INFO;
+
+typedef struct _BITMAP_RANGE {
+ LIST_ENTRY Links;
+ LARGE_INTEGER BasePage;
+ ULONG FirstDirtyPage;
+ ULONG LastDirtyPage;
+ ULONG DirtyPages;
+ PULONG Bitmap;
+} BITMAP_RANGE, *PBITMAP_RANGE;
+
+typedef struct _CACHE_UNINITIALIZE_EVENT {
+ struct _CACHE_UNINITIALIZE_EVENT *Next;
+ KEVENT Event;
+} CACHE_UNINITIALIZE_EVENT, *PCACHE_UNINITIALIZE_EVENT;
+
+typedef struct _CC_FILE_SIZES {
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER FileSize;
+ LARGE_INTEGER ValidDataLength;
+} CC_FILE_SIZES, *PCC_FILE_SIZES;
+
+typedef struct _COMPRESSED_DATA_INFO {
+ USHORT CompressionFormatAndEngine;
+ UCHAR CompressionUnitShift;
+ UCHAR ChunkShift;
+ UCHAR ClusterShift;
+ UCHAR Reserved;
+ USHORT NumberOfChunks;
+ ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
+} COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
+
+typedef struct _DEVICE_MAP {
+ POBJECT_DIRECTORY DosDevicesDirectory;
+ POBJECT_DIRECTORY GlobalDosDevicesDirectory;
+ ULONG ReferenceCount;
+ ULONG DriveMap;
+ UCHAR DriveType[32];
+} DEVICE_MAP, *PDEVICE_MAP;
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _EX_FAST_REF {
+ union {
+ PVOID Object;
+ ULONG RefCnt : 3;
+ ULONG Value;
+ };
+} EX_FAST_REF, *PEX_FAST_REF;
+
+typedef struct _EX_PUSH_LOCK {
+ union {
+ struct {
+ ULONG Waiting : 1;
+ ULONG Exclusive : 1;
+ ULONG Shared : 30;
+ };
+ ULONG Value;
+ PVOID Ptr;
+ };
+} EX_PUSH_LOCK, *PEX_PUSH_LOCK;
+
+typedef struct _EX_RUNDOWN_REF {
+ union {
+ ULONG Count;
+ PVOID Ptr;
+ };
+} EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
+
+#endif
+
+typedef struct _EPROCESS_QUOTA_ENTRY {
+ ULONG Usage;
+ ULONG Limit;
+ ULONG Peak;
+ ULONG Return;
+} EPROCESS_QUOTA_ENTRY, *PEPROCESS_QUOTA_ENTRY;
+
+typedef struct _EPROCESS_QUOTA_BLOCK {
+ EPROCESS_QUOTA_ENTRY QuotaEntry[3];
+ LIST_ENTRY QuotaList;
+ ULONG ReferenceCount;
+ ULONG ProcessCount;
+} EPROCESS_QUOTA_BLOCK, *PEPROCESS_QUOTA_BLOCK;
+
+/*
+ * When needing these parameters cast your PIO_STACK_LOCATION to
+ * PEXTENDED_IO_STACK_LOCATION
+ */
+#if !defined(_ALPHA_)
+#include <pshpack4.h>
+#endif
+typedef struct _EXTENDED_IO_STACK_LOCATION {
+
+ /* Included for padding */
+ UCHAR MajorFunction;
+ UCHAR MinorFunction;
+ UCHAR Flags;
+ UCHAR Control;
+
+ union {
+
+ struct {
+ PIO_SECURITY_CONTEXT SecurityContext;
+ ULONG Options;
+ USHORT Reserved;
+ USHORT ShareAccess;
+ PMAILSLOT_CREATE_PARAMETERS Parameters;
+ } CreateMailslot;
+
+ struct {
+ PIO_SECURITY_CONTEXT SecurityContext;
+ ULONG Options;
+ USHORT Reserved;
+ USHORT ShareAccess;
+ PNAMED_PIPE_CREATE_PARAMETERS Parameters;
+ } CreatePipe;
+
+ struct {
+ ULONG OutputBufferLength;
+ ULONG InputBufferLength;
+ ULONG FsControlCode;
+ PVOID Type3InputBuffer;
+ } FileSystemControl;
+
+ struct {
+ PLARGE_INTEGER Length;
+ ULONG Key;
+ LARGE_INTEGER ByteOffset;
+ } LockControl;
+
+ struct {
+ ULONG Length;
+ ULONG CompletionFilter;
+ } NotifyDirectory;
+
+ struct {
+ ULONG Length;
+ PUNICODE_STRING FileName;
+ FILE_INFORMATION_CLASS FileInformationClass;
+ ULONG FileIndex;
+ } QueryDirectory;
+
+ struct {
+ ULONG Length;
+ PVOID EaList;
+ ULONG EaListLength;
+ ULONG EaIndex;
+ } QueryEa;
+
+ struct {
+ ULONG Length;
+ PSID StartSid;
+ PFILE_GET_QUOTA_INFORMATION SidList;
+ ULONG SidListLength;
+ } QueryQuota;
+
+ struct {
+ ULONG Length;
+ } SetEa;
+
+ struct {
+ ULONG Length;
+ } SetQuota;
+
+ struct {
+ ULONG Length;
+ FS_INFORMATION_CLASS FsInformationClass;
+ } SetVolume;
+
+ } Parameters;
+ PDEVICE_OBJECT DeviceObject;
+ PFILE_OBJECT FileObject;
+ PIO_COMPLETION_ROUTINE CompletionRoutine;
+ PVOID Context;
+
+} EXTENDED_IO_STACK_LOCATION, *PEXTENDED_IO_STACK_LOCATION;
+#if !defined(_ALPHA_)
+#include <poppack.h>
+#endif
+
+typedef struct _FILE_ACCESS_INFORMATION {
+ ACCESS_MASK AccessFlags;
+} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
+
+typedef struct _FILE_ALLOCATION_INFORMATION {
+ LARGE_INTEGER AllocationSize;
+} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
+
+typedef struct _FILE_BOTH_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ CCHAR ShortNameLength;
+ WCHAR ShortName[12];
+ WCHAR FileName[1];
+} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
+
+typedef struct _FILE_COMPLETION_INFORMATION {
+ HANDLE Port;
+ ULONG Key;
+} FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
+
+typedef struct _FILE_COMPRESSION_INFORMATION {
+ LARGE_INTEGER CompressedFileSize;
+ USHORT CompressionFormat;
+ UCHAR CompressionUnitShift;
+ UCHAR ChunkShift;
+ UCHAR ClusterShift;
+ UCHAR Reserved[3];
+} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
+
+typedef struct _FILE_COPY_ON_WRITE_INFORMATION {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_COPY_ON_WRITE_INFORMATION, *PFILE_COPY_ON_WRITE_INFORMATION;
+
+typedef struct _FILE_DIRECTORY_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
+
+typedef struct _FILE_FULL_DIRECTORY_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ WCHAR FileName[0];
+} FILE_FULL_DIRECTORY_INFORMATION, *PFILE_FULL_DIRECTORY_INFORMATION;
+
+typedef struct _FILE_BOTH_DIRECTORY_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ CHAR ShortNameLength;
+ WCHAR ShortName[12];
+ WCHAR FileName[0];
+} FILE_BOTH_DIRECTORY_INFORMATION, *PFILE_BOTH_DIRECTORY_INFORMATION;
+
+typedef struct _FILE_EA_INFORMATION {
+ ULONG EaSize;
+} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
+
+typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
+ ULONG FileSystemAttributes;
+ ULONG MaximumComponentNameLength;
+ ULONG FileSystemNameLength;
+ WCHAR FileSystemName[1];
+} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
+
+typedef struct _FILE_FS_CONTROL_INFORMATION {
+ LARGE_INTEGER FreeSpaceStartFiltering;
+ LARGE_INTEGER FreeSpaceThreshold;
+ LARGE_INTEGER FreeSpaceStopFiltering;
+ LARGE_INTEGER DefaultQuotaThreshold;
+ LARGE_INTEGER DefaultQuotaLimit;
+ ULONG FileSystemControlFlags;
+} FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION;
+
+typedef struct _FILE_FS_FULL_SIZE_INFORMATION {
+ LARGE_INTEGER TotalAllocationUnits;
+ LARGE_INTEGER CallerAvailableAllocationUnits;
+ LARGE_INTEGER ActualAvailableAllocationUnits;
+ ULONG SectorsPerAllocationUnit;
+ ULONG BytesPerSector;
+} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
+
+typedef struct _FILE_FS_LABEL_INFORMATION {
+ ULONG VolumeLabelLength;
+ WCHAR VolumeLabel[1];
+} FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION;
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+typedef struct _FILE_FS_OBJECT_ID_INFORMATION {
+ UCHAR ObjectId[16];
+ UCHAR ExtendedInfo[48];
+} FILE_FS_OBJECT_ID_INFORMATION, *PFILE_FS_OBJECT_ID_INFORMATION;
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+typedef struct _FILE_FS_SIZE_INFORMATION {
+ LARGE_INTEGER TotalAllocationUnits;
+ LARGE_INTEGER AvailableAllocationUnits;
+ ULONG SectorsPerAllocationUnit;
+ ULONG BytesPerSector;
+} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
+
+typedef struct _FILE_FS_VOLUME_INFORMATION {
+ LARGE_INTEGER VolumeCreationTime;
+ ULONG VolumeSerialNumber;
+ ULONG VolumeLabelLength;
+ BOOLEAN SupportsObjects;
+ WCHAR VolumeLabel[1];
+} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
+
+typedef struct _FILE_FULL_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ WCHAR FileName[1];
+} FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
+
+typedef struct _FILE_GET_EA_INFORMATION {
+ ULONG NextEntryOffset;
+ UCHAR EaNameLength;
+ CHAR EaName[1];
+} FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
+
+typedef struct _FILE_GET_QUOTA_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG SidLength;
+ SID Sid;
+} FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION;
+
+typedef struct _FILE_INTERNAL_INFORMATION {
+ LARGE_INTEGER IndexNumber;
+} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
+
+typedef struct _FILE_LINK_INFORMATION {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
+
+typedef struct _FILE_LOCK_INFO {
+ LARGE_INTEGER StartingByte;
+ LARGE_INTEGER Length;
+ BOOLEAN ExclusiveLock;
+ ULONG Key;
+ PFILE_OBJECT FileObject;
+ PEPROCESS Process;
+ LARGE_INTEGER EndingByte;
+} FILE_LOCK_INFO, *PFILE_LOCK_INFO;
+
+// raw internal file lock struct returned from FsRtlGetNextFileLock
+typedef struct _FILE_SHARED_LOCK_ENTRY {
+ PVOID Unknown1;
+ PVOID Unknown2;
+ FILE_LOCK_INFO FileLock;
+} FILE_SHARED_LOCK_ENTRY, *PFILE_SHARED_LOCK_ENTRY;
+
+// raw internal file lock struct returned from FsRtlGetNextFileLock
+typedef struct _FILE_EXCLUSIVE_LOCK_ENTRY {
+ LIST_ENTRY ListEntry;
+ PVOID Unknown1;
+ PVOID Unknown2;
+ FILE_LOCK_INFO FileLock;
+} FILE_EXCLUSIVE_LOCK_ENTRY, *PFILE_EXCLUSIVE_LOCK_ENTRY;
+
+typedef NTSTATUS (*PCOMPLETE_LOCK_IRP_ROUTINE) (
+ IN PVOID Context,
+ IN PIRP Irp
+);
+
+typedef VOID (NTAPI *PUNLOCK_ROUTINE) (
+ IN PVOID Context,
+ IN PFILE_LOCK_INFO FileLockInfo
+);
+
+typedef struct _FILE_LOCK {
+ PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine;
+ PUNLOCK_ROUTINE UnlockRoutine;
+ BOOLEAN FastIoIsQuestionable;
+ BOOLEAN Pad[3];
+ PVOID LockInformation;
+ FILE_LOCK_INFO LastReturnedLockInfo;
+ PVOID LastReturnedLock;
+} FILE_LOCK, *PFILE_LOCK;
+
+typedef struct _FILE_MAILSLOT_PEEK_BUFFER {
+ ULONG ReadDataAvailable;
+ ULONG NumberOfMessages;
+ ULONG MessageLength;
+} FILE_MAILSLOT_PEEK_BUFFER, *PFILE_MAILSLOT_PEEK_BUFFER;
+
+typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
+ ULONG MaximumMessageSize;
+ ULONG MailslotQuota;
+ ULONG NextMessageSize;
+ ULONG MessagesAvailable;
+ LARGE_INTEGER ReadTimeout;
+} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
+
+typedef struct _FILE_MAILSLOT_SET_INFORMATION {
+ LARGE_INTEGER ReadTimeout;
+} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
+
+typedef struct _FILE_MODE_INFORMATION {
+ ULONG Mode;
+} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
+
+typedef struct _FILE_ALL_INFORMATION {
+ FILE_BASIC_INFORMATION BasicInformation;
+ FILE_STANDARD_INFORMATION StandardInformation;
+ FILE_INTERNAL_INFORMATION InternalInformation;
+ FILE_EA_INFORMATION EaInformation;
+ FILE_ACCESS_INFORMATION AccessInformation;
+ FILE_POSITION_INFORMATION PositionInformation;
+ FILE_MODE_INFORMATION ModeInformation;
+ FILE_ALIGNMENT_INFORMATION AlignmentInformation;
+ FILE_NAME_INFORMATION NameInformation;
+} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
+
+typedef struct _FILE_NAMES_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
+
+typedef struct _FILE_OBJECTID_INFORMATION {
+ LONGLONG FileReference;
+ UCHAR ObjectId[16];
+ union {
+ struct {
+ UCHAR BirthVolumeId[16];
+ UCHAR BirthObjectId[16];
+ UCHAR DomainId[16];
+ } ;
+ UCHAR ExtendedInfo[48];
+ };
+} FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION;
+
+typedef struct _FILE_OLE_CLASSID_INFORMATION {
+ GUID ClassId;
+} FILE_OLE_CLASSID_INFORMATION, *PFILE_OLE_CLASSID_INFORMATION;
+
+typedef struct _FILE_OLE_ALL_INFORMATION {
+ FILE_BASIC_INFORMATION BasicInformation;
+ FILE_STANDARD_INFORMATION StandardInformation;
+ FILE_INTERNAL_INFORMATION InternalInformation;
+ FILE_EA_INFORMATION EaInformation;
+ FILE_ACCESS_INFORMATION AccessInformation;
+ FILE_POSITION_INFORMATION PositionInformation;
+ FILE_MODE_INFORMATION ModeInformation;
+ FILE_ALIGNMENT_INFORMATION AlignmentInformation;
+ USN LastChangeUsn;
+ USN ReplicationUsn;
+ LARGE_INTEGER SecurityChangeTime;
+ FILE_OLE_CLASSID_INFORMATION OleClassIdInformation;
+ FILE_OBJECTID_INFORMATION ObjectIdInformation;
+ FILE_STORAGE_TYPE StorageType;
+ ULONG OleStateBits;
+ ULONG OleId;
+ ULONG NumberOfStreamReferences;
+ ULONG StreamIndex;
+ ULONG SecurityId;
+ BOOLEAN ContentIndexDisable;
+ BOOLEAN InheritContentIndexDisable;
+ FILE_NAME_INFORMATION NameInformation;
+} FILE_OLE_ALL_INFORMATION, *PFILE_OLE_ALL_INFORMATION;
+
+typedef struct _FILE_OLE_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ FILE_STORAGE_TYPE StorageType;
+ GUID OleClassId;
+ ULONG OleStateBits;
+ BOOLEAN ContentIndexDisable;
+ BOOLEAN InheritContentIndexDisable;
+ WCHAR FileName[1];
+} FILE_OLE_DIR_INFORMATION, *PFILE_OLE_DIR_INFORMATION;
+
+typedef struct _FILE_OLE_INFORMATION {
+ LARGE_INTEGER SecurityChangeTime;
+ FILE_OLE_CLASSID_INFORMATION OleClassIdInformation;
+ FILE_OBJECTID_INFORMATION ObjectIdInformation;
+ FILE_STORAGE_TYPE StorageType;
+ ULONG OleStateBits;
+ BOOLEAN ContentIndexDisable;
+ BOOLEAN InheritContentIndexDisable;
+} FILE_OLE_INFORMATION, *PFILE_OLE_INFORMATION;
+
+typedef struct _FILE_OLE_STATE_BITS_INFORMATION {
+ ULONG StateBits;
+ ULONG StateBitsMask;
+} FILE_OLE_STATE_BITS_INFORMATION, *PFILE_OLE_STATE_BITS_INFORMATION;
+
+typedef struct _FILE_PIPE_ASSIGN_EVENT_BUFFER {
+ HANDLE EventHandle;
+ ULONG KeyValue;
+} FILE_PIPE_ASSIGN_EVENT_BUFFER, *PFILE_PIPE_ASSIGN_EVENT_BUFFER;
+
+typedef struct _FILE_PIPE_CLIENT_PROCESS_BUFFER {
+ PVOID ClientSession;
+ PVOID ClientProcess;
+} FILE_PIPE_CLIENT_PROCESS_BUFFER, *PFILE_PIPE_CLIENT_PROCESS_BUFFER;
+
+typedef struct _FILE_PIPE_EVENT_BUFFER {
+ ULONG NamedPipeState;
+ ULONG EntryType;
+ ULONG ByteCount;
+ ULONG KeyValue;
+ ULONG NumberRequests;
+} FILE_PIPE_EVENT_BUFFER, *PFILE_PIPE_EVENT_BUFFER;
+
+typedef struct _FILE_PIPE_INFORMATION {
+ ULONG ReadMode;
+ ULONG CompletionMode;
+} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
+
+typedef struct _FILE_PIPE_LOCAL_INFORMATION {
+ ULONG NamedPipeType;
+ ULONG NamedPipeConfiguration;
+ ULONG MaximumInstances;
+ ULONG CurrentInstances;
+ ULONG InboundQuota;
+ ULONG ReadDataAvailable;
+ ULONG OutboundQuota;
+ ULONG WriteQuotaAvailable;
+ ULONG NamedPipeState;
+ ULONG NamedPipeEnd;
+} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
+
+typedef struct _FILE_PIPE_REMOTE_INFORMATION {
+ LARGE_INTEGER CollectDataTime;
+ ULONG MaximumCollectionCount;
+} FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
+
+typedef struct _FILE_PIPE_WAIT_FOR_BUFFER {
+ LARGE_INTEGER Timeout;
+ ULONG NameLength;
+ BOOLEAN TimeoutSpecified;
+ WCHAR Name[1];
+} FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER;
+
+typedef struct _FILE_QUOTA_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG SidLength;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER QuotaUsed;
+ LARGE_INTEGER QuotaThreshold;
+ LARGE_INTEGER QuotaLimit;
+ SID Sid;
+} FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
+
+typedef struct _FILE_RENAME_INFORMATION {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
+
+typedef struct _FILE_STREAM_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG StreamNameLength;
+ LARGE_INTEGER StreamSize;
+ LARGE_INTEGER StreamAllocationSize;
+ WCHAR StreamName[1];
+} FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
+
+typedef struct _FILE_TRACKING_INFORMATION {
+ HANDLE DestinationFile;
+ ULONG ObjectInformationLength;
+ CHAR ObjectInformation[1];
+} FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION;
+
+typedef struct _FSRTL_COMMON_FCB_HEADER {
+ CSHORT NodeTypeCode;
+ CSHORT NodeByteSize;
+ UCHAR Flags;
+ UCHAR IsFastIoPossible;
+#if (VER_PRODUCTBUILD >= 1381)
+ UCHAR Flags2;
+ UCHAR Reserved;
+#endif // (VER_PRODUCTBUILD >= 1381)
+ PERESOURCE Resource;
+ PERESOURCE PagingIoResource;
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER FileSize;
+ LARGE_INTEGER ValidDataLength;
+} FSRTL_COMMON_FCB_HEADER, *PFSRTL_COMMON_FCB_HEADER;
+
+typedef struct _GENERATE_NAME_CONTEXT {
+ USHORT Checksum;
+ BOOLEAN CheckSumInserted;
+ UCHAR NameLength;
+ WCHAR NameBuffer[8];
+ ULONG ExtensionLength;
+ WCHAR ExtensionBuffer[4];
+ ULONG LastIndexValue;
+} GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
+
+typedef struct _HANDLE_TABLE_ENTRY {
+ PVOID Object;
+ ULONG ObjectAttributes;
+ ULONG GrantedAccess;
+ USHORT GrantedAccessIndex;
+ USHORT CreatorBackTraceIndex;
+ ULONG NextFreeTableEntry;
+} HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY;
+
+typedef struct _MAPPING_PAIR {
+ ULONGLONG Vcn;
+ ULONGLONG Lcn;
+} MAPPING_PAIR, *PMAPPING_PAIR;
+
+typedef struct _GET_RETRIEVAL_DESCRIPTOR {
+ ULONG NumberOfPairs;
+ ULONGLONG StartVcn;
+ MAPPING_PAIR Pair[1];
+} GET_RETRIEVAL_DESCRIPTOR, *PGET_RETRIEVAL_DESCRIPTOR;
+
+typedef struct _IO_CLIENT_EXTENSION {
+ struct _IO_CLIENT_EXTENSION *NextExtension;
+ PVOID ClientIdentificationAddress;
+} IO_CLIENT_EXTENSION, *PIO_CLIENT_EXTENSION;
+
+typedef struct _IO_COMPLETION_BASIC_INFORMATION {
+ LONG Depth;
+} IO_COMPLETION_BASIC_INFORMATION, *PIO_COMPLETION_BASIC_INFORMATION;
+
+typedef struct _KEVENT_PAIR {
+ USHORT Type;
+ USHORT Size;
+ KEVENT Event1;
+ KEVENT Event2;
+} KEVENT_PAIR, *PKEVENT_PAIR;
+
+typedef struct _KQUEUE {
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY EntryListHead;
+ ULONG CurrentCount;
+ ULONG MaximumCount;
+ LIST_ENTRY ThreadListHead;
+} KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;
+
+typedef struct _MAILSLOT_CREATE_PARAMETERS {
+ ULONG MailslotQuota;
+ ULONG MaximumMessageSize;
+ LARGE_INTEGER ReadTimeout;
+ BOOLEAN TimeoutSpecified;
+} MAILSLOT_CREATE_PARAMETERS, *PMAILSLOT_CREATE_PARAMETERS;
+
+typedef struct _MBCB {
+ CSHORT NodeTypeCode;
+ CSHORT NodeIsInZone;
+ ULONG PagesToWrite;
+ ULONG DirtyPages;
+ ULONG Reserved;
+ LIST_ENTRY BitmapRanges;
+ LONGLONG ResumeWritePage;
+ BITMAP_RANGE BitmapRange1;
+ BITMAP_RANGE BitmapRange2;
+ BITMAP_RANGE BitmapRange3;
+} MBCB, *PMBCB;
+
+typedef struct _MOVEFILE_DESCRIPTOR {
+ HANDLE FileHandle;
+ ULONG Reserved;
+ LARGE_INTEGER StartVcn;
+ LARGE_INTEGER TargetLcn;
+ ULONG NumVcns;
+ ULONG Reserved1;
+} MOVEFILE_DESCRIPTOR, *PMOVEFILE_DESCRIPTOR;
+
+typedef struct _NAMED_PIPE_CREATE_PARAMETERS {
+ ULONG NamedPipeType;
+ ULONG ReadMode;
+ ULONG CompletionMode;
+ ULONG MaximumInstances;
+ ULONG InboundQuota;
+ ULONG OutboundQuota;
+ LARGE_INTEGER DefaultTimeout;
+ BOOLEAN TimeoutSpecified;
+} NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS;
+
+typedef struct _OBJECT_BASIC_INFO {
+ ULONG Attributes;
+ ACCESS_MASK GrantedAccess;
+ ULONG HandleCount;
+ ULONG ReferenceCount;
+ ULONG PagedPoolUsage;
+ ULONG NonPagedPoolUsage;
+ ULONG Reserved[3];
+ ULONG NameInformationLength;
+ ULONG TypeInformationLength;
+ ULONG SecurityDescriptorLength;
+ LARGE_INTEGER CreateTime;
+} OBJECT_BASIC_INFO, *POBJECT_BASIC_INFO;
+
+typedef struct _OBJECT_HANDLE_ATTRIBUTE_INFO {
+ BOOLEAN Inherit;
+ BOOLEAN ProtectFromClose;
+} OBJECT_HANDLE_ATTRIBUTE_INFO, *POBJECT_HANDLE_ATTRIBUTE_INFO;
+
+typedef struct _OBJECT_NAME_INFO {
+ UNICODE_STRING ObjectName;
+ WCHAR ObjectNameBuffer[1];
+} OBJECT_NAME_INFO, *POBJECT_NAME_INFO;
+
+typedef struct _OBJECT_PROTECTION_INFO {
+ BOOLEAN Inherit;
+ BOOLEAN ProtectHandle;
+} OBJECT_PROTECTION_INFO, *POBJECT_PROTECTION_INFO;
+
+typedef struct _OBJECT_TYPE_INFO {
+ UNICODE_STRING ObjectTypeName;
+ UCHAR Unknown[0x58];
+ WCHAR ObjectTypeNameBuffer[1];
+} OBJECT_TYPE_INFO, *POBJECT_TYPE_INFO;
+
+typedef struct _OBJECT_ALL_TYPES_INFO {
+ ULONG NumberOfObjectTypes;
+ OBJECT_TYPE_INFO ObjectsTypeInfo[1];
+} OBJECT_ALL_TYPES_INFO, *POBJECT_ALL_TYPES_INFO;
+
+typedef struct _PAGEFAULT_HISTORY {
+ ULONG CurrentIndex;
+ ULONG MaxIndex;
+ KSPIN_LOCK SpinLock;
+ PVOID Reserved;
+ PROCESS_WS_WATCH_INFORMATION WatchInfo[1];
+} PAGEFAULT_HISTORY, *PPAGEFAULT_HISTORY;
+
+typedef struct _PATHNAME_BUFFER {
+ ULONG PathNameLength;
+ WCHAR Name[1];
+} PATHNAME_BUFFER, *PPATHNAME_BUFFER;
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _PRIVATE_CACHE_MAP_FLAGS {
+ ULONG DontUse : 16;
+ ULONG ReadAheadActive : 1;
+ ULONG ReadAheadEnabled : 1;
+ ULONG Available : 14;
+} PRIVATE_CACHE_MAP_FLAGS, *PPRIVATE_CACHE_MAP_FLAGS;
+
+typedef struct _PRIVATE_CACHE_MAP {
+ union {
+ CSHORT NodeTypeCode;
+ PRIVATE_CACHE_MAP_FLAGS Flags;
+ ULONG UlongFlags;
+ };
+ ULONG ReadAheadMask;
+ PFILE_OBJECT FileObject;
+ LARGE_INTEGER FileOffset1;
+ LARGE_INTEGER BeyondLastByte1;
+ LARGE_INTEGER FileOffset2;
+ LARGE_INTEGER BeyondLastByte2;
+ LARGE_INTEGER ReadAheadOffset[2];
+ ULONG ReadAheadLength[2];
+ KSPIN_LOCK ReadAheadSpinLock;
+ LIST_ENTRY PrivateLinks;
+} PRIVATE_CACHE_MAP, *PPRIVATE_CACHE_MAP;
+
+#endif
+
+typedef struct _PS_IMPERSONATION_INFORMATION {
+ PACCESS_TOKEN Token;
+ BOOLEAN CopyOnOpen;
+ BOOLEAN EffectiveOnly;
+ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+} PS_IMPERSONATION_INFORMATION, *PPS_IMPERSONATION_INFORMATION;
+
+typedef struct _PUBLIC_BCB {
+ CSHORT NodeTypeCode;
+ CSHORT NodeByteSize;
+ ULONG MappedLength;
+ LARGE_INTEGER MappedFileOffset;
+} PUBLIC_BCB, *PPUBLIC_BCB;
+
+typedef struct _QUERY_PATH_REQUEST {
+ ULONG PathNameLength;
+ PIO_SECURITY_CONTEXT SecurityContext;
+ WCHAR FilePathName[1];
+} QUERY_PATH_REQUEST, *PQUERY_PATH_REQUEST;
+
+typedef struct _QUERY_PATH_RESPONSE {
+ ULONG LengthAccepted;
+} QUERY_PATH_RESPONSE, *PQUERY_PATH_RESPONSE;
+
+typedef struct _RETRIEVAL_POINTERS_BUFFER {
+ ULONG ExtentCount;
+ LARGE_INTEGER StartingVcn;
+ struct {
+ LARGE_INTEGER NextVcn;
+ LARGE_INTEGER Lcn;
+ } Extents[1];
+} RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER;
+
+typedef struct _RTL_SPLAY_LINKS {
+ struct _RTL_SPLAY_LINKS *Parent;
+ struct _RTL_SPLAY_LINKS *LeftChild;
+ struct _RTL_SPLAY_LINKS *RightChild;
+} RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
+
+typedef struct _SE_EXPORTS {
+
+ LUID SeCreateTokenPrivilege;
+ LUID SeAssignPrimaryTokenPrivilege;
+ LUID SeLockMemoryPrivilege;
+ LUID SeIncreaseQuotaPrivilege;
+ LUID SeUnsolicitedInputPrivilege;
+ LUID SeTcbPrivilege;
+ LUID SeSecurityPrivilege;
+ LUID SeTakeOwnershipPrivilege;
+ LUID SeLoadDriverPrivilege;
+ LUID SeCreatePagefilePrivilege;
+ LUID SeIncreaseBasePriorityPrivilege;
+ LUID SeSystemProfilePrivilege;
+ LUID SeSystemtimePrivilege;
+ LUID SeProfileSingleProcessPrivilege;
+ LUID SeCreatePermanentPrivilege;
+ LUID SeBackupPrivilege;
+ LUID SeRestorePrivilege;
+ LUID SeShutdownPrivilege;
+ LUID SeDebugPrivilege;
+ LUID SeAuditPrivilege;
+ LUID SeSystemEnvironmentPrivilege;
+ LUID SeChangeNotifyPrivilege;
+ LUID SeRemoteShutdownPrivilege;
+
+ PSID SeNullSid;
+ PSID SeWorldSid;
+ PSID SeLocalSid;
+ PSID SeCreatorOwnerSid;
+ PSID SeCreatorGroupSid;
+
+ PSID SeNtAuthoritySid;
+ PSID SeDialupSid;
+ PSID SeNetworkSid;
+ PSID SeBatchSid;
+ PSID SeInteractiveSid;
+ PSID SeLocalSystemSid;
+ PSID SeAliasAdminsSid;
+ PSID SeAliasUsersSid;
+ PSID SeAliasGuestsSid;
+ PSID SeAliasPowerUsersSid;
+ PSID SeAliasAccountOpsSid;
+ PSID SeAliasSystemOpsSid;
+ PSID SeAliasPrintOpsSid;
+ PSID SeAliasBackupOpsSid;
+
+ PSID SeAuthenticatedUsersSid;
+
+ PSID SeRestrictedSid;
+ PSID SeAnonymousLogonSid;
+
+ LUID SeUndockPrivilege;
+ LUID SeSyncAgentPrivilege;
+ LUID SeEnableDelegationPrivilege;
+
+} SE_EXPORTS, *PSE_EXPORTS;
+
+typedef struct _SECTION_BASIC_INFORMATION {
+ PVOID BaseAddress;
+ ULONG Attributes;
+ LARGE_INTEGER Size;
+} SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
+
+typedef struct _SECTION_IMAGE_INFORMATION {
+ PVOID EntryPoint;
+ ULONG Unknown1;
+ ULONG StackReserve;
+ ULONG StackCommit;
+ ULONG Subsystem;
+ USHORT MinorSubsystemVersion;
+ USHORT MajorSubsystemVersion;
+ ULONG Unknown2;
+ ULONG Characteristics;
+ USHORT ImageNumber;
+ BOOLEAN Executable;
+ UCHAR Unknown3;
+ ULONG Unknown4[3];
+} SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _SHARED_CACHE_MAP {
+ CSHORT NodeTypeCode;
+ CSHORT NodeByteSize;
+ ULONG OpenCount;
+ LARGE_INTEGER FileSize;
+ LIST_ENTRY BcbList;
+ LARGE_INTEGER SectionSize;
+ LARGE_INTEGER ValidDataLength;
+ LARGE_INTEGER ValidDataGoal;
+ PVACB InitialVacbs[4];
+ PVACB *Vacbs;
+ PFILE_OBJECT FileObject;
+ PVACB ActiveVacb;
+ PVOID NeedToZero;
+ ULONG ActivePage;
+ ULONG NeedToZeroPage;
+ KSPIN_LOCK ActiveVacbSpinLock;
+ ULONG VacbActiveCount;
+ ULONG DirtyPages;
+ LIST_ENTRY SharedCacheMapLinks;
+ ULONG Flags;
+ NTSTATUS Status;
+ PMBCB Mbcb;
+ PVOID Section;
+ PKEVENT CreateEvent;
+ PKEVENT WaitOnActiveCount;
+ ULONG PagesToWrite;
+ LONGLONG BeyondLastFlush;
+ PCACHE_MANAGER_CALLBACKS Callbacks;
+ PVOID LazyWriteContext;
+ LIST_ENTRY PrivateList;
+ PVOID LogHandle;
+ PVOID FlushToLsnRoutine;
+ ULONG DirtyPageThreshold;
+ ULONG LazyWritePassCount;
+ PCACHE_UNINITIALIZE_EVENT UninitializeEvent;
+ PVACB NeedToZeroVacb;
+ KSPIN_LOCK BcbSpinLock;
+ PVOID Reserved;
+ KEVENT Event;
+ EX_PUSH_LOCK VacbPushLock;
+ PRIVATE_CACHE_MAP PrivateCacheMap;
+} SHARED_CACHE_MAP, *PSHARED_CACHE_MAP;
+
+#endif
+
+typedef struct _STARTING_VCN_INPUT_BUFFER {
+ LARGE_INTEGER StartingVcn;
+} STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER;
+
+typedef struct _SYSTEM_CACHE_INFORMATION {
+ ULONG CurrentSize;
+ ULONG PeakSize;
+ ULONG PageFaultCount;
+ ULONG MinimumWorkingSet;
+ ULONG MaximumWorkingSet;
+ ULONG Unused[4];
+} SYSTEM_CACHE_INFORMATION, *PSYSTEM_CACHE_INFORMATION;
+
+typedef struct _TERMINATION_PORT {
+ struct _TERMINATION_PORT* Next;
+ PVOID Port;
+} TERMINATION_PORT, *PTERMINATION_PORT;
+
+typedef struct _SECURITY_CLIENT_CONTEXT {
+ SECURITY_QUALITY_OF_SERVICE SecurityQos;
+ PACCESS_TOKEN ClientToken;
+ BOOLEAN DirectlyAccessClientToken;
+ BOOLEAN DirectAccessEffectiveOnly;
+ BOOLEAN ServerIsRemote;
+ TOKEN_CONTROL ClientTokenControl;
+} SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT;
+
+typedef struct _TUNNEL {
+ FAST_MUTEX Mutex;
+ PRTL_SPLAY_LINKS Cache;
+ LIST_ENTRY TimerQueue;
+ USHORT NumEntries;
+} TUNNEL, *PTUNNEL;
+
+typedef struct _VACB {
+ PVOID BaseAddress;
+ PSHARED_CACHE_MAP SharedCacheMap;
+ union {
+ LARGE_INTEGER FileOffset;
+ USHORT ActiveCount;
+ } Overlay;
+ LIST_ENTRY LruList;
+} VACB, *PVACB;
+
+typedef struct _VAD_HEADER {
+ PVOID StartVPN;
+ PVOID EndVPN;
+ PVAD_HEADER ParentLink;
+ PVAD_HEADER LeftLink;
+ PVAD_HEADER RightLink;
+ ULONG Flags; // LSB = CommitCharge
+ PVOID ControlArea;
+ PVOID FirstProtoPte;
+ PVOID LastPTE;
+ ULONG Unknown;
+ LIST_ENTRY Secured;
+} VAD_HEADER, *PVAD_HEADER;
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcCanIWrite (
+ IN PFILE_OBJECT FileObject,
+ IN ULONG BytesToWrite,
+ IN BOOLEAN Wait,
+ IN BOOLEAN Retrying
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcCopyRead (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcCopyWrite (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN PVOID Buffer
+);
+
+#define CcCopyWriteWontFlush(FO, FOFF, LEN) ((LEN) <= 0x10000)
+
+typedef VOID (NTAPI *PCC_POST_DEFERRED_WRITE) (
+ IN PVOID Context1,
+ IN PVOID Context2
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcDeferWrite (
+ IN PFILE_OBJECT FileObject,
+ IN PCC_POST_DEFERRED_WRITE PostRoutine,
+ IN PVOID Context1,
+ IN PVOID Context2,
+ IN ULONG BytesToWrite,
+ IN BOOLEAN Retrying
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcFastCopyRead (
+ IN PFILE_OBJECT FileObject,
+ IN ULONG FileOffset,
+ IN ULONG Length,
+ IN ULONG PageCount,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcFastCopyWrite (
+ IN PFILE_OBJECT FileObject,
+ IN ULONG FileOffset,
+ IN ULONG Length,
+ IN PVOID Buffer
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcFlushCache (
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN PLARGE_INTEGER FileOffset OPTIONAL,
+ IN ULONG Length,
+ OUT PIO_STATUS_BLOCK IoStatus OPTIONAL
+);
+
+typedef VOID (*PDIRTY_PAGE_ROUTINE) (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN PLARGE_INTEGER OldestLsn,
+ IN PLARGE_INTEGER NewestLsn,
+ IN PVOID Context1,
+ IN PVOID Context2
+);
+
+NTKERNELAPI
+LARGE_INTEGER
+NTAPI
+CcGetDirtyPages (
+ IN PVOID LogHandle,
+ IN PDIRTY_PAGE_ROUTINE DirtyPageRoutine,
+ IN PVOID Context1,
+ IN PVOID Context2
+);
+
+NTKERNELAPI
+PFILE_OBJECT
+NTAPI
+CcGetFileObjectFromBcb (
+ IN PVOID Bcb
+);
+
+NTKERNELAPI
+PFILE_OBJECT
+NTAPI
+CcGetFileObjectFromSectionPtrs (
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer
+);
+
+#define CcGetFileSizePointer(FO) ( \
+ ((PLARGE_INTEGER)((FO)->SectionObjectPointer->SharedCacheMap) + 1) \
+)
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+LARGE_INTEGER
+NTAPI
+CcGetFlushedValidData (
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN BOOLEAN BcbListHeld
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+LARGE_INTEGER
+CcGetLsnForFileObject (
+ IN PFILE_OBJECT FileObject,
+ OUT PLARGE_INTEGER OldestLsn OPTIONAL
+);
+
+typedef BOOLEAN (NTAPI *PACQUIRE_FOR_LAZY_WRITE) (
+ IN PVOID Context,
+ IN BOOLEAN Wait
+);
+
+typedef VOID (NTAPI *PRELEASE_FROM_LAZY_WRITE) (
+ IN PVOID Context
+);
+
+typedef BOOLEAN (NTAPI *PACQUIRE_FOR_READ_AHEAD) (
+ IN PVOID Context,
+ IN BOOLEAN Wait
+);
+
+typedef VOID (NTAPI *PRELEASE_FROM_READ_AHEAD) (
+ IN PVOID Context
+);
+
+typedef struct _CACHE_MANAGER_CALLBACKS {
+ PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite;
+ PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite;
+ PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead;
+ PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead;
+} CACHE_MANAGER_CALLBACKS, *PCACHE_MANAGER_CALLBACKS;
+
+NTKERNELAPI
+VOID
+NTAPI
+CcInitializeCacheMap (
+ IN PFILE_OBJECT FileObject,
+ IN PCC_FILE_SIZES FileSizes,
+ IN BOOLEAN PinAccess,
+ IN PCACHE_MANAGER_CALLBACKS Callbacks,
+ IN PVOID LazyWriteContext
+);
+
+#define CcIsFileCached(FO) ( \
+ ((FO)->SectionObjectPointer != NULL) && \
+ (((PSECTION_OBJECT_POINTERS)(FO)->SectionObjectPointer)->SharedCacheMap != NULL) \
+)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcIsThereDirtyData (
+ IN PVPB Vpb
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcMapData (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ OUT PVOID *Bcb,
+ OUT PVOID *Buffer
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcMdlRead (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcMdlReadComplete (
+ IN PFILE_OBJECT FileObject,
+ IN PMDL MdlChain
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcMdlWriteComplete (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PMDL MdlChain
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcPinMappedData (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+#if (VER_PRODUCTBUILD >= 2195)
+ IN ULONG Flags,
+#else
+ IN BOOLEAN Wait,
+#endif
+ IN OUT PVOID *Bcb
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcPinRead (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+#if (VER_PRODUCTBUILD >= 2195)
+ IN ULONG Flags,
+#else
+ IN BOOLEAN Wait,
+#endif
+ OUT PVOID *Bcb,
+ OUT PVOID *Buffer
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcPrepareMdlWrite (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcPreparePinWrite (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Zero,
+#if (VER_PRODUCTBUILD >= 2195)
+ IN ULONG Flags,
+#else
+ IN BOOLEAN Wait,
+#endif
+ OUT PVOID *Bcb,
+ OUT PVOID *Buffer
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcPurgeCacheSection (
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN PLARGE_INTEGER FileOffset OPTIONAL,
+ IN ULONG Length,
+ IN BOOLEAN UninitializeCacheMaps
+);
+
+#define CcReadAhead(FO, FOFF, LEN) ( \
+ if ((LEN) >= 256) { \
+ CcScheduleReadAhead((FO), (FOFF), (LEN)); \
+ } \
+)
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+PVOID
+NTAPI
+CcRemapBcb (
+ IN PVOID Bcb
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+VOID
+NTAPI
+CcRepinBcb (
+ IN PVOID Bcb
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcScheduleReadAhead (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcSetAdditionalCacheAttributes (
+ IN PFILE_OBJECT FileObject,
+ IN BOOLEAN DisableReadAhead,
+ IN BOOLEAN DisableWriteBehind
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcSetBcbOwnerPointer (
+ IN PVOID Bcb,
+ IN PVOID OwnerPointer
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcSetDirtyPageThreshold (
+ IN PFILE_OBJECT FileObject,
+ IN ULONG DirtyPageThreshold
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcSetDirtyPinnedData (
+ IN PVOID BcbVoid,
+ IN PLARGE_INTEGER Lsn OPTIONAL
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcSetFileSizes (
+ IN PFILE_OBJECT FileObject,
+ IN PCC_FILE_SIZES FileSizes
+);
+
+typedef VOID (NTAPI *PFLUSH_TO_LSN) (
+ IN PVOID LogHandle,
+ IN PLARGE_INTEGER Lsn
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcSetLogHandleForFile (
+ IN PFILE_OBJECT FileObject,
+ IN PVOID LogHandle,
+ IN PFLUSH_TO_LSN FlushToLsnRoutine
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcSetReadAheadGranularity (
+ IN PFILE_OBJECT FileObject,
+ IN ULONG Granularity // default: PAGE_SIZE
+ // allowed: 2^n * PAGE_SIZE
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcUninitializeCacheMap (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER TruncateSize OPTIONAL,
+ IN PCACHE_UNINITIALIZE_EVENT UninitializeCompleteEvent OPTIONAL
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcUnpinData (
+ IN PVOID Bcb
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcUnpinDataForThread (
+ IN PVOID Bcb,
+ IN ERESOURCE_THREAD ResourceThreadId
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+CcUnpinRepinnedBcb (
+ IN PVOID Bcb,
+ IN BOOLEAN WriteThrough,
+ OUT PIO_STATUS_BLOCK IoStatus
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+CcWaitForCurrentLazyWriterActivity (
+ VOID
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+CcZeroData (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER StartOffset,
+ IN PLARGE_INTEGER EndOffset,
+ IN BOOLEAN Wait
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+ExDisableResourceBoostLite (
+ IN PERESOURCE Resource
+);
+
+NTKERNELAPI
+ULONG
+NTAPI
+ExQueryPoolBlockSize (
+ IN PVOID PoolBlock,
+ OUT PBOOLEAN QuotaCharged
+);
+
+#define FlagOn(x, f) ((x) & (f))
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlAddToTunnelCache (
+ IN PTUNNEL Cache,
+ IN ULONGLONG DirectoryKey,
+ IN PUNICODE_STRING ShortName,
+ IN PUNICODE_STRING LongName,
+ IN BOOLEAN KeyByShortName,
+ IN ULONG DataLength,
+ IN PVOID Data
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+PFILE_LOCK
+NTAPI
+FsRtlAllocateFileLock (
+ IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL,
+ IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+PVOID
+NTAPI
+FsRtlAllocatePool (
+ IN POOL_TYPE PoolType,
+ IN ULONG NumberOfBytes
+);
+
+NTKERNELAPI
+PVOID
+NTAPI
+FsRtlAllocatePoolWithQuota (
+ IN POOL_TYPE PoolType,
+ IN ULONG NumberOfBytes
+);
+
+NTKERNELAPI
+PVOID
+NTAPI
+FsRtlAllocatePoolWithQuotaTag (
+ IN POOL_TYPE PoolType,
+ IN ULONG NumberOfBytes,
+ IN ULONG Tag
+);
+
+NTKERNELAPI
+PVOID
+NTAPI
+FsRtlAllocatePoolWithTag (
+ IN POOL_TYPE PoolType,
+ IN ULONG NumberOfBytes,
+ IN ULONG Tag
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlAreNamesEqual (
+ IN PUNICODE_STRING Name1,
+ IN PUNICODE_STRING Name2,
+ IN BOOLEAN IgnoreCase,
+ IN PWCHAR UpcaseTable OPTIONAL
+);
+
+#define FsRtlAreThereCurrentFileLocks(FL) ( \
+ ((FL)->FastIoIsQuestionable) \
+)
+
+/*
+ FsRtlCheckLockForReadAccess:
+
+ All this really does is pick out the lock parameters from the irp (io stack
+ location?), get IoGetRequestorProcess, and pass values on to
+ FsRtlFastCheckLockForRead.
+*/
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlCheckLockForReadAccess (
+ IN PFILE_LOCK FileLock,
+ IN PIRP Irp
+);
+
+/*
+ FsRtlCheckLockForWriteAccess:
+
+ All this really does is pick out the lock parameters from the irp (io stack
+ location?), get IoGetRequestorProcess, and pass values on to
+ FsRtlFastCheckLockForWrite.
+*/
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlCheckLockForWriteAccess (
+ IN PFILE_LOCK FileLock,
+ IN PIRP Irp
+);
+
+typedef
+VOID NTAPI
+(*POPLOCK_WAIT_COMPLETE_ROUTINE) (
+ IN PVOID Context,
+ IN PIRP Irp
+);
+
+typedef
+VOID NTAPI
+(*POPLOCK_FS_PREPOST_IRP) (
+ IN PVOID Context,
+ IN PIRP Irp
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlCheckOplock (
+ IN POPLOCK Oplock,
+ IN PIRP Irp,
+ IN PVOID Context,
+ IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL,
+ IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlCopyRead (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlCopyWrite (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ IN PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlCurrentBatchOplock (
+ IN POPLOCK Oplock
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlDeleteKeyFromTunnelCache (
+ IN PTUNNEL Cache,
+ IN ULONGLONG DirectoryKey
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlDeleteTunnelCache (
+ IN PTUNNEL Cache
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlDeregisterUncProvider (
+ IN HANDLE Handle
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlDoesNameContainWildCards (
+ IN PUNICODE_STRING Name
+);
+
+#define FsRtlEnterFileSystem KeEnterCriticalRegion
+
+#define FsRtlExitFileSystem KeLeaveCriticalRegion
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlFastCheckLockForRead (
+ IN PFILE_LOCK FileLock,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ IN ULONG Key,
+ IN PFILE_OBJECT FileObject,
+ IN PEPROCESS Process
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlFastCheckLockForWrite (
+ IN PFILE_LOCK FileLock,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ IN ULONG Key,
+ IN PFILE_OBJECT FileObject,
+ IN PEPROCESS Process
+);
+
+#define FsRtlFastLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) ( \
+ FsRtlPrivateLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, NULL, A10, A11) \
+)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlFastUnlockAll (
+ IN PFILE_LOCK FileLock,
+ IN PFILE_OBJECT FileObject,
+ IN PEPROCESS Process,
+ IN PVOID Context OPTIONAL
+);
+//ret: STATUS_RANGE_NOT_LOCKED
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlFastUnlockAllByKey (
+ IN PFILE_LOCK FileLock,
+ IN PFILE_OBJECT FileObject,
+ IN PEPROCESS Process,
+ IN ULONG Key,
+ IN PVOID Context OPTIONAL
+);
+//ret: STATUS_RANGE_NOT_LOCKED
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlFastUnlockSingle (
+ IN PFILE_LOCK FileLock,
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ IN PEPROCESS Process,
+ IN ULONG Key,
+ IN PVOID Context OPTIONAL,
+ IN BOOLEAN AlreadySynchronized
+);
+//ret: STATUS_RANGE_NOT_LOCKED
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlFindInTunnelCache (
+ IN PTUNNEL Cache,
+ IN ULONGLONG DirectoryKey,
+ IN PUNICODE_STRING Name,
+ OUT PUNICODE_STRING ShortName,
+ OUT PUNICODE_STRING LongName,
+ IN OUT PULONG DataLength,
+ OUT PVOID Data
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlFreeFileLock (
+ IN PFILE_LOCK FileLock
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlGetFileSize (
+ IN PFILE_OBJECT FileObject,
+ IN OUT PLARGE_INTEGER FileSize
+);
+
+/*
+ FsRtlGetNextFileLock:
+
+ ret: NULL if no more locks
+
+ Internals:
+ FsRtlGetNextFileLock uses FileLock->LastReturnedLockInfo and
+ FileLock->LastReturnedLock as storage.
+ LastReturnedLock is a pointer to the 'raw' lock inkl. double linked
+ list, and FsRtlGetNextFileLock needs this to get next lock on subsequent
+ calls with Restart = FALSE.
+*/
+NTKERNELAPI
+PFILE_LOCK_INFO
+NTAPI
+FsRtlGetNextFileLock (
+ IN PFILE_LOCK FileLock,
+ IN BOOLEAN Restart
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlInitializeFileLock (
+ IN PFILE_LOCK FileLock,
+ IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL,
+ IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlInitializeOplock (
+ IN OUT POPLOCK Oplock
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlInitializeTunnelCache (
+ IN PTUNNEL Cache
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlIsNameInExpression (
+ IN PUNICODE_STRING Expression,
+ IN PUNICODE_STRING Name,
+ IN BOOLEAN IgnoreCase,
+ IN PWCHAR UpcaseTable OPTIONAL
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlIsNtstatusExpected (
+ IN NTSTATUS Ntstatus
+);
+
+#define FsRtlIsUnicodeCharacterWild(C) ( \
+ (((C) >= 0x40) ? \
+ FALSE : \
+ FlagOn((*FsRtlLegalAnsiCharacterArray)[(C)], FSRTL_WILD_CHARACTER )) \
+)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlMdlReadComplete (
+ IN PFILE_OBJECT FileObject,
+ IN PMDL MdlChain
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlMdlReadCompleteDev (
+ IN PFILE_OBJECT FileObject,
+ IN PMDL MdlChain,
+ IN PDEVICE_OBJECT DeviceObject
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlMdlWriteComplete (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PMDL MdlChain
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlMdlWriteCompleteDev (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PMDL MdlChain,
+ IN PDEVICE_OBJECT DeviceObject
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlNormalizeNtstatus (
+ IN NTSTATUS Exception,
+ IN NTSTATUS GenericException
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlNotifyChangeDirectory (
+ IN PNOTIFY_SYNC NotifySync,
+ IN PVOID FsContext,
+ IN PSTRING FullDirectoryName,
+ IN PLIST_ENTRY NotifyList,
+ IN BOOLEAN WatchTree,
+ IN ULONG CompletionFilter,
+ IN PIRP NotifyIrp
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlNotifyCleanup (
+ IN PNOTIFY_SYNC NotifySync,
+ IN PLIST_ENTRY NotifyList,
+ IN PVOID FsContext
+);
+
+typedef BOOLEAN (*PCHECK_FOR_TRAVERSE_ACCESS) (
+ IN PVOID NotifyContext,
+ IN PVOID TargetContext,
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlNotifyFullChangeDirectory (
+ IN PNOTIFY_SYNC NotifySync,
+ IN PLIST_ENTRY NotifyList,
+ IN PVOID FsContext,
+ IN PSTRING FullDirectoryName,
+ IN BOOLEAN WatchTree,
+ IN BOOLEAN IgnoreBuffer,
+ IN ULONG CompletionFilter,
+ IN PIRP NotifyIrp,
+ IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL,
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlNotifyFullReportChange (
+ IN PNOTIFY_SYNC NotifySync,
+ IN PLIST_ENTRY NotifyList,
+ IN PSTRING FullTargetName,
+ IN USHORT TargetNameOffset,
+ IN PSTRING StreamName OPTIONAL,
+ IN PSTRING NormalizedParentName OPTIONAL,
+ IN ULONG FilterMatch,
+ IN ULONG Action,
+ IN PVOID TargetContext
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlNotifyInitializeSync (
+ IN PNOTIFY_SYNC NotifySync
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlNotifyReportChange (
+ IN PNOTIFY_SYNC NotifySync,
+ IN PLIST_ENTRY NotifyList,
+ IN PSTRING FullTargetName,
+ IN PUSHORT FileNamePartLength,
+ IN ULONG FilterMatch
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlNotifyUninitializeSync (
+ IN PNOTIFY_SYNC NotifySync
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlNotifyVolumeEvent (
+ IN PFILE_OBJECT FileObject,
+ IN ULONG EventCode
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlOplockFsctrl (
+ IN POPLOCK Oplock,
+ IN PIRP Irp,
+ IN ULONG OpenCount
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlOplockIsFastIoPossible (
+ IN POPLOCK Oplock
+);
+
+/*
+ FsRtlPrivateLock:
+
+ ret: IoStatus->Status: STATUS_PENDING, STATUS_LOCK_NOT_GRANTED
+
+ Internals:
+ -Calls IoCompleteRequest if Irp
+ -Uses exception handling / ExRaiseStatus with STATUS_INSUFFICIENT_RESOURCES
+*/
+NTKERNELAPI
+BOOLEAN
+NTAPI
+FsRtlPrivateLock (
+ IN PFILE_LOCK FileLock,
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ IN PEPROCESS Process,
+ IN ULONG Key,
+ IN BOOLEAN FailImmediately,
+ IN BOOLEAN ExclusiveLock,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PIRP Irp OPTIONAL,
+ IN PVOID Context,
+ IN BOOLEAN AlreadySynchronized
+);
+
+/*
+ FsRtlProcessFileLock:
+
+ ret:
+ -STATUS_INVALID_DEVICE_REQUEST
+ -STATUS_RANGE_NOT_LOCKED from unlock routines.
+ -STATUS_PENDING, STATUS_LOCK_NOT_GRANTED from FsRtlPrivateLock
+ (redirected IoStatus->Status).
+
+ Internals:
+ -switch ( Irp->CurrentStackLocation->MinorFunction )
+ lock: return FsRtlPrivateLock;
+ unlocksingle: return FsRtlFastUnlockSingle;
+ unlockall: return FsRtlFastUnlockAll;
+ unlockallbykey: return FsRtlFastUnlockAllByKey;
+ default: IofCompleteRequest with STATUS_INVALID_DEVICE_REQUEST;
+ return STATUS_INVALID_DEVICE_REQUEST;
+
+ -'AllwaysZero' is passed thru as 'AllwaysZero' to lock / unlock routines.
+ -'Irp' is passet thru as 'Irp' to FsRtlPrivateLock.
+*/
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlProcessFileLock (
+ IN PFILE_LOCK FileLock,
+ IN PIRP Irp,
+ IN PVOID Context OPTIONAL
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+FsRtlRegisterUncProvider (
+ IN OUT PHANDLE MupHandle,
+ IN PUNICODE_STRING RedirectorDeviceName,
+ IN BOOLEAN MailslotsSupported
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlUninitializeFileLock (
+ IN PFILE_LOCK FileLock
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+FsRtlUninitializeOplock (
+ IN OUT POPLOCK Oplock
+);
+
+NTSYSAPI
+VOID
+NTAPI
+HalDisplayString (
+ IN PCHAR String
+);
+
+NTSYSAPI
+VOID
+NTAPI
+HalQueryRealTimeClock (
+ IN OUT PTIME_FIELDS TimeFields
+);
+
+NTSYSAPI
+VOID
+NTAPI
+HalSetRealTimeClock (
+ IN PTIME_FIELDS TimeFields
+);
+
+#define InitializeMessageHeader(m, l, t) { \
+ (m)->Length = (USHORT)(l); \
+ (m)->DataLength = (USHORT)(l - sizeof( LPC_MESSAGE )); \
+ (m)->MessageType = (USHORT)(t); \
+ (m)->DataInfoOffset = 0; \
+}
+
+NTKERNELAPI
+VOID
+NTAPI
+IoAcquireVpbSpinLock (
+ OUT PKIRQL Irql
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoCheckDesiredAccess (
+ IN OUT PACCESS_MASK DesiredAccess,
+ IN ACCESS_MASK GrantedAccess
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoCheckEaBufferValidity (
+ IN PFILE_FULL_EA_INFORMATION EaBuffer,
+ IN ULONG EaLength,
+ OUT PULONG ErrorOffset
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoCheckFunctionAccess (
+ IN ACCESS_MASK GrantedAccess,
+ IN UCHAR MajorFunction,
+ IN UCHAR MinorFunction,
+ IN ULONG IoControlCode,
+ IN PFILE_INFORMATION_CLASS FileInformationClass OPTIONAL,
+ IN PFS_INFORMATION_CLASS FsInformationClass OPTIONAL
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoCheckQuotaBufferValidity (
+ IN PFILE_QUOTA_INFORMATION QuotaBuffer,
+ IN ULONG QuotaLength,
+ OUT PULONG ErrorOffset
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+PFILE_OBJECT
+NTAPI
+IoCreateStreamFileObject (
+ IN PFILE_OBJECT FileObject OPTIONAL,
+ IN PDEVICE_OBJECT DeviceObject OPTIONAL
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+PFILE_OBJECT
+NTAPI
+IoCreateStreamFileObjectLite (
+ IN PFILE_OBJECT FileObject OPTIONAL,
+ IN PDEVICE_OBJECT DeviceObject OPTIONAL
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+IoFastQueryNetworkAttributes (
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG OpenOptions,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ OUT PFILE_NETWORK_OPEN_INFORMATION Buffer
+);
+
+NTKERNELAPI
+PDEVICE_OBJECT
+NTAPI
+IoGetAttachedDevice (
+ IN PDEVICE_OBJECT DeviceObject
+);
+
+NTKERNELAPI
+PDEVICE_OBJECT
+NTAPI
+IoGetBaseFileSystemDeviceObject (
+ IN PFILE_OBJECT FileObject
+);
+
+NTKERNELAPI
+PEPROCESS
+NTAPI
+IoGetRequestorProcess (
+ IN PIRP Irp
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+ULONG
+NTAPI
+IoGetRequestorProcessId (
+ IN PIRP Irp
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+PIRP
+NTAPI
+IoGetTopLevelIrp (
+ VOID
+);
+
+#define IoIsFileOpenedExclusively(FileObject) ( \
+ (BOOLEAN) !( \
+ (FileObject)->SharedRead || \
+ (FileObject)->SharedWrite || \
+ (FileObject)->SharedDelete \
+ ) \
+)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+IoIsOperationSynchronous (
+ IN PIRP Irp
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+IoIsSystemThread (
+ IN PETHREAD Thread
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+IoIsValidNameGraftingBuffer (
+ IN PIRP Irp,
+ IN PREPARSE_DATA_BUFFER ReparseBuffer
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoPageRead (
+ IN PFILE_OBJECT FileObject,
+ IN PMDL Mdl,
+ IN PLARGE_INTEGER Offset,
+ IN PKEVENT Event,
+ OUT PIO_STATUS_BLOCK IoStatusBlock
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoQueryFileInformation (
+ IN PFILE_OBJECT FileObject,
+ IN FILE_INFORMATION_CLASS FileInformationClass,
+ IN ULONG Length,
+ OUT PVOID FileInformation,
+ OUT PULONG ReturnedLength
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoQueryVolumeInformation (
+ IN PFILE_OBJECT FileObject,
+ IN FS_INFORMATION_CLASS FsInformationClass,
+ IN ULONG Length,
+ OUT PVOID FsInformation,
+ OUT PULONG ReturnedLength
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+IoRegisterFileSystem (
+ IN OUT PDEVICE_OBJECT DeviceObject
+);
+
+#if (VER_PRODUCTBUILD >= 1381)
+
+typedef VOID (NTAPI *PDRIVER_FS_NOTIFICATION) (
+ IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN DriverActive
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoRegisterFsRegistrationChange (
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine
+);
+
+#endif // (VER_PRODUCTBUILD >= 1381)
+
+NTKERNELAPI
+VOID
+NTAPI
+IoReleaseVpbSpinLock (
+ IN KIRQL Irql
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+IoSetDeviceToVerify (
+ IN PETHREAD Thread,
+ IN PDEVICE_OBJECT DeviceObject
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoSetInformation (
+ IN PFILE_OBJECT FileObject,
+ IN FILE_INFORMATION_CLASS FileInformationClass,
+ IN ULONG Length,
+ IN PVOID FileInformation
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+IoSetTopLevelIrp (
+ IN PIRP Irp
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoSynchronousPageWrite (
+ IN PFILE_OBJECT FileObject,
+ IN PMDL Mdl,
+ IN PLARGE_INTEGER FileOffset,
+ IN PKEVENT Event,
+ OUT PIO_STATUS_BLOCK IoStatusBlock
+);
+
+NTKERNELAPI
+PEPROCESS
+NTAPI
+IoThreadToProcess (
+ IN PETHREAD Thread
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+IoUnregisterFileSystem (
+ IN OUT PDEVICE_OBJECT DeviceObject
+);
+
+#if (VER_PRODUCTBUILD >= 1381)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoUnregisterFsRegistrationChange (
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine
+);
+
+#endif // (VER_PRODUCTBUILD >= 1381)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+IoVerifyVolume (
+ IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN AllowRawMount
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeAttachProcess (
+ IN PEPROCESS Process
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeDetachProcess (
+ VOID
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeInitializeQueue (
+ IN PRKQUEUE Queue,
+ IN ULONG Count OPTIONAL
+);
+
+NTKERNELAPI
+LONG
+NTAPI
+KeInsertHeadQueue (
+ IN PRKQUEUE Queue,
+ IN PLIST_ENTRY Entry
+);
+
+NTKERNELAPI
+LONG
+NTAPI
+KeInsertQueue (
+ IN PRKQUEUE Queue,
+ IN PLIST_ENTRY Entry
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeInsertQueueApc (
+ IN PKAPC Apc,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2,
+ UCHAR Unknown
+);
+
+NTKERNELAPI
+LONG
+NTAPI
+KeReadStateQueue (
+ IN PRKQUEUE Queue
+);
+
+NTKERNELAPI
+PLIST_ENTRY
+NTAPI
+KeRemoveQueue (
+ IN PRKQUEUE Queue,
+ IN KPROCESSOR_MODE WaitMode,
+ IN PLARGE_INTEGER Timeout OPTIONAL
+);
+
+NTKERNELAPI
+PLIST_ENTRY
+NTAPI
+KeRundownQueue (
+ IN PRKQUEUE Queue
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+VOID
+NTAPI
+KeStackAttachProcess (
+ IN PKPROCESS Process,
+ OUT PKAPC_STATE ApcState
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeUnstackDetachProcess (
+ IN PKAPC_STATE ApcState
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmCanFileBeTruncated (
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN PLARGE_INTEGER NewFileSize
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmFlushImageSection (
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN MMFLUSH_TYPE FlushType
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmForceSectionClosed (
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN BOOLEAN DelayClose
+);
+
+#if (VER_PRODUCTBUILD >= 1381)
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmIsRecursiveIoFault (
+ VOID
+);
+
+#else
+
+#define MmIsRecursiveIoFault() ( \
+ (PsGetCurrentThread()->DisablePageFaultClustering) | \
+ (PsGetCurrentThread()->ForwardClusterOnly) \
+)
+
+#endif
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmMapViewOfSection (
+ IN PVOID SectionObject,
+ IN PEPROCESS Process,
+ IN OUT PVOID *BaseAddress,
+ IN ULONG ZeroBits,
+ IN ULONG CommitSize,
+ IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
+ IN OUT PULONG ViewSize,
+ IN SECTION_INHERIT InheritDisposition,
+ IN ULONG AllocationType,
+ IN ULONG Protect
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmSetAddressRangeModified (
+ IN PVOID Address,
+ IN ULONG Length
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ObCreateObject (
+ IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
+ IN POBJECT_TYPE ObjectType,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN KPROCESSOR_MODE AccessMode,
+ IN OUT PVOID ParseContext OPTIONAL,
+ IN ULONG ObjectSize,
+ IN ULONG PagedPoolCharge OPTIONAL,
+ IN ULONG NonPagedPoolCharge OPTIONAL,
+ OUT PVOID *Object
+);
+
+NTKERNELAPI
+ULONG
+NTAPI
+ObGetObjectPointerCount (
+ IN PVOID Object
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ObInsertObject (
+ IN PVOID Object,
+ IN PACCESS_STATE PassedAccessState OPTIONAL,
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG AdditionalReferences,
+ OUT PVOID *ReferencedObject OPTIONAL,
+ OUT PHANDLE Handle
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+ObMakeTemporaryObject (
+ IN PVOID Object
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ObOpenObjectByPointer (
+ IN PVOID Object,
+ IN ULONG HandleAttributes,
+ IN PACCESS_STATE PassedAccessState OPTIONAL,
+ IN ACCESS_MASK DesiredAccess OPTIONAL,
+ IN POBJECT_TYPE ObjectType OPTIONAL,
+ IN KPROCESSOR_MODE AccessMode,
+ OUT PHANDLE Handle
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ObQueryNameString (
+ IN PVOID Object,
+ OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
+ IN ULONG Length,
+ OUT PULONG ReturnLength
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ObQueryObjectAuditingByHandle (
+ IN HANDLE Handle,
+ OUT PBOOLEAN GenerateOnClose
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ObReferenceObjectByName (
+ IN PUNICODE_STRING ObjectName,
+ IN ULONG Attributes,
+ IN PACCESS_STATE PassedAccessState OPTIONAL,
+ IN ACCESS_MASK DesiredAccess OPTIONAL,
+ IN POBJECT_TYPE ObjectType,
+ IN KPROCESSOR_MODE AccessMode,
+ IN OUT PVOID ParseContext OPTIONAL,
+ OUT PVOID *Object
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+PsChargePoolQuota (
+ IN PEPROCESS Process,
+ IN POOL_TYPE PoolType,
+ IN ULONG Amount
+);
+
+#define PsDereferenceImpersonationToken(T) \
+ {if (ARGUMENT_PRESENT(T)) { \
+ (ObDereferenceObject((T))); \
+ } else { \
+ ; \
+ } \
+}
+
+#define PsDereferencePrimaryToken(T) (ObDereferenceObject((T)))
+
+NTKERNELAPI
+ULONGLONG
+NTAPI
+PsGetProcessExitTime (
+ VOID
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+PsIsThreadTerminating (
+ IN PETHREAD Thread
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+PsLookupProcessByProcessId (
+ IN PVOID ProcessId,
+ OUT PEPROCESS *Process
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+PsLookupProcessThreadByCid (
+ IN PCLIENT_ID Cid,
+ OUT PEPROCESS *Process OPTIONAL,
+ OUT PETHREAD *Thread
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+PsLookupThreadByThreadId (
+ IN PVOID UniqueThreadId,
+ OUT PETHREAD *Thread
+);
+
+NTKERNELAPI
+PACCESS_TOKEN
+NTAPI
+PsReferenceImpersonationToken (
+ IN PETHREAD Thread,
+ OUT PBOOLEAN CopyOnUse,
+ OUT PBOOLEAN EffectiveOnly,
+ OUT PSECURITY_IMPERSONATION_LEVEL Level
+);
+
+NTKERNELAPI
+HANDLE
+NTAPI
+PsReferencePrimaryToken (
+ IN PEPROCESS Process
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+PsReturnPoolQuota (
+ IN PEPROCESS Process,
+ IN POOL_TYPE PoolType,
+ IN ULONG Amount
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+PsRevertToSelf (
+ VOID
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlAbsoluteToSelfRelativeSD (
+ IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
+ IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
+ IN PULONG BufferLength
+);
+
+NTSYSAPI
+PVOID
+NTAPI
+RtlAllocateHeap (
+ IN HANDLE HeapHandle,
+ IN ULONG Flags,
+ IN ULONG Size
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlCompressBuffer (
+ IN USHORT CompressionFormatAndEngine,
+ IN PUCHAR UncompressedBuffer,
+ IN ULONG UncompressedBufferSize,
+ OUT PUCHAR CompressedBuffer,
+ IN ULONG CompressedBufferSize,
+ IN ULONG UncompressedChunkSize,
+ OUT PULONG FinalCompressedSize,
+ IN PVOID WorkSpace
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlCompressChunks (
+ IN PUCHAR UncompressedBuffer,
+ IN ULONG UncompressedBufferSize,
+ OUT PUCHAR CompressedBuffer,
+ IN ULONG CompressedBufferSize,
+ IN OUT PCOMPRESSED_DATA_INFO CompressedDataInfo,
+ IN ULONG CompressedDataInfoLength,
+ IN PVOID WorkSpace
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlConvertSidToUnicodeString (
+ OUT PUNICODE_STRING DestinationString,
+ IN PSID Sid,
+ IN BOOLEAN AllocateDestinationString
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlCopySid (
+ IN ULONG Length,
+ IN PSID Destination,
+ IN PSID Source
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDecompressBuffer (
+ IN USHORT CompressionFormat,
+ OUT PUCHAR UncompressedBuffer,
+ IN ULONG UncompressedBufferSize,
+ IN PUCHAR CompressedBuffer,
+ IN ULONG CompressedBufferSize,
+ OUT PULONG FinalUncompressedSize
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDecompressChunks (
+ OUT PUCHAR UncompressedBuffer,
+ IN ULONG UncompressedBufferSize,
+ IN PUCHAR CompressedBuffer,
+ IN ULONG CompressedBufferSize,
+ IN PUCHAR CompressedTail,
+ IN ULONG CompressedTailSize,
+ IN PCOMPRESSED_DATA_INFO CompressedDataInfo
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDecompressFragment (
+ IN USHORT CompressionFormat,
+ OUT PUCHAR UncompressedFragment,
+ IN ULONG UncompressedFragmentSize,
+ IN PUCHAR CompressedBuffer,
+ IN ULONG CompressedBufferSize,
+ IN ULONG FragmentOffset,
+ OUT PULONG FinalUncompressedSize,
+ IN PVOID WorkSpace
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDescribeChunk (
+ IN USHORT CompressionFormat,
+ IN OUT PUCHAR *CompressedBuffer,
+ IN PUCHAR EndOfCompressedBufferPlus1,
+ OUT PUCHAR *ChunkBuffer,
+ OUT PULONG ChunkSize
+);
+
+NTSYSAPI
+BOOLEAN
+NTAPI
+RtlEqualSid (
+ IN PSID Sid1,
+ IN PSID Sid2
+);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlFillMemoryUlong (
+ IN PVOID Destination,
+ IN ULONG Length,
+ IN ULONG Fill
+);
+
+NTSYSAPI
+BOOLEAN
+NTAPI
+RtlFreeHeap (
+ IN HANDLE HeapHandle,
+ IN ULONG Flags,
+ IN PVOID P
+);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlGenerate8dot3Name (
+ IN PUNICODE_STRING Name,
+ IN BOOLEAN AllowExtendedCharacters,
+ IN OUT PGENERATE_NAME_CONTEXT Context,
+ OUT PUNICODE_STRING Name8dot3
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlGetCompressionWorkSpaceSize (
+ IN USHORT CompressionFormatAndEngine,
+ OUT PULONG CompressBufferWorkSpaceSize,
+ OUT PULONG CompressFragmentWorkSpaceSize
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlGetDaclSecurityDescriptor (
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ OUT PBOOLEAN DaclPresent,
+ OUT PACL *Dacl,
+ OUT PBOOLEAN DaclDefaulted
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlGetGroupSecurityDescriptor (
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ OUT PSID *Group,
+ OUT PBOOLEAN GroupDefaulted
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlGetOwnerSecurityDescriptor (
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ OUT PSID *Owner,
+ OUT PBOOLEAN OwnerDefaulted
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlInitializeSid (
+ IN OUT PSID Sid,
+ IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
+ IN UCHAR SubAuthorityCount
+);
+
+NTSYSAPI
+BOOLEAN
+NTAPI
+RtlIsNameLegalDOS8Dot3 (
+ IN PUNICODE_STRING UnicodeName,
+ IN PANSI_STRING AnsiName,
+ PBOOLEAN Unknown
+);
+
+NTSYSAPI
+ULONG
+NTAPI
+RtlLengthRequiredSid (
+ IN UCHAR SubAuthorityCount
+);
+
+NTSYSAPI
+ULONG
+NTAPI
+RtlLengthSid (
+ IN PSID Sid
+);
+
+NTSYSAPI
+ULONG
+NTAPI
+RtlNtStatusToDosError (
+ IN NTSTATUS Status
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlReserveChunk (
+ IN USHORT CompressionFormat,
+ IN OUT PUCHAR *CompressedBuffer,
+ IN PUCHAR EndOfCompressedBufferPlus1,
+ OUT PUCHAR *ChunkBuffer,
+ IN ULONG ChunkSize
+);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlSecondsSince1970ToTime (
+ IN ULONG SecondsSince1970,
+ OUT PLARGE_INTEGER Time
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSelfRelativeToAbsoluteSD (
+ IN PSECURITY_DESCRIPTOR SelfRelativeSD,
+ OUT PSECURITY_DESCRIPTOR AbsoluteSD,
+ IN PULONG AbsoluteSDSize,
+ IN PACL Dacl,
+ IN PULONG DaclSize,
+ IN PACL Sacl,
+ IN PULONG SaclSize,
+ IN PSID Owner,
+ IN PULONG OwnerSize,
+ IN PSID PrimaryGroup,
+ IN PULONG PrimaryGroupSize
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSetGroupSecurityDescriptor (
+ IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSID Group,
+ IN BOOLEAN GroupDefaulted
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSetOwnerSecurityDescriptor (
+ IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSID Owner,
+ IN BOOLEAN OwnerDefaulted
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSetSaclSecurityDescriptor (
+ IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN BOOLEAN SaclPresent,
+ IN PACL Sacl,
+ IN BOOLEAN SaclDefaulted
+);
+
+NTSYSAPI
+PUCHAR
+NTAPI
+RtlSubAuthorityCountSid (
+ IN PSID Sid
+);
+
+NTSYSAPI
+PULONG
+NTAPI
+RtlSubAuthoritySid (
+ IN PSID Sid,
+ IN ULONG SubAuthority
+);
+
+NTSYSAPI
+BOOLEAN
+NTAPI
+RtlValidSid (
+ IN PSID Sid
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeAppendPrivileges (
+ PACCESS_STATE AccessState,
+ PPRIVILEGE_SET Privileges
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+SeAuditingFileEvents (
+ IN BOOLEAN AccessGranted,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+SeAuditingFileOrGlobalEvents (
+ IN BOOLEAN AccessGranted,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+SeCaptureSubjectContext (
+ OUT PSECURITY_SUBJECT_CONTEXT SubjectContext
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeCreateAccessState (
+ OUT PACCESS_STATE AccessState,
+ IN PVOID AuxData,
+ IN ACCESS_MASK AccessMask,
+ IN PGENERIC_MAPPING Mapping
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeCreateClientSecurity (
+ IN PETHREAD Thread,
+ IN PSECURITY_QUALITY_OF_SERVICE QualityOfService,
+ IN BOOLEAN RemoteClient,
+ OUT PSECURITY_CLIENT_CONTEXT ClientContext
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeCreateClientSecurityFromSubjectContext (
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext,
+ IN PSECURITY_QUALITY_OF_SERVICE QualityOfService,
+ IN BOOLEAN ServerIsRemote,
+ OUT PSECURITY_CLIENT_CONTEXT ClientContext
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+#define SeDeleteClientSecurity(C) { \
+ if (SeTokenType((C)->ClientToken) == TokenPrimary) { \
+ PsDereferencePrimaryToken( (C)->ClientToken ); \
+ } else { \
+ PsDereferenceImpersonationToken( (C)->ClientToken ); \
+ } \
+}
+
+NTKERNELAPI
+VOID
+NTAPI
+SeDeleteObjectAuditAlarm (
+ IN PVOID Object,
+ IN HANDLE Handle
+);
+
+#define SeEnableAccessToExports() SeExports = *(PSE_EXPORTS *)SeExports;
+
+NTKERNELAPI
+VOID
+NTAPI
+SeFreePrivileges (
+ IN PPRIVILEGE_SET Privileges
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+SeImpersonateClient (
+ IN PSECURITY_CLIENT_CONTEXT ClientContext,
+ IN PETHREAD ServerThread OPTIONAL
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeImpersonateClientEx (
+ IN PSECURITY_CLIENT_CONTEXT ClientContext,
+ IN PETHREAD ServerThread OPTIONAL
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+VOID
+NTAPI
+SeLockSubjectContext (
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeMarkLogonSessionForTerminationNotification (
+ IN PLUID LogonId
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+SeOpenObjectAuditAlarm (
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PVOID Object OPTIONAL,
+ IN PUNICODE_STRING AbsoluteObjectName OPTIONAL,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PACCESS_STATE AccessState,
+ IN BOOLEAN ObjectCreated,
+ IN BOOLEAN AccessGranted,
+ IN KPROCESSOR_MODE AccessMode,
+ OUT PBOOLEAN GenerateOnClose
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+SeOpenObjectForDeleteAuditAlarm (
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PVOID Object OPTIONAL,
+ IN PUNICODE_STRING AbsoluteObjectName OPTIONAL,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PACCESS_STATE AccessState,
+ IN BOOLEAN ObjectCreated,
+ IN BOOLEAN AccessGranted,
+ IN KPROCESSOR_MODE AccessMode,
+ OUT PBOOLEAN GenerateOnClose
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+SePrivilegeCheck (
+ IN OUT PPRIVILEGE_SET RequiredPrivileges,
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext,
+ IN KPROCESSOR_MODE AccessMode
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeQueryAuthenticationIdToken (
+ IN PACCESS_TOKEN Token,
+ OUT PLUID LogonId
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeQueryInformationToken (
+ IN PACCESS_TOKEN Token,
+ IN TOKEN_INFORMATION_CLASS TokenInformationClass,
+ OUT PVOID *TokenInformation
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeQuerySecurityDescriptorInfo (
+ IN PSECURITY_INFORMATION SecurityInformation,
+ OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN OUT PULONG Length,
+ IN PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeQuerySessionIdToken (
+ IN PACCESS_TOKEN Token,
+ IN PULONG SessionId
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+#define SeQuerySubjectContextToken( SubjectContext ) \
+ ( ARGUMENT_PRESENT( \
+ ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->ClientToken \
+ ) ? \
+ ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->ClientToken : \
+ ((PSECURITY_SUBJECT_CONTEXT) SubjectContext)->PrimaryToken )
+
+typedef NTSTATUS (*PSE_LOGON_SESSION_TERMINATED_ROUTINE) (
+ IN PLUID LogonId
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeRegisterLogonSessionTerminatedRoutine (
+ IN PSE_LOGON_SESSION_TERMINATED_ROUTINE CallbackRoutine
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+SeReleaseSubjectContext (
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+SeSetAccessStateGenericMapping (
+ PACCESS_STATE AccessState,
+ PGENERIC_MAPPING GenericMapping
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeSetSecurityDescriptorInfo (
+ IN PVOID Object OPTIONAL,
+ IN PSECURITY_INFORMATION SecurityInformation,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN OUT PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
+ IN POOL_TYPE PoolType,
+ IN PGENERIC_MAPPING GenericMapping
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+SeSetSecurityDescriptorInfoEx (
+ IN PVOID Object OPTIONAL,
+ IN PSECURITY_INFORMATION SecurityInformation,
+ IN PSECURITY_DESCRIPTOR ModificationDescriptor,
+ IN OUT PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
+ IN ULONG AutoInheritFlags,
+ IN POOL_TYPE PoolType,
+ IN PGENERIC_MAPPING GenericMapping
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+SeTokenIsAdmin (
+ IN PACCESS_TOKEN Token
+);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+SeTokenIsRestricted (
+ IN PACCESS_TOKEN Token
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTKERNELAPI
+TOKEN_TYPE
+NTAPI
+SeTokenType (
+ IN PACCESS_TOKEN Token
+);
+
+NTKERNELAPI
+VOID
+NTAPI
+SeUnlockSubjectContext (
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext
+);
+
+NTKERNELAPI
+NTSTATUS
+SeUnregisterLogonSessionTerminatedRoutine (
+ IN PSE_LOGON_SESSION_TERMINATED_ROUTINE CallbackRoutine
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwAdjustPrivilegesToken (
+ IN HANDLE TokenHandle,
+ IN BOOLEAN DisableAllPrivileges,
+ IN PTOKEN_PRIVILEGES NewState,
+ IN ULONG BufferLength,
+ OUT PTOKEN_PRIVILEGES PreviousState OPTIONAL,
+ OUT PULONG ReturnLength
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwAlertThread (
+ IN HANDLE ThreadHandle
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwAllocateVirtualMemory (
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN ULONG ZeroBits,
+ IN OUT PULONG RegionSize,
+ IN ULONG AllocationType,
+ IN ULONG Protect
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwAccessCheckAndAuditAlarm (
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN PUNICODE_STRING ObjectTypeName,
+ IN PUNICODE_STRING ObjectName,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN ACCESS_MASK DesiredAccess,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN BOOLEAN ObjectCreation,
+ OUT PACCESS_MASK GrantedAccess,
+ OUT PBOOLEAN AccessStatus,
+ OUT PBOOLEAN GenerateOnClose
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwCancelIoFile (
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwClearEvent (
+ IN HANDLE EventHandle
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwCloseObjectAuditAlarm (
+ IN PUNICODE_STRING SubsystemName,
+ IN PVOID HandleId,
+ IN BOOLEAN GenerateOnClose
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwCreateSection (
+ OUT PHANDLE SectionHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN PLARGE_INTEGER MaximumSize OPTIONAL,
+ IN ULONG SectionPageProtection,
+ IN ULONG AllocationAttributes,
+ IN HANDLE FileHandle OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwCreateSymbolicLinkObject (
+ OUT PHANDLE SymbolicLinkHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PUNICODE_STRING TargetName
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwDeleteFile (
+ IN POBJECT_ATTRIBUTES ObjectAttributes
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwDeleteValueKey (
+ IN HANDLE Handle,
+ IN PUNICODE_STRING Name
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwDeviceIoControlFile (
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG IoControlCode,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwDisplayString (
+ IN PUNICODE_STRING String
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwDuplicateObject (
+ IN HANDLE SourceProcessHandle,
+ IN HANDLE SourceHandle,
+ IN HANDLE TargetProcessHandle OPTIONAL,
+ OUT PHANDLE TargetHandle OPTIONAL,
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG HandleAttributes,
+ IN ULONG Options
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwDuplicateToken (
+ IN HANDLE ExistingTokenHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN BOOLEAN EffectiveOnly,
+ IN TOKEN_TYPE TokenType,
+ OUT PHANDLE NewTokenHandle
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwFlushInstructionCache (
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress OPTIONAL,
+ IN ULONG FlushSize
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwFlushVirtualMemory (
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG FlushSize,
+ OUT PIO_STATUS_BLOCK IoStatusBlock
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwFreeVirtualMemory (
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN OUT PULONG RegionSize,
+ IN ULONG FreeType
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwFsControlFile (
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG FsControlCode,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwInitiatePowerAction (
+ IN POWER_ACTION SystemAction,
+ IN SYSTEM_POWER_STATE MinSystemState,
+ IN ULONG Flags,
+ IN BOOLEAN Asynchronous
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwLoadDriver (
+ // "\\Registry\\Machine\\System\\CurrentControlSet\\Services\\<DriverName>"
+ IN PUNICODE_STRING RegistryPath
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwLoadKey (
+ IN POBJECT_ATTRIBUTES KeyObjectAttributes,
+ IN POBJECT_ATTRIBUTES FileObjectAttributes
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwNotifyChangeKey (
+ IN HANDLE KeyHandle,
+ IN HANDLE EventHandle OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG NotifyFilter,
+ IN BOOLEAN WatchSubtree,
+ IN PVOID Buffer,
+ IN ULONG BufferLength,
+ IN BOOLEAN Asynchronous
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwOpenDirectoryObject (
+ OUT PHANDLE DirectoryHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwOpenEvent (
+ OUT PHANDLE EventHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwOpenProcess (
+ OUT PHANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PCLIENT_ID ClientId OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwOpenProcessToken (
+ IN HANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PHANDLE TokenHandle
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwOpenThread (
+ OUT PHANDLE ThreadHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PCLIENT_ID ClientId
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwOpenThreadToken (
+ IN HANDLE ThreadHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN BOOLEAN OpenAsSelf,
+ OUT PHANDLE TokenHandle
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwPowerInformation (
+ IN POWER_INFORMATION_LEVEL PowerInformationLevel,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwPulseEvent (
+ IN HANDLE EventHandle,
+ OUT PULONG PreviousState OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryDefaultLocale (
+ IN BOOLEAN ThreadOrSystem,
+ OUT PLCID Locale
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryDirectoryFile (
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID FileInformation,
+ IN ULONG Length,
+ IN FILE_INFORMATION_CLASS FileInformationClass,
+ IN BOOLEAN ReturnSingleEntry,
+ IN PUNICODE_STRING FileName OPTIONAL,
+ IN BOOLEAN RestartScan
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryDirectoryObject (
+ IN HANDLE DirectoryHandle,
+ OUT PVOID Buffer,
+ IN ULONG Length,
+ IN BOOLEAN ReturnSingleEntry,
+ IN BOOLEAN RestartScan,
+ IN OUT PULONG Context,
+ OUT PULONG ReturnLength OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryEaFile (
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID Buffer,
+ IN ULONG Length,
+ IN BOOLEAN ReturnSingleEntry,
+ IN PVOID EaList OPTIONAL,
+ IN ULONG EaListLength,
+ IN PULONG EaIndex OPTIONAL,
+ IN BOOLEAN RestartScan
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryInformationProcess (
+ IN HANDLE ProcessHandle,
+ IN PROCESSINFOCLASS ProcessInformationClass,
+ OUT PVOID ProcessInformation,
+ IN ULONG ProcessInformationLength,
+ OUT PULONG ReturnLength OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryInformationToken (
+ IN HANDLE TokenHandle,
+ IN TOKEN_INFORMATION_CLASS TokenInformationClass,
+ OUT PVOID TokenInformation,
+ IN ULONG Length,
+ OUT PULONG ResultLength
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryObject (
+ IN HANDLE ObjectHandle,
+ IN OBJECT_INFO_CLASS ObjectInformationClass,
+ OUT PVOID ObjectInformation,
+ IN ULONG Length,
+ OUT PULONG ResultLength
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQuerySection (
+ IN HANDLE SectionHandle,
+ IN SECTION_INFORMATION_CLASS SectionInformationClass,
+ OUT PVOID SectionInformation,
+ IN ULONG SectionInformationLength,
+ OUT PULONG ResultLength OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQuerySecurityObject (
+ IN HANDLE FileHandle,
+ IN SECURITY_INFORMATION SecurityInformation,
+ OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN ULONG Length,
+ OUT PULONG ResultLength
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQuerySystemInformation (
+ IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
+ OUT PVOID SystemInformation,
+ IN ULONG Length,
+ OUT PULONG ReturnLength
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwQueryVolumeInformationFile (
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID FsInformation,
+ IN ULONG Length,
+ IN FS_INFORMATION_CLASS FsInformationClass
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwReplaceKey (
+ IN POBJECT_ATTRIBUTES NewFileObjectAttributes,
+ IN HANDLE KeyHandle,
+ IN POBJECT_ATTRIBUTES OldFileObjectAttributes
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwResetEvent (
+ IN HANDLE EventHandle,
+ OUT PULONG PreviousState OPTIONAL
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwRestoreKey (
+ IN HANDLE KeyHandle,
+ IN HANDLE FileHandle,
+ IN ULONG Flags
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSaveKey (
+ IN HANDLE KeyHandle,
+ IN HANDLE FileHandle
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetDefaultLocale (
+ IN BOOLEAN ThreadOrSystem,
+ IN LCID Locale
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetDefaultUILanguage (
+ IN LANGID LanguageId
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetEaFile (
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID Buffer,
+ IN ULONG Length
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetEvent (
+ IN HANDLE EventHandle,
+ OUT PULONG PreviousState OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetInformationObject (
+ IN HANDLE ObjectHandle,
+ IN OBJECT_INFO_CLASS ObjectInformationClass,
+ IN PVOID ObjectInformation,
+ IN ULONG ObjectInformationLength
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetInformationProcess (
+ IN HANDLE ProcessHandle,
+ IN PROCESSINFOCLASS ProcessInformationClass,
+ IN PVOID ProcessInformation,
+ IN ULONG ProcessInformationLength
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetSecurityObject (
+ IN HANDLE Handle,
+ IN SECURITY_INFORMATION SecurityInformation,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetSystemInformation (
+ IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
+ IN PVOID SystemInformation,
+ IN ULONG Length
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetSystemTime (
+ IN PLARGE_INTEGER NewTime,
+ OUT PLARGE_INTEGER OldTime OPTIONAL
+);
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwSetVolumeInformationFile (
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PVOID FsInformation,
+ IN ULONG Length,
+ IN FS_INFORMATION_CLASS FsInformationClass
+);
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwTerminateProcess (
+ IN HANDLE ProcessHandle OPTIONAL,
+ IN NTSTATUS ExitStatus
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwUnloadDriver (
+ // "\\Registry\\Machine\\System\\CurrentControlSet\\Services\\<DriverName>"
+ IN PUNICODE_STRING RegistryPath
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwUnloadKey (
+ IN POBJECT_ATTRIBUTES KeyObjectAttributes
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwWaitForSingleObject (
+ IN HANDLE Handle,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Timeout OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwWaitForMultipleObjects (
+ IN ULONG HandleCount,
+ IN PHANDLE Handles,
+ IN WAIT_TYPE WaitType,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Timeout OPTIONAL
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+ZwYieldExecution (
+ VOID
+);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _NTIFS_
--- /dev/null
+/*
+ * ntpoapi.h
+ *
+ * APIs for power management.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __NTPOAPI_H
+#define __NTPOAPI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "batclass.h"
+
+
+#define ES_SYSTEM_REQUIRED 0x00000001
+#define ES_DISPLAY_REQUIRED 0x00000002
+#define ES_USER_PRESENT 0x00000004
+#define ES_CONTINUOUS 0x80000000
+
+typedef enum _LATENCY_TIME {
+ LT_DONT_CARE,
+ LT_LOWEST_LATENCY
+} LATENCY_TIME, *PLATENCY_TIME;
+
+#define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
+
+typedef enum _POWER_INFORMATION_LEVEL {
+ SystemPowerPolicyAc,
+ SystemPowerPolicyDc,
+ VerifySystemPolicyAc,
+ VerifySystemPolicyDc,
+ SystemPowerCapabilities,
+ SystemBatteryState,
+ SystemPowerStateHandler,
+ ProcessorStateHandler,
+ SystemPowerPolicyCurrent,
+ AdministratorPowerPolicy,
+ SystemReserveHiberFile,
+ ProcessorInformation,
+ SystemPowerInformation,
+ ProcessorStateHandler2,
+ LastWakeTime,
+ LastSleepTime,
+ SystemExecutionState,
+ SystemPowerStateNotifyHandler,
+ ProcessorPowerPolicyAc,
+ ProcessorPowerPolicyDc,
+ VerifyProcessorPowerPolicyAc,
+ VerifyProcessorPowerPolicyDc,
+ ProcessorPowerPolicyCurrent
+} POWER_INFORMATION_LEVEL;
+
+#define POWER_PERF_SCALE 100
+#define PERF_LEVEL_TO_PERCENT(x) (((x) * 1000) / (POWER_PERF_SCALE * 10))
+#define PERCENT_TO_PERF_LEVEL(x) (((x) * POWER_PERF_SCALE * 10) / 1000)
+
+typedef struct _PROCESSOR_IDLE_TIMES {
+ ULONGLONG StartTime;
+ ULONGLONG EndTime;
+ ULONG IdleHandlerReserved[4];
+} PROCESSOR_IDLE_TIMES, *PPROCESSOR_IDLE_TIMES;
+
+typedef BOOLEAN DDKFASTAPI
+(*PPROCESSOR_IDLE_HANDLER)(
+ IN OUT PPROCESSOR_IDLE_TIMES IdleTimes);
+
+typedef struct _PROCESSOR_IDLE_HANDLER_INFO {
+ ULONG HardwareLatency;
+ PPROCESSOR_IDLE_HANDLER Handler;
+} PROCESSOR_IDLE_HANDLER_INFO, *PPROCESSOR_IDLE_HANDLER_INFO;
+
+typedef VOID DDKFASTAPI
+(*PSET_PROCESSOR_THROTTLE)(
+ IN UCHAR Throttle);
+
+typedef NTSTATUS DDKFASTAPI
+(*PSET_PROCESSOR_THROTTLE2)(
+ IN UCHAR Throttle);
+
+#define MAX_IDLE_HANDLERS 3
+
+typedef struct _PROCESSOR_STATE_HANDLER {
+ UCHAR ThrottleScale;
+ BOOLEAN ThrottleOnIdle;
+ PSET_PROCESSOR_THROTTLE SetThrottle;
+ ULONG NumIdleHandlers;
+ PROCESSOR_IDLE_HANDLER_INFO IdleHandler[MAX_IDLE_HANDLERS];
+} PROCESSOR_STATE_HANDLER, *PPROCESSOR_STATE_HANDLER;
+
+typedef enum _POWER_STATE_HANDLER_TYPE {
+ PowerStateSleeping1,
+ PowerStateSleeping2,
+ PowerStateSleeping3,
+ PowerStateSleeping4,
+ PowerStateSleeping4Firmware,
+ PowerStateShutdownReset,
+ PowerStateShutdownOff,
+ PowerStateMaximum
+} POWER_STATE_HANDLER_TYPE, *PPOWER_STATE_HANDLER_TYPE;
+
+typedef NTSTATUS DDKAPI
+(*PENTER_STATE_SYSTEM_HANDLER)(
+ IN PVOID SystemContext);
+
+typedef NTSTATUS DDKAPI
+(*PENTER_STATE_HANDLER)(
+ IN PVOID Context,
+ IN PENTER_STATE_SYSTEM_HANDLER SystemHandler OPTIONAL,
+ IN PVOID SystemContext,
+ IN LONG NumberProcessors,
+ IN VOLATILE PLONG Number);
+
+typedef struct _POWER_STATE_HANDLER {
+ POWER_STATE_HANDLER_TYPE Type;
+ BOOLEAN RtcWake;
+ UCHAR Spare[3];
+ PENTER_STATE_HANDLER Handler;
+ PVOID Context;
+} POWER_STATE_HANDLER, *PPOWER_STATE_HANDLER;
+
+typedef NTSTATUS STDCALL
+(*PENTER_STATE_NOTIFY_HANDLER)(
+ IN POWER_STATE_HANDLER_TYPE State,
+ IN PVOID Context,
+ IN BOOLEAN Entering);
+
+typedef struct _POWER_STATE_NOTIFY_HANDLER {
+ PENTER_STATE_NOTIFY_HANDLER Handler;
+ PVOID Context;
+} POWER_STATE_NOTIFY_HANDLER, *PPOWER_STATE_NOTIFY_HANDLER;
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtPowerInformation(
+ IN POWER_INFORMATION_LEVEL InformationLevel,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength);
+
+#define PROCESSOR_STATE_TYPE_PERFORMANCE 1
+#define PROCESSOR_STATE_TYPE_THROTTLE 2
+
+typedef struct _PROCESSOR_PERF_LEVEL {
+ UCHAR PercentFrequency;
+ UCHAR Reserved;
+ USHORT Flags;
+} PROCESSOR_PERF_LEVEL, *PPROCESSOR_PERF_LEVEL;
+
+typedef struct _PROCESSOR_PERF_STATE {
+ UCHAR PercentFrequency;
+ UCHAR MinCapacity;
+ USHORT Power;
+ UCHAR IncreaseLevel;
+ UCHAR DecreaseLevel;
+ USHORT Flags;
+ ULONG IncreaseTime;
+ ULONG DecreaseTime;
+ ULONG IncreaseCount;
+ ULONG DecreaseCount;
+ ULONGLONG PerformanceTime;
+} PROCESSOR_PERF_STATE, *PPROCESSOR_PERF_STATE;
+
+typedef struct _PROCESSOR_STATE_HANDLER2 {
+ ULONG NumIdleHandlers;
+ PROCESSOR_IDLE_HANDLER_INFO IdleHandler[MAX_IDLE_HANDLERS];
+ PSET_PROCESSOR_THROTTLE2 SetPerfLevel;
+ ULONG HardwareLatency;
+ UCHAR NumPerfStates;
+ PROCESSOR_PERF_LEVEL PerfLevel[1];
+} PROCESSOR_STATE_HANDLER2, *PPROCESSOR_STATE_HANDLER2;
+
+/* POWER_ACTION_POLICY.Flags constants */
+#define POWER_ACTION_QUERY_ALLOWED 0x00000001
+#define POWER_ACTION_UI_ALLOWED 0x00000002
+#define POWER_ACTION_OVERRIDE_APPS 0x00000004
+#define POWER_ACTION_LIGHTEST_FIRST 0x10000000
+#define POWER_ACTION_LOCK_CONSOLE 0x20000000
+#define POWER_ACTION_DISABLE_WAKES 0x40000000
+#define POWER_ACTION_CRITICAL 0x80000000
+
+/* POWER_ACTION_POLICY.EventCode constants */
+#define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001
+#define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002
+#define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004
+#define POWER_USER_NOTIFY_BUTTON 0x00000008
+#define POWER_USER_NOTIFY_SHUTDOWN 0x00000010
+#define POWER_FORCE_TRIGGER_RESET 0x80000000
+
+typedef struct _POWER_ACTION_POLICY {
+ POWER_ACTION Action;
+ ULONG Flags;
+ ULONG EventCode;
+} POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY;
+
+typedef struct _SYSTEM_POWER_LEVEL {
+ BOOLEAN Enable;
+ UCHAR Spare[3];
+ ULONG BatteryLevel;
+ POWER_ACTION_POLICY PowerPolicy;
+ SYSTEM_POWER_STATE MinSystemState;
+} SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL;
+
+#define DISCHARGE_POLICY_CRITICAL 0
+#define DISCHARGE_POLICY_LOW 1
+#define NUM_DISCHARGE_POLICIES 4
+
+#define PO_THROTTLE_NONE 0
+#define PO_THROTTLE_CONSTANT 1
+#define PO_THROTTLE_DEGRADE 2
+#define PO_THROTTLE_ADAPTIVE 3
+#define PO_THROTTLE_MAXIMUM 4
+
+typedef struct _SYSTEM_POWER_POLICY {
+ ULONG Revision;
+ POWER_ACTION_POLICY PowerButton;
+ POWER_ACTION_POLICY SleepButton;
+ POWER_ACTION_POLICY LidClose;
+ SYSTEM_POWER_STATE LidOpenWake;
+ ULONG Reserved;
+ POWER_ACTION_POLICY Idle;
+ ULONG IdleTimeout;
+ UCHAR IdleSensitivity;
+ UCHAR DynamicThrottle;
+ UCHAR Spare2[2];
+ SYSTEM_POWER_STATE MinSleep;
+ SYSTEM_POWER_STATE MaxSleep;
+ SYSTEM_POWER_STATE ReducedLatencySleep;
+ ULONG WinLogonFlags;
+ ULONG Spare3;
+ ULONG DozeS4Timeout;
+ ULONG BroadcastCapacityResolution;
+ SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
+ ULONG VideoTimeout;
+ BOOLEAN VideoDimDisplay;
+ ULONG VideoReserved[3];
+ ULONG SpindownTimeout;
+ BOOLEAN OptimizeForPower;
+ UCHAR FanThrottleTolerance;
+ UCHAR ForcedThrottle;
+ UCHAR MinThrottle;
+ POWER_ACTION_POLICY OverThrottled;
+} SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY;
+
+typedef struct _PROCESSOR_POWER_POLICY_INFO {
+ ULONG TimeCheck;
+ ULONG DemoteLimit;
+ ULONG PromoteLimit;
+ UCHAR DemotePercent;
+ UCHAR PromotePercent;
+ UCHAR Spare[2];
+ ULONG AllowDemotion : 1;
+ ULONG AllowPromotion : 1;
+ ULONG Reserved : 30;
+} PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO;
+
+typedef struct _PROCESSOR_POWER_POLICY {
+ ULONG Revision;
+ UCHAR DynamicThrottle;
+ UCHAR Spare[3];
+ ULONG Reserved;
+ ULONG PolicyCount;
+ PROCESSOR_POWER_POLICY_INFO Policy[3];
+} PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY;
+
+typedef struct _ADMINISTRATOR_POWER_POLICY {
+ SYSTEM_POWER_STATE MinSleep;
+ SYSTEM_POWER_STATE MaxSleep;
+ ULONG MinVideoTimeout;
+ ULONG MaxVideoTimeout;
+ ULONG MinSpindownTimeout;
+ ULONG MaxSpindownTimeout;
+} ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtSetThreadExecutionState(
+ IN EXECUTION_STATE esFlags,
+ OUT EXECUTION_STATE *PreviousFlags);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtRequestWakeupLatency(
+ IN LATENCY_TIME latency);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtInitiatePowerAction(
+ IN POWER_ACTION SystemAction,
+ IN SYSTEM_POWER_STATE MinSystemState,
+ IN ULONG Flags,
+ IN BOOLEAN Asynchronous);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtSetSystemPowerState(
+ IN POWER_ACTION SystemAction,
+ IN SYSTEM_POWER_STATE MinSystemState,
+ IN ULONG Flags);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtGetDevicePowerState(
+ IN HANDLE Device,
+ OUT DEVICE_POWER_STATE *State);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtCancelDeviceWakeupRequest(
+ IN HANDLE Device);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+NtIsSystemResumeAutomatic(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtRequestDeviceWakeup(
+ IN HANDLE Device);
+
+#define WINLOGON_LOCK_ON_SLEEP 0x00000001
+
+typedef struct _SYSTEM_POWER_INFORMATION {
+ ULONG MaxIdlenessAllowed;
+ ULONG Idleness;
+ ULONG TimeRemaining;
+ UCHAR CoolingMode;
+} SYSTEM_POWER_INFORMATION, *PSYSTEM_POWER_INFORMATION;
+
+typedef struct _PROCESSOR_POWER_INFORMATION {
+ ULONG Number;
+ ULONG MaxMhz;
+ ULONG CurrentMhz;
+ ULONG MhzLimit;
+ ULONG MaxIdleState;
+ ULONG CurrentIdleState;
+} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
+
+typedef struct _SYSTEM_BATTERY_STATE {
+ BOOLEAN AcOnLine;
+ BOOLEAN BatteryPresent;
+ BOOLEAN Charging;
+ BOOLEAN Discharging;
+ BOOLEAN Spare1[4];
+ ULONG MaxCapacity;
+ ULONG RemainingCapacity;
+ ULONG Rate;
+ ULONG EstimatedTime;
+ ULONG DefaultAlert1;
+ ULONG DefaultAlert2;
+} SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
+
+typedef struct _SYSTEM_POWER_CAPABILITIES {
+ BOOLEAN PowerButtonPresent;
+ BOOLEAN SleepButtonPresent;
+ BOOLEAN LidPresent;
+ BOOLEAN SystemS1;
+ BOOLEAN SystemS2;
+ BOOLEAN SystemS3;
+ BOOLEAN SystemS4;
+ BOOLEAN SystemS5;
+ BOOLEAN HiberFilePresent;
+ BOOLEAN FullWake;
+ BOOLEAN VideoDimPresent;
+ BOOLEAN ApmPresent;
+ BOOLEAN UpsPresent;
+ BOOLEAN ThermalControl;
+ BOOLEAN ProcessorThrottle;
+ UCHAR ProcessorMinThrottle;
+ UCHAR ProcessorMaxThrottle;
+ UCHAR spare2[4];
+ BOOLEAN DiskSpinDown;
+ UCHAR spare3[8];
+ BOOLEAN SystemBatteriesPresent;
+ BOOLEAN BatteriesAreShortTerm;
+ BATTERY_REPORTING_SCALE BatteryScale[3];
+ SYSTEM_POWER_STATE AcOnLineWake;
+ SYSTEM_POWER_STATE SoftLidWake;
+ SYSTEM_POWER_STATE RtcWake;
+ SYSTEM_POWER_STATE MinDeviceWakeState;
+ SYSTEM_POWER_STATE DefaultLowLatencyWake;
+} SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NTPOAPI_H */
--- /dev/null
+/*
+ * ntstatus.h
+ *
+ * Windows NT status codes
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef _NTSTATUS_H
+#define _NTSTATUS_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(STATUS_SUCCESS)
+#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
+#endif /* !STATUS_SUCCESS */
+#define FACILITY_DEBUGGER 0x1
+#define FACILITY_RPC_RUNTIME 0x2
+#define FACILITY_RPC_STUBS 0x3
+#define FACILITY_IO_ERROR_CODE 0x4
+#define FACILITY_TERMINAL_SERVER 0xA
+#define FACILITY_USB_ERROR_CODE 0x10
+#define FACILITY_HID_ERROR_CODE 0x11
+#define FACILITY_FIREWIRE_ERROR_CODE 0x12
+#define FACILITY_CLUSTER_ERROR_CODE 0x13
+#define FACILITY_ACPI_ERROR_CODE 0x14
+#define FACILITY_SXS_ERROR_CODE 0x15
+#define STATUS_SEVERITY_SUCCESS 0x0
+#define STATUS_SEVERITY_INFORMATIONAL 0x1
+#define STATUS_SEVERITY_WARNING 0x2
+#define STATUS_SEVERITY_ERROR 0x3
+#define STATUS_WAIT_0 ((NTSTATUS)0x00000000L)
+#define STATUS_WAIT_1 ((NTSTATUS)0x00000001L)
+#define STATUS_WAIT_2 ((NTSTATUS)0x00000002L)
+#define STATUS_WAIT_3 ((NTSTATUS)0x00000003L)
+#define STATUS_WAIT_63 ((NTSTATUS)0x0000003FL)
+#define STATUS_ABANDONED ((NTSTATUS)0x00000080L)
+#define STATUS_ABANDONED_WAIT_0 ((NTSTATUS)0x00000080L)
+#define STATUS_ABANDONED_WAIT_63 ((NTSTATUS)0x000000BFL)
+#define STATUS_USER_APC ((NTSTATUS)0x000000C0L)
+#define STATUS_KERNEL_APC ((NTSTATUS)0x00000100L)
+#define STATUS_ALERTED ((NTSTATUS)0x00000101L)
+#define STATUS_TIMEOUT ((NTSTATUS)0x00000102L)
+#define STATUS_PENDING ((NTSTATUS)0x00000103L)
+#define STATUS_REPARSE ((NTSTATUS)0x00000104L)
+#define STATUS_MORE_ENTRIES ((NTSTATUS)0x00000105L)
+#define STATUS_NOT_ALL_ASSIGNED ((NTSTATUS)0x00000106L)
+#define STATUS_SOME_NOT_MAPPED ((NTSTATUS)0x00000107L)
+#define STATUS_OPLOCK_BREAK_IN_PROGRESS ((NTSTATUS)0x00000108L)
+#define STATUS_VOLUME_MOUNTED ((NTSTATUS)0x00000109L)
+#define STATUS_RXACT_COMMITTED ((NTSTATUS)0x0000010AL)
+#define STATUS_NOTIFY_CLEANUP ((NTSTATUS)0x0000010BL)
+#define STATUS_NOTIFY_ENUM_DIR ((NTSTATUS)0x0000010CL)
+#define STATUS_NO_QUOTAS_FOR_ACCOUNT ((NTSTATUS)0x0000010DL)
+#define STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED ((NTSTATUS)0x0000010EL)
+#define STATUS_PAGE_FAULT_TRANSITION ((NTSTATUS)0x00000110L)
+#define STATUS_PAGE_FAULT_DEMAND_ZERO ((NTSTATUS)0x00000111L)
+#define STATUS_PAGE_FAULT_COPY_ON_WRITE ((NTSTATUS)0x00000112L)
+#define STATUS_PAGE_FAULT_GUARD_PAGE ((NTSTATUS)0x00000113L)
+#define STATUS_PAGE_FAULT_PAGING_FILE ((NTSTATUS)0x00000114L)
+#define STATUS_CACHE_PAGE_LOCKED ((NTSTATUS)0x00000115L)
+#define STATUS_CRASH_DUMP ((NTSTATUS)0x00000116L)
+#define STATUS_BUFFER_ALL_ZEROS ((NTSTATUS)0x00000117L)
+#define STATUS_REPARSE_OBJECT ((NTSTATUS)0x00000118L)
+#define STATUS_RESOURCE_REQUIREMENTS_CHANGED ((NTSTATUS)0x00000119L)
+#define STATUS_TRANSLATION_COMPLETE ((NTSTATUS)0x00000120L)
+#define STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY ((NTSTATUS)0x00000121L)
+#define STATUS_NOTHING_TO_TERMINATE ((NTSTATUS)0x00000122L)
+#define STATUS_PROCESS_NOT_IN_JOB ((NTSTATUS)0x00000123L)
+#define STATUS_PROCESS_IN_JOB ((NTSTATUS)0x00000124L)
+#define STATUS_OBJECT_NAME_EXISTS ((NTSTATUS)0x40000000L)
+#define STATUS_THREAD_WAS_SUSPENDED ((NTSTATUS)0x40000001L)
+#define STATUS_WORKING_SET_LIMIT_RANGE ((NTSTATUS)0x40000002L)
+#define STATUS_IMAGE_NOT_AT_BASE ((NTSTATUS)0x40000003L)
+#define STATUS_RXACT_STATE_CREATED ((NTSTATUS)0x40000004L)
+#define STATUS_SEGMENT_NOTIFICATION ((NTSTATUS)0x40000005L)
+#define STATUS_LOCAL_USER_SESSION_KEY ((NTSTATUS)0x40000006L)
+#define STATUS_BAD_CURRENT_DIRECTORY ((NTSTATUS)0x40000007L)
+#define STATUS_SERIAL_MORE_WRITES ((NTSTATUS)0x40000008L)
+#define STATUS_REGISTRY_RECOVERED ((NTSTATUS)0x40000009L)
+#define STATUS_FT_READ_RECOVERY_FROM_BACKUP ((NTSTATUS)0x4000000AL)
+#define STATUS_FT_WRITE_RECOVERY ((NTSTATUS)0x4000000BL)
+#define STATUS_SERIAL_COUNTER_TIMEOUT ((NTSTATUS)0x4000000CL)
+#define STATUS_NULL_LM_PASSWORD ((NTSTATUS)0x4000000DL)
+#define STATUS_IMAGE_MACHINE_TYPE_MISMATCH ((NTSTATUS)0x4000000EL)
+#define STATUS_RECEIVE_PARTIAL ((NTSTATUS)0x4000000FL)
+#define STATUS_RECEIVE_EXPEDITED ((NTSTATUS)0x40000010L)
+#define STATUS_RECEIVE_PARTIAL_EXPEDITED ((NTSTATUS)0x40000011L)
+#define STATUS_EVENT_DONE ((NTSTATUS)0x40000012L)
+#define STATUS_EVENT_PENDING ((NTSTATUS)0x40000013L)
+#define STATUS_CHECKING_FILE_SYSTEM ((NTSTATUS)0x40000014L)
+#define STATUS_FATAL_APP_EXIT ((NTSTATUS)0x40000015L)
+#define STATUS_PREDEFINED_HANDLE ((NTSTATUS)0x40000016L)
+#define STATUS_WAS_UNLOCKED ((NTSTATUS)0x40000017L)
+#define STATUS_SERVICE_NOTIFICATION ((NTSTATUS)0x40000018L)
+#define STATUS_WAS_LOCKED ((NTSTATUS)0x40000019L)
+#define STATUS_LOG_HARD_ERROR ((NTSTATUS)0x4000001AL)
+#define STATUS_ALREADY_WIN32 ((NTSTATUS)0x4000001BL)
+#define STATUS_WX86_UNSIMULATE ((NTSTATUS)0x4000001CL)
+#define STATUS_WX86_CONTINUE ((NTSTATUS)0x4000001DL)
+#define STATUS_WX86_SINGLE_STEP ((NTSTATUS)0x4000001EL)
+#define STATUS_WX86_BREAKPOINT ((NTSTATUS)0x4000001FL)
+#define STATUS_WX86_EXCEPTION_CONTINUE ((NTSTATUS)0x40000020L)
+#define STATUS_WX86_EXCEPTION_LASTCHANCE ((NTSTATUS)0x40000021L)
+#define STATUS_WX86_EXCEPTION_CHAIN ((NTSTATUS)0x40000022L)
+#define STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE ((NTSTATUS)0x40000023L)
+#define STATUS_NO_YIELD_PERFORMED ((NTSTATUS)0x40000024L)
+#define STATUS_TIMER_RESUME_IGNORED ((NTSTATUS)0x40000025L)
+#define STATUS_ARBITRATION_UNHANDLED ((NTSTATUS)0x40000026L)
+#define STATUS_CARDBUS_NOT_SUPPORTED ((NTSTATUS)0x40000027L)
+#define STATUS_WX86_CREATEWX86TIB ((NTSTATUS)0x40000028L)
+#define STATUS_MP_PROCESSOR_MISMATCH ((NTSTATUS)0x40000029L)
+#define STATUS_HIBERNATED ((NTSTATUS)0x4000002AL)
+#define STATUS_RESUME_HIBERNATION ((NTSTATUS)0x4000002BL)
+#define STATUS_GUARD_PAGE_VIOLATION ((NTSTATUS)0x80000001L)
+#define STATUS_DATATYPE_MISALIGNMENT ((NTSTATUS)0x80000002L)
+#define STATUS_BREAKPOINT ((NTSTATUS)0x80000003L)
+#define STATUS_SINGLE_STEP ((NTSTATUS)0x80000004L)
+#define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L)
+#define STATUS_NO_MORE_FILES ((NTSTATUS)0x80000006L)
+#define STATUS_WAKE_SYSTEM_DEBUGGER ((NTSTATUS)0x80000007L)
+#define STATUS_HANDLES_CLOSED ((NTSTATUS)0x8000000AL)
+#define STATUS_NO_INHERITANCE ((NTSTATUS)0x8000000BL)
+#define STATUS_GUID_SUBSTITUTION_MADE ((NTSTATUS)0x8000000CL)
+#define STATUS_PARTIAL_COPY ((NTSTATUS)0x8000000DL)
+#define STATUS_DEVICE_PAPER_EMPTY ((NTSTATUS)0x8000000EL)
+#define STATUS_DEVICE_POWERED_OFF ((NTSTATUS)0x8000000FL)
+#define STATUS_DEVICE_OFF_LINE ((NTSTATUS)0x80000010L)
+#define STATUS_DEVICE_BUSY ((NTSTATUS)0x80000011L)
+#define STATUS_NO_MORE_EAS ((NTSTATUS)0x80000012L)
+#define STATUS_INVALID_EA_NAME ((NTSTATUS)0x80000013L)
+#define STATUS_EA_LIST_INCONSISTENT ((NTSTATUS)0x80000014L)
+#define STATUS_INVALID_EA_FLAG ((NTSTATUS)0x80000015L)
+#define STATUS_VERIFY_REQUIRED ((NTSTATUS)0x80000016L)
+#define STATUS_EXTRANEOUS_INFORMATION ((NTSTATUS)0x80000017L)
+#define STATUS_RXACT_COMMIT_NECESSARY ((NTSTATUS)0x80000018L)
+#define STATUS_NO_MORE_ENTRIES ((NTSTATUS)0x8000001AL)
+#define STATUS_FILEMARK_DETECTED ((NTSTATUS)0x8000001BL)
+#define STATUS_MEDIA_CHANGED ((NTSTATUS)0x8000001CL)
+#define STATUS_BUS_RESET ((NTSTATUS)0x8000001DL)
+#define STATUS_END_OF_MEDIA ((NTSTATUS)0x8000001EL)
+#define STATUS_BEGINNING_OF_MEDIA ((NTSTATUS)0x8000001FL)
+#define STATUS_MEDIA_CHECK ((NTSTATUS)0x80000020L)
+#define STATUS_SETMARK_DETECTED ((NTSTATUS)0x80000021L)
+#define STATUS_NO_DATA_DETECTED ((NTSTATUS)0x80000022L)
+#define STATUS_REDIRECTOR_HAS_OPEN_HANDLES ((NTSTATUS)0x80000023L)
+#define STATUS_SERVER_HAS_OPEN_HANDLES ((NTSTATUS)0x80000024L)
+#define STATUS_ALREADY_DISCONNECTED ((NTSTATUS)0x80000025L)
+#define STATUS_LONGJUMP ((NTSTATUS)0x80000026L)
+#define STATUS_CLEANER_CARTRIDGE_INSTALLED ((NTSTATUS)0x80000027L)
+#define STATUS_PLUGPLAY_QUERY_VETOED ((NTSTATUS)0x80000028L)
+#define STATUS_UNWIND_CONSOLIDATE ((NTSTATUS)0x80000029L)
+#define STATUS_CLUSTER_NODE_ALREADY_UP ((NTSTATUS)0x80130001L)
+#define STATUS_CLUSTER_NODE_ALREADY_DOWN ((NTSTATUS)0x80130002L)
+#define STATUS_CLUSTER_NETWORK_ALREADY_ONLINE ((NTSTATUS)0x80130003L)
+#define STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE ((NTSTATUS)0x80130004L)
+#define STATUS_CLUSTER_NODE_ALREADY_MEMBER ((NTSTATUS)0x80130005L)
+#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)
+#define STATUS_NOT_IMPLEMENTED ((NTSTATUS)0xC0000002L)
+#define STATUS_INVALID_INFO_CLASS ((NTSTATUS)0xC0000003L)
+#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
+#define STATUS_ACCESS_VIOLATION ((NTSTATUS)0xC0000005L)
+#define STATUS_IN_PAGE_ERROR ((NTSTATUS)0xC0000006L)
+#define STATUS_PAGEFILE_QUOTA ((NTSTATUS)0xC0000007L)
+#define STATUS_INVALID_HANDLE ((NTSTATUS)0xC0000008L)
+#define STATUS_BAD_INITIAL_STACK ((NTSTATUS)0xC0000009L)
+#define STATUS_BAD_INITIAL_PC ((NTSTATUS)0xC000000AL)
+#define STATUS_INVALID_CID ((NTSTATUS)0xC000000BL)
+#define STATUS_TIMER_NOT_CANCELED ((NTSTATUS)0xC000000CL)
+#define STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL)
+#define STATUS_NO_SUCH_DEVICE ((NTSTATUS)0xC000000EL)
+#define STATUS_NO_SUCH_FILE ((NTSTATUS)0xC000000FL)
+#define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS)0xC0000010L)
+#define STATUS_END_OF_FILE ((NTSTATUS)0xC0000011L)
+#define STATUS_WRONG_VOLUME ((NTSTATUS)0xC0000012L)
+#define STATUS_NO_MEDIA_IN_DEVICE ((NTSTATUS)0xC0000013L)
+#define STATUS_UNRECOGNIZED_MEDIA ((NTSTATUS)0xC0000014L)
+#define STATUS_NONEXISTENT_SECTOR ((NTSTATUS)0xC0000015L)
+#define STATUS_MORE_PROCESSING_REQUIRED ((NTSTATUS)0xC0000016L)
+#define STATUS_NO_MEMORY ((NTSTATUS)0xC0000017L)
+#define STATUS_CONFLICTING_ADDRESSES ((NTSTATUS)0xC0000018L)
+#define STATUS_NOT_MAPPED_VIEW ((NTSTATUS)0xC0000019L)
+#define STATUS_UNABLE_TO_FREE_VM ((NTSTATUS)0xC000001AL)
+#define STATUS_UNABLE_TO_DELETE_SECTION ((NTSTATUS)0xC000001BL)
+#define STATUS_INVALID_SYSTEM_SERVICE ((NTSTATUS)0xC000001CL)
+#define STATUS_ILLEGAL_INSTRUCTION ((NTSTATUS)0xC000001DL)
+#define STATUS_INVALID_LOCK_SEQUENCE ((NTSTATUS)0xC000001EL)
+#define STATUS_INVALID_VIEW_SIZE ((NTSTATUS)0xC000001FL)
+#define STATUS_INVALID_FILE_FOR_SECTION ((NTSTATUS)0xC0000020L)
+#define STATUS_ALREADY_COMMITTED ((NTSTATUS)0xC0000021L)
+#define STATUS_ACCESS_DENIED ((NTSTATUS)0xC0000022L)
+#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023L)
+#define STATUS_OBJECT_TYPE_MISMATCH ((NTSTATUS)0xC0000024L)
+#define STATUS_NONCONTINUABLE_EXCEPTION ((NTSTATUS)0xC0000025L)
+#define STATUS_INVALID_DISPOSITION ((NTSTATUS)0xC0000026L)
+#define STATUS_UNWIND ((NTSTATUS)0xC0000027L)
+#define STATUS_BAD_STACK ((NTSTATUS)0xC0000028L)
+#define STATUS_INVALID_UNWIND_TARGET ((NTSTATUS)0xC0000029L)
+#define STATUS_NOT_LOCKED ((NTSTATUS)0xC000002AL)
+#define STATUS_PARITY_ERROR ((NTSTATUS)0xC000002BL)
+#define STATUS_UNABLE_TO_DECOMMIT_VM ((NTSTATUS)0xC000002CL)
+#define STATUS_NOT_COMMITTED ((NTSTATUS)0xC000002DL)
+#define STATUS_INVALID_PORT_ATTRIBUTES ((NTSTATUS)0xC000002EL)
+#define STATUS_PORT_MESSAGE_TOO_LONG ((NTSTATUS)0xC000002FL)
+#define STATUS_INVALID_PARAMETER_MIX ((NTSTATUS)0xC0000030L)
+#define STATUS_INVALID_QUOTA_LOWER ((NTSTATUS)0xC0000031L)
+#define STATUS_DISK_CORRUPT_ERROR ((NTSTATUS)0xC0000032L)
+#define STATUS_OBJECT_NAME_INVALID ((NTSTATUS)0xC0000033L)
+#define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS)0xC0000034L)
+#define STATUS_OBJECT_NAME_COLLISION ((NTSTATUS)0xC0000035L)
+#define STATUS_PORT_DISCONNECTED ((NTSTATUS)0xC0000037L)
+#define STATUS_DEVICE_ALREADY_ATTACHED ((NTSTATUS)0xC0000038L)
+#define STATUS_OBJECT_PATH_INVALID ((NTSTATUS)0xC0000039L)
+#define STATUS_OBJECT_PATH_NOT_FOUND ((NTSTATUS)0xC000003AL)
+#define STATUS_OBJECT_PATH_SYNTAX_BAD ((NTSTATUS)0xC000003BL)
+#define STATUS_DATA_OVERRUN ((NTSTATUS)0xC000003CL)
+#define STATUS_DATA_LATE_ERROR ((NTSTATUS)0xC000003DL)
+#define STATUS_DATA_ERROR ((NTSTATUS)0xC000003EL)
+#define STATUS_CRC_ERROR ((NTSTATUS)0xC000003FL)
+#define STATUS_SECTION_TOO_BIG ((NTSTATUS)0xC0000040L)
+#define STATUS_PORT_CONNECTION_REFUSED ((NTSTATUS)0xC0000041L)
+#define STATUS_INVALID_PORT_HANDLE ((NTSTATUS)0xC0000042L)
+#define STATUS_SHARING_VIOLATION ((NTSTATUS)0xC0000043L)
+#define STATUS_QUOTA_EXCEEDED ((NTSTATUS)0xC0000044L)
+#define STATUS_INVALID_PAGE_PROTECTION ((NTSTATUS)0xC0000045L)
+#define STATUS_MUTANT_NOT_OWNED ((NTSTATUS)0xC0000046L)
+#define STATUS_SEMAPHORE_LIMIT_EXCEEDED ((NTSTATUS)0xC0000047L)
+#define STATUS_PORT_ALREADY_SET ((NTSTATUS)0xC0000048L)
+#define STATUS_SECTION_NOT_IMAGE ((NTSTATUS)0xC0000049L)
+#define STATUS_SUSPEND_COUNT_EXCEEDED ((NTSTATUS)0xC000004AL)
+#define STATUS_THREAD_IS_TERMINATING ((NTSTATUS)0xC000004BL)
+#define STATUS_BAD_WORKING_SET_LIMIT ((NTSTATUS)0xC000004CL)
+#define STATUS_INCOMPATIBLE_FILE_MAP ((NTSTATUS)0xC000004DL)
+#define STATUS_SECTION_PROTECTION ((NTSTATUS)0xC000004EL)
+#define STATUS_EAS_NOT_SUPPORTED ((NTSTATUS)0xC000004FL)
+#define STATUS_EA_TOO_LARGE ((NTSTATUS)0xC0000050L)
+#define STATUS_NONEXISTENT_EA_ENTRY ((NTSTATUS)0xC0000051L)
+#define STATUS_NO_EAS_ON_FILE ((NTSTATUS)0xC0000052L)
+#define STATUS_EA_CORRUPT_ERROR ((NTSTATUS)0xC0000053L)
+#define STATUS_FILE_LOCK_CONFLICT ((NTSTATUS)0xC0000054L)
+#define STATUS_LOCK_NOT_GRANTED ((NTSTATUS)0xC0000055L)
+#define STATUS_DELETE_PENDING ((NTSTATUS)0xC0000056L)
+#define STATUS_CTL_FILE_NOT_SUPPORTED ((NTSTATUS)0xC0000057L)
+#define STATUS_UNKNOWN_REVISION ((NTSTATUS)0xC0000058L)
+#define STATUS_REVISION_MISMATCH ((NTSTATUS)0xC0000059L)
+#define STATUS_INVALID_OWNER ((NTSTATUS)0xC000005AL)
+#define STATUS_INVALID_PRIMARY_GROUP ((NTSTATUS)0xC000005BL)
+#define STATUS_NO_IMPERSONATION_TOKEN ((NTSTATUS)0xC000005CL)
+#define STATUS_CANT_DISABLE_MANDATORY ((NTSTATUS)0xC000005DL)
+#define STATUS_NO_LOGON_SERVERS ((NTSTATUS)0xC000005EL)
+#define STATUS_NO_SUCH_LOGON_SESSION ((NTSTATUS)0xC000005FL)
+#define STATUS_NO_SUCH_PRIVILEGE ((NTSTATUS)0xC0000060L)
+#define STATUS_PRIVILEGE_NOT_HELD ((NTSTATUS)0xC0000061L)
+#define STATUS_INVALID_ACCOUNT_NAME ((NTSTATUS)0xC0000062L)
+#define STATUS_USER_EXISTS ((NTSTATUS)0xC0000063L)
+#define STATUS_NO_SUCH_USER ((NTSTATUS)0xC0000064L)
+#define STATUS_GROUP_EXISTS ((NTSTATUS)0xC0000065L)
+#define STATUS_NO_SUCH_GROUP ((NTSTATUS)0xC0000066L)
+#define STATUS_MEMBER_IN_GROUP ((NTSTATUS)0xC0000067L)
+#define STATUS_MEMBER_NOT_IN_GROUP ((NTSTATUS)0xC0000068L)
+#define STATUS_LAST_ADMIN ((NTSTATUS)0xC0000069L)
+#define STATUS_WRONG_PASSWORD ((NTSTATUS)0xC000006AL)
+#define STATUS_ILL_FORMED_PASSWORD ((NTSTATUS)0xC000006BL)
+#define STATUS_PASSWORD_RESTRICTION ((NTSTATUS)0xC000006CL)
+#define STATUS_LOGON_FAILURE ((NTSTATUS)0xC000006DL)
+#define STATUS_ACCOUNT_RESTRICTION ((NTSTATUS)0xC000006EL)
+#define STATUS_INVALID_LOGON_HOURS ((NTSTATUS)0xC000006FL)
+#define STATUS_INVALID_WORKSTATION ((NTSTATUS)0xC0000070L)
+#define STATUS_PASSWORD_EXPIRED ((NTSTATUS)0xC0000071L)
+#define STATUS_ACCOUNT_DISABLED ((NTSTATUS)0xC0000072L)
+#define STATUS_NONE_MAPPED ((NTSTATUS)0xC0000073L)
+#define STATUS_TOO_MANY_LUIDS_REQUESTED ((NTSTATUS)0xC0000074L)
+#define STATUS_LUIDS_EXHAUSTED ((NTSTATUS)0xC0000075L)
+#define STATUS_INVALID_SUB_AUTHORITY ((NTSTATUS)0xC0000076L)
+#define STATUS_INVALID_ACL ((NTSTATUS)0xC0000077L)
+#define STATUS_INVALID_SID ((NTSTATUS)0xC0000078L)
+#define STATUS_INVALID_SECURITY_DESCR ((NTSTATUS)0xC0000079L)
+#define STATUS_PROCEDURE_NOT_FOUND ((NTSTATUS)0xC000007AL)
+#define STATUS_INVALID_IMAGE_FORMAT ((NTSTATUS)0xC000007BL)
+#define STATUS_NO_TOKEN ((NTSTATUS)0xC000007CL)
+#define STATUS_BAD_INHERITANCE_ACL ((NTSTATUS)0xC000007DL)
+#define STATUS_RANGE_NOT_LOCKED ((NTSTATUS)0xC000007EL)
+#define STATUS_DISK_FULL ((NTSTATUS)0xC000007FL)
+#define STATUS_SERVER_DISABLED ((NTSTATUS)0xC0000080L)
+#define STATUS_SERVER_NOT_DISABLED ((NTSTATUS)0xC0000081L)
+#define STATUS_TOO_MANY_GUIDS_REQUESTED ((NTSTATUS)0xC0000082L)
+#define STATUS_GUIDS_EXHAUSTED ((NTSTATUS)0xC0000083L)
+#define STATUS_INVALID_ID_AUTHORITY ((NTSTATUS)0xC0000084L)
+#define STATUS_AGENTS_EXHAUSTED ((NTSTATUS)0xC0000085L)
+#define STATUS_INVALID_VOLUME_LABEL ((NTSTATUS)0xC0000086L)
+#define STATUS_SECTION_NOT_EXTENDED ((NTSTATUS)0xC0000087L)
+#define STATUS_NOT_MAPPED_DATA ((NTSTATUS)0xC0000088L)
+#define STATUS_RESOURCE_DATA_NOT_FOUND ((NTSTATUS)0xC0000089L)
+#define STATUS_RESOURCE_TYPE_NOT_FOUND ((NTSTATUS)0xC000008AL)
+#define STATUS_RESOURCE_NAME_NOT_FOUND ((NTSTATUS)0xC000008BL)
+#define STATUS_ARRAY_BOUNDS_EXCEEDED ((NTSTATUS)0xC000008CL)
+#define STATUS_FLOAT_DENORMAL_OPERAND ((NTSTATUS)0xC000008DL)
+#define STATUS_FLOAT_DIVIDE_BY_ZERO ((NTSTATUS)0xC000008EL)
+#define STATUS_FLOAT_INEXACT_RESULT ((NTSTATUS)0xC000008FL)
+#define STATUS_FLOAT_INVALID_OPERATION ((NTSTATUS)0xC0000090L)
+#define STATUS_FLOAT_OVERFLOW ((NTSTATUS)0xC0000091L)
+#define STATUS_FLOAT_STACK_CHECK ((NTSTATUS)0xC0000092L)
+#define STATUS_FLOAT_UNDERFLOW ((NTSTATUS)0xC0000093L)
+#define STATUS_INTEGER_DIVIDE_BY_ZERO ((NTSTATUS)0xC0000094L)
+#define STATUS_INTEGER_OVERFLOW ((NTSTATUS)0xC0000095L)
+#define STATUS_PRIVILEGED_INSTRUCTION ((NTSTATUS)0xC0000096L)
+#define STATUS_TOO_MANY_PAGING_FILES ((NTSTATUS)0xC0000097L)
+#define STATUS_FILE_INVALID ((NTSTATUS)0xC0000098L)
+#define STATUS_ALLOTTED_SPACE_EXCEEDED ((NTSTATUS)0xC0000099L)
+#define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS)0xC000009AL)
+#define STATUS_DFS_EXIT_PATH_FOUND ((NTSTATUS)0xC000009BL)
+#define STATUS_DEVICE_DATA_ERROR ((NTSTATUS)0xC000009CL)
+#define STATUS_DEVICE_NOT_CONNECTED ((NTSTATUS)0xC000009DL)
+#define STATUS_DEVICE_POWER_FAILURE ((NTSTATUS)0xC000009EL)
+#define STATUS_FREE_VM_NOT_AT_BASE ((NTSTATUS)0xC000009FL)
+#define STATUS_MEMORY_NOT_ALLOCATED ((NTSTATUS)0xC00000A0L)
+#define STATUS_WORKING_SET_QUOTA ((NTSTATUS)0xC00000A1L)
+#define STATUS_MEDIA_WRITE_PROTECTED ((NTSTATUS)0xC00000A2L)
+#define STATUS_DEVICE_NOT_READY ((NTSTATUS)0xC00000A3L)
+#define STATUS_INVALID_GROUP_ATTRIBUTES ((NTSTATUS)0xC00000A4L)
+#define STATUS_BAD_IMPERSONATION_LEVEL ((NTSTATUS)0xC00000A5L)
+#define STATUS_CANT_OPEN_ANONYMOUS ((NTSTATUS)0xC00000A6L)
+#define STATUS_BAD_VALIDATION_CLASS ((NTSTATUS)0xC00000A7L)
+#define STATUS_BAD_TOKEN_TYPE ((NTSTATUS)0xC00000A8L)
+#define STATUS_BAD_MASTER_BOOT_RECORD ((NTSTATUS)0xC00000A9L)
+#define STATUS_INSTRUCTION_MISALIGNMENT ((NTSTATUS)0xC00000AAL)
+#define STATUS_INSTANCE_NOT_AVAILABLE ((NTSTATUS)0xC00000ABL)
+#define STATUS_PIPE_NOT_AVAILABLE ((NTSTATUS)0xC00000ACL)
+#define STATUS_INVALID_PIPE_STATE ((NTSTATUS)0xC00000ADL)
+#define STATUS_PIPE_BUSY ((NTSTATUS)0xC00000AEL)
+#define STATUS_ILLEGAL_FUNCTION ((NTSTATUS)0xC00000AFL)
+#define STATUS_PIPE_DISCONNECTED ((NTSTATUS)0xC00000B0L)
+#define STATUS_PIPE_CLOSING ((NTSTATUS)0xC00000B1L)
+#define STATUS_PIPE_CONNECTED ((NTSTATUS)0xC00000B2L)
+#define STATUS_PIPE_LISTENING ((NTSTATUS)0xC00000B3L)
+#define STATUS_INVALID_READ_MODE ((NTSTATUS)0xC00000B4L)
+#define STATUS_IO_TIMEOUT ((NTSTATUS)0xC00000B5L)
+#define STATUS_FILE_FORCED_CLOSED ((NTSTATUS)0xC00000B6L)
+#define STATUS_PROFILING_NOT_STARTED ((NTSTATUS)0xC00000B7L)
+#define STATUS_PROFILING_NOT_STOPPED ((NTSTATUS)0xC00000B8L)
+#define STATUS_COULD_NOT_INTERPRET ((NTSTATUS)0xC00000B9L)
+#define STATUS_FILE_IS_A_DIRECTORY ((NTSTATUS)0xC00000BAL)
+#define STATUS_NOT_SUPPORTED ((NTSTATUS)0xC00000BBL)
+#define STATUS_REMOTE_NOT_LISTENING ((NTSTATUS)0xC00000BCL)
+#define STATUS_DUPLICATE_NAME ((NTSTATUS)0xC00000BDL)
+#define STATUS_BAD_NETWORK_PATH ((NTSTATUS)0xC00000BEL)
+#define STATUS_NETWORK_BUSY ((NTSTATUS)0xC00000BFL)
+#define STATUS_DEVICE_DOES_NOT_EXIST ((NTSTATUS)0xC00000C0L)
+#define STATUS_TOO_MANY_COMMANDS ((NTSTATUS)0xC00000C1L)
+#define STATUS_ADAPTER_HARDWARE_ERROR ((NTSTATUS)0xC00000C2L)
+#define STATUS_INVALID_NETWORK_RESPONSE ((NTSTATUS)0xC00000C3L)
+#define STATUS_UNEXPECTED_NETWORK_ERROR ((NTSTATUS)0xC00000C4L)
+#define STATUS_BAD_REMOTE_ADAPTER ((NTSTATUS)0xC00000C5L)
+#define STATUS_PRINT_QUEUE_FULL ((NTSTATUS)0xC00000C6L)
+#define STATUS_NO_SPOOL_SPACE ((NTSTATUS)0xC00000C7L)
+#define STATUS_PRINT_CANCELLED ((NTSTATUS)0xC00000C8L)
+#define STATUS_NETWORK_NAME_DELETED ((NTSTATUS)0xC00000C9L)
+#define STATUS_NETWORK_ACCESS_DENIED ((NTSTATUS)0xC00000CAL)
+#define STATUS_BAD_DEVICE_TYPE ((NTSTATUS)0xC00000CBL)
+#define STATUS_BAD_NETWORK_NAME ((NTSTATUS)0xC00000CCL)
+#define STATUS_TOO_MANY_NAMES ((NTSTATUS)0xC00000CDL)
+#define STATUS_TOO_MANY_SESSIONS ((NTSTATUS)0xC00000CEL)
+#define STATUS_SHARING_PAUSED ((NTSTATUS)0xC00000CFL)
+#define STATUS_REQUEST_NOT_ACCEPTED ((NTSTATUS)0xC00000D0L)
+#define STATUS_REDIRECTOR_PAUSED ((NTSTATUS)0xC00000D1L)
+#define STATUS_NET_WRITE_FAULT ((NTSTATUS)0xC00000D2L)
+#define STATUS_PROFILING_AT_LIMIT ((NTSTATUS)0xC00000D3L)
+#define STATUS_NOT_SAME_DEVICE ((NTSTATUS)0xC00000D4L)
+#define STATUS_FILE_RENAMED ((NTSTATUS)0xC00000D5L)
+#define STATUS_VIRTUAL_CIRCUIT_CLOSED ((NTSTATUS)0xC00000D6L)
+#define STATUS_NO_SECURITY_ON_OBJECT ((NTSTATUS)0xC00000D7L)
+#define STATUS_CANT_WAIT ((NTSTATUS)0xC00000D8L)
+#define STATUS_PIPE_EMPTY ((NTSTATUS)0xC00000D9L)
+#define STATUS_CANT_ACCESS_DOMAIN_INFO ((NTSTATUS)0xC00000DAL)
+#define STATUS_CANT_TERMINATE_SELF ((NTSTATUS)0xC00000DBL)
+#define STATUS_INVALID_SERVER_STATE ((NTSTATUS)0xC00000DCL)
+#define STATUS_INVALID_DOMAIN_STATE ((NTSTATUS)0xC00000DDL)
+#define STATUS_INVALID_DOMAIN_ROLE ((NTSTATUS)0xC00000DEL)
+#define STATUS_NO_SUCH_DOMAIN ((NTSTATUS)0xC00000DFL)
+#define STATUS_DOMAIN_EXISTS ((NTSTATUS)0xC00000E0L)
+#define STATUS_DOMAIN_LIMIT_EXCEEDED ((NTSTATUS)0xC00000E1L)
+#define STATUS_OPLOCK_NOT_GRANTED ((NTSTATUS)0xC00000E2L)
+#define STATUS_INVALID_OPLOCK_PROTOCOL ((NTSTATUS)0xC00000E3L)
+#define STATUS_INTERNAL_DB_CORRUPTION ((NTSTATUS)0xC00000E4L)
+#define STATUS_INTERNAL_ERROR ((NTSTATUS)0xC00000E5L)
+#define STATUS_GENERIC_NOT_MAPPED ((NTSTATUS)0xC00000E6L)
+#define STATUS_BAD_DESCRIPTOR_FORMAT ((NTSTATUS)0xC00000E7L)
+#define STATUS_INVALID_USER_BUFFER ((NTSTATUS)0xC00000E8L)
+#define STATUS_UNEXPECTED_IO_ERROR ((NTSTATUS)0xC00000E9L)
+#define STATUS_UNEXPECTED_MM_CREATE_ERR ((NTSTATUS)0xC00000EAL)
+#define STATUS_UNEXPECTED_MM_MAP_ERROR ((NTSTATUS)0xC00000EBL)
+#define STATUS_UNEXPECTED_MM_EXTEND_ERR ((NTSTATUS)0xC00000ECL)
+#define STATUS_NOT_LOGON_PROCESS ((NTSTATUS)0xC00000EDL)
+#define STATUS_LOGON_SESSION_EXISTS ((NTSTATUS)0xC00000EEL)
+#define STATUS_INVALID_PARAMETER_1 ((NTSTATUS)0xC00000EFL)
+#define STATUS_INVALID_PARAMETER_2 ((NTSTATUS)0xC00000F0L)
+#define STATUS_INVALID_PARAMETER_3 ((NTSTATUS)0xC00000F1L)
+#define STATUS_INVALID_PARAMETER_4 ((NTSTATUS)0xC00000F2L)
+#define STATUS_INVALID_PARAMETER_5 ((NTSTATUS)0xC00000F3L)
+#define STATUS_INVALID_PARAMETER_6 ((NTSTATUS)0xC00000F4L)
+#define STATUS_INVALID_PARAMETER_7 ((NTSTATUS)0xC00000F5L)
+#define STATUS_INVALID_PARAMETER_8 ((NTSTATUS)0xC00000F6L)
+#define STATUS_INVALID_PARAMETER_9 ((NTSTATUS)0xC00000F7L)
+#define STATUS_INVALID_PARAMETER_10 ((NTSTATUS)0xC00000F8L)
+#define STATUS_INVALID_PARAMETER_11 ((NTSTATUS)0xC00000F9L)
+#define STATUS_INVALID_PARAMETER_12 ((NTSTATUS)0xC00000FAL)
+#define STATUS_REDIRECTOR_NOT_STARTED ((NTSTATUS)0xC00000FBL)
+#define STATUS_REDIRECTOR_STARTED ((NTSTATUS)0xC00000FCL)
+#define STATUS_STACK_OVERFLOW ((NTSTATUS)0xC00000FDL)
+#define STATUS_NO_SUCH_PACKAGE ((NTSTATUS)0xC00000FEL)
+#define STATUS_BAD_FUNCTION_TABLE ((NTSTATUS)0xC00000FFL)
+#define STATUS_VARIABLE_NOT_FOUND ((NTSTATUS)0xC0000100L)
+#define STATUS_DIRECTORY_NOT_EMPTY ((NTSTATUS)0xC0000101L)
+#define STATUS_FILE_CORRUPT_ERROR ((NTSTATUS)0xC0000102L)
+#define STATUS_NOT_A_DIRECTORY ((NTSTATUS)0xC0000103L)
+#define STATUS_BAD_LOGON_SESSION_STATE ((NTSTATUS)0xC0000104L)
+#define STATUS_LOGON_SESSION_COLLISION ((NTSTATUS)0xC0000105L)
+#define STATUS_NAME_TOO_LONG ((NTSTATUS)0xC0000106L)
+#define STATUS_FILES_OPEN ((NTSTATUS)0xC0000107L)
+#define STATUS_CONNECTION_IN_USE ((NTSTATUS)0xC0000108L)
+#define STATUS_MESSAGE_NOT_FOUND ((NTSTATUS)0xC0000109L)
+#define STATUS_PROCESS_IS_TERMINATING ((NTSTATUS)0xC000010AL)
+#define STATUS_INVALID_LOGON_TYPE ((NTSTATUS)0xC000010BL)
+#define STATUS_NO_GUID_TRANSLATION ((NTSTATUS)0xC000010CL)
+#define STATUS_CANNOT_IMPERSONATE ((NTSTATUS)0xC000010DL)
+#define STATUS_IMAGE_ALREADY_LOADED ((NTSTATUS)0xC000010EL)
+#define STATUS_ABIOS_NOT_PRESENT ((NTSTATUS)0xC000010FL)
+#define STATUS_ABIOS_LID_NOT_EXIST ((NTSTATUS)0xC0000110L)
+#define STATUS_ABIOS_LID_ALREADY_OWNED ((NTSTATUS)0xC0000111L)
+#define STATUS_ABIOS_NOT_LID_OWNER ((NTSTATUS)0xC0000112L)
+#define STATUS_ABIOS_INVALID_COMMAND ((NTSTATUS)0xC0000113L)
+#define STATUS_ABIOS_INVALID_LID ((NTSTATUS)0xC0000114L)
+#define STATUS_ABIOS_SELECTOR_NOT_AVAILABLE ((NTSTATUS)0xC0000115L)
+#define STATUS_ABIOS_INVALID_SELECTOR ((NTSTATUS)0xC0000116L)
+#define STATUS_NO_LDT ((NTSTATUS)0xC0000117L)
+#define STATUS_INVALID_LDT_SIZE ((NTSTATUS)0xC0000118L)
+#define STATUS_INVALID_LDT_OFFSET ((NTSTATUS)0xC0000119L)
+#define STATUS_INVALID_LDT_DESCRIPTOR ((NTSTATUS)0xC000011AL)
+#define STATUS_INVALID_IMAGE_NE_FORMAT ((NTSTATUS)0xC000011BL)
+#define STATUS_RXACT_INVALID_STATE ((NTSTATUS)0xC000011CL)
+#define STATUS_RXACT_COMMIT_FAILURE ((NTSTATUS)0xC000011DL)
+#define STATUS_MAPPED_FILE_SIZE_ZERO ((NTSTATUS)0xC000011EL)
+#define STATUS_TOO_MANY_OPENED_FILES ((NTSTATUS)0xC000011FL)
+#define STATUS_CANCELLED ((NTSTATUS)0xC0000120L)
+#define STATUS_CANNOT_DELETE ((NTSTATUS)0xC0000121L)
+#define STATUS_INVALID_COMPUTER_NAME ((NTSTATUS)0xC0000122L)
+#define STATUS_FILE_DELETED ((NTSTATUS)0xC0000123L)
+#define STATUS_SPECIAL_ACCOUNT ((NTSTATUS)0xC0000124L)
+#define STATUS_SPECIAL_GROUP ((NTSTATUS)0xC0000125L)
+#define STATUS_SPECIAL_USER ((NTSTATUS)0xC0000126L)
+#define STATUS_MEMBERS_PRIMARY_GROUP ((NTSTATUS)0xC0000127L)
+#define STATUS_FILE_CLOSED ((NTSTATUS)0xC0000128L)
+#define STATUS_TOO_MANY_THREADS ((NTSTATUS)0xC0000129L)
+#define STATUS_THREAD_NOT_IN_PROCESS ((NTSTATUS)0xC000012AL)
+#define STATUS_TOKEN_ALREADY_IN_USE ((NTSTATUS)0xC000012BL)
+#define STATUS_PAGEFILE_QUOTA_EXCEEDED ((NTSTATUS)0xC000012CL)
+#define STATUS_COMMITMENT_LIMIT ((NTSTATUS)0xC000012DL)
+#define STATUS_INVALID_IMAGE_LE_FORMAT ((NTSTATUS)0xC000012EL)
+#define STATUS_INVALID_IMAGE_NOT_MZ ((NTSTATUS)0xC000012FL)
+#define STATUS_INVALID_IMAGE_PROTECT ((NTSTATUS)0xC0000130L)
+#define STATUS_INVALID_IMAGE_WIN_16 ((NTSTATUS)0xC0000131L)
+#define STATUS_LOGON_SERVER_CONFLICT ((NTSTATUS)0xC0000132L)
+#define STATUS_TIME_DIFFERENCE_AT_DC ((NTSTATUS)0xC0000133L)
+#define STATUS_SYNCHRONIZATION_REQUIRED ((NTSTATUS)0xC0000134L)
+#define STATUS_DLL_NOT_FOUND ((NTSTATUS)0xC0000135L)
+#define STATUS_OPEN_FAILED ((NTSTATUS)0xC0000136L)
+#define STATUS_IO_PRIVILEGE_FAILED ((NTSTATUS)0xC0000137L)
+#define STATUS_ORDINAL_NOT_FOUND ((NTSTATUS)0xC0000138L)
+#define STATUS_ENTRYPOINT_NOT_FOUND ((NTSTATUS)0xC0000139L)
+#define STATUS_CONTROL_C_EXIT ((NTSTATUS)0xC000013AL)
+#define STATUS_LOCAL_DISCONNECT ((NTSTATUS)0xC000013BL)
+#define STATUS_REMOTE_DISCONNECT ((NTSTATUS)0xC000013CL)
+#define STATUS_REMOTE_RESOURCES ((NTSTATUS)0xC000013DL)
+#define STATUS_LINK_FAILED ((NTSTATUS)0xC000013EL)
+#define STATUS_LINK_TIMEOUT ((NTSTATUS)0xC000013FL)
+#define STATUS_INVALID_CONNECTION ((NTSTATUS)0xC0000140L)
+#define STATUS_INVALID_ADDRESS ((NTSTATUS)0xC0000141L)
+#define STATUS_DLL_INIT_FAILED ((NTSTATUS)0xC0000142L)
+#define STATUS_MISSING_SYSTEMFILE ((NTSTATUS)0xC0000143L)
+#define STATUS_UNHANDLED_EXCEPTION ((NTSTATUS)0xC0000144L)
+#define STATUS_APP_INIT_FAILURE ((NTSTATUS)0xC0000145L)
+#define STATUS_PAGEFILE_CREATE_FAILED ((NTSTATUS)0xC0000146L)
+#define STATUS_NO_PAGEFILE ((NTSTATUS)0xC0000147L)
+#define STATUS_INVALID_LEVEL ((NTSTATUS)0xC0000148L)
+#define STATUS_WRONG_PASSWORD_CORE ((NTSTATUS)0xC0000149L)
+#define STATUS_ILLEGAL_FLOAT_CONTEXT ((NTSTATUS)0xC000014AL)
+#define STATUS_PIPE_BROKEN ((NTSTATUS)0xC000014BL)
+#define STATUS_REGISTRY_CORRUPT ((NTSTATUS)0xC000014CL)
+#define STATUS_REGISTRY_IO_FAILED ((NTSTATUS)0xC000014DL)
+#define STATUS_NO_EVENT_PAIR ((NTSTATUS)0xC000014EL)
+#define STATUS_UNRECOGNIZED_VOLUME ((NTSTATUS)0xC000014FL)
+#define STATUS_SERIAL_NO_DEVICE_INITED ((NTSTATUS)0xC0000150L)
+#define STATUS_NO_SUCH_ALIAS ((NTSTATUS)0xC0000151L)
+#define STATUS_MEMBER_NOT_IN_ALIAS ((NTSTATUS)0xC0000152L)
+#define STATUS_MEMBER_IN_ALIAS ((NTSTATUS)0xC0000153L)
+#define STATUS_ALIAS_EXISTS ((NTSTATUS)0xC0000154L)
+#define STATUS_LOGON_NOT_GRANTED ((NTSTATUS)0xC0000155L)
+#define STATUS_TOO_MANY_SECRETS ((NTSTATUS)0xC0000156L)
+#define STATUS_SECRET_TOO_LONG ((NTSTATUS)0xC0000157L)
+#define STATUS_INTERNAL_DB_ERROR ((NTSTATUS)0xC0000158L)
+#define STATUS_FULLSCREEN_MODE ((NTSTATUS)0xC0000159L)
+#define STATUS_TOO_MANY_CONTEXT_IDS ((NTSTATUS)0xC000015AL)
+#define STATUS_LOGON_TYPE_NOT_GRANTED ((NTSTATUS)0xC000015BL)
+#define STATUS_NOT_REGISTRY_FILE ((NTSTATUS)0xC000015CL)
+#define STATUS_NT_CROSS_ENCRYPTION_REQUIRED ((NTSTATUS)0xC000015DL)
+#define STATUS_DOMAIN_CTRLR_CONFIG_ERROR ((NTSTATUS)0xC000015EL)
+#define STATUS_FT_MISSING_MEMBER ((NTSTATUS)0xC000015FL)
+#define STATUS_ILL_FORMED_SERVICE_ENTRY ((NTSTATUS)0xC0000160L)
+#define STATUS_ILLEGAL_CHARACTER ((NTSTATUS)0xC0000161L)
+#define STATUS_UNMAPPABLE_CHARACTER ((NTSTATUS)0xC0000162L)
+#define STATUS_UNDEFINED_CHARACTER ((NTSTATUS)0xC0000163L)
+#define STATUS_FLOPPY_VOLUME ((NTSTATUS)0xC0000164L)
+#define STATUS_FLOPPY_ID_MARK_NOT_FOUND ((NTSTATUS)0xC0000165L)
+#define STATUS_FLOPPY_WRONG_CYLINDER ((NTSTATUS)0xC0000166L)
+#define STATUS_FLOPPY_UNKNOWN_ERROR ((NTSTATUS)0xC0000167L)
+#define STATUS_FLOPPY_BAD_REGISTERS ((NTSTATUS)0xC0000168L)
+#define STATUS_DISK_RECALIBRATE_FAILED ((NTSTATUS)0xC0000169L)
+#define STATUS_DISK_OPERATION_FAILED ((NTSTATUS)0xC000016AL)
+#define STATUS_DISK_RESET_FAILED ((NTSTATUS)0xC000016BL)
+#define STATUS_SHARED_IRQ_BUSY ((NTSTATUS)0xC000016CL)
+#define STATUS_FT_ORPHANING ((NTSTATUS)0xC000016DL)
+#define STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT ((NTSTATUS)0xC000016EL)
+#define STATUS_PARTITION_FAILURE ((NTSTATUS)0xC0000172L)
+#define STATUS_INVALID_BLOCK_LENGTH ((NTSTATUS)0xC0000173L)
+#define STATUS_DEVICE_NOT_PARTITIONED ((NTSTATUS)0xC0000174L)
+#define STATUS_UNABLE_TO_LOCK_MEDIA ((NTSTATUS)0xC0000175L)
+#define STATUS_UNABLE_TO_UNLOAD_MEDIA ((NTSTATUS)0xC0000176L)
+#define STATUS_EOM_OVERFLOW ((NTSTATUS)0xC0000177L)
+#define STATUS_NO_MEDIA ((NTSTATUS)0xC0000178L)
+#define STATUS_NO_SUCH_MEMBER ((NTSTATUS)0xC000017AL)
+#define STATUS_INVALID_MEMBER ((NTSTATUS)0xC000017BL)
+#define STATUS_KEY_DELETED ((NTSTATUS)0xC000017CL)
+#define STATUS_NO_LOG_SPACE ((NTSTATUS)0xC000017DL)
+#define STATUS_TOO_MANY_SIDS ((NTSTATUS)0xC000017EL)
+#define STATUS_LM_CROSS_ENCRYPTION_REQUIRED ((NTSTATUS)0xC000017FL)
+#define STATUS_KEY_HAS_CHILDREN ((NTSTATUS)0xC0000180L)
+#define STATUS_CHILD_MUST_BE_VOLATILE ((NTSTATUS)0xC0000181L)
+#define STATUS_DEVICE_CONFIGURATION_ERROR ((NTSTATUS)0xC0000182L)
+#define STATUS_DRIVER_INTERNAL_ERROR ((NTSTATUS)0xC0000183L)
+#define STATUS_INVALID_DEVICE_STATE ((NTSTATUS)0xC0000184L)
+#define STATUS_IO_DEVICE_ERROR ((NTSTATUS)0xC0000185L)
+#define STATUS_DEVICE_PROTOCOL_ERROR ((NTSTATUS)0xC0000186L)
+#define STATUS_BACKUP_CONTROLLER ((NTSTATUS)0xC0000187L)
+#define STATUS_LOG_FILE_FULL ((NTSTATUS)0xC0000188L)
+#define STATUS_TOO_LATE ((NTSTATUS)0xC0000189L)
+#define STATUS_NO_TRUST_LSA_SECRET ((NTSTATUS)0xC000018AL)
+#define STATUS_NO_TRUST_SAM_ACCOUNT ((NTSTATUS)0xC000018BL)
+#define STATUS_TRUSTED_DOMAIN_FAILURE ((NTSTATUS)0xC000018CL)
+#define STATUS_TRUSTED_RELATIONSHIP_FAILURE ((NTSTATUS)0xC000018DL)
+#define STATUS_EVENTLOG_FILE_CORRUPT ((NTSTATUS)0xC000018EL)
+#define STATUS_EVENTLOG_CANT_START ((NTSTATUS)0xC000018FL)
+#define STATUS_TRUST_FAILURE ((NTSTATUS)0xC0000190L)
+#define STATUS_MUTANT_LIMIT_EXCEEDED ((NTSTATUS)0xC0000191L)
+#define STATUS_NETLOGON_NOT_STARTED ((NTSTATUS)0xC0000192L)
+#define STATUS_ACCOUNT_EXPIRED ((NTSTATUS)0xC0000193L)
+#define STATUS_POSSIBLE_DEADLOCK ((NTSTATUS)0xC0000194L)
+#define STATUS_NETWORK_CREDENTIAL_CONFLICT ((NTSTATUS)0xC0000195L)
+#define STATUS_REMOTE_SESSION_LIMIT ((NTSTATUS)0xC0000196L)
+#define STATUS_EVENTLOG_FILE_CHANGED ((NTSTATUS)0xC0000197L)
+#define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT ((NTSTATUS)0xC0000198L)
+#define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT ((NTSTATUS)0xC0000199L)
+#define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT ((NTSTATUS)0xC000019AL)
+#define STATUS_DOMAIN_TRUST_INCONSISTENT ((NTSTATUS)0xC000019BL)
+#define STATUS_FS_DRIVER_REQUIRED ((NTSTATUS)0xC000019CL)
+#define STATUS_NO_USER_SESSION_KEY ((NTSTATUS)0xC0000202L)
+#define STATUS_USER_SESSION_DELETED ((NTSTATUS)0xC0000203L)
+#define STATUS_RESOURCE_LANG_NOT_FOUND ((NTSTATUS)0xC0000204L)
+#define STATUS_INSUFF_SERVER_RESOURCES ((NTSTATUS)0xC0000205L)
+#define STATUS_INVALID_BUFFER_SIZE ((NTSTATUS)0xC0000206L)
+#define STATUS_INVALID_ADDRESS_COMPONENT ((NTSTATUS)0xC0000207L)
+#define STATUS_INVALID_ADDRESS_WILDCARD ((NTSTATUS)0xC0000208L)
+#define STATUS_TOO_MANY_ADDRESSES ((NTSTATUS)0xC0000209L)
+#define STATUS_ADDRESS_ALREADY_EXISTS ((NTSTATUS)0xC000020AL)
+#define STATUS_ADDRESS_CLOSED ((NTSTATUS)0xC000020BL)
+#define STATUS_CONNECTION_DISCONNECTED ((NTSTATUS)0xC000020CL)
+#define STATUS_CONNECTION_RESET ((NTSTATUS)0xC000020DL)
+#define STATUS_TOO_MANY_NODES ((NTSTATUS)0xC000020EL)
+#define STATUS_TRANSACTION_ABORTED ((NTSTATUS)0xC000020FL)
+#define STATUS_TRANSACTION_TIMED_OUT ((NTSTATUS)0xC0000210L)
+#define STATUS_TRANSACTION_NO_RELEASE ((NTSTATUS)0xC0000211L)
+#define STATUS_TRANSACTION_NO_MATCH ((NTSTATUS)0xC0000212L)
+#define STATUS_TRANSACTION_RESPONDED ((NTSTATUS)0xC0000213L)
+#define STATUS_TRANSACTION_INVALID_ID ((NTSTATUS)0xC0000214L)
+#define STATUS_TRANSACTION_INVALID_TYPE ((NTSTATUS)0xC0000215L)
+#define STATUS_NOT_SERVER_SESSION ((NTSTATUS)0xC0000216L)
+#define STATUS_NOT_CLIENT_SESSION ((NTSTATUS)0xC0000217L)
+#define STATUS_CANNOT_LOAD_REGISTRY_FILE ((NTSTATUS)0xC0000218L)
+#define STATUS_DEBUG_ATTACH_FAILED ((NTSTATUS)0xC0000219L)
+#define STATUS_SYSTEM_PROCESS_TERMINATED ((NTSTATUS)0xC000021AL)
+#define STATUS_DATA_NOT_ACCEPTED ((NTSTATUS)0xC000021BL)
+#define STATUS_NO_BROWSER_SERVERS_FOUND ((NTSTATUS)0xC000021CL)
+#define STATUS_VDM_HARD_ERROR ((NTSTATUS)0xC000021DL)
+#define STATUS_DRIVER_CANCEL_TIMEOUT ((NTSTATUS)0xC000021EL)
+#define STATUS_REPLY_MESSAGE_MISMATCH ((NTSTATUS)0xC000021FL)
+#define STATUS_MAPPED_ALIGNMENT ((NTSTATUS)0xC0000220L)
+#define STATUS_IMAGE_CHECKSUM_MISMATCH ((NTSTATUS)0xC0000221L)
+#define STATUS_LOST_WRITEBEHIND_DATA ((NTSTATUS)0xC0000222L)
+#define STATUS_CLIENT_SERVER_PARAMETERS_INVALID ((NTSTATUS)0xC0000223L)
+#define STATUS_PASSWORD_MUST_CHANGE ((NTSTATUS)0xC0000224L)
+#define STATUS_NOT_FOUND ((NTSTATUS)0xC0000225L)
+#define STATUS_NOT_TINY_STREAM ((NTSTATUS)0xC0000226L)
+#define STATUS_RECOVERY_FAILURE ((NTSTATUS)0xC0000227L)
+#define STATUS_STACK_OVERFLOW_READ ((NTSTATUS)0xC0000228L)
+#define STATUS_FAIL_CHECK ((NTSTATUS)0xC0000229L)
+#define STATUS_DUPLICATE_OBJECTID ((NTSTATUS)0xC000022AL)
+#define STATUS_OBJECTID_EXISTS ((NTSTATUS)0xC000022BL)
+#define STATUS_CONVERT_TO_LARGE ((NTSTATUS)0xC000022CL)
+#define STATUS_RETRY ((NTSTATUS)0xC000022DL)
+#define STATUS_FOUND_OUT_OF_SCOPE ((NTSTATUS)0xC000022EL)
+#define STATUS_ALLOCATE_BUCKET ((NTSTATUS)0xC000022FL)
+#define STATUS_PROPSET_NOT_FOUND ((NTSTATUS)0xC0000230L)
+#define STATUS_MARSHALL_OVERFLOW ((NTSTATUS)0xC0000231L)
+#define STATUS_INVALID_VARIANT ((NTSTATUS)0xC0000232L)
+#define STATUS_DOMAIN_CONTROLLER_NOT_FOUND ((NTSTATUS)0xC0000233L)
+#define STATUS_ACCOUNT_LOCKED_OUT ((NTSTATUS)0xC0000234L)
+#define STATUS_HANDLE_NOT_CLOSABLE ((NTSTATUS)0xC0000235L)
+#define STATUS_CONNECTION_REFUSED ((NTSTATUS)0xC0000236L)
+#define STATUS_GRACEFUL_DISCONNECT ((NTSTATUS)0xC0000237L)
+#define STATUS_ADDRESS_ALREADY_ASSOCIATED ((NTSTATUS)0xC0000238L)
+#define STATUS_ADDRESS_NOT_ASSOCIATED ((NTSTATUS)0xC0000239L)
+#define STATUS_CONNECTION_INVALID ((NTSTATUS)0xC000023AL)
+#define STATUS_CONNECTION_ACTIVE ((NTSTATUS)0xC000023BL)
+#define STATUS_NETWORK_UNREACHABLE ((NTSTATUS)0xC000023CL)
+#define STATUS_HOST_UNREACHABLE ((NTSTATUS)0xC000023DL)
+#define STATUS_PROTOCOL_UNREACHABLE ((NTSTATUS)0xC000023EL)
+#define STATUS_PORT_UNREACHABLE ((NTSTATUS)0xC000023FL)
+#define STATUS_REQUEST_ABORTED ((NTSTATUS)0xC0000240L)
+#define STATUS_CONNECTION_ABORTED ((NTSTATUS)0xC0000241L)
+#define STATUS_BAD_COMPRESSION_BUFFER ((NTSTATUS)0xC0000242L)
+#define STATUS_USER_MAPPED_FILE ((NTSTATUS)0xC0000243L)
+#define STATUS_AUDIT_FAILED ((NTSTATUS)0xC0000244L)
+#define STATUS_TIMER_RESOLUTION_NOT_SET ((NTSTATUS)0xC0000245L)
+#define STATUS_CONNECTION_COUNT_LIMIT ((NTSTATUS)0xC0000246L)
+#define STATUS_LOGIN_TIME_RESTRICTION ((NTSTATUS)0xC0000247L)
+#define STATUS_LOGIN_WKSTA_RESTRICTION ((NTSTATUS)0xC0000248L)
+#define STATUS_IMAGE_MP_UP_MISMATCH ((NTSTATUS)0xC0000249L)
+#define STATUS_INSUFFICIENT_LOGON_INFO ((NTSTATUS)0xC0000250L)
+#define STATUS_BAD_DLL_ENTRYPOINT ((NTSTATUS)0xC0000251L)
+#define STATUS_BAD_SERVICE_ENTRYPOINT ((NTSTATUS)0xC0000252L)
+#define STATUS_LPC_REPLY_LOST ((NTSTATUS)0xC0000253L)
+#define STATUS_IP_ADDRESS_CONFLICT1 ((NTSTATUS)0xC0000254L)
+#define STATUS_IP_ADDRESS_CONFLICT2 ((NTSTATUS)0xC0000255L)
+#define STATUS_REGISTRY_QUOTA_LIMIT ((NTSTATUS)0xC0000256L)
+#define STATUS_PATH_NOT_COVERED ((NTSTATUS)0xC0000257L)
+#define STATUS_NO_CALLBACK_ACTIVE ((NTSTATUS)0xC0000258L)
+#define STATUS_LICENSE_QUOTA_EXCEEDED ((NTSTATUS)0xC0000259L)
+#define STATUS_PWD_TOO_SHORT ((NTSTATUS)0xC000025AL)
+#define STATUS_PWD_TOO_RECENT ((NTSTATUS)0xC000025BL)
+#define STATUS_PWD_HISTORY_CONFLICT ((NTSTATUS)0xC000025CL)
+#define STATUS_PLUGPLAY_NO_DEVICE ((NTSTATUS)0xC000025EL)
+#define STATUS_UNSUPPORTED_COMPRESSION ((NTSTATUS)0xC000025FL)
+#define STATUS_INVALID_HW_PROFILE ((NTSTATUS)0xC0000260L)
+#define STATUS_INVALID_PLUGPLAY_DEVICE_PATH ((NTSTATUS)0xC0000261L)
+#define STATUS_DRIVER_ORDINAL_NOT_FOUND ((NTSTATUS)0xC0000262L)
+#define STATUS_DRIVER_ENTRYPOINT_NOT_FOUND ((NTSTATUS)0xC0000263L)
+#define STATUS_RESOURCE_NOT_OWNED ((NTSTATUS)0xC0000264L)
+#define STATUS_TOO_MANY_LINKS ((NTSTATUS)0xC0000265L)
+#define STATUS_QUOTA_LIST_INCONSISTENT ((NTSTATUS)0xC0000266L)
+#define STATUS_FILE_IS_OFFLINE ((NTSTATUS)0xC0000267L)
+#define STATUS_EVALUATION_EXPIRATION ((NTSTATUS)0xC0000268L)
+#define STATUS_ILLEGAL_DLL_RELOCATION ((NTSTATUS)0xC0000269L)
+#define STATUS_LICENSE_VIOLATION ((NTSTATUS)0xC000026AL)
+#define STATUS_DLL_INIT_FAILED_LOGOFF ((NTSTATUS)0xC000026BL)
+#define STATUS_DRIVER_UNABLE_TO_LOAD ((NTSTATUS)0xC000026CL)
+#define STATUS_DFS_UNAVAILABLE ((NTSTATUS)0xC000026DL)
+#define STATUS_VOLUME_DISMOUNTED ((NTSTATUS)0xC000026EL)
+#define STATUS_WX86_INTERNAL_ERROR ((NTSTATUS)0xC000026FL)
+#define STATUS_WX86_FLOAT_STACK_CHECK ((NTSTATUS)0xC0000270L)
+#define STATUS_VALIDATE_CONTINUE ((NTSTATUS)0xC0000271L)
+#define STATUS_NO_MATCH ((NTSTATUS)0xC0000272L)
+#define STATUS_NO_MORE_MATCHES ((NTSTATUS)0xC0000273L)
+#define STATUS_NOT_A_REPARSE_POINT ((NTSTATUS)0xC0000275L)
+#define STATUS_IO_REPARSE_TAG_INVALID ((NTSTATUS)0xC0000276L)
+#define STATUS_IO_REPARSE_TAG_MISMATCH ((NTSTATUS)0xC0000277L)
+#define STATUS_IO_REPARSE_DATA_INVALID ((NTSTATUS)0xC0000278L)
+#define STATUS_IO_REPARSE_TAG_NOT_HANDLED ((NTSTATUS)0xC0000279L)
+#define STATUS_REPARSE_POINT_NOT_RESOLVED ((NTSTATUS)0xC0000280L)
+#define STATUS_DIRECTORY_IS_A_REPARSE_POINT ((NTSTATUS)0xC0000281L)
+#define STATUS_RANGE_LIST_CONFLICT ((NTSTATUS)0xC0000282L)
+#define STATUS_SOURCE_ELEMENT_EMPTY ((NTSTATUS)0xC0000283L)
+#define STATUS_DESTINATION_ELEMENT_FULL ((NTSTATUS)0xC0000284L)
+#define STATUS_ILLEGAL_ELEMENT_ADDRESS ((NTSTATUS)0xC0000285L)
+#define STATUS_MAGAZINE_NOT_PRESENT ((NTSTATUS)0xC0000286L)
+#define STATUS_REINITIALIZATION_NEEDED ((NTSTATUS)0xC0000287L)
+#define STATUS_DEVICE_REQUIRES_CLEANING ((NTSTATUS)0x80000288L)
+#define STATUS_DEVICE_DOOR_OPEN ((NTSTATUS)0x80000289L)
+#define STATUS_ENCRYPTION_FAILED ((NTSTATUS)0xC000028AL)
+#define STATUS_DECRYPTION_FAILED ((NTSTATUS)0xC000028BL)
+#define STATUS_RANGE_NOT_FOUND ((NTSTATUS)0xC000028CL)
+#define STATUS_NO_RECOVERY_POLICY ((NTSTATUS)0xC000028DL)
+#define STATUS_NO_EFS ((NTSTATUS)0xC000028EL)
+#define STATUS_WRONG_EFS ((NTSTATUS)0xC000028FL)
+#define STATUS_NO_USER_KEYS ((NTSTATUS)0xC0000290L)
+#define STATUS_FILE_NOT_ENCRYPTED ((NTSTATUS)0xC0000291L)
+#define STATUS_NOT_EXPORT_FORMAT ((NTSTATUS)0xC0000292L)
+#define STATUS_FILE_ENCRYPTED ((NTSTATUS)0xC0000293L)
+#define STATUS_WAKE_SYSTEM ((NTSTATUS)0x40000294L)
+#define STATUS_WMI_GUID_NOT_FOUND ((NTSTATUS)0xC0000295L)
+#define STATUS_WMI_INSTANCE_NOT_FOUND ((NTSTATUS)0xC0000296L)
+#define STATUS_WMI_ITEMID_NOT_FOUND ((NTSTATUS)0xC0000297L)
+#define STATUS_WMI_TRY_AGAIN ((NTSTATUS)0xC0000298L)
+#define STATUS_SHARED_POLICY ((NTSTATUS)0xC0000299L)
+#define STATUS_POLICY_OBJECT_NOT_FOUND ((NTSTATUS)0xC000029AL)
+#define STATUS_POLICY_ONLY_IN_DS ((NTSTATUS)0xC000029BL)
+#define STATUS_VOLUME_NOT_UPGRADED ((NTSTATUS)0xC000029CL)
+#define STATUS_REMOTE_STORAGE_NOT_ACTIVE ((NTSTATUS)0xC000029DL)
+#define STATUS_REMOTE_STORAGE_MEDIA_ERROR ((NTSTATUS)0xC000029EL)
+#define STATUS_NO_TRACKING_SERVICE ((NTSTATUS)0xC000029FL)
+#define STATUS_SERVER_SID_MISMATCH ((NTSTATUS)0xC00002A0L)
+#define STATUS_DS_NO_ATTRIBUTE_OR_VALUE ((NTSTATUS)0xC00002A1L)
+#define STATUS_DS_INVALID_ATTRIBUTE_SYNTAX ((NTSTATUS)0xC00002A2L)
+#define STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED ((NTSTATUS)0xC00002A3L)
+#define STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS ((NTSTATUS)0xC00002A4L)
+#define STATUS_DS_BUSY ((NTSTATUS)0xC00002A5L)
+#define STATUS_DS_UNAVAILABLE ((NTSTATUS)0xC00002A6L)
+#define STATUS_DS_NO_RIDS_ALLOCATED ((NTSTATUS)0xC00002A7L)
+#define STATUS_DS_NO_MORE_RIDS ((NTSTATUS)0xC00002A8L)
+#define STATUS_DS_INCORRECT_ROLE_OWNER ((NTSTATUS)0xC00002A9L)
+#define STATUS_DS_RIDMGR_INIT_ERROR ((NTSTATUS)0xC00002AAL)
+#define STATUS_DS_OBJ_CLASS_VIOLATION ((NTSTATUS)0xC00002ABL)
+#define STATUS_DS_CANT_ON_NON_LEAF ((NTSTATUS)0xC00002ACL)
+#define STATUS_DS_CANT_ON_RDN ((NTSTATUS)0xC00002ADL)
+#define STATUS_DS_CANT_MOD_OBJ_CLASS ((NTSTATUS)0xC00002AEL)
+#define STATUS_DS_CROSS_DOM_MOVE_FAILED ((NTSTATUS)0xC00002AFL)
+#define STATUS_DS_GC_NOT_AVAILABLE ((NTSTATUS)0xC00002B0L)
+#define STATUS_DIRECTORY_SERVICE_REQUIRED ((NTSTATUS)0xC00002B1L)
+#define STATUS_REPARSE_ATTRIBUTE_CONFLICT ((NTSTATUS)0xC00002B2L)
+#define STATUS_CANT_ENABLE_DENY_ONLY ((NTSTATUS)0xC00002B3L)
+#define STATUS_FLOAT_MULTIPLE_FAULTS ((NTSTATUS)0xC00002B4L)
+#define STATUS_FLOAT_MULTIPLE_TRAPS ((NTSTATUS)0xC00002B5L)
+#define STATUS_DEVICE_REMOVED ((NTSTATUS)0xC00002B6L)
+#define STATUS_JOURNAL_DELETE_IN_PROGRESS ((NTSTATUS)0xC00002B7L)
+#define STATUS_JOURNAL_NOT_ACTIVE ((NTSTATUS)0xC00002B8L)
+#define STATUS_NOINTERFACE ((NTSTATUS)0xC00002B9L)
+#define STATUS_DS_ADMIN_LIMIT_EXCEEDED ((NTSTATUS)0xC00002C1L)
+#define STATUS_DRIVER_FAILED_SLEEP ((NTSTATUS)0xC00002C2L)
+#define STATUS_MUTUAL_AUTHENTICATION_FAILED ((NTSTATUS)0xC00002C3L)
+#define STATUS_CORRUPT_SYSTEM_FILE ((NTSTATUS)0xC00002C4L)
+#define STATUS_DATATYPE_MISALIGNMENT_ERROR ((NTSTATUS)0xC00002C5L)
+#define STATUS_WMI_READ_ONLY ((NTSTATUS)0xC00002C6L)
+#define STATUS_WMI_SET_FAILURE ((NTSTATUS)0xC00002C7L)
+#define STATUS_COMMITMENT_MINIMUM ((NTSTATUS)0xC00002C8L)
+#define STATUS_REG_NAT_CONSUMPTION ((NTSTATUS)0xC00002C9L)
+#define STATUS_TRANSPORT_FULL ((NTSTATUS)0xC00002CAL)
+#define STATUS_DS_SAM_INIT_FAILURE ((NTSTATUS)0xC00002CBL)
+#define STATUS_ONLY_IF_CONNECTED ((NTSTATUS)0xC00002CCL)
+#define STATUS_DS_SENSITIVE_GROUP_VIOLATION ((NTSTATUS)0xC00002CDL)
+#define STATUS_PNP_RESTART_ENUMERATION ((NTSTATUS)0xC00002CEL)
+#define STATUS_JOURNAL_ENTRY_DELETED ((NTSTATUS)0xC00002CFL)
+#define STATUS_DS_CANT_MOD_PRIMARYGROUPID ((NTSTATUS)0xC00002D0L)
+#define STATUS_SYSTEM_IMAGE_BAD_SIGNATURE ((NTSTATUS)0xC00002D1L)
+#define STATUS_PNP_REBOOT_REQUIRED ((NTSTATUS)0xC00002D2L)
+#define STATUS_POWER_STATE_INVALID ((NTSTATUS)0xC00002D3L)
+#define STATUS_DS_INVALID_GROUP_TYPE ((NTSTATUS)0xC00002D4L)
+#define STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN ((NTSTATUS)0xC00002D5L)
+#define STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN ((NTSTATUS)0xC00002D6L)
+#define STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER ((NTSTATUS)0xC00002D7L)
+#define STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER ((NTSTATUS)0xC00002D8L)
+#define STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER ((NTSTATUS)0xC00002D9L)
+#define STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER ((NTSTATUS)0xC00002DAL)
+#define STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER ((NTSTATUS)0xC00002DBL)
+#define STATUS_DS_HAVE_PRIMARY_MEMBERS ((NTSTATUS)0xC00002DCL)
+#define STATUS_WMI_NOT_SUPPORTED ((NTSTATUS)0xC00002DDL)
+#define STATUS_INSUFFICIENT_POWER ((NTSTATUS)0xC00002DEL)
+#define STATUS_SAM_NEED_BOOTKEY_PASSWORD ((NTSTATUS)0xC00002DFL)
+#define STATUS_SAM_NEED_BOOTKEY_FLOPPY ((NTSTATUS)0xC00002E0L)
+#define STATUS_DS_CANT_START ((NTSTATUS)0xC00002E1L)
+#define STATUS_DS_INIT_FAILURE ((NTSTATUS)0xC00002E2L)
+#define STATUS_SAM_INIT_FAILURE ((NTSTATUS)0xC00002E3L)
+#define STATUS_DS_GC_REQUIRED ((NTSTATUS)0xC00002E4L)
+#define STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY ((NTSTATUS)0xC00002E5L)
+#define STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS ((NTSTATUS)0xC00002E6L)
+#define STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED ((NTSTATUS)0xC00002E7L)
+#define STATUS_MULTIPLE_FAULT_VIOLATION ((NTSTATUS)0xC00002E8L)
+#define STATUS_CURRENT_DOMAIN_NOT_ALLOWED ((NTSTATUS)0xC00002E9L)
+#define STATUS_CANNOT_MAKE ((NTSTATUS)0xC00002EAL)
+#define STATUS_SYSTEM_SHUTDOWN ((NTSTATUS)0xC00002EBL)
+#define STATUS_DS_INIT_FAILURE_CONSOLE ((NTSTATUS)0xC00002ECL)
+#define STATUS_DS_SAM_INIT_FAILURE_CONSOLE ((NTSTATUS)0xC00002EDL)
+#define STATUS_UNFINISHED_CONTEXT_DELETED ((NTSTATUS)0xC00002EEL)
+#define STATUS_NO_TGT_REPLY ((NTSTATUS)0xC00002EFL)
+#define STATUS_OBJECTID_NOT_FOUND ((NTSTATUS)0xC00002F0L)
+#define STATUS_NO_IP_ADDRESSES ((NTSTATUS)0xC00002F1L)
+#define STATUS_WRONG_CREDENTIAL_HANDLE ((NTSTATUS)0xC00002F2L)
+#define STATUS_CRYPTO_SYSTEM_INVALID ((NTSTATUS)0xC00002F3L)
+#define STATUS_MAX_REFERRALS_EXCEEDED ((NTSTATUS)0xC00002F4L)
+#define STATUS_MUST_BE_KDC ((NTSTATUS)0xC00002F5L)
+#define STATUS_STRONG_CRYPTO_NOT_SUPPORTED ((NTSTATUS)0xC00002F6L)
+#define STATUS_TOO_MANY_PRINCIPALS ((NTSTATUS)0xC00002F7L)
+#define STATUS_NO_PA_DATA ((NTSTATUS)0xC00002F8L)
+#define STATUS_PKINIT_NAME_MISMATCH ((NTSTATUS)0xC00002F9L)
+#define STATUS_SMARTCARD_LOGON_REQUIRED ((NTSTATUS)0xC00002FAL)
+#define STATUS_KDC_INVALID_REQUEST ((NTSTATUS)0xC00002FBL)
+#define STATUS_KDC_UNABLE_TO_REFER ((NTSTATUS)0xC00002FCL)
+#define STATUS_KDC_UNKNOWN_ETYPE ((NTSTATUS)0xC00002FDL)
+#define STATUS_SHUTDOWN_IN_PROGRESS ((NTSTATUS)0xC00002FEL)
+#define STATUS_SERVER_SHUTDOWN_IN_PROGRESS ((NTSTATUS)0xC00002FFL)
+#define STATUS_NOT_SUPPORTED_ON_SBS ((NTSTATUS)0xC0000300L)
+#define STATUS_WMI_GUID_DISCONNECTED ((NTSTATUS)0xC0000301L)
+#define STATUS_WMI_ALREADY_DISABLED ((NTSTATUS)0xC0000302L)
+#define STATUS_WMI_ALREADY_ENABLED ((NTSTATUS)0xC0000303L)
+#define STATUS_MFT_TOO_FRAGMENTED ((NTSTATUS)0xC0000304L)
+#define STATUS_COPY_PROTECTION_FAILURE ((NTSTATUS)0xC0000305L)
+#define STATUS_CSS_AUTHENTICATION_FAILURE ((NTSTATUS)0xC0000306L)
+#define STATUS_CSS_KEY_NOT_PRESENT ((NTSTATUS)0xC0000307L)
+#define STATUS_CSS_KEY_NOT_ESTABLISHED ((NTSTATUS)0xC0000308L)
+#define STATUS_CSS_SCRAMBLED_SECTOR ((NTSTATUS)0xC0000309L)
+#define STATUS_CSS_REGION_MISMATCH ((NTSTATUS)0xC000030AL)
+#define STATUS_CSS_RESETS_EXHAUSTED ((NTSTATUS)0xC000030BL)
+#define STATUS_PKINIT_FAILURE ((NTSTATUS)0xC0000320L)
+#define STATUS_SMARTCARD_SUBSYSTEM_FAILURE ((NTSTATUS)0xC0000321L)
+#define STATUS_NO_KERB_KEY ((NTSTATUS)0xC0000322L)
+#define STATUS_HOST_DOWN ((NTSTATUS)0xC0000350L)
+#define STATUS_UNSUPPORTED_PREAUTH ((NTSTATUS)0xC0000351L)
+#define STATUS_EFS_ALG_BLOB_TOO_BIG ((NTSTATUS)0xC0000352L)
+#define STATUS_PORT_NOT_SET ((NTSTATUS)0xC0000353L)
+#define STATUS_DEBUGGER_INACTIVE ((NTSTATUS)0xC0000354L)
+#define STATUS_DS_VERSION_CHECK_FAILURE ((NTSTATUS)0xC0000355L)
+#define STATUS_AUDITING_DISABLED ((NTSTATUS)0xC0000356L)
+#define STATUS_PRENT4_MACHINE_ACCOUNT ((NTSTATUS)0xC0000357L)
+#define STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER ((NTSTATUS)0xC0000358L)
+#define STATUS_INVALID_IMAGE_WIN_32 ((NTSTATUS)0xC0000359L)
+#define STATUS_INVALID_IMAGE_WIN_64 ((NTSTATUS)0xC000035AL)
+#define STATUS_BAD_BINDINGS ((NTSTATUS)0xC000035BL)
+#define STATUS_NETWORK_SESSION_EXPIRED ((NTSTATUS)0xC000035CL)
+#define STATUS_APPHELP_BLOCK ((NTSTATUS)0xC000035DL)
+#define STATUS_ALL_SIDS_FILTERED ((NTSTATUS)0xC000035EL)
+#define STATUS_NOT_SAFE_MODE_DRIVER ((NTSTATUS)0xC000035FL)
+#define STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT ((NTSTATUS)0xC0000361L)
+#define STATUS_ACCESS_DISABLED_BY_POLICY_PATH ((NTSTATUS)0xC0000362L)
+#define STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER ((NTSTATUS)0xC0000363L)
+#define STATUS_ACCESS_DISABLED_BY_POLICY_OTHER ((NTSTATUS)0xC0000364L)
+#define STATUS_FAILED_DRIVER_ENTRY ((NTSTATUS)0xC0000365L)
+#define STATUS_DEVICE_ENUMERATION_ERROR ((NTSTATUS)0xC0000366L)
+#define STATUS_WAIT_FOR_OPLOCK ((NTSTATUS)0x00000367L)
+#define STATUS_MOUNT_POINT_NOT_RESOLVED ((NTSTATUS)0xC0000368L)
+#define STATUS_INVALID_DEVICE_OBJECT_PARAMETER ((NTSTATUS)0xC0000369L)
+#define STATUS_MCA_OCCURED ((NTSTATUS)0xC000036AL)
+#define STATUS_DRIVER_BLOCKED_CRITICAL ((NTSTATUS)0xC000036BL)
+#define STATUS_DRIVER_BLOCKED ((NTSTATUS)0xC000036CL)
+#define STATUS_DRIVER_DATABASE_ERROR ((NTSTATUS)0xC000036DL)
+#define STATUS_SYSTEM_HIVE_TOO_LARGE ((NTSTATUS)0xC000036EL)
+#define STATUS_INVALID_IMPORT_OF_NON_DLL ((NTSTATUS)0xC000036FL)
+#define STATUS_DS_SHUTTING_DOWN ((NTSTATUS)0x40000370L)
+#define STATUS_SMARTCARD_WRONG_PIN ((NTSTATUS)0xC0000380L)
+#define STATUS_SMARTCARD_CARD_BLOCKED ((NTSTATUS)0xC0000381L)
+#define STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED ((NTSTATUS)0xC0000382L)
+#define STATUS_SMARTCARD_NO_CARD ((NTSTATUS)0xC0000383L)
+#define STATUS_SMARTCARD_NO_KEY_CONTAINER ((NTSTATUS)0xC0000384L)
+#define STATUS_SMARTCARD_NO_CERTIFICATE ((NTSTATUS)0xC0000385L)
+#define STATUS_SMARTCARD_NO_KEYSET ((NTSTATUS)0xC0000386L)
+#define STATUS_SMARTCARD_IO_ERROR ((NTSTATUS)0xC0000387L)
+#define STATUS_DOWNGRADE_DETECTED ((NTSTATUS)0xC0000388L)
+#define STATUS_SMARTCARD_CERT_REVOKED ((NTSTATUS)0xC0000389L)
+#define STATUS_ISSUING_CA_UNTRUSTED ((NTSTATUS)0xC000038AL)
+#define STATUS_REVOCATION_OFFLINE_C ((NTSTATUS)0xC000038BL)
+#define STATUS_PKINIT_CLIENT_FAILURE ((NTSTATUS)0xC000038CL)
+#define STATUS_SMARTCARD_CERT_EXPIRED ((NTSTATUS)0xC000038DL)
+#define STATUS_DRIVER_FAILED_PRIOR_UNLOAD ((NTSTATUS)0xC000038EL)
+#define STATUS_WOW_ASSERTION ((NTSTATUS)0xC0009898L)
+#define RPC_NT_INVALID_STRING_BINDING ((NTSTATUS)0xC0020001L)
+#define RPC_NT_WRONG_KIND_OF_BINDING ((NTSTATUS)0xC0020002L)
+#define RPC_NT_INVALID_BINDING ((NTSTATUS)0xC0020003L)
+#define RPC_NT_PROTSEQ_NOT_SUPPORTED ((NTSTATUS)0xC0020004L)
+#define RPC_NT_INVALID_RPC_PROTSEQ ((NTSTATUS)0xC0020005L)
+#define RPC_NT_INVALID_STRING_UUID ((NTSTATUS)0xC0020006L)
+#define RPC_NT_INVALID_ENDPOINT_FORMAT ((NTSTATUS)0xC0020007L)
+#define RPC_NT_INVALID_NET_ADDR ((NTSTATUS)0xC0020008L)
+#define RPC_NT_NO_ENDPOINT_FOUND ((NTSTATUS)0xC0020009L)
+#define RPC_NT_INVALID_TIMEOUT ((NTSTATUS)0xC002000AL)
+#define RPC_NT_OBJECT_NOT_FOUND ((NTSTATUS)0xC002000BL)
+#define RPC_NT_ALREADY_REGISTERED ((NTSTATUS)0xC002000CL)
+#define RPC_NT_TYPE_ALREADY_REGISTERED ((NTSTATUS)0xC002000DL)
+#define RPC_NT_ALREADY_LISTENING ((NTSTATUS)0xC002000EL)
+#define RPC_NT_NO_PROTSEQS_REGISTERED ((NTSTATUS)0xC002000FL)
+#define RPC_NT_NOT_LISTENING ((NTSTATUS)0xC0020010L)
+#define RPC_NT_UNKNOWN_MGR_TYPE ((NTSTATUS)0xC0020011L)
+#define RPC_NT_UNKNOWN_IF ((NTSTATUS)0xC0020012L)
+#define RPC_NT_NO_BINDINGS ((NTSTATUS)0xC0020013L)
+#define RPC_NT_NO_PROTSEQS ((NTSTATUS)0xC0020014L)
+#define RPC_NT_CANT_CREATE_ENDPOINT ((NTSTATUS)0xC0020015L)
+#define RPC_NT_OUT_OF_RESOURCES ((NTSTATUS)0xC0020016L)
+#define RPC_NT_SERVER_UNAVAILABLE ((NTSTATUS)0xC0020017L)
+#define RPC_NT_SERVER_TOO_BUSY ((NTSTATUS)0xC0020018L)
+#define RPC_NT_INVALID_NETWORK_OPTIONS ((NTSTATUS)0xC0020019L)
+#define RPC_NT_NO_CALL_ACTIVE ((NTSTATUS)0xC002001AL)
+#define RPC_NT_CALL_FAILED ((NTSTATUS)0xC002001BL)
+#define RPC_NT_CALL_FAILED_DNE ((NTSTATUS)0xC002001CL)
+#define RPC_NT_PROTOCOL_ERROR ((NTSTATUS)0xC002001DL)
+#define RPC_NT_UNSUPPORTED_TRANS_SYN ((NTSTATUS)0xC002001FL)
+#define RPC_NT_UNSUPPORTED_TYPE ((NTSTATUS)0xC0020021L)
+#define RPC_NT_INVALID_TAG ((NTSTATUS)0xC0020022L)
+#define RPC_NT_INVALID_BOUND ((NTSTATUS)0xC0020023L)
+#define RPC_NT_NO_ENTRY_NAME ((NTSTATUS)0xC0020024L)
+#define RPC_NT_INVALID_NAME_SYNTAX ((NTSTATUS)0xC0020025L)
+#define RPC_NT_UNSUPPORTED_NAME_SYNTAX ((NTSTATUS)0xC0020026L)
+#define RPC_NT_UUID_NO_ADDRESS ((NTSTATUS)0xC0020028L)
+#define RPC_NT_DUPLICATE_ENDPOINT ((NTSTATUS)0xC0020029L)
+#define RPC_NT_UNKNOWN_AUTHN_TYPE ((NTSTATUS)0xC002002AL)
+#define RPC_NT_MAX_CALLS_TOO_SMALL ((NTSTATUS)0xC002002BL)
+#define RPC_NT_STRING_TOO_LONG ((NTSTATUS)0xC002002CL)
+#define RPC_NT_PROTSEQ_NOT_FOUND ((NTSTATUS)0xC002002DL)
+#define RPC_NT_PROCNUM_OUT_OF_RANGE ((NTSTATUS)0xC002002EL)
+#define RPC_NT_BINDING_HAS_NO_AUTH ((NTSTATUS)0xC002002FL)
+#define RPC_NT_UNKNOWN_AUTHN_SERVICE ((NTSTATUS)0xC0020030L)
+#define RPC_NT_UNKNOWN_AUTHN_LEVEL ((NTSTATUS)0xC0020031L)
+#define RPC_NT_INVALID_AUTH_IDENTITY ((NTSTATUS)0xC0020032L)
+#define RPC_NT_UNKNOWN_AUTHZ_SERVICE ((NTSTATUS)0xC0020033L)
+#define EPT_NT_INVALID_ENTRY ((NTSTATUS)0xC0020034L)
+#define EPT_NT_CANT_PERFORM_OP ((NTSTATUS)0xC0020035L)
+#define EPT_NT_NOT_REGISTERED ((NTSTATUS)0xC0020036L)
+#define RPC_NT_NOTHING_TO_EXPORT ((NTSTATUS)0xC0020037L)
+#define RPC_NT_INCOMPLETE_NAME ((NTSTATUS)0xC0020038L)
+#define RPC_NT_INVALID_VERS_OPTION ((NTSTATUS)0xC0020039L)
+#define RPC_NT_NO_MORE_MEMBERS ((NTSTATUS)0xC002003AL)
+#define RPC_NT_NOT_ALL_OBJS_UNEXPORTED ((NTSTATUS)0xC002003BL)
+#define RPC_NT_INTERFACE_NOT_FOUND ((NTSTATUS)0xC002003CL)
+#define RPC_NT_ENTRY_ALREADY_EXISTS ((NTSTATUS)0xC002003DL)
+#define RPC_NT_ENTRY_NOT_FOUND ((NTSTATUS)0xC002003EL)
+#define RPC_NT_NAME_SERVICE_UNAVAILABLE ((NTSTATUS)0xC002003FL)
+#define RPC_NT_INVALID_NAF_ID ((NTSTATUS)0xC0020040L)
+#define RPC_NT_CANNOT_SUPPORT ((NTSTATUS)0xC0020041L)
+#define RPC_NT_NO_CONTEXT_AVAILABLE ((NTSTATUS)0xC0020042L)
+#define RPC_NT_INTERNAL_ERROR ((NTSTATUS)0xC0020043L)
+#define RPC_NT_ZERO_DIVIDE ((NTSTATUS)0xC0020044L)
+#define RPC_NT_ADDRESS_ERROR ((NTSTATUS)0xC0020045L)
+#define RPC_NT_FP_DIV_ZERO ((NTSTATUS)0xC0020046L)
+#define RPC_NT_FP_UNDERFLOW ((NTSTATUS)0xC0020047L)
+#define RPC_NT_FP_OVERFLOW ((NTSTATUS)0xC0020048L)
+#define RPC_NT_NO_MORE_ENTRIES ((NTSTATUS)0xC0030001L)
+#define RPC_NT_SS_CHAR_TRANS_OPEN_FAIL ((NTSTATUS)0xC0030002L)
+#define RPC_NT_SS_CHAR_TRANS_SHORT_FILE ((NTSTATUS)0xC0030003L)
+#define RPC_NT_SS_IN_NULL_CONTEXT ((NTSTATUS)0xC0030004L)
+#define RPC_NT_SS_CONTEXT_MISMATCH ((NTSTATUS)0xC0030005L)
+#define RPC_NT_SS_CONTEXT_DAMAGED ((NTSTATUS)0xC0030006L)
+#define RPC_NT_SS_HANDLES_MISMATCH ((NTSTATUS)0xC0030007L)
+#define RPC_NT_SS_CANNOT_GET_CALL_HANDLE ((NTSTATUS)0xC0030008L)
+#define RPC_NT_NULL_REF_POINTER ((NTSTATUS)0xC0030009L)
+#define RPC_NT_ENUM_VALUE_OUT_OF_RANGE ((NTSTATUS)0xC003000AL)
+#define RPC_NT_BYTE_COUNT_TOO_SMALL ((NTSTATUS)0xC003000BL)
+#define RPC_NT_BAD_STUB_DATA ((NTSTATUS)0xC003000CL)
+#define RPC_NT_CALL_IN_PROGRESS ((NTSTATUS)0xC0020049L)
+#define RPC_NT_NO_MORE_BINDINGS ((NTSTATUS)0xC002004AL)
+#define RPC_NT_GROUP_MEMBER_NOT_FOUND ((NTSTATUS)0xC002004BL)
+#define EPT_NT_CANT_CREATE ((NTSTATUS)0xC002004CL)
+#define RPC_NT_INVALID_OBJECT ((NTSTATUS)0xC002004DL)
+#define RPC_NT_NO_INTERFACES ((NTSTATUS)0xC002004FL)
+#define RPC_NT_CALL_CANCELLED ((NTSTATUS)0xC0020050L)
+#define RPC_NT_BINDING_INCOMPLETE ((NTSTATUS)0xC0020051L)
+#define RPC_NT_COMM_FAILURE ((NTSTATUS)0xC0020052L)
+#define RPC_NT_UNSUPPORTED_AUTHN_LEVEL ((NTSTATUS)0xC0020053L)
+#define RPC_NT_NO_PRINC_NAME ((NTSTATUS)0xC0020054L)
+#define RPC_NT_NOT_RPC_ERROR ((NTSTATUS)0xC0020055L)
+#define RPC_NT_UUID_LOCAL_ONLY ((NTSTATUS)0x40020056L)
+#define RPC_NT_SEC_PKG_ERROR ((NTSTATUS)0xC0020057L)
+#define RPC_NT_NOT_CANCELLED ((NTSTATUS)0xC0020058L)
+#define RPC_NT_INVALID_ES_ACTION ((NTSTATUS)0xC0030059L)
+#define RPC_NT_WRONG_ES_VERSION ((NTSTATUS)0xC003005AL)
+#define RPC_NT_WRONG_STUB_VERSION ((NTSTATUS)0xC003005BL)
+#define RPC_NT_INVALID_PIPE_OBJECT ((NTSTATUS)0xC003005CL)
+#define RPC_NT_INVALID_PIPE_OPERATION ((NTSTATUS)0xC003005DL)
+#define RPC_NT_WRONG_PIPE_VERSION ((NTSTATUS)0xC003005EL)
+#define RPC_NT_PIPE_CLOSED ((NTSTATUS)0xC003005FL)
+#define RPC_NT_PIPE_DISCIPLINE_ERROR ((NTSTATUS)0xC0030060L)
+#define RPC_NT_PIPE_EMPTY ((NTSTATUS)0xC0030061L)
+#define RPC_NT_INVALID_ASYNC_HANDLE ((NTSTATUS)0xC0020062L)
+#define RPC_NT_INVALID_ASYNC_CALL ((NTSTATUS)0xC0020063L)
+#define RPC_NT_SEND_INCOMPLETE ((NTSTATUS)0x400200AFL)
+#define STATUS_ACPI_INVALID_OPCODE ((NTSTATUS)0xC0140001L)
+#define STATUS_ACPI_STACK_OVERFLOW ((NTSTATUS)0xC0140002L)
+#define STATUS_ACPI_ASSERT_FAILED ((NTSTATUS)0xC0140003L)
+#define STATUS_ACPI_INVALID_INDEX ((NTSTATUS)0xC0140004L)
+#define STATUS_ACPI_INVALID_ARGUMENT ((NTSTATUS)0xC0140005L)
+#define STATUS_ACPI_FATAL ((NTSTATUS)0xC0140006L)
+#define STATUS_ACPI_INVALID_SUPERNAME ((NTSTATUS)0xC0140007L)
+#define STATUS_ACPI_INVALID_ARGTYPE ((NTSTATUS)0xC0140008L)
+#define STATUS_ACPI_INVALID_OBJTYPE ((NTSTATUS)0xC0140009L)
+#define STATUS_ACPI_INVALID_TARGETTYPE ((NTSTATUS)0xC014000AL)
+#define STATUS_ACPI_INCORRECT_ARGUMENT_COUNT ((NTSTATUS)0xC014000BL)
+#define STATUS_ACPI_ADDRESS_NOT_MAPPED ((NTSTATUS)0xC014000CL)
+#define STATUS_ACPI_INVALID_EVENTTYPE ((NTSTATUS)0xC014000DL)
+#define STATUS_ACPI_HANDLER_COLLISION ((NTSTATUS)0xC014000EL)
+#define STATUS_ACPI_INVALID_DATA ((NTSTATUS)0xC014000FL)
+#define STATUS_ACPI_INVALID_REGION ((NTSTATUS)0xC0140010L)
+#define STATUS_ACPI_INVALID_ACCESS_SIZE ((NTSTATUS)0xC0140011L)
+#define STATUS_ACPI_ACQUIRE_GLOBAL_LOCK ((NTSTATUS)0xC0140012L)
+#define STATUS_ACPI_ALREADY_INITIALIZED ((NTSTATUS)0xC0140013L)
+#define STATUS_ACPI_NOT_INITIALIZED ((NTSTATUS)0xC0140014L)
+#define STATUS_ACPI_INVALID_MUTEX_LEVEL ((NTSTATUS)0xC0140015L)
+#define STATUS_ACPI_MUTEX_NOT_OWNED ((NTSTATUS)0xC0140016L)
+#define STATUS_ACPI_MUTEX_NOT_OWNER ((NTSTATUS)0xC0140017L)
+#define STATUS_ACPI_RS_ACCESS ((NTSTATUS)0xC0140018L)
+#define STATUS_ACPI_INVALID_TABLE ((NTSTATUS)0xC0140019L)
+#define STATUS_ACPI_REG_HANDLER_FAILED ((NTSTATUS)0xC0140020L)
+#define STATUS_ACPI_POWER_REQUEST_FAILED ((NTSTATUS)0xC0140021L)
+#define STATUS_CTX_WINSTATION_NAME_INVALID ((NTSTATUS)0xC00A0001L)
+#define STATUS_CTX_INVALID_PD ((NTSTATUS)0xC00A0002L)
+#define STATUS_CTX_PD_NOT_FOUND ((NTSTATUS)0xC00A0003L)
+#define STATUS_CTX_CDM_CONNECT ((NTSTATUS)0x400A0004L)
+#define STATUS_CTX_CDM_DISCONNECT ((NTSTATUS)0x400A0005L)
+#define STATUS_CTX_CLOSE_PENDING ((NTSTATUS)0xC00A0006L)
+#define STATUS_CTX_NO_OUTBUF ((NTSTATUS)0xC00A0007L)
+#define STATUS_CTX_MODEM_INF_NOT_FOUND ((NTSTATUS)0xC00A0008L)
+#define STATUS_CTX_INVALID_MODEMNAME ((NTSTATUS)0xC00A0009L)
+#define STATUS_CTX_RESPONSE_ERROR ((NTSTATUS)0xC00A000AL)
+#define STATUS_CTX_MODEM_RESPONSE_TIMEOUT ((NTSTATUS)0xC00A000BL)
+#define STATUS_CTX_MODEM_RESPONSE_NO_CARRIER ((NTSTATUS)0xC00A000CL)
+#define STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE ((NTSTATUS)0xC00A000DL)
+#define STATUS_CTX_MODEM_RESPONSE_BUSY ((NTSTATUS)0xC00A000EL)
+#define STATUS_CTX_MODEM_RESPONSE_VOICE ((NTSTATUS)0xC00A000FL)
+#define STATUS_CTX_TD_ERROR ((NTSTATUS)0xC00A0010L)
+#define STATUS_CTX_LICENSE_CLIENT_INVALID ((NTSTATUS)0xC00A0012L)
+#define STATUS_CTX_LICENSE_NOT_AVAILABLE ((NTSTATUS)0xC00A0013L)
+#define STATUS_CTX_LICENSE_EXPIRED ((NTSTATUS)0xC00A0014L)
+#define STATUS_CTX_WINSTATION_NOT_FOUND ((NTSTATUS)0xC00A0015L)
+#define STATUS_CTX_WINSTATION_NAME_COLLISION ((NTSTATUS)0xC00A0016L)
+#define STATUS_CTX_WINSTATION_BUSY ((NTSTATUS)0xC00A0017L)
+#define STATUS_CTX_BAD_VIDEO_MODE ((NTSTATUS)0xC00A0018L)
+#define STATUS_CTX_GRAPHICS_INVALID ((NTSTATUS)0xC00A0022L)
+#define STATUS_CTX_NOT_CONSOLE ((NTSTATUS)0xC00A0024L)
+#define STATUS_CTX_CLIENT_QUERY_TIMEOUT ((NTSTATUS)0xC00A0026L)
+#define STATUS_CTX_CONSOLE_DISCONNECT ((NTSTATUS)0xC00A0027L)
+#define STATUS_CTX_CONSOLE_CONNECT ((NTSTATUS)0xC00A0028L)
+#define STATUS_CTX_SHADOW_DENIED ((NTSTATUS)0xC00A002AL)
+#define STATUS_CTX_WINSTATION_ACCESS_DENIED ((NTSTATUS)0xC00A002BL)
+#define STATUS_CTX_INVALID_WD ((NTSTATUS)0xC00A002EL)
+#define STATUS_CTX_WD_NOT_FOUND ((NTSTATUS)0xC00A002FL)
+#define STATUS_CTX_SHADOW_INVALID ((NTSTATUS)0xC00A0030L)
+#define STATUS_CTX_SHADOW_DISABLED ((NTSTATUS)0xC00A0031L)
+#define STATUS_RDP_PROTOCOL_ERROR ((NTSTATUS)0xC00A0032L)
+#define STATUS_CTX_CLIENT_LICENSE_NOT_SET ((NTSTATUS)0xC00A0033L)
+#define STATUS_CTX_CLIENT_LICENSE_IN_USE ((NTSTATUS)0xC00A0034L)
+#define STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE ((NTSTATUS)0xC00A0035L)
+#define STATUS_CTX_SHADOW_NOT_RUNNING ((NTSTATUS)0xC00A0036L)
+#define STATUS_PNP_BAD_MPS_TABLE ((NTSTATUS)0xC0040035L)
+#define STATUS_PNP_TRANSLATION_FAILED ((NTSTATUS)0xC0040036L)
+#define STATUS_PNP_IRQ_TRANSLATION_FAILED ((NTSTATUS)0xC0040037L)
+#define STATUS_SXS_SECTION_NOT_FOUND ((NTSTATUS)0xC0150001L)
+#define STATUS_SXS_CANT_GEN_ACTCTX ((NTSTATUS)0xC0150002L)
+#define STATUS_SXS_INVALID_ACTCTXDATA_FORMAT ((NTSTATUS)0xC0150003L)
+#define STATUS_SXS_ASSEMBLY_NOT_FOUND ((NTSTATUS)0xC0150004L)
+#define STATUS_SXS_MANIFEST_FORMAT_ERROR ((NTSTATUS)0xC0150005L)
+#define STATUS_SXS_MANIFEST_PARSE_ERROR ((NTSTATUS)0xC0150006L)
+#define STATUS_SXS_ACTIVATION_CONTEXT_DISABLED ((NTSTATUS)0xC0150007L)
+#define STATUS_SXS_KEY_NOT_FOUND ((NTSTATUS)0xC0150008L)
+#define STATUS_SXS_VERSION_CONFLICT ((NTSTATUS)0xC0150009L)
+#define STATUS_SXS_WRONG_SECTION_TYPE ((NTSTATUS)0xC015000AL)
+#define STATUS_SXS_THREAD_QUERIES_DISABLED ((NTSTATUS)0xC015000BL)
+#define STATUS_SXS_ASSEMBLY_MISSING ((NTSTATUS)0xC015000CL)
+#define STATUS_SXS_RELEASE_ACTIVATION_CONTEXT ((NTSTATUS)0x4015000DL)
+#define STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET ((NTSTATUS)0xC015000EL)
+#define STATUS_SXS_EARLY_DEACTIVATION ((NTSTATUS)0xC015000FL)
+#define STATUS_SXS_INVALID_DEACTIVATION ((NTSTATUS)0xC0150010L)
+#define STATUS_SXS_MULTIPLE_DEACTIVATION ((NTSTATUS)0xC0150011L)
+#define STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY ((NTSTATUS)0xC0150012L)
+#define STATUS_SXS_PROCESS_TERMINATION_REQUESTED ((NTSTATUS)0xC0150013L)
+#define STATUS_CLUSTER_INVALID_NODE ((NTSTATUS)0xC0130001L)
+#define STATUS_CLUSTER_NODE_EXISTS ((NTSTATUS)0xC0130002L)
+#define STATUS_CLUSTER_JOIN_IN_PROGRESS ((NTSTATUS)0xC0130003L)
+#define STATUS_CLUSTER_NODE_NOT_FOUND ((NTSTATUS)0xC0130004L)
+#define STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND ((NTSTATUS)0xC0130005L)
+#define STATUS_CLUSTER_NETWORK_EXISTS ((NTSTATUS)0xC0130006L)
+#define STATUS_CLUSTER_NETWORK_NOT_FOUND ((NTSTATUS)0xC0130007L)
+#define STATUS_CLUSTER_NETINTERFACE_EXISTS ((NTSTATUS)0xC0130008L)
+#define STATUS_CLUSTER_NETINTERFACE_NOT_FOUND ((NTSTATUS)0xC0130009L)
+#define STATUS_CLUSTER_INVALID_REQUEST ((NTSTATUS)0xC013000AL)
+#define STATUS_CLUSTER_INVALID_NETWORK_PROVIDER ((NTSTATUS)0xC013000BL)
+#define STATUS_CLUSTER_NODE_DOWN ((NTSTATUS)0xC013000CL)
+#define STATUS_CLUSTER_NODE_UNREACHABLE ((NTSTATUS)0xC013000DL)
+#define STATUS_CLUSTER_NODE_NOT_MEMBER ((NTSTATUS)0xC013000EL)
+#define STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS ((NTSTATUS)0xC013000FL)
+#define STATUS_CLUSTER_INVALID_NETWORK ((NTSTATUS)0xC0130010L)
+#define STATUS_CLUSTER_NO_NET_ADAPTERS ((NTSTATUS)0xC0130011L)
+#define STATUS_CLUSTER_NODE_UP ((NTSTATUS)0xC0130012L)
+#define STATUS_CLUSTER_NODE_PAUSED ((NTSTATUS)0xC0130013L)
+#define STATUS_CLUSTER_NODE_NOT_PAUSED ((NTSTATUS)0xC0130014L)
+#define STATUS_CLUSTER_NO_SECURITY_CONTEXT ((NTSTATUS)0xC0130015L)
+#define STATUS_CLUSTER_NETWORK_NOT_INTERNAL ((NTSTATUS)0xC0130016L)
+#define STATUS_CLUSTER_POISONED ((NTSTATUS)0xC0130017L)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * parallel.h
+ *
+ * ParPort driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __PARALLEL_H
+#define __PARALLEL_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddpar.h"
+
+
+#define DD_PARALLEL_PORT_BASE_NAME "ParallelPort"
+#define DD_PARALLEL_PORT_BASE_NAME_U L"ParallelPort"
+
+#define IOCTL_INTERNAL_DESELECT_DEVICE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_GET_MORE_PARALLEL_PORT_INFO \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 17, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_GET_PARALLEL_PNP_INFO \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_INIT_1284_3_BUS \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARALLEL_CLEAR_CHIP_MODE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARALLEL_CONNECT_INTERRUPT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARALLEL_DISCONNECT_INTERRUPT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARALLEL_PORT_ALLOCATE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARALLEL_PORT_FREE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 40, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_RELEASE_PARALLEL_PORT_INFO \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_SELECT_DEVICE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+typedef struct _PARALLEL_1284_COMMAND {
+ UCHAR ID;
+ UCHAR Port;
+ ULONG CommandFlags;
+} PARALLEL_1284_COMMAND, *PPARALLEL_1284_COMMAND;
+
+/* PARALLEL_1284_COMMAND.CommandFlags */
+#define PAR_END_OF_CHAIN_DEVICE 0x00000001
+#define PAR_HAVE_PORT_KEEP_PORT 0x00000002
+
+typedef struct _MORE_PARALLEL_PORT_INFORMATION {
+ INTERFACE_TYPE InterfaceType;
+ ULONG BusNumber;
+ ULONG InterruptLevel;
+ ULONG InterruptVector;
+ KAFFINITY InterruptAffinity;
+ KINTERRUPT_MODE InterruptMode;
+} MORE_PARALLEL_PORT_INFORMATION, *PMORE_PARALLEL_PORT_INFORMATION;
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_SET_CHIP_MODE)(
+ IN PVOID SetChipContext,
+ IN UCHAR ChipMode);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_CLEAR_CHIP_MODE)(
+ IN PVOID ClearChipContext,
+ IN UCHAR ChipMode);
+
+typedef NTSTATUS DDKAPI
+(*PPARCHIP_CLEAR_CHIP_MODE)(
+ IN PVOID ClearChipContext,
+ IN UCHAR ChipMode);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_TRY_SELECT_ROUTINE)(
+ IN PVOID TrySelectContext,
+ IN PVOID TrySelectCommand);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_DESELECT_ROUTINE)(
+ IN PVOID DeselectContext,
+ IN PVOID DeselectCommand);
+
+/* PARALLEL_PNP_INFORMATION.HardwareCapabilities */
+#define PPT_NO_HARDWARE_PRESENT 0x00000000
+#define PPT_ECP_PRESENT 0x00000001
+#define PPT_EPP_PRESENT 0x00000002
+#define PPT_EPP_32_PRESENT 0x00000004
+#define PPT_BYTE_PRESENT 0x00000008
+#define PPT_BIDI_PRESENT 0x00000008
+#define PPT_1284_3_PRESENT 0x00000010
+
+typedef struct _PARALLEL_PNP_INFORMATION {
+ PHYSICAL_ADDRESS OriginalEcpController;
+ PUCHAR EcpController;
+ ULONG SpanOfEcpController;
+ ULONG PortNumber;
+ ULONG HardwareCapabilities;
+ PPARALLEL_SET_CHIP_MODE TrySetChipMode;
+ PPARALLEL_CLEAR_CHIP_MODE ClearChipMode;
+ ULONG FifoDepth;
+ ULONG FifoWidth;
+ PHYSICAL_ADDRESS EppControllerPhysicalAddress;
+ ULONG SpanOfEppController;
+ ULONG Ieee1284_3DeviceCount;
+ PPARALLEL_TRY_SELECT_ROUTINE TrySelectDevice;
+ PPARALLEL_DESELECT_ROUTINE DeselectDevice;
+ PVOID Context;
+ ULONG CurrentMode;
+ PWSTR PortName;
+} PARALLEL_PNP_INFORMATION, *PPARALLEL_PNP_INFORMATION;
+
+typedef BOOLEAN DDKAPI
+(*PPARALLEL_TRY_ALLOCATE_ROUTINE)(
+ IN PVOID TryAllocateContext);
+
+typedef VOID DDKAPI
+(*PPARALLEL_FREE_ROUTINE)(
+ IN PVOID FreeContext);
+
+typedef ULONG DDKAPI
+(*PPARALLEL_QUERY_WAITERS_ROUTINE)(
+ IN PVOID QueryAllocsContext);
+
+typedef struct _PARALLEL_PORT_INFORMATION {
+ PHYSICAL_ADDRESS OriginalController;
+ PUCHAR Controller;
+ ULONG SpanOfController;
+ PPARALLEL_TRY_ALLOCATE_ROUTINE TryAllocatePort;
+ PPARALLEL_FREE_ROUTINE FreePort;
+ PPARALLEL_QUERY_WAITERS_ROUTINE QueryNumWaiters;
+ PVOID Context;
+} PARALLEL_PORT_INFORMATION, *PPARALLEL_PORT_INFORMATION;
+
+/* PARALLEL_CHIP_MODE.ModeFlags */
+#define INITIAL_MODE 0x00
+#define PARCHIP_ECR_ARBITRATOR 0x01
+
+typedef struct _PARALLEL_CHIP_MODE {
+ UCHAR ModeFlags;
+ BOOLEAN success;
+} PARALLEL_CHIP_MODE, *PPARALLEL_CHIP_MODE;
+
+typedef VOID DDKAPI
+(*PPARALLEL_DEFERRED_ROUTINE)(
+ IN PVOID DeferredContext);
+
+typedef struct _PARALLEL_INTERRUPT_SERVICE_ROUTINE {
+ PKSERVICE_ROUTINE InterruptServiceRoutine;
+ PVOID InterruptServiceContext;
+ PPARALLEL_DEFERRED_ROUTINE DeferredPortCheckRoutine;
+ PVOID DeferredPortCheckContext;
+} PARALLEL_INTERRUPT_SERVICE_ROUTINE, *PPARALLEL_INTERRUPT_SERVICE_ROUTINE;
+
+
+#define IOCTL_INTERNAL_DISCONNECT_IDLE \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 32, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_LOCK_PORT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 37, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_LOCK_PORT_NO_SELECT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 52, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARCLASS_CONNECT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_PARCLASS_DISCONNECT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_UNLOCK_PORT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 38, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define IOCTL_INTERNAL_UNLOCK_PORT_NO_DESELECT \
+ CTL_CODE (FILE_DEVICE_PARALLEL_PORT, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+typedef USHORT DDKAPI
+(*PDETERMINE_IEEE_MODES)(
+ IN PVOID Context);
+
+typedef enum _PARALLEL_SAFETY {
+ SAFE_MODE,
+ UNSAFE_MODE
+} PARALLEL_SAFETY;
+
+typedef NTSTATUS DDKAPI
+(*PNEGOTIATE_IEEE_MODE)(
+ IN PVOID Context,
+ IN USHORT ModeMaskFwd,
+ IN USHORT ModeMaskRev,
+ IN PARALLEL_SAFETY ModeSafety,
+ IN BOOLEAN IsForward);
+
+typedef NTSTATUS DDKAPI
+(*PTERMINATE_IEEE_MODE)(
+ IN PVOID Context);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_IEEE_FWD_TO_REV)(
+ IN PVOID Context);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_IEEE_REV_TO_FWD)(
+ IN PVOID Context);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_READ)(
+ IN PVOID Context,
+ OUT PVOID Buffer,
+ IN ULONG NumBytesToRead,
+ OUT PULONG NumBytesRead,
+ IN UCHAR Channel);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_WRITE)(
+ IN PVOID Context,
+ OUT PVOID Buffer,
+ IN ULONG NumBytesToWrite,
+ OUT PULONG NumBytesWritten,
+ IN UCHAR Channel);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_TRYSELECT_DEVICE)(
+ IN PVOID Context,
+ IN PARALLEL_1284_COMMAND Command);
+
+typedef NTSTATUS DDKAPI
+(*PPARALLEL_DESELECT_DEVICE)(
+ IN PVOID Context,
+ IN PARALLEL_1284_COMMAND Command);
+
+typedef struct _PARCLASS_INFORMATION {
+ PUCHAR Controller;
+ PUCHAR EcrController;
+ ULONG SpanOfController;
+ PDETERMINE_IEEE_MODES DetermineIeeeModes;
+ PNEGOTIATE_IEEE_MODE NegotiateIeeeMode;
+ PTERMINATE_IEEE_MODE TerminateIeeeMode;
+ PPARALLEL_IEEE_FWD_TO_REV IeeeFwdToRevMode;
+ PPARALLEL_IEEE_REV_TO_FWD IeeeRevToFwdMode;
+ PPARALLEL_READ ParallelRead;
+ PPARALLEL_WRITE ParallelWrite;
+ PVOID ParclassContext;
+ ULONG HardwareCapabilities;
+ ULONG FifoDepth;
+ ULONG FifoWidth;
+ PPARALLEL_TRYSELECT_DEVICE ParallelTryselect;
+ PPARALLEL_DESELECT_DEVICE ParallelDeSelect;
+} PARCLASS_INFORMATION, *PPARCLASS_INFORMATION;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PARALLEL_H */
--- /dev/null
+/*
+ * pfhook.h
+ *
+ * Packet filter API
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __PFHOOK_H
+#define __PFHOOK_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define DD_IPFLTRDRVR_DEVICE_NAME L"\\Device\\IPFILTERDRIVER"
+
+#define INVALID_PF_IF_INDEX 0xffffffff
+#define ZERO_PF_IP_ADDR 0
+
+typedef ULONG IPAddr;
+
+typedef enum _PF_FORWARD_ACTION {
+ PF_FORWARD = 0,
+ PF_DROP = 1,
+ PF_PASS = 2,
+ PF_ICMP_ON_DROP = 3
+} PF_FORWARD_ACTION;
+
+typedef PF_FORWARD_ACTION STDCALL
+(*PacketFilterExtensionPtr)(
+ IN unsigned char *PacketHeader,
+ IN unsigned char *Packet,
+ IN unsigned int PacketLength,
+ IN unsigned int RecvInterfaceIndex,
+ IN unsigned int SendInterfaceIndex,
+ IN IPAddr RecvLinkNextHop,
+ IN IPAddr SendLinkNextHop);
+
+typedef struct _PF_SET_EXTENSION_HOOK_INFO {
+ PacketFilterExtensionPtr ExtensionPointer;
+} PF_SET_EXTENSION_HOOK_INFO, *PPF_SET_EXTENSION_HOOK_INFO;
+
+#define FSCTL_IPFLTRDRVR_BASE FILE_DEVICE_NETWORK
+
+#define _IPFLTRDRVR_CTL_CODE(function, method, access) \
+ CTL_CODE(FSCTL_IPFLTRDRVR_BASE, function, method, access)
+
+#define IOCTL_PF_SET_EXTENSION_POINTER \
+ _IPFLTRDRVR_CTL_CODE(22, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PFHOOK_H */
--- /dev/null
+/*
+ * poclass.h
+ *
+ * Power policy driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __POCLASS_H
+#define __POCLASS_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "batclass.h"
+
+
+DEFINE_GUID(GUID_CLASS_INPUT,
+ 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30);
+
+DEFINE_GUID(GUID_DEVICE_LID,
+ 0x4AFA3D52L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57);
+
+DEFINE_GUID(GUID_DEVICE_MEMORY,
+ 0x3fd0f03dL, 0x92e0, 0x45fb, 0xb7, 0x5c, 0x5e, 0xd8, 0xff, 0xb0, 0x10, 0x21);
+
+DEFINE_GUID(GUID_DEVICE_MESSAGE_INDICATOR,
+ 0XCD48A365L, 0xfa94, 0x4ce2, 0xa2, 0x32, 0xa1, 0xb7, 0x64, 0xe5, 0xd8, 0xb4);
+
+DEFINE_GUID(GUID_DEVICE_PROCESSOR,
+ 0x97fadb10L, 0x4e33, 0x40ae, 0x35, 0x9c, 0x8b, 0xef, 0x02, 0x9d, 0xbd, 0xd0);
+
+DEFINE_GUID(GUID_DEVICE_SYS_BUTTON,
+ 0x4AFA3D53L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57);
+
+DEFINE_GUID(GUID_DEVICE_THERMAL_ZONE,
+ 0x4AFA3D51L, 0x74A7, 0x11d0, 0xbe, 0x5e, 0x00, 0xA0, 0xC9, 0x06, 0x28, 0x57);
+
+
+#define IOCTL_GET_PROCESSOR_OBJ_INFO \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x60, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_GET_SYS_BUTTON_CAPS \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x50, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_GET_SYS_BUTTON_EVENT \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x51, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_SET_SYS_MESSAGE_INDICATOR \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x70, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_NOTIFY_SWITCH_EVENT \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x40, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_THERMAL_QUERY_INFORMATION \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x20, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_THERMAL_SET_COOLING_POLICY \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x21, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define IOCTL_QUERY_LID \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x30, METHOD_BUFFERED, FILE_READ_ACCESS)
+
+#define IOCTL_RUN_ACTIVE_COOLING_METHOD \
+ CTL_CODE(FILE_DEVICE_BATTERY, 0x22, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+#define SYS_BUTTON_POWER 0x00000001
+#define SYS_BUTTON_SLEEP 0x00000002
+#define SYS_BUTTON_LID 0x00000004
+#define SYS_BUTTON_WAKE 0x80000000
+
+#define MAX_ACTIVE_COOLING_LEVELS 10
+#define ACTIVE_COOLING 0
+#define PASSIVE_COOLING 1
+
+typedef struct _THERMAL_INFORMATION {
+ ULONG ThermalStamp;
+ ULONG ThermalConstant1;
+ ULONG ThermalConstant2;
+ KAFFINITY Processors;
+ ULONG SamplingPeriod;
+ ULONG CurrentTemperature;
+ ULONG PassiveTripPoint;
+ ULONG CriticalTripPoint;
+ UCHAR ActiveTripPointCount;
+ ULONG ActiveTripPoint[MAX_ACTIVE_COOLING_LEVELS];
+} THERMAL_INFORMATION, *PTHERMAL_INFORMATION;
+
+typedef struct _PROCESSOR_OBJECT_INFO {
+ ULONG PhysicalID;
+ ULONG PBlkAddress;
+ UCHAR PBlkLength;
+} PROCESSOR_OBJECT_INFO, *PPROCESSOR_OBJECT_INFO;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __POCLASS_H */
--- /dev/null
+/*
+ * scsi.h
+ *
+ * SCSI port and class interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __SCSI_H
+#define __SCSI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+typedef union _CDB {
+ struct _CDB6GENERIC {
+ UCHAR OperationCode;
+ UCHAR Immediate : 1;
+ UCHAR CommandUniqueBits : 4;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR CommandUniqueBytes[3];
+ UCHAR Link : 1;
+ UCHAR Flag : 1;
+ UCHAR Reserved : 4;
+ UCHAR VendorUnique : 2;
+ } CDB6GENERIC, *PCDB6GENERIC;
+
+ struct _CDB6READWRITE {
+ UCHAR OperationCode;
+ UCHAR LogicalBlockMsb1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR LogicalBlockMsb0;
+ UCHAR LogicalBlockLsb;
+ UCHAR TransferBlocks;
+ UCHAR Control;
+ } CDB6READWRITE, *PCDB6READWRITE;
+
+ struct _CDB6INQUIRY {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR PageCode;
+ UCHAR IReserved;
+ UCHAR AllocationLength;
+ UCHAR Control;
+ } CDB6INQUIRY, *PCDB6INQUIRY;
+
+ struct _CDB6INQUIRY3 {
+ UCHAR OperationCode;
+ UCHAR EnableVitalProductData : 1;
+ UCHAR CommandSupportData : 1;
+ UCHAR Reserved1 : 6;
+ UCHAR PageCode;
+ UCHAR Reserved2;
+ UCHAR AllocationLength;
+ UCHAR Control;
+ } CDB6INQUIRY3, *PCDB6INQUIRY3;
+
+ struct _CDB6VERIFY {
+ UCHAR OperationCode;
+ UCHAR Fixed : 1;
+ UCHAR ByteCompare : 1;
+ UCHAR Immediate : 1;
+ UCHAR Reserved : 2;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR VerificationLength[3];
+ UCHAR Control;
+ } CDB6VERIFY, *PCDB6VERIFY;
+
+ struct _CDB6FORMAT {
+ UCHAR OperationCode;
+ UCHAR FormatControl : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR FReserved1;
+ UCHAR InterleaveMsb;
+ UCHAR InterleaveLsb;
+ UCHAR FReserved2;
+ } CDB6FORMAT, *PCDB6FORMAT;
+
+ struct _CDB10 {
+ UCHAR OperationCode;
+ UCHAR RelativeAddress : 1;
+ UCHAR Reserved1 : 2;
+ UCHAR ForceUnitAccess : 1;
+ UCHAR DisablePageOut : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR LogicalBlockByte0;
+ UCHAR LogicalBlockByte1;
+ UCHAR LogicalBlockByte2;
+ UCHAR LogicalBlockByte3;
+ UCHAR Reserved2;
+ UCHAR TransferBlocksMsb;
+ UCHAR TransferBlocksLsb;
+ UCHAR Control;
+ } CDB10, *PCDB10;
+
+ struct _CDB12 {
+ UCHAR OperationCode;
+ UCHAR RelativeAddress : 1;
+ UCHAR Reserved1 : 2;
+ UCHAR ForceUnitAccess : 1;
+ UCHAR DisablePageOut : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR LogicalBlock[4];
+ UCHAR TransferLength[4];
+ UCHAR Reserved2;
+ UCHAR Control;
+ } CDB12, *PCDB12;
+
+ struct _PAUSE_RESUME {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2[6];
+ UCHAR Action;
+ UCHAR Control;
+ } PAUSE_RESUME, *PPAUSE_RESUME;
+
+ struct _READ_TOC {
+ UCHAR OperationCode;
+ UCHAR Reserved0 : 1;
+ UCHAR Msf : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Format2 : 4;
+ UCHAR Reserved2 : 4;
+ UCHAR Reserved3[3];
+ UCHAR StartingTrack;
+ UCHAR AllocationLength[2];
+ UCHAR Control : 6;
+ UCHAR Format : 2;
+ } READ_TOC, *PREAD_TOC;
+
+ struct _READ_DISK_INFORMATION {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR Reserved2[5];
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } READ_DISK_INFORMATION, *PREAD_DISK_INFORMATION;
+
+ struct _READ_TRACK_INFORMATION {
+ UCHAR OperationCode;
+ UCHAR Track : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR Reserved2 : 1;
+ UCHAR Lun : 3;
+ UCHAR BlockAddress[4];
+ UCHAR Reserved3;
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } READ_TRACK_INFORMATION, *PREAD_TRACK_INFORMATION;
+
+ struct _RESERVE_TRACK_RZONE {
+ UCHAR OperationCode;
+ UCHAR Reserved1[4];
+ UCHAR ReservationSize[4];
+ UCHAR Control;
+ } RESERVE_TRACK_RZONE, *PRESERVE_TRACK_RZONE;
+
+ struct _SEND_OPC_INFORMATION {
+ UCHAR OperationCode;
+ UCHAR DoOpc : 1;
+ UCHAR Reserved : 7;
+ UCHAR Reserved1[5];
+ UCHAR ParameterListLength[2];
+ UCHAR Reserved2;
+ } SEND_OPC_INFORMATION, *PSEND_OPC_INFORMATION;
+
+ struct _CLOSE_TRACK {
+ UCHAR OperationCode;
+ UCHAR Immediate : 1;
+ UCHAR Reserved1 : 7;
+ UCHAR Track : 1;
+ UCHAR Session : 1;
+ UCHAR Reserved2 : 6;
+ UCHAR Reserved3;
+ UCHAR TrackNumber[2];
+ UCHAR Reserved4[3];
+ UCHAR Control;
+ } CLOSE_TRACK, *PCLOSE_TRACK;
+
+ struct _SEND_CUE_SHEET {
+ UCHAR OperationCode;
+ UCHAR Reserved[5];
+ UCHAR CueSheetSize[3];
+ UCHAR Control;
+ } SEND_CUE_SHEET, *PSEND_CUE_SHEET;
+
+ struct _READ_HEADER {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 1;
+ UCHAR Msf : 1;
+ UCHAR Reserved2 : 3;
+ UCHAR Lun : 3;
+ UCHAR LogicalBlockAddress[4];
+ UCHAR Reserved3;
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } READ_HEADER, *PREAD_HEADER;
+
+ struct _PLAY_AUDIO {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR StartingBlockAddress[4];
+ UCHAR Reserved2;
+ UCHAR PlayLength[2];
+ UCHAR Control;
+ } PLAY_AUDIO, *PPLAY_AUDIO;
+
+ struct _PLAY_AUDIO_MSF {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2;
+ UCHAR StartingM;
+ UCHAR StartingS;
+ UCHAR StartingF;
+ UCHAR EndingM;
+ UCHAR EndingS;
+ UCHAR EndingF;
+ UCHAR Control;
+ } PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF;
+
+ struct _PLAY_CD {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 1;
+ UCHAR CMSF : 1;
+ UCHAR ExpectedSectorType : 3;
+ UCHAR Lun : 3;
+
+ union {
+ struct _LBA {
+ UCHAR StartingBlockAddress[4];
+ UCHAR PlayLength[4];
+ } LBA;
+
+ struct _MSF {
+ UCHAR Reserved1;
+ UCHAR StartingM;
+ UCHAR StartingS;
+ UCHAR StartingF;
+ UCHAR EndingM;
+ UCHAR EndingS;
+ UCHAR EndingF;
+ UCHAR Reserved2;
+ } MSF;
+ #ifdef __cplusplus
+ } u;
+ #else
+ };
+ #endif
+
+ UCHAR Audio : 1;
+ UCHAR Composite : 1;
+ UCHAR Port1 : 1;
+ UCHAR Port2 : 1;
+ UCHAR Reserved2 : 3;
+ UCHAR Speed : 1;
+ UCHAR Control;
+ } PLAY_CD, *PPLAY_CD;
+
+ struct _SCAN_CD {
+ UCHAR OperationCode;
+ UCHAR RelativeAddress : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR Direct : 1;
+ UCHAR Lun : 3;
+ UCHAR StartingAddress[4];
+ UCHAR Reserved2[3];
+ UCHAR Reserved3 : 6;
+ UCHAR Type : 2;
+ UCHAR Reserved4;
+ UCHAR Control;
+ } SCAN_CD, *PSCAN_CD;
+
+ struct _STOP_PLAY_SCAN {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR Reserved2[7];
+ UCHAR Control;
+ } STOP_PLAY_SCAN, *PSTOP_PLAY_SCAN;
+
+ struct _SUBCHANNEL {
+ UCHAR OperationCode;
+ UCHAR Reserved0 : 1;
+ UCHAR Msf : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2 : 6;
+ UCHAR SubQ : 1;
+ UCHAR Reserved3 : 1;
+ UCHAR Format;
+ UCHAR Reserved4[2];
+ UCHAR TrackNumber;
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } SUBCHANNEL, *PSUBCHANNEL;
+
+ struct _READ_CD {
+ UCHAR OperationCode;
+ UCHAR RelativeAddress : 1;
+ UCHAR Reserved0 : 1;
+ UCHAR ExpectedSectorType : 3;
+ UCHAR Lun : 3;
+ UCHAR StartingLBA[4];
+ UCHAR TransferBlocks[3];
+ UCHAR Reserved2 : 1;
+ UCHAR ErrorFlags : 2;
+ UCHAR IncludeEDC : 1;
+ UCHAR IncludeUserData : 1;
+ UCHAR HeaderCode : 2;
+ UCHAR IncludeSyncData : 1;
+ UCHAR SubChannelSelection : 3;
+ UCHAR Reserved3 : 5;
+ UCHAR Control;
+ } READ_CD, *PREAD_CD;
+
+ struct _READ_CD_MSF {
+ UCHAR OperationCode;
+ UCHAR RelativeAddress : 1;
+ UCHAR Reserved1 : 1;
+ UCHAR ExpectedSectorType : 3;
+ UCHAR Lun : 3;
+ UCHAR Reserved2;
+ UCHAR StartingM;
+ UCHAR StartingS;
+ UCHAR StartingF;
+ UCHAR EndingM;
+ UCHAR EndingS;
+ UCHAR EndingF;
+ UCHAR Reserved3;
+ UCHAR Reserved4 : 1;
+ UCHAR ErrorFlags : 2;
+ UCHAR IncludeEDC : 1;
+ UCHAR IncludeUserData : 1;
+ UCHAR HeaderCode : 2;
+ UCHAR IncludeSyncData : 1;
+ UCHAR SubChannelSelection : 3;
+ UCHAR Reserved5 : 5;
+ UCHAR Control;
+ } READ_CD_MSF, *PREAD_CD_MSF;
+
+ struct _PLXTR_READ_CDDA {
+ UCHAR OperationCode;
+ UCHAR Reserved0 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR LogicalBlockByte0;
+ UCHAR LogicalBlockByte1;
+ UCHAR LogicalBlockByte2;
+ UCHAR LogicalBlockByte3;
+ UCHAR TransferBlockByte0;
+ UCHAR TransferBlockByte1;
+ UCHAR TransferBlockByte2;
+ UCHAR TransferBlockByte3;
+ UCHAR SubCode;
+ UCHAR Control;
+ } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
+
+ struct _NEC_READ_CDDA {
+ UCHAR OperationCode;
+ UCHAR Reserved0;
+ UCHAR LogicalBlockByte0;
+ UCHAR LogicalBlockByte1;
+ UCHAR LogicalBlockByte2;
+ UCHAR LogicalBlockByte3;
+ UCHAR Reserved1;
+ UCHAR TransferBlockByte0;
+ UCHAR TransferBlockByte1;
+ UCHAR Control;
+ } NEC_READ_CDDA, *PNEC_READ_CDDA;
+
+ struct _MODE_SENSE {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 3;
+ UCHAR Dbd : 1;
+ UCHAR Reserved2 : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR PageCode : 6;
+ UCHAR Pc : 2;
+ UCHAR Reserved3;
+ UCHAR AllocationLength;
+ UCHAR Control;
+ } MODE_SENSE, *PMODE_SENSE;
+
+ struct _MODE_SENSE10 {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 3;
+ UCHAR Dbd : 1;
+ UCHAR Reserved2 : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR PageCode : 6;
+ UCHAR Pc : 2;
+ UCHAR Reserved3[4];
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } MODE_SENSE10, *PMODE_SENSE10;
+
+ struct _MODE_SELECT {
+ UCHAR OperationCode;
+ UCHAR SPBit : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR PFBit : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2[2];
+ UCHAR ParameterListLength;
+ UCHAR Control;
+ } MODE_SELECT, *PMODE_SELECT;
+
+ struct _MODE_SELECT10 {
+ UCHAR OperationCode;
+ UCHAR SPBit : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR PFBit : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2[5];
+ UCHAR ParameterListLength[2];
+ UCHAR Control;
+ } MODE_SELECT10, *PMODE_SELECT10;
+
+ struct _LOCATE {
+ UCHAR OperationCode;
+ UCHAR Immediate : 1;
+ UCHAR CPBit : 1;
+ UCHAR BTBit : 1;
+ UCHAR Reserved1 : 2;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved3;
+ UCHAR LogicalBlockAddress[4];
+ UCHAR Reserved4;
+ UCHAR Partition;
+ UCHAR Control;
+ } LOCATE, *PLOCATE;
+
+ struct _LOGSENSE {
+ UCHAR OperationCode;
+ UCHAR SPBit : 1;
+ UCHAR PPCBit : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR PageCode : 6;
+ UCHAR PCBit : 2;
+ UCHAR Reserved2;
+ UCHAR Reserved3;
+ UCHAR ParameterPointer[2];
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } LOGSENSE, *PLOGSENSE;
+
+ struct _LOGSELECT {
+ UCHAR OperationCode;
+ UCHAR SPBit : 1;
+ UCHAR PCRBit : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved : 6;
+ UCHAR PCBit : 2;
+ UCHAR Reserved2[4];
+ UCHAR ParameterListLength[2];
+ UCHAR Control;
+ } LOGSELECT, *PLOGSELECT;
+
+ struct _PRINT {
+ UCHAR OperationCode;
+ UCHAR Reserved : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR TransferLength[3];
+ UCHAR Control;
+ } PRINT, *PPRINT;
+
+ struct _SEEK {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR LogicalBlockAddress[4];
+ UCHAR Reserved2[3];
+ UCHAR Control;
+ } SEEK, *PSEEK;
+
+ struct _ERASE {
+ UCHAR OperationCode;
+ UCHAR Long : 1;
+ UCHAR Immediate : 1;
+ UCHAR Reserved1 : 3;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2[3];
+ UCHAR Control;
+ } ERASE, *PERASE;
+
+ struct _START_STOP {
+ UCHAR OperationCode;
+ UCHAR Immediate: 1;
+ UCHAR Reserved1 : 4;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2[2];
+ UCHAR Start : 1;
+ UCHAR LoadEject : 1;
+ UCHAR Reserved3 : 6;
+ UCHAR Control;
+ } START_STOP, *PSTART_STOP;
+
+ struct _MEDIA_REMOVAL {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR Reserved2[2];
+
+ UCHAR Prevent : 1;
+ UCHAR Persistant : 1;
+ UCHAR Reserved3 : 6;
+
+ UCHAR Control;
+ } MEDIA_REMOVAL, *PMEDIA_REMOVAL;
+
+ struct _SEEK_BLOCK {
+ UCHAR OperationCode;
+ UCHAR Immediate : 1;
+ UCHAR Reserved1 : 7;
+ UCHAR BlockAddress[3];
+ UCHAR Link : 1;
+ UCHAR Flag : 1;
+ UCHAR Reserved2 : 4;
+ UCHAR VendorUnique : 2;
+ } SEEK_BLOCK, *PSEEK_BLOCK;
+
+ struct _REQUEST_BLOCK_ADDRESS {
+ UCHAR OperationCode;
+ UCHAR Reserved1[3];
+ UCHAR AllocationLength;
+ UCHAR Link : 1;
+ UCHAR Flag : 1;
+ UCHAR Reserved2 : 4;
+ UCHAR VendorUnique : 2;
+ } REQUEST_BLOCK_ADDRESS, *PREQUEST_BLOCK_ADDRESS;
+
+ struct _PARTITION {
+ UCHAR OperationCode;
+ UCHAR Immediate : 1;
+ UCHAR Sel: 1;
+ UCHAR PartitionSelect : 6;
+ UCHAR Reserved1[3];
+ UCHAR Control;
+ } PARTITION, *PPARTITION;
+
+ struct _WRITE_TAPE_MARKS {
+ UCHAR OperationCode;
+ UCHAR Immediate : 1;
+ UCHAR WriteSetMarks: 1;
+ UCHAR Reserved : 3;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR TransferLength[3];
+ UCHAR Control;
+ } WRITE_TAPE_MARKS, *PWRITE_TAPE_MARKS;
+
+ struct _SPACE_TAPE_MARKS {
+ UCHAR OperationCode;
+ UCHAR Code : 3;
+ UCHAR Reserved : 2;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR NumMarksMSB ;
+ UCHAR NumMarks;
+ UCHAR NumMarksLSB;
+ union {
+ UCHAR value;
+ struct {
+ UCHAR Link : 1;
+ UCHAR Flag : 1;
+ UCHAR Reserved : 4;
+ UCHAR VendorUnique : 2;
+ } Fields;
+ } Byte6;
+ } SPACE_TAPE_MARKS, *PSPACE_TAPE_MARKS;
+
+ struct _READ_POSITION {
+ UCHAR Operation;
+ UCHAR BlockType : 1;
+ UCHAR Reserved1 : 4;
+ UCHAR Lun : 3;
+ UCHAR Reserved2[7];
+ UCHAR Control;
+ } READ_POSITION, *PREAD_POSITION;
+
+ struct _CDB6READWRITETAPE {
+ UCHAR OperationCode;
+ UCHAR VendorSpecific : 5;
+ UCHAR Reserved : 3;
+ UCHAR TransferLenMSB;
+ UCHAR TransferLen;
+ UCHAR TransferLenLSB;
+ UCHAR Link : 1;
+ UCHAR Flag : 1;
+ UCHAR Reserved1 : 4;
+ UCHAR VendorUnique : 2;
+ } CDB6READWRITETAPE, *PCDB6READWRITETAPE;
+
+ struct _INIT_ELEMENT_STATUS {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNubmer : 3;
+ UCHAR Reserved2[3];
+ UCHAR Reserved3 : 7;
+ UCHAR NoBarCode : 1;
+ } INIT_ELEMENT_STATUS, *PINIT_ELEMENT_STATUS;
+
+ struct _INITIALIZE_ELEMENT_RANGE {
+ UCHAR OperationCode;
+ UCHAR Range : 1;
+ UCHAR Reserved1 : 4;
+ UCHAR LogicalUnitNubmer : 3;
+ UCHAR FirstElementAddress[2];
+ UCHAR Reserved2[2];
+ UCHAR NumberOfElements[2];
+ UCHAR Reserved3;
+ UCHAR Reserved4 : 7;
+ UCHAR NoBarCode : 1;
+ } INITIALIZE_ELEMENT_RANGE, *PINITIALIZE_ELEMENT_RANGE;
+
+ struct _POSITION_TO_ELEMENT {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR TransportElementAddress[2];
+ UCHAR DestinationElementAddress[2];
+ UCHAR Reserved2[2];
+ UCHAR Flip : 1;
+ UCHAR Reserved3 : 7;
+ UCHAR Control;
+ } POSITION_TO_ELEMENT, *PPOSITION_TO_ELEMENT;
+
+ struct _MOVE_MEDIUM {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR TransportElementAddress[2];
+ UCHAR SourceElementAddress[2];
+ UCHAR DestinationElementAddress[2];
+ UCHAR Reserved2[2];
+ UCHAR Flip : 1;
+ UCHAR Reserved3 : 7;
+ UCHAR Control;
+ } MOVE_MEDIUM, *PMOVE_MEDIUM;
+
+ struct _EXCHANGE_MEDIUM {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR TransportElementAddress[2];
+ UCHAR SourceElementAddress[2];
+ UCHAR Destination1ElementAddress[2];
+ UCHAR Destination2ElementAddress[2];
+ UCHAR Flip1 : 1;
+ UCHAR Flip2 : 1;
+ UCHAR Reserved3 : 6;
+ UCHAR Control;
+ } EXCHANGE_MEDIUM, *PEXCHANGE_MEDIUM;
+
+ struct _READ_ELEMENT_STATUS {
+ UCHAR OperationCode;
+ UCHAR ElementType : 4;
+ UCHAR VolTag : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR StartingElementAddress[2];
+ UCHAR NumberOfElements[2];
+ UCHAR Reserved1;
+ UCHAR AllocationLength[3];
+ UCHAR Reserved2;
+ UCHAR Control;
+ } READ_ELEMENT_STATUS, *PREAD_ELEMENT_STATUS;
+
+ struct _SEND_VOLUME_TAG {
+ UCHAR OperationCode;
+ UCHAR ElementType : 4;
+ UCHAR Reserved1 : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR StartingElementAddress[2];
+ UCHAR Reserved2;
+ UCHAR ActionCode : 5;
+ UCHAR Reserved3 : 3;
+ UCHAR Reserved4[2];
+ UCHAR ParameterListLength[2];
+ UCHAR Reserved5;
+ UCHAR Control;
+ } SEND_VOLUME_TAG, *PSEND_VOLUME_TAG;
+
+ struct _REQUEST_VOLUME_ELEMENT_ADDRESS {
+ UCHAR OperationCode;
+ UCHAR ElementType : 4;
+ UCHAR VolTag : 1;
+ UCHAR LogicalUnitNumber : 3;
+ UCHAR StartingElementAddress[2];
+ UCHAR NumberElements[2];
+ UCHAR Reserved1;
+ UCHAR AllocationLength[3];
+ UCHAR Reserved2;
+ UCHAR Control;
+ } REQUEST_VOLUME_ELEMENT_ADDRESS, *PREQUEST_VOLUME_ELEMENT_ADDRESS;
+
+ struct _LOAD_UNLOAD {
+ UCHAR OperationCode;
+ UCHAR Immediate : 1;
+ UCHAR Reserved1 : 4;
+ UCHAR Lun : 3;
+ UCHAR Reserved2[2];
+ UCHAR Start : 1;
+ UCHAR LoadEject : 1;
+ UCHAR Reserved3: 6;
+ UCHAR Reserved4[3];
+ UCHAR Slot;
+ UCHAR Reserved5[3];
+ } LOAD_UNLOAD, *PLOAD_UNLOAD;
+
+ struct _MECH_STATUS {
+ UCHAR OperationCode;
+ UCHAR Reserved : 5;
+ UCHAR Lun : 3;
+ UCHAR Reserved1[6];
+ UCHAR AllocationLength[2];
+ UCHAR Reserved2[1];
+ UCHAR Control;
+ } MECH_STATUS, *PMECH_STATUS;
+
+ struct _SYNCHRONIZE_CACHE10 {
+
+ UCHAR OperationCode;
+
+ UCHAR RelAddr : 1;
+ UCHAR Immediate : 1;
+ UCHAR Reserved : 3;
+ UCHAR Lun : 3;
+
+ UCHAR LogicalBlockAddress[4];
+ UCHAR Reserved2;
+ UCHAR BlockCount[2];
+ UCHAR Control;
+ } SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
+
+ struct _GET_EVENT_STATUS_NOTIFICATION {
+ UCHAR OperationCode;
+
+ UCHAR Immediate : 1;
+ UCHAR Reserved : 4;
+ UCHAR Lun : 3;
+
+ UCHAR Reserved2[2];
+ UCHAR NotificationClassRequest;
+ UCHAR Reserved3[2];
+ UCHAR EventListLength[2];
+
+ UCHAR Control;
+ } GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
+
+ struct _READ_DVD_STRUCTURE {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR RMDBlockNumber[4];
+ UCHAR LayerNumber;
+ UCHAR Format;
+ UCHAR AllocationLength[2];
+ UCHAR Reserved3 : 6;
+ UCHAR AGID : 2;
+ UCHAR Control;
+ } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
+
+ struct _SEND_DVD_STRUCTURE {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR Reserved2[5];
+ UCHAR Format;
+ UCHAR ParameterListLength[2];
+ UCHAR Reserved3;
+ UCHAR Control;
+ } SEND_DVD_STRUCTURE, *PSEND_DVD_STRUCTURE;
+
+ struct _SEND_KEY {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR Reserved2[6];
+ UCHAR ParameterListLength[2];
+ UCHAR KeyFormat : 6;
+ UCHAR AGID : 2;
+ UCHAR Control;
+ } SEND_KEY, *PSEND_KEY;
+
+ struct _REPORT_KEY {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR LogicalBlockAddress[4];
+ UCHAR Reserved2[2];
+ UCHAR AllocationLength[2];
+ UCHAR KeyFormat : 6;
+ UCHAR AGID : 2;
+ UCHAR Control;
+ } REPORT_KEY, *PREPORT_KEY;
+
+ struct _SET_READ_AHEAD {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR TriggerLBA[4];
+ UCHAR ReadAheadLBA[4];
+ UCHAR Reserved2;
+ UCHAR Control;
+ } SET_READ_AHEAD, *PSET_READ_AHEAD;
+
+ struct _READ_FORMATTED_CAPACITIES {
+ UCHAR OperationCode;
+ UCHAR Reserved1 : 5;
+ UCHAR Lun : 3;
+ UCHAR Reserved2[5];
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } READ_FORMATTED_CAPACITIES, *PREAD_FORMATTED_CAPACITIES;
+
+ struct _REPORT_LUNS {
+ UCHAR OperationCode;
+ UCHAR Reserved1[5];
+ UCHAR AllocationLength[4];
+ UCHAR Reserved2[1];
+ UCHAR Control;
+ } REPORT_LUNS, *PREPORT_LUNS;
+
+ struct _PERSISTENT_RESERVE_IN {
+ UCHAR OperationCode;
+ UCHAR ServiceAction : 5;
+ UCHAR Reserved1 : 3;
+ UCHAR Reserved2[5];
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } PERSISTENT_RESERVE_IN, *PPERSISTENT_RESERVE_IN;
+
+ struct _PERSISTENT_RESERVE_OUT {
+ UCHAR OperationCode;
+ UCHAR ServiceAction : 5;
+ UCHAR Reserved1 : 3;
+ UCHAR Type : 4;
+ UCHAR Scope : 4;
+ UCHAR Reserved2[4];
+ UCHAR ParameterListLength[2];
+ UCHAR Control;
+ } PERSISTENT_RESERVE_OUT, *PPERSISTENT_RESERVE_OUT;
+
+ struct _GET_CONFIGURATION {
+ UCHAR OperationCode;
+ UCHAR RequestType : 1;
+ UCHAR Reserved1 : 7;
+ UCHAR StartingFeature[2];
+ UCHAR Reserved2[3];
+ UCHAR AllocationLength[2];
+ UCHAR Control;
+ } GET_CONFIGURATION, *PGET_CONFIGURATION;
+
+ struct _SET_CD_SPEED {
+ UCHAR OperationCode;
+ UCHAR Reserved1;
+ UCHAR ReadSpeed[2];
+ UCHAR WriteSpeed[2];
+ UCHAR Reserved2[5];
+ UCHAR Control;
+ } SET_CD_SPEED, *PSET_CD_SPEED;
+
+ ULONG AsUlong[4];
+ UCHAR AsByte[16];
+} CDB, *PCDB;
+
+#define INQUIRYDATABUFFERSIZE 36
+
+typedef struct _INQUIRYDATA {
+ UCHAR DeviceType : 5;
+ UCHAR DeviceTypeQualifier : 3;
+ UCHAR DeviceTypeModifier : 7;
+ UCHAR RemovableMedia : 1;
+ union {
+ UCHAR Versions;
+ struct {
+ UCHAR ANSIVersion : 3;
+ UCHAR ECMAVersion : 3;
+ UCHAR ISOVersion : 2;
+ };
+ };
+ UCHAR ResponseDataFormat : 4;
+ UCHAR HiSupport : 1;
+ UCHAR NormACA : 1;
+ UCHAR TerminateTask : 1;
+ UCHAR AERC : 1;
+ UCHAR AdditionalLength;
+ UCHAR Reserved;
+ UCHAR Addr16 : 1;
+ UCHAR Addr32 : 1;
+ UCHAR AckReqQ: 1;
+ UCHAR MediumChanger : 1;
+ UCHAR MultiPort : 1;
+ UCHAR ReservedBit2 : 1;
+ UCHAR EnclosureServices : 1;
+ UCHAR ReservedBit3 : 1;
+ UCHAR SoftReset : 1;
+ UCHAR CommandQueue : 1;
+ UCHAR TransferDisable : 1;
+ UCHAR LinkedCommands : 1;
+ UCHAR Synchronous : 1;
+ UCHAR Wide16Bit : 1;
+ UCHAR Wide32Bit : 1;
+ UCHAR RelativeAddressing : 1;
+ UCHAR VendorId[8];
+ UCHAR ProductId[16];
+ UCHAR ProductRevisionLevel[4];
+ UCHAR VendorSpecific[20];
+ UCHAR Reserved3[40];
+} INQUIRYDATA, *PINQUIRYDATA;
+
+/* INQUIRYDATA.DeviceType constants */
+#define DIRECT_ACCESS_DEVICE 0x00
+#define SEQUENTIAL_ACCESS_DEVICE 0x01
+#define PRINTER_DEVICE 0x02
+#define PROCESSOR_DEVICE 0x03
+#define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04
+#define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05
+#define SCANNER_DEVICE 0x06
+#define OPTICAL_DEVICE 0x07
+#define MEDIUM_CHANGER 0x08
+#define COMMUNICATION_DEVICE 0x09
+#define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
+#define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
+
+/* INQUIRYDATA.DeviceTypeQualifier constants */
+#define DEVICE_CONNECTED 0x00
+
+#define SCSISTAT_GOOD 0x00
+#define SCSISTAT_CHECK_CONDITION 0x02
+#define SCSISTAT_CONDITION_MET 0x04
+#define SCSISTAT_BUSY 0x08
+#define SCSISTAT_INTERMEDIATE 0x10
+#define SCSISTAT_INTERMEDIATE_COND_MET 0x14
+#define SCSISTAT_RESERVATION_CONFLICT 0x18
+#define SCSISTAT_COMMAND_TERMINATED 0x22
+#define SCSISTAT_QUEUE_FULL 0x28
+
+/* Mode Sense/Select page constants */
+#define MODE_PAGE_ERROR_RECOVERY 0x01
+#define MODE_PAGE_DISCONNECT 0x02
+#define MODE_PAGE_FORMAT_DEVICE 0x03
+#define MODE_PAGE_RIGID_GEOMETRY 0x04
+#define MODE_PAGE_FLEXIBILE 0x05
+#define MODE_PAGE_WRITE_PARAMETERS 0x05
+#define MODE_PAGE_VERIFY_ERROR 0x07
+#define MODE_PAGE_CACHING 0x08
+#define MODE_PAGE_PERIPHERAL 0x09
+#define MODE_PAGE_CONTROL 0x0A
+#define MODE_PAGE_MEDIUM_TYPES 0x0B
+#define MODE_PAGE_NOTCH_PARTITION 0x0C
+#define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
+#define MODE_PAGE_DATA_COMPRESS 0x0F
+#define MODE_PAGE_DEVICE_CONFIG 0x10
+#define MODE_PAGE_MEDIUM_PARTITION 0x11
+#define MODE_PAGE_CDVD_FEATURE_SET 0x18
+#define MODE_PAGE_POWER_CONDITION 0x1A
+#define MODE_PAGE_FAULT_REPORTING 0x1C
+#define MODE_PAGE_CDVD_INACTIVITY 0x1D
+#define MODE_PAGE_ELEMENT_ADDRESS 0x1D
+#define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E
+#define MODE_PAGE_DEVICE_CAPABILITIES 0x1F
+#define MODE_PAGE_CAPABILITIES 0x2A
+#define MODE_SENSE_RETURN_ALL 0x3f
+#define MODE_SENSE_CURRENT_VALUES 0x00
+#define MODE_SENSE_CHANGEABLE_VALUES 0x40
+#define MODE_SENSE_DEFAULT_VAULES 0x80
+#define MODE_SENSE_SAVED_VALUES 0xc0
+
+/* SCSI CDB operation codes */
+#define SCSIOP_TEST_UNIT_READY 0x00
+#define SCSIOP_REZERO_UNIT 0x01
+#define SCSIOP_REWIND 0x01
+#define SCSIOP_REQUEST_BLOCK_ADDR 0x02
+#define SCSIOP_REQUEST_SENSE 0x03
+#define SCSIOP_FORMAT_UNIT 0x04
+#define SCSIOP_READ_BLOCK_LIMITS 0x05
+#define SCSIOP_REASSIGN_BLOCKS 0x07
+#define SCSIOP_INIT_ELEMENT_STATUS 0x07
+#define SCSIOP_READ6 0x08
+#define SCSIOP_RECEIVE 0x08
+#define SCSIOP_WRITE6 0x0A
+#define SCSIOP_PRINT 0x0A
+#define SCSIOP_SEND 0x0A
+#define SCSIOP_SEEK6 0x0B
+#define SCSIOP_TRACK_SELECT 0x0B
+#define SCSIOP_SLEW_PRINT 0x0B
+#define SCSIOP_SEEK_BLOCK 0x0C
+#define SCSIOP_PARTITION 0x0D
+#define SCSIOP_READ_REVERSE 0x0F
+#define SCSIOP_WRITE_FILEMARKS 0x10
+#define SCSIOP_FLUSH_BUFFER 0x10
+#define SCSIOP_SPACE 0x11
+#define SCSIOP_INQUIRY 0x12
+#define SCSIOP_VERIFY6 0x13
+#define SCSIOP_RECOVER_BUF_DATA 0x14
+#define SCSIOP_MODE_SELECT 0x15
+#define SCSIOP_RESERVE_UNIT 0x16
+#define SCSIOP_RELEASE_UNIT 0x17
+#define SCSIOP_COPY 0x18
+#define SCSIOP_ERASE 0x19
+#define SCSIOP_MODE_SENSE 0x1A
+#define SCSIOP_START_STOP_UNIT 0x1B
+#define SCSIOP_STOP_PRINT 0x1B
+#define SCSIOP_LOAD_UNLOAD 0x1B
+#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
+#define SCSIOP_SEND_DIAGNOSTIC 0x1D
+#define SCSIOP_MEDIUM_REMOVAL 0x1E
+
+#define SCSIOP_READ_FORMATTED_CAPACITY 0x23
+#define SCSIOP_READ_CAPACITY 0x25
+#define SCSIOP_READ 0x28
+#define SCSIOP_WRITE 0x2A
+#define SCSIOP_SEEK 0x2B
+#define SCSIOP_LOCATE 0x2B
+#define SCSIOP_POSITION_TO_ELEMENT 0x2B
+#define SCSIOP_WRITE_VERIFY 0x2E
+#define SCSIOP_VERIFY 0x2F
+#define SCSIOP_SEARCH_DATA_HIGH 0x30
+#define SCSIOP_SEARCH_DATA_EQUAL 0x31
+#define SCSIOP_SEARCH_DATA_LOW 0x32
+#define SCSIOP_SET_LIMITS 0x33
+#define SCSIOP_READ_POSITION 0x34
+#define SCSIOP_SYNCHRONIZE_CACHE 0x35
+#define SCSIOP_COMPARE 0x39
+#define SCSIOP_COPY_COMPARE 0x3A
+#define SCSIOP_WRITE_DATA_BUFF 0x3B
+#define SCSIOP_READ_DATA_BUFF 0x3C
+#define SCSIOP_CHANGE_DEFINITION 0x40
+#define SCSIOP_READ_SUB_CHANNEL 0x42
+#define SCSIOP_READ_TOC 0x43
+#define SCSIOP_READ_HEADER 0x44
+#define SCSIOP_PLAY_AUDIO 0x45
+#define SCSIOP_GET_CONFIGURATION 0x46
+#define SCSIOP_PLAY_AUDIO_MSF 0x47
+#define SCSIOP_PLAY_TRACK_INDEX 0x48
+#define SCSIOP_PLAY_TRACK_RELATIVE 0x49
+#define SCSIOP_GET_EVENT_STATUS 0x4A
+#define SCSIOP_PAUSE_RESUME 0x4B
+#define SCSIOP_LOG_SELECT 0x4C
+#define SCSIOP_LOG_SENSE 0x4D
+#define SCSIOP_STOP_PLAY_SCAN 0x4E
+#define SCSIOP_READ_DISK_INFORMATION 0x51
+#define SCSIOP_READ_TRACK_INFORMATION 0x52
+#define SCSIOP_RESERVE_TRACK_RZONE 0x53
+#define SCSIOP_SEND_OPC_INFORMATION 0x54
+#define SCSIOP_MODE_SELECT10 0x55
+#define SCSIOP_MODE_SENSE10 0x5A
+#define SCSIOP_CLOSE_TRACK_SESSION 0x5B
+#define SCSIOP_READ_BUFFER_CAPACITY 0x5C
+#define SCSIOP_SEND_CUE_SHEET 0x5D
+#define SCSIOP_PERSISTENT_RESERVE_IN 0x5E
+#define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F
+
+#define SCSIOP_REPORT_LUNS 0xA0
+#define SCSIOP_BLANK 0xA1
+#define SCSIOP_SEND_KEY 0xA3
+#define SCSIOP_REPORT_KEY 0xA4
+#define SCSIOP_MOVE_MEDIUM 0xA5
+#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
+#define SCSIOP_EXCHANGE_MEDIUM 0xA6
+#define SCSIOP_SET_READ_AHEAD 0xA7
+#define SCSIOP_READ_DVD_STRUCTURE 0xAD
+#define SCSIOP_REQUEST_VOL_ELEMENT 0xB5
+#define SCSIOP_SEND_VOLUME_TAG 0xB6
+#define SCSIOP_READ_ELEMENT_STATUS 0xB8
+#define SCSIOP_READ_CD_MSF 0xB9
+#define SCSIOP_SCAN_CD 0xBA
+#define SCSIOP_SET_CD_SPEED 0xBB
+#define SCSIOP_PLAY_CD 0xBC
+#define SCSIOP_MECHANISM_STATUS 0xBD
+#define SCSIOP_READ_CD 0xBE
+#define SCSIOP_SEND_DVD_STRUCTURE 0xBF
+#define SCSIOP_INIT_ELEMENT_RANGE 0xE7
+
+#define SCSIOP_DENON_EJECT_DISC 0xE6
+#define SCSIOP_DENON_STOP_AUDIO 0xE7
+#define SCSIOP_DENON_PLAY_AUDIO 0xE8
+#define SCSIOP_DENON_READ_TOC 0xE9
+#define SCSIOP_DENON_READ_SUBCODE 0xEB
+
+#define SCSIMESS_MODIFY_DATA_POINTER 0x00
+#define SCSIMESS_SYNCHRONOUS_DATA_REQ 0x01
+#define SCSIMESS_WIDE_DATA_REQUEST 0x03
+
+#define SCSIMESS_MODIFY_DATA_LENGTH 5
+#define SCSIMESS_SYNCH_DATA_LENGTH 3
+#define SCSIMESS_WIDE_DATA_LENGTH 2
+
+#define SCSIMESS_ABORT 0x06
+#define SCSIMESS_ABORT_WITH_TAG 0x0D
+#define SCSIMESS_BUS_DEVICE_RESET 0x0C
+#define SCSIMESS_CLEAR_QUEUE 0x0E
+#define SCSIMESS_COMMAND_COMPLETE 0x00
+#define SCSIMESS_DISCONNECT 0x04
+#define SCSIMESS_EXTENDED_MESSAGE 0x01
+#define SCSIMESS_IDENTIFY 0x80
+#define SCSIMESS_IDENTIFY_WITH_DISCON 0xC0
+#define SCSIMESS_IGNORE_WIDE_RESIDUE 0x23
+#define SCSIMESS_INITIATE_RECOVERY 0x0F
+#define SCSIMESS_INIT_DETECTED_ERROR 0x05
+#define SCSIMESS_LINK_CMD_COMP 0x0A
+#define SCSIMESS_LINK_CMD_COMP_W_FLAG 0x0B
+#define SCSIMESS_MESS_PARITY_ERROR 0x09
+#define SCSIMESS_MESSAGE_REJECT 0x07
+#define SCSIMESS_NO_OPERATION 0x08
+#define SCSIMESS_HEAD_OF_QUEUE_TAG 0x21
+#define SCSIMESS_ORDERED_QUEUE_TAG 0x22
+#define SCSIMESS_SIMPLE_QUEUE_TAG 0x20
+#define SCSIMESS_RELEASE_RECOVERY 0x10
+#define SCSIMESS_RESTORE_POINTERS 0x03
+#define SCSIMESS_SAVE_DATA_POINTER 0x02
+#define SCSIMESS_TERMINATE_IO_PROCESS 0x11
+
+#define CDB_FORCE_MEDIA_ACCESS 0x08
+
+#define CDB_RETURN_ON_COMPLETION 0
+#define CDB_RETURN_IMMEDIATE 1
+
+#define CDB_INQUIRY_EVPD 0x01
+
+#define LUN0_FORMAT_SAVING_DEFECT_LIST 0
+#define USE_DEFAULTMSB 0
+#define USE_DEFAULTLSB 0
+
+#define START_UNIT_CODE 0x01
+#define STOP_UNIT_CODE 0x00
+
+typedef struct _SENSE_DATA {
+ UCHAR ErrorCode : 7;
+ UCHAR Valid : 1;
+ UCHAR SegmentNumber;
+ UCHAR SenseKey : 4;
+ UCHAR Reserved : 1;
+ UCHAR IncorrectLength : 1;
+ UCHAR EndOfMedia : 1;
+ UCHAR FileMark : 1;
+ UCHAR Information[4];
+ UCHAR AdditionalSenseLength;
+ UCHAR CommandSpecificInformation[4];
+ UCHAR AdditionalSenseCode;
+ UCHAR AdditionalSenseCodeQualifier;
+ UCHAR FieldReplaceableUnitCode;
+ UCHAR SenseKeySpecific[3];
+} SENSE_DATA, *PSENSE_DATA;
+
+#define SENSE_BUFFER_SIZE 18
+
+/* Sense codes */
+#define SCSI_SENSE_NO_SENSE 0x00
+#define SCSI_SENSE_RECOVERED_ERROR 0x01
+#define SCSI_SENSE_NOT_READY 0x02
+#define SCSI_SENSE_MEDIUM_ERROR 0x03
+#define SCSI_SENSE_HARDWARE_ERROR 0x04
+#define SCSI_SENSE_ILLEGAL_REQUEST 0x05
+#define SCSI_SENSE_UNIT_ATTENTION 0x06
+#define SCSI_SENSE_DATA_PROTECT 0x07
+#define SCSI_SENSE_BLANK_CHECK 0x08
+#define SCSI_SENSE_UNIQUE 0x09
+#define SCSI_SENSE_COPY_ABORTED 0x0A
+#define SCSI_SENSE_ABORTED_COMMAND 0x0B
+#define SCSI_SENSE_EQUAL 0x0C
+#define SCSI_SENSE_VOL_OVERFLOW 0x0D
+#define SCSI_SENSE_MISCOMPARE 0x0E
+#define SCSI_SENSE_RESERVED 0x0F
+
+/* Additional tape bit */
+#define SCSI_ILLEGAL_LENGTH 0x20
+#define SCSI_EOM 0x40
+#define SCSI_FILE_MARK 0x80
+
+/* Additional Sense codes */
+#define SCSI_ADSENSE_NO_SENSE 0x00
+#define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02
+#define SCSI_ADSENSE_LUN_NOT_READY 0x04
+#define SCSI_ADSENSE_WRITE_ERROR 0x0C
+#define SCSI_ADSENSE_TRACK_ERROR 0x14
+#define SCSI_ADSENSE_SEEK_ERROR 0x15
+#define SCSI_ADSENSE_REC_DATA_NOECC 0x17
+#define SCSI_ADSENSE_REC_DATA_ECC 0x18
+#define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
+#define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
+#define SCSI_ADSENSE_INVALID_CDB 0x24
+#define SCSI_ADSENSE_INVALID_LUN 0x25
+#define SCSI_ADSENSE_WRITE_PROTECT 0x27
+#define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
+#define SCSI_ADSENSE_BUS_RESET 0x29
+#define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E
+#define SCSI_ADSENSE_INVALID_MEDIA 0x30
+#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a
+#define SCSI_ADSENSE_POSITION_ERROR 0x3b
+#define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a
+#define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
+#define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
+#define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f
+#define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73
+#define SCSI_ADSENSE_VENDOR_UNIQUE 0x80
+#define SCSI_ADSENSE_MUSIC_AREA 0xA0
+#define SCSI_ADSENSE_DATA_AREA 0xA1
+#define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
+
+#define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
+#define SCSI_SENSEQ_BECOMING_READY 0x01
+#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
+#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
+#define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
+#define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05
+#define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06
+#define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
+#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
+#define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09
+#define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A
+
+
+#define FILE_DEVICE_SCSI 0x0000001b
+
+#define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011)
+#define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012)
+#define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013)
+
+/* SMART support in ATAPI */
+#define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500)
+#define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501)
+#define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502)
+#define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503)
+#define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504)
+#define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505)
+#define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506)
+#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507)
+#define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508)
+#define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509)
+#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
+#define IOCTL_SCSI_MINIPORT_READ_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050b)
+#define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG ((FILE_DEVICE_SCSI << 16) + 0x050c)
+
+/* CLUSTER support */
+#define IOCTL_SCSI_MINIPORT_NOT_QUORUM_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0520)
+#define IOCTL_SCSI_MINIPORT_NOT_CLUSTER_CAPABLE ((FILE_DEVICE_SCSI << 16) + 0x0521)
+
+/* Read Capacity Data. Returned in Big Endian format */
+typedef struct _READ_CAPACITY_DATA {
+ ULONG LogicalBlockAddress;
+ ULONG BytesPerBlock;
+} READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
+
+/* Read Block Limits Data. Returned in Big Endian format */
+typedef struct _READ_BLOCK_LIMITS {
+ UCHAR Reserved;
+ UCHAR BlockMaximumSize[3];
+ UCHAR BlockMinimumSize[2];
+} READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA;
+
+
+typedef struct _MODE_PARAMETER_HEADER {
+ UCHAR ModeDataLength;
+ UCHAR MediumType;
+ UCHAR DeviceSpecificParameter;
+ UCHAR BlockDescriptorLength;
+}MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
+
+typedef struct _MODE_PARAMETER_HEADER10 {
+ UCHAR ModeDataLength[2];
+ UCHAR MediumType;
+ UCHAR DeviceSpecificParameter;
+ UCHAR Reserved[2];
+ UCHAR BlockDescriptorLength[2];
+} MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
+
+#define MODE_FD_SINGLE_SIDE 0x01
+#define MODE_FD_DOUBLE_SIDE 0x02
+#define MODE_FD_MAXIMUM_TYPE 0x1E
+#define MODE_DSP_FUA_SUPPORTED 0x10
+#define MODE_DSP_WRITE_PROTECT 0x80
+
+typedef struct _MODE_PARAMETER_BLOCK {
+ UCHAR DensityCode;
+ UCHAR NumberOfBlocks[3];
+ UCHAR Reserved;
+ UCHAR BlockLength[3];
+} MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
+
+typedef struct _MODE_DISCONNECT_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved : 1;
+ UCHAR PageSavable : 1;
+ UCHAR PageLength;
+ UCHAR BufferFullRatio;
+ UCHAR BufferEmptyRatio;
+ UCHAR BusInactivityLimit[2];
+ UCHAR BusDisconnectTime[2];
+ UCHAR BusConnectTime[2];
+ UCHAR MaximumBurstSize[2];
+ UCHAR DataTransferDisconnect : 2;
+ UCHAR Reserved2[3];
+}MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE;
+
+typedef struct _MODE_CACHING_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved : 1;
+ UCHAR PageSavable : 1;
+ UCHAR PageLength;
+ UCHAR ReadDisableCache : 1;
+ UCHAR MultiplicationFactor : 1;
+ UCHAR WriteCacheEnable : 1;
+ UCHAR Reserved2 : 5;
+ UCHAR WriteRetensionPriority : 4;
+ UCHAR ReadRetensionPriority : 4;
+ UCHAR DisablePrefetchTransfer[2];
+ UCHAR MinimumPrefetch[2];
+ UCHAR MaximumPrefetch[2];
+ UCHAR MaximumPrefetchCeiling[2];
+}MODE_CACHING_PAGE, *PMODE_CACHING_PAGE;
+
+typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE {
+ UCHAR PageLength;
+ UCHAR WriteType : 4;
+ UCHAR TestWrite : 1;
+ UCHAR LinkSizeValid : 1;
+ UCHAR BufferUnderrunFreeEnabled : 1;
+ UCHAR Reserved2 : 1;
+ UCHAR TrackMode : 4;
+ UCHAR Copy : 1;
+ UCHAR FixedPacket : 1;
+ UCHAR MultiSession : 2;
+ UCHAR DataBlockType : 4;
+ UCHAR Reserved3 : 4;
+ UCHAR LinkSize;
+ UCHAR Reserved4;
+ UCHAR HostApplicationCode : 6;
+ UCHAR Reserved5 : 2;
+ UCHAR SessionFormat;
+ UCHAR Reserved6;
+ UCHAR PacketSize[4];
+ UCHAR AudioPauseLength[2];
+ UCHAR Reserved7 : 7;
+ UCHAR MediaCatalogNumberValid : 1;
+ UCHAR MediaCatalogNumber[13];
+ UCHAR MediaCatalogNumberZero;
+ UCHAR MediaCatalogNumberAFrame;
+ UCHAR Reserved8 : 7;
+ UCHAR ISRCValid : 1;
+ UCHAR ISRCCountry[2];
+ UCHAR ISRCOwner[3];
+ UCHAR ISRCRecordingYear[2];
+ UCHAR ISRCSerialNumber[5];
+ UCHAR ISRCZero;
+ UCHAR ISRCAFrame;
+ UCHAR ISRCReserved;
+ UCHAR SubHeaderData[4];
+} MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE;
+
+typedef struct _MODE_FLEXIBLE_DISK_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved : 1;
+ UCHAR PageSavable : 1;
+ UCHAR PageLength;
+ UCHAR TransferRate[2];
+ UCHAR NumberOfHeads;
+ UCHAR SectorsPerTrack;
+ UCHAR BytesPerSector[2];
+ UCHAR NumberOfCylinders[2];
+ UCHAR StartWritePrecom[2];
+ UCHAR StartReducedCurrent[2];
+ UCHAR StepRate[2];
+ UCHAR StepPluseWidth;
+ UCHAR HeadSettleDelay[2];
+ UCHAR MotorOnDelay;
+ UCHAR MotorOffDelay;
+ UCHAR Reserved2 : 5;
+ UCHAR MotorOnAsserted : 1;
+ UCHAR StartSectorNumber : 1;
+ UCHAR TrueReadySignal : 1;
+ UCHAR StepPlusePerCyclynder : 4;
+ UCHAR Reserved3 : 4;
+ UCHAR WriteCompenstation;
+ UCHAR HeadLoadDelay;
+ UCHAR HeadUnloadDelay;
+ UCHAR Pin2Usage : 4;
+ UCHAR Pin34Usage : 4;
+ UCHAR Pin1Usage : 4;
+ UCHAR Pin4Usage : 4;
+ UCHAR MediumRotationRate[2];
+ UCHAR Reserved4[2];
+} MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE;
+
+typedef struct _MODE_FORMAT_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved : 1;
+ UCHAR PageSavable : 1;
+ UCHAR PageLength;
+ UCHAR TracksPerZone[2];
+ UCHAR AlternateSectorsPerZone[2];
+ UCHAR AlternateTracksPerZone[2];
+ UCHAR AlternateTracksPerLogicalUnit[2];
+ UCHAR SectorsPerTrack[2];
+ UCHAR BytesPerPhysicalSector[2];
+ UCHAR Interleave[2];
+ UCHAR TrackSkewFactor[2];
+ UCHAR CylinderSkewFactor[2];
+ UCHAR Reserved2 : 4;
+ UCHAR SurfaceFirst : 1;
+ UCHAR RemovableMedia : 1;
+ UCHAR HardSectorFormating : 1;
+ UCHAR SoftSectorFormating : 1;
+ UCHAR Reserved3[3];
+} MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE;
+
+typedef struct _MODE_RIGID_GEOMETRY_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved : 1;
+ UCHAR PageSavable : 1;
+ UCHAR PageLength;
+ UCHAR NumberOfCylinders[3];
+ UCHAR NumberOfHeads;
+ UCHAR StartWritePrecom[3];
+ UCHAR StartReducedCurrent[3];
+ UCHAR DriveStepRate[2];
+ UCHAR LandZoneCyclinder[3];
+ UCHAR RotationalPositionLock : 2;
+ UCHAR Reserved2 : 6;
+ UCHAR RotationOffset;
+ UCHAR Reserved3;
+ UCHAR RoataionRate[2];
+ UCHAR Reserved4[2];
+} MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE;
+
+typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved1 : 1;
+ UCHAR PSBit : 1;
+ UCHAR PageLength;
+ UCHAR DCRBit : 1;
+ UCHAR DTEBit : 1;
+ UCHAR PERBit : 1;
+ UCHAR EERBit : 1;
+ UCHAR RCBit : 1;
+ UCHAR TBBit : 1;
+ UCHAR ARRE : 1;
+ UCHAR AWRE : 1;
+ UCHAR ReadRetryCount;
+ UCHAR Reserved4[4];
+ UCHAR WriteRetryCount;
+ UCHAR Reserved5[3];
+} MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
+
+typedef struct _MODE_READ_RECOVERY_PAGE {
+ UCHAR PageCode : 6;
+ UCHAR Reserved1 : 1;
+ UCHAR PSBit : 1;
+ UCHAR PageLength;
+ UCHAR DCRBit : 1;
+ UCHAR DTEBit : 1;
+ UCHAR PERBit : 1;
+ UCHAR Reserved2 : 1;
+ UCHAR RCBit : 1;
+ UCHAR TBBit : 1;
+ UCHAR Reserved3 : 2;
+ UCHAR ReadRetryCount;
+ UCHAR Reserved4[4];
+} MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
+
+typedef struct _MODE_INFO_EXCEPTIONS {
+ UCHAR PageCode : 6;
+ UCHAR Reserved1 : 1;
+ UCHAR PSBit : 1;
+ UCHAR PageLength;
+ union {
+ UCHAR Flags;
+ struct {
+ UCHAR LogErr : 1;
+ UCHAR Reserved2 : 1;
+ UCHAR Test : 1;
+ UCHAR Dexcpt : 1;
+ UCHAR Reserved3 : 3;
+ UCHAR Perf : 1;
+ };
+ };
+ UCHAR ReportMethod : 4;
+ UCHAR Reserved4 : 4;
+ UCHAR IntervalTimer[4];
+ UCHAR ReportCount[4];
+} MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS;
+
+/* CDROM audio control */
+#define CDB_AUDIO_PAUSE 0x00
+#define CDB_AUDIO_RESUME 0x01
+#define CDB_DEVICE_START 0x11
+#define CDB_DEVICE_STOP 0x10
+#define CDB_EJECT_MEDIA 0x10
+#define CDB_LOAD_MEDIA 0x01
+#define CDB_SUBCHANNEL_HEADER 0x00
+#define CDB_SUBCHANNEL_BLOCK 0x01
+
+#define CDROM_AUDIO_CONTROL_PAGE 0x0E
+#define MODE_SELECT_IMMEDIATE 0x04
+#define MODE_SELECT_PFBIT 0x10
+
+#define CDB_USE_MSF 0x01
+
+typedef struct _PORT_OUTPUT {
+ UCHAR ChannelSelection;
+ UCHAR Volume;
+} PORT_OUTPUT, *PPORT_OUTPUT;
+
+typedef struct _AUDIO_OUTPUT {
+ UCHAR CodePage;
+ UCHAR ParameterLength;
+ UCHAR Immediate;
+ UCHAR Reserved[2];
+ UCHAR LbaFormat;
+ UCHAR LogicalBlocksPerSecond[2];
+ PORT_OUTPUT PortOutput[4];
+} AUDIO_OUTPUT, *PAUDIO_OUTPUT;
+
+/* Multisession CDROMs */
+#define GET_LAST_SESSION 0x01
+#define GET_SESSION_DATA 0x02;
+
+/* Atapi 2.5 changers */
+typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER {
+ UCHAR CurrentSlot : 5;
+ UCHAR ChangerState : 2;
+ UCHAR Fault : 1;
+ UCHAR Reserved : 5;
+ UCHAR MechanismState : 3;
+ UCHAR CurrentLogicalBlockAddress[3];
+ UCHAR NumberAvailableSlots;
+ UCHAR SlotTableLength[2];
+} MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER;
+
+typedef struct _SLOT_TABLE_INFORMATION {
+ UCHAR DiscChanged : 1;
+ UCHAR Reserved : 6;
+ UCHAR DiscPresent : 1;
+ UCHAR Reserved2[3];
+} SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION;
+
+typedef struct _MECHANICAL_STATUS {
+ MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader;
+ SLOT_TABLE_INFORMATION SlotTableInfo[1];
+} MECHANICAL_STATUS, *PMECHANICAL_STATUS;
+
+
+/* Tape definitions */
+typedef struct _TAPE_POSITION_DATA {
+ UCHAR Reserved1 : 2;
+ UCHAR BlockPositionUnsupported : 1;
+ UCHAR Reserved2 : 3;
+ UCHAR EndOfPartition : 1;
+ UCHAR BeginningOfPartition : 1;
+ UCHAR PartitionNumber;
+ USHORT Reserved3;
+ UCHAR FirstBlock[4];
+ UCHAR LastBlock[4];
+ UCHAR Reserved4;
+ UCHAR NumberOfBlocks[3];
+ UCHAR NumberOfBytes[4];
+} TAPE_POSITION_DATA, *PTAPE_POSITION_DATA;
+
+/* This structure is used to convert little endian ULONGs
+ to SCSI CDB big endians values. */
+typedef union _EIGHT_BYTE {
+ struct {
+ UCHAR Byte0;
+ UCHAR Byte1;
+ UCHAR Byte2;
+ UCHAR Byte3;
+ UCHAR Byte4;
+ UCHAR Byte5;
+ UCHAR Byte6;
+ UCHAR Byte7;
+ };
+ ULONGLONG AsULongLong;
+} EIGHT_BYTE, *PEIGHT_BYTE;
+
+typedef union _FOUR_BYTE {
+ struct {
+ UCHAR Byte0;
+ UCHAR Byte1;
+ UCHAR Byte2;
+ UCHAR Byte3;
+ };
+ ULONG AsULong;
+} FOUR_BYTE, *PFOUR_BYTE;
+
+typedef union _TWO_BYTE {
+ struct {
+ UCHAR Byte0;
+ UCHAR Byte1;
+ };
+ USHORT AsUShort;
+} TWO_BYTE, *PTWO_BYTE;
+
+/* Byte reversing macro for converting between
+ big- and little-endian formats */
+#define REVERSE_BYTES_QUAD(Destination, Source) { \
+ PEIGHT_BYTE _val1 = (PEIGHT_BYTE)(Destination); \
+ PEIGHT_BYTE _val2 = (PEIGHT_BYTE)(Source); \
+ _val1->Byte7 = _val2->Byte0; \
+ _val1->Byte6 = _val2->Byte1; \
+ _val1->Byte5 = _val2->Byte2; \
+ _val1->Byte4 = _val2->Byte3; \
+ _val1->Byte3 = _val2->Byte4; \
+ _val1->Byte2 = _val2->Byte5; \
+ _val1->Byte1 = _val2->Byte6; \
+ _val1->Byte0 = _val2->Byte7; \
+}
+
+#define REVERSE_BYTES(Destination, Source) { \
+ PFOUR_BYTE _val1 = (PFOUR_BYTE)(Destination); \
+ PFOUR_BYTE _val2 = (PFOUR_BYTE)(Source); \
+ _val1->Byte3 = _val2->Byte0; \
+ _val1->Byte2 = _val2->Byte1; \
+ _val1->Byte1 = _val2->Byte2; \
+ _val1->Byte0 = _val2->Byte3; \
+}
+
+#define REVERSE_BYTES_SHORT(Destination, Source) { \
+ PTWO_BYTE _val1 = (PTWO_BYTE)(Destination); \
+ PTWO_BYTE _val2 = (PTWO_BYTE)(Source); \
+ _val1->Byte1 = _val2->Byte0; \
+ _val1->Byte0 = _val2->Byte1; \
+}
+
+#define REVERSE_SHORT(Short) { \
+ UCHAR _val; \
+ PTWO_BYTE _val2 = (PTWO_BYTE)(Short); \
+ _val = _val2->Byte0; \
+ _val2->Byte0 = _val2->Byte1; \
+ _val2->Byte1 = _val; \
+}
+
+#define REVERSE_LONG(Long) { \
+ UCHAR _val; \
+ PFOUR_BYTE _val2 = (PFOUR_BYTE)(Long); \
+ _val = _val2->Byte3; \
+ _val2->Byte3 = _val2->Byte0; \
+ _val2->Byte0 = _val; \
+ _val = _val2->Byte2; \
+ _val2->Byte2 = _val2->Byte1; \
+ _val2->Byte1 = _val; \
+}
+
+#define WHICH_BIT(Data, Bit) { \
+ UCHAR _val; \
+ for (_val = 0; _val < 32; _val++) { \
+ if (((Data) >> _val) == 1) { \
+ break; \
+ } \
+ } \
+ assert(_val != 32); \
+ (Bit) = _val; \
+}
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SCSI_H */
--- /dev/null
+/*
+ * scsiscan.h
+ *
+ * SCSI scanner driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __SCSISCAN_H
+#define __SCSISCAN_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define IOCTL_SCSISCAN_CMD \
+ CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_CMD_CODE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_SCSISCAN_LOCKDEVICE \
+ CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_LOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_SCSISCAN_SET_TIMEOUT \
+ CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_SET_TIMEOUT, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_SCSISCAN_GET_INFO \
+ CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_GET_INFO, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+#define IOCTL_SCSISCAN_UNLOCKDEVICE \
+ CTL_CODE(FILE_DEVICE_SCANNER, SCSISCAN_UNLOCKDEVICE, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+
+
+/* SCSISCAN_CMD.SrbFlags constants */
+#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
+#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
+#define SRB_FLAGS_DATA_IN 0x00000040
+#define SRB_FLAGS_DATA_OUT 0x00000080
+#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
+
+/* SCSISCAN_CMD.pSrbStatus constants */
+#define SRB_STATUS_PENDING 0x00
+#define SRB_STATUS_SUCCESS 0x01
+#define SRB_STATUS_ABORTED 0x02
+#define SRB_STATUS_ABORT_FAILED 0x03
+#define SRB_STATUS_ERROR 0x04
+#define SRB_STATUS_BUSY 0x05
+#define SRB_STATUS_INVALID_REQUEST 0x06
+#define SRB_STATUS_INVALID_PATH_ID 0x07
+#define SRB_STATUS_NO_DEVICE 0x08
+#define SRB_STATUS_TIMEOUT 0x09
+#define SRB_STATUS_SELECTION_TIMEOUT 0x0A
+#define SRB_STATUS_COMMAND_TIMEOUT 0x0B
+#define SRB_STATUS_MESSAGE_REJECTED 0x0D
+#define SRB_STATUS_BUS_RESET 0x0E
+#define SRB_STATUS_PARITY_ERROR 0x0F
+#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
+#define SRB_STATUS_NO_HBA 0x11
+#define SRB_STATUS_DATA_OVERRUN 0x12
+#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
+#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
+#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
+#define SRB_STATUS_REQUEST_FLUSHED 0x16
+#define SRB_STATUS_INVALID_LUN 0x20
+#define SRB_STATUS_INVALID_TARGET_ID 0x21
+#define SRB_STATUS_BAD_FUNCTION 0x22
+#define SRB_STATUS_ERROR_RECOVERY 0x23
+#define SRB_STATUS_QUEUE_FROZEN 0x40
+#define SRB_STATUS_AUTOSENSE_VALID 0x80
+
+#define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
+
+typedef struct _SCSISCAN_CMD {
+ ULONG Reserved1;
+ ULONG Size;
+ ULONG SrbFlags;
+ UCHAR CdbLength;
+ UCHAR SenseLength;
+ UCHAR Reserved2;
+ UCHAR Reserved3;
+ ULONG TransferLength;
+ UCHAR Cdb[16];
+ PUCHAR pSrbStatus;
+ PUCHAR pSenseBuffer;
+} SCSISCAN_CMD, *PSCSISCAN_CMD;
+
+#define MAX_STRING 128
+
+/* SCSISCAN_INFO.Flags constants */
+#define SCSISCAN_RESERVED 0x000
+#define SCSISCAN_CMD_CODE 0x004
+#define SCSISCAN_LOCKDEVICE 0x005
+#define SCSISCAN_UNLOCKDEVICE 0x006
+#define SCSISCAN_SET_TIMEOUT 0x007
+#define SCSISCAN_GET_INFO 0x008
+
+typedef struct _SCSISCAN_INFO {
+ ULONG Size;
+ ULONG Flags;
+ UCHAR PortNumber;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR AdapterName[MAX_STRING];
+ ULONG Reserved;
+} SCSISCAN_INFO, *PSCSISCAN_INFO;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SCSISCAN_H */
--- /dev/null
+/*
+ * scsiwmi.h
+ *
+ * SCSI WMILIB interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __SCSIWMI_H
+#define __SCSIWMI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "srb.h"
+
+
+typedef struct _SCSIWMI_REQUEST_CONTEXT {
+ PVOID UserContext;
+ ULONG BufferSize;
+ PUCHAR Buffer;
+ UCHAR MinorFunction;
+ UCHAR ReturnStatus;
+ ULONG ReturnSize;
+} SCSIWMI_REQUEST_CONTEXT, *PSCSIWMI_REQUEST_CONTEXT;
+
+typedef struct _SCSIWMIGUIDREGINFO {
+ LPCGUID Guid;
+ ULONG InstanceCount;
+ ULONG Flags;
+} SCSIWMIGUIDREGINFO, *PSCSIWMIGUIDREGINFO;
+
+typedef UCHAR DDKAPI
+(*PSCSIWMI_QUERY_REGINFO)(
+ IN PVOID DeviceContext,
+ IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
+ OUT PWCHAR *MofResourceName);
+
+typedef BOOLEAN DDKAPI
+(*PSCSIWMI_QUERY_DATABLOCK)(
+ IN PVOID Context,
+ IN PSCSIWMI_REQUEST_CONTEXT DispatchContext,
+ IN ULONG GuidIndex,
+ IN ULONG InstanceIndex,
+ IN ULONG InstanceCount,
+ IN OUT PULONG InstanceLengthArray,
+ IN ULONG BufferAvail,
+ OUT PUCHAR Buffer);
+
+typedef BOOLEAN DDKAPI
+(*PSCSIWMI_SET_DATABLOCK)(
+ IN PVOID DeviceContext,
+ IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
+ IN ULONG GuidIndex,
+ IN ULONG InstanceIndex,
+ IN ULONG BufferSize,
+ IN PUCHAR Buffer);
+
+typedef BOOLEAN DDKAPI
+(*PSCSIWMI_SET_DATAITEM)(
+ IN PVOID DeviceContext,
+ IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
+ IN ULONG GuidIndex,
+ IN ULONG InstanceIndex,
+ IN ULONG DataItemId,
+ IN ULONG BufferSize,
+ IN PUCHAR Buffer);
+
+typedef BOOLEAN DDKAPI
+(*PSCSIWMI_EXECUTE_METHOD)(
+ IN PVOID DeviceContext,
+ IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
+ IN ULONG GuidIndex,
+ IN ULONG InstanceIndex,
+ IN ULONG MethodId,
+ IN ULONG InBufferSize,
+ IN ULONG OutBufferSize,
+ IN OUT PUCHAR Buffer);
+
+typedef enum _SCSIWMI_ENABLE_DISABLE_CONTROL {
+ ScsiWmiEventControl,
+ ScsiWmiDataBlockControl
+} SCSIWMI_ENABLE_DISABLE_CONTROL;
+
+typedef BOOLEAN DDKAPI
+(*PSCSIWMI_FUNCTION_CONTROL)(
+ IN PVOID DeviceContext,
+ IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
+ IN ULONG GuidIndex,
+ IN SCSIWMI_ENABLE_DISABLE_CONTROL Function,
+ IN BOOLEAN Enable);
+
+typedef struct _SCSIWMILIB_CONTEXT {
+ ULONG GuidCount;
+ PSCSIWMIGUIDREGINFO GuidList;
+ PSCSIWMI_QUERY_REGINFO QueryWmiRegInfo;
+ PSCSIWMI_QUERY_DATABLOCK QueryWmiDataBlock;
+ PSCSIWMI_SET_DATABLOCK SetWmiDataBlock;
+ PSCSIWMI_SET_DATAITEM SetWmiDataItem;
+ PSCSIWMI_EXECUTE_METHOD ExecuteWmiMethod;
+ PSCSIWMI_FUNCTION_CONTROL WmiFunctionControl;
+} SCSI_WMILIB_CONTEXT, *PSCSI_WMILIB_CONTEXT;
+
+SCSIPORTAPI
+BOOLEAN
+DDKAPI
+ScsiPortWmiDispatchFunction(
+ IN PSCSI_WMILIB_CONTEXT WmiLibInfo,
+ IN UCHAR MinorFunction,
+ IN PVOID DeviceContext,
+ IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
+ IN PVOID DataPath,
+ IN ULONG BufferSize,
+ IN PVOID Buffer);
+
+#define ScsiPortWmiFireAdapterEvent( \
+ HwDeviceExtension, \
+ Guid, \
+ InstanceIndex, \
+ EventDataSize, \
+ EventData) \
+ ScsiPortWmiFireLogicalUnitEvent( \
+ HwDeviceExtension, \
+ 0xff, \
+ 0, \
+ 0, \
+ Guid, \
+ InstanceIndex, \
+ EventDataSize, \
+ EventData)
+
+/*
+ * ULONG
+ * ScsiPortWmiGetReturnSize(
+ * PSCSIWMI_REQUEST_CONTEXT RequestContext);
+ */
+#define ScsiPortWmiGetReturnSize(RequestContext) \
+ ((RequestContext)->ReturnSize)
+
+/* UCHAR
+ * ScsiPortWmiGetReturnStatus(
+ * PSCSIWMI_REQUEST_CONTEXT RequestContext);
+ */
+#define ScsiPortWmiGetReturnStatus(RequestContext) \
+ ((RequestContext)->ReturnStatus)
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWmiPostProcess(
+ IN PSCSIWMI_REQUEST_CONTEXT RequestContext,
+ IN UCHAR SrbStatus,
+ IN ULONG BufferUsed);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWmiFireLogicalUnitEvent(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN LPGUID Guid,
+ IN ULONG InstanceIndex,
+ IN ULONG EventDataSize,
+ IN PVOID EventData);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SCSIWMI_H */
--- /dev/null
+/*
+ * smbus.h
+ *
+ * System Management Bus driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __SMBUS_H
+#define __SMBUS_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#if !defined(SMBCLASS)
+ #define SMBCLASSAPI DECLSPEC_IMPORT
+#else
+ #define SMBCLASSAPI DECLSPEC_EXPORT
+#endif
+
+#define SMB_BUS_REQUEST \
+ CTL_CODE(FILE_DEVICE_UNKNOWN, 0, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define SMB_DEREGISTER_ALARM_NOTIFY \
+ CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define SMB_REGISTER_ALARM_NOTIFY \
+ CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+
+struct _SMB_CLASS;
+
+#define SMB_MAX_DATA_SIZE 32
+
+/* SMB_REQUEST.Status constants */
+#define SMB_STATUS_OK 0x00
+#define SMB_UNKNOWN_FAILURE 0x07
+#define SMB_ADDRESS_NOT_ACKNOWLEDGED 0x10
+#define SMB_DEVICE_ERROR 0x11
+#define SMB_COMMAND_ACCESS_DENIED 0x12
+#define SMB_UNKNOWN_ERROR 0x13
+#define SMB_DEVICE_ACCESS_DENIED 0x17
+#define SMB_TIMEOUT 0x18
+#define SMB_UNSUPPORTED_PROTOCOL 0x19
+#define SMB_BUS_BUSY 0x1A
+
+/* SMB_REQUEST.Protocol constants */
+#define SMB_WRITE_QUICK 0x00
+#define SMB_READ_QUICK 0x01
+#define SMB_SEND_BYTE 0x02
+#define SMB_RECEIVE_BYTE 0x03
+#define SMB_WRITE_BYTE 0x04
+#define SMB_READ_BYTE 0x05
+#define SMB_WRITE_WORD 0x06
+#define SMB_READ_WORD 0x07
+#define SMB_WRITE_BLOCK 0x08
+#define SMB_READ_BLOCK 0x09
+#define SMB_PROCESS_CALL 0x0A
+#define SMB_MAXIMUM_PROTOCOL 0x0A
+
+typedef struct _SMB_REQUEST {
+ UCHAR Status;
+ UCHAR Protocol;
+ UCHAR Address;
+ UCHAR Command;
+ UCHAR BlockLength;
+ UCHAR Data[SMB_MAX_DATA_SIZE];
+} SMB_REQUEST, *PSMB_REQUEST;
+
+typedef VOID STDCALL
+(*SMB_ALARM_NOTIFY)(
+ PVOID Context,
+ UCHAR Address,
+ USHORT Data);
+
+typedef struct _SMB_REGISTER_ALARM {
+ UCHAR MinAddress;
+ UCHAR MaxAddress;
+ SMB_ALARM_NOTIFY NotifyFunction;
+ PVOID NotifyContext;
+} SMB_REGISTER_ALARM, *PSMB_REGISTER_ALARM;
+
+/* SMB_CLASS.XxxVersion constants */
+#define SMB_CLASS_MAJOR_VERSION 0x0001
+#define SMB_CLASS_MINOR_VERSION 0x0000
+
+typedef NTSTATUS DDKAPI
+(*SMB_RESET_DEVICE)(
+ IN struct _SMB_CLASS *SmbClass,
+ IN PVOID SmbMiniport);
+
+typedef VOID DDKAPI
+(*SMB_START_IO)(
+ IN struct _SMB_CLASS *SmbClass,
+ IN PVOID SmbMiniport);
+
+typedef NTSTATUS DDKAPI
+(*SMB_STOP_DEVICE)(
+ IN struct _SMB_CLASS *SmbClass,
+ IN PVOID SmbMiniport);
+
+typedef struct _SMB_CLASS {
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ PVOID Miniport;
+ PDEVICE_OBJECT DeviceObject;
+ PDEVICE_OBJECT PDO;
+ PDEVICE_OBJECT LowerDeviceObject;
+ PIRP CurrentIrp;
+ PSMB_REQUEST CurrentSmb;
+ SMB_RESET_DEVICE ResetDevice;
+ SMB_START_IO StartIo;
+ SMB_STOP_DEVICE StopDevice;
+} SMB_CLASS, *PSMB_CLASS;
+
+SMBCLASSAPI
+VOID
+DDKAPI
+SmbClassAlarm(
+ IN PSMB_CLASS SmbClass,
+ IN UCHAR Address,
+ IN USHORT Data);
+
+SMBCLASSAPI
+VOID
+DDKAPI
+SmbClassCompleteRequest(
+ IN PSMB_CLASS SmbClass);
+
+typedef NTSTATUS DDKAPI
+(*PSMB_INITIALIZE_MINIPORT)(
+ IN PSMB_CLASS SmbClass,
+ IN PVOID MiniportExtension,
+ IN PVOID MiniportContext);
+
+SMBCLASSAPI
+NTSTATUS
+DDKAPI
+SmbClassCreateFdo(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT PDO,
+ IN ULONG MiniportExtensionSize,
+ IN PSMB_INITIALIZE_MINIPORT MiniportInitialize,
+ IN PVOID MiniportContext,
+ OUT PDEVICE_OBJECT *FDO);
+
+SMBCLASSAPI
+NTSTATUS
+DDKAPI
+SmbClassInitializeDevice(
+ IN ULONG MajorVersion,
+ IN ULONG MinorVersion,
+ IN PDRIVER_OBJECT DriverObject);
+
+SMBCLASSAPI
+VOID
+DDKAPI
+SmbClassLockDevice(
+ IN PSMB_CLASS SmbClass);
+
+SMBCLASSAPI
+VOID
+DDKAPI
+SmbClassUnlockDevice(
+ IN PSMB_CLASS SmbClass);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SMBUS_H */
--- /dev/null
+/*
+ * scsi.h
+ *
+ * Interface between SCSI miniport drivers and the SCSI port driver.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __SRB_H
+#define __SRB_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#if defined(_SCSIPORT_)
+ #define SCSIPORTAPI DECLSPEC_EXPORT
+#else
+ #define SCSIPORTAPI DECLSPEC_IMPORT
+#endif
+
+#if DBG
+#define DebugPrint(x) ScsiDebugPrint x
+#else
+#define DebugPrint(x)
+#endif
+
+typedef PHYSICAL_ADDRESS SCSI_PHYSICAL_ADDRESS, *PSCSI_PHYSICAL_ADDRESS;
+
+#define SP_UNINITIALIZED_VALUE ((ULONG) ~0)
+#define SP_UNTAGGED ((UCHAR) ~0)
+
+#define SRB_SIMPLE_TAG_REQUEST 0x20
+#define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21
+#define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22
+
+#define SRB_STATUS_QUEUE_FROZEN 0x40
+#define SRB_STATUS_AUTOSENSE_VALID 0x80
+
+#define SRB_STATUS(Status) \
+ (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
+
+#define MAXIMUM_CDB_SIZE 12
+
+#if DBG
+#define SCSI_PORT_SIGNATURE 0x54524f50
+#endif
+
+
+#define SCSI_MAXIMUM_LOGICAL_UNITS 8
+#define SCSI_MAXIMUM_TARGETS_PER_BUS 128
+#define SCSI_MAXIMUM_LUNS_PER_TARGET 255
+#define SCSI_MAXIMUM_BUSES 8
+#define SCSI_MINIMUM_PHYSICAL_BREAKS 16
+#define SCSI_MAXIMUM_PHYSICAL_BREAKS 255
+#define SCSI_MAXIMUM_TARGETS 8
+
+#define SRB_FUNCTION_WMI 0x17
+
+#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x0001
+
+#define SP_BUS_PARITY_ERROR 0x0001
+#define SP_UNEXPECTED_DISCONNECT 0x0002
+#define SP_INVALID_RESELECTION 0x0003
+#define SP_BUS_TIME_OUT 0x0004
+#define SP_PROTOCOL_ERROR 0x0005
+#define SP_INTERNAL_ADAPTER_ERROR 0x0006
+#define SP_REQUEST_TIMEOUT 0x0007
+#define SP_IRQ_NOT_RESPONDING 0x0008
+#define SP_BAD_FW_WARNING 0x0009
+#define SP_BAD_FW_ERROR 0x000a
+#define SP_LOST_WMI_MINIPORT_REQUEST 0x000b
+
+/* SCSI_REQUEST_BLOCK.Function constants */
+#define SRB_FUNCTION_EXECUTE_SCSI 0x00
+#define SRB_FUNCTION_CLAIM_DEVICE 0x01
+#define SRB_FUNCTION_IO_CONTROL 0x02
+#define SRB_FUNCTION_RECEIVE_EVENT 0x03
+#define SRB_FUNCTION_RELEASE_QUEUE 0x04
+#define SRB_FUNCTION_ATTACH_DEVICE 0x05
+#define SRB_FUNCTION_RELEASE_DEVICE 0x06
+#define SRB_FUNCTION_SHUTDOWN 0x07
+#define SRB_FUNCTION_FLUSH 0x08
+#define SRB_FUNCTION_ABORT_COMMAND 0x10
+#define SRB_FUNCTION_RELEASE_RECOVERY 0x11
+#define SRB_FUNCTION_RESET_BUS 0x12
+#define SRB_FUNCTION_RESET_DEVICE 0x13
+#define SRB_FUNCTION_TERMINATE_IO 0x14
+#define SRB_FUNCTION_FLUSH_QUEUE 0x15
+#define SRB_FUNCTION_REMOVE_DEVICE 0x16
+#define SRB_FUNCTION_WMI 0x17
+#define SRB_FUNCTION_LOCK_QUEUE 0x18
+#define SRB_FUNCTION_UNLOCK_QUEUE 0x19
+#define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20
+
+/* SCSI_REQUEST_BLOCK.SrbStatus constants */
+#define SRB_STATUS_PENDING 0x00
+#define SRB_STATUS_SUCCESS 0x01
+#define SRB_STATUS_ABORTED 0x02
+#define SRB_STATUS_ABORT_FAILED 0x03
+#define SRB_STATUS_ERROR 0x04
+#define SRB_STATUS_BUSY 0x05
+#define SRB_STATUS_INVALID_REQUEST 0x06
+#define SRB_STATUS_INVALID_PATH_ID 0x07
+#define SRB_STATUS_NO_DEVICE 0x08
+#define SRB_STATUS_TIMEOUT 0x09
+#define SRB_STATUS_SELECTION_TIMEOUT 0x0A
+#define SRB_STATUS_COMMAND_TIMEOUT 0x0B
+#define SRB_STATUS_MESSAGE_REJECTED 0x0D
+#define SRB_STATUS_BUS_RESET 0x0E
+#define SRB_STATUS_PARITY_ERROR 0x0F
+#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
+#define SRB_STATUS_NO_HBA 0x11
+#define SRB_STATUS_DATA_OVERRUN 0x12
+#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
+#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
+#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
+#define SRB_STATUS_REQUEST_FLUSHED 0x16
+#define SRB_STATUS_INVALID_LUN 0x20
+#define SRB_STATUS_INVALID_TARGET_ID 0x21
+#define SRB_STATUS_BAD_FUNCTION 0x22
+#define SRB_STATUS_ERROR_RECOVERY 0x23
+#define SRB_STATUS_NOT_POWERED 0x24
+#define SRB_STATUS_INTERNAL_ERROR 0x30
+
+/* SCSI_REQUEST_BLOCK.SrbFlags constants */
+#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002
+#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004
+#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
+#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010
+#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
+#define SRB_FLAGS_DATA_IN 0x00000040
+#define SRB_FLAGS_DATA_OUT 0x00000080
+#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
+#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
+#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100
+#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200
+#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400
+#define SRB_FLAGS_IS_ACTIVE 0x00010000
+#define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000
+#define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000
+#define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000
+#define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000
+#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000
+#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000
+#define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000
+#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000
+#define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000
+
+typedef struct _SCSI_REQUEST_BLOCK {
+ USHORT Length;
+ UCHAR Function;
+ UCHAR SrbStatus;
+ UCHAR ScsiStatus;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR QueueTag;
+ UCHAR QueueAction;
+ UCHAR CdbLength;
+ UCHAR SenseInfoBufferLength;
+ ULONG SrbFlags;
+ ULONG DataTransferLength;
+ ULONG TimeOutValue;
+ PVOID DataBuffer;
+ PVOID SenseInfoBuffer;
+ struct _SCSI_REQUEST_BLOCK *NextSrb;
+ PVOID OriginalRequest;
+ PVOID SrbExtension;
+ union {
+ ULONG InternalStatus;
+ ULONG QueueSortKey;
+ };
+#if defined(_WIN64)
+ ULONG Reserved;
+#endif
+ UCHAR Cdb[16];
+} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
+
+#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
+
+typedef struct _ACCESS_RANGE {
+ SCSI_PHYSICAL_ADDRESS RangeStart;
+ ULONG RangeLength;
+ BOOLEAN RangeInMemory;
+} ACCESS_RANGE, *PACCESS_RANGE;
+
+/* PORT_CONFIGURATION_INFORMATION.Dma64BitAddresses constants */
+#define SCSI_DMA64_MINIPORT_SUPPORTED 0x01
+#define SCSI_DMA64_SYSTEM_SUPPORTED 0x80
+
+typedef struct _PORT_CONFIGURATION_INFORMATION {
+ ULONG Length;
+ ULONG SystemIoBusNumber;
+ INTERFACE_TYPE AdapterInterfaceType;
+ ULONG BusInterruptLevel;
+ ULONG BusInterruptVector;
+ KINTERRUPT_MODE InterruptMode;
+ ULONG MaximumTransferLength;
+ ULONG NumberOfPhysicalBreaks;
+ ULONG DmaChannel;
+ ULONG DmaPort;
+ DMA_WIDTH DmaWidth;
+ DMA_SPEED DmaSpeed;
+ ULONG AlignmentMask;
+ ULONG NumberOfAccessRanges;
+ ACCESS_RANGE (*AccessRanges)[];
+ PVOID Reserved;
+ UCHAR NumberOfBuses;
+ UCHAR InitiatorBusId[8];
+ BOOLEAN ScatterGather;
+ BOOLEAN Master;
+ BOOLEAN CachesData;
+ BOOLEAN AdapterScansDown;
+ BOOLEAN AtdiskPrimaryClaimed;
+ BOOLEAN AtdiskSecondaryClaimed;
+ BOOLEAN Dma32BitAddresses;
+ BOOLEAN DemandMode;
+ BOOLEAN MapBuffers;
+ BOOLEAN NeedPhysicalAddresses;
+ BOOLEAN TaggedQueueing;
+ BOOLEAN AutoRequestSense;
+ BOOLEAN MultipleRequestPerLu;
+ BOOLEAN ReceiveEvent;
+ BOOLEAN RealModeInitialized;
+ BOOLEAN BufferAccessScsiPortControlled;
+ UCHAR MaximumNumberOfTargets;
+ UCHAR ReservedUchars[2];
+ ULONG SlotNumber;
+ ULONG BusInterruptLevel2;
+ ULONG BusInterruptVector2;
+ KINTERRUPT_MODE InterruptMode2;
+ ULONG DmaChannel2;
+ ULONG DmaPort2;
+ DMA_WIDTH DmaWidth2;
+ DMA_SPEED DmaSpeed2;
+ ULONG DeviceExtensionSize;
+ ULONG SpecificLuExtensionSize;
+ ULONG SrbExtensionSize;
+ UCHAR Dma64BitAddresses;
+ BOOLEAN ResetTargetSupported;
+ UCHAR MaximumNumberOfLogicalUnits;
+ BOOLEAN WmiDataProvider;
+} PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION;
+
+#define CONFIG_INFO_VERSION_2 sizeof(PORT_CONFIGURATION_INFORMATION)
+
+typedef enum _SCSI_NOTIFICATION_TYPE {
+ RequestComplete,
+ NextRequest,
+ NextLuRequest,
+ ResetDetected,
+ CallDisableInterrupts,
+ CallEnableInterrupts,
+ RequestTimerCall,
+ BusChangeDetected,
+ WMIEvent,
+ WMIReregister
+} SCSI_NOTIFICATION_TYPE, *PSCSI_NOTIFICATION_TYPE;
+
+typedef enum _SCSI_ADAPTER_CONTROL_TYPE {
+ ScsiQuerySupportedControlTypes = 0,
+ ScsiStopAdapter,
+ ScsiRestartAdapter,
+ ScsiSetBootConfig,
+ ScsiSetRunningConfig,
+ ScsiAdapterControlMax,
+ MakeAdapterControlTypeSizeOfUlong = 0xffffffff
+} SCSI_ADAPTER_CONTROL_TYPE, *PSCSI_ADAPTER_CONTROL_TYPE;
+
+typedef enum _SCSI_ADAPTER_CONTROL_STATUS {
+ ScsiAdapterControlSuccess = 0,
+ ScsiAdapterControlUnsuccessful
+} SCSI_ADAPTER_CONTROL_STATUS, *PSCSI_ADAPTER_CONTROL_STATUS;
+
+typedef struct _SCSI_SUPPORTED_CONTROL_TYPE_LIST {
+ ULONG MaxControlType;
+ BOOLEAN SupportedTypeList[0];
+} SCSI_SUPPORTED_CONTROL_TYPE_LIST, *PSCSI_SUPPORTED_CONTROL_TYPE_LIST;
+
+typedef SCSI_ADAPTER_CONTROL_STATUS DDKAPI
+(*PHW_ADAPTER_CONTROL)(
+ IN PVOID DeviceExtension,
+ IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
+ IN PVOID Parameters);
+
+typedef BOOLEAN DDKAPI
+(*PHW_ADAPTER_STATE)(
+ IN PVOID DeviceExtension,
+ IN PVOID Context,
+ IN BOOLEAN SaveState);
+
+#define SP_RETURN_NOT_FOUND 0
+#define SP_RETURN_FOUND 1
+#define SP_RETURN_ERROR 2
+#define SP_RETURN_BAD_CONFIG 3
+
+typedef ULONG DDKAPI
+(*PHW_FIND_ADAPTER)(
+ IN PVOID DeviceExtension,
+ IN PVOID HwContext,
+ IN PVOID BusInformation,
+ IN PCHAR ArgumentString,
+ IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
+ OUT PBOOLEAN Again);
+
+typedef BOOLEAN DDKAPI
+(*PHW_INITIALIZE)(
+ IN PVOID DeviceExtension);
+
+typedef BOOLEAN DDKAPI
+(*PHW_INTERRUPT)(
+ IN PVOID DeviceExtension);
+
+typedef BOOLEAN DDKAPI
+(*PHW_RESET_BUS)(
+ IN PVOID DeviceExtension,
+ IN ULONG PathId);
+
+typedef VOID DDKAPI
+(*PHW_DMA_STARTED)(
+ IN PVOID DeviceExtension);
+
+typedef BOOLEAN DDKAPI
+(*PHW_STARTIO)(
+ IN PVOID DeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb);
+
+typedef VOID DDKAPI
+(*PHW_TIMER)(
+ IN PVOID DeviceExtension);
+
+typedef struct _HW_INITIALIZATION_DATA {
+ ULONG HwInitializationDataSize;
+ INTERFACE_TYPE AdapterInterfaceType;
+ PHW_INITIALIZE HwInitialize;
+ PHW_STARTIO HwStartIo;
+ PHW_INTERRUPT HwInterrupt;
+ PHW_FIND_ADAPTER HwFindAdapter;
+ PHW_RESET_BUS HwResetBus;
+ PHW_DMA_STARTED HwDmaStarted;
+ PHW_ADAPTER_STATE HwAdapterState;
+ ULONG DeviceExtensionSize;
+ ULONG SpecificLuExtensionSize;
+ ULONG SrbExtensionSize;
+ ULONG NumberOfAccessRanges;
+ PVOID Reserved;
+ BOOLEAN MapBuffers;
+ BOOLEAN NeedPhysicalAddresses;
+ BOOLEAN TaggedQueueing;
+ BOOLEAN AutoRequestSense;
+ BOOLEAN MultipleRequestPerLu;
+ BOOLEAN ReceiveEvent;
+ USHORT VendorIdLength;
+ PVOID VendorId;
+ USHORT ReservedUshort;
+ USHORT DeviceIdLength;
+ PVOID DeviceId;
+ PHW_ADAPTER_CONTROL HwAdapterControl;
+} HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortCompleteRequest(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN UCHAR SrbStatus);
+
+/*
+ * ULONG
+ * ScsiPortConvertPhysicalAddressToUlong(
+ * IN SCSI_PHYSICAL_ADDRESS Address);
+ */
+#define ScsiPortConvertPhysicalAddressToUlong(Address) ((Address).LowPart)
+
+SCSIPORTAPI
+SCSI_PHYSICAL_ADDRESS
+DDKAPI
+ScsiPortConvertUlongToPhysicalAddress(
+ IN ULONG UlongAddress);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortFlushDma(
+ IN PVOID DeviceExtension);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortFreeDeviceBase(
+ IN PVOID HwDeviceExtension,
+ IN PVOID MappedAddress);
+
+SCSIPORTAPI
+ULONG
+DDKAPI
+ScsiPortGetBusData(
+ IN PVOID DeviceExtension,
+ IN ULONG BusDataType,
+ IN ULONG SystemIoBusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+SCSIPORTAPI
+PVOID
+DDKAPI
+ScsiPortGetDeviceBase(
+ IN PVOID HwDeviceExtension,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG SystemIoBusNumber,
+ IN SCSI_PHYSICAL_ADDRESS IoAddress,
+ IN ULONG NumberOfBytes,
+ IN BOOLEAN InIoSpace);
+
+SCSIPORTAPI
+PVOID
+DDKAPI
+ScsiPortGetLogicalUnit(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun);
+
+SCSIPORTAPI
+SCSI_PHYSICAL_ADDRESS
+DDKAPI
+ScsiPortGetPhysicalAddress(
+ IN PVOID HwDeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
+ IN PVOID VirtualAddress,
+ OUT ULONG *Length);
+
+SCSIPORTAPI
+PSCSI_REQUEST_BLOCK
+DDKAPI
+ScsiPortGetSrb(
+ IN PVOID DeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN LONG QueueTag);
+
+SCSIPORTAPI
+PVOID
+DDKAPI
+ScsiPortGetUncachedExtension(
+ IN PVOID HwDeviceExtension,
+ IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
+ IN ULONG NumberOfBytes);
+
+SCSIPORTAPI
+PVOID
+DDKAPI
+ScsiPortGetVirtualAddress(
+ IN PVOID HwDeviceExtension,
+ IN SCSI_PHYSICAL_ADDRESS PhysicalAddress);
+
+SCSIPORTAPI
+ULONG
+DDKAPI
+ScsiPortInitialize(
+ IN PVOID Argument1,
+ IN PVOID Argument2,
+ IN struct _HW_INITIALIZATION_DATA *HwInitializationData,
+ IN PVOID HwContext OPTIONAL);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortIoMapTransfer(
+ IN PVOID HwDeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb,
+ IN ULONG LogicalAddress,
+ IN ULONG Length);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortLogError(
+ IN PVOID HwDeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN ULONG ErrorCode,
+ IN ULONG UniqueId);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortMoveMemory(
+ IN PVOID WriteBuffer,
+ IN PVOID ReadBuffer,
+ IN ULONG Length);
+
+SCSIPORTAPI
+VOID
+DDKCDECLAPI
+ScsiPortNotification(
+ IN SCSI_NOTIFICATION_TYPE NotificationType,
+ IN PVOID HwDeviceExtension,
+ IN ...);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortQuerySystemTime(
+ OUT PLARGE_INTEGER CurrentTime);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortReadPortBufferUchar(
+ IN PUCHAR Port,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortReadPortBufferUlong(
+ IN PULONG Port,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortReadPortBufferUshort(
+ IN PUSHORT Port,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+UCHAR
+DDKAPI
+ScsiPortReadPortUchar(
+ IN PUCHAR Port);
+
+SCSIPORTAPI
+ULONG
+DDKAPI
+ScsiPortReadPortUlong(
+ IN PULONG Port);
+
+SCSIPORTAPI
+USHORT
+DDKAPI
+ScsiPortReadPortUshort(
+ IN PUSHORT Port);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortReadRegisterBufferUchar(
+ IN PUCHAR Register,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortReadRegisterBufferUlong(
+ IN PULONG Register,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortReadRegisterBufferUshort(
+ IN PUSHORT Register,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+UCHAR
+DDKAPI
+ScsiPortReadRegisterUchar(
+ IN PUCHAR Register);
+
+SCSIPORTAPI
+ULONG
+DDKAPI
+ScsiPortReadRegisterUlong(
+ IN PULONG Register);
+
+SCSIPORTAPI
+USHORT
+DDKAPI
+ScsiPortReadRegisterUshort(
+ IN PUSHORT Register);
+
+SCSIPORTAPI
+ULONG
+DDKAPI
+ScsiPortSetBusDataByOffset(
+ IN PVOID DeviceExtension,
+ IN ULONG BusDataType,
+ IN ULONG SystemIoBusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortStallExecution(
+ IN ULONG Delay);
+
+SCSIPORTAPI
+BOOLEAN
+DDKAPI
+ScsiPortValidateRange(
+ IN PVOID HwDeviceExtension,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG SystemIoBusNumber,
+ IN SCSI_PHYSICAL_ADDRESS IoAddress,
+ IN ULONG NumberOfBytes,
+ IN BOOLEAN InIoSpace);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWritePortBufferUchar(
+ IN PUCHAR Port,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWritePortBufferUlong(
+ IN PULONG Port,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWritePortBufferUshort(
+ IN PUSHORT Port,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWritePortUchar(
+ IN PUCHAR Port,
+ IN UCHAR Value);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWritePortUlong(
+ IN PULONG Port,
+ IN ULONG Value);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWritePortUshort(
+ IN PUSHORT Port,
+ IN USHORT Value);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWriteRegisterBufferUchar(
+ IN PUCHAR Register,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWriteRegisterBufferUlong(
+ IN PULONG Register,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWriteRegisterBufferUshort(
+ IN PUSHORT Register,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWriteRegisterUchar(
+ IN PUCHAR Register,
+ IN ULONG Value);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWriteRegisterUlong(
+ IN PULONG Register,
+ IN ULONG Value);
+
+SCSIPORTAPI
+VOID
+DDKAPI
+ScsiPortWriteRegisterUshort(
+ IN PUSHORT Register,
+ IN USHORT Value);
+
+SCSIPORTAPI
+VOID
+DDKCDECLAPI
+ScsiDebugPrint(
+ IN ULONG DebugPrintLevel,
+ IN PCCHAR DebugMessage,
+ IN ...);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SRB_H */
--- /dev/null
+/*
+ * storport.h
+ *
+ * StorPort interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __STORPORT_H
+#define __STORPORT_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "srb.h"
+
+#if defined(_STORPORT_)
+ #define STORPORTAPI DECLSPEC_EXPORT
+#else
+ #define STORPORTAPI DECLSPEC_IMPORT
+#endif
+
+
+typedef PHYSICAL_ADDRESS STOR_PHYSICAL_ADDRESS;
+
+typedef struct _STOR_SCATTER_GATHER_ELEMENT {
+ STOR_PHYSICAL_ADDRESS PhysicalAddress;
+ ULONG Length;
+ ULONG_PTR Reserved;
+} STOR_SCATTER_GATHER_ELEMENT, *PSTOR_SCATTER_GATHER_ELEMENT;
+
+typedef struct _STOR_SCATTER_GATHER_LIST {
+ ULONG NumberOfElements;
+ ULONG_PTR Reserved;
+ STOR_SCATTER_GATHER_ELEMENT List[0];
+} STOR_SCATTER_GATHER_LIST, *PSTOR_SCATTER_GATHER_LIST;
+
+typedef struct _SCSI_WMI_REQUEST_BLOCK {
+ USHORT Length;
+ UCHAR Function;
+ UCHAR SrbStatus;
+ UCHAR WMISubFunction;
+ UCHAR PathId;
+ UCHAR TargetId;
+ UCHAR Lun;
+ UCHAR Reserved1;
+ UCHAR WMIFlags;
+ UCHAR Reserved2[2];
+ ULONG SrbFlags;
+ ULONG DataTransferLength;
+ ULONG TimeOutValue;
+ PVOID DataBuffer;
+ PVOID DataPath;
+ PVOID Reserved3;
+ PVOID OriginalRequest;
+ PVOID SrbExtension;
+ ULONG Reserved4;
+ UCHAR Reserved5[16];
+} SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
+
+
+STORPORTAPI
+ULONG
+DDKAPI
+StorPortInitialize(
+ IN PVOID Argument1,
+ IN PVOID Argument2,
+ IN PHW_INITIALIZATION_DATA HwInitializationData,
+ IN PVOID Unused);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortFreeDeviceBase(
+ IN PVOID HwDeviceExtension,
+ IN PVOID MappedAddress);
+
+STORPORTAPI
+ULONG
+DDKAPI
+StorPortGetBusData(
+ IN PVOID DeviceExtension,
+ IN ULONG BusDataType,
+ IN ULONG SystemIoBusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+STORPORTAPI
+ULONG
+DDKAPI
+StorPortSetBusDataByOffset(
+ IN PVOID DeviceExtension,
+ IN ULONG BusDataType,
+ IN ULONG SystemIoBusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+STORPORTAPI
+PVOID
+DDKAPI
+StorPortGetDeviceBase(
+ IN PVOID HwDeviceExtension,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG SystemIoBusNumber,
+ IN SCSI_PHYSICAL_ADDRESS IoAddress,
+ IN ULONG NumberOfBytes,
+ IN BOOLEAN InIoSpace);
+
+STORPORTAPI
+PVOID
+DDKAPI
+StorPortGetLogicalUnit(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun);
+
+STORPORTAPI
+PSCSI_REQUEST_BLOCK
+DDKAPI
+StorPortGetSrb(
+ IN PVOID DeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN LONG QueueTag);
+
+STORPORTAPI
+STOR_PHYSICAL_ADDRESS
+DDKAPI
+StorPortGetPhysicalAddress(
+ IN PVOID HwDeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb,
+ IN PVOID VirtualAddress,
+ OUT ULONG *Length);
+
+STORPORTAPI
+PVOID
+DDKAPI
+StorPortGetVirtualAddress(
+ IN PVOID HwDeviceExtension,
+ IN STOR_PHYSICAL_ADDRESS PhysicalAddress);
+
+STORPORTAPI
+PVOID
+DDKAPI
+StorPortGetUncachedExtension(
+ IN PVOID HwDeviceExtension,
+ IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
+ IN ULONG NumberOfBytes);
+
+STORPORTAPI
+VOID
+DDKCDECLAPI
+StorPortNotification(
+ IN SCSI_NOTIFICATION_TYPE NotificationType,
+ IN PVOID HwDeviceExtension,
+ IN ...);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortLogError(
+ IN PVOID HwDeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb OPTIONAL,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN ULONG ErrorCode,
+ IN ULONG UniqueId);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortCompleteRequest(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN UCHAR SrbStatus);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortMoveMemory(
+ IN PVOID WriteBuffer,
+ IN PVOID ReadBuffer,
+ IN ULONG Length);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortStallExecution(
+ IN ULONG Delay);
+
+STORPORTAPI
+STOR_PHYSICAL_ADDRESS
+DDKAPI
+StorPortConvertUlong64ToPhysicalAddress(
+ IN ULONG64 UlongAddress);
+
+STORPORTAPI
+ULONG64
+DDKAPI
+StorPortConvertPhysicalAddressToUlong64(
+ IN STOR_PHYSICAL_ADDRESS Address);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortValidateRange(
+ IN PVOID HwDeviceExtension,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG SystemIoBusNumber,
+ IN STOR_PHYSICAL_ADDRESS IoAddress,
+ IN ULONG NumberOfBytes,
+ IN BOOLEAN InIoSpace);
+
+STORPORTAPI
+VOID
+DDKCDECLAPI
+StorPortDebugPrint(
+ IN ULONG DebugPrintLevel,
+ IN PCCHAR DebugMessage,
+ IN ...);
+
+STORPORTAPI
+UCHAR
+DDKAPI
+StorPortReadPortUchar(
+ IN PUCHAR Port);
+
+STORPORTAPI
+ULONG
+DDKAPI
+StorPortReadPortUlong(
+ IN PULONG Port);
+
+STORPORTAPI
+USHORT
+DDKAPI
+StorPortReadPortUshort(
+ IN PUSHORT Port);
+
+STORPORTAPI
+UCHAR
+DDKAPI
+StorPortReadRegisterUchar(
+ IN PUCHAR Register);
+
+STORPORTAPI
+ULONG
+DDKAPI
+StorPortReadRegisterUlong(
+ IN PULONG Register);
+
+STORPORTAPI
+USHORT
+DDKAPI
+StorPortReadRegisterUshort(
+ IN PUSHORT Register);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortWritePortUchar(
+ IN PUCHAR Port,
+ IN UCHAR Value);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortWritePortUlong(
+ IN PULONG Port,
+ IN ULONG Value);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortWritePortUshort(
+ IN PUSHORT Port,
+ IN USHORT Value);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortWriteRegisterUchar(
+ IN PUCHAR Port,
+ IN UCHAR Value);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortWriteRegisterUlong(
+ IN PULONG Port,
+ IN ULONG Value);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortWriteRegisterUshort(
+ IN PUSHORT Port,
+ IN USHORT Value);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortPauseDevice(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN ULONG TimeOut);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortResumeDevice(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortPause(
+ IN PVOID HwDeviceExtension,
+ IN ULONG TimeOut);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortResume(
+ IN PVOID HwDeviceExtension);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortDeviceBusy(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun,
+ IN ULONG RequestsToComplete);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortDeviceReady(
+ IN PVOID HwDeviceExtension,
+ IN UCHAR PathId,
+ IN UCHAR TargetId,
+ IN UCHAR Lun);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortBusy(
+ IN PVOID HwDeviceExtension,
+ IN ULONG RequestsToComplete);
+
+STORPORTAPI
+BOOLEAN
+DDKAPI
+StorPortReady(
+ IN PVOID HwDeviceExtension);
+
+STORPORTAPI
+PSTOR_SCATTER_GATHER_LIST
+DDKAPI
+StorPortGetScatterGatherList(
+ IN PVOID DeviceExtension,
+ IN PSCSI_REQUEST_BLOCK Srb);
+
+typedef BOOLEAN DDKAPI
+(*PSTOR_SYNCHRONIZED_ACCESS)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Context);
+
+STORPORTAPI
+VOID
+DDKAPI
+StorPortSynchronizeAccess(
+ IN PVOID HwDeviceExtension,
+ IN PSTOR_SYNCHRONIZED_ACCESS SynchronizedAccessRoutine,
+ IN PVOID Context);
+
+#if DBG
+#define DebugPrint(x) StorPortDebugPrint x
+#else
+#define DebugPrint(x)
+#endif
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STORPORT_H */
--- /dev/null
+/*
+ * tdi.h
+ *
+ * TDI user mode definitions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __TDI_H
+#define __TDI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "ntddtdi.h"
+#include "tdistat.h"
+#include "netpnp.h"
+
+
+/* Basic types */
+
+typedef LONG TDI_STATUS;
+typedef PVOID CONNECTION_CONTEXT;
+
+typedef struct _TDI_CONNECTION_INFORMATION {
+ LONG UserDataLength;
+ PVOID UserData;
+ LONG OptionsLength;
+ PVOID Options;
+ LONG RemoteAddressLength;
+ PVOID RemoteAddress;
+} TDI_CONNECTION_INFORMATION, *PTDI_CONNECTION_INFORMATION;
+
+typedef struct _TDI_REQUEST {
+ union {
+ HANDLE AddressHandle;
+ CONNECTION_CONTEXT ConnectionContext;
+ HANDLE ControlChannel;
+ } Handle;
+ PVOID RequestNotifyObject;
+ PVOID RequestContext;
+ TDI_STATUS TdiStatus;
+} TDI_REQUEST, *PTDI_REQUEST;
+
+typedef struct _TDI_REQUEST_STATUS {
+ TDI_STATUS Status;
+ PVOID RequestContext;
+ ULONG BytesTransferred;
+} TDI_REQUEST_STATUS, *PTDI_REQUEST_STATUS;
+
+typedef struct _TA_ADDRESS {
+ USHORT AddressLength;
+ USHORT AddressType;
+ UCHAR Address[1];
+} TA_ADDRESS, *PTA_ADDRESS;
+
+#define TDI_ADDRESS_TYPE_UNSPEC 0
+#define TDI_ADDRESS_TYPE_UNIX 1
+#define TDI_ADDRESS_TYPE_IP 2
+#define TDI_ADDRESS_TYPE_IMPLINK 3
+#define TDI_ADDRESS_TYPE_PUP 4
+#define TDI_ADDRESS_TYPE_CHAOS 5
+#define TDI_ADDRESS_TYPE_NS 6
+#define TDI_ADDRESS_TYPE_IPX 6
+#define TDI_ADDRESS_TYPE_NBS 7
+#define TDI_ADDRESS_TYPE_ECMA 8
+#define TDI_ADDRESS_TYPE_DATAKIT 9
+#define TDI_ADDRESS_TYPE_CCITT 10
+#define TDI_ADDRESS_TYPE_SNA 11
+#define TDI_ADDRESS_TYPE_DECnet 12
+#define TDI_ADDRESS_TYPE_DLI 13
+#define TDI_ADDRESS_TYPE_LAT 14
+#define TDI_ADDRESS_TYPE_HYLINK 15
+#define TDI_ADDRESS_TYPE_APPLETALK 16
+#define TDI_ADDRESS_TYPE_NETBIOS 17
+#define TDI_ADDRESS_TYPE_8022 18
+#define TDI_ADDRESS_TYPE_OSI_TSAP 19
+#define TDI_ADDRESS_TYPE_NETONE 20
+#define TDI_ADDRESS_TYPE_VNS 21
+#define TDI_ADDRESS_TYPE_NETBIOS_EX 22
+#define TDI_ADDRESS_TYPE_IP6 23
+#define TDI_ADDRESS_TYPE_NETBIOS_UNICODE_EX 24
+
+#define TdiTransportAddress "TransportAddress"
+#define TdiConnectionContext "ConnectionContext"
+#define TDI_TRANSPORT_ADDRESS_LENGTH (sizeof(TdiTransportAddress) - 1)
+#define TDI_CONNECTION_CONTEXT_LENGTH (sizeof(TdiConnectionContext) - 1)
+
+typedef struct _TRANSPORT_ADDRESS {
+ LONG TAAddressCount;
+ TA_ADDRESS Address[1];
+} TRANSPORT_ADDRESS, *PTRANSPORT_ADDRESS;
+
+typedef struct _TDI_ADDRESS_INFO {
+ ULONG ActivityCount;
+ TRANSPORT_ADDRESS Address;
+} TDI_ADDRESS_INFO, *PTDI_ADDRESS_INFO;
+
+typedef struct _TDI_ACTION_HEADER {
+ ULONG TransportId;
+ USHORT ActionCode;
+ USHORT Reserved;
+} TDI_ACTION_HEADER, *PTDI_ACTION_HEADER;
+
+typedef struct _TDI_ADDRESS_8022 {
+ UCHAR MACAddress[6];
+} TDI_ADDRESS_8022, *PTDI_ADDRESS_8022;
+
+#define TDI_ADDRESS_LENGTH_8022 sizeof(TDI_ADDRESS_8022);
+
+typedef struct _TDI_ADDRESS_APPLETALK {
+ USHORT Network;
+ UCHAR Node;
+ UCHAR Socket;
+} TDI_ADDRESS_APPLETALK, *PTDI_ADDRESS_APPLETALK;
+
+#define TDI_ADDRESS_LENGTH_APPLETALK sizeof(TDI_ADDRESS_APPLETALK)
+
+typedef struct _TDI_ADDRESS_IP {
+ USHORT sin_port;
+ ULONG in_addr;
+ UCHAR sin_zero[8];
+} TDI_ADDRESS_IP, *PTDI_ADDRESS_IP;
+
+#define TDI_ADDRESS_LENGTH_IP sizeof(TDI_ADDRESS_IP)
+
+typedef struct _TDI_ADDRESS_IPX {
+ ULONG NetworkAddress;
+ UCHAR NodeAddress[6];
+ USHORT Socket;
+} TDI_ADDRESS_IPX, *PTDI_ADDRESS_IPX;
+
+#define TDI_ADDRESS_LENGTH_IPX sizeof(TDI_ADDRESS_IPX)
+
+/* TDI_ADDRESS_NETBIOS.NetbiosNameType constants */
+#define TDI_ADDRESS_NETBIOS_TYPE_UNIQUE 0x0000
+#define TDI_ADDRESS_NETBIOS_TYPE_GROUP 0x0001
+#define TDI_ADDRESS_NETBIOS_TYPE_QUICK_UNIQUE 0x0002
+#define TDI_ADDRESS_NETBIOS_TYPE_QUICK_GROUP 0x0003
+
+typedef struct _TDI_ADDRESS_NETBIOS {
+ USHORT NetbiosNameType;
+ UCHAR NetbiosName[16];
+} TDI_ADDRESS_NETBIOS, *PTDI_ADDRESS_NETBIOS;
+
+#define TDI_ADDRESS_LENGTH_NETBIOS sizeof(TDI_ADDRESS_NETBIOS)
+
+typedef struct _TDI_ADDRESS_NETBIOS_EX {
+ UCHAR EndpointName[16];
+ TDI_ADDRESS_NETBIOS NetbiosAddress;
+} TDI_ADDRESS_NETBIOS_EX, *PTDI_ADDRESS_NETBIOS_EX;
+
+#define TDI_ADDRESS_LENGTH_NETBIOS_EX sizeof(TDI_ADDRESS_NETBIOS_EX)
+
+/* TDI_ADDRESS_NETONE.NetoneNameType constants */
+#define TDI_ADDRESS_NETONE_TYPE_UNIQUE 0x0000
+#define TDI_ADDRESS_NETONE_TYPE_ROTORED 0x0001
+
+typedef struct _TDI_ADDRESS_NETONE {
+ USHORT NetoneNameType;
+ UCHAR NetoneName[20];
+} TDI_ADDRESS_NETONE, *PTDI_ADDRESS_NETONE;
+
+#define TDI_ADDRESS_LENGTH_NETONE sizeof(TDI_ADDRESS_NETONE)
+
+typedef struct _TDI_ADDRESS_NS
+{
+ ULONG NetworkAddress;
+ UCHAR NodeAddress[6];
+ USHORT Socket;
+} TDI_ADDRESS_NS, *PTDI_ADDRESS_NS;
+
+#define TDI_ADDRESS_LENGTH_NS sizeof(TDI_ADDRESS_NS)
+
+#define ISO_MAX_ADDR_LENGTH 64
+
+/* TDI_ADDRESS_OSI_TSAP.tp_addr_type constants */
+#define ISO_HIERARCHICAL 0
+#define ISO_NON_HIERARCHICAL 1
+
+typedef struct _TDI_ADDRESS_OSI_TSAP {
+ USHORT tp_addr_type;
+ USHORT tp_taddr_len;
+ USHORT tp_tsel_len;
+ UCHAR tp_addr[ISO_MAX_ADDR_LENGTH];
+} TDI_ADDRESS_OSI_TSAP, *PTDI_ADDRESS_OSI_TSAP;
+
+#define TDI_ADDRESS_LENGTH_OSI_TSAP sizeof(TDI_ADDRESS_OSI_TSAP)
+
+typedef struct _TDI_ADDRESS_VNS {
+ UCHAR net_address[4];
+ UCHAR subnet_addr[2];
+ UCHAR port[2];
+ UCHAR hops;
+ UCHAR filler[5];
+} TDI_ADDRESS_VNS, *PTDI_ADDRESS_VNS;
+
+#define TDI_ADDRESS_LENGTH_VNS sizeof(TDI_ADDRESS_VNS)
+
+typedef struct _TDI_ADDRESS_IP6 {
+ USHORT sin6_port;
+ ULONG sin6_flowinfo;
+ USHORT sin6_addr[8];
+ ULONG sin6_scope_id;
+} TDI_ADDRESS_IP6, *PTDI_ADDRESS_IP6;
+
+#define TDI_ADDRESS_LENGTH_IP6 sizeof(TDI_ADDRESS_IP6)
+
+enum eNameBufferType {
+ NBT_READONLY = 0,
+ NBT_WRITEONLY,
+ NBT_READWRITE,
+ NBT_WRITTEN
+};
+
+typedef struct _TDI_ADDRESS_NETBIOS_UNICODE_EX {
+ USHORT NetbiosNameType;
+ enum eNameBufferType NameBufferType;
+ UNICODE_STRING EndpointName;
+ UNICODE_STRING RemoteName;
+ WCHAR EndpointBuffer[17];
+ WCHAR RemoteNameBuffer[1];
+} TDI_ADDRESS_NETBIOS_UNICODE_EX, *PTDI_ADDRESS_NETBIOS_UNICODE_EX;
+
+
+typedef struct _TDI_CONNECT_REQUEST {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+ LARGE_INTEGER Timeout;
+} TDI_REQUEST_CONNECT, *PTDI_REQUEST_CONNECT;
+
+typedef struct _TDI_REQUEST_ACCEPT {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+} TDI_REQUEST_ACCEPT, *PTDI_REQUEST_ACCEPT;
+
+typedef struct _TDI_REQUEST_LISTEN {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+ USHORT ListenFlags;
+} TDI_REQUEST_LISTEN, *PTDI_REQUEST_LISTEN;
+
+typedef struct _TDI_DISCONNECT_REQUEST {
+ TDI_REQUEST Request;
+ LARGE_INTEGER Timeout;
+} TDI_REQUEST_DISCONNECT, *PTDI_REQUEST_DISCONNECT;
+
+typedef struct _TDI_REQUEST_SEND {
+ TDI_REQUEST Request;
+ USHORT SendFlags;
+} TDI_REQUEST_SEND, *PTDI_REQUEST_SEND;
+
+typedef struct _TDI_REQUEST_RECEIVE {
+ TDI_REQUEST Request;
+ USHORT ReceiveFlags;
+} TDI_REQUEST_RECEIVE, *PTDI_REQUEST_RECEIVE;
+
+typedef struct _TDI_REQUEST_SEND_DATAGRAM {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION SendDatagramInformation;
+} TDI_REQUEST_SEND_DATAGRAM, *PTDI_REQUEST_SEND_DATAGRAM;
+
+typedef struct _TDI_REQUEST_RECEIVE_DATAGRAM {
+ TDI_REQUEST Request;
+ PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
+ PTDI_CONNECTION_INFORMATION ReturnInformation;
+ USHORT ReceiveFlags;
+} TDI_REQUEST_RECEIVE_DATAGRAM, *PTDI_REQUEST_RECEIVE_DATAGRAM;
+
+typedef struct _TDI_REQUEST_SET_EVENT {
+ TDI_REQUEST Request;
+ LONG EventType;
+ PVOID EventHandler;
+ PVOID EventContext;
+} TDI_REQUEST_SET_EVENT_HANDLER, *PTDI_REQUEST_SET_EVENT_HANDLER;
+
+#define TDI_RECEIVE_BROADCAST 0x00000004
+#define TDI_RECEIVE_MULTICAST 0x00000008
+#define TDI_RECEIVE_PARTIAL 0x00000010
+#define TDI_RECEIVE_NORMAL 0x00000020
+#define TDI_RECEIVE_EXPEDITED 0x00000040
+#define TDI_RECEIVE_PEEK 0x00000080
+#define TDI_RECEIVE_NO_RESPONSE_EXP 0x00000100
+#define TDI_RECEIVE_COPY_LOOKAHEAD 0x00000200
+#define TDI_RECEIVE_ENTIRE_MESSAGE 0x00000400
+#define TDI_RECEIVE_AT_DISPATCH_LEVEL 0x00000800
+#define TDI_RECEIVE_CONTROL_INFO 0x00001000
+
+/* Listen flags *
+#define TDI_QUERY_ACCEPT 0x00000001
+
+/* Options used for both SendOptions and ReceiveIndicators */
+#define TDI_SEND_EXPEDITED 0x0020
+#define TDI_SEND_PARTIAL 0x0040
+#define TDI_SEND_NO_RESPONSE_EXPECTED 0x0080
+#define TDI_SEND_NON_BLOCKING 0x0100
+#define TDI_SEND_AND_DISCONNECT 0x0200
+
+/* Disconnect Flags */
+#define TDI_DISCONNECT_WAIT 0x0001
+#define TDI_DISCONNECT_ABORT 0x0002
+#define TDI_DISCONNECT_RELEASE 0x0004
+
+/* TdiRequest structure for TdiQueryInformation request */
+typedef struct _TDI_REQUEST_QUERY_INFORMATION {
+ TDI_REQUEST Request;
+ ULONG QueryType;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_QUERY_INFORMATION, *PTDI_REQUEST_QUERY_INFORMATION;
+
+/* TdiRequest structure for TdiSetInformation request */
+typedef struct _TDI_REQUEST_SET_INFORMATION {
+ TDI_REQUEST Request;
+ ULONG SetType;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_SET_INFORMATION, *PTDI_REQUEST_SET_INFORMATION;
+
+typedef TDI_REQUEST_SET_INFORMATION TDI_REQ_SET_INFORMATION, *PTDI_REQ_SET_INFORMATION;
+
+typedef union _TDI_REQUEST_TYPE {
+ TDI_REQUEST_ACCEPT TdiAccept;
+ TDI_REQUEST_CONNECT TdiConnect;
+ TDI_REQUEST_DISCONNECT TdiDisconnect;
+ TDI_REQUEST_LISTEN TdiListen;
+ TDI_REQUEST_QUERY_INFORMATION TdiQueryInformation;
+ TDI_REQUEST_RECEIVE TdiReceive;
+ TDI_REQUEST_RECEIVE_DATAGRAM TdiReceiveDatagram;
+ TDI_REQUEST_SEND TdiSend;
+ TDI_REQUEST_SEND_DATAGRAM TdiSendDatagram;
+ TDI_REQUEST_SET_EVENT_HANDLER TdiSetEventHandler;
+ TDI_REQUEST_SET_INFORMATION TdiSetInformation;
+} TDI_REQUEST_TYPE, *PTDI_REQUEST_TYPE;
+
+
+/* Query information types */
+
+/* Generic query info types that must be supported by all transports */
+#define TDI_QUERY_BROADCAST_ADDRESS 0x00000001
+#define TDI_QUERY_PROVIDER_INFO 0x00000002
+#define TDI_QUERY_ADDRESS_INFO 0x00000003
+#define TDI_QUERY_CONNECTION_INFO 0x00000004
+#define TDI_QUERY_PROVIDER_STATISTICS 0x00000005
+#define TDI_QUERY_DATAGRAM_INFO 0x00000006
+#define TDI_QUERY_DATA_LINK_ADDRESS 0x00000007
+#define TDI_QUERY_NETWORK_ADDRESS 0x00000008
+#define TDI_QUERY_MAX_DATAGRAM_INFO 0x00000009
+
+/* Netbios specific query information types */
+#define TDI_QUERY_ADAPTER_STATUS 0x00000100
+#define TDI_QUERY_SESSION_STATUS 0x00000200
+#define TDI_QUERY_FIND_NAME 0x00000300
+
+typedef struct _TA_APPLETALK_ADDR {
+ LONG TAAddressCount;
+ struct _AddrAtalk {
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_APPLETALK Address[1];
+ } Address[1];
+} TA_APPLETALK_ADDRESS, *PTA_APPLETALK_ADDRESS;
+
+typedef struct _TA_ADDRESS_IP {
+ LONG TAAddressCount;
+ struct _AddrIp {
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_IP Address[1];
+ } Address[1];
+} TA_ADDRESS_IP, *PTA_ADDRESS_IP;
+
+typedef struct _TA_ADDRESS_IPX {
+ LONG TAAddressCount;
+ struct _AddrIpx {
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_IPX Address[1];
+ } Address[1];
+} TA_IPX_ADDRESS, *PTA_IPX_ADDRESS;
+
+typedef struct _TA_NETBIOS_ADDRESS {
+ LONG TAAddressCount;
+ struct _Addr{
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_NETBIOS Address[1];
+ } Address[1];
+} TA_NETBIOS_ADDRESS, *PTA_NETBIOS_ADDRESS;
+
+typedef struct _TA_ADDRESS_NS {
+ LONG TAAddressCount;
+ struct _AddrNs {
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_NS Address[1];
+ } Address[1];
+} TA_NS_ADDRESS, *PTA_NS_ADDRESS;
+
+typedef struct _TA_ADDRESS_VNS {
+ LONG TAAddressCount;
+ struct _AddrVns {
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_VNS Address[1];
+ } Address[1];
+} TA_VNS_ADDRESS, *PTA_VNS_ADDRESS;
+
+typedef struct _TA_ADDRESS_IP6 {
+ LONG TAAddressCount;
+ struct _AddrIp6 {
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_IP6 Address[1];
+ } Address [1];
+} TA_IP6_ADDRESS, *PTA_IP6_ADDRESS;
+
+typedef struct _TA_ADDRESS_NETBIOS_UNICODE_EX {
+ LONG TAAddressCount;
+ struct _AddrNetbiosWCharEx {
+ USHORT AddressLength;
+ USHORT AddressType;
+ TDI_ADDRESS_NETBIOS_UNICODE_EX Address[1];
+ } Address [1];
+} TA_NETBIOS_UNICODE_EX_ADDRESS, *PTA_NETBIOS_UNICODE_EX_ADDRESS;
+
+
+/* Structures used for TdiQueryInformation and TdiSetInformation */
+
+typedef struct _TDI_ENDPOINT_INFO {
+ ULONG State;
+ ULONG Event;
+ ULONG TransmittedTsdus;
+ ULONG ReceivedTsdus;
+ ULONG TransmissionErrors;
+ ULONG ReceiveErrors;
+ ULONG MinimumLookaheadData;
+ ULONG MaximumLookaheadData;
+ ULONG PriorityLevel;
+ ULONG SecurityLevel;
+ ULONG SecurityCompartment;
+} TDI_ENDPOINT_INFO, *PTDI_ENDPOINT_INFO;
+
+typedef struct _TDI_CONNECTION_INFO {
+ ULONG State;
+ ULONG Event;
+ ULONG TransmittedTsdus;
+ ULONG ReceivedTsdus;
+ ULONG TransmissionErrors;
+ ULONG ReceiveErrors;
+ LARGE_INTEGER Throughput;
+ LARGE_INTEGER Delay;
+ ULONG SendBufferSize;
+ ULONG ReceiveBufferSize;
+ BOOLEAN Unreliable;
+} TDI_CONNECTION_INFO, *PTDI_CONNECTION_INFO;
+
+typedef struct _TDI_DATAGRAM_INFO {
+ ULONG MaximumDatagramBytes;
+ ULONG MaximumDatagramCount;
+} TDI_DATAGRAM_INFO, *PTDI_DATAGRAM_INFO;
+
+typedef struct _TDI_MAX_DATAGRAM_INFO {
+ ULONG MaxDatagramSize;
+} TDI_MAX_DATAGRAM_INFO, *PTDI_MAX_DATAGRAM_INFO;
+
+typedef struct _TDI_PROVIDER_INFO {
+ ULONG Version;
+ ULONG MaxSendSize;
+ ULONG MaxConnectionUserData;
+ ULONG MaxDatagramSize;
+ ULONG ServiceFlags;
+ ULONG MinimumLookaheadData;
+ ULONG MaximumLookaheadData;
+ ULONG NumberOfResources;
+ LARGE_INTEGER StartTime;
+} TDI_PROVIDER_INFO, *PTDI_PROVIDER_INFO;
+
+#define TDI_SERVICE_CONNECTION_MODE 0x00000001
+#define TDI_SERVICE_ORDERLY_RELEASE 0x00000002
+#define TDI_SERVICE_CONNECTIONLESS_MODE 0x00000004
+#define TDI_SERVICE_ERROR_FREE_DELIVERY 0x00000008
+#define TDI_SERVICE_SECURITY_LEVEL 0x00000010
+#define TDI_SERVICE_BROADCAST_SUPPORTED 0x00000020
+#define TDI_SERVICE_MULTICAST_SUPPORTED 0x00000040
+#define TDI_SERVICE_DELAYED_ACCEPTANCE 0x00000080
+#define TDI_SERVICE_EXPEDITED_DATA 0x00000100
+#define TDI_SERVICE_INTERNAL_BUFFERING 0x00000200
+#define TDI_SERVICE_ROUTE_DIRECTED 0x00000400
+#define TDI_SERVICE_NO_ZERO_LENGTH 0x00000800
+#define TDI_SERVICE_POINT_TO_POINT 0x00001000
+#define TDI_SERVICE_MESSAGE_MODE 0x00002000
+#define TDI_SERVICE_HALF_DUPLEX 0x00004000
+#define TDI_SERVICE_DGRAM_CONNECTION 0x00008000
+#define TDI_SERVICE_FORCE_ACCESS_CHECK 0x00010000
+#define TDI_SERVICE_SEND_AND_DISCONNECT 0x00020000
+#define TDI_SERVICE_DIRECT_ACCEPT 0x00040000
+#define TDI_SERVICE_ACCEPT_LOCAL_ADDR 0x00080000
+
+typedef struct _TDI_PROVIDER_RESOURCE_STATS {
+ ULONG ResourceId;
+ ULONG MaximumResourceUsed;
+ ULONG AverageResourceUsed;
+ ULONG ResourceExhausted;
+} TDI_PROVIDER_RESOURCE_STATS, *PTDI_PROVIDER_RESOURCE_STATS;
+
+typedef struct _TDI_PROVIDER_STATISTICS {
+ ULONG Version;
+ ULONG OpenConnections;
+ ULONG ConnectionsAfterNoRetry;
+ ULONG ConnectionsAfterRetry;
+ ULONG LocalDisconnects;
+ ULONG RemoteDisconnects;
+ ULONG LinkFailures;
+ ULONG AdapterFailures;
+ ULONG SessionTimeouts;
+ ULONG CancelledConnections;
+ ULONG RemoteResourceFailures;
+ ULONG LocalResourceFailures;
+ ULONG NotFoundFailures;
+ ULONG NoListenFailures;
+ ULONG DatagramsSent;
+ LARGE_INTEGER DatagramBytesSent;
+ ULONG DatagramsReceived;
+ LARGE_INTEGER DatagramBytesReceived;
+ ULONG PacketsSent;
+ ULONG PacketsReceived;
+ ULONG DataFramesSent;
+ LARGE_INTEGER DataFrameBytesSent;
+ ULONG DataFramesReceived;
+ LARGE_INTEGER DataFrameBytesReceived;
+ ULONG DataFramesResent;
+ LARGE_INTEGER DataFrameBytesResent;
+ ULONG DataFramesRejected;
+ LARGE_INTEGER DataFrameBytesRejected;
+ ULONG ResponseTimerExpirations;
+ ULONG AckTimerExpirations;
+ ULONG MaximumSendWindow;
+ ULONG AverageSendWindow;
+ ULONG PiggybackAckQueued;
+ ULONG PiggybackAckTimeouts;
+ LARGE_INTEGER WastedPacketSpace;
+ ULONG WastedSpacePackets;
+ ULONG NumberOfResources;
+ TDI_PROVIDER_RESOURCE_STATS ResourceStats[1];
+} TDI_PROVIDER_STATISTICS, *PTDI_PROVIDER_STATISTICS;
+
+#define TDI_EVENT_CONNECT 0
+#define TDI_EVENT_DISCONNECT 1
+#define TDI_EVENT_ERROR 2
+#define TDI_EVENT_RECEIVE 3
+#define TDI_EVENT_RECEIVE_DATAGRAM 4
+#define TDI_EVENT_RECEIVE_EXPEDITED 5
+#define TDI_EVENT_SEND_POSSIBLE 6
+
+typedef struct _TDI_REQUEST_ASSOCIATE {
+ TDI_REQUEST Request;
+ HANDLE AddressHandle;
+} TDI_REQUEST_ASSOCIATE_ADDRESS, *PTDI_REQUEST_ASSOCIATE_ADDRESS;
+
+#define NDIS_PACKET_POOL_TAG_FOR_NWLNKIPX 'iPDN'
+#define NDIS_PACKET_POOL_TAG_FOR_NWLNKSPX 'sPDN'
+#define NDIS_PACKET_POOL_TAG_FOR_NWLNKNB 'nPDN'
+#define NDIS_PACKET_POOL_TAG_FOR_TCPIP 'tPDN'
+#define NDIS_PACKET_POOL_TAG_FOR_NBF 'bPDN'
+#define NDIS_PACKET_POOL_TAG_FOR_APPLETALK 'aPDN'
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TDI_H */
--- /dev/null
+/*
+ * tdiinfo.h
+ *
+ * TDI set and query information interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __TDIINFO_H
+#define __TDIINFO_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+typedef struct TDIEntityID {
+ ULONG tei_entity;
+ ULONG tei_instance;
+} TDIEntityID;
+
+#define MAX_TDI_ENTITIES 4096
+#define INVALID_ENTITY_INSTANCE -1
+#define GENERIC_ENTITY 0
+#define ENTITY_LIST_ID 0
+#define ENTITY_TYPE_ID 1
+
+#define AT_ENTITY 0x280
+#define CL_NL_ENTITY 0x301
+#define CL_TL_ENTITY 0x401
+#define CO_NL_ENTITY 0x300
+#define CO_TL_ENTITY 0x400
+#define ER_ENTITY 0x380
+#define IF_ENTITY 0x200
+
+#define AT_ARP 0x280
+#define AT_NULL 0x282
+#define CL_TL_NBF 0x401
+#define CL_TL_UDP 0x403
+#define CL_NL_IPX 0x301
+#define CL_NL_IP 0x303
+#define CO_TL_NBF 0x400
+#define CO_TL_SPX 0x402
+#define CO_TL_TCP 0x404
+#define CO_TL_SPP 0x406
+#define ER_ICMP 0x380
+#define IF_GENERIC 0x200
+#define IF_MIB 0x202
+
+/* TDIObjectID.toi_class constants */
+#define INFO_CLASS_GENERIC 0x100
+#define INFO_CLASS_PROTOCOL 0x200
+#define INFO_CLASS_IMPLEMENTATION 0x300
+
+/* TDIObjectID.toi_type constants */
+#define INFO_TYPE_PROVIDER 0x100
+#define INFO_TYPE_ADDRESS_OBJECT 0x200
+#define INFO_TYPE_CONNECTION 0x300
+
+typedef struct _TDIObjectID {
+ TDIEntityID toi_entity;
+ ULONG toi_class;
+ ULONG toi_type;
+ ULONG toi_id;
+} TDIObjectID;
+
+#define CONTEXT_SIZE 16
+
+typedef struct _TCP_REQUEST_QUERY_INFORMATION_EX {
+ TDIObjectID ID;
+ ULONG_PTR Context[CONTEXT_SIZE / sizeof(ULONG_PTR)];
+} TCP_REQUEST_QUERY_INFORMATION_EX, *PTCP_REQUEST_QUERY_INFORMATION_EX;
+
+#if defined(_WIN64)
+typedef struct _TCP_REQUEST_QUERY_INFORMATION_EX32 {
+ TDIObjectID ID;
+ ULONG32 Context[CONTEXT_SIZE / sizeof(ULONG32)];
+} TCP_REQUEST_QUERY_INFORMATION_EX32, *PTCP_REQUEST_QUERY_INFORMATION_EX32;
+#endif /* _WIN64 */
+
+typedef struct _TCP_REQUEST_SET_INFORMATION_EX {
+ TDIObjectID ID;
+ UINT BufferSize;
+ UCHAR Buffer[1];
+} TCP_REQUEST_SET_INFORMATION_EX, *PTCP_REQUEST_SET_INFORMATION_EX;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TDIINFO_H */
--- /dev/null
+/*
+ * tdikrnl.h
+ *
+ * TDI kernel mode definitions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __TDIKRNL_H
+#define __TDIKRNL_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "tdi.h"
+
+#if defined(_TDI_)
+ #define TDIKRNLAPI DECLSPEC_EXPORT
+#else
+ #define TDIKRNLAPI DECLSPEC_IMPORT
+#endif
+
+
+typedef struct _TDI_REQUEST_KERNEL {
+ ULONG RequestFlags;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+ PVOID RequestSpecific;
+} TDI_REQUEST_KERNEL, *PTDI_REQUEST_KERNEL;
+
+/* Request codes */
+#define TDI_ASSOCIATE_ADDRESS 0x01
+#define TDI_DISASSOCIATE_ADDRESS 0x02
+#define TDI_CONNECT 0x03
+#define TDI_LISTEN 0x04
+#define TDI_ACCEPT 0x05
+#define TDI_DISCONNECT 0x06
+#define TDI_SEND 0x07
+#define TDI_RECEIVE 0x08
+#define TDI_SEND_DATAGRAM 0x09
+#define TDI_RECEIVE_DATAGRAM 0x0A
+#define TDI_SET_EVENT_HANDLER 0x0B
+#define TDI_QUERY_INFORMATION 0x0C
+#define TDI_SET_INFORMATION 0x0D
+#define TDI_ACTION 0x0E
+
+#define TDI_DIRECT_SEND 0x27
+#define TDI_DIRECT_SEND_DATAGRAM 0x29
+
+#define TDI_TRANSPORT_ADDRESS_FILE 1
+#define TDI_CONNECTION_FILE 2
+#define TDI_CONTROL_CHANNEL_FILE 3
+
+/* Internal TDI IOCTLS */
+#define IOCTL_TDI_QUERY_DIRECT_SEND_HANDLER _TDI_CONTROL_CODE(0x80, METHOD_NEITHER)
+#define IOCTL_TDI_QUERY_DIRECT_SENDDG_HANDLER _TDI_CONTROL_CODE(0x81, METHOD_NEITHER)
+
+/* TdiAssociateAddress */
+typedef struct _TDI_REQUEST_KERNEL_ASSOCIATE {
+ HANDLE AddressHandle;
+} TDI_REQUEST_KERNEL_ASSOCIATE, *PTDI_REQUEST_KERNEL_ASSOCIATE;
+
+/* TdiDisassociateAddress */
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISASSOCIATE,
+ *PTDI_REQUEST_KERNEL_DISASSOCIATE;
+
+/* TdiAccept */
+typedef struct _TDI_REQUEST_KERNEL_ACCEPT {
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+ PTDI_CONNECTION_INFORMATION ReturnConnectionInformation;
+} TDI_REQUEST_KERNEL_ACCEPT, *PTDI_REQUEST_KERNEL_ACCEPT;
+
+/* TdiConnect */
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_CONNECT,
+ *PTDI_REQUEST_KERNEL_CONNECT;
+
+/* TdiDisconnect */
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_DISCONNECT,
+ *PTDI_REQUEST_KERNEL_DISCONNECT;
+
+/* TdiListen */
+typedef TDI_REQUEST_KERNEL TDI_REQUEST_KERNEL_LISTEN,
+ *PTDI_REQUEST_KERNEL_LISTEN;
+
+/* TdiReceive */
+typedef struct _TDI_REQUEST_KERNEL_RECEIVE {
+ ULONG ReceiveLength;
+ ULONG ReceiveFlags;
+} TDI_REQUEST_KERNEL_RECEIVE, *PTDI_REQUEST_KERNEL_RECEIVE;
+
+/* TdiReceiveDatagram */
+typedef struct _TDI_REQUEST_KERNEL_RECEIVEDG {
+ ULONG ReceiveLength;
+ PTDI_CONNECTION_INFORMATION ReceiveDatagramInformation;
+ PTDI_CONNECTION_INFORMATION ReturnDatagramInformation;
+ ULONG ReceiveFlags;
+} TDI_REQUEST_KERNEL_RECEIVEDG, *PTDI_REQUEST_KERNEL_RECEIVEDG;
+
+/* TdiSend */
+typedef struct _TDI_REQUEST_KERNEL_SEND {
+ ULONG SendLength;
+ ULONG SendFlags;
+} TDI_REQUEST_KERNEL_SEND, *PTDI_REQUEST_KERNEL_SEND;
+
+/* TdiSendDatagram */
+typedef struct _TDI_REQUEST_KERNEL_SENDDG {
+ ULONG SendLength;
+ PTDI_CONNECTION_INFORMATION SendDatagramInformation;
+} TDI_REQUEST_KERNEL_SENDDG, *PTDI_REQUEST_KERNEL_SENDDG;
+
+/* TdiSetEventHandler */
+typedef struct _TDI_REQUEST_KERNEL_SET_EVENT {
+ LONG EventType;
+ PVOID EventHandler;
+ PVOID EventContext;
+} TDI_REQUEST_KERNEL_SET_EVENT, *PTDI_REQUEST_KERNEL_SET_EVENT;
+
+/* TdiQueryInformation */
+typedef struct _TDI_REQUEST_KERNEL_QUERY_INFO {
+ LONG QueryType;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_KERNEL_QUERY_INFORMATION, *PTDI_REQUEST_KERNEL_QUERY_INFORMATION;
+
+/* TdiSetInformation */
+typedef struct _TDI_REQUEST_KERNEL_SET_INFO {
+ LONG SetType;
+ PTDI_CONNECTION_INFORMATION RequestConnectionInformation;
+} TDI_REQUEST_KERNEL_SET_INFORMATION, *PTDI_REQUEST_KERNEL_SET_INFORMATION;
+
+
+/* Event types */
+#define TDI_EVENT_CONNECT 0
+#define TDI_EVENT_DISCONNECT 1
+#define TDI_EVENT_ERROR 2
+#define TDI_EVENT_RECEIVE 3
+#define TDI_EVENT_RECEIVE_DATAGRAM 4
+#define TDI_EVENT_RECEIVE_EXPEDITED 5
+#define TDI_EVENT_SEND_POSSIBLE 6
+#define TDI_EVENT_CHAINED_RECEIVE 7
+#define TDI_EVENT_CHAINED_RECEIVE_DATAGRAM 8
+#define TDI_EVENT_CHAINED_RECEIVE_EXPEDITED 9
+#define TDI_EVENT_ERROR_EX 10
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_CONNECT)(
+ IN PVOID TdiEventContext,
+ IN LONG RemoteAddressLength,
+ IN PVOID RemoteAddress,
+ IN LONG UserDataLength,
+ IN PVOID UserData,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ OUT CONNECTION_CONTEXT *ConnectionContext,
+ OUT PIRP *AcceptIrp);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultConnectHandler(
+ IN PVOID TdiEventContext,
+ IN LONG RemoteAddressLength,
+ IN PVOID RemoteAddress,
+ IN LONG UserDataLength,
+ IN PVOID UserData,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ OUT CONNECTION_CONTEXT *ConnectionContext,
+ OUT PIRP *AcceptIrp);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_DISCONNECT)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN LONG DisconnectDataLength,
+ IN PVOID DisconnectData,
+ IN LONG DisconnectInformationLength,
+ IN PVOID DisconnectInformation,
+ IN ULONG DisconnectFlags);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultDisconnectHandler(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN LONG DisconnectDataLength,
+ IN PVOID DisconnectData,
+ IN LONG DisconnectInformationLength,
+ IN PVOID DisconnectInformation,
+ IN ULONG DisconnectFlags);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_ERROR)(
+ IN PVOID TdiEventContext,
+ IN NTSTATUS Status);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_ERROR_EX)(
+ IN PVOID TdiEventContext,
+ IN NTSTATUS Status,
+ IN PVOID Buffer);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultErrorHandler(
+ IN PVOID TdiEventContext,
+ IN NTSTATUS Status);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_RECEIVE)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu,
+ OUT PIRP *IoRequestPacket);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultReceiveHandler(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu,
+ OUT PIRP *IoRequestPacket);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_RECEIVE_DATAGRAM)(
+ IN PVOID TdiEventContext,
+ IN LONG SourceAddressLength,
+ IN PVOID SourceAddress,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ IN ULONG ReceiveDatagramFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu,
+ OUT PIRP *IoRequestPacket);
+
+TDIKRNLAPI
+NTSTATUS DDKAPI
+TdiDefaultRcvDatagramHandler(
+ IN PVOID TdiEventContext,
+ IN LONG SourceAddressLength,
+ IN PVOID SourceAddress,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ IN ULONG ReceiveDatagramFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu,
+ OUT PIRP *IoRequestPacket);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_RECEIVE_EXPEDITED)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu,
+ OUT PIRP *IoRequestPacket);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultRcvExpeditedHandler(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG BytesIndicated,
+ IN ULONG BytesAvailable,
+ OUT ULONG *BytesTaken,
+ IN PVOID Tsdu,
+ OUT PIRP *IoRequestPacket);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_CHAINED_RECEIVE)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength,
+ IN ULONG StartingOffset,
+ IN PMDL Tsdu,
+ IN PVOID TsduDescriptor);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultChainedReceiveHandler(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength,
+ IN ULONG StartingOffset,
+ IN PMDL Tsdu,
+ IN PVOID TsduDescriptor);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_CHAINED_RECEIVE_DATAGRAM)(
+ IN PVOID TdiEventContext,
+ IN LONG SourceAddressLength,
+ IN PVOID SourceAddress,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ IN ULONG ReceiveDatagramFlags,
+ IN ULONG ReceiveDatagramLength,
+ IN ULONG StartingOffset,
+ IN PMDL Tsdu,
+ IN PVOID TsduDescriptor);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultChainedRcvDatagramHandler(
+ IN PVOID TdiEventContext,
+ IN LONG SourceAddressLength,
+ IN PVOID SourceAddress,
+ IN LONG OptionsLength,
+ IN PVOID Options,
+ IN ULONG ReceiveDatagramFlags,
+ IN ULONG ReceiveDatagramLength,
+ IN ULONG StartingOffset,
+ IN PMDL Tsdu,
+ IN PVOID TsduDescriptor);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_CHAINED_RECEIVE_EXPEDITED)(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength,
+ IN ULONG StartingOffset,
+ IN PMDL Tsdu,
+ IN PVOID TsduDescriptor);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultChainedRcvExpeditedHandler(
+ IN PVOID TdiEventContext,
+ IN CONNECTION_CONTEXT ConnectionContext,
+ IN ULONG ReceiveFlags,
+ IN ULONG ReceiveLength,
+ IN ULONG StartingOffset,
+ IN PMDL Tsdu,
+ IN PVOID TsduDescriptor);
+
+typedef NTSTATUS DDKAPI
+(*PTDI_IND_SEND_POSSIBLE)(
+ IN PVOID TdiEventContext,
+ IN PVOID ConnectionContext,
+ IN ULONG BytesAvailable);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDefaultSendPossibleHandler(
+ IN PVOID TdiEventContext,
+ IN PVOID ConnectionContext,
+ IN ULONG BytesAvailable);
+
+
+
+/* Macros and functions to build IRPs */
+
+#define TdiBuildBaseIrp( \
+ bIrp, bDevObj, bFileObj, bCompRoutine, bContxt, bIrpSp, bMinor) \
+{ \
+ bIrpSp->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; \
+ bIrpSp->MinorFunction = (bMinor); \
+ bIrpSp->DeviceObject = (bDevObj); \
+ bIrpSp->FileObject = (bFileObj); \
+ if (bCompRoutine) \
+ IoSetCompletionRoutine(bIrp, bCompRoutine, bContxt, TRUE, TRUE, TRUE) \
+ else \
+ IoSetCompletionRoutine(bIrp, NULL, NULL, FALSE, FALSE, FALSE); \
+}
+
+/*
+ * VOID
+ * TdiBuildAccept(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
+ * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
+ */
+#define TdiBuildAccept( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, \
+ RequestConnectionInfo, ReturnConnectionInfo) \
+{ \
+ PTDI_REQUEST_KERNEL_ACCEPT _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_ACCEPT); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_ACCEPT)&_IrpSp->Parameters; \
+ _Request->RequestConnectionInformation = (RequestConnectionInfo); \
+ _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
+}
+
+/*
+ * VOID
+ * TdiBuildAction(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PMDL MdlAddr);
+ */
+#define TdiBuildAction( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr) \
+{ \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_ACTION); \
+ \
+ (Irp)->MdlAddress = (MdlAddr); \
+}
+
+/*
+ * VOID
+ * TdiBuildAssociateAddress(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN HANDLE AddrHandle);
+ */
+#define TdiBuildAssociateAddress( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, AddrHandle) \
+{ \
+ PTDI_REQUEST_KERNEL_ASSOCIATE _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_ASSOCIATE_ADDRESS); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_ASSOCIATE)&_IrpSp->Parameters; \
+ _Request->AddressHandle = (HANDLE)(AddrHandle); \
+}
+
+/*
+ * VOID
+ * TdiBuildConnect(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PLARGE_INTEGER Time,
+ * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
+ * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
+ */
+#define TdiBuildConnect( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, \
+ Time, RequestConnectionInfo, ReturnConnectionInfo) \
+{ \
+ PTDI_REQUEST_KERNEL _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_CONNECT); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
+ _Request->RequestConnectionInformation = (RequestConnectionInfo); \
+ _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
+ _Request->RequestSpecific = (PVOID)(Time); \
+}
+
+/*
+ * VOID
+ * TdiBuildDisassociateAddress(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt);
+ */
+#define TdiBuildDisassociateAddress( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt) \
+{ \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_DISASSOCIATE_ADDRESS); \
+}
+
+/*
+ * VOID
+ * TdiBuildDisconnect(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PLARGE_INTEGER Time,
+ * IN PULONG Flags,
+ * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
+ * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
+ */
+#define TdiBuildDisconnect( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, Time, \
+ Flags, RequestConnectionInfo, ReturnConnectionInfo) \
+{ \
+ PTDI_REQUEST_KERNEL _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_DISCONNECT); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
+ _Request->RequestConnectionInformation = (RequestConnectionInfo); \
+ _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
+ _Request->RequestSpecific = (PVOID)(Time); \
+ _Request->RequestFlags = (Flags); \
+}
+
+/*
+ * PIRP
+ * TdiBuildInternalDeviceControlIrp(
+ * IN CCHAR IrpSubFunction,
+ * IN PDEVICE_OBJECT DeviceObject,
+ * IN PFILE_OBJECT FileObject,
+ * IN PKEVENT Event,
+ * IN PIO_STATUS_BLOCK IoStatusBlock);
+ */
+#define TdiBuildInternalDeviceControlIrp( \
+ IrpSubFunction, DeviceObject, \
+ FileObject, Event, IoStatusBlock) \
+ IoBuildDeviceIoControlRequest( \
+ 0x00000003, DeviceObject, \
+ NULL, 0, NULL, 0, \
+ TRUE, Event, IoStatusBlock)
+
+/*
+ * VOID
+ * TdiBuildListen(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN ULONG Flags,
+ * IN PTDI_CONNECTION_INFORMATION RequestConnectionInfo,
+ * OUT PTDI_CONNECTION_INFORMATION ReturnConnectionInfo);
+ */
+#define TdiBuildListen( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, \
+ Flags, RequestConnectionInfo, ReturnConnectionInfo) \
+{ \
+ PTDI_REQUEST_KERNEL _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_LISTEN); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL)&_IrpSp->Parameters; \
+ _Request->RequestConnectionInformation = (RequestConnectionInfo); \
+ _Request->ReturnConnectionInformation = (ReturnConnectionInfo); \
+ _Request->RequestFlags = (Flags); \
+}
+
+TDIKRNLAPI
+VOID
+DDKAPI
+TdiBuildNetbiosAddress(
+ IN PUCHAR NetbiosName,
+ IN BOOLEAN IsGroupName,
+ IN OUT PTA_NETBIOS_ADDRESS NetworkName);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiBuildNetbiosAddressEa(
+ IN PUCHAR Buffer,
+ IN BOOLEAN IsGroupName,
+ IN PUCHAR NetbiosName);
+
+/*
+ * VOID
+ * TdiBuildQueryInformation(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN UINT QType,
+ * IN PMDL MdlAddr);
+ */
+#define TdiBuildQueryInformation( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, QType, MdlAddr) \
+{ \
+ PTDI_REQUEST_KERNEL_QUERY_INFORMATION _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_QUERY_INFORMATION); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_QUERY_INFORMATION)&_IrpSp->Parameters; \
+ _Request->RequestConnectionInformation = NULL; \
+ _Request->QueryType = (ULONG)(QType); \
+ (Irp)->MdlAddress = (MdlAddr); \
+}
+
+/*
+ * VOID
+ * TdiBuildReceive(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PMDL MdlAddr,
+ * IN ULONG InFlags,
+ * IN ULONG ReceiveLen);
+ */
+#define TdiBuildReceive( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, \
+ MdlAddr, InFlags, ReceiveLen) \
+{ \
+ PTDI_REQUEST_KERNEL_RECEIVE _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_RECEIVE); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_RECEIVE)&_IrpSp->Parameters; \
+ _Request->ReceiveFlags = (InFlags); \
+ _Request->ReceiveLength = (ReceiveLen); \
+ (Irp)->MdlAddress = (MdlAddr); \
+}
+
+/*
+ * VOID
+ * TdiBuildReceiveDatagram(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PMDL MdlAddr,
+ * IN ULONG ReceiveLen,
+ * IN PTDI_CONNECTION_INFORMATION ReceiveDatagramInfo,
+ * OUT PTDI_CONNECTION_INFORMATION ReturnInfo,
+ * ULONG InFlags);
+ */
+#define TdiBuildReceiveDatagram( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, MdlAddr, \
+ ReceiveLen, ReceiveDatagramInfo, ReturnInfo, InFlags) \
+{ \
+ PTDI_REQUEST_KERNEL_RECEIVEDG _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_RECEIVE_DATAGRAM); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_RECEIVEDG)&_IrpSp->Parameters; \
+ _Request->ReceiveDatagramInformation = (ReceiveDatagramInfo); \
+ _Request->ReturnDatagramInformation = (ReturnInfo); \
+ _Request->ReceiveLength = (ReceiveLen); \
+ _Request->ReceiveFlags = (InFlags); \
+ (Irp)->MdlAddress = (MdlAddr); \
+}
+
+/*
+ * VOID
+ * TdiBuildSend(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PMDL MdlAddr,
+ * IN ULONG InFlags,
+ * IN ULONG SendLen);
+ */
+#define TdiBuildSend( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, \
+ MdlAddr, InFlags, SendLen) \
+{ \
+ PTDI_REQUEST_KERNEL_SEND _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_SEND); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_SEND)&_IrpSp->Parameters; \
+ _Request->SendFlags = (InFlags); \
+ _Request->SendLength = (SendLen); \
+ (Irp)->MdlAddress = (MdlAddr); \
+}
+
+/*
+ * VOID
+ * TdiBuildSendDatagram(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN PMDL MdlAddr,
+ * IN ULONG SendLen,
+ * IN PTDI_CONNECTION_INFORMATION SendDatagramInfo);
+ */
+#define TdiBuildSendDatagram( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, \
+ MdlAddr, SendLen, SendDatagramInfo) \
+{ \
+ PTDI_REQUEST_KERNEL_SENDDG _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_SEND_DATAGRAM); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_SENDDG)&_IrpSp->Parameters; \
+ _Request->SendDatagramInformation = (SendDatagramInfo); \
+ _Request->SendLength = (SendLen); \
+ (Irp)->MdlAddress = (MdlAddr); \
+}
+
+/*
+ * VOID
+ * TdiBuildSetEventHandler(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN INT InEventType,
+ * IN PVOID InEventHandler,
+ * IN PVOID InEventContext);
+ */
+#define TdiBuildSetEventHandler( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, \
+ InEventType, InEventHandler, InEventContext) \
+{ \
+ PTDI_REQUEST_KERNEL_SET_EVENT _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_SET_EVENT_HANDLER); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_SET_EVENT)&_IrpSp->Parameters; \
+ _Request->EventType = (InEventType); \
+ _Request->EventHandler = (PVOID)(InEventHandler); \
+ _Request->EventContext = (PVOID)(InEventContext); \
+}
+
+/*
+ * VOID
+ * TdiBuildSetInformation(
+ * IN PIRP Irp,
+ * IN PDEVICE_OBJECT DevObj,
+ * IN PFILE_OBJECT FileObj,
+ * IN PVOID CompRoutine,
+ * IN PVOID Contxt,
+ * IN UINT SType,
+ * IN PMDL MdlAddr);
+ */
+#define TdiBuildSetInformation( \
+ Irp, DevObj, FileObj, CompRoutine, Contxt, SType, MdlAddr) \
+{ \
+ PTDI_REQUEST_KERNEL_SET_INFORMATION _Request; \
+ PIO_STACK_LOCATION _IrpSp; \
+ \
+ _IrpSp = IoGetNextIrpStackLocation(Irp); \
+ \
+ TdiBuildBaseIrp(Irp, DevObj, FileObj, CompRoutine, \
+ Contxt, _IrpSp, TDI_SET_INFORMATION); \
+ \
+ _Request = (PTDI_REQUEST_KERNEL_SET_INFORMATION)&_IrpSp->Parameters; \
+ _Request->RequestConnectionInformation = NULL; \
+ _Request->SetType = (ULONG)(SType); \
+ (Irp)->MdlAddress = (MdlAddr); \
+}
+
+/* TDI20_CLIENT_INTERFACE_INFO.TdiVersion constants */
+#define TDI_CURRENT_MAJOR_VERSION 2
+#define TDI_CURRENT_MINOR_VERSION 0
+
+#define TDI_CURRENT_VERSION ((TDI_CURRENT_MINOR_VERSION) << 8 \
+ | (TDI_CURRENT_MAJOR_VERSION))
+
+#define TDI_VERSION_ONE 0x0001
+
+typedef enum _TDI_PNP_OPCODE {
+ TDI_PNP_OP_MIN,
+ TDI_PNP_OP_ADD,
+ TDI_PNP_OP_DEL,
+ TDI_PNP_OP_UPDATE,
+ TDI_PNP_OP_PROVIDERREADY,
+ TDI_PNP_OP_NETREADY,
+ TDI_PNP_OP_ADD_IGNORE_BINDING,
+ TDI_PNP_OP_DELETE_IGNORE_BINDING,
+ TDI_PNP_OP_MAX,
+} TDI_PNP_OPCODE;
+
+/* TDI_PNP_CONTEXT.ContextType */
+#define TDI_PNP_CONTEXT_TYPE_IF_NAME 0x1
+#define TDI_PNP_CONTEXT_TYPE_IF_ADDR 0x2
+#define TDI_PNP_CONTEXT_TYPE_PDO 0x3
+#define TDI_PNP_CONTEXT_TYPE_FIRST_OR_LAST_IF 0x4
+
+typedef struct _TDI_PNP_CONTEXT {
+ USHORT ContextSize;
+ USHORT ContextType;
+ UCHAR ContextData[1];
+} TDI_PNP_CONTEXT, *PTDI_PNP_CONTEXT;
+
+typedef VOID DDKAPI
+(*TDI_ADD_ADDRESS_HANDLER)(
+ IN PTA_ADDRESS Address);
+
+typedef VOID DDKAPI
+(*TDI_ADD_ADDRESS_HANDLER_V2)(
+ IN PTA_ADDRESS Address,
+ IN PUNICODE_STRING DeviceName,
+ IN PTDI_PNP_CONTEXT Context);
+
+typedef VOID DDKAPI
+(*TDI_BINDING_HANDLER)(
+ IN TDI_PNP_OPCODE PnPOpcode,
+ IN PUNICODE_STRING DeviceName,
+ IN PWSTR MultiSZBindList);
+
+typedef VOID DDKAPI
+(*TDI_BIND_HANDLER)(
+ IN PUNICODE_STRING DeviceName);
+
+typedef VOID DDKAPI
+(*TDI_DEL_ADDRESS_HANDLER)(
+ IN PTA_ADDRESS Address);
+
+typedef VOID DDKAPI
+(*TDI_DEL_ADDRESS_HANDLER_V2)(
+ IN PTA_ADDRESS Address,
+ IN PUNICODE_STRING DeviceName,
+ IN PTDI_PNP_CONTEXT Context);
+
+typedef NTSTATUS DDKAPI
+(*TDI_PNP_POWER_HANDLER)(
+ IN PUNICODE_STRING DeviceName,
+ IN PNET_PNP_EVENT PowerEvent,
+ IN PTDI_PNP_CONTEXT Context1,
+ IN PTDI_PNP_CONTEXT Context2);
+
+typedef VOID DDKAPI
+(*TDI_UNBIND_HANDLER)(
+ IN PUNICODE_STRING DeviceName);
+
+typedef VOID DDKAPI
+(*ProviderPnPPowerComplete)(
+ IN PNET_PNP_EVENT NetEvent,
+ IN NTSTATUS ProviderStatus);
+
+typedef struct _TDI20_CLIENT_INTERFACE_INFO {
+ union {
+ struct {
+ UCHAR MajorTdiVersion;
+ UCHAR MinorTdiVersion;
+ };
+ USHORT TdiVersion;
+ };
+ USHORT Unused;
+ PUNICODE_STRING ClientName;
+ TDI_PNP_POWER_HANDLER PnPPowerHandler;
+ union {
+ TDI_BINDING_HANDLER BindingHandler;
+ struct {
+ TDI_BIND_HANDLER BindHandler;
+ TDI_UNBIND_HANDLER UnBindHandler;
+ };
+ };
+ union {
+ struct {
+ TDI_ADD_ADDRESS_HANDLER_V2 AddAddressHandlerV2;
+ TDI_DEL_ADDRESS_HANDLER_V2 DelAddressHandlerV2;
+ };
+ struct {
+ TDI_ADD_ADDRESS_HANDLER AddAddressHandler;
+ TDI_DEL_ADDRESS_HANDLER DelAddressHandler;
+ };
+ };
+} TDI20_CLIENT_INTERFACE_INFO, *PTDI20_CLIENT_INTERFACE_INFO;
+
+typedef TDI20_CLIENT_INTERFACE_INFO TDI_CLIENT_INTERFACE_INFO;
+typedef TDI_CLIENT_INTERFACE_INFO *PTDI_CLIENT_INTERFACE_INFO;
+
+
+/* TDI functions */
+
+/*
+ * VOID
+ * TdiCompleteRequest(
+ * IN PIRP Irp,
+ * IN NTSTATUS Status);
+ */
+#define TdiCompleteRequest(Irp, Status) \
+{ \
+ (Irp)->IoStatus.Status = (Status); \
+ IoCompleteRequest((Irp), IO_NETWORK_INCREMENT); \
+}
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiCopyBufferToMdl(
+ IN PVOID SourceBuffer,
+ IN ULONG SourceOffset,
+ IN ULONG SourceBytesToCopy,
+ IN PMDL DestinationMdlChain,
+ IN ULONG DestinationOffset,
+ IN PULONG BytesCopied);
+
+/*
+ * VOID
+ * TdiCopyLookaheadData(
+ * IN PVOID Destination,
+ * IN PVOID Source,
+ * IN ULONG Length,
+ * IN ULONG ReceiveFlags);
+ */
+#define TdiCopyLookaheadData(Destination, Source, Length, ReceiveFlags) \
+ RtlCopyMemory(Destination, Source, Length)
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiCopyMdlChainToMdlChain (
+ IN PMDL SourceMdlChain,
+ IN ULONG SourceOffset,
+ IN PMDL DestinationMdlChain,
+ IN ULONG DestinationOffset,
+ OUT PULONG BytesCopied);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiCopyMdlToBuffer(
+ IN PMDL SourceMdlChain,
+ IN ULONG SourceOffset,
+ IN PVOID DestinationBuffer,
+ IN ULONG DestinationOffset,
+ IN ULONG DestinationBufferSize,
+ OUT PULONG BytesCopied);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDeregisterAddressChangeHandler(
+ IN HANDLE BindingHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDeregisterDeviceObject(
+ IN HANDLE DevRegistrationHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDeregisterNetAddress(
+ IN HANDLE AddrRegistrationHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDeregisterPnPHandlers(
+ IN HANDLE BindingHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiDeregisterProvider(
+ IN HANDLE ProviderHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiEnumerateAddresses(
+ IN HANDLE BindingHandle);
+
+TDIKRNLAPI
+VOID
+DDKAPI
+TdiInitialize(
+ VOID);
+
+TDIKRNLAPI
+VOID
+DDKAPI
+TdiMapBuffer(
+ IN PMDL MdlChain);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiMapUserRequest(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PIO_STACK_LOCATION IrpSp);
+
+TDIKRNLAPI
+BOOLEAN
+DDKAPI
+TdiMatchPdoWithChainedReceiveContext(
+ IN PVOID TsduDescriptor,
+ IN PVOID PDO);
+
+TDIKRNLAPI
+VOID
+DDKAPI
+TdiPnPPowerComplete(
+ IN HANDLE BindingHandle,
+ IN PNET_PNP_EVENT PowerEvent,
+ IN NTSTATUS Status);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiPnPPowerRequest(
+ IN PUNICODE_STRING DeviceName,
+ IN PNET_PNP_EVENT PowerEvent,
+ IN PTDI_PNP_CONTEXT Context1,
+ IN PTDI_PNP_CONTEXT Context2,
+ IN ProviderPnPPowerComplete ProtocolCompletionHandler);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiProviderReady(
+ IN HANDLE ProviderHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiRegisterAddressChangeHandler(
+ IN TDI_ADD_ADDRESS_HANDLER AddHandler,
+ IN TDI_DEL_ADDRESS_HANDLER DeleteHandler,
+ OUT HANDLE *BindingHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiRegisterDeviceObject(
+ IN PUNICODE_STRING DeviceName,
+ OUT HANDLE *DevRegistrationHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiRegisterNetAddress(
+ IN PTA_ADDRESS Address,
+ IN PUNICODE_STRING DeviceName,
+ IN PTDI_PNP_CONTEXT Context,
+ OUT HANDLE *AddrRegistrationHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiRegisterNotificationHandler(
+ IN TDI_BIND_HANDLER BindHandler,
+ IN TDI_UNBIND_HANDLER UnbindHandler,
+ OUT HANDLE *BindingHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiRegisterPnPHandlers(
+ IN PTDI_CLIENT_INTERFACE_INFO ClientInterfaceInfo,
+ IN ULONG InterfaceInfoSize,
+ OUT HANDLE *BindingHandle);
+
+TDIKRNLAPI
+NTSTATUS
+DDKAPI
+TdiRegisterProvider(
+ IN PUNICODE_STRING ProviderName,
+ OUT HANDLE *ProviderHandle);
+
+TDIKRNLAPI
+VOID
+DDKAPI
+TdiReturnChainedReceives(
+ IN PVOID *TsduDescriptors,
+ IN ULONG NumberOfTsdus);
+
+TDIKRNLAPI
+VOID
+DDKAPI
+TdiUnmapBuffer(
+ IN PMDL MdlChain);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TDIKRNL_H */
--- /dev/null
+/*
+ * tdistat.h
+ *
+ * TDI status codes
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __TDISTAT_H
+#define __TDISTAT_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#define TDI_SUCCESS STATUS_SUCCESS
+#define TDI_NO_RESOURCES STATUS_INSUFFICIENT_RESOURCES
+#define TDI_ADDR_IN_USE STATUS_ADDRESS_ALREADY_EXISTS
+#define TDI_BAD_ADDR STATUS_INVALID_ADDRESS_COMPONENT
+#define TDI_NO_FREE_ADDR STATUS_TOO_MANY_ADDRESSES
+#define TDI_ADDR_INVALID STATUS_INVALID_ADDRESS
+#define TDI_ADDR_DELETED STATUS_ADDRESS_CLOSED
+#define TDI_BUFFER_OVERFLOW STATUS_BUFFER_OVERFLOW
+#define TDI_BAD_EVENT_TYPE STATUS_INVALID_PARAMETER
+#define TDI_BAD_OPTION STATUS_INVALID_PARAMETER
+#define TDI_CONN_REFUSED STATUS_CONNECTION_REFUSED
+#define TDI_INVALID_CONNECTION STATUS_CONNECTION_INVALID
+#define TDI_ALREADY_ASSOCIATED STATUS_ADDRESS_ALREADY_ASSOCIATED
+#define TDI_NOT_ASSOCIATED STATUS_ADDRESS_NOT_ASSOCIATED
+#define TDI_CONNECTION_ACTIVE STATUS_CONNECTION_ACTIVE
+#define TDI_CONNECTION_ABORTED STATUS_CONNECTION_ABORTED
+#define TDI_CONNECTION_RESET STATUS_CONNECTION_RESET
+#define TDI_TIMED_OUT STATUS_IO_TIMEOUT
+#define TDI_GRACEFUL_DISC STATUS_GRACEFUL_DISCONNECT
+#define TDI_NOT_ACCEPTED STATUS_DATA_NOT_ACCEPTED
+#define TDI_MORE_PROCESSING STATUS_MORE_PROCESSING_REQUIRED
+#define TDI_INVALID_STATE STATUS_INVALID_DEVICE_STATE
+#define TDI_INVALID_PARAMETER STATUS_INVALID_PARAMETER
+#define TDI_DEST_NET_UNREACH STATUS_NETWORK_UNREACHABLE
+#define TDI_DEST_HOST_UNREACH STATUS_HOST_UNREACHABLE
+#define TDI_DEST_UNREACHABLE TDI_DEST_HOST_UNREACH
+#define TDI_DEST_PROT_UNREACH STATUS_PROTOCOL_UNREACHABLE
+#define TDI_DEST_PORT_UNREACH STATUS_PORT_UNREACHABLE
+#define TDI_INVALID_QUERY STATUS_INVALID_DEVICE_REQUEST
+#define TDI_REQ_ABORTED STATUS_REQUEST_ABORTED
+#define TDI_BUFFER_TOO_SMALL STATUS_BUFFER_TOO_SMALL
+#define TDI_CANCELLED STATUS_CANCELLED
+#define TDI_BUFFER_TOO_BIG STATUS_INVALID_BUFFER_SIZE
+#define TDI_INVALID_REQUEST STATUS_INVALID_DEVICE_REQUEST
+#define TDI_PENDING STATUS_PENDING
+#define TDI_ITEM_NOT_FOUND STATUS_OBJECT_NAME_NOT_FOUND
+
+#define TDI_STATUS_BAD_VERSION 0xC0010004L
+#define TDI_STATUS_BAD_CHARACTERISTICS 0xC0010005L
+
+#define TDI_OPTION_EOL 0
+
+#define TDI_ADDRESS_OPTION_REUSE 1
+#define TDI_ADDRESS_OPTION_DHCP 2
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TDISTAT_H */
--- /dev/null
+/*
+ * tvout.h
+ *
+ * Definitions for TV-out support
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __TVOUT_H
+#define __TVOUT_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+/* VIDEOPARAMETERS.dwCommand constants */
+#define VP_COMMAND_GET 0x00000001
+#define VP_COMMAND_SET 0x00000002
+
+/* VIDEOPARAMETERS.dwFlags constants */
+#define VP_FLAGS_TV_MODE 0x00000001
+#define VP_FLAGS_TV_STANDARD 0x00000002
+#define VP_FLAGS_FLICKER 0x00000004
+#define VP_FLAGS_OVERSCAN 0x00000008
+#define VP_FLAGS_MAX_UNSCALED 0x00000010
+#define VP_FLAGS_POSITION 0x00000020
+#define VP_FLAGS_BRIGHTNESS 0x00000040
+#define VP_FLAGS_CONTRAST 0x00000080
+#define VP_FLAGS_COPYPROTECT 0x00000100
+
+/* VIDEOPARAMETERS.dwMode constants */
+#define VP_MODE_WIN_GRAPHICS 0x00000001
+#define VP_MODE_TV_PLAYBACK 0x00000002
+
+/* VIDEOPARAMETERS.dwTVStandard/dwAvailableTVStandard constants */
+#define VP_TV_STANDARD_NTSC_M 0x00000001
+#define VP_TV_STANDARD_NTSC_M_J 0x00000002
+#define VP_TV_STANDARD_PAL_B 0x00000004
+#define VP_TV_STANDARD_PAL_D 0x00000008
+#define VP_TV_STANDARD_PAL_H 0x00000010
+#define VP_TV_STANDARD_PAL_I 0x00000020
+#define VP_TV_STANDARD_PAL_M 0x00000040
+#define VP_TV_STANDARD_PAL_N 0x00000080
+#define VP_TV_STANDARD_SECAM_B 0x00000100
+#define VP_TV_STANDARD_SECAM_D 0x00000200
+#define VP_TV_STANDARD_SECAM_G 0x00000400
+#define VP_TV_STANDARD_SECAM_H 0x00000800
+#define VP_TV_STANDARD_SECAM_K 0x00001000
+#define VP_TV_STANDARD_SECAM_K1 0x00002000
+#define VP_TV_STANDARD_SECAM_L 0x00004000
+#define VP_TV_STANDARD_WIN_VGA 0x00008000
+#define VP_TV_STANDARD_NTSC_433 0x00010000
+#define VP_TV_STANDARD_PAL_G 0x00020000
+#define VP_TV_STANDARD_PAL_60 0x00040000
+#define VP_TV_STANDARD_SECAM_L1 0x00080000
+
+/* VIDEOPARAMETERS.dwMode constants */
+#define VP_CP_TYPE_APS_TRIGGER 0x00000001
+#define VP_CP_TYPE_MACROVISION 0x00000002
+
+/* VIDEOPARAMETERS.dwCPCommand constants */
+#define VP_CP_CMD_ACTIVATE 0x00000001
+#define VP_CP_CMD_DEACTIVATE 0x00000002
+#define VP_CP_CMD_CHANGE 0x00000004
+
+typedef struct _VIDEOPARAMETERS {
+ GUID Guid;
+ DWORD dwOffset;
+ DWORD dwCommand;
+ DWORD dwFlags;
+ DWORD dwMode;
+ DWORD dwTVStandard;
+ DWORD dwAvailableModes;
+ DWORD dwAvailableTVStandard;
+ DWORD dwFlickerFilter;
+ DWORD dwOverScanX;
+ DWORD dwOverScanY;
+ DWORD dwMaxUnscaledX;
+ DWORD dwMaxUnscaledY;
+ DWORD dwPositionX;
+ DWORD dwPositionY;
+ DWORD dwBrightness;
+ DWORD dwContrast;
+ DWORD dwCPType;
+ DWORD dwCPCommand;
+ DWORD dwCPStandard;
+ DWORD dwCPKey;
+ BYTE bCP_APSTriggerBits;
+ BYTE bOEMCopyProtection[256];
+} VIDEOPARAMETERS, *PVIDEOPARAMETERS, FAR *LPVIDEOPARAMETERS;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TVOUT_H */
--- /dev/null
+/*
+ * upssvc.h
+ *
+ * UPS service interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __UPSSVC_H
+#define __UPSSVC_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+#if defined(_APCUPS_)
+ #define UPSAPI DECLSPEC_EXPORT
+#else
+ #define UPSAPI DECLSPEC_IMPORT
+#endif
+
+
+#define UPS_ONLINE 1
+#define UPS_ONBATTERY 2
+#define UPS_LOWBATTERY 4
+#define UPS_NOCOMM 8
+#define UPS_CRITICAL 16
+
+UPSAPI
+VOID
+DDKAPI
+UPSCancelWait(VOID);
+
+UPSAPI
+DWORD
+DDKAPI
+UPSGetState(VOID);
+
+#define UPS_INITUNKNOWNERROR 0
+#define UPS_INITOK 1
+#define UPS_INITNOSUCHDRIVER 2
+#define UPS_INITBADINTERFACE 3
+#define UPS_INITREGISTRYERROR 4
+#define UPS_INITCOMMOPENERROR 5
+#define UPS_INITCOMMSETUPERROR 6
+
+UPSAPI
+DWORD
+DDKAPI
+UPSInit(VOID);
+
+UPSAPI
+VOID
+DDKAPI
+UPSStop(VOID);
+
+UPSAPI
+VOID
+DDKAPI
+UPSTurnOff(
+ IN DWORD aTurnOffDelay);
+
+UPSAPI
+VOID
+DDKAPI
+UPSWaitForStateChange(
+ IN DWORD aCurrentState,
+ IN DWORD anInterval);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UPSSVC_H */
--- /dev/null
+/*
+ * usb.h
+ *
+ * USB support.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USB_H
+#define __USB_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#ifdef __USBDI_H
+#error usbdi.h cannot be included with usb.h
+#endif
+
+#include "ntddk.h"
+#include "usb100.h"
+
+typedef LONG USBD_STATUS;
+typedef PVOID USBD_PIPE_HANDLE;
+typedef PVOID USBD_CONFIGURATION_HANDLE;
+typedef PVOID USBD_INTERFACE_HANDLE;
+
+#define USBD_STATUS_SUCCESS ((USBD_STATUS)0x00000000L)
+#define USBD_STATUS_PENDING ((USBD_STATUS)0x40000000L)
+#define USBD_STATUS_CRC ((USBD_STATUS)0xC0000001L)
+#define USBD_STATUS_BTSTUFF ((USBD_STATUS)0xC0000002L)
+#define USBD_STATUS_DATA_TOGGLE_MISMATCH ((USBD_STATUS)0xC0000003L)
+#define USBD_STATUS_STALL_PID ((USBD_STATUS)0xC0000004L)
+#define USBD_STATUS_DEV_NOT_RESPONDING ((USBD_STATUS)0xC0000005L)
+#define USBD_STATUS_PID_CHECK_FAILURE ((USBD_STATUS)0xC0000006L)
+#define USBD_STATUS_UNEXPECTED_PID ((USBD_STATUS)0xC0000007L)
+#define USBD_STATUS_DATA_OVERRUN ((USBD_STATUS)0xC0000008L)
+#define USBD_STATUS_DATA_UNDERRUN ((USBD_STATUS)0xC0000009L)
+#define USBD_STATUS_RESERVED1 ((USBD_STATUS)0xC000000AL)
+#define USBD_STATUS_RESERVED2 ((USBD_STATUS)0xC000000BL)
+#define USBD_STATUS_BUFFER_OVERRUN ((USBD_STATUS)0xC000000CL)
+#define USBD_STATUS_BUFFER_UNDERRUN ((USBD_STATUS)0xC000000DL)
+#define USBD_STATUS_NOT_ACCESSED ((USBD_STATUS)0xC000000FL)
+#define USBD_STATUS_FIFO ((USBD_STATUS)0xC0000010L)
+#define USBD_STATUS_XACT_ERROR ((USBD_STATUS)0xC0000011L)
+#define USBD_STATUS_BABBLE_DETECTED ((USBD_STATUS)0xC0000012L)
+#define USBD_STATUS_DATA_BUFFER_ERROR ((USBD_STATUS)0xC0000013L)
+#define USBD_STATUS_ENDPOINT_HALTED ((USBD_STATUS)0xC0000030L)
+#define USBD_STATUS_INVALID_URB_FUNCTION ((USBD_STATUS)0x80000200L)
+#define USBD_STATUS_INVALID_PARAMETER ((USBD_STATUS)0x80000300L)
+#define USBD_STATUS_ERROR_BUSY ((USBD_STATUS)0x80000400L)
+#define USBD_STATUS_INVALID_PIPE_HANDLE ((USBD_STATUS)0x80000600L)
+#define USBD_STATUS_NO_BANDWIDTH ((USBD_STATUS)0x80000700L)
+#define USBD_STATUS_INTERNAL_HC_ERROR ((USBD_STATUS)0x80000800L)
+#define USBD_STATUS_ERROR_SHORT_TRANSFER ((USBD_STATUS)0x80000900L)
+#define USBD_STATUS_BAD_START_FRAME ((USBD_STATUS)0xC0000A00L)
+#define USBD_STATUS_ISOCH_REQUEST_FAILED ((USBD_STATUS)0xC0000B00L)
+#define USBD_STATUS_FRAME_CONTROL_OWNED ((USBD_STATUS)0xC0000C00L)
+#define USBD_STATUS_FRAME_CONTROL_NOT_OWNED \
+ ((USBD_STATUS)0xC0000D00L)
+#define USBD_STATUS_NOT_SUPPORTED ((USBD_STATUS)0xC0000E00L)
+#define USBD_STATUS_INAVLID_CONFIGURATION_DESCRIPTOR \
+ ((USBD_STATUS)0xC0000F00L)
+#define USBD_STATUS_INSUFFICIENT_RESOURCES \
+ ((USBD_STATUS)0xC0001000L)
+#define USBD_STATUS_SET_CONFIG_FAILED ((USBD_STATUS)0xC0002000L)
+#define USBD_STATUS_BUFFER_TOO_SMALL ((USBD_STATUS)0xC0003000L)
+#define USBD_STATUS_INTERFACE_NOT_FOUND ((USBD_STATUS)0xC0004000L)
+#define USBD_STATUS_INAVLID_PIPE_FLAGS ((USBD_STATUS)0xC0005000L)
+#define USBD_STATUS_TIMEOUT ((USBD_STATUS)0xC0006000L)
+#define USBD_STATUS_DEVICE_GONE ((USBD_STATUS)0xC0007000L)
+#define USBD_STATUS_STATUS_NOT_MAPPED ((USBD_STATUS)0xC0008000L)
+#define USBD_STATUS_CANCELED ((USBD_STATUS)0xC0010000L)
+#define USBD_STATUS_ISO_NOT_ACCESSED_BY_HW \
+ ((USBD_STATUS)0xC0020000L)
+#define USBD_STATUS_ISO_TD_ERROR ((USBD_STATUS)0xC0030000L)
+#define USBD_STATUS_ISO_NA_LATE_USBPORT ((USBD_STATUS)0xC0040000L)
+#define USBD_STATUS_ISO_NOT_ACCESSED_LATE ((USBD_STATUS)0xC0050000L)
+
+#define USBD_SUCCESS(Status) ((USBD_STATUS)(Status) >= 0)
+#define USBD_PENDING(Status) ((ULONG)(Status) >> 30 == 1)
+#define USBD_ERROR(Status) ((USBD_STATUS)(Status) < 0)
+
+/* URB TransferFlags constants */
+#define USBD_TRANSFER_DIRECTION(x) ((x) & USBD_TRANSFER_DIRECTION_IN)
+#define USBD_TRANSFER_DIRECTION_OUT 0
+#define USBD_TRANSFER_DIRECTION_BIT 0
+#define USBD_TRANSFER_DIRECTION_IN (1 << USBD_TRANSFER_DIRECTION_BIT)
+#define USBD_SHORT_TRANSFER_OK_BIT 1
+#define USBD_SHORT_TRANSFER_OK (1 << USBD_SHORT_TRANSFER_OK_BIT)
+#define USBD_START_ISO_TRANSFER_ASAP_BIT 2
+#define USBD_START_ISO_TRANSFER_ASAP (1 << USBD_START_ISO_TRANSFER_ASAP_BIT)
+#define USBD_DEFAULT_PIPE_TRANSFER_BIT 3
+#define USBD_DEFAULT_PIPE_TRANSFER (1 << USBD_DEFAULT_PIPE_TRANSFER_BIT)
+
+#define USBD_TRANSFER_DIRECTION_FLAG(flags) ((flags) & USBD_TRANSFER_DIRECTION)
+
+#define VALID_TRANSFER_FLAGS_MASK \
+ (USBD_SHORT_TRANSFER_OK | \
+ USBD_TRANSFER_DIRECTION | \
+ USBD_START_ISO_TRANSFER_ASAP | \
+ USBD_DEFAULT_PIPE_TRANSFER)
+
+#define USB_DEFAULT_DEVICE_ADDRESS 0
+#define USB_DEFAULT_ENDPOINT_ADDRESS 0
+#define USB_DEFAULT_MAX_PACKET 64
+#define USBD_ISO_START_FRAME_RANGE 1024
+#define USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE 0xFFFFFFFF
+
+typedef enum _USB_CONTROLLER_FLAVOR {
+ USB_HcGeneric = 0,
+ OHCI_Generic = 100,
+ OHCI_Hydra,
+ OHCI_NEC,
+ UHCI_Generic = 200,
+ UHCI_Piix4,
+ UHCI_Piix3,
+ UHCI_Ich2_1,
+ UHCI_Ich2_2,
+ UHCI_Ich1,
+ UHCI_VIA = 250,
+ EHCI_Generic = 1000,
+ EHCI_NEC = 2000,
+ EHCI_Lucent = 3000
+} USB_CONTROLLER_FLAVOR;
+
+struct _URB_HEADER {
+ USHORT Length;
+ USHORT Function;
+ USBD_STATUS Status;
+ PVOID UsbdDeviceHandle;
+ ULONG UsbdFlags;
+};
+
+typedef struct _USBD_VERSION_INFORMATION {
+ ULONG USBDI_Version;
+ ULONG Supported_USB_Version;
+} USBD_VERSION_INFORMATION, *PUSBD_VERSION_INFORMATION;
+
+struct _URB_HCD_AREA {
+ PVOID Reserved8[8];
+};
+
+struct _URB_BULK_OR_INTERRUPT_TRANSFER {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+};
+
+struct _URB_CONTROL_DESCRIPTOR_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ USHORT Reserved1;
+ UCHAR Index;
+ UCHAR DescriptorType;
+ USHORT LanguageId;
+ USHORT Reserved2;
+};
+
+struct _URB_CONTROL_FEATURE_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved2;
+ ULONG Reserved3;
+ PVOID Reserved4;
+ PMDL Reserved5;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ USHORT Reserved0;
+ USHORT FeatureSelector;
+ USHORT Index;
+ USHORT Reserved1;
+};
+
+struct _URB_CONTROL_GET_CONFIGURATION_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR Reserved1[8];
+};
+
+struct _URB_CONTROL_GET_INTERFACE_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR Reserved1[4];
+ USHORT Interface;
+ USHORT Reserved2;
+};
+
+struct _URB_CONTROL_GET_STATUS_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR Reserved1[4];
+ USHORT Index;
+ USHORT Reserved2;
+};
+
+struct _URB_CONTROL_TRANSFER {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR SetupPacket[8];
+};
+
+struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR RequestTypeReservedBits;
+ UCHAR Request;
+ USHORT Value;
+ USHORT Index;
+ USHORT Reserved1;
+};
+
+struct _URB_FRAME_LENGTH_CONTROL {
+ struct _URB_HEADER Hdr;
+};
+
+struct _URB_GET_CURRENT_FRAME_NUMBER {
+ struct _URB_HEADER Hdr;
+ ULONG FrameNumber;
+};
+
+struct _URB_GET_FRAME_LENGTH {
+ struct _URB_HEADER Hdr;
+ ULONG FrameLength;
+ ULONG FrameNumber;
+};
+
+typedef struct _USBD_ISO_PACKET_DESCRIPTOR {
+ ULONG Offset;
+ ULONG Length;
+ USBD_STATUS Status;
+} USBD_ISO_PACKET_DESCRIPTOR, *PUSBD_ISO_PACKET_DESCRIPTOR;
+
+struct _URB_ISOCH_TRANSFER {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ ULONG StartFrame;
+ ULONG NumberOfPackets;
+ ULONG ErrorCount;
+ USBD_ISO_PACKET_DESCRIPTOR IsoPacket[1];
+};
+
+typedef enum _USBD_PIPE_TYPE {
+ UsbdPipeTypeControl,
+ UsbdPipeTypeIsochronous,
+ UsbdPipeTypeBulk,
+ UsbdPipeTypeInterrupt
+} USBD_PIPE_TYPE;
+
+typedef struct _USBD_PIPE_INFORMATION {
+ USHORT MaximumPacketSize;
+ UCHAR EndpointAddress;
+ UCHAR Interval;
+ USBD_PIPE_TYPE PipeType;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG MaximumTransferSize;
+ ULONG PipeFlags;
+} USBD_PIPE_INFORMATION, *PUSBD_PIPE_INFORMATION ;
+
+#define USBD_PIPE_DIRECTION_IN(pipeInformation) \
+ ((pipeInformation)->EndpointAddress & USB_ENDPOINT_DIRECTION_MASK)
+
+typedef struct _USBD_INTERFACE_INFORMATION {
+ USHORT Length;
+ UCHAR InterfaceNumber;
+ UCHAR AlternateSetting;
+ UCHAR Class;
+ UCHAR SubClass;
+ UCHAR Protocol;
+ UCHAR Reserved;
+ USBD_INTERFACE_HANDLE InterfaceHandle;
+ ULONG NumberOfPipes;
+ USBD_PIPE_INFORMATION Pipes[1];
+} USBD_INTERFACE_INFORMATION, *PUSBD_INTERFACE_INFORMATION;
+
+struct _URB_SELECT_INTERFACE {
+ struct _URB_HEADER Hdr;
+ USBD_CONFIGURATION_HANDLE ConfigurationHandle;
+ USBD_INTERFACE_INFORMATION Interface;
+};
+
+struct _URB_SELECT_CONFIGURATION {
+ struct _URB_HEADER Hdr;
+ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
+ USBD_CONFIGURATION_HANDLE ConfigurationHandle;
+ USBD_INTERFACE_INFORMATION Interface;
+};
+
+struct _URB_PIPE_REQUEST {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG Reserved;
+};
+
+struct _URB_SET_FRAME_LENGTH {
+ struct _URB_HEADER Hdr;
+ LONG FrameLengthDelta;
+};
+
+typedef struct _URB {
+ union {
+ struct _URB_HEADER UrbHeader;
+ struct _URB_SELECT_INTERFACE UrbSelectInterface;
+ struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration;
+ struct _URB_PIPE_REQUEST UrbPipeRequest;
+ struct _URB_FRAME_LENGTH_CONTROL UrbFrameLengthControl;
+ struct _URB_GET_FRAME_LENGTH UrbGetFrameLength;
+ struct _URB_SET_FRAME_LENGTH UrbSetFrameLength;
+ struct _URB_GET_CURRENT_FRAME_NUMBER UrbGetCurrentFrameNumber;
+ struct _URB_CONTROL_TRANSFER UrbControlTransfer;
+ struct _URB_BULK_OR_INTERRUPT_TRANSFER UrbBulkOrInterruptTransfer;
+ struct _URB_ISOCH_TRANSFER UrbIsochronousTransfer;
+ struct _URB_CONTROL_DESCRIPTOR_REQUEST UrbControlDescriptorRequest;
+ struct _URB_CONTROL_GET_STATUS_REQUEST UrbControlGetStatusRequest;
+ struct _URB_CONTROL_FEATURE_REQUEST UrbControlFeatureRequest;
+ struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST UrbControlVendorClassRequest;
+ struct _URB_CONTROL_GET_INTERFACE_REQUEST UrbControlGetInterfaceRequest;
+ struct _URB_CONTROL_GET_CONFIGURATION_REQUEST UrbControlGetConfigurationRequest;
+ };
+} URB, *PURB;
+
+#define URB_FROM_IRP(Irp) ((IoGetCurrentIrpStackLocation(Irp))->Parameters.Others.Argument1)
+
+#define URB_FUNCTION_SELECT_CONFIGURATION 0x0000
+#define URB_FUNCTION_SELECT_INTERFACE 0x0001
+#define URB_FUNCTION_ABORT_PIPE 0x0002
+#define URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL 0x0003
+#define URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL 0x0004
+#define URB_FUNCTION_GET_FRAME_LENGTH 0x0005
+#define URB_FUNCTION_SET_FRAME_LENGTH 0x0006
+#define URB_FUNCTION_GET_CURRENT_FRAME_NUMBER 0x0007
+#define URB_FUNCTION_CONTROL_TRANSFER 0x0008
+#define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009
+#define URB_FUNCTION_ISOCH_TRANSFER 0x000A
+#define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B
+#define URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE 0x000C
+#define URB_FUNCTION_SET_FEATURE_TO_DEVICE 0x000D
+#define URB_FUNCTION_SET_FEATURE_TO_INTERFACE 0x000E
+#define URB_FUNCTION_SET_FEATURE_TO_ENDPOINT 0x000F
+#define URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE 0x0010
+#define URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE 0x0011
+#define URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT 0x0012
+#define URB_FUNCTION_GET_STATUS_FROM_DEVICE 0x0013
+#define URB_FUNCTION_GET_STATUS_FROM_INTERFACE 0x0014
+#define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT 0x0015
+#define URB_FUNCTION_RESERVED_0X0016 0x0016
+#define URB_FUNCTION_VENDOR_DEVICE 0x0017
+#define URB_FUNCTION_VENDOR_INTERFACE 0x0018
+#define URB_FUNCTION_VENDOR_ENDPOINT 0x0019
+#define URB_FUNCTION_CLASS_DEVICE 0x001A
+#define URB_FUNCTION_CLASS_INTERFACE 0x001B
+#define URB_FUNCTION_CLASS_ENDPOINT 0x001C
+#define URB_FUNCTION_RESERVE_0X001D 0x001D
+#define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL 0x001E
+#define URB_FUNCTION_CLASS_OTHER 0x001F
+#define URB_FUNCTION_VENDOR_OTHER 0x0020
+#define URB_FUNCTION_GET_STATUS_FROM_OTHER 0x0021
+#define URB_FUNCTION_CLEAR_FEATURE_TO_OTHER 0x0022
+#define URB_FUNCTION_SET_FEATURE_TO_OTHER 0x0023
+#define URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT 0x0024
+#define URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT 0x0025
+#define URB_FUNCTION_GET_CONFIGURATION 0x0026
+#define URB_FUNCTION_GET_INTERFACE 0x0027
+#define URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE 0x0028
+#define URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE 0x0029
+#define URB_FUNCTION_GET_MS_FEATURE_DESCRIPTOR 0x002A
+#define URB_FUNCTION_RESERVE_0X002B 0x002B
+#define URB_FUNCTION_RESERVE_0X002C 0x002C
+#define URB_FUNCTION_RESERVE_0X002D 0x002D
+#define URB_FUNCTION_RESERVE_0X002E 0x002E
+#define URB_FUNCTION_RESERVE_0X002F 0x002F
+#define URB_FUNCTION_SYNC_RESET_PIPE 0x0030
+#define URB_FUNCTION_SYNC_CLEAR_STALL 0x0031
+
+#define USBD_PF_CHANGE_MAX_PACKET 0x00000001
+#define USBD_PF_SHORT_PACKET_OPT 0x00000002
+#define USBD_PF_ENABLE_RT_THREAD_ACCESS 0x00000004
+#define USBD_PF_MAP_ADD_TRANSFERS 0x00000008
+
+#define USBD_PF_VALID_MASK (USBD_PF_CHANGE_MAX_PACKET | \
+ USBD_PF_SHORT_PACKET_OPT | \
+ USBD_PF_ENABLE_RT_THREAD_ACCESS | \
+ USBD_PF_MAP_ADD_TRANSFERS)
+
+#define OS_STRING_DESCRIPTOR_INDEX 0xEE
+
+#define MS_GENRE_DESCRIPTOR_INDEX 0x0001
+#define MS_POWER_DESCRIPTOR_INDEX 0x0002
+
+#define MS_OS_STRING_SIGNATURE L"MSFT100"
+
+typedef struct _OS_STRING {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ WCHAR MicrosoftString[7];
+ UCHAR bVendorCode;
+ UCHAR bPad;
+} OS_STRING, *POS_STRING;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USB_H */
--- /dev/null
+/*
+ * usb100.h
+ *
+ * USB 1.0 support
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USB100_H
+#define __USB100_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define MAXIMUM_USB_STRING_LENGTH 255
+
+#define USB_DEVICE_CLASS_RESERVED 0x00
+#define USB_DEVICE_CLASS_AUDIO 0x01
+#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
+#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
+#define USB_DEVICE_CLASS_MONITOR 0x04
+#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
+#define USB_DEVICE_CLASS_POWER 0x06
+#define USB_DEVICE_CLASS_PRINTER 0x07
+#define USB_DEVICE_CLASS_STORAGE 0x08
+#define USB_DEVICE_CLASS_HUB 0x09
+#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
+
+#define USB_RESERVED_DESCRIPTOR_TYPE 0x06
+#define USB_CONFIG_POWER_DESCRIPTOR_TYPE 0x07
+#define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 0x08
+
+#define USB_REQUEST_GET_STATUS 0x00
+#define USB_REQUEST_CLEAR_FEATURE 0x01
+#define USB_REQUEST_SET_FEATURE 0x03
+#define USB_REQUEST_SET_ADDRESS 0x05
+#define USB_REQUEST_GET_DESCRIPTOR 0x06
+#define USB_REQUEST_SET_DESCRIPTOR 0x07
+#define USB_REQUEST_GET_CONFIGURATION 0x08
+#define USB_REQUEST_SET_CONFIGURATION 0x09
+#define USB_REQUEST_GET_INTERFACE 0x0A
+#define USB_REQUEST_SET_INTERFACE 0x0B
+#define USB_REQUEST_SYNC_FRAME 0x0C
+
+#define USB_GETSTATUS_SELF_POWERED 0x01
+#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02
+
+#define BMREQUEST_HOST_TO_DEVICE 0
+#define BMREQUEST_DEVICE_TO_HOST 1
+
+#define BMREQUEST_STANDARD 0
+#define BMREQUEST_CLASS 1
+#define BMREQUEST_VENDOR 2
+
+#define BMREQUEST_TO_DEVICE 0
+#define BMREQUEST_TO_INTERFACE 1
+#define BMREQUEST_TO_ENDPOINT 2
+#define BMREQUEST_TO_OTHER 3
+
+/* USB_COMMON_DESCRIPTOR.bDescriptorType constants */
+#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
+#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
+#define USB_STRING_DESCRIPTOR_TYPE 0x03
+#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
+#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
+
+typedef struct _USB_COMMON_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+} USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;
+
+#define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT)((USHORT)d << 8 | i))
+
+/* USB_CONFIGURATION_DESCRIPTOR.bmAttributes constants */
+#define USB_CONFIG_POWERED_MASK 0xc0
+#define USB_CONFIG_BUS_POWERED 0x80
+#define USB_CONFIG_SELF_POWERED 0x40
+#define USB_CONFIG_REMOTE_WAKEUP 0x20
+
+typedef struct _USB_CONFIGURATION_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ USHORT wTotalLength;
+ UCHAR bNumInterfaces;
+ UCHAR iConfiguration;
+ UCHAR bmAttributes;
+ UCHAR MaxPower;
+} USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
+
+typedef struct _USB_DEVICE_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ USHORT bcdUSB;
+ UCHAR bDeviceClass;
+ UCHAR bDeviceSubClass;
+ UCHAR bDeviceProtocol;
+ UCHAR bMaxPacketSize0;
+ USHORT idVendor;
+ USHORT idProduct;
+ USHORT bcdDevice;
+ UCHAR iManufacturer;
+ UCHAR iProduct;
+ UCHAR iSerialNumber;
+ UCHAR bNumConfigurations;
+} USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
+
+#define USB_ENDPOINT_DIRECTION_MASK 0x80
+
+#define USB_ENDPOINT_DIRECTION_OUT(x) (!((x) & USB_ENDPOINT_DIRECTION_MASK))
+#define USB_ENDPOINT_DIRECTION_IN(x) ((x) & USB_ENDPOINT_DIRECTION_MASK)
+
+/* USB_ENDPOINT_DESCRIPTOR.bmAttributes constants */
+#define USB_ENDPOINT_TYPE_MASK 0x03
+#define USB_ENDPOINT_TYPE_CONTROL 0x00
+#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
+#define USB_ENDPOINT_TYPE_BULK 0x02
+#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
+
+typedef struct _USB_ENDPOINT_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ UCHAR bEndpointAddress;
+ UCHAR bmAttributes;
+ USHORT wMaxPacketSize;
+ UCHAR bInterval;
+} USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
+
+#define USB_FEATURE_ENDPOINT_STALL 0x0000
+#define USB_FEATURE_REMOTE_WAKEUP 0x0001
+
+typedef struct _USB_INTERFACE_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ UCHAR bInterfaceNumber;
+ UCHAR bAlternateSetting;
+ UCHAR bNumEndpoints;
+ UCHAR bInterfaceClass;
+ UCHAR bInterfaceSubClass;
+ UCHAR bInterfaceProtocol;
+ UCHAR iInterface;
+} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
+
+typedef struct _USB_STRING_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ WCHAR bString[1];
+} USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;
+
+typedef struct _USB_HUB_DESCRIPTOR {
+ UCHAR bDescriptorLength;
+ UCHAR bDescriptorType;
+ UCHAR bNumberOfPorts;
+ USHORT wHubCharacteristics;
+ UCHAR bPowerOnToPowerGood;
+ UCHAR bHubControlCurrent;
+ UCHAR bRemoveAndPowerMask[64];
+} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
+
+#define USB_SUPPORT_D0_COMMAND 0x01
+#define USB_SUPPORT_D1_COMMAND 0x02
+#define USB_SUPPORT_D2_COMMAND 0x04
+#define USB_SUPPORT_D3_COMMAND 0x08
+
+#define USB_SUPPORT_D1_WAKEUP 0x10
+#define USB_SUPPORT_D2_WAKEUP 0x20
+
+typedef struct _USB_CONFIGURATION_POWER_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ UCHAR SelfPowerConsumedD0[3];
+ UCHAR bPowerSummaryId;
+ UCHAR bBusPowerSavingD1;
+ UCHAR bSelfPowerSavingD1;
+ UCHAR bBusPowerSavingD2;
+ UCHAR bSelfPowerSavingD2;
+ UCHAR bBusPowerSavingD3;
+ UCHAR bSelfPowerSavingD3;
+ USHORT TransitionTimeFromD1;
+ USHORT TransitionTimeFromD2;
+ USHORT TransitionTimeFromD3;
+} USB_CONFIGURATION_POWER_DESCRIPTOR, *PUSB_CONFIGURATION_POWER_DESCRIPTOR;
+
+#define USB_FEATURE_INTERFACE_POWER_D0 0x0002
+#define USB_FEATURE_INTERFACE_POWER_D1 0x0003
+#define USB_FEATURE_INTERFACE_POWER_D2 0x0004
+#define USB_FEATURE_INTERFACE_POWER_D3 0x0005
+
+typedef struct _USB_INTERFACE_POWER_DESCRIPTOR {
+ UCHAR bLength;
+ UCHAR bDescriptorType;
+ UCHAR bmCapabilitiesFlags;
+ UCHAR bBusPowerSavingD1;
+ UCHAR bSelfPowerSavingD1;
+ UCHAR bBusPowerSavingD2;
+ UCHAR bSelfPowerSavingD2;
+ UCHAR bBusPowerSavingD3;
+ UCHAR bSelfPowerSavingD3;
+ USHORT TransitionTimeFromD1;
+ USHORT TransitionTimeFromD2;
+ USHORT TransitionTimeFromD3;
+} USB_INTERFACE_POWER_DESCRIPTOR, *PUSB_INTERFACE_POWER_DESCRIPTOR;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USB100_H */
--- /dev/null
+/*
+ * usbcamdi.h
+ *
+ * USB Camera driver interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USBCAMDI_H
+#define __USBCAMDI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#if !defined(__USB_H) && !defined(__USBDI_H)
+#error include usb.h or usbdi.h before usbcamdi.h
+#endif
+
+#include "ntddk.h"
+
+#if defined(_BATTERYCLASS_)
+ #define USBCAMAPI DECLSPEC_EXPORT
+#else
+ #define USBCAMAPI DECLSPEC_IMPORT
+#endif
+
+
+/* FIXME: Unknown definition */
+typedef PVOID PHW_STREAM_REQUEST_BLOCK;
+
+DEFINE_GUID(GUID_USBCAMD_INTERFACE,
+ 0x2bcb75c0, 0xb27f, 0x11d1, 0xba, 0x41, 0x0, 0xa0, 0xc9, 0xd, 0x2b, 0x5);
+
+#define USBCAMD_PROCESSPACKETEX_DropFrame 0x0002
+#define USBCAMD_PROCESSPACKETEX_NextFrameIsStill 0x0004
+#define USBCAMD_PROCESSPACKETEX_CurrentFrameIsStill 0x0008
+
+#define USBCAMD_DATA_PIPE 0x0001
+#define USBCAMD_MULTIPLEX_PIPE 0x0002
+#define USBCAMD_SYNC_PIPE 0x0004
+#define USBCAMD_DONT_CARE_PIPE 0x0008
+
+#define USBCAMD_VIDEO_STREAM 0x1
+#define USBCAMD_STILL_STREAM 0x2
+#define USBCAMD_VIDEO_STILL_STREAM (USBCAMD_VIDEO_STREAM | USBCAMD_STILL_STREAM)
+
+#define USBCAMD_STOP_STREAM 0x00000001
+#define USBCAMD_START_STREAM 0x00000000
+
+typedef struct _pipe_config_descriptor {
+ CHAR StreamAssociation;
+ UCHAR PipeConfigFlags;
+} USBCAMD_Pipe_Config_Descriptor, *PUSBCAMD_Pipe_Config_Descriptor;
+
+typedef enum {
+ USBCAMD_CamControlFlag_NoVideoRawProcessing = 1,
+ USBCAMD_CamControlFlag_NoStillRawProcessing = 2,
+ USBCAMD_CamControlFlag_AssociatedFormat = 4,
+ USBCAMD_CamControlFlag_EnableDeviceEvents = 8,
+} USBCAMD_CamControlFlags;
+
+typedef NTSTATUS DDKAPI
+(*PCAM_ALLOCATE_BW_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PULONG RawFrameLength,
+ PVOID Format);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_ALLOCATE_BW_ROUTINE_EX)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PULONG RawFrameLength,
+ PVOID Format,
+ ULONG StreamNumber);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_CONFIGURE_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PUSBD_INTERFACE_INFORMATION Interface,
+ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
+ PLONG DataPipeIndex,
+ PLONG SyncPipeIndex);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_CONFIGURE_ROUTINE_EX)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PUSBD_INTERFACE_INFORMATION Interface,
+ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
+ ULONG PipeConfigListSize,
+ PUSBCAMD_Pipe_Config_Descriptor PipeConfig,
+ PUSB_DEVICE_DESCRIPTOR DeviceDescriptor);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_FREE_BW_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_FREE_BW_ROUTINE_EX)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ ULONG StreamNumber);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_INITIALIZE_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext);
+
+typedef VOID DDKAPI
+(*PCAM_NEW_FRAME_ROUTINE)(
+ PVOID DeviceContext,
+ PVOID FrameContext);
+
+typedef VOID DDKAPI
+(*PCAM_NEW_FRAME_ROUTINE_EX)(
+ PVOID DeviceContext,
+ PVOID FrameContext,
+ ULONG StreamNumber,
+ PULONG FrameLength);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_PROCESS_RAW_FRAME_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PVOID FrameContext,
+ PVOID FrameBuffer,
+ ULONG FrameLength,
+ PVOID RawFrameBuffer,
+ ULONG RawFrameLength,
+ ULONG NumberOfPackets,
+ PULONG BytesReturned);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_PROCESS_RAW_FRAME_ROUTINE_EX)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PVOID FrameContext,
+ PVOID FrameBuffer,
+ ULONG FrameLength,
+ PVOID RawFrameBuffer,
+ ULONG RawFrameLength,
+ ULONG NumberOfPackets,
+ PULONG BytesReturned,
+ ULONG ActualRawFrameLength,
+ ULONG StreamNumber);
+
+typedef ULONG DDKAPI
+(*PCAM_PROCESS_PACKET_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PVOID CurrentFrameContext,
+ PUSBD_ISO_PACKET_DESCRIPTOR SyncPacket,
+ PVOID SyncBuffer,
+ PUSBD_ISO_PACKET_DESCRIPTOR DataPacket,
+ PVOID DataBuffer,
+ PBOOLEAN FrameComplete,
+ PBOOLEAN NextFrameIsStill);
+
+typedef ULONG DDKAPI
+(*PCAM_PROCESS_PACKET_ROUTINE_EX)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ PVOID CurrentFrameContext,
+ PUSBD_ISO_PACKET_DESCRIPTOR SyncPacket,
+ PVOID SyncBuffer,
+ PUSBD_ISO_PACKET_DESCRIPTOR DataPacket,
+ PVOID DataBuffer,
+ PBOOLEAN FrameComplete,
+ PULONG PacketFlag,
+ PULONG ValidDataOffset);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_STATE_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_START_CAPTURE_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_START_CAPTURE_ROUTINE_EX)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ ULONG StreamNumber);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_STOP_CAPTURE_ROUTINE)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext);
+
+typedef NTSTATUS DDKAPI
+(*PCAM_STOP_CAPTURE_ROUTINE_EX)(
+ PDEVICE_OBJECT BusDeviceObject,
+ PVOID DeviceContext,
+ ULONG StreamNumber);
+
+typedef struct _USBCAMD_DEVICE_DATA {
+ ULONG Sig;
+ PCAM_INITIALIZE_ROUTINE CamInitialize;
+ PCAM_INITIALIZE_ROUTINE CamUnInitialize;
+ PCAM_PROCESS_PACKET_ROUTINE CamProcessUSBPacket;
+ PCAM_NEW_FRAME_ROUTINE CamNewVideoFrame;
+ PCAM_PROCESS_RAW_FRAME_ROUTINE CamProcessRawVideoFrame;
+ PCAM_START_CAPTURE_ROUTINE CamStartCapture;
+ PCAM_STOP_CAPTURE_ROUTINE CamStopCapture;
+ PCAM_CONFIGURE_ROUTINE CamConfigure;
+ PCAM_STATE_ROUTINE CamSaveState;
+ PCAM_STATE_ROUTINE CamRestoreState;
+ PCAM_ALLOCATE_BW_ROUTINE CamAllocateBandwidth;
+ PCAM_FREE_BW_ROUTINE CamFreeBandwidth;
+} USBCAMD_DEVICE_DATA, *PUSBCAMD_DEVICE_DATA;
+
+typedef struct _USBCAMD_DEVICE_DATA2 {
+ ULONG Sig;
+ PCAM_INITIALIZE_ROUTINE CamInitialize;
+ PCAM_INITIALIZE_ROUTINE CamUnInitialize;
+ PCAM_PROCESS_PACKET_ROUTINE_EX CamProcessUSBPacketEx;
+ PCAM_NEW_FRAME_ROUTINE_EX CamNewVideoFrameEx;
+ PCAM_PROCESS_RAW_FRAME_ROUTINE_EX CamProcessRawVideoFrameEx;
+ PCAM_START_CAPTURE_ROUTINE_EX CamStartCaptureEx;
+ PCAM_STOP_CAPTURE_ROUTINE_EX CamStopCaptureEx;
+ PCAM_CONFIGURE_ROUTINE_EX CamConfigureEx;
+ PCAM_STATE_ROUTINE CamSaveState;
+ PCAM_STATE_ROUTINE CamRestoreState;
+ PCAM_ALLOCATE_BW_ROUTINE_EX CamAllocateBandwidthEx;
+ PCAM_FREE_BW_ROUTINE_EX CamFreeBandwidthEx;
+} USBCAMD_DEVICE_DATA2, *PUSBCAMD_DEVICE_DATA2;
+
+USBCAMAPI
+ULONG
+DDKAPI
+USBCAMD_InitializeNewInterface(
+ IN PVOID DeviceContext,
+ IN PVOID DeviceData,
+ IN ULONG Version,
+ IN ULONG CamControlFlag);
+
+typedef VOID DDKAPI
+(*PCOMMAND_COMPLETE_FUNCTION)(
+ PVOID DeviceContext,
+ PVOID CommandContext,
+ NTSTATUS NtStatus);
+
+typedef NTSTATUS DDKAPI
+(*PFNUSBCAMD_BulkReadWrite)(
+ IN PVOID DeviceContext,
+ IN USHORT PipeIndex,
+ IN PVOID Buffer,
+ IN ULONG BufferLength,
+ IN PCOMMAND_COMPLETE_FUNCTION CommandComplete,
+ IN PVOID CommandContext);
+
+typedef NTSTATUS DDKAPI
+(*PFNUSBCAMD_SetIsoPipeState)(
+ IN PVOID DeviceContext,
+ IN ULONG PipeStateFlags);
+
+typedef NTSTATUS DDKAPI
+(*PFNUSBCAMD_CancelBulkReadWrite)(
+ IN PVOID DeviceContext,
+ IN ULONG PipeIndex);
+
+typedef NTSTATUS DDKAPI
+(*PFNUSBCAMD_SetVideoFormat)(
+ IN PVOID DeviceContext,
+ IN PHW_STREAM_REQUEST_BLOCK pSrb);
+
+typedef NTSTATUS DDKAPI
+(*PFNUSBCAMD_WaitOnDeviceEvent)(
+ IN PVOID DeviceContext,
+ IN ULONG PipeIndex,
+ IN PVOID Buffer,
+ IN ULONG BufferLength,
+ IN PCOMMAND_COMPLETE_FUNCTION EventComplete,
+ IN PVOID EventContext,
+ IN BOOLEAN LoopBack);
+
+USBCAMAPI
+PVOID
+DDKAPI
+USBCAMD_AdapterReceivePacket(
+ IN PHW_STREAM_REQUEST_BLOCK Srb,
+ IN PUSBCAMD_DEVICE_DATA DeviceData,
+ IN PDEVICE_OBJECT *DeviceObject,
+ IN BOOLEAN NeedsCompletion);
+
+USBCAMAPI
+NTSTATUS
+DDKAPI
+USBCAMD_ControlVendorCommand(
+ IN PVOID DeviceContext,
+ IN UCHAR Request,
+ IN USHORT Value,
+ IN USHORT Index,
+ IN PVOID Buffer,
+ IN OUT PULONG BufferLength,
+ IN BOOLEAN GetData,
+ IN PCOMMAND_COMPLETE_FUNCTION CommandComplete,
+ IN PVOID CommandContext);
+
+typedef VOID DDKAPI
+(*PADAPTER_RECEIVE_PACKET_ROUTINE)(
+ IN PHW_STREAM_REQUEST_BLOCK Srb);
+
+USBCAMAPI
+ULONG
+DDKAPI
+USBCAMD_DriverEntry(
+ PVOID Context1,
+ PVOID Context2,
+ ULONG DeviceContextSize,
+ ULONG FrameContextSize,
+ PADAPTER_RECEIVE_PACKET_ROUTINE ReceivePacket);
+
+USBCAMAPI
+NTSTATUS
+DDKAPI
+USBCAMD_GetRegistryKeyValue(
+ IN HANDLE Handle,
+ IN PWCHAR KeyNameString,
+ IN ULONG KeyNameStringLength,
+ IN PVOID Data,
+ IN ULONG DataLength);
+
+USBCAMAPI
+NTSTATUS
+DDKAPI
+USBCAMD_SelectAlternateInterface(
+ IN PVOID DeviceContext,
+ IN OUT PUSBD_INTERFACE_INFORMATION RequestInterface);
+
+#define USBCAMD_VERSION_200 0x200
+
+typedef struct _USBCAMD_INTERFACE {
+ INTERFACE Interface;
+ PFNUSBCAMD_WaitOnDeviceEvent USBCAMD_WaitOnDeviceEvent;
+ PFNUSBCAMD_BulkReadWrite USBCAMD_BulkReadWrite;
+ PFNUSBCAMD_SetVideoFormat USBCAMD_SetVideoFormat;
+ PFNUSBCAMD_SetIsoPipeState USBCAMD_SetIsoPipeState;
+ PFNUSBCAMD_CancelBulkReadWrite USBCAMD_CancelBulkReadWrite;
+} USBCAMD_INTERFACE, *PUSBCAMD_INTERFACE;
+
+typedef VOID DDKAPI
+(*PSTREAM_RECEIVE_PACKET)(
+ IN PVOID Srb,
+ IN PVOID DeviceContext,
+ IN PBOOLEAN Completed);
+
+#if defined(DEBUG_LOG)
+
+USBCAMAPI
+VOID
+DDKAPI
+USBCAMD_Debug_LogEntry(
+ IN CHAR *Name,
+ IN ULONG Info1,
+ IN ULONG Info2,
+ IN ULONG Info3);
+
+#define ILOGENTRY(sig, info1, info2, info3) \
+ USBCAMD_Debug_LogEntry(sig, (ULONG)info1, (ULONG)info2, (ULONG)info3)
+
+#else
+
+#define ILOGENTRY(sig, info1, info2, info3)
+
+#endif /* DEBUG_LOG */
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USBCAMDI_H */
--- /dev/null
+/*
+ * usbdi.h
+ *
+ * USBD and USB device driver definitions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USBDI_H
+#define __USBDI_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#ifdef __USB_H
+#error usb.h cannot be included with usbdi.h
+#endif
+
+#include "ntddk.h"
+#include "usbioctl.h"
+
+
+#define USBDI_VERSION 0x300
+
+#define USB_DEFAULT_DEVICE_ADDRESS 0
+#define USB_DEFAULT_ENDPOINT_ADDRESS 0
+#define USB_DEFAULT_MAX_PACKET 64
+
+#define URB_FROM_IRP(Irp) ((IoGetCurrentIrpStackLocation(Irp))->Parameters.Others.Argument1)
+
+#define URB_FUNCTION_SELECT_CONFIGURATION 0x0000
+#define URB_FUNCTION_SELECT_INTERFACE 0x0001
+#define URB_FUNCTION_ABORT_PIPE 0x0002
+#define URB_FUNCTION_TAKE_FRAME_LENGTH_CONTROL 0x0003
+#define URB_FUNCTION_RELEASE_FRAME_LENGTH_CONTROL 0x0004
+#define URB_FUNCTION_GET_FRAME_LENGTH 0x0005
+#define URB_FUNCTION_SET_FRAME_LENGTH 0x0006
+#define URB_FUNCTION_GET_CURRENT_FRAME_NUMBER 0x0007
+#define URB_FUNCTION_CONTROL_TRANSFER 0x0008
+#define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009
+#define URB_FUNCTION_ISOCH_TRANSFER 0x000A
+#define URB_FUNCTION_RESET_PIPE 0x001E
+#define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B
+#define URB_FUNCTION_GET_DESCRIPTOR_FROM_ENDPOINT 0x0024
+#define URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE 0x0028
+#define URB_FUNCTION_SET_DESCRIPTOR_TO_DEVICE 0x000C
+#define URB_FUNCTION_SET_DESCRIPTOR_TO_ENDPOINT 0x0025
+#define URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE 0x0029
+#define URB_FUNCTION_SET_FEATURE_TO_DEVICE 0x000D
+#define URB_FUNCTION_SET_FEATURE_TO_INTERFACE 0x000E
+#define URB_FUNCTION_SET_FEATURE_TO_ENDPOINT 0x000F
+#define URB_FUNCTION_SET_FEATURE_TO_OTHER 0x0023
+#define URB_FUNCTION_CLEAR_FEATURE_TO_DEVICE 0x0010
+#define URB_FUNCTION_CLEAR_FEATURE_TO_INTERFACE 0x0011
+#define URB_FUNCTION_CLEAR_FEATURE_TO_ENDPOINT 0x0012
+#define URB_FUNCTION_CLEAR_FEATURE_TO_OTHER 0x0022
+#define URB_FUNCTION_GET_STATUS_FROM_DEVICE 0x0013
+#define URB_FUNCTION_GET_STATUS_FROM_INTERFACE 0x0014
+#define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT 0x0015
+#define URB_FUNCTION_GET_STATUS_FROM_OTHER 0x0021
+#define URB_FUNCTION_RESERVED0 0x0016
+#define URB_FUNCTION_VENDOR_DEVICE 0x0017
+#define URB_FUNCTION_VENDOR_INTERFACE 0x0018
+#define URB_FUNCTION_VENDOR_ENDPOINT 0x0019
+#define URB_FUNCTION_VENDOR_OTHER 0x0020
+#define URB_FUNCTION_CLASS_DEVICE 0x001A
+#define URB_FUNCTION_CLASS_INTERFACE 0x001B
+#define URB_FUNCTION_CLASS_ENDPOINT 0x001C
+#define URB_FUNCTION_CLASS_OTHER 0x001F
+#define URB_FUNCTION_RESERVED 0x001D
+#define URB_FUNCTION_GET_CONFIGURATION 0x0026
+#define URB_FUNCTION_GET_INTERFACE 0x0027
+#define URB_FUNCTION_LAST 0x0029
+
+typedef LONG USBD_STATUS;
+typedef PVOID USBD_PIPE_HANDLE;
+typedef PVOID USBD_CONFIGURATION_HANDLE;
+typedef PVOID USBD_INTERFACE_HANDLE;
+
+#define USBD_ERROR(Status) ((USBD_STATUS)(Status) < 0)
+#define USBD_HALTED(Status) ((ULONG)(Status) >> 30 == 3)
+#define USBD_PENDING(Status) ((ULONG)(Status) >> 30 == 1)
+#define USBD_STATUS(Status) ((ULONG)(Status) & 0x0FFFFFFFL)
+#define USBD_SUCCESS(Status) ((USBD_STATUS)(Status) >= 0)
+
+#define USBD_STATUS_SUCCESS ((USBD_STATUS)0x00000000L)
+#define USBD_STATUS_PENDING ((USBD_STATUS)0x40000000L)
+#define USBD_STATUS_HALTED ((USBD_STATUS)0xC0000000L)
+#define USBD_STATUS_ERROR ((USBD_STATUS)0x80000000L)
+#define USBD_STATUS_NO_MEMORY ((USBD_STATUS)0x80000100L)
+#define USBD_STATUS_INVALID_URB_FUNCTION ((USBD_STATUS)0x80000200L)
+#define USBD_STATUS_INVALID_PARAMETER ((USBD_STATUS)0x80000300L)
+#define USBD_STATUS_ERROR_BUSY ((USBD_STATUS)0x80000400L)
+#define USBD_STATUS_REQUEST_FAILED ((USBD_STATUS)0x80000500L)
+#define USBD_STATUS_INVALID_PIPE_HANDLE ((USBD_STATUS)0x80000600L)
+#define USBD_STATUS_NO_BANDWIDTH ((USBD_STATUS)0x80000700L)
+#define USBD_STATUS_INTERNAL_HC_ERROR ((USBD_STATUS)0x80000800L)
+#define USBD_STATUS_ERROR_SHORT_TRANSFER ((USBD_STATUS)0x80000900L)
+#define USBD_STATUS_CRC ((USBD_STATUS)0xC0000001L)
+#define USBD_STATUS_BTSTUFF ((USBD_STATUS)0xC0000002L)
+#define USBD_STATUS_DATA_TOGGLE_MISMATCH ((USBD_STATUS)0xC0000003L)
+#define USBD_STATUS_STALL_PID ((USBD_STATUS)0xC0000004L)
+#define USBD_STATUS_DEV_NOT_RESPONDING ((USBD_STATUS)0xC0000005L)
+#define USBD_STATUS_PID_CHECK_FAILURE ((USBD_STATUS)0xC0000006L)
+#define USBD_STATUS_UNEXPECTED_PID ((USBD_STATUS)0xC0000007L)
+#define USBD_STATUS_DATA_OVERRUN ((USBD_STATUS)0xC0000008L)
+#define USBD_STATUS_DATA_UNDERRUN ((USBD_STATUS)0xC0000009L)
+#define USBD_STATUS_RESERVED1 ((USBD_STATUS)0xC000000AL)
+#define USBD_STATUS_RESERVED2 ((USBD_STATUS)0xC000000BL)
+#define USBD_STATUS_BUFFER_OVERRUN ((USBD_STATUS)0xC000000CL)
+#define USBD_STATUS_BUFFER_UNDERRUN ((USBD_STATUS)0xC000000DL)
+#define USBD_STATUS_NOT_ACCESSED ((USBD_STATUS)0xC000000FL)
+#define USBD_STATUS_FIFO ((USBD_STATUS)0xC0000010L)
+#define USBD_STATUS_ENDPOINT_HALTED ((USBD_STATUS)0xC0000030L)
+#define USBD_STATUS_BAD_START_FRAME ((USBD_STATUS)0xC0000A00L)
+#define USBD_STATUS_ISOCH_REQUEST_FAILED ((USBD_STATUS)0xC0000B00L)
+#define USBD_STATUS_FRAME_CONTROL_OWNED ((USBD_STATUS)0xC0000C00L)
+#define USBD_STATUS_FRAME_CONTROL_NOT_OWNED \
+ ((USBD_STATUS)0xC0000D00L)
+#define USBD_STATUS_INAVLID_CONFIGURATION_DESCRIPTOR \
+ ((USBD_STATUS)0xC0000F00L)
+#define USBD_STATUS_CANCELING ((USBD_STATUS)0x00020000L)
+
+#define USBD_PIPE_DIRECTION_IN(pipeInformation) \
+ ((pipeInformation)->EndpointAddress & USB_ENDPOINT_DIRECTION_MASK)
+
+struct _URB_HEADER {
+ USHORT Length;
+ USHORT Function;
+ USBD_STATUS Status;
+ PVOID UsbdDeviceHandle;
+ ULONG UsbdFlags;
+};
+
+struct _URB_HCD_AREA {
+ PVOID HcdEndpoint;
+ PIRP HcdIrp;
+ LIST_ENTRY HcdListEntry;
+ LIST_ENTRY HcdListEntry2;
+ PVOID HcdCurrentIoFlushPointer;
+ PVOID HcdExtension;
+};
+
+struct _URB_BULK_OR_INTERRUPT_TRANSFER {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+};
+
+struct _URB_CONTROL_DESCRIPTOR_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ USHORT Reserved1;
+ UCHAR Index;
+ UCHAR DescriptorType;
+ USHORT LanguageId;
+ USHORT Reserved2;
+};
+
+struct _URB_CONTROL_FEATURE_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved2;
+ ULONG Reserved3;
+ PVOID Reserved4;
+ PMDL Reserved5;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ USHORT Reserved0;
+ USHORT FeatureSelector;
+ USHORT Index;
+ USHORT Reserved1;
+};
+
+struct _URB_CONTROL_GET_CONFIGURATION_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR Reserved1[8];
+};
+
+struct _URB_CONTROL_GET_INTERFACE_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR Reserved1[4];
+ USHORT Interface;
+ USHORT Reserved2;
+};
+
+struct _URB_CONTROL_GET_STATUS_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG Reserved0;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR Reserved1[4];
+ USHORT Index;
+ USHORT Reserved2;
+};
+
+struct _URB_CONTROL_TRANSFER {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR SetupPacket[8];
+};
+
+struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST {
+ struct _URB_HEADER Hdr;
+ PVOID Reserved;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ UCHAR RequestTypeReservedBits;
+ UCHAR Request;
+ USHORT Value;
+ USHORT Index;
+ USHORT Reserved1;
+};
+
+struct _URB_FRAME_LENGTH_CONTROL {
+ struct _URB_HEADER Hdr;
+};
+
+struct _URB_GET_CURRENT_FRAME_NUMBER {
+ struct _URB_HEADER Hdr;
+ ULONG FrameNumber;
+};
+
+struct _URB_GET_FRAME_LENGTH {
+ struct _URB_HEADER Hdr;
+ ULONG FrameLength;
+ ULONG FrameNumber;
+};
+
+typedef struct _USBD_ISO_PACKET_DESCRIPTOR {
+ ULONG Offset;
+ ULONG Length;
+ USBD_STATUS Status;
+} USBD_ISO_PACKET_DESCRIPTOR, *PUSBD_ISO_PACKET_DESCRIPTOR;
+
+struct _URB_ISOCH_TRANSFER {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG TransferFlags;
+ ULONG TransferBufferLength;
+ PVOID TransferBuffer;
+ PMDL TransferBufferMDL;
+ struct _URB *UrbLink;
+ struct _URB_HCD_AREA hca;
+ ULONG StartFrame;
+ ULONG NumberOfPackets;
+ ULONG ErrorCount;
+ USBD_ISO_PACKET_DESCRIPTOR IsoPacket[1];
+};
+
+struct _URB_PIPE_REQUEST {
+ struct _URB_HEADER Hdr;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG Reserved;
+};
+
+struct _URB_SET_FRAME_LENGTH {
+ struct _URB_HEADER Hdr;
+ LONG FrameLengthDelta;
+};
+
+typedef struct _USBD_DEVICE_INFORMATION {
+ ULONG OffsetNext;
+ PVOID UsbdDeviceHandle;
+ USB_DEVICE_DESCRIPTOR DeviceDescriptor;
+} USBD_DEVICE_INFORMATION, *PUSBD_DEVICE_INFORMATION;
+
+typedef enum _USBD_PIPE_TYPE {
+ UsbdPipeTypeControl,
+ UsbdPipeTypeIsochronous,
+ UsbdPipeTypeBulk,
+ UsbdPipeTypeInterrupt
+} USBD_PIPE_TYPE;
+
+/* USBD_PIPE_INFORMATION.PipeFlags constants */
+#define USBD_PF_CHANGE_MAX_PACKET 0x00000001
+#define USBD_PF_DOUBLE_BUFFER 0x00000002
+#define USBD_PF_ENABLE_RT_THREAD_ACCESS 0x00000004
+#define USBD_PF_MAP_ADD_TRANSFERS 0x00000008
+
+typedef struct _USBD_PIPE_INFORMATION {
+ USHORT MaximumPacketSize;
+ UCHAR EndpointAddress;
+ UCHAR Interval;
+ USBD_PIPE_TYPE PipeType;
+ USBD_PIPE_HANDLE PipeHandle;
+ ULONG MaximumTransferSize;
+ ULONG PipeFlags;
+} USBD_PIPE_INFORMATION, *PUSBD_PIPE_INFORMATION;
+
+typedef struct _USBD_INTERFACE_INFORMATION {
+ USHORT Length;
+ UCHAR InterfaceNumber;
+ UCHAR AlternateSetting;
+ UCHAR Class;
+ UCHAR SubClass;
+ UCHAR Protocol;
+ UCHAR Reserved;
+ USBD_INTERFACE_HANDLE InterfaceHandle;
+ ULONG NumberOfPipes;
+ USBD_PIPE_INFORMATION Pipes[1];
+} USBD_INTERFACE_INFORMATION, *PUSBD_INTERFACE_INFORMATION;
+
+struct _URB_SELECT_CONFIGURATION {
+ struct _URB_HEADER Hdr;
+ PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
+ USBD_CONFIGURATION_HANDLE ConfigurationHandle;
+ USBD_INTERFACE_INFORMATION Interface;
+};
+
+struct _URB_SELECT_INTERFACE {
+ struct _URB_HEADER Hdr;
+ USBD_CONFIGURATION_HANDLE ConfigurationHandle;
+ USBD_INTERFACE_INFORMATION Interface;
+};
+
+typedef struct _USBD_VERSION_INFORMATION {
+ ULONG USBDI_Version;
+ ULONG Supported_USB_Version;
+} USBD_VERSION_INFORMATION, *PUSBD_VERSION_INFORMATION;
+
+typedef struct _URB {
+ union {
+ struct _URB_HEADER UrbHeader;
+ struct _URB_SELECT_INTERFACE UrbSelectInterface;
+ struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration;
+ struct _URB_PIPE_REQUEST UrbPipeRequest;
+ struct _URB_FRAME_LENGTH_CONTROL UrbFrameLengthControl;
+ struct _URB_GET_FRAME_LENGTH UrbGetFrameLength;
+ struct _URB_SET_FRAME_LENGTH UrbSetFrameLength;
+ struct _URB_GET_CURRENT_FRAME_NUMBER UrbGetCurrentFrameNumber;
+ struct _URB_CONTROL_TRANSFER UrbControlTransfer;
+ struct _URB_BULK_OR_INTERRUPT_TRANSFER UrbBulkOrInterruptTransfer;
+ struct _URB_ISOCH_TRANSFER UrbIsochronousTransfer;
+ struct _URB_CONTROL_DESCRIPTOR_REQUEST UrbControlDescriptorRequest;
+ struct _URB_CONTROL_GET_STATUS_REQUEST UrbControlGetStatusRequest;
+ struct _URB_CONTROL_FEATURE_REQUEST UrbControlFeatureRequest;
+ struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST UrbControlVendorClassRequest;
+ struct _URB_CONTROL_GET_INTERFACE_REQUEST UrbControlGetInterfaceRequest;
+ struct _URB_CONTROL_GET_CONFIGURATION_REQUEST UrbControlGetConfigurationRequest;
+ };
+} URB, *PURB;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USBDI_H */
--- /dev/null
+/*
+ * usbioctl.h
+ *
+ * USB IOCTL interface.
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USBIOCTL_H
+#define __USBIOCTL_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "usb100.h"
+#include "usbiodef.h"
+
+#define USBD_PORT_ENABLED 1
+#define USBD_PORT_CONNECTED 2
+
+#define IOCTL_INTERNAL_USB_CYCLE_PORT \
+ CTL_CODE(FILE_DEVICE_USB, USB_CYCLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_ENABLE_PORT \
+ CTL_CODE(FILE_DEVICE_USB, USB_ENABLE_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_BUS_INFO \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_BUS_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_BUSGUID_INFO \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_BUSGUID_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_CONTROLLER_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_DEVICE_HANDLE, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_HUB_COUNT \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_COUNT, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_HUB_NAME \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_PARENT_HUB_INFO, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_PORT_STATUS \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_PORT_STATUS, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_RESET_PORT \
+ CTL_CODE(FILE_DEVICE_USB, USB_RESET_PORT, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_ROOTHUB_PDO, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION \
+ CTL_CODE(FILE_DEVICE_USB, USB_IDLE_NOTIFICATION, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define IOCTL_INTERNAL_USB_SUBMIT_URB \
+ CTL_CODE(FILE_DEVICE_USB, USB_SUBMIT_URB, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+
+#define IOCTL_USB_DIAG_IGNORE_HUBS_ON \
+ CTL_CODE(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_ON, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_DIAG_IGNORE_HUBS_OFF \
+ CTL_CODE(FILE_DEVICE_USB, USB_DIAG_IGNORE_HUBS_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_DIAGNOSTIC_MODE_OFF \
+ CTL_CODE(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_OFF, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_DIAGNOSTIC_MODE_ON \
+ CTL_CODE(FILE_DEVICE_USB, HCD_DIAGNOSTIC_MODE_ON, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_HUB_CAPABILITIES \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_ROOT_HUB_NAME \
+ CTL_CODE(FILE_DEVICE_USB, HCD_GET_ROOT_HUB_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_GET_HCD_DRIVERKEY_NAME \
+ CTL_CODE(FILE_DEVICE_USB, HCD_GET_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_NODE_INFORMATION \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_NODE_CONNECTION_INFORMATION \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_INFORMATION, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_ATTRIBUTES, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_NODE_CONNECTION_NAME \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME \
+ CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_HCD_DISABLE_PORT \
+ CTL_CODE(FILE_DEVICE_USB, HCD_DISABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_HCD_ENABLE_PORT \
+ CTL_CODE(FILE_DEVICE_USB, HCD_ENABLE_PORT, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_HCD_GET_STATS_1 \
+ CTL_CODE(FILE_DEVICE_USB, HCD_GET_STATS_1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_USB_HCD_GET_STATS_2 \
+ CTL_CODE(FILE_DEVICE_USB, HCD_GET_STATS_2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+typedef struct _USB_HUB_CAPABILITIES {
+ ULONG HubIs2xCapable : 1;
+} USB_HUB_CAPABILITIES, *PUSB_HUB_CAPABILITIES;
+
+typedef enum _USB_CONNECTION_STATUS {
+ NoDeviceConnected,
+ DeviceConnected,
+ DeviceFailedEnumeration,
+ DeviceGeneralFailure,
+ DeviceCausedOvercurrent,
+ DeviceNotEnoughPower,
+ DeviceNotEnoughBandwidth,
+ DeviceHubNestedTooDeeply,
+ DeviceInLegacyHub
+} USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;
+
+typedef struct _USB_DESCRIPTOR_REQUEST {
+ ULONG ConnectionIndex;
+ struct {
+ UCHAR bmRequest;
+ UCHAR bRequest;
+ USHORT wValue;
+ USHORT wIndex;
+ USHORT wLength;
+ } SetupPacket;
+ UCHAR Data[0];
+} USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST;
+
+typedef struct _USB_HCD_DRIVERKEY_NAME {
+ ULONG ActualLength;
+ WCHAR DriverKeyName[1];
+} USB_HCD_DRIVERKEY_NAME, *PUSB_HCD_DRIVERKEY_NAME;
+
+typedef struct _HCD_ISO_STAT_COUNTERS {
+ USHORT LateUrbs;
+ USHORT DoubleBufferedPackets;
+ USHORT TransfersCF_5ms;
+ USHORT TransfersCF_2ms;
+ USHORT TransfersCF_1ms;
+ USHORT MaxInterruptLatency;
+ USHORT BadStartFrame;
+ USHORT StaleUrbs;
+ USHORT IsoPacketNotAccesed;
+ USHORT IsoPacketHWError;
+ USHORT SmallestUrbPacketCount;
+ USHORT LargestUrbPacketCount;
+ USHORT IsoCRC_Error;
+ USHORT IsoOVERRUN_Error;
+ USHORT IsoINTERNAL_Error;
+ USHORT IsoUNKNOWN_Error;
+ ULONG IsoBytesTransferred;
+ USHORT LateMissedCount;
+ USHORT HWIsoMissedCount;
+ ULONG Reserved7[8];
+} HCD_ISO_STAT_COUNTERS, *PHCD_ISO_STAT_COUNTERS;
+
+typedef struct _HCD_STAT_COUNTERS {
+ ULONG BytesTransferred;
+ USHORT IsoMissedCount;
+ USHORT DataOverrunErrorCount;
+ USHORT CrcErrorCount;
+ USHORT ScheduleOverrunCount;
+ USHORT TimeoutErrorCount;
+ USHORT InternalHcErrorCount;
+ USHORT BufferOverrunErrorCount;
+ USHORT SWErrorCount;
+ USHORT StallPidCount;
+ USHORT PortDisableCount;
+} HCD_STAT_COUNTERS, *PHCD_STAT_COUNTERS;
+
+typedef struct _HCD_STAT_INFORMATION_1 {
+ ULONG Reserved1;
+ ULONG Reserved2;
+ ULONG ResetCounters;
+ LARGE_INTEGER TimeRead;
+ HCD_STAT_COUNTERS Counters;
+} HCD_STAT_INFORMATION_1, *PHCD_STAT_INFORMATION_1;
+
+typedef struct _HCD_STAT_INFORMATION_2 {
+ ULONG Reserved1;
+ ULONG Reserved2;
+ ULONG ResetCounters;
+ LARGE_INTEGER TimeRead;
+ LONG LockedMemoryUsed;
+ HCD_STAT_COUNTERS Counters;
+ HCD_ISO_STAT_COUNTERS IsoCounters;
+} HCD_STAT_INFORMATION_2, *PHCD_STAT_INFORMATION_2;
+
+typedef struct _USB_HUB_INFORMATION {
+ USB_HUB_DESCRIPTOR HubDescriptor;
+ BOOLEAN HubIsBusPowered;
+} USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION;
+
+typedef struct _USB_HUB_NAME {
+ ULONG ActualLength;
+ WCHAR HubName[1];
+} USB_HUB_NAME, *PUSB_HUB_NAME;
+
+typedef enum _USB_HUB_NODE {
+ UsbHub,
+ UsbMIParent
+} USB_HUB_NODE;
+
+typedef VOID STDCALL
+(*USB_IDLE_CALLBACK)(
+ PVOID Context);
+
+typedef struct _USB_IDLE_CALLBACK_INFO {
+ USB_IDLE_CALLBACK IdleCallback;
+ PVOID IdleContext;
+} USB_IDLE_CALLBACK_INFO, *PUSB_IDLE_CALLBACK_INFO;
+
+typedef struct _USB_NODE_CONNECTION_ATTRIBUTES {
+ ULONG ConnectionIndex;
+ USB_CONNECTION_STATUS ConnectionStatus;
+ ULONG PortAttributes;
+} USB_NODE_CONNECTION_ATTRIBUTES, *PUSB_NODE_CONNECTION_ATTRIBUTES;
+
+typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME {
+ ULONG ConnectionIndex;
+ ULONG ActualLength;
+ WCHAR DriverKeyName[1];
+} USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME;
+
+typedef struct _USB_PIPE_INFO {
+ USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
+ ULONG ScheduleOffset;
+} USB_PIPE_INFO, *PUSB_PIPE_INFO;
+
+typedef struct _USB_NODE_CONNECTION_INFORMATION {
+ ULONG ConnectionIndex;
+ USB_DEVICE_DESCRIPTOR DeviceDescriptor;
+ UCHAR CurrentConfigurationValue;
+ BOOLEAN LowSpeed;
+ BOOLEAN DeviceIsHub;
+ USHORT DeviceAddress;
+ ULONG NumberOfOpenPipes;
+ USB_CONNECTION_STATUS ConnectionStatus;
+ USB_PIPE_INFO PipeList[0];
+} USB_NODE_CONNECTION_INFORMATION, *PUSB_NODE_CONNECTION_INFORMATION;
+
+typedef struct _USB_NODE_CONNECTION_NAME {
+ ULONG ConnectionIndex;
+ ULONG ActualLength;
+ WCHAR NodeName[1];
+} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
+
+typedef struct _USB_MI_PARENT_INFORMATION {
+ ULONG NumberOfInterfaces;
+} USB_MI_PARENT_INFORMATION, *PUSB_MI_PARENT_INFORMATION;
+
+typedef struct _USB_NODE_INFORMATION {
+ USB_HUB_NODE NodeType;
+ union {
+ USB_HUB_INFORMATION HubInformation;
+ USB_MI_PARENT_INFORMATION MiParentInformation;
+ } u;
+} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;
+
+#define WMI_USB_DRIVER_INFORMATION 0
+#define WMI_USB_DRIVER_NOTIFICATION 1
+#define WMI_USB_POWER_DEVICE_ENABLE 2
+
+typedef enum _USB_NOTIFICATION_TYPE {
+ EnumerationFailure = 0,
+ InsufficentBandwidth,
+ InsufficentPower,
+ OverCurrent,
+ ResetOvercurrent,
+ AcquireBusInfo,
+ AcquireHubName,
+ AcquireControllerName,
+ HubOvercurrent,
+ HubPowerChange,
+ HubNestedTooDeeply,
+ ModernDeviceInLegacyHub
+} USB_NOTIFICATION_TYPE;
+
+typedef struct _USB_ACQUIRE_INFO {
+ USB_NOTIFICATION_TYPE NotificationType;
+ ULONG TotalSize;
+ WCHAR Buffer[1];
+} USB_ACQUIRE_INFO, *PUSB_ACQUIRE_INFO;
+
+typedef struct _USB_NOTIFICATION {
+ USB_NOTIFICATION_TYPE NotificationType;
+} USB_NOTIFICATION, *PUSB_NOTIFICATION;
+
+typedef struct _USB_BUS_NOTIFICATION {
+ USB_NOTIFICATION_TYPE NotificationType;
+ ULONG TotalBandwidth;
+ ULONG ConsumedBandwidth;
+ ULONG ControllerNameLength;
+} USB_BUS_NOTIFICATION, *PUSB_BUS_NOTIFICATION;
+
+typedef struct _USB_CONNECTION_NOTIFICATION {
+ USB_NOTIFICATION_TYPE NotificationType;
+ ULONG ConnectionNumber;
+ ULONG RequestedBandwidth;
+ ULONG EnumerationFailReason;
+ ULONG PowerRequested;
+ ULONG HubNameLength;
+} USB_CONNECTION_NOTIFICATION, *PUSB_CONNECTION_NOTIFICATION;
+
+typedef struct _USB_ROOT_HUB_NAME {
+ ULONG ActualLength;
+ WCHAR RootHubName[1];
+} USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USBIOCTL_H */
--- /dev/null
+/*
+ * usbiodef.h
+ *
+ * USB IOCTL definitions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USBIODEF_H
+#define __USBIODEF_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+DEFINE_GUID(GUID_DEVINTERFACE_USB_HUB, \
+ 0xf18a0e88, 0xc30c, 0x11d0, 0x88, 0x15, 0x00, 0xa0, 0xc9, 0x06, 0xbe, 0xd8);
+
+DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE,
+ 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED);
+
+DEFINE_GUID(GUID_DEVINTERFACE_USB_HOST_CONTROLLER,
+ 0x3abf6f2d, 0x71c4, 0x462a, 0x8a, 0x92, 0x1e, 0x68, 0x61, 0xe6, 0xaf, 0x27);
+
+DEFINE_GUID(GUID_USB_WMI_STD_DATA,
+ 0x4E623B20L, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2);
+
+DEFINE_GUID(GUID_USB_WMI_STD_NOTIFICATION,
+ 0x4E623B20L, 0xCB14, 0x11D1, 0xB3, 0x31, 0x00, 0xA0, 0xC9, 0x59, 0xBB, 0xD2);
+
+#define GUID_CLASS_USBHUB GUID_DEVINTERFACE_USB_HUB
+#define GUID_CLASS_USB_DEVICE GUID_DEVINTERFACE_USB_DEVICE
+#define GUID_CLASS_USB_HOST_CONTROLLER GUID_DEVINTERFACE_USB_HOST_CONTROLLER
+
+#define USB_SUBMIT_URB 0
+#define USB_RESET_PORT 1
+#define USB_GET_ROOTHUB_PDO 3
+#define USB_GET_PORT_STATUS 4
+#define USB_ENABLE_PORT 5
+#define USB_GET_HUB_COUNT 6
+#define USB_CYCLE_PORT 7
+#define USB_GET_HUB_NAME 8
+#define USB_IDLE_NOTIFICATION 9
+#define USB_GET_BUS_INFO 264
+#define USB_GET_CONTROLLER_NAME 265
+#define USB_GET_BUSGUID_INFO 266
+#define USB_GET_PARENT_HUB_INFO 267
+#define USB_GET_DEVICE_HANDLE 268
+
+#define HCD_GET_STATS_1 255
+#define HCD_DIAGNOSTIC_MODE_ON 256
+#define HCD_DIAGNOSTIC_MODE_OFF 257
+#define HCD_GET_ROOT_HUB_NAME 258
+#define HCD_GET_DRIVERKEY_NAME 265
+#define HCD_GET_STATS_2 266
+#define HCD_DISABLE_PORT 268
+#define HCD_ENABLE_PORT 269
+#define HCD_USER_REQUEST 270
+
+#define USB_GET_NODE_INFORMATION 258
+#define USB_GET_NODE_CONNECTION_INFORMATION 259
+#define USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION 260
+#define USB_GET_NODE_CONNECTION_NAME 261
+#define USB_DIAG_IGNORE_HUBS_ON 262
+#define USB_DIAG_IGNORE_HUBS_OFF 263
+#define USB_GET_NODE_CONNECTION_DRIVERKEY_NAME 264
+#define USB_GET_HUB_CAPABILITIES 271
+#define USB_GET_NODE_CONNECTION_ATTRIBUTES 272
+
+#define FILE_DEVICE_USB FILE_DEVICE_UNKNOWN
+
+#define USB_CTL(id) CTL_CODE(FILE_DEVICE_USB, \
+ (id), \
+ METHOD_BUFFERED, \
+ FILE_ANY_ACCESS)
+
+#define USB_KERNEL_CTL(id) CTL_CODE(FILE_DEVICE_USB, \
+ (id), \
+ METHOD_NEITHER, \
+ FILE_ANY_ACCESS)
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USBIODEF_H */
--- /dev/null
+/*
+ * usbscan.h
+ *
+ * USB scanner definitions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USBSCAN_H
+#define __USBSCAN_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+
+
+#define FILE_DEVICE_USB_SCAN 0x8000
+#define IOCTL_INDEX 0x0800
+
+#define IOCTL_CANCEL_IO \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 1, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_GET_VERSION \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 0, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_GET_CHANNEL_ALIGN_RQST \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 5, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_GET_DEVICE_DESCRIPTOR \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 6, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_GET_PIPE_CONFIGURATION \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 10,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_GET_USB_DESCRIPTOR \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 8, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_READ_REGISTERS \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 3, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_RESET_PIPE \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 7, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_SEND_USB_REQUEST \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 9, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_SET_TIMEOUT \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 11,METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_WAIT_ON_DEVICE_EVENT \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 2, METHOD_BUFFERED,FILE_ANY_ACCESS)
+
+#define IOCTL_WRITE_REGISTERS \
+ CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+#define MAX_NUM_PIPES 8
+
+#define BULKIN_FLAG 0x80
+
+typedef struct _CHANNEL_INFO {
+ OUT ULONG EventChannelSize;
+ OUT ULONG uReadDataAlignment;
+ OUT ULONG uWriteDataAlignment;
+}CHANNEL_INFO, *PCHANNEL_INFO;
+
+typedef struct _DEVICE_DESCRIPTOR {
+ OUT USHORT usVendorId;
+ OUT USHORT usProductId;
+ OUT USHORT usBcdDevice;
+ OUT USHORT usLanguageId;
+} DEVICE_DESCRIPTOR, *PDEVICE_DESCRIPTOR;
+
+typedef struct _DRV_VERSION {
+ OUT ULONG major;
+ OUT ULONG minor;
+ OUT ULONG internal;
+} DRV_VERSION, *PDRV_VERSION;
+
+typedef struct _IO_BLOCK {
+ IN ULONG uOffset;
+ IN ULONG uLength;
+ IN OUT PUCHAR pbyData;
+ IN ULONG uIndex;
+} IO_BLOCK, *PIO_BLOCK;
+
+typedef struct _IO_BLOCK_EX {
+ IN ULONG uOffset;
+ IN ULONG uLength;
+ IN OUT PUCHAR pbyData;
+ IN ULONG uIndex;
+ IN UCHAR bRequest;
+ IN UCHAR bmRequestType;
+ IN UCHAR fTransferDirectionIn;
+} IO_BLOCK_EX, *PIO_BLOCK_EX;
+
+typedef struct _USBSCAN_GET_DESCRIPTOR {
+ IN UCHAR DescriptorType;
+ IN UCHAR Index;
+ IN USHORT LanguageId;
+} USBSCAN_GET_DESCRIPTOR, *PUSBSCAN_GET_DESCRIPTOR;
+
+typedef enum _RAW_PIPE_TYPE {
+ USBSCAN_PIPE_CONTROL,
+ USBSCAN_PIPE_ISOCHRONOUS,
+ USBSCAN_PIPE_BULK,
+ USBSCAN_PIPE_INTERRUPT
+} RAW_PIPE_TYPE;
+
+typedef struct _USBSCAN_PIPE_INFORMATION {
+ USHORT MaximumPacketSize;
+ UCHAR EndpointAddress;
+ UCHAR Interval;
+ RAW_PIPE_TYPE PipeType;
+} USBSCAN_PIPE_INFORMATION, *PUSBSCAN_PIPE_INFORMATION;
+
+typedef struct _USBSCAN_PIPE_CONFIGURATION {
+ OUT ULONG NumberOfPipes;
+ OUT USBSCAN_PIPE_INFORMATION PipeInfo[MAX_NUM_PIPES];
+} USBSCAN_PIPE_CONFIGURATION, *PUSBSCAN_PIPE_CONFIGURATION;
+
+typedef struct _USBSCAN_TIMEOUT {
+ IN ULONG TimeoutRead;
+ IN ULONG TimeoutWrite;
+ IN ULONG TimeoutEvent;
+} USBSCAN_TIMEOUT, *PUSBSCAN_TIMEOUT;
+
+typedef enum _PIPE_TYPE {
+ EVENT_PIPE,
+ READ_DATA_PIPE,
+ WRITE_DATA_PIPE,
+ ALL_PIPE
+} PIPE_TYPE;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USBSCAN_H */
--- /dev/null
+/*
+ * usbuser.h
+ *
+ * USB user mode IOCTL interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __USBUSER_H
+#define __USBUSER_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push,4)
+
+#include "ntddk.h"
+#include "usb.h"
+#include "usbiodef.h"
+
+
+#define USBUSER_VERSION 0x0004
+
+#define IOCTL_USB_USER_REQUEST USB_CTL(HCD_USER_REQUEST)
+
+#ifndef IOCTL_USB_DIAGNOSTIC_MODE_ON
+#define IOCTL_USB_DIAGNOSTIC_MODE_ON USB_CTL(HCD_DIAGNOSTIC_MODE_ON)
+#endif
+#ifndef IOCTL_USB_DIAGNOSTIC_MODE_OFF
+#define IOCTL_USB_DIAGNOSTIC_MODE_OFF USB_CTL(HCD_DIAGNOSTIC_MODE_OFF)
+#endif
+
+#ifndef IOCTL_USB_GET_ROOT_HUB_NAME
+#define IOCTL_USB_GET_ROOT_HUB_NAME USB_CTL(HCD_GET_ROOT_HUB_NAME)
+#endif
+#ifndef IOCTL_GET_HCD_DRIVERKEY_NAME
+#define IOCTL_GET_HCD_DRIVERKEY_NAME USB_CTL(HCD_GET_DRIVERKEY_NAME)
+#endif
+
+typedef enum _USB_USER_ERROR_CODE {
+ UsbUserSuccess = 0,
+ UsbUserNotSupported,
+ UsbUserInvalidRequestCode,
+ UsbUserFeatureDisabled,
+ UsbUserInvalidHeaderParameter,
+ UsbUserInvalidParameter,
+ UsbUserMiniportError,
+ UsbUserBufferTooSmall,
+ UsbUserErrorNotMapped,
+ UsbUserDeviceNotStarted,
+ UsbUserNoDeviceConnected
+} USB_USER_ERROR_CODE;
+
+#define USBUSER_GET_CONTROLLER_INFO_0 0x00000001
+#define USBUSER_GET_CONTROLLER_DRIVER_KEY 0x00000002
+#define USBUSER_PASS_THRU 0x00000003
+#define USBUSER_GET_POWER_STATE_MAP 0x00000004
+#define USBUSER_GET_BANDWIDTH_INFORMATION 0x00000005
+#define USBUSER_GET_BUS_STATISTICS_0 0x00000006
+#define USBUSER_GET_ROOTHUB_SYMBOLIC_NAME 0x00000007
+#define USBUSER_GET_USB_DRIVER_VERSION 0x00000008
+#define USBUSER_GET_USB2_HW_VERSION 0x00000009
+#define USBUSER_OP_SEND_ONE_PACKET 0x10000001
+#define USBUSER_OP_RAW_RESET_PORT 0x20000001
+#define USBUSER_OP_OPEN_RAW_DEVICE 0x20000002
+#define USBUSER_OP_CLOSE_RAW_DEVICE 0x20000003
+#define USBUSER_OP_SEND_RAW_COMMAND 0x20000004
+#define USBUSER_INVALID_REQUEST 0xFFFFFFF0
+#define USBUSER_OP_MASK_DEVONLY_API 0x10000000
+#define USBUSER_OP_MASK_HCTEST_API 0x20000000
+
+#define USB_PACKETFLAG_LOW_SPEED 0x00000001
+#define USB_PACKETFLAG_FULL_SPEED 0x00000002
+#define USB_PACKETFLAG_HIGH_SPEED 0x00000004
+#define USB_PACKETFLAG_ASYNC_IN 0x00000008
+#define USB_PACKETFLAG_ASYNC_OUT 0x00000010
+#define USB_PACKETFLAG_ISO_IN 0x00000020
+#define USB_PACKETFLAG_ISO_OUT 0x00000040
+#define USB_PACKETFLAG_SETUP 0x00000080
+#define USB_PACKETFLAG_TOGGLE0 0x00000100
+#define USB_PACKETFLAG_TOGGLE1 0x00000200
+
+typedef struct _PACKET_PARAMETERS {
+ UCHAR DeviceAddress;
+ UCHAR EndpointAddress;
+ USHORT MaximumPacketSize;
+ ULONG Timeout;
+ ULONG Flags;
+ ULONG DataLength;
+ USHORT HubDeviceAddress;
+ USHORT PortTTNumber;
+ UCHAR ErrorCount;
+ UCHAR Pad[3];
+ USBD_STATUS UsbdStatusCode;
+ UCHAR Data[4];
+} PACKET_PARAMETERS, *PPACKET_PARAMETERS;
+
+typedef struct _RAW_RESET_PORT_PARAMETERS {
+ USHORT PortNumber;
+ USHORT PortStatus;
+} RAW_RESET_PORT_PARAMETERS, *PRAW_RESET_PORT_PARAMETERS;
+
+typedef struct _USB_BANDWIDTH_INFO {
+ ULONG DeviceCount;
+ ULONG TotalBusBandwidth;
+ ULONG Total32secBandwidth;
+ ULONG AllocedBulkAndControl;
+ ULONG AllocedIso;
+ ULONG AllocedInterrupt_1ms;
+ ULONG AllocedInterrupt_2ms;
+ ULONG AllocedInterrupt_4ms;
+ ULONG AllocedInterrupt_8ms;
+ ULONG AllocedInterrupt_16ms;
+ ULONG AllocedInterrupt_32ms;
+} USB_BANDWIDTH_INFO, *PUSB_BANDWIDTH_INFO;
+
+typedef struct _USBUSER_REQUEST_HEADER {
+ ULONG UsbUserRequest;
+ USB_USER_ERROR_CODE UsbUserStatusCode;
+ ULONG RequestBufferLength;
+ ULONG ActualBufferLength;
+} USBUSER_REQUEST_HEADER, *PUSBUSER_REQUEST_HEADER;
+
+typedef struct _USBUSER_BANDWIDTH_INFO_REQUEST {
+ USBUSER_REQUEST_HEADER Header;
+ USB_BANDWIDTH_INFO BandwidthInformation;
+} USBUSER_BANDWIDTH_INFO_REQUEST, *PUSBUSER_BANDWIDTH_INFO_REQUEST;
+
+typedef struct _USB_BUS_STATISTICS_0 {
+ ULONG DeviceCount;
+ LARGE_INTEGER CurrentSystemTime;
+ ULONG CurrentUsbFrame;
+ ULONG BulkBytes;
+ ULONG IsoBytes;
+ ULONG InterruptBytes;
+ ULONG ControlDataBytes;
+ ULONG PciInterruptCount;
+ ULONG HardResetCount;
+ ULONG WorkerSignalCount;
+ ULONG CommonBufferBytes;
+ ULONG WorkerIdleTimeMs;
+ BOOLEAN RootHubEnabled;
+ UCHAR RootHubDevicePowerState;
+ UCHAR Unused;
+ UCHAR NameIndex;
+} USB_BUS_STATISTICS_0, *PUSB_BUS_STATISTICS_0;
+
+typedef struct _USBUSER_BUS_STATISTICS_0_REQUEST {
+ USBUSER_REQUEST_HEADER Header;
+ USB_BUS_STATISTICS_0 BusStatistics0;
+} USBUSER_BUS_STATISTICS_0_REQUEST, *PUSBUSER_BUS_STATISTICS_0_REQUEST;
+
+/* USB_CONTROLLER_INFO_0.HcFeatureFlags constants */
+#define USB_HC_FEATURE_FLAG_PORT_POWER_SWITCHING 0x00000001
+#define USB_HC_FEATURE_FLAG_SEL_SUSPEND 0x00000002
+#define USB_HC_FEATURE_LEGACY_BIOS 0x00000004
+
+typedef struct _USB_CLOSE_RAW_DEVICE_PARAMETERS {
+ ULONG xxx;
+} USB_CLOSE_RAW_DEVICE_PARAMETERS , *PUSB_CLOSE_RAW_DEVICE_PARAMETERS;
+
+typedef struct _USBUSER_CLOSE_RAW_DEVICE {
+ USBUSER_REQUEST_HEADER Header;
+ USB_CLOSE_RAW_DEVICE_PARAMETERS Parameters;
+} USBUSER_CLOSE_RAW_DEVICE, *PUSBUSER_CLOSE_RAW_DEVICE;
+
+typedef struct _USB_CONTROLLER_INFO_0 {
+ ULONG PciVendorId;
+ ULONG PciDeviceId;
+ ULONG PciRevision;
+ ULONG NumberOfRootPorts;
+ USB_CONTROLLER_FLAVOR ControllerFlavor;
+ ULONG HcFeatureFlags;
+} USB_CONTROLLER_INFO_0 , *PUSB_CONTROLLER_INFO_0;
+
+typedef struct _USBUSER_CONTROLLER_INFO_0 {
+ USBUSER_REQUEST_HEADER Header;
+ USB_CONTROLLER_INFO_0 Info0;
+} USBUSER_CONTROLLER_INFO_0, *PUSBUSER_CONTROLLER_INFO_0;
+
+typedef struct _USB_DRIVER_VERSION_PARAMETERS {
+ ULONG DriverTrackingCode;
+ ULONG USBDI_Version;
+ ULONG USBUSER_Version;
+ BOOLEAN CheckedPortDriver;
+ BOOLEAN CheckedMiniportDriver;
+ USHORT USB_Version;
+} USB_DRIVER_VERSION_PARAMETERS , *PUSB_DRIVER_VERSION_PARAMETERS;
+
+typedef struct _USBUSER_GET_DRIVER_VERSION {
+ USBUSER_REQUEST_HEADER Header;
+ USB_DRIVER_VERSION_PARAMETERS Parameters;
+} USBUSER_GET_DRIVER_VERSION, *PUSBUSER_GET_DRIVER_VERSION;
+
+typedef struct _USB_OPEN_RAW_DEVICE_PARAMETERS {
+ USHORT PortStatus;
+ USHORT MaxPacketEp0;
+} USB_OPEN_RAW_DEVICE_PARAMETERS , *PUSB_OPEN_RAW_DEVICE_PARAMETERS;
+
+typedef struct _USBUSER_OPEN_RAW_DEVICE {
+ USBUSER_REQUEST_HEADER Header;
+ USB_OPEN_RAW_DEVICE_PARAMETERS Parameters;
+} USBUSER_OPEN_RAW_DEVICE, *PUSBUSER_OPEN_RAW_DEVICE;
+
+typedef enum _WDMUSB_POWER_STATE {
+ WdmUsbPowerNotMapped = 0,
+ WdmUsbPowerSystemUnspecified = 100,
+ WdmUsbPowerSystemWorking,
+ WdmUsbPowerSystemSleeping1,
+ WdmUsbPowerSystemSleeping2,
+ WdmUsbPowerSystemSleeping3,
+ WdmUsbPowerSystemHibernate,
+ WdmUsbPowerSystemShutdown,
+ WdmUsbPowerDeviceUnspecified = 200,
+ WdmUsbPowerDeviceD0,
+ WdmUsbPowerDeviceD1,
+ WdmUsbPowerDeviceD2,
+ WdmUsbPowerDeviceD3
+} WDMUSB_POWER_STATE;
+
+typedef struct _USB_POWER_INFO {
+ WDMUSB_POWER_STATE SystemState;
+ WDMUSB_POWER_STATE HcDevicePowerState;
+ WDMUSB_POWER_STATE HcDeviceWake;
+ WDMUSB_POWER_STATE HcSystemWake;
+ WDMUSB_POWER_STATE RhDevicePowerState;
+ WDMUSB_POWER_STATE RhDeviceWake;
+ WDMUSB_POWER_STATE RhSystemWake;
+ WDMUSB_POWER_STATE LastSystemSleepState;
+ BOOLEAN CanWakeup;
+ BOOLEAN IsPowered;
+} USB_POWER_INFO, *PUSB_POWER_INFO;
+
+typedef struct _USBUSER_POWER_INFO_REQUEST {
+ USBUSER_REQUEST_HEADER Header;
+ USB_POWER_INFO PowerInformation;
+} USBUSER_POWER_INFO_REQUEST, *PUSBUSER_POWER_INFO_REQUEST;
+
+typedef struct _USB_UNICODE_NAME {
+ ULONG Length;
+ WCHAR String[1];
+} USB_UNICODE_NAME, *PUSB_UNICODE_NAME;
+
+typedef struct _USBUSER_CONTROLLER_UNICODE_NAME {
+ USBUSER_REQUEST_HEADER Header;
+ USB_UNICODE_NAME UnicodeName;
+} USBUSER_CONTROLLER_UNICODE_NAME, *PUSBUSER_CONTROLLER_UNICODE_NAME;
+
+typedef struct _USB_PASS_THRU_PARAMETERS {
+ GUID FunctionGUID;
+ ULONG ParameterLength;
+ UCHAR Parameters[4];
+} USB_PASS_THRU_PARAMETERS, *PUSB_PASS_THRU_PARAMETERS;
+
+typedef struct _USBUSER_PASS_THRU_REQUEST {
+ USBUSER_REQUEST_HEADER Header;
+ USB_PASS_THRU_PARAMETERS PassThru;
+} USBUSER_PASS_THRU_REQUEST, *PUSBUSER_PASS_THRU_REQUEST;
+
+typedef struct _USBUSER_RAW_RESET_ROOT_PORT {
+ USBUSER_REQUEST_HEADER Header;
+ RAW_RESET_PORT_PARAMETERS Parameters;
+} USBUSER_RAW_RESET_ROOT_PORT, *PUSBUSER_RAW_RESET_ROOT_PORT;
+
+typedef struct _USBUSER_SEND_ONE_PACKET {
+ USBUSER_REQUEST_HEADER Header;
+ PACKET_PARAMETERS PacketParameters;
+} USBUSER_SEND_ONE_PACKET, *PUSBUSER_SEND_ONE_PACKET;
+
+typedef struct _USB_SEND_RAW_COMMAND_PARAMETERS {
+ UCHAR Usb_bmRequest;
+ UCHAR Usb_bRequest;
+ USHORT Usb_wVlaue;
+ USHORT Usb_wIndex;
+ USHORT Usb_wLength;
+ USHORT DeviceAddress;
+ USHORT MaximumPacketSize;
+ ULONG Timeout;
+ ULONG DataLength;
+ USBD_STATUS UsbdStatusCode;
+ UCHAR Data[4];
+} USB_SEND_RAW_COMMAND_PARAMETERS, *PUSB_SEND_RAW_COMMAND_PARAMETERS;
+
+typedef struct _USBUSER_SEND_RAW_COMMAND {
+ USBUSER_REQUEST_HEADER Header;
+ USB_SEND_RAW_COMMAND_PARAMETERS Parameters;
+} USBUSER_SEND_RAW_COMMAND, *PUSBUSER_SEND_RAW_COMMAND;
+
+/* USB_USB2HW_VERSION_PARAMETERS.Usb2HwRevision constants */
+#define USB2HW_UNKNOWN 0x00
+#define USB2HW_A0 0xA0
+#define USB2HW_A1 0xA1
+#define USB2HW_B0 0xB0
+
+typedef struct _USB_USB2HW_VERSION_PARAMETERS {
+ UCHAR Usb2HwRevision;
+} USB_USB2HW_VERSION_PARAMETERS, *PUSB_USB2HW_VERSION_PARAMETERS;
+
+typedef struct _USBUSER_GET_USB2HW_VERSION {
+ USBUSER_REQUEST_HEADER Header;
+ USB_USB2HW_VERSION_PARAMETERS Parameters;
+} USBUSER_GET_USB2HW_VERSION, *PUSBUSER_GET_USB2HW_VERSION;
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __USBUSER_H */
--- /dev/null
+/*
+ * video.h
+ *
+ * Video port and miniport driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __VIDEO_H
+#define __VIDEO_H
+
+#ifdef __WINDDI_H
+#error winddi.h cannot be included with video.h
+#endif
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ntddk.h"
+
+#if defined(_VIDEOPORT_)
+ #define VPAPI DECLSPEC_EXPORT
+#else
+ #define VPAPI DECLSPEC_IMPORT
+#endif
+
+#include "videoagp.h"
+#include "ntddvdeo.h"
+
+
+typedef LONG VP_STATUS;
+typedef VP_STATUS *PVP_STATUS;
+typedef struct __DMA_PARAMETERS * PDMA;
+typedef struct _VIDEO_PORT_EVENT *PEVENT;
+typedef struct _VIDEO_PORT_SPIN_LOCK *PSPIN_LOCK;
+typedef struct __VP_DMA_ADAPTER *PVP_DMA_ADAPTER;
+
+#define DISPLAY_ADAPTER_HW_ID 0xFFFFFFFF
+
+#define EVENT_TYPE_MASK 1
+#define SYNCHRONIZATION_EVENT 0
+#define NOTIFICATION_EVENT 1
+
+#define INITIAL_EVENT_STATE_MASK 2
+#define INITIAL_EVENT_NOT_SIGNALED 0
+#define INITIAL_EVENT_SIGNALED 2
+
+typedef enum VIDEO_DEBUG_LEVEL {
+ Error = 0,
+ Warn,
+ Trace,
+ Info
+} VIDEO_DEBUG_LEVEL, *PVIDEO_DEBUG_LEVEL;
+
+typedef enum {
+ VideoPortUnlockAfterDma = 1,
+ VideoPortKeepPagesLocked,
+ VideoPortDmaInitOnly
+} DMA_FLAGS;
+
+typedef enum _HW_DMA_RETURN {
+ DmaAsyncReturn,
+ DmaSyncReturn
+} HW_DMA_RETURN, *PHW_DMA_RETURN;
+
+typedef HW_DMA_RETURN
+(*PVIDEO_HW_START_DMA)(
+ PVOID HwDeviceExtension,
+ PDMA pDma);
+
+
+#if DBG
+
+#define PAGED_CODE() \
+ if (VideoPortGetCurrentIrql() > 1 /* APC_LEVEL */) \
+ { \
+ VideoPortDebugPrint(Error, "Video: Pageable code called at IRQL %d\n", VideoPortGetCurrentIrql() ); \
+ assert(FALSE); \
+ }
+
+#else
+
+#define PAGED_CODE()
+
+#endif
+
+typedef struct _VIDEO_HARDWARE_CONFIGURATION_DATA {
+ INTERFACE_TYPE InterfaceType;
+ ULONG BusNumber;
+ USHORT Version;
+ USHORT Revision;
+ USHORT Irql;
+ USHORT Vector;
+ ULONG ControlBase;
+ ULONG ControlSize;
+ ULONG CursorBase;
+ ULONG CursorSize;
+ ULONG FrameBase;
+ ULONG FrameSize;
+} VIDEO_HARDWARE_CONFIGURATION_DATA, *PVIDEO_HARDWARE_CONFIGURATION_DATA;
+
+#define SIZE_OF_NT4_VIDEO_PORT_CONFIG_INFO 0x42
+#define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA 0x28
+#define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA 0x50
+
+typedef enum _VIDEO_DEVICE_DATA_TYPE {
+ VpMachineData = 0,
+ VpCmosData,
+ VpBusData,
+ VpControllerData,
+ VpMonitorData
+} VIDEO_DEVICE_DATA_TYPE, *PVIDEO_DEVICE_DATA_TYPE;
+
+
+
+/* Video miniport driver functions */
+
+typedef struct _VP_SCATTER_GATHER_ELEMENT {
+ PHYSICAL_ADDRESS Address;
+ ULONG Length;
+ ULONG_PTR Reserved;
+} VP_SCATTER_GATHER_ELEMENT, *PVP_SCATTER_GATHER_ELEMENT;
+
+typedef struct _VP_SCATTER_GATHER_LIST {
+ ULONG NumberOfElements;
+ ULONG_PTR Reserved;
+ VP_SCATTER_GATHER_ELEMENT Elements[0];
+} VP_SCATTER_GATHER_LIST, *PVP_SCATTER_GATHER_LIST;
+
+typedef VOID DDKAPI
+(*PEXECUTE_DMA)(
+ IN PVOID HwDeviceExtension,
+ IN PVP_DMA_ADAPTER VpDmaAdapter,
+ IN PVP_SCATTER_GATHER_LIST SGList,
+ IN PVOID Context);
+
+typedef PVOID DDKAPI
+(*PVIDEO_PORT_GET_PROC_ADDRESS)(
+ IN PVOID HwDeviceExtension,
+ IN PUCHAR FunctionName);
+
+typedef struct _VIDEO_PORT_CONFIG_INFO {
+ ULONG Length;
+ ULONG SystemIoBusNumber;
+ INTERFACE_TYPE AdapterInterfaceType;
+ ULONG BusInterruptLevel;
+ ULONG BusInterruptVector;
+ KINTERRUPT_MODE InterruptMode;
+ ULONG NumEmulatorAccessEntries;
+ PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries;
+ ULONG_PTR EmulatorAccessEntriesContext;
+ PHYSICAL_ADDRESS VdmPhysicalVideoMemoryAddress;
+ ULONG VdmPhysicalVideoMemoryLength;
+ ULONG HardwareStateSize;
+ ULONG DmaChannel;
+ ULONG DmaPort;
+ UCHAR DmaShareable;
+ UCHAR InterruptShareable;
+ BOOLEAN Master;
+ DMA_WIDTH DmaWidth;
+ DMA_SPEED DmaSpeed;
+ BOOLEAN bMapBuffers;
+ BOOLEAN NeedPhysicalAddresses;
+ BOOLEAN DemandMode;
+ ULONG MaximumTransferLength;
+ ULONG NumberOfPhysicalBreaks;
+ BOOLEAN ScatterGather;
+ ULONG MaximumScatterGatherChunkSize;
+ PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress;
+ PWSTR DriverRegistryPath;
+ ULONGLONG SystemMemorySize;
+} VIDEO_PORT_CONFIG_INFO, *PVIDEO_PORT_CONFIG_INFO;
+
+typedef VP_STATUS DDKAPI
+(*PVIDEO_HW_FIND_ADAPTER)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID HwContext,
+ IN PWSTR ArgumentString,
+ IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
+ OUT PUCHAR Again);
+
+typedef VP_STATUS DDKAPI
+(*PVIDEO_HW_POWER_GET)(
+ IN PVOID HwDeviceExtension,
+ IN ULONG HwId,
+ IN OUT PVIDEO_POWER_MANAGEMENT VideoPowerControl);
+
+/* PVIDEO_HW_GET_CHILD_DESCRIPTOR return values */
+#define VIDEO_ENUM_MORE_DEVICES ERROR_CONTINUE
+#define VIDEO_ENUM_NO_MORE_DEVICES ERROR_NO_MORE_DEVICES
+#define VIDEO_ENUM_INVALID_DEVICE ERROR_INVALID_NAME
+
+/* PVIDEO_HW_GET_CHILD_DESCRIPTOR.ChildEnumInfo constants */
+typedef struct _VIDEO_CHILD_ENUM_INFO {
+ ULONG Size;
+ ULONG ChildDescriptorSize;
+ ULONG ChildIndex;
+ ULONG ACPIHwId;
+ PVOID ChildHwDeviceExtension;
+} VIDEO_CHILD_ENUM_INFO, *PVIDEO_CHILD_ENUM_INFO;
+
+/* PVIDEO_HW_GET_CHILD_DESCRIPTOR.VideoChildType constants */
+typedef enum _VIDEO_CHILD_TYPE {
+ Monitor = 1,
+ NonPrimaryChip,
+ VideoChip,
+ Other
+} VIDEO_CHILD_TYPE, *PVIDEO_CHILD_TYPE;
+
+typedef VP_STATUS DDKAPI
+(*PVIDEO_HW_GET_CHILD_DESCRIPTOR)(
+ IN PVOID HwDeviceExtension,
+ IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
+ OUT PVIDEO_CHILD_TYPE VideoChildType,
+ OUT PUCHAR pChildDescriptor,
+ OUT PULONG UId,
+ OUT PULONG pUnused);
+
+typedef BOOLEAN DDKAPI
+(*PVIDEO_HW_INITIALIZE)(
+ IN PVOID HwDeviceExtension);
+
+typedef BOOLEAN DDKAPI
+(*PVIDEO_HW_INTERRUPT)(
+ IN PVOID HwDeviceExtension);
+
+/* VIDEO_ACCESS_RANGE.RangePassive */
+#define VIDEO_RANGE_PASSIVE_DECODE 1
+#define VIDEO_RANGE_10_BIT_DECODE 2
+
+typedef struct _VIDEO_ACCESS_RANGE {
+ PHYSICAL_ADDRESS RangeStart;
+ ULONG RangeLength;
+ UCHAR RangeInIoSpace;
+ UCHAR RangeVisible;
+ UCHAR RangeShareable;
+ UCHAR RangePassive;
+} VIDEO_ACCESS_RANGE, *PVIDEO_ACCESS_RANGE;
+
+typedef VOID DDKAPI
+(*PVIDEO_HW_LEGACYRESOURCES)(
+ IN ULONG VendorId,
+ IN ULONG DeviceId,
+ IN OUT PVIDEO_ACCESS_RANGE *LegacyResourceList,
+ IN OUT PULONG LegacyResourceCount);
+
+typedef VP_STATUS DDKAPI
+(*PMINIPORT_QUERY_DEVICE_ROUTINE)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Context,
+ IN VIDEO_DEVICE_DATA_TYPE DeviceDataType,
+ IN PVOID Identifier,
+ IN ULONG IdentifierLength,
+ IN PVOID ConfigurationData,
+ IN ULONG ConfigurationDataLength,
+ IN OUT PVOID ComponentInformation,
+ IN ULONG ComponentInformationLength);
+
+typedef struct _QUERY_INTERFACE {
+ CONST GUID *InterfaceType;
+ USHORT Size;
+ USHORT Version;
+ PINTERFACE Interface;
+ PVOID InterfaceSpecificData;
+} QUERY_INTERFACE, *PQUERY_INTERFACE;
+
+typedef VP_STATUS DDKAPI
+(*PVIDEO_HW_QUERY_INTERFACE)(
+ IN PVOID HwDeviceExtension,
+ IN OUT PQUERY_INTERFACE QueryInterface);
+
+typedef VP_STATUS DDKAPI
+(*PMINIPORT_GET_REGISTRY_ROUTINE)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Context,
+ IN OUT PWSTR ValueName,
+ IN OUT PVOID ValueData,
+ IN ULONG ValueLength);
+
+typedef BOOLEAN DDKAPI
+(*PVIDEO_HW_RESET_HW)(
+ IN PVOID HwDeviceExtension,
+ IN ULONG Columns,
+ IN ULONG Rows);
+
+typedef VP_STATUS DDKAPI
+(*PVIDEO_HW_POWER_SET)(
+ IN PVOID HwDeviceExtension,
+ IN ULONG HwId,
+ IN PVIDEO_POWER_MANAGEMENT VideoPowerControl);
+
+typedef struct _STATUS_BLOCK {
+ union {
+ VP_STATUS Status;
+ PVOID Pointer;
+ };
+ ULONG_PTR Information;
+} STATUS_BLOCK, *PSTATUS_BLOCK;
+
+typedef struct _VIDEO_REQUEST_PACKET {
+ ULONG IoControlCode;
+ PSTATUS_BLOCK StatusBlock;
+ PVOID InputBuffer;
+ ULONG InputBufferLength;
+ PVOID OutputBuffer;
+ ULONG OutputBufferLength;
+} VIDEO_REQUEST_PACKET, *PVIDEO_REQUEST_PACKET;
+
+typedef BOOLEAN DDKAPI
+(*PVIDEO_HW_START_IO)(
+ IN PVOID HwDeviceExtension,
+ IN PVIDEO_REQUEST_PACKET RequestPacket);
+
+typedef BOOLEAN DDKAPI
+(*PMINIPORT_SYNCHRONIZE_ROUTINE)(
+ IN PVOID Context);
+
+typedef VOID DDKAPI
+(*PVIDEO_HW_TIMER)(
+ IN PVOID HwDeviceExtension);
+
+typedef VOID DDKAPI
+(*PMINIPORT_DPC_ROUTINE)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Context);
+
+typedef VP_STATUS DDKAPI
+(*PDRIVER_IO_PORT_UCHAR)(
+ IN ULONG_PTR Context,
+ IN ULONG Port,
+ IN UCHAR AccessMode,
+ IN PUCHAR Data);
+
+typedef VP_STATUS DDKAPI
+(*PDRIVER_IO_PORT_UCHAR_STRING)(
+ IN ULONG_PTR Context,
+ IN ULONG Port,
+ IN UCHAR AccessMode,
+ IN PUCHAR Data,
+ IN ULONG DataLength);
+
+typedef VP_STATUS DDKAPI
+(*PDRIVER_IO_PORT_ULONG)(
+ IN ULONG_PTR Context,
+ IN ULONG Port,
+ IN UCHAR AccessMode,
+ IN PULONG Data);
+
+typedef VP_STATUS DDKAPI
+(*PDRIVER_IO_PORT_ULONG_STRING)(
+ IN ULONG_PTR Context,
+ IN ULONG Port,
+ IN UCHAR AccessMode,
+ IN PULONG Data,
+ IN ULONG DataLength);
+
+typedef VP_STATUS DDKAPI
+(*PDRIVER_IO_PORT_USHORT)(
+ IN ULONG_PTR Context,
+ IN ULONG Port,
+ IN UCHAR AccessMode,
+ IN PUSHORT Data);
+
+typedef VP_STATUS DDKAPI
+(*PDRIVER_IO_PORT_USHORT_STRING)(
+ IN ULONG_PTR Context,
+ IN ULONG Port,
+ IN UCHAR AccessMode,
+ IN PUSHORT Data,
+ IN ULONG DataLength);
+
+
+
+typedef struct _INT10_BIOS_ARGUMENTS {
+ ULONG Eax;
+ ULONG Ebx;
+ ULONG Ecx;
+ ULONG Edx;
+ ULONG Esi;
+ ULONG Edi;
+ ULONG Ebp;
+ USHORT SegDs;
+ USHORT SegEs;
+} INT10_BIOS_ARGUMENTS, *PINT10_BIOS_ARGUMENTS;
+
+typedef struct _VIDEO_CHILD_STATE {
+ ULONG Id;
+ ULONG State;
+} VIDEO_CHILD_STATE, *PVIDEO_CHILD_STATE;
+
+typedef struct _VIDEO_CHILD_STATE_CONFIGURATION {
+ ULONG Count;
+ VIDEO_CHILD_STATE ChildStateArray[ANYSIZE_ARRAY];
+} VIDEO_CHILD_STATE_CONFIGURATION, *PVIDEO_CHILD_STATE_CONFIGURATION;
+
+typedef struct _VIDEO_HW_INITIALIZATION_DATA {
+ ULONG HwInitDataSize;
+ INTERFACE_TYPE AdapterInterfaceType;
+ PVIDEO_HW_FIND_ADAPTER HwFindAdapter;
+ PVIDEO_HW_INITIALIZE HwInitialize;
+ PVIDEO_HW_INTERRUPT HwInterrupt;
+ PVIDEO_HW_START_IO HwStartIO;
+ ULONG HwDeviceExtensionSize;
+ ULONG StartingDeviceNumber;
+ PVIDEO_HW_RESET_HW HwResetHw;
+ PVIDEO_HW_TIMER HwTimer;
+ PVIDEO_HW_START_DMA HwStartDma;
+ PVIDEO_HW_POWER_SET HwSetPowerState;
+ PVIDEO_HW_POWER_GET HwGetPowerState;
+ PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor;
+ PVIDEO_HW_QUERY_INTERFACE HwQueryInterface;
+ ULONG HwChildDeviceExtensionSize;
+ PVIDEO_ACCESS_RANGE HwLegacyResourceList;
+ ULONG HwLegacyResourceCount;
+ PVIDEO_HW_LEGACYRESOURCES HwGetLegacyResources;
+ BOOLEAN AllowEarlyEnumeration;
+ ULONG Reserved;
+} VIDEO_HW_INITIALIZATION_DATA, *PVIDEO_HW_INITIALIZATION_DATA;
+
+/* VIDEO_PORT_AGP_INTERFACE.Version contants */
+#define VIDEO_PORT_AGP_INTERFACE_VERSION_1 1
+
+typedef struct _VIDEO_PORT_AGP_INTERFACE {
+ SHORT Size;
+ SHORT Version;
+ PVOID Context;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+ PAGP_RESERVE_PHYSICAL AgpReservePhysical;
+ PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
+ PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
+ PAGP_FREE_PHYSICAL AgpFreePhysical;
+ PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
+ PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
+ PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
+ PAGP_FREE_VIRTUAL AgpFreeVirtual;
+ ULONGLONG AgpAllocationLimit;
+} VIDEO_PORT_AGP_INTERFACE, *PVIDEO_PORT_AGP_INTERFACE;
+
+/* VIDEO_PORT_AGP_INTERFACE_2.Version constants */
+#define VIDEO_PORT_AGP_INTERFACE_VERSION_2 2
+
+typedef struct _VIDEO_PORT_AGP_INTERFACE_2 {
+ IN USHORT Size;
+ IN USHORT Version;
+ OUT PVOID Context;
+ OUT PINTERFACE_REFERENCE InterfaceReference;
+ OUT PINTERFACE_DEREFERENCE InterfaceDereference;
+ OUT PAGP_RESERVE_PHYSICAL AgpReservePhysical;
+ OUT PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
+ OUT PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
+ OUT PAGP_FREE_PHYSICAL AgpFreePhysical;
+ OUT PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
+ OUT PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
+ OUT PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
+ OUT PAGP_FREE_VIRTUAL AgpFreeVirtual;
+ OUT ULONGLONG AgpAllocationLimit;
+ OUT PAGP_SET_RATE AgpSetRate;
+} VIDEO_PORT_AGP_INTERFACE_2, *PVIDEO_PORT_AGP_INTERFACE_2;
+
+#define VIDEO_PORT_I2C_INTERFACE_VERSION_1 1
+
+typedef VOID DDKAPI
+(*PVIDEO_WRITE_CLOCK_LINE)(
+ PVOID HwDeviceExtension,
+ UCHAR Data);
+
+typedef VOID DDKAPI
+(*PVIDEO_WRITE_DATA_LINE)(
+ PVOID HwDeviceExtension,
+ UCHAR Data);
+
+typedef BOOLEAN DDKAPI
+(*PVIDEO_READ_CLOCK_LINE)(
+ PVOID HwDeviceExtension);
+
+typedef BOOLEAN DDKAPI
+(*PVIDEO_READ_DATA_LINE)(
+ PVOID HwDeviceExtension);
+
+typedef struct _I2C_CALLBACKS
+{
+ IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
+ IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
+ IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
+ IN PVIDEO_READ_DATA_LINE ReadDataLine;
+} I2C_CALLBACKS, *PI2C_CALLBACKS;
+
+typedef BOOLEAN DDKAPI
+(*PI2C_START)(
+ IN PVOID HwDeviceExtension,
+ IN PI2C_CALLBACKS I2CCallbacks);
+
+typedef BOOLEAN DDKAPI
+(*PI2C_STOP)(
+ IN PVOID HwDeviceExtension,
+ IN PI2C_CALLBACKS I2CCallbacks);
+
+typedef BOOLEAN DDKAPI
+(*PI2C_WRITE)(
+ IN PVOID HwDeviceExtension,
+ IN PI2C_CALLBACKS I2CCallbacks,
+ IN PUCHAR Buffer,
+ IN ULONG Length);
+
+typedef BOOLEAN DDKAPI
+(*PI2C_READ)(
+ IN PVOID HwDeviceExtension,
+ IN PI2C_CALLBACKS I2CCallbacks,
+ OUT PUCHAR Buffer,
+ IN ULONG Length);
+
+typedef struct _VIDEO_PORT_I2C_INTERFACE {
+ USHORT Size;
+ USHORT Version;
+ PVOID Context;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+ PI2C_START I2CStart;
+ PI2C_STOP I2CStop;
+ PI2C_WRITE I2CWrite;
+ PI2C_READ I2CRead;
+} VIDEO_PORT_I2C_INTERFACE, *PVIDEO_PORT_I2C_INTERFACE;
+
+/* VIDEO_PORT_INT10_INTERFACE.Version constants */
+#define VIDEO_PORT_INT10_INTERFACE_VERSION_1 1
+
+typedef VP_STATUS DDKAPI
+(*PINT10_ALLOCATE_BUFFER)(
+ IN PVOID Context,
+ OUT PUSHORT Seg,
+ OUT PUSHORT Off,
+ IN OUT PULONG Length);
+
+typedef VP_STATUS DDKAPI
+(*PINT10_CALL_BIOS)(
+ IN PVOID Context,
+ IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
+
+typedef VP_STATUS DDKAPI
+(*PINT10_FREE_BUFFER)(
+ IN PVOID Context,
+ IN USHORT Seg,
+ IN USHORT Off);
+
+typedef VP_STATUS DDKAPI
+(*PINT10_READ_MEMORY)(
+ IN PVOID Context,
+ IN USHORT Seg,
+ IN USHORT Off,
+ OUT PVOID Buffer,
+ IN ULONG Length);
+
+typedef VP_STATUS DDKAPI
+(*PINT10_WRITE_MEMORY)(
+ IN PVOID Context,
+ IN USHORT Seg,
+ IN USHORT Off,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+typedef struct _VIDEO_PORT_INT10_INTERFACE {
+ IN USHORT Size;
+ IN USHORT Version;
+ OUT PVOID Context;
+ OUT PINTERFACE_REFERENCE InterfaceReference;
+ OUT PINTERFACE_DEREFERENCE InterfaceDereference;
+ OUT PINT10_ALLOCATE_BUFFER Int10AllocateBuffer;
+ OUT PINT10_FREE_BUFFER Int10FreeBuffer;
+ OUT PINT10_READ_MEMORY Int10ReadMemory;
+ OUT PINT10_WRITE_MEMORY Int10WriteMemory;
+ OUT PINT10_CALL_BIOS Int10CallBios;
+} VIDEO_PORT_INT10_INTERFACE, *PVIDEO_PORT_INT10_INTERFACE;
+
+/* Flags for VideoPortGetDeviceBase and VideoPortMapMemory */
+#define VIDEO_MEMORY_SPACE_MEMORY 0x00
+#define VIDEO_MEMORY_SPACE_IO 0x01
+#define VIDEO_MEMORY_SPACE_USER_MODE 0x02
+#define VIDEO_MEMORY_SPACE_DENSE 0x04
+#define VIDEO_MEMORY_SPACE_P6CACHE 0x08
+
+typedef struct _VIDEO_X86_BIOS_ARGUMENTS {
+ ULONG Eax;
+ ULONG Ebx;
+ ULONG Ecx;
+ ULONG Edx;
+ ULONG Esi;
+ ULONG Edi;
+ ULONG Ebp;
+} VIDEO_X86_BIOS_ARGUMENTS, *PVIDEO_X86_BIOS_ARGUMENTS;
+
+typedef struct _VP_DEVICE_DESCRIPTION {
+ BOOLEAN ScatterGather;
+ BOOLEAN Dma32BitAddresses;
+ BOOLEAN Dma64BitAddresses;
+ ULONG MaximumLength;
+} VP_DEVICE_DESCRIPTION, *PVP_DEVICE_DESCRIPTION;
+
+typedef struct _VPOSVERSIONINFO {
+ IN ULONG Size;
+ OUT ULONG MajorVersion;
+ OUT ULONG MinorVersion;
+ OUT ULONG BuildNumber;
+ OUT USHORT ServicePackMajor;
+ OUT USHORT ServicePackMinor;
+} VPOSVERSIONINFO, *PVPOSVERSIONINFO;
+
+
+
+/* Video port functions for miniports */
+
+VPAPI
+VOID
+DDKAPI
+VideoDebugPrint(
+ IN ULONG DebugPrintLevel,
+ IN PCHAR DebugMessage,
+ IN ...);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortAcquireDeviceLock(
+ IN PVOID HwDeviceExtension);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortAcquireSpinLock(
+ IN PVOID HwDeviceExtension,
+ IN PSPIN_LOCK SpinLock,
+ OUT PUCHAR OldIrql);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortAcquireSpinLockAtDpcLevel(
+ IN PVOID HwDeviceExtension,
+ IN PSPIN_LOCK SpinLock);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortAllocateBuffer(
+ IN PVOID HwDeviceExtension,
+ IN ULONG Size,
+ OUT PVOID *Buffer);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortAllocateCommonBuffer(
+ IN PVOID HwDeviceExtension,
+ IN PVP_DMA_ADAPTER VpDmaAdapter,
+ IN ULONG DesiredLength,
+ OUT PPHYSICAL_ADDRESS LogicalAddress,
+ IN BOOLEAN CacheEnabled,
+ PVOID Reserved);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortAllocateContiguousMemory(
+ IN PVOID HwDeviceExtension,
+ IN ULONG NumberOfBytes,
+ IN PHYSICAL_ADDRESS HighestAcceptableAddress);
+
+/* VideoPortAllocatePool.PoolType constants */
+typedef enum _VP_POOL_TYPE {
+ VpNonPagedPool = 0,
+ VpPagedPool,
+ VpNonPagedPoolCacheAligned = 4,
+ VpPagedPoolCacheAligned
+} VP_POOL_TYPE, *PVP_POOL_TYPE;
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortAllocatePool(
+ IN PVOID HwDeviceExtension,
+ IN VP_POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes,
+ IN ULONG Tag);
+
+VPAPI
+PDMA
+DDKAPI
+VideoPortAssociateEventsWithDmaHandle(
+ IN PVOID HwDeviceExtension,
+ IN OUT PVIDEO_REQUEST_PACKET pVrp,
+ IN PVOID MappedUserEvent,
+ IN PVOID DisplayDriverEvent);
+
+/* VideoPortCheckForDeviceExistence.Flags constants */
+#define CDE_USE_SUBSYSTEM_IDS 0x00000001
+#define CDE_USE_REVISION 0x00000002
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortCheckForDeviceExistence(
+ IN PVOID HwDeviceExtension,
+ IN USHORT VendorId,
+ IN USHORT DeviceId,
+ IN UCHAR RevisionId,
+ IN USHORT SubVendorId,
+ IN USHORT SubSystemId,
+ IN ULONG Flags);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortClearEvent(
+ IN PVOID HwDeviceExtension,
+ IN PEVENT pEvent);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortCompareMemory(
+ IN PVOID Source1,
+ IN PVOID Source2,
+ IN ULONG Length);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortCompleteDma(
+ IN PVOID HwDeviceExtension,
+ IN PVP_DMA_ADAPTER VpDmaAdapter,
+ IN PVP_SCATTER_GATHER_LIST VpScatterGather,
+ IN BOOLEAN WriteToDevice);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortCreateEvent(
+ IN PVOID HwDeviceExtension,
+ IN ULONG EventFlag,
+ IN PVOID Unused,
+ OUT PEVENT *ppEvent);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortCreateSecondaryDisplay(
+ IN PVOID HwDeviceExtension,
+ IN OUT PVOID *SecondaryDeviceExtension,
+ IN ULONG ulFlag);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortCreateSpinLock(
+ IN PVOID HwDeviceExtension,
+ OUT PSPIN_LOCK *SpinLock);
+
+typedef struct _DDC_CONTROL {
+ IN ULONG Size;
+ IN I2C_CALLBACKS I2CCallbacks;
+ IN UCHAR EdidSegment;
+} DDC_CONTROL, *PDDC_CONTROL;
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortDDCMonitorHelper(
+ IN PVOID HwDeviceExtension,
+ IN PVOID DDCControl,
+ IN OUT PUCHAR EdidBuffer,
+ IN ULONG EdidBufferSize);
+
+VPAPI
+VOID
+DDKCDECLAPI
+VideoPortDebugPrint(
+ IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
+ IN PCHAR DebugMessage,
+ IN ...);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortDeleteEvent(
+ IN PVOID HwDeviceExtension,
+ IN PEVENT pEvent);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortDeleteSpinLock(
+ IN PVOID HwDeviceExtension,
+ IN PSPIN_LOCK SpinLock);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortDisableInterrupt(
+ IN PVOID HwDeviceExtension);
+
+VPAPI
+PDMA
+DDKAPI
+VideoPortDoDma(
+ IN PVOID HwDeviceExtension,
+ IN PDMA pDma,
+ IN DMA_FLAGS DmaFlags);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortEnableInterrupt(
+ IN PVOID HwDeviceExtension);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortEnumerateChildren(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Reserved);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortFreeCommonBuffer(
+ IN PVOID HwDeviceExtension,
+ IN ULONG Length,
+ IN PVOID VirtualAddress,
+ IN PHYSICAL_ADDRESS LogicalAddress,
+ IN BOOLEAN CacheEnabled);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortFreeDeviceBase(
+ IN PVOID HwDeviceExtension,
+ IN PVOID MappedAddress);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortFreePool(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Ptr);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortGetAccessRanges(
+ IN PVOID HwDeviceExtension,
+ IN ULONG NumRequestedResources,
+ IN PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL,
+ IN ULONG NumAccessRanges,
+ OUT PVIDEO_ACCESS_RANGE AccessRanges,
+ IN PVOID VendorId,
+ IN PVOID DeviceId,
+ OUT PULONG Slot);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortGetAssociatedDeviceExtension(
+ IN PVOID DeviceObject);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortGetAssociatedDeviceID(
+ IN PVOID DeviceObject);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortGetBusData(
+ IN PVOID HwDeviceExtension,
+ IN BUS_DATA_TYPE BusDataType,
+ IN ULONG SlotNumber,
+ IN OUT PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortGetBytesUsed(
+ IN PVOID HwDeviceExtension,
+ IN PDMA pDma);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortGetCommonBuffer(
+ IN PVOID HwDeviceExtension,
+ IN ULONG DesiredLength,
+ IN ULONG Alignment,
+ OUT PPHYSICAL_ADDRESS LogicalAddress,
+ OUT PULONG pActualLength,
+ IN BOOLEAN CacheEnabled);
+
+VPAPI
+UCHAR
+DDKAPI
+VideoPortGetCurrentIrql(
+ VOID);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortGetDeviceBase(
+ IN PVOID HwDeviceExtension,
+ IN PHYSICAL_ADDRESS IoAddress,
+ IN ULONG NumberOfUchars,
+ IN UCHAR InIoSpace);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortGetDeviceData(
+ IN PVOID HwDeviceExtension,
+ IN VIDEO_DEVICE_DATA_TYPE DeviceDataType,
+ IN PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine,
+ IN PVOID Context);
+
+VPAPI
+PVP_DMA_ADAPTER
+DDKAPI
+VideoPortGetDmaAdapter(
+ IN PVOID HwDeviceExtension,
+ IN PVP_DEVICE_DESCRIPTION VpDeviceDescription);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortGetDmaContext(
+ IN PVOID HwDeviceExtension,
+ IN PDMA pDma);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortGetMdl(
+ IN PVOID HwDeviceExtension,
+ IN PDMA pDma);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortGetRegistryParameters(
+ IN PVOID HwDeviceExtension,
+ IN PWSTR ParameterName,
+ IN UCHAR IsParameterFileName,
+ IN PMINIPORT_GET_REGISTRY_ROUTINE CallbackRoutine,
+ IN PVOID Context);
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortGetRomImage(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Unused1,
+ IN ULONG Unused2,
+ IN ULONG Length);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortGetVersion(
+ IN PVOID HwDeviceExtension,
+ IN OUT PVPOSVERSIONINFO pVpOsVersionInfo);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortGetVgaStatus(
+ IN PVOID HwDeviceExtension,
+ OUT PULONG VgaStatus);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortInitialize(
+ IN PVOID Argument1,
+ IN PVOID Argument2,
+ IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
+ IN PVOID HwContext);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortInt10(
+ IN PVOID HwDeviceExtension,
+ IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
+
+VPAPI
+LONG
+DDKFASTAPI
+VideoPortInterlockedDecrement(
+ IN PLONG Addend);
+
+VPAPI
+LONG
+DDKFASTAPI
+VideoPortInterlockedExchange(
+ IN OUT PLONG Target,
+ IN LONG Value);
+
+VPAPI
+LONG
+DDKFASTAPI
+VideoPortInterlockedIncrement(
+ IN PLONG Addend);
+
+typedef enum _VP_LOCK_OPERATION {
+ VpReadAccess = 0,
+ VpWriteAccess,
+ VpModifyAccess
+} VP_LOCK_OPERATION;
+
+VPAPI
+PVOID
+DDKAPI
+VideoPortLockBuffer(
+ IN PVOID HwDeviceExtension,
+ IN PVOID BaseAddress,
+ IN ULONG Length,
+ IN VP_LOCK_OPERATION Operation);
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortLockPages(
+ IN PVOID HwDeviceExtension,
+ IN OUT PVIDEO_REQUEST_PACKET pVrp,
+ IN OUT PEVENT pUEvent,
+ IN PEVENT pDisplayEvent,
+ IN DMA_FLAGS DmaFlags);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortLogError(
+ IN PVOID HwDeviceExtension,
+ IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL,
+ IN VP_STATUS ErrorCode,
+ IN ULONG UniqueId);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortMapBankedMemory(
+ IN PVOID HwDeviceExtension,
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN OUT PULONG Length,
+ PULONG InIoSpace,
+ PVOID *VirtualAddress,
+ ULONG BankLength,
+ UCHAR ReadWriteBank,
+ PBANKED_SECTION_ROUTINE BankRoutine,
+ PVOID Context);
+
+VPAPI
+PDMA
+DDKAPI
+VideoPortMapDmaMemory(
+ IN PVOID HwDeviceExtension,
+ IN PVIDEO_REQUEST_PACKET pVrp,
+ IN PHYSICAL_ADDRESS BoardAddress,
+ IN PULONG Length,
+ IN PULONG InIoSpace,
+ IN PVOID MappedUserEvent,
+ IN PVOID DisplayDriverEvent,
+ IN OUT PVOID *VirtualAddress);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortMapMemory(
+ IN PVOID HwDeviceExtension,
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN OUT PULONG Length,
+ IN PULONG InIoSpace,
+ IN OUT PVOID *VirtualAddress);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortMoveMemory(
+ IN PVOID Destination,
+ IN PVOID Source,
+ IN ULONG Length);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortPutDmaAdapter(
+ IN PVOID HwDeviceExtension,
+ IN PVP_DMA_ADAPTER VpDmaAdapter);
+
+VPAPI
+LONGLONG
+DDKAPI
+VideoPortQueryPerformanceCounter(
+ IN PVOID HwDeviceExtension,
+ OUT PLONGLONG PerformanceFrequency OPTIONAL);
+
+/* VideoPortQueryServices.ServicesType constants */
+typedef enum _VIDEO_PORT_SERVICES {
+ VideoPortServicesAGP = 1,
+ VideoPortServicesI2C,
+ VideoPortServicesHeadless,
+ VideoPortServicesInt10
+} VIDEO_PORT_SERVICES;
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortQueryServices(
+ IN PVOID HwDeviceExtension,
+ IN VIDEO_PORT_SERVICES ServicesType,
+ IN OUT PINTERFACE Interface);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortQuerySystemTime(
+ OUT PLARGE_INTEGER CurrentTime);
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortQueueDpc(
+ IN PVOID HwDeviceExtension,
+ IN PMINIPORT_DPC_ROUTINE CallbackRoutine,
+ IN PVOID Context);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReadPortBufferUchar(
+ IN PUCHAR Port,
+ OUT PUCHAR Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReadPortBufferUlong(
+ IN PULONG Port,
+ OUT PULONG Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReadPortBufferUshort(
+ IN PUSHORT Port,
+ OUT PUSHORT Buffer,
+ IN ULONG Count);
+
+VPAPI
+UCHAR
+DDKAPI
+VideoPortReadPortUchar(
+ IN PUCHAR Port);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortReadPortUlong(
+ IN PULONG Port);
+
+VPAPI
+USHORT
+DDKAPI
+VideoPortReadPortUshort(
+ IN PUSHORT Port);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReadRegisterBufferUchar(
+ IN PUCHAR Register,
+ OUT PUCHAR Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReadRegisterBufferUlong(
+ IN PULONG Register,
+ OUT PULONG Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReadRegisterBufferUshort(
+ IN PUSHORT Register,
+ OUT PUSHORT Buffer,
+ IN ULONG Count);
+
+VPAPI
+UCHAR
+DDKAPI
+VideoPortReadRegisterUchar(
+ IN PUCHAR Register);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortReadRegisterUlong(
+ IN PULONG Register);
+
+VPAPI
+USHORT
+DDKAPI
+VideoPortReadRegisterUshort(
+ IN PUSHORT Register);
+
+VPAPI
+LONG
+DDKAPI
+VideoPortReadStateEvent(
+ IN PVOID HwDeviceExtension,
+ IN PEVENT pEvent);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReleaseBuffer(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Buffer);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReleaseCommonBuffer(
+ IN PVOID HwDeviceExtension,
+ IN PVP_DMA_ADAPTER VpDmaAdapter,
+ IN ULONG Length,
+ IN PHYSICAL_ADDRESS LogicalAddress,
+ IN PVOID VirtualAddress,
+ IN BOOLEAN CacheEnabled);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReleaseDeviceLock(
+ IN PVOID HwDeviceExtension);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReleaseSpinLock(
+ IN PVOID HwDeviceExtension,
+ IN PSPIN_LOCK SpinLock,
+ IN UCHAR NewIrql);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortReleaseSpinLockFromDpcLevel(
+ IN PVOID HwDeviceExtension,
+ IN PSPIN_LOCK SpinLock);
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortScanRom(
+ PVOID HwDeviceExtension,
+ PUCHAR RomBase,
+ ULONG RomLength,
+ PUCHAR String);
+
+VPAPI
+ULONG
+DDKAPI
+VideoPortSetBusData(
+ IN PVOID HwDeviceExtension,
+ IN BUS_DATA_TYPE BusDataType,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortSetBytesUsed(
+ IN PVOID HwDeviceExtension,
+ IN OUT PDMA pDma,
+ IN ULONG BytesUsed);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortSetDmaContext(
+ IN PVOID HwDeviceExtension,
+ OUT PDMA pDma,
+ IN PVOID InstanceContext);
+
+VPAPI
+LONG
+DDKAPI
+VideoPortSetEvent(
+ IN PVOID HwDeviceExtension,
+ IN PEVENT pEvent);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortSetRegistryParameters(
+ IN PVOID HwDeviceExtension,
+ IN PWSTR ValueName,
+ IN PVOID ValueData,
+ IN ULONG ValueLength);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortSetTrappedEmulatorPorts(
+ IN PVOID HwDeviceExtension,
+ IN ULONG NumAccessRanges,
+ IN PVIDEO_ACCESS_RANGE AccessRange);
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortSignalDmaComplete(
+ IN PVOID HwDeviceExtension,
+ IN PVOID pDmaHandle);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortStallExecution(
+ IN ULONG Microseconds);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortStartDma(
+ IN PVOID HwDeviceExtension,
+ IN PVP_DMA_ADAPTER VpDmaAdapter,
+ IN PVOID Mdl,
+ IN ULONG Offset,
+ IN OUT PULONG pLength,
+ IN PEXECUTE_DMA ExecuteDmaRoutine,
+ IN PVOID Context,
+ IN BOOLEAN WriteToDevice);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortStartTimer(
+ IN PVOID HwDeviceExtension);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortStopTimer(
+ IN PVOID HwDeviceExtension);
+
+/* VideoPortSynchronizeExecution.Priority constants */
+typedef enum VIDEO_SYNCHRONIZE_PRIORITY {
+ VpLowPriority = 0,
+ VpMediumPriority,
+ VpHighPriority
+} VIDEO_SYNCHRONIZE_PRIORITY, *PVIDEO_SYNCHRONIZE_PRIORITY;
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortSynchronizeExecution(
+ IN PVOID HwDeviceExtension,
+ IN VIDEO_SYNCHRONIZE_PRIORITY Priority,
+ IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine,
+ IN PVOID Context);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortUnLockBuffer(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Mdl);
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortUnlockPages(
+ IN PVOID hwDeviceExtension,
+ IN OUT PDMA pDma);
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortUnmapDmaMemory(
+ IN PVOID HwDeviceExtension,
+ IN PVOID VirtualAddress,
+ IN HANDLE ProcessHandle,
+ IN PDMA BoardMemoryHandle);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortUnmapMemory(
+ IN PVOID HwDeviceExtension,
+ IN OUT PVOID VirtualAddress,
+ IN HANDLE ProcessHandle);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortVerifyAccessRanges(
+ IN PVOID HwDeviceExtension,
+ IN ULONG NumAccessRanges,
+ IN PVIDEO_ACCESS_RANGE AccessRanges);
+
+VPAPI
+VP_STATUS
+DDKAPI
+VideoPortWaitForSingleObject(
+ IN PVOID HwDeviceExtension,
+ IN PVOID Object,
+ IN PLARGE_INTEGER Timeout OPTIONAL);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWritePortBufferUchar(
+ IN PUCHAR Port,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWritePortBufferUlong(
+ IN PULONG Port,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWritePortBufferUshort(
+ IN PUSHORT Port,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWritePortUchar(
+ IN PUCHAR Port,
+ IN UCHAR Value);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWritePortUlong(
+ IN PULONG Port,
+ IN ULONG Value);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWritePortUshort(
+ IN PUSHORT Port,
+ IN USHORT Value);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWriteRegisterBufferUchar(
+ IN PUCHAR Register,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWriteRegisterBufferUlong(
+ IN PULONG Register,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWriteRegisterBufferUshort(
+ IN PUSHORT Register,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWriteRegisterUchar(
+ IN PUCHAR Register,
+ IN UCHAR Value);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWriteRegisterUlong(
+ IN PULONG Register,
+ IN ULONG Value);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortWriteRegisterUshort(
+ IN PUSHORT Register,
+ IN USHORT Value);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortZeroDeviceMemory(
+ IN PVOID Destination,
+ IN ULONG Length);
+
+VPAPI
+VOID
+DDKAPI
+VideoPortZeroMemory(
+ IN PVOID Destination,
+ IN ULONG Length);
+
+#if DBG
+#define VideoDebugPrint(x) VideoPortDebugPrint x
+#else
+#define VideoDebugPrint(x)
+#endif
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VIDEO_H */
--- /dev/null
+/*
+ * videoagp.h
+ *
+ * Video miniport AGP interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __VIDEOAGP_H
+#define __VIDEOAGP_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ntddk.h"
+#include "video.h"
+
+
+#define VIDEO_AGP_RATE_1X 0x00000001
+#define VIDEO_AGP_RATE_2X 0x00000002
+#define VIDEO_AGP_RATE_4X 0x00000004
+#define VIDEO_AGP_RATE_8X 0x00000008
+
+typedef enum _VIDEO_PORT_CACHE_TYPE {
+ VpNonCached = 0,
+ VpWriteCombined,
+ VpCached
+} VIDEO_PORT_CACHE_TYPE;
+
+typedef BOOLEAN DDKAPI
+(*PAGP_COMMIT_PHYSICAL)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID PhysicalReserveContext,
+ IN ULONG Pages,
+ IN ULONG Offset);
+
+typedef PVOID DDKAPI
+(*PAGP_COMMIT_VIRTUAL)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID VirtualReserveContext,
+ IN ULONG Pages,
+ IN ULONG Offset);
+
+typedef VOID DDKAPI
+(*PAGP_FREE_PHYSICAL)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID PhysicalReserveContext,
+ IN ULONG Pages,
+ IN ULONG Offset);
+
+typedef VOID DDKAPI
+(*PAGP_FREE_VIRTUAL)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID VirtualReserveContext,
+ IN ULONG Pages,
+ IN ULONG Offset);
+
+typedef VOID DDKAPI
+(*PAGP_RELEASE_PHYSICAL)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID PhysicalReserveContext);
+
+typedef VOID DDKAPI
+(*PAGP_RELEASE_VIRTUAL)(
+ IN PVOID HwDeviceExtension,
+ IN PVOID VirtualReserveContext);
+
+typedef PHYSICAL_ADDRESS DDKAPI
+(*PAGP_RESERVE_PHYSICAL)(
+ IN PVOID HwDeviceExtension,
+ IN ULONG Pages,
+ IN VIDEO_PORT_CACHE_TYPE Caching,
+ OUT PVOID *PhysicalReserveContext);
+
+typedef PVOID DDKAPI
+(*PAGP_RESERVE_VIRTUAL)(
+ IN PVOID HwDeviceExtension,
+ IN HANDLE ProcessHandle,
+ IN PVOID PhysicalReserveContext,
+ OUT PVOID *VirtualReserveContext);
+
+typedef BOOLEAN DDKAPI
+(*PAGP_SET_RATE)(
+ IN PVOID HwDeviceExtension,
+ IN ULONG AgpRate);
+
+typedef struct _VIDEO_PORT_AGP_SERVICES {
+ PAGP_RESERVE_PHYSICAL AgpReservePhysical;
+ PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
+ PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
+ PAGP_FREE_PHYSICAL AgpFreePhysical;
+ PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
+ PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
+ PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
+ PAGP_FREE_VIRTUAL AgpFreeVirtual;
+ ULONGLONG AllocationLimit;
+} VIDEO_PORT_AGP_SERVICES, *PVIDEO_PORT_AGP_SERVICES;
+
+VPAPI
+BOOLEAN
+DDKAPI
+VideoPortGetAgpServices(
+ IN PVOID HwDeviceExtension,
+ IN PVIDEO_PORT_AGP_SERVICES AgpServices);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VIDEOAGP_H */
--- /dev/null
+/*
+ * win2k.h
+ *
+ * Definitions only used in Windows 2000 and earlier versions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __WIN2K_H
+#define __WIN2K_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ntddk.h"
+
+
+typedef enum _BUS_DATA_TYPE {
+ ConfigurationSpaceUndefined = -1,
+ Cmos,
+ EisaConfiguration,
+ Pos,
+ CbusConfiguration,
+ PCIConfiguration,
+ VMEConfiguration,
+ NuBusConfiguration,
+ PCMCIAConfiguration,
+ MPIConfiguration,
+ MPSAConfiguration,
+ PNPISAConfiguration,
+ SgiInternalConfiguration,
+ MaximumBusDataType
+} BUS_DATA_TYPE, *PBUS_DATA_TYPE;
+
+NTOSAPI
+VOID
+DDKAPI
+ExReleaseResourceForThreadLite(
+ IN PERESOURCE Resource,
+ IN ERESOURCE_THREAD ResourceThreadId);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReadPartitionTable(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN BOOLEAN ReturnRecognizedPartitions,
+ OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoSetPartitionInformation(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN ULONG PartitionNumber,
+ IN ULONG PartitionType);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWritePartitionTable(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN ULONG SectorsPerTrack,
+ IN ULONG NumberOfHeads,
+ IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
+
+/*
+ * PVOID MmGetSystemAddressForMdl(
+ * IN PMDL Mdl);
+ */
+#define MmGetSystemAddressForMdl(Mdl) \
+ (((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
+ MDL_SOURCE_IS_NONPAGED_POOL)) ? \
+ ((Mdl)->MappedSystemVa) : \
+ (MmMapLockedPages((Mdl), KernelMode)))
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WIN2K_H */
--- /dev/null
+/*
+ * winddi.h
+ *
+ * GDI device driver interface
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __WINDDI_H
+#define __WINDDI_H
+
+#ifdef __VIDEO_H
+#error video.h cannot be included with winddi.h
+#endif
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ntddk.h"
+#include <wingdi.h>
+
+#if 1
+/* FIXME: Some DirectDraw structures not added yet */
+typedef ULONG_PTR FLATPTR;
+typedef PVOID LPVIDMEM;
+typedef PVOID LPVMEMHEAP;
+typedef PVOID PGLYPHOS;
+typedef struct _DD_SURFACECALLBACKS {
+} DD_SURFACECALLBACKS, *PDD_SURFACECALLBACKS;
+typedef struct _DD_PALETTECALLBACKS {
+} DD_PALETTECALLBACKS, *PDD_PALETTECALLBACKS;
+typedef struct _DD_CALLBACKS {
+} DD_CALLBACKS, *PDD_CALLBACKS;
+typedef struct _DD_HALINFO {
+} DD_HALINFO, *PDD_HALINFO;
+typedef struct _DDSCAPS {
+} DDSCAPS, *PDDSCAPS;
+typedef struct _DDSCAPSEX {
+} DDSCAPSEX, *PDDSCAPSEX;
+typedef struct _VIDEOMEMORY {
+} VIDEOMEMORY, *LPVIDEOMEMORY;
+typedef struct _DD_DIRECTDRAW_GLOBAL {
+} DD_DIRECTDRAW_GLOBAL, *LPDD_DIRECTDRAW_GLOBAL;
+typedef struct _DD_SURFACE_LOCAL {
+} DD_SURFACE_LOCAL, *PDD_SURFACE_LOCAL, *LPDD_SURFACE_LOCAL;
+#endif
+
+#if defined(_WIN32K_)
+#define WIN32KAPI DECL_EXPORT
+#else
+#define WIN32KAPI DECL_IMPORT
+#endif
+
+#define DDI_DRIVER_VERSION_NT4 0x00020000
+#define DDI_DRIVER_VERSION_SP3 0x00020003
+#define DDI_DRIVER_VERSION_NT5 0x00030000
+#define DDI_DRIVER_VERSION_NT5_01 0x00030100
+
+#define GDI_DRIVER_VERSION 0x4000
+
+#ifdef _X86_
+
+typedef DWORD FLOATL;
+
+#else /* !_X86_ */
+
+typedef FLOAT FLOATL;
+
+#endif
+
+typedef SHORT FWORD;
+typedef LONG LDECI4;
+typedef ULONG IDENT;
+
+typedef ULONG_PTR HFF;
+typedef ULONG_PTR HFC;
+
+typedef LONG PTRDIFF;
+typedef PTRDIFF *PPTRDIFF;
+typedef LONG FIX;
+typedef FIX *PFIX;
+typedef ULONG ROP4;
+typedef ULONG MIX;
+typedef ULONG HGLYPH;
+typedef HGLYPH *PHGLYPH;
+
+typedef LONG_PTR (DDKAPI *PFN)();
+
+DECLARE_HANDLE(HBM);
+DECLARE_HANDLE(HDEV);
+DECLARE_HANDLE(HSURF);
+DECLARE_HANDLE(DHSURF);
+DECLARE_HANDLE(DHPDEV);
+DECLARE_HANDLE(HDRVOBJ);
+
+
+#define GDI_DRIVER_VERSION 0x4000
+
+typedef struct _ENG_EVENT *PEVENT;
+
+#define OPENGL_CMD 4352
+#define OPENGL_GETINFO 4353
+#define WNDOBJ_SETUP 4354
+
+#define FD_ERROR 0xFFFFFFFF
+#define DDI_ERROR 0xFFFFFFFF
+
+#define HFF_INVALID ((HFF) 0)
+#define HFC_INVALID ((HFC) 0)
+#define HGLYPH_INVALID ((HGLYPH) -1)
+
+#define FP_ALTERNATEMODE 1
+#define FP_WINDINGMODE 2
+
+#define DN_ACCELERATION_LEVEL 1
+#define DN_DEVICE_ORIGIN 2
+#define DN_SLEEP_MODE 3
+#define DN_DRAWING_BEGIN 4
+
+#define DCR_SOLID 0
+#define DCR_DRIVER 1
+#define DCR_HALFTONE 2
+
+#define GX_IDENTITY 0
+#define GX_OFFSET 1
+#define GX_SCALE 2
+#define GX_GENERAL 3
+
+typedef struct _POINTE {
+ FLOATL x;
+ FLOATL y;
+} POINTE, *PPOINTE;
+
+typedef union _FLOAT_LONG {
+ FLOATL e;
+ LONG l;
+} FLOAT_LONG, *PFLOAT_LONG;
+
+typedef struct _POINTFIX {
+ FIX x;
+ FIX y;
+} POINTFIX, *PPOINTFIX;
+
+typedef struct _RECTFX {
+ FIX xLeft;
+ FIX yTop;
+ FIX xRight;
+ FIX yBottom;
+} RECTFX, *PRECTFX;
+
+typedef struct _POINTQF {
+ LARGE_INTEGER x;
+ LARGE_INTEGER y;
+} POINTQF, *PPOINTQF;
+
+
+typedef struct _BLENDOBJ {
+ BLENDFUNCTION BlendFunction;
+} BLENDOBJ,*PBLENDOBJ;
+
+/* BRUSHOBJ.flColorType */
+#define BR_DEVICE_ICM 0x01
+#define BR_HOST_ICM 0x02
+#define BR_CMYKCOLOR 0x04
+#define BR_ORIGCOLOR 0x08
+
+typedef struct _BRUSHOBJ {
+ ULONG iSolidColor;
+ PVOID pvRbrush;
+ FLONG flColorType;
+} BRUSHOBJ;
+
+typedef struct _CIECHROMA {
+ LDECI4 x;
+ LDECI4 y;
+ LDECI4 Y;
+} CIECHROMA;
+
+typedef struct _RUN {
+ LONG iStart;
+ LONG iStop;
+} RUN, *PRUN;
+
+typedef struct _CLIPLINE {
+ POINTFIX ptfxA;
+ POINTFIX ptfxB;
+ LONG lStyleState;
+ ULONG c;
+ RUN arun[1];
+} CLIPLINE, *PCLIPLINE;
+
+/* CLIPOBJ.iDComplexity constants */
+#define DC_TRIVIAL 0
+#define DC_RECT 1
+#define DC_COMPLEX 3
+
+/* CLIPOBJ.iFComplexity constants */
+#define FC_RECT 1
+#define FC_RECT4 2
+#define FC_COMPLEX 3
+
+/* CLIPOBJ.iMode constants */
+#define TC_RECTANGLES 0
+#define TC_PATHOBJ 2
+
+/* CLIPOBJ.fjOptions constants */
+#define OC_BANK_CLIP 1
+
+typedef struct _CLIPOBJ {
+ ULONG iUniq;
+ RECTL rclBounds;
+ BYTE iDComplexity;
+ BYTE iFComplexity;
+ BYTE iMode;
+ BYTE fjOptions;
+} CLIPOBJ;
+
+typedef struct _COLORINFO {
+ CIECHROMA Red;
+ CIECHROMA Green;
+ CIECHROMA Blue;
+ CIECHROMA Cyan;
+ CIECHROMA Magenta;
+ CIECHROMA Yellow;
+ CIECHROMA AlignmentWhite;
+ LDECI4 RedGamma;
+ LDECI4 GreenGamma;
+ LDECI4 BlueGamma;
+ LDECI4 MagentaInCyanDye;
+ LDECI4 YellowInCyanDye;
+ LDECI4 CyanInMagentaDye;
+ LDECI4 YellowInMagentaDye;
+ LDECI4 CyanInYellowDye;
+ LDECI4 MagentaInYellowDye;
+} COLORINFO, *PCOLORINFO;
+
+/* DEVHTADJDATA.DeviceFlags constants */
+#define DEVHTADJF_COLOR_DEVICE 0x00000001
+#define DEVHTADJF_ADDITIVE_DEVICE 0x00000002
+
+typedef struct _DEVHTINFO {
+ DWORD HTFlags;
+ DWORD HTPatternSize;
+ DWORD DevPelsDPI;
+ COLORINFO ColorInfo;
+} DEVHTINFO, *PDEVHTINFO;
+
+typedef struct _DEVHTADJDATA {
+ DWORD DeviceFlags;
+ DWORD DeviceXDPI;
+ DWORD DeviceYDPI;
+ PDEVHTINFO pDefHTInfo;
+ PDEVHTINFO pAdjHTInfo;
+} DEVHTADJDATA, *PDEVHTADJDATA;
+
+/* DEVINFO.flGraphicsCaps flags */
+#define GCAPS_BEZIERS 0x00000001
+#define GCAPS_GEOMETRICWIDE 0x00000002
+#define GCAPS_ALTERNATEFILL 0x00000004
+#define GCAPS_WINDINGFILL 0x00000008
+#define GCAPS_HALFTONE 0x00000010
+#define GCAPS_COLOR_DITHER 0x00000020
+#define GCAPS_HORIZSTRIKE 0x00000040
+#define GCAPS_VERTSTRIKE 0x00000080
+#define GCAPS_OPAQUERECT 0x00000100
+#define GCAPS_VECTORFONT 0x00000200
+#define GCAPS_MONO_DITHER 0x00000400
+#define GCAPS_ASYNCCHANGE 0x00000800
+#define GCAPS_ASYNCMOVE 0x00001000
+#define GCAPS_DONTJOURNAL 0x00002000
+#define GCAPS_DIRECTDRAW 0x00004000
+#define GCAPS_ARBRUSHOPAQUE 0x00008000
+#define GCAPS_PANNING 0x00010000
+#define GCAPS_HIGHRESTEXT 0x00040000
+#define GCAPS_PALMANAGED 0x00080000
+#define GCAPS_DITHERONREALIZE 0x00200000
+#define GCAPS_NO64BITMEMACCESS 0x00400000
+#define GCAPS_FORCEDITHER 0x00800000
+#define GCAPS_GRAY16 0x01000000
+#define GCAPS_ICM 0x02000000
+#define GCAPS_CMYKCOLOR 0x04000000
+#define GCAPS_LAYERED 0x08000000
+#define GCAPS_ARBRUSHTEXT 0x10000000
+#define GCAPS_SCREENPRECISION 0x20000000
+#define GCAPS_FONT_RASTERIZER 0x40000000
+#define GCAPS_NUP 0x80000000
+
+/* DEVINFO.iDitherFormat constants */
+#define BMF_1BPP 1L
+#define BMF_4BPP 2L
+#define BMF_8BPP 3L
+#define BMF_16BPP 4L
+#define BMF_24BPP 5L
+#define BMF_32BPP 6L
+#define BMF_4RLE 7L
+#define BMF_8RLE 8L
+#define BMF_JPEG 9L
+#define BMF_PNG 10L
+
+/* DEVINFO.flGraphicsCaps2 flags */
+#define GCAPS2_JPEGSRC 0x00000001
+#define GCAPS2_xxxx 0x00000002
+#define GCAPS2_PNGSRC 0x00000008
+#define GCAPS2_CHANGEGAMMARAMP 0x00000010
+#define GCAPS2_ALPHACURSOR 0x00000020
+#define GCAPS2_SYNCFLUSH 0x00000040
+#define GCAPS2_SYNCTIMER 0x00000080
+#define GCAPS2_ICD_MULTIMON 0x00000100
+#define GCAPS2_MOUSETRAILS 0x00000200
+#define GCAPS2_RESERVED1 0x00000400
+
+typedef struct _DEVINFO {
+ FLONG flGraphicsCaps;
+ LOGFONTW lfDefaultFont;
+ LOGFONTW lfAnsiVarFont;
+ LOGFONTW lfAnsiFixFont;
+ ULONG cFonts;
+ ULONG iDitherFormat;
+ USHORT cxDither;
+ USHORT cyDither;
+ HPALETTE hpalDefault;
+ FLONG flGraphicsCaps2;
+} DEVINFO, *PDEVINFO;
+
+typedef struct _DRIVEROBJ *PDRIVEROBJ;
+
+typedef BOOL DDKAPI CALLBACK
+(*FREEOBJPROC)(
+ IN PDRIVEROBJ pDriverObj);
+
+typedef struct _DRIVEROBJ {
+ PVOID pvObj;
+ FREEOBJPROC pFreeProc;
+ HDEV hdev;
+ DHPDEV dhpdev;
+} DRIVEROBJ;
+
+/* DRVFN.iFunc constants */
+#define INDEX_DrvEnablePDEV 0L
+#define INDEX_DrvCompletePDEV 1L
+#define INDEX_DrvDisablePDEV 2L
+#define INDEX_DrvEnableSurface 3L
+#define INDEX_DrvDisableSurface 4L
+#define INDEX_DrvAssertMode 5L
+#define INDEX_DrvOffset 6L
+#define INDEX_DrvResetPDEV 7L
+#define INDEX_DrvDisableDriver 8L
+#define INDEX_DrvCreateDeviceBitmap 10L
+#define INDEX_DrvDeleteDeviceBitmap 11L
+#define INDEX_DrvRealizeBrush 12L
+#define INDEX_DrvDitherColor 13L
+#define INDEX_DrvStrokePath 14L
+#define INDEX_DrvFillPath 15L
+#define INDEX_DrvStrokeAndFillPath 16L
+#define INDEX_DrvPaint 17L
+#define INDEX_DrvBitBlt 18L
+#define INDEX_DrvCopyBits 19L
+#define INDEX_DrvStretchBlt 20L
+#define INDEX_DrvSetPalette 22L
+#define INDEX_DrvTextOut 23L
+#define INDEX_DrvEscape 24L
+#define INDEX_DrvDrawEscape 25L
+#define INDEX_DrvQueryFont 26L
+#define INDEX_DrvQueryFontTree 27L
+#define INDEX_DrvQueryFontData 28L
+#define INDEX_DrvSetPointerShape 29L
+#define INDEX_DrvMovePointer 30L
+#define INDEX_DrvLineTo 31L
+#define INDEX_DrvSendPage 32L
+#define INDEX_DrvStartPage 33L
+#define INDEX_DrvEndDoc 34L
+#define INDEX_DrvStartDoc 35L
+#define INDEX_DrvGetGlyphMode 37L
+#define INDEX_DrvSynchronize 38L
+#define INDEX_DrvSaveScreenBits 40L
+#define INDEX_DrvGetModes 41L
+#define INDEX_DrvFree 42L
+#define INDEX_DrvDestroyFont 43L
+#define INDEX_DrvQueryFontCaps 44L
+#define INDEX_DrvLoadFontFile 45L
+#define INDEX_DrvUnloadFontFile 46L
+#define INDEX_DrvFontManagement 47L
+#define INDEX_DrvQueryTrueTypeTable 48L
+#define INDEX_DrvQueryTrueTypeOutline 49L
+#define INDEX_DrvGetTrueTypeFile 50L
+#define INDEX_DrvQueryFontFile 51L
+#define INDEX_DrvMovePanning 52L
+#define INDEX_DrvQueryAdvanceWidths 53L
+#define INDEX_DrvSetPixelFormat 54L
+#define INDEX_DrvDescribePixelFormat 55L
+#define INDEX_DrvSwapBuffers 56L
+#define INDEX_DrvStartBanding 57L
+#define INDEX_DrvNextBand 58L
+#define INDEX_DrvGetDirectDrawInfo 59L
+#define INDEX_DrvEnableDirectDraw 60L
+#define INDEX_DrvDisableDirectDraw 61L
+#define INDEX_DrvQuerySpoolType 62L
+#define INDEX_DrvIcmCreateColorTransform 64L
+#define INDEX_DrvIcmDeleteColorTransform 65L
+#define INDEX_DrvIcmCheckBitmapBits 66L
+#define INDEX_DrvIcmSetDeviceGammaRamp 67L
+#define INDEX_DrvGradientFill 68L
+#define INDEX_DrvStretchBltROP 69L
+#define INDEX_DrvPlgBlt 70L
+#define INDEX_DrvAlphaBlend 71L
+#define INDEX_DrvSynthesizeFont 72L
+#define INDEX_DrvGetSynthesizedFontFiles 73L
+#define INDEX_DrvTransparentBlt 74L
+#define INDEX_DrvQueryPerBandInfo 75L
+#define INDEX_DrvQueryDeviceSupport 76L
+#define INDEX_DrvReserved1 77L
+#define INDEX_DrvReserved2 78L
+#define INDEX_DrvReserved3 79L
+#define INDEX_DrvReserved4 80L
+#define INDEX_DrvReserved5 81L
+#define INDEX_DrvReserved6 82L
+#define INDEX_DrvReserved7 83L
+#define INDEX_DrvReserved8 84L
+#define INDEX_DrvDeriveSurface 85L
+#define INDEX_DrvQueryGlyphAttrs 86L
+#define INDEX_DrvNotify 87L
+#define INDEX_DrvSynchronizeSurface 88L
+#define INDEX_DrvResetDevice 89L
+#define INDEX_DrvReserved9 90L
+#define INDEX_DrvReserved10 91L
+#define INDEX_DrvReserved11 92L
+#define INDEX_LAST 93L
+
+typedef struct _DRVFN {
+ ULONG iFunc;
+ PFN pfn;
+} DRVFN, *PDRVFN;
+
+/* DRVENABLEDATA.iDriverVersion constants */
+#define DDI_DRIVER_VERSION_NT4 0x00020000
+#define DDI_DRIVER_VERSION_SP3 0x00020003
+#define DDI_DRIVER_VERSION_NT5 0x00030000
+#define DDI_DRIVER_VERSION_NT5_01 0x00030100
+
+typedef struct _DRVENABLEDATA {
+ ULONG iDriverVersion;
+ ULONG c;
+ DRVFN *pdrvfn;
+} DRVENABLEDATA, *PDRVENABLEDATA;
+
+DECLARE_HANDLE(HSEMAPHORE);
+
+typedef struct _ENGSAFESEMAPHORE {
+ HSEMAPHORE hsem;
+ LONG lCount;
+} ENGSAFESEMAPHORE;
+
+typedef struct _ENG_TIME_FIELDS {
+ USHORT usYear;
+ USHORT usMonth;
+ USHORT usDay;
+ USHORT usHour;
+ USHORT usMinute;
+ USHORT usSecond;
+ USHORT usMilliseconds;
+ USHORT usWeekday;
+} ENG_TIME_FIELDS, *PENG_TIME_FIELDS;
+
+typedef struct _ENUMRECTS {
+ ULONG c;
+ RECTL arcl[1];
+} ENUMRECTS;
+
+typedef struct _FD_XFORM {
+ FLOATL eXX;
+ FLOATL eXY;
+ FLOATL eYX;
+ FLOATL eYY;
+} FD_XFORM, *PFD_XFORM;
+
+/* FD_DEVICEMETRICS.flRealizedType constants */
+#define FDM_TYPE_BM_SIDE_CONST 0x00000001
+#define FDM_TYPE_MAXEXT_EQUAL_BM_SIDE 0x00000002
+#define FDM_TYPE_CHAR_INC_EQUAL_BM_BASE 0x00000004
+#define FDM_TYPE_ZERO_BEARINGS 0x00000008
+#define FDM_TYPE_CONST_BEARINGS 0x00000010
+
+typedef struct _FD_DEVICEMETRICS {
+ FLONG flRealizedType;
+ POINTE pteBase;
+ POINTE pteSide;
+ LONG lD;
+ FIX fxMaxAscender;
+ FIX fxMaxDescender;
+ POINTL ptlUnderline1;
+ POINTL ptlStrikeout;
+ POINTL ptlULThickness;
+ POINTL ptlSOThickness;
+ ULONG cxMax;
+ ULONG cyMax;
+ ULONG cjGlyphMax;
+ FD_XFORM fdxQuantized;
+ LONG lNonLinearExtLeading;
+ LONG lNonLinearIntLeading;
+ LONG lNonLinearMaxCharWidth;
+ LONG lNonLinearAvgCharWidth;
+ LONG lMinA;
+ LONG lMinC;
+ LONG lMinD;
+ LONG alReserved[1];
+} FD_DEVICEMETRICS, *PFD_DEVICEMETRICS;
+
+/* FD_GLYPHATTR.iMode constants */
+#define FO_ATTR_MODE_ROTATE 1
+
+typedef struct _FD_GLYPHATTR {
+ ULONG cjThis;
+ ULONG cGlyphs;
+ ULONG iMode;
+ BYTE aGlyphAttr[1];
+} FD_GLYPHATTR, *PFD_GLYPHATTR;
+
+/* FD_GLYPHSET.flAccel */
+#define GS_UNICODE_HANDLES 0x00000001
+#define GS_8BIT_HANDLES 0x00000002
+#define GS_16BIT_HANDLES 0x00000004
+
+typedef struct _WCRUN {
+ WCHAR wcLow;
+ USHORT cGlyphs;
+ HGLYPH *phg;
+} WCRUN, *PWCRUN;
+
+typedef struct _FD_GLYPHSET {
+ ULONG cjThis;
+ FLONG flAccel;
+ ULONG cGlyphsSupported;
+ ULONG cRuns;
+ WCRUN awcrun[1];
+} FD_GLYPHSET, *PFD_GLYPHSET;
+
+typedef struct _FD_KERNINGPAIR {
+ WCHAR wcFirst;
+ WCHAR wcSecond;
+ FWORD fwdKern;
+} FD_KERNINGPAIR;
+
+typedef struct _FLOATOBJ
+{
+ ULONG ul1;
+ ULONG ul2;
+} FLOATOBJ, *PFLOATOBJ;
+
+typedef struct _FLOATOBJ_XFORM {
+ FLOATOBJ eM11;
+ FLOATOBJ eM12;
+ FLOATOBJ eM21;
+ FLOATOBJ eM22;
+ FLOATOBJ eDx;
+ FLOATOBJ eDy;
+} FLOATOBJ_XFORM, *PFLOATOBJ_XFORM, FAR *LPFLOATOBJ_XFORM;
+
+/* FONTDIFF.fsSelection */
+#define FM_SEL_ITALIC 0x0001
+#define FM_SEL_UNDERSCORE 0x0002
+#define FM_SEL_NEGATIVE 0x0004
+#define FM_SEL_OUTLINED 0x0008
+#define FM_SEL_STRIKEOUT 0x0010
+#define FM_SEL_BOLD 0x0020
+#define FM_SEL_REGULAR 0x0040
+
+typedef struct _FONTDIFF {
+ BYTE jReserved1;
+ BYTE jReserved2;
+ BYTE jReserved3;
+ BYTE bWeight;
+ USHORT usWinWeight;
+ FSHORT fsSelection;
+ FWORD fwdAveCharWidth;
+ FWORD fwdMaxCharInc;
+ POINTL ptlCaret;
+} FONTDIFF;
+
+typedef struct _FONTSIM {
+ PTRDIFF dpBold;
+ PTRDIFF dpItalic;
+ PTRDIFF dpBoldItalic;
+} FONTSIM;
+
+/* FONTINFO.flCaps constants */
+#define FO_DEVICE_FONT 1L
+#define FO_OUTLINE_CAPABLE 2L
+
+typedef struct _FONTINFO {
+ ULONG cjThis;
+ FLONG flCaps;
+ ULONG cGlyphsSupported;
+ ULONG cjMaxGlyph1;
+ ULONG cjMaxGlyph4;
+ ULONG cjMaxGlyph8;
+ ULONG cjMaxGlyph32;
+} FONTINFO, *PFONTINFO;
+
+/* FONTOBJ.flFontType constants */
+#define FO_TYPE_RASTER RASTER_FONTTYPE
+#define FO_TYPE_DEVICE DEVICE_FONTTYPE
+#define FO_TYPE_TRUETYPE TRUETYPE_FONTTYPE
+#define FO_TYPE_OPENTYPE OPENTYPE_FONTTYPE
+
+#define FO_SIM_BOLD 0x00002000
+#define FO_SIM_ITALIC 0x00004000
+#define FO_EM_HEIGHT 0x00008000
+#define FO_GRAY16 0x00010000
+#define FO_NOGRAY16 0x00020000
+#define FO_NOHINTS 0x00040000
+#define FO_NO_CHOICE 0x00080000
+#define FO_CFF 0x00100000
+#define FO_POSTSCRIPT 0x00200000
+#define FO_MULTIPLEMASTER 0x00400000
+#define FO_VERT_FACE 0x00800000
+#define FO_DBCS_FONT 0X01000000
+#define FO_NOCLEARTYPE 0x02000000
+#define FO_CLEARTYPE_X 0x10000000
+#define FO_CLEARTYPE_Y 0x20000000
+
+typedef struct _FONTOBJ {
+ ULONG iUniq;
+ ULONG iFace;
+ ULONG cxMax;
+ FLONG flFontType;
+ ULONG_PTR iTTUniq;
+ ULONG_PTR iFile;
+ SIZE sizLogResPpi;
+ ULONG ulStyleSize;
+ PVOID pvConsumer;
+ PVOID pvProducer;
+} FONTOBJ;
+
+typedef struct _GAMMARAMP {
+ WORD Red[256];
+ WORD Green[256];
+ WORD Blue[256];
+} GAMMARAMP, *PGAMMARAMP;
+
+/* GDIINFO.ulPrimaryOrder constants */
+#define PRIMARY_ORDER_ABC 0
+#define PRIMARY_ORDER_ACB 1
+#define PRIMARY_ORDER_BAC 2
+#define PRIMARY_ORDER_BCA 3
+#define PRIMARY_ORDER_CBA 4
+#define PRIMARY_ORDER_CAB 5
+
+/* GDIINFO.ulHTPatternSize constants */
+#define HT_PATSIZE_2x2 0
+#define HT_PATSIZE_2x2_M 1
+#define HT_PATSIZE_4x4 2
+#define HT_PATSIZE_4x4_M 3
+#define HT_PATSIZE_6x6 4
+#define HT_PATSIZE_6x6_M 5
+#define HT_PATSIZE_8x8 6
+#define HT_PATSIZE_8x8_M 7
+#define HT_PATSIZE_10x10 8
+#define HT_PATSIZE_10x10_M 9
+#define HT_PATSIZE_12x12 10
+#define HT_PATSIZE_12x12_M 11
+#define HT_PATSIZE_14x14 12
+#define HT_PATSIZE_14x14_M 13
+#define HT_PATSIZE_16x16 14
+#define HT_PATSIZE_16x16_M 15
+#define HT_PATSIZE_SUPERCELL 16
+#define HT_PATSIZE_SUPERCELL_M 17
+#define HT_PATSIZE_USER 18
+#define HT_PATSIZE_MAX_INDEX HT_PATSIZE_USER
+#define HT_PATSIZE_DEFAULT HT_PATSIZE_SUPERCELL_M
+#define HT_USERPAT_CX_MIN 4
+#define HT_USERPAT_CX_MAX 256
+#define HT_USERPAT_CY_MIN 4
+#define HT_USERPAT_CY_MAX 256
+
+/* GDIINFO.ulHTOutputFormat constants */
+#define HT_FORMAT_1BPP 0
+#define HT_FORMAT_4BPP 2
+#define HT_FORMAT_4BPP_IRGB 3
+#define HT_FORMAT_8BPP 4
+#define HT_FORMAT_16BPP 5
+#define HT_FORMAT_24BPP 6
+#define HT_FORMAT_32BPP 7
+
+/* GDIINFO.flHTFlags */
+#define HT_FLAG_SQUARE_DEVICE_PEL 0x00000001
+#define HT_FLAG_HAS_BLACK_DYE 0x00000002
+#define HT_FLAG_ADDITIVE_PRIMS 0x00000004
+#define HT_FLAG_USE_8BPP_BITMASK 0x00000008
+#define HT_FLAG_INK_HIGH_ABSORPTION 0x00000010
+#define HT_FLAG_INK_ABSORPTION_INDICES 0x00000060
+#define HT_FLAG_DO_DEVCLR_XFORM 0x00000080
+#define HT_FLAG_OUTPUT_CMY 0x00000100
+#define HT_FLAG_PRINT_DRAFT_MODE 0x00000200
+#define HT_FLAG_INVERT_8BPP_BITMASK_IDX 0x00000400
+#define HT_FLAG_8BPP_CMY332_MASK 0xFF000000
+
+#define MAKE_CMYMASK_BYTE(c,m,y) ((BYTE)(((BYTE)(c) & 0x07) << 5) \
+ |(BYTE)(((BYTE)(m) & 0x07) << 2) \
+ |(BYTE)((BYTE)(y) & 0x03))
+
+#define MAKE_CMY332_MASK(c,m,y) ((DWORD)(((DWORD)(c) & 0x07) << 29)\
+ |(DWORD)(((DWORD)(m) & 0x07) << 26)\
+ |(DWORD)(((DWORD)(y) & 0x03) << 24))
+
+/* GDIINFO.flHTFlags constants */
+#define HT_FLAG_INK_ABSORPTION_IDX0 0x00000000
+#define HT_FLAG_INK_ABSORPTION_IDX1 0x00000020
+#define HT_FLAG_INK_ABSORPTION_IDX2 0x00000040
+#define HT_FLAG_INK_ABSORPTION_IDX3 0x00000060
+
+#define HT_FLAG_HIGHEST_INK_ABSORPTION (HT_FLAG_INK_HIGH_ABSORPTION \
+ |HT_FLAG_INK_ABSORPTION_IDX3)
+#define HT_FLAG_HIGHER_INK_ABSORPTION (HT_FLAG_INK_HIGH_ABSORPTION \
+ |HT_FLAG_INK_ABSORPTION_IDX2)
+#define HT_FLAG_HIGH_INK_ABSORPTION (HT_FLAG_INK_HIGH_ABSORPTION \
+ |HT_FLAG_INK_ABSORPTION_IDX1)
+#define HT_FLAG_NORMAL_INK_ABSORPTION HT_FLAG_INK_ABSORPTION_IDX0
+#define HT_FLAG_LOW_INK_ABSORPTION HT_FLAG_INK_ABSORPTION_IDX1
+#define HT_FLAG_LOWER_INK_ABSORPTION HT_FLAG_INK_ABSORPTION_IDX2
+#define HT_FLAG_LOWEST_INK_ABSORPTION HT_FLAG_INK_ABSORPTION_IDX3
+
+#define HT_BITMASKPALRGB (DWORD)'0BGR'
+#define HT_SET_BITMASKPAL2RGB(pPal) (*((LPDWORD)(pPal)) = HT_BITMASKPALRGB)
+#define HT_IS_BITMASKPALRGB(pPal) (*((LPDWORD)(pPal)) == (DWORD)0)
+
+/* GDIINFO.ulPhysicalPixelCharacteristics constants */
+#define PPC_DEFAULT 0x0
+#define PPC_UNDEFINED 0x1
+#define PPC_RGB_ORDER_VERTICAL_STRIPES 0x2
+#define PPC_BGR_ORDER_VERTICAL_STRIPES 0x3
+#define PPC_RGB_ORDER_HORIZONTAL_STRIPES 0x4
+#define PPC_BGR_ORDER_HORIZONTAL_STRIPES 0x5
+
+#define PPG_DEFAULT 0
+#define PPG_SRGB 1
+
+typedef struct _GDIINFO {
+ ULONG ulVersion;
+ ULONG ulTechnology;
+ ULONG ulHorzSize;
+ ULONG ulVertSize;
+ ULONG ulHorzRes;
+ ULONG ulVertRes;
+ ULONG cBitsPixel;
+ ULONG cPlanes;
+ ULONG ulNumColors;
+ ULONG flRaster;
+ ULONG ulLogPixelsX;
+ ULONG ulLogPixelsY;
+ ULONG flTextCaps;
+ ULONG ulDACRed;
+ ULONG ulDACGreen;
+ ULONG ulDACBlue;
+ ULONG ulAspectX;
+ ULONG ulAspectY;
+ ULONG ulAspectXY;
+ LONG xStyleStep;
+ LONG yStyleStep;
+ LONG denStyleStep;
+ POINTL ptlPhysOffset;
+ SIZEL szlPhysSize;
+ ULONG ulNumPalReg;
+ COLORINFO ciDevice;
+ ULONG ulDevicePelsDPI;
+ ULONG ulPrimaryOrder;
+ ULONG ulHTPatternSize;
+ ULONG ulHTOutputFormat;
+ ULONG flHTFlags;
+ ULONG ulVRefresh;
+ ULONG ulBltAlignment;
+ ULONG ulPanningHorzRes;
+ ULONG ulPanningVertRes;
+ ULONG xPanningAlignment;
+ ULONG yPanningAlignment;
+ ULONG cxHTPat;
+ ULONG cyHTPat;
+ LPBYTE pHTPatA;
+ LPBYTE pHTPatB;
+ LPBYTE pHTPatC;
+ ULONG flShadeBlend;
+ ULONG ulPhysicalPixelCharacteristics;
+ ULONG ulPhysicalPixelGamma;
+} GDIINFO, *PGDIINFO;
+
+/* PATHDATA.flags constants */
+#define PD_BEGINSUBPATH 0x00000001
+#define PD_ENDSUBPATH 0x00000002
+#define PD_RESETSTYLE 0x00000004
+#define PD_CLOSEFIGURE 0x00000008
+#define PD_BEZIERS 0x00000010
+#define PD_ALL (PD_BEGINSUBPATH \
+ |PD_ENDSUBPATH \
+ |PD_RESETSTYLE \
+ |PD_CLOSEFIGURE \
+ PD_BEZIERS)
+
+typedef struct _PATHDATA {
+ FLONG flags;
+ ULONG count;
+ POINTFIX pptfx;
+} PATHDATA, *PPATHDATA;
+
+/* PATHOBJ.fl constants */
+#define PO_BEZIERS 0x00000001
+#define PO_ELLIPSE 0x00000002
+#define PO_ALL_INTEGERS 0x00000004
+#define PO_ENUM_AS_INTEGERS 0x00000008
+
+typedef struct _PATHOBJ {
+ FLONG fl;
+ ULONG cCurves;
+} PATHOBJ;
+
+typedef struct _GLYPHBITS {
+ POINTL ptlOrigin;
+ SIZEL sizlBitmap;
+ BYTE aj[1];
+} GLYPHBITS;
+
+typedef union _GLYPHDEF {
+ GLYPHBITS *pgb;
+ PATHOBJ *ppo;
+} GLYPHDEF;
+
+typedef struct _GLYPHPOS {
+ HGLYPH hg;
+ GLYPHDEF *pgdf;
+ POINTL *ptl;
+} GLYPHPOS, *PGLYPHPOS;
+
+typedef struct _GLYPHDATA {
+ GLYPHDEF gdf;
+ HGLYPH hg;
+ FIX fxD;
+ FIX fxA;
+ FIX fxAB;
+ FIX fxInkTop;
+ FIX fxInkBottom;
+ RECTL rclInk;
+ POINTQF ptqD;
+} GLYPHDATA;
+
+typedef struct _IFIEXTRA {
+ ULONG ulIdentifier;
+ PTRDIFF dpFontSig;
+ ULONG cig;
+ PTRDIFF dpDesignVector;
+ PTRDIFF dpAxesInfoW;
+ ULONG aulReserved[1];
+} IFIEXTRA, *PIFIEXTRA;
+
+/* IFIMETRICS constants */
+
+#define FM_VERSION_NUMBER 0x0
+
+/* IFIMETRICS.fsType constants */
+#define FM_TYPE_LICENSED 0x2
+#define FM_READONLY_EMBED 0x4
+#define FM_EDITABLE_EMBED 0x8
+#define FM_NO_EMBEDDING FM_TYPE_LICENSED
+
+/* IFIMETRICS.flInfo constants */
+#define FM_INFO_TECH_TRUETYPE 0x00000001
+#define FM_INFO_TECH_BITMAP 0x00000002
+#define FM_INFO_TECH_STROKE 0x00000004
+#define FM_INFO_TECH_OUTLINE_NOT_TRUETYPE 0x00000008
+#define FM_INFO_ARB_XFORMS 0x00000010
+#define FM_INFO_1BPP 0x00000020
+#define FM_INFO_4BPP 0x00000040
+#define FM_INFO_8BPP 0x00000080
+#define FM_INFO_16BPP 0x00000100
+#define FM_INFO_24BPP 0x00000200
+#define FM_INFO_32BPP 0x00000400
+#define FM_INFO_INTEGER_WIDTH 0x00000800
+#define FM_INFO_CONSTANT_WIDTH 0x00001000
+#define FM_INFO_NOT_CONTIGUOUS 0x00002000
+#define FM_INFO_TECH_MM 0x00004000
+#define FM_INFO_RETURNS_OUTLINES 0x00008000
+#define FM_INFO_RETURNS_STROKES 0x00010000
+#define FM_INFO_RETURNS_BITMAPS 0x00020000
+#define FM_INFO_DSIG 0x00040000
+#define FM_INFO_RIGHT_HANDED 0x00080000
+#define FM_INFO_INTEGRAL_SCALING 0x00100000
+#define FM_INFO_90DEGREE_ROTATIONS 0x00200000
+#define FM_INFO_OPTICALLY_FIXED_PITCH 0x00400000
+#define FM_INFO_DO_NOT_ENUMERATE 0x00800000
+#define FM_INFO_ISOTROPIC_SCALING_ONLY 0x01000000
+#define FM_INFO_ANISOTROPIC_SCALING_ONLY 0x02000000
+#define FM_INFO_TECH_CFF 0x04000000
+#define FM_INFO_FAMILY_EQUIV 0x08000000
+#define FM_INFO_DBCS_FIXED_PITCH 0x10000000
+#define FM_INFO_NONNEGATIVE_AC 0x20000000
+#define FM_INFO_IGNORE_TC_RA_ABLE 0x40000000
+#define FM_INFO_TECH_TYPE1 0x80000000
+
+#define MAXCHARSETS 16
+
+/* IFIMETRICS.ulPanoseCulture constants */
+#define FM_PANOSE_CULTURE_LATIN 0x0
+
+typedef struct _IFIMETRICS {
+ ULONG cjThis;
+ ULONG cjIfiExtra;
+ PTRDIFF dpwszFamilyName;
+ PTRDIFF dpwszStyleName;
+ PTRDIFF dpwszFaceName;
+ PTRDIFF dpwszUniqueName;
+ PTRDIFF dpFontSim;
+ LONG lEmbedId;
+ LONG lItalicAngle;
+ LONG lCharBias;
+ PTRDIFF dpCharSets;
+ BYTE jWinCharSet;
+ BYTE jWinPitchAndFamily;
+ USHORT usWinWeight;
+ ULONG flInfo;
+ USHORT fsSelection;
+ USHORT fsType;
+ FWORD fwdUnitsPerEm;
+ FWORD fwdLowestPPEm;
+ FWORD fwdWinAscender;
+ FWORD fwdWinDescender;
+ FWORD fwdMacAscender;
+ FWORD fwdMacDescender;
+ FWORD fwdMacLineGap;
+ FWORD fwdTypoAscender;
+ FWORD fwdTypoDescender;
+ FWORD fwdTypoLineGap;
+ FWORD fwdAveCharWidth;
+ FWORD fwdMaxCharInc;
+ FWORD fwdCapHeight;
+ FWORD fwdXHeight;
+ FWORD fwdSubscriptXSize;
+ FWORD fwdSubscriptYSize;
+ FWORD fwdSubscriptXOffset;
+ FWORD fwdSubscriptYOffset;
+ FWORD fwdSuperscriptXSize;
+ FWORD fwdSuperscriptYSize;
+ FWORD fwdSuperscriptXOffset;
+ FWORD fwdSuperscriptYOffset;
+ FWORD fwdUnderscoreSize;
+ FWORD fwdUnderscorePosition;
+ FWORD fwdStrikeoutSize;
+ FWORD fwdStrikeoutPosition;
+ BYTE chFirstChar;
+ BYTE chLastChar;
+ BYTE chDefaultChar;
+ BYTE chBreakChar;
+ WCHAR wcFirstChar;
+ WCHAR wcLastChar;
+ WCHAR wcDefaultChar;
+ WCHAR wcBreakChar;
+ POINTL ptlBaseline;
+ POINTL ptlAspect;
+ POINTL ptlCaret;
+ RECTL rclFontBox;
+ BYTE achVendId[4];
+ ULONG cKerningPairs;
+ ULONG ulPanoseCulture;
+ PANOSE panose;
+#if defined(_WIN64)
+ PVOID Align;
+#endif
+} IFIMETRICS, *PIFIMETRICS;
+
+/* LINEATTRS.fl */
+#define LA_GEOMETRIC 0x00000001
+#define LA_ALTERNATE 0x00000002
+#define LA_STARTGAP 0x00000004
+#define LA_STYLED 0x00000008
+
+/* LINEATTRS.iJoin */
+#define JOIN_ROUND 0L
+#define JOIN_BEVEL 1L
+#define JOIN_MITER 2L
+
+/* LINEATTRS.iEndCap */
+#define ENDCAP_ROUND 0L
+#define ENDCAP_SQUARE 1L
+#define ENDCAP_BUTT 2L
+
+typedef struct _LINEATTRS {
+ FLONG fl;
+ ULONG iJoin;
+ ULONG iEndCap;
+ FLOAT_LONG elWidth;
+ FLOATL eMiterLimit;
+ ULONG cstyle;
+ PFLOAT_LONG pstyle;
+ FLOAT_LONG elStyleState;
+} LINEATTRS, *PLINEATTRS;
+
+typedef struct _PALOBJ {
+ ULONG ulReserved;
+} PALOBJ;
+
+typedef struct _PERBANDINFO {
+ BOOL bRepeatThisBand;
+ SIZEL szlBand;
+ ULONG ulHorzRes;
+ ULONG ulVertRes;
+} PERBANDINFO, *PPERBANDINFO;
+
+/* STROBJ.flAccel constants */
+#define SO_FLAG_DEFAULT_PLACEMENT 0x00000001
+#define SO_HORIZONTAL 0x00000002
+#define SO_VERTICAL 0x00000004
+#define SO_REVERSED 0x00000008
+#define SO_ZERO_BEARINGS 0x00000010
+#define SO_CHAR_INC_EQUAL_BM_BASE 0x00000020
+#define SO_MAXEXT_EQUAL_BM_SIDE 0x00000040
+#define SO_DO_NOT_SUBSTITUTE_DEVICE_FONT 0x00000080
+#define SO_GLYPHINDEX_TEXTOUT 0x00000100
+#define SO_ESC_NOT_ORIENT 0x00000200
+#define SO_DXDY 0x00000400
+#define SO_CHARACTER_EXTRA 0x00000800
+#define SO_BREAK_EXTRA 0x00001000
+
+typedef struct _STROBJ {
+ ULONG cGlyphs;
+ FLONG flAccel;
+ ULONG ulCharInc;
+ RECTL rclBkGround;
+ GLYPHPOS *pgp;
+ LPWSTR pwszOrg;
+} STROBJ;
+
+typedef struct _SURFACEALIGNMENT {
+ union {
+ struct {
+ DWORD dwStartAlignment;
+ DWORD dwPitchAlignment;
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ } Linear;
+ struct {
+ DWORD dwXAlignment;
+ DWORD dwYAlignment;
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ } Rectangular;
+ };
+} SURFACEALIGNMENT, *LPSURFACEALIGNMENT;
+
+/* SURFOBJ.iType constants */
+#define STYPE_BITMAP 0L
+#define STYPE_DEVICE 1L
+#define STYPE_DEVBITMAP 3L
+
+/* SURFOBJ.fjBitmap constants */
+#define BMF_TOPDOWN 0x0001
+#define BMF_NOZEROINIT 0x0002
+#define BMF_DONTCACHE 0x0004
+#define BMF_USERMEM 0x0008
+#define BMF_KMSECTION 0x0010
+#define BMF_NOTSYSMEM 0x0020
+#define BMF_WINDOW_BLT 0x0040
+#define BMF_UMPDMEM 0x0080
+#define BMF_RESERVED 0xFF00
+
+typedef struct _SURFOBJ {
+ DHSURF dhsurf;
+ HSURF hsurf;
+ DHPDEV dhpdev;
+ HDEV hdev;
+ SIZEL sizlBitmap;
+ ULONG cjBits;
+ PVOID pvBits;
+ PVOID pvScan0;
+ LONG lDelta;
+ ULONG iUniq;
+ ULONG iBitmapFormat;
+ USHORT iType;
+ USHORT fjBitmap;
+} SURFOBJ;
+
+typedef struct _TYPE1_FONT {
+ HANDLE hPFM;
+ HANDLE hPFB;
+ ULONG ulIdentifier;
+} TYPE1_FONT;
+
+typedef struct _WNDOBJ {
+ CLIPOBJ coClient;
+ PVOID pvConsumer;
+ RECTL rclClient;
+ SURFOBJ *psoOwner;
+} WNDOBJ, *PWNDOBJ;
+
+typedef struct _XFORML {
+ FLOATL eM11;
+ FLOATL eM12;
+ FLOATL eM21;
+ FLOATL eM22;
+ FLOATL eDx;
+ FLOATL eDy;
+} XFORML, *PXFORML;
+
+typedef struct _XFORMOBJ {
+ ULONG ulReserved;
+} XFORMOBJ;
+
+/* XLATEOBJ.flXlate constants */
+#define XO_TRIVIAL 0x00000001
+#define XO_TABLE 0x00000002
+#define XO_TO_MONO 0x00000004
+#define XO_FROM_CMYK 0x00000008
+#define XO_DEVICE_ICM 0x00000010
+#define XO_HOST_ICM 0x00000020
+
+typedef struct _XLATEOBJ {
+ ULONG iUniq;
+ FLONG flXlate;
+ USHORT iSrcType;
+ USHORT iDstType;
+ ULONG cEntries;
+ ULONG *pulXlate;
+} XLATEOBJ;
+
+typedef VOID DDKAPI (CALLBACK *WNDOBJCHANGEPROC)(
+ IN WNDOBJ *pwo,
+ IN FLONG fl);
+
+
+WIN32KAPI
+HANDLE
+DDKAPI
+BRUSHOBJ_hGetColorTransform(
+ IN BRUSHOBJ *pbo);
+
+WIN32KAPI
+PVOID
+DDKAPI
+BRUSHOBJ_pvAllocRbrush(
+ IN BRUSHOBJ *pbo,
+ IN ULONG cj);
+
+WIN32KAPI
+PVOID
+DDKAPI
+BRUSHOBJ_pvGetRbrush(
+ IN BRUSHOBJ *pbo);
+
+WIN32KAPI
+ULONG
+DDKAPI
+BRUSHOBJ_ulGetBrushColor(
+ IN BRUSHOBJ *pbo);
+
+WIN32KAPI
+BOOL
+DDKAPI
+CLIPOBJ_bEnum(
+ IN CLIPOBJ *pco,
+ IN ULONG cj,
+ OUT ULONG *pv);
+
+/* CLIPOBJ_cEnumStart.iType constants */
+#define CT_RECTANGLES 0L
+
+/* CLIPOBJ_cEnumStart.iDirection constants */
+#define CD_RIGHTDOWN 0x00000000
+#define CD_LEFTDOWN 0x00000001
+#define CD_LEFTWARDS 0x00000001
+#define CD_RIGHTUP 0x00000002
+#define CD_UPWARDS 0x00000002
+#define CD_LEFTUP 0x00000003
+#define CD_ANY 0x00000004
+
+WIN32KAPI
+ULONG
+DDKAPI
+CLIPOBJ_cEnumStart(
+ IN CLIPOBJ *pco,
+ IN BOOL bAll,
+ IN ULONG iType,
+ IN ULONG iDirection,
+ IN ULONG cLimit);
+
+WIN32KAPI
+PATHOBJ*
+DDKAPI
+CLIPOBJ_ppoGetPath(
+ IN CLIPOBJ *pco);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngAcquireSemaphore(
+ IN HSEMAPHORE hsem);
+
+#define FL_ZERO_MEMORY 0x00000001
+#define FL_NONPAGED_MEMORY 0x00000002
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngAllocMem(
+ IN ULONG Flags,
+ IN ULONG MemSize,
+ IN ULONG Tag);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngAllocPrivateUserMem(
+ IN PDD_SURFACE_LOCAL psl,
+ IN SIZE_T cj,
+ IN ULONG tag);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngAllocUserMem(
+ IN SIZE_T cj,
+ IN ULONG tag);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngAlphaBlend(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN BLENDOBJ *pBlendObj);
+
+/* EngAssociateSurface.flHooks constants */
+#define HOOK_BITBLT 0x00000001
+#define HOOK_STRETCHBLT 0x00000002
+#define HOOK_PLGBLT 0x00000004
+#define HOOK_TEXTOUT 0x00000008
+#define HOOK_PAINT 0x00000010
+#define HOOK_STROKEPATH 0x00000020
+#define HOOK_FILLPATH 0x00000040
+#define HOOK_STROKEANDFILLPATH 0x00000080
+#define HOOK_LINETO 0x00000100
+#define HOOK_COPYBITS 0x00000400
+#define HOOK_MOVEPANNING 0x00000800
+#define HOOK_SYNCHRONIZE 0x00001000
+#define HOOK_STRETCHBLTROP 0x00002000
+#define HOOK_SYNCHRONIZEACCESS 0x00004000
+#define HOOK_TRANSPARENTBLT 0x00008000
+#define HOOK_ALPHABLEND 0x00010000
+#define HOOK_GRADIENTFILL 0x00020000
+#define HOOK_FLAGS 0x0003b5ff
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngAssociateSurface(
+ IN HSURF hsurf,
+ IN HDEV hdev,
+ IN FLONG flHooks);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngBitBlt(
+ IN SURFOBJ *psoTrg,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclTrg,
+ IN POINTL *pptlSrc,
+ IN POINTL *pptlMask,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrush,
+ IN ROP4 rop4);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngCheckAbort(
+ IN SURFOBJ *pso);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngClearEvent(
+ IN PEVENT pEvent);
+
+WIN32KAPI
+FD_GLYPHSET*
+DDKAPI
+EngComputeGlyphSet(
+ IN INT nCodePage,
+ IN INT nFirstChar,
+ IN INT cChars);
+
+/* EngControlSprites.fl constants */
+#define ECS_TEARDOWN 0x00000001
+#define ECS_REDRAW 0x00000002
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngControlSprites(
+ IN WNDOBJ *pwo,
+ IN FLONG fl);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngCopyBits(
+ OUT SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDest,
+ IN POINTL *pptlSrc);
+
+WIN32KAPI
+HBITMAP
+DDKAPI
+EngCreateBitmap(
+ IN SIZEL sizl,
+ IN LONG lWidth,
+ IN ULONG iFormat,
+ IN FLONG fl,
+ IN PVOID pvBits);
+
+WIN32KAPI
+CLIPOBJ*
+DDKAPI
+EngCreateClip(
+ VOID);
+
+WIN32KAPI
+HBITMAP
+DDKAPI
+EngCreateDeviceBitmap(
+ IN DHSURF dhsurf,
+ IN SIZEL sizl,
+ IN ULONG iFormatCompat);
+
+WIN32KAPI
+HSURF
+DDKAPI
+EngCreateDeviceSurface(
+ DHSURF dhsurf,
+ SIZEL sizl,
+ ULONG iFormatCompat);
+
+#if 0
+WIN32KAPI
+HDRVOBJ
+DDKAPI
+EngCreateDriverObj(
+ PVOID pvObj,
+ FREEOBJPROC pFreeObjProc,
+ HDEV hdev);
+#endif
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngCreateEvent(
+ OUT PEVENT *ppEvent);
+
+/* EngCreatePalette.iMode constants */
+#define PAL_INDEXED 0x00000001
+#define PAL_BITFIELDS 0x00000002
+#define PAL_RGB 0x00000004
+#define PAL_BGR 0x00000008
+#define PAL_CMYK 0x00000010
+
+WIN32KAPI
+HPALETTE
+DDKAPI
+EngCreatePalette(
+ IN ULONG iMode,
+ IN ULONG cColors,
+ IN ULONG *pulColors,
+ IN FLONG flRed,
+ IN FLONG flGreen,
+ IN FLONG flBlue);
+
+WIN32KAPI
+PATHOBJ*
+DDKAPI
+EngCreatePath(
+ VOID);
+
+WIN32KAPI
+HSEMAPHORE
+DDKAPI
+EngCreateSemaphore(
+ VOID);
+
+/* EngCreateWnd.fl constants */
+#define WO_RGN_CLIENT_DELTA 0x00000001
+#define WO_RGN_CLIENT 0x00000002
+#define WO_RGN_SURFACE_DELTA 0x00000004
+#define WO_RGN_SURFACE 0x00000008
+#define WO_RGN_UPDATE_ALL 0x00000010
+#define WO_RGN_WINDOW 0x00000020
+#define WO_DRAW_NOTIFY 0x00000040
+#define WO_SPRITE_NOTIFY 0x00000080
+#define WO_RGN_DESKTOP_COORD 0x00000100
+
+WIN32KAPI
+WNDOBJ*
+DDKAPI
+EngCreateWnd(
+ SURFOBJ *pso,
+ HWND hwnd,
+ WNDOBJCHANGEPROC pfn,
+ FLONG fl,
+ int iPixelFormat);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngDebugBreak(
+ VOID);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngDebugPrint(
+ IN PCHAR StandardPrefix,
+ IN PCHAR DebugMessage,
+ IN va_list ap);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngDeleteClip(
+ IN CLIPOBJ *pco);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngDeleteDriverObj(
+ IN HDRVOBJ hdo,
+ IN BOOL bCallBack,
+ IN BOOL bLocked);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngDeleteEvent(
+ IN PEVENT pEvent);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngDeleteFile(
+ IN LPWSTR pwszFileName);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngDeletePalette(
+ IN HPALETTE hpal);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngDeletePath(
+ IN PATHOBJ *ppo);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngDeleteSafeSemaphore(
+ IN OUT ENGSAFESEMAPHORE *pssem);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngDeleteSemaphore(
+ IN OUT HSEMAPHORE hsem);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngDeleteSurface(
+ IN HSURF hsurf);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngDeleteWnd(
+ IN WNDOBJ *pwo);
+
+WIN32KAPI
+DWORD
+DDKAPI
+EngDeviceIoControl(
+ IN HANDLE hDevice,
+ IN DWORD dwIoControlCode,
+ IN LPVOID lpInBuffer,
+ IN DWORD nInBufferSize,
+ IN OUT LPVOID lpOutBuffer,
+ IN DWORD nOutBufferSize,
+ OUT LPDWORD lpBytesReturned);
+
+WIN32KAPI
+ULONG
+DDKAPI
+EngDitherColor(
+ IN HDEV hdev,
+ IN ULONG iMode,
+ IN ULONG rgb,
+ OUT ULONG *pul);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngEnumForms(
+ IN HANDLE hPrinter,
+ IN DWORD Level,
+ OUT LPBYTE pForm,
+ IN DWORD cbBuf,
+ OUT LPDWORD pcbNeeded,
+ OUT LPDWORD pcReturned);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngEraseSurface(
+ IN SURFOBJ *pso,
+ IN RECTL *prcl,
+ IN ULONG iColor);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngFillPath(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mix,
+ IN FLONG flOptions);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngFindImageProcAddress(
+ IN HANDLE hModule,
+ IN LPSTR lpProcName);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngFindResource(
+ IN HANDLE h,
+ IN int iName,
+ IN int iType,
+ OUT PULONG pulSize);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngFntCacheAlloc(
+ IN ULONG FastCheckSum,
+ IN ULONG ulSize);
+
+/* EngFntCacheFault.iFaultMode constants */
+#define ENG_FNT_CACHE_READ_FAULT 0x00000001
+#define ENG_FNT_CACHE_WRITE_FAULT 0x00000002
+
+WIN32KAPI
+VOID
+DDKAPI
+EngFntCacheFault(
+ IN ULONG ulFastCheckSum,
+ IN ULONG iFaultMode);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngFntCacheLookUp(
+ IN ULONG FastCheckSum,
+ OUT ULONG *pulSize);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngFreeMem(
+ IN PVOID Mem);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngFreeModule(
+ IN HANDLE h);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngFreePrivateUserMem(
+ IN PDD_SURFACE_LOCAL psl,
+ IN PVOID pv);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngFreeUserMem(
+ IN PVOID pv);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngGetCurrentCodePage(
+ OUT PUSHORT OemCodePage,
+ OUT PUSHORT AnsiCodePage);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+EngGetCurrentProcessId(
+ VOID);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+EngGetCurrentThreadId(
+ VOID);
+
+WIN32KAPI
+LPWSTR
+DDKAPI
+EngGetDriverName(
+ IN HDEV hdev);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngGetFileChangeTime(
+ IN HANDLE h,
+ OUT LARGE_INTEGER *pChangeTime);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngGetFilePath(
+ IN HANDLE h,
+ OUT WCHAR (*pDest)[MAX_PATH+1]);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngGetForm(
+ IN HANDLE hPrinter,
+ IN LPWSTR pFormName,
+ IN DWORD Level,
+ OUT LPBYTE pForm,
+ IN DWORD cbBuf,
+ OUT LPDWORD pcbNeeded);
+
+WIN32KAPI
+ULONG
+DDKAPI
+EngGetLastError(
+ VOID);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngGetPrinter(
+ IN HANDLE hPrinter,
+ IN DWORD dwLevel,
+ OUT LPBYTE pPrinter,
+ IN DWORD cbBuf,
+ OUT LPDWORD pcbNeeded);
+
+WIN32KAPI
+DWORD
+DDKAPI
+EngGetPrinterData(
+ IN HANDLE hPrinter,
+ IN LPWSTR pValueName,
+ OUT LPDWORD pType,
+ OUT LPBYTE pData,
+ IN DWORD nSize,
+ OUT LPDWORD pcbNeeded);
+
+WIN32KAPI
+LPWSTR
+DDKAPI
+EngGetPrinterDataFileName(
+ IN HDEV hdev);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngGetPrinterDriver(
+ IN HANDLE hPrinter,
+ IN LPWSTR pEnvironment,
+ IN DWORD dwLevel,
+ OUT BYTE *lpbDrvInfo,
+ IN DWORD cbBuf,
+ OUT DWORD *pcbNeeded);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+EngGetProcessHandle(
+ VOID);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngGetType1FontList(
+ IN HDEV hdev,
+ OUT TYPE1_FONT *pType1Buffer,
+ IN ULONG cjType1Buffer,
+ OUT PULONG pulLocalFonts,
+ OUT PULONG pulRemoteFonts,
+ OUT LARGE_INTEGER *pLastModified);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngGradientFill(
+ IN SURFOBJ *psoDest,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN TRIVERTEX *pVertex,
+ IN ULONG nVertex,
+ IN PVOID pMesh,
+ IN ULONG nMesh,
+ IN RECTL *prclExtents,
+ IN POINTL *pptlDitherOrg,
+ IN ULONG ulMode);
+
+/* EngHangNotification return values */
+#define EHN_RESTORED 0x00000000
+#define EHN_ERROR 0x00000001
+
+WIN32KAPI
+ULONG
+DDKAPI
+EngHangNotification(
+ IN HDEV hDev,
+ IN PVOID Reserved);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngInitializeSafeSemaphore(
+ OUT ENGSAFESEMAPHORE *pssem);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngIsSemaphoreOwned(
+ IN HSEMAPHORE hsem);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngIsSemaphoreOwnedByCurrentThread(
+ IN HSEMAPHORE hsem);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngLineTo(
+ SURFOBJ *pso,
+ CLIPOBJ *pco,
+ BRUSHOBJ *pbo,
+ LONG x1,
+ LONG y1,
+ LONG x2,
+ LONG y2,
+ RECTL *prclBounds,
+ MIX mix);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+EngLoadImage(
+ IN LPWSTR pwszDriver);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+EngLoadModule(
+ IN LPWSTR pwsz);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+EngLoadModuleForWrite(
+ IN LPWSTR pwsz,
+ IN ULONG cjSizeOfModule);
+
+WIN32KAPI
+PDD_SURFACE_LOCAL
+DDKAPI
+EngLockDirectDrawSurface(
+ IN HANDLE hSurface);
+
+WIN32KAPI
+DRIVEROBJ*
+DDKAPI
+EngLockDriverObj(
+ IN HDRVOBJ hdo);
+
+WIN32KAPI
+SURFOBJ*
+DDKAPI
+EngLockSurface(
+ IN HSURF hsurf);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngLpkInstalled(
+ VOID);
+
+WIN32KAPI
+PEVENT
+DDKAPI
+EngMapEvent(
+ IN HDEV hDev,
+ IN HANDLE hUserObject,
+ IN PVOID Reserved1,
+ IN PVOID Reserved2,
+ IN PVOID Reserved3);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngMapFile(
+ IN LPWSTR pwsz,
+ IN ULONG cjSize,
+ OUT ULONG_PTR *piFile);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngMapFontFile(
+ ULONG_PTR iFile,
+ PULONG *ppjBuf,
+ ULONG *pcjBuf);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngMapFontFileFD(
+ IN ULONG_PTR iFile,
+ OUT PULONG *ppjBuf,
+ OUT ULONG *pcjBuf);
+
+WIN32KAPI
+PVOID
+DDKAPI
+EngMapModule(
+ IN HANDLE h,
+ OUT PULONG pSize);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngMarkBandingSurface(
+ IN HSURF hsurf);
+
+/* EngModifySurface.flSurface constants */
+#define MS_NOTSYSTEMMEMORY 0x00000001
+#define MS_SHAREDACCESS 0x00000002
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngModifySurface(
+ IN HSURF hsurf,
+ IN HDEV hdev,
+ IN FLONG flHooks,
+ IN FLONG flSurface,
+ IN DHSURF dhsurf,
+ IN VOID *pvScan0,
+ IN LONG lDelta,
+ IN VOID *pvReserved);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngMovePointer(
+ IN SURFOBJ *pso,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl);
+
+WIN32KAPI
+int
+DDKAPI
+EngMulDiv(
+ IN int a,
+ IN int b,
+ IN int c);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngMultiByteToUnicodeN(
+ OUT LPWSTR UnicodeString,
+ IN ULONG MaxBytesInUnicodeString,
+ OUT PULONG BytesInUnicodeString,
+ IN PCHAR MultiByteString,
+ IN ULONG BytesInMultiByteString);
+
+WIN32KAPI
+INT
+DDKAPI
+EngMultiByteToWideChar(
+ IN UINT CodePage,
+ OUT LPWSTR WideCharString,
+ IN INT BytesInWideCharString,
+ IN LPSTR MultiByteString,
+ IN INT BytesInMultiByteString);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngPaint(
+ IN SURFOBJ *pso,
+ IN CLIPOBJ *pco,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mix);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngPlgBlt(
+ IN SURFOBJ *psoTrg,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMsk,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlBrushOrg,
+ IN POINTFIX *pptfx,
+ IN RECTL *prcl,
+ IN POINTL *pptl,
+ IN ULONG iMode);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngProbeForRead(
+ IN PVOID Address,
+ IN ULONG Length,
+ IN ULONG Alignment);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngProbeForReadAndWrite(
+ IN PVOID Address,
+ IN ULONG Length,
+ IN ULONG Alignment);
+
+typedef enum _ENG_DEVICE_ATTRIBUTE {
+ QDA_RESERVED = 0,
+ QDA_ACCELERATION_LEVEL
+} ENG_DEVICE_ATTRIBUTE;
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngQueryDeviceAttribute(
+ IN HDEV hdev,
+ IN ENG_DEVICE_ATTRIBUTE devAttr,
+ IN VOID *pvIn,
+ IN ULONG ulInSize,
+ OUT VOID *pvOut,
+ OUT ULONG ulOutSize);
+
+WIN32KAPI
+LARGE_INTEGER
+DDKAPI
+EngQueryFileTimeStamp(
+ IN LPWSTR pwsz);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngQueryLocalTime(
+ OUT PENG_TIME_FIELDS ptf);
+
+WIN32KAPI
+ULONG
+DDKAPI
+EngQueryPalette(
+ IN HPALETTE hPal,
+ OUT ULONG *piMode,
+ IN ULONG cColors,
+ OUT ULONG *pulColors);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngQueryPerformanceCounter(
+ OUT LONGLONG *pPerformanceCount);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngQueryPerformanceFrequency(
+ OUT LONGLONG *pFrequency);
+
+typedef enum _ENG_SYSTEM_ATTRIBUTE {
+ EngProcessorFeature = 1,
+ EngNumberOfProcessors,
+ EngOptimumAvailableUserMemory,
+ EngOptimumAvailableSystemMemory,
+} ENG_SYSTEM_ATTRIBUTE;
+
+#define QSA_MMX 0x00000100
+#define QSA_SSE 0x00002000
+#define QSA_3DNOW 0x00004000
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngQuerySystemAttribute(
+ IN ENG_SYSTEM_ATTRIBUTE CapNum,
+ OUT PDWORD pCapability);
+
+WIN32KAPI
+LONG
+DDKAPI
+EngReadStateEvent(
+ IN PEVENT pEvent);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngReleaseSemaphore(
+ IN HSEMAPHORE hsem);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngRestoreFloatingPointState(
+ IN VOID *pBuffer);
+
+WIN32KAPI
+ULONG
+DDKAPI
+EngSaveFloatingPointState(
+ OUT VOID *pBuffer,
+ IN ULONG cjBufferSize);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+EngSecureMem(
+ IN PVOID Address,
+ IN ULONG Length);
+
+WIN32KAPI
+LONG
+DDKAPI
+EngSetEvent(
+ IN PEVENT pEvent);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngSetLastError(
+ IN ULONG iError);
+
+WIN32KAPI
+ULONG
+DDKAPI
+EngSetPointerShape(
+ IN SURFOBJ *pso,
+ IN SURFOBJ *psoMask,
+ IN SURFOBJ *psoColor,
+ IN XLATEOBJ *pxlo,
+ IN LONG xHot,
+ IN LONG yHot,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl,
+ IN FLONG fl);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngSetPointerTag(
+ IN HDEV hdev,
+ IN SURFOBJ *psoMask,
+ IN SURFOBJ *psoColor,
+ IN XLATEOBJ *pxlo,
+ IN FLONG fl);
+
+WIN32KAPI
+DWORD
+DDKAPI
+EngSetPrinterData(
+ IN HANDLE hPrinter,
+ IN LPWSTR pType,
+ IN DWORD dwType,
+ IN LPBYTE lpbPrinterData,
+ IN DWORD cjPrinterData);
+
+typedef int DDKCDECLAPI (*SORTCOMP)(const void *pv1, const void *pv2);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngSort(
+ IN OUT PBYTE pjBuf,
+ IN ULONG c,
+ IN ULONG cjElem,
+ IN SORTCOMP pfnComp);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngStretchBlt(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL pptlHTOrg,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN POINTL *pptlMask,
+ IN ULONG iMode);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngStretchBltROP(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlHTOrg,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN POINTL *pptlMask,
+ IN ULONG iMode,
+ IN BRUSHOBJ *pbo,
+ IN DWORD rop4);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngStrokeAndFillPath(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN XFORMOBJ *pxo,
+ IN BRUSHOBJ *pboStroke,
+ IN LINEATTRS *plineattrs,
+ IN BRUSHOBJ *pboFill,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mixFill,
+ IN FLONG flOptions);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngStrokePath(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN XFORMOBJ *pxo,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN LINEATTRS *plineattrs,
+ IN MIX mix);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngTextOut(
+ IN SURFOBJ *pso,
+ IN STROBJ *pstro,
+ IN FONTOBJ *pfo,
+ IN CLIPOBJ *pco,
+ IN RECTL *prclExtra,
+ IN RECTL *prclOpaque,
+ IN BRUSHOBJ *pboFore,
+ IN BRUSHOBJ *pboOpaque,
+ IN POINTL pptlOrg,
+ IN MIX mix);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngTransparentBlt(
+ IN SURFOBJ *psoDst,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDst,
+ IN RECTL *prclSrc,
+ IN ULONG iTransColor,
+ IN ULONG ulReserved);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngUnicodeToMultiByteN(
+ OUT PCHAR MultiByteString,
+ IN ULONG MaxBytesInMultiByteString,
+ OUT PULONG BytesInMultiByteString,
+ IN PWSTR UnicodeString,
+ IN ULONG BytesInUnicodeString);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngUnloadImage(
+ IN HANDLE hModule);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngUnlockDirectDrawSurface(
+ IN PDD_SURFACE_LOCAL pSurface);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngUnlockDriverObj(
+ IN HDRVOBJ hdo);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngUnlockSurface(
+ IN SURFOBJ *pso);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngUnmapEvent(
+ IN PEVENT pEvent);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngUnmapFile(
+ IN ULONG_PTR iFile);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngUnmapFontFile(
+ ULONG_PTR iFile);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngUnmapFontFileFD(
+ IN ULONG_PTR iFile);
+
+WIN32KAPI
+VOID
+DDKAPI
+EngUnsecureMem(
+ IN HANDLE hSecure);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngWaitForSingleObject(
+ IN PEVENT pEvent,
+ IN PLARGE_INTEGER pTimeOut);
+
+WIN32KAPI
+INT
+DDKAPI
+EngWideCharToMultiByte(
+ IN UINT CodePage,
+ IN LPWSTR WideCharString,
+ IN INT BytesInWideCharString,
+ OUT LPSTR MultiByteString,
+ IN INT BytesInMultiByteString);
+
+WIN32KAPI
+BOOL
+DDKAPI
+EngWritePrinter(
+ IN HANDLE hPrinter,
+ IN LPVOID pBuf,
+ IN DWORD cbBuf,
+ OUT LPDWORD pcWritten);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_Add(
+ IN OUT PFLOATOBJ pf,
+ IN PFLOATOBJ pf1);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_AddFloat(
+ IN OUT PFLOATOBJ pf,
+ IN FLOATL f);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_AddLong(
+ IN OUT PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_Div(
+ IN OUT PFLOATOBJ pf,
+ IN PFLOATOBJ pf1);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_DivFloat(
+ IN OUT PFLOATOBJ pf,
+ IN FLOATL f);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_DivLong(
+ IN OUT PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+BOOL
+DDKAPI
+FLOATOBJ_Equal(
+ IN PFLOATOBJ pf,
+ IN PFLOATOBJ pf1);
+
+WIN32KAPI
+BOOL
+DDKAPI
+FLOATOBJ_EqualLong(
+ IN PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+LONG
+DDKAPI
+FLOATOBJ_GetFloat(
+ IN PFLOATOBJ pf);
+
+WIN32KAPI
+LONG
+DDKAPI
+FLOATOBJ_GetLong(
+ IN PFLOATOBJ pf);
+
+WIN32KAPI
+BOOL
+DDKAPI
+FLOATOBJ_GreaterThan(
+ IN PFLOATOBJ pf,
+ IN PFLOATOBJ pf1);
+
+WIN32KAPI
+BOOL
+DDKAPI
+FLOATOBJ_GreaterThanLong(
+ IN PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+BOOL
+DDKAPI
+FLOATOBJ_LessThan(
+ IN PFLOATOBJ pf,
+ IN PFLOATOBJ pf1);
+
+WIN32KAPI
+BOOL
+DDKAPI
+FLOATOBJ_LessThanLong(
+ IN PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_Mul(
+ IN OUT PFLOATOBJ pf,
+ IN PFLOATOBJ pf1);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_MulFloat(
+ IN OUT PFLOATOBJ pf,
+ IN FLOATL f);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_MulLong(
+ IN OUT PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_Neg(
+ IN OUT PFLOATOBJ pf);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_SetFloat(
+ OUT PFLOATOBJ pf,
+ IN FLOATL f);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_SetLong(
+ OUT PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_Sub(
+ IN OUT PFLOATOBJ pf,
+ IN PFLOATOBJ pf1);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_SubFloat(
+ IN OUT PFLOATOBJ pf,
+ IN FLOATL f);
+
+WIN32KAPI
+VOID
+DDKAPI
+FLOATOBJ_SubLong(
+ IN OUT PFLOATOBJ pf,
+ IN LONG l);
+
+WIN32KAPI
+ULONG
+DDKAPI
+FONTOBJ_cGetAllGlyphHandles(
+ IN FONTOBJ *pfo,
+ OUT HGLYPH *phg);
+
+WIN32KAPI
+ULONG
+DDKAPI
+FONTOBJ_cGetGlyphs(
+ IN FONTOBJ *pfo,
+ IN ULONG iMode,
+ IN ULONG cGlyph,
+ IN HGLYPH *phg,
+ OUT PVOID **ppvGlyph);
+
+WIN32KAPI
+FD_GLYPHSET*
+DDKAPI
+FONTOBJ_pfdg(
+ IN FONTOBJ *pfo);
+
+WIN32KAPI
+IFIMETRICS*
+DDKAPI
+FONTOBJ_pifi(
+ IN FONTOBJ *pfo);
+
+WIN32KAPI
+PBYTE
+DDKAPI
+FONTOBJ_pjOpenTypeTablePointer(
+ IN FONTOBJ *pfo,
+ IN ULONG ulTag,
+ OUT ULONG *pcjTable);
+
+WIN32KAPI
+PFD_GLYPHATTR
+DDKAPI
+FONTOBJ_pQueryGlyphAttrs(
+ IN FONTOBJ *pfo,
+ IN ULONG iMode);
+
+WIN32KAPI
+PVOID
+DDKAPI
+FONTOBJ_pvTrueTypeFontFile(
+ IN FONTOBJ *pfo,
+ OUT ULONG *pcjFile);
+
+WIN32KAPI
+LPWSTR
+DDKAPI
+FONTOBJ_pwszFontFilePaths(
+ IN FONTOBJ *pfo,
+ OUT ULONG *pcwc);
+
+WIN32KAPI
+XFORMOBJ*
+DDKAPI
+FONTOBJ_pxoGetXform(
+ IN FONTOBJ *pfo);
+
+WIN32KAPI
+VOID
+DDKAPI
+FONTOBJ_vGetInfo(
+ IN FONTOBJ *pfo,
+ IN ULONG cjSize,
+ OUT FONTINFO *pfi);
+
+WIN32KAPI
+FLATPTR
+DDKAPI
+HeapVidMemAllocAligned(
+ IN LPVIDMEM lpVidMem,
+ IN DWORD dwWidth,
+ IN DWORD dwHeight,
+ IN LPSURFACEALIGNMENT lpAlignment,
+ OUT LPLONG lpNewPitch);
+
+WIN32KAPI
+LONG
+DDKAPI
+HT_ComputeRGBGammaTable(
+ IN USHORT GammaTableEntries,
+ IN USHORT GammaTableType,
+ IN USHORT RedGamma,
+ IN USHORT GreenGamma,
+ IN USHORT BlueGamma,
+ OUT LPBYTE pGammaTable);
+
+WIN32KAPI
+LONG
+DDKAPI
+HT_Get8BPPFormatPalette(
+ OUT LPPALETTEENTRY pPaletteEntry,
+ IN USHORT RedGamma,
+ IN USHORT GreenGamma,
+ IN USHORT BlueGamma);
+
+WIN32KAPI
+LONG
+DDKAPI
+HT_Get8BPPMaskPalette(
+ IN OUT LPPALETTEENTRY pPaletteEntry,
+ IN BOOL Use8BPPMaskPal,
+ IN BYTE CMYMask,
+ IN USHORT RedGamma,
+ IN USHORT GreenGamma,
+ IN USHORT BlueGamma);
+
+WIN32KAPI
+LONG
+DDKAPI
+HTUI_DeviceColorAdjustment(
+ IN LPSTR pDeviceName,
+ OUT PDEVHTADJDATA pDevHTAdjData);
+
+WIN32KAPI
+ULONG
+DDKAPI
+PALOBJ_cGetColors(
+ IN PALOBJ *ppalo,
+ IN ULONG iStart,
+ IN ULONG cColors,
+ OUT ULONG *pulColors);
+
+WIN32KAPI
+BOOL
+DDKAPI
+PATHOBJ_bCloseFigure(
+ IN PATHOBJ *ppo);
+
+WIN32KAPI
+BOOL
+DDKAPI
+PATHOBJ_bEnum(
+ IN PATHOBJ *ppo,
+ OUT PATHDATA *ppd);
+
+WIN32KAPI
+BOOL
+DDKAPI
+PATHOBJ_bEnumClipLines(
+ IN PATHOBJ *ppo,
+ IN ULONG cb,
+ OUT CLIPLINE *pcl);
+
+WIN32KAPI
+BOOL
+DDKAPI
+PATHOBJ_bMoveTo(
+ IN PATHOBJ *ppo,
+ IN POINTFIX ptfx);
+
+WIN32KAPI
+BOOL
+DDKAPI
+PATHOBJ_bPolyBezierTo(
+ IN PATHOBJ *ppo,
+ IN POINTFIX *pptfx,
+ IN ULONG cptfx);
+
+WIN32KAPI
+BOOL
+DDKAPI
+PATHOBJ_bPolyLineTo(
+ IN PATHOBJ *ppo,
+ IN POINTFIX *pptfx,
+ IN ULONG cptfx);
+
+WIN32KAPI
+VOID
+DDKAPI
+PATHOBJ_vEnumStart(
+ IN PATHOBJ *ppo);
+
+WIN32KAPI
+VOID
+DDKAPI
+PATHOBJ_vEnumStartClipLines(
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN SURFOBJ *pso,
+ IN LINEATTRS *pla);
+
+WIN32KAPI
+VOID
+DDKAPI
+PATHOBJ_vGetBounds(
+ IN PATHOBJ *ppo,
+ OUT PRECTFX prectfx);
+
+WIN32KAPI
+BOOL
+DDKAPI
+STROBJ_bEnum(
+ IN STROBJ *pstro,
+ OUT ULONG *pc,
+ OUT PGLYPHPOS *ppgpos);
+
+WIN32KAPI
+BOOL
+DDKAPI
+STROBJ_bEnumPositionsOnly(
+ IN STROBJ *pstro,
+ OUT ULONG *pc,
+ OUT PGLYPHOS **ppgpos);
+
+WIN32KAPI
+BOOL
+DDKAPI
+STROBJ_bGetAdvanceWidths(
+ IN STROBJ *pso,
+ IN ULONG iFirst,
+ IN ULONG c,
+ OUT POINTQF *pptqD);
+
+WIN32KAPI
+DWORD
+DDKAPI
+STROBJ_dwGetCodePage(
+ IN STROBJ *pstro);
+
+WIN32KAPI
+FIX
+DDKAPI
+STROBJ_fxBreakExtra(
+ IN STROBJ *pstro);
+
+WIN32KAPI
+FIX
+DDKAPI
+STROBJ_fxCharacterExtra(
+ IN STROBJ *pstro);
+
+WIN32KAPI
+VOID
+DDKAPI
+STROBJ_vEnumStart(
+ IN STROBJ *pstro);
+
+WIN32KAPI
+VOID
+DDKAPI
+VidMemFree(
+ IN LPVMEMHEAP pvmh,
+ IN FLATPTR ptr);
+
+WIN32KAPI
+BOOL
+DDKAPI
+WNDOBJ_bEnum(
+ IN WNDOBJ *pwo,
+ IN ULONG cj,
+ OUT ULONG *pul);
+
+WIN32KAPI
+ULONG
+DDKAPI
+WNDOBJ_cEnumStart(
+ IN WNDOBJ *pwo,
+ IN ULONG iType,
+ IN ULONG iDirection,
+ IN ULONG cLimit);
+
+WIN32KAPI
+VOID
+DDKAPI
+WNDOBJ_vSetConsumer(
+ IN WNDOBJ *pwo,
+ IN PVOID pvConsumer);
+
+/* XFORMOBJ_bApplyXform.iMode constants */
+#define XF_LTOL 0L
+#define XF_INV_LTOL 1L
+#define XF_LTOFX 2L
+#define XF_INV_FXTOL 3L
+
+WIN32KAPI
+BOOL
+DDKAPI
+XFORMOBJ_bApplyXform(
+ IN XFORMOBJ *pxo,
+ IN ULONG iMode,
+ IN ULONG cPoints,
+ IN PVOID pvIn,
+ OUT PVOID pvOut);
+
+WIN32KAPI
+ULONG
+DDKAPI
+XFORMOBJ_iGetFloatObjXform(
+ IN XFORMOBJ *pxo,
+ OUT FLOATOBJ_XFORM *pxfo);
+
+WIN32KAPI
+ULONG
+DDKAPI
+XFORMOBJ_iGetXform(
+ IN XFORMOBJ *pxo,
+ OUT XFORML *pxform);
+
+/* XLATEOBJ_cGetPalette.iPal constants */
+#define XO_SRCPALETTE 1
+#define XO_DESTPALETTE 2
+#define XO_DESTDCPALETTE 3
+#define XO_SRCBITFIELDS 4
+#define XO_DESTBITFIELDS 5
+
+WIN32KAPI
+ULONG
+DDKAPI
+XLATEOBJ_cGetPalette(
+ IN XLATEOBJ *pxlo,
+ IN ULONG iPal,
+ IN ULONG cPal,
+ OUT ULONG *pPal);
+
+WIN32KAPI
+HANDLE
+DDKAPI
+XLATEOBJ_hGetColorTransform(
+ IN XLATEOBJ *pxlo);
+
+WIN32KAPI
+ULONG
+DDKAPI
+XLATEOBJ_iXlate(
+ IN XLATEOBJ *pxlo,
+ IN ULONG iColor);
+
+WIN32KAPI
+ULONG*
+DDKAPI
+XLATEOBJ_piVector(
+ IN XLATEOBJ *pxlo);
+
+
+
+/* Graphics Driver Functions */
+
+BOOL
+DDKAPI
+DrvAlphaBlend(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN BLENDOBJ *pBlendObj);
+
+BOOL
+DDKAPI
+DrvAssertMode(
+ IN DHPDEV dhpdev,
+ IN BOOL bEnable);
+
+BOOL
+DDKAPI
+DrvBitBlt(
+ IN SURFOBJ *psoTrg,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclTrg,
+ IN POINTL *pptlSrc,
+ IN POINTL *pptlMask,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrush,
+ IN ROP4 rop4);
+
+VOID
+DDKAPI
+DrvCompletePDEV(
+ IN DHPDEV dhpdev,
+ IN HDEV hdev);
+
+BOOL
+DDKAPI
+DrvCopyBits(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDest,
+ IN POINTL *pptlSrc);
+
+HBITMAP
+DDKAPI
+DrvCreateDeviceBitmap(
+ IN DHPDEV dhpdev,
+ IN SIZEL sizl,
+ IN ULONG iFormat);
+
+VOID
+DDKAPI
+DrvDeleteDeviceBitmap(
+ IN DHSURF dhsurf);
+
+HBITMAP
+DDKAPI
+DrvDeriveSurface(
+ DD_DIRECTDRAW_GLOBAL *pDirectDraw,
+ DD_SURFACE_LOCAL *pSurface);
+
+LONG
+DDKAPI
+DrvDescribePixelFormat(
+ IN DHPDEV dhpdev,
+ IN LONG iPixelFormat,
+ IN ULONG cjpfd,
+ OUT PIXELFORMATDESCRIPTOR *ppfd);
+
+VOID
+DDKAPI
+DrvDestroyFont(
+ IN FONTOBJ *pfo);
+
+VOID
+DDKAPI
+DrvDisableDriver(
+ VOID);
+
+VOID
+DDKAPI
+DrvDisablePDEV(
+ IN DHPDEV dhpdev);
+
+VOID
+DDKAPI
+DrvDisableSurface(
+ IN DHPDEV dhpdev);
+
+#define DM_DEFAULT 0x00000001
+#define DM_MONOCHROME 0x00000002
+
+ULONG
+DDKAPI
+DrvDitherColor(
+ IN DHPDEV dhpdev,
+ IN ULONG iMode,
+ IN ULONG rgb,
+ OUT ULONG *pul);
+
+ULONG
+DDKAPI
+DrvDrawEscape(
+ IN SURFOBJ *pso,
+ IN ULONG iEsc,
+ IN CLIPOBJ *pco,
+ IN RECTL *prcl,
+ IN ULONG cjIn,
+ IN PVOID pvIn);
+
+BOOL
+DDKAPI
+DrvEnableDriver(
+ IN ULONG iEngineVersion,
+ IN ULONG cj,
+ OUT DRVENABLEDATA *pded);
+
+DHPDEV
+DDKAPI
+DrvEnablePDEV(
+ IN DEVMODEW *pdm,
+ IN LPWSTR pwszLogAddress,
+ IN ULONG cPat,
+ OUT HSURF *phsurfPatterns,
+ IN ULONG cjCaps,
+ OUT ULONG *pdevcaps,
+ IN ULONG cjDevInfo,
+ OUT DEVINFO *pdi,
+ IN HDEV hdev,
+ IN LPWSTR pwszDeviceName,
+ IN HANDLE hDriver);
+
+HSURF
+DDKAPI
+DrvEnableSurface(
+ IN DHPDEV dhpdev);
+
+/* DrvEndDoc.fl constants */
+#define ED_ABORTDOC 0x00000001
+
+BOOL
+DDKAPI
+DrvEndDoc(
+ IN SURFOBJ *pso,
+ IN FLONG fl);
+
+ULONG
+DDKAPI
+DrvEscape(
+ IN SURFOBJ *pso,
+ IN ULONG iEsc,
+ IN ULONG cjIn,
+ IN PVOID pvIn,
+ IN ULONG cjOut,
+ OUT PVOID pvOut);
+
+BOOL
+DDKAPI
+DrvFillPath(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mix,
+ IN FLONG flOptions);
+
+ULONG
+DDKAPI
+DrvFontManagement(
+ IN SURFOBJ *pso,
+ IN FONTOBJ *pfo,
+ IN ULONG iMode,
+ IN ULONG cjIn,
+ IN PVOID pvIn,
+ IN ULONG cjOut,
+ OUT PVOID pvOut);
+
+VOID
+DDKAPI
+DrvFree(
+ IN PVOID pv,
+ IN ULONG_PTR id);
+
+/* DrvGetGlyphMode return values */
+#define FO_HGLYPHS 0L
+#define FO_GLYPHBITS 1L
+#define FO_PATHOBJ 2L
+
+ULONG
+DDKAPI
+DrvGetGlyphMode(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo);
+
+ULONG
+DDKAPI
+DrvGetModes(
+ IN HANDLE hDriver,
+ IN ULONG cjSize,
+ OUT DEVMODEW *pdm);
+
+PVOID
+DDKAPI
+DrvGetTrueTypeFile(
+ IN ULONG_PTR iFile,
+ IN ULONG *pcj);
+
+BOOL
+DDKAPI
+DrvGradientFill(
+ IN SURFOBJ *psoDest,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN TRIVERTEX *pVertex,
+ IN ULONG nVertex,
+ IN PVOID pMesh,
+ IN ULONG nMesh,
+ IN RECTL *prclExtents,
+ IN POINTL *pptlDitherOrg,
+ IN ULONG ulMode);
+
+BOOL
+DDKAPI
+DrvIcmCheckBitmapBits(
+ IN DHPDEV dhpdev,
+ IN HANDLE hColorTransform,
+ IN SURFOBJ *pso,
+ OUT PBYTE paResults);
+
+HANDLE
+DDKAPI
+DrvIcmCreateColorTransform(
+ IN DHPDEV dhpdev,
+ IN LPLOGCOLORSPACEW pLogColorSpace,
+ IN PVOID pvSourceProfile,
+ IN ULONG cjSourceProfile,
+ IN PVOID pvDestProfile,
+ IN ULONG cjDestProfile,
+ IN PVOID pvTargetProfile,
+ IN ULONG cjTargetProfile,
+ IN DWORD dwReserved);
+
+BOOL
+DDKAPI
+DrvIcmDeleteColorTransform(
+ IN DHPDEV dhpdev,
+ IN HANDLE hcmXform);
+
+/* DrvIcmSetDeviceGammaRamp.iFormat constants */
+#define IGRF_RGB_256BYTES 0x00000000
+#define IGRF_RGB_256WORDS 0x00000001
+
+BOOL
+DDKAPI
+DrvIcmSetDeviceGammaRamp(
+ IN DHPDEV dhpdev,
+ IN ULONG iFormat,
+ IN LPVOID lpRamp);
+
+BOOL
+DDKAPI
+DrvLineTo(
+ SURFOBJ *pso,
+ CLIPOBJ *pco,
+ BRUSHOBJ *pbo,
+ LONG x1,
+ LONG y1,
+ LONG x2,
+ LONG y2,
+ RECTL *prclBounds,
+ MIX mix);
+
+ULONG_PTR
+DDKAPI
+DrvLoadFontFile(
+ ULONG cFiles,
+ ULONG_PTR *piFile,
+ PVOID *ppvView,
+ ULONG *pcjView,
+ DESIGNVECTOR *pdv,
+ ULONG ulLangID,
+ ULONG ulFastCheckSum);
+
+VOID
+DDKAPI
+DrvMovePointer(
+ IN SURFOBJ *pso,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl);
+
+BOOL
+DDKAPI
+DrvNextBand(
+ IN SURFOBJ *pso,
+ IN POINTL *pptl);
+
+VOID
+DDKAPI
+DrvNotify(
+ IN SURFOBJ *pso,
+ IN ULONG iType,
+ IN PVOID pvData);
+
+BOOL
+DDKAPI
+DrvOffset(
+ IN SURFOBJ *pso,
+ IN LONG x,
+ IN LONG y,
+ IN FLONG flReserved);
+
+BOOL
+DDKAPI
+DrvPaint(
+ IN SURFOBJ *pso,
+ IN CLIPOBJ *pco,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mix);
+
+BOOL
+DDKAPI
+DrvPlgBlt(
+ IN SURFOBJ *psoTrg,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMsk,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlBrushOrg,
+ IN POINTFIX *pptfx,
+ IN RECTL *prcl,
+ IN POINTL *pptl,
+ IN ULONG iMode);
+
+/* DrvQueryAdvanceWidths.iMode constants */
+#define QAW_GETWIDTHS 0
+#define QAW_GETEASYWIDTHS 1
+
+BOOL
+DDKAPI
+DrvQueryAdvanceWidths(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo,
+ IN ULONG iMode,
+ IN HGLYPH *phg,
+ OUT PVOID pvWidths,
+ IN ULONG cGlyphs);
+
+/* DrvQueryDeviceSupport.iType constants */
+#define QDS_CHECKJPEGFORMAT 0x00000000
+#define QDS_CHECKPNGFORMAT 0x00000001
+
+BOOL
+DDKAPI
+DrvQueryDeviceSupport(
+ SURFOBJ *pso,
+ XLATEOBJ *pxlo,
+ XFORMOBJ *pxo,
+ ULONG iType,
+ ULONG cjIn,
+ PVOID pvIn,
+ ULONG cjOut,
+ PVOID pvOut);
+
+/* DrvQueryDriverInfo.dwMode constants */
+#define DRVQUERY_USERMODE 0x00000001
+
+BOOL
+DDKAPI
+DrvQueryDriverInfo(
+ DWORD dwMode,
+ PVOID pBuffer,
+ DWORD cbBuf,
+ PDWORD pcbNeeded);
+
+PIFIMETRICS
+DDKAPI
+DrvQueryFont(
+ IN DHPDEV dhpdev,
+ IN ULONG_PTR iFile,
+ IN ULONG iFace,
+ IN ULONG_PTR *pid);
+
+/* DrvQueryFontCaps.pulCaps constants */
+#define QC_OUTLINES 0x00000001
+#define QC_1BIT 0x00000002
+#define QC_4BIT 0x00000004
+
+#define QC_FONTDRIVERCAPS (QC_OUTLINES | QC_1BIT | QC_4BIT)
+
+LONG
+DDKAPI
+DrvQueryFontCaps(
+ IN ULONG culCaps,
+ OUT ULONG *pulCaps);
+
+/* DrvQueryFontData.iMode constants */
+#define QFD_GLYPHANDBITMAP 1L
+#define QFD_GLYPHANDOUTLINE 2L
+#define QFD_MAXEXTENTS 3L
+#define QFD_TT_GLYPHANDBITMAP 4L
+#define QFD_TT_GRAY1_BITMAP 5L
+#define QFD_TT_GRAY2_BITMAP 6L
+#define QFD_TT_GRAY4_BITMAP 8L
+#define QFD_TT_GRAY8_BITMAP 9L
+
+#define QFD_TT_MONO_BITMAP QFD_TT_GRAY1_BITMAP
+
+LONG
+DDKAPI
+DrvQueryFontData(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo,
+ IN ULONG iMode,
+ IN HGLYPH hg,
+ IN OUT GLYPHDATA *pgd,
+ IN OUT PVOID pv,
+ IN ULONG cjSize);
+
+/* DrvQueryFontFile.ulMode constants */
+#define QFF_DESCRIPTION 0x00000001
+#define QFF_NUMFACES 0x00000002
+
+LONG
+DDKAPI
+DrvQueryFontFile(
+ IN ULONG_PTR iFile,
+ IN ULONG ulMode,
+ IN ULONG cjBuf,
+ IN ULONG *pulBuf);
+
+/* DrvQueryFontTree.iMode constants */
+#define QFT_UNICODE 0L
+#define QFT_LIGATURES 1L
+#define QFT_KERNPAIRS 2L
+#define QFT_GLYPHSET 3L
+
+PVOID
+DDKAPI
+DrvQueryFontTree(
+ IN DHPDEV dhpdev,
+ IN ULONG_PTR iFile,
+ IN ULONG iFace,
+ IN ULONG iMode,
+ IN ULONG_PTR *pid);
+
+PFD_GLYPHATTR
+DDKAPI
+DrvQueryGlyphAttrs(
+ IN FONTOBJ *pfo,
+ IN ULONG iMode);
+
+ULONG
+DDKAPI
+DrvQueryPerBandInfo(
+ IN SURFOBJ *pso,
+ IN OUT PERBANDINFO *pbi);
+
+/* DrvQueryTrueTypeOutline.bMetricsOnly constants */
+#define TTO_METRICS_ONLY 0x00000001
+#define TTO_QUBICS 0x00000002
+#define TTO_UNHINTED 0x00000004
+
+LONG
+DDKAPI
+DrvQueryTrueTypeOutline(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo,
+ IN HGLYPH hglyph,
+ IN BOOL bMetricsOnly,
+ IN GLYPHDATA *pgldt,
+ IN ULONG cjBuf,
+ OUT TTPOLYGONHEADER *ppoly);
+
+LONG
+DDKAPI
+DrvQueryTrueTypeTable(
+ IN ULONG_PTR iFile,
+ IN ULONG ulFont,
+ IN ULONG ulTag,
+ IN PTRDIFF dpStart,
+ IN ULONG cjBuf,
+ OUT BYTE *pjBuf,
+ OUT PBYTE *ppjTable,
+ OUT ULONG *pcjTable);
+
+/* DrvRealizeBrush.iHatch constants */
+#define RB_DITHERCOLOR 0x80000000L
+
+#define HS_DDI_MAX 6
+
+BOOL
+DDKAPI
+DrvRealizeBrush(
+ IN BRUSHOBJ *pbo,
+ IN SURFOBJ *psoTarget,
+ IN SURFOBJ *psoPattern,
+ IN SURFOBJ *psoMask,
+ IN XLATEOBJ *pxlo,
+ IN ULONG iHatch);
+
+/* DrvResetDevice return values */
+#define DRD_SUCCESS 0
+#define DRD_ERROR 1
+
+ULONG
+DDKAPI
+DrvResetDevice(
+ IN DHPDEV dhpdev,
+ IN PVOID Reserved);
+
+BOOL
+DDKAPI
+DrvResetPDEV(
+ DHPDEV dhpdevOld,
+ DHPDEV dhpdevNew);
+
+/* DrvSaveScreenBits.iMode constants */
+#define SS_SAVE 0x00000000
+#define SS_RESTORE 0x00000001
+#define SS_FREE 0x00000002
+
+ULONG_PTR
+DDKAPI
+DrvSaveScreenBits(
+ IN SURFOBJ *pso,
+ IN ULONG iMode,
+ IN ULONG_PTR ident,
+ IN RECTL *prcl);
+
+BOOL
+DDKAPI
+DrvSendPage(
+ IN SURFOBJ *pso);
+
+BOOL
+DDKAPI
+DrvSetPalette(
+ IN DHPDEV dhpdev,
+ IN PALOBJ *ppalo,
+ IN FLONG fl,
+ IN ULONG iStart,
+ IN ULONG cColors);
+
+BOOL
+DDKAPI
+DrvSetPixelFormat(
+ IN SURFOBJ *pso,
+ IN LONG iPixelFormat,
+ IN HWND hwnd);
+
+/* DrvSetPointerShape return values */
+#define SPS_ERROR 0x00000000
+#define SPS_DECLINE 0x00000001
+#define SPS_ACCEPT_NOEXCLUDE 0x00000002
+#define SPS_ACCEPT_EXCLUDE 0x00000003
+#define SPS_ACCEPT_SYNCHRONOUS 0x00000004
+
+/* DrvSetPointerShape.fl constants */
+#define SPS_CHANGE 0x00000001L
+#define SPS_ASYNCCHANGE 0x00000002L
+#define SPS_ANIMATESTART 0x00000004L
+#define SPS_ANIMATEUPDATE 0x00000008L
+#define SPS_ALPHA 0x00000010L
+#define SPS_LENGTHMASK 0x00000F00L
+#define SPS_FREQMASK 0x000FF000L
+
+ULONG
+DDKAPI
+DrvSetPointerShape(
+ IN SURFOBJ *pso,
+ IN SURFOBJ *psoMask,
+ IN SURFOBJ *psoColor,
+ IN XLATEOBJ *pxlo,
+ IN LONG xHot,
+ IN LONG yHot,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl,
+ IN FLONG fl);
+
+BOOL
+DDKAPI
+DrvStartBanding(
+ IN SURFOBJ *pso,
+ IN POINTL *pptl);
+
+BOOL
+DDKAPI
+DrvStartDoc(
+ IN SURFOBJ *pso,
+ IN LPWSTR pwszDocName,
+ IN DWORD dwJobId);
+
+BOOL
+DDKAPI
+DrvStartPage(
+ IN SURFOBJ *pso);
+
+BOOL
+DDKAPI
+DrvStretchBlt(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlHTOrg,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN POINTL *pptlMask,
+ IN ULONG iMode);
+
+BOOL
+DDKAPI
+DrvStretchBltROP(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlHTOrg,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN POINTL *pptlMask,
+ IN ULONG iMode,
+ IN BRUSHOBJ *pbo,
+ IN DWORD rop4);
+
+BOOL
+DDKAPI
+DrvStrokeAndFillPath(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN XFORMOBJ *pxo,
+ IN BRUSHOBJ *pboStroke,
+ IN LINEATTRS *plineattrs,
+ IN BRUSHOBJ *pboFill,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mixFill,
+ IN FLONG flOptions);
+
+BOOL
+DDKAPI
+DrvStrokePath(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN XFORMOBJ *pxo,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN LINEATTRS *plineattrs,
+ IN MIX mix);
+
+BOOL
+DDKAPI
+DrvSwapBuffers(
+ IN SURFOBJ *pso,
+ IN WNDOBJ *pwo);
+
+VOID
+DDKAPI
+DrvSynchronize(
+ IN DHPDEV dhpdev,
+ IN RECTL *prcl);
+
+/* DrvSynchronizeSurface.fl constants */
+#define DSS_TIMER_EVENT 0x00000001
+#define DSS_FLUSH_EVENT 0x00000002
+
+VOID
+DDKAPI
+DrvSynchronizeSurface(
+ IN SURFOBJ *pso,
+ IN RECTL *prcl,
+ IN FLONG fl);
+
+BOOL
+DDKAPI
+DrvTextOut(
+ IN SURFOBJ *pso,
+ IN STROBJ *pstro,
+ IN FONTOBJ *pfo,
+ IN CLIPOBJ *pco,
+ IN RECTL *prclExtra,
+ IN RECTL *prclOpaque,
+ IN BRUSHOBJ *pboFore,
+ IN BRUSHOBJ *pboOpaque,
+ IN POINTL *pptlOrg,
+ IN MIX mix);
+
+BOOL
+DDKAPI
+DrvTransparentBlt(
+ IN SURFOBJ *psoDst,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDst,
+ IN RECTL *prclSrc,
+ IN ULONG iTransColor,
+ IN ULONG ulReserved);
+
+BOOL
+DDKAPI
+DrvUnloadFontFile(
+ IN ULONG_PTR iFile);
+
+/* WNDOBJCHANGEPROC.fl constants */
+#define WOC_RGN_CLIENT_DELTA 0x00000001
+#define WOC_RGN_CLIENT 0x00000002
+#define WOC_RGN_SURFACE_DELTA 0x00000004
+#define WOC_RGN_SURFACE 0x00000008
+#define WOC_CHANGED 0x00000010
+#define WOC_DELETE 0x00000020
+#define WOC_DRAWN 0x00000040
+#define WOC_SPRITE_OVERLAP 0x00000080
+#define WOC_SPRITE_NO_OVERLAP 0x00000100
+
+typedef VOID DDKAPI
+(CALLBACK * WNDOBJCHANGEPROC)(
+ WNDOBJ *pwo,
+ FLONG fl);
+
+
+typedef BOOL DDKAPI
+(*PFN_DrvAlphaBlend)(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN BLENDOBJ *pBlendObj);
+
+typedef BOOL DDKAPI
+(*PFN_DrvAssertMode)(
+ IN DHPDEV dhpdev,
+ IN BOOL bEnable);
+
+typedef BOOL DDKAPI
+(*PFN_DrvBitBlt)(
+ IN SURFOBJ *psoTrg,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclTrg,
+ IN POINTL *pptlSrc,
+ IN POINTL *pptlMask,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrush,
+ IN ROP4 rop4);
+
+typedef VOID DDKAPI
+(*PFN_DrvCompletePDEV)(
+ IN DHPDEV dhpdev,
+ IN HDEV hdev);
+
+typedef BOOL DDKAPI
+(*PFN_DrvCopyBits)(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDest,
+ IN POINTL *pptlSrc);
+
+typedef HBITMAP DDKAPI
+(*PFN_DrvCreateDeviceBitmap)(
+ IN DHPDEV dhpdev,
+ IN SIZEL sizl,
+ IN ULONG iFormat);
+
+typedef VOID DDKAPI
+(*PFN_DrvDeleteDeviceBitmap)(
+ IN DHSURF dhsurf);
+
+typedef HBITMAP DDKAPI
+(*PFN_DrvDeriveSurface)(
+ DD_DIRECTDRAW_GLOBAL *pDirectDraw,
+ DD_SURFACE_LOCAL *pSurface);
+
+typedef LONG DDKAPI
+(*PFN_DrvDescribePixelFormat)(
+ IN DHPDEV dhpdev,
+ IN LONG iPixelFormat,
+ IN ULONG cjpfd,
+ OUT PIXELFORMATDESCRIPTOR *ppfd);
+
+typedef VOID DDKAPI
+(*PFN_DrvDestroyFont)(
+ IN FONTOBJ *pfo);
+
+typedef VOID DDKAPI
+(*PFN_DrvDisableDriver)(
+ VOID);
+
+typedef VOID DDKAPI
+(*PFN_DrvDisablePDEV)(
+ IN DHPDEV dhpdev);
+
+typedef VOID DDKAPI
+(*PFN_DrvDisableSurface)(
+ IN DHPDEV dhpdev);
+
+typedef ULONG DDKAPI
+(*PFN_DrvDitherColor)(
+ IN DHPDEV dhpdev,
+ IN ULONG iMode,
+ IN ULONG rgb,
+ OUT ULONG *pul);
+
+typedef ULONG DDKAPI
+(*PFN_DrvDrawEscape)(
+ IN SURFOBJ *pso,
+ IN ULONG iEsc,
+ IN CLIPOBJ *pco,
+ IN RECTL *prcl,
+ IN ULONG cjIn,
+ IN PVOID pvIn);
+
+typedef BOOL DDKAPI
+(*PFN_DrvEnableDriver)(
+ IN ULONG iEngineVersion,
+ IN ULONG cj,
+ OUT DRVENABLEDATA *pded);
+#if 0
+typedef DHPDEV DDKAPI
+(*PFN_DrvEnablePDEV)(
+ IN DEVMODEW *pdm,
+ IN LPWSTR pwszLogAddress,
+ IN ULONG cPat,
+ OUT HSURF *phsurfPatterns,
+ IN ULONG cjCaps,
+ OUT ULONG *pdevcaps,
+ IN ULONG cjDevInfo,
+ OUT DEVINFO *pdi,
+ IN HDEV hdev,
+ IN LPWSTR pwszDeviceName,
+ IN HANDLE hDriver);
+#endif
+typedef HSURF DDKAPI
+(*PFN_DrvEnableSurface)(
+ IN DHPDEV dhpdev);
+
+typedef BOOL DDKAPI
+(*PFN_DrvEndDoc)(
+ IN SURFOBJ *pso,
+ IN FLONG fl);
+
+typedef ULONG DDKAPI
+(*PFN_DrvEscape)(
+ IN SURFOBJ *pso,
+ IN ULONG iEsc,
+ IN ULONG cjIn,
+ IN PVOID pvIn,
+ IN ULONG cjOut,
+ OUT PVOID pvOut);
+
+typedef BOOL DDKAPI
+(*PFN_DrvFillPath)(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mix,
+ IN FLONG flOptions);
+
+typedef ULONG DDKAPI
+(*PFN_DrvFontManagement)(
+ IN SURFOBJ *pso,
+ IN FONTOBJ *pfo,
+ IN ULONG iMode,
+ IN ULONG cjIn,
+ IN PVOID pvIn,
+ IN ULONG cjOut,
+ OUT PVOID pvOut);
+
+typedef VOID DDKAPI
+(*PFN_DrvFree)(
+ IN PVOID pv,
+ IN ULONG_PTR id);
+
+typedef ULONG DDKAPI
+(*PFN_DrvGetGlyphMode)(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo);
+
+typedef ULONG DDKAPI
+(*PFN_DrvGetModes)(
+ IN HANDLE hDriver,
+ IN ULONG cjSize,
+ OUT DEVMODEW *pdm);
+
+typedef PVOID DDKAPI
+(*PFN_DrvGetTrueTypeFile)(
+ IN ULONG_PTR iFile,
+ IN ULONG *pcj);
+
+typedef BOOL DDKAPI
+(*PFN_DrvGradientFill)(
+ IN SURFOBJ *psoDest,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN TRIVERTEX *pVertex,
+ IN ULONG nVertex,
+ IN PVOID pMesh,
+ IN ULONG nMesh,
+ IN RECTL *prclExtents,
+ IN POINTL *pptlDitherOrg,
+ IN ULONG ulMode);
+
+typedef BOOL DDKAPI
+(*PFN_DrvIcmCheckBitmapBits)(
+ IN DHPDEV dhpdev,
+ IN HANDLE hColorTransform,
+ IN SURFOBJ *pso,
+ OUT PBYTE paResults);
+
+typedef HANDLE DDKAPI
+(*PFN_DrvIcmCreateColorTransform)(
+ IN DHPDEV dhpdev,
+ IN LPLOGCOLORSPACEW pLogColorSpace,
+ IN PVOID pvSourceProfile,
+ IN ULONG cjSourceProfile,
+ IN PVOID pvDestProfile,
+ IN ULONG cjDestProfile,
+ IN PVOID pvTargetProfile,
+ IN ULONG cjTargetProfile,
+ IN DWORD dwReserved);
+
+typedef BOOL DDKAPI
+(*PFN_DrvIcmDeleteColorTransform)(
+ IN DHPDEV dhpdev,
+ IN HANDLE hcmXform);
+
+typedef BOOL DDKAPI
+(*PFN_DrvIcmSetDeviceGammaRamp)(
+ IN DHPDEV dhpdev,
+ IN ULONG iFormat,
+ IN LPVOID lpRamp);
+
+typedef BOOL DDKAPI
+(*PFN_DrvLineTo)(
+ SURFOBJ *pso,
+ CLIPOBJ *pco,
+ BRUSHOBJ *pbo,
+ LONG x1,
+ LONG y1,
+ LONG x2,
+ LONG y2,
+ RECTL *prclBounds,
+ MIX mix);
+
+typedef ULONG_PTR DDKAPI
+(*PFN_DrvLoadFontFile)(
+ ULONG cFiles,
+ ULONG_PTR *piFile,
+ PVOID *ppvView,
+ ULONG *pcjView,
+ DESIGNVECTOR *pdv,
+ ULONG ulLangID,
+ ULONG ulFastCheckSum);
+
+typedef VOID DDKAPI
+(*PFN_DrvMovePointer)(
+ IN SURFOBJ *pso,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl);
+
+typedef BOOL DDKAPI
+(*PFN_DrvNextBand)(
+ IN SURFOBJ *pso,
+ IN POINTL *pptl);
+
+typedef VOID DDKAPI
+(*PFN_DrvNotify)(
+ IN SURFOBJ *pso,
+ IN ULONG iType,
+ IN PVOID pvData);
+
+typedef BOOL DDKAPI
+(*PFN_DrvOffset)(
+ IN SURFOBJ *pso,
+ IN LONG x,
+ IN LONG y,
+ IN FLONG flReserved);
+
+typedef BOOL DDKAPI
+(*PFN_DrvPaint)(
+ IN SURFOBJ *pso,
+ IN CLIPOBJ *pco,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mix);
+
+typedef BOOL DDKAPI
+(*PFN_DrvPlgBlt)(
+ IN SURFOBJ *psoTrg,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMsk,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlBrushOrg,
+ IN POINTFIX *pptfx,
+ IN RECTL *prcl,
+ IN POINTL *pptl,
+ IN ULONG iMode);
+
+typedef BOOL DDKAPI
+(*PFN_DrvQueryAdvanceWidths)(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo,
+ IN ULONG iMode,
+ IN HGLYPH *phg,
+ OUT PVOID pvWidths,
+ IN ULONG cGlyphs);
+
+typedef BOOL DDKAPI
+(*PFN_DrvQueryDeviceSupport)(
+ SURFOBJ *pso,
+ XLATEOBJ *pxlo,
+ XFORMOBJ *pxo,
+ ULONG iType,
+ ULONG cjIn,
+ PVOID pvIn,
+ ULONG cjOut,
+ PVOID pvOut);
+
+typedef BOOL DDKAPI
+(*PFN_DrvQueryDriverInfo)(
+ DWORD dwMode,
+ PVOID pBuffer,
+ DWORD cbBuf,
+ PDWORD pcbNeeded);
+
+typedef PIFIMETRICS DDKAPI
+(*PFN_DrvQueryFont)(
+ IN DHPDEV dhpdev,
+ IN ULONG_PTR iFile,
+ IN ULONG iFace,
+ IN ULONG_PTR *pid);
+
+typedef LONG DDKAPI
+(*PFN_DrvQueryFontCaps)(
+ IN ULONG culCaps,
+ OUT ULONG *pulCaps);
+
+typedef LONG DDKAPI
+(*PFN_DrvQueryFontData)(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo,
+ IN ULONG iMode,
+ IN HGLYPH hg,
+ IN OUT GLYPHDATA *pgd,
+ IN OUT PVOID pv,
+ IN ULONG cjSize);
+
+typedef LONG DDKAPI
+(*PFN_DrvQueryFontFile)(
+ IN ULONG_PTR iFile,
+ IN ULONG ulMode,
+ IN ULONG cjBuf,
+ IN ULONG *pulBuf);
+
+typedef PVOID DDKAPI
+(*PFN_DrvQueryFontTree)(
+ IN DHPDEV dhpdev,
+ IN ULONG_PTR iFile,
+ IN ULONG iFace,
+ IN ULONG iMode,
+ IN ULONG_PTR *pid);
+
+typedef PFD_GLYPHATTR DDKAPI
+(*PFN_DrvQueryGlyphAttrs)(
+ IN FONTOBJ *pfo,
+ IN ULONG iMode);
+
+typedef ULONG DDKAPI
+(*PFN_DrvQueryPerBandInfo)(
+ IN SURFOBJ *pso,
+ IN OUT PERBANDINFO *pbi);
+
+typedef LONG DDKAPI
+(*PFN_DrvQueryTrueTypeOutline)(
+ IN DHPDEV dhpdev,
+ IN FONTOBJ *pfo,
+ IN HGLYPH hglyph,
+ IN BOOL bMetricsOnly,
+ IN GLYPHDATA *pgldt,
+ IN ULONG cjBuf,
+ OUT TTPOLYGONHEADER *ppoly);
+
+typedef LONG DDKAPI
+(*PFN_DrvQueryTrueTypeTable)(
+ IN ULONG_PTR iFile,
+ IN ULONG ulFont,
+ IN ULONG ulTag,
+ IN PTRDIFF dpStart,
+ IN ULONG cjBuf,
+ OUT BYTE *pjBuf,
+ OUT PBYTE *ppjTable,
+ OUT ULONG *pcjTable);
+
+typedef BOOL DDKAPI
+(*PFN_DrvRealizeBrush)(
+ IN BRUSHOBJ *pbo,
+ IN SURFOBJ *psoTarget,
+ IN SURFOBJ *psoPattern,
+ IN SURFOBJ *psoMask,
+ IN XLATEOBJ *pxlo,
+ IN ULONG iHatch);
+
+typedef ULONG DDKAPI
+(*PFN_DrvResetDevice)(
+ IN DHPDEV dhpdev,
+ IN PVOID Reserved);
+
+typedef BOOL DDKAPI
+(*PFN_DrvResetPDEV)(
+ DHPDEV dhpdevOld,
+ DHPDEV dhpdevNew);
+
+typedef ULONG_PTR DDKAPI
+(*PFN_DrvSaveScreenBits)(
+ IN SURFOBJ *pso,
+ IN ULONG iMode,
+ IN ULONG_PTR ident,
+ IN RECTL *prcl);
+
+typedef BOOL DDKAPI
+(*PFN_DrvSendPage)(
+ IN SURFOBJ *pso);
+
+typedef BOOL DDKAPI
+(*PFN_DrvSetPalette)(
+ IN DHPDEV dhpdev,
+ IN PALOBJ *ppalo,
+ IN FLONG fl,
+ IN ULONG iStart,
+ IN ULONG cColors);
+
+typedef BOOL DDKAPI
+(*PFN_DrvSetPixelFormat)(
+ IN SURFOBJ *pso,
+ IN LONG iPixelFormat,
+ IN HWND hwnd);
+
+typedef ULONG DDKAPI
+(*PFN_DrvSetPointerShape)(
+ IN SURFOBJ *pso,
+ IN SURFOBJ *psoMask,
+ IN SURFOBJ *psoColor,
+ IN XLATEOBJ *pxlo,
+ IN LONG xHot,
+ IN LONG yHot,
+ IN LONG x,
+ IN LONG y,
+ IN RECTL *prcl,
+ IN FLONG fl);
+
+typedef BOOL DDKAPI
+(*PFN_DrvStartBanding)(
+ IN SURFOBJ *pso,
+ IN POINTL *pptl);
+
+typedef BOOL DDKAPI
+(*PFN_DrvStartDoc)(
+ IN SURFOBJ *pso,
+ IN LPWSTR pwszDocName,
+ IN DWORD dwJobId);
+
+typedef BOOL DDKAPI
+(*PFN_DrvStartPage)(
+ IN SURFOBJ *pso);
+
+typedef BOOL DDKAPI
+(*PFN_DrvStretchBlt)(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlHTOrg,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN POINTL *pptlMask,
+ IN ULONG iMode);
+
+typedef BOOL DDKAPI
+(*PFN_DrvStretchBltROP)(
+ IN SURFOBJ *psoDest,
+ IN SURFOBJ *psoSrc,
+ IN SURFOBJ *psoMask,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN COLORADJUSTMENT *pca,
+ IN POINTL *pptlHTOrg,
+ IN RECTL *prclDest,
+ IN RECTL *prclSrc,
+ IN POINTL *pptlMask,
+ IN ULONG iMode,
+ IN BRUSHOBJ *pbo,
+ IN DWORD rop4);
+
+typedef BOOL DDKAPI
+(*PFN_DrvStrokeAndFillPath)(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN XFORMOBJ *pxo,
+ IN BRUSHOBJ *pboStroke,
+ IN LINEATTRS *plineattrs,
+ IN BRUSHOBJ *pboFill,
+ IN POINTL *pptlBrushOrg,
+ IN MIX mixFill,
+ IN FLONG flOptions);
+
+typedef BOOL DDKAPI
+(*PFN_DrvStrokePath)(
+ IN SURFOBJ *pso,
+ IN PATHOBJ *ppo,
+ IN CLIPOBJ *pco,
+ IN XFORMOBJ *pxo,
+ IN BRUSHOBJ *pbo,
+ IN POINTL *pptlBrushOrg,
+ IN LINEATTRS *plineattrs,
+ IN MIX mix);
+
+typedef BOOL DDKAPI
+(*PFN_DrvSwapBuffers)(
+ IN SURFOBJ *pso,
+ IN WNDOBJ *pwo);
+
+typedef VOID DDKAPI
+(*PFN_DrvSynchronize)(
+ IN DHPDEV dhpdev,
+ IN RECTL *prcl);
+
+typedef VOID DDKAPI
+(*PFN_DrvSynchronizeSurface)(
+ IN SURFOBJ *pso,
+ IN RECTL *prcl,
+ IN FLONG fl);
+
+typedef BOOL DDKAPI
+(*PFN_DrvTextOut)(
+ IN SURFOBJ *pso,
+ IN STROBJ *pstro,
+ IN FONTOBJ *pfo,
+ IN CLIPOBJ *pco,
+ IN RECTL *prclExtra,
+ IN RECTL *prclOpaque,
+ IN BRUSHOBJ *pboFore,
+ IN BRUSHOBJ *pboOpaque,
+ IN POINTL *pptlOrg,
+ IN MIX mix);
+
+typedef BOOL DDKAPI
+(*PFN_DrvTransparentBlt)(
+ IN SURFOBJ *psoDst,
+ IN SURFOBJ *psoSrc,
+ IN CLIPOBJ *pco,
+ IN XLATEOBJ *pxlo,
+ IN RECTL *prclDst,
+ IN RECTL *prclSrc,
+ IN ULONG iTransColor,
+ IN ULONG ulReserved);
+
+typedef BOOL DDKAPI
+(*PFN_DrvUnloadFontFile)(
+ IN ULONG_PTR iFile);
+
+
+WIN32KAPI
+VOID
+DDKAPI
+DrvDisableDirectDraw(
+ IN DHPDEV dhpdev);
+
+WIN32KAPI
+BOOL
+DDKAPI
+DrvEnableDirectDraw(
+ IN DHPDEV dhpdev,
+ OUT DD_CALLBACKS *pCallBacks,
+ OUT DD_SURFACECALLBACKS *pSurfaceCallBacks,
+ OUT DD_PALETTECALLBACKS *pPaletteCallBacks);
+
+WIN32KAPI
+BOOL
+DDKAPI
+DrvGetDirectDrawInfo(
+ IN DHPDEV dhpdev,
+ OUT DD_HALINFO *pHalInfo,
+ OUT DWORD *pdwNumHeaps,
+ OUT VIDEOMEMORY *pvmList,
+ OUT DWORD *pdwNumFourCCCodes,
+ OUT DWORD *pdwFourCC);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINDDI_H */
--- /dev/null
+/*
+ * winddk.h
+ *
+ * Windows Device Driver Kit
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __WINDDK_H
+#define __WINDDK_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Definitions specific to this Device Driver Kit
+*/
+#define DDKAPI __attribute__((stdcall))
+#define DDKFASTAPI __attribute__((fastcall))
+#define DDKCDECLAPI __attribute__((cdecl))
+
+#if defined(_NTOSKRNL_)
+#ifndef NTOSAPI
+#define NTOSAPI DECL_EXPORT
+#endif
+#define DECLARE_INTERNAL_OBJECT(x) typedef struct _##x; typedef struct _##x *P##x;
+#define DECLARE_INTERNAL_OBJECT2(x,y) typedef struct _##x; typedef struct _##x *P##y;
+#else
+#ifndef NTOSAPI
+#define NTOSAPI DECL_IMPORT
+#endif
+#define DECLARE_INTERNAL_OBJECT(x) struct _##x; typedef struct _##x *P##x;
+#define DECLARE_INTERNAL_OBJECT2(x,y) struct _##x; typedef struct _##x *P##y;
+#endif
+
+/* Pseudo modifiers for parameters */
+#define IN
+#define OUT
+#define OPTIONAL
+#define UNALLIGNED
+
+#define CONST const
+#define VOLATILE volatile
+
+#define RESTRICTED_POINTER
+#define POINTER_ALIGNMENT
+
+
+
+/*
+** Forward declarations
+*/
+
+struct _IRP;
+struct _MDL;
+struct _KAPC;
+struct _KDPC;
+struct _KPCR;
+struct _KPRCB;
+struct _KTSS;
+struct _FILE_OBJECT;
+struct _DMA_ADAPTER;
+struct _DEVICE_OBJECT;
+struct _DRIVER_OBJECT;
+struct _SECTION_OBJECT;
+struct _IO_STATUS_BLOCK;
+struct _DEVICE_DESCRIPTION;
+struct _SCATTER_GATHER_LIST;
+
+DECLARE_INTERNAL_OBJECT(ADAPTER_OBJECT);
+DECLARE_INTERNAL_OBJECT(DMA_ADAPTER);
+DECLARE_INTERNAL_OBJECT(IO_STATUS_BLOCK);
+DECLARE_INTERNAL_OBJECT(SECTION_OBJECT);
+
+#if 1
+/* FIXME: Unknown definitions */
+struct _SET_PARTITION_INFORMATION_EX;
+typedef ULONG WAIT_TYPE;
+typedef HANDLE TRACEHANDLE;
+typedef PVOID PWMILIB_CONTEXT;
+typedef PVOID PSYSCTL_IRP_DISPOSITION;
+typedef ULONG LOGICAL;
+#endif
+
+/*
+** Routines specific to this DDK
+*/
+
+#define TAG(_a, _b, _c, _d) (ULONG) \
+ (((_a) << 0) + ((_b) << 8) + ((_c) << 16) + ((_d) << 24))
+
+static inline struct _KPCR * KeGetCurrentKPCR(
+ VOID)
+{
+ ULONG Value;
+
+ __asm__ __volatile__ ("movl %%fs:0x18, %0\n\t"
+ : "=r" (Value)
+ : /* no inputs */
+ );
+ return (struct _KPCR *) Value;
+}
+
+/*
+** Simple structures
+*/
+
+typedef LONG KPRIORITY;
+typedef ULONG KIRQL, *PKIRQL;
+typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
+typedef ULONG KAFFINITY, *PKAFFINITY;
+typedef CCHAR KPROCESSOR_MODE;
+
+typedef enum _MODE {
+ KernelMode,
+ UserMode,
+ MaximumMode
+} MODE;
+
+typedef PUNICODE_STRING PCUNICODE_STRING;
+
+typedef struct _SINGLE_LIST_ENTRY {
+ struct _SINGLE_LIST_ENTRY *Next;
+} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
+
+#define SLIST_ENTRY SINGLE_LIST_ENTRY
+#define PSLIST_ENTRY PSINGLE_LIST_ENTRY
+
+typedef union _SLIST_HEADER {
+ ULONGLONG Alignment;
+ struct {
+ SLIST_ENTRY Next;
+ USHORT Depth;
+ USHORT Sequence;
+ };
+} SLIST_HEADER, *PSLIST_HEADER;
+
+
+/* Structures not exposed to drivers */
+typedef struct _IO_TIMER *PIO_TIMER;
+typedef struct _EPROCESS *PEPROCESS;
+typedef struct _ETHREAD *PETHREAD;
+typedef struct _KINTERRUPT *PKINTERRUPT;
+typedef struct _OBJECT_TYPE *POBJECT_TYPE;
+typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
+typedef struct _COMPRESSED_DATA_INFO *PCOMPRESSED_DATA_INFO;
+typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
+typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
+typedef struct _DRIVE_LAYOUT_INFORMATION *PDRIVE_LAYOUT_INFORMATION;
+typedef struct _DRIVE_LAYOUT_INFORMATION_EX *PDRIVE_LAYOUT_INFORMATION_EX;
+
+/* Constants */
+#define MAXIMUM_PROCESSORS 32
+
+#define MAXIMUM_WAIT_OBJECTS 64
+
+#define METHOD_BUFFERED 0
+#define METHOD_IN_DIRECT 1
+#define METHOD_OUT_DIRECT 2
+#define METHOD_NEITHER 3
+
+#define LOW_PRIORITY 0
+#define LOW_REALTIME_PRIORITY 16
+#define HIGH_PRIORITY 31
+#define MAXIMUM_PRIORITY 32
+
+#define FILE_LIST_DIRECTORY 0x00000001
+#define FILE_READ_DATA 0x00000001
+#define FILE_ADD_FILE 0x00000002
+#define FILE_WRITE_DATA 0x00000002
+#define FILE_ADD_SUBDIRECTORY 0x00000004
+#define FILE_APPEND_DATA 0x00000004
+#define FILE_CREATE_PIPE_INSTANCE 0x00000004
+#define FILE_READ_EA 0x00000008
+#define FILE_WRITE_EA 0x00000010
+#define FILE_EXECUTE 0x00000020
+#define FILE_TRAVERSE 0x00000020
+#define FILE_DELETE_CHILD 0x00000040
+#define FILE_READ_ATTRIBUTES 0x00000080
+#define FILE_WRITE_ATTRIBUTES 0x00000100
+
+#define FILE_SUPERSEDED 0x00000000
+#define FILE_OPENED 0x00000001
+#define FILE_CREATED 0x00000002
+#define FILE_OVERWRITTEN 0x00000003
+#define FILE_EXISTS 0x00000004
+#define FILE_DOES_NOT_EXIST 0x00000005
+
+#define FILE_SHARE_READ 0x00000001
+#define FILE_SHARE_WRITE 0x00000002
+#define FILE_SHARE_DELETE 0x00000004
+#define FILE_SHARE_VALID_FLAGS 0x00000007
+
+#define FILE_ATTRIBUTE_READONLY 0x00000001
+#define FILE_ATTRIBUTE_HIDDEN 0x00000002
+#define FILE_ATTRIBUTE_SYSTEM 0x00000004
+#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
+#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
+#define FILE_ATTRIBUTE_DEVICE 0x00000040
+#define FILE_ATTRIBUTE_NORMAL 0x00000080
+#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
+#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
+#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
+#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
+#define FILE_ATTRIBUTE_OFFLINE 0x00001000
+#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
+#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
+
+#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
+#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
+
+#define FILE_COPY_STRUCTURED_STORAGE 0x00000041
+#define FILE_STRUCTURED_STORAGE 0x00000441
+
+#define FILE_VALID_OPTION_FLAGS 0x00ffffff
+#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
+#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
+#define FILE_VALID_SET_FLAGS 0x00000036
+
+#define FILE_SUPERSEDE 0x00000000
+#define FILE_OPEN 0x00000001
+#define FILE_CREATE 0x00000002
+#define FILE_OPEN_IF 0x00000003
+#define FILE_OVERWRITE 0x00000004
+#define FILE_OVERWRITE_IF 0x00000005
+#define FILE_MAXIMUM_DISPOSITION 0x00000005
+
+#define FILE_DIRECTORY_FILE 0x00000001
+#define FILE_WRITE_THROUGH 0x00000002
+#define FILE_SEQUENTIAL_ONLY 0x00000004
+#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
+#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
+#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
+#define FILE_NON_DIRECTORY_FILE 0x00000040
+#define FILE_CREATE_TREE_CONNECTION 0x00000080
+#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
+#define FILE_NO_EA_KNOWLEDGE 0x00000200
+#define FILE_OPEN_FOR_RECOVERY 0x00000400
+#define FILE_RANDOM_ACCESS 0x00000800
+#define FILE_DELETE_ON_CLOSE 0x00001000
+#define FILE_OPEN_BY_FILE_ID 0x00002000
+#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
+#define FILE_NO_COMPRESSION 0x00008000
+#define FILE_RESERVE_OPFILTER 0x00100000
+#define FILE_OPEN_REPARSE_POINT 0x00200000
+#define FILE_OPEN_NO_RECALL 0x00400000
+#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
+
+#define FILE_ANY_ACCESS 0x00000000
+#define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
+#define FILE_READ_ACCESS 0x00000001
+#define FILE_WRITE_ACCESS 0x00000002
+
+#define FILE_ALL_ACCESS \
+ (STANDARD_RIGHTS_REQUIRED | \
+ SYNCHRONIZE | \
+ 0x1FF)
+
+#define FILE_GENERIC_EXECUTE \
+ (STANDARD_RIGHTS_EXECUTE | \
+ FILE_READ_ATTRIBUTES | \
+ FILE_EXECUTE | \
+ SYNCHRONIZE)
+
+#define FILE_GENERIC_READ \
+ (STANDARD_RIGHTS_READ | \
+ FILE_READ_DATA | \
+ FILE_READ_ATTRIBUTES | \
+ FILE_READ_EA | \
+ SYNCHRONIZE)
+
+#define FILE_GENERIC_WRITE \
+ (STANDARD_RIGHTS_WRITE | \
+ FILE_WRITE_DATA | \
+ FILE_WRITE_ATTRIBUTES | \
+ FILE_WRITE_EA | \
+ FILE_APPEND_DATA | \
+ SYNCHRONIZE)
+
+/* Exported object types */
+extern NTOSAPI POBJECT_TYPE ExDesktopObjectType;
+extern NTOSAPI POBJECT_TYPE ExEventObjectType;
+extern NTOSAPI POBJECT_TYPE ExSemaphoreObjectType;
+extern NTOSAPI POBJECT_TYPE ExWindowStationObjectType;
+extern NTOSAPI POBJECT_TYPE IoAdapterObjectType;
+extern NTOSAPI ULONG IoDeviceHandlerObjectSize;
+extern NTOSAPI POBJECT_TYPE IoDeviceHandlerObjectType;
+extern NTOSAPI POBJECT_TYPE IoDeviceObjectType;
+extern NTOSAPI POBJECT_TYPE IoDriverObjectType;
+extern NTOSAPI POBJECT_TYPE IoFileObjectType;
+extern NTOSAPI POBJECT_TYPE LpcPortObjectType;
+extern NTOSAPI POBJECT_TYPE MmSectionObjectType;
+extern NTOSAPI POBJECT_TYPE SeTokenObjectType;
+
+extern NTOSAPI CCHAR KeNumberProcessors;
+extern NTOSAPI PHAL_DISPATCH_TABLE HalDispatchTable;
+extern NTOSAPI PHAL_PRIVATE_DISPATCH_TABLE HalPrivateDispatchTable;
+
+
+/*
+** IRP function codes
+*/
+
+#define IRP_MJ_CREATE 0x00
+#define IRP_MJ_CREATE_NAMED_PIPE 0x01
+#define IRP_MJ_CLOSE 0x02
+#define IRP_MJ_READ 0x03
+#define IRP_MJ_WRITE 0x04
+#define IRP_MJ_QUERY_INFORMATION 0x05
+#define IRP_MJ_SET_INFORMATION 0x06
+#define IRP_MJ_QUERY_EA 0x07
+#define IRP_MJ_SET_EA 0x08
+#define IRP_MJ_FLUSH_BUFFERS 0x09
+#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
+#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
+#define IRP_MJ_DIRECTORY_CONTROL 0x0c
+#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
+#define IRP_MJ_DEVICE_CONTROL 0x0e
+#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
+#define IRP_MJ_SCSI 0x0f
+#define IRP_MJ_SHUTDOWN 0x10
+#define IRP_MJ_LOCK_CONTROL 0x11
+#define IRP_MJ_CLEANUP 0x12
+#define IRP_MJ_CREATE_MAILSLOT 0x13
+#define IRP_MJ_QUERY_SECURITY 0x14
+#define IRP_MJ_SET_SECURITY 0x15
+#define IRP_MJ_POWER 0x16
+#define IRP_MJ_SYSTEM_CONTROL 0x17
+#define IRP_MJ_DEVICE_CHANGE 0x18
+#define IRP_MJ_QUERY_QUOTA 0x19
+#define IRP_MJ_SET_QUOTA 0x1a
+#define IRP_MJ_PNP 0x1b
+#define IRP_MJ_PNP_POWER 0x1b
+#define IRP_MJ_MAXIMUM_FUNCTION 0x1b
+
+#define IRP_MN_QUERY_DIRECTORY 0x01
+#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
+
+#define IRP_MN_USER_FS_REQUEST 0x00
+#define IRP_MN_MOUNT_VOLUME 0x01
+#define IRP_MN_VERIFY_VOLUME 0x02
+#define IRP_MN_LOAD_FILE_SYSTEM 0x03
+#define IRP_MN_TRACK_LINK 0x04
+#define IRP_MN_KERNEL_CALL 0x04
+
+#define IRP_MN_LOCK 0x01
+#define IRP_MN_UNLOCK_SINGLE 0x02
+#define IRP_MN_UNLOCK_ALL 0x03
+#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
+
+#define IRP_MN_NORMAL 0x00
+#define IRP_MN_DPC 0x01
+#define IRP_MN_MDL 0x02
+#define IRP_MN_COMPLETE 0x04
+#define IRP_MN_COMPRESSED 0x08
+
+#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
+#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
+#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
+
+#define IRP_MN_SCSI_CLASS 0x01
+
+#define IRP_MN_START_DEVICE 0x00
+#define IRP_MN_QUERY_REMOVE_DEVICE 0x01
+#define IRP_MN_REMOVE_DEVICE 0x02
+#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
+#define IRP_MN_STOP_DEVICE 0x04
+#define IRP_MN_QUERY_STOP_DEVICE 0x05
+#define IRP_MN_CANCEL_STOP_DEVICE 0x06
+
+#define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
+#define IRP_MN_QUERY_INTERFACE 0x08
+#define IRP_MN_QUERY_CAPABILITIES 0x09
+#define IRP_MN_QUERY_RESOURCES 0x0A
+#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
+#define IRP_MN_QUERY_DEVICE_TEXT 0x0C
+#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
+
+#define IRP_MN_READ_CONFIG 0x0F
+#define IRP_MN_WRITE_CONFIG 0x10
+#define IRP_MN_EJECT 0x11
+#define IRP_MN_SET_LOCK 0x12
+#define IRP_MN_QUERY_ID 0x13
+#define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
+#define IRP_MN_QUERY_BUS_INFORMATION 0x15
+#define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
+#define IRP_MN_SURPRISE_REMOVAL 0x17
+#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
+
+#define IRP_MN_WAIT_WAKE 0x00
+#define IRP_MN_POWER_SEQUENCE 0x01
+#define IRP_MN_SET_POWER 0x02
+#define IRP_MN_QUERY_POWER 0x03
+
+#define IRP_MN_QUERY_ALL_DATA 0x00
+#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
+#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
+#define IRP_MN_CHANGE_SINGLE_ITEM 0x03
+#define IRP_MN_ENABLE_EVENTS 0x04
+#define IRP_MN_DISABLE_EVENTS 0x05
+#define IRP_MN_ENABLE_COLLECTION 0x06
+#define IRP_MN_DISABLE_COLLECTION 0x07
+#define IRP_MN_REGINFO 0x08
+#define IRP_MN_EXECUTE_METHOD 0x09
+
+#define IRP_MN_REGINFO_EX 0x0b
+
+typedef enum _IO_ALLOCATION_ACTION {
+ KeepObject = 1,
+ DeallocateObject,
+ DeallocateObjectKeepRegisters
+} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
+
+typedef IO_ALLOCATION_ACTION DDKAPI
+(*PDRIVER_CONTROL)(
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp,
+ IN PVOID MapRegisterBase,
+ IN PVOID Context);
+
+typedef VOID DDKAPI
+(*PDRIVER_LIST_CONTROL)(
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp,
+ IN struct _SCATTER_GATHER_LIST *ScatterGather,
+ IN PVOID Context);
+
+typedef NTSTATUS DDKAPI
+(*PDRIVER_ADD_DEVICE)(
+ IN struct _DRIVER_OBJECT *DriverObject,
+ IN struct _DEVICE_OBJECT *PhysicalDeviceObject);
+
+typedef NTSTATUS DDKAPI
+(*PIO_COMPLETION_ROUTINE)(
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp,
+ IN PVOID Context);
+
+typedef VOID DDKAPI
+(*PDRIVER_CANCEL)(
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp);
+
+typedef VOID DDKAPI
+(*PKDEFERRED_ROUTINE)(
+ IN struct _KDPC *Dpc,
+ IN PVOID DeferredContext,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2);
+
+typedef NTSTATUS DDKAPI
+(*PDRIVER_DISPATCH)(
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp);
+
+typedef VOID DDKAPI
+(*PIO_DPC_ROUTINE)(
+ IN struct _KDPC *Dpc,
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp,
+ IN PVOID Context);
+
+typedef NTSTATUS DDKAPI
+(*PMM_DLL_INITIALIZE)(
+ IN PUNICODE_STRING RegistryPath);
+
+typedef NTSTATUS DDKAPI
+(*PMM_DLL_UNLOAD)(
+ VOID);
+
+typedef NTSTATUS DDKAPI
+(*PDRIVER_ENTRY)(
+ IN struct _DRIVER_OBJECT *DriverObject,
+ IN PUNICODE_STRING RegistryPath);
+
+typedef NTSTATUS DDKAPI
+(*PDRIVER_INITIALIZE)(
+ IN struct _DRIVER_OBJECT *DriverObject,
+ IN PUNICODE_STRING RegistryPath);
+
+typedef BOOLEAN DDKAPI
+(*PKSERVICE_ROUTINE)(
+ IN struct _KINTERRUPT *Interrupt,
+ IN PVOID ServiceContext);
+
+typedef VOID DDKAPI
+(*PIO_TIMER_ROUTINE)(
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN PVOID Context);
+
+typedef VOID DDKAPI
+(*PDRIVER_REINITIALIZE)(
+ IN struct _DRIVER_OBJECT *DriverObject,
+ IN PVOID Context,
+ IN ULONG Count);
+
+typedef NTSTATUS DDKAPI
+(*PDRIVER_STARTIO)(
+ IN struct _DEVICE_OBJECT *DeviceObject,
+ IN struct _IRP *Irp);
+
+typedef BOOLEAN DDKAPI
+(*PKSYNCHRONIZE_ROUTINE)(
+ IN PVOID SynchronizeContext);
+
+typedef VOID DDKAPI
+(*PDRIVER_UNLOAD)(
+ IN struct _DRIVER_OBJECT *DriverObject);
+
+
+
+/*
+** Plug and Play structures
+*/
+
+typedef VOID DDKAPI
+(*PINTERFACE_REFERENCE)(
+ PVOID Context);
+
+typedef VOID DDKAPI
+(*PINTERFACE_DEREFERENCE)(
+ PVOID Context);
+
+typedef BOOLEAN DDKAPI
+(*PTRANSLATE_BUS_ADDRESS)(
+ IN PVOID Context,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN ULONG Length,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress);
+
+typedef struct _DMA_ADAPTER* DDKAPI
+(*PGET_DMA_ADAPTER)(
+ IN PVOID Context,
+ IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
+ OUT PULONG NumberOfMapRegisters);
+
+typedef ULONG DDKAPI
+(*PGET_SET_DEVICE_DATA)(
+ IN PVOID Context,
+ IN ULONG DataType,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+typedef enum _DEVICE_POWER_STATE {
+ PowerDeviceUnspecified,
+ PowerDeviceD0,
+ PowerDeviceD1,
+ PowerDeviceD2,
+ PowerDeviceD3,
+ PowerDeviceMaximum
+} DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
+
+typedef enum _SYSTEM_POWER_STATE {
+ PowerSystemUnspecified,
+ PowerSystemWorking,
+ PowerSystemSleeping1,
+ PowerSystemSleeping2,
+ PowerSystemSleeping3,
+ PowerSystemHibernate,
+ PowerSystemShutdown,
+ PowerSystemMaximum
+} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
+
+typedef union _POWER_STATE {
+ SYSTEM_POWER_STATE SystemState;
+ DEVICE_POWER_STATE DeviceState;
+} POWER_STATE, *PPOWER_STATE;
+
+typedef enum _POWER_STATE_TYPE {
+ SystemPowerState,
+ DevicePowerState
+} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
+
+typedef enum {
+ PowerActionNone,
+ PowerActionReserved,
+ PowerActionSleep,
+ PowerActionHibernate,
+ PowerActionShutdown,
+ PowerActionShutdownReset,
+ PowerActionShutdownOff,
+ PowerActionWarmEject
+} POWER_ACTION, *PPOWER_ACTION;
+
+typedef struct _BUS_INTERFACE_STANDARD {
+ USHORT Size;
+ USHORT Version;
+ PVOID Context;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+ PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
+ PGET_DMA_ADAPTER GetDmaAdapter;
+ PGET_SET_DEVICE_DATA SetBusData;
+ PGET_SET_DEVICE_DATA GetBusData;
+} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
+
+typedef struct _DEVICE_CAPABILITIES {
+ USHORT Size;
+ USHORT Version;
+ ULONG DeviceD1 : 1;
+ ULONG DeviceD2 : 1;
+ ULONG LockSupported : 1;
+ ULONG EjectSupported : 1;
+ ULONG Removable : 1;
+ ULONG DockDevice : 1;
+ ULONG UniqueID : 1;
+ ULONG SilentInstall : 1;
+ ULONG RawDeviceOK : 1;
+ ULONG SurpriseRemovalOK : 1;
+ ULONG WakeFromD0 : 1;
+ ULONG WakeFromD1 : 1;
+ ULONG WakeFromD2 : 1;
+ ULONG WakeFromD3 : 1;
+ ULONG HardwareDisabled : 1;
+ ULONG NonDynamic : 1;
+ ULONG WarmEjectSupported : 1;
+ ULONG NoDisplayInUI : 1;
+ ULONG Reserved : 14;
+ ULONG Address;
+ ULONG UINumber;
+ DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
+ SYSTEM_POWER_STATE SystemWake;
+ DEVICE_POWER_STATE DeviceWake;
+ ULONG D1Latency;
+ ULONG D2Latency;
+ ULONG D3Latency;
+} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
+
+typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
+ USHORT Version;
+ USHORT Size;
+ GUID Event;
+ GUID InterfaceClassGuid;
+ PUNICODE_STRING SymbolicLinkName;
+} DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
+
+typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
+ USHORT Version;
+ USHORT Size;
+ GUID Event;
+} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
+
+#undef INTERFACE
+
+typedef struct _INTERFACE {
+ USHORT Size;
+ USHORT Version;
+ PVOID Context;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+} INTERFACE, *PINTERFACE;
+
+typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
+ USHORT Version;
+ USHORT Size;
+ GUID Event;
+} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
+
+typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
+
+/* PNP_DEVICE_STATE */
+
+#define PNP_DEVICE_DISABLED 0x00000001
+#define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
+#define PNP_DEVICE_FAILED 0x00000004
+#define PNP_DEVICE_REMOVED 0x00000008
+#define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
+#define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
+
+typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
+ USHORT Version;
+ USHORT Size;
+ GUID Event;
+ struct _FILE_OBJECT *FileObject;
+ LONG NameBufferOffset;
+ UCHAR CustomDataBuffer[1];
+} TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
+
+typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
+ USHORT Version;
+ USHORT Size;
+ GUID Event;
+ struct _FILE_OBJECT *FileObject;
+} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
+
+typedef enum _BUS_QUERY_ID_TYPE {
+ BusQueryDeviceID,
+ BusQueryHardwareIDs,
+ BusQueryCompatibleIDs,
+ BusQueryInstanceID,
+ BusQueryDeviceSerialNumber
+} BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
+
+typedef enum _DEVICE_TEXT_TYPE {
+ DeviceTextDescription,
+ DeviceTextLocationInformation
+} DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
+
+typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
+ DeviceUsageTypeUndefined,
+ DeviceUsageTypePaging,
+ DeviceUsageTypeHibernation,
+ DeviceUsageTypeDumpFile
+} DEVICE_USAGE_NOTIFICATION_TYPE;
+
+typedef struct _POWER_SEQUENCE {
+ ULONG SequenceD1;
+ ULONG SequenceD2;
+ ULONG SequenceD3;
+} POWER_SEQUENCE, *PPOWER_SEQUENCE;
+
+typedef enum {
+ DevicePropertyDeviceDescription,
+ DevicePropertyHardwareID,
+ DevicePropertyCompatibleIDs,
+ DevicePropertyBootConfiguration,
+ DevicePropertyBootConfigurationTranslated,
+ DevicePropertyClassName,
+ DevicePropertyClassGuid,
+ DevicePropertyDriverKeyName,
+ DevicePropertyManufacturer,
+ DevicePropertyFriendlyName,
+ DevicePropertyLocationInformation,
+ DevicePropertyPhysicalDeviceObjectName,
+ DevicePropertyBusTypeGuid,
+ DevicePropertyLegacyBusType,
+ DevicePropertyBusNumber,
+ DevicePropertyEnumeratorName,
+ DevicePropertyAddress,
+ DevicePropertyUINumber,
+ DevicePropertyInstallState,
+ DevicePropertyRemovalPolicy
+} DEVICE_REGISTRY_PROPERTY;
+
+typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
+ EventCategoryReserved,
+ EventCategoryHardwareProfileChange,
+ EventCategoryDeviceInterfaceChange,
+ EventCategoryTargetDeviceChange
+} IO_NOTIFICATION_EVENT_CATEGORY;
+
+#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
+
+typedef NTSTATUS DDKAPI
+(*PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
+ IN PVOID NotificationStructure,
+ IN PVOID Context);
+
+typedef VOID DDKAPI
+(*PDEVICE_CHANGE_COMPLETE_CALLBACK)(
+ IN PVOID Context);
+
+
+
+/*
+** System structures
+*/
+
+#define SYMBOLIC_LINK_QUERY 0x0001
+#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
+
+#define DUPLICATE_CLOSE_SOURCE 0x00000001
+#define DUPLICATE_SAME_ACCESS 0x00000002
+#define DUPLICATE_SAME_ATTRIBUTES 0x00000004
+
+typedef struct _OBJECT_NAME_INFORMATION {
+ UNICODE_STRING Name;
+} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
+
+typedef VOID DDKAPI
+(*PIO_APC_ROUTINE)(
+ IN PVOID ApcContext,
+ IN PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG Reserved);
+
+typedef struct _IO_STATUS_BLOCK {
+ union {
+ NTSTATUS Status;
+ PVOID Pointer;
+ };
+ ULONG_PTR Information;
+} IO_STATUS_BLOCK;
+
+typedef VOID DDKAPI
+(*PKNORMAL_ROUTINE)(
+ IN PVOID NormalContext,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2);
+
+typedef VOID DDKAPI
+(*PKKERNEL_ROUTINE)(
+ IN struct _KAPC *Apc,
+ IN OUT PKNORMAL_ROUTINE *NormalRoutine,
+ IN OUT PVOID *NormalContext,
+ IN OUT PVOID *SystemArgument1,
+ IN OUT PVOID *SystemArgument2);
+
+typedef VOID DDKAPI
+(*PKRUNDOWN_ROUTINE)(
+ IN struct _KAPC *Apc);
+
+typedef BOOLEAN DDKAPI
+(*PKTRANSFER_ROUTINE)(
+ VOID);
+
+typedef struct _KAPC {
+ CSHORT Type;
+ CSHORT Size;
+ ULONG Spare0;
+ struct _KTHREAD *Thread;
+ LIST_ENTRY ApcListEntry;
+ PKKERNEL_ROUTINE KernelRoutine;
+ PKRUNDOWN_ROUTINE RundownRoutine;
+ PKNORMAL_ROUTINE NormalRoutine;
+ PVOID NormalContext;
+ PVOID SystemArgument1;
+ PVOID SystemArgument2;
+ CCHAR ApcStateIndex;
+ KPROCESSOR_MODE ApcMode;
+ BOOLEAN Inserted;
+} KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
+
+typedef struct _KDEVICE_QUEUE {
+ CSHORT Type;
+ CSHORT Size;
+ LIST_ENTRY DeviceListHead;
+ KSPIN_LOCK Lock;
+ BOOLEAN Busy;
+} KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
+
+typedef struct _KDEVICE_QUEUE_ENTRY {
+ LIST_ENTRY DeviceListEntry;
+ ULONG SortKey;
+ BOOLEAN Inserted;
+} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
+*RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
+
+#define LOCK_QUEUE_WAIT 1
+#define LOCK_QUEUE_OWNER 2
+
+typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
+ LockQueueDispatcherLock,
+ LockQueueContextSwapLock,
+ LockQueuePfnLock,
+ LockQueueSystemSpaceLock,
+ LockQueueVacbLock,
+ LockQueueMasterLock,
+ LockQueueNonPagedPoolLock,
+ LockQueueIoCancelLock,
+ LockQueueWorkQueueLock,
+ LockQueueIoVpbLock,
+ LockQueueIoDatabaseLock,
+ LockQueueIoCompletionLock,
+ LockQueueNtfsStructLock,
+ LockQueueAfdWorkQueueLock,
+ LockQueueBcbLock,
+ LockQueueMaximumLock
+} KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
+
+typedef struct _KSPIN_LOCK_QUEUE {
+ struct _KSPIN_LOCK_QUEUE *VOLATILE Next;
+ PKSPIN_LOCK VOLATILE Lock;
+} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
+
+typedef struct _KLOCK_QUEUE_HANDLE {
+ KSPIN_LOCK_QUEUE LockQueue;
+ KIRQL OldIrql;
+} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
+
+typedef struct _KDPC {
+ CSHORT Type;
+ UCHAR Number;
+ UCHAR Importance;
+ LIST_ENTRY DpcListEntry;
+ PKDEFERRED_ROUTINE DeferredRoutine;
+ PVOID DeferredContext;
+ PVOID SystemArgument1;
+ PVOID SystemArgument2;
+ PULONG_PTR Lock;
+} KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
+
+typedef struct _WAIT_CONTEXT_BLOCK {
+ KDEVICE_QUEUE_ENTRY WaitQueueEntry;
+ struct _DRIVER_CONTROL *DeviceRoutine;
+ PVOID DeviceContext;
+ ULONG NumberOfMapRegisters;
+ PVOID DeviceObject;
+ PVOID CurrentIrp;
+ PKDPC BufferChainingDpc;
+} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
+
+typedef struct _DISPATCHER_HEADER {
+ UCHAR Type;
+ UCHAR Absolute;
+ UCHAR Size;
+ UCHAR Inserted;
+ LONG SignalState;
+ LIST_ENTRY WaitListHead;
+} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
+
+typedef struct _KEVENT {
+ DISPATCHER_HEADER Header;
+} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
+
+typedef struct _KSEMAPHORE {
+ DISPATCHER_HEADER Header;
+ LONG Limit;
+} KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
+
+typedef struct _FAST_MUTEX {
+ LONG Count;
+ struct _KTHREAD *Owner;
+ ULONG Contention;
+ KEVENT Event;
+ ULONG OldIrql;
+} FAST_MUTEX, *PFAST_MUTEX;
+
+typedef struct _KTIMER {
+ DISPATCHER_HEADER Header;
+ ULARGE_INTEGER DueTime;
+ LIST_ENTRY TimerListEntry;
+ struct _KDPC *Dpc;
+ LONG Period;
+} KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
+
+typedef struct _KMUTANT {
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY MutantListEntry;
+ struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
+ BOOLEAN Abandoned;
+ UCHAR ApcDisable;
+} KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
+
+typedef enum _TIMER_TYPE {
+ NotificationTimer,
+ SynchronizationTimer
+} TIMER_TYPE;
+
+#define EVENT_INCREMENT 1
+#define IO_NO_INCREMENT 0
+#define IO_CD_ROM_INCREMENT 1
+#define IO_DISK_INCREMENT 1
+#define IO_KEYBOARD_INCREMENT 6
+#define IO_MAILSLOT_INCREMENT 2
+#define IO_MOUSE_INCREMENT 6
+#define IO_NAMED_PIPE_INCREMENT 2
+#define IO_NETWORK_INCREMENT 2
+#define IO_PARALLEL_INCREMENT 1
+#define IO_SERIAL_INCREMENT 2
+#define IO_SOUND_INCREMENT 8
+#define IO_VIDEO_INCREMENT 1
+#define SEMAPHORE_INCREMENT 1
+
+typedef struct _IRP {
+ CSHORT Type;
+ USHORT Size;
+ struct _MDL *MdlAddress;
+ ULONG Flags;
+ union {
+ struct _IRP *MasterIrp;
+ LONG IrpCount;
+ PVOID SystemBuffer;
+ } AssociatedIrp;
+ LIST_ENTRY ThreadListEntry;
+ IO_STATUS_BLOCK IoStatus;
+ KPROCESSOR_MODE RequestorMode;
+ BOOLEAN PendingReturned;
+ CHAR StackCount;
+ CHAR CurrentLocation;
+ BOOLEAN Cancel;
+ KIRQL CancelIrql;
+ CCHAR ApcEnvironment;
+ UCHAR AllocationFlags;
+ PIO_STATUS_BLOCK UserIosb;
+ PKEVENT UserEvent;
+ union {
+ struct {
+ PIO_APC_ROUTINE UserApcRoutine;
+ PVOID UserApcContext;
+ } AsynchronousParameters;
+ LARGE_INTEGER AllocationSize;
+ } Overlay;
+ PDRIVER_CANCEL CancelRoutine;
+ PVOID UserBuffer;
+ union {
+ struct {
+ union {
+ KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
+ struct {
+ PVOID DriverContext[4];
+ };
+ };
+ PETHREAD Thread;
+ PCHAR AuxiliaryBuffer;
+ struct {
+ LIST_ENTRY ListEntry;
+ union {
+ struct _IO_STACK_LOCATION *CurrentStackLocation;
+ ULONG PacketType;
+ };
+ };
+ struct _FILE_OBJECT *OriginalFileObject;
+ } Overlay;
+ KAPC Apc;
+ PVOID CompletionKey;
+ } Tail;
+} IRP;
+typedef struct _IRP *PIRP;
+
+/* IRP.Flags */
+
+#define SL_FORCE_ACCESS_CHECK 0x01
+#define SL_OPEN_PAGING_FILE 0x02
+#define SL_OPEN_TARGET_DIRECTORY 0x04
+#define SL_CASE_SENSITIVE 0x80
+
+#define SL_KEY_SPECIFIED 0x01
+#define SL_OVERRIDE_VERIFY_VOLUME 0x02
+#define SL_WRITE_THROUGH 0x04
+#define SL_FT_SEQUENTIAL_WRITE 0x08
+
+#define SL_FAIL_IMMEDIATELY 0x01
+#define SL_EXCLUSIVE_LOCK 0x02
+
+#define SL_RESTART_SCAN 0x01
+#define SL_RETURN_SINGLE_ENTRY 0x02
+#define SL_INDEX_SPECIFIED 0x04
+
+#define SL_WATCH_TREE 0x01
+
+#define SL_ALLOW_RAW_MOUNT 0x01
+
+#define CTL_CODE(DeviceType, Function, Method, Access)( \
+ ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
+
+#define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
+
+
+typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
+ ULONG Signature;
+} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
+
+typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
+ GUID DiskId;
+ LARGE_INTEGER StartingUsableOffset;
+ LARGE_INTEGER UsableLength;
+ ULONG MaxPartitionCount;
+} DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
+
+typedef struct _PARTITION_INFORMATION_MBR {
+ UCHAR PartitionType;
+ BOOLEAN BootIndicator;
+ BOOLEAN RecognizedPartition;
+ ULONG HiddenSectors;
+} PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
+
+
+typedef struct _BOOTDISK_INFORMATION {
+ LONGLONG BootPartitionOffset;
+ LONGLONG SystemPartitionOffset;
+ ULONG BootDeviceSignature;
+ ULONG SystemDeviceSignature;
+} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
+
+typedef struct _BOOTDISK_INFORMATION_EX {
+ LONGLONG BootPartitionOffset;
+ LONGLONG SystemPartitionOffset;
+ ULONG BootDeviceSignature;
+ ULONG SystemDeviceSignature;
+ GUID BootDeviceGuid;
+ GUID SystemDeviceGuid;
+ BOOLEAN BootDeviceIsGpt;
+ BOOLEAN SystemDeviceIsGpt;
+} BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
+
+typedef struct _EISA_MEMORY_TYPE {
+ UCHAR ReadWrite : 1;
+ UCHAR Cached : 1;
+ UCHAR Reserved0 : 1;
+ UCHAR Type : 2;
+ UCHAR Shared : 1;
+ UCHAR Reserved1 : 1;
+ UCHAR MoreEntries : 1;
+} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
+
+typedef struct _EISA_MEMORY_CONFIGURATION {
+ EISA_MEMORY_TYPE ConfigurationByte;
+ UCHAR DataSize;
+ USHORT AddressLowWord;
+ UCHAR AddressHighByte;
+ USHORT MemorySize;
+} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
+
+typedef struct _EISA_IRQ_DESCRIPTOR {
+ UCHAR Interrupt : 4;
+ UCHAR Reserved : 1;
+ UCHAR LevelTriggered : 1;
+ UCHAR Shared : 1;
+ UCHAR MoreEntries : 1;
+} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
+
+typedef struct _EISA_IRQ_CONFIGURATION {
+ EISA_IRQ_DESCRIPTOR ConfigurationByte;
+ UCHAR Reserved;
+} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
+
+typedef struct _DMA_CONFIGURATION_BYTE0 {
+ UCHAR Channel : 3;
+ UCHAR Reserved : 3;
+ UCHAR Shared : 1;
+ UCHAR MoreEntries : 1;
+} DMA_CONFIGURATION_BYTE0;
+
+typedef struct _DMA_CONFIGURATION_BYTE1 {
+ UCHAR Reserved0 : 2;
+ UCHAR TransferSize : 2;
+ UCHAR Timing : 2;
+ UCHAR Reserved1 : 2;
+} DMA_CONFIGURATION_BYTE1;
+
+typedef struct _EISA_DMA_CONFIGURATION {
+ DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
+ DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
+} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
+
+typedef struct _EISA_PORT_DESCRIPTOR {
+ UCHAR NumberPorts : 5;
+ UCHAR Reserved : 1;
+ UCHAR Shared : 1;
+ UCHAR MoreEntries : 1;
+} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
+
+typedef struct _EISA_PORT_CONFIGURATION {
+ EISA_PORT_DESCRIPTOR Configuration;
+ USHORT PortAddress;
+} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
+
+typedef struct _CM_EISA_FUNCTION_INFORMATION {
+ ULONG CompressedId;
+ UCHAR IdSlotFlags1;
+ UCHAR IdSlotFlags2;
+ UCHAR MinorRevision;
+ UCHAR MajorRevision;
+ UCHAR Selections[26];
+ UCHAR FunctionFlags;
+ UCHAR TypeString[80];
+ EISA_MEMORY_CONFIGURATION EisaMemory[9];
+ EISA_IRQ_CONFIGURATION EisaIrq[7];
+ EISA_DMA_CONFIGURATION EisaDma[4];
+ EISA_PORT_CONFIGURATION EisaPort[20];
+ UCHAR InitializationData[60];
+} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
+
+/* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
+
+#define EISA_FUNCTION_ENABLED 0x80
+#define EISA_FREE_FORM_DATA 0x40
+#define EISA_HAS_PORT_INIT_ENTRY 0x20
+#define EISA_HAS_PORT_RANGE 0x10
+#define EISA_HAS_DMA_ENTRY 0x08
+#define EISA_HAS_IRQ_ENTRY 0x04
+#define EISA_HAS_MEMORY_ENTRY 0x02
+#define EISA_HAS_TYPE_ENTRY 0x01
+#define EISA_HAS_INFORMATION \
+ EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
+ + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY
+
+typedef struct _CM_EISA_SLOT_INFORMATION {
+ UCHAR ReturnCode;
+ UCHAR ReturnFlags;
+ UCHAR MajorRevision;
+ UCHAR MinorRevision;
+ USHORT Checksum;
+ UCHAR NumberFunctions;
+ UCHAR FunctionInformation;
+ ULONG CompressedId;
+} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
+
+/* CM_EISA_SLOT_INFORMATION.ReturnCode */
+
+#define EISA_INVALID_SLOT 0x80
+#define EISA_INVALID_FUNCTION 0x81
+#define EISA_INVALID_CONFIGURATION 0x82
+#define EISA_EMPTY_SLOT 0x83
+#define EISA_INVALID_BIOS_CALL 0x86
+
+typedef struct _CM_FLOPPY_DEVICE_DATA {
+ USHORT Version;
+ USHORT Revision;
+ CHAR Size[8];
+ ULONG MaxDensity;
+ ULONG MountDensity;
+ UCHAR StepRateHeadUnloadTime;
+ UCHAR HeadLoadTime;
+ UCHAR MotorOffTime;
+ UCHAR SectorLengthCode;
+ UCHAR SectorPerTrack;
+ UCHAR ReadWriteGapLength;
+ UCHAR DataTransferLength;
+ UCHAR FormatGapLength;
+ UCHAR FormatFillCharacter;
+ UCHAR HeadSettleTime;
+ UCHAR MotorSettleTime;
+ UCHAR MaximumTrackValue;
+ UCHAR DataTransferRate;
+} CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
+
+typedef enum _INTERFACE_TYPE {
+ InterfaceTypeUndefined = -1,
+ Internal,
+ Isa,
+ Eisa,
+ MicroChannel,
+ TurboChannel,
+ PCIBus,
+ VMEBus,
+ NuBus,
+ PCMCIABus,
+ CBus,
+ MPIBus,
+ MPSABus,
+ ProcessorInternal,
+ InternalPowerBus,
+ PNPISABus,
+ PNPBus,
+ MaximumInterfaceType
+} INTERFACE_TYPE, *PINTERFACE_TYPE;
+
+typedef struct _PNP_BUS_INFORMATION {
+ GUID BusTypeGuid;
+ INTERFACE_TYPE LegacyBusType;
+ ULONG BusNumber;
+} PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
+
+typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
+ UCHAR Type;
+ UCHAR ShareDisposition;
+ USHORT Flags;
+ union {
+ struct {
+ PHYSICAL_ADDRESS Start;
+ ULONG Length;
+ } Generic;
+ struct {
+ PHYSICAL_ADDRESS Start;
+ ULONG Length;
+ } Port;
+ struct {
+ ULONG Level;
+ ULONG Vector;
+ ULONG Affinity;
+ } Interrupt;
+ struct {
+ PHYSICAL_ADDRESS Start;
+ ULONG Length;
+ } Memory;
+ struct {
+ ULONG Channel;
+ ULONG Port;
+ ULONG Reserved1;
+ } Dma;
+ struct {
+ ULONG Data[3];
+ } DevicePrivate;
+ struct {
+ ULONG Start;
+ ULONG Length;
+ ULONG Reserved;
+ } BusNumber;
+ struct {
+ ULONG DataSize;
+ ULONG Reserved1;
+ ULONG Reserved2;
+ } DeviceSpecificData;
+ } u;
+} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
+
+#define CmResourceTypeNull 0
+#define CmResourceTypePort 1
+#define CmResourceTypeInterrupt 2
+#define CmResourceTypeMemory 3
+#define CmResourceTypeDma 4
+#define CmResourceTypeDeviceSpecific 5
+#define CmResourceTypeBusNumber 6
+#define CmResourceTypeMaximum 7
+#define CmResourceTypeNonArbitrated 128
+#define CmResourceTypeConfigData 128
+#define CmResourceTypeDevicePrivate 129
+#define CmResourceTypePcCardConfig 130
+#define CmResourceTypeMfCardConfig 131
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
+
+typedef enum _CM_SHARE_DISPOSITION {
+ CmResourceShareUndetermined,
+ CmResourceShareDeviceExclusive,
+ CmResourceShareDriverExclusive,
+ CmResourceShareShared
+} CM_SHARE_DISPOSITION;
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
+
+#define CM_RESOURCE_PORT_MEMORY 0x0000
+#define CM_RESOURCE_PORT_IO 0x0001
+#define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
+#define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
+#define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
+#define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
+#define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
+#define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
+
+#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
+#define CM_RESOURCE_INTERRUPT_LATCHED 0x0001
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
+
+#define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
+#define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
+#define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
+#define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
+#define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
+#define CM_RESOURCE_MEMORY_24 0x0010
+#define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
+
+/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
+
+#define CM_RESOURCE_DMA_8 0x0000
+#define CM_RESOURCE_DMA_16 0x0001
+#define CM_RESOURCE_DMA_32 0x0002
+#define CM_RESOURCE_DMA_8_AND_16 0x0004
+#define CM_RESOURCE_DMA_BUS_MASTER 0x0008
+#define CM_RESOURCE_DMA_TYPE_A 0x0010
+#define CM_RESOURCE_DMA_TYPE_B 0x0020
+#define CM_RESOURCE_DMA_TYPE_F 0x0040
+
+typedef struct _CM_PARTIAL_RESOURCE_LIST {
+ USHORT Version;
+ USHORT Revision;
+ ULONG Count;
+ CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
+} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
+
+typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
+ INTERFACE_TYPE InterfaceType;
+ ULONG BusNumber;
+ CM_PARTIAL_RESOURCE_LIST PartialResourceList;
+} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
+
+typedef struct _CM_RESOURCE_LIST {
+ ULONG Count;
+ CM_FULL_RESOURCE_DESCRIPTOR List[1];
+} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
+
+typedef struct _CM_INT13_DRIVE_PARAMETER {
+ USHORT DriveSelect;
+ ULONG MaxCylinders;
+ USHORT SectorsPerTrack;
+ USHORT MaxHeads;
+ USHORT NumberDrives;
+} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
+
+typedef struct _CM_KEYBOARD_DEVICE_DATA {
+ USHORT Version;
+ USHORT Revision;
+ UCHAR Type;
+ UCHAR Subtype;
+ USHORT KeyboardFlags;
+} CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
+
+#define KEYBOARD_INSERT_ON 0x80
+#define KEYBOARD_CAPS_LOCK_ON 0x40
+#define KEYBOARD_NUM_LOCK_ON 0x20
+#define KEYBOARD_SCROLL_LOCK_ON 0x10
+#define KEYBOARD_ALT_KEY_DOWN 0x08
+#define KEYBOARD_CTRL_KEY_DOWN 0x04
+#define KEYBOARD_LEFT_SHIFT_DOWN 0x02
+#define KEYBOARD_RIGHT_SHIFT_DOWN 0x01
+
+typedef struct _CM_MCA_POS_DATA {
+ USHORT AdapterId;
+ UCHAR PosData1;
+ UCHAR PosData2;
+ UCHAR PosData3;
+ UCHAR PosData4;
+} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
+
+typedef struct CM_Power_Data_s {
+ ULONG PD_Size;
+ DEVICE_POWER_STATE PD_MostRecentPowerState;
+ ULONG PD_Capabilities;
+ ULONG PD_D1Latency;
+ ULONG PD_D2Latency;
+ ULONG PD_D3Latency;
+ DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum];
+} CM_POWER_DATA, *PCM_POWER_DATA;
+
+#define PDCAP_D0_SUPPORTED 0x00000001
+#define PDCAP_D1_SUPPORTED 0x00000002
+#define PDCAP_D2_SUPPORTED 0x00000004
+#define PDCAP_D3_SUPPORTED 0x00000008
+#define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
+#define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
+#define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
+#define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
+#define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
+
+typedef struct _CM_SCSI_DEVICE_DATA {
+ USHORT Version;
+ USHORT Revision;
+ UCHAR HostIdentifier;
+} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
+
+typedef struct _CM_SERIAL_DEVICE_DATA {
+ USHORT Version;
+ USHORT Revision;
+ ULONG BaudClock;
+} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
+
+/* IO_RESOURCE_DESCRIPTOR.Option */
+
+#define IO_RESOURCE_PREFERRED 0x01
+#define IO_RESOURCE_DEFAULT 0x02
+#define IO_RESOURCE_ALTERNATIVE 0x08
+
+typedef struct _IO_RESOURCE_DESCRIPTOR {
+ UCHAR Option;
+ UCHAR Type;
+ UCHAR ShareDisposition;
+ UCHAR Spare1;
+ USHORT Flags;
+ USHORT Spare2;
+ union {
+ struct {
+ ULONG Length;
+ ULONG Alignment;
+ PHYSICAL_ADDRESS MinimumAddress;
+ PHYSICAL_ADDRESS MaximumAddress;
+ } Port;
+ struct {
+ ULONG Length;
+ ULONG Alignment;
+ PHYSICAL_ADDRESS MinimumAddress;
+ PHYSICAL_ADDRESS MaximumAddress;
+ } Memory;
+ struct {
+ ULONG MinimumVector;
+ ULONG MaximumVector;
+ } Interrupt;
+ struct {
+ ULONG MinimumChannel;
+ ULONG MaximumChannel;
+ } Dma;
+ struct {
+ ULONG Length;
+ ULONG Alignment;
+ PHYSICAL_ADDRESS MinimumAddress;
+ PHYSICAL_ADDRESS MaximumAddress;
+ } Generic;
+ struct {
+ ULONG Data[3];
+ } DevicePrivate;
+ struct {
+ ULONG Length;
+ ULONG MinBusNumber;
+ ULONG MaxBusNumber;
+ ULONG Reserved;
+ } BusNumber;
+ struct {
+ ULONG Priority;
+ ULONG Reserved1;
+ ULONG Reserved2;
+ } ConfigData;
+ } u;
+} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
+
+typedef struct _IO_RESOURCE_LIST {
+ USHORT Version;
+ USHORT Revision;
+ ULONG Count;
+ IO_RESOURCE_DESCRIPTOR Descriptors[1];
+} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
+
+typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
+ ULONG ListSize;
+ INTERFACE_TYPE InterfaceType;
+ ULONG BusNumber;
+ ULONG SlotNumber;
+ ULONG Reserved[3];
+ ULONG AlternativeLists;
+ IO_RESOURCE_LIST List[1];
+} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
+
+typedef struct _CONTROLLER_OBJECT {
+ CSHORT Type;
+ CSHORT Size;
+ PVOID ControllerExtension;
+ KDEVICE_QUEUE DeviceWaitQueue;
+ ULONG Spare1;
+ LARGE_INTEGER Spare2;
+} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
+
+typedef enum _DMA_WIDTH {
+ Width8Bits,
+ Width16Bits,
+ Width32Bits,
+ MaximumDmaWidth
+} DMA_WIDTH, *PDMA_WIDTH;
+
+typedef enum _DMA_SPEED {
+ Compatible,
+ TypeA,
+ TypeB,
+ TypeC,
+ TypeF,
+ MaximumDmaSpeed
+} DMA_SPEED, *PDMA_SPEED;
+
+/* DEVICE_DESCRIPTION.Version */
+
+#define DEVICE_DESCRIPTION_VERSION 0x0000
+#define DEVICE_DESCRIPTION_VERSION1 0x0001
+#define DEVICE_DESCRIPTION_VERSION2 0x0002
+
+typedef struct _DEVICE_DESCRIPTION {
+ ULONG Version;
+ BOOLEAN Master;
+ BOOLEAN ScatterGather;
+ BOOLEAN DemandMode;
+ BOOLEAN AutoInitialize;
+ BOOLEAN Dma32BitAddresses;
+ BOOLEAN IgnoreCount;
+ BOOLEAN Reserved1;
+ BOOLEAN Dma64BitAddresses;
+ ULONG BusNumber;
+ ULONG DmaChannel;
+ INTERFACE_TYPE InterfaceType;
+ DMA_WIDTH DmaWidth;
+ DMA_SPEED DmaSpeed;
+ ULONG MaximumLength;
+ ULONG DmaPort;
+} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
+
+/* VPB.Flags */
+#define VPB_MOUNTED 0x0001
+#define VPB_LOCKED 0x0002
+#define VPB_PERSISTENT 0x0004
+#define VPB_REMOVE_PENDING 0x0008
+#define VPB_RAW_MOUNT 0x0010
+
+#define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
+
+typedef struct _VPB {
+ CSHORT Type;
+ CSHORT Size;
+ USHORT Flags;
+ USHORT VolumeLabelLength;
+ struct _DEVICE_OBJECT *DeviceObject;
+ struct _DEVICE_OBJECT *RealDevice;
+ ULONG SerialNumber;
+ ULONG ReferenceCount;
+ WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
+} VPB, *PVPB;
+
+/* DEVICE_OBJECT.Flags */
+
+#define DO_VERIFY_VOLUME 0x00000002
+#define DO_BUFFERED_IO 0x00000004
+#define DO_EXCLUSIVE 0x00000008
+#define DO_DIRECT_IO 0x00000010
+#define DO_MAP_IO_BUFFER 0x00000020
+#define DO_DEVICE_HAS_NAME 0x00000040
+#define DO_DEVICE_INITIALIZING 0x00000080
+#define DO_SYSTEM_BOOT_PARTITION 0x00000100
+#define DO_LONG_TERM_REQUESTS 0x00000200
+#define DO_NEVER_LAST_DEVICE 0x00000400
+#define DO_SHUTDOWN_REGISTERED 0x00000800
+#define DO_BUS_ENUMERATED_DEVICE 0x00001000
+#define DO_POWER_PAGABLE 0x00002000
+#define DO_POWER_INRUSH 0x00004000
+#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
+
+/* DEVICE_OBJECT.Characteristics */
+
+#define FILE_REMOVABLE_MEDIA 0x00000001
+#define FILE_READ_ONLY_DEVICE 0x00000002
+#define FILE_FLOPPY_DISKETTE 0x00000004
+#define FILE_WRITE_ONCE_MEDIA 0x00000008
+#define FILE_REMOTE_DEVICE 0x00000010
+#define FILE_DEVICE_IS_MOUNTED 0x00000020
+#define FILE_VIRTUAL_VOLUME 0x00000040
+#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
+#define FILE_DEVICE_SECURE_OPEN 0x00000100
+
+/* DEVICE_OBJECT.AlignmentRequirement */
+
+#define FILE_BYTE_ALIGNMENT 0x00000000
+#define FILE_WORD_ALIGNMENT 0x00000001
+#define FILE_LONG_ALIGNMENT 0x00000003
+#define FILE_QUAD_ALIGNMENT 0x00000007
+#define FILE_OCTA_ALIGNMENT 0x0000000f
+#define FILE_32_BYTE_ALIGNMENT 0x0000001f
+#define FILE_64_BYTE_ALIGNMENT 0x0000003f
+#define FILE_128_BYTE_ALIGNMENT 0x0000007f
+#define FILE_256_BYTE_ALIGNMENT 0x000000ff
+#define FILE_512_BYTE_ALIGNMENT 0x000001ff
+
+/* DEVICE_OBJECT.DeviceType */
+
+#define DEVICE_TYPE ULONG
+
+#define FILE_DEVICE_BEEP 0x00000001
+#define FILE_DEVICE_CD_ROM 0x00000002
+#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
+#define FILE_DEVICE_CONTROLLER 0x00000004
+#define FILE_DEVICE_DATALINK 0x00000005
+#define FILE_DEVICE_DFS 0x00000006
+#define FILE_DEVICE_DISK 0x00000007
+#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
+#define FILE_DEVICE_FILE_SYSTEM 0x00000009
+#define FILE_DEVICE_INPORT_PORT 0x0000000a
+#define FILE_DEVICE_KEYBOARD 0x0000000b
+#define FILE_DEVICE_MAILSLOT 0x0000000c
+#define FILE_DEVICE_MIDI_IN 0x0000000d
+#define FILE_DEVICE_MIDI_OUT 0x0000000e
+#define FILE_DEVICE_MOUSE 0x0000000f
+#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
+#define FILE_DEVICE_NAMED_PIPE 0x00000011
+#define FILE_DEVICE_NETWORK 0x00000012
+#define FILE_DEVICE_NETWORK_BROWSER 0x00000013
+#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
+#define FILE_DEVICE_NULL 0x00000015
+#define FILE_DEVICE_PARALLEL_PORT 0x00000016
+#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
+#define FILE_DEVICE_PRINTER 0x00000018
+#define FILE_DEVICE_SCANNER 0x00000019
+#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
+#define FILE_DEVICE_SERIAL_PORT 0x0000001b
+#define FILE_DEVICE_SCREEN 0x0000001c
+#define FILE_DEVICE_SOUND 0x0000001d
+#define FILE_DEVICE_STREAMS 0x0000001e
+#define FILE_DEVICE_TAPE 0x0000001f
+#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
+#define FILE_DEVICE_TRANSPORT 0x00000021
+#define FILE_DEVICE_UNKNOWN 0x00000022
+#define FILE_DEVICE_VIDEO 0x00000023
+#define FILE_DEVICE_VIRTUAL_DISK 0x00000024
+#define FILE_DEVICE_WAVE_IN 0x00000025
+#define FILE_DEVICE_WAVE_OUT 0x00000026
+#define FILE_DEVICE_8042_PORT 0x00000027
+#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
+#define FILE_DEVICE_BATTERY 0x00000029
+#define FILE_DEVICE_BUS_EXTENDER 0x0000002a
+#define FILE_DEVICE_MODEM 0x0000002b
+#define FILE_DEVICE_VDM 0x0000002c
+#define FILE_DEVICE_MASS_STORAGE 0x0000002d
+#define FILE_DEVICE_SMB 0x0000002e
+#define FILE_DEVICE_KS 0x0000002f
+#define FILE_DEVICE_CHANGER 0x00000030
+#define FILE_DEVICE_SMARTCARD 0x00000031
+#define FILE_DEVICE_ACPI 0x00000032
+#define FILE_DEVICE_DVD 0x00000033
+#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
+#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
+#define FILE_DEVICE_DFS_VOLUME 0x00000036
+#define FILE_DEVICE_SERENUM 0x00000037
+#define FILE_DEVICE_TERMSRV 0x00000038
+#define FILE_DEVICE_KSEC 0x00000039
+#define FILE_DEVICE_FIPS 0x0000003a
+
+typedef struct _DEVICE_OBJECT {
+ CSHORT Type;
+ USHORT Size;
+ LONG ReferenceCount;
+ struct _DRIVER_OBJECT *DriverObject;
+ struct _DEVICE_OBJECT *NextDevice;
+ struct _DEVICE_OBJECT *AttachedDevice;
+ struct _IRP *CurrentIrp;
+ PIO_TIMER Timer;
+ ULONG Flags;
+ ULONG Characteristics;
+ PVPB Vpb;
+ PVOID DeviceExtension;
+ DEVICE_TYPE DeviceType;
+ CCHAR StackSize;
+ union {
+ LIST_ENTRY ListEntry;
+ WAIT_CONTEXT_BLOCK Wcb;
+ } Queue;
+ ULONG AlignmentRequirement;
+ KDEVICE_QUEUE DeviceQueue;
+ KDPC Dpc;
+ ULONG ActiveThreadCount;
+ PSECURITY_DESCRIPTOR SecurityDescriptor;
+ KEVENT DeviceLock;
+ USHORT SectorSize;
+ USHORT Spare1;
+ struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
+ PVOID Reserved;
+} DEVICE_OBJECT;
+typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
+
+typedef enum _DEVICE_RELATION_TYPE {
+ BusRelations,
+ EjectionRelations,
+ PowerRelations,
+ RemovalRelations,
+ TargetDeviceRelation,
+ SingleBusRelations
+} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
+
+typedef struct _DEVICE_RELATIONS {
+ ULONG Count;
+ PDEVICE_OBJECT Objects[1];
+} DEVICE_RELATIONS, *PDEVICE_RELATIONS;
+
+typedef struct _SCATTER_GATHER_ELEMENT {
+ PHYSICAL_ADDRESS Address;
+ ULONG Length;
+ ULONG_PTR Reserved;
+} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
+
+typedef struct _SCATTER_GATHER_LIST {
+ ULONG NumberOfElements;
+ ULONG_PTR Reserved;
+ SCATTER_GATHER_ELEMENT Elements[0];
+} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
+
+typedef struct _MDL {
+ struct _MDL *Next;
+ CSHORT Size;
+ CSHORT MdlFlags;
+ struct _EPROCESS *Process;
+ PVOID MappedSystemVa;
+ PVOID StartVa;
+ ULONG ByteCount;
+ ULONG ByteOffset;
+} MDL, *PMDL;
+
+#define MDL_MAPPED_TO_SYSTEM_VA 0x0001
+#define MDL_PAGES_LOCKED 0x0002
+#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
+#define MDL_ALLOCATED_FIXED_SIZE 0x0008
+#define MDL_PARTIAL 0x0010
+#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
+#define MDL_IO_PAGE_READ 0x0040
+#define MDL_WRITE_OPERATION 0x0080
+#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
+#define MDL_FREE_EXTRA_PTES 0x0200
+#define MDL_IO_SPACE 0x0800
+#define MDL_NETWORK_HEADER 0x1000
+#define MDL_MAPPING_CAN_FAIL 0x2000
+#define MDL_ALLOCATED_MUST_SUCCEED 0x4000
+
+#define MDL_MAPPING_FLAGS ( \
+ MDL_MAPPED_TO_SYSTEM_VA | \
+ MDL_PAGES_LOCKED | \
+ MDL_SOURCE_IS_NONPAGED_POOL | \
+ MDL_PARTIAL_HAS_BEEN_MAPPED | \
+ MDL_PARENT_MAPPED_SYSTEM_VA | \
+ MDL_SYSTEM_VA | \
+ MDL_IO_SPACE)
+
+typedef VOID DDKAPI
+(*PPUT_DMA_ADAPTER)(
+ IN PDMA_ADAPTER DmaAdapter);
+
+typedef PVOID DDKAPI
+(*PALLOCATE_COMMON_BUFFER)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN ULONG Length,
+ OUT PPHYSICAL_ADDRESS LogicalAddress,
+ IN BOOLEAN CacheEnabled);
+
+typedef VOID DDKAPI
+(*PFREE_COMMON_BUFFER)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN ULONG Length,
+ IN PHYSICAL_ADDRESS LogicalAddress,
+ IN PVOID VirtualAddress,
+ IN BOOLEAN CacheEnabled);
+
+typedef NTSTATUS DDKAPI
+(*PALLOCATE_ADAPTER_CHANNEL)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG NumberOfMapRegisters,
+ IN PDRIVER_CONTROL ExecutionRoutine,
+ IN PVOID Context);
+
+typedef BOOLEAN DDKAPI
+(*PFLUSH_ADAPTER_BUFFERS)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PMDL Mdl,
+ IN PVOID MapRegisterBase,
+ IN PVOID CurrentVa,
+ IN ULONG Length,
+ IN BOOLEAN WriteToDevice);
+
+typedef VOID DDKAPI
+(*PFREE_ADAPTER_CHANNEL)(
+ IN PDMA_ADAPTER DmaAdapter);
+
+typedef VOID DDKAPI
+(*PFREE_MAP_REGISTERS)(
+ IN PDMA_ADAPTER DmaAdapter,
+ PVOID MapRegisterBase,
+ ULONG NumberOfMapRegisters);
+
+typedef PHYSICAL_ADDRESS DDKAPI
+(*PMAP_TRANSFER)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PMDL Mdl,
+ IN PVOID MapRegisterBase,
+ IN PVOID CurrentVa,
+ IN OUT PULONG Length,
+ IN BOOLEAN WriteToDevice);
+
+typedef ULONG DDKAPI
+(*PGET_DMA_ALIGNMENT)(
+ IN PDMA_ADAPTER DmaAdapter);
+
+typedef ULONG DDKAPI
+(*PREAD_DMA_COUNTER)(
+ IN PDMA_ADAPTER DmaAdapter);
+
+typedef NTSTATUS DDKAPI
+(*PGET_SCATTER_GATHER_LIST)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PMDL Mdl,
+ IN PVOID CurrentVa,
+ IN ULONG Length,
+ IN PDRIVER_LIST_CONTROL ExecutionRoutine,
+ IN PVOID Context,
+ IN BOOLEAN WriteToDevice);
+
+typedef VOID DDKAPI
+(*PPUT_SCATTER_GATHER_LIST)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PSCATTER_GATHER_LIST ScatterGather,
+ IN BOOLEAN WriteToDevice);
+
+typedef NTSTATUS DDKAPI
+(*PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PMDL Mdl OPTIONAL,
+ IN PVOID CurrentVa,
+ IN ULONG Length,
+ OUT PULONG ScatterGatherListSize,
+ OUT PULONG pNumberOfMapRegisters OPTIONAL);
+
+typedef NTSTATUS DDKAPI
+(*PBUILD_SCATTER_GATHER_LIST)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PMDL Mdl,
+ IN PVOID CurrentVa,
+ IN ULONG Length,
+ IN PDRIVER_LIST_CONTROL ExecutionRoutine,
+ IN PVOID Context,
+ IN BOOLEAN WriteToDevice,
+ IN PVOID ScatterGatherBuffer,
+ IN ULONG ScatterGatherLength);
+
+typedef NTSTATUS DDKAPI
+(*PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
+ IN PDMA_ADAPTER DmaAdapter,
+ IN PSCATTER_GATHER_LIST ScatterGather,
+ IN PMDL OriginalMdl,
+ OUT PMDL *TargetMdl);
+
+typedef struct _DMA_OPERATIONS {
+ ULONG Size;
+ PPUT_DMA_ADAPTER PutDmaAdapter;
+ PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
+ PFREE_COMMON_BUFFER FreeCommonBuffer;
+ PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
+ PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
+ PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
+ PFREE_MAP_REGISTERS FreeMapRegisters;
+ PMAP_TRANSFER MapTransfer;
+ PGET_DMA_ALIGNMENT GetDmaAlignment;
+ PREAD_DMA_COUNTER ReadDmaCounter;
+ PGET_SCATTER_GATHER_LIST GetScatterGatherList;
+ PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
+ PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList;
+ PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList;
+ PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList;
+} DMA_OPERATIONS, *PDMA_OPERATIONS;
+
+typedef struct _DMA_ADAPTER {
+ USHORT Version;
+ USHORT Size;
+ PDMA_OPERATIONS DmaOperations;
+} DMA_ADAPTER;
+
+typedef enum _FILE_INFORMATION_CLASS {
+ FileDirectoryInformation = 1,
+ FileFullDirectoryInformation,
+ FileBothDirectoryInformation,
+ FileBasicInformation,
+ FileStandardInformation,
+ FileInternalInformation,
+ FileEaInformation,
+ FileAccessInformation,
+ FileNameInformation,
+ FileRenameInformation,
+ FileLinkInformation,
+ FileNamesInformation,
+ FileDispositionInformation,
+ FilePositionInformation,
+ FileFullEaInformation,
+ FileModeInformation,
+ FileAlignmentInformation,
+ FileAllInformation,
+ FileAllocationInformation,
+ FileEndOfFileInformation,
+ FileAlternateNameInformation,
+ FileStreamInformation,
+ FilePipeInformation,
+ FilePipeLocalInformation,
+ FilePipeRemoteInformation,
+ FileMailslotQueryInformation,
+ FileMailslotSetInformation,
+ FileCompressionInformation,
+ FileObjectIdInformation,
+ FileCompletionInformation,
+ FileMoveClusterInformation,
+ FileQuotaInformation,
+ FileReparsePointInformation,
+ FileNetworkOpenInformation,
+ FileAttributeTagInformation,
+ FileTrackingInformation,
+ FileIdBothDirectoryInformation,
+ FileIdFullDirectoryInformation,
+ FileValidDataLengthInformation,
+ FileShortNameInformation,
+ FileMaximumInformation
+} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
+
+typedef struct _FILE_POSITION_INFORMATION {
+ LARGE_INTEGER CurrentByteOffset;
+} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
+
+typedef struct _FILE_ALIGNMENT_INFORMATION {
+ ULONG AlignmentRequirement;
+} FILE_ALIGNMENT_INFORMATION;
+
+typedef struct _FILE_NAME_INFORMATION {
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
+
+typedef struct FILE_BASIC_INFORMATION {
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ ULONG FileAttributes;
+} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
+
+typedef struct _FILE_STANDARD_INFORMATION {
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER EndOfFile;
+ ULONG NumberOfLinks;
+ BOOLEAN DeletePending;
+ BOOLEAN Directory;
+} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
+
+typedef struct _FILE_NETWORK_OPEN_INFORMATION {
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER EndOfFile;
+ ULONG FileAttributes;
+} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
+
+typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION {
+ ULONG FileAttributes;
+ ULONG ReparseTag;
+} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
+
+typedef struct _FILE_DISPOSITION_INFORMATION {
+ BOOLEAN DoDeleteFile;
+} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
+
+typedef struct _FILE_END_OF_FILE_INFORMATION {
+ LARGE_INTEGER EndOfFile;
+} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
+
+typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION {
+ LARGE_INTEGER ValidDataLength;
+} FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
+
+typedef enum _FSINFOCLASS {
+ FileFsVolumeInformation = 1,
+ FileFsLabelInformation,
+ FileFsSizeInformation,
+ FileFsDeviceInformation,
+ FileFsAttributeInformation,
+ FileFsControlInformation,
+ FileFsFullSizeInformation,
+ FileFsObjectIdInformation,
+ FileFsDriverPathInformation,
+ FileFsMaximumInformation
+} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
+
+typedef struct _FILE_FS_DEVICE_INFORMATION {
+ DEVICE_TYPE DeviceType;
+ ULONG Characteristics;
+} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
+
+typedef struct _FILE_FULL_EA_INFORMATION {
+ ULONG NextEntryOffset;
+ UCHAR Flags;
+ UCHAR EaNameLength;
+ USHORT EaValueLength;
+ CHAR EaName[1];
+} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
+
+typedef ULONG_PTR ERESOURCE_THREAD;
+typedef ERESOURCE_THREAD *PERESOURCE_THREAD;
+
+typedef struct _OWNER_ENTRY {
+ ERESOURCE_THREAD OwnerThread;
+ union {
+ LONG OwnerCount;
+ ULONG TableSize;
+ };
+} OWNER_ENTRY, *POWNER_ENTRY;
+
+/* ERESOURCE.Flag */
+
+#define ResourceNeverExclusive 0x0010
+#define ResourceReleaseByOtherThread 0x0020
+#define ResourceOwnedExclusive 0x0080
+
+#define RESOURCE_HASH_TABLE_SIZE 64
+
+typedef struct _ERESOURCE {
+ LIST_ENTRY SystemResourcesList;
+ POWNER_ENTRY OwnerTable;
+ SHORT ActiveCount;
+ USHORT Flag;
+ PKSEMAPHORE SharedWaiters;
+ PKEVENT ExclusiveWaiters;
+ OWNER_ENTRY OwnerThreads[2];
+ ULONG ContentionCount;
+ USHORT NumberOfSharedWaiters;
+ USHORT NumberOfExclusiveWaiters;
+ union {
+ PVOID Address;
+ ULONG_PTR CreatorBackTraceIndex;
+ };
+ KSPIN_LOCK SpinLock;
+} ERESOURCE, *PERESOURCE;
+
+/* NOTE: PVOID for methods to avoid 'assignment from incompatible pointer type' warning */
+typedef struct _DRIVER_EXTENSION {
+ struct _DRIVER_OBJECT *DriverObject;
+ PVOID AddDevice;
+ ULONG Count;
+ UNICODE_STRING ServiceKeyName;
+} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_CHECK_IF_POSSIBLE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ IN BOOLEAN CheckForReadOperation,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_READ)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_WRITE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ IN PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_QUERY_BASIC_INFO)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN BOOLEAN Wait,
+ OUT PFILE_BASIC_INFORMATION Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_QUERY_STANDARD_INFO)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN BOOLEAN Wait,
+ OUT PFILE_STANDARD_INFORMATION Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_LOCK)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ PEPROCESS ProcessId,
+ ULONG Key,
+ BOOLEAN FailImmediately,
+ BOOLEAN ExclusiveLock,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_UNLOCK_SINGLE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ PEPROCESS ProcessId,
+ ULONG Key,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_UNLOCK_ALL)(
+ IN struct _FILE_OBJECT *FileObject,
+ PEPROCESS ProcessId,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_UNLOCK_ALL_BY_KEY)(
+ IN struct _FILE_OBJECT *FileObject,
+ PVOID ProcessId,
+ ULONG Key,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_DEVICE_CONTROL)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN BOOLEAN Wait,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength,
+ IN ULONG IoControlCode,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef VOID DDKAPI
+(*PFAST_IO_ACQUIRE_FILE)(
+ IN struct _FILE_OBJECT *FileObject);
+
+typedef VOID DDKAPI
+(*PFAST_IO_RELEASE_FILE)(
+ IN struct _FILE_OBJECT *FileObject);
+
+typedef VOID DDKAPI
+(*PFAST_IO_DETACH_DEVICE)(
+ IN struct _DEVICE_OBJECT *SourceDevice,
+ IN struct _DEVICE_OBJECT *TargetDevice);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_QUERY_NETWORK_OPEN_INFO)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN BOOLEAN Wait,
+ OUT struct _FILE_NETWORK_OPEN_INFORMATION *Buffer,
+ OUT struct _IO_STATUS_BLOCK *IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef NTSTATUS DDKAPI
+(*PFAST_IO_ACQUIRE_FOR_MOD_WRITE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER EndingOffset,
+ OUT struct _ERESOURCE **ResourceToRelease,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_MDL_READ)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG LockKey,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_MDL_READ_COMPLETE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PMDL MdlChain,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_PREPARE_MDL_WRITE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG LockKey,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_MDL_WRITE_COMPLETE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PMDL MdlChain,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_READ_COMPRESSED)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG LockKey,
+ OUT PVOID Buffer,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
+ IN ULONG CompressedDataInfoLength,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_WRITE_COMPRESSED)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG LockKey,
+ IN PVOID Buffer,
+ OUT PMDL *MdlChain,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
+ IN ULONG CompressedDataInfoLength,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PMDL MdlChain,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PMDL MdlChain,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef BOOLEAN DDKAPI
+(*PFAST_IO_QUERY_OPEN)(
+ IN struct _IRP *Irp,
+ OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef NTSTATUS DDKAPI
+(*PFAST_IO_RELEASE_FOR_MOD_WRITE)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN struct _ERESOURCE *ResourceToRelease,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef NTSTATUS DDKAPI
+(*PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
+ IN struct _FILE_OBJECT *FileObject,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef NTSTATUS DDKAPI
+(*PFAST_IO_RELEASE_FOR_CCFLUSH) (
+ IN struct _FILE_OBJECT *FileObject,
+ IN struct _DEVICE_OBJECT *DeviceObject);
+
+typedef struct _FAST_IO_DISPATCH {
+ ULONG SizeOfFastIoDispatch;
+ PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
+ PFAST_IO_READ FastIoRead;
+ PFAST_IO_WRITE FastIoWrite;
+ PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
+ PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
+ PFAST_IO_LOCK FastIoLock;
+ PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
+ PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
+ PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
+ PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
+ PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
+ PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
+ PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
+ PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
+ PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
+ PFAST_IO_MDL_READ MdlRead;
+ PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
+ PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
+ PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
+ PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
+ PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
+ PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
+ PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
+ PFAST_IO_QUERY_OPEN FastIoQueryOpen;
+ PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
+ PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
+ PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
+} FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
+
+/* NOTE: PVOID for methods to avoid 'assignment from incompatible pointer type' warning */
+typedef struct _DRIVER_OBJECT {
+ CSHORT Type;
+ CSHORT Size;
+ PDEVICE_OBJECT DeviceObject;
+ ULONG Flags;
+ PVOID DriverStart;
+ ULONG DriverSize;
+ PVOID DriverSection;
+ PDRIVER_EXTENSION DriverExtension;
+ UNICODE_STRING DriverName;
+ PUNICODE_STRING HardwareDatabase;
+ PVOID FastIoDispatch;
+ PVOID DriverInit;
+ PVOID DriverStartIo;
+ PVOID DriverUnload;
+ PVOID MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
+} DRIVER_OBJECT;
+typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
+
+typedef struct _SECTION_OBJECT_POINTERS {
+ PVOID DataSectionObject;
+ PVOID SharedCacheMap;
+ PVOID ImageSectionObject;
+} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
+
+typedef struct _IO_COMPLETION_CONTEXT {
+ PVOID Port;
+ PVOID Key;
+} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
+
+/* FILE_OBJECT.Flags */
+
+#define FO_FILE_OPEN 0x00000001
+#define FO_SYNCHRONOUS_IO 0x00000002
+#define FO_ALERTABLE_IO 0x00000004
+#define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
+#define FO_WRITE_THROUGH 0x00000010
+#define FO_SEQUENTIAL_ONLY 0x00000020
+#define FO_CACHE_SUPPORTED 0x00000040
+#define FO_NAMED_PIPE 0x00000080
+#define FO_STREAM_FILE 0x00000100
+#define FO_MAILSLOT 0x00000200
+#define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
+#define FO_DIRECT_DEVICE_OPEN 0x00000800
+#define FO_FILE_MODIFIED 0x00001000
+#define FO_FILE_SIZE_CHANGED 0x00002000
+#define FO_CLEANUP_COMPLETE 0x00004000
+#define FO_TEMPORARY_FILE 0x00008000
+#define FO_DELETE_ON_CLOSE 0x00010000
+#define FO_OPENED_CASE_SENSITIVE 0x00020000
+#define FO_HANDLE_CREATED 0x00040000
+#define FO_FILE_FAST_IO_READ 0x00080000
+#define FO_RANDOM_ACCESS 0x00100000
+#define FO_FILE_OPEN_CANCELLED 0x00200000
+#define FO_VOLUME_OPEN 0x00400000
+#define FO_FILE_OBJECT_HAS_EXTENSION 0x00800000
+#define FO_REMOTE_ORIGIN 0x01000000
+
+typedef struct _FILE_OBJECT {
+ CSHORT Type;
+ CSHORT Size;
+ PDEVICE_OBJECT DeviceObject;
+ PVPB Vpb;
+ PVOID FsContext;
+ PVOID FsContext2;
+ PSECTION_OBJECT_POINTERS SectionObjectPointer;
+ PVOID PrivateCacheMap;
+ NTSTATUS FinalStatus;
+ struct _FILE_OBJECT *RelatedFileObject;
+ BOOLEAN LockOperation;
+ BOOLEAN DeletePending;
+ BOOLEAN ReadAccess;
+ BOOLEAN WriteAccess;
+ BOOLEAN DeleteAccess;
+ BOOLEAN SharedRead;
+ BOOLEAN SharedWrite;
+ BOOLEAN SharedDelete;
+ ULONG Flags;
+ UNICODE_STRING FileName;
+ LARGE_INTEGER CurrentByteOffset;
+ ULONG Waiters;
+ ULONG Busy;
+ PVOID LastLock;
+ KEVENT Lock;
+ KEVENT Event;
+ PIO_COMPLETION_CONTEXT CompletionContext;
+} FILE_OBJECT;
+typedef struct _FILE_OBJECT *PFILE_OBJECT;
+
+typedef enum _SECURITY_OPERATION_CODE {
+ SetSecurityDescriptor,
+ QuerySecurityDescriptor,
+ DeleteSecurityDescriptor,
+ AssignSecurityDescriptor
+} SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
+
+#define INITIAL_PRIVILEGE_COUNT 3
+
+typedef struct _INITIAL_PRIVILEGE_SET {
+ ULONG PrivilegeCount;
+ ULONG Control;
+ LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT];
+} INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
+
+typedef struct _SECURITY_SUBJECT_CONTEXT {
+ PACCESS_TOKEN ClientToken;
+ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+ PACCESS_TOKEN PrimaryToken;
+ PVOID ProcessAuditId;
+} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
+
+typedef struct _ACCESS_STATE {
+ LUID OperationID;
+ BOOLEAN SecurityEvaluated;
+ BOOLEAN GenerateAudit;
+ BOOLEAN GenerateOnClose;
+ BOOLEAN PrivilegesAllocated;
+ ULONG Flags;
+ ACCESS_MASK RemainingDesiredAccess;
+ ACCESS_MASK PreviouslyGrantedAccess;
+ ACCESS_MASK OriginalDesiredAccess;
+ SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
+ PSECURITY_DESCRIPTOR SecurityDescriptor;
+ PVOID AuxData;
+ union {
+ INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
+ PRIVILEGE_SET PrivilegeSet;
+ } Privileges;
+
+ BOOLEAN AuditPrivileges;
+ UNICODE_STRING ObjectName;
+ UNICODE_STRING ObjectTypeName;
+} ACCESS_STATE, *PACCESS_STATE;
+
+typedef struct _IO_SECURITY_CONTEXT {
+ PSECURITY_QUALITY_OF_SERVICE SecurityQos;
+ PACCESS_STATE AccessState;
+ ACCESS_MASK DesiredAccess;
+ ULONG FullCreateOptions;
+} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
+
+struct _IO_CSQ;
+
+typedef struct _IO_CSQ_IRP_CONTEXT {
+ ULONG Type;
+ struct _IRP *Irp;
+ struct _IO_CSQ *Csq;
+} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
+
+typedef VOID DDKAPI
+(*PIO_CSQ_INSERT_IRP)(
+ IN struct _IO_CSQ *Csq,
+ IN PIRP Irp);
+
+typedef VOID DDKAPI
+(*PIO_CSQ_REMOVE_IRP)(
+ IN struct _IO_CSQ *Csq,
+ IN PIRP Irp);
+
+typedef PIRP DDKAPI
+(*PIO_CSQ_PEEK_NEXT_IRP)(
+ IN struct _IO_CSQ *Csq,
+ IN PIRP Irp,
+ IN PVOID PeekContext);
+
+typedef VOID DDKAPI
+(*PIO_CSQ_ACQUIRE_LOCK)(
+ IN struct _IO_CSQ *Csq,
+ OUT PKIRQL Irql);
+
+typedef VOID DDKAPI
+(*PIO_CSQ_RELEASE_LOCK)(
+ IN struct _IO_CSQ *Csq,
+ IN KIRQL Irql);
+
+typedef VOID DDKAPI
+(*PIO_CSQ_COMPLETE_CANCELED_IRP)(
+ IN struct _IO_CSQ *Csq,
+ IN PIRP Irp);
+
+typedef struct _IO_CSQ {
+ ULONG Type;
+ PIO_CSQ_INSERT_IRP CsqInsertIrp;
+ PIO_CSQ_REMOVE_IRP CsqRemoveIrp;
+ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp;
+ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock;
+ PIO_CSQ_RELEASE_LOCK CsqReleaseLock;
+ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp;
+ PVOID ReservePointer;
+} IO_CSQ, *PIO_CSQ;
+
+typedef struct _IO_STACK_LOCATION {
+ UCHAR MajorFunction;
+ UCHAR MinorFunction;
+ UCHAR Flags;
+ UCHAR Control;
+ union {
+ struct {
+ PIO_SECURITY_CONTEXT SecurityContext;
+ ULONG Options;
+ USHORT POINTER_ALIGNMENT FileAttributes;
+ USHORT ShareAccess;
+ ULONG POINTER_ALIGNMENT EaLength;
+ } Create;
+ struct {
+ ULONG Length;
+ ULONG POINTER_ALIGNMENT Key;
+ LARGE_INTEGER ByteOffset;
+ } Read;
+ struct {
+ ULONG Length;
+ ULONG POINTER_ALIGNMENT Key;
+ LARGE_INTEGER ByteOffset;
+ } Write;
+ struct {
+ ULONG Length;
+ FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
+ } QueryFile;
+ struct {
+ ULONG Length;
+ FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
+ PFILE_OBJECT FileObject;
+ union {
+ struct {
+ BOOLEAN ReplaceIfExists;
+ BOOLEAN AdvanceOnly;
+ };
+ ULONG ClusterCount;
+ HANDLE DeleteHandle;
+ };
+ } SetFile;
+ struct {
+ ULONG Length;
+ FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
+ } QueryVolume;
+ struct {
+ ULONG OutputBufferLength;
+ ULONG POINTER_ALIGNMENT InputBufferLength;
+ ULONG POINTER_ALIGNMENT IoControlCode;
+ PVOID Type3InputBuffer;
+ } DeviceIoControl;
+ struct {
+ SECURITY_INFORMATION SecurityInformation;
+ ULONG POINTER_ALIGNMENT Length;
+ } QuerySecurity;
+ struct {
+ SECURITY_INFORMATION SecurityInformation;
+ PSECURITY_DESCRIPTOR SecurityDescriptor;
+ } SetSecurity;
+ struct {
+ PVPB Vpb;
+ PDEVICE_OBJECT DeviceObject;
+ } MountVolume;
+ struct {
+ PVPB Vpb;
+ PDEVICE_OBJECT DeviceObject;
+ } VerifyVolume;
+ struct {
+ struct _SCSI_REQUEST_BLOCK *Srb;
+ } Scsi;
+ struct {
+ DEVICE_RELATION_TYPE Type;
+ } QueryDeviceRelations;
+ struct {
+ CONST GUID *InterfaceType;
+ USHORT Size;
+ USHORT Version;
+ PINTERFACE Interface;
+ PVOID InterfaceSpecificData;
+ } QueryInterface;
+ struct {
+ PDEVICE_CAPABILITIES Capabilities;
+ } DeviceCapabilities;
+ struct {
+ PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
+ } FilterResourceRequirements;
+ struct {
+ ULONG WhichSpace;
+ PVOID Buffer;
+ ULONG Offset;
+ ULONG POINTER_ALIGNMENT Length;
+ } ReadWriteConfig;
+ struct {
+ BOOLEAN Lock;
+ } SetLock;
+ struct {
+ BUS_QUERY_ID_TYPE IdType;
+ } QueryId;
+ struct {
+ DEVICE_TEXT_TYPE DeviceTextType;
+ LCID POINTER_ALIGNMENT LocaleId;
+ } QueryDeviceText;
+ struct {
+ BOOLEAN InPath;
+ BOOLEAN Reserved[3];
+ DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
+ } UsageNotification;
+ struct {
+ SYSTEM_POWER_STATE PowerState;
+ } WaitWake;
+ struct {
+ PPOWER_SEQUENCE PowerSequence;
+ } PowerSequence;
+ struct {
+ ULONG SystemContext;
+ POWER_STATE_TYPE POINTER_ALIGNMENT Type;
+ POWER_STATE POINTER_ALIGNMENT State;
+ POWER_ACTION POINTER_ALIGNMENT ShutdownType;
+ } Power;
+ struct {
+ PCM_RESOURCE_LIST AllocatedResources;
+ PCM_RESOURCE_LIST AllocatedResourcesTranslated;
+ } StartDevice;
+ struct {
+ ULONG_PTR ProviderId;
+ PVOID DataPath;
+ ULONG BufferSize;
+ PVOID Buffer;
+ } WMI;
+ struct {
+ PVOID Argument1;
+ PVOID Argument2;
+ PVOID Argument3;
+ PVOID Argument4;
+ } Others;
+ } Parameters;
+ PDEVICE_OBJECT DeviceObject;
+ PFILE_OBJECT FileObject;
+ PIO_COMPLETION_ROUTINE CompletionRoutine;
+ PVOID Context;
+} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
+
+/* IO_STACK_LOCATION.Control */
+
+#define SL_PENDING_RETURNED 0x01
+#define SL_INVOKE_ON_CANCEL 0x20
+#define SL_INVOKE_ON_SUCCESS 0x40
+#define SL_INVOKE_ON_ERROR 0x80
+
+typedef enum _KEY_INFORMATION_CLASS {
+ KeyBasicInformation,
+ KeyNodeInformation,
+ KeyFullInformation,
+ KeyNameInformation,
+ KeyCachedInformation,
+ KeyFlagsInformation
+} KEY_INFORMATION_CLASS;
+
+typedef struct _KEY_BASIC_INFORMATION {
+ LARGE_INTEGER LastWriteTime;
+ ULONG TitleIndex;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
+
+typedef struct _KEY_FULL_INFORMATION {
+ LARGE_INTEGER LastWriteTime;
+ ULONG TitleIndex;
+ ULONG ClassOffset;
+ ULONG ClassLength;
+ ULONG SubKeys;
+ ULONG MaxNameLen;
+ ULONG MaxClassLen;
+ ULONG Values;
+ ULONG MaxValueNameLen;
+ ULONG MaxValueDataLen;
+ WCHAR Class[1];
+} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
+
+typedef struct _KEY_NODE_INFORMATION {
+ LARGE_INTEGER LastWriteTime;
+ ULONG TitleIndex;
+ ULONG ClassOffset;
+ ULONG ClassLength;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
+
+typedef struct _KEY_VALUE_BASIC_INFORMATION {
+ ULONG TitleIndex;
+ ULONG Type;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
+
+typedef struct _KEY_VALUE_FULL_INFORMATION {
+ ULONG TitleIndex;
+ ULONG Type;
+ ULONG DataOffset;
+ ULONG DataLength;
+ ULONG NameLength;
+ WCHAR Name[1];
+} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
+
+typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
+ ULONG TitleIndex;
+ ULONG Type;
+ ULONG DataLength;
+ UCHAR Data[1];
+} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
+
+typedef struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 {
+ ULONG Type;
+ ULONG DataLength;
+ UCHAR Data[1];
+} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
+
+typedef struct _KEY_VALUE_ENTRY {
+ PUNICODE_STRING ValueName;
+ ULONG DataLength;
+ ULONG DataOffset;
+ ULONG Type;
+} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
+
+typedef enum _KEY_VALUE_INFORMATION_CLASS {
+ KeyValueBasicInformation,
+ KeyValueFullInformation,
+ KeyValuePartialInformation,
+ KeyValueFullInformationAlign64,
+ KeyValuePartialInformationAlign64
+} KEY_VALUE_INFORMATION_CLASS;
+
+/* KEY_VALUE_Xxx.Type */
+
+#define REG_NONE 0
+#define REG_SZ 1
+#define REG_EXPAND_SZ 2
+#define REG_BINARY 3
+#define REG_DWORD 4
+#define REG_DWORD_LITTLE_ENDIAN 4
+#define REG_DWORD_BIG_ENDIAN 5
+#define REG_LINK 6
+#define REG_MULTI_SZ 7
+#define REG_RESOURCE_LIST 8
+#define REG_FULL_RESOURCE_DESCRIPTOR 9
+#define REG_RESOURCE_REQUIREMENTS_LIST 10
+#define REG_QWORD 11
+#define REG_QWORD_LITTLE_ENDIAN 11
+
+#define PCI_TYPE0_ADDRESSES 6
+#define PCI_TYPE1_ADDRESSES 2
+#define PCI_TYPE2_ADDRESSES 5
+
+typedef struct _PCI_COMMON_CONFIG {
+ USHORT VendorID;
+ USHORT DeviceID;
+ USHORT Command;
+ USHORT Status;
+ UCHAR RevisionID;
+ UCHAR ProgIf;
+ UCHAR SubClass;
+ UCHAR BaseClass;
+ UCHAR CacheLineSize;
+ UCHAR LatencyTimer;
+ UCHAR HeaderType;
+ UCHAR BIST;
+ union {
+ struct _PCI_HEADER_TYPE_0 {
+ ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
+ ULONG CIS;
+ USHORT SubVendorID;
+ USHORT SubSystemID;
+ ULONG ROMBaseAddress;
+ UCHAR CapabilitiesPtr;
+ UCHAR Reserved1[3];
+ ULONG Reserved2;
+ UCHAR InterruptLine;
+ UCHAR InterruptPin;
+ UCHAR MinimumGrant;
+ UCHAR MaximumLatency;
+ } type0;
+ struct _PCI_HEADER_TYPE_1 {
+ ULONG BaseAddresses[PCI_TYPE1_ADDRESSES];
+ UCHAR PrimaryBus;
+ UCHAR SecondaryBus;
+ UCHAR SubordinateBus;
+ UCHAR SecondaryLatency;
+ UCHAR IOBase;
+ UCHAR IOLimit;
+ USHORT SecondaryStatus;
+ USHORT MemoryBase;
+ USHORT MemoryLimit;
+ USHORT PrefetchBase;
+ USHORT PrefetchLimit;
+ ULONG PrefetchBaseUpper32;
+ ULONG PrefetchLimitUpper32;
+ USHORT IOBaseUpper16;
+ USHORT IOLimitUpper16;
+ UCHAR CapabilitiesPtr;
+ UCHAR Reserved1[3];
+ ULONG ROMBaseAddress;
+ UCHAR InterruptLine;
+ UCHAR InterruptPin;
+ USHORT BridgeControl;
+ } type1;
+ struct _PCI_HEADER_TYPE_2 {
+ ULONG SocketRegistersBaseAddress;
+ UCHAR CapabilitiesPtr;
+ UCHAR Reserved;
+ USHORT SecondaryStatus;
+ UCHAR PrimaryBus;
+ UCHAR SecondaryBus;
+ UCHAR SubordinateBus;
+ UCHAR SecondaryLatency;
+ struct {
+ ULONG Base;
+ ULONG Limit;
+ } Range[PCI_TYPE2_ADDRESSES - 1];
+ UCHAR InterruptLine;
+ UCHAR InterruptPin;
+ USHORT BridgeControl;
+ } type2;
+ } u;
+ UCHAR DeviceSpecific[192];
+} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
+
+/* PCI_COMMON_CONFIG.Command */
+
+#define PCI_ENABLE_IO_SPACE 0x0001
+#define PCI_ENABLE_MEMORY_SPACE 0x0002
+#define PCI_ENABLE_BUS_MASTER 0x0004
+#define PCI_ENABLE_SPECIAL_CYCLES 0x0008
+#define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
+#define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
+#define PCI_ENABLE_PARITY 0x0040
+#define PCI_ENABLE_WAIT_CYCLE 0x0080
+#define PCI_ENABLE_SERR 0x0100
+#define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
+
+/* PCI_COMMON_CONFIG.Status */
+
+#define PCI_STATUS_CAPABILITIES_LIST 0x0010
+#define PCI_STATUS_66MHZ_CAPABLE 0x0020
+#define PCI_STATUS_UDF_SUPPORTED 0x0040
+#define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
+#define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
+#define PCI_STATUS_DEVSEL 0x0600
+#define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
+#define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
+#define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
+#define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
+#define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
+
+/* PCI_COMMON_CONFIG.HeaderType */
+
+#define PCI_MULTIFUNCTION 0x80
+#define PCI_DEVICE_TYPE 0x00
+#define PCI_BRIDGE_TYPE 0x01
+#define PCI_CARDBUS_BRIDGE_TYPE 0x02
+
+#define PCI_CONFIGURATION_TYPE(PciData) \
+ (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
+
+#define PCI_MULTIFUNCTION_DEVICE(PciData) \
+ ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
+
+typedef struct _PCI_SLOT_NUMBER {
+ union {
+ struct {
+ ULONG DeviceNumber : 5;
+ ULONG FunctionNumber : 3;
+ ULONG Reserved : 24;
+ } bits;
+ ULONG AsULONG;
+ } u;
+} PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
+
+typedef enum _POOL_TYPE {
+ NonPagedPool,
+ PagedPool,
+ NonPagedPoolMustSucceed,
+ DontUseThisType,
+ NonPagedPoolCacheAligned,
+ PagedPoolCacheAligned,
+ NonPagedPoolCacheAlignedMustS,
+ MaxPoolType,
+ NonPagedPoolSession = 32,
+ PagedPoolSession,
+ NonPagedPoolMustSucceedSession,
+ DontUseThisTypeSession,
+ NonPagedPoolCacheAlignedSession,
+ PagedPoolCacheAlignedSession,
+ NonPagedPoolCacheAlignedMustSSession
+} POOL_TYPE;
+
+typedef enum _EX_POOL_PRIORITY {
+ LowPoolPriority,
+ LowPoolPrioritySpecialPoolOverrun = 8,
+ LowPoolPrioritySpecialPoolUnderrun = 9,
+ NormalPoolPriority = 16,
+ NormalPoolPrioritySpecialPoolOverrun = 24,
+ NormalPoolPrioritySpecialPoolUnderrun = 25,
+ HighPoolPriority = 32,
+ HighPoolPrioritySpecialPoolOverrun = 40,
+ HighPoolPrioritySpecialPoolUnderrun = 41
+} EX_POOL_PRIORITY;
+
+/* PRIVILEGE_SET.Control */
+
+#define PRIVILEGE_SET_ALL_NECESSARY 1
+
+typedef struct _RTL_OSVERSIONINFOW {
+ ULONG dwOSVersionInfoSize;
+ ULONG dwMajorVersion;
+ ULONG dwMinorVersion;
+ ULONG dwBuildNumber;
+ ULONG dwPlatformId;
+ WCHAR szCSDVersion[128];
+} RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
+
+typedef struct _RTL_OSVERSIONINFOEXW {
+ ULONG dwOSVersionInfoSize;
+ ULONG dwMajorVersion;
+ ULONG dwMinorVersion;
+ ULONG dwBuildNumber;
+ ULONG dwPlatformId;
+ WCHAR szCSDVersion[128];
+ USHORT wServicePackMajor;
+ USHORT wServicePackMinor;
+ USHORT wSuiteMask;
+ UCHAR wProductType;
+ UCHAR wReserved;
+} RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
+
+NTOSAPI
+ULONGLONG
+DDKAPI
+VerSetConditionMask(
+ IN ULONGLONG ConditionMask,
+ IN ULONG TypeMask,
+ IN UCHAR Condition);
+
+#define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType) \
+ ((ConditionMask) = VerSetConditionMask((ConditionMask), \
+ (TypeBitMask), (ComparisonType)))
+
+/* RtlVerifyVersionInfo() TypeMask */
+
+#define VER_MINORVERSION 0x0000001
+#define VER_MAJORVERSION 0x0000002
+#define VER_BUILDNUMBER 0x0000004
+#define VER_PLATFORMID 0x0000008
+#define VER_SERVICEPACKMINOR 0x0000010
+#define VER_SERVICEPACKMAJOR 0x0000020
+#define VER_SUITENAME 0x0000040
+#define VER_PRODUCT_TYPE 0x0000080
+
+/* RtlVerifyVersionInfo() ComparisonType */
+
+#define VER_EQUAL 1
+#define VER_GREATER 2
+#define VER_GREATER_EQUAL 3
+#define VER_LESS 4
+#define VER_LESS_EQUAL 5
+#define VER_AND 6
+#define VER_OR 7
+
+#define VER_CONDITION_MASK 7
+#define VER_NUM_BITS_PER_CONDITION_MASK 3
+
+typedef struct _RTL_BITMAP {
+ ULONG SizeOfBitMap;
+ PULONG Buffer;
+} RTL_BITMAP, *PRTL_BITMAP;
+
+typedef struct _RTL_BITMAP_RUN {
+ ULONG StartingIndex;
+ ULONG NumberOfBits;
+} RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
+
+typedef NTSTATUS DDKAPI
+(*PRTL_QUERY_REGISTRY_ROUTINE)(
+ IN PWSTR ValueName,
+ IN ULONG ValueType,
+ IN PVOID ValueData,
+ IN ULONG ValueLength,
+ IN PVOID Context,
+ IN PVOID EntryContext);
+
+/* RTL_QUERY_REGISTRY_TABLE.Flags */
+#define RTL_QUERY_REGISTRY_SUBKEY 0x00000001
+#define RTL_QUERY_REGISTRY_TOPKEY 0x00000002
+#define RTL_QUERY_REGISTRY_REQUIRED 0x00000004
+#define RTL_QUERY_REGISTRY_NOVALUE 0x00000008
+#define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010
+#define RTL_QUERY_REGISTRY_DIRECT 0x00000020
+#define RTL_QUERY_REGISTRY_DELETE 0x00000040
+
+typedef struct _RTL_QUERY_REGISTRY_TABLE {
+ PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
+ ULONG Flags;
+ PWSTR Name;
+ PVOID EntryContext;
+ ULONG DefaultType;
+ PVOID DefaultData;
+ ULONG DefaultLength;
+} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
+
+typedef struct _TIME_FIELDS {
+ CSHORT Year;
+ CSHORT Month;
+ CSHORT Day;
+ CSHORT Hour;
+ CSHORT Minute;
+ CSHORT Second;
+ CSHORT Milliseconds;
+ CSHORT Weekday;
+} TIME_FIELDS, *PTIME_FIELDS;
+
+typedef PVOID DDKAPI
+(*PALLOCATE_FUNCTION)(
+ IN POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes,
+ IN ULONG Tag);
+
+typedef VOID DDKAPI
+(*PFREE_FUNCTION)(
+ IN PVOID Buffer);
+
+#define GENERAL_LOOKASIDE_S \
+ SLIST_HEADER ListHead; \
+ USHORT Depth; \
+ USHORT MaximumDepth; \
+ ULONG TotalAllocates; \
+ union { \
+ ULONG AllocateMisses; \
+ ULONG AllocateHits; \
+ }; \
+ ULONG TotalFrees; \
+ union { \
+ ULONG FreeMisses; \
+ ULONG FreeHits; \
+ }; \
+ POOL_TYPE Type; \
+ ULONG Tag; \
+ ULONG Size; \
+ PALLOCATE_FUNCTION Allocate; \
+ PFREE_FUNCTION Free; \
+ LIST_ENTRY ListEntry; \
+ ULONG LastTotalAllocates; \
+ union { \
+ ULONG LastAllocateMisses; \
+ ULONG LastAllocateHits; \
+ }; \
+ ULONG Future[2];
+
+typedef struct _GENERAL_LOOKASIDE {
+ GENERAL_LOOKASIDE_S;
+} GENERAL_LOOKASIDE, *PGENERAL_LOOKASIDE;
+
+typedef struct _NPAGED_LOOKASIDE_LIST {
+ GENERAL_LOOKASIDE_S;
+ KSPIN_LOCK Obsoleted;
+} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
+
+typedef struct _PAGED_LOOKASIDE_LIST {
+ GENERAL_LOOKASIDE_S;
+ FAST_MUTEX Obsoleted;
+} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
+
+typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
+
+typedef VOID DDKAPI (*PCALLBACK_FUNCTION)(
+ IN PVOID CallbackContext,
+ IN PVOID Argument1,
+ IN PVOID Argument2);
+
+typedef enum _EVENT_TYPE {
+ NotificationEvent,
+ SynchronizationEvent,
+} EVENT_TYPE;
+
+typedef enum _KWAIT_REASON {
+ Executive,
+ FreePage,
+ PageIn,
+ PoolAllocation,
+ DelayExecution,
+ Suspended,
+ UserRequest,
+ WrExecutive,
+ WrFreePage,
+ WrPageIn,
+ WrPoolAllocation,
+ WrDelayExecution,
+ WrSuspended,
+ WrUserRequest,
+ WrEventPair,
+ WrQueue,
+ WrLpcReceive,
+ WrLpcReply,
+ WrVirtualMemory,
+ WrPageOut,
+ WrRendezvous,
+ Spare2,
+ Spare3,
+ Spare4,
+ Spare5,
+ Spare6,
+ WrKernel,
+ MaximumWaitReason
+} KWAIT_REASON;
+
+typedef struct _KWAIT_BLOCK {
+ LIST_ENTRY WaitListEntry;
+ struct _KTHREAD * RESTRICTED_POINTER Thread;
+ PVOID Object;
+ struct _KWAIT_BLOCK * RESTRICTED_POINTER NextWaitBlock;
+ USHORT WaitKey;
+ USHORT WaitType;
+} KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
+
+typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
+
+typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
+ BOOLEAN Removed;
+ BOOLEAN Reserved[3];
+ LONG IoCount;
+ KEVENT RemoveEvent;
+} IO_REMOVE_LOCK_COMMON_BLOCK;
+
+typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
+ LONG Signature;
+ LONG HighWatermark;
+ LONGLONG MaxLockedTicks;
+ LONG AllocateTag;
+ LIST_ENTRY LockList;
+ KSPIN_LOCK Spin;
+ LONG LowMemoryCount;
+ ULONG Reserved1[4];
+ PVOID Reserved2;
+ PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks;
+} IO_REMOVE_LOCK_DBG_BLOCK;
+
+typedef struct _IO_REMOVE_LOCK {
+ IO_REMOVE_LOCK_COMMON_BLOCK Common;
+#if DBG
+ IO_REMOVE_LOCK_DBG_BLOCK Dbg;
+#endif
+} IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
+
+typedef struct _IO_WORKITEM *PIO_WORKITEM;
+
+typedef VOID DDKAPI
+(*PIO_WORKITEM_ROUTINE)(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PVOID Context);
+
+typedef struct _SHARE_ACCESS {
+ ULONG OpenCount;
+ ULONG Readers;
+ ULONG Writers;
+ ULONG Deleters;
+ ULONG SharedRead;
+ ULONG SharedWrite;
+ ULONG SharedDelete;
+} SHARE_ACCESS, *PSHARE_ACCESS;
+
+typedef enum _KINTERRUPT_MODE {
+ LevelSensitive,
+ Latched
+} KINTERRUPT_MODE;
+
+typedef VOID DDKAPI
+(*PKINTERRUPT_ROUTINE)(
+ VOID);
+
+typedef enum _KPROFILE_SOURCE {
+ ProfileTime,
+ ProfileAlignmentFixup,
+ ProfileTotalIssues,
+ ProfilePipelineDry,
+ ProfileLoadInstructions,
+ ProfilePipelineFrozen,
+ ProfileBranchInstructions,
+ ProfileTotalNonissues,
+ ProfileDcacheMisses,
+ ProfileIcacheMisses,
+ ProfileCacheMisses,
+ ProfileBranchMispredictions,
+ ProfileStoreInstructions,
+ ProfileFpInstructions,
+ ProfileIntegerInstructions,
+ Profile2Issue,
+ Profile3Issue,
+ Profile4Issue,
+ ProfileSpecialInstructions,
+ ProfileTotalCycles,
+ ProfileIcacheIssues,
+ ProfileDcacheAccesses,
+ ProfileMemoryBarrierCycles,
+ ProfileLoadLinkedIssues,
+ ProfileMaximum
+} KPROFILE_SOURCE;
+
+typedef enum _CREATE_FILE_TYPE {
+ CreateFileTypeNone,
+ CreateFileTypeNamedPipe,
+ CreateFileTypeMailslot
+} CREATE_FILE_TYPE;
+
+typedef struct _CONFIGURATION_INFORMATION {
+ ULONG DiskCount;
+ ULONG FloppyCount;
+ ULONG CdRomCount;
+ ULONG TapeCount;
+ ULONG ScsiPortCount;
+ ULONG SerialCount;
+ ULONG ParallelCount;
+ BOOLEAN AtDiskPrimaryAddressClaimed;
+ BOOLEAN AtDiskSecondaryAddressClaimed;
+ ULONG Version;
+ ULONG MediumChangerCount;
+} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
+
+typedef enum _CONFIGURATION_TYPE {
+ ArcSystem,
+ CentralProcessor,
+ FloatingPointProcessor,
+ PrimaryIcache,
+ PrimaryDcache,
+ SecondaryIcache,
+ SecondaryDcache,
+ SecondaryCache,
+ EisaAdapter,
+ TcAdapter,
+ ScsiAdapter,
+ DtiAdapter,
+ MultiFunctionAdapter,
+ DiskController,
+ TapeController,
+ CdromController,
+ WormController,
+ SerialController,
+ NetworkController,
+ DisplayController,
+ ParallelController,
+ PointerController,
+ KeyboardController,
+ AudioController,
+ OtherController,
+ DiskPeripheral,
+ FloppyDiskPeripheral,
+ TapePeripheral,
+ ModemPeripheral,
+ MonitorPeripheral,
+ PrinterPeripheral,
+ PointerPeripheral,
+ KeyboardPeripheral,
+ TerminalPeripheral,
+ OtherPeripheral,
+ LinePeripheral,
+ NetworkPeripheral,
+ SystemMemory,
+ DockingInformation,
+ RealModeIrqRoutingTable,
+ MaximumType
+} CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
+
+typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(
+ IN PVOID Context,
+ IN PUNICODE_STRING PathName,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG BusNumber,
+ IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
+ IN CONFIGURATION_TYPE ControllerType,
+ IN ULONG ControllerNumber,
+ IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
+ IN CONFIGURATION_TYPE PeripheralType,
+ IN ULONG PeripheralNumber,
+ IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation);
+
+typedef enum _WORK_QUEUE_TYPE {
+ CriticalWorkQueue,
+ DelayedWorkQueue,
+ HyperCriticalWorkQueue,
+ MaximumWorkQueue
+} WORK_QUEUE_TYPE;
+
+typedef VOID DDKAPI
+(*PWORKER_THREAD_ROUTINE)(
+ IN PVOID Parameter);
+
+typedef struct _WORK_QUEUE_ITEM {
+ LIST_ENTRY List;
+ PWORKER_THREAD_ROUTINE WorkerRoutine;
+ PVOID Parameter;
+} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
+
+typedef enum _KBUGCHECK_BUFFER_DUMP_STATE {
+ BufferEmpty,
+ BufferInserted,
+ BufferStarted,
+ BufferFinished,
+ BufferIncomplete
+} KBUGCHECK_BUFFER_DUMP_STATE;
+
+typedef VOID DDKAPI
+(*PKBUGCHECK_CALLBACK_ROUTINE)(
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+typedef struct _KBUGCHECK_CALLBACK_RECORD {
+ LIST_ENTRY Entry;
+ PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
+ PVOID Buffer;
+ ULONG Length;
+ PUCHAR Component;
+ ULONG_PTR Checksum;
+ UCHAR State;
+} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
+
+/*
+ * VOID
+ * KeInitializeCallbackRecord(
+ * IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
+ */
+#define KeInitializeCallbackRecord(CallbackRecord) \
+ CallbackRecord->State = BufferEmpty;
+
+typedef enum _KDPC_IMPORTANCE {
+ LowImportance,
+ MediumImportance,
+ HighImportance
+} KDPC_IMPORTANCE;
+
+typedef enum _MEMORY_CACHING_TYPE_ORIG {
+ MmFrameBufferCached = 2
+} MEMORY_CACHING_TYPE_ORIG;
+
+typedef enum _MEMORY_CACHING_TYPE {
+ MmNonCached = FALSE,
+ MmCached = TRUE,
+ MmWriteCombined = MmFrameBufferCached,
+ MmHardwareCoherentCached,
+ MmNonCachedUnordered,
+ MmUSWCCached,
+ MmMaximumCacheType
+} MEMORY_CACHING_TYPE;
+
+typedef enum _MM_PAGE_PRIORITY {
+ LowPagePriority,
+ NormalPagePriority = 16,
+ HighPagePriority = 32
+} MM_PAGE_PRIORITY;
+
+typedef enum _LOCK_OPERATION {
+ IoReadAccess,
+ IoWriteAccess,
+ IoModifyAccess
+} LOCK_OPERATION;
+
+typedef enum _MM_SYSTEM_SIZE {
+ MmSmallSystem,
+ MmMediumSystem,
+ MmLargeSystem
+} MM_SYSTEM_SIZE;
+
+typedef struct _OBJECT_HANDLE_INFORMATION {
+ ULONG HandleAttributes;
+ ACCESS_MASK GrantedAccess;
+} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
+
+typedef struct _CLIENT_ID {
+ HANDLE UniqueProcess;
+ HANDLE UniqueThread;
+} CLIENT_ID, *PCLIENT_ID;
+
+typedef VOID DDKAPI
+(*PKSTART_ROUTINE)(
+ IN PVOID StartContext);
+
+typedef VOID DDKAPI
+(*PCREATE_PROCESS_NOTIFY_ROUTINE)(
+ IN HANDLE ParentId,
+ IN HANDLE ProcessId,
+ IN BOOLEAN Create);
+
+typedef VOID DDKAPI
+(*PCREATE_THREAD_NOTIFY_ROUTINE)(
+ IN HANDLE ProcessId,
+ IN HANDLE ThreadId,
+ IN BOOLEAN Create);
+
+typedef struct _IMAGE_INFO {
+ union {
+ ULONG Properties;
+ struct {
+ ULONG ImageAddressingMode : 8;
+ ULONG SystemModeImage : 1;
+ ULONG ImageMappedToAllPids : 1;
+ ULONG Reserved : 22;
+ };
+ };
+ PVOID ImageBase;
+ ULONG ImageSelector;
+ SIZE_T ImageSize;
+ ULONG ImageSectionNumber;
+} IMAGE_INFO, *PIMAGE_INFO;
+
+#define IMAGE_ADDRESSING_MODE_32BIT 3
+
+typedef VOID DDKAPI
+(*PLOAD_IMAGE_NOTIFY_ROUTINE)(
+ IN PUNICODE_STRING FullImageName,
+ IN HANDLE ProcessId,
+ IN PIMAGE_INFO ImageInfo);
+
+typedef enum _PROCESSINFOCLASS {
+ ProcessBasicInformation,
+ ProcessQuotaLimits,
+ ProcessIoCounters,
+ ProcessVmCounters,
+ ProcessTimes,
+ ProcessBasePriority,
+ ProcessRaisePriority,
+ ProcessDebugPort,
+ ProcessExceptionPort,
+ ProcessAccessToken,
+ ProcessLdtInformation,
+ ProcessLdtSize,
+ ProcessDefaultHardErrorMode,
+ ProcessIoPortHandlers,
+ ProcessPooledUsageAndLimits,
+ ProcessWorkingSetWatch,
+ ProcessUserModeIOPL,
+ ProcessEnableAlignmentFaultFixup,
+ ProcessPriorityClass,
+ ProcessWx86Information,
+ ProcessHandleCount,
+ ProcessAffinityMask,
+ ProcessPriorityBoost,
+ ProcessDeviceMap,
+ ProcessSessionInformation,
+ ProcessForegroundInformation,
+ ProcessWow64Information,
+ ProcessImageFileName,
+ ProcessLUIDDeviceMapsEnabled,
+ ProcessBreakOnTermination,
+ ProcessDebugObjectHandle,
+ ProcessDebugFlags,
+ ProcessHandleTracing,
+ MaxProcessInfoClass
+} PROCESSINFOCLASS;
+
+typedef enum _THREADINFOCLASS {
+ ThreadBasicInformation,
+ ThreadTimes,
+ ThreadPriority,
+ ThreadBasePriority,
+ ThreadAffinityMask,
+ ThreadImpersonationToken,
+ ThreadDescriptorTableEntry,
+ ThreadEnableAlignmentFaultFixup,
+ ThreadEventPair_Reusable,
+ ThreadQuerySetWin32StartAddress,
+ ThreadZeroTlsCell,
+ ThreadPerformanceCount,
+ ThreadAmILastThread,
+ ThreadIdealProcessor,
+ ThreadPriorityBoost,
+ ThreadSetTlsArrayAddress,
+ ThreadIsIoPending,
+ ThreadHideFromDebugger,
+ ThreadBreakOnTermination,
+ MaxThreadInfoClass
+} THREADINFOCLASS;
+
+#define ES_SYSTEM_REQUIRED 0x00000001
+#define ES_DISPLAY_REQUIRED 0x00000002
+#define ES_USER_PRESENT 0x00000004
+#define ES_CONTINUOUS 0x80000000
+
+typedef ULONG EXECUTION_STATE;
+
+typedef VOID DDKAPI
+(*PREQUEST_POWER_COMPLETE)(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN UCHAR MinorFunction,
+ IN POWER_STATE PowerState,
+ IN PVOID Context,
+ IN PIO_STATUS_BLOCK IoStatus);
+
+typedef enum _TRACE_INFORMATION_CLASS {
+ TraceIdClass,
+ TraceHandleClass,
+ TraceEnableFlagsClass,
+ TraceEnableLevelClass,
+ GlobalLoggerHandleClass,
+ EventLoggerHandleClass,
+ AllLoggerHandlesClass,
+ TraceHandleByNameClass
+} TRACE_INFORMATION_CLASS;
+
+typedef NTSTATUS DDKAPI
+(*PEX_CALLBACK_FUNCTION)(
+ IN PVOID CallbackContext,
+ IN PVOID Argument1,
+ IN PVOID Argument2);
+
+
+
+/*
+** Storage structures
+*/
+typedef enum _PARTITION_STYLE {
+ PARTITION_STYLE_MBR,
+ PARTITION_STYLE_GPT
+} PARTITION_STYLE;
+
+typedef struct _CREATE_DISK_MBR {
+ ULONG Signature;
+} CREATE_DISK_MBR, *PCREATE_DISK_MBR;
+
+typedef struct _CREATE_DISK_GPT {
+ GUID DiskId;
+ ULONG MaxPartitionCount;
+} CREATE_DISK_GPT, *PCREATE_DISK_GPT;
+
+typedef struct _CREATE_DISK {
+ PARTITION_STYLE PartitionStyle;
+ union {
+ CREATE_DISK_MBR Mbr;
+ CREATE_DISK_GPT Gpt;
+ };
+} CREATE_DISK, *PCREATE_DISK;
+
+typedef struct _DISK_SIGNATURE {
+ ULONG PartitionStyle;
+ union {
+ struct {
+ ULONG Signature;
+ ULONG CheckSum;
+ } Mbr;
+ struct {
+ GUID DiskId;
+ } Gpt;
+ };
+} DISK_SIGNATURE, *PDISK_SIGNATURE;
+
+typedef VOID DDKFASTAPI
+(*PTIME_UPDATE_NOTIFY_ROUTINE)(
+ IN HANDLE ThreadId,
+ IN KPROCESSOR_MODE Mode);
+
+#define DBG_STATUS_CONTROL_C 1
+#define DBG_STATUS_SYSRQ 2
+#define DBG_STATUS_BUGCHECK_FIRST 3
+#define DBG_STATUS_BUGCHECK_SECOND 4
+#define DBG_STATUS_FATAL 5
+#define DBG_STATUS_DEBUG_CONTROL 6
+#define DBG_STATUS_WORKER 7
+
+typedef struct _PHYSICAL_MEMORY_RANGE {
+ PHYSICAL_ADDRESS BaseAddress;
+ LARGE_INTEGER NumberOfBytes;
+} PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
+
+typedef ULONG_PTR
+(*PDRIVER_VERIFIER_THUNK_ROUTINE)(
+ IN PVOID Context);
+
+typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
+ PDRIVER_VERIFIER_THUNK_ROUTINE PristineRoutine;
+ PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine;
+} DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS;
+
+#define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001
+#define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002
+#define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004
+#define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
+#define DRIVER_VERIFIER_IO_CHECKING 0x0010
+
+#define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001
+#define RTL_RANGE_LIST_ADD_SHARED 0x00000002
+
+#define RTL_RANGE_LIST_SHARED_OK 0x00000001
+#define RTL_RANGE_LIST_NULL_CONFLICT_OK 0x00000002
+
+#define RTL_RANGE_LIST_SHARED_OK 0x00000001
+#define RTL_RANGE_LIST_NULL_CONFLICT_OK 0x00000002
+
+#define RTL_RANGE_LIST_MERGE_IF_CONFLICT RTL_RANGE_LIST_ADD_IF_CONFLICT
+
+typedef struct _RTL_RANGE {
+ ULONGLONG Start;
+ ULONGLONG End;
+ PVOID UserData;
+ PVOID Owner;
+ UCHAR Attributes;
+ UCHAR Flags;
+} RTL_RANGE, *PRTL_RANGE;
+
+#define RTL_RANGE_SHARED 0x01
+#define RTL_RANGE_CONFLICT 0x02
+
+typedef struct _RTL_RANGE_LIST {
+ LIST_ENTRY ListHead;
+ ULONG Flags;
+ ULONG Count;
+ ULONG Stamp;
+} RTL_RANGE_LIST, *PRTL_RANGE_LIST;
+
+typedef struct _RANGE_LIST_ITERATOR {
+ PLIST_ENTRY RangeListHead;
+ PLIST_ENTRY MergedHead;
+ PVOID Current;
+ ULONG Stamp;
+} RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
+
+typedef BOOLEAN
+(*PRTL_CONFLICT_RANGE_CALLBACK)(
+ IN PVOID Context,
+ IN PRTL_RANGE Range);
+
+#define HASH_STRING_ALGORITHM_DEFAULT 0
+#define HASH_STRING_ALGORITHM_X65599 1
+#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
+
+typedef enum _SUITE_TYPE {
+ SmallBusiness,
+ Enterprise,
+ BackOffice,
+ CommunicationServer,
+ TerminalServer,
+ SmallBusinessRestricted,
+ EmbeddedNT,
+ DataCenter,
+ SingleUserTS,
+ Personal,
+ Blade,
+ MaxSuiteType
+} SUITE_TYPE;
+
+typedef VOID DDKAPI
+(*PTIMER_APC_ROUTINE)(
+ IN PVOID TimerContext,
+ IN ULONG TimerLowValue,
+ IN LONG TimerHighValue);
+
+
+
+/*
+** WMI structures
+*/
+
+typedef VOID DDKAPI
+(*WMI_NOTIFICATION_CALLBACK)(
+ PVOID Wnode,
+ PVOID Context);
+
+
+/*
+** Architecture specific structures
+*/
+
+#ifdef _X86_
+
+typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
+
+#define PASSIVE_LEVEL 0
+#define LOW_LEVEL 0
+#define APC_LEVEL 1
+#define DISPATCH_LEVEL 2
+#define PROFILE_LEVEL 27
+#define CLOCK1_LEVEL 28
+#define CLOCK2_LEVEL 28
+#define IPI_LEVEL 29
+#define POWER_LEVEL 30
+#define HIGH_LEVEL 31
+
+typedef struct _KPCR_TIB {
+ PVOID ExceptionList; /* 00 */
+ PVOID StackBase; /* 04 */
+ PVOID StackLimit; /* 08 */
+ PVOID SubSystemTib; /* 0C */
+ union {
+ PVOID FiberData; /* 10 */
+ DWORD Version; /* 10 */
+ };
+ PVOID ArbitraryUserPointer; /* 14 */
+} KPCR_TIB, *PKPCR_TIB; /* 18 */
+
+#define PCR_MINOR_VERSION 1
+#define PCR_MAJOR_VERSION 1
+
+typedef struct _KPCR {
+ KPCR_TIB Tib; /* 00 */
+ struct _KPCR *Self; /* 18 */
+ struct _KPRCB *PCRCB; /* 1C */
+ KIRQL Irql; /* 20 */
+ ULONG IRR; /* 24 */
+ ULONG IrrActive; /* 28 */
+ ULONG IDR; /* 2C */
+ PVOID KdVersionBlock; /* 30 */ PUSHORT IDT; /* 34 */
+ PUSHORT GDT; /* 38 */
+ struct _KTSS *TSS; /* 3C */
+ USHORT MajorVersion; /* 40 */
+ USHORT MinorVersion; /* 42 */
+ KAFFINITY SetMember; /* 44 */
+ ULONG StallScaleFactor; /* 48 */
+ UCHAR DebugActive; /* 4C */
+ UCHAR ProcessorNumber; /* 4D */
+ UCHAR Reserved[2]; /* 4E */
+} KPCR, *PKPCR; /* 50 */
+
+typedef struct _KFLOATING_SAVE {
+ ULONG ControlWord;
+ ULONG StatusWord;
+ ULONG ErrorOffset;
+ ULONG ErrorSelector;
+ ULONG DataOffset;
+ ULONG DataSelector;
+ ULONG Cr0NpxState;
+ ULONG Spare1;
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+#define PAGE_SIZE 0x1000
+#define PAGE_SHIFT 12L
+
+extern NTOSAPI PVOID *MmHighestUserAddress;
+extern NTOSAPI PVOID *MmSystemRangeStart;
+extern NTOSAPI ULONG *MmUserProbeAddress;
+
+#define MM_HIGHEST_USER_ADDRESS *MmHighestUserAddress
+#define MM_SYSTEM_RANGE_START *MmSystemRangeStart
+#define MM_USER_PROBE_ADDRESS *MmUserProbeAddress
+#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
+#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
+
+#define KI_USER_SHARED_DATA 0xffdf0000
+#define SharedUserData ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
+
+#define EFLAG_SIGN 0x8000
+#define EFLAG_ZERO 0x4000
+#define EFLAG_SELECT (EFLAG_SIGN | EFLAG_ZERO)
+
+#define RESULT_NEGATIVE ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
+#define RESULT_ZERO ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
+#define RESULT_POSITIVE ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
+
+typedef enum _INTERLOCKED_RESULT {
+ ResultNegative = RESULT_NEGATIVE,
+ ResultZero = RESULT_ZERO,
+ ResultPositive = RESULT_POSITIVE
+} INTERLOCKED_RESULT;
+
+NTOSAPI
+KIRQL
+DDKAPI
+KeGetCurrentIrql(
+ VOID);
+
+/*
+ * ULONG
+ * KeGetCurrentProcessorNumber(
+ * VOID)
+ */
+#define KeGetCurrentProcessorNumber() \
+ ((ULONG)KeGetCurrentKPCR()->ProcessorNumber)
+
+#if !defined(__INTERLOCKED_DECLARED)
+#define __INTERLOCKED_DECLARED
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedIncrement(
+ IN PLONG VOLATILE Addend);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedDecrement(
+ IN PLONG VOLATILE Addend);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedCompareExchange(
+ IN OUT PLONG VOLATILE Destination,
+ IN LONG Exchange,
+ IN LONG Comparand);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedExchange(
+ IN OUT PLONG VOLATILE Target,
+ IN LONG Value);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedExchangeAdd(
+ IN OUT PLONG VOLATILE Addend,
+ IN LONG Value);
+
+/*
+ * PVOID
+ * InterlockedExchangePointer(
+ * IN OUT PVOID VOLATILE *Target,
+ * IN PVOID Value)
+ */
+#define InterlockedExchangePointer(Target, Value) \
+ (PVOID) InterlockedExchange((PLONG) Target, (LONG) Value);
+
+/*
+ * PVOID
+ * InterlockedCompareExchangePointer(
+ * IN OUT PVOID *Destination,
+ * IN PVOID Exchange,
+ * IN PVOID Comparand)
+ */
+#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
+ (PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand);
+
+#endif /* !__INTERLOCKED_DECLARED */
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KefAcquireSpinLockAtDpcLevel(
+ IN PKSPIN_LOCK SpinLock);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KefReleaseSpinLockFromDpcLevel(
+ IN PKSPIN_LOCK SpinLock);
+
+#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
+#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
+
+#define RtlCopyMemoryNonTemporal RtlCopyMemory
+
+#define KeGetDcacheFillSize() 1L
+
+#endif /* _X86_ */
+
+
+
+/*
+** Utillity functions
+*/
+
+#define ARGUMENT_PRESENT(ArgumentPointer) \
+ (BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL);
+
+/*
+ * ULONG
+ * BYTE_OFFSET(
+ * IN PVOID Va)
+ */
+#define BYTE_OFFSET(Va) \
+ (ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1));
+
+/*
+ * ULONG
+ * BYTES_TO_PAGES(
+ * IN ULONG Size)
+ */
+#define BYTES_TO_PAGES(Size) \
+ (ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0);
+
+/*
+ * PCHAR
+ * CONTAINING_RECORD(
+ * IN PCHAR Address,
+ * IN TYPE Type,
+ * IN PCHAR Field);
+ */
+#ifndef CONTAINING_RECORD
+#define CONTAINING_RECORD(Address, Type, Field) \
+ ((Type *) (((ULONG_PTR) Address) - FIELD_OFFSET(Type, Field)))
+#endif
+
+/* LONG
+ * FIELD_OFFSET(
+ * IN TYPE Type,
+ * IN PCHAR Field);
+ */
+#ifndef FIELD_OFFSET
+#define FIELD_OFFSET(Type, Field) \
+ ((LONG) (&(((Type *) 0)->Field)))
+#endif
+
+/*
+ * PVOID
+ * PAGE_ALIGN(
+ * IN PVOID Va)
+ */
+#define PAGE_ALIGN(Va) \
+ (PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1));
+
+/*
+ * ULONG_PTR
+ * ROUND_TO_PAGES(
+ * IN ULONG_PTR Size)
+ */
+#define ROUND_TO_PAGES(Size) \
+ (ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1));
+
+NTOSAPI
+VOID
+DDKAPI
+RtlAssert(
+ IN PVOID FailedAssertion,
+ IN PVOID FileName,
+ IN ULONG LineNumber,
+ IN PCHAR Message);
+
+#if DBG
+
+#define ASSERT(exp) \
+ ((!(exp)) ? \
+ (RtlAssert( #exp, __FILE__, __LINE__, NULL ), FALSE) : TRUE)
+
+#define ASSERTMSG(msg, exp) \
+ ((!(exp)) ? \
+ (RtlAssert( #exp, __FILE__, __LINE__, msg ), FALSE) : TRUE)
+
+#define RTL_SOFT_ASSERT(exp) \
+ ((!(_exp)) ? \
+ (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #exp), FALSE) : TRUE)
+
+#define RTL_SOFT_ASSERTMSG(msg, exp) \
+ ((!(exp)) ? \
+ (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n Message: %s\n", __FILE__, __LINE__, #exp, (msg)), FALSE) : TRUE)
+
+#define RTL_VERIFY(exp) ASSERT(exp)
+#define RTL_VERIFYMSG(msg, exp) ASSERT(msg, exp)
+
+#define RTL_SOFT_VERIFY(exp) RTL_SOFT_ASSERT(exp)
+#define RTL_SOFT_VERIFYMSG(msg, exp) RTL_SOFT_ASSERTMSG(msg, exp)
+
+#else /* !DBG */
+
+#define ASSERT(exp) ((VOID) 0)
+#define ASSERTMSG(msg, exp) ((VOID) 0)
+
+#define RTL_SOFT_ASSERT(exp) ((VOID) 0)
+#define RTL_SOFT_ASSERTMSG(msg, exp) ((VOID) 0)
+
+#define RTL_VERIFY(exp) ((exp) ? TRUE : FALSE)
+#define RTL_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
+
+#define RTL_SOFT_VERIFY(exp) ((exp) ? TRUE : FALSE)
+#define RTL_SOFT_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
+
+#endif /* DBG */
+
+#define assert ASSERT
+
+
+/*
+** Driver support routines
+*/
+
+/** Runtime library routines **/
+
+/*
+ * VOID
+ * InitializeListHead(
+ * IN PLIST_ENTRY ListHead)
+ */
+#define InitializeListHead(_ListHead) \
+{ \
+ (_ListHead)->Flink = (_ListHead); \
+ (_ListHead)->Blink = (_ListHead); \
+}
+
+/*
+ * VOID
+ * InsertHeadList(
+ * IN PLIST_ENTRY ListHead,
+ * IN PLIST_ENTRY Entry)
+ */
+#define InsertHeadList(_ListHead, \
+ _Entry) \
+{ \
+ PLIST_ENTRY _OldFlink; \
+ _OldFlink = (_ListHead)->Flink; \
+ (_Entry)->Flink = _OldFlink; \
+ (_Entry)->Blink = (_ListHead); \
+ _OldFlink->Blink = (_Entry); \
+ (_ListHead)->Flink = (_Entry); \
+}
+
+/*
+ * VOID
+ * InsertTailList(
+ * IN PLIST_ENTRY ListHead,
+ * IN PLIST_ENTRY Entry)
+ */
+#define InsertTailList(_ListHead, \
+ _Entry) \
+{ \
+ PLIST_ENTRY _OldBlink; \
+ _OldBlink = (_ListHead)->Blink; \
+ (_Entry)->Flink = (_ListHead); \
+ (_Entry)->Blink = _OldBlink; \
+ _OldBlink->Flink = (_Entry); \
+ (_ListHead)->Blink = (_Entry); \
+}
+
+/*
+ * BOOLEAN
+ * IsListEmpty(
+ * IN PLIST_ENTRY ListHead)
+ */
+#define IsListEmpty(_ListHead) \
+ ((_ListHead)->Flink == (_ListHead))
+
+static inline PSINGLE_LIST_ENTRY
+PopEntryList(
+ IN PSINGLE_LIST_ENTRY ListHead)
+{
+ PSINGLE_LIST_ENTRY Entry;
+
+ Entry = ListHead->Next;
+ if (Entry != NULL)
+ {
+ ListHead->Next = Entry->Next;
+ }
+ return Entry;
+}
+
+/*
+ * VOID
+ * PushEntryList(
+ * IN PSINGLE_LIST_ENTRY ListHead,
+ * IN PSINGLE_LIST_ENTRY Entry)
+ */
+#define PushEntryList(_ListHead, \
+ _Entry) \
+{ \
+ (_Entry)->Next = (_ListHead)->Next; \
+ (_ListHead)->Next = (_Entry); \
+}
+
+/*
+ * VOID
+ * RemoveEntryList(
+ * IN PLIST_ENTRY Entry)
+ */
+#define RemoveEntryList(_Entry) \
+{ \
+ PLIST_ENTRY _OldFlink; \
+ PLIST_ENTRY _OldBlink; \
+ _OldFlink = (_Entry)->Flink; \
+ _OldBlink = (_Entry)->Blink; \
+ _OldFlink->Blink = _OldBlink; \
+ _OldBlink->Flink = _OldFlink; \
+ (_Entry)->Flink = NULL; \
+ (_Entry)->Blink = NULL; \
+}
+
+static inline PLIST_ENTRY
+RemoveHeadList(
+ IN PLIST_ENTRY ListHead)
+{
+ PLIST_ENTRY OldFlink;
+ PLIST_ENTRY OldBlink;
+ PLIST_ENTRY Entry;
+
+ Entry = ListHead->Flink;
+ OldFlink = ListHead->Flink->Flink;
+ OldBlink = ListHead->Flink->Blink;
+ OldFlink->Blink = OldBlink;
+ OldBlink->Flink = OldFlink;
+
+ if (Entry != ListHead)
+ {
+ Entry->Flink = NULL;
+ Entry->Blink = NULL;
+ }
+
+ return Entry;
+}
+
+static inline PLIST_ENTRY
+RemoveTailList(
+ IN PLIST_ENTRY ListHead)
+{
+ PLIST_ENTRY OldFlink;
+ PLIST_ENTRY OldBlink;
+ PLIST_ENTRY Entry;
+
+ Entry = ListHead->Blink;
+ OldFlink = ListHead->Blink->Flink;
+ OldBlink = ListHead->Blink->Blink;
+ OldFlink->Blink = OldBlink;
+ OldBlink->Flink = OldFlink;
+
+ if (Entry != ListHead)
+ {
+ Entry->Flink = NULL;
+ Entry->Blink = NULL;
+ }
+
+ return Entry;
+}
+
+NTOSAPI
+PSLIST_ENTRY
+DDKFASTAPI
+InterlockedPopEntrySList(
+ IN PSLIST_HEADER ListHead);
+
+NTOSAPI
+PSLIST_ENTRY
+DDKFASTAPI
+InterlockedPushEntrySList(
+ IN PSLIST_HEADER ListHead,
+ IN PSLIST_ENTRY ListEntry);
+
+/*
+ * USHORT
+ * QueryDepthSList(
+ * IN PSLIST_HEADER SListHead)
+ */
+#define QueryDepthSList(_SListHead) \
+ ((USHORT) ((_SListHead)->Alignment & 0xffff))
+
+#define InterlockedFlushSList(ListHead) ExInterlockedFlushSList(ListHead)
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlAnsiStringToUnicodeSize(
+ IN PANSI_STRING AnsiString);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlAddRange(
+ IN OUT PRTL_RANGE_LIST RangeList,
+ IN ULONGLONG Start,
+ IN ULONGLONG End,
+ IN UCHAR Attributes,
+ IN ULONG Flags,
+ IN PVOID UserData OPTIONAL,
+ IN PVOID Owner OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlAnsiStringToUnicodeString(
+ IN OUT PUNICODE_STRING DestinationString,
+ IN PANSI_STRING SourceString,
+ IN BOOLEAN AllocateDestinationString);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlAppendUnicodeStringToString(
+ IN OUT PUNICODE_STRING Destination,
+ IN PUNICODE_STRING Source);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlAppendUnicodeToString(
+ IN OUT PUNICODE_STRING Destination,
+ IN PCWSTR Source);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlAreBitsClear(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG StartingIndex,
+ IN ULONG Length);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlAreBitsSet(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG StartingIndex,
+ IN ULONG Length);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlCharToInteger(
+ IN PCSZ String,
+ IN ULONG Base OPTIONAL,
+ IN OUT PULONG Value);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlCheckBit(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG BitPosition);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlCheckRegistryKey(
+ IN ULONG RelativeTo,
+ IN PWSTR Path);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlClearAllBits(
+ IN PRTL_BITMAP BitMapHeader);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlClearBit(
+ PRTL_BITMAP BitMapHeader,
+ ULONG BitNumber);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlClearBits(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG StartingIndex,
+ IN ULONG NumberToClear);
+
+NTOSAPI
+SIZE_T
+DDKAPI
+RtlCompareMemory(
+ IN CONST VOID *Source1,
+ IN CONST VOID *Source2,
+ IN SIZE_T Length);
+
+NTOSAPI
+LONG
+DDKAPI
+RtlCompareString(
+ IN PSTRING String1,
+ IN PSTRING String2,
+ BOOLEAN CaseInSensitive);
+
+NTOSAPI
+LONG
+DDKAPI
+RtlCompareUnicodeString(
+ IN PUNICODE_STRING String1,
+ IN PUNICODE_STRING String2,
+ IN BOOLEAN CaseInSensitive);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlConvertLongToLargeInteger(
+ IN LONG SignedInteger);
+
+NTOSAPI
+LUID
+DDKAPI
+RtlConvertLongToLuid(
+ IN LONG Long);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlConvertUlongToLargeInteger(
+ IN ULONG UnsignedInteger);
+
+NTOSAPI
+LUID
+DDKAPI
+RtlConvertUlongToLuid(
+ ULONG Ulong);
+
+/*
+ * VOID
+ * RtlCopyMemory(
+ * IN VOID UNALIGNED *Destination,
+ * IN CONST VOID UNALIGNED *Source,
+ * IN SIZE_T Length)
+ */
+#ifndef RtlCopyMemory
+#define RtlCopyMemory(Destination, Source, Length) \
+ memcpy(Destination, Source, Length);
+#endif
+
+#ifndef RtlCopyBytes
+#define RtlCopyBytes RtlCopyMemory
+#endif
+
+NTOSAPI
+VOID
+DDKAPI
+RtlCopyMemory32(
+ IN VOID UNALIGNED *Destination,
+ IN CONST VOID UNALIGNED *Source,
+ IN ULONG Length);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlCopyRangeList(
+ OUT PRTL_RANGE_LIST CopyRangeList,
+ IN PRTL_RANGE_LIST RangeList);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlCopyString(
+ IN OUT PSTRING DestinationString,
+ IN PSTRING SourceString OPTIONAL);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlCopyUnicodeString(
+ IN OUT PUNICODE_STRING DestinationString,
+ IN PUNICODE_STRING SourceString);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlCreateRegistryKey(
+ IN ULONG RelativeTo,
+ IN PWSTR Path);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlCreateSecurityDescriptor(
+ IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN ULONG Revision);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlDeleteOwnersRanges(
+ IN OUT PRTL_RANGE_LIST RangeList,
+ IN PVOID Owner);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlDeleteRange(
+ IN OUT PRTL_RANGE_LIST RangeList,
+ IN ULONGLONG Start,
+ IN ULONGLONG End,
+ IN PVOID Owner);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlDeleteRegistryValue(
+ IN ULONG RelativeTo,
+ IN PCWSTR Path,
+ IN PCWSTR ValueName);
+
+/*
+ * BOOLEAN
+ * RtlEqualLuid(
+ * IN LUID Luid1,
+ * IN LUID Luid2)
+ */
+#define RtlEqualLuid(_Luid1, \
+ _Luid2) \
+ ((Luid1.LowPart == Luid2.LowPart) && (Luid1.HighPart == Luid2.HighPart))
+
+/*
+ * ULONG
+ * RtlEqualMemory(
+ * IN VOID UNALIGNED *Destination,
+ * IN CONST VOID UNALIGNED *Source,
+ * IN SIZE_T Length)
+ */
+#define RtlEqualMemory(Destination, Source, Length) (!memcmp(Destination, Source, Length))
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlEqualString(
+ IN PSTRING String1,
+ IN PSTRING String2,
+ IN BOOLEAN CaseInSensitive);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlEqualUnicodeString(
+ IN CONST UNICODE_STRING *String1,
+ IN CONST UNICODE_STRING *String2,
+ IN BOOLEAN CaseInSensitive);
+
+/*
+ * VOID
+ * RtlFillMemory(
+ * IN VOID UNALIGNED *Destination,
+ * IN SIZE_T Length,
+ * IN UCHAR Fill)
+ */
+#ifndef RtlFillMemory
+#define RtlFillMemory(Destination, Length, Fill) \
+ memset(Destination, Fill, Length);
+#endif
+
+#ifndef RtlFillBytes
+#define RtlFillBytes RtlFillMemory
+#endif
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindClearBits(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG NumberToFind,
+ IN ULONG HintIndex);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindClearBitsAndSet(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG NumberToFind,
+ IN ULONG HintIndex);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindClearRuns(
+ IN PRTL_BITMAP BitMapHeader,
+ OUT PRTL_BITMAP_RUN RunArray,
+ IN ULONG SizeOfRunArray,
+ IN BOOLEAN LocateLongestRuns);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindFirstRunClear(
+ IN PRTL_BITMAP BitMapHeader,
+ OUT PULONG StartingIndex);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindLastBackwardRunClear(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG FromIndex,
+ OUT PULONG StartingRunIndex);
+
+NTOSAPI
+CCHAR
+DDKAPI
+RtlFindLeastSignificantBit(
+ IN ULONGLONG Set);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindLongestRunClear(
+ IN PRTL_BITMAP BitMapHeader,
+ OUT PULONG StartingIndex);
+
+NTOSAPI
+CCHAR
+DDKAPI
+RtlFindMostSignificantBit(
+ IN ULONGLONG Set);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindNextForwardRunClear(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG FromIndex,
+ OUT PULONG StartingRunIndex);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlFindRange(
+ IN PRTL_RANGE_LIST RangeList,
+ IN ULONGLONG Minimum,
+ IN ULONGLONG Maximum,
+ IN ULONG Length,
+ IN ULONG Alignment,
+ IN ULONG Flags,
+ IN UCHAR AttributeAvailableMask,
+ IN PVOID Context OPTIONAL,
+ IN PRTL_CONFLICT_RANGE_CALLBACK Callback OPTIONAL,
+ OUT PULONGLONG Start);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindSetBits(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG NumberToFind,
+ IN ULONG HintIndex);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlFindSetBitsAndClear(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG NumberToFind,
+ IN ULONG HintIndex);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlFreeAnsiString(
+ IN PANSI_STRING AnsiString);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlFreeRangeList(
+ IN PRTL_RANGE_LIST RangeList);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlFreeUnicodeString(
+ IN PUNICODE_STRING UnicodeString);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlGetCallersAddress(
+ OUT PVOID *CallersAddress,
+ OUT PVOID *CallersCaller);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlGetVersion(
+ IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlGetFirstRange(
+ IN PRTL_RANGE_LIST RangeList,
+ OUT PRTL_RANGE_LIST_ITERATOR Iterator,
+ OUT PRTL_RANGE *Range);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlGetNextRange(
+ IN OUT PRTL_RANGE_LIST_ITERATOR Iterator,
+ OUT PRTL_RANGE *Range,
+ IN BOOLEAN MoveForwards);
+
+#define FOR_ALL_RANGES(RangeList, Iterator, Current) \
+ for (RtlGetFirstRange((RangeList), (Iterator), &(Current)); \
+ (Current) != NULL; \
+ RtlGetNextRange((Iterator), &(Current), TRUE))
+
+#define FOR_ALL_RANGES_BACKWARDS(RangeList, Iterator, Current) \
+ for (RtlGetLastRange((RangeList), (Iterator), &(Current)); \
+ (Current) != NULL; \
+ RtlGetNextRange((Iterator), &(Current), FALSE))
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlGUIDFromString(
+ IN PUNICODE_STRING GuidString,
+ OUT GUID *Guid);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlHashUnicodeString(
+ IN CONST UNICODE_STRING *String,
+ IN BOOLEAN CaseInSensitive,
+ IN ULONG HashAlgorithm,
+ OUT PULONG HashValue);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlInitAnsiString(
+ IN OUT PANSI_STRING DestinationString,
+ IN PCSZ SourceString);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlInitializeBitMap(
+ IN PRTL_BITMAP BitMapHeader,
+ IN PULONG BitMapBuffer,
+ IN ULONG SizeOfBitMap);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlInitializeRangeList(
+ IN OUT PRTL_RANGE_LIST RangeList);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlInitString(
+ IN OUT PSTRING DestinationString,
+ IN PCSZ SourceString);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlInitUnicodeString(
+ IN OUT PUNICODE_STRING DestinationString,
+ IN PCWSTR SourceString);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlInt64ToUnicodeString(
+ IN ULONGLONG Value,
+ IN ULONG Base OPTIONAL,
+ IN OUT PUNICODE_STRING String);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlIntegerToUnicodeString(
+ IN ULONG Value,
+ IN ULONG Base OPTIONAL,
+ IN OUT PUNICODE_STRING String);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlIntPtrToUnicodeString(
+ PLONG Value,
+ ULONG Base OPTIONAL,
+ PUNICODE_STRING String);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlInvertRangeList(
+ OUT PRTL_RANGE_LIST InvertedRangeList,
+ IN PRTL_RANGE_LIST RangeList);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlIsRangeAvailable(
+ IN PRTL_RANGE_LIST RangeList,
+ IN ULONGLONG Start,
+ IN ULONGLONG End,
+ IN ULONG Flags,
+ IN UCHAR AttributeAvailableMask,
+ IN PVOID Context OPTIONAL,
+ IN PRTL_CONFLICT_RANGE_CALLBACK Callback OPTIONAL,
+ OUT PBOOLEAN Available);
+
+/*
+ * BOOLEAN
+ * RtlIsZeroLuid(
+ * IN PLUID L1)
+ */
+#define RtlIsZeroLuid(_L1) \
+ ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlLengthSecurityDescriptor(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlMapGenericMask(
+ IN OUT PACCESS_MASK AccessMask,
+ IN PGENERIC_MAPPING GenericMapping);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlMergeRangeLists(
+ OUT PRTL_RANGE_LIST MergedRangeList,
+ IN PRTL_RANGE_LIST RangeList1,
+ IN PRTL_RANGE_LIST RangeList2,
+ IN ULONG Flags);
+
+/*
+ * VOID
+ * RtlMoveMemory(
+ * IN VOID UNALIGNED *Destination,
+ * IN CONST VOID UNALIGNED *Source,
+ * IN SIZE_T Length)
+ */
+#define RtlMoveMemory memmove
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlNumberOfClearBits(
+ IN PRTL_BITMAP BitMapHeader);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlNumberOfSetBits(
+ IN PRTL_BITMAP BitMapHeader);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+RtlPrefetchMemoryNonTemporal(
+ IN PVOID Source,
+ IN SIZE_T Length);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlPrefixUnicodeString(
+ IN PUNICODE_STRING String1,
+ IN PUNICODE_STRING String2,
+ IN BOOLEAN CaseInSensitive);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlQueryRegistryValues(
+ IN ULONG RelativeTo,
+ IN PCWSTR Path,
+ IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
+ IN PVOID Context,
+ IN PVOID Environment OPTIONAL);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlRetrieveUlong(
+ IN OUT PULONG DestinationAddress,
+ IN PULONG SourceAddress);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlRetrieveUshort(
+ IN OUT PUSHORT DestinationAddress,
+ IN PUSHORT SourceAddress);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlSetAllBits(
+ IN PRTL_BITMAP BitMapHeader);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlSetBit(
+ PRTL_BITMAP BitMapHeader,
+ ULONG BitNumber);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlSetBits(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG StartingIndex,
+ IN ULONG NumberToSet);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlSetDaclSecurityDescriptor(
+ IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN BOOLEAN DaclPresent,
+ IN PACL Dacl OPTIONAL,
+ IN BOOLEAN DaclDefaulted OPTIONAL);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlStoreUlong(
+ IN PULONG Address,
+ IN ULONG Value);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlStoreUlonglong(
+ IN OUT PULONGLONG Address,
+ ULONGLONG Value);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlStoreUlongPtr(
+ IN OUT PULONG_PTR Address,
+ IN ULONG_PTR Value);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlStoreUshort(
+ IN PUSHORT Address,
+ IN USHORT Value);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlStringFromGUID(
+ IN REFGUID Guid,
+ OUT PUNICODE_STRING GuidString);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlTestBit(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG BitNumber);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlTimeFieldsToTime(
+ IN PTIME_FIELDS TimeFields,
+ IN PLARGE_INTEGER Time);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlTimeToTimeFields(
+ IN PLARGE_INTEGER Time,
+ IN PTIME_FIELDS TimeFields);
+
+NTOSAPI
+ULONG
+DDKFASTAPI
+RtlUlongByteSwap(
+ IN ULONG Source);
+
+NTOSAPI
+ULONGLONG
+DDKFASTAPI
+RtlUlonglongByteSwap(
+ IN ULONGLONG Source);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlUnicodeStringToAnsiSize(
+ IN PUNICODE_STRING UnicodeString);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlUnicodeStringToAnsiString(
+ IN OUT PANSI_STRING DestinationString,
+ IN PUNICODE_STRING SourceString,
+ IN BOOLEAN AllocateDestinationString);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlUnicodeStringToInteger(
+ IN PUNICODE_STRING String,
+ IN ULONG Base OPTIONAL,
+ OUT PULONG Value);
+
+NTOSAPI
+WCHAR
+DDKAPI
+RtlUpcaseUnicodeChar(
+ IN WCHAR SourceCharacter);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlUpcaseUnicodeString(
+ IN OUT PUNICODE_STRING DestinationString OPTIONAL,
+ IN PCUNICODE_STRING SourceString,
+ IN BOOLEAN AllocateDestinationString);
+
+NTOSAPI
+CHAR
+DDKAPI
+RtlUpperChar(
+ IN CHAR Character);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlUpperString(
+ IN OUT PSTRING DestinationString,
+ IN PSTRING SourceString);
+
+NTOSAPI
+USHORT
+DDKFASTAPI
+RtlUshortByteSwap(
+ IN USHORT Source);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlValidRelativeSecurityDescriptor(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
+ IN ULONG SecurityDescriptorLength,
+ IN SECURITY_INFORMATION RequiredInformation);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlValidSecurityDescriptor(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlVerifyVersionInfo(
+ IN PRTL_OSVERSIONINFOEXW VersionInfo,
+ IN ULONG TypeMask,
+ IN ULONGLONG ConditionMask);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlVolumeDeviceToDosName(
+ IN PVOID VolumeDeviceObject,
+ OUT PUNICODE_STRING DosName);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlWalkFrameChain(
+ OUT PVOID *Callers,
+ IN ULONG Count,
+ IN ULONG Flags);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+RtlWriteRegistryValue(
+ IN ULONG RelativeTo,
+ IN PCWSTR Path,
+ IN PCWSTR ValueName,
+ IN ULONG ValueType,
+ IN PVOID ValueData,
+ IN ULONG ValueLength);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlxUnicodeStringToAnsiSize(
+ IN PUNICODE_STRING UnicodeString);
+
+/*
+ * VOID
+ * RtlZeroMemory(
+ * IN VOID UNALIGNED *Destination,
+ * IN SIZE_T Length)
+ */
+#ifndef RtlZeroMemory
+#define RtlZeroMemory(Destination, Length) \
+ memset(Destination, 0, Length);
+#endif
+
+#ifndef RtlZeroBytes
+#define RtlZeroBytes RtlZeroMemory
+#endif
+
+
+/** Executive support routines **/
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ExAcquireFastMutex(
+ IN PFAST_MUTEX FastMutex);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ExAcquireFastMutexUnsafe(
+ IN PFAST_MUTEX FastMutex);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExAcquireResourceExclusiveLite(
+ IN PERESOURCE Resource,
+ IN BOOLEAN Wait);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExAcquireResourceSharedLite(
+ IN PERESOURCE Resource,
+ IN BOOLEAN Wait);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExAcquireSharedStarveExclusive(
+ IN PERESOURCE Resource,
+ IN BOOLEAN Wait);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExAcquireSharedWaitForExclusive(
+ IN PERESOURCE Resource,
+ IN BOOLEAN Wait);
+
+static inline PVOID
+ExAllocateFromNPagedLookasideList(
+ IN PNPAGED_LOOKASIDE_LIST Lookaside)
+{
+ PVOID Entry;
+
+ Lookaside->TotalAllocates++;
+ Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
+ if (Entry == NULL) {
+ Lookaside->AllocateMisses++;
+ Entry = (Lookaside->Allocate)(Lookaside->Type, Lookaside->Size, Lookaside->Tag);
+ }
+ return Entry;
+}
+
+static inline PVOID
+ExAllocateFromPagedLookasideList(
+ IN PPAGED_LOOKASIDE_LIST Lookaside)
+{
+ PVOID Entry;
+
+ Lookaside->TotalAllocates++;
+ Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
+ if (Entry == NULL) {
+ Lookaside->AllocateMisses++;
+ Entry = (Lookaside->Allocate)(Lookaside->Type,
+ Lookaside->Size, Lookaside->Tag);
+ }
+ return Entry;
+}
+
+NTOSAPI
+PVOID
+DDKAPI
+ExAllocatePoolWithQuotaTag(
+ IN POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes,
+ IN ULONG Tag);
+
+NTOSAPI
+PVOID
+DDKAPI
+ExAllocatePoolWithTag(
+ IN POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes,
+ IN ULONG Tag);
+
+#ifdef POOL_TAGGING
+
+#define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
+#define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
+
+#else /* !POOL_TAGGING */
+
+NTOSAPI
+PVOID
+DDKAPI
+ExAllocatePool(
+ IN POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes);
+
+NTOSAPI
+PVOID
+DDKAPI
+ExAllocatePoolWithQuota(
+ IN POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes);
+
+#endif /* POOL_TAGGING */
+
+NTOSAPI
+PVOID
+DDKAPI
+ExAllocatePoolWithTagPriority(
+ IN POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes,
+ IN ULONG Tag,
+ IN EX_POOL_PRIORITY Priority);
+
+NTOSAPI
+VOID
+DDKAPI
+ExConvertExclusiveToSharedLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ExCreateCallback(
+ OUT PCALLBACK_OBJECT *CallbackObject,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN BOOLEAN Create,
+ IN BOOLEAN AllowMultipleCallbacks);
+
+NTOSAPI
+VOID
+DDKAPI
+ExDeleteNPagedLookasideList(
+ IN PNPAGED_LOOKASIDE_LIST Lookaside);
+
+NTOSAPI
+VOID
+DDKAPI
+ExDeletePagedLookasideList(
+ IN PPAGED_LOOKASIDE_LIST Lookaside);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ExDeleteResourceLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+VOID
+DDKAPI
+ExFreePool(
+ IN PVOID P);
+
+#define PROTECTED_POOL 0x80000000
+
+#ifdef POOL_TAGGING
+#define ExFreePool(P) ExFreePoolWithTag(P, 0)
+#endif
+
+NTOSAPI
+VOID
+DDKAPI
+ExFreePoolWithTag(
+ IN PVOID P,
+ IN ULONG Tag);
+
+#define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
+
+static inline VOID
+ExFreeToNPagedLookasideList(
+ IN PNPAGED_LOOKASIDE_LIST Lookaside,
+ IN PVOID Entry)
+{
+ Lookaside->TotalFrees++;
+ if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
+ Lookaside->FreeMisses++;
+ (Lookaside->Free)(Entry);
+ } else {
+ InterlockedPushEntrySList(&Lookaside->ListHead,
+ (PSLIST_ENTRY)Entry);
+ }
+}
+
+static inline VOID
+ExFreeToPagedLookasideList(
+ IN PPAGED_LOOKASIDE_LIST Lookaside,
+ IN PVOID Entry)
+{
+ Lookaside->TotalFrees++;
+ if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) {
+ Lookaside->FreeMisses++;
+ (Lookaside->Free)(Entry);
+ } else {
+ InterlockedPushEntrySList(&Lookaside->ListHead, (PSLIST_ENTRY)Entry);
+ }
+}
+
+/*
+ * ERESOURCE_THREAD
+ * ExGetCurrentResourceThread(
+ * VOID);
+ */
+#define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
+
+NTOSAPI
+ULONG
+DDKAPI
+ExGetExclusiveWaiterCount(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+KPROCESSOR_MODE
+DDKAPI
+ExGetPreviousMode(
+ VOID);
+
+NTOSAPI
+ULONG
+DDKAPI
+ExGetSharedWaiterCount(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeEvent(
+ IN PRKEVENT Event,
+ IN EVENT_TYPE Type,
+ IN BOOLEAN State);
+
+/*
+ * VOID DDKAPI
+ * ExInitializeFastMutex(
+ * IN PFAST_MUTEX FastMutex)
+ */
+#define ExInitializeFastMutex(_FastMutex) \
+{ \
+ (_FastMutex)->Count = 1; \
+ (_FastMutex)->Owner = NULL; \
+ (_FastMutex)->Contention = 0; \
+ KeInitializeEvent(&(_FastMutex)->Event, SynchronizationEvent, FALSE); \
+}
+
+NTOSAPI
+VOID
+DDKAPI
+ExInitializeNPagedLookasideList(
+ IN PNPAGED_LOOKASIDE_LIST Lookaside,
+ IN PALLOCATE_FUNCTION Allocate OPTIONAL,
+ IN PFREE_FUNCTION Free OPTIONAL,
+ IN ULONG Flags,
+ IN SIZE_T Size,
+ IN ULONG Tag,
+ IN USHORT Depth);
+
+NTOSAPI
+VOID
+DDKAPI
+ExInitializePagedLookasideList(
+ IN PPAGED_LOOKASIDE_LIST Lookaside,
+ IN PALLOCATE_FUNCTION Allocate OPTIONAL,
+ IN PFREE_FUNCTION Free OPTIONAL,
+ IN ULONG Flags,
+ IN SIZE_T Size,
+ IN ULONG Tag,
+ IN USHORT Depth);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ExInitializeResourceLite(
+ IN PERESOURCE Resource);
+
+/*
+ * VOID
+ * InitializeSListHead(
+ * IN PSLIST_HEADER SListHead)
+ */
+#define InitializeSListHead(_SListHead) \
+ (_SListHead)->Alignment = 0;
+
+#define ExInitializeSListHead InitializeSListHead
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+ExInterlockedAddLargeInteger(
+ IN PLARGE_INTEGER Addend,
+ IN LARGE_INTEGER Increment,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ExInterlockedAddLargeStatistic(
+ IN PLARGE_INTEGER Addend,
+ IN ULONG Increment);
+
+NTOSAPI
+ULONG
+DDKFASTAPI
+ExInterlockedAddUlong(
+ IN PULONG Addend,
+ IN ULONG Increment,
+ PKSPIN_LOCK Lock);
+
+NTOSAPI
+LONGLONG
+DDKFASTAPI
+ExInterlockedCompareExchange64(
+ IN OUT PLONGLONG Destination,
+ IN PLONGLONG Exchange,
+ IN PLONGLONG Comparand,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+PSINGLE_LIST_ENTRY
+DDKFASTAPI
+ExInterlockedFlushSList(
+ IN PSLIST_HEADER ListHead);
+
+NTOSAPI
+PLIST_ENTRY
+DDKFASTAPI
+ExInterlockedInsertHeadList(
+ IN PLIST_ENTRY ListHead,
+ IN PLIST_ENTRY ListEntry,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+PLIST_ENTRY
+DDKFASTAPI
+ExInterlockedInsertTailList(
+ IN PLIST_ENTRY ListHead,
+ IN PLIST_ENTRY ListEntry,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+PSINGLE_LIST_ENTRY
+DDKFASTAPI
+ExInterlockedPopEntryList(
+ IN PSINGLE_LIST_ENTRY ListHead,
+ IN PKSPIN_LOCK Lock);
+
+/*
+ * PSINGLE_LIST_ENTRY
+ * ExInterlockedPopEntrySList(
+ * IN PSLIST_HEADER ListHead,
+ * IN PKSPIN_LOCK Lock)
+ */
+#define ExInterlockedPopEntrySList(_ListHead, \
+ _Lock) \
+ InterlockedPopEntrySList(_ListHead)
+
+NTOSAPI
+PSINGLE_LIST_ENTRY
+DDKFASTAPI
+ExInterlockedPushEntryList(
+ IN PSINGLE_LIST_ENTRY ListHead,
+ IN PSINGLE_LIST_ENTRY ListEntry,
+ IN PKSPIN_LOCK Lock);
+
+/*
+ * PSINGLE_LIST_ENTRY FASTCALL
+ * ExInterlockedPushEntrySList(
+ * IN PSLIST_HEADER ListHead,
+ * IN PSINGLE_LIST_ENTRY ListEntry,
+ * IN PKSPIN_LOCK Lock)
+ */
+#define ExInterlockedPushEntrySList(_ListHead, \
+ _ListEntry, \
+ _Lock) \
+ InterlockedPushEntrySList(_ListHead, _ListEntry)
+
+NTOSAPI
+PLIST_ENTRY
+DDKFASTAPI
+ExInterlockedRemoveHeadList(
+ IN PLIST_ENTRY ListHead,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExIsProcessorFeaturePresent(
+ IN ULONG ProcessorFeature);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExIsResourceAcquiredExclusiveLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+USHORT
+DDKAPI
+ExIsResourceAcquiredLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+USHORT
+DDKAPI
+ExIsResourceAcquiredSharedLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+VOID
+DDKAPI
+ExLocalTimeToSystemTime(
+ IN PLARGE_INTEGER LocalTime,
+ OUT PLARGE_INTEGER SystemTime);
+
+NTOSAPI
+VOID
+DDKAPI
+ExNotifyCallback(
+ IN PCALLBACK_OBJECT CallbackObject,
+ IN PVOID Argument1,
+ IN PVOID Argument2);
+
+NTOSAPI
+VOID
+DDKAPI
+ExRaiseAccessViolation(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+ExRaiseDatatypeMisalignment(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+ExRaiseStatus(
+ IN NTSTATUS Status);
+
+NTOSAPI
+PVOID
+DDKAPI
+ExRegisterCallback(
+ IN PCALLBACK_OBJECT CallbackObject,
+ IN PCALLBACK_FUNCTION CallbackFunction,
+ IN PVOID CallbackContext);
+
+NTOSAPI
+VOID
+DDKAPI
+ExReinitializeResourceLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ExReleaseFastMutex(
+ IN PFAST_MUTEX FastMutex);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ExReleaseFastMutexUnsafe(
+ IN PFAST_MUTEX FastMutex);
+
+NTOSAPI
+VOID
+DDKAPI
+ExReleaseResourceForThreadLite(
+ IN PERESOURCE Resource,
+ IN ERESOURCE_THREAD ResourceThreadId);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ExReleaseResourceLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+VOID
+DDKAPI
+ExSetResourceOwnerPointer(
+ IN PERESOURCE Resource,
+ IN PVOID OwnerPointer);
+
+NTOSAPI
+ULONG
+DDKAPI
+ExSetTimerResolution(
+ IN ULONG DesiredTime,
+ IN BOOLEAN SetResolution);
+
+NTOSAPI
+VOID
+DDKAPI
+ExSystemTimeToLocalTime(
+ IN PLARGE_INTEGER SystemTime,
+ OUT PLARGE_INTEGER LocalTime);
+
+NTOSAPI
+BOOLEAN
+DDKFASTAPI
+ExTryToAcquireFastMutex(
+ IN PFAST_MUTEX FastMutex);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExTryToAcquireResourceExclusiveLite(
+ IN PERESOURCE Resource);
+
+NTOSAPI
+VOID
+DDKAPI
+ExUnregisterCallback(
+ IN PVOID CbRegistration);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ExUuidCreate(
+ OUT UUID *Uuid);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExVerifySuite(
+ IN SUITE_TYPE SuiteType);
+
+#if DBG
+
+#define PAGED_CODE() { \
+ if (KeGetCurrentIrql() > APC_LEVEL) { \
+ KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
+ assert(FALSE); \
+ } \
+}
+
+#else
+
+#define PAGED_CODE()
+
+#endif
+
+NTOSAPI
+VOID
+DDKAPI
+ProbeForRead(
+ IN CONST VOID *Address,
+ IN ULONG Length,
+ IN ULONG Alignment);
+
+NTOSAPI
+VOID
+DDKAPI
+ProbeForWrite(
+ IN CONST VOID *Address,
+ IN ULONG Length,
+ IN ULONG Alignment);
+
+
+
+/** Configuration manager routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+CmRegisterCallback(
+ IN PEX_CALLBACK_FUNCTION Function,
+ IN PVOID Context,
+ IN OUT PLARGE_INTEGER Cookie);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+CmUnRegisterCallback(
+ IN LARGE_INTEGER Cookie);
+
+
+
+/** Filesystem runtime library routines **/
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+FsRtlIsTotalDeviceFailure(
+ IN NTSTATUS Status);
+
+
+
+/** Hardware abstraction layer routines **/
+
+NTOSAPI
+VOID
+DDKFASTAPI
+HalExamineMBR(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN ULONG MBRTypeIdentifier,
+ OUT PVOID Buffer);
+
+NTOSAPI
+VOID
+DDKAPI
+READ_PORT_BUFFER_UCHAR(
+ IN PUCHAR Port,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+READ_PORT_BUFFER_ULONG(
+ IN PULONG Port,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+READ_PORT_BUFFER_USHORT(
+ IN PUSHORT Port,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+UCHAR
+DDKAPI
+READ_PORT_UCHAR(
+ IN PUCHAR Port);
+
+NTOSAPI
+ULONG
+DDKAPI
+READ_PORT_ULONG(
+ IN PULONG Port);
+
+NTOSAPI
+USHORT
+DDKAPI
+READ_PORT_USHORT(
+ IN PUSHORT Port);
+
+NTOSAPI
+VOID
+DDKAPI
+READ_REGISTER_BUFFER_UCHAR(
+ IN PUCHAR Register,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+READ_REGISTER_BUFFER_ULONG(
+ IN PULONG Register,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+READ_REGISTER_BUFFER_USHORT(
+ IN PUSHORT Register,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+UCHAR
+DDKAPI
+READ_REGISTER_UCHAR(
+ IN PUCHAR Register);
+
+NTOSAPI
+ULONG
+DDKAPI
+READ_REGISTER_ULONG(
+ IN PULONG Register);
+
+NTOSAPI
+USHORT
+DDKAPI
+READ_REGISTER_USHORT(
+ IN PUSHORT Register);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_PORT_BUFFER_UCHAR(
+ IN PUCHAR Port,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_PORT_BUFFER_ULONG(
+ IN PULONG Port,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_PORT_BUFFER_USHORT(
+ IN PUSHORT Port,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_PORT_UCHAR(
+ IN PUCHAR Port,
+ IN UCHAR Value);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_PORT_ULONG(
+ IN PULONG Port,
+ IN ULONG Value);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_PORT_USHORT(
+ IN PUSHORT Port,
+ IN USHORT Value);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_REGISTER_BUFFER_UCHAR(
+ IN PUCHAR Register,
+ IN PUCHAR Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_REGISTER_BUFFER_ULONG(
+ IN PULONG Register,
+ IN PULONG Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_REGISTER_BUFFER_USHORT(
+ IN PUSHORT Register,
+ IN PUSHORT Buffer,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_REGISTER_UCHAR(
+ IN PUCHAR Register,
+ IN UCHAR Value);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_REGISTER_ULONG(
+ IN PULONG Register,
+ IN ULONG Value);
+
+NTOSAPI
+VOID
+DDKAPI
+WRITE_REGISTER_USHORT(
+ IN PUSHORT Register,
+ IN USHORT Value);
+
+
+
+/** I/O manager routines **/
+
+NTOSAPI
+VOID
+DDKAPI
+IoAcquireCancelSpinLock(
+ OUT PKIRQL Irql);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoAcquireRemoveLockEx(
+ IN PIO_REMOVE_LOCK RemoveLock,
+ IN OPTIONAL PVOID Tag OPTIONAL,
+ IN PCSTR File,
+ IN ULONG Line,
+ IN ULONG RemlockSize);
+
+/*
+ * NTSTATUS
+ * IoAcquireRemoveLock(
+ * IN PIO_REMOVE_LOCK RemoveLock,
+ * IN OPTIONAL PVOID Tag)
+ */
+#define IoAcquireRemoveLock(_RemoveLock, \
+ _Tag) \
+ IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK));
+
+/*
+ * VOID
+ * IoAdjustPagingPathCount(
+ * IN PLONG Count,
+ * IN BOOLEAN Increment)
+ */
+#define IoAdjustPagingPathCount(_Count, \
+ _Increment) \
+{ \
+ if (_Increment) \
+ { \
+ InterlockedIncrement(_Count); \
+ } \
+ else \
+ { \
+ InterlockedDecrement(_Count); \
+ } \
+}
+
+NTOSAPI
+VOID
+DDKAPI
+IoAllocateController(
+ IN PCONTROLLER_OBJECT ControllerObject,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PDRIVER_CONTROL ExecutionRoutine,
+ IN PVOID Context);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoAllocateDriverObjectExtension(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PVOID ClientIdentificationAddress,
+ IN ULONG DriverObjectExtensionSize,
+ OUT PVOID *DriverObjectExtension);
+
+typedef struct _IO_ERROR_LOG_PACKET {
+ UCHAR MajorFunctionCode;
+ UCHAR RetryCount;
+ USHORT DumpDataSize;
+ USHORT NumberOfStrings;
+ USHORT StringOffset;
+ USHORT EventCategory;
+ NTSTATUS ErrorCode;
+ ULONG UniqueErrorValue;
+ NTSTATUS FinalStatus;
+ ULONG SequenceNumber;
+ ULONG IoControlCode;
+ LARGE_INTEGER DeviceOffset;
+ ULONG DumpData[1];
+} IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
+
+NTOSAPI
+PVOID
+DDKAPI
+IoAllocateErrorLogEntry(
+ IN PVOID IoObject,
+ IN UCHAR EntrySize);
+
+NTOSAPI
+PIRP
+DDKAPI
+IoAllocateIrp(
+ IN CCHAR StackSize,
+ IN BOOLEAN ChargeQuota);
+
+NTOSAPI
+PMDL
+DDKAPI
+IoAllocateMdl(
+ IN PVOID VirtualAddress,
+ IN ULONG Length,
+ IN BOOLEAN SecondaryBuffer,
+ IN BOOLEAN ChargeQuota,
+ IN OUT PIRP Irp OPTIONAL);
+
+NTOSAPI
+PIO_WORKITEM
+DDKAPI
+IoAllocateWorkItem(
+ IN PDEVICE_OBJECT DeviceObject);
+
+/*
+ * VOID IoAssignArcName(
+ * IN PUNICODE_STRING ArcName,
+ * IN PUNICODE_STRING DeviceName);
+ */
+#define IoAssignArcName(_ArcName, _DeviceName) ( \
+ IoCreateSymbolicLink((_ArcName), (_DeviceName)))
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoAttachDevice(
+ IN PDEVICE_OBJECT SourceDevice,
+ IN PUNICODE_STRING TargetDevice,
+ OUT PDEVICE_OBJECT *AttachedDevice);
+
+NTOSAPI
+PDEVICE_OBJECT
+DDKAPI
+IoAttachDeviceToDeviceStack(
+ IN PDEVICE_OBJECT SourceDevice,
+ IN PDEVICE_OBJECT TargetDevice);
+
+NTOSAPI
+PIRP
+DDKAPI
+IoBuildAsynchronousFsdRequest(
+ IN ULONG MajorFunction,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN OUT PVOID Buffer OPTIONAL,
+ IN ULONG Length OPTIONAL,
+ IN PLARGE_INTEGER StartingOffset OPTIONAL,
+ IN PIO_STATUS_BLOCK IoStatusBlock OPTIONAL);
+
+NTOSAPI
+PIRP
+DDKAPI
+IoBuildDeviceIoControlRequest(
+ IN ULONG IoControlCode,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PVOID InputBuffer OPTIONAL,
+ IN ULONG InputBufferLength,
+ OUT PVOID OutputBuffer OPTIONAL,
+ IN ULONG OutputBufferLength,
+ IN BOOLEAN InternalDeviceIoControl,
+ IN PKEVENT Event,
+ OUT PIO_STATUS_BLOCK IoStatusBlock);
+
+NTOSAPI
+VOID
+DDKAPI
+IoBuildPartialMdl(
+ IN PMDL SourceMdl,
+ IN OUT PMDL TargetMdl,
+ IN PVOID VirtualAddress,
+ IN ULONG Length);
+
+NTOSAPI
+PIRP
+DDKAPI
+IoBuildSynchronousFsdRequest(
+ IN ULONG MajorFunction,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN OUT PVOID Buffer OPTIONAL,
+ IN ULONG Length OPTIONAL,
+ IN PLARGE_INTEGER StartingOffset OPTIONAL,
+ IN PKEVENT Event,
+ OUT PIO_STATUS_BLOCK IoStatusBlock);
+
+NTOSAPI
+NTSTATUS
+DDKFASTAPI
+IofCallDriver(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN OUT PIRP Irp);
+
+/*
+ * NTSTATUS
+ * IoCallDriver(
+ * IN PDEVICE_OBJECT DeviceObject,
+ * IN OUT PIRP Irp)
+ */
+#define IoCallDriver IofCallDriver
+
+NTOSAPI
+VOID
+DDKAPI
+IoCancelFileOpen(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PFILE_OBJECT FileObject);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+IoCancelIrp(
+ IN PIRP Irp);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoCheckShareAccess(
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG DesiredShareAccess,
+ IN OUT PFILE_OBJECT FileObject,
+ IN OUT PSHARE_ACCESS ShareAccess,
+ IN BOOLEAN Update);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+IofCompleteRequest(
+ IN PIRP Irp,
+ IN CCHAR PriorityBoost);
+
+/*
+ * VOID
+ * IoCompleteRequest(
+ * IN PIRP Irp,
+ * IN CCHAR PriorityBoost)
+ */
+#define IoCompleteRequest IofCompleteRequest
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoConnectInterrupt(
+ OUT PKINTERRUPT *InterruptObject,
+ IN PKSERVICE_ROUTINE ServiceRoutine,
+ IN PVOID ServiceContext,
+ IN PKSPIN_LOCK SpinLock OPTIONAL,
+ IN ULONG Vector,
+ IN KIRQL Irql,
+ IN KIRQL SynchronizeIrql,
+ IN KINTERRUPT_MODE InterruptMode,
+ IN BOOLEAN ShareVector,
+ IN KAFFINITY ProcessorEnableMask,
+ IN BOOLEAN FloatingSave);
+
+/*
+ * PIO_STACK_LOCATION
+ * IoGetCurrentIrpStackLocation(
+ * IN PIRP Irp)
+ */
+#define IoGetCurrentIrpStackLocation(_Irp) \
+ ((_Irp)->Tail.Overlay.CurrentStackLocation)
+
+/*
+ * PIO_STACK_LOCATION
+ * IoGetNextIrpStackLocation(
+ * IN PIRP Irp)
+ */
+#define IoGetNextIrpStackLocation(_Irp) \
+ ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
+
+/*
+ * VOID
+ * IoCopyCurrentIrpStackLocationToNext(
+ * IN PIRP Irp)
+ */
+#define IoCopyCurrentIrpStackLocationToNext(_Irp) \
+{ \
+ PIO_STACK_LOCATION _IrpSp; \
+ PIO_STACK_LOCATION _NextIrpSp; \
+ _IrpSp = IoGetCurrentIrpStackLocation(_Irp); \
+ _NextIrpSp = IoGetNextIrpStackLocation(_Irp); \
+ RtlCopyMemory(_NextIrpSp, _IrpSp, \
+ FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
+ _NextIrpSp->Control = 0; \
+}
+
+NTOSAPI
+PCONTROLLER_OBJECT
+DDKAPI
+IoCreateController(
+ IN ULONG Size);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoCreateDevice(
+ IN PDRIVER_OBJECT DriverObject,
+ IN ULONG DeviceExtensionSize,
+ IN PUNICODE_STRING DeviceName OPTIONAL,
+ IN DEVICE_TYPE DeviceType,
+ IN ULONG DeviceCharacteristics,
+ IN BOOLEAN Exclusive,
+ OUT PDEVICE_OBJECT *DeviceObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoCreateDisk(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PCREATE_DISK Disk);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoCreateFile(
+ OUT PHANDLE FileHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PLARGE_INTEGER AllocationSize OPTIONAL,
+ IN ULONG FileAttributes,
+ IN ULONG ShareAccess,
+ IN ULONG Disposition,
+ IN ULONG CreateOptions,
+ IN PVOID EaBuffer OPTIONAL,
+ IN ULONG EaLength,
+ IN CREATE_FILE_TYPE CreateFileType,
+ IN PVOID ExtraCreateParameters OPTIONAL,
+ IN ULONG Options);
+
+NTOSAPI
+PKEVENT
+DDKAPI
+IoCreateNotificationEvent(
+ IN PUNICODE_STRING EventName,
+ OUT PHANDLE EventHandle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoCreateSymbolicLink(
+ IN PUNICODE_STRING SymbolicLinkName,
+ IN PUNICODE_STRING DeviceName);
+
+NTOSAPI
+PKEVENT
+DDKAPI
+IoCreateSynchronizationEvent(
+ IN PUNICODE_STRING EventName,
+ OUT PHANDLE EventHandle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoCreateUnprotectedSymbolicLink(
+ IN PUNICODE_STRING SymbolicLinkName,
+ IN PUNICODE_STRING DeviceName);
+
+NTOSAPI
+VOID
+DDKAPI
+IoCsqInitialize(
+ PIO_CSQ Csq,
+ IN PIO_CSQ_INSERT_IRP CsqInsertIrp,
+ IN PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
+ IN PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
+ IN PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
+ IN PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
+ IN PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp);
+
+NTOSAPI
+VOID
+DDKAPI
+IoCsqInsertIrp(
+ IN PIO_CSQ Csq,
+ IN PIRP Irp,
+ IN PIO_CSQ_IRP_CONTEXT Context);
+
+NTOSAPI
+PIRP
+DDKAPI
+IoCsqRemoveIrp(
+ IN PIO_CSQ Csq,
+ IN PIO_CSQ_IRP_CONTEXT Context);
+
+NTOSAPI
+PIRP
+DDKAPI
+IoCsqRemoveNextIrp(
+ IN PIO_CSQ Csq,
+ IN PVOID PeekContext);
+
+NTOSAPI
+VOID
+DDKAPI
+IoDeleteController(
+ IN PCONTROLLER_OBJECT ControllerObject);
+
+NTOSAPI
+VOID
+DDKAPI
+IoDeleteDevice(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoDeleteSymbolicLink(
+ IN PUNICODE_STRING SymbolicLinkName);
+
+/*
+ * VOID
+ * IoDeassignArcName(
+ * IN PUNICODE_STRING ArcName)
+ */
+#define IoDeassignArcName IoDeleteSymbolicLink
+
+NTOSAPI
+VOID
+DDKAPI
+IoDetachDevice(
+ IN OUT PDEVICE_OBJECT TargetDevice);
+
+NTOSAPI
+VOID
+DDKAPI
+IoDisconnectInterrupt(
+ IN PKINTERRUPT InterruptObject);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+IoForwardIrpSynchronously(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
+
+#define IoForwardAndCatchIrp IoForwardIrpSynchronously
+
+NTOSAPI
+VOID
+DDKAPI
+IoFreeController(
+ IN PCONTROLLER_OBJECT ControllerObject);
+
+NTOSAPI
+VOID
+DDKAPI
+IoFreeErrorLogEntry(
+ PVOID ElEntry);
+
+NTOSAPI
+VOID
+DDKAPI
+IoFreeIrp(
+ IN PIRP Irp);
+
+NTOSAPI
+VOID
+DDKAPI
+IoFreeMdl(
+ IN PMDL Mdl);
+
+NTOSAPI
+VOID
+DDKAPI
+IoFreeWorkItem(
+ IN PIO_WORKITEM pIOWorkItem);
+
+NTOSAPI
+PDEVICE_OBJECT
+DDKAPI
+IoGetAttachedDevice(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+PDEVICE_OBJECT
+DDKAPI
+IoGetAttachedDeviceReference(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoGetBootDiskInformation(
+ IN OUT PBOOTDISK_INFORMATION BootDiskInformation,
+ IN ULONG Size);
+
+NTOSAPI
+PCONFIGURATION_INFORMATION
+DDKAPI
+IoGetConfigurationInformation(
+ VOID);
+
+NTOSAPI
+PEPROCESS
+DDKAPI
+IoGetCurrentProcess(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoGetDeviceInterfaceAlias(
+ IN PUNICODE_STRING SymbolicLinkName,
+ IN CONST GUID *AliasInterfaceClassGuid,
+ OUT PUNICODE_STRING AliasSymbolicLinkName);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoGetDeviceInterfaces(
+ IN CONST GUID *InterfaceClassGuid,
+ IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
+ IN ULONG Flags,
+ OUT PWSTR *SymbolicLinkList);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoGetDeviceObjectPointer(
+ IN PUNICODE_STRING ObjectName,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PFILE_OBJECT *FileObject,
+ OUT PDEVICE_OBJECT *DeviceObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoGetDeviceProperty(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
+ IN ULONG BufferLength,
+ OUT PVOID PropertyBuffer,
+ OUT PULONG ResultLength);
+
+NTOSAPI
+PDEVICE_OBJECT
+DDKAPI
+IoGetDeviceToVerify(
+ IN PETHREAD Thread);
+
+NTOSAPI
+PDMA_ADAPTER
+DDKAPI
+IoGetDmaAdapter(
+ IN PDEVICE_OBJECT PhysicalDeviceObject,
+ IN PDEVICE_DESCRIPTION DeviceDescription,
+ IN OUT PULONG NumberOfMapRegisters);
+
+NTOSAPI
+PVOID
+DDKAPI
+IoGetDriverObjectExtension(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PVOID ClientIdentificationAddress);
+
+NTOSAPI
+PGENERIC_MAPPING
+DDKAPI
+IoGetFileObjectGenericMapping(
+ VOID);
+
+/*
+ * ULONG
+ * IoGetFunctionCodeFromCtlCode(
+ * IN ULONG ControlCode)
+ */
+#define IoGetFunctionCodeFromCtlCode(_ControlCode) \
+ (((_ControlCode) >> 2) & 0x00000FFF);
+
+NTOSAPI
+PVOID
+DDKAPI
+IoGetInitialStack(
+ VOID);
+
+NTOSAPI
+PDEVICE_OBJECT
+DDKAPI
+IoGetRelatedDeviceObject(
+ IN PFILE_OBJECT FileObject);
+
+NTOSAPI
+ULONG
+DDKAPI
+IoGetRemainingStackSize(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+IoGetStackLimits(
+ OUT PULONG_PTR LowLimit,
+ OUT PULONG_PTR HighLimit);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeDpc(
+ IN PRKDPC Dpc,
+ IN PKDEFERRED_ROUTINE DeferredRoutine,
+ IN PVOID DeferredContext);
+
+/*
+ * VOID
+ * IoInitializeDpcRequest(
+ * IN PDEVICE_OBJECT DeviceObject,
+ * IN PIO_DPC_ROUTINE DpcRoutine)
+ */
+#define IoInitializeDpcRequest(_DeviceObject, \
+ _DpcRoutine) \
+ KeInitializeDpc(&(_DeviceObject)->Dpc, \
+ (PKDEFERRED_ROUTINE) (_DpcRoutine), \
+ _DeviceObject);
+
+NTOSAPI
+VOID
+DDKAPI
+IoInitializeIrp(
+ IN OUT PIRP Irp,
+ IN USHORT PacketSize,
+ IN CCHAR StackSize);
+
+NTOSAPI
+VOID
+DDKAPI
+IoInitializeRemoveLockEx(
+ IN PIO_REMOVE_LOCK Lock,
+ IN ULONG AllocateTag,
+ IN ULONG MaxLockedMinutes,
+ IN ULONG HighWatermark,
+ IN ULONG RemlockSize);
+
+/* VOID
+ * IoInitializeRemoveLock(
+ * IN PIO_REMOVE_LOCK Lock,
+ * IN ULONG AllocateTag,
+ * IN ULONG MaxLockedMinutes,
+ * IN ULONG HighWatermark)
+ */
+#define IoInitializeRemoveLock( \
+ Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
+ IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
+ HighWatermark, sizeof(IO_REMOVE_LOCK));
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoInitializeTimer(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIO_TIMER_ROUTINE TimerRoutine,
+ IN PVOID Context);
+
+NTOSAPI
+VOID
+DDKAPI
+IoInvalidateDeviceRelations(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN DEVICE_RELATION_TYPE Type);
+
+NTOSAPI
+VOID
+DDKAPI
+IoInvalidateDeviceState(
+ IN PDEVICE_OBJECT PhysicalDeviceObject);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+IoIs32bitProcess(
+ IN PIRP Irp OPTIONAL);
+
+/*
+ * BOOLEAN
+ * IoIsErrorUserInduced(
+ * IN NTSTATUS Status);
+ */
+#define IoIsErrorUserInduced(Status) \
+ ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) || \
+ ((Status) == STATUS_IO_TIMEOUT) || \
+ ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \
+ ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \
+ ((Status) == STATUS_VERIFY_REQUIRED) || \
+ ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \
+ ((Status) == STATUS_WRONG_VOLUME)))
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+IoIsWdmVersionAvailable(
+ IN UCHAR MajorVersion,
+ IN UCHAR MinorVersion);
+
+NTOSAPI
+PIRP
+DDKAPI
+IoMakeAssociatedIrp(
+ IN PIRP Irp,
+ IN CCHAR StackSize);
+
+/*
+ * VOID
+ * IoMarkIrpPending(
+ * IN OUT PIRP Irp)
+ */
+#define IoMarkIrpPending(_Irp) \
+ (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoOpenDeviceInterfaceRegistryKey(
+ IN PUNICODE_STRING SymbolicLinkName,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PHANDLE DeviceInterfaceKey);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoOpenDeviceRegistryKey(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG DevInstKeyType,
+ IN ACCESS_MASK DesiredAccess,
+ OUT PHANDLE DevInstRegKey);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoQueryDeviceDescription(
+ IN PINTERFACE_TYPE BusType OPTIONAL,
+ IN PULONG BusNumber OPTIONAL,
+ IN PCONFIGURATION_TYPE ControllerType OPTIONAL,
+ IN PULONG ControllerNumber OPTIONAL,
+ IN PCONFIGURATION_TYPE PeripheralType OPTIONAL,
+ IN PULONG PeripheralNumber OPTIONAL,
+ IN PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
+ IN PVOID Context);
+
+NTOSAPI
+VOID
+DDKAPI
+IoQueueWorkItem(
+ IN PIO_WORKITEM pIOWorkItem,
+ IN PIO_WORKITEM_ROUTINE Routine,
+ IN WORK_QUEUE_TYPE QueueType,
+ IN PVOID Context);
+
+NTOSAPI
+VOID
+DDKAPI
+IoRaiseHardError(
+ IN PIRP Irp,
+ IN PVPB Vpb OPTIONAL,
+ IN PDEVICE_OBJECT RealDeviceObject);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+IoRaiseInformationalHardError(
+ IN NTSTATUS ErrorStatus,
+ IN PUNICODE_STRING String OPTIONAL,
+ IN PKTHREAD Thread OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReadDiskSignature(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG BytesPerSector,
+ OUT PDISK_SIGNATURE Signature);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReadPartitionTableEx(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer);
+
+NTOSAPI
+VOID
+DDKAPI
+IoRegisterBootDriverReinitialization(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
+ IN PVOID Context);
+
+NTOSAPI
+VOID
+DDKAPI
+IoRegisterBootDriverReinitialization(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
+ IN PVOID Context);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoRegisterDeviceInterface(
+ IN PDEVICE_OBJECT PhysicalDeviceObject,
+ IN CONST GUID *InterfaceClassGuid,
+ IN PUNICODE_STRING ReferenceString OPTIONAL,
+ OUT PUNICODE_STRING SymbolicLinkName);
+
+NTOSAPI
+VOID
+DDKAPI
+IoRegisterDriverReinitialization(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
+ IN PVOID Context);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoRegisterPlugPlayNotification(
+ IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
+ IN ULONG EventCategoryFlags,
+ IN PVOID EventCategoryData OPTIONAL,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
+ IN PVOID Context,
+ OUT PVOID *NotificationEntry);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoRegisterShutdownNotification(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+VOID
+DDKAPI
+IoReleaseCancelSpinLock(
+ IN KIRQL Irql);
+
+NTOSAPI
+VOID
+DDKAPI
+IoReleaseRemoveLockAndWaitEx(
+ IN PIO_REMOVE_LOCK RemoveLock,
+ IN PVOID Tag,
+ IN ULONG RemlockSize);
+
+NTOSAPI
+VOID
+DDKAPI
+IoReleaseRemoveLockEx(
+ IN PIO_REMOVE_LOCK RemoveLock,
+ IN PVOID Tag,
+ IN ULONG RemlockSize);
+
+/*
+ * VOID
+ * IoReleaseRemoveLockAndWait(
+ * IN PIO_REMOVE_LOCK RemoveLock,
+ * IN PVOID Tag)
+ */
+#define IoReleaseRemoveLockAndWait(_RemoveLock, \
+ _Tag) \
+ IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK));
+
+NTOSAPI
+VOID
+DDKAPI
+IoRemoveShareAccess(
+ IN PFILE_OBJECT FileObject,
+ IN OUT PSHARE_ACCESS ShareAccess);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReportDetectedDevice(
+ IN PDRIVER_OBJECT DriverObject,
+ IN INTERFACE_TYPE LegacyBusType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PCM_RESOURCE_LIST ResourceList,
+ IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
+ IN BOOLEAN ResourceAssigned,
+ IN OUT PDEVICE_OBJECT *DeviceObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReportResourceForDetection(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PCM_RESOURCE_LIST DriverList OPTIONAL,
+ IN ULONG DriverListSize OPTIONAL,
+ IN PDEVICE_OBJECT DeviceObject OPTIONAL,
+ IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
+ IN ULONG DeviceListSize OPTIONAL,
+ OUT PBOOLEAN ConflictDetected);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReportResourceUsage(
+ IN PUNICODE_STRING DriverClassName OPTIONAL,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PCM_RESOURCE_LIST DriverList OPTIONAL,
+ IN ULONG DriverListSize OPTIONAL,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
+ IN ULONG DeviceListSize OPTIONAL,
+ IN BOOLEAN OverrideConflict,
+ OUT PBOOLEAN ConflictDetected);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReportTargetDeviceChange(
+ IN PDEVICE_OBJECT PhysicalDeviceObject,
+ IN PVOID NotificationStructure);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoReportTargetDeviceChangeAsynchronous(
+ IN PDEVICE_OBJECT PhysicalDeviceObject,
+ IN PVOID NotificationStructure,
+ IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
+ IN PVOID Context OPTIONAL);
+
+NTOSAPI
+VOID
+DDKAPI
+IoRequestDeviceEject(
+ IN PDEVICE_OBJECT PhysicalDeviceObject);
+
+/*
+ * VOID
+ * IoRequestDpc(
+ * IN PDEVICE_OBJECT DeviceObject,
+ * IN PIRP Irp,
+ * IN PVOID Context);
+ */
+#define IoRequestDpc(DeviceObject, Irp, Context)( \
+ KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
+
+NTOSAPI
+VOID
+DDKAPI
+IoReuseIrp(
+ IN OUT PIRP Irp,
+ IN NTSTATUS Status);
+
+/*
+ * PDRIVER_CANCEL
+ * IoSetCancelRoutine(
+ * IN PIRP Irp,
+ * IN PDRIVER_CANCEL CancelRoutine)
+ */
+#define IoSetCancelRoutine(_Irp, \
+ _CancelRoutine) \
+ (PDRIVER_CANCEL) InterlockedExchangePointer( \
+ (PVOID *) &(_Irp)->CancelRoutine, (PVOID) (_CancelRoutine));
+
+/*
+ * VOID
+ * IoSetCompletionRoutine(
+ * IN PIRP Irp,
+ * IN PIO_COMPLETION_ROUTINE CompletionRoutine,
+ * IN PVOID Context,
+ * IN BOOLEAN InvokeOnSuccess,
+ * IN BOOLEAN InvokeOnError,
+ * IN BOOLEAN InvokeOnCancel)
+ */
+#define IoSetCompletionRoutine(_Irp, \
+ _CompletionRoutine, \
+ _Context, \
+ _InvokeOnSuccess, \
+ _InvokeOnError, \
+ _InvokeOnCancel) \
+{ \
+ PIO_STACK_LOCATION _IrpSp; \
+ assert(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
+ _CompletionRoutine != NULL : TRUE); \
+ _IrpSp = IoGetNextIrpStackLocation(_Irp); \
+ _IrpSp->CompletionRoutine = (_CompletionRoutine); \
+ _IrpSp->Context = (_Context); \
+ _IrpSp->Control = 0; \
+ if (_InvokeOnSuccess) _IrpSp->Control = SL_INVOKE_ON_SUCCESS; \
+ if (_InvokeOnError) _IrpSp->Control |= SL_INVOKE_ON_ERROR; \
+ if (_InvokeOnCancel) _IrpSp->Control |= SL_INVOKE_ON_CANCEL; \
+}
+
+NTOSAPI
+VOID
+DDKAPI
+IoSetCompletionRoutineEx(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PIO_COMPLETION_ROUTINE CompletionRoutine,
+ IN PVOID Context,
+ IN BOOLEAN InvokeOnSuccess,
+ IN BOOLEAN InvokeOnError,
+ IN BOOLEAN InvokeOnCancel);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoSetDeviceInterfaceState(
+ IN PUNICODE_STRING SymbolicLinkName,
+ IN BOOLEAN Enable);
+
+NTOSAPI
+VOID
+DDKAPI
+IoSetHardErrorOrVerifyDevice(
+ IN PIRP Irp,
+ IN PDEVICE_OBJECT DeviceObject);
+
+/*
+ * VOID
+ * IoSetNextIrpStackLocation(
+ * IN OUT PIRP Irp)
+ */
+#define IoSetNextIrpStackLocation(_Irp) \
+{ \
+ (_Irp)->CurrentLocation--; \
+ (_Irp)->Tail.Overlay.CurrentStackLocation--; \
+}
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoSetPartitionInformationEx(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG PartitionNumber,
+ IN struct _SET_PARTITION_INFORMATION_EX *PartitionInfo);
+
+NTOSAPI
+VOID
+DDKAPI
+IoSetShareAccess(
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG DesiredShareAccess,
+ IN OUT PFILE_OBJECT FileObject,
+ OUT PSHARE_ACCESS ShareAccess);
+
+NTOSAPI
+VOID
+DDKAPI
+IoSetStartIoAttributes(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN DeferredStartIo,
+ IN BOOLEAN NonCancelable);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoSetSystemPartition(
+ IN PUNICODE_STRING VolumeNameString);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+IoSetThreadHardErrorMode(
+ IN BOOLEAN EnableHardErrors);
+
+/*
+ * USHORT
+ * IoSizeOfIrp(
+ * IN CCHAR StackSize)
+ */
+#define IoSizeOfIrp(_StackSize) \
+ ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
+
+/*
+ * VOID
+ * IoSkipCurrentIrpStackLocation(
+ * IN PIRP Irp)
+ */
+#define IoSkipCurrentIrpStackLocation(_Irp) \
+{ \
+ (_Irp)->CurrentLocation++; \
+ (_Irp)->Tail.Overlay.CurrentStackLocation++; \
+}
+
+NTOSAPI
+VOID
+DDKAPI
+IoStartNextPacket(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN Cancelable);
+
+NTOSAPI
+VOID
+DDKAPI
+IoStartNextPacketByKey(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN Cancelable,
+ IN ULONG Key);
+
+NTOSAPI
+VOID
+DDKAPI
+IoStartPacket(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PULONG Key OPTIONAL,
+ IN PDRIVER_CANCEL CancelFunction OPTIONAL);
+
+NTOSAPI
+VOID
+DDKAPI
+IoStartTimer(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+VOID
+DDKAPI
+IoStopTimer(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoUnregisterPlugPlayNotification(
+ IN PVOID NotificationEntry);
+
+NTOSAPI
+VOID
+DDKAPI
+IoUnregisterShutdownNotification(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+VOID
+DDKAPI
+IoUpdateShareAccess(
+ IN PFILE_OBJECT FileObject,
+ IN OUT PSHARE_ACCESS ShareAccess);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoVerifyPartitionTable(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN BOOLEAN FixErrors);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoVolumeDeviceToDosName(
+ IN PVOID VolumeDeviceObject,
+ OUT PUNICODE_STRING DosName);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIAllocateInstanceIds(
+ IN GUID *Guid,
+ IN ULONG InstanceCount,
+ OUT ULONG *FirstInstanceId);
+
+NTOSAPI
+ULONG
+DDKAPI
+IoWMIDeviceObjectToProviderId(
+ IN PDEVICE_OBJECT DeviceObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIDeviceObjectToInstanceName(
+ IN PVOID DataBlockObject,
+ IN PDEVICE_OBJECT DeviceObject,
+ OUT PUNICODE_STRING InstanceName);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIExecuteMethod(
+ IN PVOID DataBlockObject,
+ IN PUNICODE_STRING InstanceName,
+ IN ULONG MethodId,
+ IN ULONG InBufferSize,
+ IN OUT PULONG OutBufferSize,
+ IN OUT PUCHAR InOutBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIHandleToInstanceName(
+ IN PVOID DataBlockObject,
+ IN HANDLE FileHandle,
+ OUT PUNICODE_STRING InstanceName);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIOpenBlock(
+ IN GUID *DataBlockGuid,
+ IN ULONG DesiredAccess,
+ OUT PVOID *DataBlockObject);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIQueryAllData(
+ IN PVOID DataBlockObject,
+ IN OUT ULONG *InOutBufferSize,
+ OUT PVOID OutBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIQueryAllDataMultiple(
+ IN PVOID *DataBlockObjectList,
+ IN ULONG ObjectCount,
+ IN OUT ULONG *InOutBufferSize,
+ OUT PVOID OutBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIQuerySingleInstance(
+ IN PVOID DataBlockObject,
+ IN PUNICODE_STRING InstanceName,
+ IN OUT ULONG *InOutBufferSize,
+ OUT PVOID OutBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIQuerySingleInstanceMultiple(
+ IN PVOID *DataBlockObjectList,
+ IN PUNICODE_STRING InstanceNames,
+ IN ULONG ObjectCount,
+ IN OUT ULONG *InOutBufferSize,
+ OUT PVOID OutBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIRegistrationControl(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG Action);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMISetNotificationCallback(
+ IN PVOID Object,
+ IN WMI_NOTIFICATION_CALLBACK Callback,
+ IN PVOID Context);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMISetSingleInstance(
+ IN PVOID DataBlockObject,
+ IN PUNICODE_STRING InstanceName,
+ IN ULONG Version,
+ IN ULONG ValueBufferSize,
+ IN PVOID ValueBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMISetSingleItem(
+ IN PVOID DataBlockObject,
+ IN PUNICODE_STRING InstanceName,
+ IN ULONG DataItemId,
+ IN ULONG Version,
+ IN ULONG ValueBufferSize,
+ IN PVOID ValueBuffer);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMISuggestInstanceName(
+ IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
+ IN PUNICODE_STRING SymbolicLinkName OPTIONAL,
+ IN BOOLEAN CombineNames,
+ OUT PUNICODE_STRING SuggestedInstanceName);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWMIWriteEvent(
+ IN PVOID WnodeEventItem);
+
+NTOSAPI
+VOID
+DDKAPI
+IoWriteErrorLogEntry(
+ IN PVOID ElEntry);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoWritePartitionTableEx(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN struct _DRIVE_LAYOUT_INFORMATION_EX *PartitionBuffer);
+
+
+
+/** Kernel routines **/
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KeAcquireInStackQueuedSpinLock(
+ IN PKSPIN_LOCK SpinLock,
+ IN PKLOCK_QUEUE_HANDLE LockHandle);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KeAcquireInStackQueuedSpinLockAtDpcLevel(
+ IN PKSPIN_LOCK SpinLock,
+ IN PKLOCK_QUEUE_HANDLE LockHandle);
+
+NTOSAPI
+KIRQL
+DDKAPI
+KeAcquireInterruptSpinLock(
+ IN PKINTERRUPT Interrupt);
+
+NTOSAPI
+VOID
+DDKAPI
+KeAcquireSpinLock(
+ IN PKSPIN_LOCK SpinLock,
+ OUT PKIRQL OldIrql);
+
+/* System Service Dispatch Table */
+typedef struct _SSDT {
+ ULONG SysCallPtr;
+} SSDT, *PSSDT;
+
+/* System Service Parameters Table */
+typedef struct _SSPT {
+ ULONG ParamBytes;
+} SSPT, *PSSPT;
+
+typedef struct _SSDT_ENTRY {
+ PSSDT SSDT;
+ PULONG ServiceCounterTable;
+ ULONG NumberOfServices;
+ PSSPT SSPT;
+} SSDT_ENTRY, *PSSDT_ENTRY;
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeAddSystemServiceTable(
+ IN PSSDT SSDT,
+ IN PULONG ServiceCounterTable,
+ IN ULONG NumberOfServices,
+ IN PSSPT SSPT,
+ IN ULONG TableIndex);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeAreApcsDisabled(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+KeAttachProcess(
+ IN PEPROCESS Process);
+
+NTOSAPI
+VOID
+DDKAPI
+KeBugCheck(
+ IN ULONG BugCheckCode);
+
+NTOSAPI
+VOID
+DDKAPI
+KeBugCheckEx(
+ IN ULONG BugCheckCode,
+ IN ULONG_PTR BugCheckParameter1,
+ IN ULONG_PTR BugCheckParameter2,
+ IN ULONG_PTR BugCheckParameter3,
+ IN ULONG_PTR BugCheckParameter4);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeCancelTimer(
+ IN PKTIMER Timer);
+
+NTOSAPI
+VOID
+DDKAPI
+KeClearEvent(
+ IN PRKEVENT Event);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+KeDelayExecutionThread(
+ IN KPROCESSOR_MODE WaitMode,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Interval);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeDeregisterBugCheckCallback(
+ IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
+
+NTOSAPI
+VOID
+DDKAPI
+KeDetachProcess(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+KeEnterCriticalRegion(
+ VOID);
+
+/*
+ * VOID
+ * KeFlushIoBuffers(
+ * IN PMDL Mdl,
+ * IN BOOLEAN ReadOperation,
+ * IN BOOLEAN DmaOperation)
+ */
+#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
+
+NTOSAPI
+PRKTHREAD
+DDKAPI
+KeGetCurrentThread(
+ VOID);
+
+NTOSAPI
+KPROCESSOR_MODE
+DDKAPI
+KeGetPreviousMode(
+ VOID);
+
+NTOSAPI
+ULONG
+DDKAPI
+KeGetRecommendedSharedDataAlignment(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeApc(
+ IN PKAPC Apc,
+ IN PKTHREAD Thread,
+ IN UCHAR StateIndex,
+ IN PKKERNEL_ROUTINE KernelRoutine,
+ IN PKRUNDOWN_ROUTINE RundownRoutine,
+ IN PKNORMAL_ROUTINE NormalRoutine,
+ IN UCHAR Mode,
+ IN PVOID Context);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeDeviceQueue(
+ IN PKDEVICE_QUEUE DeviceQueue);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeMutex(
+ IN PRKMUTEX Mutex,
+ IN ULONG Level);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeSemaphore(
+ IN PRKSEMAPHORE Semaphore,
+ IN LONG Count,
+ IN LONG Limit);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeSpinLock(
+ IN PKSPIN_LOCK SpinLock);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeTimer(
+ IN PKTIMER Timer);
+
+NTOSAPI
+VOID
+DDKAPI
+KeInitializeTimerEx(
+ IN PKTIMER Timer,
+ IN TIMER_TYPE Type);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeInsertByKeyDeviceQueue(
+ IN PKDEVICE_QUEUE DeviceQueue,
+ IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry,
+ IN ULONG SortKey);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeInsertDeviceQueue(
+ IN PKDEVICE_QUEUE DeviceQueue,
+ IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeInsertQueueDpc(
+ IN PRKDPC Dpc,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2);
+
+NTOSAPI
+VOID
+DDKAPI
+KeLeaveCriticalRegion(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+KeLowerIrql(
+ IN KIRQL NewIrql);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+KePulseEvent(
+ IN PRKEVENT Event,
+ IN KPRIORITY Increment,
+ IN BOOLEAN Wait);
+
+NTOSAPI
+ULONGLONG
+DDKAPI
+KeQueryInterruptTime(
+ VOID);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+KeQueryPerformanceCounter(
+ OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL);
+
+NTOSAPI
+KPRIORITY
+DDKAPI
+KeQueryPriorityThread(
+ IN PRKTHREAD Thread);
+
+NTOSAPI
+VOID
+DDKAPI
+KeQuerySystemTime(
+ OUT PLARGE_INTEGER CurrentTime);
+
+NTOSAPI
+VOID
+DDKAPI
+KeQueryTickCount(
+ OUT PLARGE_INTEGER TickCount);
+
+NTOSAPI
+ULONG
+DDKAPI
+KeQueryTimeIncrement(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+KeRaiseIrql(
+ IN KIRQL NewIrql,
+ OUT PKIRQL OldIrql);
+
+NTOSAPI
+KIRQL
+DDKAPI
+KeRaiseIrqlToDpcLevel(
+ VOID);
+
+NTOSAPI
+LONG
+DDKAPI
+KeReadStateEvent(
+ IN PRKEVENT Event);
+
+NTOSAPI
+LONG
+DDKAPI
+KeReadStateMutex(
+ IN PRKMUTEX Mutex);
+
+NTOSAPI
+LONG
+DDKAPI
+KeReadStateSemaphore(
+ IN PRKSEMAPHORE Semaphore);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeReadStateTimer(
+ IN PKTIMER Timer);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeRegisterBugCheckCallback(
+ IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
+ IN PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
+ IN PVOID Buffer,
+ IN ULONG Length,
+ IN PUCHAR Component);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KeReleaseInStackQueuedSpinLock(
+ IN PKLOCK_QUEUE_HANDLE LockHandle);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KeReleaseInStackQueuedSpinLockFromDpcLevel(
+ IN PKLOCK_QUEUE_HANDLE LockHandle);
+
+NTOSAPI
+VOID
+DDKAPI
+KeReleaseInterruptSpinLock(
+ IN PKINTERRUPT Interrupt,
+ IN KIRQL OldIrql);
+
+NTOSAPI
+LONG
+DDKAPI
+KeReleaseMutex(
+ IN PRKMUTEX Mutex,
+ IN BOOLEAN Wait);
+
+NTOSAPI
+LONG
+DDKAPI
+KeReleaseSemaphore(
+ IN PRKSEMAPHORE Semaphore,
+ IN KPRIORITY Increment,
+ IN LONG Adjustment,
+ IN BOOLEAN Wait);
+
+NTOSAPI
+VOID
+DDKAPI
+KeReleaseSpinLock(
+ IN PKSPIN_LOCK SpinLock,
+ IN KIRQL NewIrql);
+
+NTOSAPI
+PKDEVICE_QUEUE_ENTRY
+DDKAPI
+KeRemoveByKeyDeviceQueue(
+ IN PKDEVICE_QUEUE DeviceQueue,
+ IN ULONG SortKey);
+
+NTOSAPI
+PKDEVICE_QUEUE_ENTRY
+DDKAPI
+KeRemoveDeviceQueue(
+ IN PKDEVICE_QUEUE DeviceQueue);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeRemoveEntryDeviceQueue(
+ IN PKDEVICE_QUEUE DeviceQueue,
+ IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeRemoveQueueDpc(
+ IN PRKDPC Dpc);
+
+NTOSAPI
+LONG
+DDKAPI
+KeResetEvent(
+ IN PRKEVENT Event);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+KeRestoreFloatingPointState(
+ IN PKFLOATING_SAVE FloatSave);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+KeSaveFloatingPointState(
+ OUT PKFLOATING_SAVE FloatSave);
+
+NTOSAPI
+LONG
+DDKAPI
+KeSetBasePriorityThread(
+ IN PRKTHREAD Thread,
+ IN LONG Increment);
+
+NTOSAPI
+LONG
+DDKAPI
+KeSetEvent(
+ IN PRKEVENT Event,
+ IN KPRIORITY Increment,
+ IN BOOLEAN Wait);
+
+NTOSAPI
+VOID
+DDKAPI
+KeSetImportanceDpc(
+ IN PRKDPC Dpc,
+ IN KDPC_IMPORTANCE Importance);
+
+NTOSAPI
+KPRIORITY
+DDKAPI
+KeSetPriorityThread(
+ IN PKTHREAD Thread,
+ IN KPRIORITY Priority);
+
+NTOSAPI
+VOID
+DDKAPI
+KeSetTargetProcessorDpc(
+ IN PRKDPC Dpc,
+ IN CCHAR Number);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeSetTimer(
+ IN PKTIMER Timer,
+ IN LARGE_INTEGER DueTime,
+ IN PKDPC Dpc OPTIONAL);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeSetTimerEx(
+ IN PKTIMER Timer,
+ IN LARGE_INTEGER DueTime,
+ IN LONG Period OPTIONAL,
+ IN PKDPC Dpc OPTIONAL);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KeSetTimeUpdateNotifyRoutine(
+ IN PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine);
+
+NTOSAPI
+VOID
+DDKAPI
+KeStallExecutionProcessor(
+ IN ULONG MicroSeconds);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+KeSynchronizeExecution(
+ IN PKINTERRUPT Interrupt,
+ IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
+ IN PVOID SynchronizeContext);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+KeWaitForMultipleObjects(
+ IN ULONG Count,
+ IN PVOID Object[],
+ IN WAIT_TYPE WaitType,
+ IN KWAIT_REASON WaitReason,
+ IN KPROCESSOR_MODE WaitMode,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Timeout OPTIONAL,
+ IN PKWAIT_BLOCK WaitBlockArray OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+KeWaitForMutexObject(
+ IN PRKMUTEX Mutex,
+ IN KWAIT_REASON WaitReason,
+ IN KPROCESSOR_MODE WaitMode,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Timeout OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+KeWaitForSingleObject(
+ IN PVOID Object,
+ IN KWAIT_REASON WaitReason,
+ IN KPROCESSOR_MODE WaitMode,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Timeout OPTIONAL);
+
+
+
+/** Memory manager routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmAdvanceMdl(
+ IN PMDL Mdl,
+ IN ULONG NumberOfBytes);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmAllocateContiguousMemory(
+ IN ULONG NumberOfBytes,
+ IN PHYSICAL_ADDRESS HighestAcceptableAddress);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmAllocateContiguousMemorySpecifyCache(
+ IN SIZE_T NumberOfBytes,
+ IN PHYSICAL_ADDRESS LowestAcceptableAddress,
+ IN PHYSICAL_ADDRESS HighestAcceptableAddress,
+ IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
+ IN MEMORY_CACHING_TYPE CacheType);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmAllocateMappingAddress(
+ IN SIZE_T NumberOfBytes,
+ IN ULONG PoolTag);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmAllocateNonCachedMemory(
+ IN ULONG NumberOfBytes);
+
+NTOSAPI
+PMDL
+DDKAPI
+MmAllocatePagesForMdl(
+ IN PHYSICAL_ADDRESS LowAddress,
+ IN PHYSICAL_ADDRESS HighAddress,
+ IN PHYSICAL_ADDRESS SkipBytes,
+ IN SIZE_T TotalBytes);
+
+NTOSAPI
+VOID
+DDKAPI
+MmBuildMdlForNonPagedPool(
+ IN OUT PMDL MemoryDescriptorList);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmCreateSection(
+ OUT PSECTION_OBJECT *SectionObject,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN PLARGE_INTEGER MaximumSize,
+ IN ULONG SectionPageProtection,
+ IN ULONG AllocationAttributes,
+ IN HANDLE FileHandle OPTIONAL,
+ IN PFILE_OBJECT File OPTIONAL);
+
+typedef enum _MMFLUSH_TYPE {
+ MmFlushForDelete,
+ MmFlushForWrite
+} MMFLUSH_TYPE;
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+MmFlushImageSection(
+ IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
+ IN MMFLUSH_TYPE FlushType);
+
+NTOSAPI
+VOID
+DDKAPI
+MmFreeContiguousMemory(
+ IN PVOID BaseAddress);
+
+NTOSAPI
+VOID
+DDKAPI
+MmFreeContiguousMemorySpecifyCache(
+ IN PVOID BaseAddress,
+ IN SIZE_T NumberOfBytes,
+ IN MEMORY_CACHING_TYPE CacheType);
+
+NTOSAPI
+VOID
+DDKAPI
+MmFreeMappingAddress(
+ IN PVOID BaseAddress,
+ IN ULONG PoolTag);
+
+NTOSAPI
+VOID
+DDKAPI
+MmFreeNonCachedMemory(
+ IN PVOID BaseAddress,
+ IN SIZE_T NumberOfBytes);
+
+NTOSAPI
+VOID
+DDKAPI
+MmFreePagesFromMdl(
+ IN PMDL MemoryDescriptorList);
+
+/*
+ * ULONG
+ * MmGetMdlByteCount(
+ * IN PMDL Mdl)
+ */
+#define MmGetMdlByteCount(_Mdl) \
+ ((_Mdl)->ByteCount)
+
+/*
+ * ULONG
+ * MmGetMdlByteOffset(
+ * IN PMDL Mdl)
+ */
+#define MmGetMdlByteOffset(_Mdl) \
+ ((_Mdl)->ByteOffset)
+
+/*
+ * PPFN_NUMBER
+ * MmGetMdlPfnArray(
+ * IN PMDL Mdl)
+ */
+#define MmGetMdlPfnArray(_Mdl) \
+ ((PPFN_NUMBER) ((_Mdl) + 1))
+
+/*
+ * PVOID
+ * MmGetMdlVirtualAddress(
+ * IN PMDL Mdl)
+ */
+#define MmGetMdlVirtualAddress(_Mdl) \
+ ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
+
+NTOSAPI
+PHYSICAL_ADDRESS
+DDKAPI
+MmGetPhysicalAddress(
+ IN PVOID BaseAddress);
+
+NTOSAPI
+PPHYSICAL_MEMORY_RANGE
+DDKAPI
+MmGetPhysicalMemoryRanges(
+ VOID);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmGetVirtualForPhysical(
+ IN PHYSICAL_ADDRESS PhysicalAddress);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmMapLockedPagesSpecifyCache(
+ IN PMDL MemoryDescriptorList,
+ IN KPROCESSOR_MODE AccessMode,
+ IN MEMORY_CACHING_TYPE CacheType,
+ IN PVOID BaseAddress,
+ IN ULONG BugCheckOnFailure,
+ IN MM_PAGE_PRIORITY Priority);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmMapLockedPagesWithReservedMapping(
+ IN PVOID MappingAddress,
+ IN ULONG PoolTag,
+ IN PMDL MemoryDescriptorList,
+ IN MEMORY_CACHING_TYPE CacheType);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmMapUserAddressesToPage(
+ IN PVOID BaseAddress,
+ IN SIZE_T NumberOfBytes,
+ IN PVOID PageAddress);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmMapVideoDisplay(
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN SIZE_T NumberOfBytes,
+ IN MEMORY_CACHING_TYPE CacheType);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmMapViewInSessionSpace(
+ IN PVOID Section,
+ OUT PVOID *MappedBase,
+ IN OUT PSIZE_T ViewSize);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmMapViewInSystemSpace(
+ IN PVOID Section,
+ OUT PVOID *MappedBase,
+ IN PSIZE_T ViewSize);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmMarkPhysicalMemoryAsBad(
+ IN PPHYSICAL_ADDRESS StartAddress,
+ IN OUT PLARGE_INTEGER NumberOfBytes);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmMarkPhysicalMemoryAsGood(
+ IN PPHYSICAL_ADDRESS StartAddress,
+ IN OUT PLARGE_INTEGER NumberOfBytes);
+
+/*
+ * PVOID
+ * MmGetSystemAddressForMdlSafe(
+ * IN PMDL Mdl,
+ * IN MM_PAGE_PRIORITY Priority)
+ */
+#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
+ ((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
+ | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
+ (_Mdl)->MappedSystemVa : \
+ (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
+ KernelMode, MmCached, NULL, FALSE, _Priority);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmGetSystemRoutineAddress(
+ IN PUNICODE_STRING SystemRoutineName);
+
+/*
+ * ULONG
+ * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
+ * IN PVOID Va,
+ * IN ULONG Size)
+ */
+#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, \
+ _Size) \
+ (ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
+ + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)
+
+/*
+ * VOID
+ * MmInitializeMdl(
+ * IN PMDL MemoryDescriptorList,
+ * IN PVOID BaseVa,
+ * IN SIZE_T Length)
+ */
+#define MmInitializeMdl(_MemoryDescriptorList, \
+ _BaseVa, \
+ _Length) \
+{ \
+ (_MemoryDescriptorList)->Next = (PMDL) NULL; \
+ (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
+ (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
+ (_MemoryDescriptorList)->MdlFlags = 0; \
+ (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
+ (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
+ (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
+}
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+MmIsAddressValid(
+ IN PVOID VirtualAddress);
+
+NTOSAPI
+LOGICAL
+DDKAPI
+MmIsDriverVerifying(
+ IN PDRIVER_OBJECT DriverObject);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+MmIsThisAnNtAsSystem(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmIsVerifierEnabled(
+ OUT PULONG VerifierFlags);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmLockPagableDataSection(
+ IN PVOID AddressWithinSection);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmLockPagableImageSection(
+ IN PVOID AddressWithinSection);
+
+/*
+ * PVOID
+ * MmLockPagableCodeSection(
+ * IN PVOID AddressWithinSection)
+ */
+#define MmLockPagableCodeSection MmLockPagableDataSection
+
+NTOSAPI
+VOID
+DDKAPI
+MmLockPagableSectionByHandle(
+ IN PVOID ImageSectionHandle);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmMapIoSpace(
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN ULONG NumberOfBytes,
+ IN MEMORY_CACHING_TYPE CacheEnable);
+
+NTOSAPI
+PVOID
+DDKAPI
+MmMapLockedPages(
+ IN PMDL MemoryDescriptorList,
+ IN KPROCESSOR_MODE AccessMode);
+
+NTOSAPI
+VOID
+DDKAPI
+MmPageEntireDriver(
+ IN PVOID AddressWithinSection);
+
+NTOSAPI
+VOID
+DDKAPI
+MmProbeAndLockProcessPages(
+ IN OUT PMDL MemoryDescriptorList,
+ IN PEPROCESS Process,
+ IN KPROCESSOR_MODE AccessMode,
+ IN LOCK_OPERATION Operation);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmProtectMdlSystemAddress(
+ IN PMDL MemoryDescriptorList,
+ IN ULONG NewProtect);
+
+NTOSAPI
+VOID
+DDKAPI
+MmUnmapLockedPages(
+ IN PVOID BaseAddress,
+ IN PMDL MemoryDescriptorList);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmUnmapViewInSessionSpace(
+ IN PVOID MappedBase);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmUnmapViewInSystemSpace(
+ IN PVOID MappedBase);
+
+NTOSAPI
+VOID
+DDKAPI
+MmUnsecureVirtualMemory(
+ IN HANDLE SecureHandle);
+
+/*
+ * VOID
+ * MmPrepareMdlForReuse(
+ * IN PMDL Mdl)
+ */
+#define MmPrepareMdlForReuse(_Mdl) \
+{ \
+ if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
+ assert(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
+ MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
+ } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
+ assert(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
+ } \
+}
+
+NTOSAPI
+VOID
+DDKAPI
+MmProbeAndLockPages(
+ IN OUT PMDL MemoryDescriptorList,
+ IN KPROCESSOR_MODE AccessMode,
+ IN LOCK_OPERATION Operation);
+
+NTOSAPI
+MM_SYSTEM_SIZE
+DDKAPI
+MmQuerySystemSize(
+ VOID);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+MmRemovePhysicalMemory(
+ IN PPHYSICAL_ADDRESS StartAddress,
+ IN OUT PLARGE_INTEGER NumberOfBytes);
+
+NTOSAPI
+VOID
+DDKAPI
+MmResetDriverPaging(
+ IN PVOID AddressWithinSection);
+
+NTOSAPI
+HANDLE
+DDKAPI
+MmSecureVirtualMemory(
+ IN PVOID Address,
+ IN SIZE_T Size,
+ IN ULONG ProbeMode);
+
+NTOSAPI
+ULONG
+DDKAPI
+MmSizeOfMdl(
+ IN PVOID Base,
+ IN SIZE_T Length);
+
+NTOSAPI
+VOID
+DDKAPI
+MmUnlockPagableImageSection(
+ IN PVOID ImageSectionHandle);
+
+NTOSAPI
+VOID
+DDKAPI
+MmUnlockPages(
+ IN PMDL MemoryDescriptorList);
+
+NTOSAPI
+VOID
+DDKAPI
+MmUnmapIoSpace(
+ IN PVOID BaseAddress,
+ IN SIZE_T NumberOfBytes);
+
+NTOSAPI
+VOID
+DDKAPI
+MmUnmapReservedMapping(
+ IN PVOID BaseAddress,
+ IN ULONG PoolTag,
+ IN PMDL MemoryDescriptorList);
+
+NTOSAPI
+VOID
+DDKAPI
+MmUnmapVideoDisplay(
+ IN PVOID BaseAddress,
+ IN SIZE_T NumberOfBytes);
+
+
+
+/** Object manager routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObAssignSecurity(
+ IN PACCESS_STATE AccessState,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PVOID Object,
+ IN POBJECT_TYPE Type);
+
+NTOSAPI
+VOID
+DDKAPI
+ObDereferenceSecurityDescriptor(
+ PSECURITY_DESCRIPTOR SecurityDescriptor,
+ ULONG Count);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ObfDereferenceObject(
+ IN PVOID Object);
+
+/*
+ * VOID
+ * ObDereferenceObject(
+ * IN PVOID Object)
+ */
+#define ObDereferenceObject ObfDereferenceObject
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObGetObjectSecurity(
+ IN PVOID Object,
+ OUT PSECURITY_DESCRIPTOR *SecurityDescriptor,
+ OUT PBOOLEAN MemoryAllocated);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObInsertObject(
+ IN PVOID Object,
+ IN PACCESS_STATE PassedAccessState OPTIONAL,
+ IN ACCESS_MASK DesiredAccess,
+ IN ULONG AdditionalReferences,
+ OUT PVOID* ReferencedObject OPTIONAL,
+ OUT PHANDLE Handle);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+ObfReferenceObject(
+ IN PVOID Object);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObLogSecurityDescriptor(
+ IN PSECURITY_DESCRIPTOR InputSecurityDescriptor,
+ OUT PSECURITY_DESCRIPTOR *OutputSecurityDescriptor,
+ IN ULONG RefBias);
+/*
+ * VOID
+ * ObReferenceObject(
+ * IN PVOID Object)
+ */
+#define ObReferenceObject ObfReferenceObject
+
+NTOSAPI
+VOID
+DDKAPI
+ObMakeTemporaryObject(
+ IN PVOID Object);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObOpenObjectByName(
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN POBJECT_TYPE ObjectType,
+ IN OUT PVOID ParseContext OPTIONAL,
+ IN KPROCESSOR_MODE AccessMode,
+ IN ACCESS_MASK DesiredAccess,
+ IN PACCESS_STATE PassedAccessState,
+ OUT PHANDLE Handle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObOpenObjectByPointer(
+ IN PVOID Object,
+ IN ULONG HandleAttributes,
+ IN PACCESS_STATE PassedAccessState OPTIONAL,
+ IN ACCESS_MASK DesiredAccess OPTIONAL,
+ IN POBJECT_TYPE ObjectType OPTIONAL,
+ IN KPROCESSOR_MODE AccessMode,
+ OUT PHANDLE Handle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObQueryObjectAuditingByHandle(
+ IN HANDLE Handle,
+ OUT PBOOLEAN GenerateOnClose);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObReferenceObjectByHandle(
+ IN HANDLE Handle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_TYPE ObjectType OPTIONAL,
+ IN KPROCESSOR_MODE AccessMode,
+ OUT PVOID *Object,
+ OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObReferenceObjectByName(
+ IN PUNICODE_STRING ObjectPath,
+ IN ULONG Attributes,
+ IN PACCESS_STATE PassedAccessState OPTIONAL,
+ IN ACCESS_MASK DesiredAccess OPTIONAL,
+ IN POBJECT_TYPE ObjectType,
+ IN KPROCESSOR_MODE AccessMode,
+ IN OUT PVOID ParseContext OPTIONAL,
+ OUT PVOID *Object);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ObReferenceObjectByPointer(
+ IN PVOID Object,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_TYPE ObjectType,
+ IN KPROCESSOR_MODE AccessMode);
+
+NTOSAPI
+VOID
+DDKAPI
+ObReferenceSecurityDescriptor(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN ULONG Count);
+
+NTOSAPI
+VOID
+DDKAPI
+ObReleaseObjectSecurity(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN BOOLEAN MemoryAllocated);
+
+
+
+/** Process manager routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsCreateSystemProcess(
+ IN PHANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsCreateSystemThread(
+ OUT PHANDLE ThreadHandle,
+ IN ULONG DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN HANDLE ProcessHandle OPTIONAL,
+ OUT PCLIENT_ID ClientId OPTIONAL,
+ IN PKSTART_ROUTINE StartRoutine,
+ IN PVOID StartContext);
+
+/*
+ * PEPROCESS
+ * PsGetCurrentProcess(VOID)
+ */
+#define PsGetCurrentProcess IoGetCurrentProcess
+
+NTOSAPI
+HANDLE
+DDKAPI
+PsGetCurrentProcessId(
+ VOID);
+
+/*
+ * PETHREAD
+ * PsGetCurrentThread(VOID)
+ */
+#define PsGetCurrentThread() \
+ ((PETHREAD) KeGetCurrentThread())
+
+NTOSAPI
+HANDLE
+DDKAPI
+PsGetCurrentThreadId(
+ VOID);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+PsGetVersion(
+ PULONG MajorVersion OPTIONAL,
+ PULONG MinorVersion OPTIONAL,
+ PULONG BuildNumber OPTIONAL,
+ PUNICODE_STRING CSDVersion OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsRemoveCreateThreadNotifyRoutine(
+ IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsRemoveLoadImageNotifyRoutine(
+ IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsSetCreateProcessNotifyRoutine(
+ IN PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine,
+ IN BOOLEAN Remove);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsSetCreateThreadNotifyRoutine(
+ IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsSetLoadImageNotifyRoutine(
+ IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PsTerminateSystemThread(
+ IN NTSTATUS ExitStatus);
+
+
+
+/** Security reference monitor routines **/
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+SeAccessCheck(
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext,
+ IN BOOLEAN SubjectContextLocked,
+ IN ACCESS_MASK DesiredAccess,
+ IN ACCESS_MASK PreviouslyGrantedAccess,
+ OUT PPRIVILEGE_SET *Privileges OPTIONAL,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN KPROCESSOR_MODE AccessMode,
+ OUT PACCESS_MASK GrantedAccess,
+ OUT PNTSTATUS AccessStatus);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+SeAssignSecurity(
+ IN PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL,
+ IN PSECURITY_DESCRIPTOR ExplicitDescriptor OPTIONAL,
+ OUT PSECURITY_DESCRIPTOR *NewDescriptor,
+ IN BOOLEAN IsDirectoryObject,
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN POOL_TYPE PoolType);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+SeAssignSecurityEx(
+ IN PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL,
+ IN PSECURITY_DESCRIPTOR ExplicitDescriptor OPTIONAL,
+ OUT PSECURITY_DESCRIPTOR *NewDescriptor,
+ IN GUID *ObjectType OPTIONAL,
+ IN BOOLEAN IsDirectoryObject,
+ IN ULONG AutoInheritFlags,
+ IN PSECURITY_SUBJECT_CONTEXT SubjectContext,
+ IN PGENERIC_MAPPING GenericMapping,
+ IN POOL_TYPE PoolType);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+SeDeassignSecurity(
+ IN OUT PSECURITY_DESCRIPTOR *SecurityDescriptor);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+SeSinglePrivilegeCheck(
+ LUID PrivilegeValue,
+ KPROCESSOR_MODE PreviousMode);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+SeValidSecurityDescriptor(
+ IN ULONG Length,
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor);
+
+
+
+/** NtXxx routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtOpenProcess(
+ OUT PHANDLE ProcessHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN PCLIENT_ID ClientId OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtQueryInformationProcess(
+ IN HANDLE ProcessHandle,
+ IN PROCESSINFOCLASS ProcessInformationClass,
+ OUT PVOID ProcessInformation,
+ IN ULONG ProcessInformationLength,
+ OUT PULONG ReturnLength OPTIONAL);
+
+
+
+/** NtXxx and ZwXxx routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwCancelTimer(
+ IN HANDLE TimerHandle,
+ OUT PBOOLEAN CurrentState OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtClose(
+ IN HANDLE Handle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwClose(
+ IN HANDLE Handle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwCreateDirectoryObject(
+ OUT PHANDLE DirectoryHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtCreateEvent(
+ OUT PHANDLE EventHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN BOOLEAN ManualReset,
+ IN BOOLEAN InitialState);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwCreateEvent(
+ OUT PHANDLE EventHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN BOOLEAN ManualReset,
+ IN BOOLEAN InitialState);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwCreateFile(
+ OUT PHANDLE FileHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PLARGE_INTEGER AllocationSize OPTIONAL,
+ IN ULONG FileAttributes,
+ IN ULONG ShareAccess,
+ IN ULONG CreateDisposition,
+ IN ULONG CreateOptions,
+ IN PVOID EaBuffer OPTIONAL,
+ IN ULONG EaLength);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwCreateKey(
+ OUT PHANDLE KeyHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ IN ULONG TitleIndex,
+ IN PUNICODE_STRING Class OPTIONAL,
+ IN ULONG CreateOptions,
+ OUT PULONG Disposition OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwCreateTimer(
+ OUT PHANDLE TimerHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN TIMER_TYPE TimerType);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwDeleteKey(
+ IN HANDLE KeyHandle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwDeleteValueKey(
+ IN HANDLE KeyHandle,
+ IN PUNICODE_STRING ValueName);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtDeviceIoControlFile(
+ IN HANDLE DeviceHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
+ IN PVOID UserApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG IoControlCode,
+ IN PVOID InputBuffer,
+ IN ULONG InputBufferSize,
+ OUT PVOID OutputBuffer,
+ IN ULONG OutputBufferSize);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwDeviceIoControlFile(
+ IN HANDLE DeviceHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
+ IN PVOID UserApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG IoControlCode,
+ IN PVOID InputBuffer,
+ IN ULONG InputBufferSize,
+ OUT PVOID OutputBuffer,
+ IN ULONG OutputBufferSize);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwEnumerateKey(
+ IN HANDLE KeyHandle,
+ IN ULONG Index,
+ IN KEY_INFORMATION_CLASS KeyInformationClass,
+ OUT PVOID KeyInformation,
+ IN ULONG Length,
+ OUT PULONG ResultLength);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwEnumerateValueKey(
+ IN HANDLE KeyHandle,
+ IN ULONG Index,
+ IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
+ OUT PVOID KeyValueInformation,
+ IN ULONG Length,
+ OUT PULONG ResultLength);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwFlushKey(
+ IN HANDLE KeyHandle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwMakeTemporaryObject(
+ IN HANDLE Handle);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtMapViewOfSection(
+ IN HANDLE SectionHandle,
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN ULONG ZeroBits,
+ IN ULONG CommitSize,
+ IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
+ IN OUT PSIZE_T ViewSize,
+ IN SECTION_INHERIT InheritDisposition,
+ IN ULONG AllocationType,
+ IN ULONG Protect);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwMapViewOfSection(
+ IN HANDLE SectionHandle,
+ IN HANDLE ProcessHandle,
+ IN OUT PVOID *BaseAddress,
+ IN ULONG ZeroBits,
+ IN ULONG CommitSize,
+ IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
+ IN OUT PSIZE_T ViewSize,
+ IN SECTION_INHERIT InheritDisposition,
+ IN ULONG AllocationType,
+ IN ULONG Protect);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtOpenFile(
+ OUT PHANDLE FileHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG ShareAccess,
+ IN ULONG OpenOptions);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwOpenFile(
+ OUT PHANDLE FileHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN ULONG ShareAccess,
+ IN ULONG OpenOptions);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwOpenKey(
+ OUT PHANDLE KeyHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwOpenSection(
+ OUT PHANDLE SectionHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwOpenSymbolicLinkObject(
+ OUT PHANDLE LinkHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwOpenTimer(
+ OUT PHANDLE TimerHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwQueryInformationFile(
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID FileInformation,
+ IN ULONG Length,
+ IN FILE_INFORMATION_CLASS FileInformationClass);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwQueryKey(
+ IN HANDLE KeyHandle,
+ IN KEY_INFORMATION_CLASS KeyInformationClass,
+ OUT PVOID KeyInformation,
+ IN ULONG Length,
+ OUT PULONG ResultLength);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwQuerySymbolicLinkObject(
+ IN HANDLE LinkHandle,
+ IN OUT PUNICODE_STRING LinkTarget,
+ OUT PULONG ReturnedLength OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwQueryValueKey(
+ IN HANDLE KeyHandle,
+ IN PUNICODE_STRING ValueName,
+ IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
+ OUT PVOID KeyValueInformation,
+ IN ULONG Length,
+ OUT PULONG ResultLength);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtReadFile(
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID Buffer,
+ IN ULONG Length,
+ IN PLARGE_INTEGER ByteOffset OPTIONAL,
+ IN PULONG Key OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwReadFile(
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ OUT PVOID Buffer,
+ IN ULONG Length,
+ IN PLARGE_INTEGER ByteOffset OPTIONAL,
+ IN PULONG Key OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtSetEvent(
+ IN HANDLE EventHandle,
+ IN PULONG NumberOfThreadsReleased);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwSetEvent(
+ IN HANDLE EventHandle,
+ IN PULONG NumberOfThreadsReleased);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwSetInformationFile(
+ IN HANDLE FileHandle,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PVOID FileInformation,
+ IN ULONG Length,
+ IN FILE_INFORMATION_CLASS FileInformationClass);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwSetInformationThread(
+ IN HANDLE ThreadHandle,
+ IN THREADINFOCLASS ThreadInformationClass,
+ IN PVOID ThreadInformation,
+ IN ULONG ThreadInformationLength);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwSetTimer(
+ IN HANDLE TimerHandle,
+ IN PLARGE_INTEGER DueTime,
+ IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL,
+ IN PVOID TimerContext OPTIONAL,
+ IN BOOLEAN WakeTimer,
+ IN LONG Period OPTIONAL,
+ OUT PBOOLEAN PreviousState OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwSetValueKey(
+ IN HANDLE KeyHandle,
+ IN PUNICODE_STRING ValueName,
+ IN ULONG TitleIndex OPTIONAL,
+ IN ULONG Type,
+ IN PVOID Data,
+ IN ULONG DataSize);
+
+/* [Nt|Zw]MapViewOfSection.InheritDisposition constants */
+#define AT_EXTENDABLE_FILE 0x00002000
+#define SEC_NO_CHANGE 0x00400000
+#define AT_RESERVED 0x20000000
+#define AT_ROUND_TO_PAGE 0x40000000
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtUnmapViewOfSection(
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwUnmapViewOfSection(
+ IN HANDLE ProcessHandle,
+ IN PVOID BaseAddress);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtWaitForSingleObject(
+ IN HANDLE Object,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Time);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwWaitForSingleObject(
+ IN HANDLE Object,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Time);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+NtWriteFile(
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PVOID Buffer,
+ IN ULONG Length,
+ IN PLARGE_INTEGER ByteOffset OPTIONAL,
+ IN PULONG Key OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ZwWriteFile(
+ IN HANDLE FileHandle,
+ IN HANDLE Event OPTIONAL,
+ IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
+ IN PVOID ApcContext OPTIONAL,
+ OUT PIO_STATUS_BLOCK IoStatusBlock,
+ IN PVOID Buffer,
+ IN ULONG Length,
+ IN PLARGE_INTEGER ByteOffset OPTIONAL,
+ IN PULONG Key OPTIONAL);
+
+
+
+/** Power management support routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PoCallDriver(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN OUT PIRP Irp);
+
+NTOSAPI
+PULONG
+DDKAPI
+PoRegisterDeviceForIdleDetection(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG ConservationIdleTime,
+ IN ULONG PerformanceIdleTime,
+ IN DEVICE_POWER_STATE State);
+
+NTOSAPI
+PVOID
+DDKAPI
+PoRegisterSystemState(
+ IN PVOID StateHandle,
+ IN EXECUTION_STATE Flags);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PoRequestPowerIrp(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN UCHAR MinorFunction,
+ IN POWER_STATE PowerState,
+ IN PREQUEST_POWER_COMPLETE CompletionFunction,
+ IN PVOID Context,
+ OUT PIRP *Irp OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+PoRequestShutdownEvent(
+ OUT PVOID *Event);
+
+NTOSAPI
+VOID
+DDKAPI
+PoSetDeviceBusy(
+ PULONG IdlePointer);
+
+NTOSAPI
+POWER_STATE
+DDKAPI
+PoSetPowerState(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN POWER_STATE_TYPE Type,
+ IN POWER_STATE State);
+
+NTOSAPI
+VOID
+DDKAPI
+PoSetSystemState(
+ IN EXECUTION_STATE Flags);
+
+NTOSAPI
+VOID
+DDKAPI
+PoStartNextPowerIrp(
+ IN PIRP Irp);
+
+NTOSAPI
+VOID
+DDKAPI
+PoUnregisterSystemState(
+ IN PVOID StateHandle);
+
+
+
+/** WMI library support routines **/
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+WmiCompleteRequest(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN NTSTATUS Status,
+ IN ULONG BufferUsed,
+ IN CCHAR PriorityBoost);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+WmiFireEvent(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN LPGUID Guid,
+ IN ULONG InstanceIndex,
+ IN ULONG EventDataSize,
+ IN PVOID EventData);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+WmiQueryTraceInformation(
+ IN TRACE_INFORMATION_CLASS TraceInformationClass,
+ OUT PVOID TraceInformation,
+ IN ULONG TraceInformationLength,
+ OUT PULONG RequiredLength OPTIONAL,
+ IN PVOID Buffer OPTIONAL);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+WmiSystemControl(
+ IN PWMILIB_CONTEXT WmiLibInfo,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ OUT PSYSCTL_IRP_DISPOSITION IrpDisposition);
+
+NTOSAPI
+NTSTATUS
+DDKCDECLAPI
+WmiTraceMessage(
+ IN TRACEHANDLE LoggerHandle,
+ IN ULONG MessageFlags,
+ IN LPGUID MessageGuid,
+ IN USHORT MessageNumber,
+ IN ...);
+
+#if 0
+/* FIXME: Get va_list from where? */
+NTOSAPI
+NTSTATUS
+DDKCDECLAPI
+WmiTraceMessageVa(
+ IN TRACEHANDLE LoggerHandle,
+ IN ULONG MessageFlags,
+ IN LPGUID MessageGuid,
+ IN USHORT MessageNumber,
+ IN va_list MessageArgList);
+#endif
+
+
+/** Kernel debugger routines **/
+
+NTOSAPI
+VOID
+DDKAPI
+KdDisableDebugger(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+KdEnableDebugger(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+DbgBreakPoint(
+ VOID);
+
+NTOSAPI
+VOID
+DDKAPI
+DbgBreakPointWithStatus(
+ IN ULONG Status);
+
+NTOSAPI
+ULONG
+DDKCDECLAPI
+DbgPrint(
+ IN PCH Format,
+ IN ...);
+
+NTOSAPI
+ULONG
+DDKCDECLAPI
+DbgPrintEx(
+ IN ULONG ComponentId,
+ IN ULONG Level,
+ IN PCH Format,
+ IN ...);
+
+NTOSAPI
+ULONG
+DDKCDECLAPI
+DbgPrintReturnControlC(
+ IN PCH Format,
+ IN ...);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+DbgQueryDebugFilterState(
+ IN ULONG ComponentId,
+ IN ULONG Level);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+DbgSetDebugFilterState(
+ IN ULONG ComponentId,
+ IN ULONG Level,
+ IN BOOLEAN State);
+
+#if DBG
+
+#define KdPrint(_x_) DbgPrint _x_
+#define KdPrintEx(_x_) DbgPrintEx _x_
+#define KdBreakPoint() DbgBreakPoint()
+#define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
+
+#else /* !DBG */
+
+#define KdPrint(_x_)
+#define KdPrintEx(_x_)
+#define KdBreakPoint()
+#define KdBreakPointWithStatus(s)
+
+#endif /* !DBG */
+
+extern NTOSAPI PBOOLEAN KdDebuggerNotPresent;
+extern NTOSAPI PBOOLEAN KdDebuggerEnabled;
+#define KD_DEBUGGER_ENABLED *KdDebuggerEnabled
+#define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINDDK_H */
--- /dev/null
+/*
+ * winnt4.h
+ *
+ * Definitions only used in Windows NT 4.0 and earlier versions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __WINNT4_H
+#define __WINNT4_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _ZONE_SEGMENT_HEADER {
+ SINGLE_LIST_ENTRY SegmentList;
+ PVOID Reserved;
+} ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER;
+
+typedef struct _ZONE_HEADER {
+ SINGLE_LIST_ENTRY FreeList;
+ SINGLE_LIST_ENTRY SegmentList;
+ ULONG BlockSize;
+ ULONG TotalSegmentSize;
+} ZONE_HEADER, *PZONE_HEADER;
+
+static inline PVOID
+ExAllocateFromZone(
+ IN PZONE_HEADER Zone)
+{
+ if (Zone->FreeList.Next)
+ Zone->FreeList.Next = Zone->FreeList.Next->Next;
+ return (PVOID) Zone->FreeList.Next;
+}
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ExExtendZone(
+ IN PZONE_HEADER Zone,
+ IN PVOID Segment,
+ IN ULONG SegmentSize);
+
+static inline PVOID
+ExFreeToZone(
+ IN PZONE_HEADER Zone,
+ IN PVOID Block)
+{
+ ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next;
+ Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block);
+ return ((PSINGLE_LIST_ENTRY) Block)->Next;
+}
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ExInitializeZone(
+ IN PZONE_HEADER Zone,
+ IN ULONG BlockSize,
+ IN PVOID InitialSegment,
+ IN ULONG InitialSegmentSize);
+
+/*
+ * PVOID
+ * ExInterlockedAllocateFromZone(
+ * IN PZONE_HEADER Zone,
+ * IN PKSPIN_LOCK Lock)
+ */
+#define ExInterlockedAllocateFromZone(Zone, \
+ Lock) \
+ ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+ExInterlockedExtendZone(
+ IN PZONE_HEADER Zone,
+ IN PVOID Segment,
+ IN ULONG SegmentSize,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+PVOID
+DDKAPI
+ExInterlockedFreeToZone(
+ IN PZONE_HEADER Zone,
+ IN PVOID Block,
+ IN PKSPIN_LOCK Lock);
+
+/*
+ * VOID
+ * ExInitializeWorkItem(
+ * IN PWORK_QUEUE_ITEM Item,
+ * IN PWORKER_THREAD_ROUTINE Routine,
+ * IN PVOID Context)
+ */
+#define ExInitializeWorkItem(Item, \
+ Routine, \
+ Context) \
+{ \
+ (Item)->WorkerRoutine = Routine; \
+ (Item)->Parameter = Context; \
+ (Item)->List.Flink = NULL; \
+}
+
+/*
+ * BOOLEAN
+ * ExIsFullZone(
+ * IN PZONE_HEADER Zone)
+ */
+#define ExIsFullZone(Zone) \
+ ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
+
+NTOSAPI
+VOID
+DDKAPI
+ExQueueWorkItem(
+ IN PWORK_QUEUE_ITEM WorkItem,
+ IN WORK_QUEUE_TYPE QueueType);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+ExIsObjectInFirstZoneSegment(
+ IN PZONE_HEADER Zone,
+ IN PVOID Object);
+
+NTOSAPI
+VOID
+DDKAPI
+ExReleaseResource(
+ IN PERESOURCE Resource);
+
+#define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite
+#define ExAcquireResourceShared ExAcquireResourceSharedLite
+#define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite
+#define ExDeleteResource ExDeleteResourceLite
+#define ExInitializeResource ExInitializeResourceLite
+#define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite
+#define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite
+#define ExIsResourceAcquired ExIsResourceAcquiredSharedLite
+#define ExReleaseResourceForThread ExReleaseResourceForThreadLite
+
+NTOSAPI
+INTERLOCKED_RESULT
+DDKAPI
+ExInterlockedDecrementLong(
+ IN PLONG Addend,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+ULONG
+DDKAPI
+ExInterlockedExchangeUlong(
+ IN PULONG Target,
+ IN ULONG Value,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+INTERLOCKED_RESULT
+DDKAPI
+ExInterlockedIncrementLong(
+ IN PLONG Addend,
+ IN PKSPIN_LOCK Lock);
+
+NTOSAPI
+PVOID
+DDKAPI
+HalAllocateCommonBuffer(
+ IN PADAPTER_OBJECT AdapterObject,
+ IN ULONG Length,
+ OUT PPHYSICAL_ADDRESS LogicalAddress,
+ IN BOOLEAN CacheEnabled);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+HalAssignSlotResources(
+ IN PUNICODE_STRING RegistryPath,
+ IN PUNICODE_STRING DriverClassName,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResources);
+
+NTOSAPI
+VOID
+DDKAPI
+HalFreeCommonBuffer(
+ IN PADAPTER_OBJECT AdapterObject,
+ IN ULONG Length,
+ IN PHYSICAL_ADDRESS LogicalAddress,
+ IN PVOID VirtualAddress,
+ IN BOOLEAN CacheEnabled);
+
+NTOSAPI
+PADAPTER_OBJECT
+DDKAPI
+HalGetAdapter(
+ IN PDEVICE_DESCRIPTION DeviceDescription,
+ IN OUT PULONG NumberOfMapRegisters);
+
+NTOSAPI
+ULONG
+DDKAPI
+HalGetBusData(
+ IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+NTOSAPI
+ULONG
+DDKAPI
+HalGetBusDataByOffset(
+ IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+NTOSAPI
+ULONG
+DDKAPI
+HalGetDmaAlignmentRequirement(
+ VOID);
+
+NTOSAPI
+ULONG
+DDKAPI
+HalGetInterruptVector(
+ IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity);
+
+NTOSAPI
+ULONG
+DDKAPI
+HalReadDmaCounter(
+ IN PADAPTER_OBJECT AdapterObject);
+
+NTOSAPI
+ULONG
+DDKAPI
+HalSetBusData(
+ IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length);
+
+NTOSAPI
+ULONG
+DDKAPI
+HalSetBusDataByOffset(
+ IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+HalTranslateBusAddress(
+ IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoAllocateAdapterChannel(
+ IN PADAPTER_OBJECT AdapterObject,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG NumberOfMapRegisters,
+ IN PDRIVER_CONTROL ExecutionRoutine,
+ IN PVOID Context);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoAssignResources(
+ IN PUNICODE_STRING RegistryPath,
+ IN PUNICODE_STRING DriverClassName OPTIONAL,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT DeviceObject OPTIONAL,
+ IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResources);
+
+NTOSAPI
+NTSTATUS
+DDKAPI
+IoAttachDeviceByPointer(
+ IN PDEVICE_OBJECT SourceDevice,
+ IN PDEVICE_OBJECT TargetDevice);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+IoFlushAdapterBuffers(
+ IN PADAPTER_OBJECT AdapterObject,
+ IN PMDL Mdl,
+ IN PVOID MapRegisterBase,
+ IN PVOID CurrentVa,
+ IN ULONG Length,
+ IN BOOLEAN WriteToDevice);
+
+NTOSAPI
+VOID
+DDKAPI
+IoFreeAdapterChannel(
+ IN PADAPTER_OBJECT AdapterObject);
+
+NTOSAPI
+VOID
+DDKAPI
+IoFreeMapRegisters(
+ IN PADAPTER_OBJECT AdapterObject,
+ IN PVOID MapRegisterBase,
+ IN ULONG NumberOfMapRegisters);
+
+NTOSAPI
+PHYSICAL_ADDRESS
+DDKAPI
+IoMapTransfer(
+ IN PADAPTER_OBJECT AdapterObject,
+ IN PMDL Mdl,
+ IN PVOID MapRegisterBase,
+ IN PVOID CurrentVa,
+ IN OUT PULONG Length,
+ IN BOOLEAN WriteToDevice);
+
+NTOSAPI
+PMDL
+DDKAPI
+MmCreateMdl(
+ IN PMDL MemoryDescriptorList OPTIONAL,
+ IN PVOID Base,
+ IN SIZE_T Length);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+MmIsNonPagedSystemAddressValid(
+ IN PVOID VirtualAddress);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlEnlargedIntegerMultiply(
+ IN LONG Multiplicand,
+ IN LONG Multiplier);
+
+NTOSAPI
+ULONG
+DDKAPI
+RtlEnlargedUnsignedDivide(
+ IN ULARGE_INTEGER Dividend,
+ IN ULONG Divisor,
+ IN OUT PULONG Remainder);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlEnlargedUnsignedMultiply(
+ IN ULONG Multiplicand,
+ IN ULONG Multiplier);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlExtendedIntegerMultiply(
+ IN LARGE_INTEGER Multiplicand,
+ IN LONG Multiplier);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlExtendedLargeIntegerDivide(
+ IN LARGE_INTEGER Dividend,
+ IN ULONG Divisor,
+ IN OUT PULONG Remainder);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlExtendedMagicDivide(
+ IN LARGE_INTEGER Dividend,
+ IN LARGE_INTEGER MagicDivisor,
+ IN CCHAR ShiftCount);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlLargeIntegerAdd(
+ IN LARGE_INTEGER Addend1,
+ IN LARGE_INTEGER Addend2);
+
+NTOSAPI
+VOID
+DDKAPI
+RtlLargeIntegerAnd(
+ IN OUT LARGE_INTEGER Result,
+ IN LARGE_INTEGER Source,
+ IN LARGE_INTEGER Mask);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlLargeIntegerArithmeticShift(
+ IN LARGE_INTEGER LargeInteger,
+ IN CCHAR ShiftCount);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlLargeIntegerDivide(
+ IN LARGE_INTEGER Dividend,
+ IN LARGE_INTEGER Divisor,
+ IN OUT PLARGE_INTEGER Remainder);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerEqualTo(
+ IN LARGE_INTEGER Operand1,
+ IN LARGE_INTEGER Operand2);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerEqualToZero(
+ IN LARGE_INTEGER Operand);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerGreaterOrEqualToZero(
+ IN LARGE_INTEGER Operand);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerGreaterThan(
+ IN LARGE_INTEGER Operand1,
+ IN LARGE_INTEGER Operand2);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerGreaterThanOrEqualTo(
+ IN LARGE_INTEGER Operand1,
+ IN LARGE_INTEGER Operand2);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerGreaterThanZero(
+ IN LARGE_INTEGER Operand);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerLessOrEqualToZero(
+ IN LARGE_INTEGER Operand);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerLessThan(
+ IN LARGE_INTEGER Operand1,
+ IN LARGE_INTEGER Operand2);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerLessThanOrEqualTo(
+ IN LARGE_INTEGER Operand1,
+ IN LARGE_INTEGER Operand2);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerLessThanZero(
+ IN LARGE_INTEGER Operand);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlLargeIntegerNegate(
+ IN LARGE_INTEGER Subtrahend);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerNotEqualTo(
+ IN LARGE_INTEGER Operand1,
+ IN LARGE_INTEGER Operand2);
+
+NTOSAPI
+BOOLEAN
+DDKAPI
+RtlLargeIntegerNotEqualToZero(
+ IN LARGE_INTEGER Operand);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlLargeIntegerShiftLeft(
+ IN LARGE_INTEGER LargeInteger,
+ IN CCHAR ShiftCount);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlLargeIntegerShiftRight(
+ IN LARGE_INTEGER LargeInteger,
+ IN CCHAR ShiftCount);
+
+NTOSAPI
+LARGE_INTEGER
+DDKAPI
+RtlLargeIntegerSubtract(
+ IN LARGE_INTEGER Minuend,
+ IN LARGE_INTEGER Subtrahend);
+
+
+/*
+ * ULONG
+ * COMPUTE_PAGES_SPANNED(
+ * IN PVOID Va,
+ * IN ULONG Size)
+ */
+#define COMPUTE_PAGES_SPANNED(Va, \
+ Size) \
+ (ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va, Size))
+
+
+/*
+** Architecture specific structures
+*/
+
+#ifdef _X86_
+
+NTOSAPI
+INTERLOCKED_RESULT
+DDKFASTAPI
+Exfi386InterlockedIncrementLong(
+ IN PLONG Addend);
+
+NTOSAPI
+INTERLOCKED_RESULT
+DDKFASTAPI
+Exfi386InterlockedDecrementLong(
+ IN PLONG Addend);
+
+NTOSAPI
+ULONG
+DDKFASTAPI
+Exfi386InterlockedExchangeUlong(
+ IN PULONG Target,
+ IN ULONG Value);
+
+#define ExInterlockedIncrementLong(Addend,Lock) Exfi386InterlockedIncrementLong(Addend)
+#define ExInterlockedDecrementLong(Addend,Lock) Exfi386InterlockedDecrementLong(Addend)
+#define ExInterlockedExchangeUlong(Target, Value, Lock) Exfi386InterlockedExchangeUlong(Target, Value)
+
+#endif /* _X86_ */
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINNT4_H */
--- /dev/null
+/*
+ * winxp.h
+ *
+ * Definitions only used in Windows XP and earlier versions
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __WINXP_H
+#define __WINXP_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINXP_H */
--- /dev/null
+/*
+ * ws2san.h
+ *
+ * WinSock Direct (SAN) support
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __WS2SAN_H
+#define __WS2SAN_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <winsock2.h>
+#include "ntddk.h"
+
+
+#define WSPAPI STDCALL
+
+/* FIXME: Unknown definitions */
+typedef PVOID LPWSPDATA;
+typedef PDWORD LPWSATHREADID;
+typedef PVOID LPWSPPROC_TABLE;
+typedef struct _WSPUPCALLTABLEEX WSPUPCALLTABLEEX;
+typedef WSPUPCALLTABLEEX *LPWSPUPCALLTABLEEX;
+
+#define SO_MAX_RDMA_SIZE 0x700D
+#define SO_RDMA_THRESHOLD_SIZE 0x700E
+
+#define WSAID_REGISTERMEMORY \
+ {0xC0B422F5, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
+
+#define WSAID_DEREGISTERMEMORY \
+ {0xC0B422F6, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
+
+#define WSAID_REGISTERRDMAMEMORY \
+ {0xC0B422F7, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
+
+#define WSAID_DEREGISTERRDMAMEMORY \
+ {0xC0B422F8, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
+
+#define WSAID_RDMAWRITE \
+ {0xC0B422F9, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
+
+#define WSAID_RDMAREAD \
+ {0xC0B422FA, 0xF58C, 0x11d1, {0xAD, 0x6C, 0x00, 0xC0, 0x4F, 0xA3, 0x4A, 0x2D}}
+
+#define WSAID_MEMORYREGISTRATIONCACHECALLBACK \
+ {0xE5DA4AF8, 0xD824, 0x48CD, {0xA7, 0x99, 0x63, 0x37, 0xA9, 0x8E, 0xD2, 0xAF}}
+
+typedef struct _WSABUFEX {
+ u_long len;
+ char FAR *buf;
+ HANDLE handle;
+} WSABUFEX, FAR * LPWSABUFEX;
+
+#if 0
+typedef struct _WSPUPCALLTABLEEX {
+ LPWPUCLOSEEVENT lpWPUCloseEvent;
+ LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle;
+ LPWPUCREATEEVENT lpWPUCreateEvent;
+ LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle;
+ LPWPUFDISSET lpWPUFDIsSet;
+ LPWPUGETPROVIDERPATH lpWPUGetProviderPath;
+ LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle;
+ LPWPUPOSTMESSAGE lpWPUPostMessage;
+ LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback;
+ LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext;
+ LPWPUQUEUEAPC lpWPUQueueApc;
+ LPWPURESETEVENT lpWPUResetEvent;
+ LPWPUSETEVENT lpWPUSetEvent;
+ LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread;
+ LPWPUCLOSETHREAD lpWPUCloseThread;
+ LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
+} WSPUPCALLTABLEEX, FAR * LPWSPUPCALLTABLEEX;
+#endif
+
+int WSPAPI
+WSPStartupEx(
+ IN WORD wVersionRequested,
+ OUT LPWSPDATA lpWSPData,
+ IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
+ IN LPWSPUPCALLTABLEEX lpUpcallTable,
+ OUT LPWSPPROC_TABLE lpProcTable);
+
+typedef int WSPAPI
+(*LPWSPSTARTUPEX)(
+ IN WORD wVersionRequested,
+ OUT LPWSPDATA lpWSPData,
+ IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
+ IN LPWSPUPCALLTABLEEX lpUpcallTable,
+ OUT LPWSPPROC_TABLE lpProcTable);
+
+#define MEM_READ 1
+#define MEM_WRITE 2
+#define MEM_READWRITE 3
+
+int WSPAPI
+WSPDeregisterMemory(
+ IN SOCKET s,
+ IN HANDLE Handle,
+ OUT LPINT lpErrno);
+
+typedef int WSPAPI
+(*LPFN_WSPDEREGISTERMEMORY)(
+ IN SOCKET s,
+ IN HANDLE Handle,
+ OUT LPINT lpErrno);
+
+int WSPAPI
+WSPDeregisterRdmaMemory(
+ IN SOCKET s,
+ IN LPVOID lpRdmaBufferDescriptor,
+ IN DWORD dwDescriptorLength,
+ OUT LPINT lpErrno);
+
+typedef int WSPAPI
+(*LPFN_WSPDEREGISTERRDMAMEMORY)(
+ IN SOCKET s,
+ IN LPVOID lpRdmaBufferDescriptor,
+ IN DWORD dwDescriptorLength,
+ OUT LPINT lpErrno);
+
+int WSPAPI
+WSPMemoryRegistrationCacheCallback(
+ IN PVOID lpvAddress,
+ IN SIZE_T Size,
+ OUT LPINT lpErrno);
+
+typedef int WSPAPI
+(*LPFN_WSPMEMORYREGISTRATIONCACHECALLBACK)(
+ IN PVOID lpvAddress,
+ IN SIZE_T Size,
+ OUT LPINT lpErrno);
+
+int WSPAPI
+WSPRdmaRead(
+ IN SOCKET s,
+ IN LPWSABUFEX lpBuffers,
+ IN DWORD dwBufferCount,
+ IN LPVOID lpTargetBufferDescriptor,
+ IN DWORD dwTargetDescriptorLength,
+ IN DWORD dwTargetBufferOffset,
+ OUT LPDWORD lpdwNumberOfBytesRead,
+ IN DWORD dwFlags,
+ IN LPWSAOVERLAPPED lpOverlapped,
+ IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+ IN LPWSATHREADID lpThreadId,
+ OUT LPINT lpErrno);
+
+typedef int WSPAPI
+(*LPFN_WSPRDMAREAD)(
+ IN SOCKET s,
+ IN LPWSABUFEX lpBuffers,
+ IN DWORD dwBufferCount,
+ IN LPVOID lpTargetBufferDescriptor,
+ IN DWORD dwTargetDescriptorLength,
+ IN DWORD dwTargetBufferOffset,
+ OUT LPDWORD lpdwNumberOfBytesRead,
+ IN DWORD dwFlags,
+ IN LPWSAOVERLAPPED lpOverlapped,
+ IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+ IN LPWSATHREADID lpThreadId,
+ OUT LPINT lpErrno);
+
+int WSPAPI
+WSPRdmaWrite(
+ IN SOCKET s,
+ IN LPWSABUFEX lpBuffers,
+ IN DWORD dwBufferCount,
+ IN LPVOID lpTargetBufferDescriptor,
+ IN DWORD dwTargetDescriptorLength,
+ IN DWORD dwTargetBufferOffset,
+ OUT LPDWORD lpdwNumberOfBytesWritten,
+ IN DWORD dwFlags,
+ IN LPWSAOVERLAPPED lpOverlapped,
+ IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+ IN LPWSATHREADID lpThreadId,
+ OUT LPINT lpErrno);
+
+typedef int WSPAPI
+(*LPFN_WSPRDMAWRITE)(
+ IN SOCKET s,
+ IN LPWSABUFEX lpBuffers,
+ IN DWORD dwBufferCount,
+ IN LPVOID lpTargetBufferDescriptor,
+ IN DWORD dwTargetDescriptorLength,
+ IN DWORD dwTargetBufferOffset,
+ OUT LPDWORD lpdwNumberOfBytesWritten,
+ IN DWORD dwFlags,
+ IN LPWSAOVERLAPPED lpOverlapped,
+ IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
+ IN LPWSATHREADID lpThreadId,
+ OUT LPINT lpErrno);
+
+HANDLE WSPAPI
+WSPRegisterMemory(
+ IN SOCKET s,
+ IN PVOID lpBuffer,
+ IN DWORD dwBufferLength,
+ IN DWORD dwFlags,
+ OUT LPINT lpErrno);
+
+int WSPAPI
+WSPRegisterRdmaMemory(
+ IN SOCKET s,
+ IN PVOID lpBuffer,
+ IN DWORD dwBufferLength,
+ IN DWORD dwFlags,
+ OUT LPVOID lpRdmaBufferDescriptor,
+ IN OUT LPDWORD lpdwDescriptorLength,
+ OUT LPINT lpErrno);
+
+typedef int WSPAPI
+(*LPFN_WSPREGISTERRDMAMEMORY)(
+ IN SOCKET s,
+ IN PVOID lpBuffer,
+ IN DWORD dwBufferLength,
+ IN DWORD dwFlags,
+ OUT LPVOID lpRdmaBufferDescriptor,
+ IN OUT LPDWORD lpdwDescriptorLength,
+ OUT LPINT lpErrno);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WS2SAN_H */
--- /dev/null
+/*
+ * xfilter.h
+ *
+ * Address filtering for NDIS MACs
+ *
+ * This file is part of the MinGW package.
+ *
+ * Contributors:
+ * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warranties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+#ifndef __XFILTER_H
+#define __XFILTER_H
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ntddk.h"
+
+
+#define ETH_LENGTH_OF_ADDRESS 6
+
+#define ETH_IS_BROADCAST(Address) \
+ ((((PUCHAR)(Address))[0] == ((UCHAR)0xff)) && (((PUCHAR)(Address))[1] == ((UCHAR)0xff)))
+
+#define ETH_IS_MULTICAST(Address) \
+ (BOOLEAN)(((PUCHAR)(Address))[0] & ((UCHAR)0x01))
+
+#define ETH_COMPARE_NETWORK_ADDRESSES(_A, _B, _Result) \
+{ \
+ if (*(ULONG UNALIGNED *)&(_A)[2] > *(ULONG UNALIGNED *)&(_B)[2]) \
+ { \
+ *(_Result) = 1; \
+ } \
+ else if (*(ULONG UNALIGNED *)&(_A)[2] < *(ULONG UNALIGNED *)&(_B)[2]) \
+ { \
+ *(_Result) = (UINT)-1; \
+ } \
+ else if (*(USHORT UNALIGNED *)(_A) > *(USHORT UNALIGNED *)(_B)) \
+ { \
+ *(_Result) = 1; \
+ } \
+ else if (*(USHORT UNALIGNED *)(_A) < *(USHORT UNALIGNED *)(_B)) \
+ { \
+ *(_Result) = (UINT)-1; \
+ } \
+ else \
+ { \
+ *(_Result) = 0; \
+ } \
+}
+
+#define ETH_COMPARE_NETWORK_ADDRESSES_EQ(_A,_B, _Result) \
+{ \
+ if ((*(ULONG UNALIGNED *)&(_A)[2] == *(ULONG UNALIGNED *)&(_B)[2]) && \
+ (*(USHORT UNALIGNED *)(_A) == *(USHORT UNALIGNED *)(_B))) \
+ { \
+ *(_Result) = 0; \
+ } \
+ else \
+ { \
+ *(_Result) = 1; \
+ } \
+}
+
+#define ETH_COPY_NETWORK_ADDRESS(_D, _S) \
+{ \
+ *((ULONG UNALIGNED *)(_D)) = *((ULONG UNALIGNED *)(_S)); \
+ *((USHORT UNALIGNED *)((UCHAR *)(_D) + 4)) = *((USHORT UNALIGNED *)((UCHAR *)(_S) + 4)); \
+}
+
+#define FDDI_LENGTH_OF_LONG_ADDRESS 6
+#define FDDI_LENGTH_OF_SHORT_ADDRESS 2
+
+#define FDDI_IS_BROADCAST(Address, AddressLength, Result) \
+ *Result = ((*(PUCHAR)(Address) == (UCHAR)0xFF) && \
+ (*((PUCHAR)(Address) + 1) == (UCHAR)0xFF))
+
+#define FDDI_IS_MULTICAST(Address, AddressLength, Result) \
+ *Result = (BOOLEAN)(*(UCHAR *)(Address) & (UCHAR)0x01)
+
+#define FDDI_IS_SMT(FcByte, Result) \
+{ \
+ *Result = ((FcByte & ((UCHAR)0xf0)) == 0x40); \
+}
+
+
+#define FDDI_COMPARE_NETWORK_ADDRESSES(_A, _B, _Length, _Result) \
+{ \
+ if (*(USHORT UNALIGNED *)(_A) > *(USHORT UNALIGNED *)(_B)) \
+ { \
+ *(_Result) = 1; \
+ } \
+ else if (*(USHORT UNALIGNED *)(_A) < *(USHORT UNALIGNED *)(_B)) \
+ { \
+ *(_Result) = (UINT)-1; \
+ } \
+ else if (_Length == 2) \
+ { \
+ *(_Result) = 0; \
+ } \
+ else if (*(ULONG UNALIGNED *)((PUCHAR)(_A) + 2) > *(ULONG UNALIGNED *)((PUCHAR)(_B) + 2)) \
+ { \
+ *(_Result) = 1; \
+ } \
+ else if (*(ULONG UNALIGNED *)((PUCHAR)(_A) + 2) < *(ULONG UNALIGNED *)((PUCHAR)(_B) + 2)) \
+ { \
+ *(_Result) = (UINT)-1; \
+ } \
+ else \
+ { \
+ *(_Result) = 0; \
+ } \
+}
+
+#define FDDI_COMPARE_NETWORK_ADDRESSES_EQ(_A, _B, _Length, _Result) \
+{ \
+ if ((*(USHORT UNALIGNED *)(_A) == *(USHORT UNALIGNED *)(_B)) && \
+ (((_Length) == 2) || \
+ (*(ULONG UNALIGNED *)((PUCHAR)(_A) + 2) == *(ULONG UNALIGNED *)((PUCHAR)(_B) + 2)))) \
+ { \
+ *(_Result) = 0; \
+ } \
+ else \
+ { \
+ *(_Result) = 1; \
+ } \
+}
+
+#define FDDI_COPY_NETWORK_ADDRESS(D, S, AddressLength) \
+{ \
+ PCHAR _D = (D); \
+ PCHAR _S = (S); \
+ UINT _C = (AddressLength); \
+ for ( ; _C > 0 ; _D++, _S++, _C--) \
+ { \
+ *_D = *_S; \
+ } \
+}
+
+#define TR_LENGTH_OF_FUNCTIONAL 4
+#define TR_LENGTH_OF_ADDRESS 6
+
+typedef ULONG TR_FUNCTIONAL_ADDRESS;
+typedef ULONG TR_GROUP_ADDRESS;
+
+#define TR_IS_NOT_DIRECTED(_Address, _Result) \
+{ \
+ *(_Result) = (BOOLEAN)((_Address)[0] & 0x80); \
+}
+
+#define TR_IS_FUNCTIONAL(_Address, _Result) \
+{ \
+ *(_Result) = (BOOLEAN)(((_Address)[0] & 0x80) && !((_Address)[2] & 0x80)); \
+}
+
+#define TR_IS_GROUP(_Address, _Result) \
+{ \
+ *(_Result) = (BOOLEAN)((_Address)[0] & (_Address)[2] & 0x80); \
+}
+
+#define TR_IS_SOURCE_ROUTING(_Address, _Result) \
+{ \
+ *(_Result) = (BOOLEAN)((_Address)[0] & 0x80); \
+}
+
+#define TR_IS_MAC_FRAME(_PacketHeader) ((((PUCHAR)_PacketHeader)[1] & 0xFC) == 0)
+
+#define TR_IS_BROADCAST(_Address, _Result) \
+{ \
+ *(_Result) = (BOOLEAN)(((*(UNALIGNED USHORT *)&(_Address)[0] == 0xFFFF) || \
+ (*(UNALIGNED USHORT *)&(_Address)[0] == 0x00C0)) && \
+ (*(UNALIGNED ULONG *)&(_Address)[2] == 0xFFFFFFFF)); \
+}
+
+#define TR_COMPARE_NETWORK_ADDRESSES(_A, _B, _Result) \
+{ \
+ if (*(ULONG UNALIGNED *)&(_A)[2] > *(ULONG UNALIGNED *)&(_B)[2]) \
+ { \
+ *(_Result) = 1; \
+ } \
+ else if (*(ULONG UNALIGNED *)&(_A)[2] < *(ULONG UNALIGNED *)&(_B)[2]) \
+ { \
+ *(_Result) = (UINT)-1; \
+ } \
+ else if (*(USHORT UNALIGNED *)(_A) > *(USHORT UNALIGNED *)(_B)) \
+ { \
+ *(_Result) = 1; \
+ } \
+ else if (*(USHORT UNALIGNED *)(_A) < *(USHORT UNALIGNED *)(_B)) \
+ { \
+ *(_Result) = (UINT)-1; \
+ } \
+ else \
+ { \
+ *(_Result) = 0; \
+ } \
+}
+
+#define TR_COPY_NETWORK_ADDRESS(_D, _S) \
+{ \
+ *((ULONG UNALIGNED *)(_D)) = *((ULONG UNALIGNED *)(_S)); \
+ *((USHORT UNALIGNED *)((UCHAR *)(_D)+4)) = *((USHORT UNALIGNED *)((UCHAR *)(_S) + 4)); \
+}
+
+#define TR_COMPARE_NETWORK_ADDRESSES_EQ(_A, _B, _Result) \
+{ \
+ if ((*(ULONG UNALIGNED *)&(_A)[2] == *(ULONG UNALIGNED *)&(_B)[2]) && \
+ (*(USHORT UNALIGNED *)&(_A)[0] == *(USHORT UNALIGNED *)&(_B)[0])) \
+ { \
+ *(_Result) = 0; \
+ } \
+ else \
+ { \
+ *(_Result) = 1; \
+ } \
+}
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XFILTER_H */
--- /dev/null
+# Makefile.in
+#
+# This file is part of a free library building Windows NT drivers.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+
+# start config section
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+host_alias = @host_alias@
+build_alias = @build_alias@
+target_alias = @target_alias@
+prefix = @prefix@
+includedir:=@includedir@
+
+program_transform_name = @program_transform_name@
+exec_prefix = @exec_prefix@
+libdir:=@libdir@
+bindir = @bindir@
+ifeq ($(target_alias),$(host_alias))
+ifeq ($(build_alias),$(host_alias))
+tooldir:=$(exec_prefix)
+else
+tooldir:=$(exec_prefix)/$(target_alias)
+endif
+else
+tooldir:=$(exec_prefix)/$(target_alias)
+endif
+datadir = @datadir@
+infodir = @infodir@
+ifneq (,$(findstring cygwin,$(target_alias)))
+inst_includedir:=$(tooldir)/include/ddk
+inst_libdir:=$(tooldir)/lib
+else
+inst_includedir:=$(includedir)/ddk
+inst_libdir:=$(libdir)
+endif
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+mkinstalldirs = mkdir -p
+
+CC = @CC@
+CC_FOR_TARGET = $(CC)
+
+DLLTOOL = @DLLTOOL@
+DLLTOOL_FLAGS = --as=$(AS) -k
+AS = @AS@
+AS_FOR_TARGET = $(AS_FOR_TARGET)
+WINDRES = @WINDRES@
+
+# Depending on if we build as part of winsup or mingw we need to
+# add additional include paths in order to get the correct headers
+# from the C library.
+BUILDENV = @BUILDENV@
+
+ifeq ($(BUILDENV), cygwin)
+# winsup/include
+# winsup/../newlib/libc/include
+# winsup/../newlib/libc/sys/cygwin
+EXTRA_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../../../newlib/libc/include -I$(srcdir)/../../../newlib/libc/sys/cygwin
+endif
+ifeq ($(BUILDENV), mingw)
+EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
+endif
+
+INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
+
+CFLAGS = @CFLAGS@
+ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
+
+RANLIB = @RANLIB@
+AR = @AR@
+LD = @LD@
+
+# end config section
+
+# headers
+
+HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
+
+# libraries
+
+DEF_FILES = $(notdir $(wildcard $(srcdir)/*.def))
+IMPLIBS = $(addprefix lib,$(subst .def,.a,$(DEF_FILES)))
+LIBS = $(IMPLIBS)
+
+DISTFILES = Makefile.in $(DEF_FILES)
+
+.NOTPARALLEL:
+
+# targets
+all: $(LIBS)
+
+TEST_OPTIONS = $(ALL_CFLAGS) -Wall -pedantic -Wsystem-headers -c $(srcdir)/test.c -o test.o
+.PHONY: test
+test:
+ @echo "Testing ddk..."
+ @for lang in c c++ objective-c ; do \
+ echo "$$lang..."; \
+ $(CC) -x$$lang $(TEST_OPTIONS) ; \
+ echo "$$lang UNICODE..."; \
+ $(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
+ done
+ @echo "windres..."
+ @$(WINDRES) --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
+ @echo "windres UNICODE..."
+ @$(WINDRES) --define UNICODE --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
+ @rm -f test.o
+
+# make rules
+
+.SUFFIXES: .c .o .def .a
+
+.c.o:
+ $(CC) -c $(ALL_CFLAGS) -o $@ $<
+
+lib%.a : %.def %.o
+ $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
+ $(AR) r $@ $*.o
+ $(RANLIB) $@
+
+lib%.a: %.def
+ $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
+
+lib%.a: %.o
+ $(AR) rc $@ $*.o
+ $(RANLIB) $@
+
+# install headers and libraries in a target specified directory.
+install: install-libraries install-headers
+
+install-libraries: all
+ $(mkinstalldirs) $(inst_libdir)
+ for i in $(LIBS); do \
+ $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
+ done
+
+install-headers:
+ $(mkinstalldirs) $(inst_includedir)
+ for i in $(HEADERS); do \
+ $(INSTALL_DATA) $(srcdir)/../../ddk/include/$$i $(inst_includedir)/$$i ; \
+ done
+
+# uninstall headers and libraries from a target specified directory
+uninstall: uninstall-libraries uninstall-headers
+
+uninstall-libraries:
+ @for i in $(LIBS); do \
+ rm -f $(inst_libdir)/$$i ; \
+ done
+ rmdir $(inst_libdir)
+
+uninstall-headers:
+ @for i in $(HEADERS); do \
+ rm -r $(inst_includedir)/$$i ; \
+ done
+ rmdir $(inst_includedir)
+
+
+dist:
+ mkdir $(distdir)/include
+ chmod 755 $(distdir)/include
+ @for i in $(HEADERS); do \
+ cp -p $(srcdir)/../../ddk/include/$$i $(distdir)/include/ddk/$$i ; \
+ done
+ mkdir $(distdir)/lib
+ chmod 755 $(distdir)/lib
+ @for i in $(DISTFILES); do \
+ cp -p $(srcdir)/$$i $(distdir)/lib/$$i ; \
+ done
+
+Makefile: Makefile.in ../../config.status ../../configure
+ cd ../..; $(SHELL) config.status
+
+# clean
+
+mostlyclean:
+ rm -f *~ *.o *.s
+
+clean:
+ rm -f *.o *.a *.s *~
+
+distclean: clean
+ rm -f config.cache config.status config.log Makefile
+
+maintainer-clean: distclean
--- /dev/null
+LIBRARY apcups.dll
+EXPORTS
+UPSCancelWait@0
+UPSGetState@0
+UPSInit@0
+UPSStop@0
+UPSTurnOff@4
+UPSWaitForStateChange@8
--- /dev/null
+LIBRARY cfgmgr32.dll
+EXPORTS
+;CMP_Init_Detection
+;CMP_RegisterNotification
+;CMP_Report_LogOn
+;CMP_UnregisterNotification
+CMP_WaitNoPendingInstallEvents@4
+;CMP_WaitServicesAvailable
+CM_Add_Empty_Log_Conf@16
+CM_Add_Empty_Log_Conf_Ex@20
+CM_Add_IDA@16
+CM_Add_IDW@16
+CM_Add_ID_ExA@16
+CM_Add_ID_ExW@16
+;CM_Add_Range
+CM_Add_Res_Des@24
+CM_Add_Res_Des_Ex@28
+CM_Connect_MachineA@8
+CM_Connect_MachineW@8
+;CM_Create_DevNodeA
+;CM_Create_DevNodeW
+;CM_Create_DevNode_ExA
+;CM_Create_DevNode_ExW
+;CM_Create_Range_List
+;CM_Delete_Class_Key
+;CM_Delete_Class_Key_Ex
+;CM_Delete_DevNode_Key
+;CM_Delete_DevNode_Key_Ex
+;CM_Delete_Range
+;CM_Detect_Resource_Conflict
+;CM_Detect_Resource_Conflict_Ex
+;CM_Disable_DevNode
+;CM_Disable_DevNode_Ex
+CM_Disconnect_Machine@4
+;CM_Dup_Range_List
+;CM_Enable_DevNode
+;CM_Enable_DevNode_Ex
+CM_Enumerate_Classes@12
+CM_Enumerate_Classes_Ex@16
+CM_Enumerate_EnumeratorsA@16
+CM_Enumerate_EnumeratorsW@16
+CM_Enumerate_Enumerators_ExA@20
+CM_Enumerate_Enumerators_ExW@20
+;CM_Find_Range
+;CM_First_Range
+CM_Free_Log_Conf@8
+CM_Free_Log_Conf_Ex@12
+CM_Free_Log_Conf_Handle@4
+;CM_Free_Range_List
+CM_Free_Res_Des@12
+CM_Free_Res_Des_Ex@16
+CM_Free_Res_Des_Handle@4
+CM_Free_Resource_Conflict_Handle@4
+CM_Get_Child@12
+CM_Get_Child_Ex@16
+;CM_Get_Class_Key_NameA
+;CM_Get_Class_Key_NameW
+;CM_Get_Class_Key_Name_ExA
+;CM_Get_Class_Key_Name_ExW
+;CM_Get_Class_NameA
+;CM_Get_Class_NameW
+;CM_Get_Class_Name_ExA
+;CM_Get_Class_Name_ExW
+;CM_Get_Class_Registry_PropertyA
+;CM_Get_Class_Registry_PropertyW
+CM_Get_Depth@12
+CM_Get_Depth_Ex@16
+;CM_Get_DevNode_Registry_PropertyA
+;CM_Get_DevNode_Registry_PropertyW
+;CM_Get_DevNode_Registry_Property_ExA
+;CM_Get_DevNode_Registry_Property_ExW
+CM_Get_DevNode_Status@16
+CM_Get_DevNode_Status_Ex@20
+CM_Get_Device_IDA@16
+CM_Get_Device_IDW@16
+CM_Get_Device_ID_ExA@20
+CM_Get_Device_ID_ExW@20
+CM_Get_Device_ID_ListA@16
+CM_Get_Device_ID_ListW@16
+CM_Get_Device_ID_List_ExA@20
+CM_Get_Device_ID_List_ExW@20
+CM_Get_Device_ID_List_SizeA@12
+CM_Get_Device_ID_List_SizeW@12
+CM_Get_Device_ID_List_Size_ExA@16
+CM_Get_Device_ID_List_Size_ExW@16
+CM_Get_Device_ID_Size@12
+CM_Get_Device_ID_Size_Ex@16
+;CM_Get_Device_Interface_AliasA
+;CM_Get_Device_Interface_AliasW
+;CM_Get_Device_Interface_Alias_ExA
+;CM_Get_Device_Interface_Alias_ExW
+;CM_Get_Device_Interface_ListA
+;CM_Get_Device_Interface_ListW
+;CM_Get_Device_Interface_List_ExA
+;CM_Get_Device_Interface_List_ExW
+;CM_Get_Device_Interface_List_SizeA
+;CM_Get_Device_Interface_List_SizeW
+;CM_Get_Device_Interface_List_Size_ExA
+;CM_Get_Device_Interface_List_Size_ExW
+CM_Get_First_Log_Conf@12
+CM_Get_First_Log_Conf_Ex@16
+;CM_Get_Global_State
+;CM_Get_Global_State_Ex
+;CM_Get_HW_Prof_FlagsA
+;CM_Get_HW_Prof_FlagsW
+;CM_Get_HW_Prof_Flags_ExA
+;CM_Get_HW_Prof_Flags_ExW
+;CM_Get_Hardware_Profile_InfoA
+;CM_Get_Hardware_Profile_InfoW
+;CM_Get_Hardware_Profile_Info_ExA
+;CM_Get_Hardware_Profile_Info_ExW
+CM_Get_Log_Conf_Priority@12
+CM_Get_Log_Conf_Priority_Ex@16
+CM_Get_Next_Log_Conf@12
+CM_Get_Next_Log_Conf_Ex@16
+CM_Get_Next_Res_Des@20
+CM_Get_Next_Res_Des_Ex@24
+CM_Get_Parent@12
+CM_Get_Parent_Ex@16
+CM_Get_Res_Des_Data@16
+CM_Get_Res_Des_Data_Ex@20
+CM_Get_Res_Des_Data_Size@12
+CM_Get_Res_Des_Data_Size_Ex@16
+CM_Get_Resource_Conflict_Count@8
+CM_Get_Resource_Conflict_DetailsA@12
+CM_Get_Resource_Conflict_DetailsW@12
+CM_Get_Sibling@12
+CM_Get_Sibling_Ex@16
+CM_Get_Version@0
+CM_Get_Version_Ex@4
+;CM_Intersect_Range_List
+;CM_Invert_Range_List
+;CM_Is_Dock_Station_Present
+;CM_Is_Dock_Station_Present_Ex
+CM_Locate_DevNodeA@12
+CM_Locate_DevNodeW@12
+CM_Locate_DevNode_ExA@16
+CM_Locate_DevNode_ExW@16
+;CM_Merge_Range_List
+CM_Modify_Res_Des@24
+CM_Modify_Res_Des_Ex@28
+;CM_Move_DevNode
+;CM_Move_DevNode_Ex
+;CM_Next_Range
+;CM_Open_Class_KeyA
+;CM_Open_Class_KeyW
+;CM_Open_Class_Key_ExA
+;CM_Open_Class_Key_ExW
+;CM_Open_DevNode_Key
+;CM_Open_DevNode_Key_Ex
+CM_Query_And_Remove_SubTreeA@20
+CM_Query_And_Remove_SubTreeW@20
+CM_Query_And_Remove_SubTree_ExA@0
+CM_Query_And_Remove_SubTree_ExW@0
+;CM_Query_Arbitrator_Free_Data
+;CM_Query_Arbitrator_Free_Data_Ex
+;CM_Query_Arbitrator_Free_Size
+;CM_Query_Arbitrator_Free_Size_Ex
+;CM_Query_Remove_SubTree
+;CM_Query_Remove_SubTree_Ex
+CM_Query_Resource_Conflict_List@28
+CM_Reenumerate_DevNode@8
+CM_Reenumerate_DevNode_Ex@12
+;CM_Register_Device_Driver
+;CM_Register_Device_Driver_Ex
+;CM_Register_Device_InterfaceA
+;CM_Register_Device_InterfaceW
+;CM_Register_Device_Interface_ExA
+;CM_Register_Device_Interface_ExW
+;CM_Remove_SubTree
+;CM_Remove_SubTree_Ex
+;CM_Request_Eject_PC
+;CM_Request_Eject_PC_Ex
+;CM_Run_Detection
+;CM_Run_Detection_Ex
+;CM_Set_Class_Registry_PropertyA
+;CM_Set_Class_Registry_PropertyW
+;CM_Set_DevNode_Problem
+;CM_Set_DevNode_Problem_Ex
+;CM_Set_DevNode_Registry_PropertyA
+;CM_Set_DevNode_Registry_PropertyW
+;CM_Set_DevNode_Registry_Property_ExA
+;CM_Set_DevNode_Registry_Property_ExW
+;CM_Set_HW_Prof
+;CM_Set_HW_Prof_Ex
+;CM_Set_HW_Prof_FlagsA
+;CM_Set_HW_Prof_FlagsW
+;CM_Set_HW_Prof_Flags_ExA
+;CM_Set_HW_Prof_Flags_ExW
+;CM_Setup_DevNode
+;CM_Setup_DevNode_Ex
+;CM_Test_Range_Available
+;CM_Uninstall_DevNode
+;CM_Uninstall_DevNode_Ex
+;CM_Unregister_Device_InterfaceA
+;CM_Unregister_Device_InterfaceW
+;CM_Unregister_Device_Interface_ExA
+;CM_Unregister_Device_Interface_ExW
+;CMP_Init_Detection
+;CMP_RegisterNotification
+;CMP_Report_LogOn
+;CMP_UnregisterNotification
+CMP_WaitNoPendingInstallEvents@4
+;CMP_WaitServicesAvailable
+CM_Add_Empty_Log_Conf@16
+CM_Add_Empty_Log_Conf_Ex@20
+CM_Add_IDA@16
+CM_Add_IDW@16
+CM_Add_ID_ExA@16
+CM_Add_ID_ExW@16
+;CM_Add_Range
+CM_Add_Res_Des@24
+CM_Add_Res_Des_Ex@28
+CM_Connect_MachineA@8
+CM_Connect_MachineW@8
+;CM_Create_DevNodeA
+;CM_Create_DevNodeW
+;CM_Create_DevNode_ExA
+;CM_Create_DevNode_ExW
+;CM_Create_Range_List
+;CM_Delete_Class_Key
+;CM_Delete_Class_Key_Ex
+;CM_Delete_DevNode_Key
+;CM_Delete_DevNode_Key_Ex
+;CM_Delete_Range
+;CM_Detect_Resource_Conflict
+;CM_Detect_Resource_Conflict_Ex
+;CM_Disable_DevNode
+;CM_Disable_DevNode_Ex
+CM_Disconnect_Machine@4
+;CM_Dup_Range_List
+;CM_Enable_DevNode
+;CM_Enable_DevNode_Ex
+CM_Enumerate_Classes@12
+CM_Enumerate_Classes_Ex@16
+CM_Enumerate_EnumeratorsA@16
+CM_Enumerate_EnumeratorsW@16
+CM_Enumerate_Enumerators_ExA@20
+CM_Enumerate_Enumerators_ExW@20
+;CM_Find_Range
+;CM_First_Range
+CM_Free_Log_Conf@8
+CM_Free_Log_Conf_Ex@12
+CM_Free_Log_Conf_Handle@4
+;CM_Free_Range_List
+CM_Free_Res_Des@12
+CM_Free_Res_Des_Ex@16
+CM_Free_Res_Des_Handle@4
+CM_Free_Resource_Conflict_Handle@4
+CM_Get_Child@12
+CM_Get_Child_Ex@16
+;CM_Get_Class_Key_NameA
+;CM_Get_Class_Key_NameW
+;CM_Get_Class_Key_Name_ExA
+;CM_Get_Class_Key_Name_ExW
+;CM_Get_Class_NameA
+;CM_Get_Class_NameW
+;CM_Get_Class_Name_ExA
+;CM_Get_Class_Name_ExW
+;CM_Get_Class_Registry_PropertyA
+;CM_Get_Class_Registry_PropertyW
+CM_Get_Depth@12
+CM_Get_Depth_Ex@16
+;CM_Get_DevNode_Registry_PropertyA
+;CM_Get_DevNode_Registry_PropertyW
+;CM_Get_DevNode_Registry_Property_ExA
+;CM_Get_DevNode_Registry_Property_ExW
+CM_Get_DevNode_Status@16
+CM_Get_DevNode_Status_Ex@20
+CM_Get_Device_IDA@16
+CM_Get_Device_IDW@16
+CM_Get_Device_ID_ExA@20
+CM_Get_Device_ID_ExW@20
+CM_Get_Device_ID_ListA@16
+CM_Get_Device_ID_ListW@16
+CM_Get_Device_ID_List_ExA@20
+CM_Get_Device_ID_List_ExW@20
+CM_Get_Device_ID_List_SizeA@12
+CM_Get_Device_ID_List_SizeW@12
+CM_Get_Device_ID_List_Size_ExA@16
+CM_Get_Device_ID_List_Size_ExW@16
+CM_Get_Device_ID_Size@12
+CM_Get_Device_ID_Size_Ex@16
+;CM_Get_Device_Interface_AliasA
+;CM_Get_Device_Interface_AliasW
+;CM_Get_Device_Interface_Alias_ExA
+;CM_Get_Device_Interface_Alias_ExW
+;CM_Get_Device_Interface_ListA
+;CM_Get_Device_Interface_ListW
+;CM_Get_Device_Interface_List_ExA
+;CM_Get_Device_Interface_List_ExW
+;CM_Get_Device_Interface_List_SizeA
+;CM_Get_Device_Interface_List_SizeW
+;CM_Get_Device_Interface_List_Size_ExA
+;CM_Get_Device_Interface_List_Size_ExW
+CM_Get_First_Log_Conf@12
+CM_Get_First_Log_Conf_Ex@16
+;CM_Get_Global_State
+;CM_Get_Global_State_Ex
+;CM_Get_HW_Prof_FlagsA
+;CM_Get_HW_Prof_FlagsW
+;CM_Get_HW_Prof_Flags_ExA
+;CM_Get_HW_Prof_Flags_ExW
+;CM_Get_Hardware_Profile_InfoA
+;CM_Get_Hardware_Profile_InfoW
+;CM_Get_Hardware_Profile_Info_ExA
+;CM_Get_Hardware_Profile_Info_ExW
+CM_Get_Log_Conf_Priority@12
+CM_Get_Log_Conf_Priority_Ex@16
+CM_Get_Next_Log_Conf@12
+CM_Get_Next_Log_Conf_Ex@16
+CM_Get_Next_Res_Des@20
+CM_Get_Next_Res_Des_Ex@24
+CM_Get_Parent@12
+CM_Get_Parent_Ex@16
+CM_Get_Res_Des_Data@16
+CM_Get_Res_Des_Data_Ex@20
+CM_Get_Res_Des_Data_Size@12
+CM_Get_Res_Des_Data_Size_Ex@16
+CM_Get_Resource_Conflict_Count@8
+CM_Get_Resource_Conflict_DetailsA@12
+CM_Get_Resource_Conflict_DetailsW@12
+CM_Get_Sibling@12
+CM_Get_Sibling_Ex@16
+CM_Get_Version@0
+CM_Get_Version_Ex@4
+;CM_Intersect_Range_List
+;CM_Invert_Range_List
+;CM_Is_Dock_Station_Present
+;CM_Is_Dock_Station_Present_Ex
+CM_Locate_DevNodeA@12
+CM_Locate_DevNodeW@12
+CM_Locate_DevNode_ExA@16
+CM_Locate_DevNode_ExW@16
+;CM_Merge_Range_List
+CM_Modify_Res_Des@24
+CM_Modify_Res_Des_Ex@28
+;CM_Move_DevNode
+;CM_Move_DevNode_Ex
+;CM_Next_Range
+;CM_Open_Class_KeyA
+;CM_Open_Class_KeyW
+;CM_Open_Class_Key_ExA
+;CM_Open_Class_Key_ExW
+;CM_Open_DevNode_Key
+;CM_Open_DevNode_Key_Ex
+CM_Query_And_Remove_SubTreeA@20
+CM_Query_And_Remove_SubTreeW@20
+CM_Query_And_Remove_SubTree_ExA@0
+CM_Query_And_Remove_SubTree_ExW@0
+;CM_Query_Arbitrator_Free_Data
+;CM_Query_Arbitrator_Free_Data_Ex
+;CM_Query_Arbitrator_Free_Size
+;CM_Query_Arbitrator_Free_Size_Ex
+;CM_Query_Remove_SubTree
+;CM_Query_Remove_SubTree_Ex
+CM_Query_Resource_Conflict_List@28
+CM_Reenumerate_DevNode@8
+CM_Reenumerate_DevNode_Ex@12
+;CM_Register_Device_Driver
+;CM_Register_Device_Driver_Ex
+;CM_Register_Device_InterfaceA
+;CM_Register_Device_InterfaceW
+;CM_Register_Device_Interface_ExA
+;CM_Register_Device_Interface_ExW
+;CM_Remove_SubTree
+;CM_Remove_SubTree_Ex
+;CM_Request_Eject_PC
+;CM_Request_Eject_PC_Ex
+;CM_Run_Detection
+;CM_Run_Detection_Ex
+;CM_Set_Class_Registry_PropertyA
+;CM_Set_Class_Registry_PropertyW
+;CM_Set_DevNode_Problem
+;CM_Set_DevNode_Problem_Ex
+;CM_Set_DevNode_Registry_PropertyA
+;CM_Set_DevNode_Registry_PropertyW
+;CM_Set_DevNode_Registry_Property_ExA
+;CM_Set_DevNode_Registry_Property_ExW
+;CM_Set_HW_Prof
+;CM_Set_HW_Prof_Ex
+;CM_Set_HW_Prof_FlagsA
+;CM_Set_HW_Prof_FlagsW
+;CM_Set_HW_Prof_Flags_ExA
+;CM_Set_HW_Prof_Flags_ExW
+;CM_Setup_DevNode
+;CM_Setup_DevNode_Ex
+;CM_Test_Range_Available
+;CM_Uninstall_DevNode
+;CM_Uninstall_DevNode_Ex
+;CM_Unregister_Device_InterfaceA
+;CM_Unregister_Device_InterfaceW
+;CM_Unregister_Device_Interface_ExA
+;CM_Unregister_Device_Interface_ExW
--- /dev/null
+LIBRARY dxapi.sys
+EXPORTS
+;_DxApi@20
+;_DxApiGetVersion@0
+;_DxApiInitialize@32
+;_DxAutoflipUpdate@20
+;_DxEnableIRQ@8
+;_DxLoseObject@8
+;_DxUpdateCapture@12
--- /dev/null
+LIBRARY hal.dll
+EXPORTS
+@ExAcquireFastMutex@4
+@ExReleaseFastMutex@4
+@ExTryToAcquireFastMutex@4
+;HalAcquireDisplayOwnership
+;HalAdjustResourceList
+;HalAllProcessorsStarted
+;HalAllocateAdapterChannel
+HalAllocateCommonBuffer@16
+;HalAllocateCrashDumpRegisters
+HalAssignSlotResources@32
+;HalBeginSystemInterrupt
+;HalCalibratePerformanceCounter
+;HalClearSoftwareInterrupt
+;HalDisableSystemInterrupt
+;HalDisplayString
+;HalEnableSystemInterrupt
+;HalEndSystemInterrupt
+;HalFlushCommonBuffer
+HalFreeCommonBuffer@20
+HalGetAdapter@8
+HalGetBusData@20
+HalGetBusDataByOffset@24
+;HalGetEnvironmentVariable
+HalGetInterruptVector@24
+;HalHandleNMI
+;HalInitSystem
+;HalInitializeProcessor
+;HalMakeBeep
+;HalProcessorIdle
+;HalQueryDisplayParameters
+;HalQueryRealTimeClock
+HalReadDmaCounter@4
+;HalReportResourceUsage
+;HalRequestIpi
+;HalRequestSoftwareInterrupt
+;HalReturnToFirmware
+HalSetBusData@20
+HalSetBusDataByOffset@24
+;HalSetDisplayParameters
+;HalSetEnvironmentVariable
+;HalSetProfileInterval
+;HalSetRealTimeClock
+;HalSetTimeIncrement
+;HalStartNextProcessor
+;HalStartProfileInterrupt
+;HalStopProfileInterrupt
+;HalSystemVectorDispatchEntry
+HalTranslateBusAddress@20
+;IoAssignDriveLetters
+IoFlushAdapterBuffers@24
+IoFreeAdapterChannel@4
+IoFreeMapRegisters@12
+IoMapTransfer@24
+IoReadPartitionTable@16
+IoSetPartitionInformation@16
+IoWritePartitionTable@20
+;KdComPortInUse DATA
+@KeAcquireInStackQueuedSpinLock@8
+;KeAcquireInStackQueuedSpinLockRaiseToSynch
+;KeAcquireQueuedSpinLock
+;KeAcquireQueuedSpinLockRaiseToSynch
+KeAcquireSpinLock@8
+;KeAcquireSpinLockRaiseToSynch
+;KeFlushWriteBuffer
+KeGetCurrentIrql@0
+KeLowerIrql@4
+KeQueryPerformanceCounter@4
+KeRaiseIrql@8
+KeRaiseIrqlToDpcLevel@0
+;KeRaiseIrqlToSynchLevel
+@KeReleaseInStackQueuedSpinLock@4
+;KeReleaseQueuedSpinLock
+KeReleaseSpinLock@8
+KeStallExecutionProcessor@4
+;KeTryToAcquireQueuedSpinLock
+;KeTryToAcquireQueuedSpinLockRaiseToSynch
+;KfAcquireSpinLock
+;KfLowerIrql
+;KfRaiseIrql
+;KfReleaseSpinLock
+READ_PORT_BUFFER_UCHAR@12
+READ_PORT_BUFFER_ULONG@12
+READ_PORT_BUFFER_USHORT@12
+READ_PORT_UCHAR@4
+READ_PORT_ULONG@4
+READ_PORT_USHORT@4
+WRITE_PORT_BUFFER_UCHAR@12
+WRITE_PORT_BUFFER_ULONG@12
+WRITE_PORT_BUFFER_USHORT@12
+WRITE_PORT_UCHAR@8
+WRITE_PORT_ULONG@8
+WRITE_PORT_USHORT@8
--- /dev/null
+LIBRARY hid.dll
+EXPORTS
+;HidD_FlushQueue
+;HidD_FreePreparsedData
+;HidD_GetAttributes
+;HidD_GetConfiguration
+;HidD_GetFeature
+;HidD_GetHidGuid
+;HidD_GetIndexedString
+;HidD_GetInputReport
+;HidD_GetManufacturerString
+;HidD_GetMsGenreDescriptor
+;HidD_GetNumInputBuffers
+;HidD_GetPhysicalDescriptor
+;HidD_GetPreparsedData
+;HidD_GetProductString
+;HidD_GetSerialNumberString
+;HidD_Hello
+;HidD_SetConfiguration
+;HidD_SetFeature
+;HidD_SetNumInputBuffers
+;HidD_SetOutputReport
+;HidP_GetButtonCaps
+HidP_GetCaps@8
+HidP_GetData@24
+HidP_GetExtendedAttributes@20
+HidP_GetLinkCollectionNodes@12
+HidP_GetScaledUsageValue@32
+HidP_GetSpecificButtonCaps@28
+HidP_GetSpecificValueCaps@28
+HidP_GetUsageValue@32
+HidP_GetUsageValueArray@36
+HidP_GetUsages@32
+HidP_GetUsagesEx@28
+;HidP_GetValueCaps
+HidP_InitializeReportForID@20
+HidP_MaxDataListLength@8
+HidP_MaxUsageListLength@12
+HidP_SetData@24
+HidP_SetScaledUsageValue@32
+HidP_SetUsageValue@32
+HidP_SetUsageValueArray@36
+HidP_SetUsages@32
+HidP_TranslateUsagesToI8042ScanCodes@24
+HidP_UnsetUsages@32
+HidP_UsageListDifference@20
+;HidservInstaller
--- /dev/null
+LIBRARY hidparse.sys
+EXPORTS
+;HidP_FreeCollectionDescription
+;HidP_GetButtonCaps
+HidP_GetCaps@8
+;HidP_GetCollectionDescription
+HidP_GetData@24
+HidP_GetExtendedAttributes@20
+HidP_GetLinkCollectionNodes@12
+HidP_GetScaledUsageValue@32
+HidP_GetSpecificButtonCaps@28
+HidP_GetSpecificValueCaps@28
+HidP_GetUsageValue@32
+HidP_GetUsageValueArray@36
+HidP_GetUsages@32
+HidP_GetUsagesEx@28
+;HidP_GetValueCaps
+HidP_InitializeReportForID@20
+HidP_MaxDataListLength@8
+HidP_MaxUsageListLength@12
+HidP_SetData@24
+HidP_SetScaledUsageValue@32
+HidP_SetUsageValue@32
+HidP_SetUsageValueArray@36
+HidP_SetUsages@32
+;HidP_SysPowerCaps
+;HidP_SysPowerEvent
+HidP_TranslateUsageAndPagesToI8042ScanCodes@24
+HidP_TranslateUsagesToI8042ScanCodes@24
+HidP_UnsetUsages@32
+HidP_UsageAndPageListDifference@20
+HidP_UsageListDifference@20
--- /dev/null
+LIBRARY mcd.sys
+EXPORTS
+ChangerClassAllocatePool@8
+ChangerClassDebugPrint@8
+ChangerClassFreePool@4
+ChangerClassInitialize@12
+ChangerClassSendSrbSynchronous@20
--- /dev/null
+LIBRARY ndis.sys
+EXPORTS
+;ArcFilterDprIndicateReceive
+;ArcFilterDprIndicateReceiveComplete
+;EthFilterDprIndicateReceive
+;EthFilterDprIndicateReceiveComplete
+;FddiFilterDprIndicateReceive
+;FddiFilterDprIndicateReceiveComplete
+NDIS_BUFFER_TO_SPAN_PAGES@4
+NdisAcquireReadWriteLock@12
+;NdisAcquireSpinLock
+NdisAdjustBufferLength@8
+NdisAllocateBuffer@20
+NdisAllocateBufferPool@12
+;NdisAllocateFromBlockPool
+NdisAllocateMemory@16
+NdisAllocateMemoryWithTag@12
+NdisAllocatePacket@12
+NdisAllocatePacketPool@16
+NdisAllocatePacketPoolEx@20
+;NdisAllocateSpinLock
+NdisAnsiStringToUnicodeString@8
+NdisBufferLength@4
+NdisBufferVirtualAddress@4
+;NdisCancelSendPackets
+;NdisCancelTimer
+NdisClAddParty@16
+NdisClCloseAddressFamily@4
+NdisClCloseCall@16
+NdisClDeregisterSap@4
+NdisClDropParty@12
+;NdisClGetProtocolVcContextFromTapiCallId
+NdisClIncomingCallComplete@12
+NdisClMakeCall@16
+NdisClModifyCallQoS@8
+NdisClOpenAddressFamily@24
+NdisClRegisterSap@16
+NdisCloseAdapter@8
+NdisCloseConfiguration@4
+;NdisCloseFile
+NdisCmActivateVc@8
+NdisCmAddPartyComplete@16
+NdisCmCloseAddressFamilyComplete@8
+NdisCmCloseCallComplete@12
+NdisCmDeactivateVc@4
+NdisCmDeregisterSapComplete@8
+NdisCmDispatchCallConnected@4
+NdisCmDispatchIncomingCall@12
+NdisCmDispatchIncomingCallQoSChange@8
+NdisCmDispatchIncomingCloseCall@16
+NdisCmDispatchIncomingDropParty@16
+NdisCmDropPartyComplete@8
+NdisCmMakeCallComplete@20
+NdisCmModifyCallQoSComplete@12
+NdisCmOpenAddressFamilyComplete@12
+NdisCmRegisterAddressFamily@16
+NdisCmRegisterSapComplete@12
+;NdisCoAssignInstanceName
+NdisCoCreateVc@16
+NdisCoDeleteVc@4
+;NdisCoGetTapiCallId
+NdisCoRequest@20
+NdisCoRequestComplete@20
+NdisCoSendPackets@12
+;NdisCompareAnsiString DATA
+;NdisCompareUnicodeString DATA
+NdisCompleteBindAdapter@12
+;NdisCompleteDmaTransfer
+NdisCompletePnPEvent@12
+NdisCompleteUnbindAdapter@8
+;NdisConvertStringToAtmAddress
+NdisCopyBuffer@24
+NdisCopyFromPacketToPacket@24
+;NdisCopyFromPacketToPacketSafe
+;NdisCreateBlockPool
+NdisDeregisterProtocol@8
+;NdisDestroyBlockPool
+;NdisDprAcquireSpinLock
+NdisDprAllocatePacket@12
+NdisDprAllocatePacketNonInterlocked@12
+NdisDprFreePacket@4
+NdisDprFreePacketNonInterlocked@4
+;NdisDprReleaseSpinLock
+;NdisEqualString DATA
+NdisFreeBuffer@4
+NdisFreeBufferPool@4
+NdisFreeMemory@12
+NdisFreePacket@4
+NdisFreePacketPool@4
+;NdisFreeSpinLock
+;NdisFreeToBlockPool
+;NdisGeneratePartialCancelId
+NdisGetBufferPhysicalArraySize@8
+NdisGetCurrentProcessorCounts@12
+NdisGetCurrentProcessorCpuUsage@4
+;NdisGetCurrentSystemTime
+NdisGetDriverHandle@8
+NdisGetFirstBufferFromPacket@20
+;NdisGetFirstBufferFromPacketSafe
+;NdisGetPacketCancelId
+;NdisGetPoolFromPacket
+NdisGetReceivedPacket@8
+;NdisGetRoutineAddress
+;NdisGetSharedDataAlignment
+NdisGetSystemUpTime@4
+;NdisGetVersion
+NdisIMAssociateMiniport@8
+NdisIMCancelInitializeDeviceInstance@8
+NdisIMCopySendCompletePerPacketInfo@8
+NdisIMCopySendPerPacketInfo@8
+NdisIMDeInitializeDeviceInstance@4
+NdisIMDeregisterLayeredMiniport@4
+NdisIMGetBindingContext@4
+;NdisIMGetCurrentPacketStack
+NdisIMGetDeviceContext@4
+;NdisIMInitializeDeviceInstance
+NdisIMInitializeDeviceInstanceEx@12
+;NdisIMNotifyPnPEvent
+;NdisIMQueueMiniportCallback
+NdisIMRegisterLayeredMiniport@16
+;NdisIMRevertBack
+;NdisIMSwitchToMiniport
+;NdisImmediateReadPciSlotInformation
+;NdisImmediateReadPortUchar
+;NdisImmediateReadPortUlong
+;NdisImmediateReadPortUshort
+NdisImmediateReadSharedMemory@16
+;NdisImmediateWritePciSlotInformation
+;NdisImmediateWritePortUchar
+;NdisImmediateWritePortUlong
+;NdisImmediateWritePortUshort
+NdisImmediateWriteSharedMemory@16
+;NdisInitAnsiString DATA
+;NdisInitUnicodeString DATA
+;NdisInitializeEvent
+NdisInitializeReadWriteLock@4
+;NdisInitializeString
+;NdisInitializeTimer
+NdisInitializeWrapper@16
+;NdisInterlockedAddLargeInterger DATA
+;NdisInterlockedAddUlong
+;NdisInterlockedDecrement
+;NdisInterlockedIncrement
+;NdisInterlockedInsertHeadList
+;NdisInterlockedInsertTailList
+;NdisInterlockedPopEntryList
+;NdisInterlockedPushEntryList
+;NdisInterlockedRemoveHeadList
+NdisMAllocateMapRegisters@20
+NdisMAllocateSharedMemory@20
+NdisMAllocateSharedMemoryAsync@16
+;NdisMCancelTimer
+NdisMCloseLog@4
+NdisMCmActivateVc@8
+NdisMCmCreateVc@16
+NdisMCmDeactivateVc@4
+NdisMCmDeleteVc@4
+NdisMCmRegisterAddressFamily@16
+NdisMCmRequest@16
+NdisMCoActivateVcComplete@12
+NdisMCoDeactivateVcComplete@8
+NdisMCoIndicateReceivePacket@12
+NdisMCoIndicateStatus@20
+NdisMCoReceiveComplete@4
+NdisMCoRequestComplete@12
+NdisMCoSendComplete@12
+;NdisMCompleteBufferPhysicalMapping
+NdisMCreateLog@12
+NdisMDeregisterAdapterShutdownHandler@4
+NdisMDeregisterDevice@4
+;NdisMDeregisterDmaChannel
+NdisMDeregisterInterrupt@4
+NdisMDeregisterIoPortRange@16
+NdisMFlushLog@4
+NdisMFreeMapRegisters@4
+NdisMFreeSharedMemory@20
+NdisMGetDeviceProperty@24
+;NdisMGetDmaAlignment
+;NdisMIndicateStatus
+;NdisMIndicateStatusComplete
+NdisMInitializeScatterGatherDma@12
+;NdisMInitializeTimer
+NdisMMapIoSpace@16
+;NdisMPciAssignResources
+NdisMPromoteMiniport@4
+NdisMQueryAdapterInstanceName@8
+NdisMQueryAdapterResources@16
+;NdisMQueryInformationComplete
+;NdisMReadDmaCounter
+NdisMRegisterAdapterShutdownHandler@12
+NdisMRegisterDevice@24
+;NdisMRegisterDmaChannel
+NdisMRegisterInterrupt@28
+NdisMRegisterIoPortRange@16
+NdisMRegisterMiniport@12
+NdisMRegisterUnloadHandler@8
+NdisMRemoveMiniport@4
+;NdisMResetComplete
+;NdisMSendComplete
+;NdisMSendResourcesAvailable
+;NdisMSetAttributes
+NdisMSetAttributesEx@20
+;NdisMSetInformationComplete
+NdisMSetMiniportSecondary@8
+;NdisMSetPeriodicTimer
+;NdisMSetTimer
+NdisMSleep@4
+;NdisMStartBufferPhysicalMapping
+NdisMSynchronizeWithInterrupt@12
+;NdisMTransferDataComplete
+NdisMUnmapIoSpace@12
+NdisMWanIndicateReceive@20
+NdisMWanIndicateReceiveComplete@4
+NdisMWanSendComplete@12
+NdisMWriteLogData@12
+;NdisMapFile
+;NdisMatchPdoWithPacket
+NdisOpenAdapter@44
+NdisOpenConfiguration@12
+NdisOpenConfigurationKeyByIndex@20
+NdisOpenConfigurationKeyByName@16
+;NdisOpenFile
+NdisOpenProtocolConfiguration@12
+;NdisOverrideBusNumber
+NdisPacketPoolUsage@4
+;NdisPacketSize
+NdisQueryAdapterInstanceName@8
+;NdisQueryBindInstanceName
+NdisQueryBuffer@12
+NdisQueryBufferOffset@12
+NdisQueryBufferSafe@16
+;NdisQueryMapRegisterCount
+;NdisQueryPendingIOCount
+;NdisReEnumerateProtocolBindings
+NdisReadConfiguration@20
+NdisReadEisaSlotInformation@16
+NdisReadEisaSlotInformationEx@20
+;NdisReadMcaPosInformation
+NdisReadNetworkAddress@16
+NdisReadPciSlotInformation@20
+NdisReadPcmciaAttributeMemory@16
+NdisRegisterProtocol@16
+;NdisRegisterTdiCallBack
+NdisReleaseReadWriteLock@8
+;NdisReleaseSpinLock
+NdisRequest@12
+NdisReset@8
+;NdisResetEvent
+NdisReturnPackets@8
+;NdisScheduleWorkItem
+NdisSend@12
+NdisSendPackets@12
+;NdisSetEvent
+;NdisSetPacketCancelId
+;NdisSetPacketPoolProtocolId
+;NdisSetPacketStatus
+;NdisSetProtocolFilter
+;NdisSetTimer
+;NdisSetTimerEx
+NdisSetupDmaTransfer@24
+;NdisSystemProcessorCount
+NdisTerminateWrapper@8
+NdisTransferData@28
+NdisUnchainBufferAtBack@8
+NdisUnchainBufferAtFront@8
+NdisUnicodeStringToAnsiString@8
+;NdisUnmapFile
+NdisUpcaseUnicodeString@8
+NdisUpdateSharedMemory@16
+;NdisWaitEvent
+NdisWriteConfiguration@16
+NdisWriteErrorLogEntry
+NdisWriteEventLogEntry@28
+NdisWritePciSlotInformation@20
+NdisWritePcmciaAttributeMemory@16
+;TrFilterDprIndicateReceive
+;TrFilterDprIndicateReceiveComplete
--- /dev/null
+LIBRARY ntoskrnl.exe
+EXPORTS
+;CcCanIWrite
+;CcCopyRead
+;CcCopyWrite
+;CcDeferWrite
+;CcFastCopyRead
+;CcFastCopyWrite
+;CcFastMdlReadWait
+;CcFastReadNotPossible
+;CcFastReadWait
+;CcFlushCache
+;CcGetDirtyPages
+;CcGetFileObjectFromBcb
+;CcGetFileObjectFromSectionPtrs
+;CcGetFlushedValidData
+;CcGetLsnForFileObject
+;CcInitializeCacheMap
+;CcIsThereDirtyData
+;CcMapData
+;CcMdlRead
+;CcMdlReadComplete
+;CcMdlWriteAbort
+;CcMdlWriteComplete
+;CcPinMappedData
+;CcPinRead
+;CcPrepareMdlWrite
+;CcPreparePinWrite
+;CcPurgeCacheSection
+;CcRemapBcb
+;CcRepinBcb
+;CcScheduleReadAhead
+;CcSetAdditionalCacheAttributes
+;CcSetBcbOwnerPointer
+;CcSetDirtyPageThreshold
+;CcSetDirtyPinnedData
+;CcSetFileSizes
+;CcSetLogHandleForFile
+;CcSetReadAheadGranularity
+;CcUninitializeCacheMap
+;CcUnpinData
+;CcUnpinDataForThread
+;CcUnpinRepinnedBcb
+;CcWaitForCurrentLazyWriterActivity
+;CcZeroData
+CmRegisterCallback@12
+CmUnRegisterCallback@4
+DbgBreakPoint@0
+DbgBreakPointWithStatus@4
+;DbgLoadImageSymbols
+DbgPrint
+DbgPrintEx
+DbgPrintReturnControlC
+;DbgPrompt
+DbgQueryDebugFilterState@8
+DbgSetDebugFilterState@12
+@ExAcquireFastMutexUnsafe@4
+ExAcquireResourceExclusiveLite@8
+ExAcquireResourceSharedLite@8
+;ExAcquireRundownProtection
+ExAcquireSharedStarveExclusive@8
+ExAcquireSharedWaitForExclusive@8
+ExAllocateFromPagedLookasideList@4
+ExAllocatePool@8
+ExAllocatePoolWithQuota@8
+ExAllocatePoolWithQuotaTag@12
+ExAllocatePoolWithTag@12
+ExAllocatePoolWithTagPriority@16
+ExConvertExclusiveToSharedLite@4
+ExCreateCallback@16
+ExDeleteNPagedLookasideList@4
+ExDeletePagedLookasideList@4
+ExDeleteResourceLite@4
+;ExDesktopObjectType DATA
+;ExDisableResourceBoostLite
+;ExEnumHandleTable
+;ExEventObjectType DATA
+ExExtendZone@12
+ExFreePool@4
+ExFreePoolWithTag@8
+ExFreeToPagedLookasideList@8
+;ExGetCurrentProcessorCounts
+;ExGetCurrentProcessorCpuUsage
+ExGetExclusiveWaiterCount@4
+ExGetPreviousMode@0
+ExGetSharedWaiterCount@4
+ExInitializeNPagedLookasideList@28
+ExInitializePagedLookasideList@28
+ExInitializeResourceLite@4
+;ExInitializeRundownProtection
+ExInitializeZone@16
+ExInterlockedAddLargeInteger@12
+@ExInterlockedAddLargeStatistic@8
+@ExInterlockedAddUlong@12
+@ExInterlockedCompareExchange64@16
+ExInterlockedDecrementLong@8
+ExInterlockedExchangeUlong@12
+ExInterlockedExtendZone@16
+@ExInterlockedFlushSList@4
+@ExInterlockedIncrementLong@8
+@ExInterlockedInsertHeadList@12
+@ExInterlockedInsertTailList@12
+@ExInterlockedPopEntryList@8
+;ExInterlockedPopEntrySList
+@ExInterlockedPushEntryList@12
+;ExInterlockedPushEntrySList
+@ExInterlockedRemoveHeadList@8
+ExIsProcessorFeaturePresent@4
+ExIsResourceAcquiredExclusiveLite@4
+ExIsResourceAcquiredSharedLite@4
+ExLocalTimeToSystemTime@8
+ExNotifyCallback@12
+;ExQueryPoolBlockSize
+ExQueueWorkItem@8
+ExRaiseAccessViolation@0
+ExRaiseDatatypeMisalignment@0
+;ExRaiseException
+;ExRaiseHardError
+ExRaiseStatus@4
+;ExReInitializeRundownProtection
+ExRegisterCallback@12
+ExReinitializeResourceLite@4
+@ExReleaseFastMutexUnsafe@4
+ExReleaseResourceForThreadLite@8
+@ExReleaseResourceLite@4
+;ExReleaseRundownProtection
+;ExRundownCompleted
+;ExSemaphoreObjectType DATA
+ExSetResourceOwnerPointer@8
+ExSetTimerResolution@8
+;ExSystemExceptionFilter
+ExSystemTimeToLocalTime@8
+ExUnregisterCallback@4
+ExUuidCreate@4
+ExVerifySuite@4
+;ExWaitForRundownProtectionRelease
+;ExWindowStationObjectType DATA
+;ExfInterlockedAddUlong
+;ExfInterlockedCompareExchange64
+;ExfInterlockedInsertHeadList
+;ExfInterlockedInsertTailList
+;ExfInterlockedPopEntryList
+;ExfInterlockedPushEntryList
+;ExfInterlockedRemoveHeadList
+@Exfi386InterlockedDecrementLong@4
+@Exfi386InterlockedExchangeUlong@8
+@Exfi386InterlockedIncrementLong@4
+;Exi386InterlockedDecrementLong
+;Exi386InterlockedExchangeUlong
+;Exi386InterlockedIncrementLong
+;FsRtlAcquireFileExclusive
+;FsRtlAddLargeMcbEntry
+;FsRtlAddMcbEntry
+;FsRtlAddToTunnelCache
+;FsRtlAllocateFileLock
+;FsRtlAllocatePool
+;FsRtlAllocatePoolWithQuota
+;FsRtlAllocatePoolWithQuotaTag
+;FsRtlAllocatePoolWithTag
+;FsRtlAllocateResource
+;FsRtlAreNamesEqual
+;FsRtlBalanceReads
+;FsRtlCheckLockForReadAccess
+;FsRtlCheckLockForWriteAccess
+;FsRtlCheckOplock
+;FsRtlCopyRead
+;FsRtlCopyWrite
+;FsRtlCurrentBatchOplock
+;FsRtlDeleteKeyFromTunnelCache
+;FsRtlDeleteTunnelCache
+;FsRtlDeregisterUncProvider
+;FsRtlDissectDbcs
+;FsRtlDissectName
+;FsRtlDoesDbcsContainWildCards
+;FsRtlDoesNameContainWildCards
+;FsRtlFastCheckLockForRead
+;FsRtlFastCheckLockForWrite
+;FsRtlFastUnlockAll
+;FsRtlFastUnlockAllByKey
+;FsRtlFastUnlockSingle
+;FsRtlFindInTunnelCache
+;FsRtlFreeFileLock
+;FsRtlGetFileSize
+;FsRtlGetNextFileLock
+;FsRtlGetNextLargeMcbEntry
+;FsRtlGetNextMcbEntry
+;FsRtlIncrementCcFastReadNoWait
+;FsRtlIncrementCcFastReadNotPossible
+;FsRtlIncrementCcFastReadResourceMiss
+;FsRtlIncrementCcFastReadWait
+;FsRtlInitializeFileLock
+;FsRtlInitializeLargeMcb
+;FsRtlInitializeMcb
+;FsRtlInitializeOplock
+;FsRtlInitializeTunnelCache
+;FsRtlInsertPerFileObjectContext
+;FsRtlInsertPerStreamContext
+;FsRtlIsDbcsInExpression
+;FsRtlIsFatDbcsLegal
+;FsRtlIsHpfsDbcsLegal
+;FsRtlIsNameInExpression
+;FsRtlIsNtstatusExpected
+;FsRtlIsPagingFile
+FsRtlIsTotalDeviceFailure@4
+;FsRtlLegalAnsiCharacterArray
+;FsRtlLookupLargeMcbEntry
+;FsRtlLookupLastLargeMcbEntry
+;FsRtlLookupLastLargeMcbEntryAndIndex
+;FsRtlLookupLastMcbEntry
+;FsRtlLookupMcbEntry
+;FsRtlLookupPerFileObjectContext
+;FsRtlLookupPerStreamContextInternal
+;FsRtlMdlRead
+;FsRtlMdlReadComplete
+;FsRtlMdlReadCompleteDev
+;FsRtlMdlReadDev
+;FsRtlMdlWriteComplete
+;FsRtlMdlWriteCompleteDev
+;FsRtlNormalizeNtstatus
+;FsRtlNotifyChangeDirectory
+;FsRtlNotifyCleanup
+;FsRtlNotifyFilterChangeDirectory
+;FsRtlNotifyFilterReportChange
+;FsRtlNotifyFullChangeDirectory
+;FsRtlNotifyFullReportChange
+;FsRtlNotifyInitializeSync
+;FsRtlNotifyReportChange
+;FsRtlNotifyUninitializeSync
+;FsRtlNotifyVolumeEvent
+;FsRtlNumberOfRunsInLargeMcb
+;FsRtlNumberOfRunsInMcb
+;FsRtlOplockFsctrl
+;FsRtlOplockIsFastIoPossible
+;FsRtlPostPagingFileStackOverflow
+;FsRtlPostStackOverflow
+;FsRtlPrepareMdlWrite
+;FsRtlPrepareMdlWriteDev
+;FsRtlPrivateLock
+;FsRtlProcessFileLock
+;FsRtlRegisterFileSystemFilterCallbacks
+;FsRtlRegisterUncProvider
+;FsRtlReleaseFile
+;FsRtlRemoveLargeMcbEntry
+;FsRtlRemoveMcbEntry
+;FsRtlRemovePerFileObjectContext
+;FsRtlRemovePerStreamContext
+;FsRtlResetLargeMcb
+;FsRtlSplitLargeMcb
+;FsRtlSyncVolumes
+;FsRtlTeardownPerStreamContexts
+;FsRtlTruncateLargeMcb
+;FsRtlTruncateMcb
+;FsRtlUninitializeFileLock
+;FsRtlUninitializeLargeMcb
+;FsRtlUninitializeMcb
+;FsRtlUninitializeOplock
+;HalDispatchTable DATA
+@HalExamineMBR@16
+;HalPrivateDispatchTable DATA
+;HeadlessDispatch
+;InbvAcquireDisplayOwnership
+;InbvCheckDisplayOwnership
+;InbvDisplayString
+;InbvEnableBootDriver
+;InbvEnableDisplayString
+;InbvInstallDisplayStringFilter
+;InbvIsBootDriverInstalled
+;InbvNotifyDisplayOwnershipLost
+;InbvResetDisplay
+;InbvSetScrollRegion
+;InbvSetTextColor
+;InbvSolidColorFill
+;InitSafeBootMode DATA
+@InterlockedCompareExchange@12
+@InterlockedDecrement@4
+@InterlockedExchange@8
+@InterlockedExchangeAdd@8
+@InterlockedIncrement@4
+@InterlockedPopEntrySList@4
+@InterlockedPushEntrySList@8
+IoAcquireCancelSpinLock@4
+IoAcquireRemoveLockEx@20
+;IoAcquireVpbSpinLock
+;IoAdapterObjectType DATA
+IoAllocateAdapterChannel@20
+IoAllocateController@16
+IoAllocateDriverObjectExtension@16
+IoAllocateErrorLogEntry@8
+IoAllocateIrp@8
+IoAllocateMdl@20
+IoAllocateWorkItem@4
+;IoAssignDriveLetters
+IoAssignResources@24
+IoAttachDevice@12
+IoAttachDeviceByPointer@8
+IoAttachDeviceToDeviceStack@8
+;IoAttachDeviceToDeviceStackSafe
+IoBuildAsynchronousFsdRequest@24
+IoBuildDeviceIoControlRequest@36
+IoBuildPartialMdl@16
+IoBuildSynchronousFsdRequest@28
+;IoCallDriver
+IoCancelFileOpen@8
+IoCancelIrp@4
+;IoCheckDesiredAccess
+;IoCheckEaBufferValidity
+;IoCheckFunctionAccess
+;IoCheckQuerySetFileInformation
+;IoCheckQuerySetVolumeInformation
+;IoCheckQuotaBufferValidity
+IoCheckShareAccess@20
+;IoCompleteRequest
+IoConnectInterrupt@44
+IoCreateController@4
+IoCreateDevice@28
+IoCreateDisk@8
+;IoCreateDriver
+IoCreateFile@56
+;IoCreateFileSpecifyDeviceObjectHint
+IoCreateNotificationEvent@8
+;IoCreateStreamFileObject
+;IoCreateStreamFileObjectEx
+;IoCreateStreamFileObjectLite
+IoCreateSymbolicLink@8
+IoCreateSynchronizationEvent@8
+IoCreateUnprotectedSymbolicLink@8
+IoCsqInitialize@28
+IoCsqInsertIrp@12
+IoCsqRemoveIrp@8
+IoCsqRemoveNextIrp@8
+IoDeleteController@4
+IoDeleteDevice@4
+;IoDeleteDriver
+IoDeleteSymbolicLink@4
+IoDetachDevice@4
+;IoDeviceHandlerObjectSize DATA
+;IoDeviceHandlerObjectType DATA
+;IoDeviceObjectType DATA
+IoDisconnectInterrupt@4
+;IoDriverObjectType DATA
+;IoEnqueueIrp
+;IoEnumerateDeviceObjectList
+;IoFastQueryNetworkAttributes
+;IoFileObjectType DATA
+;IoForwardAndCatchIrp
+IoForwardIrpSynchronously@8
+IoFreeController@4
+IoFreeErrorLogEntry@4
+IoFreeIrp@4
+IoFreeMdl@4
+IoFreeWorkItem@4
+IoGetAttachedDevice@4
+IoGetAttachedDeviceReference@4
+;IoGetBaseFileSystemDeviceObject
+IoGetBootDiskInformation@8
+IoGetConfigurationInformation@0
+IoGetCurrentProcess@0
+;IoGetDeviceAttachmentBaseRef
+IoGetDeviceInterfaceAlias@12
+IoGetDeviceInterfaces@16
+IoGetDeviceObjectPointer@16
+IoGetDeviceProperty@20
+IoGetDeviceToVerify@4
+;IoGetDiskDeviceObject
+IoGetDmaAdapter@12
+IoGetDriverObjectExtension@8
+IoGetFileObjectGenericMapping@0
+IoGetInitialStack@0
+;IoGetLowerDeviceObject
+IoGetRelatedDeviceObject@4
+;IoGetRequestorProcess
+;IoGetRequestorProcessId
+;IoGetRequestorSessionId
+IoGetStackLimits@8
+;IoGetTopLevelIrp
+IoInitializeIrp@12
+IoInitializeRemoveLockEx@20
+IoInitializeTimer@12
+IoInvalidateDeviceRelations@8
+IoInvalidateDeviceState@4
+;IoIsFileOriginRemote
+;IoIsOperationSynchronous
+;IoIsSystemThread
+;IoIsValidNameGraftingBuffer
+IoIsWdmVersionAvailable@8
+IoMakeAssociatedIrp@8
+IoOpenDeviceInterfaceRegistryKey@12
+IoOpenDeviceRegistryKey@16
+;IoPageRead
+;IoPnPDeliverServicePowerNotification
+IoQueryDeviceDescription@32
+;IoQueryFileDosDeviceName
+;IoQueryFileInformation
+;IoQueryVolumeInformation
+;IoQueueThreadIrp
+IoQueueWorkItem@16
+IoRaiseHardError@12
+IoRaiseInformationalHardError@12
+IoReadDiskSignature@12
+;IoReadOperationCount DATA
+@IoReadPartitionTable@16
+IoReadPartitionTableEx@8
+;IoReadTransferCount DATA
+IoRegisterBootDriverReinitialization@12
+IoRegisterDeviceInterface@16
+IoRegisterDriverReinitialization@12
+;IoRegisterFileSystem
+;IoRegisterFsRegistrationChange
+;IoRegisterLastChanceShutdownNotification
+IoRegisterPlugPlayNotification@28
+IoRegisterShutdownNotification@4
+IoReleaseCancelSpinLock@4
+IoReleaseRemoveLockAndWaitEx@12
+IoReleaseRemoveLockEx@12
+;IoReleaseVpbSpinLock
+IoRemoveShareAccess@8
+IoReportDetectedDevice@32
+;IoReportHalResourceUsage
+IoReportResourceForDetection@28
+IoReportResourceUsage@36
+IoReportTargetDeviceChange@8
+IoReportTargetDeviceChangeAsynchronous@16
+IoRequestDeviceEject@4
+IoReuseIrp@8
+IoSetCompletionRoutineEx@28
+IoSetDeviceInterfaceState@8
+;IoSetDeviceToVerify
+;IoSetFileOrigin
+IoSetHardErrorOrVerifyDevice@8
+;IoSetInformation
+;IoSetIoCompletion
+@IoSetPartitionInformation@16
+IoSetPartitionInformationEx@12
+IoSetShareAccess@16
+IoSetStartIoAttributes@12
+IoSetSystemPartition@4
+IoSetThreadHardErrorMode@4
+;IoSetTopLevelIrp
+IoStartNextPacket@8
+IoStartNextPacketByKey@12
+IoStartPacket@16
+IoStartTimer@4
+;IoStatisticsLock DATA
+IoStopTimer@4
+;IoSynchronousInvalidateDeviceRelations
+;IoSynchronousPageWrite
+;IoThreadToProcess
+;IoUnregisterFileSystem
+;IoUnregisterFsRegistrationChange
+IoUnregisterPlugPlayNotification@4
+IoUnregisterShutdownNotification@4
+IoUpdateShareAccess@8
+IoVerifyPartitionTable@8
+;IoVerifyVolume
+IoVolumeDeviceToDosName@8
+IoWMIAllocateInstanceIds@12
+IoWMIDeviceObjectToInstanceName@12
+IoWMIExecuteMethod@24
+IoWMIHandleToInstanceName@12
+IoWMIOpenBlock@12
+IoWMIQueryAllData@12
+IoWMIQueryAllDataMultiple@16
+IoWMIQuerySingleInstance@16
+IoWMIQuerySingleInstanceMultiple@20
+IoWMIRegistrationControl@8
+IoWMISetNotificationCallback@12
+IoWMISetSingleInstance@20
+IoWMISetSingleItem@24
+IoWMISuggestInstanceName@16
+IoWMIWriteEvent@4
+IoWriteErrorLogEntry@4
+;IoWriteOperationCount DATA
+@IoWritePartitionTable@20
+IoWritePartitionTableEx@8
+;IoWriteTransferCount DATA
+@IofCallDriver@8
+@IofCompleteRequest@8
+;KdDebuggerEnabled DATA
+;KdDebuggerNotPresent DATA
+KdDisableDebugger@0
+KdEnableDebugger@0
+;KdEnteredDebugger DATA
+;KdPollBreakIn
+;KdPowerTransition
+;Ke386CallBios
+;Ke386IoSetAccessProcess
+;Ke386QueryIoAccessMap
+;Ke386SetIoAccessMap
+@KeAcquireInStackQueuedSpinLockAtDpcLevel@8
+KeAcquireInterruptSpinLock@4
+;KeAcquireSpinLockAtDpcLevel
+KeAddSystemServiceTable@20
+KeAreApcsDisabled@0
+KeAttachProcess@4
+KeBugCheck@4
+KeBugCheckEx@20
+KeCancelTimer@4
+KeClearEvent@4
+;KeConnectInterrupt
+;KeDcacheFlushCount DATA
+KeDelayExecutionThread@12
+KeDeregisterBugCheckCallback@4
+KeDetachProcess@0
+;KeDisconnectInterrupt
+KeEnterCriticalRegion@0
+;KeEnterKernelDebugger
+;KeFindConfigurationEntry
+;KeFindConfigurationNextEntry
+;KeFlushEntireTb
+KeGetCurrentThread@0
+KeGetPreviousMode@0
+KeGetRecommendedSharedDataAlignment@0
+;KeI386AbiosCall
+;KeI386AllocateGdtSelectors
+;KeI386Call16BitCStyleFunction
+;KeI386Call16BitFunction
+;KeI386FlatToGdtSelector
+;KeI386GetLid
+;KeI386MachineType DATA
+;KeI386ReleaseGdtSelectors
+;KeI386ReleaseLid
+;KeI386SetGdtSelector
+;KeIcacheFlushCount DATA
+KeInitializeApc@32
+KeInitializeDeviceQueue@4
+KeInitializeDpc@12
+KeInitializeEvent@12
+;KeInitializeInterrupt
+;KeInitializeMutant
+KeInitializeMutex@8
+;KeInitializeQueue
+KeInitializeSemaphore@12
+KeInitializeSpinLock@4
+KeInitializeTimer@4
+KeInitializeTimerEx@8
+KeInsertByKeyDeviceQueue@12
+KeInsertDeviceQueue@8
+;KeInsertHeadQueue
+;KeInsertQueue
+;KeInsertQueueApc
+KeInsertQueueDpc@12
+;KeIsAttachedProcess
+;KeIsExecutingDpc
+KeLeaveCriticalRegion@0
+;KeLoaderBlock DATA
+;KeNumberProcessors DATA
+;KeProfileInterrupt
+;KeProfileInterruptWithSource
+KePulseEvent@12
+;KeQueryActiveProcessors
+KeQueryInterruptTime@0
+KeQueryPriorityThread@4
+;KeQueryRuntimeThread
+KeQuerySystemTime@4
+KeQueryTickCount@4
+KeQueryTimeIncrement@0
+;KeRaiseUserException
+KeReadStateEvent@4
+;KeReadStateMutant
+KeReadStateMutex@4
+;KeReadStateQueue
+KeReadStateSemaphore@4
+KeReadStateTimer@4
+KeRegisterBugCheckCallback@20
+KeReleaseInStackQueuedSpinLockFromDpcLevel@4
+KeReleaseInterruptSpinLock@8
+;KeReleaseMutant
+KeReleaseMutex@8
+KeReleaseSemaphore@16
+;KeReleaseSpinLockFromDpcLevel
+KeRemoveByKeyDeviceQueue@8
+;KeRemoveByKeyDeviceQueueIfBusy
+KeRemoveDeviceQueue@4
+KeRemoveEntryDeviceQueue@8
+;KeRemoveQueue
+KeRemoveQueueDpc@4
+;KeRemoveSystemServiceTable
+KeResetEvent@4
+KeRestoreFloatingPointState@4
+;KeRevertToUserAffinityThread
+;KeRundownQueue
+KeSaveFloatingPointState@4
+;KeSaveStateForHibernate
+;KeServiceDescriptorTable DATA
+;KeSetAffinityThread
+KeSetBasePriorityThread@8
+;KeSetDmaIoCoherency
+KeSetEvent@12
+;KeSetEventBoostPriority
+;KeSetIdealProcessorThread
+KeSetImportanceDpc@8
+;KeSetKernelStackSwapEnable
+KeSetPriorityThread@8
+;KeSetProfileIrql
+;KeSetSystemAffinityThread
+KeSetTargetProcessorDpc@8
+;KeSetTimeIncrement
+@KeSetTimeUpdateNotifyRoutine@4
+KeSetTimer@12
+KeSetTimerEx@16
+;KeStackAttachProcess
+KeSynchronizeExecution@12
+;KeTerminateThread
+;KeTickCount DATA
+;KeUnstackDetachProcess
+;KeUpdateRunTime
+;KeUpdateSystemTime
+;KeUserModeCallback
+KeWaitForMultipleObjects@32
+KeWaitForMutexObject@20
+KeWaitForSingleObject@20
+@KefAcquireSpinLockAtDpcLevel@4
+@KefReleaseSpinLockFromDpcLevel@4
+;Kei386EoiHelper
+;KiAcquireSpinLock
+;KiBugCheckData DATA
+;KiCoprocessorError
+;KiDeliverApc
+;KiDispatchInterrupt
+;KiEnableTimerWatchdog DATA
+;KiIpiServiceRoutine
+;KiReleaseSpinLock
+;KiUnexpectedInterrupt
+;Kii386SpinOnSpinLock
+;LdrAccessResource
+;LdrEnumResources
+;LdrFindResourceDirectory_U
+;LdrFindResource_U
+;LpcPortObjectType DATA
+;LpcRequestPort
+;LpcRequestWaitReplyPort
+;LsaCallAuthenticationPackage
+;LsaDeregisterLogonProcess
+;LsaFreeReturnBuffer
+;LsaLogonUser
+;LsaLookupAuthenticationPackage
+;LsaRegisterLogonProcess
+;Mm64BitPhysicalAddress DATA
+;MmAddPhysicalMemory
+;MmAddVerifierThunks
+;MmAdjustWorkingSetSize
+MmAdvanceMdl@8
+MmAllocateContiguousMemory@8
+MmAllocateContiguousMemorySpecifyCache@20
+MmAllocateMappingAddress@8
+MmAllocateNonCachedMemory@4
+MmAllocatePagesForMdl@16
+MmBuildMdlForNonPagedPool@4
+;MmCanFileBeTruncated
+MmCreateMdl@12
+MmCreateSection@32
+;MmDisableModifiedWriteOfSection
+MmFlushImageSection@8
+;MmForceSectionClosed
+MmFreeContiguousMemory@4
+MmFreeContiguousMemorySpecifyCache@12
+MmFreeMappingAddress@8
+MmFreeNonCachedMemory@8
+MmFreePagesFromMdl@4
+MmGetPhysicalAddress@4
+MmGetPhysicalMemoryRanges@0
+MmGetSystemRoutineAddress@4
+MmGetVirtualForPhysical@4
+;MmGrowKernelStack
+;MmHighestUserAddress DATA
+MmIsAddressValid@4
+MmIsDriverVerifying@4
+MmIsNonPagedSystemAddressValid@4
+;MmIsRecursiveIoFault
+MmIsThisAnNtAsSystem@0
+MmIsVerifierEnabled@4
+MmLockPagableDataSection@4
+MmLockPagableImageSection@4
+MmLockPagableSectionByHandle@4
+MmMapIoSpace@12
+MmMapLockedPages@8
+MmMapLockedPagesSpecifyCache@24
+MmMapLockedPagesWithReservedMapping@16
+;MmMapMemoryDumpMdl
+MmMapUserAddressesToPage@12
+MmMapVideoDisplay@12
+MmMapViewInSessionSpace@12
+MmMapViewInSystemSpace@12
+;MmMapViewOfSection
+MmMarkPhysicalMemoryAsBad@8
+MmMarkPhysicalMemoryAsGood@8
+MmPageEntireDriver@4
+;MmPrefetchPages
+MmProbeAndLockPages@12
+MmProbeAndLockProcessPages@16
+;MmProbeAndLockSelectedPages
+MmProtectMdlSystemAddress@8
+MmQuerySystemSize@0
+MmRemovePhysicalMemory@8
+MmResetDriverPaging@4
+;MmSectionObjectType DATA
+MmSecureVirtualMemory@12
+;MmSetAddressRangeModified
+;MmSetBankedSection
+MmSizeOfMdl@8
+;MmSystemRangeStart DATA
+;MmTrimAllSystemPagableMemory
+MmUnlockPagableImageSection@4
+MmUnlockPages@4
+MmUnmapIoSpace@8
+MmUnmapLockedPages@8
+MmUnmapReservedMapping@12
+MmUnmapVideoDisplay@8
+MmUnmapViewInSessionSpace@4
+MmUnmapViewInSystemSpace@4
+;MmUnmapViewOfSection
+MmUnsecureVirtualMemory@4
+;MmUserProbeAddress DATA
+;NlsAnsiCodePage DATA
+;NlsLeadByteInfo
+;NlsMbCodePageTag DATA
+;NlsMbOemCodePageTag DATA
+;NlsOemCodePage DATA
+;NlsOemLeadByteInfo
+NtAddAtom@12
+NtAdjustPrivilegesToken@24
+NtAllocateLocallyUniqueId@4
+NtAllocateUuids@16
+NtAllocateVirtualMemory@24
+;NtBuildNumber DATA
+NtClose@4
+NtConnectPort@32
+NtCreateEvent@20
+;NtCreateFile
+NtCreateSection@28
+NtDeleteAtom@4
+NtDeleteFile@4
+NtDeviceIoControlFile@40
+NtDuplicateObject@28
+NtDuplicateToken@24
+NtFindAtom@12
+NtFreeVirtualMemory@16
+;NtFsControlFile
+;NtGlobalFlag DATA
+;NtLockFile
+;NtMakePermanentObject
+NtMapViewOfSection@40
+;NtNotifyChangeDirectoryFile
+NtOpenFile@24
+NtOpenProcess@16
+NtOpenProcessToken@12
+;NtOpenProcessTokenEx
+NtOpenThread@16
+NtOpenThreadToken@16
+;NtOpenThreadTokenEx
+;NtQueryDirectoryFile
+;NtQueryEaFile
+NtQueryInformationAtom@20
+;NtQueryInformationFile
+NtQueryInformationProcess@20
+NtQueryInformationThread@20
+NtQueryInformationToken@20
+;NtQueryQuotaInformationFile
+NtQuerySecurityObject@20
+NtQuerySystemInformation@16
+;NtQueryVolumeInformationFile
+NtReadFile@36
+NtRequestPort@8
+NtRequestWaitReplyPort@12
+;NtSetEaFile
+NtSetEvent@8
+;NtSetInformationFile
+NtSetInformationProcess@16
+NtSetInformationThread@16
+;NtSetQuotaInformationFile
+NtSetSecurityObject@12
+;NtSetVolumeInformationFile
+NtShutdownSystem@4
+;NtTraceEvent
+;NtUnlockFile
+NtVdmControl@8
+NtWaitForSingleObject@12
+NtWriteFile@36
+ObAssignSecurity@16
+;ObCheckCreateObjectAccess
+;ObCheckObjectAccess
+;ObCloseHandle
+ObCreateObject@36
+;ObCreateObjectType
+;ObDereferenceObject
+ObDereferenceSecurityDescriptor@8
+;ObFindHandleForObject
+ObGetObjectSecurity@12
+ObInsertObject@24
+ObLogSecurityDescriptor@12
+ObMakeTemporaryObject@4
+ObOpenObjectByName@28
+ObOpenObjectByPointer@28
+;ObQueryNameString
+ObQueryObjectAuditingByHandle@8
+ObReferenceObjectByHandle@24
+ObReferenceObjectByName@32
+ObReferenceObjectByPointer@16
+ObReferenceSecurityDescriptor@8
+ObReleaseObjectSecurity@8
+;ObSetHandleAttributes
+;ObSetSecurityDescriptorInfo
+;ObSetSecurityObjectByPointer
+@ObfDereferenceObject@4
+@ObfReferenceObject@4
+;PfxFindPrefix
+;PfxInitialize
+;PfxInsertPrefix
+;PfxRemovePrefix
+PoCallDriver@8
+;PoCancelDeviceNotify
+;PoQueueShutdownWorkItem
+PoRegisterDeviceForIdleDetection@16
+;PoRegisterDeviceNotify
+PoRegisterSystemState@8
+PoRequestPowerIrp@24
+PoRequestShutdownEvent@4
+;PoSetHiberRange
+PoSetPowerState@12
+PoSetSystemState@4
+;PoShutdownBugCheck
+PoStartNextPowerIrp@4
+PoUnregisterSystemState@4
+ProbeForRead@12
+ProbeForWrite@12
+;PsAssignImpersonationToken
+;PsChargePoolQuota
+;PsChargeProcessNonPagedPoolQuota
+;PsChargeProcessPagedPoolQuota
+;PsChargeProcessPoolQuota
+PsCreateSystemProcess@12
+PsCreateSystemThread@28
+;PsDereferenceImpersonationToken
+;PsDereferencePrimaryToken
+;PsDisableImpersonation
+;PsEstablishWin32Callouts
+;PsGetCurrentProcess
+PsGetCurrentProcessId@0
+;PsGetCurrentProcessSessionId
+;PsGetCurrentThread
+PsGetCurrentThreadId@0
+;PsGetCurrentThreadPreviousMode
+;PsGetCurrentThreadStackBase
+;PsGetCurrentThreadStackLimit
+;PsGetJobLock
+;PsGetJobSessionId
+;PsGetJobUIRestrictionsClass
+;PsGetProcessCreateTimeQuadPart
+;PsGetProcessDebugPort
+;PsGetProcessExitProcessCalled
+;PsGetProcessExitStatus
+;PsGetProcessExitTime
+;PsGetProcessId
+;PsGetProcessImageFileName
+;PsGetProcessInheritedFromUniqueProcessId
+;PsGetProcessJob
+;PsGetProcessPeb
+;PsGetProcessPriorityClass
+;PsGetProcessSectionBaseAddress
+;PsGetProcessSecurityPort
+;PsGetProcessSessionId
+;PsGetProcessWin32Process
+;PsGetProcessWin32WindowStation
+;PsGetThreadFreezeCount
+;PsGetThreadHardErrorsAreDisabled
+;PsGetThreadId
+;PsGetThreadProcess
+;PsGetThreadProcessId
+;PsGetThreadSessionId
+;PsGetThreadTeb
+;PsGetThreadWin32Thread
+PsGetVersion@16
+;PsImpersonateClient
+;PsInitialSystemProcess DATA
+;PsIsProcessBeingDebugged
+;PsIsSystemThread
+;PsIsThreadImpersonating
+;PsIsThreadTerminating
+;PsJobType DATA
+;PsLookupProcessByProcessId
+;PsLookupProcessThreadByCid
+;PsLookupThreadByThreadId
+;PsProcessType DATA
+;PsReferenceImpersonationToken
+;PsReferencePrimaryToken
+PsRemoveCreateThreadNotifyRoutine@4
+PsRemoveLoadImageNotifyRoutine@4
+;PsRestoreImpersonation
+;PsReturnPoolQuota
+;PsReturnProcessNonPagedPoolQuota
+;PsReturnProcessPagedPoolQuota
+;PsRevertThreadToSelf
+;PsRevertToSelf
+PsSetCreateProcessNotifyRoutine@8
+PsSetCreateThreadNotifyRoutine@4
+;PsSetJobUIRestrictionsClass
+;PsSetLegoNotifyRoutine
+PsSetLoadImageNotifyRoutine@4
+;PsSetProcessPriorityByClass
+;PsSetProcessPriorityClass
+;PsSetProcessSecurityPort
+;PsSetProcessWin32Process
+;PsSetProcessWindowStation
+;PsSetThreadHardErrorsAreDisabled
+;PsSetThreadWin32Thread
+PsTerminateSystemThread@4
+;PsThreadType DATA
+READ_REGISTER_BUFFER_UCHAR@12
+READ_REGISTER_BUFFER_ULONG@12
+READ_REGISTER_BUFFER_USHORT@12
+READ_REGISTER_UCHAR@4
+READ_REGISTER_ULONG@4
+READ_REGISTER_USHORT@4
+;RtlAbsoluteToSelfRelativeSD
+;RtlAddAccessAllowedAce
+;RtlAddAce
+;RtlAddAtomToAtomTable
+RtlAddRange@28
+;RtlAllocateHeap
+;RtlAnsiCharToUnicodeChar
+RtlAnsiStringToUnicodeSize@4
+RtlAnsiStringToUnicodeString@12
+;RtlAppendAsciizToString
+;RtlAppendStringToString
+RtlAppendUnicodeStringToString@8
+RtlAppendUnicodeToString@8
+;RtlAreAllAccessesGranted
+;RtlAreAnyAccessesGranted
+RtlAreBitsClear@12
+RtlAreBitsSet@12
+RtlAssert@16
+;RtlCaptureContext
+;RtlCaptureStackBackTrace
+RtlCharToInteger@12
+RtlCheckRegistryKey@8
+RtlClearAllBits@4
+RtlClearBit@8
+RtlClearBits@12
+RtlCompareMemory@12
+;RtlCompareMemoryUlong
+RtlCompareString@12
+RtlCompareUnicodeString@12
+;RtlCompressBuffer
+;RtlCompressChunks
+RtlConvertLongToLargeInteger@4
+;RtlConvertSidToUnicodeString
+RtlConvertUlongToLargeInteger@4
+;RtlCopyLuid
+RtlCopyRangeList@8
+;RtlCopySid
+RtlCopyString@8
+RtlCopyUnicodeString@8
+;RtlCreateAcl
+;RtlCreateAtomTable
+;RtlCreateHeap
+RtlCreateRegistryKey@8
+RtlCreateSecurityDescriptor@8
+;RtlCreateSystemVolumeInformationFolder
+;RtlCreateUnicodeString
+;RtlCustomCPToUnicodeN
+;RtlDecompressBuffer
+;RtlDecompressChunks
+;RtlDecompressFragment
+;RtlDelete
+;RtlDeleteAce
+;RtlDeleteAtomFromAtomTable
+;RtlDeleteElementGenericTable
+;RtlDeleteElementGenericTableAvl
+;RtlDeleteNoSplay
+RtlDeleteOwnersRanges@8
+RtlDeleteRange@16
+RtlDeleteRegistryValue@12
+;RtlDescribeChunk
+;RtlDestroyAtomTable
+;RtlDestroyHeap
+;RtlDowncaseUnicodeString
+;RtlEmptyAtomTable
+RtlEnlargedIntegerMultiply@8
+RtlEnlargedUnsignedDivide@12
+RtlEnlargedUnsignedMultiply@8
+;RtlEnumerateGenericTable
+;RtlEnumerateGenericTableAvl
+;RtlEnumerateGenericTableLikeADirectory
+;RtlEnumerateGenericTableWithoutSplaying
+;RtlEnumerateGenericTableWithoutSplayingAvl
+;RtlEqualLuid
+;RtlEqualSid
+RtlEqualString@12
+RtlEqualUnicodeString@12
+RtlExtendedIntegerMultiply@8
+RtlExtendedLargeIntegerDivide@12
+RtlExtendedMagicDivide@12
+;RtlFillMemory
+;RtlFillMemoryUlong
+RtlFindClearBits@12
+RtlFindClearBitsAndSet@12
+RtlFindClearRuns@16
+RtlFindFirstRunClear@8
+RtlFindLastBackwardRunClear@12
+RtlFindLeastSignificantBit@4
+RtlFindLongestRunClear@8
+;RtlFindMessage
+RtlFindMostSignificantBit@4
+RtlFindNextForwardRunClear@12
+RtlFindRange@40
+RtlFindSetBits@12
+RtlFindSetBitsAndClear@12
+;RtlFindUnicodePrefix
+;RtlFormatCurrentUserKeyPath
+RtlFreeAnsiString@4
+;RtlFreeHeap
+;RtlFreeOemString
+RtlFreeRangeList@4
+RtlFreeUnicodeString@4
+RtlGUIDFromString@8
+;RtlGenerate8dot3Name
+;RtlGetAce
+RtlGetCallersAddress@8
+;RtlGetCompressionWorkSpaceSize
+;RtlGetDaclSecurityDescriptor
+;RtlGetDefaultCodePage
+;RtlGetElementGenericTable
+;RtlGetElementGenericTableAvl
+RtlGetFirstRange@12
+;RtlGetGroupSecurityDescriptor
+RtlGetNextRange@12
+;RtlGetNtGlobalFlags
+;RtlGetOwnerSecurityDescriptor
+;RtlGetSaclSecurityDescriptor
+;RtlGetSetBootStatusData
+RtlGetVersion@4
+RtlHashUnicodeString@16
+;RtlImageDirectoryEntryToData
+;RtlImageNtHeader
+RtlInitAnsiString@8
+;RtlInitCodePageTable
+RtlInitString@8
+RtlInitUnicodeString@8
+RtlInitializeBitMap@12
+;RtlInitializeGenericTable
+;RtlInitializeGenericTableAvl
+RtlInitializeRangeList@4
+;RtlInitializeSid
+;RtlInitializeUnicodePrefix
+;RtlInsertElementGenericTable
+;RtlInsertElementGenericTableAvl
+;RtlInsertElementGenericTableFull
+;RtlInsertElementGenericTableFullAvl
+;RtlInsertUnicodePrefix
+RtlInt64ToUnicodeString@12
+;RtlIntegerToChar
+;RtlIntegerToUnicode
+RtlIntegerToUnicodeString@12
+RtlInvertRangeList@8
+;RtlIpv4AddressToStringA
+;RtlIpv4AddressToStringW
+;RtlIpv4StringToAddressA
+;RtlIpv4StringToAddressW
+;RtlIpv6AddressToStringA
+;RtlIpv6AddressToStringW
+;RtlIpv6StringToAddressA
+;RtlIpv6StringToAddressW
+;RtlIsGenericTableEmpty
+;RtlIsGenericTableEmptyAvl
+;RtlIsNameLegalDOS8Dot3
+RtlIsRangeAvailable@32
+;RtlIsValidOemCharacter
+RtlLargeIntegerAdd@8
+RtlLargeIntegerArithmeticShift@8
+RtlLargeIntegerDivide@12
+RtlLargeIntegerNegate@4
+RtlLargeIntegerShiftLeft@8
+RtlLargeIntegerShiftRight@8
+RtlLargeIntegerSubtract@8
+;RtlLengthRequiredSid
+RtlLengthSecurityDescriptor@4
+;RtlLengthSid
+;RtlLockBootStatusData
+;RtlLookupAtomInAtomTable
+;RtlLookupElementGenericTable
+;RtlLookupElementGenericTableAvl
+;RtlLookupElementGenericTableFull
+;RtlLookupElementGenericTableFullAvl
+RtlMapGenericMask@8
+;RtlMapSecurityErrorToNtStatus
+RtlMergeRangeLists@16
+;RtlMoveMemory
+;RtlMultiByteToUnicodeN
+;RtlMultiByteToUnicodeSize
+;RtlNextUnicodePrefix
+;RtlNtStatusToDosError
+;RtlNtStatusToDosErrorNoTeb
+;RtlNumberGenericTableElements
+;RtlNumberGenericTableElementsAvl
+RtlNumberOfClearBits@4
+RtlNumberOfSetBits@4
+;RtlOemStringToCountedUnicodeString
+;RtlOemStringToUnicodeSize
+;RtlOemStringToUnicodeString
+;RtlOemToUnicodeN
+;RtlPinAtomInAtomTable
+@RtlPrefetchMemoryNonTemporal@8
+;RtlPrefixString
+RtlPrefixUnicodeString@12
+;RtlQueryAtomInAtomTable
+RtlQueryRegistryValues@20
+;RtlQueryTimeZoneInformation
+;RtlRaiseException
+;RtlRandom
+;RtlRandomEx
+;RtlRealPredecessor
+;RtlRealSuccessor
+;RtlRemoveUnicodePrefix
+;RtlReserveChunk
+;RtlSecondsSince1970ToTime
+;RtlSecondsSince1980ToTime
+;RtlSelfRelativeToAbsoluteSD
+;RtlSelfRelativeToAbsoluteSD2
+RtlSetAllBits@4
+RtlSetBit@8
+RtlSetBits@12
+RtlSetDaclSecurityDescriptor@16
+;RtlSetGroupSecurityDescriptor
+;RtlSetOwnerSecurityDescriptor
+;RtlSetSaclSecurityDescriptor
+;RtlSetTimeZoneInformation
+;RtlSizeHeap
+;RtlSplay
+RtlStringFromGUID@8
+;RtlSubAuthorityCountSid
+;RtlSubAuthoritySid
+;RtlSubtreePredecessor
+;RtlSubtreeSuccessor
+RtlTestBit@8
+RtlTimeFieldsToTime@8
+;RtlTimeToElapsedTimeFields
+;RtlTimeToSecondsSince1970
+;RtlTimeToSecondsSince1980
+RtlTimeToTimeFields@8
+;RtlTraceDatabaseAdd
+;RtlTraceDatabaseCreate
+;RtlTraceDatabaseDestroy
+;RtlTraceDatabaseEnumerate
+;RtlTraceDatabaseFind
+;RtlTraceDatabaseLock
+;RtlTraceDatabaseUnlock
+;RtlTraceDatabaseValidate
+@RtlUlongByteSwap@4
+@RtlUlonglongByteSwap@4
+RtlUnicodeStringToAnsiSize@4
+RtlUnicodeStringToAnsiString@12
+;RtlUnicodeStringToCountedOemString
+RtlUnicodeStringToInteger@12
+;RtlUnicodeStringToOemSize
+;RtlUnicodeStringToOemString
+;RtlUnicodeToCustomCPN
+;RtlUnicodeToMultiByteN
+;RtlUnicodeToMultiByteSize
+;RtlUnicodeToOemN
+;RtlUnlockBootStatusData
+;RtlUnwind
+RtlUpcaseUnicodeChar@4
+RtlUpcaseUnicodeString@12
+;RtlUpcaseUnicodeStringToAnsiString
+;RtlUpcaseUnicodeStringToCountedOemString
+;RtlUpcaseUnicodeStringToOemString
+;RtlUpcaseUnicodeToCustomCPN
+;RtlUpcaseUnicodeToMultiByteN
+;RtlUpcaseUnicodeToOemN
+RtlUpperChar@4
+RtlUpperString@8
+RtlUshortByteSwap@4
+RtlValidRelativeSecurityDescriptor@12
+RtlValidSecurityDescriptor@4
+;RtlValidSid
+RtlVerifyVersionInfo@12
+RtlVolumeDeviceToDosName@8
+RtlWalkFrameChain@12
+RtlWriteRegistryValue@24
+;RtlZeroHeap
+;RtlZeroMemory
+;RtlxAnsiStringToUnicodeSize
+;RtlxOemStringToUnicodeSize
+RtlxUnicodeStringToAnsiSize@4
+;RtlxUnicodeStringToOemSize
+SeAccessCheck@40
+;SeAppendPrivileges
+SeAssignSecurity@28
+SeAssignSecurityEx@36
+;SeAuditHardLinkCreation
+;SeAuditingFileEvents
+;SeAuditingFileOrGlobalEvents
+;SeAuditingHardLinkEvents
+;SeCaptureSecurityDescriptor
+;SeCaptureSubjectContext
+;SeCloseObjectAuditAlarm
+;SeCreateAccessState
+;SeCreateClientSecurity
+;SeCreateClientSecurityFromSubjectContext
+SeDeassignSecurity@4
+;SeDeleteAccessState
+;SeDeleteObjectAuditAlarm
+;SeExports DATA
+;SeFilterToken
+;SeFreePrivileges
+;SeImpersonateClient
+;SeImpersonateClientEx
+;SeLockSubjectContext
+;SeMarkLogonSessionForTerminationNotification
+;SeOpenObjectAuditAlarm
+;SeOpenObjectForDeleteAuditAlarm
+;SePrivilegeCheck
+;SePrivilegeObjectAuditAlarm
+;SePublicDefaultDacl DATA
+;SeQueryAuthenticationIdToken
+;SeQueryInformationToken
+;SeQuerySecurityDescriptorInfo
+;SeQuerySessionIdToken
+;SeRegisterLogonSessionTerminatedRoutine
+;SeReleaseSecurityDescriptor
+;SeReleaseSubjectContext
+;SeSetAccessStateGenericMapping
+;SeSetSecurityDescriptorInfo
+;SeSetSecurityDescriptorInfoEx
+SeSinglePrivilegeCheck@8
+;SeSystemDefaultDacl DATA
+;SeTokenImpersonationLevel
+;SeTokenIsAdmin
+;SeTokenIsRestricted
+;SeTokenObjectType DATA
+;SeTokenType
+;SeUnlockSubjectContext
+;SeUnregisterLogonSessionTerminatedRoutine
+SeValidSecurityDescriptor@8
+VerSetConditionMask@12
+;VfFailDeviceNode
+;VfFailDriver
+;VfFailSystemBIOS
+;VfIsVerificationEnabled
+WRITE_REGISTER_BUFFER_UCHAR@12
+WRITE_REGISTER_BUFFER_ULONG@12
+WRITE_REGISTER_BUFFER_USHORT@12
+WRITE_REGISTER_UCHAR@8
+WRITE_REGISTER_ULONG@8
+WRITE_REGISTER_USHORT@8
+;WmiFlushTrace
+;WmiGetClock
+;WmiQueryTrace
+WmiQueryTraceInformation@20
+;WmiStartTrace
+;WmiStopTrace
+WmiTraceMessage
+;WmiTraceMessageVa
+;WmiUpdateTrace
+;XIPDispatch
+ZwAccessCheckAndAuditAlarm@44
+;ZwAddBootEntry
+ZwAdjustPrivilegesToken@24
+ZwAlertThread@4
+ZwAllocateVirtualMemory@24
+ZwAssignProcessToJobObject@8
+ZwCancelIoFile@8
+ZwCancelTimer@8
+;ZwClearEvent
+ZwClose@4
+ZwCloseObjectAuditAlarm@12
+ZwConnectPort@32
+ZwCreateDirectoryObject@12
+ZwCreateEvent@20
+ZwCreateFile@44
+ZwCreateJobObject@12
+ZwCreateKey@28
+ZwCreateSection@28
+ZwCreateSymbolicLinkObject@16
+ZwCreateTimer@16
+;ZwDeleteBootEntry
+ZwDeleteFile@4
+ZwDeleteKey@4
+ZwDeleteValueKey@8
+ZwDeviceIoControlFile@40
+ZwDisplayString@4
+ZwDuplicateObject@28
+ZwDuplicateToken@24
+;ZwEnumerateBootEntries
+ZwEnumerateKey@24
+ZwEnumerateValueKey@24
+ZwFlushInstructionCache@12
+ZwFlushKey@4
+ZwFlushVirtualMemory@16
+ZwFreeVirtualMemory@16
+;ZwFsControlFile
+ZwInitiatePowerAction@16
+;ZwIsProcessInJob
+ZwLoadDriver@4
+ZwLoadKey@8
+ZwMakeTemporaryObject@4
+ZwMapViewOfSection@40
+ZwNotifyChangeKey@40
+ZwOpenDirectoryObject@12
+;ZwOpenEvent
+ZwOpenFile@24
+ZwOpenJobObject@12
+ZwOpenKey@12
+;ZwOpenProcess
+ZwOpenProcessToken@12
+;ZwOpenProcessTokenEx
+ZwOpenSection@12
+ZwOpenSymbolicLinkObject@12
+ZwOpenThread@16
+ZwOpenThreadToken@16
+;ZwOpenThreadTokenEx
+ZwOpenTimer@12
+ZwPowerInformation@20
+;ZwPulseEvent
+;ZwQueryBootEntryOrder
+;ZwQueryBootOptions
+ZwQueryDefaultLocale@8
+ZwQueryDefaultUILanguage@4
+;ZwQueryDirectoryFile
+ZwQueryDirectoryObject@28
+;ZwQueryEaFile
+;ZwQueryFullAttributesFile
+ZwQueryInformationFile@20
+ZwQueryInformationJobObject@20
+ZwQueryInformationProcess@20
+ZwQueryInformationThread@20
+ZwQueryInformationToken@20
+ZwQueryInstallUILanguage@4
+ZwQueryKey@20
+ZwQueryObject@20
+ZwQuerySection@20
+ZwQuerySecurityObject@20
+ZwQuerySymbolicLinkObject@12
+ZwQuerySystemInformation@16
+ZwQueryValueKey@24
+;ZwQueryVolumeInformationFile
+ZwReadFile@36
+ZwReplaceKey@12
+ZwRequestWaitReplyPort@12
+;ZwResetEvent
+ZwRestoreKey@12
+ZwSaveKey@8
+;ZwSaveKeyEx
+;ZwSetBootEntryOrder
+;ZwSetBootOptions
+ZwSetDefaultLocale@8
+ZwSetDefaultUILanguage@4
+;ZwSetEaFile
+ZwSetEvent@8
+ZwSetInformationFile@20
+ZwSetInformationJobObject@16
+ZwSetInformationObject@16
+ZwSetInformationProcess@16
+ZwSetInformationThread@16
+ZwSetSecurityObject@12
+ZwSetSystemInformation@12
+ZwSetSystemTime@8
+ZwSetTimer@28
+ZwSetValueKey@24
+;ZwSetVolumeInformationFile
+ZwTerminateJobObject@8
+ZwTerminateProcess@8
+;ZwTranslateFilePath
+ZwUnloadDriver@4
+ZwUnloadKey@4
+ZwUnmapViewOfSection@8
+;ZwWaitForMultipleObjects
+ZwWaitForSingleObject@12
+ZwWriteFile@36
+ZwYieldExecution@0
+;_CIcos
+;_CIsin
+;_CIsqrt
+;_abnormal_termination
+;_alldiv
+;_alldvrm
+;_allmul
+;_alloca_probe
+;_allrem
+;_allshl
+;_allshr
+;_aulldiv
+;_aulldvrm
+;_aullrem
+;_aullshr
+;_except_handler2
+;_except_handler3
+;_global_unwind2
+;_itoa
+;_itow
+;_local_unwind2
+;_purecall
+;_snprintf
+;_snwprintf
+_stricmp
+_strlwr
+_strnicmp
+_strnset
+_strrev
+_strset
+_strupr
+;_vsnprintf
+;_vsnwprintf
+_wcsicmp@8
+_wcslwr@4
+_wcsnicmp@12
+_wcsnset@12
+_wcsrev@4
+_wcsupr@4
+;atoi
+;atol
+;isdigit
+;islower
+;isprint
+;isspace
+;isupper
+;isxdigit
+;mbstowcs
+;mbtowc
+memchr
+memcpy
+memmove
+memset
+;qsort
+;rand
+;sprintf
+;srand
+strcat
+strchr
+strcmp
+strcpy
+strlen
+strncat
+strncmp
+strncpy
+strrchr
+strspn
+strstr
+;swprintf
+;tolower
+;toupper
+;towlower
+;towupper
+;vDbgPrintEx
+;vDbgPrintExWithPrefix
+;vsprintf
+wcscat
+wcschr
+wcscmp
+wcscpy
+wcscspn
+wcslen
+wcsncat
+wcsncmp
+wcsncpy
+wcsrchr
+wcsspn
+wcsstr
+;wcstombs
+;wctomb
--- /dev/null
+LIBRARY scsiport.sys
+EXPORTS
+DllInitialize@4
+ScsiDebugPrint
+ScsiPortCompleteRequest@20
+;ScsiPortConvertPhysicalAddressToUlong
+ScsiPortConvertUlongToPhysicalAddress@4
+ScsiPortFlushDma@4
+ScsiPortFreeDeviceBase@8
+ScsiPortGetBusData@24
+ScsiPortGetDeviceBase@24
+ScsiPortGetLogicalUnit@16
+ScsiPortGetPhysicalAddress@16
+ScsiPortGetSrb@20
+ScsiPortGetUncachedExtension@12
+ScsiPortGetVirtualAddress@8
+ScsiPortInitialize@16
+ScsiPortIoMapTransfer@16
+ScsiPortLogError@28
+ScsiPortMoveMemory@12
+ScsiPortNotification
+ScsiPortQuerySystemTime@4
+ScsiPortReadPortBufferUchar@12
+ScsiPortReadPortBufferUlong@12
+ScsiPortReadPortBufferUshort@12
+ScsiPortReadPortUchar@4
+ScsiPortReadPortUlong@4
+ScsiPortReadPortUshort@4
+ScsiPortReadRegisterBufferUchar@12
+ScsiPortReadRegisterBufferUlong@12
+ScsiPortReadRegisterBufferUshort@12
+ScsiPortReadRegisterUchar@4
+ScsiPortReadRegisterUlong@4
+ScsiPortReadRegisterUshort@4
+ScsiPortSetBusDataByOffset@28
+ScsiPortStallExecution@4
+ScsiPortValidateRange@24
+ScsiPortWritePortBufferUchar@12
+ScsiPortWritePortBufferUlong@12
+ScsiPortWritePortBufferUshort@12
+ScsiPortWritePortUchar@8
+ScsiPortWritePortUlong@8
+ScsiPortWritePortUshort@8
+ScsiPortWriteRegisterBufferUchar@12
+ScsiPortWriteRegisterBufferUlong@12
+ScsiPortWriteRegisterBufferUshort@12
+ScsiPortWriteRegisterUchar@8
+ScsiPortWriteRegisterUlong@8
+ScsiPortWriteRegisterUshort@8
--- /dev/null
+LIBRARY tdi.sys
+EXPORTS
+;CTEAllocateString
+;CTEBlock
+;CTEInitEvent
+;CTEInitString
+;CTEInitTimer
+;CTEInitialize
+;CTELogEvent
+;CTEScheduleDelayedEvent
+;CTEScheduleEvent
+;CTESignal
+;CTEStartTimer
+;CTESystemUpTime
+TdiBuildNetbiosAddress@12
+TdiBuildNetbiosAddressEa@12
+TdiCopyBufferToMdl@24
+TdiCopyMdlChainToMdlChain@20
+TdiCopyMdlToBuffer@24
+TdiDefaultChainedRcvDatagramHandler@40
+TdiDefaultChainedRcvExpeditedHandler@28
+TdiDefaultChainedReceiveHandler@28
+TdiDefaultConnectHandler@36
+TdiDefaultDisconnectHandler@28
+TdiDefaultErrorHandler@8
+TdiDefaultRcvDatagramHandler@44
+TdiDefaultRcvExpeditedHandler@32
+TdiDefaultReceiveHandler@32
+TdiDefaultSendPossibleHandler@12
+TdiDeregisterAddressChangeHandler@4
+TdiDeregisterDeviceObject@4
+TdiDeregisterNetAddress@4
+;TdiDeregisterNotificationHandler
+TdiDeregisterPnPHandlers@4
+TdiDeregisterProvider@4
+TdiEnumerateAddresses@4
+TdiInitialize@0
+TdiMapUserRequest@12
+TdiMatchPdoWithChainedReceiveContext@8
+;TdiOpenNetbiosAddress
+TdiPnPPowerComplete@12
+TdiPnPPowerRequest@20
+TdiProviderReady@4
+TdiRegisterAddressChangeHandler@12
+TdiRegisterDeviceObject@8
+TdiRegisterNetAddress@16
+TdiRegisterNotificationHandler@12
+TdiRegisterPnPHandlers@12
+TdiRegisterProvider@8
+TdiReturnChainedReceives@8
--- /dev/null
+LIBRARY usbcamd.sys
+EXPORTS
+DllUnload@0
+USBCAMD_AdapterReceivePacket@16
+USBCAMD_ControlVendorCommand@36
+;USBCAMD_Debug_LogEntry
+USBCAMD_DriverEntry@20
+USBCAMD_GetRegistryKeyValue@20
+USBCAMD_InitializeNewInterface@16
+USBCAMD_SelectAlternateInterface@8
--- /dev/null
+LIBRARY usbcamd2.sys
+EXPORTS
+DllUnload@0
+USBCAMD_AdapterReceivePacket@16
+USBCAMD_ControlVendorCommand@36
+;USBCAMD_Debug_LogEntry
+USBCAMD_DriverEntry@20
+USBCAMD_GetRegistryKeyValue@20
+USBCAMD_InitializeNewInterface@16
+USBCAMD_SelectAlternateInterface@8
--- /dev/null
+LIBRARY videoprt.sys
+EXPORTS
+VideoPortAcquireDeviceLock@4
+VideoPortAcquireSpinLock@12
+VideoPortAcquireSpinLockAtDpcLevel@8
+VideoPortAllocateBuffer@12
+VideoPortAllocateCommonBuffer@24
+VideoPortAllocateContiguousMemory@12
+VideoPortAllocatePool@16
+VideoPortAssociateEventsWithDmaHandle@16
+;VideoPortCheckForDeviceExistance
+VideoPortCheckForDeviceExistence@28
+VideoPortClearEvent@8
+VideoPortCompareMemory@12
+VideoPortCompleteDma@16
+VideoPortCreateEvent@16
+VideoPortCreateSecondaryDisplay@12
+VideoPortCreateSpinLock@8
+VideoPortDDCMonitorHelper@16
+VideoPortDebugPrint
+VideoPortDeleteEvent@8
+VideoPortDeleteSpinLock@8
+VideoPortDisableInterrupt@4
+VideoPortDoDma@12
+VideoPortEnableInterrupt@4
+VideoPortEnumerateChildren@8
+;VideoPortFlushRegistry
+VideoPortFreeCommonBuffer@20
+VideoPortFreeDeviceBase@8
+VideoPortFreePool@8
+VideoPortGetAccessRanges@32
+VideoPortGetAgpServices@8
+VideoPortGetAssociatedDeviceExtension@4
+VideoPortGetAssociatedDeviceID@4
+VideoPortGetBusData@24
+VideoPortGetBytesUsed@8
+VideoPortGetCommonBuffer@24
+VideoPortGetCurrentIrql@0
+VideoPortGetDeviceBase@16
+VideoPortGetDeviceData@16
+VideoPortGetDmaAdapter@8
+VideoPortGetDmaContext@8
+VideoPortGetMdl@8
+VideoPortGetRegistryParameters@20
+VideoPortGetRomImage@16
+VideoPortGetVersion@8
+VideoPortGetVgaStatus@8
+VideoPortInitialize@16
+VideoPortInt10@8
+@VideoPortInterlockedDecrement@4
+@VideoPortInterlockedExchange@8
+@VideoPortInterlockedIncrement@4
+VideoPortLockBuffer@16
+VideoPortLockPages@20
+VideoPortLogError@16
+VideoPortMapBankedMemory@36
+VideoPortMapDmaMemory@32
+VideoPortMapMemory@20
+VideoPortMoveMemory@12
+VideoPortPutDmaAdapter@8
+VideoPortQueryPerformanceCounter@8
+VideoPortQueryServices@12
+VideoPortQuerySystemTime@4
+VideoPortQueueDpc@12
+VideoPortReadPortBufferUchar@12
+VideoPortReadPortBufferUlong@12
+VideoPortReadPortBufferUshort@12
+VideoPortReadPortUchar@4
+VideoPortReadPortUlong@4
+VideoPortReadPortUshort@4
+VideoPortReadRegisterBufferUchar@12
+VideoPortReadRegisterBufferUlong@12
+VideoPortReadRegisterBufferUshort@12
+VideoPortReadRegisterUchar@4
+VideoPortReadRegisterUlong@4
+VideoPortReadRegisterUshort@4
+VideoPortReadStateEvent@8
+VideoPortReleaseBuffer@8
+VideoPortReleaseCommonBuffer@24
+VideoPortReleaseDeviceLock@4
+VideoPortReleaseSpinLock@12
+VideoPortReleaseSpinLockFromDpcLevel@8
+VideoPortScanRom@16
+VideoPortSetBusData@24
+VideoPortSetBytesUsed@12
+VideoPortSetDmaContext@12
+VideoPortSetEvent@8
+VideoPortSetRegistryParameters@16
+VideoPortSetTrappedEmulatorPorts@12
+VideoPortSignalDmaComplete@8
+VideoPortStallExecution@4
+VideoPortStartDma@32
+VideoPortStartTimer@4
+VideoPortStopTimer@4
+VideoPortSynchronizeExecution@16
+VideoPortUnlockBuffer@8
+VideoPortUnlockPages@8
+VideoPortUnmapDmaMemory@16
+VideoPortUnmapMemory@12
+VideoPortVerifyAccessRanges@12
+VideoPortWaitForSingleObject@12
+VideoPortWritePortBufferUchar@12
+VideoPortWritePortBufferUlong@12
+VideoPortWritePortBufferUshort@12
+VideoPortWritePortUchar@8
+VideoPortWritePortUlong@8
+VideoPortWritePortUshort@8
+VideoPortWriteRegisterBufferUchar@12
+VideoPortWriteRegisterBufferUlong@12
+VideoPortWriteRegisterBufferUshort@12
+VideoPortWriteRegisterUchar@8
+VideoPortWriteRegisterUlong@8
+VideoPortWriteRegisterUshort@8
+VideoPortZeroDeviceMemory@8
+VideoPortZeroMemory@8
--- /dev/null
+LIBRARY win32k.sys
+EXPORTS
+BRUSHOBJ_hGetColorTransform@4
+BRUSHOBJ_pvAllocRbrush@8
+BRUSHOBJ_pvGetRbrush@4
+BRUSHOBJ_ulGetBrushColor@4
+CLIPOBJ_bEnum@12
+CLIPOBJ_cEnumStart@20
+CLIPOBJ_ppoGetPath@4
+EngAcquireSemaphore@4
+EngAllocMem@12
+EngAllocPrivateUserMem@12
+;EngAllocSectionMem
+EngAllocUserMem@8
+EngAlphaBlend@28
+EngAssociateSurface@12
+EngBitBlt@44
+EngCheckAbort@4
+EngClearEvent@4
+EngComputeGlyphSet@12
+EngControlSprites@8
+EngCopyBits@24
+EngCreateBitmap@20
+EngCreateClip@0
+EngCreateDeviceBitmap@12
+EngCreateDeviceSurface@12
+;EngCreateDriverObj
+EngCreateEvent@4
+EngCreatePalette@24
+EngCreatePath@0
+EngCreateSemaphore@0
+EngCreateWnd@20
+EngDebugBreak@0
+EngDebugPrint@12
+EngDeleteClip@4
+EngDeleteDriverObj@12
+EngDeleteEvent@4
+EngDeleteFile@4
+EngDeletePalette@4
+EngDeletePath@4
+EngDeleteSafeSemaphore@4
+EngDeleteSemaphore@4
+EngDeleteSurface@4
+EngDeleteWnd@4
+EngDeviceIoControl@28
+EngDitherColor@16
+;EngDxIoctl
+EngEnumForms@24
+EngEraseSurface@12
+;EngFileIoControl
+;EngFileWrite
+EngFillPath@28
+EngFindImageProcAddress@8
+EngFindResource@16
+EngFntCacheAlloc@8
+EngFntCacheFault@8
+EngFntCacheLookUp@8
+EngFreeMem@4
+EngFreeModule@4
+EngFreePrivateUserMem@8
+;EngFreeSectionMem
+EngFreeUserMem@4
+EngGetCurrentCodePage@8
+EngGetCurrentProcessId@0
+EngGetCurrentThreadId@0
+EngGetDriverName@4
+EngGetFileChangeTime@8
+EngGetFilePath@8
+EngGetForm@24
+EngGetLastError@0
+EngGetPrinter@20
+EngGetPrinterData@24
+EngGetPrinterDataFileName@4
+EngGetPrinterDriver@24
+EngGetProcessHandle@0
+;EngGetTickCount
+EngGetType1FontList@24
+EngGradientFill@40
+EngHangNotification@8
+EngInitializeSafeSemaphore@4
+EngIsSemaphoreOwned@4
+EngIsSemaphoreOwnedByCurrentThread@4
+EngLineTo@36
+EngLoadImage@4
+EngLoadModule@4
+EngLoadModuleForWrite@8
+EngLockDirectDrawSurface@4
+;EngLockDriverObj
+EngLockSurface@4
+EngLpkInstalled@0
+EngMapEvent@20
+EngMapFile@12
+EngMapFontFile@12
+EngMapFontFileFD@12
+EngMapModule@8
+;EngMapSection
+EngMarkBandingSurface@4
+EngModifySurface@32
+EngMovePointer@16
+EngMulDiv@12
+EngMultiByteToUnicodeN@20
+EngMultiByteToWideChar@20
+;EngNineGrid
+EngPaint@20
+EngPlgBlt@44
+EngProbeForRead@12
+EngProbeForReadAndWrite@12
+EngQueryDeviceAttribute@24
+EngQueryLocalTime@4
+EngQueryPalette@16
+EngQueryPerformanceCounter@4
+EngQueryPerformanceFrequency@4
+EngQuerySystemAttribute@8
+EngReadStateEvent@4
+EngReleaseSemaphore@4
+EngRestoreFloatingPointState@4
+EngSaveFloatingPointState@8
+EngSecureMem@8
+EngSetEvent@4
+EngSetLastError@4
+EngSetPointerShape@40
+EngSetPointerTag@20
+EngSetPrinterData@20
+EngSort@16
+EngStretchBlt@44
+EngStretchBltROP@52
+EngStrokeAndFillPath@40
+EngStrokePath@32
+EngTextOut@40
+EngTransparentBlt@32
+EngUnicodeToMultiByteN@20
+EngUnloadImage@4
+EngUnlockDirectDrawSurface@4
+EngUnlockDriverObj@4
+EngUnlockSurface@4
+EngUnmapEvent@4
+EngUnmapFile@4
+EngUnmapFontFile@4
+EngUnmapFontFileFD@4
+EngUnsecureMem@4
+EngWaitForSingleObject@8
+EngWideCharToMultiByte@20
+EngWritePrinter@16
+FLOATOBJ_Add@8
+FLOATOBJ_AddFloat@8
+;FLOATOBJ_AddFloatObj
+FLOATOBJ_AddLong@8
+FLOATOBJ_Div@8
+FLOATOBJ_DivFloat@8
+;FLOATOBJ_DivFloatObj
+FLOATOBJ_DivLong@8
+FLOATOBJ_Equal@8
+FLOATOBJ_EqualLong@8
+FLOATOBJ_GetFloat@4
+FLOATOBJ_GetLong@4
+FLOATOBJ_GreaterThan@8
+FLOATOBJ_GreaterThanLong@8
+FLOATOBJ_LessThan@8
+FLOATOBJ_LessThanLong@8
+FLOATOBJ_Mul@8
+FLOATOBJ_MulFloat@8
+;FLOATOBJ_MulFloatObj
+FLOATOBJ_MulLong@8
+FLOATOBJ_Neg@4
+FLOATOBJ_SetFloat@8
+FLOATOBJ_SetLong@8
+FLOATOBJ_Sub@8
+FLOATOBJ_SubFloat@8
+;FLOATOBJ_SubFloatObj
+FLOATOBJ_SubLong@8
+FONTOBJ_cGetAllGlyphHandles@8
+FONTOBJ_cGetGlyphs@20
+FONTOBJ_pQueryGlyphAttrs@8
+FONTOBJ_pfdg@4
+FONTOBJ_pifi@4
+FONTOBJ_pjOpenTypeTablePointer@12
+FONTOBJ_pvTrueTypeFontFile@8
+FONTOBJ_pwszFontFilePaths@8
+FONTOBJ_pxoGetXform@4
+FONTOBJ_vGetInfo@12
+HT_ComputeRGBGammaTable@24
+HT_Get8BPPFormatPalette@16
+HT_Get8BPPMaskPalette@24
+HeapVidMemAllocAligned@20
+PALOBJ_cGetColors@16
+PATHOBJ_bCloseFigure@4
+PATHOBJ_bEnum@8
+PATHOBJ_bEnumClipLines@12
+PATHOBJ_bMoveTo@8
+PATHOBJ_bPolyBezierTo@12
+PATHOBJ_bPolyLineTo@12
+PATHOBJ_vEnumStart@4
+PATHOBJ_vEnumStartClipLines@16
+PATHOBJ_vGetBounds@8
+;RtlAnsiCharToUnicodeChar
+;RtlMultiByteToUnicodeN
+;RtlRaiseException
+;RtlUnicodeToMultiByteN
+;RtlUnicodeToMultiByteSize
+;RtlUnwind
+RtlUpcaseUnicodeChar@4
+;RtlUpcaseUnicodeToMultiByteN
+STROBJ_bEnum@12
+STROBJ_bEnumPositionsOnly@12
+STROBJ_bGetAdvanceWidths@16
+STROBJ_dwGetCodePage@4
+STROBJ_fxBreakExtra@4
+STROBJ_fxCharacterExtra@4
+STROBJ_vEnumStart@4
+VidMemFree@8
+WNDOBJ_bEnum@12
+WNDOBJ_cEnumStart@16
+WNDOBJ_vSetConsumer@8
+XFORMOBJ_bApplyXform@20
+XFORMOBJ_iGetFloatObjXform@8
+XFORMOBJ_iGetXform@8
+XLATEOBJ_cGetPalette@16
+XLATEOBJ_hGetColorTransform@4
+XLATEOBJ_iXlate@8
+XLATEOBJ_piVector@4
+;_abnormal_termination
+;_except_handler2
+;_global_unwind2
+;_itoa
+;_itow
+;_local_unwind2