Bitdefender Hypervisor Memory Introspection
windeployer.c File Reference
#include "windeployer.h"
#include "winagent.h"
#include "alerts.h"
#include "guests.h"
#include "winagent_dummy_Win32.h"
#include "winagent_dummy_x64.h"
#include "winagent_gather_Win32.h"
#include "winagent_gather_x64.h"
#include "winagent_killer_Win32.h"
#include "winagent_killer_x64.h"
#include "winpe.h"
#include "winprocesshp.h"

Go to the source code of this file.

Functions

static INTSTATUS IntWinDepDeploy (QWORD GuestVirtualAddress, DWORD AgentTag, void *Context)
 Boot agent deployment callback. More...
 
static INTSTATUS IntWinDepComplete (QWORD GuestVirtualAddress, DWORD ErrorCode, DWORD AgentTag, void *Context)
 Called once the boot driver finishes starting the agent inside the guest. More...
 
static INTSTATUS IntWinFormatAgentKillerCommandLine (char *CommandLine, DWORD Length)
 Formats the agent killer command line. More...
 
INTSTATUS IntWinDepInjectProcess (DWORD AgentTag, PBYTE AgentContent, DWORD AgentSize, const CHAR *Name, const CHAR *Args)
 Inject a process inside a Windows guest. More...
 
INTSTATUS IntWinDepInjectFile (PBYTE FileContent, DWORD FileSize, const CHAR *Name)
 Inject a file inside the Windows guest. More...
 

Function Documentation

◆ IntWinDepComplete()

static INTSTATUS IntWinDepComplete ( QWORD  GuestVirtualAddress,
DWORD  ErrorCode,
DWORD  AgentTag,
void *  Context 
)
static

Called once the boot driver finishes starting the agent inside the guest.

This callback is called once the boot driver has finished execution. On success (ErrorCode 0), this means that either the process agent has been started, or the file agent has been written on disk.

Parameters
[in]GuestVirtualAddressUnused.
[in]ErrorCodeInjection error code. 0 indicates success.
[in]AgentTagThe agent tag.
[in]ContextThe optional context.
Return values
INT_STATUS_SUCCESSOn success.

Definition at line 69 of file windeployer.c.

Referenced by IntWinDepInjectFile(), and IntWinDepInjectProcess().

◆ IntWinDepDeploy()

static INTSTATUS IntWinDepDeploy ( QWORD  GuestVirtualAddress,
DWORD  AgentTag,
void *  Context 
)
static

Boot agent deployment callback.

This is the injection callback called once the boot driver has been successfully injected inside the guest. This function will send an introEventAgentEvent, indicating that the agent has been injected via the agentInjected event type. NOTE: This event does not indicate that the injected agent has actually started. That may still fail!

Parameters
[in]GuestVirtualAddressGla where the boot driver has been injected.
[in]AgentTagThe agent tag.
[in]ContextOptional context.
Return values
INT_STATUS_SUCCESSOn success.

Definition at line 20 of file windeployer.c.

Referenced by IntWinDepInjectFile(), and IntWinDepInjectProcess().

◆ IntWinDepInjectFile()

INTSTATUS IntWinDepInjectFile ( PBYTE  FileContent,
DWORD  FileSize,
const CHAR Name 
)

Inject a file inside the Windows guest.

This function will inject a file inside the guest. The file will be written inside the System% folder, so make sure you use a name that will not conflict with potential existing files.

Parameters
[in]FileContentThe file contents to be injected.
[in]FileSizeThe file size.
[in]NameThe file name.
Return values
INT_STATUS_SUCCESSOn success.

Definition at line 294 of file windeployer.c.

Referenced by IntDepInjectFile().

◆ IntWinDepInjectProcess()

INTSTATUS IntWinDepInjectProcess ( DWORD  AgentTag,
PBYTE  AgentContent,
DWORD  AgentSize,
const CHAR Name,
const CHAR Args 
)

Inject a process inside a Windows guest.

Inject a process inside the Windows guest. The executable file will be written inside the System% folder, so make sure you use a name that will not conflict with existing files inside that folder. The process will be started under the SYSTEM user by default.

Parameters
[in]AgentTagTag used to identify the agent. Some tags are predefined and reserved:
[in]AgentContentUnless AgentTag indicates a predefined agent, this must be supplied.
[in]AgentSizeSize of the AgentContent buffer.
[in]NameAgent name. The process will have this name inside the guest.
[in]ArgsOptional arguments to be passed to the agent.
Return values
INT_STATUS_SUCCESSOn success.
INT_STATUS_INVALID_PARAMETERIf an invalid parameter is supplied.

Definition at line 137 of file windeployer.c.

Referenced by IntDepInjectProcess().

◆ IntWinFormatAgentKillerCommandLine()

static INTSTATUS IntWinFormatAgentKillerCommandLine ( char *  CommandLine,
DWORD  Length 
)
static

Formats the agent killer command line.

Parameters
[in]CommandLineThe agent killer command line.
[in]LengthThe command line length.
Return values
INT_STATUS_SUCCESSOn success.

Definition at line 119 of file windeployer.c.

Referenced by IntWinDepInjectProcess().