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
|
|
|
|
{
|
|
|
|
struct _QUEUE_NODE* next;
|
|
|
|
PVOID data;
|
|
|
|
|
|
|
|
}QUEUE_NODE, *PQUEUE_NODE;
|
|
|
|
|
|
|
|
typedef struct QUEUE_HEAD
|
|
|
|
{
|
|
|
|
struct _QUEUE_NODE* start;
|
|
|
|
struct _QUEUE_NODE* end;
|
2023-08-20 18:06:21 +02:00
|
|
|
KSPIN_LOCK lock;
|
2023-08-20 17:04:53 +02:00
|
|
|
INT entries;
|
2023-08-20 16:12:04 +02:00
|
|
|
|
|
|
|
}QUEUE_HEAD, *PQUEUE_HEAD;
|
|
|
|
|
2023-09-02 10:54:04 +02:00
|
|
|
typedef struct _GLOBAL_REPORT_QUEUE_HEADER
|
|
|
|
{
|
|
|
|
INT count;
|
|
|
|
|
|
|
|
}GLOBAL_REPORT_QUEUE_HEADER, * PGLOBAL_REPORT_QUEUE_HEADER;
|
|
|
|
|
2023-09-02 15:47:15 +02:00
|
|
|
typedef struct _REPORT_HEADER
|
|
|
|
{
|
|
|
|
INT report_id;
|
|
|
|
|
|
|
|
}REPORT_HEADER, * PREPORT_HEADER;
|
|
|
|
|
2023-09-25 17:41:38 +02:00
|
|
|
typedef struct _LIST_ITEM
|
|
|
|
{
|
|
|
|
struct _LIST_ITEM* next;
|
|
|
|
|
|
|
|
}LIST_ITEM, * PLIST_ITEM;
|
|
|
|
|
|
|
|
typedef struct _LIST_HEAD
|
|
|
|
{
|
|
|
|
PLIST_ITEM start;
|
|
|
|
KSPIN_LOCK lock;
|
|
|
|
|
|
|
|
}LIST_HEAD, * PLIST_HEAD;
|
|
|
|
|
|
|
|
#define LIST_POOL_TAG 'list'
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
VOID
|
|
|
|
QueuePush(
|
2023-08-20 16:12:04 +02:00
|
|
|
_In_ PQUEUE_HEAD Head,
|
|
|
|
_In_ PVOID Data
|
|
|
|
);
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
PVOID
|
|
|
|
QueuePop(
|
2023-08-20 16:12:04 +02:00
|
|
|
_In_ PQUEUE_HEAD Head
|
|
|
|
);
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
VOID
|
|
|
|
InitialiseGlobalReportQueue(
|
2023-09-02 10:54:04 +02:00
|
|
|
_In_ PBOOLEAN Status
|
|
|
|
);
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
VOID
|
|
|
|
InsertReportToQueue(
|
2023-09-02 10:54:04 +02:00
|
|
|
_In_ PVOID Report
|
|
|
|
);
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
NTSTATUS
|
|
|
|
HandlePeriodicGlobalReportQueueQuery(
|
2023-09-02 10:54:04 +02:00
|
|
|
_In_ PIRP Irp
|
|
|
|
);
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
VOID
|
|
|
|
FreeGlobalReportQueueObjects();
|
2023-08-20 16:12:04 +02:00
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
VOID
|
|
|
|
ListInit(
|
2023-09-25 17:41:38 +02:00
|
|
|
_In_ PLIST_HEAD ListHead
|
|
|
|
);
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
PLIST_ITEM
|
|
|
|
ListInsert(
|
2023-09-25 17:41:38 +02:00
|
|
|
_In_ PLIST_HEAD ListHead,
|
2023-09-26 12:00:45 +02:00
|
|
|
_In_ PLIST_ITEM Data
|
2023-09-25 17:41:38 +02:00
|
|
|
);
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
PVOID
|
|
|
|
ListRemoveFirst(
|
2023-09-25 17:41:38 +02:00
|
|
|
_In_ PLIST_HEAD ListHead
|
|
|
|
);
|
|
|
|
|
2023-09-27 06:22:14 +02:00
|
|
|
PVOID
|
|
|
|
ListRemoveItem(
|
2023-09-25 17:41:38 +02:00
|
|
|
_In_ PLIST_HEAD ListHead,
|
|
|
|
_Inout_ PLIST_ITEM ListItem
|
|
|
|
);
|
|
|
|
|
2023-08-20 16:12:04 +02:00
|
|
|
#endif
|