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-11-30: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           50 :     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      13           50 :         f.debug_struct("CodeIntegrity")
      14           50 :             .field("flags", &self.flags())
      15           50 :             .field("catalog", &self.catalog())
      16           50 :             .field("catalog_offset", &self.catalog_offset())
      17           50 :             .field("reserved", &self.reserved())
      18           50 :             .finish()
      19           50 :     }
      20              : }
      21              : 
      22              : impl CodeIntegrity<'_> {
      23              :     /// Flags to indicate if CI information is available, etc.
      24           50 :     pub fn flags(&self) -> u16 {
      25           50 :         self.ptr.flags()
      26           50 :     }
      27              : 
      28              :     /// 0xFFFF means not available
      29           50 :     pub fn catalog(&self) -> u16 {
      30           50 :         self.ptr.catalog()
      31           50 :     }
      32           50 :     pub fn catalog_offset(&self) -> u32 {
      33           50 :         self.ptr.catalog_offset()
      34           50 :     }
      35              : 
      36              :     /// Additional bitmask to be defined later
      37           50 :     pub fn reserved(&self) -> u32 {
      38           50 :         self.ptr.reserved()
      39           50 :     }
      40              : }
      41              : 
      42              : impl<'a> FromFFI<ffi::PE_CodeIntegrity> for CodeIntegrity<'a> {
      43           50 :     fn from_ffi(ptr: cxx::UniquePtr<ffi::PE_CodeIntegrity>) -> Self {
      44           50 :         CodeIntegrity {
      45           50 :             ptr,
      46           50 :             _owner: PhantomData,
      47           50 :         }
      48           50 :     }
      49              : }
        

Generated by: LCOV version 2.1-1