ReactOS  0.4.14-dev-317-g96040ec
CInterruptSync Class Reference
Inheritance diagram for CInterruptSync:
Collaboration diagram for CInterruptSync:

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
 CInterruptSync (IUnknown *OuterUnknown)
 
virtual ~CInterruptSync ()
 

Public Attributes

 IMP_IInterruptSync
 
KSPIN_LOCK m_Lock
 
LIST_ENTRY m_ServiceRoutines
 
PKINTERRUPT m_Interrupt
 
INTERRUPTSYNCMODE m_Mode
 
PRESOURCELIST m_ResourceList
 
ULONG m_ResourceIndex
 
PINTERRUPTSYNCROUTINE m_SyncRoutine
 
PVOID m_DynamicContext
 
NTSTATUS m_Status
 
LONG m_Ref
 

Friends

BOOLEAN NTAPI CInterruptSynchronizedRoutine (IN PVOID ServiceContext)
 
BOOLEAN NTAPI IInterruptServiceRoutine (IN PKINTERRUPT Interrupt, IN PVOID ServiceContext)
 

Detailed Description

Definition at line 24 of file interrupt.cpp.

Constructor & Destructor Documentation

◆ CInterruptSync()

CInterruptSync::CInterruptSync ( IUnknown OuterUnknown)
inline

Definition at line 46 of file interrupt.cpp.

46 {}

◆ ~CInterruptSync()

virtual CInterruptSync::~CInterruptSync ( )
inlinevirtual

Definition at line 47 of file interrupt.cpp.

47 {}

Member Function Documentation

◆ QueryInterface()

NTSTATUS NTAPI CInterruptSync::QueryInterface ( REFIID  InterfaceId,
PVOID Interface 
)

Definition at line 77 of file interrupt.cpp.

80 {
82 
83  DPRINT("CInterruptSync::QueryInterface: this %p\n", this);
84 
85  if (IsEqualGUIDAligned(refiid, IID_IInterruptSync) ||
87  {
88  *Output = PVOID(PUNKNOWN(this));
89  PUNKNOWN(*Output)->AddRef();
90  return STATUS_SUCCESS;
91  }
92 
93 
95  {
96  DPRINT1("CInterruptSync::QueryInterface: no interface!!! iface %S\n", GuidString.Buffer);
98  }
99 
100  return STATUS_UNSUCCESSFUL;
101 }
static PWSTR GuidString
Definition: apphelp.c:91
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
void DPRINT(...)
Definition: polytest.cpp:61
void * PVOID
Definition: retypes.h:9
const GUID IID_IUnknown
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ULONG AddRef()
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Definition: arc.h:85
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ STDMETHODIMP_() [1/2]

CInterruptSync::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 29 of file interrupt.cpp.

30  {
32  return m_Ref;
33  }
#define InterlockedIncrement
Definition: armddk.h:53

◆ STDMETHODIMP_() [2/2]

CInterruptSync::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 34 of file interrupt.cpp.

35  {
37 
38  if (!m_Ref)
39  {
40  delete this;
41  return 0;
42  }
43  return m_Ref;
44  }
#define InterlockedDecrement
Definition: armddk.h:52

Friends And Related Function Documentation

◆ CInterruptSynchronizedRoutine

BOOLEAN NTAPI CInterruptSynchronizedRoutine ( IN PVOID  ServiceContext)
friend

Definition at line 110 of file interrupt.cpp.

112 {
114  This->m_Status = This->m_SyncRoutine(This, This->m_DynamicContext);
115 
116  DPRINT("CInterruptSynchronizedRoutine this %p SyncRoutine %p Context %p Status %x\n", This, This->m_SyncRoutine, This->m_DynamicContext, This->m_Status);
117  return TRUE;
118 }
#define TRUE
Definition: types.h:120
void DPRINT(...)
Definition: polytest.cpp:61
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:798

◆ IInterruptServiceRoutine

BOOLEAN NTAPI IInterruptServiceRoutine ( IN PKINTERRUPT  Interrupt,
IN PVOID  ServiceContext 
)
friend

Definition at line 165 of file interrupt.cpp.

168 {
169  PLIST_ENTRY CurEntry;
172  BOOL Success, Ret;
173 
175 
176  DPRINT("IInterruptServiceRoutine Mode %u\n", This->m_Mode);
177 
178  Ret = FALSE;
179  if (This->m_Mode == InterruptSyncModeNormal)
180  {
181  CurEntry = This->m_ServiceRoutines.Flink;
182  while (CurEntry != &This->m_ServiceRoutines)
183  {
184  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
185  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
186  if (Status == STATUS_SUCCESS)
187  {
188  /* Mark as handled and break on the first success */
189  Ret = TRUE;
190  break;
191  }
192  CurEntry = CurEntry->Flink;
193  }
194  return Ret;
195  }
196  else if (This->m_Mode == InterruptSyncModeAll)
197  {
198  CurEntry = This->m_ServiceRoutines.Flink;
199  while (CurEntry != &This->m_ServiceRoutines)
200  {
201  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
202  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
203  if (Status == STATUS_SUCCESS)
204  {
205  /* Mark as handled but don't break */
206  Ret = TRUE;
207  }
208  CurEntry = CurEntry->Flink;
209  }
210  return Ret;
211  }
212  else if (This->m_Mode == InterruptSyncModeRepeat)
213  {
214  do
215  {
216  Success = FALSE;
217  CurEntry = This->m_ServiceRoutines.Flink;
218  while (CurEntry != &This->m_ServiceRoutines)
219  {
220  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
221  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
222  if (Status == STATUS_SUCCESS)
223  {
224  /* Mark as handled if it works at least once */
225  Success = TRUE;
226  Ret = TRUE;
227  }
228  CurEntry = CurEntry->Flink;
229  }
230  } while(Success);
231  return Ret;
232  }
233  else
234  {
235  DPRINT("Unknown mode %u\n", This->m_Mode);
236  return Ret;
237  }
238 }
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
LONG NTSTATUS
Definition: precomp.h:26
Definition: interrupt.cpp:17
unsigned int BOOL
Definition: ntddk_ex.h:94
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:798
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2938
base of all file and directory entries
Definition: entries.h:82

Member Data Documentation

◆ IMP_IInterruptSync

CInterruptSync::IMP_IInterruptSync

Definition at line 45 of file interrupt.cpp.

◆ m_DynamicContext

PVOID CInterruptSync::m_DynamicContext

Definition at line 59 of file interrupt.cpp.

◆ m_Interrupt

PKINTERRUPT CInterruptSync::m_Interrupt

Definition at line 53 of file interrupt.cpp.

◆ m_Lock

KSPIN_LOCK CInterruptSync::m_Lock

Definition at line 51 of file interrupt.cpp.

◆ m_Mode

INTERRUPTSYNCMODE CInterruptSync::m_Mode

Definition at line 54 of file interrupt.cpp.

◆ m_Ref

LONG CInterruptSync::m_Ref

Definition at line 62 of file interrupt.cpp.

Referenced by STDMETHODIMP_().

◆ m_ResourceIndex

ULONG CInterruptSync::m_ResourceIndex

Definition at line 56 of file interrupt.cpp.

◆ m_ResourceList

PRESOURCELIST CInterruptSync::m_ResourceList

Definition at line 55 of file interrupt.cpp.

◆ m_ServiceRoutines

LIST_ENTRY CInterruptSync::m_ServiceRoutines

Definition at line 52 of file interrupt.cpp.

◆ m_Status

NTSTATUS CInterruptSync::m_Status

Definition at line 60 of file interrupt.cpp.

◆ m_SyncRoutine

PINTERRUPTSYNCROUTINE CInterruptSync::m_SyncRoutine

Definition at line 58 of file interrupt.cpp.


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