Comments (6)
Looks like a metadata bug. There's Windows.Wdk.System.SystemServices.DRIVER_UNLOAD
which appears to be correct and then there's Windows.Wdk.Foundation.PDRIVER_UNLOAD
which appears to be incorrect.
from wdkmetadata.
DRIVER_UNLOAD
is in the metadata. Does that work as expected?
from wdkmetadata.
Although the currently published version of windows-sys 0.48 does not include this declaration, the latest version on GitHub has the expected type:
pub type DRIVER_UNLOAD = ::core::option::Option<unsafe extern "system" fn(driverobject: *const super::super::Foundation::DRIVER_OBJECT) -> ()>;
You can test by pointing your Cargo dependency to the git repo.
from wdkmetadata.
@kennykerr, I can't found this. I setted windows-sys
using a git link:
[dependencies.windows-sys]
git = "https://github.com/microsoft/windows-rs.git"
features = [
"Win32_Foundation",
"Win32_Security",
"Win32_System_IO",
"Win32_System_Kernel",
"Win32_System_Power",
"Win32_System_WindowsProgramming",
"Win32_System_Ioctl",
"Wdk_Foundation",
"Wdk_System",
"Wdk_System_IO",
"Wdk_System_SystemServices",
"Wdk_System_Threading",
"Wdk_Storage",
"Wdk_Storage_FileSystem"
]
And we still have no arguments in the master branch: https://github.com/microsoft/windows-rs/blob/master/crates/libs/sys/src/Windows/Wdk/Foundation/mod.rs#L2208
from wdkmetadata.
Here is a workaround for anyone else who came across this issue until it is fixed:
let driver_unload_fn: windows_sys::Wdk::System::SystemServices::DRIVER_UNLOAD = Some(the_driver_unload_function);
(*driver_object).DriverUnload = core::mem::transmute(driver_unload_fn);
This also works for the Major functions array:
type WriteType = Option<unsafe extern "system" fn(&mut windows_sys::Wdk::Foundation::DEVICE_OBJECT, &mut windows_sys::Wdk::Foundation::IRP) -> windows_sys::Win32::Foundation::NTSTATUS>;
let driver_write_fn: WriteType = Some(the_read_function);
(*driver_object).MajorFunction[windows_sys::Wdk::System::SystemServices::IRP_MJ_WRITE as usize] = core::mem::transmute(driver_write_fn);
from wdkmetadata.
//
// Define driver unload routine type.
//
_Function_class_(DRIVER_UNLOAD)
_IRQL_requires_(PASSIVE_LEVEL)
_IRQL_requires_same_
typedef
VOID
DRIVER_UNLOAD (
_In_ struct _DRIVER_OBJECT *DriverObject
);
typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
@tannergooding is there anything we can do to scrape these pointer-to-delegate typedefs in a better way? PDRIVER_UNLOAD
and other typedefs like this result in an empty delegate, and then wherever these typedefs are referenced results in an empty delegate rather than a pointer to the real delegate.
We can manually exclude these typedefs and then remap all occurrences of them to use the original delegate, but there are a lot of instances of these so it would be better if we could handle this while scraping.
Is ClangSharp behaving as expected here? Are there any config options that could help us?
from wdkmetadata.
Related Issues (20)
- Missing WDF Device Functions in Metadata
- KeBugCheckEx should be made to use the System.Diagnostics.Debug BUGCHECK_ERROR enumeration
- Add FILE_INFORMATION_CLASS
- Missing DEVPKEY_s HOT 6
- The API "LsaFreeReturnBuffer" is ambiguous. HOT 2
- ntdll functions HOT 10
- Incorrect DRIVER_OBJECT member types HOT 1
- POINTER_ALIGNMENT not applied to Rust structs HOT 6
- CM_POWER_DATA can use one more enum
- why define NTSTRSAFE_USE_SECURE_CRT as 0 here? HOT 1
- Missing `ThreadNameInformation`
- Inconsistent alignment of `CM_PARTIAL_RESOURCE_DESCRIPTOR` structure HOT 1
- `VHF_CONFIG` callbacks have wrong signature HOT 1
- Invalid "optioning" of driver callbacks. HOT 1
- Nt vs Zw exports HOT 2
- There's no `NtOpenDirectoryObject` and `NtQueryDirectoryObject` HOT 3
- Some more missing DEVPKEYs
- Add `RtlIsDosDeviceName_U` and `RtlDosPathNameToNtPathName_U_WithStatus`
- `OBJ_INHERIT` and related attributes are `int` whereas `OBJECT_ATTRIBUTES.Attributes` is `uint`
- feat: Useful names for reparse data buffers HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wdkmetadata.