initial commit
This commit is contained in:
30
hkrpg/src/modules/hk_check.rs
Normal file
30
hkrpg/src/modules/hk_check.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use ilhook::x64::Registers;
|
||||
|
||||
use crate::addr::rva_config;
|
||||
|
||||
use super::{HkrpgModule, HkrpgModuleContext};
|
||||
|
||||
pub struct HkCheck;
|
||||
|
||||
impl HkrpgModule for HkrpgModuleContext<HkCheck> {
|
||||
unsafe fn init(&mut self) -> Result<(), ilhook::HookError> {
|
||||
let config = rva_config();
|
||||
if config.hk_check1 != 0 && config.hk_check2 != 0 {
|
||||
self.interceptor.replace(
|
||||
self.base.wrapping_add(config.hk_check1),
|
||||
HkCheck::replacement,
|
||||
)?;
|
||||
self.interceptor.replace(
|
||||
self.base.wrapping_add(config.hk_check2),
|
||||
HkCheck::replacement,
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl HkCheck {
|
||||
extern "win64" fn replacement(_: *mut Registers, _: usize, _: usize) -> usize {
|
||||
0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user