[PATCH 3 of 3] (issue143) Only show warning when multiple users exist

Wald Commits scm-commit at wald.intevation.org
Thu Sep 25 12:05:13 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1411639494 -7200
# Node ID 9f5893faa60bbb6a47b3ffb936e9301b624e6085
# Parent  d4b24df4eed1f7125fd586b76840d0aba649aaee
(issue143) Only show warning when multiple users exist.

    This enumerates the ProfileList registry key and looks
    for SID's starting with S-1-5-21- (like the certificate
    installer does) and count the users. Only when more
    then one users are found the warning is shown. Otherwise
    the nss-installer will be removed.

diff -r d4b24df4eed1 -r 9f5893faa60b packaging/trustbridge.nsi
--- a/packaging/trustbridge.nsi	Thu Sep 25 12:03:18 2014 +0200
+++ b/packaging/trustbridge.nsi	Thu Sep 25 12:04:54 2014 +0200
@@ -270,6 +270,9 @@
 SectionEnd
 
 !ifdef WRITE_UNINSTALLER
+
+!include "StrFunc.nsh"
+
 Section "Uninstall"
   StrCmp "$douninstcertificates" "TRUE" 0 skip_certs
   ExpandEnvStrings $0 %LOCALAPPDATA%
@@ -281,10 +284,25 @@
   ExpandEnvStrings $0 %APPDATA%
   Delete "$0\BSI\TrustBridge.ini"
   RmDir "$0\BSI"
+  var /GLOBAL user_count
+  StrCpy $user_count 0
 
   UserInfo::GetAccountType
   pop $0
   ${If} $0 == "admin"
+    ${Do}
+      ; Loop over profile keys
+      EnumRegKey $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $R0
+      ${If} $R1 != ""
+        ${UnStrStr} $R2 $R1 "S-1-5-21-" ;Search for S-1-5-21-
+        ${If} $R2 != ""
+          IntOp $user_count $user_count + 1
+        ${EndIf}
+        IntOp $R0 $R0 + 1
+      ${EndIf}
+    ${LoopUntil} $R1 == ""
+
+    ${if} $user_count > 1
       MessageBox MB_ICONINFORMATION|MB_YESNO "\
       Zertifikate, die für andere Nutzer im Zertifikatsspeicher von Firefox und Thunderbird installiert wurden, können erst beim der nächsten \
       Anmeldung dieser Nutzer deinstalliert werden. \
@@ -294,6 +312,9 @@
       Sie bitte 'Nein' und löschen Sie 'trustbridge-nss-installer.exe' manuell nachdem die anderen Nutzer sich einmal angemeldet hatten.$\r$\n \
       $\r$\n\
       Soll '$INSTDIR\trustbridge-nss-installer.exe' jetzt entfernt werden?" /SD IDYES IDYES deleteNSSInstaller IDNO dontDeleteNSS
+    ${Else}
+      goto deleteNSSInstaller
+    ${Endif}
   ${Else}
     Delete "$INSTDIR\trustbridge-nss-installer.exe"
   ${EndIf}


More information about the Trustbridge-commits mailing list