The bof-launcher library exposes a C API for managing BOF lifecycles, memory masking, and execution.
Initialization and Cleanup
int bofLauncherInit(void): Initializes the library.void bofLauncherRelease(void): Releases library resources.
Memory Masking
int bofMemoryMaskKey(const unsigned char* key, int key_len): Sets a key for memory masking.int bofMemoryMaskWin32ApiCall(const char* win32_api_name, int masking_enabled): Enables/disables masking for specific Win32 API calls.
Object Management
int bofObjectInitFromMemory(const unsigned char* file_data_ptr, int file_data_len, BofObjectHandle* out_bof_handle): Loads a BOF from memory.void bofObjectRelease(BofObjectHandle bof_handle): Releases a specific BOF object.int bofObjectIsValid(BofObjectHandle bof_handle): Checks if a handle is valid.void* bofObjectGetProcAddress(BofObjectHandle bof_handle, const char* name): Retrieves a procedure address from the BOF.
Execution
int bofRun(const unsigned char* file_data_ptr, int file_data_len): Runs a BOF directly from memory.int bofObjectRun(BofObjectHandle bof_handle, unsigned char* arg_data_ptr, int arg_data_len, BofContext** out_context): Runs a loaded BOF object with arguments.int bofObjectRunAsyncThread(...): Runs a BOF in a separate thread.int bofObjectRunAsyncProcess(...): Runs a BOF in a separate sacrificial process.
Context and Arguments
void bofContextRelease(BofContext* context): Releases execution context.int bofContextIsRunning(BofContext* context): Checks if the context is still active.void bofContextWait(BofContext* context): Waits for context completion.unsigned char bofContextGetExitCode(BofContext* context): Gets the exit code.const char* bofContextGetOutput(BofContext* context, int* out_output_len): Retrieves output from the BOF.int bofArgsInit(BofArgs** out_args): Initializes an argument buffer.int bofArgsAdd(BofArgs* args, unsigned char* arg, int arg_len): Adds arguments to the buffer.void bofArgsEnd(BofArgs* args): Finalizes the argument buffer.
int bofLauncherInit(void);
void bofLauncherRelease(void);
int bofMemoryMaskKey(const unsigned char* key, int key_len);
int bofMemoryMaskWin32ApiCall(const char* win32_api_name, int masking_enabled);
int bofObjectInitFromMemory(const unsigned char* file_data_ptr, int file_data_len, BofObjectHandle* out_bof_handle);
void bofObjectRelease(BofObjectHandle bof_handle);
int bofObjectIsValid(BofObjectHandle bof_handle);
void* bofObjectGetProcAddress(BofObjectHandle bof_handle, const char* name);
int bofRun(const unsigned char* file_data_ptr, int file_data_len);
int bofObjectRun(BofObjectHandle bof_handle,
unsigned char* arg_data_ptr,
int arg_data_len,
BofContext** out_context);
int bofObjectRunAsyncThread(BofObjectHandle bof_handle,
unsigned char* arg_data_ptr,
int arg_data_len,
BofCompletionCallback completion_cb,
void* completion_cb_context,
BofContext** out_context);
int bofObjectRunAsyncProcess(BofObjectHandle bof_handle,
unsigned char* arg_data_ptr,
int arg_data_len,
BofCompletionCallback completion_cb,
void* completion_cb_context,
BofContext** out_context);
void bofContextRelease(BofContext* context);
int bofContextIsRunning(BofContext* context);
void bofContextWait(BofContext* context);
unsigned char bofContextGetExitCode(BofContext* context);
const char* bofContextGetOutput(BofContext* context, int* out_output_len);
BofObjectHandle bofContextGetObjectHandle(BofContext* context);
int bofArgsInit(BofArgs** out_args);
void bofArgsRelease(BofArgs* args);
int bofArgsAdd(BofArgs* args, unsigned char* arg, int arg_len);
void bofArgsBegin(BofArgs* args);
void bofArgsEnd(BofArgs* args);
const char* bofArgsGetBuffer(BofArgs* args);
int bofArgsGetBufferSize(BofArgs* args);