Skip to content

Commit

Permalink
reverted changes made by cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Durrenberger committed Dec 4, 2024
1 parent 76b6805 commit 214e5cb
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 20 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ readme = "README.md"
license = "MIT OR Apache-2.0"

[workspace.dependencies]
# Workspace Crates
wdk = { path = "crates/wdk", version = "0.3.0" }
wdk-alloc = { path = "crates/wdk-alloc", version = "0.3.0" }
wdk-build = { path = "crates/wdk-build", version = "0.3.0" }
wdk-macros = { path = "crates/wdk-macros", version = "0.3.0" }
wdk-panic = { path = "crates/wdk-panic", version = "0.3.0" }
wdk-sys = { path = "crates/wdk-sys", version = "0.3.0" }

# External Crates
Expand Down
6 changes: 4 additions & 2 deletions crates/wdk-alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ pub use kernel_mode::*;
mod kernel_mode {

use core::alloc::{GlobalAlloc, Layout};

use wdk_sys::{
ntddk::{ExAllocatePool2, ExFreePool},
POOL_FLAG_NON_PAGED, SIZE_T, ULONG,
POOL_FLAG_NON_PAGED,
SIZE_T,
ULONG,
};

/// Allocator implementation to use with `#[global_allocator]` to allow use
Expand Down
8 changes: 6 additions & 2 deletions crates/wdk-build/src/cargo_make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ use tracing::{instrument, trace};
use crate::{
metadata,
utils::{
detect_wdk_content_root, get_latest_windows_sdk_version, get_wdk_version_number, PathExt,
detect_wdk_content_root,
get_latest_windows_sdk_version,
get_wdk_version_number,
PathExt,
},
ConfigError, CpuArchitecture,
ConfigError,
CpuArchitecture,
};

/// The filename of the main makefile for Rust Windows drivers.
Expand Down
12 changes: 10 additions & 2 deletions crates/wdk-build/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ use thiserror::Error;
use windows::{
core::{s, PCSTR},
Win32::System::Registry::{
RegCloseKey, RegGetValueA, RegOpenKeyExA, HKEY, HKEY_LOCAL_MACHINE, KEY_READ, RRF_RT_REG_SZ,
RegCloseKey,
RegGetValueA,
RegOpenKeyExA,
HKEY,
HKEY_LOCAL_MACHINE,
KEY_READ,
RRF_RT_REG_SZ,
},
};

Expand Down Expand Up @@ -416,7 +422,9 @@ mod tests {

mod read_registry_key_string_value {
use windows::Win32::UI::Shell::{
FOLDERID_ProgramFiles, SHGetKnownFolderPath, KF_FLAG_DEFAULT,
FOLDERID_ProgramFiles,
SHGetKnownFolderPath,
KF_FLAG_DEFAULT,
};

use super::*;
Expand Down
31 changes: 26 additions & 5 deletions crates/wdk-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,34 @@ use proc_macro2::{Span, TokenStream as TokenStream2};
use quote::{format_ident, quote};
use syn::{
parse::{Parse, ParseStream},
parse2, parse_file, parse_quote,
parse2,
parse_file,
parse_quote,
punctuated::Punctuated,
AngleBracketedGenericArguments, Attribute, BareFnArg, Error, Expr, ExprCall, File,
GenericArgument, Ident, Item, ItemType, LitStr, Path, PathArguments, PathSegment, Result,
ReturnType, Signature, Stmt, Token, Type, TypeBareFn, TypePath,
AngleBracketedGenericArguments,
Attribute,
BareFnArg,
Error,
Expr,
ExprCall,
File,
GenericArgument,
Ident,
Item,
ItemType,
LitStr,
Path,
PathArguments,
PathSegment,
Result,
ReturnType,
Signature,
Stmt,
Token,
Type,
TypeBareFn,
TypePath,
};

/// A procedural macro that allows WDF functions to be called by name.
///
/// This macro is only intended to be used in the `wdk-sys` crate. Users wanting
Expand Down
21 changes: 13 additions & 8 deletions crates/wdk-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ use tracing_subscriber::{
EnvFilter,
};
use wdk_build::{
configure_wdk_library_build_and_then, BuilderExt, Config, ConfigError, DriverConfig,
KmdfConfig, UmdfConfig,
configure_wdk_library_build_and_then,
BuilderExt,
Config,
ConfigError,
DriverConfig,
KmdfConfig,
UmdfConfig,
};

const NUM_WDF_FUNCTIONS_PLACEHOLDER: &str =
Expand Down Expand Up @@ -94,7 +99,7 @@ impl FunctionTable {{
/// Static instance of the function table to be used throughout generated code.
pub static WDF_FUNCTION_TABLE: FunctionTable = FunctionTable::new();
"#
)
)
});

static CALL_UNSAFE_WDF_BINDING_TEMPLATE: LazyLock<String> = LazyLock::new(|| {
Expand Down Expand Up @@ -154,12 +159,12 @@ macro_rules! call_unsafe_wdf_function_binding {{
static TEST_STUBS_TEMPLATE: LazyLock<String> = LazyLock::new(|| {
format!(
r"
use crate::WDFFUNC;
use crate::WDFFUNC;
/// Stubbed version of the symbol that [`WdfFunctions`] links to so that test targets will compile
#[no_mangle]
pub static mut {WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER}: *const WDFFUNC = core::ptr::null();
",
/// Stubbed version of the symbol that [`WdfFunctions`] links to so that test targets will compile
#[no_mangle]
pub static mut {WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER}: *const WDFFUNC = core::ptr::null();
",
)
});
type GenerateFn = fn(&Path, &Config) -> Result<(), ConfigError>;
Expand Down
6 changes: 5 additions & 1 deletion crates/wdk/src/wdf/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// License: MIT OR Apache-2.0

use wdk_sys::{
call_unsafe_wdf_function_binding, NTSTATUS, WDFTIMER, WDF_OBJECT_ATTRIBUTES, WDF_TIMER_CONFIG,
call_unsafe_wdf_function_binding,
NTSTATUS,
WDFTIMER,
WDF_OBJECT_ATTRIBUTES,
WDF_TIMER_CONFIG,
};

use crate::nt_success;
Expand Down

0 comments on commit 214e5cb

Please sign in to comment.