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

Bug: ContinueDebugEvent third parameter doesn't match type of its constants #1386

Closed
CraftSpider opened this issue Nov 29, 2022 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@CraftSpider
Copy link
Contributor

CraftSpider commented Nov 29, 2022

Which crate is this about?

windows

Crate version

0.43.0

Summary

When calling ContinueDebugEvent, the third flag parameter is supposed to be one of the constants DBG_CONTINUE, DBG_EXCEPTION_NOT_HANDLED, or DBG_REPLY_LATER, according to the documentation. Trying to pass any of these parameters, however, results in a type error, as they have type NTSTATUS, while the ContinueDebugEvent event parameter is a u32. Even appending .0 doesn't help, as the internal type of NTSTATUS is i32.

Toolchain version/configuration

Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\runet.rustup

installed toolchains

stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default)
dev
dev1

installed targets for active toolchain

wasm32-unknown-unknown
x86_64-pc-windows-msvc
x86_64-unknown-linux-gnu

active toolchain

nightly-x86_64-pc-windows-msvc (default)
rustc 1.67.0-nightly (edf018221 2022-11-02)

Reproducible example

use windows::Win32::Foundation::DBG_CONTINUE;
use windows::Win32::System::Diagnostics::Debug::ContinueDebugEvent;

fn main() {
    ContinueDebugEvent(0, 0, DBG_CONTINUE);
}

Crate manifest

[dependencies.windows]
version = "0.43"
features = ["Win32_Foundation", "Win32_System_Diagnostics_Debug"]

Expected behavior

The third parameter type for ContinueDebugEvent matches the type of its constants

Actual behavior

The third parameter type differs, resulting in extra difficulty calling the function

Additional comments

No response

@CraftSpider CraftSpider added the bug Something isn't working label Nov 29, 2022
@kennykerr
Copy link
Contributor

It looks like the Windows SDK defines these constants as either NTSTATUS or DWORD depending on whether you include ntstatus.h or winnt.h. I'm not sure what the solution is here but I'll transfer the issue to the Win32 metadata repo where these definitions are produced.

@kennykerr kennykerr transferred this issue from microsoft/windows-rs Nov 29, 2022
@mikebattista
Copy link
Contributor

We need to pick one type. Is there a clear winner?

@kennykerr
Copy link
Contributor

I had a quick peek at the ContinueDebugEvent implementation and it just treats the parameter as an NTSTATUS value so perhaps we just update the signature to expect an NTSTATUS.

@mikebattista mikebattista self-assigned this Nov 30, 2022
@mikebattista
Copy link
Contributor

Windows.Win32.System.Diagnostics.Debug.Apis.ContinueDebugEvent : dwContinueStatus...UInt32 => NTSTATUS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants