2020-09-24 20:41:01 +00:00
|
|
|
/*++
|
|
|
|
|
|
|
|
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
|
2020-09-24 20:48:32 +00:00
|
|
|
STDCALL
|
2020-09-24 20:41:01 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
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
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFWORKITEMCREATE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_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)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
NTSTATUS
|
2020-09-24 20:41:01 +00:00
|
|
|
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
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFWORKITEMENQUEUE)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
WDFWORKITEM WorkItem
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfWorkItemEnqueue(
|
|
|
|
_In_
|
|
|
|
WDFWORKITEM WorkItem
|
|
|
|
)
|
|
|
|
{
|
|
|
|
((PFN_WDFWORKITEMENQUEUE) WdfFunctions[WdfWorkItemEnqueueTableIndex])(WdfDriverGlobals, WorkItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfWorkItemGetParentObject
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
WDFOBJECT
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFWORKITEMGETPARENTOBJECT)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
WDFWORKITEM WorkItem
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(DISPATCH_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
WDFOBJECT
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfWorkItemGetParentObject(
|
|
|
|
_In_
|
|
|
|
WDFWORKITEM WorkItem
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return ((PFN_WDFWORKITEMGETPARENTOBJECT) WdfFunctions[WdfWorkItemGetParentObjectTableIndex])(WdfDriverGlobals, WorkItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// WDF Function: WdfWorkItemFlush
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
_IRQL_requires_max_(PASSIVE_LEVEL)
|
|
|
|
WDFAPI
|
|
|
|
VOID
|
2020-09-24 20:48:32 +00:00
|
|
|
(STDCALL *PFN_WDFWORKITEMFLUSH)(
|
2020-09-24 20:41:01 +00:00
|
|
|
_In_
|
|
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
|
|
_In_
|
|
|
|
WDFWORKITEM WorkItem
|
|
|
|
);
|
|
|
|
|
|
|
|
_IRQL_requires_max_(PASSIVE_LEVEL)
|
|
|
|
FORCEINLINE
|
2020-09-24 20:48:32 +00:00
|
|
|
VOID
|
2020-09-24 20:41:01 +00:00
|
|
|
WdfWorkItemFlush(
|
|
|
|
_In_
|
|
|
|
WDFWORKITEM WorkItem
|
|
|
|
)
|
|
|
|
{
|
|
|
|
((PFN_WDFWORKITEMFLUSH) WdfFunctions[WdfWorkItemFlushTableIndex])(WdfDriverGlobals, WorkItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
|
|
|
|
|
|
|
|
|
|
|
|
WDF_EXTERN_C_END
|
|
|
|
|
|
|
|
#endif // _WDFWORKITEM_H_
|
|
|
|
|