Skip to content

Commit

Permalink
Move non-phnt extensions to ext namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
oberrich committed Apr 10, 2024
1 parent 067bdfc commit 08f5c46
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/ffi/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

// Generated at 2024-04-10 11:51:38.944305 +02:00
use cty;
pub use windows::Win32::Foundation::BOOLEAN as BOOLEAN;
pub use windows::Win32::Foundation::NTSTATUS as NTSTATUS;
pub use nt_string::unicode_string::NtUnicodeString as UNICODE_STRING;
pub use nt_string::unicode_string::NtUnicodeString as _UNICODE_STRING;
pub use windows::Win32::Foundation::BOOL as BOOL;
pub use windows::Win32::Foundation::BOOL;
pub use windows::Win32::Foundation::BOOLEAN;
pub use windows::Win32::Foundation::NTSTATUS;

#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
Expand Down
44 changes: 24 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
#![doc = include_str!("../README.md")]
#![allow(
warnings,
unused,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
// MIT License
//
//
// Copyright (c) 2024 oberrich <[email protected]>
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
#[allow(
warnings,
unused,
non_snake_case,
non_camel_case_types,
non_upper_case_globals
)]
//

pub mod ffi {
// use vendored `generated.rs` for docs.rs
#[cfg(feature="docsrs")]
#[cfg(feature = "docsrs")]
include!("ffi/generated.rs");

#[cfg(not(feature="docsrs"))]
#[cfg(not(feature = "docsrs"))]
include!(concat!(env!("OUT_DIR"), "\\generated.rs"));
}

pub mod ext {
use crate::ffi::*;
use std::arch::asm;

#[macro_export]
Expand All @@ -52,12 +56,12 @@ pub mod ffi {
}

macro_rules! FIELD_OFFSET {
($_type:ty, $field:ident$(.$cfields:ident)*) => {{
let obj = core::mem::MaybeUninit::<$_type>::uninit();
let base = obj.as_ptr();
unsafe { core::ptr::addr_of!((*base).$field$(.$cfields)*) as usize - base as usize }
}};
}
($_type:ty, $field:ident$(.$cfields:ident)*) => {{
let obj = core::mem::MaybeUninit::<$_type>::uninit();
let base = obj.as_ptr();
unsafe { core::ptr::addr_of!((*base).$field$(.$cfields)*) as usize - base as usize }
}};
}

#[inline]
pub unsafe fn __readfsdword(offset: u32) -> usize {
Expand Down

0 comments on commit 08f5c46

Please sign in to comment.