You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Environment variables are not expanded in _winreg when using REG_EXPAND_SZ. #55128
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=<Date2012-12-24.02:23:25.683>created_at=<Date2011-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=<Date2012-12-24.02:23:25.667>user='https://bugs.python.org/rjnienaber'
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.
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."
Activity
rjnienaber commentedon 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.
briancurtin commentedon Jan 16, 2011
Assigning to myself.
Relevant IronPython issue: http://ironpython.codeplex.com/workitem/24042
rjnienaber commentedon 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 commentedon Dec 24, 2012
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.