1
1
//! Rust KMDF Abstractions
2
2
#![ no_std]
3
- #![ deny( unsafe_op_in_unsafe_fn) ]
3
+ #![ deny( unsafe_op_in_unsafe_fn, clippy :: undocumented_unsafe_blocks ) ]
4
4
5
5
pub mod raw {
6
6
//! Raw bindings to KMDF functions
@@ -703,8 +703,10 @@ pub mod object {
703
703
let handle = handle. as_handle ( ) ;
704
704
705
705
// SAFETY: `handle` validity assured by `AsObjectHandle`, and context info validity assured by `IntoContextSpace`
706
- let context_space =
707
- unsafe { crate :: raw:: WdfObjectGetTypedContextWorker ( handle, T :: CONTEXT_INFO ) } ;
706
+ let context_space = unsafe {
707
+ // filler line as a work-around for https://github.com/rust-lang/rust-clippy/issues/10832
708
+ crate :: raw:: WdfObjectGetTypedContextWorker ( handle, T :: CONTEXT_INFO )
709
+ } ;
708
710
let context_space = context_space. cast :: < T > ( ) ;
709
711
710
712
// SAFETY:
@@ -726,8 +728,10 @@ pub mod object {
726
728
let handle = handle. as_handle_mut ( ) ;
727
729
728
730
// SAFETY: `handle` validity assured by `AsObjectHandle`, and context info validity assured by `IntoContextSpace`
729
- let context_space =
730
- unsafe { crate :: raw:: WdfObjectGetTypedContextWorker ( handle, T :: CONTEXT_INFO ) } ;
731
+ let context_space = unsafe {
732
+ // filler line as a work-around for https://github.com/rust-lang/rust-clippy/issues/10832
733
+ crate :: raw:: WdfObjectGetTypedContextWorker ( handle, T :: CONTEXT_INFO )
734
+ } ;
731
735
let context_space = context_space. cast :: < T > ( ) ;
732
736
733
737
// SAFETY:
@@ -752,8 +756,10 @@ pub mod object {
752
756
let handle = handle. as_handle_mut ( ) ;
753
757
754
758
// SAFETY: `handle` validity assured by `AsObjectHandle`, and context info validity assured by `IntoContextSpace`
755
- let context_space =
756
- unsafe { crate :: raw:: WdfObjectGetTypedContextWorker ( handle, T :: CONTEXT_INFO ) } ;
759
+ let context_space = unsafe {
760
+ // filler line as a work-around for https://github.com/rust-lang/rust-clippy/issues/10832
761
+ crate :: raw:: WdfObjectGetTypedContextWorker ( handle, T :: CONTEXT_INFO )
762
+ } ;
757
763
let context_space = context_space. cast :: < T > ( ) ;
758
764
759
765
// SAFETY:
@@ -794,7 +800,7 @@ pub mod driver {
794
800
impl DriverHandle {
795
801
/// Wraps the handle in a raw driver object
796
802
///
797
- /// SAFETY:
803
+ /// ## Safety
798
804
///
799
805
/// Respect aliasing rules, since this can be used to
800
806
/// generate aliasing mutable references to the context space
@@ -997,13 +1003,9 @@ pub mod driver {
997
1003
return ;
998
1004
} ;
999
1005
1000
- unsafe {
1001
- windows_kernel_sys:: DbgPrintEx (
1002
- windows_kernel_sys:: _DPFLTR_TYPE:: DPFLTR_IHVDRIVER_ID as u32 ,
1003
- windows_kernel_sys:: DPFLTR_INFO_LEVEL ,
1004
- b"KmdfHewwoWowwd: EvtDestroy\n \0 " . as_ptr ( ) . cast ( ) ,
1005
- )
1006
- } ;
1006
+ // Don't really need it here, but just as a demonstration of how we can add logging
1007
+ // for lib crates
1008
+ windows_kernel_rs:: log:: debug!( "KmdfHewwoWowwd: EvtDestroy" ) ;
1007
1009
1008
1010
// Drop it!
1009
1011
// SAFETY:
0 commit comments