remove functions which are already included in a header file
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5470 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
99bd07ffb6
commit
730807022b
1 changed files with 161 additions and 416 deletions
|
@ -1,260 +1,5 @@
|
|||
\A{usefulfunctions} Useful Scripts
|
||||
|
||||
\H{getparent} Get parent directory
|
||||
|
||||
\c ; GetParent
|
||||
\c ; input, top of stack (e.g. C:\Program Files\Poop)
|
||||
\c ; output, top of stack (replaces, with e.g. C:\Program Files)
|
||||
\c ; modifies no other variables.
|
||||
\c ;
|
||||
\c ; Usage:
|
||||
\c ; Push "C:\Program Files\Directory\Whatever"
|
||||
\c ; Call GetParent
|
||||
\c ; Pop $R0
|
||||
\c ; ; at this point $R0 will equal "C:\Program Files\Directory"
|
||||
\c
|
||||
\c Function GetParent
|
||||
\c
|
||||
\c Exch $R0
|
||||
\c Push $R1
|
||||
\c Push $R2
|
||||
\c Push $R3
|
||||
\c
|
||||
\c StrCpy $R1 0
|
||||
\c StrLen $R2 $R0
|
||||
\c
|
||||
\c loop:
|
||||
\c IntOp $R1 $R1 + 1
|
||||
\c IntCmp $R1 $R2 get 0 get
|
||||
\c StrCpy $R3 $R0 1 -$R1
|
||||
\c StrCmp $R3 "\" get
|
||||
\c Goto loop
|
||||
\c
|
||||
\c get:
|
||||
\c StrCpy $R0 $R0 -$R1
|
||||
\c
|
||||
\c Pop $R3
|
||||
\c Pop $R2
|
||||
\c Pop $R1
|
||||
\c Exch $R0
|
||||
\c
|
||||
\c FunctionEnd
|
||||
|
||||
\H{trimnewlines} Trim newlines
|
||||
|
||||
\c ; TrimNewlines
|
||||
\c ; input, top of stack (e.g. whatever$\r$\n)
|
||||
\c ; output, top of stack (replaces, with e.g. whatever)
|
||||
\c ; modifies no other variables.
|
||||
\c
|
||||
\c Function TrimNewlines
|
||||
\c Exch $R0
|
||||
\c Push $R1
|
||||
\c Push $R2
|
||||
\c StrCpy $R1 0
|
||||
\c
|
||||
\c loop:
|
||||
\c IntOp $R1 $R1 - 1
|
||||
\c StrCpy $R2 $R0 1 $R1
|
||||
\c StrCmp $R2 "$\r" loop
|
||||
\c StrCmp $R2 "$\n" loop
|
||||
\c IntOp $R1 $R1 + 1
|
||||
\c IntCmp $R1 0 no_trim_needed
|
||||
\c StrCpy $R0 $R0 $R1
|
||||
\c
|
||||
\c no_trim_needed:
|
||||
\c Pop $R2
|
||||
\c Pop $R1
|
||||
\c Exch $R0
|
||||
\c FunctionEnd
|
||||
|
||||
|
||||
\H{getparameters} Get command line parameters
|
||||
|
||||
\c ; GetParameters
|
||||
\c ; input, none
|
||||
\c ; output, top of stack (replaces, with e.g. whatever)
|
||||
\c ; modifies no other variables.
|
||||
\c
|
||||
\c Function GetParameters
|
||||
\c
|
||||
\c Push $R0
|
||||
\c Push $R1
|
||||
\c Push $R2
|
||||
\c Push $R3
|
||||
\c
|
||||
\c StrCpy $R2 1
|
||||
\c StrLen $R3 $CMDLINE
|
||||
\c
|
||||
\c ;Check for quote or space
|
||||
\c StrCpy $R0 $CMDLINE $R2
|
||||
\c StrCmp $R0 '"' 0 +3
|
||||
\c StrCpy $R1 '"'
|
||||
\c Goto loop
|
||||
\c StrCpy $R1 " "
|
||||
\c
|
||||
\c loop:
|
||||
\c IntOp $R2 $R2 + 1
|
||||
\c StrCpy $R0 $CMDLINE 1 $R2
|
||||
\c StrCmp $R0 $R1 get
|
||||
\c StrCmp $R2 $R3 get
|
||||
\c Goto loop
|
||||
\c
|
||||
\c get:
|
||||
\c IntOp $R2 $R2 + 1
|
||||
\c StrCpy $R0 $CMDLINE 1 $R2
|
||||
\c StrCmp $R0 " " get
|
||||
\c StrCpy $R0 $CMDLINE "" $R2
|
||||
\c
|
||||
\c Pop $R3
|
||||
\c Pop $R2
|
||||
\c Pop $R1
|
||||
\c Exch $R0
|
||||
\c
|
||||
\c FunctionEnd
|
||||
|
||||
\H{strstr} Search in a string
|
||||
|
||||
\c ; StrStr
|
||||
\c ; input, top of stack = string to search for
|
||||
\c ; top of stack-1 = string to search in
|
||||
\c ; output, top of stack (replaces with the portion of the string remaining)
|
||||
\c ; modifies no other variables.
|
||||
\c ;
|
||||
\c ; Usage:
|
||||
\c ; Push "this is a long ass string"
|
||||
\c ; Push "ass"
|
||||
\c ; Call StrStr
|
||||
\c ; Pop $R0
|
||||
\c ; ($R0 at this point is "ass string")
|
||||
\c
|
||||
\c Function StrStr
|
||||
\c Exch $R1 ; st=haystack,old$R1, $R1=needle
|
||||
\c Exch ; st=old$R1,haystack
|
||||
\c Exch $R2 ; st=old$R1,old$R2, $R2=haystack
|
||||
\c Push $R3
|
||||
\c Push $R4
|
||||
\c Push $R5
|
||||
\c StrLen $R3 $R1
|
||||
\c StrCpy $R4 0
|
||||
\c ; $R1=needle
|
||||
\c ; $R2=haystack
|
||||
\c ; $R3=len(needle)
|
||||
\c ; $R4=cnt
|
||||
\c ; $R5=tmp
|
||||
\c loop:
|
||||
\c StrCpy $R5 $R2 $R3 $R4
|
||||
\c StrCmp $R5 $R1 done
|
||||
\c StrCmp $R5 "" done
|
||||
\c IntOp $R4 $R4 + 1
|
||||
\c Goto loop
|
||||
\c done:
|
||||
\c StrCpy $R1 $R2 "" $R4
|
||||
\c Pop $R5
|
||||
\c Pop $R4
|
||||
\c Pop $R3
|
||||
\c Pop $R2
|
||||
\c Exch $R1
|
||||
\c FunctionEnd
|
||||
|
||||
\H{getwindowsversion} Get Windows version
|
||||
|
||||
\c ; GetWindowsVersion
|
||||
\c ;
|
||||
\c ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
|
||||
\c ; Updated by Joost Verburg
|
||||
\c ;
|
||||
\c ; Returns on top of stack
|
||||
\c ;
|
||||
\c ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista)
|
||||
\c ; or
|
||||
\c ; '' (Unknown Windows Version)
|
||||
\c ;
|
||||
\c ; Usage:
|
||||
\c ; Call GetWindowsVersion
|
||||
\c ; Pop $R0
|
||||
\c ; ; at this point $R0 is "NT 4.0" or whatnot
|
||||
\c
|
||||
\c Function GetWindowsVersion
|
||||
\c
|
||||
\c Push $R0
|
||||
\c Push $R1
|
||||
\c
|
||||
\c ClearErrors
|
||||
\c
|
||||
\c ReadRegStr $R0 HKLM \
|
||||
\c "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
|
||||
\c
|
||||
\c IfErrors 0 lbl_winnt
|
||||
\c
|
||||
\c ; we are not NT
|
||||
\c ReadRegStr $R0 HKLM \
|
||||
\c "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
|
||||
\c
|
||||
\c StrCpy $R1 $R0 1
|
||||
\c StrCmp $R1 '4' 0 lbl_error
|
||||
\c
|
||||
\c StrCpy $R1 $R0 3
|
||||
\c
|
||||
\c StrCmp $R1 '4.0' lbl_win32_95
|
||||
\c StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
|
||||
\c
|
||||
\c lbl_win32_95:
|
||||
\c StrCpy $R0 '95'
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_win32_98:
|
||||
\c StrCpy $R0 '98'
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_win32_ME:
|
||||
\c StrCpy $R0 'ME'
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_winnt:
|
||||
\c
|
||||
\c StrCpy $R1 $R0 1
|
||||
\c
|
||||
\c StrCmp $R1 '3' lbl_winnt_x
|
||||
\c StrCmp $R1 '4' lbl_winnt_x
|
||||
\c
|
||||
\c StrCpy $R1 $R0 3
|
||||
\c
|
||||
\c StrCmp $R1 '5.0' lbl_winnt_2000
|
||||
\c StrCmp $R1 '5.1' lbl_winnt_XP
|
||||
\c StrCmp $R1 '5.2' lbl_winnt_2003
|
||||
\c StrCmp $R1 '6.0' lbl_winnt_vista lbl_error
|
||||
\c
|
||||
\c lbl_winnt_x:
|
||||
\c StrCpy $R0 "NT $R0" 6
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_winnt_2000:
|
||||
\c Strcpy $R0 '2000'
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_winnt_XP:
|
||||
\c Strcpy $R0 'XP'
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_winnt_2003:
|
||||
\c Strcpy $R0 '2003'
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_winnt_vista:
|
||||
\c Strcpy $R0 'Vista'
|
||||
\c Goto lbl_done
|
||||
\c
|
||||
\c lbl_error:
|
||||
\c Strcpy $R0 ''
|
||||
\c lbl_done:
|
||||
\c
|
||||
\c Pop $R1
|
||||
\c Exch $R0
|
||||
\c
|
||||
\c FunctionEnd
|
||||
|
||||
|
||||
\H{getieversion} Get Internet Explorer version
|
||||
|
||||
\c ; GetIEVersion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue