Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
ioctl.cpp File Reference
#include "ioctl.h"
#include "event_queue.h"
#include "inject_exclusions.h"
#include "pano_filter.h"
#include <wdmsec.h>

Go to the source code of this file.

Macros

#define PROCESS_TERMINATE   0x0001

Functions

NTSTATUS InitializeDriverLink (PDRIVER_OBJECT DriverObject)
 Creates the \Device\Panoptes device and symbolic link and registers the IOCTL dispatch routines.
void RemoveDriverLink ()
 Deletes the device and symbolic link created by InitializeDriverLink.

Macro Definition Documentation

◆ PROCESS_TERMINATE

#define PROCESS_TERMINATE   0x0001

Definition at line 8 of file ioctl.cpp.

Function Documentation

◆ InitializeDriverLink()

NTSTATUS InitializeDriverLink ( PDRIVER_OBJECT DriverObject)

Creates the \Device\Panoptes device and symbolic link and registers the IOCTL dispatch routines.

Definition at line 124 of file ioctl.cpp.

125{
126 PAGED_CODE();
127 UNICODE_STRING deviceName = RTL_CONSTANT_STRING(PANOPTES_DEVICE_NAME);
128
129 // Only SYSTEM and Administrators may open the device
130 NTSTATUS status = IoCreateDeviceSecure(
131 DriverObject,
132 0,
133 &deviceName,
134 FILE_DEVICE_UNKNOWN,
135 FILE_DEVICE_SECURE_OPEN,
136 FALSE,
137 &SDDL_DEVOBJ_SYS_ALL_ADM_ALL,
138 NULL,
139 &g_DeviceObject);
140 if (!NT_SUCCESS(status)) {
141 DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, "[!] Panoptes: Failed to create the device object with status 0x%X\n", status);
142 return status;
143 }
144
145 status = IoCreateSymbolicLink(&g_SymbolicLink, &deviceName);
146 if (!NT_SUCCESS(status)) {
147 DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, "[!] Panoptes: Failed to create the device symbolic link with status 0x%X\n", status);
148 IoDeleteDevice(g_DeviceObject);
149 g_DeviceObject = NULL;
150 return status;
151 }
152
153 DriverObject->MajorFunction[IRP_MJ_CREATE] = DeviceCreate;
154 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = DeviceCleanupClose;
155 DriverObject->MajorFunction[IRP_MJ_CLOSE] = DeviceCleanupClose;
156 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DeviceControl;
157
158 return STATUS_SUCCESS;
159}
#define PANOPTES_DEVICE_NAME
Definition pano_events.h:14

References PANOPTES_DEVICE_NAME.

Referenced by DriverEntry().

◆ RemoveDriverLink()

void RemoveDriverLink ( )

Deletes the device and symbolic link created by InitializeDriverLink.

Definition at line 161 of file ioctl.cpp.

162{
163 PAGED_CODE();
164 if (g_DeviceObject == NULL) {
165 return;
166 }
167
168 IoDeleteSymbolicLink(&g_SymbolicLink);
169 IoDeleteDevice(g_DeviceObject);
170 g_DeviceObject = NULL;
171}

Referenced by DriverEntry(), and UnloadPanoptes().