Added support for /Force to uninstaller. Required some tweaks for the 'parameters.nsh' include file.
This commit is contained in:
parent
af7bb2026a
commit
9d652fb2e0
@ -1,4 +1,11 @@
|
|||||||
Function StrStr
|
!ifndef __PREFIX__
|
||||||
|
!define __PREFIX__ ""
|
||||||
|
!endif
|
||||||
|
|
||||||
|
|
||||||
|
; StrStr
|
||||||
|
|
||||||
|
Function ${__PREFIX__}StrStr
|
||||||
/*After this point:
|
/*After this point:
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
$R0 = SubString (input)
|
$R0 = SubString (input)
|
||||||
@ -54,13 +61,12 @@ Function StrStr
|
|||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; GetParameters
|
; GetParameters
|
||||||
; input, none
|
; input, none
|
||||||
; output, top of stack (replaces, with e.g. whatever)
|
; output, top of stack (replaces, with e.g. whatever)
|
||||||
; modifies no other variables.
|
; modifies no other variables.
|
||||||
|
|
||||||
Function GetParameters
|
Function ${__PREFIX__}GetParameters
|
||||||
Push $R0
|
Push $R0
|
||||||
Push $R1
|
Push $R1
|
||||||
Push $R2
|
Push $R2
|
||||||
@ -96,7 +102,6 @@ Function GetParameters
|
|||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; GetParameterValue
|
; GetParameterValue
|
||||||
; Chris Morgan<cmorgan@alum.wpi.edu> 5/10/2004
|
; Chris Morgan<cmorgan@alum.wpi.edu> 5/10/2004
|
||||||
; -Updated 4/7/2005 to add support for retrieving a command line switch
|
; -Updated 4/7/2005 to add support for retrieving a command line switch
|
||||||
@ -127,7 +132,7 @@ FunctionEnd
|
|||||||
;$R4 - result from StrStr calls
|
;$R4 - result from StrStr calls
|
||||||
;$R5 - search for ' ' or '"'
|
;$R5 - search for ' ' or '"'
|
||||||
|
|
||||||
Function GetParameterValue
|
Function ${__PREFIX__}GetParameterValue
|
||||||
Exch $R0 ; get the top of the stack(default parameter) into R0
|
Exch $R0 ; get the top of the stack(default parameter) into R0
|
||||||
Exch ; exchange the top of the stack(default) with
|
Exch ; exchange the top of the stack(default) with
|
||||||
; the second in the stack(parameter to search for)
|
; the second in the stack(parameter to search for)
|
||||||
@ -141,14 +146,14 @@ Function GetParameterValue
|
|||||||
|
|
||||||
Strlen $R2 $R1+2 ; store the length of the search string into R2
|
Strlen $R2 $R1+2 ; store the length of the search string into R2
|
||||||
|
|
||||||
Call GetParameters ; get the command line parameters
|
Call ${__PREFIX__}GetParameters ; get the command line parameters
|
||||||
Pop $R3 ; store the command line string in R3
|
Pop $R3 ; store the command line string in R3
|
||||||
|
|
||||||
# search for quoted search string
|
# search for quoted search string
|
||||||
StrCpy $R5 '"' ; later on we want to search for a open quote
|
StrCpy $R5 '"' ; later on we want to search for a open quote
|
||||||
Push $R3 ; push the 'search in' string onto the stack
|
Push $R3 ; push the 'search in' string onto the stack
|
||||||
Push '"/$R1=' ; push the 'search for'
|
Push '"/$R1=' ; push the 'search for'
|
||||||
Call StrStr ; search for the quoted parameter value
|
Call ${__PREFIX__}StrStr ; search for the quoted parameter value
|
||||||
Pop $R4
|
Pop $R4
|
||||||
StrCpy $R4 $R4 "" 1 ; skip over open quote character, "" means no maxlen
|
StrCpy $R4 $R4 "" 1 ; skip over open quote character, "" means no maxlen
|
||||||
StrCmp $R4 "" "" next ; if we didn't find an empty string go to next
|
StrCmp $R4 "" "" next ; if we didn't find an empty string go to next
|
||||||
@ -159,7 +164,7 @@ Function GetParameterValue
|
|||||||
; look for a close quote '"'
|
; look for a close quote '"'
|
||||||
Push $R3 ; push the command line back on the stack for searching
|
Push $R3 ; push the command line back on the stack for searching
|
||||||
Push '/$R1=' ; search for the non-quoted search string
|
Push '/$R1=' ; search for the non-quoted search string
|
||||||
Call StrStr
|
Call ${__PREFIX__}StrStr
|
||||||
Pop $R4
|
Pop $R4
|
||||||
|
|
||||||
; $R4 now contains the parameter string starting at the search string,
|
; $R4 now contains the parameter string starting at the search string,
|
||||||
@ -178,7 +183,7 @@ next:
|
|||||||
; ending ", as in '"/output=somevalue"'
|
; ending ", as in '"/output=somevalue"'
|
||||||
; if we found '/output' then we want to find the first
|
; if we found '/output' then we want to find the first
|
||||||
; space after '/output=somevalue'
|
; space after '/output=somevalue'
|
||||||
Call StrStr ; search for the next parameter
|
Call ${__PREFIX__}StrStr ; search for the next parameter
|
||||||
Pop $R4
|
Pop $R4
|
||||||
StrCmp $R4 "" done ; if 'somevalue' is missing, we are done
|
StrCmp $R4 "" done ; if 'somevalue' is missing, we are done
|
||||||
StrLen $R4 $R4 ; get the length of 'somevalue' so we can copy this
|
StrLen $R4 $R4 ; get the length of 'somevalue' so we can copy this
|
||||||
@ -192,7 +197,7 @@ next:
|
|||||||
check_for_switch:
|
check_for_switch:
|
||||||
Push $R3 ; push the command line back on the stack for searching
|
Push $R3 ; push the command line back on the stack for searching
|
||||||
Push '/$R1' ; search for the non-quoted search string
|
Push '/$R1' ; search for the non-quoted search string
|
||||||
Call StrStr
|
Call ${__PREFIX__}StrStr
|
||||||
Pop $R4
|
Pop $R4
|
||||||
StrCmp $R4 "" done ; if we didn't find anything then use the default
|
StrCmp $R4 "" done ; if we didn't find anything then use the default
|
||||||
StrCpy $R0 "" ; otherwise copy in an empty string since we found the
|
StrCpy $R0 "" ; otherwise copy in an empty string since we found the
|
||||||
@ -207,9 +212,24 @@ done:
|
|||||||
Exch $R0 ; put the value in $R0 at the top of the stack
|
Exch $R0 ; put the value in $R0 at the top of the stack
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
|
; Wrapper macros
|
||||||
|
|
||||||
|
!if "${__PREFIX__}" != "un."
|
||||||
!macro GetCommandlineParameter param default var
|
!macro GetCommandlineParameter param default var
|
||||||
Push "${param}" ; push the search string onto the stack
|
Push "${param}" ; push the search string onto the stack
|
||||||
Push "${default}" ; push a default value onto the stack
|
Push "${default}" ; push a default value onto the stack
|
||||||
Call GetParameterValue
|
Call GetParameterValue
|
||||||
Pop ${var}
|
Pop ${var}
|
||||||
!macroend
|
!macroend
|
||||||
|
!else
|
||||||
|
!macro un.GetCommandlineParameter param default var
|
||||||
|
Push "${param}" ; push the search string onto the stack
|
||||||
|
Push "${default}" ; push a default value onto the stack
|
||||||
|
Call un.GetParameterValue
|
||||||
|
Pop ${var}
|
||||||
|
!macroend
|
||||||
|
!endif
|
||||||
|
|
||||||
|
|
||||||
|
!undef __PREFIX__
|
||||||
|
@ -78,6 +78,10 @@
|
|||||||
!include `StdUtils.nsh`
|
!include `StdUtils.nsh`
|
||||||
!include `parameters.nsh`
|
!include `parameters.nsh`
|
||||||
|
|
||||||
|
;Uninstaller
|
||||||
|
!define __PREFIX__ "un."
|
||||||
|
!include `parameters.nsh`
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Installer Attributes
|
;Installer Attributes
|
||||||
@ -197,7 +201,9 @@ Page Custom LockedListShow
|
|||||||
;Uninstaller
|
;Uninstaller
|
||||||
!define MUI_WELCOMEPAGE_TITLE_3LINES
|
!define MUI_WELCOMEPAGE_TITLE_3LINES
|
||||||
!define MUI_FINISHPAGE_TITLE_3LINES
|
!define MUI_FINISHPAGE_TITLE_3LINES
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
|
||||||
!insertmacro MUI_UNPAGE_WELCOME
|
!insertmacro MUI_UNPAGE_WELCOME
|
||||||
|
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
|
||||||
!insertmacro MUI_UNPAGE_CONFIRM
|
!insertmacro MUI_UNPAGE_CONFIRM
|
||||||
UninstPage Custom un.LockedListShow
|
UninstPage Custom un.LockedListShow
|
||||||
!insertmacro MUI_UNPAGE_INSTFILES
|
!insertmacro MUI_UNPAGE_INSTFILES
|
||||||
@ -266,7 +272,10 @@ Function .onInit
|
|||||||
Quit
|
Quit
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
!insertmacro GetCommandlineParameter "Update" "?" $R0
|
||||||
|
${If} "$R0" == "?"
|
||||||
!insertmacro MUI_LANGDLL_DISPLAY
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
; --------
|
; --------
|
||||||
|
|
||||||
@ -310,7 +319,10 @@ Function un.onInit
|
|||||||
Quit
|
Quit
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
!insertmacro un.GetCommandlineParameter "Force" "?" $R0
|
||||||
|
${If} "$R0" == "?"
|
||||||
!insertmacro MUI_LANGDLL_DISPLAY
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
; --------
|
; --------
|
||||||
|
|
||||||
@ -324,7 +336,7 @@ FunctionEnd
|
|||||||
|
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;UAC initialization
|
;GUI initialization
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
Function MyGuiInit
|
Function MyGuiInit
|
||||||
@ -559,16 +571,20 @@ SectionEnd
|
|||||||
|
|
||||||
Function CheckForUpdate
|
Function CheckForUpdate
|
||||||
!insertmacro GetCommandlineParameter "Update" "?" $R0
|
!insertmacro GetCommandlineParameter "Update" "?" $R0
|
||||||
StrCmp $R0 "?" 0 EnableUpdateMode
|
${IfNotThen} "$R0" == "?" ${|} Goto EnableUpdateMode ${|}
|
||||||
|
|
||||||
StrCmp "$INSTDIR" "" 0 +2
|
${IfThen} "$INSTDIR" == "" ${|} Return ${|}
|
||||||
Return
|
${IfThen} "$INSTDIR" == "$EXEDIR" ${|} Return ${|}
|
||||||
IfFileExists "$INSTDIR\*.*" +2
|
${IfNotThen} ${FileExists} "$INSTDIR\LameXP.exe" ${|} Return ${|}
|
||||||
Return
|
|
||||||
StrCmp "$EXEDIR" "$INSTDIR" 0 +2
|
;StrCmp "$INSTDIR" "" 0 +2
|
||||||
Return
|
;Return
|
||||||
IfFileExists "$INSTDIR\LameXP.exe" +2
|
;IfFileExists "$INSTDIR\*.*" +2
|
||||||
Return
|
;Return
|
||||||
|
;StrCmp "$EXEDIR" "$INSTDIR" 0 +2
|
||||||
|
;Return
|
||||||
|
;IfFileExists "$INSTDIR\LameXP.exe" +2
|
||||||
|
;Return
|
||||||
|
|
||||||
EnableUpdateMode:
|
EnableUpdateMode:
|
||||||
|
|
||||||
@ -581,6 +597,11 @@ Function CheckForUpdate
|
|||||||
EnableWindow $R1 0
|
EnableWindow $R1 0
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
Function un.CheckForcedUninstall
|
||||||
|
!insertmacro un.GetCommandlineParameter "Force" "?" $R0
|
||||||
|
${IfNotThen} "$R0" == "?" ${|} Abort ${|}
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Check For Pre-Release
|
;Check For Pre-Release
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 3
|
#define VER_LAMEXP_MINOR_LO 3
|
||||||
#define VER_LAMEXP_TYPE Beta
|
#define VER_LAMEXP_TYPE Beta
|
||||||
#define VER_LAMEXP_PATCH 3
|
#define VER_LAMEXP_PATCH 3
|
||||||
#define VER_LAMEXP_BUILD 716
|
#define VER_LAMEXP_BUILD 717
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -935,7 +935,7 @@ void MainWindow::windowShown(void)
|
|||||||
QString uninstallerPath = uninstallerInfo.canonicalFilePath();
|
QString uninstallerPath = uninstallerInfo.canonicalFilePath();
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
HINSTANCE res = ShellExecuteW(this->winId(), L"open", QWCHAR(QDir::toNativeSeparators(uninstallerPath)), NULL, QWCHAR(QDir::toNativeSeparators(uninstallerDir)), SW_SHOWNORMAL);
|
HINSTANCE res = ShellExecuteW(this->winId(), L"open", QWCHAR(QDir::toNativeSeparators(uninstallerPath)), L"/Force", QWCHAR(QDir::toNativeSeparators(uninstallerDir)), SW_SHOWNORMAL);
|
||||||
if(reinterpret_cast<int>(res) > 32) break;
|
if(reinterpret_cast<int>(res) > 32) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user