Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invaid prototype of PDRIVER_UNLOAD #2612

Closed
HoShiMin opened this issue Aug 16, 2023 · 2 comments
Closed

Invaid prototype of PDRIVER_UNLOAD #2612

HoShiMin opened this issue Aug 16, 2023 · 2 comments
Labels
question Further information is requested

Comments

@HoShiMin
Copy link

HoShiMin commented Aug 16, 2023

Which crate is this about?

windows-sys

Crate version

0.51.0

Summary

Is that correct that the PDRIVER_UNLOAD has no PDRIVER_OBJECT argument?
It has the following prototype:

pub type PDRIVER_UNLOAD = ::core::option::Option<unsafe extern "system" fn() -> ()>;

But in C++ WDK it declared as this:

//
// 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
    );

And it seems like all function pointers (at least in Foundation module) have no arguments.

Toolchain version/configuration

No response

Reproducible example

No response

Crate manifest

No response

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

@HoShiMin HoShiMin added the bug Something isn't working label Aug 16, 2023
@HoShiMin
Copy link
Author

HoShiMin commented Aug 16, 2023

And why they declared as Option<fn()> but not like a raw function pointers? Is it compatible with raw C pointers?

@kennykerr
Copy link
Collaborator

If the function signature is incorrect then we may need the Win32/WDK metadata to be updated. Here's the repo for that:

https://github.com/microsoft/wdkmetadata

As for Option, that is guaranteed to be the same size:

https://doc.rust-lang.org/stable/std/option/index.html#representation

@kennykerr kennykerr added question Further information is requested and removed bug Something isn't working labels Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants