]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/win64_installer/ConfigPage1.nsh
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / win64_installer / ConfigPage1.nsh
1 Function EnterConfigPage1
2   ${If} $AutomaticInstall = 1
3     Abort
4   ${EndIf}
5
6   IntOp $R0 $NewComponents & ${ComponentsFileAndStorage}
7
8   ${If} $R0 = 0
9     Abort
10   ${EndIf}
11
12   FileOpen $R5 "$PLUGINSDIR\ConfigPage1.ini" w
13
14   StrCpy $R6 1  ; Field Number
15   StrCpy $R7 0  ; Top
16
17   IntOp $R0 $NewComponents & ${ComponentFile}
18   ${If} $R0 <> 0
19     IntOp $R8 $R7 + 52
20     FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Client"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n'
21     IntOp $R6 $R6 + 1
22     IntOp $R7 $R7 + 12
23
24     IntOp $R8 $R7 + 8
25     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n'
26     IntOp $R6 $R6 + 1
27     IntOp $R7 $R7 - 2
28
29     IntOp $R8 $R8 + 2
30     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n'
31     IntOp $R6 $R6 + 1
32     IntOp $R7 $R7 + 2
33
34     IntOp $R8 $R8 - 2
35     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n'
36     IntOp $R6 $R6 + 1
37     IntOp $R7 $R7 - 2
38
39     IntOp $R8 $R8 + 2
40     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientPort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n'
41     IntOp $R6 $R6 + 1
42     IntOp $R7 $R7 + 2
43
44     IntOp $R8 $R8 - 2
45     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n'
46     IntOp $R6 $R6 + 1
47     IntOp $R7 $R7 - 2
48
49     IntOp $R8 $R8 + 2
50     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigClientMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n'
51     IntOp $R6 $R6 + 1
52     IntOp $R7 $R7 + 16
53
54     IntOp $R8 $R7 + 8
55     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n'
56     IntOp $R6 $R6 + 1
57     IntOp $R7 $R7 - 2
58
59     IntOp $R8 $R8 + 2
60     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigClientPassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n'
61     IntOp $R6 $R6 + 1
62     IntOp $R7 $R7 + 14
63
64     IntOp $R8 $R7 + 10
65     FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n'
66     IntOp $R6 $R6 + 1
67
68     FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigClientStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n'
69     IntOp $R6 $R6 + 1
70     IntOp $R7 $R7 + 16
71   ${Endif}
72
73   IntOp $R0 $NewComponents & ${ComponentStorage}
74   ${If} $R0 <> 0
75     IntOp $R8 $R7 + 52
76     FileWrite $R5 '[Field $R6]$\r$\nType="GroupBox"$\r$\nText="Storage"$\r$\nLeft=0$\r$\nTop=$R7$\r$\nRight=300$\r$\nBottom=$R8$\r$\n$\r$\n'
77     IntOp $R6 $R6 + 1
78     IntOp $R7 $R7 + 12
79     
80     IntOp $R8 $R7 + 8
81     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Name"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=26$\r$\nBottom=$R8$\r$\n$\r$\n'
82     IntOp $R6 $R6 + 1
83     IntOp $R7 $R7 - 2
84
85     IntOp $R8 $R8 + 2
86     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStorageName$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=158$\r$\nBottom=$R8$\r$\n$\r$\n'
87     IntOp $R6 $R6 + 1
88     IntOp $R7 $R7 + 2
89
90     IntOp $R8 $R8 - 2
91     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Port"$\r$\nLeft=172$\r$\nTop=$R7$\r$\nRight=188$\r$\nBottom=$R8$\r$\n$\r$\n'
92     IntOp $R6 $R6 + 1
93     IntOp $R7 $R7 - 2
94
95     IntOp $R8 $R8 + 2
96     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStoragePort$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=218$\r$\nBottom=$R8$\r$\n$\r$\n'
97     IntOp $R6 $R6 + 1
98     IntOp $R7 $R7 + 2
99
100     IntOp $R8 $R8 - 2
101     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Max Jobs"$\r$\nLeft=238$\r$\nTop=$R7$\r$\nRight=270$\r$\nBottom=$R8$\r$\n$\r$\n'
102     IntOp $R6 $R6 + 1
103     IntOp $R7 $R7 - 2
104
105     IntOp $R8 $R8 + 2
106     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nFlags="ONLY_NUMBERS"$\r$\nState=$ConfigStorageMaxJobs$\r$\nLeft=274$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n'
107     IntOp $R6 $R6 + 1
108     IntOp $R7 $R7 + 16
109
110     IntOp $R8 $R7 + 8
111     FileWrite $R5 '[Field $R6]$\r$\nType="Label"$\r$\nText="Password"$\r$\nLeft=6$\r$\nTop=$R7$\r$\nRight=38$\r$\nBottom=$R8$\r$\n$\r$\n'
112     IntOp $R6 $R6 + 1
113     IntOp $R7 $R7 - 2
114
115     IntOp $R8 $R8 + 2
116     FileWrite $R5 '[Field $R6]$\r$\nType="Text"$\r$\nState=$ConfigStoragePassword$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=294$\r$\nBottom=$R8$\r$\n$\r$\n'
117     IntOp $R6 $R6 + 1
118     IntOp $R7 $R7 + 14
119
120     IntOp $R8 $R7 + 10
121     FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageInstallService$\r$\nText="Install as service"$\r$\nLeft=50$\r$\nTop=$R7$\r$\nRight=118$\r$\nBottom=$R8$\r$\n$\r$\n'
122     IntOp $R6 $R6 + 1
123
124     FileWrite $R5 '[Field $R6]$\r$\nType="Checkbox"$\r$\nState=$ConfigStorageStartService$\r$\nText="Start after install"$\r$\nLeft=190$\r$\nTop=$R7$\r$\nRight=260$\r$\nBottom=$R8$\r$\n$\r$\n'
125     IntOp $R6 $R6 + 1
126     IntOp $R7 $R7 + 16
127   ${Endif}
128
129   IntOp $R6 $R6 - 1
130
131   FileWrite $R5 "[Settings]$\r$\nNumFields=$R6$\r$\n"
132
133   FileClose $R5
134
135   !insertmacro MUI_HEADER_TEXT "$(TITLE_ConfigPage1)" "$(SUBTITLE_ConfigPage1)"
136   !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ConfigPage1.ini"
137   Pop $HDLG ;HWND of dialog
138
139   ; Initialize Controls
140
141   StrCpy $R6 1  ; Field Number
142
143   IntOp $R0 $NewComponents & ${ComponentFile}
144   ${If} $R0 <> 0
145     IntOp $R6 $R6 + 2
146
147     ; Client Name
148     !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND"
149     SendMessage $HCTL ${EM_LIMITTEXT} 30 0
150
151     IntOp $R6 $R6 + 2
152
153     ; Client Port Number
154     !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND"
155     SendMessage $HCTL ${EM_LIMITTEXT} 5 0
156
157     IntOp $R6 $R6 + 2
158
159     ; Max Jobs
160     !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND"
161     SendMessage $HCTL ${EM_LIMITTEXT} 3 0
162
163     IntOp $R6 $R6 + 5
164   ${Endif}
165
166   IntOp $R0 $NewComponents & ${ComponentStorage}
167   ${If} $R0 <> 0
168     IntOp $R6 $R6 + 2
169
170     ; Storage Name
171     !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND"
172     SendMessage $HCTL ${EM_LIMITTEXT} 30 0
173
174     IntOp $R6 $R6 + 2
175
176     ; Storage Port Number
177     !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND"
178     SendMessage $HCTL ${EM_LIMITTEXT} 5 0
179
180     IntOp $R6 $R6 + 2
181
182     ; Max Jobs
183     !insertmacro MUI_INSTALLOPTIONS_READ $HCTL "ConfigPage1.ini" "Field $R6" "HWND"
184     SendMessage $HCTL ${EM_LIMITTEXT} 3 0
185
186     IntOp $R6 $R6 + 5
187   ${Endif}
188
189   !insertmacro MUI_INSTALLOPTIONS_SHOW
190
191   ; Process results
192
193   StrCpy $R6 3
194
195   IntOp $R0 $NewComponents & ${ComponentFile}
196   ${If} $R0 <> 0
197     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientName "ConfigPage1.ini" "Field $R6" "State"
198
199     IntOp $R6 $R6 + 2
200
201     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPort "ConfigPage1.ini" "Field $R6" "State"
202
203     IntOp $R6 $R6 + 2
204
205     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientMaxJobs "ConfigPage1.ini" "Field $R6" "State"
206
207     IntOp $R6 $R6 + 2
208
209     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientPassword "ConfigPage1.ini" "Field $R6" "State"
210
211     IntOp $R6 $R6 + 1
212
213     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientInstallService "ConfigPage1.ini" "Field $R6" "State"
214
215     IntOp $R6 $R6 + 1
216
217     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigClientStartService "ConfigPage1.ini" "Field $R6" "State"
218
219     IntOp $R6 $R6 + 3
220   ${Endif}
221
222   IntOp $R0 $NewComponents & ${ComponentStorage}
223   ${If} $R0 <> 0
224     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageName "ConfigPage1.ini" "Field $R6" "State"
225
226     IntOp $R6 $R6 + 2
227
228     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePort "ConfigPage1.ini" "Field $R6" "State"
229
230     IntOp $R6 $R6 + 2
231
232     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageMaxJobs "ConfigPage1.ini" "Field $R6" "State"
233
234     IntOp $R6 $R6 + 2
235
236     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStoragePassword "ConfigPage1.ini" "Field $R6" "State"
237
238     IntOp $R6 $R6 + 1
239
240     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageInstallService "ConfigPage1.ini" "Field $R6" "State"
241
242     IntOp $R6 $R6 + 1
243
244     !insertmacro MUI_INSTALLOPTIONS_READ $ConfigStorageStartService "ConfigPage1.ini" "Field $R6" "State"
245
246     IntOp $R6 $R6 + 3
247   ${Endif}
248 FunctionEnd
249
250 Function LeaveConfigPage1
251   StrCpy $R6 5
252
253   IntOp $R0 $NewComponents & ${ComponentFile}
254   ${If} $R0 <> 0
255     !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State"
256     ${If} $R0 < 1024
257     ${OrIf} $R0 > 65535
258       MessageBox MB_OK "Port must be between 1024 and 65535 inclusive."
259       Abort
260     ${EndIf}
261
262     IntOp $R6 $R6 + 2
263
264     !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State"
265     ${If} $R0 < 1
266     ${OrIf} $R0 > 99
267       MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive."
268       Abort
269     ${EndIf}
270
271     IntOp $R6 $R6 + 9
272   ${Endif}
273   
274   IntOp $R0 $NewComponents & ${ComponentStorage}
275   ${If} $R0 <> 0
276     !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State"
277     ${If} $R0 < 1024
278     ${OrIf} $R0 > 65535
279       MessageBox MB_OK "Port must be between 1024 and 65535 inclusive."
280       Abort
281     ${EndIf}
282
283     IntOp $R6 $R6 + 2
284
285     !insertmacro MUI_INSTALLOPTIONS_READ $R0 "ConfigPage1.ini" "Field $R6" "State"
286     ${If} $R0 < 1
287     ${OrIf} $R0 > 99
288       MessageBox MB_OK "Max Jobs must be between 1 and 99 inclusive."
289       Abort
290     ${EndIf}
291
292     IntOp $R6 $R6 + 9
293   ${Endif}
294 FunctionEnd