[KMDF] Add Kernel-Mode Driver Framework headers v1.17

Taken from Microsoft GitHub repo:
d9c6040fe9

Licensed under MIT
This commit is contained in:
Victor Perevertkin 2020-09-24 23:41:01 +03:00
parent 5c7ce4475e
commit 40462c924e
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
42 changed files with 24287 additions and 0 deletions

View file

@ -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_

View file

@ -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_

View file

@ -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_

View file

@ -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_

View file

@ -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_

View file

@ -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_

View file

@ -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_

View file

@ -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_

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,509 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfDmaEnabler.h
Abstract:
WDF DMA Enabler 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 _WDFDMAENABLER_H_
#define _WDFDMAENABLER_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_DMA_PROFILE {
WdfDmaProfileInvalid = 0,
WdfDmaProfilePacket,
WdfDmaProfileScatterGather,
WdfDmaProfilePacket64,
WdfDmaProfileScatterGather64,
WdfDmaProfileScatterGatherDuplex,
WdfDmaProfileScatterGather64Duplex,
WdfDmaProfileSystem,
WdfDmaProfileSystemDuplex,
} WDF_DMA_PROFILE;
typedef enum _WDF_DMA_DIRECTION {
WdfDmaDirectionReadFromDevice = FALSE,
WdfDmaDirectionWriteToDevice = TRUE,
} WDF_DMA_DIRECTION;
//
// DMA power event callbacks
//
typedef
_Function_class_(EVT_WDF_DMA_ENABLER_FILL)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DMA_ENABLER_FILL(
_In_
WDFDMAENABLER DmaEnabler
);
typedef EVT_WDF_DMA_ENABLER_FILL *PFN_WDF_DMA_ENABLER_FILL;
typedef
_Function_class_(EVT_WDF_DMA_ENABLER_FLUSH)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DMA_ENABLER_FLUSH(
_In_
WDFDMAENABLER DmaEnabler
);
typedef EVT_WDF_DMA_ENABLER_FLUSH *PFN_WDF_DMA_ENABLER_FLUSH;
typedef
_Function_class_(EVT_WDF_DMA_ENABLER_ENABLE)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DMA_ENABLER_ENABLE(
_In_
WDFDMAENABLER DmaEnabler
);
typedef EVT_WDF_DMA_ENABLER_ENABLE *PFN_WDF_DMA_ENABLER_ENABLE;
typedef
_Function_class_(EVT_WDF_DMA_ENABLER_DISABLE)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DMA_ENABLER_DISABLE(
_In_
WDFDMAENABLER DmaEnabler
);
typedef EVT_WDF_DMA_ENABLER_DISABLE *PFN_WDF_DMA_ENABLER_DISABLE;
typedef
_Function_class_(EVT_WDF_DMA_ENABLER_SELFMANAGED_IO_START)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DMA_ENABLER_SELFMANAGED_IO_START(
_In_
WDFDMAENABLER DmaEnabler
);
typedef EVT_WDF_DMA_ENABLER_SELFMANAGED_IO_START *PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_START;
typedef
_Function_class_(EVT_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP(
_In_
WDFDMAENABLER DmaEnabler
);
typedef EVT_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP *PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP;
#define WDF_DMA_ENABLER_UNLIMITED_FRAGMENTS ((ULONG) -1)
typedef enum _WDF_DMA_ENABLER_CONFIG_FLAGS {
//
// This flag only applies to the following DMA profiles:
// WdfDmaProfileScatterGather,
// WdfDmaProfileScatterGather64,
// WdfDmaProfileScatterGatherDuplex and
// WdfDmaProfileScatterGather64Duplex
//
// When this flag is not set and the profile is one of the above, WDF
// creates a SGLookasideList used by this DMA adapter's transaction
// objects. The SGLookasideList is initialized to allow the max specified
// transfer length. When the transaction is executed, WDF calls the WDM
// DMA's BuildScatterGatherList entry function. Forward progress drivers
// must use this option. This is the default option.
//
// When this flag is set and the profile is one of the above, WDF
// does not create a SGLookasideList. When the transaction is executed,
// WDF calls the WDM DMA's GetScatterGatherList entry function.
//
WDF_DMA_ENABLER_CONFIG_NO_SGLIST_PREALLOCATION = 0x00000001,
} WDF_DMA_ENABLER_CONFIG_FLAGS;
typedef struct _WDF_DMA_ENABLER_CONFIG {
//
// Size of this structure in bytes
//
ULONG Size;
//
// One of the above WDF_DMA_PROFILES
//
WDF_DMA_PROFILE Profile;
//
// Maximum DMA Transfer handled in bytes.
//
size_t MaximumLength;
//
// The various DMA PnP/Power event callbacks
//
PFN_WDF_DMA_ENABLER_FILL EvtDmaEnablerFill;
PFN_WDF_DMA_ENABLER_FLUSH EvtDmaEnablerFlush;
PFN_WDF_DMA_ENABLER_DISABLE EvtDmaEnablerDisable;
PFN_WDF_DMA_ENABLER_ENABLE EvtDmaEnablerEnable;
PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_START EvtDmaEnablerSelfManagedIoStart;
PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP EvtDmaEnablerSelfManagedIoStop;
//
// Overrides the address width specified by the DMA profile.
//
ULONG AddressWidthOverride;
//
// Overrides the version of the WDM DMA interfaces that WDF uses
// (0 for default).
//
ULONG WdmDmaVersionOverride;
//
// Bit field combination of values from the WDF_DMA_ENABLER_CONFIG_FLAGS
// enumeration
//
ULONG Flags;
} WDF_DMA_ENABLER_CONFIG, *PWDF_DMA_ENABLER_CONFIG;
VOID
FORCEINLINE
WDF_DMA_ENABLER_CONFIG_INIT(
_Out_ PWDF_DMA_ENABLER_CONFIG Config,
_In_ WDF_DMA_PROFILE Profile,
_In_ size_t MaximumLength
)
{
RtlZeroMemory(Config, sizeof(WDF_DMA_ENABLER_CONFIG));
Config->Size = sizeof(WDF_DMA_ENABLER_CONFIG);
Config->Profile = Profile;
Config->MaximumLength = MaximumLength;
}
typedef struct _WDF_DMA_SYSTEM_PROFILE_CONFIG {
//
// The size of this structure in bytes
//
ULONG Size;
//
// Specifies that the transfer is controlled by the device's DMA
// request line.
//
BOOLEAN DemandMode;
//
// Specifies that the DMA engine will loop back to the beginning
// of the buffer once it reaches the end.
//
BOOLEAN LoopedTransfer;
//
// Width of the register to DMA to/from
//
DMA_WIDTH DmaWidth;
//
// The adress at which to write to the device
//
PHYSICAL_ADDRESS DeviceAddress;
//
// The translated resource descriptor for the DMA channel assigned
// the device during EvtDevicePrepareHardware
//
PCM_PARTIAL_RESOURCE_DESCRIPTOR DmaDescriptor;
} WDF_DMA_SYSTEM_PROFILE_CONFIG, *PWDF_DMA_SYSTEM_PROFILE_CONFIG;
VOID
FORCEINLINE
WDF_DMA_SYSTEM_PROFILE_CONFIG_INIT(
_Out_ PWDF_DMA_SYSTEM_PROFILE_CONFIG DmaConfig,
_In_ PHYSICAL_ADDRESS Address,
_In_ DMA_WIDTH DmaWidth,
_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR DmaDescriptor
)
{
RtlZeroMemory(DmaConfig, sizeof(WDF_DMA_SYSTEM_PROFILE_CONFIG));
DmaConfig->Size = sizeof(WDF_DMA_SYSTEM_PROFILE_CONFIG);
DmaConfig->DeviceAddress = Address;
DmaConfig->DmaWidth = DmaWidth;
DmaConfig->DmaDescriptor = DmaDescriptor;
}
//
// WDF Function: WdfDmaEnablerCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMAENABLERCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_In_
PWDF_DMA_ENABLER_CONFIG Config,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFDMAENABLER* DmaEnablerHandle
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaEnablerCreate(
_In_
WDFDEVICE Device,
_In_
PWDF_DMA_ENABLER_CONFIG Config,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFDMAENABLER* DmaEnablerHandle
)
{
return ((PFN_WDFDMAENABLERCREATE) WdfFunctions[WdfDmaEnablerCreateTableIndex])(WdfDriverGlobals, Device, Config, Attributes, DmaEnablerHandle);
}
//
// WDF Function: WdfDmaEnablerConfigureSystemProfile
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMAENABLERCONFIGURESYSTEMPROFILE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMAENABLER DmaEnabler,
_In_
PWDF_DMA_SYSTEM_PROFILE_CONFIG ProfileConfig,
_In_
WDF_DMA_DIRECTION ConfigDirection
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaEnablerConfigureSystemProfile(
_In_
WDFDMAENABLER DmaEnabler,
_In_
PWDF_DMA_SYSTEM_PROFILE_CONFIG ProfileConfig,
_In_
WDF_DMA_DIRECTION ConfigDirection
)
{
return ((PFN_WDFDMAENABLERCONFIGURESYSTEMPROFILE) WdfFunctions[WdfDmaEnablerConfigureSystemProfileTableIndex])(WdfDriverGlobals, DmaEnabler, ProfileConfig, ConfigDirection);
}
//
// WDF Function: WdfDmaEnablerGetMaximumLength
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
size_t
(*PFN_WDFDMAENABLERGETMAXIMUMLENGTH)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMAENABLER DmaEnabler
);
_IRQL_requires_max_(DISPATCH_LEVEL)
size_t
FORCEINLINE
WdfDmaEnablerGetMaximumLength(
_In_
WDFDMAENABLER DmaEnabler
)
{
return ((PFN_WDFDMAENABLERGETMAXIMUMLENGTH) WdfFunctions[WdfDmaEnablerGetMaximumLengthTableIndex])(WdfDriverGlobals, DmaEnabler);
}
//
// WDF Function: WdfDmaEnablerGetMaximumScatterGatherElements
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
size_t
(*PFN_WDFDMAENABLERGETMAXIMUMSCATTERGATHERELEMENTS)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMAENABLER DmaEnabler
);
_IRQL_requires_max_(DISPATCH_LEVEL)
size_t
FORCEINLINE
WdfDmaEnablerGetMaximumScatterGatherElements(
_In_
WDFDMAENABLER DmaEnabler
)
{
return ((PFN_WDFDMAENABLERGETMAXIMUMSCATTERGATHERELEMENTS) WdfFunctions[WdfDmaEnablerGetMaximumScatterGatherElementsTableIndex])(WdfDriverGlobals, DmaEnabler);
}
//
// WDF Function: WdfDmaEnablerSetMaximumScatterGatherElements
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMAENABLERSETMAXIMUMSCATTERGATHERELEMENTS)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMAENABLER DmaEnabler,
_In_
_When_(MaximumFragments == 0, __drv_reportError(MaximumFragments cannot be zero))
size_t MaximumFragments
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfDmaEnablerSetMaximumScatterGatherElements(
_In_
WDFDMAENABLER DmaEnabler,
_In_
_When_(MaximumFragments == 0, __drv_reportError(MaximumFragments cannot be zero))
size_t MaximumFragments
)
{
((PFN_WDFDMAENABLERSETMAXIMUMSCATTERGATHERELEMENTS) WdfFunctions[WdfDmaEnablerSetMaximumScatterGatherElementsTableIndex])(WdfDriverGlobals, DmaEnabler, MaximumFragments);
}
//
// WDF Function: WdfDmaEnablerGetFragmentLength
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
size_t
(*PFN_WDFDMAENABLERGETFRAGMENTLENGTH)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMAENABLER DmaEnabler,
_In_
WDF_DMA_DIRECTION DmaDirection
);
_IRQL_requires_max_(DISPATCH_LEVEL)
size_t
FORCEINLINE
WdfDmaEnablerGetFragmentLength(
_In_
WDFDMAENABLER DmaEnabler,
_In_
WDF_DMA_DIRECTION DmaDirection
)
{
return ((PFN_WDFDMAENABLERGETFRAGMENTLENGTH) WdfFunctions[WdfDmaEnablerGetFragmentLengthTableIndex])(WdfDriverGlobals, DmaEnabler, DmaDirection);
}
//
// WDF Function: WdfDmaEnablerWdmGetDmaAdapter
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PDMA_ADAPTER
(*PFN_WDFDMAENABLERWDMGETDMAADAPTER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMAENABLER DmaEnabler,
_In_
WDF_DMA_DIRECTION DmaDirection
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PDMA_ADAPTER
FORCEINLINE
WdfDmaEnablerWdmGetDmaAdapter(
_In_
WDFDMAENABLER DmaEnabler,
_In_
WDF_DMA_DIRECTION DmaDirection
)
{
return ((PFN_WDFDMAENABLERWDMGETDMAADAPTER) WdfFunctions[WdfDmaEnablerWdmGetDmaAdapterTableIndex])(WdfDriverGlobals, DmaEnabler, DmaDirection);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFDMAENABLER_H_

View file

@ -0,0 +1,890 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfDmaTransaction.h
Abstract:
WDF DMA Transaction 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 _WDFDMATRANSACTION_H_
#define _WDFDMATRANSACTION_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_PROGRAM_DMA)
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
BOOLEAN
EVT_WDF_PROGRAM_DMA(
_In_
WDFDMATRANSACTION Transaction,
_In_
WDFDEVICE Device,
_In_
WDFCONTEXT Context,
_In_
WDF_DMA_DIRECTION Direction,
_In_
PSCATTER_GATHER_LIST SgList
);
typedef EVT_WDF_PROGRAM_DMA *PFN_WDF_PROGRAM_DMA;
typedef
_Function_class_(EVT_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL)
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
BOOLEAN
EVT_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
WDFDEVICE Device,
_In_
PVOID Context,
_In_opt_
PMDL Mdl,
_In_
size_t Offset,
_In_
size_t Length
);
typedef EVT_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL *PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL;
typedef
_Function_class_(EVT_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE)
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
VOID
EVT_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE(
_In_
WDFDMATRANSACTION Transaction,
_In_
WDFDEVICE Device,
_In_
WDFCONTEXT Context,
_In_
WDF_DMA_DIRECTION Direction,
_In_
DMA_COMPLETION_STATUS Status
);
typedef EVT_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE *PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE;
typedef
_Function_class_(EVT_WDF_RESERVE_DMA)
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
VOID
EVT_WDF_RESERVE_DMA(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
PVOID Context
);
typedef EVT_WDF_RESERVE_DMA *PFN_WDF_RESERVE_DMA;
//
// WDF Function: WdfDmaTransactionCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMATRANSACTIONCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMAENABLER DmaEnabler,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFDMATRANSACTION* DmaTransaction
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaTransactionCreate(
_In_
WDFDMAENABLER DmaEnabler,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFDMATRANSACTION* DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONCREATE) WdfFunctions[WdfDmaTransactionCreateTableIndex])(WdfDriverGlobals, DmaEnabler, Attributes, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionInitialize
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMATRANSACTIONINITIALIZE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
_In_
WDF_DMA_DIRECTION DmaDirection,
_In_
PMDL Mdl,
_In_
PVOID VirtualAddress,
_In_
_When_(Length == 0, __drv_reportError(Length cannot be zero))
size_t Length
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaTransactionInitialize(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
_In_
WDF_DMA_DIRECTION DmaDirection,
_In_
PMDL Mdl,
_In_
PVOID VirtualAddress,
_In_
_When_(Length == 0, __drv_reportError(Length cannot be zero))
size_t Length
)
{
return ((PFN_WDFDMATRANSACTIONINITIALIZE) WdfFunctions[WdfDmaTransactionInitializeTableIndex])(WdfDriverGlobals, DmaTransaction, EvtProgramDmaFunction, DmaDirection, Mdl, VirtualAddress, Length);
}
//
// WDF Function: WdfDmaTransactionInitializeUsingOffset
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMATRANSACTIONINITIALIZEUSINGOFFSET)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
_In_
WDF_DMA_DIRECTION DmaDirection,
_In_
PMDL Mdl,
_In_
size_t Offset,
_In_
_When_(Length == 0, __drv_reportError(Length cannot be zero))
size_t Length
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaTransactionInitializeUsingOffset(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
_In_
WDF_DMA_DIRECTION DmaDirection,
_In_
PMDL Mdl,
_In_
size_t Offset,
_In_
_When_(Length == 0, __drv_reportError(Length cannot be zero))
size_t Length
)
{
return ((PFN_WDFDMATRANSACTIONINITIALIZEUSINGOFFSET) WdfFunctions[WdfDmaTransactionInitializeUsingOffsetTableIndex])(WdfDriverGlobals, DmaTransaction, EvtProgramDmaFunction, DmaDirection, Mdl, Offset, Length);
}
//
// WDF Function: WdfDmaTransactionInitializeUsingRequest
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMATRANSACTIONINITIALIZEUSINGREQUEST)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
WDFREQUEST Request,
_In_
PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
_In_
WDF_DMA_DIRECTION DmaDirection
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaTransactionInitializeUsingRequest(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
WDFREQUEST Request,
_In_
PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
_In_
WDF_DMA_DIRECTION DmaDirection
)
{
return ((PFN_WDFDMATRANSACTIONINITIALIZEUSINGREQUEST) WdfFunctions[WdfDmaTransactionInitializeUsingRequestTableIndex])(WdfDriverGlobals, DmaTransaction, Request, EvtProgramDmaFunction, DmaDirection);
}
//
// WDF Function: WdfDmaTransactionExecute
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMATRANSACTIONEXECUTE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_opt_
WDFCONTEXT Context
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaTransactionExecute(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_opt_
WDFCONTEXT Context
)
{
return ((PFN_WDFDMATRANSACTIONEXECUTE) WdfFunctions[WdfDmaTransactionExecuteTableIndex])(WdfDriverGlobals, DmaTransaction, Context);
}
//
// WDF Function: WdfDmaTransactionRelease
//
typedef
_Success_(TRUE)
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMATRANSACTIONRELEASE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_Success_(TRUE)
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaTransactionRelease(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONRELEASE) WdfFunctions[WdfDmaTransactionReleaseTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionDmaCompleted
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFDMATRANSACTIONDMACOMPLETED)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_Out_
NTSTATUS* Status
);
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
FORCEINLINE
WdfDmaTransactionDmaCompleted(
_In_
WDFDMATRANSACTION DmaTransaction,
_Out_
NTSTATUS* Status
)
{
return ((PFN_WDFDMATRANSACTIONDMACOMPLETED) WdfFunctions[WdfDmaTransactionDmaCompletedTableIndex])(WdfDriverGlobals, DmaTransaction, Status);
}
//
// WDF Function: WdfDmaTransactionDmaCompletedWithLength
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFDMATRANSACTIONDMACOMPLETEDWITHLENGTH)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
size_t TransferredLength,
_Out_
NTSTATUS* Status
);
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
FORCEINLINE
WdfDmaTransactionDmaCompletedWithLength(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
size_t TransferredLength,
_Out_
NTSTATUS* Status
)
{
return ((PFN_WDFDMATRANSACTIONDMACOMPLETEDWITHLENGTH) WdfFunctions[WdfDmaTransactionDmaCompletedWithLengthTableIndex])(WdfDriverGlobals, DmaTransaction, TransferredLength, Status);
}
//
// WDF Function: WdfDmaTransactionDmaCompletedFinal
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFDMATRANSACTIONDMACOMPLETEDFINAL)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
size_t FinalTransferredLength,
_Out_
NTSTATUS* Status
);
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
FORCEINLINE
WdfDmaTransactionDmaCompletedFinal(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
size_t FinalTransferredLength,
_Out_
NTSTATUS* Status
)
{
return ((PFN_WDFDMATRANSACTIONDMACOMPLETEDFINAL) WdfFunctions[WdfDmaTransactionDmaCompletedFinalTableIndex])(WdfDriverGlobals, DmaTransaction, FinalTransferredLength, Status);
}
//
// WDF Function: WdfDmaTransactionGetBytesTransferred
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
size_t
(*PFN_WDFDMATRANSACTIONGETBYTESTRANSFERRED)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
size_t
FORCEINLINE
WdfDmaTransactionGetBytesTransferred(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONGETBYTESTRANSFERRED) WdfFunctions[WdfDmaTransactionGetBytesTransferredTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionSetMaximumLength
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONSETMAXIMUMLENGTH)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
size_t MaximumLength
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionSetMaximumLength(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
size_t MaximumLength
)
{
((PFN_WDFDMATRANSACTIONSETMAXIMUMLENGTH) WdfFunctions[WdfDmaTransactionSetMaximumLengthTableIndex])(WdfDriverGlobals, DmaTransaction, MaximumLength);
}
//
// WDF Function: WdfDmaTransactionGetRequest
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFREQUEST
(*PFN_WDFDMATRANSACTIONGETREQUEST)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFREQUEST
FORCEINLINE
WdfDmaTransactionGetRequest(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONGETREQUEST) WdfFunctions[WdfDmaTransactionGetRequestTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionGetCurrentDmaTransferLength
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
size_t
(*PFN_WDFDMATRANSACTIONGETCURRENTDMATRANSFERLENGTH)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
size_t
FORCEINLINE
WdfDmaTransactionGetCurrentDmaTransferLength(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONGETCURRENTDMATRANSFERLENGTH) WdfFunctions[WdfDmaTransactionGetCurrentDmaTransferLengthTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionGetDevice
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFDEVICE
(*PFN_WDFDMATRANSACTIONGETDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFDEVICE
FORCEINLINE
WdfDmaTransactionGetDevice(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONGETDEVICE) WdfFunctions[WdfDmaTransactionGetDeviceTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionGetTransferInfo
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONGETTRANSFERINFO)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_Out_opt_
ULONG* MapRegisterCount,
_Out_opt_
ULONG* ScatterGatherElementCount
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionGetTransferInfo(
_In_
WDFDMATRANSACTION DmaTransaction,
_Out_opt_
ULONG* MapRegisterCount,
_Out_opt_
ULONG* ScatterGatherElementCount
)
{
((PFN_WDFDMATRANSACTIONGETTRANSFERINFO) WdfFunctions[WdfDmaTransactionGetTransferInfoTableIndex])(WdfDriverGlobals, DmaTransaction, MapRegisterCount, ScatterGatherElementCount);
}
//
// WDF Function: WdfDmaTransactionSetChannelConfigurationCallback
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONSETCHANNELCONFIGURATIONCALLBACK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_opt_
PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL ConfigureRoutine,
_In_opt_
PVOID ConfigureContext
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionSetChannelConfigurationCallback(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_opt_
PFN_WDF_DMA_TRANSACTION_CONFIGURE_DMA_CHANNEL ConfigureRoutine,
_In_opt_
PVOID ConfigureContext
)
{
((PFN_WDFDMATRANSACTIONSETCHANNELCONFIGURATIONCALLBACK) WdfFunctions[WdfDmaTransactionSetChannelConfigurationCallbackTableIndex])(WdfDriverGlobals, DmaTransaction, ConfigureRoutine, ConfigureContext);
}
//
// WDF Function: WdfDmaTransactionSetTransferCompleteCallback
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONSETTRANSFERCOMPLETECALLBACK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_opt_
PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE DmaCompletionRoutine,
_In_opt_
PVOID DmaCompletionContext
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionSetTransferCompleteCallback(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_opt_
PFN_WDF_DMA_TRANSACTION_DMA_TRANSFER_COMPLETE DmaCompletionRoutine,
_In_opt_
PVOID DmaCompletionContext
)
{
((PFN_WDFDMATRANSACTIONSETTRANSFERCOMPLETECALLBACK) WdfFunctions[WdfDmaTransactionSetTransferCompleteCallbackTableIndex])(WdfDriverGlobals, DmaTransaction, DmaCompletionRoutine, DmaCompletionContext);
}
//
// WDF Function: WdfDmaTransactionSetImmediateExecution
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONSETIMMEDIATEEXECUTION)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
BOOLEAN UseImmediateExecution
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionSetImmediateExecution(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
BOOLEAN UseImmediateExecution
)
{
((PFN_WDFDMATRANSACTIONSETIMMEDIATEEXECUTION) WdfFunctions[WdfDmaTransactionSetImmediateExecutionTableIndex])(WdfDriverGlobals, DmaTransaction, UseImmediateExecution);
}
//
// WDF Function: WdfDmaTransactionAllocateResources
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDMATRANSACTIONALLOCATERESOURCES)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
WDF_DMA_DIRECTION DmaDirection,
_In_
ULONG RequiredMapRegisters,
_In_
PFN_WDF_RESERVE_DMA EvtReserveDmaFunction,
_In_
PVOID EvtReserveDmaContext
);
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDmaTransactionAllocateResources(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
WDF_DMA_DIRECTION DmaDirection,
_In_
ULONG RequiredMapRegisters,
_In_
PFN_WDF_RESERVE_DMA EvtReserveDmaFunction,
_In_
PVOID EvtReserveDmaContext
)
{
return ((PFN_WDFDMATRANSACTIONALLOCATERESOURCES) WdfFunctions[WdfDmaTransactionAllocateResourcesTableIndex])(WdfDriverGlobals, DmaTransaction, DmaDirection, RequiredMapRegisters, EvtReserveDmaFunction, EvtReserveDmaContext);
}
//
// WDF Function: WdfDmaTransactionSetDeviceAddressOffset
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONSETDEVICEADDRESSOFFSET)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
ULONG Offset
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionSetDeviceAddressOffset(
_In_
WDFDMATRANSACTION DmaTransaction,
_In_
ULONG Offset
)
{
((PFN_WDFDMATRANSACTIONSETDEVICEADDRESSOFFSET) WdfFunctions[WdfDmaTransactionSetDeviceAddressOffsetTableIndex])(WdfDriverGlobals, DmaTransaction, Offset);
}
//
// WDF Function: WdfDmaTransactionFreeResources
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONFREERESOURCES)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionFreeResources(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
((PFN_WDFDMATRANSACTIONFREERESOURCES) WdfFunctions[WdfDmaTransactionFreeResourcesTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionCancel
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFDMATRANSACTIONCANCEL)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
FORCEINLINE
WdfDmaTransactionCancel(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONCANCEL) WdfFunctions[WdfDmaTransactionCancelTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionWdmGetTransferContext
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PVOID
(*PFN_WDFDMATRANSACTIONWDMGETTRANSFERCONTEXT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PVOID
FORCEINLINE
WdfDmaTransactionWdmGetTransferContext(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
return ((PFN_WDFDMATRANSACTIONWDMGETTRANSFERCONTEXT) WdfFunctions[WdfDmaTransactionWdmGetTransferContextTableIndex])(WdfDriverGlobals, DmaTransaction);
}
//
// WDF Function: WdfDmaTransactionStopSystemTransfer
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFDMATRANSACTIONSTOPSYSTEMTRANSFER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDMATRANSACTION DmaTransaction
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfDmaTransactionStopSystemTransfer(
_In_
WDFDMATRANSACTION DmaTransaction
)
{
((PFN_WDFDMATRANSACTIONSTOPSYSTEMTRANSFER) WdfFunctions[WdfDmaTransactionStopSystemTransferTableIndex])(WdfDriverGlobals, DmaTransaction);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFDMATRANSACTION_H_

View file

@ -0,0 +1,243 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfdpc.h
Abstract:
This is the C header for driver frameworks DPC object
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 _WDFDPC_H_
#define _WDFDPC_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)
//
// This is the function that gets called back into the driver
// when the DPC fires.
//
typedef
_Function_class_(EVT_WDF_DPC)
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
VOID
EVT_WDF_DPC(
_In_
WDFDPC Dpc
);
typedef EVT_WDF_DPC *PFN_WDF_DPC;
typedef struct _WDF_DPC_CONFIG {
ULONG Size;
PFN_WDF_DPC EvtDpcFunc;
//
// If this is TRUE, the DPC will automatically serialize
// with the event callback handlers of its Parent Object.
//
// Parent Object's callback constraints should be compatible
// with the DPC (DISPATCH_LEVEL), or the request will fail.
//
BOOLEAN AutomaticSerialization;
} WDF_DPC_CONFIG, *PWDF_DPC_CONFIG;
VOID
FORCEINLINE
WDF_DPC_CONFIG_INIT(
_Out_ PWDF_DPC_CONFIG Config,
_In_ PFN_WDF_DPC EvtDpcFunc
)
{
RtlZeroMemory(Config, sizeof(WDF_DPC_CONFIG));
Config->Size = sizeof(WDF_DPC_CONFIG);
Config->EvtDpcFunc = EvtDpcFunc;
Config->AutomaticSerialization = TRUE;
}
//
// WDF Function: WdfDpcCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDPCCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDF_DPC_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFDPC* Dpc
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfDpcCreate(
_In_
PWDF_DPC_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFDPC* Dpc
)
{
return ((PFN_WDFDPCCREATE) WdfFunctions[WdfDpcCreateTableIndex])(WdfDriverGlobals, Config, Attributes, Dpc);
}
//
// WDF Function: WdfDpcEnqueue
//
typedef
_IRQL_requires_max_(HIGH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFDPCENQUEUE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDPC Dpc
);
_IRQL_requires_max_(HIGH_LEVEL)
BOOLEAN
FORCEINLINE
WdfDpcEnqueue(
_In_
WDFDPC Dpc
)
{
return ((PFN_WDFDPCENQUEUE) WdfFunctions[WdfDpcEnqueueTableIndex])(WdfDriverGlobals, Dpc);
}
//
// WDF Function: WdfDpcCancel
//
typedef
_When_(Wait == __true, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Wait == __false, _IRQL_requires_max_(HIGH_LEVEL))
WDFAPI
BOOLEAN
(*PFN_WDFDPCCANCEL)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDPC Dpc,
_In_
BOOLEAN Wait
);
_When_(Wait == __true, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Wait == __false, _IRQL_requires_max_(HIGH_LEVEL))
BOOLEAN
FORCEINLINE
WdfDpcCancel(
_In_
WDFDPC Dpc,
_In_
BOOLEAN Wait
)
{
return ((PFN_WDFDPCCANCEL) WdfFunctions[WdfDpcCancelTableIndex])(WdfDriverGlobals, Dpc, Wait);
}
//
// WDF Function: WdfDpcGetParentObject
//
typedef
_IRQL_requires_max_(HIGH_LEVEL)
WDFAPI
WDFOBJECT
(*PFN_WDFDPCGETPARENTOBJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDPC Dpc
);
_IRQL_requires_max_(HIGH_LEVEL)
WDFOBJECT
FORCEINLINE
WdfDpcGetParentObject(
_In_
WDFDPC Dpc
)
{
return ((PFN_WDFDPCGETPARENTOBJECT) WdfFunctions[WdfDpcGetParentObjectTableIndex])(WdfDriverGlobals, Dpc);
}
//
// WDF Function: WdfDpcWdmGetDpc
//
typedef
_IRQL_requires_max_(HIGH_LEVEL)
WDFAPI
PKDPC
(*PFN_WDFDPCWDMGETDPC)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDPC Dpc
);
_IRQL_requires_max_(HIGH_LEVEL)
PKDPC
FORCEINLINE
WdfDpcWdmGetDpc(
_In_
WDFDPC Dpc
)
{
return ((PFN_WDFDPCWDMGETDPC) WdfFunctions[WdfDpcWdmGetDpcTableIndex])(WdfDriverGlobals, Dpc);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFDPC_H_

View file

@ -0,0 +1,460 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfdriver.h
Abstract:
This is the interfaces for the Windows Driver Framework Driver 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 _WDFDRIVER_H_
#define _WDFDRIVER_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_DRIVER_INIT_FLAGS {
WdfDriverInitNonPnpDriver = 0x00000001, // If set, no Add Device routine is assigned.
WdfDriverInitNoDispatchOverride = 0x00000002, // Useful for miniports.
WdfVerifyOn = 0x00000004, // Controls whether WDFVERIFY macros are live.
WdfVerifierOn = 0x00000008, // Top level verififer flag.
} WDF_DRIVER_INIT_FLAGS;
#define WDF_TRACE_ID ('TRAC')
//
// Callbacks for FxDriver
//
typedef
_Function_class_(EVT_WDF_DRIVER_DEVICE_ADD)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DRIVER_DEVICE_ADD(
_In_
WDFDRIVER Driver,
_Inout_
PWDFDEVICE_INIT DeviceInit
);
typedef EVT_WDF_DRIVER_DEVICE_ADD *PFN_WDF_DRIVER_DEVICE_ADD;
typedef
_Function_class_(EVT_WDF_DRIVER_UNLOAD)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
EVT_WDF_DRIVER_UNLOAD(
_In_
WDFDRIVER Driver
);
typedef EVT_WDF_DRIVER_UNLOAD *PFN_WDF_DRIVER_UNLOAD;
//
// Used by WPP Tracing (modeled after WPP's WppTraceCallback (in km-init.tpl))
//
typedef
_Function_class_(EVT_WDF_TRACE_CALLBACK)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_TRACE_CALLBACK(
_In_
UCHAR minorFunction,
_In_opt_
PVOID dataPath,
_In_
ULONG bufferLength,
_Inout_updates_bytes_(bufferLength)
PVOID buffer,
_In_
PVOID context,
_Out_
PULONG size
);
typedef EVT_WDF_TRACE_CALLBACK *PFN_WDF_TRACE_CALLBACK;
typedef struct _WDF_DRIVER_CONFIG {
//
// Size of this structure in bytes
//
ULONG Size;
//
// Event callbacks
//
PFN_WDF_DRIVER_DEVICE_ADD EvtDriverDeviceAdd;
PFN_WDF_DRIVER_UNLOAD EvtDriverUnload;
//
// Combination of WDF_DRIVER_INIT_FLAGS values
//
ULONG DriverInitFlags;
//
// Pool tag to use for all allocations made by the framework on behalf of
// the client driver.
//
ULONG DriverPoolTag;
} WDF_DRIVER_CONFIG, *PWDF_DRIVER_CONFIG;
VOID
FORCEINLINE
WDF_DRIVER_CONFIG_INIT(
_Out_ PWDF_DRIVER_CONFIG Config,
_In_opt_ PFN_WDF_DRIVER_DEVICE_ADD EvtDriverDeviceAdd
)
{
RtlZeroMemory(Config, sizeof(WDF_DRIVER_CONFIG));
Config->Size = sizeof(WDF_DRIVER_CONFIG);
Config->EvtDriverDeviceAdd = EvtDriverDeviceAdd;
}
typedef struct _WDF_DRIVER_VERSION_AVAILABLE_PARAMS {
//
// Size of the structure in bytes
//
ULONG Size;
//
// Major Version requested
//
ULONG MajorVersion;
//
// Minor Version requested
//
ULONG MinorVersion;
} WDF_DRIVER_VERSION_AVAILABLE_PARAMS, *PWDF_DRIVER_VERSION_AVAILABLE_PARAMS;
VOID
FORCEINLINE
WDF_DRIVER_VERSION_AVAILABLE_PARAMS_INIT(
_Out_ PWDF_DRIVER_VERSION_AVAILABLE_PARAMS Params,
_In_ ULONG MajorVersion,
_In_ ULONG MinorVersion
)
{
RtlZeroMemory(Params, sizeof(WDF_DRIVER_VERSION_AVAILABLE_PARAMS));
Params->Size = sizeof(WDF_DRIVER_VERSION_AVAILABLE_PARAMS);
Params->MajorVersion = MajorVersion;
Params->MinorVersion = MinorVersion;
}
WDFDRIVER
FORCEINLINE
WdfGetDriver(
VOID
)
{
return WdfDriverGlobals->Driver;
}
//
// WDF Function: WdfDriverCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDRIVERCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PDRIVER_OBJECT DriverObject,
_In_
PCUNICODE_STRING RegistryPath,
_In_opt_
PWDF_OBJECT_ATTRIBUTES DriverAttributes,
_In_
PWDF_DRIVER_CONFIG DriverConfig,
_Out_opt_
WDFDRIVER* Driver
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDriverCreate(
_In_
PDRIVER_OBJECT DriverObject,
_In_
PCUNICODE_STRING RegistryPath,
_In_opt_
PWDF_OBJECT_ATTRIBUTES DriverAttributes,
_In_
PWDF_DRIVER_CONFIG DriverConfig,
_Out_opt_
WDFDRIVER* Driver
)
{
return ((PFN_WDFDRIVERCREATE) WdfFunctions[WdfDriverCreateTableIndex])(WdfDriverGlobals, DriverObject, RegistryPath, DriverAttributes, DriverConfig, Driver);
}
//
// WDF Function: WdfDriverGetRegistryPath
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
PWSTR
(*PFN_WDFDRIVERGETREGISTRYPATH)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDRIVER Driver
);
_IRQL_requires_max_(PASSIVE_LEVEL)
PWSTR
FORCEINLINE
WdfDriverGetRegistryPath(
_In_
WDFDRIVER Driver
)
{
return ((PFN_WDFDRIVERGETREGISTRYPATH) WdfFunctions[WdfDriverGetRegistryPathTableIndex])(WdfDriverGlobals, Driver);
}
//
// WDF Function: WdfDriverWdmGetDriverObject
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PDRIVER_OBJECT
(*PFN_WDFDRIVERWDMGETDRIVEROBJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDRIVER Driver
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PDRIVER_OBJECT
FORCEINLINE
WdfDriverWdmGetDriverObject(
_In_
WDFDRIVER Driver
)
{
return ((PFN_WDFDRIVERWDMGETDRIVEROBJECT) WdfFunctions[WdfDriverWdmGetDriverObjectTableIndex])(WdfDriverGlobals, Driver);
}
//
// WDF Function: WdfDriverOpenParametersRegistryKey
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDRIVEROPENPARAMETERSREGISTRYKEY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDRIVER Driver,
_In_
ACCESS_MASK DesiredAccess,
_In_opt_
PWDF_OBJECT_ATTRIBUTES KeyAttributes,
_Out_
WDFKEY* Key
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDriverOpenParametersRegistryKey(
_In_
WDFDRIVER Driver,
_In_
ACCESS_MASK DesiredAccess,
_In_opt_
PWDF_OBJECT_ATTRIBUTES KeyAttributes,
_Out_
WDFKEY* Key
)
{
return ((PFN_WDFDRIVEROPENPARAMETERSREGISTRYKEY) WdfFunctions[WdfDriverOpenParametersRegistryKeyTableIndex])(WdfDriverGlobals, Driver, DesiredAccess, KeyAttributes, Key);
}
//
// WDF Function: WdfWdmDriverGetWdfDriverHandle
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFDRIVER
(*PFN_WDFWDMDRIVERGETWDFDRIVERHANDLE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PDRIVER_OBJECT DriverObject
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFDRIVER
FORCEINLINE
WdfWdmDriverGetWdfDriverHandle(
_In_
PDRIVER_OBJECT DriverObject
)
{
return ((PFN_WDFWDMDRIVERGETWDFDRIVERHANDLE) WdfFunctions[WdfWdmDriverGetWdfDriverHandleTableIndex])(WdfDriverGlobals, DriverObject);
}
//
// WDF Function: WdfDriverRegisterTraceInfo
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDRIVERREGISTERTRACEINFO)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PDRIVER_OBJECT DriverObject,
_In_
PFN_WDF_TRACE_CALLBACK EvtTraceCallback,
_In_
PVOID ControlBlock
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDriverRegisterTraceInfo(
_In_
PDRIVER_OBJECT DriverObject,
_In_
PFN_WDF_TRACE_CALLBACK EvtTraceCallback,
_In_
PVOID ControlBlock
)
{
return ((PFN_WDFDRIVERREGISTERTRACEINFO) WdfFunctions[WdfDriverRegisterTraceInfoTableIndex])(WdfDriverGlobals, DriverObject, EvtTraceCallback, ControlBlock);
}
//
// WDF Function: WdfDriverRetrieveVersionString
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDRIVERRETRIEVEVERSIONSTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDRIVER Driver,
_In_
WDFSTRING String
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDriverRetrieveVersionString(
_In_
WDFDRIVER Driver,
_In_
WDFSTRING String
)
{
return ((PFN_WDFDRIVERRETRIEVEVERSIONSTRING) WdfFunctions[WdfDriverRetrieveVersionStringTableIndex])(WdfDriverGlobals, Driver, String);
}
//
// WDF Function: WdfDriverIsVersionAvailable
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFDRIVERISVERSIONAVAILABLE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDRIVER Driver,
_In_
PWDF_DRIVER_VERSION_AVAILABLE_PARAMS VersionAvailableParams
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
BOOLEAN
FORCEINLINE
WdfDriverIsVersionAvailable(
_In_
WDFDRIVER Driver,
_In_
PWDF_DRIVER_VERSION_AVAILABLE_PARAMS VersionAvailableParams
)
{
return ((PFN_WDFDRIVERISVERSIONAVAILABLE) WdfFunctions[WdfDriverIsVersionAvailableTableIndex])(WdfDriverGlobals, Driver, VersionAvailableParams);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFDRIVER_H_

View file

@ -0,0 +1,643 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfFdo.h
Abstract:
This is the interface to the FDO functionality in the framework. This also
covers filters.
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 _WDFFDO_H_
#define _WDFFDO_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_FILTER_RESOURCE_REQUIREMENTS)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS(
_In_
WDFDEVICE Device,
_In_
WDFIORESREQLIST IoResourceRequirementsList
);
typedef EVT_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS *PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS;
typedef
_Function_class_(EVT_WDF_DEVICE_REMOVE_ADDED_RESOURCES)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_REMOVE_ADDED_RESOURCES(
_In_
WDFDEVICE Device,
_In_
WDFCMRESLIST ResourcesRaw,
_In_
WDFCMRESLIST ResourcesTranslated
);
typedef EVT_WDF_DEVICE_REMOVE_ADDED_RESOURCES *PFN_WDF_DEVICE_REMOVE_ADDED_RESOURCES;
typedef struct _WDF_FDO_EVENT_CALLBACKS {
//
// Size of this structure in bytes
//
ULONG Size;
PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS EvtDeviceFilterAddResourceRequirements;
PFN_WDF_DEVICE_FILTER_RESOURCE_REQUIREMENTS EvtDeviceFilterRemoveResourceRequirements;
PFN_WDF_DEVICE_REMOVE_ADDED_RESOURCES EvtDeviceRemoveAddedResources;
} WDF_FDO_EVENT_CALLBACKS, *PWDF_FDO_EVENT_CALLBACKS;
VOID
FORCEINLINE
WDF_FDO_EVENT_CALLBACKS_INIT(
_Out_ PWDF_FDO_EVENT_CALLBACKS Callbacks
)
{
RtlZeroMemory(Callbacks, sizeof(WDF_FDO_EVENT_CALLBACKS));
Callbacks->Size = sizeof(WDF_FDO_EVENT_CALLBACKS);
}
//
// WDF Function: WdfFdoInitWdmGetPhysicalDevice
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PDEVICE_OBJECT
(*PFN_WDFFDOINITWDMGETPHYSICALDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PDEVICE_OBJECT
FORCEINLINE
WdfFdoInitWdmGetPhysicalDevice(
_In_
PWDFDEVICE_INIT DeviceInit
)
{
return ((PFN_WDFFDOINITWDMGETPHYSICALDEVICE) WdfFunctions[WdfFdoInitWdmGetPhysicalDeviceTableIndex])(WdfDriverGlobals, DeviceInit);
}
//
// WDF Function: WdfFdoInitOpenRegistryKey
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFFDOINITOPENREGISTRYKEY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_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
WdfFdoInitOpenRegistryKey(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
ULONG DeviceInstanceKeyType,
_In_
ACCESS_MASK DesiredAccess,
_In_opt_
PWDF_OBJECT_ATTRIBUTES KeyAttributes,
_Out_
WDFKEY* Key
)
{
return ((PFN_WDFFDOINITOPENREGISTRYKEY) WdfFunctions[WdfFdoInitOpenRegistryKeyTableIndex])(WdfDriverGlobals, DeviceInit, DeviceInstanceKeyType, DesiredAccess, KeyAttributes, Key);
}
//
// WDF Function: WdfFdoInitQueryProperty
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFFDOINITQUERYPROPERTY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
DEVICE_REGISTRY_PROPERTY DeviceProperty,
_In_
ULONG BufferLength,
_Out_writes_bytes_all_opt_(BufferLength)
PVOID PropertyBuffer,
_Out_
PULONG ResultLength
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfFdoInitQueryProperty(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
DEVICE_REGISTRY_PROPERTY DeviceProperty,
_In_
ULONG BufferLength,
_Out_writes_bytes_all_opt_(BufferLength)
PVOID PropertyBuffer,
_Out_
PULONG ResultLength
)
{
return ((PFN_WDFFDOINITQUERYPROPERTY) WdfFunctions[WdfFdoInitQueryPropertyTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, BufferLength, PropertyBuffer, ResultLength);
}
//
// WDF Function: WdfFdoInitAllocAndQueryProperty
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFFDOINITALLOCANDQUERYPROPERTY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
DEVICE_REGISTRY_PROPERTY DeviceProperty,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
_Out_
WDFMEMORY* PropertyMemory
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfFdoInitAllocAndQueryProperty(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
DEVICE_REGISTRY_PROPERTY DeviceProperty,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
_Out_
WDFMEMORY* PropertyMemory
)
{
return ((PFN_WDFFDOINITALLOCANDQUERYPROPERTY) WdfFunctions[WdfFdoInitAllocAndQueryPropertyTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, PoolType, PropertyMemoryAttributes, PropertyMemory);
}
//
// WDF Function: WdfFdoInitQueryPropertyEx
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFFDOINITQUERYPROPERTYEX)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
_In_
ULONG BufferLength,
_Out_
PVOID PropertyBuffer,
_Out_
PULONG ResultLength,
_Out_
PDEVPROPTYPE Type
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfFdoInitQueryPropertyEx(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
_In_
ULONG BufferLength,
_Out_
PVOID PropertyBuffer,
_Out_
PULONG ResultLength,
_Out_
PDEVPROPTYPE Type
)
{
return ((PFN_WDFFDOINITQUERYPROPERTYEX) WdfFunctions[WdfFdoInitQueryPropertyExTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, BufferLength, PropertyBuffer, ResultLength, Type);
}
//
// WDF Function: WdfFdoInitAllocAndQueryPropertyEx
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFFDOINITALLOCANDQUERYPROPERTYEX)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
_Out_
WDFMEMORY* PropertyMemory,
_Out_
PDEVPROPTYPE Type
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfFdoInitAllocAndQueryPropertyEx(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_DEVICE_PROPERTY_DATA DeviceProperty,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes,
_Out_
WDFMEMORY* PropertyMemory,
_Out_
PDEVPROPTYPE Type
)
{
return ((PFN_WDFFDOINITALLOCANDQUERYPROPERTYEX) WdfFunctions[WdfFdoInitAllocAndQueryPropertyExTableIndex])(WdfDriverGlobals, DeviceInit, DeviceProperty, PoolType, PropertyMemoryAttributes, PropertyMemory, Type);
}
//
// WDF Function: WdfFdoInitSetEventCallbacks
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFFDOINITSETEVENTCALLBACKS)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_FDO_EVENT_CALLBACKS FdoEventCallbacks
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfFdoInitSetEventCallbacks(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_FDO_EVENT_CALLBACKS FdoEventCallbacks
)
{
((PFN_WDFFDOINITSETEVENTCALLBACKS) WdfFunctions[WdfFdoInitSetEventCallbacksTableIndex])(WdfDriverGlobals, DeviceInit, FdoEventCallbacks);
}
//
// WDF Function: WdfFdoInitSetFilter
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFFDOINITSETFILTER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfFdoInitSetFilter(
_In_
PWDFDEVICE_INIT DeviceInit
)
{
((PFN_WDFFDOINITSETFILTER) WdfFunctions[WdfFdoInitSetFilterTableIndex])(WdfDriverGlobals, DeviceInit);
}
//
// WDF Function: WdfFdoInitSetDefaultChildListConfig
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFFDOINITSETDEFAULTCHILDLISTCONFIG)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_Inout_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_CHILD_LIST_CONFIG Config,
_In_opt_
PWDF_OBJECT_ATTRIBUTES DefaultChildListAttributes
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfFdoInitSetDefaultChildListConfig(
_Inout_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_CHILD_LIST_CONFIG Config,
_In_opt_
PWDF_OBJECT_ATTRIBUTES DefaultChildListAttributes
)
{
((PFN_WDFFDOINITSETDEFAULTCHILDLISTCONFIG) WdfFunctions[WdfFdoInitSetDefaultChildListConfigTableIndex])(WdfDriverGlobals, DeviceInit, Config, DefaultChildListAttributes);
}
//
// WDF Function: WdfFdoQueryForInterface
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFFDOQUERYFORINTERFACE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Fdo,
_In_
LPCGUID InterfaceType,
_Out_
PINTERFACE Interface,
_In_
USHORT Size,
_In_
USHORT Version,
_In_opt_
PVOID InterfaceSpecificData
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfFdoQueryForInterface(
_In_
WDFDEVICE Fdo,
_In_
LPCGUID InterfaceType,
_Out_
PINTERFACE Interface,
_In_
USHORT Size,
_In_
USHORT Version,
_In_opt_
PVOID InterfaceSpecificData
)
{
return ((PFN_WDFFDOQUERYFORINTERFACE) WdfFunctions[WdfFdoQueryForInterfaceTableIndex])(WdfDriverGlobals, Fdo, InterfaceType, Interface, Size, Version, InterfaceSpecificData);
}
//
// WDF Function: WdfFdoGetDefaultChildList
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFCHILDLIST
(*PFN_WDFFDOGETDEFAULTCHILDLIST)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Fdo
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFCHILDLIST
FORCEINLINE
WdfFdoGetDefaultChildList(
_In_
WDFDEVICE Fdo
)
{
return ((PFN_WDFFDOGETDEFAULTCHILDLIST) WdfFunctions[WdfFdoGetDefaultChildListTableIndex])(WdfDriverGlobals, Fdo);
}
//
// WDF Function: WdfFdoAddStaticChild
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFFDOADDSTATICCHILD)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Fdo,
_In_
WDFDEVICE Child
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfFdoAddStaticChild(
_In_
WDFDEVICE Fdo,
_In_
WDFDEVICE Child
)
{
return ((PFN_WDFFDOADDSTATICCHILD) WdfFunctions[WdfFdoAddStaticChildTableIndex])(WdfDriverGlobals, Fdo, Child);
}
//
// WDF Function: WdfFdoLockStaticChildListForIteration
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFFDOLOCKSTATICCHILDLISTFORITERATION)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Fdo
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfFdoLockStaticChildListForIteration(
_In_
WDFDEVICE Fdo
)
{
((PFN_WDFFDOLOCKSTATICCHILDLISTFORITERATION) WdfFunctions[WdfFdoLockStaticChildListForIterationTableIndex])(WdfDriverGlobals, Fdo);
}
//
// WDF Function: WdfFdoRetrieveNextStaticChild
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFDEVICE
(*PFN_WDFFDORETRIEVENEXTSTATICCHILD)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Fdo,
_In_opt_
WDFDEVICE PreviousChild,
_In_
ULONG Flags
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFDEVICE
FORCEINLINE
WdfFdoRetrieveNextStaticChild(
_In_
WDFDEVICE Fdo,
_In_opt_
WDFDEVICE PreviousChild,
_In_
ULONG Flags
)
{
return ((PFN_WDFFDORETRIEVENEXTSTATICCHILD) WdfFunctions[WdfFdoRetrieveNextStaticChildTableIndex])(WdfDriverGlobals, Fdo, PreviousChild, Flags);
}
//
// WDF Function: WdfFdoUnlockStaticChildListFromIteration
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFFDOUNLOCKSTATICCHILDLISTFROMITERATION)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Fdo
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfFdoUnlockStaticChildListFromIteration(
_In_
WDFDEVICE Fdo
)
{
((PFN_WDFFDOUNLOCKSTATICCHILDLISTFROMITERATION) WdfFunctions[WdfFdoUnlockStaticChildListFromIterationTableIndex])(WdfDriverGlobals, Fdo);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFFDO_H_

View file

@ -0,0 +1,166 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdffileobject.h
Abstract:
This header containts the Windows Driver Framework file object
DDIs.
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 _WDFFILEOBJECT_H_
#define _WDFFILEOBJECT_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: WdfFileObjectGetFileName
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
PUNICODE_STRING
(*PFN_WDFFILEOBJECTGETFILENAME)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFFILEOBJECT FileObject
);
_IRQL_requires_max_(PASSIVE_LEVEL)
PUNICODE_STRING
FORCEINLINE
WdfFileObjectGetFileName(
_In_
WDFFILEOBJECT FileObject
)
{
return ((PFN_WDFFILEOBJECTGETFILENAME) WdfFunctions[WdfFileObjectGetFileNameTableIndex])(WdfDriverGlobals, FileObject);
}
//
// WDF Function: WdfFileObjectGetFlags
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
ULONG
(*PFN_WDFFILEOBJECTGETFLAGS)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFFILEOBJECT FileObject
);
_IRQL_requires_max_(DISPATCH_LEVEL)
ULONG
FORCEINLINE
WdfFileObjectGetFlags(
_In_
WDFFILEOBJECT FileObject
)
{
return ((PFN_WDFFILEOBJECTGETFLAGS) WdfFunctions[WdfFileObjectGetFlagsTableIndex])(WdfDriverGlobals, FileObject);
}
//
// WDF Function: WdfFileObjectGetDevice
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFDEVICE
(*PFN_WDFFILEOBJECTGETDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFFILEOBJECT FileObject
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFDEVICE
FORCEINLINE
WdfFileObjectGetDevice(
_In_
WDFFILEOBJECT FileObject
)
{
return ((PFN_WDFFILEOBJECTGETDEVICE) WdfFunctions[WdfFileObjectGetDeviceTableIndex])(WdfDriverGlobals, FileObject);
}
//
// WDF Function: WdfFileObjectWdmGetFileObject
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PFILE_OBJECT
(*PFN_WDFFILEOBJECTWDMGETFILEOBJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFFILEOBJECT FileObject
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PFILE_OBJECT
FORCEINLINE
WdfFileObjectWdmGetFileObject(
_In_
WDFFILEOBJECT FileObject
)
{
return ((PFN_WDFFILEOBJECTWDMGETFILEOBJECT) WdfFunctions[WdfFileObjectWdmGetFileObjectTableIndex])(WdfDriverGlobals, FileObject);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFFILEOBJECT_H_

View file

@ -0,0 +1,473 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name: WdfFuncEnum.h
Abstract:
Generated an enum of all WDF API functions
Environment:
kernel mode only
Warning: manual changes to this file will be lost.
--*/
#ifndef _WDFFUNCENUM_H_
#define _WDFFUNCENUM_H_
extern PWDF_DRIVER_GLOBALS WdfDriverGlobals;
typedef enum _WDFFUNCENUM {
WdfChildListCreateTableIndex = 0,
WdfChildListGetDeviceTableIndex = 1,
WdfChildListRetrievePdoTableIndex = 2,
WdfChildListRetrieveAddressDescriptionTableIndex = 3,
WdfChildListBeginScanTableIndex = 4,
WdfChildListEndScanTableIndex = 5,
WdfChildListBeginIterationTableIndex = 6,
WdfChildListRetrieveNextDeviceTableIndex = 7,
WdfChildListEndIterationTableIndex = 8,
WdfChildListAddOrUpdateChildDescriptionAsPresentTableIndex = 9,
WdfChildListUpdateChildDescriptionAsMissingTableIndex = 10,
WdfChildListUpdateAllChildDescriptionsAsPresentTableIndex = 11,
WdfChildListRequestChildEjectTableIndex = 12,
WdfCollectionCreateTableIndex = 13,
WdfCollectionGetCountTableIndex = 14,
WdfCollectionAddTableIndex = 15,
WdfCollectionRemoveTableIndex = 16,
WdfCollectionRemoveItemTableIndex = 17,
WdfCollectionGetItemTableIndex = 18,
WdfCollectionGetFirstItemTableIndex = 19,
WdfCollectionGetLastItemTableIndex = 20,
WdfCommonBufferCreateTableIndex = 21,
WdfCommonBufferGetAlignedVirtualAddressTableIndex = 22,
WdfCommonBufferGetAlignedLogicalAddressTableIndex = 23,
WdfCommonBufferGetLengthTableIndex = 24,
WdfControlDeviceInitAllocateTableIndex = 25,
WdfControlDeviceInitSetShutdownNotificationTableIndex = 26,
WdfControlFinishInitializingTableIndex = 27,
WdfDeviceGetDeviceStateTableIndex = 28,
WdfDeviceSetDeviceStateTableIndex = 29,
WdfWdmDeviceGetWdfDeviceHandleTableIndex = 30,
WdfDeviceWdmGetDeviceObjectTableIndex = 31,
WdfDeviceWdmGetAttachedDeviceTableIndex = 32,
WdfDeviceWdmGetPhysicalDeviceTableIndex = 33,
WdfDeviceWdmDispatchPreprocessedIrpTableIndex = 34,
WdfDeviceAddDependentUsageDeviceObjectTableIndex = 35,
WdfDeviceAddRemovalRelationsPhysicalDeviceTableIndex = 36,
WdfDeviceRemoveRemovalRelationsPhysicalDeviceTableIndex = 37,
WdfDeviceClearRemovalRelationsDevicesTableIndex = 38,
WdfDeviceGetDriverTableIndex = 39,
WdfDeviceRetrieveDeviceNameTableIndex = 40,
WdfDeviceAssignMofResourceNameTableIndex = 41,
WdfDeviceGetIoTargetTableIndex = 42,
WdfDeviceGetDevicePnpStateTableIndex = 43,
WdfDeviceGetDevicePowerStateTableIndex = 44,
WdfDeviceGetDevicePowerPolicyStateTableIndex = 45,
WdfDeviceAssignS0IdleSettingsTableIndex = 46,
WdfDeviceAssignSxWakeSettingsTableIndex = 47,
WdfDeviceOpenRegistryKeyTableIndex = 48,
WdfDeviceSetSpecialFileSupportTableIndex = 49,
WdfDeviceSetCharacteristicsTableIndex = 50,
WdfDeviceGetCharacteristicsTableIndex = 51,
WdfDeviceGetAlignmentRequirementTableIndex = 52,
WdfDeviceSetAlignmentRequirementTableIndex = 53,
WdfDeviceInitFreeTableIndex = 54,
WdfDeviceInitSetPnpPowerEventCallbacksTableIndex = 55,
WdfDeviceInitSetPowerPolicyEventCallbacksTableIndex = 56,
WdfDeviceInitSetPowerPolicyOwnershipTableIndex = 57,
WdfDeviceInitRegisterPnpStateChangeCallbackTableIndex = 58,
WdfDeviceInitRegisterPowerStateChangeCallbackTableIndex = 59,
WdfDeviceInitRegisterPowerPolicyStateChangeCallbackTableIndex = 60,
WdfDeviceInitSetIoTypeTableIndex = 61,
WdfDeviceInitSetExclusiveTableIndex = 62,
WdfDeviceInitSetPowerNotPageableTableIndex = 63,
WdfDeviceInitSetPowerPageableTableIndex = 64,
WdfDeviceInitSetPowerInrushTableIndex = 65,
WdfDeviceInitSetDeviceTypeTableIndex = 66,
WdfDeviceInitAssignNameTableIndex = 67,
WdfDeviceInitAssignSDDLStringTableIndex = 68,
WdfDeviceInitSetDeviceClassTableIndex = 69,
WdfDeviceInitSetCharacteristicsTableIndex = 70,
WdfDeviceInitSetFileObjectConfigTableIndex = 71,
WdfDeviceInitSetRequestAttributesTableIndex = 72,
WdfDeviceInitAssignWdmIrpPreprocessCallbackTableIndex = 73,
WdfDeviceInitSetIoInCallerContextCallbackTableIndex = 74,
WdfDeviceCreateTableIndex = 75,
WdfDeviceSetStaticStopRemoveTableIndex = 76,
WdfDeviceCreateDeviceInterfaceTableIndex = 77,
WdfDeviceSetDeviceInterfaceStateTableIndex = 78,
WdfDeviceRetrieveDeviceInterfaceStringTableIndex = 79,
WdfDeviceCreateSymbolicLinkTableIndex = 80,
WdfDeviceQueryPropertyTableIndex = 81,
WdfDeviceAllocAndQueryPropertyTableIndex = 82,
WdfDeviceSetPnpCapabilitiesTableIndex = 83,
WdfDeviceSetPowerCapabilitiesTableIndex = 84,
WdfDeviceSetBusInformationForChildrenTableIndex = 85,
WdfDeviceIndicateWakeStatusTableIndex = 86,
WdfDeviceSetFailedTableIndex = 87,
WdfDeviceStopIdleNoTrackTableIndex = 88,
WdfDeviceResumeIdleNoTrackTableIndex = 89,
WdfDeviceGetFileObjectTableIndex = 90,
WdfDeviceEnqueueRequestTableIndex = 91,
WdfDeviceGetDefaultQueueTableIndex = 92,
WdfDeviceConfigureRequestDispatchingTableIndex = 93,
WdfDmaEnablerCreateTableIndex = 94,
WdfDmaEnablerGetMaximumLengthTableIndex = 95,
WdfDmaEnablerGetMaximumScatterGatherElementsTableIndex = 96,
WdfDmaEnablerSetMaximumScatterGatherElementsTableIndex = 97,
WdfDmaTransactionCreateTableIndex = 98,
WdfDmaTransactionInitializeTableIndex = 99,
WdfDmaTransactionInitializeUsingRequestTableIndex = 100,
WdfDmaTransactionExecuteTableIndex = 101,
WdfDmaTransactionReleaseTableIndex = 102,
WdfDmaTransactionDmaCompletedTableIndex = 103,
WdfDmaTransactionDmaCompletedWithLengthTableIndex = 104,
WdfDmaTransactionDmaCompletedFinalTableIndex = 105,
WdfDmaTransactionGetBytesTransferredTableIndex = 106,
WdfDmaTransactionSetMaximumLengthTableIndex = 107,
WdfDmaTransactionGetRequestTableIndex = 108,
WdfDmaTransactionGetCurrentDmaTransferLengthTableIndex = 109,
WdfDmaTransactionGetDeviceTableIndex = 110,
WdfDpcCreateTableIndex = 111,
WdfDpcEnqueueTableIndex = 112,
WdfDpcCancelTableIndex = 113,
WdfDpcGetParentObjectTableIndex = 114,
WdfDpcWdmGetDpcTableIndex = 115,
WdfDriverCreateTableIndex = 116,
WdfDriverGetRegistryPathTableIndex = 117,
WdfDriverWdmGetDriverObjectTableIndex = 118,
WdfDriverOpenParametersRegistryKeyTableIndex = 119,
WdfWdmDriverGetWdfDriverHandleTableIndex = 120,
WdfDriverRegisterTraceInfoTableIndex = 121,
WdfDriverRetrieveVersionStringTableIndex = 122,
WdfDriverIsVersionAvailableTableIndex = 123,
WdfFdoInitWdmGetPhysicalDeviceTableIndex = 124,
WdfFdoInitOpenRegistryKeyTableIndex = 125,
WdfFdoInitQueryPropertyTableIndex = 126,
WdfFdoInitAllocAndQueryPropertyTableIndex = 127,
WdfFdoInitSetEventCallbacksTableIndex = 128,
WdfFdoInitSetFilterTableIndex = 129,
WdfFdoInitSetDefaultChildListConfigTableIndex = 130,
WdfFdoQueryForInterfaceTableIndex = 131,
WdfFdoGetDefaultChildListTableIndex = 132,
WdfFdoAddStaticChildTableIndex = 133,
WdfFdoLockStaticChildListForIterationTableIndex = 134,
WdfFdoRetrieveNextStaticChildTableIndex = 135,
WdfFdoUnlockStaticChildListFromIterationTableIndex = 136,
WdfFileObjectGetFileNameTableIndex = 137,
WdfFileObjectGetFlagsTableIndex = 138,
WdfFileObjectGetDeviceTableIndex = 139,
WdfFileObjectWdmGetFileObjectTableIndex = 140,
WdfInterruptCreateTableIndex = 141,
WdfInterruptQueueDpcForIsrTableIndex = 142,
WdfInterruptSynchronizeTableIndex = 143,
WdfInterruptAcquireLockTableIndex = 144,
WdfInterruptReleaseLockTableIndex = 145,
WdfInterruptEnableTableIndex = 146,
WdfInterruptDisableTableIndex = 147,
WdfInterruptWdmGetInterruptTableIndex = 148,
WdfInterruptGetInfoTableIndex = 149,
WdfInterruptSetPolicyTableIndex = 150,
WdfInterruptGetDeviceTableIndex = 151,
WdfIoQueueCreateTableIndex = 152,
WdfIoQueueGetStateTableIndex = 153,
WdfIoQueueStartTableIndex = 154,
WdfIoQueueStopTableIndex = 155,
WdfIoQueueStopSynchronouslyTableIndex = 156,
WdfIoQueueGetDeviceTableIndex = 157,
WdfIoQueueRetrieveNextRequestTableIndex = 158,
WdfIoQueueRetrieveRequestByFileObjectTableIndex = 159,
WdfIoQueueFindRequestTableIndex = 160,
WdfIoQueueRetrieveFoundRequestTableIndex = 161,
WdfIoQueueDrainSynchronouslyTableIndex = 162,
WdfIoQueueDrainTableIndex = 163,
WdfIoQueuePurgeSynchronouslyTableIndex = 164,
WdfIoQueuePurgeTableIndex = 165,
WdfIoQueueReadyNotifyTableIndex = 166,
WdfIoTargetCreateTableIndex = 167,
WdfIoTargetOpenTableIndex = 168,
WdfIoTargetCloseForQueryRemoveTableIndex = 169,
WdfIoTargetCloseTableIndex = 170,
WdfIoTargetStartTableIndex = 171,
WdfIoTargetStopTableIndex = 172,
WdfIoTargetGetStateTableIndex = 173,
WdfIoTargetGetDeviceTableIndex = 174,
WdfIoTargetQueryTargetPropertyTableIndex = 175,
WdfIoTargetAllocAndQueryTargetPropertyTableIndex = 176,
WdfIoTargetQueryForInterfaceTableIndex = 177,
WdfIoTargetWdmGetTargetDeviceObjectTableIndex = 178,
WdfIoTargetWdmGetTargetPhysicalDeviceTableIndex = 179,
WdfIoTargetWdmGetTargetFileObjectTableIndex = 180,
WdfIoTargetWdmGetTargetFileHandleTableIndex = 181,
WdfIoTargetSendReadSynchronouslyTableIndex = 182,
WdfIoTargetFormatRequestForReadTableIndex = 183,
WdfIoTargetSendWriteSynchronouslyTableIndex = 184,
WdfIoTargetFormatRequestForWriteTableIndex = 185,
WdfIoTargetSendIoctlSynchronouslyTableIndex = 186,
WdfIoTargetFormatRequestForIoctlTableIndex = 187,
WdfIoTargetSendInternalIoctlSynchronouslyTableIndex = 188,
WdfIoTargetFormatRequestForInternalIoctlTableIndex = 189,
WdfIoTargetSendInternalIoctlOthersSynchronouslyTableIndex = 190,
WdfIoTargetFormatRequestForInternalIoctlOthersTableIndex = 191,
WdfMemoryCreateTableIndex = 192,
WdfMemoryCreatePreallocatedTableIndex = 193,
WdfMemoryGetBufferTableIndex = 194,
WdfMemoryAssignBufferTableIndex = 195,
WdfMemoryCopyToBufferTableIndex = 196,
WdfMemoryCopyFromBufferTableIndex = 197,
WdfLookasideListCreateTableIndex = 198,
WdfMemoryCreateFromLookasideTableIndex = 199,
WdfDeviceMiniportCreateTableIndex = 200,
WdfDriverMiniportUnloadTableIndex = 201,
WdfObjectGetTypedContextWorkerTableIndex = 202,
WdfObjectAllocateContextTableIndex = 203,
WdfObjectContextGetObjectTableIndex = 204,
WdfObjectReferenceActualTableIndex = 205,
WdfObjectDereferenceActualTableIndex = 206,
WdfObjectCreateTableIndex = 207,
WdfObjectDeleteTableIndex = 208,
WdfObjectQueryTableIndex = 209,
WdfPdoInitAllocateTableIndex = 210,
WdfPdoInitSetEventCallbacksTableIndex = 211,
WdfPdoInitAssignDeviceIDTableIndex = 212,
WdfPdoInitAssignInstanceIDTableIndex = 213,
WdfPdoInitAddHardwareIDTableIndex = 214,
WdfPdoInitAddCompatibleIDTableIndex = 215,
WdfPdoInitAddDeviceTextTableIndex = 216,
WdfPdoInitSetDefaultLocaleTableIndex = 217,
WdfPdoInitAssignRawDeviceTableIndex = 218,
WdfPdoMarkMissingTableIndex = 219,
WdfPdoRequestEjectTableIndex = 220,
WdfPdoGetParentTableIndex = 221,
WdfPdoRetrieveIdentificationDescriptionTableIndex = 222,
WdfPdoRetrieveAddressDescriptionTableIndex = 223,
WdfPdoUpdateAddressDescriptionTableIndex = 224,
WdfPdoAddEjectionRelationsPhysicalDeviceTableIndex = 225,
WdfPdoRemoveEjectionRelationsPhysicalDeviceTableIndex = 226,
WdfPdoClearEjectionRelationsDevicesTableIndex = 227,
WdfDeviceAddQueryInterfaceTableIndex = 228,
WdfRegistryOpenKeyTableIndex = 229,
WdfRegistryCreateKeyTableIndex = 230,
WdfRegistryCloseTableIndex = 231,
WdfRegistryWdmGetHandleTableIndex = 232,
WdfRegistryRemoveKeyTableIndex = 233,
WdfRegistryRemoveValueTableIndex = 234,
WdfRegistryQueryValueTableIndex = 235,
WdfRegistryQueryMemoryTableIndex = 236,
WdfRegistryQueryMultiStringTableIndex = 237,
WdfRegistryQueryUnicodeStringTableIndex = 238,
WdfRegistryQueryStringTableIndex = 239,
WdfRegistryQueryULongTableIndex = 240,
WdfRegistryAssignValueTableIndex = 241,
WdfRegistryAssignMemoryTableIndex = 242,
WdfRegistryAssignMultiStringTableIndex = 243,
WdfRegistryAssignUnicodeStringTableIndex = 244,
WdfRegistryAssignStringTableIndex = 245,
WdfRegistryAssignULongTableIndex = 246,
WdfRequestCreateTableIndex = 247,
WdfRequestCreateFromIrpTableIndex = 248,
WdfRequestReuseTableIndex = 249,
WdfRequestChangeTargetTableIndex = 250,
WdfRequestFormatRequestUsingCurrentTypeTableIndex = 251,
WdfRequestWdmFormatUsingStackLocationTableIndex = 252,
WdfRequestSendTableIndex = 253,
WdfRequestGetStatusTableIndex = 254,
WdfRequestMarkCancelableTableIndex = 255,
WdfRequestUnmarkCancelableTableIndex = 256,
WdfRequestIsCanceledTableIndex = 257,
WdfRequestCancelSentRequestTableIndex = 258,
WdfRequestIsFrom32BitProcessTableIndex = 259,
WdfRequestSetCompletionRoutineTableIndex = 260,
WdfRequestGetCompletionParamsTableIndex = 261,
WdfRequestAllocateTimerTableIndex = 262,
WdfRequestCompleteTableIndex = 263,
WdfRequestCompleteWithPriorityBoostTableIndex = 264,
WdfRequestCompleteWithInformationTableIndex = 265,
WdfRequestGetParametersTableIndex = 266,
WdfRequestRetrieveInputMemoryTableIndex = 267,
WdfRequestRetrieveOutputMemoryTableIndex = 268,
WdfRequestRetrieveInputBufferTableIndex = 269,
WdfRequestRetrieveOutputBufferTableIndex = 270,
WdfRequestRetrieveInputWdmMdlTableIndex = 271,
WdfRequestRetrieveOutputWdmMdlTableIndex = 272,
WdfRequestRetrieveUnsafeUserInputBufferTableIndex = 273,
WdfRequestRetrieveUnsafeUserOutputBufferTableIndex = 274,
WdfRequestSetInformationTableIndex = 275,
WdfRequestGetInformationTableIndex = 276,
WdfRequestGetFileObjectTableIndex = 277,
WdfRequestProbeAndLockUserBufferForReadTableIndex = 278,
WdfRequestProbeAndLockUserBufferForWriteTableIndex = 279,
WdfRequestGetRequestorModeTableIndex = 280,
WdfRequestForwardToIoQueueTableIndex = 281,
WdfRequestGetIoQueueTableIndex = 282,
WdfRequestRequeueTableIndex = 283,
WdfRequestStopAcknowledgeTableIndex = 284,
WdfRequestWdmGetIrpTableIndex = 285,
WdfIoResourceRequirementsListSetSlotNumberTableIndex = 286,
WdfIoResourceRequirementsListSetInterfaceTypeTableIndex = 287,
WdfIoResourceRequirementsListAppendIoResListTableIndex = 288,
WdfIoResourceRequirementsListInsertIoResListTableIndex = 289,
WdfIoResourceRequirementsListGetCountTableIndex = 290,
WdfIoResourceRequirementsListGetIoResListTableIndex = 291,
WdfIoResourceRequirementsListRemoveTableIndex = 292,
WdfIoResourceRequirementsListRemoveByIoResListTableIndex = 293,
WdfIoResourceListCreateTableIndex = 294,
WdfIoResourceListAppendDescriptorTableIndex = 295,
WdfIoResourceListInsertDescriptorTableIndex = 296,
WdfIoResourceListUpdateDescriptorTableIndex = 297,
WdfIoResourceListGetCountTableIndex = 298,
WdfIoResourceListGetDescriptorTableIndex = 299,
WdfIoResourceListRemoveTableIndex = 300,
WdfIoResourceListRemoveByDescriptorTableIndex = 301,
WdfCmResourceListAppendDescriptorTableIndex = 302,
WdfCmResourceListInsertDescriptorTableIndex = 303,
WdfCmResourceListGetCountTableIndex = 304,
WdfCmResourceListGetDescriptorTableIndex = 305,
WdfCmResourceListRemoveTableIndex = 306,
WdfCmResourceListRemoveByDescriptorTableIndex = 307,
WdfStringCreateTableIndex = 308,
WdfStringGetUnicodeStringTableIndex = 309,
WdfObjectAcquireLockTableIndex = 310,
WdfObjectReleaseLockTableIndex = 311,
WdfWaitLockCreateTableIndex = 312,
WdfWaitLockAcquireTableIndex = 313,
WdfWaitLockReleaseTableIndex = 314,
WdfSpinLockCreateTableIndex = 315,
WdfSpinLockAcquireTableIndex = 316,
WdfSpinLockReleaseTableIndex = 317,
WdfTimerCreateTableIndex = 318,
WdfTimerStartTableIndex = 319,
WdfTimerStopTableIndex = 320,
WdfTimerGetParentObjectTableIndex = 321,
WdfUsbTargetDeviceCreateTableIndex = 322,
WdfUsbTargetDeviceRetrieveInformationTableIndex = 323,
WdfUsbTargetDeviceGetDeviceDescriptorTableIndex = 324,
WdfUsbTargetDeviceRetrieveConfigDescriptorTableIndex = 325,
WdfUsbTargetDeviceQueryStringTableIndex = 326,
WdfUsbTargetDeviceAllocAndQueryStringTableIndex = 327,
WdfUsbTargetDeviceFormatRequestForStringTableIndex = 328,
WdfUsbTargetDeviceGetNumInterfacesTableIndex = 329,
WdfUsbTargetDeviceSelectConfigTableIndex = 330,
WdfUsbTargetDeviceWdmGetConfigurationHandleTableIndex = 331,
WdfUsbTargetDeviceRetrieveCurrentFrameNumberTableIndex = 332,
WdfUsbTargetDeviceSendControlTransferSynchronouslyTableIndex = 333,
WdfUsbTargetDeviceFormatRequestForControlTransferTableIndex = 334,
WdfUsbTargetDeviceIsConnectedSynchronousTableIndex = 335,
WdfUsbTargetDeviceResetPortSynchronouslyTableIndex = 336,
WdfUsbTargetDeviceCyclePortSynchronouslyTableIndex = 337,
WdfUsbTargetDeviceFormatRequestForCyclePortTableIndex = 338,
WdfUsbTargetDeviceSendUrbSynchronouslyTableIndex = 339,
WdfUsbTargetDeviceFormatRequestForUrbTableIndex = 340,
WdfUsbTargetPipeGetInformationTableIndex = 341,
WdfUsbTargetPipeIsInEndpointTableIndex = 342,
WdfUsbTargetPipeIsOutEndpointTableIndex = 343,
WdfUsbTargetPipeGetTypeTableIndex = 344,
WdfUsbTargetPipeSetNoMaximumPacketSizeCheckTableIndex = 345,
WdfUsbTargetPipeWriteSynchronouslyTableIndex = 346,
WdfUsbTargetPipeFormatRequestForWriteTableIndex = 347,
WdfUsbTargetPipeReadSynchronouslyTableIndex = 348,
WdfUsbTargetPipeFormatRequestForReadTableIndex = 349,
WdfUsbTargetPipeConfigContinuousReaderTableIndex = 350,
WdfUsbTargetPipeAbortSynchronouslyTableIndex = 351,
WdfUsbTargetPipeFormatRequestForAbortTableIndex = 352,
WdfUsbTargetPipeResetSynchronouslyTableIndex = 353,
WdfUsbTargetPipeFormatRequestForResetTableIndex = 354,
WdfUsbTargetPipeSendUrbSynchronouslyTableIndex = 355,
WdfUsbTargetPipeFormatRequestForUrbTableIndex = 356,
WdfUsbInterfaceGetInterfaceNumberTableIndex = 357,
WdfUsbInterfaceGetNumEndpointsTableIndex = 358,
WdfUsbInterfaceGetDescriptorTableIndex = 359,
WdfUsbInterfaceSelectSettingTableIndex = 360,
WdfUsbInterfaceGetEndpointInformationTableIndex = 361,
WdfUsbTargetDeviceGetInterfaceTableIndex = 362,
WdfUsbInterfaceGetConfiguredSettingIndexTableIndex = 363,
WdfUsbInterfaceGetNumConfiguredPipesTableIndex = 364,
WdfUsbInterfaceGetConfiguredPipeTableIndex = 365,
WdfUsbTargetPipeWdmGetPipeHandleTableIndex = 366,
WdfVerifierDbgBreakPointTableIndex = 367,
WdfVerifierKeBugCheckTableIndex = 368,
WdfWmiProviderCreateTableIndex = 369,
WdfWmiProviderGetDeviceTableIndex = 370,
WdfWmiProviderIsEnabledTableIndex = 371,
WdfWmiProviderGetTracingHandleTableIndex = 372,
WdfWmiInstanceCreateTableIndex = 373,
WdfWmiInstanceRegisterTableIndex = 374,
WdfWmiInstanceDeregisterTableIndex = 375,
WdfWmiInstanceGetDeviceTableIndex = 376,
WdfWmiInstanceGetProviderTableIndex = 377,
WdfWmiInstanceFireEventTableIndex = 378,
WdfWorkItemCreateTableIndex = 379,
WdfWorkItemEnqueueTableIndex = 380,
WdfWorkItemGetParentObjectTableIndex = 381,
WdfWorkItemFlushTableIndex = 382,
WdfCommonBufferCreateWithConfigTableIndex = 383,
WdfDmaEnablerGetFragmentLengthTableIndex = 384,
WdfDmaEnablerWdmGetDmaAdapterTableIndex = 385,
WdfUsbInterfaceGetNumSettingsTableIndex = 386,
WdfDeviceRemoveDependentUsageDeviceObjectTableIndex = 387,
WdfDeviceGetSystemPowerActionTableIndex = 388,
WdfInterruptSetExtendedPolicyTableIndex = 389,
WdfIoQueueAssignForwardProgressPolicyTableIndex = 390,
WdfPdoInitAssignContainerIDTableIndex = 391,
WdfPdoInitAllowForwardingRequestToParentTableIndex = 392,
WdfRequestMarkCancelableExTableIndex = 393,
WdfRequestIsReservedTableIndex = 394,
WdfRequestForwardToParentDeviceIoQueueTableIndex = 395,
WdfCxDeviceInitAllocateTableIndex = 396,
WdfCxDeviceInitAssignWdmIrpPreprocessCallbackTableIndex = 397,
WdfCxDeviceInitSetIoInCallerContextCallbackTableIndex = 398,
WdfCxDeviceInitSetRequestAttributesTableIndex = 399,
WdfCxDeviceInitSetFileObjectConfigTableIndex = 400,
WdfDeviceWdmDispatchIrpTableIndex = 401,
WdfDeviceWdmDispatchIrpToIoQueueTableIndex = 402,
WdfDeviceInitSetRemoveLockOptionsTableIndex = 403,
WdfDeviceConfigureWdmIrpDispatchCallbackTableIndex = 404,
WdfDmaEnablerConfigureSystemProfileTableIndex = 405,
WdfDmaTransactionInitializeUsingOffsetTableIndex = 406,
WdfDmaTransactionGetTransferInfoTableIndex = 407,
WdfDmaTransactionSetChannelConfigurationCallbackTableIndex = 408,
WdfDmaTransactionSetTransferCompleteCallbackTableIndex = 409,
WdfDmaTransactionSetImmediateExecutionTableIndex = 410,
WdfDmaTransactionAllocateResourcesTableIndex = 411,
WdfDmaTransactionSetDeviceAddressOffsetTableIndex = 412,
WdfDmaTransactionFreeResourcesTableIndex = 413,
WdfDmaTransactionCancelTableIndex = 414,
WdfDmaTransactionWdmGetTransferContextTableIndex = 415,
WdfInterruptQueueWorkItemForIsrTableIndex = 416,
WdfInterruptTryToAcquireLockTableIndex = 417,
WdfIoQueueStopAndPurgeTableIndex = 418,
WdfIoQueueStopAndPurgeSynchronouslyTableIndex = 419,
WdfIoTargetPurgeTableIndex = 420,
WdfUsbTargetDeviceCreateWithParametersTableIndex = 421,
WdfUsbTargetDeviceQueryUsbCapabilityTableIndex = 422,
WdfUsbTargetDeviceCreateUrbTableIndex = 423,
WdfUsbTargetDeviceCreateIsochUrbTableIndex = 424,
WdfDeviceWdmAssignPowerFrameworkSettingsTableIndex = 425,
WdfDmaTransactionStopSystemTransferTableIndex = 426,
WdfCxVerifierKeBugCheckTableIndex = 427,
WdfInterruptReportActiveTableIndex = 428,
WdfInterruptReportInactiveTableIndex = 429,
WdfDeviceInitSetReleaseHardwareOrderOnFailureTableIndex = 430,
WdfGetTriageInfoTableIndex = 431,
WdfDeviceInitSetIoTypeExTableIndex = 432,
WdfDeviceQueryPropertyExTableIndex = 433,
WdfDeviceAllocAndQueryPropertyExTableIndex = 434,
WdfDeviceAssignPropertyTableIndex = 435,
WdfFdoInitQueryPropertyExTableIndex = 436,
WdfFdoInitAllocAndQueryPropertyExTableIndex = 437,
WdfDeviceStopIdleActualTableIndex = 438,
WdfDeviceResumeIdleActualTableIndex = 439,
WdfDeviceGetSelfIoTargetTableIndex = 440,
WdfDeviceInitAllowSelfIoTargetTableIndex = 441,
WdfIoTargetSelfAssignDefaultIoQueueTableIndex = 442,
WdfDeviceOpenDevicemapKeyTableIndex = 443,
WdfFunctionTableNumEntries = 444,
} WDFFUNCENUM;
#endif // _WDFFUNCENUM_H_

View file

@ -0,0 +1,85 @@
/*++
Copyright (c) Microsoft Corporation
Module Name:
WdfGlobals.h
Abstract:
This module contains globals definitions for the 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 _WDFGLOBALS_H_
#define _WDFGLOBALS_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
#ifdef __cplusplus
extern "C" {
#endif
#define WDF_DRIVER_GLOBALS_NAME_LEN (32)
typedef struct _WDF_DRIVER_GLOBALS {
// backpointer to the handle for this driver
WDFDRIVER Driver;
// Flags indicated by the driver during create
ULONG DriverFlags;
// Tag generated by WDF for the driver. Tag used by allocations made on
// behalf of the driver by WDF.
ULONG DriverTag;
CHAR DriverName[WDF_DRIVER_GLOBALS_NAME_LEN];
// If TRUE, the stub code will capture DriverObject->DriverUnload and insert
// itself first in the unload chain. If FALSE, DriverUnload is left alone
// (but WDF will not be notified of unload and there will be no auto cleanup).
BOOLEAN DisplaceDriverUnload;
} WDF_DRIVER_GLOBALS, *PWDF_DRIVER_GLOBALS;
#ifdef __cplusplus
}
#endif
WDF_EXTERN_C_END
#endif // _WDFGLOBALS_H_

View file

@ -0,0 +1,75 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfhwaccess.h
Abstract:
This module contains contains the Windows Driver Framework hw access
interfaces.
Environment:
User 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 _WDFHWACCESS_H_
#define _WDFHWACCESS_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)
//
// Types
//
//
// Functions for HwAccess
//
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFHWACCESS_H_

View file

@ -0,0 +1,165 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfInstaller.h
Abstract:
Contains prototypes for the WDF installer support.
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 _WDFINSTALLER_H_
#define _WDFINSTALLER_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_COINSTALLER_INSTALL_OPTIONS {
ULONG Size;
BOOL ShowRebootPrompt;
} WDF_COINSTALLER_INSTALL_OPTIONS, *PWDF_COINSTALLER_INSTALL_OPTIONS;
VOID
FORCEINLINE
WDF_COINSTALLER_INSTALL_OPTIONS_INIT(
_Out_ PWDF_COINSTALLER_INSTALL_OPTIONS ClientOptions
)
{
RtlZeroMemory(ClientOptions, sizeof(WDF_COINSTALLER_INSTALL_OPTIONS));
ClientOptions->Size = sizeof(WDF_COINSTALLER_INSTALL_OPTIONS);
}
//----------------------------------------------------------------------------
// To be called before (your) WDF driver is installed.
//----------------------------------------------------------------------------
ULONG
WINAPI
WdfPreDeviceInstall(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
typedef
ULONG
(WINAPI *PFN_WDFPREDEVICEINSTALL)(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
ULONG
WINAPI
WdfPreDeviceInstallEx(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName,
_In_ PWDF_COINSTALLER_INSTALL_OPTIONS ClientOptions
);
typedef
ULONG
(WINAPI *PFN_WDFPREDEVICEINSTALLEX)(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName,
_In_ PWDF_COINSTALLER_INSTALL_OPTIONS ClientOptions
);
//----------------------------------------------------------------------------
// To be called after (your) WDF driver is installed.
//----------------------------------------------------------------------------
ULONG
WINAPI
WdfPostDeviceInstall(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
typedef
ULONG
(WINAPI *PFN_WDFPOSTDEVICEINSTALL)(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
//----------------------------------------------------------------------------
// To be called before (your) WDF driver is removed.
//----------------------------------------------------------------------------
ULONG
WINAPI
WdfPreDeviceRemove(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
typedef
ULONG
(WINAPI *PFN_WDFPREDEVICEREMOVE)(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
//----------------------------------------------------------------------------
// To be called after (your) WDF driver is removed.
//----------------------------------------------------------------------------
ULONG
WINAPI
WdfPostDeviceRemove(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
typedef
ULONG
(WINAPI *PFN_WDFPOSTDEVICEREMOVE)(
_In_ LPCWSTR InfPath,
_In_opt_ LPCWSTR InfSectionName
);
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFINSTALLER_H_

View file

@ -0,0 +1,810 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfinterrupt.h
Abstract:
This is the C header for driver framework Interrupt object
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 _WDFINTERRUPT_H_
#define _WDFINTERRUPT_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)
//
// Message Signaled Interrupts (MSI) information structure
//
typedef enum _WDF_INTERRUPT_POLARITY {
WdfInterruptPolarityUnknown = 0,
WdfInterruptActiveHigh,
WdfInterruptActiveLow,
} WDF_INTERRUPT_POLARITY, *PWDF_INTERRUPT_POLARITY;
typedef enum _WDF_INTERRUPT_POLICY {
WdfIrqPolicyMachineDefault = 0,
WdfIrqPolicyAllCloseProcessors,
WdfIrqPolicyOneCloseProcessor,
WdfIrqPolicyAllProcessorsInMachine,
WdfIrqPolicySpecifiedProcessors,
WdfIrqPolicySpreadMessagesAcrossAllProcessors,
} WDF_INTERRUPT_POLICY, *PWDF_INTERRUPT_POLICY;
typedef enum _WDF_INTERRUPT_PRIORITY {
WdfIrqPriorityUndefined = 0,
WdfIrqPriorityLow,
WdfIrqPriorityNormal,
WdfIrqPriorityHigh,
} WDF_INTERRUPT_PRIORITY, *PWDF_INTERRUPT_PRIORITY;
//
// This is the function that gets invoked when the hardware ISR occurs.
// This function is called at the IRQL at which the interrupt is serviced:
// - DIRQL for DIRQL interrupt handling.
// - PASSIVE_LEVEL for passive-level interrupt handling.
//
typedef
_Function_class_(EVT_WDF_INTERRUPT_ISR)
_IRQL_requires_same_
_IRQL_requires_min_(PASSIVE_LEVEL)
BOOLEAN
EVT_WDF_INTERRUPT_ISR(
_In_
WDFINTERRUPT Interrupt,
_In_
ULONG MessageID
);
typedef EVT_WDF_INTERRUPT_ISR *PFN_WDF_INTERRUPT_ISR;
//
// This is the function that gets invoked when a Synchronize execution occurs.
// This function is called at the IRQL at which the interrupt is serviced:
// - DIRQL for DIRQL interrupt handling.
// - PASSIVE_LEVEL for passive-level interrupt handling.
//
typedef
_Function_class_(EVT_WDF_INTERRUPT_SYNCHRONIZE)
_IRQL_requires_same_
_IRQL_requires_min_(PASSIVE_LEVEL)
BOOLEAN
EVT_WDF_INTERRUPT_SYNCHRONIZE(
_In_
WDFINTERRUPT Interrupt,
_In_
WDFCONTEXT Context
);
typedef EVT_WDF_INTERRUPT_SYNCHRONIZE *PFN_WDF_INTERRUPT_SYNCHRONIZE;
//
// This is the function that gets called back into the driver
// when the DpcForIsr fires. It will be called at DISPATCH_LEVEL.
//
typedef
_Function_class_(EVT_WDF_INTERRUPT_DPC)
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
VOID
EVT_WDF_INTERRUPT_DPC(
_In_
WDFINTERRUPT Interrupt,
_In_
WDFOBJECT AssociatedObject
);
typedef EVT_WDF_INTERRUPT_DPC *PFN_WDF_INTERRUPT_DPC;
//
// This is the function that gets called back into the driver
// when the WorkItemForIsr fires. It will be called at PASSIVE_LEVEL.
//
typedef
_Function_class_(EVT_WDF_INTERRUPT_WORKITEM)
_IRQL_requires_same_
_IRQL_requires_(PASSIVE_LEVEL)
VOID
EVT_WDF_INTERRUPT_WORKITEM(
_In_
WDFINTERRUPT Interrupt,
_In_
WDFOBJECT AssociatedObject
);
typedef EVT_WDF_INTERRUPT_WORKITEM *PFN_WDF_INTERRUPT_WORKITEM;
//
// This is the function that gets called back into the driver
// to enable the interrupt in the hardware. It will be called
// at the same IRQL at which the interrupt will be serviced:
// - DIRQL for DIRQL interrupt handling.
// - PASSIVE_LEVEL for passive-level interrupt handling.
//
typedef
_Function_class_(EVT_WDF_INTERRUPT_ENABLE)
_IRQL_requires_same_
_IRQL_requires_min_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_INTERRUPT_ENABLE(
_In_
WDFINTERRUPT Interrupt,
_In_
WDFDEVICE AssociatedDevice
);
typedef EVT_WDF_INTERRUPT_ENABLE *PFN_WDF_INTERRUPT_ENABLE;
//
// This is the function that gets called back into the driver
// to disable the interrupt in the hardware. It will be called
// at the same IRQL at which the interrupt is serviced:
// - DIRQL for DIRQL interrupt handling.
// - PASSIVE_LEVEL for passive-level interrupt handling.
//
typedef
_Function_class_(EVT_WDF_INTERRUPT_DISABLE)
_IRQL_requires_same_
_IRQL_requires_min_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_INTERRUPT_DISABLE(
_In_
WDFINTERRUPT Interrupt,
_In_
WDFDEVICE AssociatedDevice
);
typedef EVT_WDF_INTERRUPT_DISABLE *PFN_WDF_INTERRUPT_DISABLE;
//
// Interrupt Configuration Structure
//
typedef struct _WDF_INTERRUPT_CONFIG {
ULONG Size;
//
// If this interrupt is to be synchronized with other interrupt(s) assigned
// to the same WDFDEVICE, create a WDFSPINLOCK and assign it to each of the
// WDFINTERRUPTs config.
//
WDFSPINLOCK SpinLock;
WDF_TRI_STATE ShareVector;
BOOLEAN FloatingSave;
//
// DIRQL handling: automatic serialization of the DpcForIsr/WaitItemForIsr.
// Passive-level handling: automatic serialization of all callbacks.
//
BOOLEAN AutomaticSerialization;
//
// Event Callbacks
//
PFN_WDF_INTERRUPT_ISR EvtInterruptIsr;
PFN_WDF_INTERRUPT_DPC EvtInterruptDpc;
PFN_WDF_INTERRUPT_ENABLE EvtInterruptEnable;
PFN_WDF_INTERRUPT_DISABLE EvtInterruptDisable;
PFN_WDF_INTERRUPT_WORKITEM EvtInterruptWorkItem;
//
// These fields are only used when interrupt is created in
// EvtDevicePrepareHardware callback.
//
PCM_PARTIAL_RESOURCE_DESCRIPTOR InterruptRaw;
PCM_PARTIAL_RESOURCE_DESCRIPTOR InterruptTranslated;
//
// Optional passive lock for handling interrupts at passive-level.
//
WDFWAITLOCK WaitLock;
//
// TRUE: handle interrupt at passive-level.
// FALSE: handle interrupt at DIRQL level. This is the default.
//
BOOLEAN PassiveHandling;
//
// TRUE: Interrupt is reported inactive on explicit power down
// instead of disconnecting it.
// FALSE: Interrupt is disconnected instead of reporting inactive
// on explicit power down.
// DEFAULT: Framework decides the right value.
//
WDF_TRI_STATE ReportInactiveOnPowerDown;
//
// TRUE: Interrupt is used to wake the device from low-power states
// and when the device is armed for wake this interrupt should
// remain connected.
// FALSE: Interrupt is not used to wake the device from low-power states.
// This is the default.
//
BOOLEAN CanWakeDevice;
} WDF_INTERRUPT_CONFIG, *PWDF_INTERRUPT_CONFIG;
VOID
FORCEINLINE
WDF_INTERRUPT_CONFIG_INIT(
_Out_ PWDF_INTERRUPT_CONFIG Configuration,
_In_ PFN_WDF_INTERRUPT_ISR EvtInterruptIsr,
_In_opt_ PFN_WDF_INTERRUPT_DPC EvtInterruptDpc
)
{
RtlZeroMemory(Configuration, sizeof(WDF_INTERRUPT_CONFIG));
Configuration->Size = sizeof(WDF_INTERRUPT_CONFIG);
Configuration->ShareVector = WdfUseDefault;
Configuration->EvtInterruptIsr = EvtInterruptIsr;
Configuration->EvtInterruptDpc = EvtInterruptDpc;
Configuration->ReportInactiveOnPowerDown = WdfUseDefault;
}
//
// Disable warning C4324: structure was padded due to DECLSPEC_ALIGN
// This padding is intentional and necessary.
#pragma warning(push)
#pragma warning(disable: 4324)
typedef struct _WDF_INTERRUPT_INFO {
//
// Size of this structure in bytes
//
ULONG Size;
ULONG64 Reserved1;
KAFFINITY TargetProcessorSet;
ULONG Reserved2;
ULONG MessageNumber;
ULONG Vector;
KIRQL Irql;
KINTERRUPT_MODE Mode;
WDF_INTERRUPT_POLARITY Polarity;
BOOLEAN MessageSignaled;
UCHAR ShareDisposition; //CM_SHARE_DISPOSITION
DECLSPEC_ALIGN(8) USHORT Group;
} WDF_INTERRUPT_INFO, *PWDF_INTERRUPT_INFO;
#pragma warning(pop)
VOID
FORCEINLINE
WDF_INTERRUPT_INFO_INIT(
_Out_ PWDF_INTERRUPT_INFO Info
)
{
RtlZeroMemory(Info, sizeof(WDF_INTERRUPT_INFO));
Info->Size = sizeof(WDF_INTERRUPT_INFO);
}
//
// Interrupt Extended Policy Configuration Structure
//
typedef struct _WDF_INTERRUPT_EXTENDED_POLICY {
//
// Size of this structure in bytes
//
ULONG Size;
WDF_INTERRUPT_POLICY Policy;
WDF_INTERRUPT_PRIORITY Priority;
GROUP_AFFINITY TargetProcessorSetAndGroup;
} WDF_INTERRUPT_EXTENDED_POLICY, *PWDF_INTERRUPT_EXTENDED_POLICY;
VOID
FORCEINLINE
WDF_INTERRUPT_EXTENDED_POLICY_INIT(
_Out_ PWDF_INTERRUPT_EXTENDED_POLICY ExtendedPolicy
)
{
RtlZeroMemory(ExtendedPolicy, sizeof(WDF_INTERRUPT_EXTENDED_POLICY));
ExtendedPolicy->Size = sizeof(WDF_INTERRUPT_EXTENDED_POLICY);
ExtendedPolicy->Policy = WdfIrqPolicyMachineDefault;
ExtendedPolicy->Priority = WdfIrqPriorityUndefined;
}
//
// WDF Function: WdfInterruptCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFINTERRUPTCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_In_
PWDF_INTERRUPT_CONFIG Configuration,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFINTERRUPT* Interrupt
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfInterruptCreate(
_In_
WDFDEVICE Device,
_In_
PWDF_INTERRUPT_CONFIG Configuration,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFINTERRUPT* Interrupt
)
{
return ((PFN_WDFINTERRUPTCREATE) WdfFunctions[WdfInterruptCreateTableIndex])(WdfDriverGlobals, Device, Configuration, Attributes, Interrupt);
}
//
// WDF Function: WdfInterruptQueueDpcForIsr
//
typedef
WDFAPI
BOOLEAN
(*PFN_WDFINTERRUPTQUEUEDPCFORISR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
BOOLEAN
FORCEINLINE
WdfInterruptQueueDpcForIsr(
_In_
WDFINTERRUPT Interrupt
)
{
return ((PFN_WDFINTERRUPTQUEUEDPCFORISR) WdfFunctions[WdfInterruptQueueDpcForIsrTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptQueueWorkItemForIsr
//
typedef
WDFAPI
BOOLEAN
(*PFN_WDFINTERRUPTQUEUEWORKITEMFORISR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
BOOLEAN
FORCEINLINE
WdfInterruptQueueWorkItemForIsr(
_In_
WDFINTERRUPT Interrupt
)
{
return ((PFN_WDFINTERRUPTQUEUEWORKITEMFORISR) WdfFunctions[WdfInterruptQueueWorkItemForIsrTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptSynchronize
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFINTERRUPTSYNCHRONIZE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt,
_In_
PFN_WDF_INTERRUPT_SYNCHRONIZE Callback,
_In_
WDFCONTEXT Context
);
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
FORCEINLINE
WdfInterruptSynchronize(
_In_
WDFINTERRUPT Interrupt,
_In_
PFN_WDF_INTERRUPT_SYNCHRONIZE Callback,
_In_
WDFCONTEXT Context
)
{
return ((PFN_WDFINTERRUPTSYNCHRONIZE) WdfFunctions[WdfInterruptSynchronizeTableIndex])(WdfDriverGlobals, Interrupt, Callback, Context);
}
//
// WDF Function: WdfInterruptAcquireLock
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL + 1)
WDFAPI
VOID
(*PFN_WDFINTERRUPTACQUIRELOCK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_not_held_(_Curr_)
_Acquires_lock_(_Curr_)
WDFINTERRUPT Interrupt
);
_IRQL_requires_max_(DISPATCH_LEVEL + 1)
VOID
FORCEINLINE
WdfInterruptAcquireLock(
_In_
_Requires_lock_not_held_(_Curr_)
_Acquires_lock_(_Curr_)
WDFINTERRUPT Interrupt
)
{
((PFN_WDFINTERRUPTACQUIRELOCK) WdfFunctions[WdfInterruptAcquireLockTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptReleaseLock
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL + 1)
WDFAPI
VOID
(*PFN_WDFINTERRUPTRELEASELOCK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
WDFINTERRUPT Interrupt
);
_IRQL_requires_max_(DISPATCH_LEVEL + 1)
VOID
FORCEINLINE
WdfInterruptReleaseLock(
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
WDFINTERRUPT Interrupt
)
{
((PFN_WDFINTERRUPTRELEASELOCK) WdfFunctions[WdfInterruptReleaseLockTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptEnable
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFINTERRUPTENABLE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfInterruptEnable(
_In_
WDFINTERRUPT Interrupt
)
{
((PFN_WDFINTERRUPTENABLE) WdfFunctions[WdfInterruptEnableTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptDisable
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFINTERRUPTDISABLE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfInterruptDisable(
_In_
WDFINTERRUPT Interrupt
)
{
((PFN_WDFINTERRUPTDISABLE) WdfFunctions[WdfInterruptDisableTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptWdmGetInterrupt
//
typedef
_Must_inspect_result_
WDFAPI
PKINTERRUPT
(*PFN_WDFINTERRUPTWDMGETINTERRUPT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
_Must_inspect_result_
PKINTERRUPT
FORCEINLINE
WdfInterruptWdmGetInterrupt(
_In_
WDFINTERRUPT Interrupt
)
{
return ((PFN_WDFINTERRUPTWDMGETINTERRUPT) WdfFunctions[WdfInterruptWdmGetInterruptTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptGetInfo
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFINTERRUPTGETINFO)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt,
_Out_
PWDF_INTERRUPT_INFO Info
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfInterruptGetInfo(
_In_
WDFINTERRUPT Interrupt,
_Out_
PWDF_INTERRUPT_INFO Info
)
{
((PFN_WDFINTERRUPTGETINFO) WdfFunctions[WdfInterruptGetInfoTableIndex])(WdfDriverGlobals, Interrupt, Info);
}
//
// WDF Function: WdfInterruptSetPolicy
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFINTERRUPTSETPOLICY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt,
_In_
WDF_INTERRUPT_POLICY Policy,
_In_
WDF_INTERRUPT_PRIORITY Priority,
_In_
KAFFINITY TargetProcessorSet
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfInterruptSetPolicy(
_In_
WDFINTERRUPT Interrupt,
_In_
WDF_INTERRUPT_POLICY Policy,
_In_
WDF_INTERRUPT_PRIORITY Priority,
_In_
KAFFINITY TargetProcessorSet
)
{
((PFN_WDFINTERRUPTSETPOLICY) WdfFunctions[WdfInterruptSetPolicyTableIndex])(WdfDriverGlobals, Interrupt, Policy, Priority, TargetProcessorSet);
}
//
// WDF Function: WdfInterruptSetExtendedPolicy
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFINTERRUPTSETEXTENDEDPOLICY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt,
_In_
PWDF_INTERRUPT_EXTENDED_POLICY PolicyAndGroup
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfInterruptSetExtendedPolicy(
_In_
WDFINTERRUPT Interrupt,
_In_
PWDF_INTERRUPT_EXTENDED_POLICY PolicyAndGroup
)
{
((PFN_WDFINTERRUPTSETEXTENDEDPOLICY) WdfFunctions[WdfInterruptSetExtendedPolicyTableIndex])(WdfDriverGlobals, Interrupt, PolicyAndGroup);
}
//
// WDF Function: WdfInterruptGetDevice
//
typedef
WDFAPI
WDFDEVICE
(*PFN_WDFINTERRUPTGETDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
WDFDEVICE
FORCEINLINE
WdfInterruptGetDevice(
_In_
WDFINTERRUPT Interrupt
)
{
return ((PFN_WDFINTERRUPTGETDEVICE) WdfFunctions[WdfInterruptGetDeviceTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptTryToAcquireLock
//
typedef
_Must_inspect_result_
_Post_satisfies_(return == 1 || return == 0)
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFINTERRUPTTRYTOACQUIRELOCK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_not_held_(_Curr_)
_When_(return!=0, _Acquires_lock_(_Curr_))
WDFINTERRUPT Interrupt
);
_Must_inspect_result_
_Post_satisfies_(return == 1 || return == 0)
_IRQL_requires_max_(PASSIVE_LEVEL)
BOOLEAN
FORCEINLINE
WdfInterruptTryToAcquireLock(
_In_
_Requires_lock_not_held_(_Curr_)
_When_(return!=0, _Acquires_lock_(_Curr_))
WDFINTERRUPT Interrupt
)
{
return ((PFN_WDFINTERRUPTTRYTOACQUIRELOCK) WdfFunctions[WdfInterruptTryToAcquireLockTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptReportActive
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFINTERRUPTREPORTACTIVE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfInterruptReportActive(
_In_
WDFINTERRUPT Interrupt
)
{
((PFN_WDFINTERRUPTREPORTACTIVE) WdfFunctions[WdfInterruptReportActiveTableIndex])(WdfDriverGlobals, Interrupt);
}
//
// WDF Function: WdfInterruptReportInactive
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFINTERRUPTREPORTINACTIVE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFINTERRUPT Interrupt
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfInterruptReportInactive(
_In_
WDFINTERRUPT Interrupt
)
{
((PFN_WDFINTERRUPTREPORTINACTIVE) WdfFunctions[WdfInterruptReportInactiveTableIndex])(WdfDriverGlobals, Interrupt);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFINTERRUPT_H_

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,480 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfMemory.h
Abstract:
Contains prototypes for managing memory objects in the driver frameworks.
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 _WDFMEMORY_H_
#define _WDFMEMORY_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_MEMORY_DESCRIPTOR_TYPE {
WdfMemoryDescriptorTypeInvalid = 0,
WdfMemoryDescriptorTypeBuffer,
WdfMemoryDescriptorTypeMdl,
WdfMemoryDescriptorTypeHandle,
} WDF_MEMORY_DESCRIPTOR_TYPE;
typedef struct _WDFMEMORY_OFFSET {
//
// Offset into the WDFMEMORY that the operation should start at.
//
size_t BufferOffset;
//
// Number of bytes that the operation should access. If 0, the entire
// length of the WDFMEMORY buffer will be used in the operation or ignored
// depending on the API.
//
size_t BufferLength;
} WDFMEMORY_OFFSET, *PWDFMEMORY_OFFSET;
typedef struct _WDF_MEMORY_DESCRIPTOR {
WDF_MEMORY_DESCRIPTOR_TYPE Type;
union {
struct {
PVOID Buffer;
ULONG Length;
} BufferType;
struct {
PMDL Mdl;
ULONG BufferLength;
} MdlType;
struct {
WDFMEMORY Memory;
PWDFMEMORY_OFFSET Offsets;
} HandleType;
} u;
} WDF_MEMORY_DESCRIPTOR, *PWDF_MEMORY_DESCRIPTOR;
VOID
FORCEINLINE
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(
_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor,
_In_ PVOID Buffer,
_In_ ULONG BufferLength
)
{
RtlZeroMemory(Descriptor, sizeof(WDF_MEMORY_DESCRIPTOR));
Descriptor->Type = WdfMemoryDescriptorTypeBuffer;
Descriptor->u.BufferType.Buffer = Buffer;
Descriptor->u.BufferType.Length = BufferLength;
}
VOID
FORCEINLINE
WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(
_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor,
_In_ WDFMEMORY Memory,
_In_opt_ PWDFMEMORY_OFFSET Offsets
)
{
RtlZeroMemory(Descriptor, sizeof(WDF_MEMORY_DESCRIPTOR));
Descriptor->Type = WdfMemoryDescriptorTypeHandle;
Descriptor->u.HandleType.Memory = Memory;
Descriptor->u.HandleType.Offsets = Offsets;
}
VOID
FORCEINLINE
WDF_MEMORY_DESCRIPTOR_INIT_MDL(
_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor,
_In_ PMDL Mdl,
_In_ ULONG BufferLength
)
{
RtlZeroMemory(Descriptor, sizeof(WDF_MEMORY_DESCRIPTOR));
Descriptor->Type = WdfMemoryDescriptorTypeMdl;
Descriptor->u.MdlType.Mdl = Mdl;
Descriptor->u.MdlType.BufferLength = BufferLength;
}
//
// WDF Function: WdfMemoryCreate
//
typedef
_Must_inspect_result_
_When_(PoolType == 1 || PoolType == 257, _IRQL_requires_max_(APC_LEVEL))
_When_(PoolType == 0 || PoolType == 256, _IRQL_requires_max_(DISPATCH_LEVEL))
WDFAPI
NTSTATUS
(*PFN_WDFMEMORYCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
ULONG PoolTag,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize,
_Out_
WDFMEMORY* Memory,
_Outptr_opt_result_bytebuffer_(BufferSize)
PVOID* Buffer
);
_Must_inspect_result_
_When_(PoolType == 1 || PoolType == 257, _IRQL_requires_max_(APC_LEVEL))
_When_(PoolType == 0 || PoolType == 256, _IRQL_requires_max_(DISPATCH_LEVEL))
NTSTATUS
FORCEINLINE
WdfMemoryCreate(
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
ULONG PoolTag,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize,
_Out_
WDFMEMORY* Memory,
_Outptr_opt_result_bytebuffer_(BufferSize)
PVOID* Buffer
)
{
return ((PFN_WDFMEMORYCREATE) WdfFunctions[WdfMemoryCreateTableIndex])(WdfDriverGlobals, Attributes, PoolType, PoolTag, BufferSize, Memory, Buffer);
}
//
// WDF Function: WdfMemoryCreatePreallocated
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFMEMORYCREATEPREALLOCATED)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_In_ __drv_aliasesMem
PVOID Buffer,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize,
_Out_
WDFMEMORY* Memory
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfMemoryCreatePreallocated(
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_In_ __drv_aliasesMem
PVOID Buffer,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize,
_Out_
WDFMEMORY* Memory
)
{
return ((PFN_WDFMEMORYCREATEPREALLOCATED) WdfFunctions[WdfMemoryCreatePreallocatedTableIndex])(WdfDriverGlobals, Attributes, Buffer, BufferSize, Memory);
}
//
// WDF Function: WdfMemoryGetBuffer
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PVOID
(*PFN_WDFMEMORYGETBUFFER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFMEMORY Memory,
_Out_opt_
size_t* BufferSize
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PVOID
FORCEINLINE
WdfMemoryGetBuffer(
_In_
WDFMEMORY Memory,
_Out_opt_
size_t* BufferSize
)
{
return ((PFN_WDFMEMORYGETBUFFER) WdfFunctions[WdfMemoryGetBufferTableIndex])(WdfDriverGlobals, Memory, BufferSize);
}
//
// WDF Function: WdfMemoryAssignBuffer
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFMEMORYASSIGNBUFFER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFMEMORY Memory,
_Pre_notnull_ _Pre_writable_byte_size_(BufferSize)
PVOID Buffer,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfMemoryAssignBuffer(
_In_
WDFMEMORY Memory,
_Pre_notnull_ _Pre_writable_byte_size_(BufferSize)
PVOID Buffer,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize
)
{
return ((PFN_WDFMEMORYASSIGNBUFFER) WdfFunctions[WdfMemoryAssignBufferTableIndex])(WdfDriverGlobals, Memory, Buffer, BufferSize);
}
//
// WDF Function: WdfMemoryCopyToBuffer
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFMEMORYCOPYTOBUFFER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFMEMORY SourceMemory,
_In_
size_t SourceOffset,
_Out_writes_bytes_( NumBytesToCopyTo )
PVOID Buffer,
_In_
_When_(NumBytesToCopyTo == 0, __drv_reportError(NumBytesToCopyTo cannot be zero))
size_t NumBytesToCopyTo
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfMemoryCopyToBuffer(
_In_
WDFMEMORY SourceMemory,
_In_
size_t SourceOffset,
_Out_writes_bytes_( NumBytesToCopyTo )
PVOID Buffer,
_In_
_When_(NumBytesToCopyTo == 0, __drv_reportError(NumBytesToCopyTo cannot be zero))
size_t NumBytesToCopyTo
)
{
return ((PFN_WDFMEMORYCOPYTOBUFFER) WdfFunctions[WdfMemoryCopyToBufferTableIndex])(WdfDriverGlobals, SourceMemory, SourceOffset, Buffer, NumBytesToCopyTo);
}
//
// WDF Function: WdfMemoryCopyFromBuffer
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFMEMORYCOPYFROMBUFFER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFMEMORY DestinationMemory,
_In_
size_t DestinationOffset,
_In_
PVOID Buffer,
_In_
_When_(NumBytesToCopyFrom == 0, __drv_reportError(NumBytesToCopyFrom cannot be zero))
size_t NumBytesToCopyFrom
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfMemoryCopyFromBuffer(
_In_
WDFMEMORY DestinationMemory,
_In_
size_t DestinationOffset,
_In_
PVOID Buffer,
_In_
_When_(NumBytesToCopyFrom == 0, __drv_reportError(NumBytesToCopyFrom cannot be zero))
size_t NumBytesToCopyFrom
)
{
return ((PFN_WDFMEMORYCOPYFROMBUFFER) WdfFunctions[WdfMemoryCopyFromBufferTableIndex])(WdfDriverGlobals, DestinationMemory, DestinationOffset, Buffer, NumBytesToCopyFrom);
}
//
// WDF Function: WdfLookasideListCreate
//
typedef
_Must_inspect_result_
_When_(PoolType == 1 || PoolType == 257, _IRQL_requires_max_(APC_LEVEL))
_When_(PoolType == 0 || PoolType == 256, _IRQL_requires_max_(DISPATCH_LEVEL))
WDFAPI
NTSTATUS
(*PFN_WDFLOOKASIDELISTCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
PWDF_OBJECT_ATTRIBUTES LookasideAttributes,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES MemoryAttributes,
_In_opt_
ULONG PoolTag,
_Out_
WDFLOOKASIDE* Lookaside
);
_Must_inspect_result_
_When_(PoolType == 1 || PoolType == 257, _IRQL_requires_max_(APC_LEVEL))
_When_(PoolType == 0 || PoolType == 256, _IRQL_requires_max_(DISPATCH_LEVEL))
NTSTATUS
FORCEINLINE
WdfLookasideListCreate(
_In_opt_
PWDF_OBJECT_ATTRIBUTES LookasideAttributes,
_In_
_When_(BufferSize == 0, __drv_reportError(BufferSize cannot be zero))
size_t BufferSize,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES MemoryAttributes,
_In_opt_
ULONG PoolTag,
_Out_
WDFLOOKASIDE* Lookaside
)
{
return ((PFN_WDFLOOKASIDELISTCREATE) WdfFunctions[WdfLookasideListCreateTableIndex])(WdfDriverGlobals, LookasideAttributes, BufferSize, PoolType, MemoryAttributes, PoolTag, Lookaside);
}
//
// WDF Function: WdfMemoryCreateFromLookaside
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFMEMORYCREATEFROMLOOKASIDE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFLOOKASIDE Lookaside,
_Out_
WDFMEMORY* Memory
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfMemoryCreateFromLookaside(
_In_
WDFLOOKASIDE Lookaside,
_Out_
WDFMEMORY* Memory
)
{
return ((PFN_WDFMEMORYCREATEFROMLOOKASIDE) WdfFunctions[WdfMemoryCreateFromLookasideTableIndex])(WdfDriverGlobals, Lookaside, Memory);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFMEMORY_H_

View file

@ -0,0 +1,130 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfminiport.h
Abstract:
Interfaces for WDF usage in a miniport environment
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 _WDFMINIPORT_H_
#define _WDFMINIPORT_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: WdfDeviceMiniportCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDEVICEMINIPORTCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDRIVER Driver,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_In_
PDEVICE_OBJECT DeviceObject,
_In_opt_
PDEVICE_OBJECT AttachedDeviceObject,
_In_opt_
PDEVICE_OBJECT Pdo,
_Out_
WDFDEVICE* Device
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDeviceMiniportCreate(
_In_
WDFDRIVER Driver,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_In_
PDEVICE_OBJECT DeviceObject,
_In_opt_
PDEVICE_OBJECT AttachedDeviceObject,
_In_opt_
PDEVICE_OBJECT Pdo,
_Out_
WDFDEVICE* Device
)
{
return ((PFN_WDFDEVICEMINIPORTCREATE) WdfFunctions[WdfDeviceMiniportCreateTableIndex])(WdfDriverGlobals, Driver, Attributes, DeviceObject, AttachedDeviceObject, Pdo, Device);
}
//
// WDF Function: WdfDriverMiniportUnload
//
typedef
WDFAPI
VOID
(*PFN_WDFDRIVERMINIPORTUNLOAD)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDRIVER Driver
);
VOID
FORCEINLINE
WdfDriverMiniportUnload(
_In_
WDFDRIVER Driver
)
{
((PFN_WDFDRIVERMINIPORTUNLOAD) WdfDriverMiniportUnloadOverride)(WdfDriverGlobals, Driver);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFMINIPORT_H_

View file

@ -0,0 +1,837 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfobject.h
Abstract:
This is the C header for driver frameworks objects
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 _WDFOBJECT_H_
#define _WDFOBJECT_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)
//
// Specifies the highest IRQL level allowed on callbacks
// to the device driver.
//
typedef enum _WDF_EXECUTION_LEVEL {
WdfExecutionLevelInvalid = 0x00,
WdfExecutionLevelInheritFromParent,
WdfExecutionLevelPassive,
WdfExecutionLevelDispatch,
} WDF_EXECUTION_LEVEL;
//
// Specifies the concurrency of callbacks to the device driver
//
typedef enum _WDF_SYNCHRONIZATION_SCOPE {
WdfSynchronizationScopeInvalid = 0x00,
WdfSynchronizationScopeInheritFromParent,
WdfSynchronizationScopeDevice,
WdfSynchronizationScopeQueue,
WdfSynchronizationScopeNone,
} WDF_SYNCHRONIZATION_SCOPE;
typedef
_Function_class_(EVT_WDF_OBJECT_CONTEXT_CLEANUP)
_IRQL_requires_same_
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
EVT_WDF_OBJECT_CONTEXT_CLEANUP(
_In_
WDFOBJECT Object
);
typedef EVT_WDF_OBJECT_CONTEXT_CLEANUP *PFN_WDF_OBJECT_CONTEXT_CLEANUP;
typedef
_Function_class_(EVT_WDF_OBJECT_CONTEXT_DESTROY)
_IRQL_requires_same_
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
EVT_WDF_OBJECT_CONTEXT_DESTROY(
_In_
WDFOBJECT Object
);
typedef EVT_WDF_OBJECT_CONTEXT_DESTROY *PFN_WDF_OBJECT_CONTEXT_DESTROY;
typedef const struct _WDF_OBJECT_CONTEXT_TYPE_INFO *PCWDF_OBJECT_CONTEXT_TYPE_INFO;
typedef struct _WDF_OBJECT_ATTRIBUTES {
//
// Size in bytes of this structure
//
ULONG Size;
//
// Function to call when the object is deleted
//
PFN_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanupCallback;
//
// Function to call when the objects memory is destroyed when the
// the last reference count goes to zero
//
PFN_WDF_OBJECT_CONTEXT_DESTROY EvtDestroyCallback;
//
// Execution level constraints for Object
//
WDF_EXECUTION_LEVEL ExecutionLevel;
//
// Synchronization level constraint for Object
//
WDF_SYNCHRONIZATION_SCOPE SynchronizationScope;
//
// Optional Parent Object
//
WDFOBJECT ParentObject;
//
// Overrides the size of the context allocated as specified by
// ContextTypeInfo->ContextSize
//
size_t ContextSizeOverride;
//
// Pointer to the type information to be associated with the object
//
PCWDF_OBJECT_CONTEXT_TYPE_INFO ContextTypeInfo;
} WDF_OBJECT_ATTRIBUTES, *PWDF_OBJECT_ATTRIBUTES;
VOID
FORCEINLINE
WDF_OBJECT_ATTRIBUTES_INIT(
_Out_ PWDF_OBJECT_ATTRIBUTES Attributes
)
{
RtlZeroMemory(Attributes, sizeof(WDF_OBJECT_ATTRIBUTES));
Attributes->Size = sizeof(WDF_OBJECT_ATTRIBUTES);
Attributes->ExecutionLevel = WdfExecutionLevelInheritFromParent;
Attributes->SynchronizationScope = WdfSynchronizationScopeInheritFromParent;
}
#define WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE(_attributes, _contexttype) \
(_attributes)->ContextTypeInfo = WDF_GET_CONTEXT_TYPE_INFO(_contexttype)->UniqueType
//
// VOID
// FORCEINLINE
// WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(
// PWDF_OBJECT_ATTRIBUTES Attributes,
// <typename>
// )
//
// NOTE: Do not put a ; at the end of the last line. This will require the
// caller to specify a ; after the call.
//
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype) \
WDF_OBJECT_ATTRIBUTES_INIT(_attributes); \
WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE(_attributes, _contexttype)
typedef
PCWDF_OBJECT_CONTEXT_TYPE_INFO
(__cdecl *PFN_GET_UNIQUE_CONTEXT_TYPE)(
VOID
);
//
// Since C does not have strong type checking we must invent our own
//
typedef struct _WDF_OBJECT_CONTEXT_TYPE_INFO {
//
// The size of this structure in bytes
//
ULONG Size;
//
// String representation of the context's type name, i.e. "DEVICE_CONTEXT"
//
PCHAR ContextName;
//
// The size of the context in bytes. This will be the size of the context
// associated with the handle unless
// WDF_OBJECT_ATTRIBUTES::ContextSizeOverride is specified.
//
size_t ContextSize;
//
// If NULL, this structure is the unique type identifier for the context
// type. If != NULL, the UniqueType pointer value is the unique type id
// for the context type.
//
PCWDF_OBJECT_CONTEXT_TYPE_INFO UniqueType;
//
// Function pointer to retrieve the context type information structure
// pointer from the provider of the context type. This function is invoked
// by the client driver's entry point by the KMDF stub after all class
// drivers are loaded and before DriverEntry is invoked.
//
PFN_GET_UNIQUE_CONTEXT_TYPE EvtDriverGetUniqueContextType;
} WDF_OBJECT_CONTEXT_TYPE_INFO, *PWDF_OBJECT_CONTEXT_TYPE_INFO;
//
// Converts a type name a unique name in which we can retrieve type specific
// information.
//
#define WDF_TYPE_NAME_TO_TYPE_INFO(_contexttype) \
_WDF_ ## _contexttype ## _TYPE_INFO
//
// Converts a type name a unique name to the structure which will initialize
// it through an external component.
//
#define WDF_TYPE_NAME_TO_EXTERNAL_INIT(_contexttype) \
_WDF_ ## _contexttype ## _EXTERNAL_INIT
#define WDF_TYPE_NAME_TO_EXTERNAL_INIT_FUNCTION(_contexttype) \
_contexttype ## _EXTERNAL_INIT_FUNCTION
//
// Returns an address to the type information representing this typename
//
#define WDF_GET_CONTEXT_TYPE_INFO(_contexttype) \
(&WDF_TYPE_NAME_TO_TYPE_INFO(_contexttype))
//
// Used to help generate our own usable pointer to the type typedef. For instance,
// a call as WDF_TYPE_NAME_POINTER_TYPE(DEVICE_CONTEXT) would generate:
//
// WDF_POINTER_TYPE_DEVICE_CONTEXT
//
// which would be the equivalent of DEVICE_CONTEXT*
//
#define WDF_TYPE_NAME_POINTER_TYPE(_contexttype) \
WDF_POINTER_TYPE_ ## _contexttype
//
// Declares a typename so that in can be associated with a handle. This will
// use the type's name with a _ prepended as the "friendly name" (which results
// in the autogenerated casting function being named WdfObjectGet_<typename>, ie
// WdfObjectGet_DEVICE_CONTEXT. See WDF_DECLARE_CONTEXT_TYPE_WITH_NAME for
// more details on what is generated.
//
#define WDF_DECLARE_CONTEXT_TYPE(_contexttype) \
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(_contexttype, WdfObjectGet_ ## _contexttype)
//
// WDF_DECLARE_CONTEXT_TYPE_WITH_NAME performs the following 3 tasks
//
// 1) declare a typedef for the context type so that its pointer type can be
// referred to later
// 2) declare and initialize global structure that represents the type
// information for this
// context type
// 3) declare and implement a function named _castingfunction
// which does the proper type conversion.
//
// WDF_DECLARE_TYPE_AND_GLOBALS implements 1 & 2
// WDF_DECLARE_CASTING_FUNCTION implements 3
//
// For instance, the invocation of
// WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, WdfDeviceGetContext)
// would result in the following being generated:
//
// typedef DEVICE_CONTEXT* WDF_POINTER_TYPE_DEVICE_CONTEXT;
//
// extern const __declspec(selectany) WDF_OBJECT_CONTEXT_TYPE_INFO _WDF_DEVICE_CONTEXT_TYPE_INFO =
// {
// sizeof(WDF_OBJECT_CONTEXT_TYPE_INFO),
// "DEVICE_CONTEXT",
// sizeof(DEVICE_CONTEXT),
// };
//
// WDF_POINTER_TYPE_DEVICE_CONTEXT
// WdfDeviceGetContext(
// WDFOBJECT Handle
// )
// {
// return (WDF_POINTER_TYPE_DEVICE_CONTEXT)
// WdfObjectGetTypedContextWorker(
// Handle,
// (&_WDF_DEVICE_CONTEXT_TYPE_INFO)->UniqueType
// );
// }
//
#define WDF_TYPE_INIT_BASE_SECTION_NAME ".kmdftypeinit"
#define WDF_TYPE_INIT_SECTION_NAME ".kmdftypeinit$b"
//
// .data is the default section that global data would be placed into. We
// cannot just use ".data" in __declspec(allocate()) without first declaring
// it in a #pragma section() even though it is a default section name.
//
#ifndef WDF_TYPE_DEFAULT_SECTION_NAME
#define WDF_TYPE_DEFAULT_SECTION_NAME ".data"
#endif // WDF_TYPE_DEFAULT_SECTION_NAME
#pragma section(WDF_TYPE_INIT_SECTION_NAME, read, write)
#pragma section(WDF_TYPE_DEFAULT_SECTION_NAME)
#define WDF_DECLARE_TYPE_AND_GLOBALS(_contexttype, _UniqueType, _GetUniqueType, _section)\
\
typedef _contexttype* WDF_TYPE_NAME_POINTER_TYPE(_contexttype); \
\
WDF_EXTERN_C \
__declspec(allocate( _section )) \
__declspec(selectany) \
extern const WDF_OBJECT_CONTEXT_TYPE_INFO \
WDF_TYPE_NAME_TO_TYPE_INFO(_contexttype) = \
{ \
sizeof(WDF_OBJECT_CONTEXT_TYPE_INFO), \
#_contexttype, \
sizeof(_contexttype), \
_UniqueType, \
_GetUniqueType, \
}; \
#define WDF_DECLARE_CASTING_FUNCTION(_contexttype, _castingfunction) \
\
WDF_EXTERN_C \
__drv_aliasesMem \
WDF_TYPE_NAME_POINTER_TYPE(_contexttype) \
FORCEINLINE \
_castingfunction( \
_In_ WDFOBJECT Handle \
) \
{ \
return (WDF_TYPE_NAME_POINTER_TYPE(_contexttype)) \
WdfObjectGetTypedContextWorker( \
Handle, \
WDF_GET_CONTEXT_TYPE_INFO(_contexttype)->UniqueType \
); \
}
#define WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(_contexttype, _castingfunction) \
\
WDF_DECLARE_TYPE_AND_GLOBALS( \
_contexttype, \
WDF_GET_CONTEXT_TYPE_INFO(_contexttype), \
NULL, \
WDF_TYPE_DEFAULT_SECTION_NAME) \
\
WDF_DECLARE_CASTING_FUNCTION(_contexttype, _castingfunction)
//
// WDF_DECLARE_SHARED_CONTEXT_TYPE_WITH_NAME is the same as
// WDF_DECLARE_CONTEXT_TYPE_WITH_NAME with respect to the types and structures
// that are created and initialized. The casting function is different in that
// it passes the UniqueType to WdfObjectGetTypedContextWorker() instead of the
// global type structure created. It also creates a structure which will contain
// an initialization function which will be invoked before DriverEntry() is
// called.
//
// It is the responsibilty of the component exporting the unique type to define
// and implement the function which will return the unique type. The format of
// the define is:
//
// #define _contexttype ## _EXTERNAL_INIT_FUNCTION
//
// (e.g. #define DEVICE_CONTEXT_EXTERNALINIT_FUNCTION DeviceContextInit()
// for a type of DEVICE_CONTEXT)
//
#define WDF_DECLARE_SHARED_CONTEXT_TYPE_WITH_NAME(_contexttype, _castingfunction) \
\
WDF_DECLARE_TYPE_AND_GLOBALS( \
_contexttype, \
NULL, \
WDF_TYPE_NAME_TO_EXTERNAL_INIT_FUNCTION(_contexttype), \
WDF_TYPE_INIT_SECTION_NAME) \
\
WDF_DECLARE_CASTING_FUNCTION(_contexttype, _castingfunction)
//
// Generic conversion macro from handle to type. This should be used if the
// autogenerated conversion function does not suite the programmers calling style.
//
// The type parameter should be name of the type (e.g. DEVICE_CONTEXT), not the
// name of the pointer to the type (PDEVICE_CONTEXT).
//
// Example call:
//
// WDFDEVICE device;
// PDEVICE_CONTEXT pContext;
//
// pContext = WdfObjectGetTypedContext(device, DEVICE_CONTEXT);
//
//
#define WdfObjectGetTypedContext(handle, type) \
(type*) \
WdfObjectGetTypedContextWorker( \
(WDFOBJECT) handle, \
WDF_GET_CONTEXT_TYPE_INFO(type)->UniqueType \
)
//
// Converts a type name to a unique context name.
//
#define WDF_CUSTOM_TYPE_CONTEXT_NAME(_type) \
WdfCustomType_ ## _type
//
// Converts a type name to a unique function name to retrieve the type info context.
//
#define WDF_GET_CUSTOM_TYPE_FUNCTION_NAME(_type) \
WdfObjectGetCustomType_ ## _type
//
// Converts a type name to a unique function name to add the type info context.
//
#define WDF_ADD_CUSTOM_TYPE_FUNCTION_NAME(_type) \
WdfObjectAddCustomType_ ## _type
//
// Core structure for supporting custom types, see macros below.
//
typedef struct _WDF_CUSTOM_TYPE_CONTEXT {
ULONG Size;
ULONG_PTR Data;
} WDF_CUSTOM_TYPE_CONTEXT, *PWDF_CUSTOM_TYPE_CONTEXT;
//
// Declares a context and a function to handle the specified type.
//
// NOTE: Do not put a ; at the end of the last line. This will require the
// caller to specify a ; after the call.
//
#define WDF_DECLARE_CUSTOM_TYPE(_type) \
\
typedef WDF_CUSTOM_TYPE_CONTEXT WDF_CUSTOM_TYPE_CONTEXT_NAME(_type); \
\
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME( \
WDF_CUSTOM_TYPE_CONTEXT_NAME(_type), \
WDF_GET_CUSTOM_TYPE_FUNCTION_NAME(_type) \
); \
\
WDF_EXTERN_C \
NTSTATUS \
FORCEINLINE \
WDF_ADD_CUSTOM_TYPE_FUNCTION_NAME(_type)( \
_In_ WDFOBJECT Handle, \
_In_opt_ ULONG_PTR Data, \
_In_opt_ PFN_WDF_OBJECT_CONTEXT_CLEANUP EvtCleanupCallback, \
_In_opt_ PFN_WDF_OBJECT_CONTEXT_DESTROY EvtDestroyCallback \
) \
{ \
NTSTATUS status; \
WDF_OBJECT_ATTRIBUTES attributes; \
WDF_CUSTOM_TYPE_CONTEXT_NAME(_type)* typeInfo; \
\
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE( \
&attributes, \
WDF_CUSTOM_TYPE_CONTEXT_NAME(_type)); \
\
attributes.EvtCleanupCallback = EvtCleanupCallback; \
attributes.EvtDestroyCallback = EvtDestroyCallback; \
\
status = WdfObjectAllocateContext(Handle, \
&attributes, \
(PVOID*)&typeInfo); \
if (NT_SUCCESS(status)) { \
typeInfo->Size = sizeof(WDF_CUSTOM_TYPE_CONTEXT_NAME(_type)); \
typeInfo->Data = Data; \
} \
\
return status; \
}
//
// BOOLEAN
// WdfObjectIsCustomType(
// _In_ _handle, // WDFOBJECT handle.
// _In_ _type // Type.
// )
//
// NOTE: Do not put a ; at the end of the last line. This will require the
// caller to specify a ; after the call.
//
#define WdfObjectIsCustomType(_handle, _type) \
(WdfObjectGetTypedContext(_handle, WDF_CUSTOM_TYPE_CONTEXT_NAME(_type)) \
== NULL ? FALSE : TRUE)
//
// NTSTATUS
// WdfObjectAddCustomTypeWithData(
// _In_ _handle, // WDFOBJECT handle.
// _In_ _type, // Type.
// _In_opt_ _data, // Type's data.
// _In_opt_ _cleanup, // EvtCleanupCallback
// _In_opt_ _destroy // EvtDestroyCallback
// )
//
// NOTE: Do not put a ; at the end of the last line. This will require the
// caller to specify a ; after the call.
//
#define WdfObjectAddCustomTypeWithData(_handle, _type, _data, _cleanup, _destroy) \
WDF_ADD_CUSTOM_TYPE_FUNCTION_NAME(_type)(_handle, _data, _cleanup, _destroy)
//
// NTSTATUS
// WdfObjectAddCustomType(
// _In_ _handle, // WDFOBJECT handle.
// _In_ _type // Type.
// )
//
// NOTE: Do not put a ; at the end of the last line. This will require the
// caller to specify a ; after the call.
//
#define WdfObjectAddCustomType(_handle, _type) \
WdfObjectAddCustomTypeWithData(_handle, _type, 0, NULL, NULL)
//
// ULONG_PTR
// WdfObjectGetCustomTypeData(
// _In_ _handle, // WDFOBJECT handle.
// _In_ _type // Type.
// )
//
// NOTE: Do not put a ; at the end of the last line. This will require the
// caller to specify a ; after the call.
//
#define WdfObjectGetCustomTypeData(_handle, _type) \
(WDF_GET_CUSTOM_TYPE_FUNCTION_NAME(_type)(_handle)->Data)
//
// WDF Function: WdfObjectGetTypedContextWorker
//
typedef
WDFAPI
PVOID
(FASTCALL *PFN_WDFOBJECTGETTYPEDCONTEXTWORKER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFOBJECT Handle,
_In_
PCWDF_OBJECT_CONTEXT_TYPE_INFO TypeInfo
);
PVOID
FORCEINLINE
WdfObjectGetTypedContextWorker(
_In_
WDFOBJECT Handle,
_In_
PCWDF_OBJECT_CONTEXT_TYPE_INFO TypeInfo
)
{
return ((PFN_WDFOBJECTGETTYPEDCONTEXTWORKER) WdfFunctions[WdfObjectGetTypedContextWorkerTableIndex])(WdfDriverGlobals, Handle, TypeInfo);
}
//
// WDF Function: WdfObjectAllocateContext
//
typedef
WDFAPI
NTSTATUS
(*PFN_WDFOBJECTALLOCATECONTEXT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFOBJECT Handle,
_In_
PWDF_OBJECT_ATTRIBUTES ContextAttributes,
_Outptr_opt_
PVOID* Context
);
NTSTATUS
FORCEINLINE
WdfObjectAllocateContext(
_In_
WDFOBJECT Handle,
_In_
PWDF_OBJECT_ATTRIBUTES ContextAttributes,
_Outptr_opt_
PVOID* Context
)
{
return ((PFN_WDFOBJECTALLOCATECONTEXT) WdfFunctions[WdfObjectAllocateContextTableIndex])(WdfDriverGlobals, Handle, ContextAttributes, Context);
}
//
// WDF Function: WdfObjectContextGetObject
//
typedef
WDFAPI
WDFOBJECT
(FASTCALL *PFN_WDFOBJECTCONTEXTGETOBJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PVOID ContextPointer
);
WDFOBJECT
FORCEINLINE
WdfObjectContextGetObject(
_In_
PVOID ContextPointer
)
{
return ((PFN_WDFOBJECTCONTEXTGETOBJECT) WdfFunctions[WdfObjectContextGetObjectTableIndex])(WdfDriverGlobals, ContextPointer);
}
//
// WDF Function: WdfObjectReferenceActual
//
typedef
WDFAPI
VOID
(*PFN_WDFOBJECTREFERENCEACTUAL)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFOBJECT Handle,
_In_opt_
PVOID Tag,
_In_
LONG Line,
_In_z_
PCHAR File
);
VOID
FORCEINLINE
WdfObjectReferenceActual(
_In_
WDFOBJECT Handle,
_In_opt_
PVOID Tag,
_In_
LONG Line,
_In_z_
PCHAR File
)
{
((PFN_WDFOBJECTREFERENCEACTUAL) WdfFunctions[WdfObjectReferenceActualTableIndex])(WdfDriverGlobals, Handle, Tag, Line, File);
}
//
// WDF Function: WdfObjectDereferenceActual
//
typedef
WDFAPI
VOID
(*PFN_WDFOBJECTDEREFERENCEACTUAL)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFOBJECT Handle,
_In_opt_
PVOID Tag,
_In_
LONG Line,
_In_z_
PCHAR File
);
VOID
FORCEINLINE
WdfObjectDereferenceActual(
_In_
WDFOBJECT Handle,
_In_opt_
PVOID Tag,
_In_
LONG Line,
_In_z_
PCHAR File
)
{
((PFN_WDFOBJECTDEREFERENCEACTUAL) WdfFunctions[WdfObjectDereferenceActualTableIndex])(WdfDriverGlobals, Handle, Tag, Line, File);
}
//
// WDF Function: WdfObjectCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFOBJECTCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFOBJECT* Object
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfObjectCreate(
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFOBJECT* Object
)
{
return ((PFN_WDFOBJECTCREATE) WdfFunctions[WdfObjectCreateTableIndex])(WdfDriverGlobals, Attributes, Object);
}
//
// WDF Function: WdfObjectDelete
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFOBJECTDELETE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFOBJECT Object
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfObjectDelete(
_In_
WDFOBJECT Object
)
{
((PFN_WDFOBJECTDELETE) WdfFunctions[WdfObjectDeleteTableIndex])(WdfDriverGlobals, Object);
}
//
// WDF Function: WdfObjectQuery
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFOBJECTQUERY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFOBJECT Object,
_In_
CONST GUID* Guid,
_In_
ULONG QueryBufferLength,
_Out_writes_bytes_(QueryBufferLength)
PVOID QueryBuffer
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfObjectQuery(
_In_
WDFOBJECT Object,
_In_
CONST GUID* Guid,
_In_
ULONG QueryBufferLength,
_Out_writes_bytes_(QueryBufferLength)
PVOID QueryBuffer
)
{
return ((PFN_WDFOBJECTQUERY) WdfFunctions[WdfObjectQueryTableIndex])(WdfDriverGlobals, Object, Guid, QueryBufferLength, QueryBuffer);
}
//
// Reference an object
//
// VOID
// WdfObjectReference(
// _In_ WDFOBJECT Handle
// );
//
// VOID
// WdfObjectReferenceWithTag(
// _In_ WDFOBJECT Handle,
// _In_ PVOID Tag
// );
//
#define WdfObjectReference(Handle) \
WdfObjectReferenceWithTag(Handle, NULL)
#define WdfObjectReferenceWithTag(Handle, Tag) \
WdfObjectReferenceActual(Handle, Tag, __LINE__, __FILE__)
//
// Dereference an object. If an object allows for a client explicitly deleting
// it, call WdfObjectDelete. Do not use WdfObjectDereferenceXxx to delete an
// object.
//
// VOID
// WdfObjectDereference(
// _In_ WDFOBJECT Handle
// );
//
// VOID
// WdfObjectDereferenceWithTag(
// _In_ WDFOBJECT Handle
// _In_ PVOID Tag
// );
//
#define WdfObjectDereference(Handle) \
WdfObjectDereferenceWithTag(Handle, NULL)
#define WdfObjectDereferenceWithTag(Handle, Tag) \
WdfObjectDereferenceActual(Handle, Tag, __LINE__, __FILE__)
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFOBJECT_H_

View file

@ -0,0 +1,799 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfPdo.h
Abstract:
This is the interface to the PDO 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 _WDFPDO_H_
#define _WDFPDO_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_RESOURCES_QUERY)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_RESOURCES_QUERY(
_In_
WDFDEVICE Device,
_In_
WDFCMRESLIST Resources
);
typedef EVT_WDF_DEVICE_RESOURCES_QUERY *PFN_WDF_DEVICE_RESOURCES_QUERY;
typedef
_Function_class_(EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY(
_In_
WDFDEVICE Device,
_In_
WDFIORESREQLIST IoResourceRequirementsList
);
typedef EVT_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY *PFN_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY;
typedef
_Function_class_(EVT_WDF_DEVICE_EJECT)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_EJECT(
_In_
WDFDEVICE Device
);
typedef EVT_WDF_DEVICE_EJECT *PFN_WDF_DEVICE_EJECT;
typedef
_Function_class_(EVT_WDF_DEVICE_SET_LOCK)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_SET_LOCK(
_In_
WDFDEVICE Device,
_In_
BOOLEAN IsLocked
);
typedef EVT_WDF_DEVICE_SET_LOCK *PFN_WDF_DEVICE_SET_LOCK;
typedef
_Function_class_(EVT_WDF_DEVICE_ENABLE_WAKE_AT_BUS)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_ENABLE_WAKE_AT_BUS(
_In_
WDFDEVICE Device,
_In_
SYSTEM_POWER_STATE PowerState
);
typedef EVT_WDF_DEVICE_ENABLE_WAKE_AT_BUS *PFN_WDF_DEVICE_ENABLE_WAKE_AT_BUS;
typedef
_Function_class_(EVT_WDF_DEVICE_DISABLE_WAKE_AT_BUS)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
EVT_WDF_DEVICE_DISABLE_WAKE_AT_BUS(
_In_
WDFDEVICE Device
);
typedef EVT_WDF_DEVICE_DISABLE_WAKE_AT_BUS *PFN_WDF_DEVICE_DISABLE_WAKE_AT_BUS;
typedef
_Function_class_(EVT_WDF_DEVICE_REPORTED_MISSING)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
EVT_WDF_DEVICE_REPORTED_MISSING(
_In_
WDFDEVICE Device
);
typedef EVT_WDF_DEVICE_REPORTED_MISSING *PFN_WDF_DEVICE_REPORTED_MISSING;
typedef struct _WDF_PDO_EVENT_CALLBACKS {
//
// The size of this structure in bytes
//
ULONG Size;
//
// Called in response to IRP_MN_QUERY_RESOURCES
//
PFN_WDF_DEVICE_RESOURCES_QUERY EvtDeviceResourcesQuery;
//
// Called in response to IRP_MN_QUERY_RESOURCE_REQUIREMENTS
//
PFN_WDF_DEVICE_RESOURCE_REQUIREMENTS_QUERY EvtDeviceResourceRequirementsQuery;
//
// Called in response to IRP_MN_EJECT
//
PFN_WDF_DEVICE_EJECT EvtDeviceEject;
//
// Called in response to IRP_MN_SET_LOCK
//
PFN_WDF_DEVICE_SET_LOCK EvtDeviceSetLock;
//
// Called in response to the power policy owner sending a wait wake to the
// PDO. Bus generic arming shoulding occur here.
//
PFN_WDF_DEVICE_ENABLE_WAKE_AT_BUS EvtDeviceEnableWakeAtBus;
//
// Called in response to the power policy owner sending a wait wake to the
// PDO. Bus generic disarming shoulding occur here.
//
PFN_WDF_DEVICE_DISABLE_WAKE_AT_BUS EvtDeviceDisableWakeAtBus;
//
// Called when reporting the PDO missing to PnP manager in response to
// IRP_MN_QUERY_DEVICE_RELATIONS for Bus Relations.
//
PFN_WDF_DEVICE_REPORTED_MISSING EvtDeviceReportedMissing;
} WDF_PDO_EVENT_CALLBACKS, *PWDF_PDO_EVENT_CALLBACKS;
VOID
FORCEINLINE
WDF_PDO_EVENT_CALLBACKS_INIT(
_Out_ PWDF_PDO_EVENT_CALLBACKS Callbacks
)
{
RtlZeroMemory(Callbacks, sizeof(WDF_PDO_EVENT_CALLBACKS));
Callbacks->Size = sizeof(WDF_PDO_EVENT_CALLBACKS);
}
//
// WDF Function: WdfPdoInitAllocate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
PWDFDEVICE_INIT
(*PFN_WDFPDOINITALLOCATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE ParentDevice
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
PWDFDEVICE_INIT
FORCEINLINE
WdfPdoInitAllocate(
_In_
WDFDEVICE ParentDevice
)
{
return ((PFN_WDFPDOINITALLOCATE) WdfFunctions[WdfPdoInitAllocateTableIndex])(WdfDriverGlobals, ParentDevice);
}
//
// WDF Function: WdfPdoInitSetEventCallbacks
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFPDOINITSETEVENTCALLBACKS)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_PDO_EVENT_CALLBACKS DispatchTable
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfPdoInitSetEventCallbacks(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PWDF_PDO_EVENT_CALLBACKS DispatchTable
)
{
((PFN_WDFPDOINITSETEVENTCALLBACKS) WdfFunctions[WdfPdoInitSetEventCallbacksTableIndex])(WdfDriverGlobals, DeviceInit, DispatchTable);
}
//
// WDF Function: WdfPdoInitAssignDeviceID
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOINITASSIGNDEVICEID)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING DeviceID
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoInitAssignDeviceID(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING DeviceID
)
{
return ((PFN_WDFPDOINITASSIGNDEVICEID) WdfFunctions[WdfPdoInitAssignDeviceIDTableIndex])(WdfDriverGlobals, DeviceInit, DeviceID);
}
//
// WDF Function: WdfPdoInitAssignInstanceID
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOINITASSIGNINSTANCEID)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING InstanceID
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoInitAssignInstanceID(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING InstanceID
)
{
return ((PFN_WDFPDOINITASSIGNINSTANCEID) WdfFunctions[WdfPdoInitAssignInstanceIDTableIndex])(WdfDriverGlobals, DeviceInit, InstanceID);
}
//
// WDF Function: WdfPdoInitAddHardwareID
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOINITADDHARDWAREID)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING HardwareID
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoInitAddHardwareID(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING HardwareID
)
{
return ((PFN_WDFPDOINITADDHARDWAREID) WdfFunctions[WdfPdoInitAddHardwareIDTableIndex])(WdfDriverGlobals, DeviceInit, HardwareID);
}
//
// WDF Function: WdfPdoInitAddCompatibleID
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOINITADDCOMPATIBLEID)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING CompatibleID
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoInitAddCompatibleID(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING CompatibleID
)
{
return ((PFN_WDFPDOINITADDCOMPATIBLEID) WdfFunctions[WdfPdoInitAddCompatibleIDTableIndex])(WdfDriverGlobals, DeviceInit, CompatibleID);
}
//
// WDF Function: WdfPdoInitAssignContainerID
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOINITASSIGNCONTAINERID)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING ContainerID
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoInitAssignContainerID(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING ContainerID
)
{
return ((PFN_WDFPDOINITASSIGNCONTAINERID) WdfFunctions[WdfPdoInitAssignContainerIDTableIndex])(WdfDriverGlobals, DeviceInit, ContainerID);
}
//
// WDF Function: WdfPdoInitAddDeviceText
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOINITADDDEVICETEXT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING DeviceDescription,
_In_
PCUNICODE_STRING DeviceLocation,
_In_
LCID LocaleId
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoInitAddDeviceText(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
PCUNICODE_STRING DeviceDescription,
_In_
PCUNICODE_STRING DeviceLocation,
_In_
LCID LocaleId
)
{
return ((PFN_WDFPDOINITADDDEVICETEXT) WdfFunctions[WdfPdoInitAddDeviceTextTableIndex])(WdfDriverGlobals, DeviceInit, DeviceDescription, DeviceLocation, LocaleId);
}
//
// WDF Function: WdfPdoInitSetDefaultLocale
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFPDOINITSETDEFAULTLOCALE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
LCID LocaleId
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfPdoInitSetDefaultLocale(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
LCID LocaleId
)
{
((PFN_WDFPDOINITSETDEFAULTLOCALE) WdfFunctions[WdfPdoInitSetDefaultLocaleTableIndex])(WdfDriverGlobals, DeviceInit, LocaleId);
}
//
// WDF Function: WdfPdoInitAssignRawDevice
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOINITASSIGNRAWDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
CONST GUID* DeviceClassGuid
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoInitAssignRawDevice(
_In_
PWDFDEVICE_INIT DeviceInit,
_In_
CONST GUID* DeviceClassGuid
)
{
return ((PFN_WDFPDOINITASSIGNRAWDEVICE) WdfFunctions[WdfPdoInitAssignRawDeviceTableIndex])(WdfDriverGlobals, DeviceInit, DeviceClassGuid);
}
//
// WDF Function: WdfPdoInitAllowForwardingRequestToParent
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFPDOINITALLOWFORWARDINGREQUESTTOPARENT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDFDEVICE_INIT DeviceInit
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfPdoInitAllowForwardingRequestToParent(
_In_
PWDFDEVICE_INIT DeviceInit
)
{
((PFN_WDFPDOINITALLOWFORWARDINGREQUESTTOPARENT) WdfFunctions[WdfPdoInitAllowForwardingRequestToParentTableIndex])(WdfDriverGlobals, DeviceInit);
}
//
// WDF Function: WdfPdoMarkMissing
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOMARKMISSING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoMarkMissing(
_In_
WDFDEVICE Device
)
{
return ((PFN_WDFPDOMARKMISSING) WdfFunctions[WdfPdoMarkMissingTableIndex])(WdfDriverGlobals, Device);
}
//
// WDF Function: WdfPdoRequestEject
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFPDOREQUESTEJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfPdoRequestEject(
_In_
WDFDEVICE Device
)
{
((PFN_WDFPDOREQUESTEJECT) WdfFunctions[WdfPdoRequestEjectTableIndex])(WdfDriverGlobals, Device);
}
//
// WDF Function: WdfPdoGetParent
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFDEVICE
(*PFN_WDFPDOGETPARENT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFDEVICE
FORCEINLINE
WdfPdoGetParent(
_In_
WDFDEVICE Device
)
{
return ((PFN_WDFPDOGETPARENT) WdfFunctions[WdfPdoGetParentTableIndex])(WdfDriverGlobals, Device);
}
//
// WDF Function: WdfPdoRetrieveIdentificationDescription
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDORETRIEVEIDENTIFICATIONDESCRIPTION)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_Inout_
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoRetrieveIdentificationDescription(
_In_
WDFDEVICE Device,
_Inout_
PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription
)
{
return ((PFN_WDFPDORETRIEVEIDENTIFICATIONDESCRIPTION) WdfFunctions[WdfPdoRetrieveIdentificationDescriptionTableIndex])(WdfDriverGlobals, Device, IdentificationDescription);
}
//
// WDF Function: WdfPdoRetrieveAddressDescription
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDORETRIEVEADDRESSDESCRIPTION)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_Inout_
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoRetrieveAddressDescription(
_In_
WDFDEVICE Device,
_Inout_
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription
)
{
return ((PFN_WDFPDORETRIEVEADDRESSDESCRIPTION) WdfFunctions[WdfPdoRetrieveAddressDescriptionTableIndex])(WdfDriverGlobals, Device, AddressDescription);
}
//
// WDF Function: WdfPdoUpdateAddressDescription
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOUPDATEADDRESSDESCRIPTION)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_Inout_
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoUpdateAddressDescription(
_In_
WDFDEVICE Device,
_Inout_
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER AddressDescription
)
{
return ((PFN_WDFPDOUPDATEADDRESSDESCRIPTION) WdfFunctions[WdfPdoUpdateAddressDescriptionTableIndex])(WdfDriverGlobals, Device, AddressDescription);
}
//
// WDF Function: WdfPdoAddEjectionRelationsPhysicalDevice
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFPDOADDEJECTIONRELATIONSPHYSICALDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_In_
PDEVICE_OBJECT PhysicalDevice
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfPdoAddEjectionRelationsPhysicalDevice(
_In_
WDFDEVICE Device,
_In_
PDEVICE_OBJECT PhysicalDevice
)
{
return ((PFN_WDFPDOADDEJECTIONRELATIONSPHYSICALDEVICE) WdfFunctions[WdfPdoAddEjectionRelationsPhysicalDeviceTableIndex])(WdfDriverGlobals, Device, PhysicalDevice);
}
//
// WDF Function: WdfPdoRemoveEjectionRelationsPhysicalDevice
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFPDOREMOVEEJECTIONRELATIONSPHYSICALDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_In_
PDEVICE_OBJECT PhysicalDevice
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfPdoRemoveEjectionRelationsPhysicalDevice(
_In_
WDFDEVICE Device,
_In_
PDEVICE_OBJECT PhysicalDevice
)
{
((PFN_WDFPDOREMOVEEJECTIONRELATIONSPHYSICALDEVICE) WdfFunctions[WdfPdoRemoveEjectionRelationsPhysicalDeviceTableIndex])(WdfDriverGlobals, Device, PhysicalDevice);
}
//
// WDF Function: WdfPdoClearEjectionRelationsDevices
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFPDOCLEAREJECTIONRELATIONSDEVICES)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfPdoClearEjectionRelationsDevices(
_In_
WDFDEVICE Device
)
{
((PFN_WDFPDOCLEAREJECTIONRELATIONSDEVICES) WdfFunctions[WdfPdoClearEjectionRelationsDevicesTableIndex])(WdfDriverGlobals, Device);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFPDO_H_

View file

@ -0,0 +1,61 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfpool.h
Abstract:
This module contains pool API's
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 _WDFPOOL_H_
#define _WDFPOOL_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)
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFPOOL_H_

View file

@ -0,0 +1,215 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfQueryInterface.h
Abstract:
This file contains the DDIs for handling query interface
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 _WDFQUERYINTERFACE_H_
#define _WDFQUERYINTERFACE_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_PROCESS_QUERY_INTERFACE_REQUEST)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST(
_In_
WDFDEVICE Device,
_In_
LPGUID InterfaceType,
_Inout_
PINTERFACE ExposedInterface,
_Inout_opt_
PVOID ExposedInterfaceSpecificData
);
typedef EVT_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST *PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST;
typedef struct _WDF_QUERY_INTERFACE_CONFIG {
//
// Size of this structure in bytes.
//
ULONG Size;
//
// Interface to be returned to the caller. Optional if BehaviorType is set
// to WdfQueryInterfaceTypePassThrough or ImportInterface is set to TRUE.
//
PINTERFACE Interface;
//
// The GUID identifying the interface
//
CONST GUID * InterfaceType;
//
// Valid only for PDOs. The framework will allocate a new request and
// forward it down the parent's device stack.
//
BOOLEAN SendQueryToParentStack;
//
// Driver supplied callback which is called after some basic interface
// validation has been performed (size, version, and guid checking). This
// is an optional parameter and may be NULL unless ImportInterface is
// specified.
//
// If the callback returns !NT_SUCCESS, this error will be returned to the
// caller and the query interface will fail.
//
// In this callback, the caller is free to modify the ExposedInterface in
// any manner of its choosing. For instance, the callback may change any
// field in the interface. The callback may also alloate a dynamic context
// to be associated with the interface; the InterfaceReference and
// InterfaceDereference functions may also be overridden.
//
// If ImportInterface is set to TRUE, then this is a required field and the
// callback must initialize the interface (the framework will leave the
// ExposedInterface buffer exactly as it received it) since the framework
// has no way of knowing which fields to fill in and which to leave alone.
//
PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST EvtDeviceProcessQueryInterfaceRequest;
//
// If TRUE, the interface provided by the caller contains data that the
// driver is interested in. By setting to this field to TRUE, the
// EvtDeviceProcessQueryInterfaceRequest callback must initialize the
// ExposedInterface.
//
// If FALSE, the entire ExposedInterface is initialized through a memory
// copy before the EvtDeviceProcessQueryInterfaceRequest is called.
//
BOOLEAN ImportInterface;
} WDF_QUERY_INTERFACE_CONFIG, *PWDF_QUERY_INTERFACE_CONFIG;
VOID
FORCEINLINE
WDF_QUERY_INTERFACE_CONFIG_INIT(
_Out_ PWDF_QUERY_INTERFACE_CONFIG InterfaceConfig,
_In_opt_ PINTERFACE Interface,
_In_ CONST GUID* InterfaceType,
_In_opt_ PFN_WDF_DEVICE_PROCESS_QUERY_INTERFACE_REQUEST EvtDeviceProcessQueryInterfaceRequest
)
{
RtlZeroMemory(InterfaceConfig, sizeof(WDF_QUERY_INTERFACE_CONFIG));
InterfaceConfig->Size = sizeof(WDF_QUERY_INTERFACE_CONFIG);
InterfaceConfig->Interface = Interface;
InterfaceConfig->InterfaceType = InterfaceType;
InterfaceConfig->EvtDeviceProcessQueryInterfaceRequest =
EvtDeviceProcessQueryInterfaceRequest;
}
//
// WDF Function: WdfDeviceAddQueryInterface
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFDEVICEADDQUERYINTERFACE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_In_
PWDF_QUERY_INTERFACE_CONFIG InterfaceConfig
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfDeviceAddQueryInterface(
_In_
WDFDEVICE Device,
_In_
PWDF_QUERY_INTERFACE_CONFIG InterfaceConfig
)
{
return ((PFN_WDFDEVICEADDQUERYINTERFACE) WdfFunctions[WdfDeviceAddQueryInterfaceTableIndex])(WdfDriverGlobals, Device, InterfaceConfig);
}
//
// The following functions can be assigned to INTERFACE::InterfaceReference
// and INTERFACE::InterfaceDeference
//
// o WdfDeviceInterfaceReferenceNoOp
// o WdfDeviceInterfaceDereferenceNoOp
//
// Thes 2 functions do nothing when called. These are appropriate for
// interfaces which can be queried for and used independent of the PNP state of
// the WDFDEVICE the interface was retrieved from.
//
VOID
FORCEINLINE
WdfDeviceInterfaceReferenceNoOp(
_In_ PVOID Context
)
{
UNREFERENCED_PARAMETER(Context);
}
VOID
FORCEINLINE
WdfDeviceInterfaceDereferenceNoOp(
_In_ PVOID Context
)
{
UNREFERENCED_PARAMETER(Context);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFQUERYINTERFACE_H_

View file

@ -0,0 +1,737 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfRegistry.h
Abstract:
This is the interface to registry access.
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 _WDFREGISTRY_H_
#define _WDFREGISTRY_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)
#define WDF_REGKEY_DEVICE_SUBKEY 0
#define WDF_REGKEY_DRIVER_SUBKEY 0
//
// WDF Function: WdfRegistryOpenKey
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYOPENKEY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
WDFKEY ParentKey,
_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
WdfRegistryOpenKey(
_In_opt_
WDFKEY ParentKey,
_In_
PCUNICODE_STRING KeyName,
_In_
ACCESS_MASK DesiredAccess,
_In_opt_
PWDF_OBJECT_ATTRIBUTES KeyAttributes,
_Out_
WDFKEY* Key
)
{
return ((PFN_WDFREGISTRYOPENKEY) WdfFunctions[WdfRegistryOpenKeyTableIndex])(WdfDriverGlobals, ParentKey, KeyName, DesiredAccess, KeyAttributes, Key);
}
//
// WDF Function: WdfRegistryCreateKey
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYCREATEKEY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
WDFKEY ParentKey,
_In_
PCUNICODE_STRING KeyName,
_In_
ACCESS_MASK DesiredAccess,
_In_
ULONG CreateOptions,
_Out_opt_
PULONG CreateDisposition,
_In_opt_
PWDF_OBJECT_ATTRIBUTES KeyAttributes,
_Out_
WDFKEY* Key
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryCreateKey(
_In_opt_
WDFKEY ParentKey,
_In_
PCUNICODE_STRING KeyName,
_In_
ACCESS_MASK DesiredAccess,
_In_
ULONG CreateOptions,
_Out_opt_
PULONG CreateDisposition,
_In_opt_
PWDF_OBJECT_ATTRIBUTES KeyAttributes,
_Out_
WDFKEY* Key
)
{
return ((PFN_WDFREGISTRYCREATEKEY) WdfFunctions[WdfRegistryCreateKeyTableIndex])(WdfDriverGlobals, ParentKey, KeyName, DesiredAccess, CreateOptions, CreateDisposition, KeyAttributes, Key);
}
//
// WDF Function: WdfRegistryClose
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFREGISTRYCLOSE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfRegistryClose(
_In_
WDFKEY Key
)
{
((PFN_WDFREGISTRYCLOSE) WdfFunctions[WdfRegistryCloseTableIndex])(WdfDriverGlobals, Key);
}
//
// WDF Function: WdfRegistryWdmGetHandle
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
HANDLE
(*PFN_WDFREGISTRYWDMGETHANDLE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key
);
_IRQL_requires_max_(PASSIVE_LEVEL)
HANDLE
FORCEINLINE
WdfRegistryWdmGetHandle(
_In_
WDFKEY Key
)
{
return ((PFN_WDFREGISTRYWDMGETHANDLE) WdfFunctions[WdfRegistryWdmGetHandleTableIndex])(WdfDriverGlobals, Key);
}
//
// WDF Function: WdfRegistryRemoveKey
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYREMOVEKEY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryRemoveKey(
_In_
WDFKEY Key
)
{
return ((PFN_WDFREGISTRYREMOVEKEY) WdfFunctions[WdfRegistryRemoveKeyTableIndex])(WdfDriverGlobals, Key);
}
//
// WDF Function: WdfRegistryRemoveValue
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYREMOVEVALUE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryRemoveValue(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName
)
{
return ((PFN_WDFREGISTRYREMOVEVALUE) WdfFunctions[WdfRegistryRemoveValueTableIndex])(WdfDriverGlobals, Key, ValueName);
}
//
// WDF Function: WdfRegistryQueryValue
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYQUERYVALUE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG ValueLength,
_Out_writes_bytes_opt_( ValueLength)
PVOID Value,
_Out_opt_
PULONG ValueLengthQueried,
_Out_opt_
PULONG ValueType
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryQueryValue(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG ValueLength,
_Out_writes_bytes_opt_( ValueLength)
PVOID Value,
_Out_opt_
PULONG ValueLengthQueried,
_Out_opt_
PULONG ValueType
)
{
return ((PFN_WDFREGISTRYQUERYVALUE) WdfFunctions[WdfRegistryQueryValueTableIndex])(WdfDriverGlobals, Key, ValueName, ValueLength, Value, ValueLengthQueried, ValueType);
}
//
// WDF Function: WdfRegistryQueryMemory
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYQUERYMEMORY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES MemoryAttributes,
_Out_
WDFMEMORY* Memory,
_Out_opt_
PULONG ValueType
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryQueryMemory(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
_Strict_type_match_
POOL_TYPE PoolType,
_In_opt_
PWDF_OBJECT_ATTRIBUTES MemoryAttributes,
_Out_
WDFMEMORY* Memory,
_Out_opt_
PULONG ValueType
)
{
return ((PFN_WDFREGISTRYQUERYMEMORY) WdfFunctions[WdfRegistryQueryMemoryTableIndex])(WdfDriverGlobals, Key, ValueName, PoolType, MemoryAttributes, Memory, ValueType);
}
//
// WDF Function: WdfRegistryQueryMultiString
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYQUERYMULTISTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_opt_
PWDF_OBJECT_ATTRIBUTES StringsAttributes,
_In_
WDFCOLLECTION Collection
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryQueryMultiString(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_opt_
PWDF_OBJECT_ATTRIBUTES StringsAttributes,
_In_
WDFCOLLECTION Collection
)
{
return ((PFN_WDFREGISTRYQUERYMULTISTRING) WdfFunctions[WdfRegistryQueryMultiStringTableIndex])(WdfDriverGlobals, Key, ValueName, StringsAttributes, Collection);
}
//
// WDF Function: WdfRegistryQueryUnicodeString
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYQUERYUNICODESTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_Out_opt_
PUSHORT ValueByteLength,
_Inout_opt_
PUNICODE_STRING Value
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryQueryUnicodeString(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_Out_opt_
PUSHORT ValueByteLength,
_Inout_opt_
PUNICODE_STRING Value
)
{
return ((PFN_WDFREGISTRYQUERYUNICODESTRING) WdfFunctions[WdfRegistryQueryUnicodeStringTableIndex])(WdfDriverGlobals, Key, ValueName, ValueByteLength, Value);
}
//
// WDF Function: WdfRegistryQueryString
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYQUERYSTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
WDFSTRING String
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryQueryString(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
WDFSTRING String
)
{
return ((PFN_WDFREGISTRYQUERYSTRING) WdfFunctions[WdfRegistryQueryStringTableIndex])(WdfDriverGlobals, Key, ValueName, String);
}
//
// WDF Function: WdfRegistryQueryULong
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYQUERYULONG)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_Out_
PULONG Value
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryQueryULong(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_Out_
PULONG Value
)
{
return ((PFN_WDFREGISTRYQUERYULONG) WdfFunctions[WdfRegistryQueryULongTableIndex])(WdfDriverGlobals, Key, ValueName, Value);
}
//
// WDF Function: WdfRegistryAssignValue
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYASSIGNVALUE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG ValueType,
_In_
ULONG ValueLength,
_In_reads_( ValueLength)
PVOID Value
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryAssignValue(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG ValueType,
_In_
ULONG ValueLength,
_In_reads_( ValueLength)
PVOID Value
)
{
return ((PFN_WDFREGISTRYASSIGNVALUE) WdfFunctions[WdfRegistryAssignValueTableIndex])(WdfDriverGlobals, Key, ValueName, ValueType, ValueLength, Value);
}
//
// WDF Function: WdfRegistryAssignMemory
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYASSIGNMEMORY)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG ValueType,
_In_
WDFMEMORY Memory,
_In_opt_
PWDFMEMORY_OFFSET MemoryOffsets
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryAssignMemory(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG ValueType,
_In_
WDFMEMORY Memory,
_In_opt_
PWDFMEMORY_OFFSET MemoryOffsets
)
{
return ((PFN_WDFREGISTRYASSIGNMEMORY) WdfFunctions[WdfRegistryAssignMemoryTableIndex])(WdfDriverGlobals, Key, ValueName, ValueType, Memory, MemoryOffsets);
}
//
// WDF Function: WdfRegistryAssignMultiString
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYASSIGNMULTISTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
WDFCOLLECTION StringsCollection
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryAssignMultiString(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
WDFCOLLECTION StringsCollection
)
{
return ((PFN_WDFREGISTRYASSIGNMULTISTRING) WdfFunctions[WdfRegistryAssignMultiStringTableIndex])(WdfDriverGlobals, Key, ValueName, StringsCollection);
}
//
// WDF Function: WdfRegistryAssignUnicodeString
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYASSIGNUNICODESTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
PCUNICODE_STRING Value
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryAssignUnicodeString(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
PCUNICODE_STRING Value
)
{
return ((PFN_WDFREGISTRYASSIGNUNICODESTRING) WdfFunctions[WdfRegistryAssignUnicodeStringTableIndex])(WdfDriverGlobals, Key, ValueName, Value);
}
//
// WDF Function: WdfRegistryAssignString
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYASSIGNSTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
WDFSTRING String
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryAssignString(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
WDFSTRING String
)
{
return ((PFN_WDFREGISTRYASSIGNSTRING) WdfFunctions[WdfRegistryAssignStringTableIndex])(WdfDriverGlobals, Key, ValueName, String);
}
//
// WDF Function: WdfRegistryAssignULong
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFREGISTRYASSIGNULONG)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG Value
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfRegistryAssignULong(
_In_
WDFKEY Key,
_In_
PCUNICODE_STRING ValueName,
_In_
ULONG Value
)
{
return ((PFN_WDFREGISTRYASSIGNULONG) WdfFunctions[WdfRegistryAssignULongTableIndex])(WdfDriverGlobals, Key, ValueName, Value);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFREGISTRY_H_

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,724 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfresource.h
Abstract:
This defines the DDIs for hardware resources
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 _WDFRESOURCE_H_
#define _WDFRESOURCE_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)
#define WDF_INSERT_AT_END ((ULONG) -1)
//
// WDF Function: WdfIoResourceRequirementsListSetSlotNumber
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFIORESOURCEREQUIREMENTSLISTSETSLOTNUMBER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_
ULONG SlotNumber
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfIoResourceRequirementsListSetSlotNumber(
_In_
WDFIORESREQLIST RequirementsList,
_In_
ULONG SlotNumber
)
{
((PFN_WDFIORESOURCEREQUIREMENTSLISTSETSLOTNUMBER) WdfFunctions[WdfIoResourceRequirementsListSetSlotNumberTableIndex])(WdfDriverGlobals, RequirementsList, SlotNumber);
}
//
// WDF Function: WdfIoResourceRequirementsListSetInterfaceType
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFIORESOURCEREQUIREMENTSLISTSETINTERFACETYPE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_
_Strict_type_match_
INTERFACE_TYPE InterfaceType
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfIoResourceRequirementsListSetInterfaceType(
_In_
WDFIORESREQLIST RequirementsList,
_In_
_Strict_type_match_
INTERFACE_TYPE InterfaceType
)
{
((PFN_WDFIORESOURCEREQUIREMENTSLISTSETINTERFACETYPE) WdfFunctions[WdfIoResourceRequirementsListSetInterfaceTypeTableIndex])(WdfDriverGlobals, RequirementsList, InterfaceType);
}
//
// WDF Function: WdfIoResourceRequirementsListAppendIoResList
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFIORESOURCEREQUIREMENTSLISTAPPENDIORESLIST)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_
WDFIORESLIST IoResList
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfIoResourceRequirementsListAppendIoResList(
_In_
WDFIORESREQLIST RequirementsList,
_In_
WDFIORESLIST IoResList
)
{
return ((PFN_WDFIORESOURCEREQUIREMENTSLISTAPPENDIORESLIST) WdfFunctions[WdfIoResourceRequirementsListAppendIoResListTableIndex])(WdfDriverGlobals, RequirementsList, IoResList);
}
//
// WDF Function: WdfIoResourceRequirementsListInsertIoResList
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFIORESOURCEREQUIREMENTSLISTINSERTIORESLIST)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_
WDFIORESLIST IoResList,
_In_
ULONG Index
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfIoResourceRequirementsListInsertIoResList(
_In_
WDFIORESREQLIST RequirementsList,
_In_
WDFIORESLIST IoResList,
_In_
ULONG Index
)
{
return ((PFN_WDFIORESOURCEREQUIREMENTSLISTINSERTIORESLIST) WdfFunctions[WdfIoResourceRequirementsListInsertIoResListTableIndex])(WdfDriverGlobals, RequirementsList, IoResList, Index);
}
//
// WDF Function: WdfIoResourceRequirementsListGetCount
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
ULONG
(*PFN_WDFIORESOURCEREQUIREMENTSLISTGETCOUNT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList
);
_IRQL_requires_max_(DISPATCH_LEVEL)
ULONG
FORCEINLINE
WdfIoResourceRequirementsListGetCount(
_In_
WDFIORESREQLIST RequirementsList
)
{
return ((PFN_WDFIORESOURCEREQUIREMENTSLISTGETCOUNT) WdfFunctions[WdfIoResourceRequirementsListGetCountTableIndex])(WdfDriverGlobals, RequirementsList);
}
//
// WDF Function: WdfIoResourceRequirementsListGetIoResList
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFIORESLIST
(*PFN_WDFIORESOURCEREQUIREMENTSLISTGETIORESLIST)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_
ULONG Index
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFIORESLIST
FORCEINLINE
WdfIoResourceRequirementsListGetIoResList(
_In_
WDFIORESREQLIST RequirementsList,
_In_
ULONG Index
)
{
return ((PFN_WDFIORESOURCEREQUIREMENTSLISTGETIORESLIST) WdfFunctions[WdfIoResourceRequirementsListGetIoResListTableIndex])(WdfDriverGlobals, RequirementsList, Index);
}
//
// WDF Function: WdfIoResourceRequirementsListRemove
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFIORESOURCEREQUIREMENTSLISTREMOVE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_
ULONG Index
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfIoResourceRequirementsListRemove(
_In_
WDFIORESREQLIST RequirementsList,
_In_
ULONG Index
)
{
((PFN_WDFIORESOURCEREQUIREMENTSLISTREMOVE) WdfFunctions[WdfIoResourceRequirementsListRemoveTableIndex])(WdfDriverGlobals, RequirementsList, Index);
}
//
// WDF Function: WdfIoResourceRequirementsListRemoveByIoResList
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFIORESOURCEREQUIREMENTSLISTREMOVEBYIORESLIST)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_
WDFIORESLIST IoResList
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfIoResourceRequirementsListRemoveByIoResList(
_In_
WDFIORESREQLIST RequirementsList,
_In_
WDFIORESLIST IoResList
)
{
((PFN_WDFIORESOURCEREQUIREMENTSLISTREMOVEBYIORESLIST) WdfFunctions[WdfIoResourceRequirementsListRemoveByIoResListTableIndex])(WdfDriverGlobals, RequirementsList, IoResList);
}
//
// WDF Function: WdfIoResourceListCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFIORESOURCELISTCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESREQLIST RequirementsList,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFIORESLIST* ResourceList
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfIoResourceListCreate(
_In_
WDFIORESREQLIST RequirementsList,
_In_opt_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFIORESLIST* ResourceList
)
{
return ((PFN_WDFIORESOURCELISTCREATE) WdfFunctions[WdfIoResourceListCreateTableIndex])(WdfDriverGlobals, RequirementsList, Attributes, ResourceList);
}
//
// WDF Function: WdfIoResourceListAppendDescriptor
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFIORESOURCELISTAPPENDDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfIoResourceListAppendDescriptor(
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor
)
{
return ((PFN_WDFIORESOURCELISTAPPENDDESCRIPTOR) WdfFunctions[WdfIoResourceListAppendDescriptorTableIndex])(WdfDriverGlobals, ResourceList, Descriptor);
}
//
// WDF Function: WdfIoResourceListInsertDescriptor
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFIORESOURCELISTINSERTDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor,
_In_
ULONG Index
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfIoResourceListInsertDescriptor(
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor,
_In_
ULONG Index
)
{
return ((PFN_WDFIORESOURCELISTINSERTDESCRIPTOR) WdfFunctions[WdfIoResourceListInsertDescriptorTableIndex])(WdfDriverGlobals, ResourceList, Descriptor, Index);
}
//
// WDF Function: WdfIoResourceListUpdateDescriptor
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFIORESOURCELISTUPDATEDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor,
_In_
ULONG Index
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfIoResourceListUpdateDescriptor(
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor,
_In_
ULONG Index
)
{
((PFN_WDFIORESOURCELISTUPDATEDESCRIPTOR) WdfFunctions[WdfIoResourceListUpdateDescriptorTableIndex])(WdfDriverGlobals, ResourceList, Descriptor, Index);
}
//
// WDF Function: WdfIoResourceListGetCount
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
ULONG
(*PFN_WDFIORESOURCELISTGETCOUNT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESLIST ResourceList
);
_IRQL_requires_max_(DISPATCH_LEVEL)
ULONG
FORCEINLINE
WdfIoResourceListGetCount(
_In_
WDFIORESLIST ResourceList
)
{
return ((PFN_WDFIORESOURCELISTGETCOUNT) WdfFunctions[WdfIoResourceListGetCountTableIndex])(WdfDriverGlobals, ResourceList);
}
//
// WDF Function: WdfIoResourceListGetDescriptor
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PIO_RESOURCE_DESCRIPTOR
(*PFN_WDFIORESOURCELISTGETDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESLIST ResourceList,
_In_
ULONG Index
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PIO_RESOURCE_DESCRIPTOR
FORCEINLINE
WdfIoResourceListGetDescriptor(
_In_
WDFIORESLIST ResourceList,
_In_
ULONG Index
)
{
return ((PFN_WDFIORESOURCELISTGETDESCRIPTOR) WdfFunctions[WdfIoResourceListGetDescriptorTableIndex])(WdfDriverGlobals, ResourceList, Index);
}
//
// WDF Function: WdfIoResourceListRemove
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFIORESOURCELISTREMOVE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESLIST ResourceList,
_In_
ULONG Index
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfIoResourceListRemove(
_In_
WDFIORESLIST ResourceList,
_In_
ULONG Index
)
{
((PFN_WDFIORESOURCELISTREMOVE) WdfFunctions[WdfIoResourceListRemoveTableIndex])(WdfDriverGlobals, ResourceList, Index);
}
//
// WDF Function: WdfIoResourceListRemoveByDescriptor
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFIORESOURCELISTREMOVEBYDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfIoResourceListRemoveByDescriptor(
_In_
WDFIORESLIST ResourceList,
_In_
PIO_RESOURCE_DESCRIPTOR Descriptor
)
{
((PFN_WDFIORESOURCELISTREMOVEBYDESCRIPTOR) WdfFunctions[WdfIoResourceListRemoveByDescriptorTableIndex])(WdfDriverGlobals, ResourceList, Descriptor);
}
//
// WDF Function: WdfCmResourceListAppendDescriptor
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFCMRESOURCELISTAPPENDDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFCMRESLIST List,
_In_
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfCmResourceListAppendDescriptor(
_In_
WDFCMRESLIST List,
_In_
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
)
{
return ((PFN_WDFCMRESOURCELISTAPPENDDESCRIPTOR) WdfFunctions[WdfCmResourceListAppendDescriptorTableIndex])(WdfDriverGlobals, List, Descriptor);
}
//
// WDF Function: WdfCmResourceListInsertDescriptor
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFCMRESOURCELISTINSERTDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFCMRESLIST List,
_In_
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
_In_
ULONG Index
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfCmResourceListInsertDescriptor(
_In_
WDFCMRESLIST List,
_In_
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor,
_In_
ULONG Index
)
{
return ((PFN_WDFCMRESOURCELISTINSERTDESCRIPTOR) WdfFunctions[WdfCmResourceListInsertDescriptorTableIndex])(WdfDriverGlobals, List, Descriptor, Index);
}
//
// WDF Function: WdfCmResourceListGetCount
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
ULONG
(*PFN_WDFCMRESOURCELISTGETCOUNT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFCMRESLIST List
);
_IRQL_requires_max_(DISPATCH_LEVEL)
ULONG
FORCEINLINE
WdfCmResourceListGetCount(
_In_
WDFCMRESLIST List
)
{
return ((PFN_WDFCMRESOURCELISTGETCOUNT) WdfFunctions[WdfCmResourceListGetCountTableIndex])(WdfDriverGlobals, List);
}
//
// WDF Function: WdfCmResourceListGetDescriptor
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
PCM_PARTIAL_RESOURCE_DESCRIPTOR
(*PFN_WDFCMRESOURCELISTGETDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFCMRESLIST List,
_In_
ULONG Index
);
_IRQL_requires_max_(DISPATCH_LEVEL)
PCM_PARTIAL_RESOURCE_DESCRIPTOR
FORCEINLINE
WdfCmResourceListGetDescriptor(
_In_
WDFCMRESLIST List,
_In_
ULONG Index
)
{
return ((PFN_WDFCMRESOURCELISTGETDESCRIPTOR) WdfFunctions[WdfCmResourceListGetDescriptorTableIndex])(WdfDriverGlobals, List, Index);
}
//
// WDF Function: WdfCmResourceListRemove
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFCMRESOURCELISTREMOVE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFCMRESLIST List,
_In_
ULONG Index
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfCmResourceListRemove(
_In_
WDFCMRESLIST List,
_In_
ULONG Index
)
{
((PFN_WDFCMRESOURCELISTREMOVE) WdfFunctions[WdfCmResourceListRemoveTableIndex])(WdfDriverGlobals, List, Index);
}
//
// WDF Function: WdfCmResourceListRemoveByDescriptor
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFCMRESOURCELISTREMOVEBYDESCRIPTOR)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFCMRESLIST List,
_In_
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfCmResourceListRemoveByDescriptor(
_In_
WDFCMRESLIST List,
_In_
PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor
)
{
((PFN_WDFCMRESOURCELISTREMOVEBYDESCRIPTOR) WdfFunctions[WdfCmResourceListRemoveByDescriptorTableIndex])(WdfDriverGlobals, List, Descriptor);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFRESOURCE_H_

View file

@ -0,0 +1,62 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfroletypes.h
Abstract:
Various typedefs for convenience.
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 _WDFROLETYPES_H_
#define _WDFROLETYPES_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
typedef EVT_WDF_OBJECT_CONTEXT_CLEANUP EVT_WDF_DEVICE_CONTEXT_CLEANUP;
typedef EVT_WDF_OBJECT_CONTEXT_DESTROY EVT_WDF_DEVICE_CONTEXT_DESTROY;
typedef EVT_WDF_OBJECT_CONTEXT_CLEANUP EVT_WDF_IO_QUEUE_CONTEXT_CLEANUP_CALLBACK;
typedef EVT_WDF_OBJECT_CONTEXT_DESTROY EVT_WDF_IO_QUEUE_CONTEXT_DESTROY_CALLBACK;
typedef EVT_WDF_OBJECT_CONTEXT_CLEANUP EVT_WDF_FILE_CONTEXT_CLEANUP_CALLBACK;
typedef EVT_WDF_OBJECT_CONTEXT_DESTROY EVT_WDF_FILE_CONTEXT_DESTROY_CALLBACK;
WDF_EXTERN_C_END
#endif // _WDFROLETYPES_H_

View file

@ -0,0 +1,254 @@
/*++ BUILD Version: 0005 // Increment this if a change has global effects
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
wdfstatus.h
Abstract:
Constant definitions for the WDFSTATUS values.
Revision History:
Notes:
This file is generated by the MC tool from the wdfstatus.mc file.
--*/
#ifndef _WDFSTATUS_H_
#define _WDFSTATUS_H_
/////////////////////////////////////////////////////////////////////////
//
// Standard Success values match the NTSTATUS values
//
//
/////////////////////////////////////////////////////////////////////////
#define FACILITY_DRIVER_FRAMEWORK 0x20
//
// Values are 32 bit values laid out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
//
// Define the severity codes
//
#define STATUS_SEVERITY_WARNING 0x2
#define STATUS_SEVERITY_SUCCESS 0x0
#define STATUS_SEVERITY_INFORMATIONAL 0x1
#define STATUS_SEVERITY_ERROR 0x3
//
// MessageId: STATUS_WDF_QUEUED
//
// MessageText:
//
// The request was queued internally and not immediately submitted to its target.
//
#define STATUS_WDF_QUEUED ((NTSTATUS)0x40200000L)
//
// MessageId: STATUS_WDF_POSTED
//
// MessageText:
//
// The request was posted to a worker thread.
//
#define STATUS_WDF_POSTED ((NTSTATUS)0x40200002L)
//
// MessageId: STATUS_WDF_NO_PACKAGE
//
// MessageText:
//
// No package of the selected type has been defined.
//
#define STATUS_WDF_NO_PACKAGE ((NTSTATUS)0xC0200200L)
//
// MessageId: STATUS_WDF_INTERNAL_ERROR
//
// MessageText:
//
// An internal error has occured.
//
#define STATUS_WDF_INTERNAL_ERROR ((NTSTATUS)0xC0200201L)
//
// MessageId: STATUS_WDF_PAUSED
//
// MessageText:
//
// The object is in a paused state.
//
#define STATUS_WDF_PAUSED ((NTSTATUS)0xC0200203L)
//
// MessageId: STATUS_WDF_BUSY
//
// MessageText:
//
// The object is busy with previous requests.
//
#define STATUS_WDF_BUSY ((NTSTATUS)0xC0200204L)
//
// MessageId: STATUS_WDF_IO_TIMEOUT_NOT_SENT
//
// MessageText:
//
// The request timed out and was never sent to its target.
//
#define STATUS_WDF_IO_TIMEOUT_NOT_SENT ((NTSTATUS)0xC0200205L)
//
// MessageId: STATUS_WDF_DEVICE_REMOVED_NOT_SENT
//
// MessageText:
//
// The request was never sent to its target and is now failed because the device has been removed.
//
#define STATUS_WDF_DEVICE_REMOVED_NOT_SENT ((NTSTATUS)0xC0200206L)
//
// MessageId: STATUS_WDF_REQUEST_ALREADY_PENDING
//
// MessageText:
//
// A request that was already pending with a IO target was submitted to a IO target.
//
#define STATUS_WDF_REQUEST_ALREADY_PENDING ((NTSTATUS)0xC0200207L)
//
// MessageId: STATUS_WDF_REQUEST_INVALID_STATE
//
// MessageText:
//
// An invalid operation was attempted on a request based on its currents state.
//
#define STATUS_WDF_REQUEST_INVALID_STATE ((NTSTATUS)0xC0200208L)
//
// MessageId: STATUS_WDF_OBJECT_ATTRIBUTES_INVALID
//
// MessageText:
//
// An invalid WDF_OBJECT_ATTRIBUTES parameter was passed.
//
#define STATUS_WDF_OBJECT_ATTRIBUTES_INVALID ((NTSTATUS)0xC0200209L)
//
// MessageId: STATUS_WDF_TOO_FRAGMENTED
//
// MessageText:
//
// The DMA Request's MDL has more SCATTER_GATHER_ELEMENTS that DMA Object's MaximumFragments allows.
//
#define STATUS_WDF_TOO_FRAGMENTED ((NTSTATUS)0xC020020AL)
//
// MessageId: STATUS_WDF_NO_CALLBACK
//
// MessageText:
//
// A required Event Callback has not been registered.
//
#define STATUS_WDF_NO_CALLBACK ((NTSTATUS)0xC020020BL)
//
// MessageId: STATUS_WDF_INCOMPATIBLE_EXECUTION_LEVEL
//
// MessageText:
//
// The object does not support the specified WDF_EXECUTION_LEVEL.
//
#define STATUS_WDF_INCOMPATIBLE_EXECUTION_LEVEL ((NTSTATUS)0xC020020CL)
//
// MessageId: STATUS_WDF_PARENT_ALREADY_ASSIGNED
//
// MessageText:
//
// The object already has a parent assigned.
//
#define STATUS_WDF_PARENT_ALREADY_ASSIGNED ((NTSTATUS)0xC020020DL)
//
// MessageId: STATUS_WDF_PARENT_IS_SELF
//
// MessageText:
//
// The object can not be its own parent.
//
#define STATUS_WDF_PARENT_IS_SELF ((NTSTATUS)0xC020020EL)
//
// MessageId: STATUS_WDF_PARENT_ASSIGNMENT_NOT_ALLOWED
//
// MessageText:
//
// The object can not have a driver specified parent assignment.
//
#define STATUS_WDF_PARENT_ASSIGNMENT_NOT_ALLOWED ((NTSTATUS)0xC020020FL)
//
// MessageId: STATUS_WDF_SYNCHRONIZATION_SCOPE_INVALID
//
// MessageText:
//
// The object does not support the specified WDF_SYNCHRONIZATION_SCOPE.
//
#define STATUS_WDF_SYNCHRONIZATION_SCOPE_INVALID ((NTSTATUS)0xC0200210L)
//
// MessageId: STATUS_WDF_EXECUTION_LEVEL_INVALID
//
// MessageText:
//
// The object does not support the specified WDF_EXECUTION_LEVEL.
//
#define STATUS_WDF_EXECUTION_LEVEL_INVALID ((NTSTATUS)0xC0200211L)
//
// MessageId: STATUS_WDF_PARENT_NOT_SPECIFIED
//
// MessageText:
//
// A required parent object was not specified in WDF_OBJECT_ATTRIBUTES.
//
#define STATUS_WDF_PARENT_NOT_SPECIFIED ((NTSTATUS)0xC0200212L)
#endif // _WDFSTATUS_H_

View file

@ -0,0 +1,124 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfString.h
Abstract:
This is the DDI for string handles.
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 _WDFSTRING_H_
#define _WDFSTRING_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: WdfStringCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFSTRINGCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
PCUNICODE_STRING UnicodeString,
_In_opt_
PWDF_OBJECT_ATTRIBUTES StringAttributes,
_Out_
WDFSTRING* String
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfStringCreate(
_In_opt_
PCUNICODE_STRING UnicodeString,
_In_opt_
PWDF_OBJECT_ATTRIBUTES StringAttributes,
_Out_
WDFSTRING* String
)
{
return ((PFN_WDFSTRINGCREATE) WdfFunctions[WdfStringCreateTableIndex])(WdfDriverGlobals, UnicodeString, StringAttributes, String);
}
//
// WDF Function: WdfStringGetUnicodeString
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFSTRINGGETUNICODESTRING)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFSTRING String,
_Out_
PUNICODE_STRING UnicodeString
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfStringGetUnicodeString(
_In_
WDFSTRING String,
_Out_
PUNICODE_STRING UnicodeString
)
{
((PFN_WDFSTRINGGETUNICODESTRING) WdfFunctions[WdfStringGetUnicodeStringTableIndex])(WdfDriverGlobals, String, UnicodeString);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFSTRING_H_

View file

@ -0,0 +1,318 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfsync.h
Abstract:
This module contains contains the Windows Driver Framework synchronization
DDIs.
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 _WDFSYNC_H_
#define _WDFSYNC_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: WdfObjectAcquireLock
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFOBJECTACQUIRELOCK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_not_held_(_Curr_)
_Acquires_lock_(_Curr_)
WDFOBJECT Object
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfObjectAcquireLock(
_In_
_Requires_lock_not_held_(_Curr_)
_Acquires_lock_(_Curr_)
WDFOBJECT Object
)
{
((PFN_WDFOBJECTACQUIRELOCK) WdfFunctions[WdfObjectAcquireLockTableIndex])(WdfDriverGlobals, Object);
}
//
// WDF Function: WdfObjectReleaseLock
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFOBJECTRELEASELOCK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
WDFOBJECT Object
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfObjectReleaseLock(
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
WDFOBJECT Object
)
{
((PFN_WDFOBJECTRELEASELOCK) WdfFunctions[WdfObjectReleaseLockTableIndex])(WdfDriverGlobals, Object);
}
//
// WDF Function: WdfWaitLockCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFWAITLOCKCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
PWDF_OBJECT_ATTRIBUTES LockAttributes,
_Out_
WDFWAITLOCK* Lock
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfWaitLockCreate(
_In_opt_
PWDF_OBJECT_ATTRIBUTES LockAttributes,
_Out_
WDFWAITLOCK* Lock
)
{
return ((PFN_WDFWAITLOCKCREATE) WdfFunctions[WdfWaitLockCreateTableIndex])(WdfDriverGlobals, LockAttributes, Lock);
}
//
// WDF Function: WdfWaitLockAcquire
//
typedef
_When_(Timeout == NULL, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Timeout != NULL && *Timeout == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
_When_(Timeout != NULL && *Timeout != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
_Always_(_When_(Timeout == NULL, _Acquires_lock_(Lock)))
_When_(Timeout != NULL && return == STATUS_SUCCESS, _Acquires_lock_(Lock))
_When_(Timeout != NULL, _Must_inspect_result_)
WDFAPI
NTSTATUS
(*PFN_WDFWAITLOCKACQUIRE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_not_held_(_Curr_)
WDFWAITLOCK Lock,
_In_opt_
PLONGLONG Timeout
);
_When_(Timeout == NULL, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Timeout != NULL && *Timeout == 0, _IRQL_requires_max_(DISPATCH_LEVEL))
_When_(Timeout != NULL && *Timeout != 0, _IRQL_requires_max_(PASSIVE_LEVEL))
_Always_(_When_(Timeout == NULL, _Acquires_lock_(Lock)))
_When_(Timeout != NULL && return == STATUS_SUCCESS, _Acquires_lock_(Lock))
_When_(Timeout != NULL, _Must_inspect_result_)
NTSTATUS
FORCEINLINE
WdfWaitLockAcquire(
_In_
_Requires_lock_not_held_(_Curr_)
WDFWAITLOCK Lock,
_In_opt_
PLONGLONG Timeout
)
{
return ((PFN_WDFWAITLOCKACQUIRE) WdfFunctions[WdfWaitLockAcquireTableIndex])(WdfDriverGlobals, Lock, Timeout);
}
//
// WDF Function: WdfWaitLockRelease
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFWAITLOCKRELEASE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
WDFWAITLOCK Lock
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfWaitLockRelease(
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
WDFWAITLOCK Lock
)
{
((PFN_WDFWAITLOCKRELEASE) WdfFunctions[WdfWaitLockReleaseTableIndex])(WdfDriverGlobals, Lock);
}
//
// WDF Function: WdfSpinLockCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFSPINLOCKCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_opt_
PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,
_Out_
WDFSPINLOCK* SpinLock
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfSpinLockCreate(
_In_opt_
PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,
_Out_
WDFSPINLOCK* SpinLock
)
{
return ((PFN_WDFSPINLOCKCREATE) WdfFunctions[WdfSpinLockCreateTableIndex])(WdfDriverGlobals, SpinLockAttributes, SpinLock);
}
//
// WDF Function: WdfSpinLockAcquire
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
_IRQL_raises_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFSPINLOCKACQUIRE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_not_held_(_Curr_)
_Acquires_lock_(_Curr_)
_IRQL_saves_
WDFSPINLOCK SpinLock
);
_IRQL_requires_max_(DISPATCH_LEVEL)
_IRQL_raises_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfSpinLockAcquire(
_In_
_Requires_lock_not_held_(_Curr_)
_Acquires_lock_(_Curr_)
_IRQL_saves_
WDFSPINLOCK SpinLock
)
{
((PFN_WDFSPINLOCKACQUIRE) WdfFunctions[WdfSpinLockAcquireTableIndex])(WdfDriverGlobals, SpinLock);
}
//
// WDF Function: WdfSpinLockRelease
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
_IRQL_requires_min_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFSPINLOCKRELEASE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
_IRQL_restores_
WDFSPINLOCK SpinLock
);
_IRQL_requires_max_(DISPATCH_LEVEL)
_IRQL_requires_min_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfSpinLockRelease(
_In_
_Requires_lock_held_(_Curr_)
_Releases_lock_(_Curr_)
_IRQL_restores_
WDFSPINLOCK SpinLock
)
{
((PFN_WDFSPINLOCKRELEASE) WdfFunctions[WdfSpinLockReleaseTableIndex])(WdfDriverGlobals, SpinLock);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFSYNC_H_

View file

@ -0,0 +1,264 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdftimer.h
Abstract:
This is the C header for driver framework TIMER object
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 _WDFTIMER_H_
#define _WDFTIMER_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)
#define TolerableDelayUnlimited ((ULONG)-1)
//
// This is the function that gets called back into the driver
// when the TIMER fires.
//
typedef
_Function_class_(EVT_WDF_TIMER)
_IRQL_requires_same_
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
EVT_WDF_TIMER(
_In_
WDFTIMER Timer
);
typedef EVT_WDF_TIMER *PFN_WDF_TIMER;
//
// Disable warning C4324: structure was padded due to DECLSPEC_ALIGN
// This padding is intentional and necessary.
#pragma warning(push)
#pragma warning(disable: 4324)
typedef struct _WDF_TIMER_CONFIG {
ULONG Size;
PFN_WDF_TIMER EvtTimerFunc;
ULONG Period;
//
// If this is TRUE, the Timer will automatically serialize
// with the event callback handlers of its Parent Object.
//
// Parent Object's callback constraints should be compatible
// with the Timer DPC (DISPATCH_LEVEL), or the request will fail.
//
BOOLEAN AutomaticSerialization;
//
// Optional tolerance for the timer in milliseconds.
//
ULONG TolerableDelay;
//
// If this is TRUE, high resolution timers will be used. The default
// value is FALSE
//
DECLSPEC_ALIGN(8) BOOLEAN UseHighResolutionTimer;
} WDF_TIMER_CONFIG, *PWDF_TIMER_CONFIG;
#pragma warning(pop)
VOID
FORCEINLINE
WDF_TIMER_CONFIG_INIT(
_Out_ PWDF_TIMER_CONFIG Config,
_In_ PFN_WDF_TIMER EvtTimerFunc
)
{
RtlZeroMemory(Config, sizeof(WDF_TIMER_CONFIG));
Config->Size = sizeof(WDF_TIMER_CONFIG);
Config->EvtTimerFunc = EvtTimerFunc;
Config->Period = 0;
Config->AutomaticSerialization = TRUE;
Config->TolerableDelay = 0;
}
VOID
FORCEINLINE
WDF_TIMER_CONFIG_INIT_PERIODIC(
_Out_ PWDF_TIMER_CONFIG Config,
_In_ PFN_WDF_TIMER EvtTimerFunc,
_In_ LONG Period
)
{
RtlZeroMemory(Config, sizeof(WDF_TIMER_CONFIG));
Config->Size = sizeof(WDF_TIMER_CONFIG);
Config->EvtTimerFunc = EvtTimerFunc;
Config->Period = Period;
Config->AutomaticSerialization = TRUE;
Config->TolerableDelay = 0;
}
//
// WDF Function: WdfTimerCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFTIMERCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDF_TIMER_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFTIMER* Timer
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfTimerCreate(
_In_
PWDF_TIMER_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFTIMER* Timer
)
{
return ((PFN_WDFTIMERCREATE) WdfFunctions[WdfTimerCreateTableIndex])(WdfDriverGlobals, Config, Attributes, Timer);
}
//
// WDF Function: WdfTimerStart
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFTIMERSTART)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFTIMER Timer,
_In_
LONGLONG DueTime
);
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
FORCEINLINE
WdfTimerStart(
_In_
WDFTIMER Timer,
_In_
LONGLONG DueTime
)
{
return ((PFN_WDFTIMERSTART) WdfFunctions[WdfTimerStartTableIndex])(WdfDriverGlobals, Timer, DueTime);
}
//
// WDF Function: WdfTimerStop
//
typedef
_When_(Wait == __true, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Wait == __false, _IRQL_requires_max_(DISPATCH_LEVEL))
WDFAPI
BOOLEAN
(*PFN_WDFTIMERSTOP)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFTIMER Timer,
_In_
BOOLEAN Wait
);
_When_(Wait == __true, _IRQL_requires_max_(PASSIVE_LEVEL))
_When_(Wait == __false, _IRQL_requires_max_(DISPATCH_LEVEL))
BOOLEAN
FORCEINLINE
WdfTimerStop(
_In_
WDFTIMER Timer,
_In_
BOOLEAN Wait
)
{
return ((PFN_WDFTIMERSTOP) WdfFunctions[WdfTimerStopTableIndex])(WdfDriverGlobals, Timer, Wait);
}
//
// WDF Function: WdfTimerGetParentObject
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFOBJECT
(*PFN_WDFTIMERGETPARENTOBJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFTIMER Timer
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFOBJECT
FORCEINLINE
WdfTimerGetParentObject(
_In_
WDFTIMER Timer
)
{
return ((PFN_WDFTIMERGETPARENTOBJECT) WdfFunctions[WdfTimerGetParentObjectTableIndex])(WdfDriverGlobals, Timer);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFTIMER_H_

View file

@ -0,0 +1,91 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name: WdfTraceEnums.h
Abstract:
Generated trace enums
Environment:
kernel mode only
--*/
#ifndef _WDFTRACEENUMS_H_
#define _WDFTRACEENUMS_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
// begin_wpp config
// CUSTOM_TYPE(WDF_BUGCHECK_CODES, ItemEnum(_WDF_BUGCHECK_CODES));
// CUSTOM_TYPE(WDF_REQUEST_FATAL_ERROR_CODES, ItemEnum(_WDF_REQUEST_FATAL_ERROR_CODES));
// CUSTOM_TYPE(WDF_CHILD_LIST_RETRIEVE_DEVICE_STATUS, ItemEnum(_WDF_CHILD_LIST_RETRIEVE_DEVICE_STATUS));
// CUSTOM_TYPE(WDF_RETRIEVE_CHILD_FLAGS, ItemEnum(_WDF_RETRIEVE_CHILD_FLAGS));
// CUSTOM_TYPE(WDF_DEVICE_SHUTDOWN_FLAGS, ItemEnum(_WDF_DEVICE_SHUTDOWN_FLAGS));
// CUSTOM_TYPE(WDF_DEVICE_STATE_FLAGS, ItemEnum(_WDF_DEVICE_STATE_FLAGS));
// CUSTOM_TYPE(WDF_DEVICE_PNP_STATE, ItemEnum(_WDF_DEVICE_PNP_STATE));
// CUSTOM_TYPE(WDF_DEVICE_POWER_STATE, ItemEnum(_WDF_DEVICE_POWER_STATE));
// CUSTOM_TYPE(WDF_DEVICE_POWER_POLICY_STATE, ItemEnum(_WDF_DEVICE_POWER_POLICY_STATE));
// CUSTOM_TYPE(WDF_STATE_NOTIFICATION_TYPE, ItemEnum(_WDF_STATE_NOTIFICATION_TYPE));
// CUSTOM_TYPE(WDF_POWER_POLICY_S0_IDLE_CAPABILITIES, ItemEnum(_WDF_POWER_POLICY_S0_IDLE_CAPABILITIES));
// CUSTOM_TYPE(WDF_POWER_POLICY_S0_IDLE_USER_CONTROL, ItemEnum(_WDF_POWER_POLICY_S0_IDLE_USER_CONTROL));
// CUSTOM_TYPE(WDF_POWER_POLICY_IDLE_TIMEOUT_CONSTANTS, ItemEnum(_WDF_POWER_POLICY_IDLE_TIMEOUT_CONSTANTS));
// CUSTOM_TYPE(WDF_POWER_POLICY_SX_WAKE_USER_CONTROL, ItemEnum(_WDF_POWER_POLICY_SX_WAKE_USER_CONTROL));
// CUSTOM_TYPE(WDF_POWER_DEVICE_STATE, ItemEnum(_WDF_POWER_DEVICE_STATE));
// CUSTOM_TYPE(WDF_DISPATCH_IRP_TO_IO_QUEUE_FLAGS, ItemEnum(_WDF_DISPATCH_IRP_TO_IO_QUEUE_FLAGS));
// CUSTOM_TYPE(WDF_SPECIAL_FILE_TYPE, ItemEnum(_WDF_SPECIAL_FILE_TYPE));
// CUSTOM_TYPE(WDF_DEVICE_IO_TYPE, ItemEnum(_WDF_DEVICE_IO_TYPE));
// CUSTOM_TYPE(WDF_FILEOBJECT_CLASS, ItemEnum(_WDF_FILEOBJECT_CLASS));
// CUSTOM_TYPE(WDF_DEVICE_FAILED_ACTION, ItemEnum(_WDF_DEVICE_FAILED_ACTION));
// CUSTOM_TYPE(WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE, ItemEnum(_WDF_RELEASE_HARDWARE_ORDER_ON_FAILURE));
// CUSTOM_TYPE(WDF_DMA_PROFILE, ItemEnum(_WDF_DMA_PROFILE));
// CUSTOM_TYPE(WDF_DMA_DIRECTION, ItemEnum(_WDF_DMA_DIRECTION));
// CUSTOM_TYPE(WDF_DRIVER_INIT_FLAGS, ItemEnum(_WDF_DRIVER_INIT_FLAGS));
// CUSTOM_TYPE(WDF_INTERRUPT_POLARITY, ItemEnum(_WDF_INTERRUPT_POLARITY));
// CUSTOM_TYPE(WDF_INTERRUPT_POLICY, ItemEnum(_WDF_INTERRUPT_POLICY));
// CUSTOM_TYPE(WDF_INTERRUPT_PRIORITY, ItemEnum(_WDF_INTERRUPT_PRIORITY));
// CUSTOM_TYPE(WDF_IO_QUEUE_DISPATCH_TYPE, ItemEnum(_WDF_IO_QUEUE_DISPATCH_TYPE));
// CUSTOM_TYPE(WDF_IO_QUEUE_STATE, ItemEnum(_WDF_IO_QUEUE_STATE));
// CUSTOM_TYPE(WDF_IO_TARGET_STATE, ItemEnum(_WDF_IO_TARGET_STATE));
// CUSTOM_TYPE(WDF_IO_TARGET_OPEN_TYPE, ItemEnum(_WDF_IO_TARGET_OPEN_TYPE));
// CUSTOM_TYPE(WDF_IO_TARGET_SENT_IO_ACTION, ItemEnum(_WDF_IO_TARGET_SENT_IO_ACTION));
// CUSTOM_TYPE(WDF_IO_TARGET_PURGE_IO_ACTION, ItemEnum(_WDF_IO_TARGET_PURGE_IO_ACTION));
// CUSTOM_TYPE(WDF_MEMORY_DESCRIPTOR_TYPE, ItemEnum(_WDF_MEMORY_DESCRIPTOR_TYPE));
// CUSTOM_TYPE(WDF_EXECUTION_LEVEL, ItemEnum(_WDF_EXECUTION_LEVEL));
// CUSTOM_TYPE(WDF_SYNCHRONIZATION_SCOPE, ItemEnum(_WDF_SYNCHRONIZATION_SCOPE));
// CUSTOM_TYPE(WDF_REQUEST_TYPE, ItemEnum(_WDF_REQUEST_TYPE));
// CUSTOM_TYPE(WDF_REQUEST_REUSE_FLAGS, ItemEnum(_WDF_REQUEST_REUSE_FLAGS));
// CUSTOM_TYPE(WDF_REQUEST_STOP_ACTION_FLAGS, ItemEnum(_WDF_REQUEST_STOP_ACTION_FLAGS));
// CUSTOM_TYPE(WDF_REQUEST_SEND_OPTIONS_FLAGS, ItemEnum(_WDF_REQUEST_SEND_OPTIONS_FLAGS));
// CUSTOM_TYPE(WDF_TRI_STATE, ItemEnum(_WDF_TRI_STATE));
// CUSTOM_TYPE(WDF_USB_REQUEST_TYPE, ItemEnum(_WDF_USB_REQUEST_TYPE));
// CUSTOM_TYPE(WDF_USB_BMREQUEST_DIRECTION, ItemEnum(_WDF_USB_BMREQUEST_DIRECTION));
// CUSTOM_TYPE(WDF_USB_BMREQUEST_TYPE, ItemEnum(_WDF_USB_BMREQUEST_TYPE));
// CUSTOM_TYPE(WDF_USB_BMREQUEST_RECIPIENT, ItemEnum(_WDF_USB_BMREQUEST_RECIPIENT));
// CUSTOM_TYPE(WDF_USB_PIPE_TYPE, ItemEnum(_WDF_USB_PIPE_TYPE));
// CUSTOM_TYPE(WdfUsbTargetDeviceSelectConfigType, ItemEnum(_WdfUsbTargetDeviceSelectConfigType));
// CUSTOM_TYPE(WdfUsbTargetDeviceSelectSettingType, ItemEnum(_WdfUsbTargetDeviceSelectSettingType));
// CUSTOM_TYPE(WDF_USB_DEVICE_TRAITS, ItemEnum(_WDF_USB_DEVICE_TRAITS));
// CUSTOM_TYPE(WDF_WMI_PROVIDER_CONTROL, ItemEnum(_WDF_WMI_PROVIDER_CONTROL));
// CUSTOM_TYPE(WDF_WMI_PROVIDER_FLAGS, ItemEnum(_WDF_WMI_PROVIDER_FLAGS));
// end_wpp
WDF_EXTERN_C_END
#endif // _WDFTRACEENUMS_H_

View file

@ -0,0 +1,176 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfypes.h
Abstract:
This module contains contains the C driver frameworks basic types.
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 _WDFTYPES_H_
#define _WDFTYPES_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)
#define WDFAPI
#ifndef __WDF_BYTE_DEFINED__
#define __WDF_BYTE_DEFINED__
typedef UCHAR BYTE;
#endif // __WDF_BYTE_DEFINED__
//
// Windows 2000 does not define FORCEINLINE, so define it if needed
//
#ifndef FORCEINLINE
#if (_MSC_VER >= 1200)
#define FORCEINLINE __forceinline
#else
#define FORCEINLINE __inline
#endif
#endif
//
// WDF_WPP_KMDF_DRIVER define is used by the WPP trace template file
// (km-init.tpl) to call the framework to register the KMDF provider
// if the WppInit and WppCleanup functions are executed in the
// Windows 2000 system.
//
#ifndef WDF_WPP_KMDF_DRIVER
#define WDF_WPP_KMDF_DRIVER
#endif // WDF_WPP_KMDF_DRIVER
//
// Do not create an invalid value for this enum in case driver writers mix up
// the usage of WdfFalse/FALSE and WdfTrue/TRUE.
//
typedef enum _WDF_TRI_STATE {
WdfFalse = FALSE,
WdfTrue = TRUE,
WdfUseDefault = 2,
} WDF_TRI_STATE, *PWDF_TRI_STATE;
typedef PVOID WDFCONTEXT;
//
// Forward declare structures needed later header files
//
typedef struct WDFDEVICE_INIT *PWDFDEVICE_INIT;
typedef struct WDFCXDEVICE_INIT *PWDFCXDEVICE_INIT;
typedef struct _WDF_OBJECT_ATTRIBUTES *PWDF_OBJECT_ATTRIBUTES;
#define WDF_NO_OBJECT_ATTRIBUTES (NULL)
#define WDF_NO_EVENT_CALLBACK (NULL)
#define WDF_NO_HANDLE (NULL)
#define WDF_NO_CONTEXT (NULL)
#define WDF_NO_SEND_OPTIONS (NULL)
//
// General Handle Type, should always be typeless
//
typedef HANDLE WDFOBJECT, *PWDFOBJECT;
//
// core handles
//
DECLARE_HANDLE( WDFDRIVER );
DECLARE_HANDLE( WDFDEVICE );
DECLARE_HANDLE( WDFWMIPROVIDER );
DECLARE_HANDLE( WDFWMIINSTANCE );
DECLARE_HANDLE( WDFQUEUE );
DECLARE_HANDLE( WDFREQUEST );
DECLARE_HANDLE( WDFFILEOBJECT );
DECLARE_HANDLE( WDFDPC );
DECLARE_HANDLE( WDFTIMER );
DECLARE_HANDLE( WDFWORKITEM );
DECLARE_HANDLE( WDFINTERRUPT );
//
// synch and lock handles
//
DECLARE_HANDLE( WDFWAITLOCK );
DECLARE_HANDLE( WDFSPINLOCK );
DECLARE_HANDLE( WDFMEMORY );
DECLARE_HANDLE( WDFLOOKASIDE );
//
// i/o targets for different busses
//
DECLARE_HANDLE( WDFIOTARGET );
DECLARE_HANDLE( WDFUSBDEVICE );
DECLARE_HANDLE( WDFUSBINTERFACE );
DECLARE_HANDLE( WDFUSBPIPE );
// dma handles
DECLARE_HANDLE( WDFDMAENABLER );
DECLARE_HANDLE( WDFDMATRANSACTION );
DECLARE_HANDLE( WDFCOMMONBUFFER );
//
// support handles
//
DECLARE_HANDLE( WDFKEY );
DECLARE_HANDLE( WDFSTRING );
DECLARE_HANDLE( WDFCOLLECTION );
DECLARE_HANDLE( WDFCHILDLIST );
DECLARE_HANDLE( WDFIORESREQLIST );
DECLARE_HANDLE( WDFIORESLIST );
DECLARE_HANDLE( WDFCMRESLIST );
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFTYPES_H_

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,138 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfverifier.h
Abstract:
This module contains Driver Frameworks Verifier definitions
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 _WDFVERIFIER_H_
#define _WDFVERIFIER_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: WdfVerifierDbgBreakPoint
//
typedef
WDFAPI
VOID
(*PFN_WDFVERIFIERDBGBREAKPOINT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals
);
VOID
FORCEINLINE
WdfVerifierDbgBreakPoint(
)
{
((PFN_WDFVERIFIERDBGBREAKPOINT) WdfFunctions[WdfVerifierDbgBreakPointTableIndex])(WdfDriverGlobals);
}
//
// WDF Function: WdfVerifierKeBugCheck
//
typedef
WDFAPI
VOID
(*PFN_WDFVERIFIERKEBUGCHECK)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
ULONG BugCheckCode,
_In_
ULONG_PTR BugCheckParameter1,
_In_
ULONG_PTR BugCheckParameter2,
_In_
ULONG_PTR BugCheckParameter3,
_In_
ULONG_PTR BugCheckParameter4
);
VOID
FORCEINLINE
WdfVerifierKeBugCheck(
_In_
ULONG BugCheckCode,
_In_
ULONG_PTR BugCheckParameter1,
_In_
ULONG_PTR BugCheckParameter2,
_In_
ULONG_PTR BugCheckParameter3,
_In_
ULONG_PTR BugCheckParameter4
)
{
((PFN_WDFVERIFIERKEBUGCHECK) WdfFunctions[WdfVerifierKeBugCheckTableIndex])(WdfDriverGlobals, BugCheckCode, BugCheckParameter1, BugCheckParameter2, BugCheckParameter3, BugCheckParameter4);
}
//
// WDF Function: WdfGetTriageInfo
//
typedef
WDFAPI
PVOID
(*PFN_WDFGETTRIAGEINFO)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals
);
PVOID
FORCEINLINE
WdfGetTriageInfo(
)
{
return ((PFN_WDFGETTRIAGEINFO) WdfFunctions[WdfGetTriageInfoTableIndex])(WdfDriverGlobals);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFVERIFIER_H_

View file

@ -0,0 +1,642 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
WdfWMI.h
Abstract:
This is the C interface for WMI support
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 _WDFWMI_H_
#define _WDFWMI_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_WMI_PROVIDER_CONTROL {
WdfWmiControlInvalid = 0,
WdfWmiEventControl,
WdfWmiInstanceControl,
} WDF_WMI_PROVIDER_CONTROL;
//
// WdfWmiProviderExpensive:
// The provider's operations are expensive in terms of resources
//
// WdfWmiProviderReadOnly:
// The provider is read only. No set or set data item callbacks will be
// made on all instances of this provider.
//
// WdfWmiProviderEventOnly:
// Data item is being used to fire events only. It will not receive any
// callbacks on it to get / set / execute buffers.
//
typedef enum _WDF_WMI_PROVIDER_FLAGS {
WdfWmiProviderEventOnly = 0x0001,
WdfWmiProviderExpensive = 0x0002,
WdfWmiProviderTracing = 0x0004,
WdfWmiProviderValidFlags = WdfWmiProviderEventOnly | WdfWmiProviderExpensive | WdfWmiProviderTracing,
} WDF_WMI_PROVIDER_FLAGS;
typedef
_Function_class_(EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE(
_In_
WDFWMIINSTANCE WmiInstance,
_In_
ULONG OutBufferSize,
_Out_writes_bytes_to_(OutBufferSize, *BufferUsed)
PVOID OutBuffer,
_Out_
PULONG BufferUsed
);
typedef EVT_WDF_WMI_INSTANCE_QUERY_INSTANCE *PFN_WDF_WMI_INSTANCE_QUERY_INSTANCE;
typedef
_Function_class_(EVT_WDF_WMI_INSTANCE_SET_INSTANCE)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_WMI_INSTANCE_SET_INSTANCE(
_In_
WDFWMIINSTANCE WmiInstance,
_In_
ULONG InBufferSize,
_In_reads_bytes_(InBufferSize)
PVOID InBuffer
);
typedef EVT_WDF_WMI_INSTANCE_SET_INSTANCE *PFN_WDF_WMI_INSTANCE_SET_INSTANCE;
typedef
_Function_class_(EVT_WDF_WMI_INSTANCE_SET_ITEM)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_WMI_INSTANCE_SET_ITEM(
_In_
WDFWMIINSTANCE WmiInstance,
_In_
ULONG DataItemId,
_In_
ULONG InBufferSize,
_In_reads_bytes_(InBufferSize)
PVOID InBuffer
);
typedef EVT_WDF_WMI_INSTANCE_SET_ITEM *PFN_WDF_WMI_INSTANCE_SET_ITEM;
typedef
_Function_class_(EVT_WDF_WMI_INSTANCE_EXECUTE_METHOD)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_WMI_INSTANCE_EXECUTE_METHOD(
_In_
WDFWMIINSTANCE WmiInstance,
_In_
ULONG MethodId,
_In_
ULONG InBufferSize,
_In_
ULONG OutBufferSize,
_When_(InBufferSize >= OutBufferSize, _Inout_updates_bytes_(InBufferSize))
_When_(InBufferSize < OutBufferSize, _Inout_updates_bytes_(OutBufferSize))
PVOID Buffer,
_Out_
PULONG BufferUsed
);
typedef EVT_WDF_WMI_INSTANCE_EXECUTE_METHOD *PFN_WDF_WMI_INSTANCE_EXECUTE_METHOD;
typedef
_Function_class_(EVT_WDF_WMI_PROVIDER_FUNCTION_CONTROL)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
EVT_WDF_WMI_PROVIDER_FUNCTION_CONTROL(
_In_
WDFWMIPROVIDER WmiProvider,
_In_
WDF_WMI_PROVIDER_CONTROL Control,
_In_
BOOLEAN Enable
);
typedef EVT_WDF_WMI_PROVIDER_FUNCTION_CONTROL *PFN_WDF_WMI_PROVIDER_FUNCTION_CONTROL;
typedef struct _WDF_WMI_PROVIDER_CONFIG {
//
// Size of this structure in bytes
//
ULONG Size;
//
// The GUID being registered
//
GUID Guid;
//
// Combination of values from the enum WDF_WMI_PROVIDER_FLAGS
//
ULONG Flags;
//
// Minimum expected buffer size for query and set instance requests.
// Ignored if WdfWmiProviderEventOnly is set in Flags.
//
ULONG MinInstanceBufferSize;
//
// Callback when caller is opening a provider which ha been marked as
// expensive or when a caller is interested in events.
//
PFN_WDF_WMI_PROVIDER_FUNCTION_CONTROL EvtWmiProviderFunctionControl;
} WDF_WMI_PROVIDER_CONFIG, *PWDF_WMI_PROVIDER_CONFIG;
VOID
FORCEINLINE
WDF_WMI_PROVIDER_CONFIG_INIT(
_Out_ PWDF_WMI_PROVIDER_CONFIG Config,
_In_ CONST GUID* Guid
)
{
RtlZeroMemory(Config, sizeof(WDF_WMI_PROVIDER_CONFIG));
Config->Size = sizeof(WDF_WMI_PROVIDER_CONFIG);
RtlCopyMemory(&Config->Guid, Guid, sizeof(GUID));
}
typedef struct _WDF_WMI_INSTANCE_CONFIG {
//
// Size of the structure in bytes
//
ULONG Size;
//
// Optional parameter. If NULL, ProviderConfig must be set to a valid pointer
// value. If specified, indicates the provider to create an instance for.
//
WDFWMIPROVIDER Provider;
//
// Optional parameter. If NULL, Provider must be set to a valid handle
// value. If specifeid, indicates the configuration for a provider to be
// created and for this instance to be associated with.
//
PWDF_WMI_PROVIDER_CONFIG ProviderConfig;
//
// If the Provider is configured as read only and this field is set to TRUE,
// the EvtWmiInstanceQueryInstance is ignored and WDF will blindly copy the
// context associated with this instance (using RtlCopyMemory, with no locks
// held) into the query buffer.
//
BOOLEAN UseContextForQuery;
//
// If TRUE, the instance will be registered as well as created.
//
BOOLEAN Register;
//
// Callback when caller wants to query the entire data item's buffer.
//
PFN_WDF_WMI_INSTANCE_QUERY_INSTANCE EvtWmiInstanceQueryInstance;
//
// Callback when caller wants to set the entire data item's buffer.
//
PFN_WDF_WMI_INSTANCE_SET_INSTANCE EvtWmiInstanceSetInstance;
//
// Callback when caller wants to set a single field in the data item's buffer
//
PFN_WDF_WMI_INSTANCE_SET_ITEM EvtWmiInstanceSetItem;
//
// Callback when caller wants to execute a method on the data item.
//
PFN_WDF_WMI_INSTANCE_EXECUTE_METHOD EvtWmiInstanceExecuteMethod;
} WDF_WMI_INSTANCE_CONFIG, *PWDF_WMI_INSTANCE_CONFIG;
VOID
FORCEINLINE
WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER(
_Out_ PWDF_WMI_INSTANCE_CONFIG Config,
_In_ WDFWMIPROVIDER Provider
)
{
RtlZeroMemory(Config, sizeof(WDF_WMI_INSTANCE_CONFIG));
Config->Size = sizeof(WDF_WMI_INSTANCE_CONFIG);
Config->Provider = Provider;
}
VOID
FORCEINLINE
WDF_WMI_INSTANCE_CONFIG_INIT_PROVIDER_CONFIG(
_Out_ PWDF_WMI_INSTANCE_CONFIG Config,
_In_ PWDF_WMI_PROVIDER_CONFIG ProviderConfig
)
{
RtlZeroMemory(Config, sizeof(WDF_WMI_INSTANCE_CONFIG));
Config->Size = sizeof(WDF_WMI_INSTANCE_CONFIG);
Config->ProviderConfig = ProviderConfig;
}
NTSTATUS
FORCEINLINE
WDF_WMI_BUFFER_APPEND_STRING(
_Out_writes_bytes_(BufferLength) PVOID Buffer,
_In_ ULONG BufferLength,
_In_ PCUNICODE_STRING String,
_Out_ PULONG RequiredSize
)
{
//
// Compute the length of buffer we need to use. Upon error the caller can
// use this length to report the required length. On success, the caller
// can use this length to know how many bytes were written.
//
*RequiredSize = String->Length + sizeof(USHORT);
//
// UNICODE_STRING.Length is the length of the string in bytes, not characters
//
// First check to see if there is enough space
// 1) to store the length of the string
// 2) to store the string itself
//
if (BufferLength < (String->Length + sizeof(USHORT))) {
//
// Not enough room in the string, report back how big a buffer is
// required.
//
return STATUS_BUFFER_TOO_SMALL;
}
//
// Store the length of the string
//
*(USHORT *) Buffer = String->Length;
//
// Copy the string to the buffer
//
RtlCopyMemory(WDF_PTR_ADD_OFFSET(Buffer, sizeof(USHORT)),
String->Buffer,
String->Length);
return STATUS_SUCCESS;
}
//
// WDF Function: WdfWmiProviderCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFWMIPROVIDERCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_In_
PWDF_WMI_PROVIDER_CONFIG WmiProviderConfig,
_In_opt_
PWDF_OBJECT_ATTRIBUTES ProviderAttributes,
_Out_
WDFWMIPROVIDER* WmiProvider
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfWmiProviderCreate(
_In_
WDFDEVICE Device,
_In_
PWDF_WMI_PROVIDER_CONFIG WmiProviderConfig,
_In_opt_
PWDF_OBJECT_ATTRIBUTES ProviderAttributes,
_Out_
WDFWMIPROVIDER* WmiProvider
)
{
return ((PFN_WDFWMIPROVIDERCREATE) WdfFunctions[WdfWmiProviderCreateTableIndex])(WdfDriverGlobals, Device, WmiProviderConfig, ProviderAttributes, WmiProvider);
}
//
// WDF Function: WdfWmiProviderGetDevice
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFDEVICE
(*PFN_WDFWMIPROVIDERGETDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIPROVIDER WmiProvider
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFDEVICE
FORCEINLINE
WdfWmiProviderGetDevice(
_In_
WDFWMIPROVIDER WmiProvider
)
{
return ((PFN_WDFWMIPROVIDERGETDEVICE) WdfFunctions[WdfWmiProviderGetDeviceTableIndex])(WdfDriverGlobals, WmiProvider);
}
//
// WDF Function: WdfWmiProviderIsEnabled
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
BOOLEAN
(*PFN_WDFWMIPROVIDERISENABLED)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIPROVIDER WmiProvider,
_In_
WDF_WMI_PROVIDER_CONTROL ProviderControl
);
_IRQL_requires_max_(DISPATCH_LEVEL)
BOOLEAN
FORCEINLINE
WdfWmiProviderIsEnabled(
_In_
WDFWMIPROVIDER WmiProvider,
_In_
WDF_WMI_PROVIDER_CONTROL ProviderControl
)
{
return ((PFN_WDFWMIPROVIDERISENABLED) WdfFunctions[WdfWmiProviderIsEnabledTableIndex])(WdfDriverGlobals, WmiProvider, ProviderControl);
}
//
// WDF Function: WdfWmiProviderGetTracingHandle
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
ULONGLONG
(*PFN_WDFWMIPROVIDERGETTRACINGHANDLE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIPROVIDER WmiProvider
);
_IRQL_requires_max_(DISPATCH_LEVEL)
ULONGLONG
FORCEINLINE
WdfWmiProviderGetTracingHandle(
_In_
WDFWMIPROVIDER WmiProvider
)
{
return ((PFN_WDFWMIPROVIDERGETTRACINGHANDLE) WdfFunctions[WdfWmiProviderGetTracingHandleTableIndex])(WdfDriverGlobals, WmiProvider);
}
//
// WDF Function: WdfWmiInstanceCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFWMIINSTANCECREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFDEVICE Device,
_In_
PWDF_WMI_INSTANCE_CONFIG InstanceConfig,
_In_opt_
PWDF_OBJECT_ATTRIBUTES InstanceAttributes,
_Out_opt_
WDFWMIINSTANCE* Instance
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfWmiInstanceCreate(
_In_
WDFDEVICE Device,
_In_
PWDF_WMI_INSTANCE_CONFIG InstanceConfig,
_In_opt_
PWDF_OBJECT_ATTRIBUTES InstanceAttributes,
_Out_opt_
WDFWMIINSTANCE* Instance
)
{
return ((PFN_WDFWMIINSTANCECREATE) WdfFunctions[WdfWmiInstanceCreateTableIndex])(WdfDriverGlobals, Device, InstanceConfig, InstanceAttributes, Instance);
}
//
// WDF Function: WdfWmiInstanceRegister
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFWMIINSTANCEREGISTER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIINSTANCE WmiInstance
);
_Must_inspect_result_
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
FORCEINLINE
WdfWmiInstanceRegister(
_In_
WDFWMIINSTANCE WmiInstance
)
{
return ((PFN_WDFWMIINSTANCEREGISTER) WdfFunctions[WdfWmiInstanceRegisterTableIndex])(WdfDriverGlobals, WmiInstance);
}
//
// WDF Function: WdfWmiInstanceDeregister
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFWMIINSTANCEDEREGISTER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIINSTANCE WmiInstance
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfWmiInstanceDeregister(
_In_
WDFWMIINSTANCE WmiInstance
)
{
((PFN_WDFWMIINSTANCEDEREGISTER) WdfFunctions[WdfWmiInstanceDeregisterTableIndex])(WdfDriverGlobals, WmiInstance);
}
//
// WDF Function: WdfWmiInstanceGetDevice
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFDEVICE
(*PFN_WDFWMIINSTANCEGETDEVICE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIINSTANCE WmiInstance
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFDEVICE
FORCEINLINE
WdfWmiInstanceGetDevice(
_In_
WDFWMIINSTANCE WmiInstance
)
{
return ((PFN_WDFWMIINSTANCEGETDEVICE) WdfFunctions[WdfWmiInstanceGetDeviceTableIndex])(WdfDriverGlobals, WmiInstance);
}
//
// WDF Function: WdfWmiInstanceGetProvider
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFWMIPROVIDER
(*PFN_WDFWMIINSTANCEGETPROVIDER)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIINSTANCE WmiInstance
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFWMIPROVIDER
FORCEINLINE
WdfWmiInstanceGetProvider(
_In_
WDFWMIINSTANCE WmiInstance
)
{
return ((PFN_WDFWMIINSTANCEGETPROVIDER) WdfFunctions[WdfWmiInstanceGetProviderTableIndex])(WdfDriverGlobals, WmiInstance);
}
//
// WDF Function: WdfWmiInstanceFireEvent
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(APC_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFWMIINSTANCEFIREEVENT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWMIINSTANCE WmiInstance,
_In_opt_
ULONG EventDataSize,
_In_reads_bytes_opt_(EventDataSize)
PVOID EventData
);
_Must_inspect_result_
_IRQL_requires_max_(APC_LEVEL)
NTSTATUS
FORCEINLINE
WdfWmiInstanceFireEvent(
_In_
WDFWMIINSTANCE WmiInstance,
_In_opt_
ULONG EventDataSize,
_In_reads_bytes_opt_(EventDataSize)
PVOID EventData
)
{
return ((PFN_WDFWMIINSTANCEFIREEVENT) WdfFunctions[WdfWmiInstanceFireEventTableIndex])(WdfDriverGlobals, WmiInstance, EventDataSize, EventData);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFWMI_H_

View file

@ -0,0 +1,215 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
_WdfVersionBuild_
Module Name:
wdfworkitem.h
Abstract:
This is the Windows Driver Framework work item DDIs
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 _WDFWORKITEM_H_
#define _WDFWORKITEM_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)
//
// This is the function that gets called back into the driver
// when the WorkItem fires.
//
typedef
_Function_class_(EVT_WDF_WORKITEM)
_IRQL_requires_same_
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
EVT_WDF_WORKITEM(
_In_
WDFWORKITEM WorkItem
);
typedef EVT_WDF_WORKITEM *PFN_WDF_WORKITEM;
typedef struct _WDF_WORKITEM_CONFIG {
ULONG Size;
PFN_WDF_WORKITEM EvtWorkItemFunc;
//
// If this is TRUE, the workitem will automatically serialize
// with the event callback handlers of its Parent Object.
//
// Parent Object's callback constraints should be compatible
// with the work item (PASSIVE_LEVEL), or the request will fail.
//
BOOLEAN AutomaticSerialization;
} WDF_WORKITEM_CONFIG, *PWDF_WORKITEM_CONFIG;
VOID
FORCEINLINE
WDF_WORKITEM_CONFIG_INIT(
_Out_ PWDF_WORKITEM_CONFIG Config,
_In_ PFN_WDF_WORKITEM EvtWorkItemFunc
)
{
RtlZeroMemory(Config, sizeof(WDF_WORKITEM_CONFIG));
Config->Size = sizeof(WDF_WORKITEM_CONFIG);
Config->EvtWorkItemFunc = EvtWorkItemFunc;
Config->AutomaticSerialization = TRUE;
}
//
// WDF Function: WdfWorkItemCreate
//
typedef
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
NTSTATUS
(*PFN_WDFWORKITEMCREATE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
PWDF_WORKITEM_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFWORKITEM* WorkItem
);
_Must_inspect_result_
_IRQL_requires_max_(DISPATCH_LEVEL)
NTSTATUS
FORCEINLINE
WdfWorkItemCreate(
_In_
PWDF_WORKITEM_CONFIG Config,
_In_
PWDF_OBJECT_ATTRIBUTES Attributes,
_Out_
WDFWORKITEM* WorkItem
)
{
return ((PFN_WDFWORKITEMCREATE) WdfFunctions[WdfWorkItemCreateTableIndex])(WdfDriverGlobals, Config, Attributes, WorkItem);
}
//
// WDF Function: WdfWorkItemEnqueue
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
VOID
(*PFN_WDFWORKITEMENQUEUE)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWORKITEM WorkItem
);
_IRQL_requires_max_(DISPATCH_LEVEL)
VOID
FORCEINLINE
WdfWorkItemEnqueue(
_In_
WDFWORKITEM WorkItem
)
{
((PFN_WDFWORKITEMENQUEUE) WdfFunctions[WdfWorkItemEnqueueTableIndex])(WdfDriverGlobals, WorkItem);
}
//
// WDF Function: WdfWorkItemGetParentObject
//
typedef
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFAPI
WDFOBJECT
(*PFN_WDFWORKITEMGETPARENTOBJECT)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWORKITEM WorkItem
);
_IRQL_requires_max_(DISPATCH_LEVEL)
WDFOBJECT
FORCEINLINE
WdfWorkItemGetParentObject(
_In_
WDFWORKITEM WorkItem
)
{
return ((PFN_WDFWORKITEMGETPARENTOBJECT) WdfFunctions[WdfWorkItemGetParentObjectTableIndex])(WdfDriverGlobals, WorkItem);
}
//
// WDF Function: WdfWorkItemFlush
//
typedef
_IRQL_requires_max_(PASSIVE_LEVEL)
WDFAPI
VOID
(*PFN_WDFWORKITEMFLUSH)(
_In_
PWDF_DRIVER_GLOBALS DriverGlobals,
_In_
WDFWORKITEM WorkItem
);
_IRQL_requires_max_(PASSIVE_LEVEL)
VOID
FORCEINLINE
WdfWorkItemFlush(
_In_
WDFWORKITEM WorkItem
)
{
((PFN_WDFWORKITEMFLUSH) WdfFunctions[WdfWorkItemFlushTableIndex])(WdfDriverGlobals, WorkItem);
}
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
WDF_EXTERN_C_END
#endif // _WDFWORKITEM_H_