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: SetThreadErrorMode has invalid prototype #1505

Closed
vthib opened this issue Mar 21, 2023 · 2 comments
Closed

Bug: SetThreadErrorMode has invalid prototype #1505

vthib opened this issue Mar 21, 2023 · 2 comments
Assignees
Labels
broken api An API is inaccurate and could lead to runtime failure bug Something isn't working

Comments

@vthib
Copy link

vthib commented Mar 21, 2023

Which crate is this about?

windows-sys

Crate version

0.45.0

Summary

The SetThreadErrorMode function has this prototype: https://docs.rs/windows-sys/0.45.0/windows_sys/Win32/System/Diagnostics/Debug/fn.SetThreadErrorMode.html

pub unsafe extern "system" fn SetThreadErrorMode(
    dwnewmode: THREAD_ERROR_MODE,
    lpoldmode: *const THREAD_ERROR_MODE
) -> BOOL

But as seen in the official doc: https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-setthreaderrormode the "lpoldmode" is an out parameter, and thus should be a *mut THREAD_ERROR_MODE.

@vthib vthib added the bug Something isn't working label Mar 21, 2023
@riverar
Copy link
Collaborator

riverar commented Mar 21, 2023

Yep, metadata bug, sorry about that. Transferring over there.

@riverar riverar transferred this issue from microsoft/windows-rs Mar 21, 2023
@riverar riverar added the broken api An API is inaccurate and could lead to runtime failure label Mar 21, 2023
@kennykerr
Copy link
Contributor

This function is declared as follows:

WINBASEAPI
BOOL
WINAPI
SetThreadErrorMode(
    _In_ DWORD dwNewMode,
    _In_opt_ LPDWORD lpOldMode
    );

The SAL annotation is wrong - it should be: _Out_opt_

@mikebattista mikebattista self-assigned this Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broken api An API is inaccurate and could lead to runtime failure bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants