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
Comments
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. |
The new patch fixes the issues found by Zachary. Thanks for the review! |
eryksun: You commented on my review comment; does Claudiu's latest patch look good to you? |
Here's a cleaned up version of the patch. |
The latest patch drops the symlink check, since it can be added later. |
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. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: