# -*- coding: utf-8 -*-
from setuphelpers import *

uninstallkey = []

def install():
    print('installing waptiut-java-platform-se-8-u171')
    install_exe_if_needed("jdk-8u171-windows-x64.exe",'/s',key='',min_version='8.0.1710.11')
    run(r'"jdk\script.bat"')

    print("desactivation des mises a jour automatiques")
    if iswin64():
        key=reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy',sam=KEY_WRITE,create_if_missing=True)
        reg_setvalue(key,'EnableJavaUpdate',0,REG_DWORD)
    else:
        key=reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\JavaSoft\Java Update\Policy',sam=KEY_WRITE,create_if_missing=True)
        reg_setvalue(key,'EnableJavaUpdate',0,REG_DWORD)