Bitdefender Hypervisor Memory Introspection
update_guests.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #ifndef _UPDATE_GUESTS_H__
6 #define _UPDATE_GUESTS_H__
7 
17 
24 
25 #include "introcore.h"
26 
28 #define MAX_VERSION_STRING_SIZE 64
29 
31 #define MAX_FUNCTION_NAME_SIZE 64
32 
34 #define CAMI_MAGIC_WORD 'IMAC'
35 
37 #define CAMI_MAX_ENTRY_COUNT 0x4000
38 
40 typedef enum _CAMI_SECTION_HINTS
41 {
46 
50 
53 {
57 
58 
59 #pragma pack(push)
60 #pragma pack(1)
61 
62 #define UPDATE_CAMI_MIN_VER_MAJOR 1
63 #define UPDATE_CAMI_MIN_VER_MINOR 4
64 
66 typedef struct _CAMI_VERSION
67 {
70 
73 
75 typedef struct _CAMI_HEADER
76 {
78 
80 
85 
87 
89 typedef struct _CAMI_SECTION_HEADER
90 {
96 
98 typedef struct _CAMI_LIX_DESCRIPTOR
99 {
100  CHAR VersionString[MAX_VERSION_STRING_SIZE];
101 
104 
106  DWORD StructuresTable;
108 
110  DWORD HooksTable;
112 
115 
120 
122 typedef struct _CAMI_LIX_HOOK
123 {
130 
133 {
135  CHAR VersionString[MAX_VERSION_STRING_SIZE];
137  CHAR ServerVersionString[MAX_VERSION_STRING_SIZE];
139 
141 typedef struct _CAMI_WIN_DESCRIPTOR
142 {
146 
148 
151 
153  DWORD KmStructuresTable;
155 
157  DWORD UmStructuresTable;
159 
161  DWORD FunctionTable;
163 
166 
172 
174 typedef struct _CAMI_WIN_FUNCTION
175 {
177 
179  DWORD PatternsTable;
181 
184 
189 
192 {
195 
201 
204 {
205  BYTE SectionHint[8];
208 
212 
215 {
222 
226 
229 {
234 
236 typedef struct _CAMI_PROT_OPTIONS
237 {
245 
248 {
249  union
250  {
251  WCHAR Name16[32];
252  CHAR Name8[64];
253  };
254 
257 
261 
263 
266 {
273 
274 #pragma pack(pop)
275 
276 INTSTATUS
278  _In_ DWORD CamiSectionHint
279  );
280 
281 INTSTATUS
283  _In_ const BYTE *UpdateBuffer,
284  _In_ DWORD BufferLength
285  );
286 
287 INTSTATUS
289  _Out_ DWORD *MajorVersion,
290  _Out_ DWORD *MinorVersion,
292  );
293 
294 INTSTATUS
296  _In_ BOOLEAN KptiInstalled,
297  _In_ BOOLEAN Guest64,
298  _Out_opt_ DWORD *NtBuildNumberList,
299  _Inout_ DWORD *Count
300  );
301 
302 void
304  void
305  );
306 
307 INTSTATUS
309  _In_ DWORD Items
310  );
311 
312 INTSTATUS
314  void
315  );
316 
317 INTSTATUS
319  _In_ void *ProtectedProcess
320  );
321 
322 #endif // !_UPDATE_GUESTS_H__
DWORD _Reserved2
Reserved for future use.
QWORD MaxIntroVersion
Maximum introcore version which supports this OS.
DWORD _Reserved2
Reserved for future use.
#define _Out_
Definition: intro_sal.h:22
_Bool BOOLEAN
Definition: intro_types.h:58
void IntCamiClearUpdateBuffer(void)
Uninitialize the update buffer and notify the integrator that we don't need it anymore.
DWORD _Reserved
Reserved.
Definition: update_guests.h:93
uint8_t BYTE
Definition: intro_types.h:47
DWORD CustomProtectionOffset
Protection flags for this OS. (pointer to a CAMI_CUSTOM_OS_PROTECTION struct)
DWORD SignatureId
The unique ID of the signature.
Describe the introcore protection options.
#define _In_
Definition: intro_sal.h:21
DWORD CoreOptionsOffset
Intro core options. File pointer to a CAMI_PROT_OPTIONS structure.
uint16_t WORD
Definition: intro_types.h:48
CAMI_STRING_ENCODING
Describes the encoding of a string received from the CAMI file.
Definition: update_guests.h:52
DWORD _Reserved1
Reserved for future use.
DWORD BuildNumber
Build number for this Windows OS.
WORD PatternLength
The length of the pattern. (count of DWORDs)
QWORD _Reserved2
Reserved for future use.
struct _CAMI_VERSION CAMI_VERSION
Describe the CAMI version.
BYTE SkipOnBoot
TRUE if this function should not be hooked on boot.
DWORD Flags
Auxiliary data.
QWORD MinIntroVersion
Minimum introcore version which supports this OS.
struct _CAMI_PROC_PROT_OPTIONS CAMI_PROC_PROT_OPTIONS
Describe the introcore protection options for a process.
QWORD _Reserved2
Reserved for future use.
DWORD _Reserved3
Reserved for future use.
QWORD _Reserved2
Reserved for future use.
DWORD ProcOptionsCount
The number of entries in the ProcOptionsTable.
DWORD Minor
Minor version of this file.
Definition: update_guests.h:68
WORD _Reserved1
Reserved for future use.
struct _CAMI_PATTERN_SIGNATURE * PCAMI_PATTERN_SIGNATURE
Describe a CAMI file windows descriptor. Load support for a windows guest.
struct _CAMI_VERSION * PCAMI_VERSION
Section will contain linux related information.
Definition: update_guests.h:48
QWORD _Reserved3
Reserved for future use.
Describe the introcore protection options for a process.
int INTSTATUS
The status data type.
Definition: introstatus.h:24
struct _CAMI_HEADER CAMI_HEADER
Describe the CAMI file header.
DWORD _Reserved3
Reserved for future use.
DWORD ArgumentsCount
Arguments count.
DWORD VersionStringOffset
VersionString pointer (pointer to a CAMI_WIN_VERSION_STRING struct)
Describe the CAMI version.
Definition: update_guests.h:66
QWORD MinIntroVersion
Minimum introcore version which supports this OS.
INTSTATUS IntCamiGetVersion(DWORD *MajorVersion, DWORD *MinorVersion, DWORD *BuildNumber)
Get the version of the loaded CAMI support file.
struct _CAMI_LIX_HOOK CAMI_LIX_HOOK
Describe a function to be hooked by introcore.
struct _CAMI_CUSTOM_OS_PROTECTION CAMI_CUSTOM_OS_PROTECTION
Describe the introcore protection options for a guest.
Describe a pattern signature.
struct _CAMI_OPAQUE_STRUCTURE * PCAMI_OPAQUE_STRUCTURE
INTSTATUS IntCamiSetUpdateBuffer(const BYTE *UpdateBuffer, DWORD BufferLength)
Initialize the update buffer with the one from the integrator.
Describe a function to be hooked by introcore.
Section will contain information about a supported OS.
Definition: update_guests.h:42
Describe the CAMI file header.
Definition: update_guests.h:75
Describe a CAMI file Linux descriptor. Load support for a Linux guest.
Definition: update_guests.h:98
DWORD OptionsOffset
File pointer to a CAMI_PROT_OPTIONS.
DWORD Offset
Offset inside the buffer.
Describe a function to be hooked by introcore.
DWORD EntryCount
How many entries of this type are in the DescriptorTable.
Definition: update_guests.h:92
DWORD DescriptorTable
Pointer to a CAMI descriptor table.
Definition: update_guests.h:94
DWORD _Reserved2
Reserved for future use.
Describe the arguments for a function.
DWORD PointerToSectionsHeaders
RVA of a CAMI_SECTION_HEADER table.
Definition: update_guests.h:84
DWORD MembersCount
How many members are available for this structure.
QWORD ServerVersionStringSize
Size of the server version string, if exists.
DWORD _Reserved1
Reserved for future use.
Describe a CAMI file section header.
Definition: update_guests.h:89
DWORD Extended
The file pointer of this structure's extension.
#define _Inout_
Definition: intro_sal.h:20
DWORD Members
A file pointer to members of this structure. (pointer to a DWORD array)
BOOLEAN Is64
If this OS is 64 bits.
INTSTATUS IntCamiUpdateProcessProtectionInfo(void *ProtectedProcess)
Update a process' protection flags using the ones from CAMI.
#define _Out_opt_
Definition: intro_sal.h:30
QWORD VersionStringSize
Size of the version string.
DWORD BuildNumber
Build number.
Definition: update_guests.h:71
DWORD ShemuOptionsOffset
Shemu options. File pointer to a CAMI_PROT_OPTIONS structure.
DWORD ProcOptionsTable
Process protection options. Pointer to a CAMI_PROC_PROT_OPTIONS array.
DWORD FileSize
The size of the update file. Should be equal with the value of BufferSize.
Definition: update_guests.h:82
BYTE HookHandler
The hook handler index from the API_HOOK_DESCRIPTOR.
#define MAX_VERSION_STRING_SIZE
Maximum size of a version string.
Definition: update_guests.h:28
INTSTATUS IntCamiProtectedProcessFree(void)
Uninitialize the global holding custom process protection options.
DWORD _Reserved1
Reserved for future use.
unsigned long long QWORD
Definition: intro_types.h:53
Section will contain protection flags.
Definition: update_guests.h:45
QWORD MaxIntroVersion
Maximum introcore version which supports this OS.
struct _CAMI_WIN_FUNCTION * PCAMI_WIN_FUNCTION
DWORD ArgumentsTable
Arguments file offset. (pointer to a DWORD array)
struct _CAMI_SECTION_HEADER CAMI_SECTION_HEADER
Describe a CAMI file section header.
QWORD _Reserved1
Reserved for future use.
struct _CAMI_WIN_DESCRIPTOR * PCAMI_WIN_DESCRIPTOR
DWORD NumberOfSections
Number of entries in the table bellow.
Definition: update_guests.h:83
QWORD _Reserved1
Reserved for future use.
String will be encoded in utf-8.
Definition: update_guests.h:54
QWORD ForceOn
Options which will be enabled by default.
QWORD ForceFeedback
Options feedback only.
struct _CAMI_PATTERN_SIGNATURE CAMI_PATTERN_SIGNATURE
Describe a pattern signature.
CAMI_VERSION Version
Version.
Definition: update_guests.h:79
DWORD PatternOffset
Pattern file pointer. (pointer to a DWORD array)
struct _CAMI_WIN_VERSION_STRING * PCAMI_WIN_VERSION_STRING
Describe windows version strings.
DWORD HashLength
The length (count of DWORDs) of the pattern.
uint16_t WCHAR
Definition: intro_types.h:63
struct _CAMI_WIN_FUNCTION_PATTERN * PCAMI_WIN_FUNCTION_PATTERN
uint32_t DWORD
Definition: intro_types.h:49
DWORD _Reserved2
Reserved for future use.
struct _CAMI_LIX_DESCRIPTOR * PCAMI_LIX_DESCRIPTOR
struct _CAMI_OPAQUE_STRUCTURE CAMI_OPAQUE_STRUCTURE
Describe the members of a guest opaque structure.
QWORD ForceOff
Options which will be disabled.
DWORD _Reserved3
Reserved for future use.
INTSTATUS IntCamiProtectedProcessAllocate(DWORD Items)
Initialize the global variable holding custom process protection options.
_CAMI_SECTION_HINTS
CAMI section hints that describe what is to be loaded.
Definition: update_guests.h:40
Describe the members of a guest opaque structure.
QWORD _Reserved1
Reserved for future use.
DWORD Hint
Any combination of CAMI_SECTION_HINTS.
Definition: update_guests.h:91
Describe a function pattern.
struct _CAMI_WIN_FUNCTION_PATTERN_EXTENSION * PCAMI_WIN_FUNCTION_PATTERN_EXTENSION
struct _CAMI_SECTION_HEADER * PCAMI_SECTION_HEADER
enum _CAMI_SECTION_HINTS CAMI_SECTION_HINTS
CAMI section hints that describe what is to be loaded.
Section will contain windows related information.
Definition: update_guests.h:47
DWORD Magic
Magic value. Should be CAMI_MAGIC_WORD.
Definition: update_guests.h:77
DWORD NameHash
Function name hash.
DWORD _Reserved3
Reserved for future use.
WORD _Reserved1
Alignment mostly, but may become useful.
DWORD HashOffset
Pattern file pointer. (pointer to a DWORD array)
BOOLEAN Kpti
If this OS has KPTI support.
struct _CAMI_WIN_VERSION_STRING CAMI_WIN_VERSION_STRING
Describe windows version strings.
DWORD Encoding
One of the CAMI_STRING_ENCODING.
DWORD _Reserved3
Reserved for future use.
struct _CAMI_PROT_OPTIONS CAMI_PROT_OPTIONS
Describe the introcore protection options.
struct _CAMI_WIN_FUNCTION_PATTERN_EXTENSION CAMI_WIN_FUNCTION_PATTERN_EXTENSION
Describe the arguments for a function.
DWORD _Reserved2
Reserved for future use.
DWORD ArgumentsCount
Arguments count.
Section will contain distribution signatures.
Definition: update_guests.h:44
struct _CAMI_LIX_HOOK * PCAMI_LIX_HOOK
Describe the introcore protection options for a guest.
char CHAR
Definition: intro_types.h:56
DWORD Major
Major version of this file.
Definition: update_guests.h:69
DWORD _Reserved4
Reserved for future use.
String will be encoded in utf-16.
Definition: update_guests.h:55
DWORD ArgumentsTable
Arguments file offset. (pointer to a DWORD array)
Section will contain syscall signatures.
Definition: update_guests.h:43
struct _CAMI_WIN_DESCRIPTOR CAMI_WIN_DESCRIPTOR
Describe a CAMI file windows descriptor. Load support for a windows guest.
struct _CAMI_WIN_FUNCTION CAMI_WIN_FUNCTION
Describe a function to be hooked by introcore.
DWORD NameHash
Function name hash.
QWORD ForceBeta
Options beta only.
INTSTATUS IntCamiGetWinSupportedList(BOOLEAN KptiInstalled, BOOLEAN Guest64, DWORD *NtBuildNumberList, DWORD *Count)
Return a list of supported Windows NtBuildNumbers.
QWORD _Reserved4
Reserved for future use.
struct _CAMI_HEADER * PCAMI_HEADER
DWORD CustomProtectionOffset
Protection flags for this OS. (pointer to a CAMI_CUSTOM_OS_PROTECTION).
INTSTATUS IntCamiLoadSection(DWORD CamiSectionHint)
Load CAMI objects from section with given hint.
struct _CAMI_LIX_DESCRIPTOR CAMI_LIX_DESCRIPTOR
Describe a CAMI file Linux descriptor. Load support for a Linux guest.
struct _CAMI_WIN_FUNCTION_PATTERN CAMI_WIN_FUNCTION_PATTERN
Describe a function pattern.