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

Add windows_helper module helper #66278

Open
PCManticore mannequin opened this issue Jul 26, 2014 · 6 comments
Open

Add windows_helper module helper #66278

PCManticore mannequin opened this issue Jul 26, 2014 · 6 comments
Labels
3.9 only security fixes 3.10 only security fixes OS-windows tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@PCManticore
Copy link
Mannequin

PCManticore mannequin commented Jul 26, 2014

BPO 22080
Nosy @pfmoore, @tjguk, @PCManticore, @zware, @eryksun, @zooba
Files
  • windows_helper.patch
  • issue22080.patch: New version.
  • issue22080_1.patch
  • issue22080_2.patch
  • windows_helper.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2014-07-26.12:39:33.429>
    labels = ['3.10', 'type-feature', 'tests', '3.9', 'OS-windows']
    title = 'Add windows_helper module helper'
    updated_at = <Date 2021-02-24.17:11:36.765>
    user = 'https://github.com/PCManticore'

    bugs.python.org fields:

    activity = <Date 2021-02-24.17:11:36.765>
    actor = 'eryksun'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests', 'Windows']
    creation = <Date 2014-07-26.12:39:33.429>
    creator = 'Claudiu.Popa'
    dependencies = []
    files = ['36108', '36288', '37741', '39133', '49832']
    hgrepos = []
    issue_num = 22080
    keywords = ['patch']
    message_count = 6.0
    messages = ['224050', '224934', '229063', '234179', '241563', '387631']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'Claudiu.Popa', 'zach.ware', 'eryksun', 'steve.dower']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue22080'
    versions = ['Python 3.9', 'Python 3.10']

    @PCManticore
    Copy link
    Mannequin Author

    PCManticore mannequin commented Jul 26, 2014

    Hi. This patch adds a new test helper module, initially added in bpo-21518, for controlling various aspects on Windows platform, like acquiring / releasing privileges etc. At the same time, it contains a modification in test.support.skip_unless_symlink, so that it tries to acquire the privilege, failing otherwise. The only downside is that acquiring SeCreateSymbolicLinkPrivilege is only possible for admins and it seems to be that they have the privilege by default. On the other hand, for SeBackupPrivilege must be explicitly acquired, so the purpose of this module isn't redundant.

    The part of acquiring a privilege using ctypes is based on similar code by Jason R. Coombs.

    @PCManticore PCManticore mannequin added tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Jul 26, 2014
    @PCManticore
    Copy link
    Mannequin Author

    PCManticore mannequin commented Aug 6, 2014

    The new patch fixes the issues found by Zachary. Thanks for the review!

    @zware
    Copy link
    Member

    zware commented Oct 11, 2014

    eryksun: You commented on my review comment; does Claudiu's latest patch look good to you?

    @PCManticore
    Copy link
    Mannequin Author

    PCManticore mannequin commented Jan 17, 2015

    Here's a cleaned up version of the patch.

    @PCManticore
    Copy link
    Mannequin Author

    PCManticore mannequin commented Apr 19, 2015

    The latest patch drops the symlink check, since it can be added later.

    @eryksun
    Copy link
    Contributor

    eryksun commented Feb 24, 2021

    I rewrote windows_helper.py with cleaner ctypes code, better error handling, the correct implementation of restoring the previous privilege state, and without leaking the handle for the process token. It's kind of limited as a "Windows helper" module. It's just handling privileges, at least for now. This helper was intended to help with testing bpo-21518 (add winreg.UnLoadKey), another contribution from Claudiu.

    @eryksun eryksun added 3.9 only security fixes 3.10 only security fixes labels Feb 24, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes OS-windows tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants