[Wapt] Désinstallation clé
Hubert TOUVET
htouvet at tranquil.it
Mon Jun 23 14:22:05 CEST 2014
La fonction registry_delete ici n'est pas adaptée car il faut supprimer
une clé complète avec ses valeurs et pas seulement une valeur dans une
clé du registre.
Il faudrait plutôt utiliser la fonction
_winreg.DeleteKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\SalsaJ")
def uninstall():
#Suppression du répertoire
salsaj_dir = makepath(programfiles32,'SalsaJ')
remove_tree(salsaj_dir)
#suppression de la clé : attention, ne marche que pour une machine
WIN64...
import _winreg
_winreg.DeleteKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\SalsaJ")
Remarques :
- HKEY_LOCAL_MACHINE est une constante, donc pas de guillemets autour.
- SalsaJ fait partie d'une chaîne de caractères donc guillemets autour.
On peut utiliser la fonction "unregister_uninstall" du module setuphelpers
def uninstall():
#Suppression du répertoire
salsaj_dir = makepath(programfiles32,'SalsaJ')
remove_tree(salsaj_dir)
#suppression de la clé
unregister_uninstall("SalsaJ",win64app=False)
Hubert Touvet.
Tranquil IT Systems.
Le 23/06/2014 13:08, Druart Michel a écrit :
> Bonjour.
>
> Voici le code que généré pour le logiciel Salsaj.
> Le problème est que je n'arrive pas à supprimer la clé de la base de
> registre.
>
> Merci de bien vouloir m'aider.
>
> Cordialement Michel
>
> Livet.
>
> -----------------------------------------------------------------------------------------------------------
>
> # -*- coding: utf-8 -*-
> from setuphelpers import *
>
> # registry key(s) where WAPT will find how to remove the application(s)
> uninstallkey = []
>
> # command(s) to launch to remove the application(s)
> uninstallstring = []
>
> # list of required parameters names (string) which can be used during
> install
> required_params = []
>
>
> def install():
> # if you want to modify the keys depending on environment
> (win32/win64... params..)
> global uninstallkey
> global uninstallstring
>
> print('installing liv-sasaj 2.0.3')
> run(r'"salsaj_with_macros_2_3_windows_installer.msi" /q /norestart')
>
> # def
> create_user_desktop_shortcut(salsaj,target='C:\Windows\system32\javaw.exe
> -jar -Dfile.encoding=UTF-8 "C:\Program Files
> (x86)\SalsaJ\SalsaJ.jar"',icon='C:\Program Files (x86)\SalsaJ\SalsaJ.ico')
>
> def uninstall():
> #Vérification du chemin
> print("%s" %os.path.join(programfiles32,'SalsaJ'))
> #Suppresion du répertoire
> salsaj_dir= os.path.join(programfiles32,'SalsaJ')
> remove_tree(salsaj_dir)
> #suppresion de la clé
> registry_delete("HKEY_LOCAL_MACHINE","SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall",SalsaJ)
>
>
> _______________________________________________
> WAPT mailing list
> WAPT at lists.tranquil.it
> http://lists.tranquil.it/listinfo/wapt
--
Hubert TOUVET
Tranquil IT Systems
02 40 97 57 57
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tranquil.it/pipermail/wapt/attachments/20140623/4dab5e07/attachment.html>
More information about the WAPT
mailing list