1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! Memory Lock Module
//!
//! Provides functionality to continuously monitor and restore memory values.
//! This is useful for creating "freeze" effects in game trainers or maintaining
//! constant values in target processes.
//!
//! # Feature Flag
//! Enable with: `--features "memory_lock"`
//!
//! # Quick Start
//!
//! ## Basic Usage
//! ```no_run
//! use win_auto_utils::memory_lock::MemoryLock;
//! use windows::Win32::Foundation::HANDLE;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let handle = HANDLE::default(); // Replace with actual handle
//! let address = 0x7FF6A1B2C3D4;
//!
//! // Lock a value (e.g., health = 100)
//! let mut lock = MemoryLock::builder()
//! .handle(handle)
//! .address(address)
//! .value(100u32)
//! .build()?;
//!
//! lock.lock_value(100u32)?; // Start locking immediately
//!
//! // The value will be continuously restored to 100
//! // ... your code here ...
//!
//! // Lock automatically stops when `lock` goes out of scope
//! // or you can manually drop it: drop(lock);
//!
//! Ok(())
//! }
//! ```
//!
//! ## Dynamic Address Resolution
//! ```no_run
//! use win_auto_utils::memory_lock::MemoryLock;
//! use win_auto_utils::memory_resolver::MemoryAddress;
//! use windows::Win32::Foundation::HANDLE;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let pid = 12345;
//! let handle = HANDLE::default(); // Replace with actual handle
//!
//! // Use pointer chain that resolves dynamically
//! let addr = MemoryAddress::new_x86("game.exe+58C94->308")?;
//!
//! let mut lock = MemoryLock::builder()
//! .pid(pid)
//! .handle(handle)
//! .address_from_resolver(addr)
//! .value(500u32)
//! .build()?;
//!
//! lock.lock_value(500u32)?; // Start locking
//! // Address will be re-resolved on each check cycle
//!
//! Ok(())
//! }
//! ```
pub use ;