Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2551 dpurdie 1
Function GetDriverName
2
	Push $R1   
3
		ReadRegStr $R1 HKLM "SOFTWARE\ERG Transit Systems\GUA" DriverName			
4
	Exch $R1
5
FunctionEnd
6
 
7
Function GetDriversODBC
8
   Push $R1
9
   StrCpy $0 0
10
   loop:
11
		;lecture de la $0 eme valeur
12
		EnumRegValue $1 HKLM "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" $0        	
13
		StrCmp $1 "" done
14
 
15
		; on concatene | nompilote
16
		StrCmp $R1 "" +2
17
		StrCpy $R1 "$R1|"
18
		StrCpy $R1 "$R1$1"
19
 
20
		; on passe a l'indice suivant
21
		IntOp $0 $0 + 1
22
		Goto loop
23
	done:
24
	;MessageBox MB_OK|MB_ICONQUESTION "ODBC drivers : $R1"
25
	Exch $R1
26
FunctionEnd
27
 
28
; Trim
29
;   Removes leading & trailing whitespace from a string
30
; Usage:
31
;   Push 
32
;   Call Trim
33
;   Pop 
34
Function Trim
35
	Exch $R1 ; Original string
36
	Push $R2
37
 
38
Loop:
39
	StrCpy $R2 "$R1" 1
40
	StrCmp "$R2" " " TrimLeft
41
	StrCmp "$R2" "$\r" TrimLeft
42
	StrCmp "$R2" "$\n" TrimLeft
43
	StrCmp "$R2" "$\t" TrimLeft
44
	GoTo Loop2
45
TrimLeft:	
46
	StrCpy $R1 "$R1" "" 1
47
	Goto Loop
48
 
49
Loop2:
50
	StrCpy $R2 "$R1" 1 -1
51
	StrCmp "$R2" " " TrimRight
52
	StrCmp "$R2" "$\r" TrimRight
53
	StrCmp "$R2" "$\n" TrimRight
54
	StrCmp "$R2" "$\t" TrimRight
55
	GoTo Done
56
TrimRight:	
57
	StrCpy $R1 "$R1" -1
58
	Goto Loop2
59
 
60
Done:
61
	Pop $R2
62
	Exch $R1
63
FunctionEnd
64
 
65
;
66
; Gets the name of the default Oracle Home path in 64 bit env
67
;
68
; Usage:
69
;
70
;    Call GetOracleDefaultHomePath64
71
;    Pop $0
72
;
73
Function GetOracleDefaultHomePath64
74
  Push $R1
75
  Push $R2
76
	; parcourir la cle oracle a la recherche de KEY_xxxxx
77
   StrCpy $0 0
78
loop:
79
	;lecture de la $0 eme valeur
80
	EnumRegKey $1 HKLM "SOFTWARE\Wow6432Node\ORACLE" $0        	
81
	StrCmp $1 "" bad_home
82
 
83
	; on concatene | nompilote
84
	StrCpy $R1 "SOFTWARE\Wow6432Node\ORACLE\$1"
85
	ReadRegStr $R1 HKLM  $R1 "ORACLE_HOME"
86
	StrCmp $R1 "" +2
87
	Goto done
88
	; on passe a l'indice suivant
89
	IntOp $0 $0 + 1
90
	Goto loop
91
 
92
bad_home:
93
  StrCpy $R1 ""
94
 
95
done:
96
  Pop $R2
97
  Exch $R1
98
FunctionEnd
99
 
100
;
101
; Gets the name of the default Oracle Home path
102
;
103
; Usage:
104
;
105
;    Call GetOracleDefaultHomePath
106
;    Pop $0
107
;
108
Function GetOracleDefaultHomePath
109
  Push $R1
110
  Push $R2
111
;Wow6432Node 
112
  ; Get the name of the default home
113
  ReadRegStr $R1 HKLM "SOFTWARE\ORACLE\OracleMTSRecoveryService\Setup\Current Version" "HOME"
114
  ReadRegStr $R1 HKLM  $R1 "ORACLE_HOME"
115
 
116
  StrCmp $R1 "" GetBis
117
;VerifHome:
118
  IfFileExists $R1 0 bad_home
119
  Goto done
120
GetBis:
121
	; parcourir la cle oracle a la recherche de KEY_xxxxx
122
   StrCpy $0 0
123
loop:
124
	;lecture de la $0 eme valeur
125
	EnumRegKey $1 HKLM "SOFTWARE\ORACLE" $0        	
126
	StrCmp $1 "" test64
127
 
128
	; on concatene | nompilote
129
	StrCpy $R1 "SOFTWARE\ORACLE\$1"
130
	;MessageBox MB_OK|MB_ICONQUESTION "ORACLE : $R1"
131
	ReadRegStr $R1 HKLM  $R1 "ORACLE_HOME"
132
	;MessageBox MB_OK|MB_ICONQUESTION "ORACLE : $R1"
133
	StrCmp $R1 "" +2
134
	Goto done
135
	; on passe a l'indice suivant
136
	IntOp $0 $0 + 1
137
	Goto loop
138
test64:
139
	Call GetOracleDefaultHomePath64
140
	Pop $R1
141
	StrCmp $R1 "" bad_home
142
	Goto done
143
bad_home:
144
  StrCpy $R1 ""
145
 
146
done:
147
  Pop $R2
148
  Exch $R1
149
FunctionEnd
150
 
151
;
152
; Returns the list of Oracle TNS Connection Names separated by the 
153
; pipe ("|") symbol, suitable for setting the ListItems attribute 
154
; in an InstallOptions DropList.
155
;
156
; Requires: GetDefaultOracleHomePath
157
; Requires: Trim
158
;
159
; Usage:
160
;
161
;    Call GetOracleConnections
162
;    Pop $0
163
;
164
Function GetOracleConnections
165
    ClearErrors
166
    Push $R1 ;The connection list
167
    Push $R2 ;Line read from tnsnames.ora
168
    Push $R3 ;File handle
169
    Push $R4 ;Flag indicating whether connection name has been captured
170
    Push $R5 ;Parentheses count
171
    Push $R6 ;Current connection name
172
    Push $R7 ;Character being currently processed
173
    Push $R8 ;Temp var
174
 
175
    StrCpy $R1 ""
176
    Call GetOracleDefaultHomePath
177
    Pop $R2
178
    StrCmp $R2 "" done
179
 
180
    ; The path of the TNS names file
181
    StrCpy $R2 "$R2\network\admin\tnsnames.ora"
182
 
183
    ; Open the TNS names file
184
    StrCpy $R3 ""
185
    FileOpen $R3 $R2 "r"
186
    StrCmp $R3 "" fileerror
187
    ClearErrors
188
    StrCpy $R1 ""
189
reset:
190
    ; Reset variables
191
    StrCpy $R4 "0"
192
    StrCpy $R5 "0"
193
    StrCpy $R6 ""
194
read:
195
    ; Read a line from the file
196
    FileRead $R3 $R2
197
    StrCmp $R2 "" 0 loop
198
    IfErrors closefile read
199
 
200
    ; Loop through the characters in the line just read
201
loop:
202
    StrCpy $R7 $R2 1
203
    StrCmp $R7 "" read
204
    StrCpy $R2 $R2 "" 1
205
    StrCmp $R7 "#" comment
206
    StrCmp $R7 " " whitespace
207
    StrCmp $R7 "	" whitespace
208
    StrCmp $R7 "$\t" whitespace
209
    StrCmp $R7 "$\r" whitespace
210
    StrCmp $R7 "$\n" whitespace
211
    StrCmp $R7 "(" openparen
212
    StrCmp $R7 ")" closeparen
213
    StrCmp $R7 "," add
214
    StrCmp $R7 "=" equal
215
    StrCmp $R4 "1" loop
216
append:
217
    StrCmp $R6 "" blank
218
    StrCpy $R8 $R6 1 -1
219
    StrCmp $R8 " " syntaxerror
220
    StrCmp $R8 "    " syntaxerror
221
    StrCmp $R8 "$\r" syntaxerror
222
    StrCmp $R8 "$\n" syntaxerror
223
blank:
224
    StrCpy $R6 "$R6$R7"
225
    GoTo loop
226
comment:
227
    StrCmp $R6 "" read
228
    StrCmp $R4 "1" read syntaxerror
229
whitespace:
230
    StrCmp $R6 "" loop
231
    StrCmp $R4 "1" loop append
232
equal:
233
    StrCmp $R4 "1" loop
234
    StrCpy $R4 "1"
235
    GoTo loop
236
openparen:
237
    StrCmp $R4 "1" 0 syntaxerror
238
    IntOp $R5 $R5 + 1
239
    GoTo loop
240
closeparen:
241
    StrCmp $R4 "1" 0 syntaxerror
242
    IntOp $R5 $R5 - 1
243
    IntCmp $R5 0 0 syntaxerror loop
244
    Push $R1
245
    Call Trim
246
    Pop $R1
247
    StrCmp $R1 "" +2
248
    StrCpy $R1 "$R1|"
249
    StrCpy $R1 "$R1$R6"
250
    GoTo reset
251
add:
252
 	StrCpy $R1 "$R1|"
253
   	StrCpy $R1 "$R1$R6"
254
    StrCpy $R4 "0"
255
    StrCpy $R5 "0"
256
    StrCpy $R6 ""
257
   	GoTo loop
258
 closefile:
259
    FileClose $R3
260
    GoTo done
261
fileerror:
262
    MessageBox MB_OK "File access error: tnsnames.ora."
263
    StrCpy $R1 ""
264
    GoTo done
265
syntaxerror:
266
    MessageBox MB_OK "File syntax error: tnsnames.ora."
267
    StrCpy $R1 ""
268
    StrCmp $R3 "" +2
269
    FileClose $R3
270
	GoTo done
271
done:
272
    Pop $R8
273
    Pop $R7
274
    Pop $R6
275
    Pop $R5
276
    Pop $R4
277
    Pop $R3
278
    Pop $R2
279
    Exch $R1
280
 
281
FunctionEnd