2023-08-20 16:12:04 +02:00
|
|
|
#ifndef QUEUE_H
|
|
|
|
#define QUEUE_H
|
|
|
|
|
|
|
|
#include <ntifs.h>
|
2023-09-02 15:47:15 +02:00
|
|
|
#include "common.h"
|
2023-09-02 10:54:04 +02:00
|
|
|
|
|
|
|
#define MAX_REPORTS_PER_IRP 20
|
2023-08-20 16:12:04 +02:00
|
|
|
|
|
|
|
typedef struct _QUEUE_NODE
|
|
|
|
{
|
2023-12-13 05:06:27 +01:00
|
|
|
struct _QUEUE_NODE* next;
|
|
|
|
PVOID data;
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-12-13 05:06:27 +01:00
|
|
|
} QUEUE_NODE, *PQUEUE_NODE;
|
2023-08-20 16:12:04 +02:00
|
|
|
|
|
|
|
typedef struct QUEUE_HEAD
|
|
|
|
{
|
2023-12-13 05:06:27 +01:00
|
|
|
struct _QUEUE_NODE* start;
|
|
|
|
struct _QUEUE_NODE* end;
|
|
|
|
KGUARDED_MUTEX lock;
|
|
|
|
INT entries;
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-12-13 05:06:27 +01:00
|
|
|
} QUEUE_HEAD, *PQUEUE_HEAD;
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-09-02 10:54:04 +02:00
|
|
|
typedef struct _GLOBAL_REPORT_QUEUE_HEADER
|
|
|
|
{
|
2023-12-13 05:06:27 +01:00
|
|
|
INT count;
|
2023-09-02 10:54:04 +02:00
|
|
|
|
2023-12-13 05:06:27 +01:00
|
|
|
} GLOBAL_REPORT_QUEUE_HEADER, *PGLOBAL_REPORT_QUEUE_HEADER;
|
2023-09-02 10:54:04 +02:00
|
|
|
|
2023-09-02 15:47:15 +02:00
|
|
|
typedef struct _REPORT_HEADER
|
|
|
|
{
|
2023-12-13 05:06:27 +01:00
|
|
|
INT report_id;
|
2023-09-02 15:47:15 +02:00
|
|
|
|
2023-12-13 05:06:27 +01:00
|
|
|
} REPORT_HEADER, *PREPORT_HEADER;
|
2023-09-02 15:47:15 +02:00
|
|
|
|
2023-09-25 17:41:38 +02:00
|
|
|
#define LIST_POOL_TAG 'list'
|
|
|
|
|
2023-10-05 08:27:17 +02:00
|
|
|
VOID
|
2023-12-13 05:06:27 +01:00
|
|
|
QueuePush(_Inout_ PQUEUE_HEAD Head, _In_ PVOID Data);
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-10-05 08:27:17 +02:00
|
|
|
PVOID
|
2023-12-13 05:06:27 +01:00
|
|
|
QueuePop(_Inout_ PQUEUE_HEAD Head);
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-10-05 08:27:17 +02:00
|
|
|
VOID
|
2023-12-13 05:06:27 +01:00
|
|
|
InitialiseGlobalReportQueue(_Out_ PBOOLEAN Status);
|
2023-09-02 10:54:04 +02:00
|
|
|
|
2023-10-05 08:27:17 +02:00
|
|
|
VOID
|
2023-12-13 05:06:27 +01:00
|
|
|
InsertReportToQueue(_In_ PVOID Report);
|
2023-09-02 10:54:04 +02:00
|
|
|
|
2023-10-05 08:27:17 +02:00
|
|
|
NTSTATUS
|
2023-12-13 05:06:27 +01:00
|
|
|
HandlePeriodicGlobalReportQueueQuery(_Inout_ PIRP Irp);
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-10-05 08:27:17 +02:00
|
|
|
VOID
|
2023-09-27 06:22:14 +02:00
|
|
|
FreeGlobalReportQueueObjects();
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-10-05 08:27:17 +02:00
|
|
|
VOID
|
2023-12-13 05:06:27 +01:00
|
|
|
ListInit(_Inout_ PSINGLE_LIST_ENTRY Head, _Inout_ PKGUARDED_MUTEX Lock);
|
2023-09-25 17:41:38 +02:00
|
|
|
|
2023-10-08 16:07:49 +02:00
|
|
|
VOID
|
2023-12-13 05:06:27 +01:00
|
|
|
ListInsert(_Inout_ PSINGLE_LIST_ENTRY Head,
|
|
|
|
_Inout_ PSINGLE_LIST_ENTRY NewEntry,
|
|
|
|
_In_ PKGUARDED_MUTEX Lock);
|
2023-09-25 17:41:38 +02:00
|
|
|
|
2023-10-08 16:07:49 +02:00
|
|
|
BOOLEAN
|
2023-12-13 05:06:27 +01:00
|
|
|
ListFreeFirstEntry(_Inout_ PSINGLE_LIST_ENTRY Head,
|
|
|
|
_In_ PKGUARDED_MUTEX Lock,
|
|
|
|
_In_opt_ PVOID CallbackRoutine);
|
2023-09-25 17:41:38 +02:00
|
|
|
|
2023-10-08 16:07:49 +02:00
|
|
|
VOID
|
2023-12-13 05:06:27 +01:00
|
|
|
ListRemoveEntry(_Inout_ PSINGLE_LIST_ENTRY Head,
|
|
|
|
_Inout_ PSINGLE_LIST_ENTRY Entry,
|
|
|
|
_In_ PKGUARDED_MUTEX Lock);
|
2023-10-08 16:07:49 +02:00
|
|
|
|
2023-08-20 16:12:04 +02:00
|
|
|
#endif
|