ReactOS  r76032
chanmgr.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Drivers
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: drivers/sac/driver/chanmgr.c
5  * PURPOSE: Driver for the Server Administration Console (SAC) for EMS
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "sacdrv.h"
12 
13 /* GLOBALS ********************************************************************/
14 
21 
22 /* FUNCTIONS ******************************************************************/
23 
24 #define MAX_REF_COUNT 100
25 
26 #define CHANNEL_SLOT_IS_IN_USE(x) (ChannelRefCount[(x)] > 0)
27 
31 {
32  return ChannelArray[Index];
33 }
34 
36 LONG
38 {
39  return ChannelRefCount[Index];
40 }
41 
43 LONG
45 {
46  if (ChannelGetReferenceCount(Index) > 0)
47  {
49  ASSERT(ChannelRefCount[Index] >= 1);
52  ASSERT(ChannelRefCount[Index] >= 2);
53  }
54 
55  return ChannelGetReferenceCount(Index);
56 }
57 
59 LONG
61 {
62  LONG RefCount;
63 
64  ChannelSlotLock(Index);
65  RefCount = ChannelReferenceByIndex(Index);
66  ChannelSlotUnlock(Index);
67  return RefCount;
68 }
69 
71 LONG
73 {
75  ASSERT(ChannelGetReferenceCount(Index) > 1);
77  ASSERT(ChannelGetReferenceCount(Index) >= 1);
78  return ChannelGetReferenceCount(Index);
79 }
80 
82 VOID
84 {
85  ChannelSlotLock(Index);
87  ChannelSlotUnlock(Index);
88 }
89 
91 VOID
93 {
94  ASSERT(ChannelGetReferenceCount(Index) == 1);
97 }
98 
100 VOID
102 {
103  ASSERT(ChannelGetReferenceCount(Index) == 0);
105 }
106 
108 VOID
110 {
111  ChannelSlotLock(Index);
113  ChannelSlotUnlock(Index);
114 }
115 
116 NTSTATUS
117 NTAPI
119 {
120  ULONG i;
121 
122  /* Initialize the channel lock */
123  SacInitializeLock(&ChannelCreateLock);
125 
126  /* Loop through the channel arrays */
127  for (i = 0; i < SAC_MAX_CHANNELS; i++)
128  {
129  /* Clear and initialize their locks */
130  ChannelArray[i] = NULL;
131  SacInitializeLock(&ChannelSlotLock[i]);
132 
133  /* Clear their statuses and reference counts */
136  }
137 
138  /* All good */
139  return STATUS_SUCCESS;
140 }
141 
142 NTSTATUS
143 NTAPI
145 {
146  /* FIXME: TODO */
147  return STATUS_NOT_IMPLEMENTED;
148 }
149 
150 NTSTATUS
151 NTAPI
153  OUT PSAC_CHANNEL* Channel)
154 {
155  NTSTATUS Status, Status1;
156  ULONG i;
158  PWCHAR ChannelName;
159  BOOLEAN Found;
160  CHECK_PARAMETER1(Name);
161  CHECK_PARAMETER2(Channel);
162 
163  /* Assume failure */
164  *Channel = NULL;
165  Status = STATUS_NOT_FOUND;
166 
167  /* Loop through all channels */
168  for (i = 0; i < SAC_MAX_CHANNELS; i++)
169  {
170  /* Reference this one and check if it's valid */
172  {
173  /* All good, grab it */
174  CurrentChannel = ChannelFromIndex(i);
175  ASSERT(CurrentChannel != NULL);
176 
177  /* Get its name */
178  Status1 = ChannelGetName(CurrentChannel, &ChannelName);
179  ASSERT(NT_SUCCESS(Status1));
180 
181  /* Check if this is the name that was passed in */
182  Found = wcsicmp(Name, ChannelName);
183  SacFreePool(ChannelName);
184  if (Found)
185  {
186  /* We found it, return it (with a reference held) */
187  *Channel = CurrentChannel;
188  return STATUS_SUCCESS;
189  }
190 
191  /* Not the one we want, dereference this one and keep going */
193  }
194  }
195 
196  /* No channels with this name were found */
197  return Status;
198 }
199 
200 NTSTATUS
201 NTAPI
203  OUT PSAC_CHANNEL* TargetChannel)
204 {
206  ULONG i;
207  PSAC_CHANNEL Channel;
208  CHECK_PARAMETER2(TargetChannel);
209 
210  /* Assume failure */
211  *TargetChannel = NULL;
212  Status = STATUS_NOT_FOUND;
213 
214  /* Loop through all channels */
215  for (i = 0; i < SAC_MAX_CHANNELS; i++)
216  {
217  /* Reference this one and check if it's valid */
219  {
220  /* All good, grab it */
221  Channel = ChannelFromIndex(i);
222  ASSERT(Channel != NULL);
223 
224  /* Check if the channel ID matches */
225  if (ChannelIsEqual(Channel, &ChannelId))
226  {
227  /* We found it, return it (with a reference held) */
228  *TargetChannel = Channel;
229  return STATUS_SUCCESS;
230  }
231 
232  /* Not the one we want, dereference this one and keep going */
234  }
235  }
236 
237  /* No channels with this ID were found */
238  return Status;
239 }
240 
241 NTSTATUS
242 NTAPI
244 {
245  LONG Index;
246  ULONG RefCount;
247  PSAC_CHANNEL ThisChannel;
248  CHECK_PARAMETER(Channel);
249 
250  /* Get the index of the channel */
251  Index = ChannelGetIndex(Channel);
252 
253  /* Drop a reference -- there should still be at least the keepalive left */
254  ChannelSlotLock(Index);
255  RefCount = ChannelDereferenceByIndex(Index);
256  ASSERT(RefCount > 0);
257 
258  /* Do we only have the keep-alive left, and the channel is dead? */
259  if ((RefCount == 1) && !(ChannelIsActive(Channel)))
260  {
261  /* Check if the ??? flag is set, or if there's no output data */
262  ThisChannel = ChannelFromIndex(Index);
263  if (!(ThisChannel->Flags & 1))
264  {
265  /* Nope, we can wipe the references and get rid of it */
267  }
268  else if (!ThisChannel->ChannelHasNewOBufferData)
269  {
270  /* No data, we can wipe the references and get rid of it */
272  }
273  }
274 
275  /* We're done, we can unlock the slot now */
276  ChannelSlotUnlock(Index);
277  return STATUS_SUCCESS;
278 }
279 
280 BOOLEAN
281 NTAPI
283 {
285  BOOLEAN IsUnique = FALSE;
286  PSAC_CHANNEL Channel;
287 
288  /* Check if a channel with this name already exists */
289  Status = ChanMgrGetChannelByName(ChannelName, &Channel);
290  if (Status == STATUS_NOT_FOUND) IsUnique = TRUE;
291 
292  /* If one did, dereference it, all we wanted was to check uniqueness */
293  if (NT_SUCCESS(Status)) ChanMgrReleaseChannel(Channel);
294 
295  /* Return if one was found or not */
296  return IsUnique;
297 }
298 
299 NTSTATUS
300 NTAPI
302 {
303  /* FIXME: TODO */
304  return STATUS_NOT_IMPLEMENTED;
305 }
306 
307 NTSTATUS
308 NTAPI
310 {
311  ULONG i;
313 
314  /* Loop all the channels */
315  for (i = 0; i < SAC_MAX_CHANNELS; i++)
316  {
317  /* Lock this index and see if the channel was reaped */
318  ChannelSlotLock(i);
319  if (!ChannelReaped[i])
320  {
321  /* It was not reaped yet, so a channel should still be here */
323  if (ChannelGetReferenceCount(i) <= 0)
324  {
325  /* The channel has no more references, so clear the buffer flags */
326  _InterlockedExchange(&ChannelArray[i]->ChannelHasNewIBufferData, 0);
327  _InterlockedExchange(&ChannelArray[i]->ChannelHasNewOBufferData, 0);
328 
329  /* And reap it */
330  Status = ChanMgrReapChannel(i);
331  }
332  }
333 
334  /* Release the lock, and move on unless reaping failed */
336  if (!NT_SUCCESS(Status)) break;
337  }
338 
339  /* Return reaping status */
340  return Status;
341 }
342 
343 NTSTATUS
344 NTAPI
347 {
349  PSAC_CHANNEL NewChannel;
350  SAC_CHANNEL_ID ChanId;
351  ULONG i;
352  CHECK_PARAMETER(Channel);
353  CHECK_PARAMETER2(Attributes);
354 
355  /* No other channel create attempts can happen */
357 
358  /* Is the channel manager initialized? */
360  {
361  /* Nope, bail out */
362  Status = STATUS_UNSUCCESSFUL;
363  goto ReturnStatus;
364  }
365 
366  /* Reap any zombie channels */
367  Status = ChanMgrReapChannels();
368  if (!NT_SUCCESS(Status))
369  {
370  /* Bail out on error */
371  Status = STATUS_UNSUCCESSFUL;
372  goto ReturnStatus;
373  }
374 
375  /* Check if we already have a channel with this name */
376  if (!ChanMgrIsUniqueName(Attributes->NameBuffer))
377  {
378  /* We do, fail */
379  Status = STATUS_DUPLICATE_NAME;
380  goto ReturnStatus;
381  }
382 
383  /* Allocate this channel */
384  NewChannel = SacAllocatePool(sizeof(SAC_CHANNEL), CHANNEL_BLOCK_TAG);
385  CHECK_PARAMETER_WITH_STATUS(NewChannel, STATUS_NO_MEMORY); // bug
386  RtlZeroMemory(NewChannel, sizeof(SAC_CHANNEL));
387 
388  /* Loop channel slots */
389  for (i = 0; i < SAC_MAX_CHANNELS; i++)
390  {
391  /* Find a free spot for it */
392  if (ChannelReaped[i])
393  {
394  /* Free slot found, attempt to use it */
396  _InterlockedCompareExchange((PLONG)&ChannelArray[i], (LONG)NewChannel, 0);
397  if (ChannelArray[i] == NewChannel) break;
398  }
399  }
400 
401  /* Did we not find a single free slot? */
402  if (i == SAC_MAX_CHANNELS)
403  {
404  /* Bail out */
405  goto ReturnStatus;
406  }
407 
408  /* Create an ID for this channel */
409  RtlZeroMemory(&ChanId, sizeof(ChanId));
410  Status = ExUuidCreate(&ChanId.ChannelGuid);
411  if (!NT_SUCCESS(Status))
412  {
413  /* Bail out if we couldn't */
414  SAC_DBG(SAC_DBG_INIT, "SAC Create Channel :: Failed to get GUID\n");
415  goto ReturnStatus;
416  }
417 
418  /* Now create the channel proper */
419  Status = ChannelCreate(NewChannel, Attributes, ChanId);
420  if (NT_SUCCESS(Status))
421  {
422  /* Set the channel index */
423  _InterlockedExchange(&NewChannel->Index, i);
424 
425  /* Add the initial reference to the channel */
427 
428  /* Return it to the caller */
429  *Channel = NewChannel;
430 
431  /* This slot is now occupied */
432  ASSERT(ChannelReaped[i] == 1);
434  }
435  else
436  {
437  /* We couldn't create it, free the buffer */
438  SacFreePool(NewChannel);
439  }
440 
441 ReturnStatus:
442  /* Return whatever the operation status was */
444  return Status;
445 }
446 
447 NTSTATUS
448 NTAPI
451  OUT PSAC_CHANNEL* TargetChannel)
452 {
454  PSAC_CHANNEL FoundChannel;
455 
456  /* Lookup the channel by ID first */
457  Status = ChanMgrGetByHandle(ChannelId, &FoundChannel);
458  if (NT_SUCCESS(Status))
459  {
460  /* We found it, now check if the file object matches */
461  if (FoundChannel->FileObject == FileObject)
462  {
463  /* Yep, return success */
464  *TargetChannel = FoundChannel;
465  }
466  else
467  {
468  /* Nope, drop the reference on the channel */
469  ChanMgrReleaseChannel(FoundChannel);
470 
471  /* And return failure */
472  *TargetChannel = NULL;
473  Status = STATUS_NOT_FOUND;
474  }
475  }
476 
477  /* Return if we found it or not */
478  return Status;
479 }
480 
481 NTSTATUS
482 NTAPI
484  IN PLONG ChannelIndex)
485 {
486  CHECK_PARAMETER1(Channel);
487  CHECK_PARAMETER2(ChannelIndex);
488 
489  /* Just return the index of the channel */
490  *ChannelIndex = ChannelGetIndex(Channel);
491  return STATUS_SUCCESS;
492 }
493 
494 NTSTATUS
495 NTAPI
497  IN PSAC_CHANNEL* TargetChannel)
498 {
500  CHECK_PARAMETER1(TargetIndex < SAC_MAX_CHANNELS);
501  CHECK_PARAMETER2(TargetChannel);
502 
503  /* Assume failure */
504  *TargetChannel = NULL;
505  Status = STATUS_NOT_FOUND;
506 
507  /* Reference this one and check if it's valid */
508  if (ChannelReferenceByIndexWithLock(TargetIndex) > 0)
509  {
510  /* We found it, return it (with a reference held) */
511  *TargetChannel = ChannelFromIndex(TargetIndex);
512  return STATUS_SUCCESS;
513  }
514 
515  /* No channels with this ID were found */
516  return Status;
517 }
518 
519 NTSTATUS
520 NTAPI
522  IN PULONG TargetIndex,
523  OUT PSAC_CHANNEL *TargetChannel)
524 {
526  ULONG i;
527  LONG ChannelIndex, StartIndex;
528  PSAC_CHANNEL FoundChannel;
529  BOOLEAN ChannelFound;
530  CHECK_PARAMETER1(CurrentChannel);
531  CHECK_PARAMETER2(TargetIndex);
532  CHECK_PARAMETER3(TargetChannel);
533 
534  /* Get the current channel index */
535  Status = ChanMgrGetChannelIndex(CurrentChannel, &ChannelIndex);
536  if (!NT_SUCCESS(Status)) return Status;
537 
538  /* Assume failure */
539  ChannelFound = FALSE;
540 
541  /* Loop through all the possible active channels */
542  StartIndex = (ChannelIndex + 1) % SAC_MAX_CHANNELS;
543  for (i = StartIndex; i != StartIndex; i = (i + 1) % SAC_MAX_CHANNELS)
544  {
545  /* Get the channel and see if it exists*/
546  Status = ChanMgrGetByIndex(i, &FoundChannel);
547  if (Status != STATUS_NOT_FOUND)
548  {
549  /* Bail out if we failed for some reason */
550  if (!NT_SUCCESS(Status)) return Status;
551 
552  /* It exists -- is it active? Or, does it have output data? */
553  if ((ChannelIsActive(FoundChannel)) ||
554  (!(ChannelIsActive(FoundChannel)) &&
555  (FoundChannel->ChannelHasNewOBufferData)))
556  {
557  /* It's active or has output data, return with it */
558  ChannelFound = TRUE;
559  break;
560  }
561 
562  /* Drop the reference on this channel and try the next one */
563  Status = ChanMgrReleaseChannel(FoundChannel);
564  if (!NT_SUCCESS(Status)) return Status;
565  }
566  }
567 
568  /* Check if we successfully found a channel */
569  if ((NT_SUCCESS(Status)) && (ChannelFound))
570  {
571  /* Return it and its indexed. Remember we still hold the reference */
572  *TargetIndex = i;
573  *TargetChannel = FoundChannel;
574  }
575 
576  /* All done */
577  return Status;
578 }
579 
580 NTSTATUS
581 NTAPI
583 {
584  CHECK_PARAMETER1(Channel);
585  CHECK_PARAMETER(ChannelGetReferenceCount(Channel->Index) > 0);
586 
587  /* Destroy the channel */
588  return Channel->ChannelDestroy(Channel);
589 }
590 
591 NTSTATUS
592 NTAPI
594 {
596  CHECK_PARAMETER(Channel);
597 
598  /* Check if the channel is active */
599  if (ChannelIsActive(Channel))
600  {
601  /* Yep, close it */
602  Status = ChannelClose(Channel);
603  }
604  else
605  {
606  /* Nothing to do */
608  }
609 
610  /* Handle the channel close */
611  ConMgrHandleEvent(TRUE, Channel, &Status);
612  return Status;
613 }
614 
615 NTSTATUS
616 NTAPI
618 {
619  ULONG i;
620  PSAC_CHANNEL Channel;
622  CHECK_PARAMETER(ChannelCount);
623 
624  /* Assume no channels */
625  *ChannelCount = 0;
626 
627  /* Loop every channel */
628  for (i = 0; i < SAC_MAX_CHANNELS; i++)
629  {
630  /* See if this one exists */
631  Status = ChanMgrGetByIndex(i, &Channel);
632  if (Status != STATUS_NOT_FOUND)
633  {
634  /* Sanity checks*/
635  ASSERT(NT_SUCCESS(Status));
636  ASSERT(Channel != NULL);
637 
638  /* It exists -- is it active? Or, does it have output data? */
639  if ((ChannelIsActive(Channel)) ||
640  (!(ChannelIsActive(Channel)) &&
641  (Channel->ChannelHasNewOBufferData)))
642  {
643  /* It's active or has output data, increase the count */
644  ++*ChannelCount;
645  break;
646  }
647 
648  /* Drop the reference on this channel and try the next one */
649  Status = ChanMgrReleaseChannel(Channel);
650  if (!NT_SUCCESS(Status)) return Status;
651  }
652  else
653  {
654  /* Channel doesn't exist, nothing wrong with that, keep going */
655  Status = STATUS_SUCCESS;
656  }
657  }
658 
659  /* We should always succeed if we get here */
660  ASSERT(NT_SUCCESS(Status));
661  return Status;
662 }
663 
664 NTSTATUS
665 NTAPI
667 {
669  ULONG Count;
670 
671  /* Count the channels */
672  Status = ChanMgrGetChannelCount(&Count);
673  CHECK_PARAMETER(Status == STATUS_SUCCESS);
674 
675  /* Return if we hit the limit */
676  *IsFull = (Count == SAC_MAX_CHANNELS);
677  return Status;
678 }
679 
680 NTSTATUS
681 NTAPI
683 {
684  PSAC_CHANNEL Channel;
685  ULONG i;
687  CHECK_PARAMETER1(FileObject);
688 
689  /* Loop all channels */
690  for (i = 0; i < SAC_MAX_CHANNELS; i++)
691  {
692  /* Try to get this one */
693  Status = ChanMgrGetByIndex(i, &Channel);
694  if (!NT_SUCCESS(Status)) break;
695 
696  /* Check if the FO matches, if so, close the channel */
697  if (Channel->FileObject == FileObject) ChanMgrCloseChannel(Channel);
698 
699  /* Drop the reference and try the next channel(s) */
700  Status = ChanMgrReleaseChannel(Channel);
701  if (!NT_SUCCESS(Status)) break;
702  }
703 
704  /* All done */
705  return Status;
706 }
707 
708 NTSTATUS
709 NTAPI
711 {
712  return STATUS_NOT_IMPLEMENTED;
713 }
NTSTATUS NTAPI ConMgrHandleEvent(IN ULONG EventCode, IN PSAC_CHANNEL Channel, OUT PVOID Data)
Definition: conmgr.c:888
NTSTATUS NTAPI ChanMgrGetByHandleAndFileObject(IN SAC_CHANNEL_ID ChannelId, IN PFILE_OBJECT FileObject, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:449
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
long __cdecl _InterlockedCompareExchange(_Interlocked_operand_ long volatile *_Destination, long _Exchange, long _Comparand)
NTSTATUS NTAPI ChanMgrReapChannels(VOID)
Definition: chanmgr.c:309
#define STATUS_ALREADY_DISCONNECTED
Definition: ntstatus.h:204
LONG Index
Definition: sacdrv.h:426
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
PFILE_OBJECT FileObject
Definition: sacdrv.h:440
return STATUS_SUCCESS
Definition: btrfs.c:2664
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
NTSTATUS NTAPI ChanMgrGetChannelByName(IN PWCHAR Name, OUT PSAC_CHANNEL *Channel)
Definition: chanmgr.c:152
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define ChannelSlotUnlock(x)
Definition: sacdrv.h:1339
LONG ChannelReaped[SAC_MAX_CHANNELS]
Definition: chanmgr.c:19
BOOLEAN NTAPI ChannelIsEqual(IN PSAC_CHANNEL Channel, IN PSAC_CHANNEL_ID ChannelId)
Definition: channel.c:25
uint16_t * PWCHAR
Definition: typedefs.h:54
_Must_inspect_result_ _In_ ULONG Index
Definition: fltkernel.h:1824
NTSTATUS NTAPI ChanMgrGetByIndex(IN LONG TargetIndex, IN PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:496
#define STATUS_DUPLICATE_NAME
Definition: ntstatus.h:411
NTSTATUS NTAPI ChanMgrShutdown(VOID)
Definition: chanmgr.c:144
FORCEINLINE VOID ChannelReferenceToOneByIndex(IN LONG Index)
Definition: chanmgr.c:101
BOOLEAN ChannelCreateEnabled
Definition: chanmgr.c:16
FORCEINLINE BOOLEAN ChannelHasNewOBufferData(IN PSAC_CHANNEL Channel)
Definition: rawchan.c:51
#define CHANNEL_SLOT_IS_IN_USE(x)
Definition: chanmgr.c:26
#define CHECK_PARAMETER_WITH_STATUS(Parameter, Status)
Definition: sacdrv.h:47
GLenum GLclampf GLint i
Definition: glfuncs.h:14
FORCEINLINE LONG ChannelReferenceByIndex(IN LONG Index)
Definition: chanmgr.c:44
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
FORCEINLINE VOID ChannelDereferenceToZeroByIndex(IN LONG Index)
Definition: chanmgr.c:92
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
PSAC_CHANNEL ChannelArray[SAC_MAX_CHANNELS]
Definition: chanmgr.c:17
long LONG
Definition: pedump.c:60
FORCEINLINE VOID SacInitializeLock(IN PSAC_CHANNEL_LOCK Lock)
Definition: sacdrv.h:1252
#define MAX_REF_COUNT
Definition: chanmgr.c:24
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
smooth NULL
Definition: ftsmooth.c:557
#define FORCEINLINE
Definition: ntbasedef.h:213
_In_ PFILE_OBJECT FileObject
Definition: classpnp.h:1229
NTKERNELAPI NTSTATUS ExUuidCreate(OUT UUID *Uuid)
Definition: uuid.c:303
#define CHECK_PARAMETER(x)
Definition: sacdrv.h:55
#define SacAllocatePool(Length, Tag)
Definition: sacdrv.h:24
FORCEINLINE PSAC_CHANNEL ChannelFromIndex(IN ULONG Index)
Definition: chanmgr.c:30
FORCEINLINE VOID ChannelReferenceToOneByIndexWithLock(IN LONG Index)
Definition: chanmgr.c:109
NTSTATUS NTAPI ChanMgrCreateChannel(OUT PSAC_CHANNEL *Channel, IN PSAC_CHANNEL_ATTRIBUTES Attributes)
Definition: chanmgr.c:345
NTSTATUS NTAPI ChanMgrGenerateUniqueCmdName(IN PWCHAR ChannelName)
Definition: chanmgr.c:710
LONG ChannelHasNewOBufferData
Definition: sacdrv.h:459
FORCEINLINE LONG ChannelDereferenceByIndex(IN LONG Index)
Definition: chanmgr.c:72
FORCEINLINE BOOLEAN ChannelHasNewIBufferData(IN PSAC_CHANNEL Channel)
Definition: sacdrv.h:1361
FORCEINLINE LONG ChannelGetIndex(IN PSAC_CHANNEL Channel)
Definition: sacdrv.h:1353
NTSTATUS NTAPI ChanMgrReapChannel(IN ULONG ChannelIndex)
Definition: chanmgr.c:301
unsigned char BOOLEAN
#define STATUS_NOT_FOUND
Definition: shellext.h:53
NTSTATUS NTAPI ChanMgrGetNextActiveChannel(IN PSAC_CHANNEL CurrentChannel, IN PULONG TargetIndex, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:521
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
GUID ChannelGuid
Definition: sacdrv.h:296
BOOLEAN NTAPI ChanMgrIsUniqueName(IN PWCHAR ChannelName)
Definition: chanmgr.c:282
#define SacFreePool(Pointer)
Definition: sacdrv.h:26
#define CHECK_PARAMETER1(x)
Definition: sacdrv.h:57
* PFILE_OBJECT
Definition: iotypes.h:1949
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
FORCEINLINE LONG ChannelReferenceByIndexWithLock(IN LONG Index)
Definition: chanmgr.c:60
_In_ PUNICODE_STRING Name
Definition: mrx.h:218
NTSTATUS NTAPI ChannelClose(IN PSAC_CHANNEL Channel)
Definition: channel.c:558
char * PBOOLEAN
Definition: retypes.h:11
NTSTATUS NTAPI ChanMgrChannelDestroy(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:582
LONG ChannelRefCount[SAC_MAX_CHANNELS]
Definition: chanmgr.c:18
#define SAC_DBG_INIT
Definition: sacdrv.h:34
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
ULONG Flags
Definition: sacdrv.h:445
FORCEINLINE VOID ChannelDereferenceByIndexWithLock(IN LONG Index)
Definition: chanmgr.c:83
NTSTATUS NTAPI ChannelCreate(IN PSAC_CHANNEL Channel, IN PSAC_CHANNEL_ATTRIBUTES Attributes, IN SAC_CHANNEL_ID ChannelId)
Definition: channel.c:457
SAC_CHANNEL_LOCK ChannelSlotLock[SAC_MAX_CHANNELS]
Definition: chanmgr.c:20
#define wcsicmp
Definition: string.h:1152
Status
Definition: gdiplustypes.h:24
#define CHECK_PARAMETER3(x)
Definition: sacdrv.h:61
NTSTATUS NTAPI ChannelGetName(IN PSAC_CHANNEL Channel, OUT PWCHAR *Name)
Definition: channel.c:297
LONG NTSTATUS
Definition: DriverTester.h:11
NTSTATUS NTAPI ChanMgrIsFull(OUT PBOOLEAN IsFull)
Definition: chanmgr.c:666
#define ChannelLockCreates()
Definition: sacdrv.h:1330
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
NTSTATUS NTAPI ChanMgrGetChannelCount(OUT PULONG ChannelCount)
Definition: chanmgr.c:617
FORCEINLINE LONG ChannelGetReferenceCount(IN LONG Index)
Definition: chanmgr.c:37
unsigned int * PULONG
Definition: retypes.h:1
SAC_CHANNEL_LOCK ChannelCreateLock
Definition: chanmgr.c:15
BOOLEAN NTAPI ChannelIsActive(IN PSAC_CHANNEL Channel)
Definition: channel.c:250
#define CHECK_PARAMETER2(x)
Definition: sacdrv.h:59
#define ChannelUnlockCreates()
Definition: sacdrv.h:1331
#define OUT
Definition: typedefs.h:39
NTSTATUS NTAPI ChanMgrGetChannelIndex(IN PSAC_CHANNEL Channel, IN PLONG ChannelIndex)
Definition: chanmgr.c:483
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI ChanMgrGetByHandle(IN SAC_CHANNEL_ID ChannelId, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:202
NTSTATUS NTAPI ChanMgrCloseChannelsWithFileObject(IN PFILE_OBJECT FileObject)
Definition: chanmgr.c:682
signed int * PLONG
Definition: retypes.h:5
NTSTATUS NTAPI ChanMgrCloseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:593
struct _ACPI_EFI_FILE_HANDLE CHAR16 UINT64 UINT64 Attributes
Definition: acefiex.h:335
#define CHANNEL_BLOCK_TAG
Definition: sacdrv.h:143
#define SAC_MAX_CHANNELS
Definition: sacdrv.h:154
NTSTATUS NTAPI ChanMgrReleaseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:243
NTSTATUS NTAPI ChanMgrInitialize(VOID)
Definition: chanmgr.c:118