@@ -16,6 +16,8 @@ pub use wdf::*;
1616 driver_model__driver_type = "UMDF"
1717) ) ]
1818use crate :: { DRIVER_OBJECT , NTSTATUS , PCUNICODE_STRING } ;
19+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
20+ use crate :: { ERESOURCE , EX_SPIN_LOCK , KIRQL , LOGICAL , ULONG , ULONG_PTR } ;
1921
2022/// Stubbed version of `DriverEntry` Symbol so that test targets will compile
2123///
@@ -37,6 +39,145 @@ pub const unsafe extern "system" fn driver_entry_stub(
3739 0
3840}
3941
42+ /// Stubbed version of `ExInitializeResourceLite` so test targets can link
43+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
44+ #[ unsafe( no_mangle) ]
45+ pub extern "system" fn ExInitializeResourceLite ( _resource : * mut ERESOURCE ) -> NTSTATUS {
46+ crate :: STATUS_SUCCESS
47+ }
48+
49+ /// Stubbed version of `ExAcquireResourceSharedLite` so test targets can link
50+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
51+ #[ unsafe( no_mangle) ]
52+ pub extern "system" fn ExAcquireResourceSharedLite (
53+ _resource : * mut ERESOURCE ,
54+ _wait : crate :: BOOLEAN ,
55+ ) -> crate :: BOOLEAN {
56+ 1
57+ }
58+
59+ /// Stubbed version of `ExAcquireResourceExclusiveLite` so test targets can link
60+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
61+ #[ unsafe( no_mangle) ]
62+ pub extern "system" fn ExAcquireResourceExclusiveLite (
63+ _resource : * mut ERESOURCE ,
64+ _wait : crate :: BOOLEAN ,
65+ ) -> crate :: BOOLEAN {
66+ 1
67+ }
68+
69+ /// Stubbed version of `ExReleaseResourceLite` so test targets can link
70+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
71+ #[ unsafe( no_mangle) ]
72+ pub extern "system" fn ExReleaseResourceLite ( _resource : * mut ERESOURCE ) { }
73+
74+ /// Stubbed version of `ExDeleteResourceLite` so test targets can link
75+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
76+ #[ unsafe( no_mangle) ]
77+ pub extern "system" fn ExDeleteResourceLite ( _resource : * mut ERESOURCE ) -> NTSTATUS {
78+ crate :: STATUS_SUCCESS
79+ }
80+
81+ /// Stubbed version of `KeEnterCriticalRegion` so test targets can link
82+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
83+ #[ unsafe( no_mangle) ]
84+ pub extern "system" fn KeEnterCriticalRegion ( ) { }
85+
86+ /// Stubbed version of `KeLeaveCriticalRegion` so test targets can link
87+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
88+ #[ unsafe( no_mangle) ]
89+ pub extern "system" fn KeLeaveCriticalRegion ( ) { }
90+
91+ /// Stubbed version of `ExInitializePushLock` so test targets can link
92+ ///
93+ /// # Safety
94+ ///
95+ /// `push_lock` must point to valid writable push lock storage.
96+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
97+ #[ unsafe( no_mangle) ]
98+ pub unsafe extern "C" fn ExInitializePushLock ( push_lock : * mut ULONG_PTR ) {
99+ // SAFETY: Test callers pass a valid pointer to push lock storage.
100+ unsafe {
101+ push_lock. write ( 0 ) ;
102+ }
103+ }
104+
105+ /// Stubbed version of `ExAcquirePushLockSharedEx` so test targets can link
106+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
107+ #[ unsafe( no_mangle) ]
108+ pub extern "C" fn ExAcquirePushLockSharedEx ( _push_lock : * mut ULONG_PTR , _flags : ULONG ) { }
109+
110+ /// Stubbed version of `ExAcquirePushLockExclusiveEx` so test targets can link
111+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
112+ #[ unsafe( no_mangle) ]
113+ pub extern "C" fn ExAcquirePushLockExclusiveEx ( _push_lock : * mut ULONG_PTR , _flags : ULONG ) { }
114+
115+ /// Stubbed version of `ExReleasePushLockSharedEx` so test targets can link
116+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
117+ #[ unsafe( no_mangle) ]
118+ pub extern "C" fn ExReleasePushLockSharedEx ( _push_lock : * mut ULONG_PTR , _flags : ULONG ) { }
119+
120+ /// Stubbed version of `ExReleasePushLockExclusiveEx` so test targets can link
121+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
122+ #[ unsafe( no_mangle) ]
123+ pub extern "C" fn ExReleasePushLockExclusiveEx ( _push_lock : * mut ULONG_PTR , _flags : ULONG ) { }
124+
125+ /// Stubbed version of `ExAcquireSpinLockShared` so test targets can link
126+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
127+ #[ unsafe( no_mangle) ]
128+ pub extern "C" fn ExAcquireSpinLockShared ( _spin_lock : * mut EX_SPIN_LOCK ) -> KIRQL {
129+ 0
130+ }
131+
132+ /// Stubbed version of `ExAcquireSpinLockSharedAtDpcLevel` so test targets can
133+ /// link
134+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
135+ #[ unsafe( no_mangle) ]
136+ pub extern "C" fn ExAcquireSpinLockSharedAtDpcLevel ( _spin_lock : * mut EX_SPIN_LOCK ) { }
137+
138+ /// Stubbed version of `ExReleaseSpinLockShared` so test targets can link
139+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
140+ #[ unsafe( no_mangle) ]
141+ pub extern "C" fn ExReleaseSpinLockShared ( _spin_lock : * mut EX_SPIN_LOCK , _old_irql : KIRQL ) { }
142+
143+ /// Stubbed version of `ExReleaseSpinLockSharedFromDpcLevel` so test targets can
144+ /// link
145+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
146+ #[ unsafe( no_mangle) ]
147+ pub extern "C" fn ExReleaseSpinLockSharedFromDpcLevel ( _spin_lock : * mut EX_SPIN_LOCK ) { }
148+
149+ /// Stubbed version of `ExAcquireSpinLockExclusive` so test targets can link
150+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
151+ #[ unsafe( no_mangle) ]
152+ pub extern "C" fn ExAcquireSpinLockExclusive ( _spin_lock : * mut EX_SPIN_LOCK ) -> KIRQL {
153+ 0
154+ }
155+
156+ /// Stubbed version of `ExAcquireSpinLockExclusiveAtDpcLevel` so test targets
157+ /// can link
158+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
159+ #[ unsafe( no_mangle) ]
160+ pub extern "C" fn ExAcquireSpinLockExclusiveAtDpcLevel ( _spin_lock : * mut EX_SPIN_LOCK ) { }
161+
162+ /// Stubbed version of `ExReleaseSpinLockExclusive` so test targets can link
163+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
164+ #[ unsafe( no_mangle) ]
165+ pub extern "C" fn ExReleaseSpinLockExclusive ( _spin_lock : * mut EX_SPIN_LOCK , _old_irql : KIRQL ) { }
166+
167+ /// Stubbed version of `ExReleaseSpinLockExclusiveFromDpcLevel` so test targets
168+ /// can link
169+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
170+ #[ unsafe( no_mangle) ]
171+ pub extern "C" fn ExReleaseSpinLockExclusiveFromDpcLevel ( _spin_lock : * mut EX_SPIN_LOCK ) { }
172+
173+ /// Stubbed version of `ExTryConvertSharedSpinLockExclusive` so test targets can
174+ /// link
175+ #[ cfg( any( driver_model__driver_type = "WDM" , driver_model__driver_type = "KMDF" ) ) ]
176+ #[ unsafe( no_mangle) ]
177+ pub extern "C" fn ExTryConvertSharedSpinLockExclusive ( _spin_lock : * mut EX_SPIN_LOCK ) -> LOGICAL {
178+ 1
179+ }
180+
40181#[ cfg( any( driver_model__driver_type = "KMDF" , driver_model__driver_type = "UMDF" ) ) ]
41182mod wdf {
42183 use crate :: ULONG ;
0 commit comments