Bitdefender Hypervisor Memory Introspection
hook_cr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #ifndef _HOOK_CR_H_
6 #define _HOOK_CR_H_
7 
8 #include "introtypes.h"
9 
10 
20 typedef INTSTATUS
22  _In_opt_ void *Context,
23  _In_ DWORD Cr,
24  _In_ QWORD OldValue,
25  _In_ QWORD NewValue,
26  _Out_ INTRO_ACTION *Action
27  );
28 
29 
33 typedef struct _CR_HOOK_STATE
34 {
38 
39 
43 typedef struct _HOOK_CR
44 {
50  void *Context;
51 } HOOK_CR, *PHOOK_CR;
52 
53 
54 //
55 // CR hooks related API
56 //
59  _In_ DWORD Cr,
60  _In_ DWORD Flags,
62  _In_opt_ void *Context,
63  _Out_opt_ HOOK_CR **Hook
64  );
65 
68  _In_ HOOK_CR *Hook
69  );
70 
73  void
74  );
75 
78  void
79  );
80 
83  void
84  );
85 
86 #endif // _HOOK_CR_H_
#define _In_opt_
Definition: intro_sal.h:16
_Bool BOOLEAN
Definition: intro_types.h:58
#define _Out_
Definition: intro_sal.h:22
LIST_ENTRY Link
List entry link.
Definition: hook_cr.h:45
INT64 HooksCount
Total number of CR hooks.
Definition: hook_cr.h:36
long long INT64
Definition: intro_types.h:45
#define _In_
Definition: intro_sal.h:21
void * Context
Optional context, will be passed to the callback.
Definition: hook_cr.h:50
INTSTATUS IntHookCrSetHook(DWORD Cr, DWORD Flags, PFUNC_CrWriteHookCallback Callback, void *Context, HOOK_CR **Hook)
Set a control register write hook.
Definition: hook_cr.c:11
INTSTATUS IntHookCrUninit(void)
Uninit the control register hooks state.
Definition: hook_cr.c:295
struct _CR_HOOK_STATE * PCR_HOOK_STATE
int INTSTATUS
The status data type.
Definition: introstatus.h:24
INTSTATUS(* PFUNC_CrWriteHookCallback)(void *Context, DWORD Cr, QWORD OldValue, QWORD NewValue, INTRO_ACTION *Action)
Called when a control-register write takes place.
Definition: hook_cr.h:21
INTSTATUS IntHookCrInit(void)
Initialize the control registers hook state.
Definition: hook_cr.c:272
INTSTATUS IntHookCrCommit(void)
Commit the control register hooks.
Definition: hook_cr.c:234
struct _HOOK_CR HOOK_CR
#define _Out_opt_
Definition: intro_sal.h:30
struct _HOOK_CR * PHOOK_CR
unsigned long long QWORD
Definition: intro_types.h:53
INTSTATUS IntHookCrRemoveHook(HOOK_CR *Hook)
Remove a control register hook.
Definition: hook_cr.c:135
uint32_t DWORD
Definition: intro_types.h:49
enum _INTRO_ACTION INTRO_ACTION
Event actions.
PFUNC_CrWriteHookCallback Callback
Callback.
Definition: hook_cr.h:49
DWORD Cr
The CR number.
Definition: hook_cr.h:47
BOOLEAN Disabled
If true, the hook is disabled, and the callback will no longer be called.
Definition: hook_cr.h:48
LIST_HEAD CrHooksList
The list of CR hooks.
Definition: hook_cr.h:35
DWORD Flags
Flags. Can be used by the caller.
Definition: hook_cr.h:46
struct _CR_HOOK_STATE CR_HOOK_STATE