1*8a978a17SVictor Perevertkin /*++ 2*8a978a17SVictor Perevertkin 3*8a978a17SVictor Perevertkin Copyright (c) Microsoft Corporation 4*8a978a17SVictor Perevertkin 5*8a978a17SVictor Perevertkin Module Name: 6*8a978a17SVictor Perevertkin 7*8a978a17SVictor Perevertkin FxIoQueueCallbacks.h 8*8a978a17SVictor Perevertkin 9*8a978a17SVictor Perevertkin Abstract: 10*8a978a17SVictor Perevertkin 11*8a978a17SVictor Perevertkin This module implements the I/O package queue object callbacks 12*8a978a17SVictor Perevertkin 13*8a978a17SVictor Perevertkin Author: 14*8a978a17SVictor Perevertkin 15*8a978a17SVictor Perevertkin 16*8a978a17SVictor Perevertkin 17*8a978a17SVictor Perevertkin 18*8a978a17SVictor Perevertkin Environment: 19*8a978a17SVictor Perevertkin 20*8a978a17SVictor Perevertkin Both kernel and user mode 21*8a978a17SVictor Perevertkin 22*8a978a17SVictor Perevertkin Revision History: 23*8a978a17SVictor Perevertkin 24*8a978a17SVictor Perevertkin --*/ 25*8a978a17SVictor Perevertkin 26*8a978a17SVictor Perevertkin #ifndef _FXREQUESTCALLBACKS_H_ 27*8a978a17SVictor Perevertkin #define _FXREQUESTCALLBACKS_H_ 28*8a978a17SVictor Perevertkin 29*8a978a17SVictor Perevertkin 30*8a978a17SVictor Perevertkin // 31*8a978a17SVictor Perevertkin // Delegate which contains EvtRequestCancel 32*8a978a17SVictor Perevertkin // 33*8a978a17SVictor Perevertkin class FxRequestCancelCallback : public FxCallback { 34*8a978a17SVictor Perevertkin 35*8a978a17SVictor Perevertkin public: 36*8a978a17SVictor Perevertkin PFN_WDF_REQUEST_CANCEL m_Cancel; 37*8a978a17SVictor Perevertkin FxRequestCancelCallback(VOID)38*8a978a17SVictor Perevertkin FxRequestCancelCallback( 39*8a978a17SVictor Perevertkin VOID 40*8a978a17SVictor Perevertkin ) 41*8a978a17SVictor Perevertkin { 42*8a978a17SVictor Perevertkin m_Cancel = NULL; 43*8a978a17SVictor Perevertkin } 44*8a978a17SVictor Perevertkin 45*8a978a17SVictor Perevertkin void InvokeCancel(__in FxCallbackLock * Lock,__in WDFREQUEST Request)46*8a978a17SVictor Perevertkin InvokeCancel( 47*8a978a17SVictor Perevertkin __in FxCallbackLock* Lock, 48*8a978a17SVictor Perevertkin __in WDFREQUEST Request 49*8a978a17SVictor Perevertkin ) 50*8a978a17SVictor Perevertkin { 51*8a978a17SVictor Perevertkin if (m_Cancel != NULL) { 52*8a978a17SVictor Perevertkin PFN_WDF_REQUEST_CANCEL pMethod; 53*8a978a17SVictor Perevertkin KIRQL irql; 54*8a978a17SVictor Perevertkin 55*8a978a17SVictor Perevertkin // 56*8a978a17SVictor Perevertkin // Satisfy W4 warning, even though it is technically not necessary to 57*8a978a17SVictor Perevertkin // assign an initial value. 58*8a978a17SVictor Perevertkin // 59*8a978a17SVictor Perevertkin irql = PASSIVE_LEVEL; 60*8a978a17SVictor Perevertkin 61*8a978a17SVictor Perevertkin if (Lock != NULL) { 62*8a978a17SVictor Perevertkin Lock->Lock(&irql); 63*8a978a17SVictor Perevertkin } 64*8a978a17SVictor Perevertkin 65*8a978a17SVictor Perevertkin // 66*8a978a17SVictor Perevertkin // Clear the value before invoking the routine since the assignment 67*8a978a17SVictor Perevertkin // is invalidated when the routine is run. 68*8a978a17SVictor Perevertkin // 69*8a978a17SVictor Perevertkin pMethod = m_Cancel; 70*8a978a17SVictor Perevertkin m_Cancel = NULL; 71*8a978a17SVictor Perevertkin 72*8a978a17SVictor Perevertkin pMethod(Request); 73*8a978a17SVictor Perevertkin 74*8a978a17SVictor Perevertkin if (Lock != NULL) { 75*8a978a17SVictor Perevertkin Lock->Unlock(irql); 76*8a978a17SVictor Perevertkin } 77*8a978a17SVictor Perevertkin } 78*8a978a17SVictor Perevertkin } 79*8a978a17SVictor Perevertkin }; 80*8a978a17SVictor Perevertkin 81*8a978a17SVictor Perevertkin // 82*8a978a17SVictor Perevertkin // Delegate which contains EvtRequestCompletion 83*8a978a17SVictor Perevertkin // 84*8a978a17SVictor Perevertkin class FxRequestCompletionCallback : public FxCallback { 85*8a978a17SVictor Perevertkin 86*8a978a17SVictor Perevertkin public: 87*8a978a17SVictor Perevertkin PFN_WDF_REQUEST_COMPLETION_ROUTINE m_Completion; 88*8a978a17SVictor Perevertkin FxRequestCompletionCallback(VOID)89*8a978a17SVictor Perevertkin FxRequestCompletionCallback( 90*8a978a17SVictor Perevertkin VOID 91*8a978a17SVictor Perevertkin ) 92*8a978a17SVictor Perevertkin { 93*8a978a17SVictor Perevertkin m_Completion = NULL; 94*8a978a17SVictor Perevertkin } 95*8a978a17SVictor Perevertkin }; 96*8a978a17SVictor Perevertkin 97*8a978a17SVictor Perevertkin 98*8a978a17SVictor Perevertkin #endif // _FXREQUESTCALLBACKS_H_ 99*8a978a17SVictor Perevertkin 100