ebpf-for-windows/include/ebpf_store_helper.h

78 строки
2.3 KiB
C
Исходник Обычный вид История

Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
// Copyright (c) Microsoft Corporation
// SPDX-License-Identifier: MIT
#pragma once
#include "ebpf_program_types.h"
Make runtime binaries not depend on usersim (#2783) * build ebpfcore under usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Work around analysis warnings Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix installer project Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Temporarily use ubpf branch with memory fix Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Create project for files shared between ebpfapi and the ebpf runtime Move existing files from libs/platform either to: * libs/shared, if meant to be common between user-mode and ebpf runtime * libs/runtime, if meant to be used by the ebpf runtime only (whether in user or kernel mode) Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Move ebpf_tracelog.c to shared Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Create shared_user and shared_kernel projects Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Remove usersim from ebpfsvc Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update to cxplat branch of usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Use cxplat_utf8_string Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Cleanup Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix build errors Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix ebpf_allocate_with_tag Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fixes Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Bug fixes Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix use of ebpf_reallocate to not pass a null pointer Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix printf tests Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix memory leaks Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Temporary change to help debug double-free in test Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update to latest usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix analysis warnings Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update to latest usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update usersim to latest Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Change native module to use latest usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update nuget package Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Only call cxplat_cleanup if cxplat_initialize succeeds Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Revert setup_build.vcxproj change Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update usersim to latest Signed-off-by: Dave Thaler <dthaler@microsoft.com> --------- Signed-off-by: Dave Thaler <dthaler@microsoft.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
2023-09-05 20:57:21 +03:00
#include "ebpf_shared_framework.h"
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
#include "ebpf_windows.h"
Make runtime binaries not depend on usersim (#2783) * build ebpfcore under usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Work around analysis warnings Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix installer project Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Temporarily use ubpf branch with memory fix Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Create project for files shared between ebpfapi and the ebpf runtime Move existing files from libs/platform either to: * libs/shared, if meant to be common between user-mode and ebpf runtime * libs/runtime, if meant to be used by the ebpf runtime only (whether in user or kernel mode) Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Move ebpf_tracelog.c to shared Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Create shared_user and shared_kernel projects Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * WIP Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Remove usersim from ebpfsvc Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update to cxplat branch of usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Use cxplat_utf8_string Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Cleanup Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix build errors Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix ebpf_allocate_with_tag Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fixes Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Bug fixes Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix use of ebpf_reallocate to not pass a null pointer Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix printf tests Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix memory leaks Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Temporary change to help debug double-free in test Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update to latest usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Fix analysis warnings Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update to latest usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update usersim to latest Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Change native module to use latest usersim Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update nuget package Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Only call cxplat_cleanup if cxplat_initialize succeeds Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> * Revert setup_build.vcxproj change Signed-off-by: Dave Thaler <dthaler@microsoft.com> * Update usersim to latest Signed-off-by: Dave Thaler <dthaler@microsoft.com> --------- Signed-off-by: Dave Thaler <dthaler@microsoft.com> Signed-off-by: Alan Jowett <alan.jowett@microsoft.com> Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
2023-09-05 20:57:21 +03:00
#ifdef USER_MODE
#include "ebpf_utilities.h"
#else
#include <minwindef.h>
#include <wdm.h>
#endif
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
#define GUID_STRING_LENGTH 38 // not including the null terminator.
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
#ifdef __cplusplus
extern "C"
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
{
#endif
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
typedef HKEY ebpf_store_key_t;
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
extern ebpf_store_key_t ebpf_store_root_key;
extern const wchar_t* ebpf_store_root_sub_key;
/**
* @brief Update the provider prototype information in the eBPF store.
*
* @param[in] helper_info_key Pointer to the store key to be initialized.
* @param[in] helper_info Pointer to the helper function prototype.
*
* @return Status of the operation.
*/
ebpf_result_t
ebpf_store_update_helper_prototype(
ebpf_store_key_t helper_info_key, _In_ const ebpf_helper_function_prototype_t* helper_info);
/**
* @brief Update global helper information in the eBPF store.
*
* @param[in] helper_info Pointer to an array of helper function prototypes.
* @param[in] helper_info_count Count of helper function prototypes.
*
* @returns Status of the operation.
*/
ebpf_result_t
ebpf_store_update_global_helper_information(
_In_reads_(helper_info_count) ebpf_helper_function_prototype_t* helper_info, uint32_t helper_info_count);
/**
* @brief Update section information in the eBPF store.
*
* @param[in] section_info Pointer to an array of section information.
* @param[in] section_info_count Count of section information entries.
*
* @returns Status of the operation.
*/
ebpf_result_t
ebpf_store_update_section_information(
_In_reads_(section_info_count) const ebpf_program_section_info_t* section_info, uint32_t section_info_count);
/**
* @brief Update program information in the eBPF store.
*
* @param[in] program_info Pointer to an array of program information.
* @param[in] program_info_count Count of program information entries.
*
* @returns Status of the operation.
*/
ebpf_result_t
ebpf_store_update_program_information(
_In_reads_(program_info_count) const ebpf_program_info_t* program_info, uint32_t program_info_count);
#ifdef __cplusplus
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
}
#endif