mirror of
https://github.com/reactos/reactos.git
synced 2024-11-01 12:26:32 +00:00
245 lines
4.3 KiB
C
245 lines
4.3 KiB
C
/*++
|
|
|
|
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
|
|
STDCALL
|
|
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;
|
|
|
|
FORCEINLINE
|
|
VOID
|
|
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
|
|
(STDCALL *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)
|
|
FORCEINLINE
|
|
NTSTATUS
|
|
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
|
|
(STDCALL *PFN_WDFDPCENQUEUE)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_
|
|
WDFDPC Dpc
|
|
);
|
|
|
|
_IRQL_requires_max_(HIGH_LEVEL)
|
|
FORCEINLINE
|
|
BOOLEAN
|
|
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
|
|
(STDCALL *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))
|
|
FORCEINLINE
|
|
BOOLEAN
|
|
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
|
|
(STDCALL *PFN_WDFDPCGETPARENTOBJECT)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_
|
|
WDFDPC Dpc
|
|
);
|
|
|
|
_IRQL_requires_max_(HIGH_LEVEL)
|
|
FORCEINLINE
|
|
WDFOBJECT
|
|
WdfDpcGetParentObject(
|
|
_In_
|
|
WDFDPC Dpc
|
|
)
|
|
{
|
|
return ((PFN_WDFDPCGETPARENTOBJECT) WdfFunctions[WdfDpcGetParentObjectTableIndex])(WdfDriverGlobals, Dpc);
|
|
}
|
|
|
|
//
|
|
// WDF Function: WdfDpcWdmGetDpc
|
|
//
|
|
typedef
|
|
_IRQL_requires_max_(HIGH_LEVEL)
|
|
WDFAPI
|
|
PKDPC
|
|
(STDCALL *PFN_WDFDPCWDMGETDPC)(
|
|
_In_
|
|
PWDF_DRIVER_GLOBALS DriverGlobals,
|
|
_In_
|
|
WDFDPC Dpc
|
|
);
|
|
|
|
_IRQL_requires_max_(HIGH_LEVEL)
|
|
FORCEINLINE
|
|
PKDPC
|
|
WdfDpcWdmGetDpc(
|
|
_In_
|
|
WDFDPC Dpc
|
|
)
|
|
{
|
|
return ((PFN_WDFDPCWDMGETDPC) WdfFunctions[WdfDpcWdmGetDpcTableIndex])(WdfDriverGlobals, Dpc);
|
|
}
|
|
|
|
|
|
|
|
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
|
|
|
|
|
|
WDF_EXTERN_C_END
|
|
|
|
#endif // _WDFDPC_H_
|
|
|