ReactOS 0.4.15-dev-7998-gdb93cb1
FxIoTargetRemoteNotificationCallback Class Reference

#include <fxiotargetremoteum.hpp>

Inheritance diagram for FxIoTargetRemoteNotificationCallback:
Collaboration diagram for FxIoTargetRemoteNotificationCallback:

Public Member Functions

 FxIoTargetRemoteNotificationCallback (PFX_DRIVER_GLOBALS FxDriverGlobals, FxIoTargetRemote *Target)
 
 ~FxIoTargetRemoteNotificationCallback ()
 
WUDF_TARGET_CONTEXT GetRegistrationId (VOID)
 
BOOL __stdcall OnQueryRemove (_In_ WUDF_TARGET_CONTEXT RegistrationID)
 
VOID __stdcall OnRemoveCanceled (_In_ WUDF_TARGET_CONTEXT RegistrationID)
 
VOID __stdcall OnRemoveComplete (_In_ WUDF_TARGET_CONTEXT RegistrationID)
 
VOID __stdcall OnCustomEvent (_In_ WUDF_TARGET_CONTEXT RegistrationID, _In_ REFGUID Event, _In_reads_bytes_(DataSize) BYTE *Data, _In_ DWORD DataSize, _In_ DWORD NameBufferOffset)
 
HRESULT __stdcall QueryInterface (__in const IID &iid, __out void **ppv)
 
ULONG __stdcall AddRef ()
 
ULONG __stdcall Release ()
 
- Public Member Functions inherited from FxGlobalsStump
 FxGlobalsStump (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
- Public Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 

Private Attributes

LONG m_cRefs
 
FxIoTargetRemotem_RemoteTarget
 

Additional Inherited Members

- Protected Member Functions inherited from FxStump
 FxStump (VOID)
 

Detailed Description

Definition at line 26 of file fxiotargetremoteum.hpp.

Constructor & Destructor Documentation

◆ FxIoTargetRemoteNotificationCallback()

FxIoTargetRemoteNotificationCallback::FxIoTargetRemoteNotificationCallback ( PFX_DRIVER_GLOBALS  FxDriverGlobals,
FxIoTargetRemote Target 
)
inline

Definition at line 38 of file fxiotargetremoteum.hpp.

41 :
42 FxGlobalsStump(FxDriverGlobals),
44 m_cRefs(1)
45 {
46 }
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

◆ ~FxIoTargetRemoteNotificationCallback()

FxIoTargetRemoteNotificationCallback::~FxIoTargetRemoteNotificationCallback ( )
inline

Definition at line 48 of file fxiotargetremoteum.hpp.

48{};

Member Function Documentation

◆ AddRef()

ULONG __stdcall FxIoTargetRemoteNotificationCallback::AddRef ( )
inline

Definition at line 115 of file fxiotargetremoteum.hpp.

117 {
119 return cRefs;
120 }
#define InterlockedIncrement
Definition: armddk.h:53
long LONG
Definition: pedump.c:60

Referenced by QueryInterface().

◆ GetRegistrationId()

WUDF_TARGET_CONTEXT FxIoTargetRemoteNotificationCallback::GetRegistrationId ( VOID  )
inline

Definition at line 51 of file fxiotargetremoteum.hpp.

54 {
56 }
MdTargetNotifyHandle m_TargetNotifyHandle

Referenced by OnQueryRemove(), OnRemoveCanceled(), and OnRemoveComplete().

◆ OnCustomEvent()

VOID __stdcall FxIoTargetRemoteNotificationCallback::OnCustomEvent ( _In_ WUDF_TARGET_CONTEXT  RegistrationID,
_In_ REFGUID  Event,
_In_reads_bytes_(DataSize) BYTE Data,
_In_ DWORD  DataSize,
_In_ DWORD  NameBufferOffset 
)

Definition at line 637 of file fxiotargetremoteum.cpp.

644{
645 UNREFERENCED_PARAMETER(RegistrationID);
649 UNREFERENCED_PARAMETER(NameBufferOffset);
650
651 //
652 // UMDF 2.0 doesn't yet support custom event. Ignore the event.
653 //
654 DO_NOTHING();
655
656 return;
657}
#define DO_NOTHING()
Definition: mxgeneral.h:32
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

◆ OnQueryRemove()

BOOL __stdcall FxIoTargetRemoteNotificationCallback::OnQueryRemove ( _In_ WUDF_TARGET_CONTEXT  RegistrationID)

Definition at line 435 of file fxiotargetremoteum.cpp.

438{
440 FxIoTargetRemote* pThis;
442 BOOLEAN bStatus;
443
444 pThis = m_RemoteTarget;
445
446 //
447 // In one of these callbacks, the driver may decide to delete the target.
448 // If that is the case, we need to be able to return and deref the object until
449 // we are done.
450 //
451 pThis->ADDREF(m_RemoteTarget);
452
454
456 bStatus = TRUE;
457
458 if (GetRegistrationId() != RegistrationID) {
459 //
460 // By design, we can get notification callbacks even after we have
461 // unregistered for notifications. This can happen if there were
462 // callbacks already in flight before we unregistered. In this case, we
463 // simply succeed on query-remove. Since we have already unregistered,
464 // there is no reason for us to fail query-remove.
465 //
468 "QueryRemove callback was for an old registration, ignoring.");
469
470 bStatus = TRUE;
471 goto exit;
472 }
473
476 "WDFIOTARGET %p: query remove notification",
478
479 //
480 // Device is gracefully being removed. PnP is asking us to close down
481 // the target. If there is a driver callback, there is *no* default
482 // behavior. This is because we don't know what the callback is going
483 // to do. For instance, the driver could reopen the target to a
484 // different device in a multi-path scenario.
485 //
486 if (pThis->m_EvtQueryRemove.m_Method != NULL) {
488 pThis->GetHandle());
489 }
490 else {
493 "WDFIOTARGET %p: query remove, default action (close for QR)",
494 pThis->GetObjectHandle());
495
496 //
497 // No callback, close it down conditionally.
498 //
500 }
501
502 if (!NT_SUCCESS(status)) {
503 bStatus = FALSE;
504 }
505
506exit:
507
508 pThis->RELEASE(m_RemoteTarget);
509
510 return bStatus;
511}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
WUDF_TARGET_CONTEXT GetRegistrationId(VOID)
__inline WDFIOTARGET GetHandle(VOID)
FxIoTargetQueryRemove m_EvtQueryRemove
VOID Close(__in FxIoTargetRemoteCloseReason Reason)
PVOID __inline GetObjectHandle(VOID)
Definition: fxobject.hpp:603
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
@ FxIoTargetRemoteCloseReasonQueryRemove
#define exit(n)
Definition: config.h:202
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
PFN_WDF_IO_TARGET_QUERY_REMOVE m_Method
_Must_inspect_result_ NTSTATUS Invoke(__in WDFIOTARGET IoTarget)
Definition: ps.c:97

◆ OnRemoveCanceled()

VOID __stdcall FxIoTargetRemoteNotificationCallback::OnRemoveCanceled ( _In_ WUDF_TARGET_CONTEXT  RegistrationID)

Definition at line 571 of file fxiotargetremoteum.cpp.

574{
576 FxIoTargetRemote* pThis;
578
579 pThis = m_RemoteTarget;
580
581 //
582 // In one of these callbacks, the driver may decide to delete the target.
583 // If that is the case, we need to be able to return and deref the object until
584 // we are done.
585 //
586 pThis->ADDREF(m_RemoteTarget);
587
590
591 if (GetRegistrationId() != RegistrationID) {
594 "RemoveCanceled callback was for an old registration, ignoring.");
595
596 goto exit;
597 }
598
601 "WDFIOTARGET %p: remove canceled notification", pThis->GetObjectHandle());
602
603 if (pThis->m_EvtRemoveCanceled.m_Method != NULL) {
604 pThis->m_EvtRemoveCanceled.Invoke(pThis->GetHandle());
605 }
606 else {
608
611 "WDFIOTARGET %p: remove canceled, default action (reopen)",
612 pThis->GetObjectHandle());
613
615
616 //
617 // Attempt to reopen the target with stored settings
618 //
619 status = pThis->Open(&params);
620
621
622
623
624
625
626
628 }
629
630exit:
631
632 pThis->RELEASE(m_RemoteTarget);
633}
_Must_inspect_result_ NTSTATUS Open(__in PWDF_IO_TARGET_OPEN_PARAMS OpenParams)
FxIoTargetRemoveCanceled m_EvtRemoveCanceled
GLenum const GLfloat * params
Definition: glext.h:5645
VOID Invoke(__in WDFIOTARGET Target)
PFN_WDF_IO_TARGET_REMOVE_CANCELED m_Method
FORCEINLINE VOID WDF_IO_TARGET_OPEN_PARAMS_INIT_REOPEN(_Out_ PWDF_IO_TARGET_OPEN_PARAMS Params)
Definition: wdfiotarget.h:340

◆ OnRemoveComplete()

VOID __stdcall FxIoTargetRemoteNotificationCallback::OnRemoveComplete ( _In_ WUDF_TARGET_CONTEXT  RegistrationID)

Definition at line 515 of file fxiotargetremoteum.cpp.

518{
520 FxIoTargetRemote* pThis;
521
522 pThis = m_RemoteTarget;
523
524 //
525 // In one of these callbacks, the driver may decide to delete the target.
526 // If that is the case, we need to be able to return and deref the object until
527 // we are done.
528 //
529 pThis->ADDREF(m_RemoteTarget);
530
532
533 if (GetRegistrationId() != RegistrationID) {
536 "RemoveComplete callback was for an old registration, ignoring.");
537
538 goto exit;
539 }
540
543 "WDFIOTARGET %p: remove complete notification", pThis->GetObjectHandle());
544
545 //
546 // The device was surprise removed, close it for good if the driver has
547 // no override.
548 //
549 if (pThis->m_EvtRemoveComplete.m_Method != NULL) {
550 pThis->m_EvtRemoveComplete.Invoke(pThis->GetHandle());
551 }
552 else {
555 "WDFIOTARGET %p: remove complete, default action (close)",
556 pThis->GetObjectHandle());
557
558 //
559 // The device is now gone for good. Close down the target for good.
560 //
562 }
563
564exit:
565
566 pThis->RELEASE(m_RemoteTarget);
567}
FxIoTargetRemoveComplete m_EvtRemoveComplete
@ FxIoTargetRemoteCloseReasonPlainClose
PFN_WDF_IO_TARGET_REMOVE_COMPLETE m_Method
VOID Invoke(__in WDFIOTARGET Target)

◆ QueryInterface()

HRESULT __stdcall FxIoTargetRemoteNotificationCallback::QueryInterface ( __in const IID iid,
__out void **  ppv 
)
inline

Definition at line 88 of file fxiotargetremoteum.hpp.

92 {
93 if (NULL == ppv) {
94 return E_INVALIDARG;
95 }
96
97 *ppv = NULL;
98
99 if ( iid == IID_IUnknown) {
100 *ppv = static_cast<IUnknown *> (this);
101 }
102 else if ( iid == IID_IWudfTargetCallbackDeviceChange) {
103 *ppv = static_cast<IWudfTargetCallbackDeviceChange *> (this);
104 }
105 else {
106 return E_INVALIDARG;
107 }
108
109 this->AddRef();
110 return S_OK;
111 }
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52

◆ Release()

ULONG __stdcall FxIoTargetRemoteNotificationCallback::Release ( )
inline

Definition at line 124 of file fxiotargetremoteum.hpp.

126 {
128 if (0 == cRefs) {
129 //
130 // The lifetime of this object is controlled by FxIoTargetRemote
131 // object (the container object), and not by this ref count. This
132 // method is implemented just to satisfy the interface implemetation
133 // requirement.
134 //
135 DO_NOTHING();
136 }
137
138 return cRefs;
139 }
#define InterlockedDecrement
Definition: armddk.h:52

Member Data Documentation

◆ m_cRefs

LONG FxIoTargetRemoteNotificationCallback::m_cRefs
private

Definition at line 32 of file fxiotargetremoteum.hpp.

Referenced by AddRef(), and Release().

◆ m_RemoteTarget

FxIoTargetRemote* FxIoTargetRemoteNotificationCallback::m_RemoteTarget
private

The documentation for this class was generated from the following files: