Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Win Auto Utils
ไธญๆๆๆกฃ | English Documentation
A universal Windows automation utility library providing atomic modules for memory operations, window management, input simulation, and color processing. Built with Rust for performance and safety.
๐ Features
Core Capabilities
- Process Management: Process enumeration, handle aggregation, module snapshot (ToolHelp32)
- Window Operations: Window handle queries, enumeration, manipulation, DC management
- Input Simulation: Keyboard input (Key Down/Up/Press), mouse click & movement
- Screen Capture: High-performance DXGI-based capture, GDI color picking
- Color Processing: Pure Rust pixel color finding algorithms (zero dependencies)
- Memory Operations: Read/write process memory, address resolution, AOB scanning
- Hooking System: Inline hooks, trampoline hooks, register extraction
- Script Engine: Pure Rust interpreter with control flow, timing, keyboard/mouse instructions
- DLL Injection: Cross-architecture injection (x64โx86/x64, WOW64 compatible)
- Template Matching: Image-based UI element detection with parallel processing
Key Advantages
โ
Atomic Design: Enable only what you need via feature flags
โ
Minimal Dependencies: Core features depend only on windows crate
โ
Performance: Release mode with LTO, size optimization, symbol stripping
โ
Safety: Rust's ownership system prevents common memory errors
โ
Cross-platform Script Engine: Pure Rust, no external dependencies
๐ฆ Installation
Add to your Cargo.toml:
[]
= { = "0.2.6", = ["standard"] }
For full functionality including template matching:
[]
= { = "0.2.6", = ["full"] }
๐ฏ Quick Start
Process Management
Only three types needed for full functionality!
use ;
// Method 1: One-step initialization by name (most convenient)
let mut process = init_by_name?;
println!;
// Method 2: One-step initialization by PID (when you know the PID)
let process = init_by_pid?;
println!;
// Method 3: Using Builder with intuitive methods (no enums needed!)
let config = builder
.set_window_client_mode // Easy to remember - no DCMode enum!
.exclude_invisible
.include_by_title
.build;
let mut game = new;
game.init?;
// Method 4: Instance method init_with_pid (for existing Process objects)
// Useful for distinguishing multiple instances of the same process
let mut app = by_name;
app.init?; // Initialize first instance
// Later, switch to specific PID for second instance
app.init_with_pid?;
// Manager API (simple and straightforward):
let mut manager = new;
manager.register?; // process name becomes the key
manager.register_alias?; // custom alias
manager.init?;
manager.init_with_pid?; // initialize with specific PID
// Query processes (read-only, no mut needed)
if let Some = manager.get
// DC Mode Options (intuitive method names):
// - .set_window_mode() -> Standard window DC (GetWindowDC)
// - .set_window_client_mode() -> Client area DC (GetDC) - best for games
// - .set_desktop_mode() -> Desktop DC for full-screen capture
Memory Operations
use ;
// Read a 32-bit integer
let value: i32 = read_memory_t?;
// Write a float value
write_memory_t::?;
Input Simulation
use ;
use ;
// SendInput method (system-level input, works with all apps)
let mut kb = new;
kb.click?;
let mut mouse = new;
mouse.move_to?;
mouse.click_left?;
// PostMessage method (background input, no focus required, needs HWND)
let kb = new;
kb.click?;
let mouse = new;
mouse.move_to?;
mouse.click_left_at?;
Screen Capture (DXGI)
use DxgiCapture;
let mut capture = new?;
let image = capture.capture_window?;
Color Finding
Search for colors in screen regions or pixel buffers with automatic AVX2 optimization:
use ;
// Method 1: Find color in screen region (uses DXGI capture internally)
match find_color
// Method 2: Find color in pixel buffer (pure algorithm, no screen capture)
use find_color_in_buffer;
let buffer: = vec!; // 100x100 BGRA pixels
let result = find_color_in_buffer; // Search green
Features:
- AVX2 SIMD acceleration (~4-8x faster on supported hardware)
- Automatic fallback to scalar implementation
- Works with any BGRA pixel buffer source
Memory Hooking (Recommended: Using Memory Manager)
use ModifierManager;
use TrampolineHookHandler;
use ProcessManager;
// Initialize process
let mut process_mgr = new;
process_mgr.register?;
process_mgr.init?;
let proc = process_mgr.get.unwrap;
let handle = proc.handle.unwrap;
let pid = proc.pid.unwrap;
// Create manager and bind context
let mut manager = new;
manager.set_context;
// Register hook with shellcode (architecture auto-detected)
let shellcode = vec!; // NOP instruction
let hook_handler = new_hook_aob_with_offset?;
manager.register;
// Activate hook
manager.activate?;
// ... trigger hook ...
// Deactivate (auto-frees memory)
manager.deactivate?;
Legacy Direct API (still supported but not recommended):
use TrampolineHook;
let shellcode = vec!; // add edx, edx
let mut hook = new_x86;
hook.install?;
// ... trigger hook ...
hook.uninstall?; // Auto-frees memory
Script Engine
use ScriptEngine;
let script = r#"
loop 10
key VK_SPACE
sleep 100
end
"#;
let mut engine = new;
engine.execute?;
๐ Documentation
Comprehensive documentation is available in both English and Chinese:
Quick Links
- Documentation Index (EN) - Complete navigation guide
- ๆๆกฃ็ดขๅผ (ไธญๆ) - ๅฎๆดๅฏผ่ชๆๅ
Module Documentation
English
- Modules Overview - High-level view of all modules
- Memory Operations
- Memory Manager - Unified memory modification manager
- Memory Hooking
- Address Resolution
- AOB Scanning
- Script Engine
- Input Control
- Process & Window
- Screen Capture
- Template Matching
- DLL Injection
Chinese (ไธญๆ)
- ๆจกๅๆฆ่ง - ๆๆๆจกๅ็้ซๅฑ่งๅพ
- ๅ ๅญๆไฝ
- ๅ ๅญ็ฎก็ๅจ - ็ปไธ็ๅ ๅญไฟฎๆน็ฎก็ๅจ
- ๅ ๅญ้ฉๅญ
- ๅฐๅ่งฃๆ
- ๅญ่ๆซๆ
- ่ๆฌๅผๆ
- ่พๅ ฅๆงๅถ
- ่ฟ็จไธ็ชๅฃ
- ๅฑๅนๆ่ท
- ๆจกๆฟๅน้
- DLLๆณจๅ ฅ
๐๏ธ Architecture
The library follows a modular architecture with feature-gated components:
win-auto-utils/
โโโ Process & Window Layer
โ โโโ process - Process management
โ โโโ hwnd - Handle queries
โ โโโ window - Window manipulation
โ โโโ snapshot - ToolHelp32 enumeration
โ
โโโ Input Layer
โ โโโ keyboard - Keyboard simulation
โ โโโ mouse - Mouse control
โ
โโโ Graphics Layer
โ โโโ dxgi - Screen capture
โ โโโ color_picker - GDI color picking
โ โโโ color_finder - Pixel color search
โ
โโโ Memory Layer
โ โโโ memory - Basic read/write
โ โโโ memory_resolver - Symbolic addresses
โ โโโ memory_aobscan - Pattern scanning
โ โโโ memory_hook - Inline/trampoline hooks
โ
โโโ Advanced Features
โ โโโ dll_injector - DLL injection
โ โโโ template_matcher - Image matching
โ
โโโ Script Engine
โโโ script_engine - Core interpreter
โโโ scripts_builtin - Built-in instructions
๐ง Feature Flags
Choose only what you need:
Minimal Setup (~15s compilation)
Core Features (default)
Full Features (~45-60s compilation)
Available Features
| Feature | Description | Dependencies |
|---|---|---|
process |
Process management | windows, hwnd, hdc, snapshot, handle |
keyboard |
Keyboard input | windows |
mouse |
Mouse control | windows |
color_picker |
GDI color picking | windows |
color_finder |
Pixel color search (AVX2/SIMD) | dxgi |
memory |
Memory read/write | windows |
memory_hook |
Hooking system | memory, windows |
memory_aobscan |
Pattern scanning | memory, memchr, rayon |
dxgi |
Screen capture | windows |
template_matcher |
Image matching | image, imageproc, rayon |
script_engine |
Script interpreter | (none, pure Rust) |
dll_injector |
DLL injection | snapshot, windows |
See Cargo.toml for complete feature list.
๐ Examples
Explore the examples/ directory for usage demonstrations:
Memory Manager Examples
# General memory manager usage
Process & Window Management
# Process manager example
# Custom initialization flags
# Window activation instruction
Screen Capture
# DXGI capture example
# Performance comparison
Script Engine
# Script engine with built-in instructions
Color Operations
# Color conversion utilities
# Color finder re-exports
Clipboard
# Clipboard usage example
AOB Scanning
# 64-bit bytecode AOB scanning
DLL Injection
# DLL injection example
๐งช Testing
Run tests for specific modules:
# Test script engine
# Test built-in instructions
# Test memory operations