Skip to content

[winreg] DeleteKeyEx() documentation #95423

@eryksun

Description

@eryksun

The documentation and docstring of winreg.DeleteKeyEx() claim that RegDeleteKeyExW() is only implemented in 64-bit versions of Windows. Actually, it's available in the API on systems based on NT 5.2 and above, including XP Professional x64 Edition, Vista, and later releases of Windows.

A 32-bit build of Windows ignores the KEY_WOW64_64KEY and KEY_WOW64_32KEY access constants, in which case RegDeleteKeyExW() is functionally equivalent to RegDeleteKeyW(). The documentation of these two constants in the "Access Rights" section should clarify that they're ignored in 32-bit Windows.

The default value of access should have been 0 instead of KEY_WOW64_64KEY, if only this could be changed, but it can't. The docs should clarify that the way to delete a key from the default registry view of the process is either to pass 0 for access or use winreg.DeleteKey().

On a related note, since RegDeleteKeyExW() has been available for all builds of Windows since Vista, winreg_DeleteKeyEx_impl() in "PC/winreg.c" can be simplified to use load-time dynamic linking. Updating this isn't necessary, however. It works fine either way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only security fixes3.11only security fixes3.12only security fixesOS-windowsdocsDocumentation in the Doc direasytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions