changeset 13391:5d2bde0687ed

[gaim-migrate @ 15764] David Everly created this patch to prevent duplication of code in the installer committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 03 Mar 2006 22:27:28 +0000
parents 9f95b44d561a
children e132f0969763
files gaim-installer.nsi
diffstat 1 files changed, 11 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/gaim-installer.nsi	Fri Mar 03 21:49:49 2006 +0000
+++ b/gaim-installer.nsi	Fri Mar 03 22:27:28 2006 +0000
@@ -906,8 +906,8 @@
       Exch $1
 FunctionEnd
 
-
-Function CheckUserInstallRights
+!macro CheckUserInstallRightsMacro UN
+Function ${UN}CheckUserInstallRights
   Push $0
   Push $1
   ClearErrors
@@ -941,41 +941,9 @@
     Exch
     Pop $0
 FunctionEnd
-
-Function un.CheckUserInstallRights
-  Push $0
-  Push $1
-  ClearErrors
-  UserInfo::GetName
-  IfErrors Win9x
-  Pop $0
-  UserInfo::GetAccountType
-  Pop $1
-
-  StrCmp $1 "Admin" 0 +3
-    StrCpy $1 "HKLM"
-    Goto done
-  StrCmp $1 "Power" 0 +3
-    StrCpy $1 "HKLM"
-    Goto done
-  StrCmp $1 "User" 0 +3
-    StrCpy $1 "HKCU"
-    Goto done
-  StrCmp $1 "Guest" 0 +3
-    StrCpy $1 "NONE"
-    Goto done
-  ; Unknown error
-  StrCpy $1 "NONE"
-  Goto done
-
-  Win9x:
-    StrCpy $1 "HKLM"
-
-  done:
-    Exch $1
-    Exch
-    Pop $0
-FunctionEnd
+!macroend
+!insertmacro CheckUserInstallRightsMacro ""
+!insertmacro CheckUserInstallRightsMacro "un."
 
 ;
 ; Usage:
@@ -1230,7 +1198,9 @@
   Pop $3
 FunctionEnd
 
-Function RunCheck
+
+!macro RunCheckMacro UN
+Function ${UN}RunCheck
   Push $R0
   System::Call 'kernel32::OpenMutex(i 2031617, b 0, t "gaim_is_running") i .R0'
   IntCmp $R0 0 done
@@ -1239,16 +1209,9 @@
   done:
   Pop $R0
 FunctionEnd
-
-Function un.RunCheck
-  Push $R0
-  System::Call 'kernel32::OpenMutex(i 2031617, b 0, t "gaim_is_running") i .R0'
-  IntCmp $R0 0 done
-  MessageBox MB_OK|MB_ICONEXCLAMATION $(GAIM_IS_RUNNING) IDOK
-    Abort
-  done:
-  Pop $R0
-FunctionEnd
+!macroend
+!insertmacro RunCheckMacro ""
+!insertmacro RunCheckMacro "un."
 
 Function .onInit
   Push $R0