mirror-ac/driver/callbacks.h

141 lines
3.7 KiB
C
Raw Permalink Normal View History

2023-08-20 16:12:04 +02:00
#ifndef CALLBACKS_H
#define CALLBACKS_H
2024-01-15 02:01:14 +01:00
2024-01-12 06:40:33 +01:00
#include "driver.h"
2024-01-15 02:01:14 +01:00
#include "common.h"
#include <wdf.h>
typedef void (*THREADLIST_CALLBACK_ROUTINE)(
_In_ PTHREAD_LIST_ENTRY ThreadListEntry, _In_opt_ PVOID Context);
2024-01-15 02:01:14 +01:00
2024-01-08 04:57:07 +01:00
#define DRIVER_PATH_LENGTH 0x100
2024-01-07 05:42:40 +01:00
#define SHA_256_HASH_LENGTH 32
typedef struct _DRIVER_LIST_ENTRY {
LIST_ENTRY list_entry;
PVOID ImageBase;
ULONG ImageSize;
BOOLEAN hashed;
BOOLEAN x86;
CHAR path[DRIVER_PATH_LENGTH];
CHAR text_hash[SHA_256_HASH_LENGTH];
2024-04-13 10:23:14 +02:00
/*
* This LIST_ENTRY is to be used for modules where the hashing needs to
* be deferred. For example, when x86 modules can't be hashed on driver
* load.
*/
LIST_ENTRY deferred_entry;
2024-02-11 15:34:28 +01:00
} DRIVER_LIST_ENTRY, *PDRIVER_LIST_ENTRY;
typedef void (*DRIVERLIST_CALLBACK_ROUTINE)(
_In_ PDRIVER_LIST_ENTRY DriverListEntry, _In_opt_ PVOID Context);
2024-02-11 15:34:28 +01:00
typedef BOOLEAN (*PROCESS_MODULE_CALLBACK)(_In_ PPROCESS_MAP_MODULE_ENTRY Entry,
_In_opt_ PVOID Context);
NTSTATUS
InitialiseDriverList();
2023-12-13 05:06:27 +01:00
VOID NTAPI
ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable,
IN PHANDLE_TABLE_ENTRY HandleTableEntry);
2023-08-29 19:36:58 +02:00
2023-10-05 08:27:17 +02:00
VOID
ObPostOpCallbackRoutine(_In_ PVOID RegistrationContext,
_In_ POB_POST_OPERATION_INFORMATION
OperationInformation);
2023-08-20 16:12:04 +02:00
2023-10-05 08:27:17 +02:00
OB_PREOP_CALLBACK_STATUS
2023-12-13 05:06:27 +01:00
ObPreOpCallbackRoutine(_In_ PVOID RegistrationContext,
_In_ POB_PRE_OPERATION_INFORMATION OperationInformation);
2023-08-20 16:12:04 +02:00
2024-01-14 05:31:19 +01:00
NTSTATUS
2023-10-08 16:07:49 +02:00
InitialiseThreadList();
VOID
ThreadCreateNotifyRoutine(_In_ HANDLE ProcessId,
_In_ HANDLE ThreadId,
_In_ BOOLEAN Create);
2023-10-08 16:07:49 +02:00
2023-10-10 19:49:17 +02:00
VOID
ProcessCreateNotifyRoutine(_In_ HANDLE ParentId,
_In_ HANDLE ProcessId,
_In_ BOOLEAN Create);
2023-10-10 19:49:17 +02:00
2023-10-08 16:07:49 +02:00
VOID
CleanupThreadListOnDriverUnload();
2023-10-09 09:34:30 +02:00
VOID
2024-06-16 10:04:28 +02:00
FindThreadListEntryByThreadAddress(_In_ HANDLE ThreadId,
2024-05-11 14:54:58 +02:00
_Out_ PTHREAD_LIST_ENTRY* Entry);
2023-10-09 09:34:30 +02:00
VOID
FindDriverEntryByBaseAddress(_In_ PVOID ImageBase,
_Out_ PDRIVER_LIST_ENTRY* Entry);
VOID
CleanupDriverListOnDriverUnload();
VOID
ImageLoadNotifyRoutineCallback(_In_opt_ PUNICODE_STRING FullImageName,
_In_ HANDLE ProcessId,
_In_ PIMAGE_INFO ImageInfo);
2024-01-12 06:40:33 +01:00
NTSTATUS
InitialiseTimerObject(_Out_ PTIMER_OBJECT Timer);
VOID
2024-05-11 14:54:58 +02:00
CleanupDriverTimerObjects(_Inout_ PTIMER_OBJECT Timer);
2024-01-12 06:40:33 +01:00
2024-01-14 05:31:19 +01:00
VOID
UnregisterProcessCreateNotifyRoutine();
VOID
UnregisterImageLoadNotifyRoutine();
VOID
UnregisterThreadCreateNotifyRoutine();
2024-01-15 02:01:14 +01:00
VOID
UnregisterProcessObCallbacks();
NTSTATUS
RegisterProcessObCallbacks();
VOID
2024-01-31 08:32:13 +01:00
InitialiseObCallbacksConfiguration(_Out_ PACTIVE_SESSION ProcessConfig);
2024-01-15 02:01:14 +01:00
2024-02-11 15:34:28 +01:00
VOID
EnumerateDriverListWithCallbackRoutine(
_In_ DRIVERLIST_CALLBACK_ROUTINE CallbackRoutine, _In_opt_ PVOID Context);
2024-02-11 15:34:28 +01:00
VOID
DriverListEntryToExtendedModuleInfo(_In_ PDRIVER_LIST_ENTRY Entry,
_Out_ PRTL_MODULE_EXTENDED_INFO Extended);
NTSTATUS
InitialiseProcessHashmap();
NTSTATUS
EnumerateProcessHandles(_In_ PPROCESS_LIST_ENTRY Entry, _In_opt_ PVOID Context);
VOID
EnumerateAndPrintProcessHashmap();
VOID
CleanupProcessHashmap();
VOID
EnumerateProcessModuleList(_In_ HANDLE ProcessId,
_In_ PROCESS_MODULE_CALLBACK Callback,
_In_opt_ PVOID Context);
VOID
FindOurUserModeModuleEntry(_In_ PROCESS_MODULE_CALLBACK Callback,
_In_opt_ PVOID Context);
2023-08-20 16:12:04 +02:00
#endif