29#include "FxDeviceApiUm.tmh"
122 "WDFDEVICE 0x%p WdfEventType %d not expected %!STATUS!",
140 "WDFDEVICE 0x%p Failed to post event %!STATUS!",
334 "incorrect register address, or provided incorrect size",
352WDFEXPORT(WdfDeviceGetHardwareRegisterMappedAddress)(
412 " Register mapping to user-mode is not enabled. Set the INF directive"
413 " UmdfRegisterAccessMode to RegisterAccessUsingUserModeMapping"
414 " in driver's INF file to enable Register mapping to user-mode",
448 WDF_DEVICE_HWACCESS_TARGET_TYPE
Type,
450 WDF_DEVICE_HWACCESS_TARGET_SIZE
Size,
523 CHECK(
"Incorrect Type parameter",
524 (
Type > WdfDeviceHwAccessTargetTypeInvalid &&
525 Type < WdfDeviceHwAccessTargetTypeMaximum)),
529 CHECK(
"Incorrect Size parameter",
530 (
Size > WdfDeviceHwAccessTargetSizeInvalid &&
531 Size < WdfDeviceHwAccessTargetSizeMaximum)),
550 "on 64-bit platform", (
Size != WdfDeviceHwAccessTargetSizeUlong64)),
574 "when computing length of read access", (
SUCCEEDED(
hr))),
602 CHECK(
"Driver attempted to read from invalid register address or "
632 CHECK(
"Driver attempted to read from invalid register address "
640 CHECK(
"Driver attempted to read from invalid port address or "
649 (UMINT::WDF_DEVICE_HWACCESS_TARGET_SIZE)
Size,
673 WDF_DEVICE_HWACCESS_TARGET_TYPE
Type,
675 WDF_DEVICE_HWACCESS_TARGET_SIZE
Size,
751 CHECK(
"Incorrect Type parameter",
752 (
Type > WdfDeviceHwAccessTargetTypeInvalid &&
753 Type < WdfDeviceHwAccessTargetTypeMaximum)),
757 CHECK(
"Incorrect Size parameter",
758 (
Size > WdfDeviceHwAccessTargetSizeInvalid &&
759 Size < WdfDeviceHwAccessTargetSizeMaximum)),
779 "on 64-bit platform", (
Size != WdfDeviceHwAccessTargetSizeUlong64)),
803 "when computing length of write access", (
SUCCEEDED(
hr))),
832 CHECK(
"Driver attempted to write to invalid register address or "
862 CHECK(
"Driver attempted to write to invalid register address "
871 CHECK(
"Driver attempted to write to invalid port address or "
880 (UMINT::WDF_DEVICE_HWACCESS_TARGET_SIZE)
Size,
898WDFEXPORT(WdfDeviceAssignInterfaceProperty) (
972 "Property buffer size is zero, while the buffer is non-NULL"
989WDFEXPORT(WdfDeviceAllocAndQueryInterfaceProperty) (
1097WDFEXPORT(WdfDeviceQueryInterfaceProperty) (
1186 "Property buffer size is non-zero, while the buffer is NULL"
1194 "Property buffer size is zero, while the buffer is non-NULL"
1214WDFEXPORT(WdfDeviceGetDeviceStackIoType) (
1277 "HidNotifyPresence(%s) failed, %!STATUS! - Make sure to call "
1278 "WdfDeviceInitEnableHidInterface in EvtDriverDeviceAdd "
1279 "before calling WdfDeviceHidNotifyPresence.",
1317 TRAPMSG(
"The DDI WdfDeviceGetFileObject is not supported for UMDF"),
1326WDFEXPORT(WdfDeviceWdmDispatchIrpToIoQueue)(
1445 CHECK(
"This function must be called from within a "
1446 "EVT_WDFDEVICE_WDM_IRP_DISPATCH callback",
HRESULT ValidatePortAddressRange(__in PVOID Address, __in SIZE_T Length)
HRESULT ValidateAndClearMapping(__in PVOID Address, __in SIZE_T Length)
HRESULT ValidateRegisterSystemBaseAddress(__in PVOID Address, __out PVOID *UsermodeBaseAddress)
HRESULT ValidateRegisterSystemAddressRange(__in PVOID SystemAddress, __in SIZE_T Length, __out_opt PVOID *UsermodeAddress)
__inline void LockResourceTable()
HRESULT MapIoSpaceWorker(__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T NumberOfBytes, __in MEMORY_CACHING_TYPE CacheType, __deref_out VOID **PseudoBaseAddress)
__inline void UnlockResourceTable()
FxCmResList * GetTranslatedResources()
VOID ReadRegisterBuffer(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __out_ecount_full(Count) PVOID Buffer, __in ULONG Count)
PVOID GetSystemAddressFromPseudoAddress(__in PVOID PseudoAddress)
VOID WriteRegisterBuffer(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in_ecount(Count) PVOID Buffer, __in ULONG Count)
VOID WriteRegister(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register, __in SIZE_T Value)
VOID GetDeviceStackIoType(_Out_ WDF_DEVICE_IO_TYPE *ReadWriteIoType, _Out_ WDF_DEVICE_IO_TYPE *IoControlIoType)
BOOL IsRegister(__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
BOOLEAN AreRegistersMappedToUsermode(VOID)
static _Must_inspect_result_ NTSTATUS _QueryPropertyEx(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ ULONG BufferLength, _Out_ PVOID PropertyBuffer, _Out_ PULONG ResultLength, _Out_ PDEVPROPTYPE PropertyType)
BOOLEAN IsDirectHardwareAccessAllowed()
CfxDevice * m_ParentDevice
_Must_inspect_result_ NTSTATUS FxValidateInterfacePropertyData(_In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData)
static NTSTATUS NtStatusFromHr(_In_ IWudfDeviceStack *DevStack, _In_ HRESULT Hr)
_Must_inspect_result_ NTSTATUS AssignProperty(_In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ DEVPROPTYPE Type, _In_ ULONG BufferLength, _In_opt_ PVOID PropertyBuffer)
IWudfDeviceStack * GetDeviceStack(VOID)
static ULONG __inline GetLength(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size)
static _Must_inspect_result_ NTSTATUS _AllocAndQueryPropertyEx(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ POOL_TYPE PoolType, _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, _Out_ WDFMEMORY *PropertyMemory, _Out_ PDEVPROPTYPE PropertyType)
IWudfDeviceStack * m_DevStack
BOOL IsBufferType(__in WDF_DEVICE_HWACCESS_TARGET_TYPE Type)
SIZE_T ReadRegister(__in WDF_DEVICE_HWACCESS_TARGET_SIZE Size, __in PVOID Register)
__inline CfxDevice * GetDevice(VOID)
VOID CompleteRequest(__in_opt CCHAR PriorityBoost=IO_NO_INCREMENT)
VOID SetStatus(__in NTSTATUS Status)
VOID SetInformation(__in ULONG_PTR Information)
_Must_inspect_result_ NTSTATUS __fastcall DispatchStep1(__inout MdIrp Irp, __in WDFCONTEXT DispatchContext)
_Must_inspect_result_ NTSTATUS __fastcall DispatchStep2(__inout MdIrp Irp, __in_opt FxIoInCallerContext *IoInCallerCtx, __in_opt FxIoQueue *Queue)
#define ERROR_STRING_HW_ACCESS_NOT_ALLOWED
#define NT_SUCCESS(StatCode)
#define _IRQL_requires_max_(irql)
#define __drv_maxIRQL(irql)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ NTSTATUS FX_VF_FUNCTION() VerifyWdfDeviceWdmDispatchIrpToIoQueue(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ FxDevice *device, _In_ MdIrp Irp, _In_ FxIoQueue *queue, _In_ ULONG Flags)
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID _In_ WDF_EVENT_TYPE _In_ ULONG DataSizeCb
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID _In_opt_ ULONG Count
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T _In_ MEMORY_CACHING_TYPE _Out_ PVOID * PseudoBaseAddress
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP pIrp
IWudfDeviceStack * deviceStack
_Must_inspect_result_ _In_ WDFDEVICE Device
_In_ WDFDEVICE _Out_ WDF_DEVICE_IO_TYPE * ReadWriteIoType
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE Type
_Must_inspect_result_ __in WDFDEVICE __in MdIrp __in WDFQUEUE __in ULONG Flags
_Must_inspect_result_ __in WDFDEVICE __in MdIrp Irp
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFCONTEXT DispatchContext
_Must_inspect_result_ __in WDFDEVICE __in MdIrp __in WDFQUEUE Queue
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG ResultLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID _In_ WDF_EVENT_TYPE WdfEventType
FxCmResList * transResources
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
IWudfDeviceStack * pDevStack
_In_ WDFDEVICE _Out_ WDF_DEVICE_IO_TYPE _Out_ WDF_DEVICE_IO_TYPE * IoControlIoType
FxObjectHandleGetPtr(pFxDriverGlobals, Queue, FX_TYPE_QUEUE,(PVOID *)&pQueue)
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID TargetAddress
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG BufferLength
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE Size
EventWriteEVENT_UMDF_FX_DDI_READ_FROM_HARDWARE_START(Type, Size, Count)
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *) &pDevice, &pFxDriverGlobals)
FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK(ERROR_STRING_HW_ACCESS_NOT_ALLOWED,(pDevice->IsDirectHardwareAccessAllowed()==TRUE)), DriverGlobals->DriverName)
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG _Out_ PDEVPROPTYPE PropertyType
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T _In_ MEMORY_CACHING_TYPE CacheType
__in WDFDEVICE __in MdFileObject FileObject
PVOID usermodeBaseAddress
EventWriteEVENT_UMDF_FX_DDI_WRITE_TO_HARDWARE_END(Type, Size, Count)
EventWriteEVENT_UMDF_FX_DDI_READ_FROM_HARDWARE_END(Type, Size, Count)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS PhysicalAddress
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID PropertyBuffer
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_ REFGUID EventGuid
EventWriteEVENT_UMDF_FX_DDI_WRITE_TO_HARDWARE_START(Type, Size, Count)
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA _In_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFMEMORY * PropertyMemory
_In_ WDFDEVICE _In_ WDF_DEVICE_HWACCESS_TARGET_TYPE _In_ WDF_DEVICE_HWACCESS_TARGET_SIZE _In_ PVOID _In_ SIZE_T Value
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T NumberOfBytes
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN IsPresent
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxVerifierDbgBreakPoint(pFxDriverGlobals)
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
#define FX_DECLARE_VF_FUNCTION_P4(rt, fnName, at1, at2, at3, at4)
#define FxPointerNotNull(FxDriverGlobals, Ptr)
#define FX_IN_DISPATCH_CALLBACK
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
GLuint GLsizei GLsizei * length
Windows helper functions for integer overflow prevention.
PFILE_OBJECT MdFileObject
enum _WDF_EVENT_TYPE WDF_EVENT_TYPE
#define _In_reads_bytes_(s)
#define _Must_inspect_result_
#define _In_reads_opt_(s)
#define _Out_writes_all_opt_(s)
#define UNREFERENCED_PARAMETER(P)
#define TRACE_LEVEL_ERROR
#define STATUS_INVALID_PARAMETER
_Must_inspect_result_ _In_ WDFDEVICE Device
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFMEMORY * PropertyMemory
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
enum _WDF_DEVICE_IO_TYPE WDF_DEVICE_IO_TYPE
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ ULONG Flags
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE