mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix reg.py to only convert text types to unicode
This commit is contained in:
parent
3579534ea5
commit
0e41535cdb
2 changed files with 6 additions and 3 deletions
|
@ -2750,7 +2750,7 @@ def shell_info(shell, list_modules=False):
|
|||
'Software\\Microsoft\\PowerShell\\{0}'.format(reg_ver),
|
||||
'Install')
|
||||
if install_data.get('vtype') == 'REG_DWORD' and \
|
||||
install_data.get('vdata') == salt.utils.to_unicode(1, 'mbcs'):
|
||||
install_data.get('vdata') == 1:
|
||||
details = __salt__['reg.list_values'](
|
||||
'HKEY_LOCAL_MACHINE',
|
||||
'Software\\Microsoft\\PowerShell\\{0}\\'
|
||||
|
|
|
@ -372,11 +372,14 @@ def read_value(hive, key, vname=None, use_32bit_registry=False):
|
|||
# RegQueryValueEx returns and accepts unicode data
|
||||
vdata, vtype = win32api.RegQueryValueEx(handle, local_vname)
|
||||
if vdata or vdata in [0, '']:
|
||||
# Only convert text types to unicode
|
||||
ret['vtype'] = registry.vtype_reverse[vtype]
|
||||
if vtype == 7:
|
||||
if vtype == win32con.REG_MULTI_SZ:
|
||||
ret['vdata'] = [_to_mbcs(i) for i in vdata]
|
||||
else:
|
||||
elif vtype in [win32con.REG_SZ, win32con.REG_EXPAND_SZ]:
|
||||
ret['vdata'] = _to_mbcs(vdata)
|
||||
else:
|
||||
ret['vdata'] = vdata
|
||||
else:
|
||||
ret['comment'] = 'Empty Value'
|
||||
except WindowsError: # pylint: disable=E0602
|
||||
|
|
Loading…
Add table
Reference in a new issue