Skip to content

Bug into GetThreadDescription(), wrong prototype. #152903

Description

@carlo-bramini

Bug report

Bug description:

There is bug into the declaration of a type for a pointer to function.
At this line there is this declaration:

typedef HRESULT (WINAPI *PF_GET_THREAD_DESCRIPTION)(HANDLE, PCWSTR*);

Unfortunately, this declaration is wrong.
From this page:
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreaddescription
this is the correct declaration of the function:

HRESULT GetThreadDescription(
  [in]  HANDLE hThread,
  [out] PWSTR  *ppszThreadDescription
);

As you can see, the second parameter is PWSTR and not PCWSTR.
Next, into the code, GetThreadDescription() is called with the right types for the parameters and MSVC seems to tolerate this, but a more strict compiler like GCC does not.
However, this is very simple to fix with a tiny patch.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions