def unregisterInstallation(keepDesktopShortcut=False): try: _winreg.DeleteKeyEx(_winreg.HKEY_LOCAL_MACHINE, easeOfAccess.APP_KEY_PATH, _winreg.KEY_WOW64_64KEY) easeOfAccess.setAutoStart(_winreg.HKEY_LOCAL_MACHINE, False) except WindowsError: pass wsh=_getWSH() desktopPath=os.path.join(wsh.SpecialFolders("AllUsersDesktop"),"NVDA.lnk") if not keepDesktopShortcut and os.path.isfile(desktopPath): try: os.remove(desktopPath) except WindowsError: pass startMenuFolder=getStartMenuFolder() if startMenuFolder: programsPath=wsh.SpecialFolders("AllUsersPrograms") startMenuPath=os.path.join(programsPath,startMenuFolder) if os.path.isdir(startMenuPath): shutil.rmtree(startMenuPath,ignore_errors=True) try: _winreg.DeleteKey(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\nvda") except WindowsError: pass try: _winreg.DeleteKey(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe") except WindowsError: pass try: _winreg.DeleteKey(_winreg.HKEY_LOCAL_MACHINE,config.NVDA_REGKEY) except WindowsError: pass unregisterAddonFileAssociation()
def unregisterInstallation(keepDesktopShortcut=False): try: winreg.DeleteKeyEx(winreg.HKEY_LOCAL_MACHINE, easeOfAccess.APP_KEY_PATH, winreg.KEY_WOW64_64KEY) easeOfAccess.setAutoStart(winreg.HKEY_LOCAL_MACHINE, False) except WindowsError: pass wsh=_getWSH() desktopPath=os.path.join(wsh.SpecialFolders("AllUsersDesktop"),"NVDA.lnk") if not keepDesktopShortcut and os.path.isfile(desktopPath): try: os.remove(desktopPath) except WindowsError: pass startMenuFolder=getStartMenuFolder() if startMenuFolder: programsPath=wsh.SpecialFolders("AllUsersPrograms") startMenuPath=os.path.join(programsPath,startMenuFolder) if os.path.isdir(startMenuPath): shutil.rmtree(startMenuPath,ignore_errors=True) try: winreg.DeleteKey(winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\nvda") except WindowsError: pass try: winreg.DeleteKey(winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe") except WindowsError: pass try: winreg.DeleteKey(winreg.HKEY_LOCAL_MACHINE,config.NVDA_REGKEY) except WindowsError: pass unregisterAddonFileAssociation()
def _setStartOnLogonScreen(enable): if easeOfAccess.isSupported: # The installer will have migrated service config to EoA if appropriate, # so we only need to deal with EoA here. easeOfAccess.setAutoStart(winreg.HKEY_LOCAL_MACHINE, enable) else: k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, NVDA_REGKEY, 0, winreg.KEY_WRITE) winreg.SetValueEx(k, u"startOnLogonScreen", None, winreg.REG_DWORD, int(enable))
def _setStartOnLogonScreen(enable): if easeOfAccess.isSupported: # The installer will have migrated service config to EoA if appropriate, # so we only need to deal with EoA here. easeOfAccess.setAutoStart(_winreg.HKEY_LOCAL_MACHINE, enable) else: k = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, NVDA_REGKEY, 0, _winreg.KEY_WRITE) _winreg.SetValueEx(k, u"startOnLogonScreen", None, _winreg.REG_DWORD, int(enable))
def setStartAfterLogon(enable): if getStartAfterLogon() == enable: return if easeOfAccess.isSupported and easeOfAccess.canConfigTerminateOnDesktopSwitch: easeOfAccess.setAutoStart(winreg.HKEY_CURRENT_USER, enable) if enable: return # We're disabling, so ensure the run key is cleared, # as it might have been set by an old version. run = False else: run = enable k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RUN_REGKEY, 0, winreg.KEY_WRITE) if run: winreg.SetValueEx(k, u"nvda", None, winreg.REG_SZ, sys.argv[0]) else: try: winreg.DeleteValue(k, u"nvda") except WindowsError: pass
def setStartAfterLogon(enable): if getStartAfterLogon() == enable: return if easeOfAccess.isSupported and easeOfAccess.canConfigTerminateOnDesktopSwitch: easeOfAccess.setAutoStart(_winreg.HKEY_CURRENT_USER, enable) if enable: return # We're disabling, so ensure the run key is cleared, # as it might have been set by an old version. run = False else: run = enable k = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, RUN_REGKEY, 0, _winreg.KEY_WRITE) if run: _winreg.SetValueEx(k, u"nvda", None, _winreg.REG_SZ, sys.argv[0]) else: try: _winreg.DeleteValue(k, u"nvda") except WindowsError: pass
def setStartAfterLogon(enable: bool) -> None: """Not to be confused with setStartOnLogonScreen. Toggle if NVDA automatically starts after a logon. Sets easeOfAccess related registry keys on Windows 8 or newer. On Windows 7 this sets the registry run key. When toggling off, always delete the registry run key in case it was set by an earlier version of NVDA or on Windows 7 or earlier. """ if getStartAfterLogon() == enable: return if easeOfAccess.canConfigTerminateOnDesktopSwitch: easeOfAccess.setAutoStart(easeOfAccess.AutoStartContext.AFTER_LOGON, enable) if enable: return # We're disabling, so ensure the run key is cleared, # as it might have been set by an old version. run = False else: run = enable k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, RegistryKey.RUN.value, 0, winreg.KEY_WRITE) if run: winreg.SetValueEx(k, "nvda", None, winreg.REG_SZ, sys.argv[0]) else: try: winreg.QueryValue(k, "nvda") except FileNotFoundError: log.debug( "The run registry key is not set for setStartAfterLogon." "This is expected for Windows 8+ which uses ease of access" ) return try: winreg.DeleteValue(k, "nvda") except WindowsError: log.error( "Couldn't unset registry key for nvda to start after logon.", exc_info=True )
def _setStartOnLogonScreen(enable): easeOfAccess.setAutoStart(winreg.HKEY_LOCAL_MACHINE, enable)
def _setStartOnLogonScreen(enable: bool) -> None: easeOfAccess.setAutoStart(easeOfAccess.AutoStartContext.ON_LOGON_SCREEN, enable)