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