From b09fedf8ac4d77d92eb68a44c9a7453ae09d0a06 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Mon, 10 Dec 2018 21:14:20 +0100 Subject: [PATCH] Use registry_setstring --- setup.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index c718fb4..65ff023 100644 --- a/setup.py +++ b/setup.py @@ -41,21 +41,17 @@ def install(): run(r'net localgroup Administrateurs rv /add', accept_returncodes=[0,2]) 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: - reg_setvalue(reg_key, 'Enabled', 0, REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE, r'Software\Microsoft\Windows Script Host\Settings', 'Enabled', 0, REG_DWORD) 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: - reg_setvalue(reg_key, 'Enabled', 0, REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', 'Enabled', 0, REG_DWORD) def uninstall(): print('Re enabling 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]) 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: - reg_setvalue(reg_key, 'Enabled', 1, REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE, r'Software\Microsoft\Windows Script Host\Settings', 'Enabled', 1, REG_DWORD) 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: - reg_setvalue(reg_key, 'Enabled', 1, REG_DWORD) + registry_setstring(HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\Windows Script Host\Settings', 'Enabled', 1, REG_DWORD)