Bitdefender Hypervisor Memory Introspection
drivers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #ifndef _DRIVER_H_
6 #define _DRIVER_H_
7 
8 #include "lixmodule.h"
9 #include "windriver.h"
10 
15 {
17 
18  struct
19  {
20  BYTE Unknown : 1;
21  BYTE Export : 1;
22  } Type;
24 
30 typedef struct _KERNEL_DRIVER
31 {
34 
50 
54  void *Name;
57 
60 
62  void *HookObject;
63 
66 
68  union
69  {
72  };
74 
75 
78  _In_ void const *Detour
79  );
80 
83  _In_ void const *Detour
84  );
85 
88  _In_ QWORD Gva
89  );
90 
93  _In_ QWORD Gva
94  );
95 
98  _In_ DWORD LoadOrder
99  );
100 
103  _In_ const void *Name
104  );
105 
108  _In_ const WCHAR *Path
109  );
110 
111 void
113  void
114  );
115 
116 void
118  void
119  );
120 
121 void
123  _In_ const QWORD Rip
124  );
125 
126 void
128  _In_ const QWORD Rip
129  );
130 
133  _In_ const QWORD Rip
134  );
135 
136 void
138  _In_ const QWORD BaseAddress,
139  _In_ const QWORD Length
140  );
141 
142 #endif // _DRIVER_H_
KERNEL_DRIVER * IntDriverFindByLoadOrder(DWORD LoadOrder)
Searches a driver by its module load order.
Definition: drivers.c:235
_Bool BOOLEAN
Definition: intro_types.h:58
struct _DRIVER_EXPORT_CACHE_ENTRY DRIVER_EXPORT_CACHE_ENTRY
Describes an entry in the gDriverExportCache.
uint8_t BYTE
Definition: intro_types.h:47
BYTE Unknown
Set if the function at this RIP is not exported.
Definition: drivers.h:20
#define _In_
Definition: intro_sal.h:21
WIN_KERNEL_DRIVER Win
Valid only for Windows guests.
Definition: drivers.h:70
QWORD BaseVa
The guest virtual address of the kernel module that owns this driver object.
Definition: drivers.h:41
void IntDriverCacheCreateExport(const QWORD Rip)
Adds a new export entry to the gDriverExportCache.
Definition: drivers.c:432
INTSTATUS IntDriverUnloadHandler(void const *Detour)
The detour handler that will be invoked when a guest driver is unloaded.This handles driver unloading...
Definition: drivers.c:110
int INTSTATUS
The status data type.
Definition: introstatus.h:24
QWORD Size
The size of the kernel module that owns this driver object.
Definition: drivers.h:43
BOOLEAN Protected
True if the driver is protected, False if it is not.
Definition: drivers.h:65
struct _DRIVER_EXPORT_CACHE_ENTRY::@23 Type
BYTE Export
Set if the function at this RIP is exported.
Definition: drivers.h:21
Describes a kernel driver.
Definition: drivers.h:30
KERNEL_DRIVER * IntDriverFindByName(const void *Name)
Searches for a driver by its name.
Definition: drivers.c:266
DWORD NameHash
The hash of the name.
Definition: drivers.h:59
INTSTATUS IntDriverLoadHandler(void const *Detour)
The detour handler that will be invoked when a guest loads a new driver.This handles driver loading i...
Definition: drivers.c:45
struct _KERNEL_DRIVER * PKERNEL_DRIVER
SIZE_T NameLength
The length of the Name. This is the number of characters in the Name buffer.
Definition: drivers.h:56
QWORD Rip
The guest RIP for which this entry exists.
Definition: drivers.h:16
struct _DRIVER_EXPORT_CACHE_ENTRY * PDRIVER_EXPORT_CACHE_ENTRY
unsigned long long QWORD
Definition: intro_types.h:53
DRIVER_EXPORT_CACHE_ENTRY * IntDriverCacheExportFind(const QWORD Rip)
Finds an entry inside the gDriverExportCache.
Definition: drivers.c:484
void * Name
The name of the driver.
Definition: drivers.h:54
KERNEL_DRIVER * IntDriverFindByPath(const WCHAR *Path)
Searches for a driver by its module path.
Definition: drivers.c:312
LIX_KERNEL_MODULE Lix
Valid only for Linux guests.
Definition: drivers.h:71
void * HookObject
The hook object used to protect this driver. NULL if the driver is not protected. ...
Definition: drivers.h:62
void IntDriverUninit(void)
Uninitializes the drivers submodule.
Definition: drivers.c:354
uint16_t WCHAR
Definition: intro_types.h:63
uint32_t DWORD
Definition: intro_types.h:49
QWORD ProtectionFlag
The introcore option that decided that this driver must be protected.
Definition: drivers.h:49
LIST_ENTRY Link
Entry inside the gKernelDrivers list.
Definition: drivers.h:33
KERNEL_DRIVER * IntDriverFindByBase(QWORD Gva)
Searches a driver object by its module base.
Definition: drivers.c:211
struct _KERNEL_DRIVER KERNEL_DRIVER
Describes a kernel driver.
KERNEL_DRIVER * IntDriverFindByAddress(QWORD Gva)
Returns the driver in which Gva resides.
Definition: drivers.c:164
void IntDriverCacheCreateUnknown(const QWORD Rip)
Adds a new entry to the gDriverExportCache.
Definition: drivers.c:458
Describes an entry in the gDriverExportCache.
Definition: drivers.h:14
void IntDriverDump(void)
Prints all the currently loaded drivers.
Definition: drivers.c:391
QWORD EntryPoint
The entry point of this driver.
Definition: drivers.h:45
Exposes the types, constants and functions used to handle Windows Drivers related events...
QWORD ObjectGva
The guest virtual address at which this object resides.
Definition: drivers.h:39
The internal structure of the Linux-driver.
Definition: lixmodule.h:29
void IntDriverCacheInv(const QWORD BaseAddress, const QWORD Length)
Invalidates all cache entries for a given guest memory range.
Definition: drivers.c:508
size_t SIZE_T
Definition: intro_types.h:60