14#define PANOPTES_DEVICE_NAME L"\\Device\\Panoptes"
15#define PANOPTES_SYMLINK_NAME L"\\DosDevices\\Panoptes"
16#define PANOPTES_USER_DEVICE_PATH L"\\\\.\\Panoptes"
19#define IOCTL_PANOPTES_GET_EVENT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_READ_ACCESS)
22#define IOCTL_PANOPTES_TERMINATE_PROCESS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x900, METHOD_BUFFERED, FILE_ANY_ACCESS)
32#define IOCTL_PANOPTES_SET_INJECTION_EXCLUSIONS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x901, METHOD_BUFFERED, FILE_WRITE_ACCESS)
35#define PANO_MAX_INJECTION_EXCLUSIONS 1024
39#define PANO_MAX_INJECTION_EXCLUSION_LENGTH (0xFFFE / 2)
59#define PANO_MAX_EVENT_SIZE (136 * 1024)
62#define PANO_MAX_UNICODE_STRING_CHARS (0xFFFF / sizeof(WCHAR))
138#define PANO_FILE_MODIFIED_INTERVAL_MS 30000
158#define PANO_FILE_EVENTS_ALL 0x3F
162#define IOCTL_PANOPTES_SET_FILE_EVENTS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x902, METHOD_BUFFERED, FILE_WRITE_ACCESS)
186#define PANO_FLAG_OPLOCKED 0x1
187#define PANO_FLAG_COMPRESSED 0x2
188#define PANO_FLAG_NAME_TRUNCATED 0x4
191#define PANO_FLAG_DELETE_ON_CLOSE 0x8
193#define PANO_FLAG_REPLACE_EXISTING 0x10
195#define PANO_FLAG_COMMAND_LINE_TRUNCATED 0x20
198#define PANO_FLAG_HANDLE_STILL_OPEN 0x40
201#define PANO_FLAG_DATA_TRUNCATED 0x80
204#define PANO_FLAG_KERNEL_MODE_CALLER 0x100
207#define PANO_FLAG_CAPTURE_FAILED 0x200
226#define PANO_MAX_FILE_NAME_LENGTH \
227 ((PANO_MAX_EVENT_SIZE - sizeof(PANO_EVENT_HEADER) - FIELD_OFFSET(PANO_FILE_EVENT_DATA, FileName)) / sizeof(WCHAR))
250#define PANO_MAX_MODIFIED_FILE_NAME_LENGTH \
251 ((PANO_MAX_EVENT_SIZE - sizeof(PANO_EVENT_HEADER) - FIELD_OFFSET(PANO_FILE_MODIFIED_EVENT_DATA, FileName)) / sizeof(WCHAR))
269#define PANO_MAX_RENAME_NAMES_LENGTH \
270 ((PANO_MAX_EVENT_SIZE - sizeof(PANO_EVENT_HEADER) - FIELD_OFFSET(PANO_RENAME_EVENT_DATA, Names)) / sizeof(WCHAR))
295#define PANO_MAX_PROCESS_STRINGS_LENGTH \
296 ((PANO_MAX_EVENT_SIZE - sizeof(PANO_EVENT_HEADER) - FIELD_OFFSET(PANO_PROCESS_EVENT_DATA, Strings)) / sizeof(WCHAR))
300#define PANO_MAX_REGISTRY_DATA_SIZE 4096
329#define PANO_MAX_REGISTRY_NAMES_LENGTH \
330 ((PANO_MAX_EVENT_SIZE - sizeof(PANO_EVENT_HEADER) - FIELD_OFFSET(PANO_REGISTRY_EVENT_DATA, Strings) - PANO_MAX_REGISTRY_DATA_SIZE) / sizeof(WCHAR))
332static_assert(
sizeof(
PANO_EVENT_HEADER) == 24,
"PANO_EVENT_HEADER layout changed");
334static_assert(FIELD_OFFSET(
PANO_FILE_EVENT_DATA, FileName) == 36,
"PANO_FILE_EVENT_DATA layout changed");
337static_assert(
sizeof(
PANO_FILE_EVENTS) == 4,
"PANO_FILE_EVENTS layout changed");
343 "PANO_MAX_EVENT_SIZE too small for a full-length file name");
345 "PANO_MAX_EVENT_SIZE too small for a full-length modified file name");
347 "PANO_MAX_EVENT_SIZE too small for two full-length rename names");
349 "PANO_MAX_EVENT_SIZE too small for a full-length image name and command line");
351 "PANO_MAX_EVENT_SIZE too small for a full-length key name, second name and data");
PANO_FILE_EVENT_GROUP
Bits of IOCTL_PANOPTES_SET_FILE_EVENTS: the groups of file system events the driver reports....
@ PANO_FILE_EVENTS_SECURITY
PANO_EVENT_FILE_SECURITY_CHANGED.
@ PANO_FILE_EVENTS_EA
PANO_EVENT_FILE_EA_CHANGED.
@ PANO_FILE_EVENTS_DELETE_RENAME
PANO_EVENT_FILE_DELETE and PANO_EVENT_FILE_RENAME.
@ PANO_FILE_EVENTS_WRITE
PANO_EVENT_FILE_MODIFIED.
@ PANO_FILE_EVENTS_PIPE_MAILSLOT
Named pipes and mailslots being created by a server or connected to by a client.
@ PANO_FILE_EVENTS_CREATE
PANO_EVENT_FILE_CREATED / _OVERWRITTEN / _SUPERSEDED, and deletes through FILE_DELETE_ON_CLOSE.
struct _PANO_TERMINATE_PROCESS PANO_TERMINATE_PROCESS
struct _PANO_RENAME_EVENT_DATA * PPANO_RENAME_EVENT_DATA
struct _PANO_RENAME_EVENT_DATA PANO_RENAME_EVENT_DATA
The data for PANO_EVENT_FILE_RENAME.
#define PANO_MAX_MODIFIED_FILE_NAME_LENGTH
The maximum number of WCHARs in PANO_FILE_MODIFIED_EVENT_DATA::FileName so that the whole response fi...
struct _PANO_EVENT_HEADER PANO_EVENT_HEADER
The header at the start of every IOCTL_PANOPTES_GET_EVENT response.
PANO_EVENT_TYPE
The type of event, which determines the data that follows the header.
@ PANO_EVENT_REGISTRY_SET_KEY_SECURITY
A registry key's security descriptor is about to be changed (a PANO_REGISTRY_EVENT_DATA)....
@ PANO_EVENT_FILE_RENAME
A file was renamed or moved (a PANO_RENAME_EVENT_DATA).
@ PANO_EVENT_MAILSLOT_CREATE
A server created a mailslot (CreateMailslot).
@ PANO_EVENT_NAMED_PIPE_CREATE
A server created a named pipe, or another instance of one (CreateNamedPipe).
@ PANO_EVENT_FILE_MODIFIED
A handle that wrote to a file was closed (a PANO_FILE_MODIFIED_EVENT_DATA). One event covers every wr...
@ PANO_EVENT_MAILSLOT_OPEN
A client opened a mailslot to write to it (CreateFile on \.\mailslot...).
@ PANO_EVENT_REGISTRY_SAVE_KEY
A registry key is about to be saved to a file, e.g. reg save HKLM\SAM (a PANO_REGISTRY_EVENT_DATA)....
@ PANO_EVENT_FILE_SUPERSEDED
@ PANO_EVENT_REGISTRY_REPLACE_KEY
A key's hive file was replaced, taking effect at the next boot, e.g. reg replace (a PANO_REGISTRY_EVE...
@ PANO_EVENT_FILE_EA_CHANGED
A file's extended attributes were written (a PANO_FILE_EVENT_DATA). Length holds the size of the EA b...
@ PANO_EVENT_NAMED_PIPE_OPEN
A client connected to a named pipe (CreateFile on \.\pipe...).
@ PANO_EVENT_REGISTRY_RENAME_KEY
A registry key was renamed (a PANO_REGISTRY_EVENT_DATA). The key name is the old full name and Second...
@ PANO_EVENT_REGISTRY_SET_VALUE
A registry value is about to be written (a PANO_REGISTRY_EVENT_DATA). SecondName is the value name,...
@ PANO_EVENT_FILE_OVERWRITTEN
@ PANO_EVENT_REGISTRY_CREATE_KEY
A new registry key was created (a PANO_REGISTRY_EVENT_DATA with only the key name)....
@ PANO_EVENT_FILE_CREATED
@ PANO_EVENT_FILE_SECURITY_CHANGED
A file's security descriptor was changed (a PANO_FILE_EVENT_DATA). Length holds the SECURITY_INFORMAT...
@ PANO_EVENT_PROCESS_TERMINATED
A process exited (a PANO_PROCESS_EVENT_DATA with only ProcessId set).
@ PANO_EVENT_FILE_OPENED
No longer reported: opens of existing files are too frequent and filled the queue....
@ PANO_EVENT_PROCESS_CREATED
A process was created (a PANO_PROCESS_EVENT_DATA).
@ PANO_EVENT_REGISTRY_LOAD_KEY
A hive file was loaded into the registry, e.g. reg load (a PANO_REGISTRY_EVENT_DATA)....
@ PANO_EVENT_REGISTRY_DELETE_KEY
A registry key is about to be deleted (a PANO_REGISTRY_EVENT_DATA with only the key name)....
@ PANO_EVENT_REGISTRY_QUERY_VALUE
A value was read from a key holding credentials (under HKLM\SAM or HKLM\SECURITY) (a PANO_REGISTRY_EV...
@ PANO_EVENT_FILE_DELETE
A file was marked for deletion (a PANO_FILE_EVENT_DATA). The delete happens when the last handle clos...
struct _PANO_INJECTION_EXCLUSIONS PANO_INJECTION_EXCLUSIONS
The input of IOCTL_PANOPTES_SET_INJECTION_EXCLUSIONS. Each name is either:
#define PANO_MAX_UNICODE_STRING_CHARS
The most WCHARs a UNICODE_STRING can hold (its Length is a USHORT byte count).
struct _PANO_FILE_EVENT_DATA * PPANO_FILE_EVENT_DATA
struct _PANO_REGISTRY_EVENT_DATA PANO_REGISTRY_EVENT_DATA
The data for PANO_EVENT_REGISTRY_* events.
struct _PANO_REGISTRY_EVENT_DATA * PPANO_REGISTRY_EVENT_DATA
struct _PANO_TERMINATE_PROCESS * PPANO_TERMINATE_PROCESS
struct _PANO_PROCESS_EVENT_DATA * PPANO_PROCESS_EVENT_DATA
struct _PANO_FILE_MODIFIED_EVENT_DATA * PPANO_FILE_MODIFIED_EVENT_DATA
struct _PANO_FILE_EVENT_DATA PANO_FILE_EVENT_DATA
The data for file, named pipe and mailslot events.
struct _PANO_PROCESS_EVENT_DATA PANO_PROCESS_EVENT_DATA
The data for PANO_EVENT_PROCESS_CREATED and PANO_EVENT_PROCESS_TERMINATED.
#define PANO_MAX_RENAME_NAMES_LENGTH
The maximum combined number of WCHARs in both PANO_RENAME_EVENT_DATA names so that the whole response...
struct _PANO_FILE_MODIFIED_EVENT_DATA PANO_FILE_MODIFIED_EVENT_DATA
The data for PANO_EVENT_FILE_MODIFIED.
#define PANO_MAX_FILE_NAME_LENGTH
The maximum number of WCHARs in PANO_FILE_EVENT_DATA::FileName so that the whole response fits in PAN...
struct _PANO_FILE_EVENTS PANO_FILE_EVENTS
struct _PANO_EVENT_HEADER * PPANO_EVENT_HEADER
struct _PANO_FILE_EVENTS * PPANO_FILE_EVENTS
#define PANO_MAX_PROCESS_STRINGS_LENGTH
The maximum combined number of WCHARs in the PANO_PROCESS_EVENT_DATA image name and command line so t...
struct _PANO_INJECTION_EXCLUSIONS * PPANO_INJECTION_EXCLUSIONS
#define PANO_MAX_REGISTRY_NAMES_LENGTH
The maximum combined number of WCHARs in both PANO_REGISTRY_EVENT_DATA names so that the whole respon...
UINT32 Enabled
PANO_FILE_EVENT_GROUP bits. Bits outside PANO_FILE_EVENTS_ALL are rejected.
The data for file, named pipe and mailslot events.
UINT32 Length
Length of the write, PANO_EVENT_FILE_WRITE only.
UINT32 NameLength
Length of FileName in WCHARs. FileName is not null terminated.
UINT32 Flags
PANO_FLAG_* values.
INT64 FileOffset
Offset of the write, PANO_EVENT_FILE_WRITE only.
The data for PANO_EVENT_FILE_MODIFIED.
UINT64 ProcessId
The process and thread of the most recent write.
UINT32 NameLength
Length of FileName in WCHARs. FileName is not null terminated. It is the file's name when the event w...
INT64 FirstWriteTime
When the first of those writes happened, in FILETIME units (UTC).
UINT32 Flags
PANO_FLAG_* values.
UINT64 Bytes
Bytes written by those writes.
UINT64 Writes
Number of writes through the handle covered by this event.
The input of IOCTL_PANOPTES_SET_INJECTION_EXCLUSIONS. Each name is either:
WCHAR Names[1]
Count non-empty, null-terminated names, back to back.
UINT32 Count
The number of names in Names.
The data for PANO_EVENT_PROCESS_CREATED and PANO_EVENT_PROCESS_TERMINATED.
UINT32 Flags
PANO_FLAG_* values. PANO_FLAG_NAME_TRUNCATED refers to the image name and PANO_FLAG_COMMAND_LINE_TRUN...
WCHAR Strings[1]
The image name immediately followed by the command line. Neither is null terminated.
UINT32 CommandLineLength
Length of the command line in WCHARs. PANO_EVENT_PROCESS_CREATED only.
UINT32 ImageNameLength
Length of the image name in WCHARs. PANO_EVENT_PROCESS_CREATED only.
UINT64 ParentProcessId
PANO_EVENT_PROCESS_CREATED only.
UINT64 CreatingProcessId
The process that created the new process, which can differ from the parent. PANO_EVENT_PROCESS_CREATE...
UINT64 CreatingThreadId
The thread that created the new process. PANO_EVENT_PROCESS_CREATED only.
The data for PANO_EVENT_REGISTRY_* events.
WCHAR Strings[1]
The key name, then the second name (neither null terminated), then DataLength bytes of data....
UINT32 KeyNameLength
Length of the key's full name (\REGISTRY\MACHINE...) in WCHARs.
UINT32 Detail
Per event type: the REG_* value type (SET_VALUE), the REG_*_FORMAT (SAVE_KEY), the SECURITY_INFORMATI...
UINT32 DataSize
The full size of Data in bytes before it was cut to fit: the value's data (SET_VALUE) or the old hive...
UINT32 Flags
PANO_FLAG_* values.
UINT32 SecondNameLength
Length of the second name in WCHARs: the value name (SET_VALUE, QUERY_VALUE), the file (SAVE_KEY,...
UINT32 DataLength
Bytes in Data, at most PANO_MAX_REGISTRY_DATA_SIZE. SET_VALUE and REPLACE_KEY only.
The data for PANO_EVENT_FILE_RENAME.
WCHAR Names[1]
The original name immediately followed by the new name. Neither is null terminated.
UINT32 Flags
PANO_FLAG_* values.
UINT32 SourceNameLength
Length of the original name in WCHARs.
UINT32 DestinationNameLength
Length of the new name in WCHARs.