]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
9f36dfacae566d12294a3f7ca68c78f964b712bf
[features.git] / development / Win32 / packaging / installer / include / init.nsh
1 /*
2 init.nsh
3
4 Initialization functions
5 */
6
7 #--------------------------------
8 # User initialization
9
10 Var ComponentPath
11 Var LyXLangName
12
13 # COMPONENT can be LaTeX, ImageMagick and Ghostscript
14 !macro EXTERNAL_INIT COMPONENT
15
16   # APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
17   # where ${APP_NAME}${APP_SERIES_KEY} is something like LyX22
18   ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
19   
20   # BIN_LATEX etc are defined in settings.nsh
21   ${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
22     # set variables like PathLaTeX
23     StrCpy $Path${COMPONENT} $ComponentPath
24   ${EndIf}
25
26 !macroend
27
28 Function InitUser
29
30   # Get directories of components from registry
31   
32   !insertmacro EXTERNAL_INIT LaTeX
33   
34   # Get LyX language
35   
36   ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
37   
38   ${If} $LyXLangName != ""
39     StrCpy $LangName $LyXLangName
40   ${EndIf}
41   
42 FunctionEnd
43
44 #--------------------------------
45 # visible installer sections
46
47 Section "$(SecFileAssocTitle)" SecFileAssoc
48  StrCpy $CreateFileAssociations "true" 
49 SectionEnd
50
51 Section "$(SecDesktopTitle)" SecDesktop
52  StrCpy $CreateDesktopIcon "true"
53 SectionEnd
54
55 # Expand the list of dictionaries by default as this was requested by several
56 # users. For the thesaurus this is was not requested because this section
57 # is by default empty.
58 SectionGroup /e "$(SecDictionaries)" SecDictionaries
59
60 Section /o "Afrikaans" SecDAfrikaans
61  StrCpy $DictCodes "af_ZA,$DictCodes"
62  AddSize 1440
63 SectionEnd
64
65 Section /o "العربية" SecDArabic
66  StrCpy $DictCodes "ar_SA,$DictCodes"
67  AddSize 7304
68 SectionEnd
69
70 Section /o "հայերեն" SecDArmenian
71  StrCpy $DictCodes "hy_AM,$DictCodes"
72  AddSize 2000
73 SectionEnd
74
75 Section /o "Bahasa Indonesia" SecDIndonesian
76  StrCpy $DictCodes "id_ID,$DictCodes"
77  AddSize 217
78 SectionEnd
79
80 Section /o "Bahasa Melayu" SecDMalayan
81  StrCpy $DictCodes "ms_MY,$DictCodes"
82  AddSize 227
83 SectionEnd
84
85 Section /o "беларускі" SecDBelarusian 
86  StrCpy $DictCodes "be_BY,$DictCodes"
87  AddSize 1730
88 SectionEnd
89
90 Section /o "Brezhoneg" SecDBreton 
91  StrCpy $DictCodes "br_FR,$DictCodes"
92  AddSize 5556
93 SectionEnd
94
95 Section /o "български" SecDBulgarian
96  StrCpy $DictCodes "bg_BG,$DictCodes"
97  AddSize 985
98 SectionEnd
99
100 Section /o "Català" SecDCatalanian
101  StrCpy $DictCodes "ca_ES,$DictCodes"
102  AddSize 1210
103 SectionEnd
104
105 Section /o "Ceština" SecDCzech
106  StrCpy $DictCodes "cs_CZ,$DictCodes"
107  AddSize 2190
108 SectionEnd
109
110 Section /o "Coptic" SecDCoptic
111  StrCpy $DictCodes "cop_EG,$DictCodes"
112  AddSize 151
113 SectionEnd
114
115 Section /o "Cymraeg" SecDWelsh 
116  StrCpy $DictCodes "cy_GB,$DictCodes"
117  AddSize 1540
118 SectionEnd
119
120 Section /o "Dansk" SecDDanish
121  StrCpy $DictCodes "da_DK,$DictCodes"
122  AddSize 2470
123 SectionEnd
124
125 Section /o "Deutsch (A)" SecDGermanAT
126  StrCpy $DictCodes "de_AT,$DictCodes"
127  AddSize 3620
128 SectionEnd
129
130 Section /o "Deutsch (CH)" SecDGermanCH
131  StrCpy $DictCodes "de_CH,$DictCodes"
132  AddSize 3620
133 SectionEnd
134
135 Section "Deutsch (D)" SecDGermanD
136  # already installed by default
137  SectionIn RO
138  #StrCpy $DictCodes "de_DE,$DictCodes"
139  AddSize 3620
140 SectionEnd
141
142 Section /o "Ελληνικά" SecDGreek
143  StrCpy $DictCodes "el_GR,$DictCodes"
144  AddSize 6550
145 SectionEnd
146
147 Section /o "Eesti" SecDEstonian
148  StrCpy $DictCodes "et_EE,$DictCodes"
149  AddSize 4400
150 SectionEnd
151
152 Section /o "English (AU)" SecDEnglishAU
153  StrCpy $DictCodes "en_AU,$DictCodes"
154  AddSize 552
155 SectionEnd
156
157 Section /o "English (CA)" SecDEnglishCA
158  StrCpy $DictCodes "en_CA,$DictCodes"
159  AddSize 550
160 SectionEnd
161
162 Section "English (GB)" SecDEnglishGB
163  # already installed by default
164  SectionIn RO
165  #StrCpy $DictCodes "en_GB,$DictCodes"
166  AddSize 742
167 SectionEnd
168
169 Section /o "English (NZ)" SecDEnglishNZ
170  StrCpy $DictCodes "en_NZ,$DictCodes"
171  AddSize 551
172 SectionEnd
173
174 Section "English (US)" SecDEnglishUS
175  # already installed by default
176  SectionIn RO
177  #StrCpy $DictCodes "en_US,$DictCodes"
178  AddSize 548
179 SectionEnd
180
181 Section "Español (ES)" SecDSpanishES
182  # already installed by default
183  SectionIn RO
184  #StrCpy $DictCodes "es_ES,$DictCodes"
185  AddSize 974
186 SectionEnd
187
188 Section "Español (MX)" SecDSpanishMX
189  # already installed by default
190  SectionIn RO
191  #StrCpy $DictCodes "es_MX,$DictCodes"
192  AddSize 924
193 SectionEnd
194
195 Section /o "Esperanto" SecDEsperanto
196  StrCpy $DictCodes "eo_EO,$DictCodes"
197  AddSize 389
198 SectionEnd
199
200 Section /o "Euskara" SecDBasque
201  StrCpy $DictCodes "eu_ES,$DictCodes"
202  AddSize 4850
203 SectionEnd
204
205 Section /o "فارسی" SecDFarsi
206  StrCpy $DictCodes "fa_IR,$DictCodes"
207  AddSize 6710
208 SectionEnd
209
210 Section "Français" SecDFrench
211  # already installed by default
212  SectionIn RO
213  #StrCpy $DictCodes "fr_FR,$DictCodes"
214  AddSize 1200
215 SectionEnd
216
217 Section /o "Français (Canada)" SecDFrenchCanada
218  StrCpy $DictCodes "fr_CA,$DictCodes"
219  AddSize 1390
220 SectionEnd
221
222 Section /o "Gaeilge" SecDGaelic
223  StrCpy $DictCodes "ga_IR,$DictCodes"
224  AddSize 1090
225 SectionEnd
226
227 Section /o "Gàidhlig" SecDScottish
228  StrCpy $DictCodes "gd_GB,$DictCodes"
229  AddSize 4161
230 SectionEnd
231
232 Section /o "Galego" SecDGalician
233  StrCpy $DictCodes "gl_ES,$DictCodes"
234  AddSize 3911
235 SectionEnd
236
237 Section /o "עִברִית" SecDHebrew
238  StrCpy $DictCodes "he_IL,$DictCodes"
239  AddSize 3120
240 SectionEnd
241
242 Section /o "Hrvatski" SecDCroatian
243  StrCpy $DictCodes "hr_HR,$DictCodes"
244  AddSize 2240
245 SectionEnd
246
247 Section /o "Magyar" SecDHungarian
248  StrCpy $DictCodes "hu_HU,$DictCodes"
249  AddSize 3380
250 SectionEnd
251
252 Section /o "हिंदी" SecDHindi
253  StrCpy $DictCodes "hi_IN,$DictCodes"
254  AddSize 1900
255 SectionEnd
256
257 Section /o "Interlingua" SecDInterlingua
258  StrCpy $DictCodes "ia_IA,$DictCodes"
259  AddSize 613
260 SectionEnd
261
262 Section /o "Íslenska" SecDIcelandic
263  StrCpy $DictCodes "is_IS,$DictCodes"
264  AddSize 2320
265 SectionEnd
266
267 Section /o "Italiano" SecDItalian
268  StrCpy $DictCodes "it_IT,$DictCodes"
269  AddSize 1380
270 SectionEnd
271
272 Section /o "Қазақша" SecDKazakh
273  StrCpy $DictCodes "kk_KZ,$DictCodes"
274  AddSize 2120
275 SectionEnd
276
277 Section /o "한국어" SecDKorean
278  StrCpy $DictCodes "ko_KR,$DictCodes"
279  AddSize 16540
280 SectionEnd
281
282 Section /o "Latina" SecDLatin
283  StrCpy $DictCodes "la_LA,$DictCodes"
284  AddSize 2040
285 SectionEnd
286
287 Section /o "Lietuviu" SecDLithuanian
288  StrCpy $DictCodes "lt_LT,$DictCodes"
289  AddSize 1320
290 SectionEnd
291
292 Section /o "Latviešu" SecDLatvian
293  StrCpy $DictCodes "lv_LV,$DictCodes"
294  AddSize 2243
295 SectionEnd
296
297 Section /o "मराठी" SecDMarathi
298  StrCpy $DictCodes "mr_IN,$DictCodes"
299  AddSize 5290
300 SectionEnd
301
302 Section /o "Nederlands" SecDDutch
303  StrCpy $DictCodes "nl_NL,$DictCodes"
304  AddSize 1820
305 SectionEnd
306
307 Section /o "Norsk (Bokmål)" SecDNorwegianNB
308  StrCpy $DictCodes "nb_NO,$DictCodes"
309  AddSize 5291
310 SectionEnd
311
312 Section /o "Norsk (Nynorsk)" SecDNorwegianNN
313  StrCpy $DictCodes "nn_NO,$DictCodes"
314  AddSize 3292
315 SectionEnd
316
317 Section /o "Occitan" SecDOccitan
318  StrCpy $DictCodes "oc_FR,$DictCodes"
319  AddSize 31710
320 SectionEnd
321
322 Section /o "Polski" SecDPolish
323  StrCpy $DictCodes "pl_PL,$DictCodes"
324  AddSize 4540
325 SectionEnd
326
327 Section /o "Português (BR)" SecDPortugueseBR
328  StrCpy $DictCodes "pt_BR,$DictCodes"
329  AddSize 5280
330 SectionEnd
331
332 Section /o "Português (PT)" SecDPortuguesePT
333  StrCpy $DictCodes "pt_PT,$DictCodes"
334  AddSize 1568
335 SectionEnd
336
337 Section /o "Româna" SecDRomanian
338  StrCpy $DictCodes "ro_RO,$DictCodes"
339  AddSize 2255
340 SectionEnd
341
342 Section /o "Русский" SecDRussian
343  StrCpy $DictCodes "ru_RU,$DictCodes"
344  AddSize 1920
345 SectionEnd
346
347 Section /o "Serbšcina (Dolno)" SecDSorbianD
348  StrCpy $DictCodes "dsb_DE,$DictCodes"
349  AddSize 1035
350 SectionEnd
351
352 Section /o "Serbšcina (Horno)" SecDSorbianH
353  StrCpy $DictCodes "hsb_DE,$DictCodes"
354  AddSize 740
355 SectionEnd
356
357 Section /o "Shqip" SecDAlbanian
358  StrCpy $DictCodes "sq_AL,$DictCodes"
359  AddSize 2612
360 SectionEnd
361
362 Section /o "Slovenšcina" SecDSlovenian
363  StrCpy $DictCodes "sl_SI,$DictCodes"
364  AddSize 2910
365 SectionEnd
366
367 Section /o "Slovenský" SecDSlovakian
368  StrCpy $DictCodes "sk_SK,$DictCodes"
369  AddSize 3310
370 SectionEnd
371
372 Section /o "Српски (Ћирилица)" SecDSerbianC
373  StrCpy $DictCodes "sr_RS,$DictCodes"
374  AddSize 4401
375 SectionEnd
376
377 Section /o "Srpski (Latinica)" SecDSerbianL
378  StrCpy $DictCodes "sr_RS-Latin,$DictCodes"
379  AddSize 2843
380 SectionEnd
381
382 Section /o "Svenska" SecDSwedish
383  StrCpy $DictCodes "sv_SE,$DictCodes"
384  AddSize 2028
385 SectionEnd
386
387 Section /o "தமிழ்" SecDTamil
388  StrCpy $DictCodes "ta_IN,$DictCodes"
389  AddSize 5911
390 SectionEnd
391
392 Section /o "తెలుగు" SecDTelugu
393  StrCpy $DictCodes "te_IN,$DictCodes"
394  AddSize 3400
395 SectionEnd
396  
397 Section /o "ไทย" SecDThai
398  StrCpy $DictCodes "th_TH,$DictCodes"
399  AddSize 351
400 SectionEnd
401
402 Section /o "Tibetan" SecDTibetan
403  StrCpy $DictCodes "bo_CN,$DictCodes"
404  AddSize 7
405 SectionEnd
406
407 Section /o "Türkmençe" SecDTurkmen
408  StrCpy $DictCodes "tk_TM,$DictCodes"
409  AddSize 950
410 SectionEnd
411
412 Section /o "Türkçe" SecDTurkish
413  StrCpy $DictCodes "tr_TR,$DictCodes"
414  AddSize 8870
415 SectionEnd
416
417 Section /o "Українська" SecDUkrainian
418  StrCpy $DictCodes "uk_UA,$DictCodes"
419  AddSize 6375
420 SectionEnd
421
422 Section /o "اردو" SecDUrdu
423  StrCpy $DictCodes "ur_PK,$DictCodes"
424  AddSize 1401
425 SectionEnd
426
427 Section /o "Tiếng Việt" SecDVietnamese
428  StrCpy $DictCodes "vi_VN,$DictCodes"
429  AddSize 40
430 SectionEnd
431
432 SectionGroupEnd
433
434
435 SectionGroup "$(SecThesaurus)" SecThesaurus
436
437 Section /o "العربية" SecTArabic
438  StrCpy $ThesCodes "ar_SA,$ThesCodes"
439  AddSize 799
440 SectionEnd
441
442 Section /o "български" SecTBulgarian
443  StrCpy $ThesCodes "bg_BG,$ThesCodes"
444  AddSize 3020
445 SectionEnd
446
447 Section /o "Català" SecTCatalan
448  StrCpy $ThesCodes "ca_ES,$ThesCodes"
449  AddSize 731
450 SectionEnd
451
452 Section /o "Ceština" SecTCzech
453  StrCpy $ThesCodes "cs_CZ,$ThesCodes"
454  AddSize 635
455 SectionEnd
456
457 Section /o "Dansk" SecTDanish
458  StrCpy $ThesCodes "da_DK,$ThesCodes"
459  AddSize 2360
460 SectionEnd
461
462 Section /o "Deutsch (D/A)" SecTGermanDA
463  StrCpy $ThesCodes "de_DE,$ThesCodes"
464  AddSize 14600
465 SectionEnd
466
467 Section /o "Deutsch (CH)" SecTGermanCH
468  StrCpy $ThesCodes "de_CH,$ThesCodes"
469  AddSize 14600
470 SectionEnd
471
472 Section /o "English (AU)" SecTEnglishAU
473  StrCpy $ThesCodes "en_AU,$ThesCodes"
474  AddSize 21642
475 SectionEnd
476
477 Section /o "English (GB)" SecTEnglishGB
478  StrCpy $ThesCodes "en_GB,$ThesCodes"
479  AddSize 14300
480 SectionEnd
481
482 Section /o "English (US)" SecTEnglishUS
483  StrCpy $ThesCodes "en_US,$ThesCodes"
484  AddSize 22095
485 SectionEnd
486
487 Section /o "Español" SecTSpanish
488  StrCpy $ThesCodes "es_ES,$ThesCodes"
489  AddSize 2860
490 SectionEnd
491
492 Section /o "Français" SecTFrench
493  StrCpy $ThesCodes "fr_FR,$ThesCodes"
494  AddSize 5060
495 SectionEnd
496
497 Section /o "Gaeilge" SecTGaelic
498  StrCpy $ThesCodes "ga_IR,$ThesCodes"
499  AddSize 30600
500 SectionEnd
501
502 Section /o "Galego" SecTGalician
503  StrCpy $ThesCodes "gl_ES,$ThesCodes"
504  AddSize 510
505 SectionEnd
506
507 Section /o "Ελληνικά" SecTGreek
508  StrCpy $ThesCodes "el_GR,$ThesCodes"
509  AddSize 903
510 SectionEnd
511
512 Section /o "Íslenska" SecTIcelandic
513  StrCpy $ThesCodes "is_IS,$ThesCodes"
514  AddSize 63
515 SectionEnd
516
517 Section /o "Italiano" SecTItalian
518  StrCpy $ThesCodes "it_IT,$ThesCodes"
519  AddSize 2520
520 SectionEnd
521
522 Section /o "Magyar" SecTHungarian
523  StrCpy $ThesCodes "hu_HU,$ThesCodes"
524  AddSize 632
525 SectionEnd
526
527 Section /o "Norsk (Bokmål)" SecTNorwegianNB
528  StrCpy $ThesCodes "nb_NO,$ThesCodes"
529  AddSize 2595
530 SectionEnd
531
532 Section /o "Norsk (Nynorsk)" SecTNorwegianNN
533  StrCpy $ThesCodes "nn_NO,$ThesCodes"
534  AddSize 2
535 SectionEnd
536
537 Section /o "Polski" SecTPolish
538  StrCpy $ThesCodes "pl_PL,$ThesCodes"
539  AddSize 5580
540 SectionEnd
541
542 Section /o "Português" SecTPortuguese
543  StrCpy $ThesCodes "pt_PT,$ThesCodes"
544  AddSize 3950
545 SectionEnd
546
547 Section /o "Româna" SecTRomanian
548  StrCpy $ThesCodes "ro_RO,$ThesCodes"
549  AddSize 3650
550 SectionEnd
551
552 Section /o "Русский" SecTRussian
553  StrCpy $ThesCodes "ru_RU,$ThesCodes"
554  AddSize 2080
555 SectionEnd
556
557 Section /o "Slovenšcina" SecTSlovenian
558  StrCpy $ThesCodes "sl_SI,$ThesCodes"
559  AddSize 1110
560 SectionEnd
561
562 Section /o "Slovenský" SecTSlovakian
563  StrCpy $ThesCodes "sk_SK,$ThesCodes"
564  AddSize 930
565 SectionEnd
566
567 Section /o "Svenska" SecTSwedish
568  StrCpy $ThesCodes "sv_SE,$ThesCodes"
569  AddSize 720
570 SectionEnd
571
572 Section /o "Українська" SecTUkrainian
573  StrCpy $ThesCodes "uk_UA,$ThesCodes"
574  AddSize 1339
575 SectionEnd
576
577 SectionGroupEnd
578
579 # Section descriptions
580 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
581 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
582 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
583 !insertmacro MUI_DESCRIPTION_TEXT ${SecDictionaries} "$(SecDictionariesDescription)"
584 !insertmacro MUI_DESCRIPTION_TEXT ${SecThesaurus} "$(SecThesaurusDescription)"
585 !insertmacro MUI_FUNCTION_DESCRIPTION_END
586
587
588 # .onInit must be here after the section definition because we have to set
589 # the selection states of the dictionary sections
590 Function .onInit
591
592   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
593   ${if} $R0 == "5.0" # 2000
594   ${orif} $R0 == "5.1" # XP
595   ${orif} $R0 == "5.2" # 2003
596   ${orif} $R0 == "6.0" # Vista
597     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 7 or newer." /SD IDOK
598     Quit
599   ${endif}
600   
601   # Check that LyX is not currently running
602   FindProcDLL::FindProc "${BIN_LYX}"
603   ${if} $R0 == "1"
604    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
605    Abort
606   ${endif}
607   
608   # read the user and computer name
609   ReadRegStr $ComputerName HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
610   System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
611   StrCpy $UserName $0
612   
613   !insertmacro MULTIUSER_INIT
614   
615   # check if this LyX version is already installed
616   ${if} $MultiUser.Privileges == "Admin"
617   ${orif} $MultiUser.Privileges == "Power"
618    ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
619   ${else}
620    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayIcon"
621    # handle also the case that LyX is already installed in HKLM
622    ${if} $0 == ""
623     ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
624    ${endif}
625   ${endif}
626   ${if} $0 != ""
627    # check if the uninstaller was acidentally deleted
628    # if so don't bother the user if he realy wants to install a new LyX over an existing one
629    # because he won't have a chance to deny this
630    StrCpy $4 $0 -10 # remove '\bin\lyx,0'
631    # (for FileCheck the variables $0 and $1 cannot be used)
632    !insertmacro FileCheck $5 "Uninstall-${APP_NAME}.exe" "$4" # macro from LyXUtils.nsh
633    ${if} $5 == "False"
634     Goto ForceInstallation
635    ${endif}
636    # installing over an existing installation of the same LyX release is not necessary
637    # if the users does this he most probably has a problem with LyX that can better be solved
638    # by reinstalling LyX
639    # for beta and other test releases over-installing can even cause errors
640    MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION "$(AlreadyInstalled)" /SD IDNO IDYES ForceInstallation 
641    Abort
642    ForceInstallation:
643   ${endif}
644   
645   # check if there is an existing LyX installation of the same LyX series
646   # we usually don't release more than 10 versions so with 20 we are safe to check if a newer version is installed
647   IntOp $4 ${APP_VERSION_REVISION} + 20
648   ${for} $5 0 $4
649    ${if} $MultiUser.Privileges == "Admin"
650    ${orif} $MultiUser.Privileges == "Power"
651     ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
652     # also check for an emergency release
653     ${if} $0 == ""
654      ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
655     ${endif}
656    ${else}
657     ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
658     # also check for an emergency release
659     ${if} $0 == ""
660      ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
661     ${endif}
662    ${endif}
663    ${if} $0 != ""
664     StrCpy $R5 $0 # store the read version number
665     StrCpy $OldVersionNumber "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5"
666     # we don't stop here because we want the latest installed version
667    ${endif} 
668   ${next}
669   
670   ${if} $OldVersionNumber > ${APP_SERIES_KEY}
671    # store the version number and reformat it temporarily for the error message
672    StrCpy $R0 $OldVersionNumber
673    StrCpy $OldVersionNumber $R5
674    MessageBox MB_OK|MB_ICONSTOP "$(NewerInstalled)" /SD IDOK
675    StrCpy $OldVersionNumber $R0
676    Abort
677   ${endif}
678
679   # this can be reset to "true" in section SecDesktop
680   StrCpy $CreateDesktopIcon "false"
681   StrCpy $CreateFileAssociations "false"
682  
683   ${IfNot} ${Silent}
684     # Show banner while installer is intializating 
685     Banner::show /NOUNLOAD "Checking system"
686   ${EndIf}
687  
688   Call SearchExternal
689   
690   # select sections of already installed spell-checker dictionaries, make them read-only
691   # and set the necessary size to 0 bytes
692   StrCpy $String $FoundDict
693   StrCpy $Search "af_ZA"
694   Call StrPoint # function from LyXUtils.nsh
695   ${if} $Pointer != "-1"
696    IntOp $0 ${SF_SELECTED} | ${SF_RO}
697    SectionSetFlags ${SecDAfrikaans} $0
698    SectionSetSize ${SecDAfrikaans} 0
699   ${endif}
700   StrCpy $Search "ar_SA"
701   Call StrPoint
702   ${if} $Pointer != "-1"
703    IntOp $0 ${SF_SELECTED} | ${SF_RO}
704    SectionSetFlags ${SecDArabic} $0
705    SectionSetSize ${SecDArabic} 0
706   ${endif}
707   StrCpy $Search "hy_AM"
708   Call StrPoint
709   ${if} $Pointer != "-1"
710    IntOp $0 ${SF_SELECTED} | ${SF_RO}
711    SectionSetFlags ${SecDArmenian} $0
712    SectionSetSize ${SecDArmenian} 0
713   ${endif}
714   StrCpy $Search "id_ID"
715   Call StrPoint
716   ${if} $Pointer != "-1"
717    IntOp $0 ${SF_SELECTED} | ${SF_RO}
718    SectionSetFlags ${SecDIndonesian} $0
719    SectionSetSize ${SecDIndonesian} 0
720   ${endif}
721   StrCpy $Search "ms_MY"
722   Call StrPoint
723   ${if} $Pointer != "-1"
724    IntOp $0 ${SF_SELECTED} | ${SF_RO}
725    SectionSetFlags ${SecDMalayan} $0
726    SectionSetSize ${SecDMalayan} 0
727   ${endif}
728   StrCpy $Search "be_BY"
729   Call StrPoint
730   ${if} $Pointer != "-1"
731    IntOp $0 ${SF_SELECTED} | ${SF_RO}
732    SectionSetFlags ${SecDBelarusian} $0
733    SectionSetSize ${SecDBelarusian} 0
734   ${endif}
735   StrCpy $Search "br_FR"
736   Call StrPoint
737   ${if} $Pointer != "-1"
738    IntOp $0 ${SF_SELECTED} | ${SF_RO}
739    SectionSetFlags ${SecDBreton} $0
740    SectionSetSize ${SecDBreton} 0
741   ${endif}
742   StrCpy $Search "bg_BG"
743   Call StrPoint
744   ${if} $Pointer != "-1"
745    IntOp $0 ${SF_SELECTED} | ${SF_RO}
746    SectionSetFlags ${SecDBulgarian} $0
747    SectionSetSize ${SecDBulgarian} 0
748   ${endif}
749   StrCpy $Search "ca_ES"
750   Call StrPoint
751   ${if} $Pointer != "-1"
752    IntOp $0 ${SF_SELECTED} | ${SF_RO}
753    SectionSetFlags ${SecDCatalanian} $0
754    SectionSetSize ${SecDCatalanian} 0
755   ${endif}
756   StrCpy $Search "cs_CZ"
757   Call StrPoint
758   ${if} $Pointer != "-1"
759    IntOp $0 ${SF_SELECTED} | ${SF_RO}
760    SectionSetFlags ${SecDCzech} $0
761    SectionSetSize ${SecDCzech} 0
762   ${endif}
763  
764   StrCpy $Search "cop_EG"
765   Call StrPoint
766   ${if} $Pointer != "-1"
767    IntOp $0 ${SF_SELECTED} | ${SF_RO}
768    SectionSetFlags ${SecDCoptic} $0
769    SectionSetSize ${SecDCoptic} 0
770   ${endif}
771   StrCpy $Search "cy_GB"
772   Call StrPoint
773   ${if} $Pointer != "-1"
774    IntOp $0 ${SF_SELECTED} | ${SF_RO}
775    SectionSetFlags ${SecDWelsh} $0
776    SectionSetSize ${SecDWelsh} 0
777   ${endif}
778   StrCpy $Search "da_DK"
779   Call StrPoint
780   ${if} $Pointer != "-1"
781    IntOp $0 ${SF_SELECTED} | ${SF_RO}
782    SectionSetFlags ${SecDDanish} $0
783    SectionSetSize ${SecDDanish} 0
784   ${endif}
785   StrCpy $Search "de_AT"
786   Call StrPoint
787   ${if} $Pointer != "-1"
788    IntOp $0 ${SF_SELECTED} | ${SF_RO}
789    SectionSetFlags ${SecDGermanAT} $0
790    SectionSetSize ${SecDGermanAT} 0
791   ${endif}
792   StrCpy $Search "de_CH"
793   Call StrPoint
794   ${if} $Pointer != "-1"
795    IntOp $0 ${SF_SELECTED} | ${SF_RO}
796    SectionSetFlags ${SecDGermanCH} $0
797    SectionSetSize ${SecDGermanCH} 0
798   ${endif}
799   StrCpy $Search "de_DE"
800   Call StrPoint
801   ${if} $Pointer != "-1"
802    IntOp $0 ${SF_SELECTED} | ${SF_RO}
803    SectionSetFlags ${SecDGermanD} $0
804    SectionSetSize ${SecDGermanD} 0
805   ${endif}
806   StrCpy $Search "el_GR"
807   Call StrPoint
808   ${if} $Pointer != "-1"
809    IntOp $0 ${SF_SELECTED} | ${SF_RO}
810    SectionSetFlags ${SecDGreek} $0
811    SectionSetSize ${SecDGreek} 0
812   ${endif}
813   StrCpy $Search "et_EE"
814   Call StrPoint
815   ${if} $Pointer != "-1"
816    IntOp $0 ${SF_SELECTED} | ${SF_RO}
817    SectionSetFlags ${SecDEstonian} $0
818    SectionSetSize ${SecDEstonian} 0
819   ${endif}
820   StrCpy $Search "en_AU"
821   Call StrPoint
822   ${if} $Pointer != "-1"
823    IntOp $0 ${SF_SELECTED} | ${SF_RO}
824    SectionSetFlags ${SecDEnglishAU} $0
825    SectionSetSize ${SecDEnglishAU} 0
826   ${endif}
827   StrCpy $Search "en_CA"
828   Call StrPoint
829   ${if} $Pointer != "-1"
830    IntOp $0 ${SF_SELECTED} | ${SF_RO}
831    SectionSetFlags ${SecDEnglishCA} $0
832    SectionSetSize ${SecDEnglishCA} 0
833   ${endif}
834   StrCpy $Search "en_GB"
835   Call StrPoint
836   ${if} $Pointer != "-1"
837    IntOp $0 ${SF_SELECTED} | ${SF_RO}
838    SectionSetFlags ${SecDEnglishGB} $0
839    SectionSetSize ${SecDEnglishGB} 0
840   ${endif}
841   StrCpy $Search "en_NZ"
842   Call StrPoint
843   ${if} $Pointer != "-1"
844    IntOp $0 ${SF_SELECTED} | ${SF_RO}
845    SectionSetFlags ${SecDEnglishNZ} $0
846    SectionSetSize ${SecDEnglishNZ} 0
847   ${endif}
848   StrCpy $Search "en_US"
849   Call StrPoint
850   ${if} $Pointer != "-1"
851    IntOp $0 ${SF_SELECTED} | ${SF_RO}
852    SectionSetFlags ${SecDEnglishUS} $0
853    SectionSetSize ${SecDEnglishUS} 0
854   ${endif}
855   StrCpy $Search "es_ES"
856   Call StrPoint
857   ${if} $Pointer != "-1"
858    IntOp $0 ${SF_SELECTED} | ${SF_RO}
859    SectionSetFlags ${SecDSpanishES} $0
860    SectionSetSize ${SecDSpanishES} 0
861   ${endif}
862   StrCpy $Search "es_MX"
863   Call StrPoint
864   ${if} $Pointer != "-1"
865    IntOp $0 ${SF_SELECTED} | ${SF_RO}
866    SectionSetFlags ${SecDSpanishMX} $0
867    SectionSetSize ${SecDSpanishMX} 0
868   ${endif}
869   StrCpy $Search "eo_EO"
870   Call StrPoint
871   ${if} $Pointer != "-1"
872    IntOp $0 ${SF_SELECTED} | ${SF_RO}
873    SectionSetFlags ${SecDEsperanto} $0
874    SectionSetSize ${SecDEsperanto} 0
875   ${endif}
876   StrCpy $Search "eu_ES"
877   Call StrPoint
878   ${if} $Pointer != "-1"
879    IntOp $0 ${SF_SELECTED} | ${SF_RO}
880    SectionSetFlags ${SecDBasque} $0
881    SectionSetSize ${SecDBasque} 0
882   ${endif}
883   StrCpy $Search "fa_IR"
884   Call StrPoint
885   ${if} $Pointer != "-1"
886    IntOp $0 ${SF_SELECTED} | ${SF_RO}
887    SectionSetFlags ${SecDFarsi} $0
888    SectionSetSize ${SecDFarsi} 0
889   ${endif}
890   StrCpy $Search "fr_CA"
891   Call StrPoint
892   ${if} $Pointer != "-1"
893    IntOp $0 ${SF_SELECTED} | ${SF_RO}
894    SectionSetFlags ${SecDFrenchCanada} $0
895    SectionSetSize ${SecDFrenchCanada} 0
896   ${endif}
897   StrCpy $Search "fr_FR"
898   Call StrPoint
899   ${if} $Pointer != "-1"
900    IntOp $0 ${SF_SELECTED} | ${SF_RO}
901    SectionSetFlags ${SecDFrench} $0
902    SectionSetSize ${SecDFrench} 0
903   ${endif}
904   StrCpy $Search "ga_IR"
905   Call StrPoint
906   ${if} $Pointer != "-1"
907    IntOp $0 ${SF_SELECTED} | ${SF_RO}
908    SectionSetFlags ${SecDGaelic} $0
909    SectionSetSize ${SecDGaelic} 0
910   ${endif}
911   StrCpy $Search "gd_GB"
912   Call StrPoint
913   ${if} $Pointer != "-1"
914    IntOp $0 ${SF_SELECTED} | ${SF_RO}
915    SectionSetFlags ${SecDScottish} $0
916    SectionSetSize ${SecDScottish} 0
917   ${endif}
918   StrCpy $Search "gl_ES"
919   Call StrPoint
920   ${if} $Pointer != "-1"
921    IntOp $0 ${SF_SELECTED} | ${SF_RO}
922    SectionSetFlags ${SecDGalician} $0
923    SectionSetSize ${SecDGalician} 0
924   ${endif}
925   StrCpy $Search "he_IL"
926   Call StrPoint
927   ${if} $Pointer != "-1"
928    IntOp $0 ${SF_SELECTED} | ${SF_RO}
929    SectionSetFlags ${SecDHebrew} $0
930    SectionSetSize ${SecDHebrew} 0
931   ${endif}
932   StrCpy $Search "hi_IN"
933   Call StrPoint
934   ${if} $Pointer != "-1"
935    IntOp $0 ${SF_SELECTED} | ${SF_RO}
936    SectionSetFlags ${SecDHindi} $0
937    SectionSetSize ${SecDHindi} 0
938   ${endif}
939   StrCpy $Search "hr_HR"
940   Call StrPoint
941   ${if} $Pointer != "-1"
942    IntOp $0 ${SF_SELECTED} | ${SF_RO}
943    SectionSetFlags ${SecDCroatian} $0
944    SectionSetSize ${SecDCroatian} 0
945   ${endif}
946   StrCpy $Search "hu_HU"
947   Call StrPoint
948   ${if} $Pointer != "-1"
949    IntOp $0 ${SF_SELECTED} | ${SF_RO}
950    SectionSetFlags ${SecDHungarian} $0
951    SectionSetSize ${SecDHungarian} 0
952   ${endif}
953   StrCpy $Search "ia_IA"
954   Call StrPoint
955   ${if} $Pointer != "-1"
956    IntOp $0 ${SF_SELECTED} | ${SF_RO}
957    SectionSetFlags ${SecDInterlingua} $0
958    SectionSetSize ${SecDInterlingua} 0
959   ${endif}
960   StrCpy $Search "is_IS"
961   Call StrPoint
962   ${if} $Pointer != "-1"
963    IntOp $0 ${SF_SELECTED} | ${SF_RO}
964    SectionSetFlags ${SecDIcelandic} $0
965    SectionSetSize ${SecDIcelandic} 0
966   ${endif}
967   StrCpy $Search "it_IT"
968   Call StrPoint
969   ${if} $Pointer != "-1"
970    IntOp $0 ${SF_SELECTED} | ${SF_RO}
971    SectionSetFlags ${SecDItalian} $0
972    SectionSetSize ${SecDItalian} 0
973   ${endif}
974   StrCpy $Search "kk_KZ"
975   Call StrPoint
976   ${if} $Pointer != "-1"
977    IntOp $0 ${SF_SELECTED} | ${SF_RO}
978    SectionSetFlags ${SecDKazakh} $0
979    SectionSetSize ${SecDKazakh} 0
980   ${endif}
981   StrCpy $Search "ko_KR"
982   Call StrPoint
983   ${if} $Pointer != "-1"
984    IntOp $0 ${SF_SELECTED} | ${SF_RO}
985    SectionSetFlags ${SecDKorean} $0
986    SectionSetSize ${SecDKorean} 0
987   ${endif}
988   StrCpy $Search "la_LA"
989   Call StrPoint
990   ${if} $Pointer != "-1"
991    IntOp $0 ${SF_SELECTED} | ${SF_RO}
992    SectionSetFlags ${SecDLatin} $0
993    SectionSetSize ${SecDLatin} 0
994   ${endif}
995   StrCpy $Search "lt_LT"
996   Call StrPoint
997   ${if} $Pointer != "-1"
998    IntOp $0 ${SF_SELECTED} | ${SF_RO}
999    SectionSetFlags ${SecDLithuanian} $0
1000    SectionSetSize ${SecDLithuanian} 0
1001   ${endif}
1002   StrCpy $Search "lv_LV"
1003   Call StrPoint
1004   ${if} $Pointer != "-1"
1005    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1006    SectionSetFlags ${SecDLatvian} $0
1007    SectionSetSize ${SecDLatvian} 0
1008   ${endif}
1009   StrCpy $Search "mr_IN"
1010   Call StrPoint
1011   ${if} $Pointer != "-1"
1012    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1013    SectionSetFlags ${SecDMarathi} $0
1014    SectionSetSize ${SecDMarathi} 0
1015   ${endif}
1016   StrCpy $Search "nl_NL"
1017   Call StrPoint
1018   ${if} $Pointer != "-1"
1019    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1020    SectionSetFlags ${SecDDutch} $0
1021    SectionSetSize ${SecDDutch} 0
1022   ${endif}
1023   StrCpy $Search "nb_NO"
1024   Call StrPoint
1025   ${if} $Pointer != "-1"
1026    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1027    SectionSetFlags ${SecDNorwegianNB} $0
1028    SectionSetSize ${SecDNorwegianNB} 0
1029   ${endif}
1030   StrCpy $Search "nn_NO"
1031   Call StrPoint
1032   ${if} $Pointer != "-1"
1033    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1034    SectionSetFlags ${SecDNorwegianNN} $0
1035    SectionSetSize ${SecDNorwegianNN} 0
1036   ${endif}
1037   StrCpy $Search "oc_FR"
1038   Call StrPoint
1039   ${if} $Pointer != "-1"
1040    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1041    SectionSetFlags ${SecDOccitan} $0
1042    SectionSetSize ${SecDOccitan} 0
1043   ${endif}
1044   StrCpy $Search "pl_PL"
1045   Call StrPoint
1046   ${if} $Pointer != "-1"
1047    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1048    SectionSetFlags ${SecDPolish} $0
1049    SectionSetSize ${SecDPolish} 0
1050   ${endif}
1051   StrCpy $Search "pt_BR"
1052   Call StrPoint
1053   ${if} $Pointer != "-1"
1054    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1055    SectionSetFlags ${SecDPortugueseBR} $0
1056    SectionSetSize ${SecDPortugueseBR} 0
1057   ${endif}
1058   StrCpy $Search "pt_PT"
1059   Call StrPoint
1060   ${if} $Pointer != "-1"
1061    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1062    SectionSetFlags ${SecDPortuguesePT} $0
1063    SectionSetSize ${SecDPortuguesePT} 0
1064   ${endif}
1065   StrCpy $Search "ro_RO"
1066   Call StrPoint
1067   ${if} $Pointer != "-1"
1068    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1069    SectionSetFlags ${SecDRomanian} $0
1070    SectionSetSize ${SecDRomanian} 0
1071   ${endif}
1072   StrCpy $Search "ru_RU"
1073   Call StrPoint
1074   ${if} $Pointer != "-1"
1075    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1076    SectionSetFlags ${SecDRussian} $0
1077    SectionSetSize ${SecDRussian} 0
1078   ${endif}
1079   StrCpy $Search "dsb_DE"
1080   Call StrPoint
1081   ${if} $Pointer != "-1"
1082    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1083    SectionSetFlags ${SecDSorbianD} $0
1084    SectionSetSize ${SecDSorbianD} 0
1085   ${endif}
1086   StrCpy $Search "hsb_DE"
1087   Call StrPoint
1088   ${if} $Pointer != "-1"
1089    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1090    SectionSetFlags ${SecDSorbianH} $0
1091    SectionSetSize ${SecDSorbianH} 0
1092   ${endif}
1093   StrCpy $Search "sq_AL"
1094   Call StrPoint
1095   ${if} $Pointer != "-1"
1096    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1097    SectionSetFlags ${SecDAlbanian} $0
1098    SectionSetSize ${SecDAlbanian} 0
1099   ${endif}
1100   StrCpy $Search "sl_SI"
1101   Call StrPoint
1102   ${if} $Pointer != "-1"
1103    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1104    SectionSetFlags ${SecDSlovenian} $0
1105    SectionSetSize ${SecDSlovenian} 0
1106   ${endif}
1107   StrCpy $Search "sk_SK"
1108   Call StrPoint
1109   ${if} $Pointer != "-1"
1110    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1111    SectionSetFlags ${SecDSlovakian} $0
1112    SectionSetSize ${SecDSlovakian} 0
1113   ${endif}
1114   StrCpy $Search "sr_RS"
1115   Call StrPoint
1116   ${if} $Pointer != "-1"
1117    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1118    SectionSetFlags ${SecDSerbianC} $0
1119    SectionSetSize ${SecDSerbianC} 0
1120   ${endif}
1121   StrCpy $Search "sr_RS-Latin"
1122   Call StrPoint
1123   ${if} $Pointer != "-1"
1124    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1125    SectionSetFlags ${SecDSerbianL} $0
1126    SectionSetSize ${SecDSerbianL} 0
1127   ${endif}
1128   StrCpy $Search "sv_SE"
1129   Call StrPoint
1130   ${if} $Pointer != "-1"
1131    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1132    SectionSetFlags ${SecDSwedish} $0
1133    SectionSetSize ${SecDSwedish} 0
1134   ${endif}
1135   StrCpy $Search "ta_IN"
1136   Call StrPoint
1137   ${if} $Pointer != "-1"
1138    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1139    SectionSetFlags ${SecDTamil} $0
1140    SectionSetSize ${SecDTamil} 0
1141   ${endif}
1142   StrCpy $Search "te_IN"
1143   Call StrPoint
1144   ${if} $Pointer != "-1"
1145    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1146    SectionSetFlags ${SecDTelugu} $0
1147    SectionSetSize ${SecDTelugu} 0
1148   ${endif}
1149   StrCpy $Search "th_TH"
1150   Call StrPoint
1151   ${if} $Pointer != "-1"
1152    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1153    SectionSetFlags ${SecDThai} $0
1154    SectionSetSize ${SecDThai} 0
1155   ${endif}
1156   StrCpy $Search "bo_CN"
1157   Call StrPoint
1158   ${if} $Pointer != "-1"
1159    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1160    SectionSetFlags ${SecDTibetan} $0
1161    SectionSetSize ${SecDTibetan} 0
1162   ${endif}
1163   StrCpy $Search "tk_TM"
1164   Call StrPoint
1165   ${if} $Pointer != "-1"
1166    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1167    SectionSetFlags ${SecDTurkmen} $0
1168    SectionSetSize ${SecDTurkmen} 0
1169   ${endif}
1170   StrCpy $Search "tr_TR"
1171   Call StrPoint
1172   ${if} $Pointer != "-1"
1173    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1174    SectionSetFlags ${SecDTurkish} $0
1175    SectionSetSize ${SecDTurkish} 0
1176   ${endif}
1177   StrCpy $Search "uk_UA"
1178   Call StrPoint
1179   ${if} $Pointer != "-1"
1180    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1181    SectionSetFlags ${SecDUkrainian} $0
1182    SectionSetSize ${SecDUkrainian} 0
1183   ${endif}
1184   StrCpy $Search "ur_PK"
1185   Call StrPoint
1186   ${if} $Pointer != "-1"
1187    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1188    SectionSetFlags ${SecDUrdu} $0
1189    SectionSetSize ${SecDUrdu} 0
1190   ${endif}
1191   StrCpy $Search "vi_VN"
1192   Call StrPoint
1193   ${if} $Pointer != "-1"
1194    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1195    SectionSetFlags ${SecDVietnamese} $0
1196    SectionSetSize ${SecDVietnamese} 0
1197   ${endif}
1198   
1199   # select sections of already installed thesaurus dictionaries, make them read-only
1200   # and set the necessary size to 0 bytes
1201   StrCpy $String $FoundThes
1202   StrCpy $Search "ar_SA"
1203   Call StrPoint # function from LyXUtils.nsh
1204   ${if} $Pointer != "-1"
1205    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1206    SectionSetFlags ${SecTArabic} $0
1207    SectionSetSize ${SecTArabic} 0
1208   ${endif}
1209   StrCpy $Search "bg_BG"
1210   Call StrPoint
1211   ${if} $Pointer != "-1"
1212    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1213    SectionSetFlags ${SecTBulgarian} $0
1214    SectionSetSize ${SecTBulgarian} 0
1215   ${endif}
1216   StrCpy $Search "ca_ES"
1217   Call StrPoint
1218   ${if} $Pointer != "-1"
1219    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1220    SectionSetFlags ${SecTCatalan} $0
1221    SectionSetSize ${SecTCatalan} 0
1222   ${endif}
1223   StrCpy $Search "cs_CZ"
1224   Call StrPoint
1225   ${if} $Pointer != "-1"
1226    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1227    SectionSetFlags ${SecTCzech} $0
1228    SectionSetSize ${SecTCzech} 0
1229   ${endif}
1230   StrCpy $Search "da_DK"
1231   Call StrPoint
1232   ${if} $Pointer != "-1"
1233    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1234    SectionSetFlags ${SecTDanish} $0
1235    SectionSetSize ${SecTDanish} 0
1236   ${endif}
1237   StrCpy $Search "de_DE"
1238   Call StrPoint
1239   ${if} $Pointer != "-1"
1240    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1241    SectionSetFlags ${SecTGermanDA} $0
1242    SectionSetSize ${SecTGermanDA} 0
1243   ${endif} 
1244   StrCpy $Search "de_CH"
1245   Call StrPoint
1246   ${if} $Pointer != "-1"
1247    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1248    SectionSetFlags ${SecTGermanCH} $0
1249    SectionSetSize ${SecTGermanCH} 0
1250   ${endif}
1251   StrCpy $Search "en_AU"
1252   Call StrPoint
1253   ${if} $Pointer != "-1"
1254    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1255    SectionSetFlags ${SecTEnglishAU} $0
1256    SectionSetSize ${SecTEnglishAU} 0
1257   ${endif}
1258   StrCpy $Search "en_GB"
1259   Call StrPoint
1260   ${if} $Pointer != "-1"
1261    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1262    SectionSetFlags ${SecTEnglishGB} $0
1263    SectionSetSize ${SecTEnglishGB} 0
1264   ${endif} 
1265   StrCpy $Search "en_US"
1266   Call StrPoint
1267   ${if} $Pointer != "-1"
1268    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1269    SectionSetFlags ${SecTEnglishUS} $0
1270    SectionSetSize ${SecTEnglishUS} 0
1271   ${endif}
1272   StrCpy $Search "es_ES"
1273   Call StrPoint
1274   ${if} $Pointer != "-1"
1275    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1276    SectionSetFlags ${SecTSpanish} $0
1277    SectionSetSize ${SecTSpanish} 0
1278   ${endif}
1279   StrCpy $Search "fr_FR"
1280   Call StrPoint
1281   ${if} $Pointer != "-1"
1282    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1283    SectionSetFlags ${SecTFrench} $0
1284    SectionSetSize ${SecTFrench} 0
1285   ${endif}
1286   StrCpy $Search "ga_IR"
1287   Call StrPoint
1288   ${if} $Pointer != "-1"
1289    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1290    SectionSetFlags ${SecTGaelic} $0
1291    SectionSetSize ${SecTGaelic} 0
1292   ${endif}
1293   StrCpy $Search "gl_ES"
1294   Call StrPoint
1295   ${if} $Pointer != "-1"
1296    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1297    SectionSetFlags ${SecTGalician} $0
1298    SectionSetSize ${SecTGalician} 0
1299   ${endif}
1300   StrCpy $Search "el_GR"
1301   Call StrPoint
1302   ${if} $Pointer != "-1"
1303    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1304    SectionSetFlags ${SecTGreek} $0
1305    SectionSetSize ${SecTGreek} 0
1306   ${endif}
1307   StrCpy $Search "is_IS"
1308   Call StrPoint
1309   ${if} $Pointer != "-1"
1310    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1311    SectionSetFlags ${SecTIcelandic} $0
1312    SectionSetSize ${SecTIcelandic} 0
1313   ${endif}
1314   StrCpy $Search "it_IT"
1315   Call StrPoint
1316   ${if} $Pointer != "-1"
1317    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1318    SectionSetFlags ${SecTItalian} $0
1319    SectionSetSize ${SecTItalian} 0
1320   ${endif}
1321   StrCpy $Search "hu_HU"
1322   Call StrPoint
1323   ${if} $Pointer != "-1"
1324    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1325    SectionSetFlags ${SecTHungarian} $0
1326    SectionSetSize ${SecTHungarian} 0
1327   ${endif}
1328   StrCpy $Search "nb_NO"
1329   Call StrPoint
1330   ${if} $Pointer != "-1"
1331    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1332    SectionSetFlags ${SecTNorwegianNB} $0
1333    SectionSetSize ${SecTNorwegianNB} 0
1334   ${endif}
1335   StrCpy $Search "nn_NO"
1336   Call StrPoint
1337   ${if} $Pointer != "-1"
1338    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1339    SectionSetFlags ${SecTNorwegianNN} $0
1340    SectionSetSize ${SecTNorwegianNN} 0
1341   ${endif}
1342   StrCpy $Search "pl_PL"
1343   Call StrPoint
1344   ${if} $Pointer != "-1"
1345    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1346    SectionSetFlags ${SecTPolish} $0
1347    SectionSetSize ${SecTPolish} 0
1348   ${endif}
1349   StrCpy $Search "pt_PT"
1350   Call StrPoint
1351   ${if} $Pointer != "-1"
1352    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1353    SectionSetFlags ${SecTPortuguese} $0
1354    SectionSetSize ${SecTPortuguese} 0
1355   ${endif}
1356   StrCpy $Search "ro_RO"
1357   Call StrPoint
1358   ${if} $Pointer != "-1"
1359    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1360    SectionSetFlags ${SecTRomanian} $0
1361    SectionSetSize ${SecTRomanian} 0
1362   ${endif}
1363   StrCpy $Search "ru_RU"
1364   Call StrPoint
1365   ${if} $Pointer != "-1"
1366    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1367    SectionSetFlags ${SecTRussian} $0
1368    SectionSetSize ${SecTRussian} 0
1369   ${endif}
1370   StrCpy $Search "sl_SI"
1371   Call StrPoint
1372   ${if} $Pointer != "-1"
1373    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1374    SectionSetFlags ${SecTSlovenian} $0
1375    SectionSetSize ${SecTSlovenian} 0
1376   ${endif}
1377   StrCpy $Search "sk_SK"
1378   Call StrPoint
1379   ${if} $Pointer != "-1"
1380    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1381    SectionSetFlags ${SecTSlovakian} $0
1382    SectionSetSize ${SecTSlovakian} 0
1383   ${endif}
1384   StrCpy $Search "sv_SE"
1385   Call StrPoint
1386   ${if} $Pointer != "-1"
1387    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1388    SectionSetFlags ${SecTSwedish} $0
1389    SectionSetSize ${SecTSwedish} 0
1390   ${endif}
1391   StrCpy $Search "uk_UA"
1392   Call StrPoint
1393   ${if} $Pointer != "-1"
1394    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1395    SectionSetFlags ${SecTUkrainian} $0
1396    SectionSetSize ${SecTUkrainian} 0
1397   ${endif}
1398   
1399   ${IfNot} ${Silent}
1400     Banner::destroy
1401   ${EndIf}
1402
1403 FunctionEnd
1404
1405 # this function is called at first after starting the uninstaller
1406 Function un.onInit
1407
1408   !insertmacro MULTIUSER_UNINIT
1409
1410   # Check that LyX is not currently running
1411   FindProcDLL::FindProc "${BIN_LYX}"
1412   ${if} $R0 == "1"
1413    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
1414    Abort
1415   ${endif}
1416
1417   # set registry root key
1418   ${if} $MultiUser.Privileges == "Admin"
1419   ${orif} $MultiUser.Privileges == "Power"
1420     SetShellVarContext all
1421   ${else}
1422    SetShellVarContext current
1423   ${endif}
1424
1425   # Ascertain whether the user has sufficient privileges to uninstall.
1426   # abort when LyX was installed with admin permissions but the user doesn't have administrator privileges
1427   ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayVersion"
1428   ${if} $0 != ""
1429   ${andif} $MultiUser.Privileges != "Admin"
1430   ${andif} $MultiUser.Privileges != "Power"
1431    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)" /SD IDOK
1432    Abort
1433   ${endif}
1434   # warning when LyX couldn't be found in the registry
1435   ${if} $0 == "" # check in HKCU
1436    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayVersion"
1437    ${if} $0 == ""
1438      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)" /SD IDOK
1439    ${endif}
1440   ${endif}
1441   
1442   # Macro to investigate name of LyX's preferences folders to be able remove them
1443   !insertmacro UnAppPreSuff $AppPre $AppSuff # macro from LyXUtils.nsh
1444
1445   # test if MiKTeX was installed together with LyX
1446   ReadRegStr $0 SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
1447   ${if} $0 == "Yes${APP_SERIES_KEY}"
1448    SectionSetText 2 "MiKTeX" # names the corersponding uninstaller section
1449    StrCpy $LaTeXInstalled "MiKTeX"
1450   ${else}
1451    SectionSetText 2 "" # hides the corresponding uninstaller section
1452   ${endif}
1453   
1454   # question message if the user really wants to uninstall LyX
1455   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" /SD IDYES IDYES +2 # continue if yes
1456   Abort
1457
1458 FunctionEnd