https://git.reactos.org/?p=reactos.git;a=commitdiff;h=40462c924e9dce2f00e73f93f4b91f6b757234e4
commit 40462c924e9dce2f00e73f93f4b91f6b757234e4 Author: Victor Perevertkin <victor.perevert...@reactos.org> AuthorDate: Thu Sep 24 23:41:01 2020 +0300 Commit: Victor Perevertkin <victor.perevert...@reactos.org> CommitDate: Mon Nov 2 22:07:15 2020 +0300 [KMDF] Add Kernel-Mode Driver Framework headers v1.17 Taken from Microsoft GitHub repo: https://github.com/microsoft/Windows-Driver-Frameworks/commit/d9c6040fe9fa787964ea99c48a8b35cf1aa978f7 Licensed under MIT --- sdk/include/wdf/kmdf/1.17/wdf.h | 130 + sdk/include/wdf/kmdf/1.17/wdfassert.h | 107 + sdk/include/wdf/kmdf/1.17/wdfbugcodes.h | 145 + sdk/include/wdf/kmdf/1.17/wdfchildlist.h | 858 +++++ sdk/include/wdf/kmdf/1.17/wdfcollection.h | 284 ++ sdk/include/wdf/kmdf/1.17/wdfcommonbuffer.h | 249 ++ sdk/include/wdf/kmdf/1.17/wdfcontrol.h | 168 + sdk/include/wdf/kmdf/1.17/wdfcore.h | 176 + sdk/include/wdf/kmdf/1.17/wdfdevice.h | 4496 +++++++++++++++++++++++++ sdk/include/wdf/kmdf/1.17/wdfdmaenabler.h | 509 +++ sdk/include/wdf/kmdf/1.17/wdfdmatransaction.h | 890 +++++ sdk/include/wdf/kmdf/1.17/wdfdpc.h | 243 ++ sdk/include/wdf/kmdf/1.17/wdfdriver.h | 460 +++ sdk/include/wdf/kmdf/1.17/wdffdo.h | 643 ++++ sdk/include/wdf/kmdf/1.17/wdffileobject.h | 166 + sdk/include/wdf/kmdf/1.17/wdffuncenum.h | 473 +++ sdk/include/wdf/kmdf/1.17/wdfglobals.h | 85 + sdk/include/wdf/kmdf/1.17/wdfhwaccess.h | 75 + sdk/include/wdf/kmdf/1.17/wdfinstaller.h | 165 + sdk/include/wdf/kmdf/1.17/wdfinterrupt.h | 810 +++++ sdk/include/wdf/kmdf/1.17/wdfio.h | 1177 +++++++ sdk/include/wdf/kmdf/1.17/wdfiotarget.h | 1351 ++++++++ sdk/include/wdf/kmdf/1.17/wdfmemory.h | 480 +++ sdk/include/wdf/kmdf/1.17/wdfminiport.h | 130 + sdk/include/wdf/kmdf/1.17/wdfobject.h | 837 +++++ sdk/include/wdf/kmdf/1.17/wdfpdo.h | 799 +++++ sdk/include/wdf/kmdf/1.17/wdfpool.h | 61 + sdk/include/wdf/kmdf/1.17/wdfqueryinterface.h | 215 ++ sdk/include/wdf/kmdf/1.17/wdfregistry.h | 737 ++++ sdk/include/wdf/kmdf/1.17/wdfrequest.h | 1768 ++++++++++ sdk/include/wdf/kmdf/1.17/wdfresource.h | 724 ++++ sdk/include/wdf/kmdf/1.17/wdfroletypes.h | 62 + sdk/include/wdf/kmdf/1.17/wdfstatus.h | 254 ++ sdk/include/wdf/kmdf/1.17/wdfstring.h | 124 + sdk/include/wdf/kmdf/1.17/wdfsync.h | 318 ++ sdk/include/wdf/kmdf/1.17/wdftimer.h | 264 ++ sdk/include/wdf/kmdf/1.17/wdftraceenums.h | 91 + sdk/include/wdf/kmdf/1.17/wdftypes.h | 176 + sdk/include/wdf/kmdf/1.17/wdfusb.h | 2592 ++++++++++++++ sdk/include/wdf/kmdf/1.17/wdfverifier.h | 138 + sdk/include/wdf/kmdf/1.17/wdfwmi.h | 642 ++++ sdk/include/wdf/kmdf/1.17/wdfworkitem.h | 215 ++ 42 files changed, 24287 insertions(+) diff --git a/sdk/include/wdf/kmdf/1.17/wdf.h b/sdk/include/wdf/kmdf/1.17/wdf.h new file mode 100644 index 00000000000..892aaa506ac --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdf.h @@ -0,0 +1,130 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + wdf.h + +Abstract: + + Main header file for Windows Driver Frameworks + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDF_H_ +#define _WDF_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + +#ifndef _Dispatch_type_ +#include <driverspecs.h> +#endif + + + + + +// +// Rename WdfFunctions to match version number. Build issues relating to +// unresolved externals of WdfFunctions or WdfFunctions_XXXXX indicate +// multiple WDF versions are being included. Ensure WDF version of all input +// binaries match to resolve. +// +#define WdfFunctions WdfFunctions_01017 + +typedef VOID (*WDFFUNC) (VOID); +extern const WDFFUNC *WdfFunctions; +extern WDFFUNC WdfDriverMiniportUnloadOverride; + +_Analysis_mode_(KMDF_INCLUDED) + +// Basic definitions +#include "wdftypes.h" +#include "wdfglobals.h" +#include "wdffuncenum.h" +#include "wdfstatus.h" +#include "wdfassert.h" +#include "wdfverifier.h" +#include "wdfpool.h" + +// generic object +#include "wdfobject.h" + +// Synchronization +#include "wdfsync.h" + +#include "wdfcore.h" + +#include "wdfdriver.h" + +// Objects +#include "WdfQueryInterface.h" +#include "wdfmemory.h" +#include "wdfchildlist.h" +#include "wdffileobject.h" +#include "wdfdevice.h" +#include "wdfcollection.h" +#include "wdfdpc.h" +#include "wdftimer.h" +#include "wdfworkitem.h" +#include "wdfinterrupt.h" +#include "wdfresource.h" + +// I/O +#include "wdfrequest.h" +#include "wdfiotarget.h" +#include "wdfio.h" + +// particular device types +#include "wdffdo.h" +#include "wdfpdo.h" +#include "wdfcontrol.h" + +#include "WdfWMI.h" + +#include "wdfstring.h" +#include "wdfregistry.h" + +// Dma +#include "wdfDmaEnabler.h" +#include "wdfDmaTransaction.h" +#include "wdfCommonBuffer.h" + +#include "wdfbugcodes.h" +#include "wdfroletypes.h" +#include "wdfhwaccess.h" + + + + +WDF_EXTERN_C_END + +#endif // _WDF_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfassert.h b/sdk/include/wdf/kmdf/1.17/wdfassert.h new file mode 100644 index 00000000000..a61dae07b52 --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfassert.h @@ -0,0 +1,107 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + WdfAssert.h + +Abstract: + + Contains prototypes for dealing with run time asserts + +Author: + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFASSERT_H_ +#define _WDFASSERT_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + +// +// Including here because RtlAssert is not declared in XP and Win2K headers for +// free builds +// +NTSYSAPI +VOID +NTAPI +RtlAssert( + _In_ PVOID FailedAssertion, + _In_ PVOID FileName, + _In_ ULONG LineNumber, + _In_opt_ PSTR Message + ); + + + +// +// WDFVERIFY is active both on checked and free build only if +// the wdf verifier is tuned on +// +#define WDFVERIFY(exp) { \ + if ((WdfDriverGlobals->DriverFlags & WdfVerifyOn) && !(exp)) { \ + RtlAssert( #exp, __FILE__, __LINE__, NULL ); \ + } \ +} + +#define VERIFY_IS_IRQL_PASSIVE_LEVEL() WDFVERIFY(KeGetCurrentIrql() == PASSIVE_LEVEL) + +// +// Following macro is obsolete and it will be phased out in due course +// +#define IS_AT_PASSIVE() WDFVERIFY(KeGetCurrentIrql() == PASSIVE_LEVEL) + +// +// Compile time active "assert". File will not compile if this assert is FALSE. +// +// This compile time assert is designed to catch mismatch in the values of the +// declared constants. So suppress the OACR warning #6326 generated about the +// potential comparison of constants. +// +#define WDFCASSERT(c) { \ + __pragma(warning(suppress: 6326)) \ + switch(0) case (c): case 0: ; \ + } + + + + + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) + +WDF_EXTERN_C_END + +#endif // _WDFASSERT_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfbugcodes.h b/sdk/include/wdf/kmdf/1.17/wdfbugcodes.h new file mode 100644 index 00000000000..245edcc4379 --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfbugcodes.h @@ -0,0 +1,145 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + wdfbugcodes.h + +Abstract: + + Lists bugcheck subcode values for the WDF_VIOLATION bugcheck code + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFBUGCODES_H_ +#define _WDFBUGCODES_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + +// +// These values are used in Parameter 1 in the bugcheck data +// +// NOTE: Do not change these codes, only add to the end. +// The OCA analysis and debugger tools will look at +// these codes to perform fault analysis. +// +typedef enum _WDF_BUGCHECK_CODES { + WDF_POWER_ROUTINE_TIMED_OUT = 0x1, + WDF_RECURSIVE_LOCK = 0x2, + WDF_VERIFIER_FATAL_ERROR = 0x3, + WDF_REQUIRED_PARAMETER_IS_NULL = 0x4, + WDF_INVALID_HANDLE = 0x5, + WDF_REQUEST_FATAL_ERROR = 0x6, + WDF_OBJECT_ERROR = 0x7, + WDF_DMA_FATAL_ERROR = 0x8, + WDF_INVALID_INTERRUPT = 0x9, + WDF_QUEUE_FATAL_ERROR = 0xA, + WDF_INVALID_LOCK_OPERATION = 0xB, + WDF_PNP_FATAL_ERROR = 0xC, + WDF_POWER_MULTIPLE_PPO = 0xD, + WDF_VERIFIER_IRQL_MISMATCH = 0xE, + WDF_VERIFIER_CRITICAL_REGION_MISMATCH = 0xF, +} WDF_BUGCHECK_CODES; + +typedef enum _WDF_REQUEST_FATAL_ERROR_CODES { + WDF_REQUEST_FATAL_ERROR_NO_MORE_STACK_LOCATIONS = 0x1, + WDF_REQUEST_FATAL_ERROR_NULL_IRP = 0x2, + WDF_REQUEST_FATAL_ERROR_REQUEST_ALREADY_SENT = 0x3, + WDF_REQUEST_FATAL_ERROR_INFORMATION_LENGTH_MISMATCH = 0x4, + WDF_REQUEST_FATAL_ERROR_REQUEST_NOT_IN_QUEUE = 05, +} WDF_REQUEST_FATAL_ERROR_CODES; + + + +typedef struct _WDF_POWER_ROUTINE_TIMED_OUT_DATA { + // + // Current power state associated with the timed out device + // + WDF_DEVICE_POWER_STATE PowerState; + + // + // Current power policy state associated with the timed out device + // + WDF_DEVICE_POWER_POLICY_STATE PowerPolicyState; + + // + // The device object for the timed out device + // + PDEVICE_OBJECT DeviceObject; + + // + // The handle for the timed out device + // + WDFDEVICE Device; + + // + // The thread which is stuck + // + PKTHREAD TimedOutThread; + +} WDF_POWER_ROUTINE_TIMED_OUT_DATA; + +typedef struct _WDF_REQUEST_FATAL_ERROR_INFORMATION_LENGTH_MISMATCH_DATA { + WDFREQUEST Request; + + PIRP Irp; + + ULONG OutputBufferLength; + + ULONG_PTR Information; + + UCHAR MajorFunction; + +} WDF_REQUEST_FATAL_ERROR_INFORMATION_LENGTH_MISMATCH_DATA, + *PWDF_REQUEST_FATAL_ERROR_INFORMATION_LENGTH_MISMATCH_DATA; + +typedef struct _WDF_QUEUE_FATAL_ERROR_DATA { + WDFQUEUE Queue; + + WDFREQUEST Request; + + NTSTATUS Status; + +} WDF_QUEUE_FATAL_ERROR_DATA, *PWDF_QUEUE_FATAL_ERROR_DATA; + + + + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) + + +WDF_EXTERN_C_END + +#endif // _WDFBUGCODES_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfchildlist.h b/sdk/include/wdf/kmdf/1.17/wdfchildlist.h new file mode 100644 index 00000000000..14f96550b2c --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfchildlist.h @@ -0,0 +1,858 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + WdfChildList.hpp + +Abstract: + + This module defines the set of APIs to manipulate a WDFCHILDLIST handle. A + WDFCHILDLIST handle maintains a list of descriptions representing + dynamically enumerated child devices. + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFCHILDLIST_H_ +#define _WDFCHILDLIST_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + +typedef enum _WDF_CHILD_LIST_RETRIEVE_DEVICE_STATUS { + WdfChildListRetrieveDeviceUndefined = 0, + WdfChildListRetrieveDeviceSuccess, + WdfChildListRetrieveDeviceNotYetCreated, + WdfChildListRetrieveDeviceNoSuchDevice, +} WDF_CHILD_LIST_RETRIEVE_DEVICE_STATUS, *PWDF_CHILD_LIST_RETRIEVE_DEVICE_STATUS; + +typedef enum _WDF_RETRIEVE_CHILD_FLAGS { + WdfRetrieveUnspecified = 0x0000, + WdfRetrievePresentChildren = 0x0001, + WdfRetrieveMissingChildren = 0x0002, + WdfRetrievePendingChildren = 0x0004, + WdfRetrieveAddedChildren = (WdfRetrievePresentChildren | WdfRetrievePendingChildren), + WdfRetrieveAllChildren = (WdfRetrievePresentChildren | WdfRetrievePendingChildren | WdfRetrieveMissingChildren), +} WDF_RETRIEVE_CHILD_FLAGS; + + + +typedef struct _WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER { + // + // Size in bytes of the entire description, including this header. + // + // Same value as WDF_CHILD_LIST_CONFIG::IdentificationDescriptionSize + // Used as a sanity check. + // + ULONG IdentificationDescriptionSize; +} WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER, + *PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER; + +VOID +FORCEINLINE +WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER_INIT( + _Out_ PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Header, + _In_ ULONG IdentificationDescriptionSize + ) +{ + RtlZeroMemory(Header, IdentificationDescriptionSize); + Header->IdentificationDescriptionSize = IdentificationDescriptionSize; +} + +typedef struct _WDF_CHILD_ADDRESS_DESCRIPTION_HEADER { + // + // Size in bytes of the entire description, including this header. + // + // Same value as WDF_CHILD_LIST_CONFIG::AddressDescriptionSize + // Used as a sanity check. + // + ULONG AddressDescriptionSize; +} WDF_CHILD_ADDRESS_DESCRIPTION_HEADER, + *PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER; + +VOID +FORCEINLINE +WDF_CHILD_ADDRESS_DESCRIPTION_HEADER_INIT( + _Out_ PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER Header, + _In_ ULONG AddressDescriptionSize + ) +{ + RtlZeroMemory(Header, AddressDescriptionSize); + Header->AddressDescriptionSize = AddressDescriptionSize; +} + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_CREATE_DEVICE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_CHILD_LIST_CREATE_DEVICE( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription, + _In_ + PWDFDEVICE_INIT ChildInit + ); + +typedef EVT_WDF_CHILD_LIST_CREATE_DEVICE *PFN_WDF_CHILD_LIST_CREATE_DEVICE; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_SCAN_FOR_CHILDREN) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_CHILD_LIST_SCAN_FOR_CHILDREN( + _In_ + WDFCHILDLIST ChildList + ); + +typedef EVT_WDF_CHILD_LIST_SCAN_FOR_CHILDREN *PFN_WDF_CHILD_LIST_SCAN_FOR_CHILDREN; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COPY) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COPY( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER SourceIdentificationDescription, + _Out_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER DestinationIdentificationDescription + ); + +typedef EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COPY *PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COPY; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_DUPLICATE) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_DUPLICATE( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER SourceIdentificationDescription, + _Out_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER DestinationIdentificationDescription + ); + +typedef EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_DUPLICATE *PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_DUPLICATE; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COMPARE) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +BOOLEAN +EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COMPARE( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER FirstIdentificationDescription, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER SecondIdentificationDescription + ); + +typedef EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COMPARE *PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COMPARE; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_CLEANUP) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_CLEANUP( + _In_ + WDFCHILDLIST ChildList, + _Inout_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription + ); + +typedef EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_CLEANUP *PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_CLEANUP; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_COPY) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_COPY( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER SourceAddressDescription, + _Out_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER DestinationAddressDescription + ); + +typedef EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_COPY *PFN_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_COPY; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_DUPLICATE) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_DUPLICATE( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER SourceAddressDescription, + _Out_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER DestinationAddressDescription + ); + +typedef EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_DUPLICATE *PFN_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_DUPLICATE; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_CLEANUP) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_CLEANUP( + _In_ + WDFCHILDLIST ChildList, + _Inout_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription + ); + +typedef EVT_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_CLEANUP *PFN_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_CLEANUP; + +typedef +_Function_class_(EVT_WDF_CHILD_LIST_DEVICE_REENUMERATED) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +BOOLEAN +EVT_WDF_CHILD_LIST_DEVICE_REENUMERATED( + _In_ + WDFCHILDLIST ChildList, + _In_ + WDFDEVICE OldDevice, + _In_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER OldAddressDescription, + _Out_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER NewAddressDescription + ); + +typedef EVT_WDF_CHILD_LIST_DEVICE_REENUMERATED *PFN_WDF_CHILD_LIST_DEVICE_REENUMERATED; + +typedef struct _WDF_CHILD_RETRIEVE_INFO { + // + // Size of the structure in bytes + // + ULONG Size; + + // + // Must be a valid pointer when passed in, copied into upon success + // + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription; + + // + // Optional pointer when passed in, copied into upon success + // + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription; + + // + // Status of the returned device + // + WDF_CHILD_LIST_RETRIEVE_DEVICE_STATUS Status; + + // + // If provided, will be used for searching through the list of devices + // instead of the default list ID compare function + // + PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COMPARE EvtChildListIdentificationDescriptionCompare; + +} WDF_CHILD_RETRIEVE_INFO, *PWDF_CHILD_RETRIEVE_INFO; + +VOID +FORCEINLINE +WDF_CHILD_RETRIEVE_INFO_INIT( + _Out_ PWDF_CHILD_RETRIEVE_INFO Info, + _In_ PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription + ) +{ + RtlZeroMemory(Info, sizeof(WDF_CHILD_RETRIEVE_INFO)); + + Info->Size = sizeof(WDF_CHILD_RETRIEVE_INFO); + Info->IdentificationDescription = IdentificationDescription; +} + +typedef struct _WDF_CHILD_LIST_CONFIG { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // The size in bytes of an identificaiton description to be used with the + // created WDFCHILDLIST handle + // + ULONG IdentificationDescriptionSize; + + // + // Optional size in bytes of an address description to be used with the + // created WDFCHILDLIST handle. + // + ULONG AddressDescriptionSize; + + // + // Required callback to be invoked when a description on the device list + // needs to be converted into a real WDFDEVICE handle. + // + PFN_WDF_CHILD_LIST_CREATE_DEVICE EvtChildListCreateDevice; + + // + // Optional callback to be invoked when the device list needs to be + // rescanned. This function will be called after the device has entered D0 + // and been fully initialized but before I/O has started. + // + PFN_WDF_CHILD_LIST_SCAN_FOR_CHILDREN EvtChildListScanForChildren; + + // + // Optional callback to be invoked when an identification description needs + // to be copied from one location to another. + // + // If left NULL, RtlCopyMemory will be used to copy the description. + // + PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COPY EvtChildListIdentificationDescriptionCopy; + + // + // Optional callback to be invoked when an identification description needs + // to be duplicated. As opposed to EvtChildListIdentificationDescriptionCopy, + // EvtChildListIdentificationDescriptionDuplicate can fail. + // + PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_DUPLICATE EvtChildListIdentificationDescriptionDuplicate; + + // + // Optional callback to be invoked when an identification description needs + // to be cleaned up. This function should *NOT* free the description passed + // to it, just free any associated resources. + // + PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_CLEANUP EvtChildListIdentificationDescriptionCleanup; + + // + // Optional callback to be invoked when an identification description needs + // to be compared with another identificaiton description. + // + // If left NULL, RtlCompareMemory will be used to compare the two + // descriptions. + // + PFN_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_COMPARE EvtChildListIdentificationDescriptionCompare; + + // + // Optional callback to be invoked when an address description needs + // to be copied from one location to another. + // + // If left NULL, RtlCopyMemory will be used to copy the description. + // + PFN_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_COPY EvtChildListAddressDescriptionCopy; + + // + // Optional callback to be invoked when an address description needs to be + // duplicated. As opposed to EvtChildListAddressDescriptionCopy, + // EvtChildListAddressDescriptionDuplicate can fail. + // + PFN_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_DUPLICATE EvtChildListAddressDescriptionDuplicate; + + // + // Optional callback to be invoked when an address description needs to be + // cleaned up. This function should *NOT* free the description passed to + // it, just free any associated resources. + // + PFN_WDF_CHILD_LIST_ADDRESS_DESCRIPTION_CLEANUP EvtChildListAddressDescriptionCleanup; + + // + // If provided, will be called when the child's stack requests that the + // child be reenumerated. Returning TRUE allows for the reenumeration to + // proceed. FALSE will no reenumerate the stack. + // + PFN_WDF_CHILD_LIST_DEVICE_REENUMERATED EvtChildListDeviceReenumerated; + +} WDF_CHILD_LIST_CONFIG, *PWDF_CHILD_LIST_CONFIG; + +VOID +FORCEINLINE +WDF_CHILD_LIST_CONFIG_INIT( + _Out_ PWDF_CHILD_LIST_CONFIG Config, + _In_ ULONG IdentificationDescriptionSize, + _In_ PFN_WDF_CHILD_LIST_CREATE_DEVICE EvtChildListCreateDevice + ) +{ + RtlZeroMemory(Config, sizeof(WDF_CHILD_LIST_CONFIG)); + + Config->Size = sizeof(WDF_CHILD_LIST_CONFIG); + Config->IdentificationDescriptionSize = IdentificationDescriptionSize; + Config->EvtChildListCreateDevice = EvtChildListCreateDevice; +} + +typedef struct _WDF_CHILD_LIST_ITERATOR { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // What type of devices to return, see WDF_RETRIEVE_CHILD_FLAGS for + // flag values + // + // + ULONG Flags; + + // + // For internal use, treat this field as opaque + // + PVOID Reserved[4]; + +} WDF_CHILD_LIST_ITERATOR, *PWDF_CHILD_LIST_ITERATOR; + +VOID +FORCEINLINE +WDF_CHILD_LIST_ITERATOR_INIT( + _Out_ PWDF_CHILD_LIST_ITERATOR Iterator, + _In_ ULONG Flags + ) +{ + RtlZeroMemory(Iterator, sizeof(WDF_CHILD_LIST_ITERATOR)); + + Iterator->Size = sizeof(WDF_CHILD_LIST_ITERATOR); + Iterator->Flags = Flags; +} + + +// +// WDF Function: WdfChildListCreate +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCHILDLISTCREATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PWDF_CHILD_LIST_CONFIG Config, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES ChildListAttributes, + _Out_ + WDFCHILDLIST* ChildList + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FORCEINLINE +WdfChildListCreate( + _In_ + WDFDEVICE Device, + _In_ + PWDF_CHILD_LIST_CONFIG Config, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES ChildListAttributes, + _Out_ + WDFCHILDLIST* ChildList + ) +{ + return ((PFN_WDFCHILDLISTCREATE) WdfFunctions[WdfChildListCreateTableIndex])(WdfDriverGlobals, Device, Config, ChildListAttributes, ChildList); +} + +// +// WDF Function: WdfChildListGetDevice +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFDEVICE +(*PFN_WDFCHILDLISTGETDEVICE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFDEVICE +FORCEINLINE +WdfChildListGetDevice( + _In_ + WDFCHILDLIST ChildList + ) +{ + return ((PFN_WDFCHILDLISTGETDEVICE) WdfFunctions[WdfChildListGetDeviceTableIndex])(WdfDriverGlobals, ChildList); +} + +// +// WDF Function: WdfChildListRetrievePdo +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFDEVICE +(*PFN_WDFCHILDLISTRETRIEVEPDO)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _Inout_ + PWDF_CHILD_RETRIEVE_INFO RetrieveInfo + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFDEVICE +FORCEINLINE +WdfChildListRetrievePdo( + _In_ + WDFCHILDLIST ChildList, + _Inout_ + PWDF_CHILD_RETRIEVE_INFO RetrieveInfo + ) +{ + return ((PFN_WDFCHILDLISTRETRIEVEPDO) WdfFunctions[WdfChildListRetrievePdoTableIndex])(WdfDriverGlobals, ChildList, RetrieveInfo); +} + +// +// WDF Function: WdfChildListRetrieveAddressDescription +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCHILDLISTRETRIEVEADDRESSDESCRIPTION)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription, + _Inout_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfChildListRetrieveAddressDescription( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription, + _Inout_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription + ) +{ + return ((PFN_WDFCHILDLISTRETRIEVEADDRESSDESCRIPTION) WdfFunctions[WdfChildListRetrieveAddressDescriptionTableIndex])(WdfDriverGlobals, ChildList, IdentificationDescription, AddressDescription); +} + +// +// WDF Function: WdfChildListBeginScan +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCHILDLISTBEGINSCAN)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfChildListBeginScan( + _In_ + WDFCHILDLIST ChildList + ) +{ + ((PFN_WDFCHILDLISTBEGINSCAN) WdfFunctions[WdfChildListBeginScanTableIndex])(WdfDriverGlobals, ChildList); +} + +// +// WDF Function: WdfChildListEndScan +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCHILDLISTENDSCAN)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfChildListEndScan( + _In_ + WDFCHILDLIST ChildList + ) +{ + ((PFN_WDFCHILDLISTENDSCAN) WdfFunctions[WdfChildListEndScanTableIndex])(WdfDriverGlobals, ChildList); +} + +// +// WDF Function: WdfChildListBeginIteration +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCHILDLISTBEGINITERATION)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_LIST_ITERATOR Iterator + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfChildListBeginIteration( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_LIST_ITERATOR Iterator + ) +{ + ((PFN_WDFCHILDLISTBEGINITERATION) WdfFunctions[WdfChildListBeginIterationTableIndex])(WdfDriverGlobals, ChildList, Iterator); +} + +// +// WDF Function: WdfChildListRetrieveNextDevice +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCHILDLISTRETRIEVENEXTDEVICE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_LIST_ITERATOR Iterator, + _Out_ + WDFDEVICE* Device, + _Inout_opt_ + PWDF_CHILD_RETRIEVE_INFO Info + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfChildListRetrieveNextDevice( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_LIST_ITERATOR Iterator, + _Out_ + WDFDEVICE* Device, + _Inout_opt_ + PWDF_CHILD_RETRIEVE_INFO Info + ) +{ + return ((PFN_WDFCHILDLISTRETRIEVENEXTDEVICE) WdfFunctions[WdfChildListRetrieveNextDeviceTableIndex])(WdfDriverGlobals, ChildList, Iterator, Device, Info); +} + +// +// WDF Function: WdfChildListEndIteration +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCHILDLISTENDITERATION)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_LIST_ITERATOR Iterator + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfChildListEndIteration( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_LIST_ITERATOR Iterator + ) +{ + ((PFN_WDFCHILDLISTENDITERATION) WdfFunctions[WdfChildListEndIterationTableIndex])(WdfDriverGlobals, ChildList, Iterator); +} + +// +// WDF Function: WdfChildListAddOrUpdateChildDescriptionAsPresent +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCHILDLISTADDORUPDATECHILDDESCRIPTIONASPRESENT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription, + _In_opt_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfChildListAddOrUpdateChildDescriptionAsPresent( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription, + _In_opt_ + PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription + ) +{ + return ((PFN_WDFCHILDLISTADDORUPDATECHILDDESCRIPTIONASPRESENT) WdfFunctions[WdfChildListAddOrUpdateChildDescriptionAsPresentTableIndex])(WdfDriverGlobals, ChildList, IdentificationDescription, AddressDescription); +} + +// +// WDF Function: WdfChildListUpdateChildDescriptionAsMissing +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCHILDLISTUPDATECHILDDESCRIPTIONASMISSING)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfChildListUpdateChildDescriptionAsMissing( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription + ) +{ + return ((PFN_WDFCHILDLISTUPDATECHILDDESCRIPTIONASMISSING) WdfFunctions[WdfChildListUpdateChildDescriptionAsMissingTableIndex])(WdfDriverGlobals, ChildList, IdentificationDescription); +} + +// +// WDF Function: WdfChildListUpdateAllChildDescriptionsAsPresent +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCHILDLISTUPDATEALLCHILDDESCRIPTIONSASPRESENT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfChildListUpdateAllChildDescriptionsAsPresent( + _In_ + WDFCHILDLIST ChildList + ) +{ + ((PFN_WDFCHILDLISTUPDATEALLCHILDDESCRIPTIONSASPRESENT) WdfFunctions[WdfChildListUpdateAllChildDescriptionsAsPresentTableIndex])(WdfDriverGlobals, ChildList); +} + +// +// WDF Function: WdfChildListRequestChildEject +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +BOOLEAN +(*PFN_WDFCHILDLISTREQUESTCHILDEJECT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +BOOLEAN +FORCEINLINE +WdfChildListRequestChildEject( + _In_ + WDFCHILDLIST ChildList, + _In_ + PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription + ) +{ + return ((PFN_WDFCHILDLISTREQUESTCHILDEJECT) WdfFunctions[WdfChildListRequestChildEjectTableIndex])(WdfDriverGlobals, ChildList, IdentificationDescription); +} + + + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) + + + +WDF_EXTERN_C_END + +#endif // _WDFCHILDLIST_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfcollection.h b/sdk/include/wdf/kmdf/1.17/wdfcollection.h new file mode 100644 index 00000000000..c28ecab6c15 --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfcollection.h @@ -0,0 +1,284 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + WdfCollection.h + +Abstract: + + This is the interface to the collection object + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFCOLLECTION_H_ +#define _WDFCOLLECTION_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + + + +// +// WDF Function: WdfCollectionCreate +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCOLLECTIONCREATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES CollectionAttributes, + _Out_ + WDFCOLLECTION* Collection + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfCollectionCreate( + _In_opt_ + PWDF_OBJECT_ATTRIBUTES CollectionAttributes, + _Out_ + WDFCOLLECTION* Collection + ) +{ + return ((PFN_WDFCOLLECTIONCREATE) WdfFunctions[WdfCollectionCreateTableIndex])(WdfDriverGlobals, CollectionAttributes, Collection); +} + +// +// WDF Function: WdfCollectionGetCount +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +ULONG +(*PFN_WDFCOLLECTIONGETCOUNT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOLLECTION Collection + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +ULONG +FORCEINLINE +WdfCollectionGetCount( + _In_ + WDFCOLLECTION Collection + ) +{ + return ((PFN_WDFCOLLECTIONGETCOUNT) WdfFunctions[WdfCollectionGetCountTableIndex])(WdfDriverGlobals, Collection); +} + +// +// WDF Function: WdfCollectionAdd +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCOLLECTIONADD)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOLLECTION Collection, + _In_ + WDFOBJECT Object + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfCollectionAdd( + _In_ + WDFCOLLECTION Collection, + _In_ + WDFOBJECT Object + ) +{ + return ((PFN_WDFCOLLECTIONADD) WdfFunctions[WdfCollectionAddTableIndex])(WdfDriverGlobals, Collection, Object); +} + +// +// WDF Function: WdfCollectionRemove +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCOLLECTIONREMOVE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOLLECTION Collection, + _In_ + WDFOBJECT Item + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfCollectionRemove( + _In_ + WDFCOLLECTION Collection, + _In_ + WDFOBJECT Item + ) +{ + ((PFN_WDFCOLLECTIONREMOVE) WdfFunctions[WdfCollectionRemoveTableIndex])(WdfDriverGlobals, Collection, Item); +} + +// +// WDF Function: WdfCollectionRemoveItem +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCOLLECTIONREMOVEITEM)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOLLECTION Collection, + _In_ + ULONG Index + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfCollectionRemoveItem( + _In_ + WDFCOLLECTION Collection, + _In_ + ULONG Index + ) +{ + ((PFN_WDFCOLLECTIONREMOVEITEM) WdfFunctions[WdfCollectionRemoveItemTableIndex])(WdfDriverGlobals, Collection, Index); +} + +// +// WDF Function: WdfCollectionGetItem +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFOBJECT +(*PFN_WDFCOLLECTIONGETITEM)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOLLECTION Collection, + _In_ + ULONG Index + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFOBJECT +FORCEINLINE +WdfCollectionGetItem( + _In_ + WDFCOLLECTION Collection, + _In_ + ULONG Index + ) +{ + return ((PFN_WDFCOLLECTIONGETITEM) WdfFunctions[WdfCollectionGetItemTableIndex])(WdfDriverGlobals, Collection, Index); +} + +// +// WDF Function: WdfCollectionGetFirstItem +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFOBJECT +(*PFN_WDFCOLLECTIONGETFIRSTITEM)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOLLECTION Collection + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFOBJECT +FORCEINLINE +WdfCollectionGetFirstItem( + _In_ + WDFCOLLECTION Collection + ) +{ + return ((PFN_WDFCOLLECTIONGETFIRSTITEM) WdfFunctions[WdfCollectionGetFirstItemTableIndex])(WdfDriverGlobals, Collection); +} + +// +// WDF Function: WdfCollectionGetLastItem +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFOBJECT +(*PFN_WDFCOLLECTIONGETLASTITEM)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOLLECTION Collection + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFOBJECT +FORCEINLINE +WdfCollectionGetLastItem( + _In_ + WDFCOLLECTION Collection + ) +{ + return ((PFN_WDFCOLLECTIONGETLASTITEM) WdfFunctions[WdfCollectionGetLastItemTableIndex])(WdfDriverGlobals, Collection); +} + + + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) + + +WDF_EXTERN_C_END + +#endif // _WDFCOLLECTION_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfcommonbuffer.h b/sdk/include/wdf/kmdf/1.17/wdfcommonbuffer.h new file mode 100644 index 00000000000..018a83241ab --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfcommonbuffer.h @@ -0,0 +1,249 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + WdfCommonBuffer.h + +Abstract: + + WDF CommonBuffer support + +Environment: + + Kernel mode only. + +Notes: + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFCOMMONBUFFER_H_ +#define _WDFCOMMONBUFFER_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + + + +typedef struct _WDF_COMMON_BUFFER_CONFIG { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // Alignment requirement of the buffer address + // + ULONG AlignmentRequirement; + +} WDF_COMMON_BUFFER_CONFIG, *PWDF_COMMON_BUFFER_CONFIG; + +VOID +FORCEINLINE +WDF_COMMON_BUFFER_CONFIG_INIT( + _Out_ PWDF_COMMON_BUFFER_CONFIG Config, + _In_ ULONG AlignmentRequirement + ) +{ + RtlZeroMemory(Config, sizeof(WDF_COMMON_BUFFER_CONFIG)); + + Config->Size = sizeof(WDF_COMMON_BUFFER_CONFIG); + Config->AlignmentRequirement = AlignmentRequirement; +} + +// +// WDF Function: WdfCommonBufferCreate +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCOMMONBUFFERCREATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDMAENABLER DmaEnabler, + _In_ + _When_(Length == 0, __drv_reportError(Length cannot be zero)) + size_t Length, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES Attributes, + _Out_ + WDFCOMMONBUFFER* CommonBuffer + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FORCEINLINE +WdfCommonBufferCreate( + _In_ + WDFDMAENABLER DmaEnabler, + _In_ + _When_(Length == 0, __drv_reportError(Length cannot be zero)) + size_t Length, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES Attributes, + _Out_ + WDFCOMMONBUFFER* CommonBuffer + ) +{ + return ((PFN_WDFCOMMONBUFFERCREATE) WdfFunctions[WdfCommonBufferCreateTableIndex])(WdfDriverGlobals, DmaEnabler, Length, Attributes, CommonBuffer); +} + +// +// WDF Function: WdfCommonBufferCreateWithConfig +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFCOMMONBUFFERCREATEWITHCONFIG)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDMAENABLER DmaEnabler, + _In_ + _When_(Length == 0, __drv_reportError(Length cannot be zero)) + size_t Length, + _In_ + PWDF_COMMON_BUFFER_CONFIG Config, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES Attributes, + _Out_ + WDFCOMMONBUFFER* CommonBuffer + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FORCEINLINE +WdfCommonBufferCreateWithConfig( + _In_ + WDFDMAENABLER DmaEnabler, + _In_ + _When_(Length == 0, __drv_reportError(Length cannot be zero)) + size_t Length, + _In_ + PWDF_COMMON_BUFFER_CONFIG Config, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES Attributes, + _Out_ + WDFCOMMONBUFFER* CommonBuffer + ) +{ + return ((PFN_WDFCOMMONBUFFERCREATEWITHCONFIG) WdfFunctions[WdfCommonBufferCreateWithConfigTableIndex])(WdfDriverGlobals, DmaEnabler, Length, Config, Attributes, CommonBuffer); +} + +// +// WDF Function: WdfCommonBufferGetAlignedVirtualAddress +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +PVOID +(*PFN_WDFCOMMONBUFFERGETALIGNEDVIRTUALADDRESS)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOMMONBUFFER CommonBuffer + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +PVOID +FORCEINLINE +WdfCommonBufferGetAlignedVirtualAddress( + _In_ + WDFCOMMONBUFFER CommonBuffer + ) +{ + return ((PFN_WDFCOMMONBUFFERGETALIGNEDVIRTUALADDRESS) WdfFunctions[WdfCommonBufferGetAlignedVirtualAddressTableIndex])(WdfDriverGlobals, CommonBuffer); +} + +// +// WDF Function: WdfCommonBufferGetAlignedLogicalAddress +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +PHYSICAL_ADDRESS +(*PFN_WDFCOMMONBUFFERGETALIGNEDLOGICALADDRESS)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOMMONBUFFER CommonBuffer + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +PHYSICAL_ADDRESS +FORCEINLINE +WdfCommonBufferGetAlignedLogicalAddress( + _In_ + WDFCOMMONBUFFER CommonBuffer + ) +{ + return ((PFN_WDFCOMMONBUFFERGETALIGNEDLOGICALADDRESS) WdfFunctions[WdfCommonBufferGetAlignedLogicalAddressTableIndex])(WdfDriverGlobals, CommonBuffer); +} + +// +// WDF Function: WdfCommonBufferGetLength +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +size_t +(*PFN_WDFCOMMONBUFFERGETLENGTH)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFCOMMONBUFFER CommonBuffer + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +size_t +FORCEINLINE +WdfCommonBufferGetLength( + _In_ + WDFCOMMONBUFFER CommonBuffer + ) +{ + return ((PFN_WDFCOMMONBUFFERGETLENGTH) WdfFunctions[WdfCommonBufferGetLengthTableIndex])(WdfDriverGlobals, CommonBuffer); +} + + + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) + + +WDF_EXTERN_C_END + +#endif // _WDFCOMMONBUFFER_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfcontrol.h b/sdk/include/wdf/kmdf/1.17/wdfcontrol.h new file mode 100644 index 00000000000..f94a3aadba7 --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfcontrol.h @@ -0,0 +1,168 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + wdfcontrol.h + +Abstract: + + Defines functions for controller and creating a "controller" NT4 style + WDFDEVICE handle. + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFCONTROL_H_ +#define _WDFCONTROL_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + +typedef +_Function_class_(EVT_WDF_DEVICE_SHUTDOWN_NOTIFICATION) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_SHUTDOWN_NOTIFICATION( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_SHUTDOWN_NOTIFICATION *PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION; + +typedef enum _WDF_DEVICE_SHUTDOWN_FLAGS { + WdfDeviceShutdown = 0x01, + WdfDeviceLastChanceShutdown = 0x02, +} WDF_DEVICE_SHUTDOWN_FLAGS; + + + +// +// WDF Function: WdfControlDeviceInitAllocate +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +PWDFDEVICE_INIT +(*PFN_WDFCONTROLDEVICEINITALLOCATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDRIVER Driver, + _In_ + CONST UNICODE_STRING* SDDLString + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +PWDFDEVICE_INIT +FORCEINLINE +WdfControlDeviceInitAllocate( + _In_ + WDFDRIVER Driver, + _In_ + CONST UNICODE_STRING* SDDLString + ) +{ + return ((PFN_WDFCONTROLDEVICEINITALLOCATE) WdfFunctions[WdfControlDeviceInitAllocateTableIndex])(WdfDriverGlobals, Driver, SDDLString); +} + +// +// WDF Function: WdfControlDeviceInitSetShutdownNotification +// +typedef +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +VOID +(*PFN_WDFCONTROLDEVICEINITSETSHUTDOWNNOTIFICATION)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + PWDFDEVICE_INIT DeviceInit, + _In_ + PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification, + _In_ + UCHAR Flags + ); + +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +FORCEINLINE +WdfControlDeviceInitSetShutdownNotification( + _In_ + PWDFDEVICE_INIT DeviceInit, + _In_ + PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification, + _In_ + UCHAR Flags + ) +{ + ((PFN_WDFCONTROLDEVICEINITSETSHUTDOWNNOTIFICATION) WdfFunctions[WdfControlDeviceInitSetShutdownNotificationTableIndex])(WdfDriverGlobals, DeviceInit, Notification, Flags); +} + +// +// WDF Function: WdfControlFinishInitializing +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFCONTROLFINISHINITIALIZING)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfControlFinishInitializing( + _In_ + WDFDEVICE Device + ) +{ + ((PFN_WDFCONTROLFINISHINITIALIZING) WdfFunctions[WdfControlFinishInitializingTableIndex])(WdfDriverGlobals, Device); +} + + + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) + + + +WDF_EXTERN_C_END + +#endif // _WDFCONTROL_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfcore.h b/sdk/include/wdf/kmdf/1.17/wdfcore.h new file mode 100644 index 00000000000..ff28279f609 --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfcore.h @@ -0,0 +1,176 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + wdfcore.h + +Abstract: + + This is the main driver framework. + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFCORE_H_ +#define _WDFCORE_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + + + +// +// Time conversion related macros +// +// to to to +// us ms sec +#define WDF_TIMEOUT_TO_SEC ((LONGLONG) 1 * 10 * 1000 * 1000) +#define WDF_TIMEOUT_TO_MS ((LONGLONG) 1 * 10 * 1000) +#define WDF_TIMEOUT_TO_US ((LONGLONG) 1 * 10) +LONGLONG +FORCEINLINE +WDF_REL_TIMEOUT_IN_SEC( + _In_ ULONGLONG Time + ) +{ + return Time * -1 * WDF_TIMEOUT_TO_SEC; +} + +LONGLONG +FORCEINLINE +WDF_ABS_TIMEOUT_IN_SEC( + _In_ ULONGLONG Time + ) +{ + return Time * 1 * WDF_TIMEOUT_TO_SEC; +} + +LONGLONG +FORCEINLINE +WDF_REL_TIMEOUT_IN_MS( + _In_ ULONGLONG Time + ) +{ + return Time * -1 * WDF_TIMEOUT_TO_MS; +} + +LONGLONG +FORCEINLINE +WDF_ABS_TIMEOUT_IN_MS( + _In_ ULONGLONG Time + ) +{ + return Time * 1 * WDF_TIMEOUT_TO_MS; +} + +LONGLONG +FORCEINLINE +WDF_REL_TIMEOUT_IN_US( + _In_ ULONGLONG Time + ) +{ + return Time * -1 * WDF_TIMEOUT_TO_US; +} + +LONGLONG +FORCEINLINE +WDF_ABS_TIMEOUT_IN_US( + _In_ ULONGLONG Time + ) +{ + return Time * 1 * WDF_TIMEOUT_TO_US; +} + +// +// Rounding functions +// +size_t +FORCEINLINE +WDF_ALIGN_SIZE_DOWN( + _In_ size_t Length, + _In_ size_t AlignTo + ) +{ + return Length & ~(AlignTo - 1); +} + +size_t +FORCEINLINE +WDF_ALIGN_SIZE_UP( + _In_ size_t Length, + _In_ size_t AlignTo + ) +{ + return WDF_ALIGN_SIZE_DOWN(Length + AlignTo - 1, AlignTo); +} + + +// +// Pointer math +// +#define WDF_PTR_ADD_OFFSET_TYPE(_ptr, _offset, _type) \ + ((_type) (((PUCHAR) (_ptr)) + (_offset))) + +#define WDF_PTR_ADD_OFFSET(_ptr, _offset) \ + WDF_PTR_ADD_OFFSET_TYPE(_ptr, _offset, PVOID) + +#define WDF_PTR_GET_OFFSET(_base, _addr) \ + (size_t) (((PUCHAR) _addr) - ((PUCHAR) _base)) + +#if (OSVER(NTDDI_VERSION) == NTDDI_WIN2K) +// +// These definitions are necessary for building under a Win2K Environment. +// +#ifndef DECLARE_UNICODE_STRING_SIZE +#define DECLARE_UNICODE_STRING_SIZE(_var, _size) \ +WCHAR _var ## _buffer[_size]; \ +UNICODE_STRING _var = { 0, _size * sizeof(WCHAR) , _var ## _buffer } +#endif + +#undef DECLARE_CONST_UNICODE_STRING +#define DECLARE_CONST_UNICODE_STRING(_variablename, _string) \ +const WCHAR _variablename ## _buffer[] = _string; \ +__pragma(warning(suppress:4204)) __pragma(warning(suppress:4221)) \ +const UNICODE_STRING _variablename = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWSTR) _variablename ## _buffer } + +#endif // (OSVER(NTDDI_VERSION) == NTDDI_WIN2K) + + + +#endif // (NTDDI_VERSION >= NTDDI_WIN2K) + + +WDF_EXTERN_C_END + +#endif // _WDFCORE_H_ + diff --git a/sdk/include/wdf/kmdf/1.17/wdfdevice.h b/sdk/include/wdf/kmdf/1.17/wdfdevice.h new file mode 100644 index 00000000000..370612414f7 --- /dev/null +++ b/sdk/include/wdf/kmdf/1.17/wdfdevice.h @@ -0,0 +1,4496 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +_WdfVersionBuild_ + +Module Name: + + wdfdevice.h + +Abstract: + + +Environment: + + kernel mode only + +Revision History: + +--*/ + +// +// NOTE: This header is generated by stubwork. Please make any +// modifications to the corresponding template files +// (.x or .y) and use stubwork to regenerate the header +// + +#ifndef _WDFDEVICE_H_ +#define _WDFDEVICE_H_ + +#ifndef WDF_EXTERN_C + #ifdef __cplusplus + #define WDF_EXTERN_C extern "C" + #define WDF_EXTERN_C_START extern "C" { + #define WDF_EXTERN_C_END } + #else + #define WDF_EXTERN_C + #define WDF_EXTERN_C_START + #define WDF_EXTERN_C_END + #endif +#endif + +WDF_EXTERN_C_START + + + + +#include <devpropdef.h> + + +#if (NTDDI_VERSION >= NTDDI_WIN2K) + + +// begin_wpp enum +typedef enum _WDF_DEVICE_STATE_FLAGS { + WdfDevStateNP = 0x8000, +} WDF_DEVICE_STATE_FLAGS; + +// end_wpp + +// begin_wpp enum +typedef enum _WDF_DEVICE_PNP_STATE { + WdfDevStatePnpInvalid = 0x00, + WdfDevStatePnpObjectCreated = 0x100, + WdfDevStatePnpCheckForDevicePresence = 0x101, + WdfDevStatePnpEjectFailed = 0x102, + WdfDevStatePnpEjectHardware = 0x103, + WdfDevStatePnpEjectedWaitingForRemove = 0x104, + WdfDevStatePnpInit = 0x105, + WdfDevStatePnpInitStarting = 0x106, + WdfDevStatePnpInitSurpriseRemoved = 0x107, + WdfDevStatePnpHardwareAvailable = 0x108, + WdfDevStatePnpEnableInterfaces = 0x109, + WdfDevStatePnpHardwareAvailablePowerPolicyFailed = 0x10A, + WdfDevStatePnpQueryRemoveAskDriver = 0x10B, + WdfDevStatePnpQueryRemovePending = 0x10C, + WdfDevStatePnpQueryRemoveStaticCheck = 0x10D, + WdfDevStatePnpQueriedRemoving = 0x10E, + WdfDevStatePnpQueryStopAskDriver = 0x10F, + WdfDevStatePnpQueryStopPending = 0x110, + WdfDevStatePnpQueryStopStaticCheck = 0x111, + WdfDevStatePnpQueryCanceled = 0x112, + WdfDevStatePnpRemoved = 0x113, + WdfDevStatePnpPdoRemoved = 0x114, + WdfDevStatePnpRemovedPdoWait = 0x115, + WdfDevStatePnpRemovedPdoSurpriseRemoved = 0x116, + WdfDevStatePnpRemovingDisableInterfaces = 0x117, + WdfDevStatePnpRestarting = 0x118, + WdfDevStatePnpStarted = 0x119, + WdfDevStatePnpStartedCancelStop = 0x11A, + WdfDevStatePnpStartedCancelRemove = 0x11B, + WdfDevStatePnpStartedRemoving = 0x11C, + WdfDevStatePnpStartingFromStopped = 0x11D, + WdfDevStatePnpStopped = 0x11E, + WdfDevStatePnpStoppedWaitForStartCompletion = 0x11F, + WdfDevStatePnpStartedStopping = 0x120, + WdfDevStatePnpSurpriseRemove = 0x121, + WdfDevStatePnpInitQueryRemove = 0x122, + WdfDevStatePnpInitQueryRemoveCanceled = 0x123, + WdfDevStatePnpFdoRemoved = 0x124, + WdfDevStatePnpRemovedWaitForChildren = 0x125, + WdfDevStatePnpQueriedSurpriseRemove = 0x126, + WdfDevStatePnpSurpriseRemoveIoStarted = 0x127, + WdfDevStatePnpFailedPowerDown = 0x128, + WdfDevStatePnpFailedIoStarting = 0x129, + WdfDevStatePnpFailedOwnHardware = 0x12A, + WdfDevStatePnpFailed = 0x12B, + WdfDevStatePnpFailedSurpriseRemoved = 0x12C, + WdfDevStatePnpFailedStarted = 0x12D, + WdfDevStatePnpFailedWaitForRemove = 0x12E, + WdfDevStatePnpFailedInit = 0x12F, + WdfDevStatePnpPdoInitFailed = 0x130, + WdfDevStatePnpRestart = 0x131, + WdfDevStatePnpRestartReleaseHardware = 0x132, + WdfDevStatePnpRestartHardwareAvailable = 0x133, + WdfDevStatePnpPdoRestart = 0x134, + WdfDevStatePnpFinal = 0x135, + WdfDevStatePnpRemovedChildrenRemoved = 0x136, + WdfDevStatePnpQueryRemoveEnsureDeviceAwake = 0x137, + WdfDevStatePnpQueryStopEnsureDeviceAwake = 0x138, + WdfDevStatePnpFailedPowerPolicyRemoved = 0x139, + WdfDevStatePnpNull = 0x13A, +} WDF_DEVICE_PNP_STATE, *PWDF_DEVICE_PNP_STATE; + +// end_wpp + +// begin_wpp enum +typedef enum _WDF_DEVICE_POWER_STATE { + WdfDevStatePowerInvalid = 0x00, + WdfDevStatePowerObjectCreated = 0x300, + WdfDevStatePowerCheckDeviceType = 0x301, + WdfDevStatePowerCheckDeviceTypeNP = 0x302 | WdfDevStateNP, + WdfDevStatePowerCheckParentState = 0x303, + WdfDevStatePowerCheckParentStateNP = 0x304 | WdfDevStateNP, + WdfDevStatePowerEnablingWakeAtBus = 0x305, + WdfDevStatePowerEnablingWakeAtBusNP = 0x306 | WdfDevStateNP, + WdfDevStatePowerD0 = 0x307, + WdfDevStatePowerD0NP = 0x308 | WdfDevStateNP, + WdfDevStatePowerD0BusWakeOwner = 0x309, + WdfDevStatePowerD0BusWakeOwnerNP = 0x30A | WdfDevStateNP, + WdfDevStatePowerD0ArmedForWake = 0x30B, + WdfDevStatePowerD0ArmedForWakeNP = 0x30C | WdfDevStateNP, + WdfDevStatePowerD0DisarmingWakeAtBus = 0x30D, + WdfDevStatePowerD0DisarmingWakeAtBusNP = 0x30E | WdfDevStateNP, + WdfDevStatePowerD0Starting = 0x30F, + WdfDevStatePowerD0StartingConnectInterrupt = 0x310, + WdfDevStatePowerD0StartingDmaEnable = 0x311, + WdfDevStatePowerD0StartingStartSelfManagedIo = 0x312, + WdfDevStatePowerDecideD0State = 0x313, + WdfDevStatePowerGotoD3Stopped = 0x314, + WdfDevStatePowerStopped = 0x315, + WdfDevStatePowerStartingCheckDeviceType = 0x316, + WdfDevStatePowerStartingChild = 0x317, + WdfDevStatePowerDxDisablingWakeAtBus = 0x318, + WdfDevStatePowerDxDisablingWakeAtBusNP = 0x319 | WdfDevStateNP, + WdfDevStatePowerGotoDx = 0x31A, + WdfDevStatePowerGotoDxNP = 0x31B | WdfDevStateNP, + WdfDevStatePowerGotoDxIoStopped = 0x31C, + WdfDevStatePowerGotoDxIoStoppedNP = 0x31D | WdfDevStateNP, + WdfDevStatePowerGotoDxNPFailed = 0x31E | WdfDevStateNP, + WdfDevStatePowerDx = 0x31F, + WdfDevStatePowerDxNP = 0x320 | WdfDevStateNP, + WdfDevStatePowerGotoDxArmedForWake = 0x321, + WdfDevStatePowerGotoDxArmedForWakeNP = 0x322 | WdfDevStateNP, + WdfDevStatePowerGotoDxIoStoppedArmedForWake = 0x323, + WdfDevStatePowerGotoDxIoStoppedArmedForWakeNP = 0x324 | WdfDevStateNP, + WdfDevStatePowerDxArmedForWake = 0x325, + WdfDevStatePowerDxArmedForWakeNP = 0x326 | WdfDevStateNP, + WdfDevStatePowerCheckParentStateArmedForWake = 0x327, + WdfDevStatePowerCheckParentStateArmedForWakeNP = 0x328 | WdfDevStateNP, + WdfDevStatePowerWaitForParentArmedForWake = 0x329, + WdfDevStatePowerWaitForParentArmedForWakeNP = 0x32A | WdfDevStateNP, + WdfDevStatePowerStartSelfManagedIo = 0x32B, + WdfDevStatePowerStartSelfManagedIoNP = 0x32C | WdfDevStateNP, + WdfDevStatePowerStartSelfManagedIoFailed = 0x32D, + WdfDevStatePowerStartSelfManagedIoFailedNP = 0x32E | WdfDevStateNP, + WdfDevStatePowerWaitForParent = 0x32F, + WdfDevStatePowerWaitForParentNP = 0x330 | WdfDevStateNP, + WdfDevStatePowerWakePending = 0x331, + WdfDevStatePowerWakePendingNP = 0x332 | WdfDevStateNP, + WdfDevStatePowerWaking = 0x333, + WdfDevStatePowerWakingNP = 0x334 | WdfDevStateNP, + WdfDevStatePowerWakingConnectInterrupt = 0x335, + WdfDevStatePowerWakingConnectInterruptNP = 0x336 | WdfDevStateNP, + WdfDevStatePowerWakingConnectInterruptFailed = 0x337, + WdfDevStatePowerWakingConnectInterruptFailedNP = 0x338 | WdfDevStateNP, + WdfDevStatePowerWakingDmaEnable = 0x339, + WdfDevStatePowerWakingDmaEnableNP = 0x33A | WdfDevStateNP, + WdfDevStatePowerWakingDmaEnableFailed = 0x33B, + WdfDevStatePowerWakingDmaEnableFailedNP = 0x33C | WdfDevStateNP, + WdfDevStatePowerReportPowerUpFailedDerefParent = 0x33D, + WdfDevStatePowerReportPowerUpFailed = 0x33E, + WdfDevStatePowerPowerFailedPowerDown = 0x33F, + WdfDevStatePowerReportPowerDownFailed = 0x340, + WdfDevStatePowerInitialConnectInterruptFailed = 0x341, + WdfDevStatePowerInitialDmaEnableFailed = 0x342, + WdfDevStatePowerInitialSelfManagedIoFailed = 0x343, + WdfDevStatePowerInitialPowerUpFailedDerefParent = 0x344, + WdfDevStatePowerInitialPowerUpFailed = 0x345, + WdfDevStatePowerDxStoppedDisarmWake = 0x346, + WdfDevStatePowerDxStoppedDisarmWakeNP = 0x347 | WdfDevStateNP, + WdfDevStatePowerGotoDxStoppedDisableInterruptNP = 0x348 | WdfDevStateNP, + WdfDevStatePowerGotoDxStopped = 0x349, + WdfDevStatePowerDxStopped = 0x34A, + WdfDevStatePowerGotoStopped = 0x34B, + WdfDevStatePowerStoppedCompleteDx = 0x34C, + WdfDevStatePowerDxStoppedDecideDxState = 0x34D, + WdfDevStatePowerDxStoppedArmForWake = 0x34E, + WdfDevStatePowerDxStoppedArmForWakeNP = 0x34F | WdfDevStateNP, + WdfDevStatePowerFinalPowerDownFailed = 0x350, + WdfDevStatePowerFinal = 0x351, + WdfDevStatePowerGotoImplicitD3DisarmWakeAtBus = 0x352, + WdfDevStatePowerUpFailed = 0x353, + WdfDevStatePowerUpFailedDerefParent = 0x354, + WdfDevStatePowerGotoDxFailed = 0x355, + WdfDevStatePowerGotoDxStoppedDisableInterrupt = 0x356, + WdfDevStatePowerUpFailedNP = 0x357 | WdfDevStateNP, + WdfDevStatePowerUpFailedDerefParentNP = 0x358 | WdfDevStateNP, + WdfDevStatePowerNotifyingD0ExitToWakeInterrupts = 0x359, + WdfDevStatePowerNotifyingD0EntryToWakeInterrupts = 0x35A, + WdfDevStatePowerNotifyingD0ExitToWakeInterruptsNP = 0x35B | WdfDevStateNP, + WdfDevStatePowerNotifyingD0EntryToWakeInterruptsNP = 0x35C | WdfDevStateNP, + WdfDevStatePowerNull = 0x35D, +} WDF_DEVICE_POWER_STATE, *PWDF_DEVICE_POWER_STATE; + +// end_wpp + + +// begin_wpp enum +typedef enum _WDF_DEVICE_POWER_POLICY_STATE { + WdfDevStatePwrPolInvalid = 0x00, + WdfDevStatePwrPolObjectCreated = 0x500, + WdfDevStatePwrPolStarting = 0x501, + WdfDevStatePwrPolStartingSucceeded = 0x502, + WdfDevStatePwrPolStartingFailed = 0x503, + WdfDevStatePwrPolStartingDecideS0Wake = 0x504, + WdfDevStatePwrPolStartedIdleCapable = 0x505, + WdfDevStatePwrPolTimerExpiredNoWake = 0x506, + WdfDevStatePwrPolTimerExpiredNoWakeCompletePowerDown = 0x507, + WdfDevStatePwrPolWaitingUnarmed = 0x508, + WdfDevStatePwrPolWaitingUnarmedQueryIdle = 0x509, + WdfDevStatePwrPolS0NoWakePowerUp = 0x50A, + WdfDevStatePwrPolS0NoWakeCompletePowerUp = 0x50B, + WdfDevStatePwrPolSystemSleepFromDeviceWaitingUnarmed = 0x50C, + WdfDevStatePwrPolSystemSleepNeedWake = 0x50D, + WdfDevStatePwrPolSystemSleepNeedWakeCompletePowerUp = 0x50E, + WdfDevStatePwrPolSystemSleepPowerRequestFailed = 0x50F, + WdfDevStatePwrPolCheckPowerPageable = 0x510, + WdfDevStatePwrPolSleepingWakeWakeArrived = 0x511, + WdfDevStatePwrPolSleepingWakeRevertArmWake = 0x512, + WdfDevStatePwrPolSystemAsleepWakeArmed = 0x513, + WdfDevStatePwrPolSystemWakeDeviceWakeEnabled = 0x514, + WdfDevStatePwrPolSystemWakeDeviceWakeEnabledWakeCanceled = 0x515, + WdfDevStatePwrPolSystemWakeDeviceWakeDisarm = 0x516, + WdfDevStatePwrPolSystemWakeDeviceWakeTriggered = 0x517, + WdfDevStatePwrPolSystemWakeDeviceWakeTriggeredS0 = 0x518, + WdfDevStatePwrPolSystemWakeDeviceWokeDisarm = 0x519, + WdfDevStatePwrPolSleepingWakeWakeArrivedNP = 0x51A | WdfDevStateNP, + WdfDevStatePwrPolSleepingWakeRevertArmWakeNP = 0x51B | WdfDevStateNP, + WdfDevStatePwrPolSleepingWakePowerDownFailed = 0x51C, + WdfDevStatePwrPolSleepingWakePowerDownFailedWakeCanceled = 0x51D, + WdfDevStatePwrPolSystemAsleepWakeArmedNP = 0x51E | WdfDevStateNP, + WdfDevStatePwrPolSystemWakeDeviceWakeEnabledNP = 0x51F | WdfDevStateNP, + WdfDevStatePwrPolSystemWakeDeviceWakeEnabledWakeCanceledNP = 0x520 | WdfDevStateNP, + WdfDevStatePwrPolSystemWakeDeviceWakeDisarmNP = 0x521 | WdfDevStateNP, + WdfDevStatePwrPolSystemWakeDeviceWakeTriggeredNP = 0x522 | WdfDevStateNP, + WdfDevStatePwrPolSystemWakeDeviceWakeTriggeredS0NP = 0x523 | WdfDevStateNP, + WdfDevStatePwrPolSystemWakeDeviceWokeDisarmNP = 0x524 | WdfDevStateNP, + WdfDevStatePwrPolSystemWakeDeviceWakeCompletePowerUp = 0x525, + WdfDevStatePwrPolSleeping = 0x526, + WdfDevStatePwrPolSleepingNoWakePowerDown = 0x527, + WdfDevStatePwrPolSleepingNoWakeCompletePowerDown = 0x528, + WdfDevStatePwrPolSleepingNoWakeDxRequestFailed = 0x529, + WdfDevStatePwrPolSleepingWakePowerDown = 0x52A, + WdfDevStatePwrPolSleepingSendWake = 0x52B, + WdfDevStatePwrPolSystemAsleepNoWake = 0x52C, + WdfDevStatePwrPolSystemWakeDeviceWakeDisabled = 0x52D, + WdfDevStatePwrPolSystemWakeDeviceToD0 = 0x52E, + WdfDevStatePwrPolSystemWakeDeviceToD0CompletePowerUp = 0x52F, + WdfDevStatePwrPolSystemWakeQueryIdle = 0x530, + WdfDevStatePwrPolStartedWakeCapable = 0x531, + WdfDevStatePwrPolTimerExpiredDecideUsbSS = 0x532, + WdfDevStatePwrPolTimerExpiredWakeCapablePowerDown = 0x533, + WdfDevStatePwrPolTimerExpiredWakeCapableSendWake = 0x534, + WdfDevStatePwrPolTimerExpiredWakeCapableUsbSS = 0x535, + WdfDevStatePwrPolTimerExpiredWakeCapableWakeArrived = 0x536, + WdfDevStatePwrPolTimerExpiredWakeCapableCancelWake = 0x537, + WdfDevStatePwrPolTimerExpiredWakeCapableWakeCanceled = 0x538, + WdfDevStatePwrPolTimerExpiredWakeCapableCleanup = 0x539, + WdfDevStatePwrPolTimerExpiredWakeCapableDxAllocFailed = 0x53A, + WdfDevStatePwrPolTimerExpiredWakeCompletedPowerDown = 0x53B, + WdfDevStatePwrPolTimerExpiredWakeCompletedPowerUp = 0x53C, + WdfDevStatePwrPolWaitingArmedUsbSS = 0x53D, + WdfDevStatePwrPolWaitingArmed = 0x53E, + WdfDevStatePwrPolWaitingArmedQueryIdle = 0x53F, + WdfDevStatePwrPolIoPresentArmed = 0x540, + WdfDevStatePwrPolIoPresentArmedWakeCanceled = 0x541, + WdfDevStatePwrPolS0WakeDisarm = 0x542, + WdfDevStatePwrPolS0WakeCompletePowerUp = 0x543, + WdfDevStatePwrPolTimerExpiredWakeSucceeded = 0x544, + WdfDevStatePwrPolTimerExpiredWakeCompletedDisarm = 0x545, + WdfDevStatePwrPolTimerExpiredWakeCapableWakeSucceeded = 0x546, + WdfDevStatePwrPolTimerExpiredWakeCapableWakeFailed = 0x547, + WdfDevStatePwrPolWakeFailedUsbSS = 0x548, + WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedCancelWake = 0x549, + WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedWakeCanceled = 0x54A, + WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedUsbSS = 0x54B, + WdfDevStatePwrPolCancelingWakeForSystemSleep = 0x54C, + WdfDevStatePwrPolCancelingWakeForSystemSleepWakeCanceled = 0x54D, + WdfDevStatePwrPolDisarmingWakeForSystemSleepCompletePowerUp = 0x54E, + WdfDevStatePwrPolPowerUpForSystemSleepFailed = 0x54F, + WdfDevStatePwrPolWokeFromS0UsbSS = 0x550, + WdfDevStatePwrPolWokeFromS0 = 0x551, + WdfDevStatePwrPolWokeFromS0NotifyDriver = 0x552, + WdfDevStatePwrPolStoppingResetDevice = 0x553, + WdfDevStatePwrPolStoppingResetDeviceCompletePowerUp = 0x554, + WdfDevStatePwrPolStoppingResetDeviceFailed = 0x555, + WdfDevStatePwrPolStoppingD0 = 0x556, + WdfDevStatePwrPolStoppingD0Failed = 0x557, + WdfDevStatePwrPolStoppingDisarmWake = 0x558, + WdfDevStatePwrPolStoppingDisarmWakeCancelWake = 0x559, + WdfDevStatePwrPolStoppingDisarmWakeWakeCanceled = 0x55A, + WdfDevStatePwrPolStopping = 0x55B, + WdfDevStatePwrPolStoppingFailed = 0x55C, + WdfDevStatePwrPolStoppingSendStatus = 0x55D, + WdfDevStatePwrPolStoppingCancelTimer = 0x55E, + WdfDevStatePwrPolStoppingWaitForIdleTimeout = 0x55F, + WdfDevStatePwrPolStoppingCancelUsbSS = 0x560, + WdfDevStatePwrPolStoppingWaitForUsbSSCompletion = 0x561, + WdfDevStatePwrPolStoppingCancelWake = 0x562, + WdfDevStatePwrPolStopped = 0x563, + WdfDevStatePwrPolCancelUsbSS = 0x564, + WdfDevStatePwrPolStarted = 0x565, + WdfDevStatePwrPolStartedCancelTimer = 0x566, + WdfDevStatePwrPolStartedWaitForIdleTimeout = 0x567, + WdfDevStatePwrPolStartedWakeCapableCancelTimerForSleep = 0x568, + WdfDevStatePwrPolStartedWakeCapableWaitForIdleTimeout = 0x569, + WdfDevStatePwrPolStartedWakeCapableSleepingUsbSS = 0x56A, + WdfDevStatePwrPolStartedIdleCapableCancelTimerForSleep = 0x56B, + WdfDevStatePwrPolStartedIdleCapableWaitForIdleTimeout = 0x56C, + WdfDevStatePwrPolDeviceD0PowerRequestFailed = 0x56D, + WdfDevStatePwrPolDevicePowerRequestFailed = 0x56E, + WdfDevStatePwrPolGotoDx = 0x56F, + WdfDevStatePwrPolGotoDxInDx = 0x570, + WdfDevStatePwrPolDx = 0x571, + WdfDevStatePwrPolGotoD0 = 0x572, + WdfDevStatePwrPolGotoD0InD0 = 0x573, + WdfDevStatePwrPolFinal = 0x574, + WdfDevStatePwrPolSleepingPowerDownNotProcessed = 0x575, + WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownNotProcessed = 0x576, + WdfDevStatePwrPolTimerExpiredNoWakePowerDownNotProcessed = 0x577, + WdfDevStatePwrPolTimerExpiredNoWakePoweredDownDisableIdleTimer = 0x578, + WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown = 0x579, + WdfDevStatePwrPolStoppingPoweringUp = 0x57A, + WdfDevStatePwrPolStoppingPoweringDown = 0x57B, + WdfDevStatePwrPolPowerUpForSystemSleepNotSeen = 0x57C, + WdfDevStatePwrPolWaitingArmedStoppingCancelUsbSS = 0x57D, + WdfDevStatePwrPolWaitingArmedWakeFailedCancelUsbSS = 0x57E, + WdfDevStatePwrPolWaitingArmedIoPresentCancelUsbSS = 0x57F, + WdfDevStatePwrPolWaitingArmedWakeSucceededCancelUsbSS = 0x580, + WdfDevStatePwrPolCancelingUsbSSForSystemSleep = 0x581, + WdfDevStatePwrPolStoppingD0CancelUsbSS = 0x582, + WdfDevStatePwrPolStartingPoweredUp = 0x583, + WdfDevStatePwrPolIdleCapableDeviceIdle = 0x584, + WdfDevStatePwrPolDeviceIdleReturnToActive = 0x585, + WdfDevStatePwrPolDeviceIdleSleeping = 0x586, + WdfDevStatePwrPolDeviceIdleStopping = 0x587, + WdfDevStatePwrPolTimerExpiredNoWakeUndoPowerDown = 0x588, + WdfDevStatePwrPolWakeCapableDeviceIdle = 0x589, + WdfDevStatePwrPolWakeCapableUsbSSCompleted = 0x58A, + WdfDevStatePwrPolTimerExpiredWakeCapableUndoPowerDown = 0x58B, + WdfDevStatePwrPolTimerExpiredWakeCompletedHardwareStarted = 0x58C, + WdfDevStatePwrPolStoppedRemoving = 0x58D, + WdfDevStatePwrPolRemoved = 0x58E, + WdfDevStatePwrPolRestarting = 0x58F, + WdfDevStatePwrPolRestartingFailed = 0x590, + WdfDevStatePwrPolStartingPoweredUpFailed = 0x591, + WdfDevStatePwrPolTimerExpiredNoWakeReturnToActive = 0x592, + WdfDevStatePwrPolWaitingArmedWakeInterruptFired = 0x593, + WdfDevStatePwrPolSystemWakeDeviceWakeInterruptFired = 0x594, + WdfDevStatePwrPolSystemWakeDeviceWakeInterruptFiredNP = 0x595 | WdfDevStateNP, + WdfDevStatePwrPolTimerExpiredWakeCapableWakeInterruptArrived = 0x596, + WdfDevStatePwrPolTimerExpiredWakeCapablePowerDownFailedWakeInterruptArrived = 0x597, + WdfDevStatePwrPolWaitingArmedWakeInterruptFiredDuringPowerDown = 0x598, + WdfDevStatePwrPolNull = 0x599, +} WDF_DEVICE_POWER_POLICY_STATE, *PWDF_DEVICE_POWER_POLICY_STATE; + +// end_wpp + +typedef enum _WDF_STATE_NOTIFICATION_TYPE { + StateNotificationInvalid = 0x0000, + StateNotificationEnterState = 0x0001, + StateNotificationPostProcessState = 0x0002, + StateNotificationLeaveState = 0x0004, + StateNotificationAllStates = StateNotificationEnterState | StateNotificationPostProcessState | StateNotificationLeaveState, +} WDF_STATE_NOTIFICATION_TYPE; + +typedef enum _WDF_POWER_POLICY_S0_IDLE_CAPABILITIES { + IdleCapsInvalid = 0, + IdleCannotWakeFromS0, + IdleCanWakeFromS0, + IdleUsbSelectiveSuspend, +} WDF_POWER_POLICY_S0_IDLE_CAPABILITIES; + +typedef enum _WDF_POWER_POLICY_S0_IDLE_USER_CONTROL { + IdleUserControlInvalid = 0, + IdleDoNotAllowUserControl, + IdleAllowUserControl, +} WDF_POWER_POLICY_S0_IDLE_USER_CONTROL; + +typedef enum _WDF_POWER_POLICY_IDLE_TIMEOUT_CONSTANTS { + IdleTimeoutDefaultConstant = 0, +} WDF_POWER_POLICY_IDLE_TIMEOUT_CONSTANTS; + +typedef enum _WDF_POWER_POLICY_SX_WAKE_USER_CONTROL { + WakeUserControlInvalid = 0, + WakeDoNotAllowUserControl, + WakeAllowUserControl, +} WDF_POWER_POLICY_SX_WAKE_USER_CONTROL; + +typedef enum _WDF_POWER_DEVICE_STATE { + WdfPowerDeviceInvalid = 0, + WdfPowerDeviceD0, + WdfPowerDeviceD1, + WdfPowerDeviceD2, + WdfPowerDeviceD3, + WdfPowerDeviceD3Final, + WdfPowerDevicePrepareForHibernation, + WdfPowerDeviceMaximum, +} WDF_POWER_DEVICE_STATE, *PWDF_POWER_DEVICE_STATE; + + + +typedef enum _WDF_DISPATCH_IRP_TO_IO_QUEUE_FLAGS { + WDF_DISPATCH_IRP_TO_IO_QUEUE_NO_FLAGS = 0x00000000, + WDF_DISPATCH_IRP_TO_IO_QUEUE_INVOKE_INCALLERCTX_CALLBACK = 0x00000001, + WDF_DISPATCH_IRP_TO_IO_QUEUE_PREPROCESSED_IRP = 0x00000002, +} WDF_DISPATCH_IRP_TO_IO_QUEUE_FLAGS; + +typedef enum _WDF_SPECIAL_FILE_TYPE { + WdfSpecialFileUndefined = 0, + WdfSpecialFilePaging = 1, + WdfSpecialFileHibernation, + WdfSpecialFileDump, + WdfSpecialFileBoot, + WdfSpecialFileMax, +} WDF_SPECIAL_FILE_TYPE, *PWDF_SPECIAL_FILE_TYPE; + +typedef enum _WDF_DEVICE_IO_TYPE { + WdfDeviceIoUndefined = 0, + WdfDeviceIoNeither, + WdfDeviceIoBuffered, + WdfDeviceIoDirect, + WdfDeviceIoBufferedOrDirect = 4, + WdfDeviceIoMaximum, +} WDF_DEVICE_IO_TYPE, *PWDF_DEVICE_IO_TYPE; + +typedef enum _WDF_FILEOBJECT_CLASS { + WdfFileObjectInvalid = 0, + WdfFileObjectNotRequired = 1, + WdfFileObjectWdfCanUseFsContext = 2, + WdfFileObjectWdfCanUseFsContext2 = 3, + WdfFileObjectWdfCannotUseFsContexts = 4, + WdfFileObjectCanBeOptional = 0x80000000, +} WDF_FILEOBJECT_CLASS, *PWDF_FILEOBJECT_CLASS; + +typedef enum _WDF_DEVICE_FAILED_ACTION { + WdfDeviceFailedUndefined = 0, + WdfDeviceFailedAttemptRestart, + WdfDeviceFailedNoRestart, +} WDF_DEVICE_FAILED_ACTION; + +typedef enum _WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE { + WdfReleaseHardwareOrderOnFailureInvalid = 0, + WdfReleaseHardwareOrderOnFailureEarly, + WdfReleaseHardwareOrderOnFailureAfterDescendants, +} WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE, *PWDF_RELEASE_HARDWARE_ORDER_ON_FAILURE; + + + +// +// If you do not want the auto inclusion of wdmsec.h, define +// WDF_DEVICE_NO_WDMSEC_H before including this file (or wdf.h) +// +#ifndef WDF_DEVICE_NO_WDMSEC_H +#include <wdmsec.h> +#endif // WDF_DEVICE_NO_WDMSEC_H + + +#define WDF_S0_IDLE_ENABLED_VALUE_NAME L"IdleInWorkingState" +#define WDF_SX_WAKE_ENABLED_VALUE_NAME L"WakeFromSleepState" +#define WDF_S0_IDLE_DEFAULT_VALUE_NAME L"WdfDefaultIdleInWorkingState" +#define WDF_SX_WAKE_DEFAULT_VALUE_NAME L"WdfDefaultWakeFromSleepState" +// +// Declare empty definitions so that they may be referenced by +// routines before they are defined. +// +typedef enum _WDF_REQUEST_TYPE WDF_REQUEST_TYPE; + + +typedef +_Function_class_(EVT_WDF_DEVICE_FILE_CREATE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_FILE_CREATE( + _In_ + WDFDEVICE Device, + _In_ + WDFREQUEST Request, + _In_ + WDFFILEOBJECT FileObject + ); + +typedef EVT_WDF_DEVICE_FILE_CREATE *PFN_WDF_DEVICE_FILE_CREATE; + +typedef +_Function_class_(EVT_WDF_FILE_CLOSE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_FILE_CLOSE( + _In_ + WDFFILEOBJECT FileObject + ); + +typedef EVT_WDF_FILE_CLOSE *PFN_WDF_FILE_CLOSE; + +typedef +_Function_class_(EVT_WDF_FILE_CLEANUP) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_FILE_CLEANUP( + _In_ + WDFFILEOBJECT FileObject + ); + +typedef EVT_WDF_FILE_CLEANUP *PFN_WDF_FILE_CLEANUP; + +typedef struct _WDF_FILEOBJECT_CONFIG { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // Event callback for create requests + // + PFN_WDF_DEVICE_FILE_CREATE EvtDeviceFileCreate; + + // + // Event callback for close requests + // + PFN_WDF_FILE_CLOSE EvtFileClose; + + // + // Event callback for cleanup requests + // + PFN_WDF_FILE_CLEANUP EvtFileCleanup; + + // + // If WdfTrue, create/cleanup/close file object related requests will be + // sent down the stack. + // + // If WdfFalse, create/cleanup/close will be completed at this location in + // the device stack. + // + // If WdfDefault, behavior depends on device type + // FDO, PDO, Control: use the WdfFalse behavior + // Filter: use the WdfTrue behavior + // + WDF_TRI_STATE AutoForwardCleanupClose; + + // + // Specify whether framework should create WDFFILEOBJECT and also + // whether it can FsContexts fields in the WDM fileobject to store + // WDFFILEOBJECT so that it can avoid table look up and improve perf. + // + WDF_FILEOBJECT_CLASS FileObjectClass; + +} WDF_FILEOBJECT_CONFIG, *PWDF_FILEOBJECT_CONFIG; + +VOID +FORCEINLINE +WDF_FILEOBJECT_CONFIG_INIT( + _Out_ PWDF_FILEOBJECT_CONFIG FileEventCallbacks, + _In_opt_ PFN_WDF_DEVICE_FILE_CREATE EvtDeviceFileCreate, + _In_opt_ PFN_WDF_FILE_CLOSE EvtFileClose, + _In_opt_ PFN_WDF_FILE_CLEANUP EvtFileCleanup + ) +{ + FileEventCallbacks->Size = sizeof(WDF_FILEOBJECT_CONFIG); + + FileEventCallbacks->EvtDeviceFileCreate = EvtDeviceFileCreate; + FileEventCallbacks->EvtFileClose = EvtFileClose; + FileEventCallbacks->EvtFileCleanup = EvtFileCleanup; + + FileEventCallbacks->FileObjectClass = WdfFileObjectWdfCannotUseFsContexts; + FileEventCallbacks->AutoForwardCleanupClose = WdfUseDefault; +} + +typedef struct _WDF_DEVICE_PNP_NOTIFICATION_DATA { + // + // Type of data + // + WDF_STATE_NOTIFICATION_TYPE Type; + + union { + struct { + // + // The current state that is about to be exited + // + WDF_DEVICE_PNP_STATE CurrentState; + + // + // The new state that is about to be entered + // + WDF_DEVICE_PNP_STATE NewState; + } EnterState; + + struct { + // + // The current state + // + WDF_DEVICE_PNP_STATE CurrentState; + } PostProcessState; + + + struct { + // + // The current state that is about to be exitted + // + WDF_DEVICE_PNP_STATE CurrentState; + + // + // The state that is about to be entered + // + WDF_DEVICE_PNP_STATE NewState; + } LeaveState; + } Data; +} WDF_DEVICE_PNP_NOTIFICATION_DATA; + +typedef const WDF_DEVICE_PNP_NOTIFICATION_DATA* PCWDF_DEVICE_PNP_NOTIFICATION_DATA; + +typedef struct _WDF_DEVICE_POWER_NOTIFICATION_DATA { + // + // Type of data + // + WDF_STATE_NOTIFICATION_TYPE Type; + + union { + struct { + // + // The current state that is about to be exitted + // + WDF_DEVICE_POWER_STATE CurrentState; + + // + // The new state that is about to be entered + // + WDF_DEVICE_POWER_STATE NewState; + } EnterState; + + struct { + // + // The current state + // + WDF_DEVICE_POWER_STATE CurrentState; + } PostProcessState; + + + struct { + // + // The current state that is about to be exitted + // + WDF_DEVICE_POWER_STATE CurrentState; + + // + // The state that is about to be entered + // + WDF_DEVICE_POWER_STATE NewState; + } LeaveState; + } Data; +} WDF_DEVICE_POWER_NOTIFICATION_DATA; + +typedef const WDF_DEVICE_POWER_NOTIFICATION_DATA* PCWDF_DEVICE_POWER_NOTIFICATION_DATA; + +typedef struct _WDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA { + // + // Type of data + // + WDF_STATE_NOTIFICATION_TYPE Type; + + union { + struct { + // + // The current state that is about to be exitted + // + WDF_DEVICE_POWER_POLICY_STATE CurrentState; + + // + // The new state that is about to be entered + // + WDF_DEVICE_POWER_POLICY_STATE NewState; + } EnterState; + + struct { + // + // The current state + // + WDF_DEVICE_POWER_POLICY_STATE CurrentState; + } PostProcessState; + + + struct { + // + // The current state that is about to be exitted + // + WDF_DEVICE_POWER_POLICY_STATE CurrentState; + + // + // The state that is about to be entered + // + WDF_DEVICE_POWER_POLICY_STATE NewState; + } LeaveState; + } Data; +} WDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA; + +typedef const WDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA* PCWDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA; + +typedef +_Function_class_(EVT_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION( + _In_ + WDFDEVICE Device, + _In_ + PCWDF_DEVICE_PNP_NOTIFICATION_DATA NotificationData + ); + +typedef EVT_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION *PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION; + +typedef +_Function_class_(EVT_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION( + _In_ + WDFDEVICE Device, + _In_ + PCWDF_DEVICE_POWER_NOTIFICATION_DATA NotificationData + ); + +typedef EVT_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION *PFN_WDF_DEVICE_POWER_STATE_CHANGE_NOTIFICATION; + +typedef +_Function_class_(EVT_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION( + _In_ + WDFDEVICE Device, + _In_ + PCWDF_DEVICE_POWER_POLICY_NOTIFICATION_DATA NotificationData + ); + +typedef EVT_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION *PFN_WDF_DEVICE_POWER_POLICY_STATE_CHANGE_NOTIFICATION; + +#define IdleTimeoutDefaultValue ((ULONG) IdleTimeoutDefaultConstant) + +typedef +_Function_class_(EVT_WDF_DEVICE_D0_ENTRY) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_D0_ENTRY( + _In_ + WDFDEVICE Device, + _In_ + WDF_POWER_DEVICE_STATE PreviousState + ); + +typedef EVT_WDF_DEVICE_D0_ENTRY *PFN_WDF_DEVICE_D0_ENTRY; + +typedef +_Function_class_(EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED( + _In_ + WDFDEVICE Device, + _In_ + WDF_POWER_DEVICE_STATE PreviousState + ); + +typedef EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED *PFN_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED; + +typedef +_Function_class_(EVT_WDF_DEVICE_D0_EXIT) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_D0_EXIT( + _In_ + WDFDEVICE Device, + _In_ + WDF_POWER_DEVICE_STATE TargetState + ); + +typedef EVT_WDF_DEVICE_D0_EXIT *PFN_WDF_DEVICE_D0_EXIT; + +typedef +_Function_class_(EVT_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED( + _In_ + WDFDEVICE Device, + _In_ + WDF_POWER_DEVICE_STATE TargetState + ); + +typedef EVT_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED *PFN_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED; + +typedef +_Function_class_(EVT_WDF_DEVICE_PREPARE_HARDWARE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_PREPARE_HARDWARE( + _In_ + WDFDEVICE Device, + _In_ + WDFCMRESLIST ResourcesRaw, + _In_ + WDFCMRESLIST ResourcesTranslated + ); + +typedef EVT_WDF_DEVICE_PREPARE_HARDWARE *PFN_WDF_DEVICE_PREPARE_HARDWARE; + +typedef +_Function_class_(EVT_WDF_DEVICE_RELEASE_HARDWARE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_RELEASE_HARDWARE( + _In_ + WDFDEVICE Device, + _In_ + WDFCMRESLIST ResourcesTranslated + ); + +typedef EVT_WDF_DEVICE_RELEASE_HARDWARE *PFN_WDF_DEVICE_RELEASE_HARDWARE; + +typedef +_Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP *PFN_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP; + +typedef +_Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_FLUSH) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_SELF_MANAGED_IO_FLUSH( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_FLUSH *PFN_WDF_DEVICE_SELF_MANAGED_IO_FLUSH; + +typedef +_Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT *PFN_WDF_DEVICE_SELF_MANAGED_IO_INIT; + +typedef +_Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND *PFN_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND; + +typedef +_Function_class_(EVT_WDF_DEVICE_SELF_MANAGED_IO_RESTART) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_SELF_MANAGED_IO_RESTART( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_SELF_MANAGED_IO_RESTART *PFN_WDF_DEVICE_SELF_MANAGED_IO_RESTART; + +typedef +_Function_class_(EVT_WDF_DEVICE_QUERY_STOP) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_QUERY_STOP( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_QUERY_STOP *PFN_WDF_DEVICE_QUERY_STOP; + +typedef +_Function_class_(EVT_WDF_DEVICE_QUERY_REMOVE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_QUERY_REMOVE( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_QUERY_REMOVE *PFN_WDF_DEVICE_QUERY_REMOVE; + +typedef +_Function_class_(EVT_WDF_DEVICE_SURPRISE_REMOVAL) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_SURPRISE_REMOVAL( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_SURPRISE_REMOVAL *PFN_WDF_DEVICE_SURPRISE_REMOVAL; + +typedef +_Function_class_(EVT_WDF_DEVICE_USAGE_NOTIFICATION) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_USAGE_NOTIFICATION( + _In_ + WDFDEVICE Device, + _In_ + WDF_SPECIAL_FILE_TYPE NotificationType, + _In_ + BOOLEAN IsInNotificationPath + ); + +typedef EVT_WDF_DEVICE_USAGE_NOTIFICATION *PFN_WDF_DEVICE_USAGE_NOTIFICATION; + +typedef +_Function_class_(EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX( + _In_ + WDFDEVICE Device, + _In_ + WDF_SPECIAL_FILE_TYPE NotificationType, + _In_ + BOOLEAN IsInNotificationPath + ); + +typedef EVT_WDF_DEVICE_USAGE_NOTIFICATION_EX *PFN_WDF_DEVICE_USAGE_NOTIFICATION_EX; + +typedef +_Function_class_(EVT_WDF_DEVICE_RELATIONS_QUERY) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_RELATIONS_QUERY( + _In_ + WDFDEVICE Device, + _In_ + DEVICE_RELATION_TYPE RelationType + ); + +typedef EVT_WDF_DEVICE_RELATIONS_QUERY *PFN_WDF_DEVICE_RELATIONS_QUERY; + +typedef +_Function_class_(EVT_WDF_DEVICE_ARM_WAKE_FROM_S0) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_ARM_WAKE_FROM_S0( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_ARM_WAKE_FROM_S0 *PFN_WDF_DEVICE_ARM_WAKE_FROM_S0; + +typedef +_Function_class_(EVT_WDF_DEVICE_ARM_WAKE_FROM_SX) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_ARM_WAKE_FROM_SX( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_ARM_WAKE_FROM_SX *PFN_WDF_DEVICE_ARM_WAKE_FROM_SX; + +typedef +_Function_class_(EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON( + _In_ + WDFDEVICE Device, + _In_ + BOOLEAN DeviceWakeEnabled, + _In_ + BOOLEAN ChildrenArmedForWake + ); + +typedef EVT_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON *PFN_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON; + +typedef +_Function_class_(EVT_WDF_DEVICE_DISARM_WAKE_FROM_S0) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_DISARM_WAKE_FROM_S0( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_DISARM_WAKE_FROM_S0 *PFN_WDF_DEVICE_DISARM_WAKE_FROM_S0; + +typedef +_Function_class_(EVT_WDF_DEVICE_DISARM_WAKE_FROM_SX) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_DISARM_WAKE_FROM_SX( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_DISARM_WAKE_FROM_SX *PFN_WDF_DEVICE_DISARM_WAKE_FROM_SX; + +typedef +_Function_class_(EVT_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED *PFN_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED; + +typedef +_Function_class_(EVT_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED( + _In_ + WDFDEVICE Device + ); + +typedef EVT_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED *PFN_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED; + +typedef struct _WDF_PNPPOWER_EVENT_CALLBACKS { + // + // Size of this structure in bytes + // + ULONG Size; + + PFN_WDF_DEVICE_D0_ENTRY EvtDeviceD0Entry; + PFN_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED EvtDeviceD0EntryPostInterruptsEnabled; + PFN_WDF_DEVICE_D0_EXIT EvtDeviceD0Exit; + PFN_WDF_DEVICE_D0_EXIT_PRE_INTERRUPTS_DISABLED EvtDeviceD0ExitPreInterruptsDisabled; + PFN_WDF_DEVICE_PREPARE_HARDWARE EvtDevicePrepareHardware; + PFN_WDF_DEVICE_RELEASE_HARDWARE EvtDeviceReleaseHardware; + PFN_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP EvtDeviceSelfManagedIoCleanup; + PFN_WDF_DEVICE_SELF_MANAGED_IO_FLUSH EvtDeviceSelfManagedIoFlush; + PFN_WDF_DEVICE_SELF_MANAGED_IO_INIT EvtDeviceSelfManagedIoInit; + PFN_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND EvtDeviceSelfManagedIoSuspend; + PFN_WDF_DEVICE_SELF_MANAGED_IO_RESTART EvtDeviceSelfManagedIoRestart; + PFN_WDF_DEVICE_SURPRISE_REMOVAL EvtDeviceSurpriseRemoval; + PFN_WDF_DEVICE_QUERY_REMOVE EvtDeviceQueryRemove; + PFN_WDF_DEVICE_QUERY_STOP EvtDeviceQueryStop; + PFN_WDF_DEVICE_USAGE_NOTIFICATION EvtDeviceUsageNotification; + PFN_WDF_DEVICE_RELATIONS_QUERY EvtDeviceRelationsQuery; + PFN_WDF_DEVICE_USAGE_NOTIFICATION_EX EvtDeviceUsageNotificationEx; +} WDF_PNPPOWER_EVENT_CALLBACKS, *PWDF_PNPPOWER_EVENT_CALLBACKS; + +typedef struct _WDF_POWER_POLICY_EVENT_CALLBACKS { + // + // Size of this structure in bytes + // + ULONG Size; + + PFN_WDF_DEVICE_ARM_WAKE_FROM_S0 EvtDeviceArmWakeFromS0; + PFN_WDF_DEVICE_DISARM_WAKE_FROM_S0 EvtDeviceDisarmWakeFromS0; + PFN_WDF_DEVICE_WAKE_FROM_S0_TRIGGERED EvtDeviceWakeFromS0Triggered; + + PFN_WDF_DEVICE_ARM_WAKE_FROM_SX EvtDeviceArmWakeFromSx; + PFN_WDF_DEVICE_DISARM_WAKE_FROM_SX EvtDeviceDisarmWakeFromSx; + PFN_WDF_DEVICE_WAKE_FROM_SX_TRIGGERED EvtDeviceWakeFromSxTriggered; + + PFN_WDF_DEVICE_ARM_WAKE_FROM_SX_WITH_REASON EvtDeviceArmWakeFromSxWithReason; + +} WDF_POWER_POLICY_EVENT_CALLBACKS, *PWDF_POWER_POLICY_EVENT_CALLBACKS; + +VOID +FORCEINLINE +WDF_POWER_POLICY_EVENT_CALLBACKS_INIT( + _Out_ PWDF_POWER_POLICY_EVENT_CALLBACKS Callbacks + ) +{ + RtlZeroMemory(Callbacks, sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS)); + + Callbacks->Size = sizeof(WDF_POWER_POLICY_EVENT_CALLBACKS); +} + +VOID +FORCEINLINE +WDF_PNPPOWER_EVENT_CALLBACKS_INIT( + _Out_ PWDF_PNPPOWER_EVENT_CALLBACKS Callbacks + ) +{ + RtlZeroMemory(Callbacks, sizeof(WDF_PNPPOWER_EVENT_CALLBACKS)); + Callbacks->Size = sizeof(WDF_PNPPOWER_EVENT_CALLBACKS); +} + + +ULONG +FORCEINLINE +WdfDevStateNormalize( + _In_ ULONG State + ) +{ + return State & ~WdfDevStateNP; +} + + +BOOLEAN +FORCEINLINE +WdfDevStateIsNP( + _In_ ULONG State + ) +{ + return (State & WdfDevStateNP) ? TRUE : FALSE; +} + +typedef enum _WDF_POWER_POLICY_IDLE_TIMEOUT_TYPE { + DriverManagedIdleTimeout = 0, + SystemManagedIdleTimeout = 1, + SystemManagedIdleTimeoutWithHint = 2 +} WDF_POWER_POLICY_IDLE_TIMEOUT_TYPE, *PWDF_POWER_POLICY_IDLE_TIMEOUT_TYPE; + +typedef struct _WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // Indicates whether the device can wake itself up while the machine is in + // S0. + // + WDF_POWER_POLICY_S0_IDLE_CAPABILITIES IdleCaps; + + // + // The low power state in which the device will be placed when it is idled + // out while the machine is in S0. + // + DEVICE_POWER_STATE DxState; + + // + // Amount of time the device must be idle before idling out. Timeout is in + // milliseconds. + // + ULONG IdleTimeout; + + // + // Inidcates whether a user can control the idle policy of the device. + // By default, a user is allowed to change the policy. + // + WDF_POWER_POLICY_S0_IDLE_USER_CONTROL UserControlOfIdleSettings; + + // + // If WdfTrue, idling out while the machine is in S0 will be enabled. + // + // If WdfFalse, idling out will be disabled. + // + // If WdfUseDefault, the idling out will be enabled. If + // UserControlOfIdleSettings is set to IdleAllowUserControl, the user's + // settings will override the default. + // + WDF_TRI_STATE Enabled; + + // + // This field is applicable only when IdleCaps == IdleCannotWakeFromS0 + // If WdfTrue,device is powered up on System Wake even if device is idle + // If WdfFalse, device is not powered up on system wake if it is idle + // If WdfUseDefault, the behavior is same as WdfFalse + // + WDF_TRI_STATE PowerUpIdleDeviceOnSystemWake; + + // + // This field determines how the IdleTimeout field is used. + // + // If the value is DriverManagedIdleTimeout, then the idle timeout value + // is determined by the IdleTimeout field of this structure. + // + // If the value is SystemManagedIdleTimeout, then the timeout value is + // determined by the power framework (PoFx) on operating systems where + // the PoFx is available (i.e. Windows 8 and later). The IdleTimeout field + // is ignored on these operating systems. On operating systems where the + // PoFx is not available, the behavior is same as DriverManagedIdleTimeout. + // + // If the value is SystemManagedIdleTimeoutWithHint, then the timeout value + // is determined by the power framework (PoFx) on operating systems where + // the PoFx is available (i.e. Windows 8 and later). In addition, the value + // specified in the IdleTimeout field is provided as a hint to the PoFx in + // determining when the device should be allowed to enter a low-power state. + // Since it is only a hint, the actual duration after which the PoFx allows + // the device to enter a low-power state might be greater than or less than + // the IdleTimeout value. On operating systems where the PoFx is not + // available, the behavior is same as DriverManagedIdleTimeout. + // + WDF_POWER_POLICY_IDLE_TIMEOUT_TYPE IdleTimeoutType; + + // + // This field forces the device to avoid idling in the D3cold power state. + // WDF will ensure, with help from the bus drivers, that the device will + // idle in a D-state that can successfully generate a wake signal, if + // necessary. If the client specifies that DxState == PowerDeviceD3, this + // setting allows the client to distinguish betwen D3hot and D3cold. If + // the client sets DxState == PowerDeviceMaximum, then WDF will pick the + // deepest idle state identified by the bus driver. If that deepest state + // is D3cold, this field allows the client to override that and choose + // D3hot. + // + // If WdfTrue, device will not use D3cold in S0. + // If WdfFalse, device will use D3cold in S0 if the ACPI firmware indicates + // that the device can enter that state, if DxState above does not + // specify some other D-state and, if the device is armed for + // wake, that it can generate its wake signal from D3cold. + // If WdfUseDefault, this setting will be derived from the driver's INF, + // specifically the presence or absence of the following two lines in + // the DDInstall.HW section: + // Include=machine.inf + // Needs=PciD3ColdSupported + // + WDF_TRI_STATE ExcludeD3Cold; + +} WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS, *PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS; + +VOID +FORCEINLINE +WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT( + _Out_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings, + _In_ WDF_POWER_POLICY_S0_IDLE_CAPABILITIES IdleCaps + ) +{ + RtlZeroMemory(Settings, sizeof(WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS)); + + Settings->Size = sizeof(WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS); + + Settings->IdleTimeout = IdleTimeoutDefaultValue; + Settings->UserControlOfIdleSettings = IdleAllowUserControl; + Settings->Enabled = WdfUseDefault; + Settings->PowerUpIdleDeviceOnSystemWake = WdfUseDefault; + Settings->IdleTimeoutType = DriverManagedIdleTimeout; + Settings->ExcludeD3Cold = WdfUseDefault; + + Settings->IdleCaps = IdleCaps; + + switch (IdleCaps) { + case IdleUsbSelectiveSuspend: + case IdleCanWakeFromS0: + Settings->DxState = PowerDeviceMaximum; + break; + + case IdleCannotWakeFromS0: + Settings->DxState = PowerDeviceD3; + break; + } +} + +typedef struct _WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // The low power state in which the device will be placed when it is armed + // for wake from Sx. + // + DEVICE_POWER_STATE DxState; + + // + // Inidcates whether a user can control the idle policy of the device. + // By default, a user is allowed to change the policy. + // + WDF_POWER_POLICY_SX_WAKE_USER_CONTROL UserControlOfWakeSettings; + + // + // If WdfTrue, arming the device for wake while the machine is in Sx is + // enabled. + // + // If WdfFalse, arming the device for wake while the machine is in Sx is + // disabled. + // + // If WdfUseDefault, arming will be enabled. If UserControlOfWakeSettings + // is set to WakeAllowUserControl, the user's settings will override the + // default. + // + WDF_TRI_STATE Enabled; + + // + // If set to TRUE, arming the parent device can depend on whether there + // is atleast one child device armed for wake. + // + // If set to FALSE, arming of the parent device will be independent of + // whether any of the child devices are armed for wake. + // + BOOLEAN ArmForWakeIfChildrenAreArmedForWake; + + // + // Indicates that whenever the parent device completes the wake irp + // successfully, the status needs to be also propagated to the child + // devices. This helps in tracking which devices were responsible for + // waking the system. + // + BOOLEAN IndicateChildWakeOnParentWake; + +} WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS, *PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS; + +VOID +FORCEINLINE +WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT( + _Out_ PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings + ) +{ + RtlZeroMemory(Settings, sizeof(WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS)); + + Settings->Size = sizeof(WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS); + + Settings->Enabled = WdfUseDefault; + Settings->DxState = PowerDeviceMaximum; + Settings->UserControlOfWakeSettings = WakeAllowUserControl; +} + +typedef struct _WDF_DEVICE_STATE { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // If set to WdfTrue, the device will be disabled + // + WDF_TRI_STATE Disabled; + + // + // If set to WdfTrue, the device will not be displayed in device manager. + // Once hidden, the device cannot be unhidden. + // + WDF_TRI_STATE DontDisplayInUI; + + // + // If set to WdfTrue, the device is reporting itself as failed. If set + // in conjuction with ResourcesChanged to WdfTrue, the device will receive + // a PnP stop and then a new PnP start device. + // + WDF_TRI_STATE Failed; + + // + // If set to WdfTrue, the device cannot be subsequently disabled. + // + WDF_TRI_STATE NotDisableable; + + + // + // If set to WdfTrue, the device stack will be torn down. + // + WDF_TRI_STATE Removed; + + // + // If set to WdfTrue, the device will be sent another PnP start. If the + // Failed field is set to WdfTrue as well, a PnP stop will be sent before + // the start. + // + WDF_TRI_STATE ResourcesChanged; + +} WDF_DEVICE_STATE, *PWDF_DEVICE_STATE; + +VOID +FORCEINLINE +WDF_DEVICE_STATE_INIT( + _Out_ PWDF_DEVICE_STATE PnpDeviceState + ) +{ + RtlZeroMemory(PnpDeviceState, sizeof(WDF_DEVICE_STATE)); + + PnpDeviceState->Size = sizeof(WDF_DEVICE_STATE); + + // + // Initializes all of the fields to the WdfUseDefault enum value + // + PnpDeviceState->Disabled = WdfUseDefault; + PnpDeviceState->DontDisplayInUI = WdfUseDefault; + PnpDeviceState->Failed = WdfUseDefault; + PnpDeviceState->NotDisableable = WdfUseDefault; + PnpDeviceState->Removed = WdfUseDefault; + PnpDeviceState->ResourcesChanged = WdfUseDefault; +} + +typedef struct _WDF_DEVICE_PNP_CAPABILITIES { + // + // Size of the structure in bytes + // + ULONG Size; + + // + // NOTE: To mark a PDO as raw, call WdfPdoInitAssignRawDevice + // + + WDF_TRI_STATE LockSupported; + WDF_TRI_STATE EjectSupported; + WDF_TRI_STATE Removable; + WDF_TRI_STATE DockDevice; + WDF_TRI_STATE UniqueID; + WDF_TRI_STATE SilentInstall; + WDF_TRI_STATE SurpriseRemovalOK; + WDF_TRI_STATE HardwareDisabled; + WDF_TRI_STATE NoDisplayInUI; + + // + // Default values of -1 indicate not to set this value + // + ULONG Address; + ULONG UINumber; + +} WDF_DEVICE_PNP_CAPABILITIES, *PWDF_DEVICE_PNP_CAPABILITIES; + +VOID +FORCEINLINE +WDF_DEVICE_PNP_CAPABILITIES_INIT( + _Out_ PWDF_DEVICE_PNP_CAPABILITIES Caps + ) +{ + RtlZeroMemory(Caps, sizeof(WDF_DEVICE_PNP_CAPABILITIES)); + + Caps->Size = sizeof(WDF_DEVICE_PNP_CAPABILITIES); + + Caps->LockSupported = WdfUseDefault; + Caps->EjectSupported = WdfUseDefault; + Caps->Removable = WdfUseDefault; + Caps->DockDevice = WdfUseDefault; + Caps->UniqueID = WdfUseDefault; + Caps->SilentInstall = WdfUseDefault; + Caps->SurpriseRemovalOK = WdfUseDefault; + Caps->HardwareDisabled = WdfUseDefault; + Caps->NoDisplayInUI = WdfUseDefault; + + Caps->Address = (ULONG) -1; + Caps->UINumber = (ULONG) -1; +} + +typedef struct _WDF_DEVICE_POWER_CAPABILITIES { + // + // Size of the structure in bytes + // + ULONG Size; + + WDF_TRI_STATE DeviceD1; + WDF_TRI_STATE DeviceD2; + + WDF_TRI_STATE WakeFromD0; + WDF_TRI_STATE WakeFromD1; + WDF_TRI_STATE WakeFromD2; + WDF_TRI_STATE WakeFromD3; + + // + // Default value PowerDeviceMaximum indicates not to set this value + // + DEVICE_POWER_STATE DeviceState[PowerSystemMaximum]; + + // + // Default value PowerDeviceMaximum, PowerSystemMaximum indicates not to + // set this value. + // + DEVICE_POWER_STATE DeviceWake; + SYSTEM_POWER_STATE SystemWake; + + // + // Default values of -1 indicate not to set this value + // + ULONG D1Latency; + ULONG D2Latency; + ULONG D3Latency; + + // + // Ideal Dx state for the device to be put into when the machine moves into + // Sx and the device is not armed for wake. By default, the default will be + // placed into D3. If IdealDxStateForSx is lighter then + // DeviceState[Sx], then DeviceState[Sx] will be used as the Dx state. + // + DEVICE_POWER_STATE IdealDxStateForSx; + +} WDF_DEVICE_POWER_CAPABILITIES, *PWDF_DEVICE_POWER_CAPABILITIES; + +VOID +FORCEINLINE +WDF_DEVICE_POWER_CAPABILITIES_INIT( + _Out_ PWDF_DEVICE_POWER_CAPABILITIES Caps + ) +{ + ULONG i; + + RtlZeroMemory(Caps, sizeof(WDF_DEVICE_POWER_CAPABILITIES)); + + Caps->Size = sizeof(WDF_DEVICE_POWER_CAPABILITIES); + + Caps->DeviceD1 = WdfUseDefault; + Caps->DeviceD2 = WdfUseDefault; + + Caps->WakeFromD0 = WdfUseDefault; + Caps->WakeFromD1 = WdfUseDefault; + Caps->WakeFromD2 = WdfUseDefault; + Caps->WakeFromD3 = WdfUseDefault; + + for (i = 0; i < sizeof(Caps->DeviceState)/sizeof(Caps->DeviceState[1]); i++) { + Caps->DeviceState[i] = PowerDeviceMaximum; + } + + Caps->DeviceWake = PowerDeviceMaximum; + Caps->SystemWake = PowerSystemMaximum; + + Caps->D1Latency = (ULONG) -1; + Caps->D2Latency = (ULONG) -1; + Caps->D3Latency = (ULONG) -1; + + Caps->IdealDxStateForSx = PowerDeviceMaximum; +} + +typedef enum _WDF_REMOVE_LOCK_OPTIONS_FLAGS { + WDF_REMOVE_LOCK_OPTION_ACQUIRE_FOR_IO = 0x00000001 +} WDF_REMOVE_LOCK_OPTIONS_FLAGS; + +typedef struct _WDF_REMOVE_LOCK_OPTIONS { + // + // Size of the structure in bytes + // + ULONG Size; + + // + // Bit field combination of values from the WDF_REMOVE_LOCK_OPTIONS_FLAGS + // enumeration + // + ULONG Flags; +} WDF_REMOVE_LOCK_OPTIONS, *PWDF_REMOVE_LOCK_OPTIONS; + + +// +// Default remove lock options initialization macro +// +VOID +FORCEINLINE +WDF_REMOVE_LOCK_OPTIONS_INIT( + _Out_ PWDF_REMOVE_LOCK_OPTIONS RemoveLockOptions, + _In_ ULONG Flags + ) +{ + RtlZeroMemory(RemoveLockOptions, sizeof(WDF_REMOVE_LOCK_OPTIONS)); + + RemoveLockOptions->Size = sizeof(WDF_REMOVE_LOCK_OPTIONS); + RemoveLockOptions->Flags = Flags; +} + +typedef +_Function_class_(EVT_WDFDEVICE_WDM_IRP_PREPROCESS) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +EVT_WDFDEVICE_WDM_IRP_PREPROCESS( + _In_ + WDFDEVICE Device, + _Inout_ + PIRP Irp + ); + +typedef EVT_WDFDEVICE_WDM_IRP_PREPROCESS *PFN_WDFDEVICE_WDM_IRP_PREPROCESS; + +typedef +_Function_class_(EVT_WDFDEVICE_WDM_IRP_DISPATCH) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +EVT_WDFDEVICE_WDM_IRP_DISPATCH( + _In_ + WDFDEVICE Device, + _In_ + UCHAR MajorFunction, + _In_ + UCHAR MinorFunction, + _In_ + ULONG Code, + _In_ + WDFCONTEXT DriverContext, + _Inout_ + PIRP Irp, + _In_ + WDFCONTEXT DispatchContext + ); + +typedef EVT_WDFDEVICE_WDM_IRP_DISPATCH *PFN_WDFDEVICE_WDM_IRP_DISPATCH; + +// +// This is called to pre-process a request using METHOD_NEITHER +// +typedef +_Function_class_(EVT_WDF_IO_IN_CALLER_CONTEXT) +_IRQL_requires_same_ +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +EVT_WDF_IO_IN_CALLER_CONTEXT( + _In_ + WDFDEVICE Device, + _In_ + WDFREQUEST Request + ); + +typedef EVT_WDF_IO_IN_CALLER_CONTEXT *PFN_WDF_IO_IN_CALLER_CONTEXT; + +typedef +_Function_class_(EVT_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +EVT_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE( + _In_ + WDFDEVICE Device, + _In_ + POHANDLE PoHandle + ); + +typedef EVT_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE *PFN_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE; + +typedef +_Function_class_(EVT_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE) +_IRQL_requires_same_ +_IRQL_requires_max_(PASSIVE_LEVEL) +VOID +EVT_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE( + _In_ + WDFDEVICE Device, + _In_ + POHANDLE PoHandle + ); + +typedef EVT_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE *PFN_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE; + +typedef struct _WDF_POWER_FRAMEWORK_SETTINGS { + // + // Size of the structure, in bytes. + // + ULONG Size; + + // + // Client driver's callback function that is invoked after KMDF has + // registered with the power framework. This field can be NULL if the + // client driver does not wish to specify this callback. + // + PFN_WDFDEVICE_WDM_POST_PO_FX_REGISTER_DEVICE EvtDeviceWdmPostPoFxRegisterDevice; + + // + // Client driver's callback function that is invoked before KMDF + // unregisters with the power framework. This field can be NULL if the + // client driver does not wish to specify this callback. + // + PFN_WDFDEVICE_WDM_PRE_PO_FX_UNREGISTER_DEVICE EvtDeviceWdmPrePoFxUnregisterDevice; + + // + // Pointer to a PO_FX_COMPONENT structure that describes the only component + // in the single-component device. This field can be NULL if the client + // driver wants KMDF to use the default specification for this component + // (i.e. support for F0 only). + // + PPO_FX_COMPONENT Component; + + // + // Client driver's PO_FX_COMPONENT_ACTIVE_CONDITION_CALLBACK callback + // function. This field can be NULL if the client driver does not wish to + // specify this callback. + // + PPO_FX_COMPONENT_ACTIVE_CONDITION_CALLBACK ComponentActiveConditionCallback; + + // + // Client driver's PO_FX_COMPONENT_IDLE_CONDITION_CALLBACK callback + // function. This field can be NULL if the client driver does not wish to + // specify this callback. + // + PPO_FX_COMPONENT_IDLE_CONDITION_CALLBACK ComponentIdleConditionCallback; + + // + // Client driver's PO_FX_COMPONENT_IDLE_STATE_CALLBACK callback function. + // This field can be NULL if the client driver does not wish to specify + // this callback. + // + PPO_FX_COMPONENT_IDLE_STATE_CALLBACK ComponentIdleStateCallback; + + // + // Client driver's PO_FX_POWER_CONTROL_CALLBACK callback function. This + // field can be NULL if the client driver does not wish to specify this + // callback. + // + PPO_FX_POWER_CONTROL_CALLBACK PowerControlCallback; + + // + // Context value that is passed in to the ComponentIdleStateCallback and + // PowerControlCallback callback functions. + // + PVOID PoFxDeviceContext; +} WDF_POWER_FRAMEWORK_SETTINGS, *PWDF_POWER_FRAMEWORK_SETTINGS; + +VOID +FORCEINLINE +WDF_POWER_FRAMEWORK_SETTINGS_INIT( + _Out_ PWDF_POWER_FRAMEWORK_SETTINGS PowerFrameworkSettings + ) +{ + RtlZeroMemory(PowerFrameworkSettings, + sizeof(WDF_POWER_FRAMEWORK_SETTINGS)); + PowerFrameworkSettings->Size = sizeof(WDF_POWER_FRAMEWORK_SETTINGS); +} + + +typedef struct _WDF_IO_TYPE_CONFIG { + // + // Size of this structure in bytes + // + ULONG Size; + + // + // <KMDF_DOC/> + // Identifies the method that the driver will use to access data buffers + // that it receives for read and write requests. + // + // <UMDF_DOC/> + // Identifies the method that the driver will "prefer" to use to access data + // buffers that it receives for read and write requests. Note that UMDF + // driver provides just a preference, and not a guarantee.Therefore, + // even if a driver specified direct access method, UMDF might use the + // buffered access method for one or more of the device's requests to + // improve performance. For example, UMDF uses buffered access for small + // buffers, if it can copy the data to the driver's buffer faster than it + // can map the buffers for direct access. + // + WDF_DEVICE_IO_TYPE ReadWriteIoType; + + // + // <UMDF_ONLY/> + // Identifies the method that the driver will "prefer" to use to access data + // buffers that it receives for IOCTL requests. Note that UMDF + // driver provides just a preference, and not a guarantee. Therefore, + // even if a driver specified direct access method, UMDF might use the + // buffered access method for one or more of the device's requests to + // improve performance. For example, UMDF uses buffered access for small + // buffers, if it can copy the data to the driver's buffer faster than it + // can map the buffers for direct access. + // + WDF_DEVICE_IO_TYPE DeviceControlIoType; + + // + // <UMDF_ONLY/> + // Optional, Provides the smallest buffer size (in bytes) for which + // UMDF will use direct access for the buffers. For example, set + // DirectTransferThreshold to "12288" to indicate that UMDF should use buffered + // access for all buffers that are smaller than 12 kilobytes, and direct + // access for buffers equal to or greater than that. Typically, you + // do not need to provide this value because UMDF uses a value that provides + // the best performance. Note that there are other requirements that must be + // met in order to get direct access of buffers. See Docs for details. + // + ULONG DirectTransferThreshold; + +} WDF_IO_TYPE_CONFIG, *PWDF_IO_TYPE_CONFIG; + +VOID +FORCEINLINE +WDF_IO_TYPE_CONFIG_INIT( + _Out_ PWDF_IO_TYPE_CONFIG IoTypeConfig + ) +{ + RtlZeroMemory(IoTypeConfig, sizeof(WDF_IO_TYPE_CONFIG)); + IoTypeConfig->Size = sizeof(WDF_IO_TYPE_CONFIG); + IoTypeConfig->ReadWriteIoType = WdfDeviceIoBuffered; + IoTypeConfig->DeviceControlIoType = WdfDeviceIoBuffered; +} + + + + + +typedef struct _WDF_DEVICE_PROPERTY_DATA { + // + // Size of this structure + // + _In_ ULONG Size; + + // + // A pointer to a DEVPROPKEY structure that specifies the device + // property key. + // + _In_ const DEVPROPKEY * PropertyKey; + + // + // A locale identifier. Set this parameter either to a language-specific + // LCID value or to LOCALE_NEUTRAL. The LOCALE_NEUTRAL LCID specifies + // that the property is language-neutral (that is, not specific to any + // language). Do not set this parameter to LOCALE_SYSTEM_DEFAULT or + // LOCALE_USER_DEFAULT. For more information about language-specific + // LCID values, see LCID Structure. + // + _In_ LCID Lcid; + + // + // Set this parameter to PLUGPLAY_PROPERTY_PERSISTENT if the property + // value set by this routine should persist across computer restarts. + // Otherwise, set Flags to zero. Ignored for Query DDIs. + // + _In_ ULONG Flags; + +} WDF_DEVICE_PROPERTY_DATA, *PWDF_DEVICE_PROPERTY_DATA; + +FORCEINLINE +VOID +WDF_DEVICE_PROPERTY_DATA_INIT ( + _Out_ PWDF_DEVICE_PROPERTY_DATA PropertyData, + _In_ const DEVPROPKEY* PropertyKey + ) +{ + RtlZeroMemory(PropertyData, sizeof(* PropertyData)); + + PropertyData->Size = sizeof(*PropertyData); + PropertyData->PropertyKey = PropertyKey; +} + +// +// VOID +// WdfDeviceStopIdle( +// _In_ WDFDEVICE Device, +// _In_ BOOLEAN WaitForD0 +// ); +// +// VOID +// WdfDeviceStopIdleWithTag( +// _In_ WDFDEVICE Device, +// _In_ BOOLEAN WaitForD0, +// _In_ PVOID Tag +// ); +// +// VOID +// WdfDeviceResumeIdle( +// _In_ WDFDEVICE Device +// ); +// +// VOID +// WdfDeviceResumeIdleWithTag( +// _In_ WDFDEVICE Device +// _In_ PVOID Tag +// ); +// +#define WdfDeviceStopIdle(Device, WaitForD0) \ + WdfDeviceStopIdleWithTag(Device, WaitForD0, NULL) + +#define WdfDeviceStopIdleWithTag(Device, WaitForD0, Tag) \ + WdfDeviceStopIdleActual(Device, WaitForD0, Tag, __LINE__, __FILE__) + +#define WdfDeviceResumeIdle(Device) \ + WdfDeviceResumeIdleWithTag(Device, NULL) + +#define WdfDeviceResumeIdleWithTag(Device, Tag) \ + WdfDeviceResumeIdleActual(Device, Tag, __LINE__, __FILE__) + + + +// +// WDF Function: WdfDeviceGetDeviceState +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFDEVICEGETDEVICESTATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _Out_ + PWDF_DEVICE_STATE DeviceState + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfDeviceGetDeviceState( + _In_ + WDFDEVICE Device, + _Out_ + PWDF_DEVICE_STATE DeviceState + ) +{ + ((PFN_WDFDEVICEGETDEVICESTATE) WdfFunctions[WdfDeviceGetDeviceStateTableIndex])(WdfDriverGlobals, Device, DeviceState); +} + +// +// WDF Function: WdfDeviceSetDeviceState +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFDEVICESETDEVICESTATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PWDF_DEVICE_STATE DeviceState + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfDeviceSetDeviceState( + _In_ + WDFDEVICE Device, + _In_ + PWDF_DEVICE_STATE DeviceState + ) +{ + ((PFN_WDFDEVICESETDEVICESTATE) WdfFunctions[WdfDeviceSetDeviceStateTableIndex])(WdfDriverGlobals, Device, DeviceState); +} + +// +// WDF Function: WdfWdmDeviceGetWdfDeviceHandle +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFDEVICE +(*PFN_WDFWDMDEVICEGETWDFDEVICEHANDLE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + PDEVICE_OBJECT DeviceObject + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFDEVICE +FORCEINLINE +WdfWdmDeviceGetWdfDeviceHandle( + _In_ + PDEVICE_OBJECT DeviceObject + ) +{ + return ((PFN_WDFWDMDEVICEGETWDFDEVICEHANDLE) WdfFunctions[WdfWdmDeviceGetWdfDeviceHandleTableIndex])(WdfDriverGlobals, DeviceObject); +} + +// +// WDF Function: WdfDeviceWdmGetDeviceObject +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +PDEVICE_OBJECT +(*PFN_WDFDEVICEWDMGETDEVICEOBJECT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +PDEVICE_OBJECT +FORCEINLINE +WdfDeviceWdmGetDeviceObject( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEWDMGETDEVICEOBJECT) WdfFunctions[WdfDeviceWdmGetDeviceObjectTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceWdmGetAttachedDevice +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +PDEVICE_OBJECT +(*PFN_WDFDEVICEWDMGETATTACHEDDEVICE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +PDEVICE_OBJECT +FORCEINLINE +WdfDeviceWdmGetAttachedDevice( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEWDMGETATTACHEDDEVICE) WdfFunctions[WdfDeviceWdmGetAttachedDeviceTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceWdmGetPhysicalDevice +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +PDEVICE_OBJECT +(*PFN_WDFDEVICEWDMGETPHYSICALDEVICE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +PDEVICE_OBJECT +FORCEINLINE +WdfDeviceWdmGetPhysicalDevice( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEWDMGETPHYSICALDEVICE) WdfFunctions[WdfDeviceWdmGetPhysicalDeviceTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceWdmDispatchPreprocessedIrp +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEWDMDISPATCHPREPROCESSEDIRP)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PIRP Irp + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceWdmDispatchPreprocessedIrp( + _In_ + WDFDEVICE Device, + _In_ + PIRP Irp + ) +{ + return ((PFN_WDFDEVICEWDMDISPATCHPREPROCESSEDIRP) WdfFunctions[WdfDeviceWdmDispatchPreprocessedIrpTableIndex])(WdfDriverGlobals, Device, Irp); +} + +// +// WDF Function: WdfDeviceWdmDispatchIrp +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEWDMDISPATCHIRP)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PIRP Irp, + _In_ + WDFCONTEXT DispatchContext + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceWdmDispatchIrp( + _In_ + WDFDEVICE Device, + _In_ + PIRP Irp, + _In_ + WDFCONTEXT DispatchContext + ) +{ + return ((PFN_WDFDEVICEWDMDISPATCHIRP) WdfFunctions[WdfDeviceWdmDispatchIrpTableIndex])(WdfDriverGlobals, Device, Irp, DispatchContext); +} + +// +// WDF Function: WdfDeviceWdmDispatchIrpToIoQueue +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEWDMDISPATCHIRPTOIOQUEUE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PIRP Irp, + _In_ + WDFQUEUE Queue, + _In_ + ULONG Flags + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceWdmDispatchIrpToIoQueue( + _In_ + WDFDEVICE Device, + _In_ + PIRP Irp, + _In_ + WDFQUEUE Queue, + _In_ + ULONG Flags + ) +{ + return ((PFN_WDFDEVICEWDMDISPATCHIRPTOIOQUEUE) WdfFunctions[WdfDeviceWdmDispatchIrpToIoQueueTableIndex])(WdfDriverGlobals, Device, Irp, Queue, Flags); +} + +// +// WDF Function: WdfDeviceAddDependentUsageDeviceObject +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEADDDEPENDENTUSAGEDEVICEOBJECT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT DependentDevice + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceAddDependentUsageDeviceObject( + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT DependentDevice + ) +{ + return ((PFN_WDFDEVICEADDDEPENDENTUSAGEDEVICEOBJECT) WdfFunctions[WdfDeviceAddDependentUsageDeviceObjectTableIndex])(WdfDriverGlobals, Device, DependentDevice); +} + +// +// WDF Function: WdfDeviceRemoveDependentUsageDeviceObject +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFDEVICEREMOVEDEPENDENTUSAGEDEVICEOBJECT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT DependentDevice + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfDeviceRemoveDependentUsageDeviceObject( + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT DependentDevice + ) +{ + ((PFN_WDFDEVICEREMOVEDEPENDENTUSAGEDEVICEOBJECT) WdfFunctions[WdfDeviceRemoveDependentUsageDeviceObjectTableIndex])(WdfDriverGlobals, Device, DependentDevice); +} + +// +// WDF Function: WdfDeviceAddRemovalRelationsPhysicalDevice +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEADDREMOVALRELATIONSPHYSICALDEVICE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT PhysicalDevice + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceAddRemovalRelationsPhysicalDevice( + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT PhysicalDevice + ) +{ + return ((PFN_WDFDEVICEADDREMOVALRELATIONSPHYSICALDEVICE) WdfFunctions[WdfDeviceAddRemovalRelationsPhysicalDeviceTableIndex])(WdfDriverGlobals, Device, PhysicalDevice); +} + +// +// WDF Function: WdfDeviceRemoveRemovalRelationsPhysicalDevice +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFDEVICEREMOVEREMOVALRELATIONSPHYSICALDEVICE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT PhysicalDevice + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfDeviceRemoveRemovalRelationsPhysicalDevice( + _In_ + WDFDEVICE Device, + _In_ + PDEVICE_OBJECT PhysicalDevice + ) +{ + ((PFN_WDFDEVICEREMOVEREMOVALRELATIONSPHYSICALDEVICE) WdfFunctions[WdfDeviceRemoveRemovalRelationsPhysicalDeviceTableIndex])(WdfDriverGlobals, Device, PhysicalDevice); +} + +// +// WDF Function: WdfDeviceClearRemovalRelationsDevices +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFDEVICECLEARREMOVALRELATIONSDEVICES)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfDeviceClearRemovalRelationsDevices( + _In_ + WDFDEVICE Device + ) +{ + ((PFN_WDFDEVICECLEARREMOVALRELATIONSDEVICES) WdfFunctions[WdfDeviceClearRemovalRelationsDevicesTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceGetDriver +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFDRIVER +(*PFN_WDFDEVICEGETDRIVER)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFDRIVER +FORCEINLINE +WdfDeviceGetDriver( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEGETDRIVER) WdfFunctions[WdfDeviceGetDriverTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceRetrieveDeviceName +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICERETRIEVEDEVICENAME)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + WDFSTRING String + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceRetrieveDeviceName( + _In_ + WDFDEVICE Device, + _In_ + WDFSTRING String + ) +{ + return ((PFN_WDFDEVICERETRIEVEDEVICENAME) WdfFunctions[WdfDeviceRetrieveDeviceNameTableIndex])(WdfDriverGlobals, Device, String); +} + +// +// WDF Function: WdfDeviceAssignMofResourceName +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEASSIGNMOFRESOURCENAME)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PCUNICODE_STRING MofResourceName + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceAssignMofResourceName( + _In_ + WDFDEVICE Device, + _In_ + PCUNICODE_STRING MofResourceName + ) +{ + return ((PFN_WDFDEVICEASSIGNMOFRESOURCENAME) WdfFunctions[WdfDeviceAssignMofResourceNameTableIndex])(WdfDriverGlobals, Device, MofResourceName); +} + +// +// WDF Function: WdfDeviceGetIoTarget +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDFIOTARGET +(*PFN_WDFDEVICEGETIOTARGET)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFIOTARGET +FORCEINLINE +WdfDeviceGetIoTarget( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEGETIOTARGET) WdfFunctions[WdfDeviceGetIoTargetTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceGetDevicePnpState +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDF_DEVICE_PNP_STATE +(*PFN_WDFDEVICEGETDEVICEPNPSTATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDF_DEVICE_PNP_STATE +FORCEINLINE +WdfDeviceGetDevicePnpState( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEGETDEVICEPNPSTATE) WdfFunctions[WdfDeviceGetDevicePnpStateTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceGetDevicePowerState +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDF_DEVICE_POWER_STATE +(*PFN_WDFDEVICEGETDEVICEPOWERSTATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDF_DEVICE_POWER_STATE +FORCEINLINE +WdfDeviceGetDevicePowerState( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEGETDEVICEPOWERSTATE) WdfFunctions[WdfDeviceGetDevicePowerStateTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceGetDevicePowerPolicyState +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +WDF_DEVICE_POWER_POLICY_STATE +(*PFN_WDFDEVICEGETDEVICEPOWERPOLICYSTATE)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +WDF_DEVICE_POWER_POLICY_STATE +FORCEINLINE +WdfDeviceGetDevicePowerPolicyState( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEGETDEVICEPOWERPOLICYSTATE) WdfFunctions[WdfDeviceGetDevicePowerPolicyStateTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceAssignS0IdleSettings +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEASSIGNS0IDLESETTINGS)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceAssignS0IdleSettings( + _In_ + WDFDEVICE Device, + _In_ + PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings + ) +{ + return ((PFN_WDFDEVICEASSIGNS0IDLESETTINGS) WdfFunctions[WdfDeviceAssignS0IdleSettingsTableIndex])(WdfDriverGlobals, Device, Settings); +} + +// +// WDF Function: WdfDeviceAssignSxWakeSettings +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEASSIGNSXWAKESETTINGS)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings + ); + +_Must_inspect_result_ +_IRQL_requires_max_(DISPATCH_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceAssignSxWakeSettings( + _In_ + WDFDEVICE Device, + _In_ + PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings + ) +{ + return ((PFN_WDFDEVICEASSIGNSXWAKESETTINGS) WdfFunctions[WdfDeviceAssignSxWakeSettingsTableIndex])(WdfDriverGlobals, Device, Settings); +} + +// +// WDF Function: WdfDeviceOpenRegistryKey +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEOPENREGISTRYKEY)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + ULONG DeviceInstanceKeyType, + _In_ + ACCESS_MASK DesiredAccess, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES KeyAttributes, + _Out_ + WDFKEY* Key + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceOpenRegistryKey( + _In_ + WDFDEVICE Device, + _In_ + ULONG DeviceInstanceKeyType, + _In_ + ACCESS_MASK DesiredAccess, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES KeyAttributes, + _Out_ + WDFKEY* Key + ) +{ + return ((PFN_WDFDEVICEOPENREGISTRYKEY) WdfFunctions[WdfDeviceOpenRegistryKeyTableIndex])(WdfDriverGlobals, Device, DeviceInstanceKeyType, DesiredAccess, KeyAttributes, Key); +} + +// +// WDF Function: WdfDeviceOpenDevicemapKey +// +typedef +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +WDFAPI +NTSTATUS +(*PFN_WDFDEVICEOPENDEVICEMAPKEY)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + PCUNICODE_STRING KeyName, + _In_ + ACCESS_MASK DesiredAccess, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES KeyAttributes, + _Out_ + WDFKEY* Key + ); + +_Must_inspect_result_ +_IRQL_requires_max_(PASSIVE_LEVEL) +NTSTATUS +FORCEINLINE +WdfDeviceOpenDevicemapKey( + _In_ + WDFDEVICE Device, + _In_ + PCUNICODE_STRING KeyName, + _In_ + ACCESS_MASK DesiredAccess, + _In_opt_ + PWDF_OBJECT_ATTRIBUTES KeyAttributes, + _Out_ + WDFKEY* Key + ) +{ + return ((PFN_WDFDEVICEOPENDEVICEMAPKEY) WdfFunctions[WdfDeviceOpenDevicemapKeyTableIndex])(WdfDriverGlobals, Device, KeyName, DesiredAccess, KeyAttributes, Key); +} + +// +// WDF Function: WdfDeviceSetSpecialFileSupport +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFDEVICESETSPECIALFILESUPPORT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + WDF_SPECIAL_FILE_TYPE FileType, + _In_ + BOOLEAN FileTypeIsSupported + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfDeviceSetSpecialFileSupport( + _In_ + WDFDEVICE Device, + _In_ + WDF_SPECIAL_FILE_TYPE FileType, + _In_ + BOOLEAN FileTypeIsSupported + ) +{ + ((PFN_WDFDEVICESETSPECIALFILESUPPORT) WdfFunctions[WdfDeviceSetSpecialFileSupportTableIndex])(WdfDriverGlobals, Device, FileType, FileTypeIsSupported); +} + +// +// WDF Function: WdfDeviceSetCharacteristics +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +VOID +(*PFN_WDFDEVICESETCHARACTERISTICS)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device, + _In_ + ULONG DeviceCharacteristics + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +VOID +FORCEINLINE +WdfDeviceSetCharacteristics( + _In_ + WDFDEVICE Device, + _In_ + ULONG DeviceCharacteristics + ) +{ + ((PFN_WDFDEVICESETCHARACTERISTICS) WdfFunctions[WdfDeviceSetCharacteristicsTableIndex])(WdfDriverGlobals, Device, DeviceCharacteristics); +} + +// +// WDF Function: WdfDeviceGetCharacteristics +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +ULONG +(*PFN_WDFDEVICEGETCHARACTERISTICS)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +ULONG +FORCEINLINE +WdfDeviceGetCharacteristics( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEGETCHARACTERISTICS) WdfFunctions[WdfDeviceGetCharacteristicsTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceGetAlignmentRequirement +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) +WDFAPI +ULONG +(*PFN_WDFDEVICEGETALIGNMENTREQUIREMENT)( + _In_ + PWDF_DRIVER_GLOBALS DriverGlobals, + _In_ + WDFDEVICE Device + ); + +_IRQL_requires_max_(DISPATCH_LEVEL) +ULONG +FORCEINLINE +WdfDeviceGetAlignmentRequirement( + _In_ + WDFDEVICE Device + ) +{ + return ((PFN_WDFDEVICEGETALIGNMENTREQUIREMENT) WdfFunctions[WdfDeviceGetAlignmentRequirementTableIndex])(WdfDriverGlobals, Device); +} + +// +// WDF Function: WdfDeviceSetAlignmentRequirement +// +typedef +_IRQL_requires_max_(DISPATCH_LEVEL) ... 19595 lines suppressed ...