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

Environment variables are not expanded in _winreg when using REG_EXPAND_SZ. #55128

Closed
rjnienaber mannequin opened this issue Jan 16, 2011 · 4 comments
Closed

Environment variables are not expanded in _winreg when using REG_EXPAND_SZ. #55128

rjnienaber mannequin opened this issue Jan 16, 2011 · 4 comments
Assignees
Labels
extension-modules C modules in the Modules dir OS-windows type-bug An unexpected behavior, bug, or error

Comments

@rjnienaber
Copy link
Mannequin

rjnienaber mannequin commented Jan 16, 2011

BPO 10919
Nosy @briancurtin
Files
  • testcase-24042.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 = 'https://github.com/briancurtin'
    closed_at = <Date 2012-12-24.02:23:25.683>
    created_at = <Date 2011-01-16.18:23:27.983>
    labels = ['extension-modules', 'type-bug', 'invalid', 'OS-windows']
    title = 'Environment variables are not expanded in _winreg when using REG_EXPAND_SZ.'
    updated_at = <Date 2012-12-24.02:23:25.667>
    user = 'https://bugs.python.org/rjnienaber'

    bugs.python.org fields:

    activity = <Date 2012-12-24.02:23:25.667>
    actor = 'brian.curtin'
    assignee = 'brian.curtin'
    closed = True
    closed_date = <Date 2012-12-24.02:23:25.683>
    closer = 'brian.curtin'
    components = ['Extension Modules', 'Windows']
    creation = <Date 2011-01-16.18:23:27.983>
    creator = 'rjnienaber'
    dependencies = []
    files = ['20418']
    hgrepos = []
    issue_num = 10919
    keywords = []
    message_count = 4.0
    messages = ['126368', '126369', '126383', '178027']
    nosy_count = 2.0
    nosy_names = ['brian.curtin', 'rjnienaber']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue10919'
    versions = ['Python 2.7']

    @rjnienaber
    Copy link
    Mannequin Author

    rjnienaber mannequin commented Jan 16, 2011

    According to Microsoft documentation (http://msdn.microsoft.com/en-us/library/ms724884(v=vs.85).aspx) when using the REG_EXPAND_SZ value type, environment variables (e.g. %programfiles%) should be expanded to their values (e.g. 'C:\Program Files').

    I've added a test case that reproduces this error.

    @rjnienaber rjnienaber mannequin added the stdlib Python modules in the Lib dir label Jan 16, 2011
    @briancurtin
    Copy link
    Member

    Assigning to myself.
    Relevant IronPython issue: http://ironpython.codeplex.com/workitem/24042

    @briancurtin briancurtin added extension-modules C modules in the Modules dir OS-windows and removed stdlib Python modules in the Lib dir labels Jan 16, 2011
    @briancurtin briancurtin self-assigned this Jan 16, 2011
    @briancurtin briancurtin added the type-bug An unexpected behavior, bug, or error label Jan 16, 2011
    @rjnienaber
    Copy link
    Mannequin Author

    rjnienaber mannequin commented Jan 16, 2011

    Further documentation on the RegEnumValue function (used by the _winreg module): http://msdn.microsoft.com/en-us/library/ms724865(v=vs.85).aspx. The documentation doesn't say whether the string is expanded or not on retrieval.

    Given the current behaviour plus the ExpandEnvironmentStrings function, this seems like a non-issue.

    @briancurtin
    Copy link
    Member

    Yep. The documentation you linked says "A null-terminated string that contains unexpanded references to environment variables (for example, "%PATH%"). It will be a Unicode or ANSI string depending on whether you use the Unicode or ANSI functions. To expand the environment variable references, use the ExpandEnvironmentStrings function."

    Based on that, we're doing the right thing.

    @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
    extension-modules C modules in the Modules dir OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant