LCOV - code coverage report
Current view: top level - src/pe - code_integrity.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 100.0 % 26 26
Test Date: 2024-10-27:00:00:00 Functions: 100.0 % 6 6

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : use crate::common::FromFFI;
       4              : use std::marker::PhantomData;
       5              : 
       6              : pub struct CodeIntegrity<'a> {
       7              :     ptr: cxx::UniquePtr<ffi::PE_CodeIntegrity>,
       8              :     _owner: PhantomData<&'a ffi::PE_LoadConfigurationV2>,
       9              : }
      10              : 
      11              : impl std::fmt::Debug for CodeIntegrity<'_> {
      12           40 :     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      13           40 :         f.debug_struct("CodeIntegrity")
      14           40 :             .field("flags", &self.flags())
      15           40 :             .field("catalog", &self.catalog())
      16           40 :             .field("catalog_offset", &self.catalog_offset())
      17           40 :             .field("reserved", &self.reserved())
      18           40 :             .finish()
      19           40 :     }
      20              : }
      21              : 
      22              : impl CodeIntegrity<'_> {
      23              :     /// Flags to indicate if CI information is available, etc.
      24           40 :     pub fn flags(&self) -> u16 {
      25           40 :         self.ptr.flags()
      26           40 :     }
      27              : 
      28              :     /// 0xFFFF means not available
      29           40 :     pub fn catalog(&self) -> u16 {
      30           40 :         self.ptr.catalog()
      31           40 :     }
      32           40 :     pub fn catalog_offset(&self) -> u32 {
      33           40 :         self.ptr.catalog_offset()
      34           40 :     }
      35              : 
      36              :     /// Additional bitmask to be defined later
      37           40 :     pub fn reserved(&self) -> u32 {
      38           40 :         self.ptr.reserved()
      39           40 :     }
      40              : }
      41              : 
      42              : impl<'a> FromFFI<ffi::PE_CodeIntegrity> for CodeIntegrity<'a> {
      43           40 :     fn from_ffi(ptr: cxx::UniquePtr<ffi::PE_CodeIntegrity>) -> Self {
      44           40 :         CodeIntegrity {
      45           40 :             ptr,
      46           40 :             _owner: PhantomData,
      47           40 :         }
      48           40 :     }
      49              : }
        

Generated by: LCOV version 2.1-1