Skip to content

Commit

Permalink
Initial commit to this repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jul 23, 2007
0 parents commit 3f89d56
Show file tree
Hide file tree
Showing 127 changed files with 14,438 additions and 0 deletions.
15 changes: 15 additions & 0 deletions BackupPersonal.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Function backupPersonal
IfFileExists "$whereprofiles\personal\personal.rc" 0 end

; We got here, that means there are old personal files
; that we maybe should back up...

MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON1 $(BACKUP_PERSONAL) IDNO end

CreateDirectory "$whereprofiles\personal\backup"
CopyFiles "$whereprofiles\personal\*" "$whereprofiles\personal\backup\"

MessageBox MB_OK $(BACKUP_DONE)

end:
FunctionEnd
564 changes: 564 additions & 0 deletions Evars.nsh

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions FinishPage.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
; Function SetupFinishPage
;
; This function gets called before the finish page is shown. It
; creates different controls on the finish page depending on
; whether the installer thinks a reboot is needed or not.

Function SetupFinishPage
IfRebootFlag reboot noreboot
noreboot:
; If we end up here the installer didn't think a reboot was
; necesary. No option to reboot will be created.

StrCmp $LogoffFlag "true" logoff nologoff

logoff:
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Settings" "NumFields" "4"

WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 3" "Text" "$(TEXT_LOGOFF)"

WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Type" "CheckBox"
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Flags" "Notify"
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Text" "$(FINISH_LOGOFF)"

GoTo donesetup

nologoff:
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Settings" "NumFields" "3"

GoTo donesetup

reboot:
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Settings" "NumFields" "8"
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Flags" "GROUP|Notify"
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 5" "Flags" "Notify"

donesetup:
FunctionEnd

; Function ValidateFinish
;
; This function gets called when the user has pressed any
; of the controls on the finishpage. Depending on what the
; user pressed different actions will be taken.
Function ValidateFinish
ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Settings" "State" ;What caused this function to be called?

StrCmp $0 0 finish ;The "Finish" button
Abort

finish:
; The user pressed the finish button. Now we need to act on the
; users selections.

IfRebootFlag 0 runpage

;The "Reboot now" radiobutton
ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 4" "State"
StrCmp $0 1 done 0
SetRebootFlag false ;The user wanted to manualy reboot later

GoTo done

runpage:
StrCmp $LogoffFlag "true" logoff done

logoff:
ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 4" "State"
StrCmp $0 1 0 done ;Check if the user wants to log off or not
ShutDown::LogOff

done:
FunctionEnd

Function ShowFinishPage

Push $0 ;hwnd

GetDlgItem $0 $MUI_HWND 1203
SetCtlColors $0 0x000000 0xFFFFFF

GetDlgItem $0 $MUI_HWND 1204
SetCtlColors $0 0x000000 0xFFFFFF

Pop $0

FunctionEnd
8 changes: 8 additions & 0 deletions FinishPageSettings.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
!define MUI_PAGE_CUSTOMFUNCTION_PRE SetupFinishPage
!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowFinishPage
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ValidateFinish
!define MUI_FINISHPAGE_TEXT_REBOOT "$(TEXT_REBOOT)"
!define MUI_FINISHPAGE_RUN ""
!define MUI_FINISHPAGE_RUN_TEXT $(RUN_LS)

!insertmacro MUI_PAGE_FINISH
50 changes: 50 additions & 0 deletions GetExecutablePath.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Function GetExecutablePath
exch $0 ; Execution string - Top element in stack is now what ever value $0 had before
push $R0
push $R1
push $R2

StrLen $R0 $0
IntCmp $R0 2 done done

StrCpy $R1 $0

StrCpy $R0 $0 1
StrCmp $R0 '"' 0 +4
push $0
Call GetInQuotes
pop $0

ExpandEnvStrings $0 $0

loop:
IfFileExists $0 done 0
${RIndexOf} $R0 $0 " " ;This will expand to 4 lines because of the macro
IntCmp $R0 -1 nofile nofile
StrCpy $0 $0 -$R0
GoTo loop
nofile:
StrCpy $0 $R1
StrCpy $R0 $0 "" -3
StrCmp $R0 " %1" 0 +3
StrCpy $0 $0 -3
GoTo done
StrCpy $R0 $0 "" -5
StrCmp $R0 ' "%1"' 0 done
StrCpy $0 $0 -5


done:
pop $R2
pop $R1
pop $R0
exch $0
FunctionEnd

!macro ExePath Var Str
Push "${Str}"
Call GetExecutablePath
Pop "${Var}"
!macroend

!define ExePath "!insertmacro ExePath"
41 changes: 41 additions & 0 deletions GetInQuotes.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
; Push 'a string containing "quotes"!'
; Call GetInQuotes
; Pop $R0 ; = quotes
;
; If no paired quotes are found, the function will return an empty string.
;
; Written by Stu

Function GetInQuotes
Exch $R0
Push $R1
Push $R2
Push $R3

StrCpy $R2 -1
IntOp $R2 $R2 + 1
StrCpy $R3 $R0 1 $R2
StrCmp $R3 "" 0 +3
StrCpy $R0 ""
Goto Done
StrCmp $R3 '"' 0 -5

IntOp $R2 $R2 + 1
StrCpy $R0 $R0 "" $R2

StrCpy $R2 0
IntOp $R2 $R2 + 1
StrCpy $R3 $R0 1 $R2
StrCmp $R3 "" 0 +3
StrCpy $R0 ""
Goto Done
StrCmp $R3 '"' 0 -5

StrCpy $R0 $R0 $R2
Done:

Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
111 changes: 111 additions & 0 deletions GetWindowsVersion.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
; GetWindowsVersion
;
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
; Updated by Joost Verburg
; Modified by Tobbe
;
; Returns on top of stack
;
; Windows Version (9x, NT, or 2k (2k, XP, or 2k3))
; or
; '' (Unknown Windows Version)
;
; Usage:
; Call GetWindowsVersion
; Pop $R0
; ; at this point $R0 is "NT" or whatnot

Function GetWindowsVersion

Push $R0
Push $R1

ClearErrors

ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion

IfErrors 0 lbl_winnt

; we are not NT
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber

StrCpy $R1 $R0 1
StrCmp $R1 '4' 0 lbl_error

StrCpy $R0 '9x'
Goto lbl_done

lbl_winnt:

StrCpy $R1 $R0 1

StrCmp $R1 '3' lbl_winnt_x
StrCmp $R1 '4' lbl_winnt_x

Goto lbl_winnt_2k

lbl_winnt_x:
StrCpy $R0 "NT"
Goto lbl_done

lbl_winnt_2k:
Strcpy $R0 '2k'
Goto lbl_done

lbl_error:
Strcpy $R0 ''

lbl_done:

Pop $R1
Exch $R0

FunctionEnd

;Same as GetWindowsVersion, just with a different name for the uninstaller
Function un.GetWindowsVersion

Push $R0
Push $R1

ClearErrors

ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion

IfErrors 0 lbl_winnt

; we are not NT
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber

StrCpy $R1 $R0 1
StrCmp $R1 '4' 0 lbl_error

StrCpy $R0 '9x'
Goto lbl_done

lbl_winnt:

StrCpy $R1 $R0 1

StrCmp $R1 '3' lbl_winnt_x
StrCmp $R1 '4' lbl_winnt_x

Goto lbl_winnt_2k

lbl_winnt_x:
StrCpy $R0 "NT"
Goto lbl_done

lbl_winnt_2k:
Strcpy $R0 '2k'
Goto lbl_done

lbl_error:
Strcpy $R0 ''

lbl_done:

Pop $R1
Exch $R0

FunctionEnd
Loading

0 comments on commit 3f89d56

Please sign in to comment.