pub fn scan_fn<T: VirtualMemory>(
    process: &mut Win32Process<T>,
    interface_manager: &InterfaceManager,
    func: Address,
) -> Result<Option<Function>> {
    if func.is_null() {
        return Err(Error::Other("func is null"));
    }

    /*
    let page_info = match process.virt_mem.virt_page_info(func) {
        Ok(p) => p,
        Err(_) => return Err(Error::Other("unable to get page info for func")),
    };

    // only allow valid pages
    if page_info.page_type.contains(PageType::NOEXEC) {
        // we hit a non executable page, end of vtable
        return Err(Error::Other("func points to non executable page"));
    }
    */

    // TODO: check if function falls in any regular valve module and break
    // TODO: if module is not mapped, add it to the suspect list

    match interface_manager
        .modules()
        .iter()
        .find(|m| func >= m.base() && func < m.base() + m.size())
    {
        Some(m) => {
            debug!("{} found in module: {}", func, m.name());
            Ok(None)
        }
        None => Ok(Some(Function::new(func))),
    }
}
/// Scans the given function for a potential hook
Scans the given function for a potential hook
Scans the given function for a potential hook
pub fn scan_fn<T: VirtualMemory>(
    process: &mut Win32Process<T>,
    interface_manager: &InterfaceManager,
    func: Address,
) -> Result<Option<Function>> {
    if func.is_null() {
        return Err(Error::Other("func is null"));
    }
    /*
    let page_info = match process.virt_mem.virt_page_info(func) {
        Ok(p) => p,
        Err(_) => return Err(Error::Other("unable to get page info for func")),
    };
    // only allow valid pages
    if page_info.page_type.contains(PageType::NOEXEC) {
        // we hit a non executable page, end of vtable
        return Err(Error::Other("func points to non executable page"));
    }
    */
    // TODO: check if function falls in any regular valve module and break
    // TODO: if module is not mapped, add it to the suspect list
    match interface_manager
        .modules()
        .iter()
        .find(|m| func >= m.base() && func < m.base() + m.size())
    {
        Some(m) => {
            debug!("{} found in module: {}", func, m.name());
            Ok(None)
        }
        None => Ok(Some(Function::new(func))),
    }
}
pub fn scan_fn < T : VirtualMemory > ( process : & mut Win32Process < T > , interface_manager : & InterfaceManager , func : Address , ) -> Result < Option < Function > > { if func . is_null ( ) { return Err ( Error :: Other ( " " ) ) ; } /*
    let page_info = match process.virt_mem.virt_page_info(func) {
        Ok(p) => p,
        Err(_) => return Err(Error::Other("unable to get page info for func")),
    };

    // only allow valid pages
    if page_info.page_type.contains(PageType::NOEXEC) {
        // we hit a non executable page, end of vtable
        return Err(Error::Other("func points to non executable page"));
    }
    */ // TODO: check if function falls in any regular valve module and break // TODO: if module is not mapped, add it to the suspect list match interface_manager . modules ( ) . iter ( ) . find ( | m | func >= m . base ( ) && func < m . base ( ) + m . size ( ) ) { Some ( m ) => { debug ! ( " " func m name ( ) ) ; Ok ( None ) } None => Ok ( Some ( Function :: new ( func ) ) ) , } }
Scans the given function for a potential hook
Scans the given function for a potential hook
process
&mut Win32Process<T>
interface_manager
&InterfaceManager
func
Address
process
&mut Win32Process<T>
interface_manager
&InterfaceManager
func
Address