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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! # Windows Native Rust Library
//!
//! The **Windows-Native** Rust library provides a convenient and safe way to
//! access the native Windows undocumented APIs using the Rust programming
//! language. These APIs are mostly exported from the Process Hacker native API
//! headers (phnt), enabling you to interact with Windows internals in a
//! reliable and efficient manner.
//!
//! Please note that using undocumented APIs can be risky, as they might change
//! without notice in different Windows versions and can potentially cause
//! system instability. Use this library with caution and ensure you have a good
//! understanding of the implications of using undocumented APIs.
//!
//! ## Features
//!
//! - Access undocumented Windows APIs through Rust.
//! - Headers sourced mainly from Process Hacker's NT headers.
//! - Provides a safer interface compared to raw FFI.
//! - Detailed documentation and examples for each API.
//! - Easy-to-use functions and types for common Windows tasks.
//!
//! ## Installation
//!
//! Add this library to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! windows-native = "1.0.40"
//! ```
//! or run this command
//!
//! ```text
//! cargo add windows-native
//! ```
//!
//! and then install [windows-rs](https://github.com/microsoft/windows-rs)
//!
//! ## Usage
//!
//! ```no_run
//! # fn main() {
//! use std::{thread, time::Duration};
//!
//! use windows_native::ntpsapi::{NtResumeProcess, NtSuspendProcess};
//! use windows::Win32::System::Threading::{OpenProcess, PROCESS_ALL_ACCESS};
//!
//! let handle = unsafe { OpenProcess(PROCESS_ALL_ACCESS, false, 69420).unwrap() };
//! let result = unsafe { NtSuspendProcess(handle) };
//! println!("Result {:?}", result);
//! thread::sleep(Duration::from_secs(3));
//! let result = unsafe { NtResumeProcess(handle) };
//! println!("Result {:?}", result);
//! # }
//! ```
//!
//! ## Contributing
//!
//! Contributions are welcome! If you find a bug or want to add new features to
//! the library, please open an issue or submit a pull request.
//!
//! ## Disclaimer
//!
//! **Windows-Native** is provided as-is and does not guarantee compatibility
//! with future Windows versions. Using undocumented APIs can have unintended
//! consequences, including system instability and security vulnerabilities. Use
//! at your own risk.