annotate src/win32/nsis/AddToPath.nsi @ 5395:e29ae53b744a

[gaim-migrate @ 5771] Nice bmp for installer intro page committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Fri, 16 May 2003 13:35:04 +0000
parents 0cf56ff1b0d6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5331
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
1 !verbose 3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
2 !include "WinMessages.NSH"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
3 !verbose 4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
5 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
6 ; AddToPath - Adds the given dir to the search path.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
7 ; Input - head of the stack
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
8 ; Note - Win9x systems requires reboot
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
9 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
10 Function AddToPath
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
11 Exch $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
12 Push $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
13
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
14 Call IsNT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
15 Pop $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
16 StrCmp $1 1 AddToPath_NT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
17 ; Not on NT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
18 StrCpy $1 $WINDIR 2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
19 FileOpen $1 "$1\autoexec.bat" a
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
20 FileSeek $1 0 END
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
21 GetFullPathName /SHORT $0 $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
22 FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
23 FileClose $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24 Goto AddToPath_done
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
25
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
26 AddToPath_NT:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
27 ReadRegStr $1 HKCU "Environment" "PATH"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
28 StrCmp $1 "" AddToPath_NTdoIt
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
29 StrCpy $0 "$1;$0"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
30 Goto AddToPath_NTdoIt
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
31 AddToPath_NTdoIt:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
32 WriteRegStr HKCU "Environment" "PATH" $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
33 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
34
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
35 AddToPath_done:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
36 Pop $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
37 Pop $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
38 FunctionEnd
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
39
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
41 ; RemoveFromPath - Remove a given dir from the path
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
42 ; Input: head of the stack
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
43 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44 Function un.RemoveFromPath
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 Exch $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
46 Push $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47 Push $2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 Push $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49 Push $4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
50
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
51 Call un.IsNT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52 Pop $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
53 StrCmp $1 1 unRemoveFromPath_NT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54 ; Not on NT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55 StrCpy $1 $WINDIR 2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
56 FileOpen $1 "$1\autoexec.bat" r
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
57 GetTempFileName $4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
58 FileOpen $2 $4 w
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59 GetFullPathName /SHORT $0 $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
60 StrCpy $0 "SET PATH=%PATH%;$0"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61 SetRebootFlag true
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
62 Goto unRemoveFromPath_dosLoop
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
63
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64 unRemoveFromPath_dosLoop:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
65 FileRead $1 $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
66 StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
67 StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
68 StrCmp $3 "$0" unRemoveFromPath_dosLoop
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
69 StrCmp $3 "" unRemoveFromPath_dosLoopEnd
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
70 FileWrite $2 $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
71 Goto unRemoveFromPath_dosLoop
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
72
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
73 unRemoveFromPath_dosLoopEnd:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
74 FileClose $2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
75 FileClose $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
76 StrCpy $1 $WINDIR 2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
77 Delete "$1\autoexec.bat"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
78 CopyFiles /SILENT $4 "$1\autoexec.bat"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
79 Delete $4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
80 Goto unRemoveFromPath_done
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82 unRemoveFromPath_NT:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 StrLen $2 $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84 ReadRegStr $1 HKCU "Environment" "PATH"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
85 Push $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
86 Push $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
87 Call un.StrStr ; Find $0 in $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
88 Pop $0 ; pos of our dir
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
89 IntCmp $0 -1 unRemoveFromPath_done
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
90 ; else, it is in path
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
91 StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
92 IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
93 IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
94 StrLen $0 $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
95 StrCpy $1 $1 $0 $2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
96 StrCpy $3 "$3$1"
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
97
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
98 WriteRegStr HKCU "Environment" "PATH" $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
99 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
100
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
101 unRemoveFromPath_done:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
102 Pop $4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
103 Pop $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
104 Pop $2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
105 Pop $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
106 Pop $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
107 FunctionEnd
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
108
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
109 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
110 ; IsNT - Returns 1 if the current system is NT, 0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
111 ; otherwise.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
112 ; Output: head of the stack
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
113 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
114 Function IsNT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
115 Push $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
116 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
117 StrCmp $0 "" 0 IsNT_yes
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
118 ; we are not NT.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
119 Pop $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
120 Push 0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
121 Return
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
122
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
123 IsNT_yes:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
124 ; NT!!!
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
125 Pop $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
126 Push 1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
127 FunctionEnd
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
128
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
129 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
130 ; Uninstall sutff
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
131 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
132
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
133
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
134 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
135 ; StrStr - Finds a given string in another given string.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
136 ; Returns -1 if not found and the pos if found.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
137 ; Input: head of the stack - string to find
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
138 ; second in the stack - string to find in
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
139 ; Output: head of the stack
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
140 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
141 Function un.StrStr
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
142 Push $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
143 Exch
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
144 Pop $0 ; $0 now have the string to find
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
145 Push $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
146 Exch 2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
147 Pop $1 ; $1 now have the string to find in
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
148 Exch
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
149 Push $2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
150 Push $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
151 Push $4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
152 Push $5
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
153
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
154 StrCpy $2 -1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
155 StrLen $3 $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
156 StrLen $4 $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
157 IntOp $4 $4 - $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
158
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
159 unStrStr_loop:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
160 IntOp $2 $2 + 1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
161 IntCmp $2 $4 0 0 unStrStrReturn_notFound
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
162 StrCpy $5 $1 $3 $2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
163 StrCmp $5 $0 unStrStr_done unStrStr_loop
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
164
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
165 unStrStrReturn_notFound:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
166 StrCpy $2 -1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
167
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
168 unStrStr_done:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
169 Pop $5
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
170 Pop $4
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
171 Pop $3
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
172 Exch $2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
173 Exch 2
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
174 Pop $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
175 Pop $1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
176 FunctionEnd
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
177
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
178 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
179 ; IsNT - Returns 1 if the current system is NT, 0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
180 ; otherwise.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
181 ; Output: head of the stack
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
182 ;====================================================
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
183 Function un.IsNT
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
184 Push $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
185 ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
186 StrCmp $0 "" 0 unIsNT_yes
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
187 ; we are not NT.
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
188 Pop $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
189 Push 0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
190 Return
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
191
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
192 unIsNT_yes:
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
193 ; NT!!!
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
194 Pop $0
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
195 Push 1
0cf56ff1b0d6 [gaim-migrate @ 5704]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
196 FunctionEnd