Skip to content

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

Closed

Description

@rjnienaber
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']

    Activity

    1. rjnienaber commented on Jan 16, 2011

      rjnienabermannequin
      MannequinAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Jan 16, 2011
    3. briancurtin commented on Jan 16, 2011

      @briancurtin
      Member

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

    4. added and removed
      stdlibStandard Library Python modules in the Lib/ directory
      on Jan 16, 2011
    5. self-assigned this
      on Jan 16, 2011
    6. rjnienaber commented on Jan 16, 2011

      rjnienabermannequin
      MannequinAuthor

      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.

    7. briancurtin commented on Dec 24, 2012

      @briancurtin
      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.

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions