Use registry_setstring

master
Daniel Berteaud 6 years ago
parent c33edf5a03
commit b09fedf8ac
  1. 14
      setup.py

@ -41,21 +41,17 @@ def install():
run(r'net localgroup Administrateurs rv /add', accept_returncodes=[0,2]) run(r'net localgroup Administrateurs rv /add', accept_returncodes=[0,2])
print('Disabling Windows host script engine') print('Disabling Windows host script engine')
with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'Software\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: registry_setstring(HKEY_LOCAL_MACHINE, r'Software\Microsoft\Windows Script Host\Settings', 'Enabled', 0, REG_DWORD)
reg_setvalue(reg_key, 'Enabled', 0, REG_DWORD)
if iswin64(): if iswin64():
with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', 'Enabled', 0, REG_DWORD)
reg_setvalue(reg_key, 'Enabled', 0, REG_DWORD)
def uninstall(): def uninstall():
print('Re enabling services') print('Re enabling services')
for service in disabled_services: for service in disabled_services:
print('Enabling %s' % service) print(' Enabling %s' % service)
run(r'sc config %s start= auto' % service, accept_returncodes=[0,1060]) run(r'sc config %s start= auto' % service, accept_returncodes=[0,1060])
print('Enabling Windows Host Script engine') print('Enabling Windows Host Script engine')
with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'Software\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: registry_setstring(HKEY_LOCAL_MACHINE, r'Software\Microsoft\Windows Script Host\Settings', 'Enabled', 1, REG_DWORD)
reg_setvalue(reg_key, 'Enabled', 1, REG_DWORD)
if iswin64(): if iswin64():
with reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', sam=KEY_WRITE,create_if_missing=True) as reg_key: registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', 'Enabled', 1, REG_DWORD)
reg_setvalue(reg_key, 'Enabled', 1, REG_DWORD)

Loading…
Cancel
Save