21#include "../fxtargetsshared.hpp"
35 m_EvtQueryRemove(FxDriverGlobals),
36 m_EvtRemoveCanceled(FxDriverGlobals),
37 m_EvtRemoveComplete(FxDriverGlobals)
56#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
58#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
61 m_pIoDispatcher =
NULL;
62 m_pRemoteDispatcher =
NULL;
63 m_NotificationCallback =
NULL;
100 if (pSearchDevice ==
NULL) {
105 "Attributes->ParentObject 0x%p must have WDFDEVICE as an "
106 "eventual ancestor, %!STATUS!",
111 else if (pSearchDevice !=
Device) {
116 "Attributes->ParentObject 0x%p ancestor is WDFDEVICE %p, but "
117 "not the same WDFDEVICE 0x%p passed to WdfIoTargetCreate, "
133 "Could not allocate memory for target, %!STATUS!",
status);
159 "Commit failed for target, %!STATUS!",
status);
229 "Reopen only supported if the open type is WdfIoTargetOpenByName WDFIOTARGET %p %!STATUS!",
256 "Could not allocate memory for target name for WDFIOTARGET %p",
269 "Could not allocate memory for target name "
287 "Opening WDFIOTARGET %p which is removed, state %d",
297 "Opening an already open WDFIOTARGET %p, open state %d",
337 if (reopen ==
FALSE) {
379 if (reopen ==
FALSE) {
385 if (reopen ==
FALSE) {
412 if (reopen ==
FALSE) {
431 "WDFIOTARGET %p, could not register pnp notification, %!STATUS! not "
445#if (FX_CORE_MODE == FX_CORE_USER_MODE)
458#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
477 "WDFIOTARGET %p could not transition to started state, %!STATUS!",
537 pNotifyHandle =
NULL;
548#pragma prefast(suppress: __WARNING_UNUSED_SCALAR_ASSIGNMENT, "PFD is warning that the following assignement is unused. Suppress it to prevent changing any logic.")
562 "Closing WDFIOTARGET %p which is opening, waiting on event %p",
584 "Closing WDFIOTARGET %p, reason: query remove",
623 "WDFIOTARGET %p: fileobj %p, devobj %p, handle %p, notify handle %I64d",
693 "WDFIOTARGET %p derefing PDO %p on close",
702 "WDFIOTARGET %p derefing FileObj %p on close",
706#if (FX_CORE_MODE == FX_CORE_USER_MODE)
711#if (FX_CORE_MODE == FX_CORE_USER_MODE)
712 UnbindHandle(&pointers);
718 "WDFIOTARGET %p closing handle %p on close",
731 "WDFIOTARGET %p cleared pointers %p state %!WDF_IO_TARGET_STATE!,"
732 " open state %d, pdo %p, fileobj %p, handle %p",
#define CheckState(OldState, NewState)
unsigned long long UINT64
static FxDeviceBase * _SearchForDevice(__in FxObject *Object, __out_opt IFxHasCallbacks **Callbacks)
WDFDEVICE __inline GetHandle(VOID)
FxIoTargetClearedPointers * m_ClearedPointers
virtual VOID Remove(VOID)
FxIoTargetRemoveComplete m_EvtRemoveComplete
_Must_inspect_result_ NTSTATUS OpenLocalTargetByFile(_In_ PWDF_IO_TARGET_OPEN_PARAMS OpenParams)
_Must_inspect_result_ NTSTATUS Open(__in PWDF_IO_TARGET_OPEN_PARAMS OpenParams)
FxIoTargetRemote(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
FxIoTargetQueryRemove m_EvtQueryRemove
virtual VOID ClearTargetPointers(VOID)
BOOLEAN CanRegisterForPnpNotification(VOID)
VOID ResetTargetNotifyHandle(VOID)
FxIoTargetRemoveOpenParams m_OpenParams
NTSTATUS InitRemote(__in FxDeviceBase *Device)
NTSTATUS GetTargetDeviceRelations(_Out_ BOOLEAN *Close)
VOID UnregisterForPnpNotification(_In_ MdTargetNotifyHandle Handle)
MdTargetNotifyHandle m_TargetNotifyHandle
VOID Close(__in FxIoTargetRemoteCloseReason Reason)
NTSTATUS RegisterForPnpNotification(VOID)
NTSTATUS InitRemoteModeSpecific(__in FxDeviceBase *Device)
VOID RemoveModeSpecific(VOID)
FxIoTargetRemoveCanceled m_EvtRemoveCanceled
NTSTATUS OpenTargetHandle(_In_ PWDF_IO_TARGET_OPEN_PARAMS OpenParams, _Inout_ FxIoTargetRemoveOpenParams *pParams)
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in FxDeviceBase *Device, __out FxIoTargetRemote **Target)
virtual _Must_inspect_result_ NTSTATUS GotoStartState(__in PLIST_ENTRY RequestListHead, __in BOOLEAN Lock=TRUE)
UCHAR GetTargetIoType(VOID)
MdDeviceObject m_TargetDevice
MdDeviceObject m_TargetPdo
virtual VOID WaitForDisposeEvent(VOID)
MdDeviceObject m_InStackDevice
WDF_IO_TARGET_STATE m_State
VOID SubmitPendedRequests(__in PLIST_ENTRY RequestListHeadHead)
VOID CompletePendedRequestList(__in PLIST_ENTRY RequestListHead)
virtual VOID ClearTargetPointers(VOID)
static VOID _CancelSentRequests(__in PSINGLE_LIST_ENTRY RequestListHead)
_Must_inspect_result_ NTSTATUS InitModeSpecific(__in CfxDeviceBase *Device)
virtual VOID GotoRemoveState(__in WDF_IO_TARGET_STATE NewState, __in PLIST_ENTRY PendedRequestListHead, __in PSINGLE_LIST_ENTRY SentRequestListHead, __in BOOLEAN Lock, __out PBOOLEAN Wait)
virtual VOID WaitForSentIoToComplete(VOID)
MdFileObject m_TargetFileObject
VOID SetDeviceBase(__in CfxDeviceBase *DeviceBase)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
__drv_restoresIRQL KIRQL __in BOOLEAN Unlock
VOID DeleteFromFailedCreate(VOID)
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
static __inline VOID MxDereferenceObject(__in PVOID Object)
static __inline VOID MxReferenceObject(__in PVOID Object)
static __inline NTSTATUS MxClose(__in HANDLE Handle)
#define NT_SUCCESS(StatCode)
#define InitializeListHead(ListHead)
IN PVCB IN PDIRENT OUT PULONG EaLength
#define KMDF_ONLY_CODE_PATH_ASSERT()
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
return pObject GetObjectHandle()
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
FxIoTargetRemoteCloseReason
@ FxIoTargetRemoteCloseReasonPlainClose
@ FxIoTargetRemoteCloseReasonQueryRemove
@ FxIoTargetRemoteCloseReasonDelete
@ FxIoTargetRemoteOpenStateClosed
@ FxIoTargetRemoteOpenStateOpening
@ FxIoTargetRemoteOpenStateOpen
#define UMDF_ONLY_CODE_PATH_ASSERT()
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
GLuint GLuint GLsizei GLenum type
GLenum const GLfloat * params
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
PFILE_OBJECT MdFileObject
PDEVICE_OBJECT MdDeviceObject
#define _Must_inspect_result_
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
#define TRACE_LEVEL_INFORMATION
_Must_inspect_result_ NTSTATUS FxDuplicateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in const UNICODE_STRING *Source, __out PUNICODE_STRING Destination)
NTSTATUS EnterCRAndWaitAndLeave(VOID)
MdFileObject TargetFileObject
PFN_WDF_IO_TARGET_QUERY_REMOVE m_Method
PFN_WDF_IO_TARGET_REMOVE_CANCELED m_Method
PFN_WDF_IO_TARGET_REMOVE_COMPLETE m_Method
LARGE_INTEGER AllocationSize
WDF_IO_TARGET_OPEN_TYPE OpenType
VOID Set(__in PWDF_IO_TARGET_OPEN_PARAMS OpenParams, __in PUNICODE_STRING Name, __in PVOID Ea, __in ULONG EaLength)
PLARGE_INTEGER AllocationSizePointer
UNICODE_STRING TargetDeviceName
_Must_inspect_result_ BOOLEAN IsVersionGreaterThanOrEqualTo(__in ULONG Major, __in ULONG Minor)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_DEVICE_STATE
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE Device
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
enum _WDF_IO_TARGET_OPEN_TYPE WDF_IO_TARGET_OPEN_TYPE
@ WdfIoTargetOpenLocalTargetByFile
@ WdfIoTargetOpenUseExistingDevice
_Must_inspect_result_ _In_ WDFIOTARGET _In_ PWDF_IO_TARGET_OPEN_PARAMS OpenParams
@ WdfIoTargetClosedForQueryRemove
WDF_EXTERN_C_START enum _WDF_IO_TARGET_STATE WDF_IO_TARGET_STATE
_Must_inspect_result_ _In_opt_ WDFKEY _In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ULONG _Out_opt_ PULONG CreateDisposition
_Must_inspect_result_ _In_opt_ WDFKEY _In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ULONG CreateOptions
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG _In_opt_ PVOID EaBuffer
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList