Remove the 'beta' feature and everything related to it

This commit is contained in:
MSxDOS
2022-09-24 00:24:20 +03:00
parent 9f56b149c9
commit 2148881c30
7 changed files with 13 additions and 59 deletions
-3
View File
@@ -14,7 +14,6 @@ edition = "2018"
[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
features = ["beta"]
targets = ["aarch64-pc-windows-msvc", "i686-pc-windows-msvc", "x86_64-pc-windows-msvc"]
[dependencies.winapi]
@@ -27,5 +26,3 @@ func-types = []
impl-default = ["winapi/impl-default"]
user = []
kernel = []
beta = []
nightly = ["beta"]
+1 -1
View File
@@ -3,7 +3,7 @@
Rust FFI bindings for Native API. Mostly based on Process Hacker [phnt](https://github.com/processhacker/processhacker/tree/master/phnt) headers as the most complete source of bindings to be found. The comments there also contain useful information on how to use specific things.
### Minimum supported Rust
Always the latest stable. Some [features][docs_link] require a beta compiler.
1.64
[appveyor_link]: https://ci.appveyor.com/project/MSxDOS/ntapi
[appveyor_badge]: https://ci.appveyor.com/api/projects/status/i1fcmm0c5b7c6b6u/branch/master?svg=true
+2 -6
View File
@@ -28,11 +28,7 @@ install:
)
build_script:
- if "%channel%"=="nightly" (
cargo test --verbose --color always --features "func-types impl-default nightly user"
) else (
cargo test --verbose --color always --features "func-types impl-default user"
)
- cargo test --verbose --color always --features "func-types impl-default user"
- if defined aarch64 (
cargo test --verbose --color always --features "func-types impl-default nightly user" --target aarch64-pc-windows-msvc --no-run
cargo test --verbose --color always --features "func-types impl-default user" --target aarch64-pc-windows-msvc --no-run
)
-19
View File
@@ -3,26 +3,7 @@
//! **`impl-default`** -- Implement [`Default`] for structs and unions.<br/>
//! **`user`** *(default)* -- Link to `ntdll`.<br/>
//! **`kernel`** -- Link to `ntoskrnl` on MSVC targets.<br/>
//! **`beta`** -- Unlock unstable features that require a beta compiler:
//! - [`NtCurrentTeb`]
//! - [`__readfsdword`]
//! - [`__readgsqword`]
//! - [`_bittest64`]
//! - [`NtCurrentPeb`]
//! - [`NtCurrentProcessId`]
//! - [`NtCurrentThreadId`]
//! - [`RtlProcessHeap`]
//! - [`RtlCheckBit`] implementation using [`_bittest64`] on x86_64.
//!
//! [`NtCurrentTeb`]: winapi_local/um/winnt/fn.NtCurrentTeb.html
//! [`__readfsdword`]: winapi_local/um/winnt/fn.__readfsdword.html
//! [`__readgsqword`]: winapi_local/um/winnt/fn.__readgsqword.html
//! [`_bittest64`]: winapi_local/um/winnt/fn._bittest64.html
//! [`NtCurrentPeb`]: ntpsapi/fn.NtCurrentPeb.html
//! [`NtCurrentProcessId`]: ntpsapi/fn.NtCurrentProcessId.html
//! [`NtCurrentThreadId`]: ntpsapi/fn.NtCurrentThreadId.html
//! [`RtlProcessHeap`]: ntrtl/fn.RtlProcessHeap.html
//! [`RtlCheckBit`]: ntrtl/fn.RtlCheckBit.html
//! [fn_ptr]: https://doc.rust-lang.org/reference/types.html#function-pointer-types
//! [`Default`]: https://doc.rust-lang.org/std/default/trait.Default.html#tymethod.default
#![cfg(all(windows, any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")))]
+4 -4
View File
@@ -19,7 +19,7 @@ use winapi::um::winnt::{
PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY, PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY,
PROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY, PSECURITY_QUALITY_OF_SERVICE,
};
#[cfg(all(feature = "beta", not(target_arch = "aarch64")))]
#[cfg(not(target_arch = "aarch64"))]
use crate::winapi_local::um::winnt::NtCurrentTeb;
pub const GDI_HANDLE_BUFFER_SIZE32: usize = 34;
pub const GDI_HANDLE_BUFFER_SIZE64: usize = 60;
@@ -932,7 +932,7 @@ pub const NtCurrentThread: HANDLE = -2isize as *mut c_void;
pub const ZwCurrentThread: HANDLE = NtCurrentThread;
pub const NtCurrentSession: HANDLE = -3isize as *mut c_void;
pub const ZwCurrentSession: HANDLE = NtCurrentSession;
#[inline] #[cfg(all(feature = "beta", not(target_arch = "aarch64")))]
#[inline] #[cfg(not(target_arch = "aarch64"))]
pub unsafe fn NtCurrentPeb() -> PPEB {
(*NtCurrentTeb()).ProcessEnvironmentBlock
}
@@ -940,11 +940,11 @@ pub const NtCurrentProcessToken: HANDLE = -4isize as *mut c_void;
pub const NtCurrentThreadToken: HANDLE = -5isize as *mut c_void;
pub const NtCurrentEffectiveToken: HANDLE = -6isize as *mut c_void;
pub const NtCurrentSilo: HANDLE = -1isize as *mut c_void;
#[inline] #[cfg(all(feature = "beta", not(target_arch = "aarch64")))]
#[inline] #[cfg(not(target_arch = "aarch64"))]
pub unsafe fn NtCurrentProcessId() -> HANDLE {
(*NtCurrentTeb()).ClientId.UniqueProcess
}
#[inline] #[cfg(all(feature = "beta", not(target_arch = "aarch64")))]
#[inline] #[cfg(not(target_arch = "aarch64"))]
pub unsafe fn NtCurrentThreadId() -> HANDLE {
(*NtCurrentTeb()).ClientId.UniqueThread
}
+4 -9
View File
@@ -2196,7 +2196,7 @@ EXTERN!{extern "system" {
MakeReadOnly: BOOLEAN,
);
}}
#[inline] #[cfg(all(feature = "beta", not(target_arch = "aarch64")))]
#[inline] #[cfg(not(target_arch = "aarch64"))]
pub unsafe fn RtlProcessHeap() -> PVOID {
use crate::ntpsapi::NtCurrentPeb;
(*NtCurrentPeb()).ProcessHeap
@@ -2944,15 +2944,10 @@ EXTERN!{extern "system" {
}}
#[inline]
pub unsafe fn RtlCheckBit(BitMapHeader: &RTL_BITMAP, BitPosition: ULONG) -> u8 {
#[cfg(all(target_arch = "x86_64", feature = "beta"))] {
use crate::winapi_local::um::winnt::_bittest64;
_bittest64(BitMapHeader.Buffer as *const i64, BitPosition as i64)
#[cfg(target_arch = "x86_64")] {
core::arch::x86_64::_bittest64(BitMapHeader.Buffer as *const i64, BitPosition as i64)
}
#[cfg(any(
target_arch = "x86",
all(target_arch = "x86_64", not(feature = "beta")),
target_arch = "aarch64",
))] {
#[cfg(any(target_arch = "x86", target_arch = "aarch64"))] {
(*BitMapHeader.Buffer.offset(BitPosition as isize / 32) >> (BitPosition % 32) & 1) as u8
}
}
+2 -17
View File
@@ -1,5 +1,3 @@
#[cfg(all(feature = "beta", not(target_arch = "aarch64")))]
use core::arch::asm;
use winapi::shared::basetsd::{DWORD64, SIZE_T, ULONG64};
use winapi::shared::minwindef::DWORD;
use winapi::um::winnt::{HANDLE, PVOID};
@@ -8,24 +6,11 @@ use winapi::um::winnt::{HANDLE, PVOID};
pub const fn UInt32x32To64(a: u32, b: u32) -> u64 {
a as u64 * b as u64
}
#[cfg(all(feature = "beta", not(target_arch = "aarch64")))]
#[cfg(not(target_arch = "aarch64"))]
IFDEF!{
use core::arch::asm;
use crate::ntpebteb::TEB;
#[inline]
#[cfg(target_pointer_width = "64")]
pub unsafe fn _bittest64(Base: *const i64, Offset: i64) -> u8 {
let out: u8;
asm!(
"bt {1}, {2}",
"setb {0}",
out(reg_byte) out,
in(reg) Base,
in(reg) Offset,
options(nostack, pure, readonly),
);
out
}
#[inline]
pub unsafe fn __readfsdword(Offset: DWORD) -> DWORD {
let out: u32;
asm!(