]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
Win installer: fix installation of Arabic dictionaries.nsh
[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_SA,$DictCodes"
77  AddSize 7304
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 5556
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 6375
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 "العربية" SecTArabic
448  StrCpy $ThesCodes "ar_SA,$ThesCodes"
449  AddSize 799
450 SectionEnd
451
452 Section /o "български" SecTBulgarian
453  StrCpy $ThesCodes "bg_BG,$ThesCodes"
454  AddSize 3020
455 SectionEnd
456
457 Section /o "Català" SecTCatalan
458  StrCpy $ThesCodes "ca_ES,$ThesCodes"
459  AddSize 731
460 SectionEnd
461
462 Section /o "Ceština" SecTCzech
463  StrCpy $ThesCodes "cs_CZ,$ThesCodes"
464  AddSize 635
465 SectionEnd
466
467 Section /o "Dansk" SecTDanish
468  StrCpy $ThesCodes "da_DK,$ThesCodes"
469  AddSize 2360
470 SectionEnd
471
472 Section /o "Deutsch (D/A)" SecTGermanDA
473  StrCpy $ThesCodes "de_DE,$ThesCodes"
474  AddSize 14600
475 SectionEnd
476
477 Section /o "Deutsch (CH)" SecTGermanCH
478  StrCpy $ThesCodes "de_CH,$ThesCodes"
479  AddSize 14600
480 SectionEnd
481
482 Section /o "English (AU)" SecTEnglishAU
483  StrCpy $ThesCodes "en_AU,$ThesCodes"
484  AddSize 21642
485 SectionEnd
486
487 Section /o "English (GB)" SecTEnglishGB
488  StrCpy $ThesCodes "en_GB,$ThesCodes"
489  AddSize 14300
490 SectionEnd
491
492 Section /o "English (US)" SecTEnglishUS
493  StrCpy $ThesCodes "en_US,$ThesCodes"
494  AddSize 22095
495 SectionEnd
496
497 Section /o "Español" SecTSpanish
498  StrCpy $ThesCodes "es_ES,$ThesCodes"
499  AddSize 2860
500 SectionEnd
501
502 Section /o "Français" SecTFrench
503  StrCpy $ThesCodes "fr_FR,$ThesCodes"
504  AddSize 5060
505 SectionEnd
506
507 Section /o "Gaeilge" SecTGaelic
508  StrCpy $ThesCodes "ga_IR,$ThesCodes"
509  AddSize 30600
510 SectionEnd
511
512 Section /o "Galego" SecTGalician
513  StrCpy $ThesCodes "gl_ES,$ThesCodes"
514  AddSize 510
515 SectionEnd
516
517 Section /o "Ελληνικά" SecTGreek
518  StrCpy $ThesCodes "el_GR,$ThesCodes"
519  AddSize 903
520 SectionEnd
521
522 Section /o "Íslenska" SecTIcelandic
523  StrCpy $ThesCodes "is_IS,$ThesCodes"
524  AddSize 63
525 SectionEnd
526
527 Section /o "Italiano" SecTItalian
528  StrCpy $ThesCodes "it_IT,$ThesCodes"
529  AddSize 2520
530 SectionEnd
531
532 Section /o "Magyar" SecTHungarian
533  StrCpy $ThesCodes "hu_HU,$ThesCodes"
534  AddSize 632
535 SectionEnd
536
537 Section /o "Norsk (Bokmål)" SecTNorwegianNB
538  StrCpy $ThesCodes "nb_NO,$ThesCodes"
539  AddSize 2595
540 SectionEnd
541
542 Section /o "Norsk (Nynorsk)" SecTNorwegianNN
543  StrCpy $ThesCodes "nn_NO,$ThesCodes"
544  AddSize 2
545 SectionEnd
546
547 Section /o "Polski" SecTPolish
548  StrCpy $ThesCodes "pl_PL,$ThesCodes"
549  AddSize 5580
550 SectionEnd
551
552 Section /o "Português" SecTPortuguese
553  StrCpy $ThesCodes "pt_PT,$ThesCodes"
554  AddSize 3950
555 SectionEnd
556
557 Section /o "Româna" SecTRomanian
558  StrCpy $ThesCodes "ro_RO,$ThesCodes"
559  AddSize 3650
560 SectionEnd
561
562 Section /o "Русский" SecTRussian
563  StrCpy $ThesCodes "ru_RU,$ThesCodes"
564  AddSize 2080
565 SectionEnd
566
567 Section /o "Slovenšcina" SecTSlovenian
568  StrCpy $ThesCodes "sl_SI,$ThesCodes"
569  AddSize 1110
570 SectionEnd
571
572 Section /o "Slovenský" SecTSlovakian
573  StrCpy $ThesCodes "sk_SK,$ThesCodes"
574  AddSize 930
575 SectionEnd
576
577 Section /o "Svenska" SecTSwedish
578  StrCpy $ThesCodes "sv_SE,$ThesCodes"
579  AddSize 720
580 SectionEnd
581
582 Section /o "Українська" SecTUkrainian
583  StrCpy $ThesCodes "uk_UA,$ThesCodes"
584  AddSize 1339
585 SectionEnd
586
587 SectionGroupEnd
588
589 # Section descriptions
590 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
591 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
592 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
593 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
594 !insertmacro MUI_DESCRIPTION_TEXT ${SecDictionaries} "$(SecDictionariesDescription)"
595 !insertmacro MUI_DESCRIPTION_TEXT ${SecThesaurus} "$(SecThesaurusDescription)"
596 !insertmacro MUI_FUNCTION_DESCRIPTION_END
597
598
599 # .onInit must be here after the section definition because we have to set
600 # the selection states of the dictionary sections
601 Function .onInit
602
603   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
604   ${if} $R0 == "5.0" # 2000
605   ${orif} $R0 == "5.1" # XP
606   ${orif} $R0 == "5.2" # 2003
607   ${orif} $R0 == "6.0" # Vista
608     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 7 or newer." /SD IDOK
609     Quit
610   ${endif}
611   
612   # check that another LyX installer is not currently running
613   !if ${SETUPTYPE} == STANDARD
614    FindProcDLL::FindProc "${BundleExeFile}"
615    ${if} $R0 == "1"
616     MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)" /SD IDOK
617     Abort
618    ${endif}
619   !endif
620   !if ${SETUPTYPE} == BUNDLE
621    FindProcDLL::FindProc "${ExeFile}"
622    ${if} $R0 == "1"
623     MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)" /SD IDOK
624     Abort
625    ${endif}
626   !endif
627   
628   # Check that LyX is not currently running
629   FindProcDLL::FindProc "${BIN_LYX}"
630   ${if} $R0 == "1"
631    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
632    Abort
633   ${endif}
634   
635   # read the user and computer name
636   ReadRegStr $ComputerName HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
637   System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
638   StrCpy $UserName $0
639   
640   !insertmacro MULTIUSER_INIT
641   
642   # check if this LyX version is already installed
643   ${if} $MultiUser.Privileges == "Admin"
644   ${orif} $MultiUser.Privileges == "Power"
645    ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
646   ${else}
647    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayIcon"
648    # handle also the case that LyX is already installed in HKLM
649    ${if} $0 == ""
650     ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
651    ${endif}
652   ${endif}
653   ${if} $0 != ""
654    # check if the uninstaller was acidentally deleted
655    # if so don't bother the user if he realy wants to install a new LyX over an existing one
656    # because he won't have a chance to deny this
657    StrCpy $4 $0 -10 # remove '\bin\lyx,0'
658    # (for FileCheck the variables $0 and $1 cannot be used)
659    !insertmacro FileCheck $5 "Uninstall-${APP_NAME}.exe" "$4" # macro from LyXUtils.nsh
660    ${if} $5 == "False"
661     Goto ForceInstallation
662    ${endif}
663    # installing over an existing installation of the same LyX release is not necessary
664    # if the users does this he most probably has a problem with LyX that can better be solved
665    # by reinstalling LyX
666    # for beta and other test releases over-installing can even cause errors
667    MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION "$(AlreadyInstalled)" /SD IDNO IDYES ForceInstallation 
668    Abort
669    ForceInstallation:
670   ${endif}
671   
672   # check if there is an existing LyX installation of the same LyX series
673   # we usually don't release more than 10 versions so with 20 we are safe to check if a newer version is installed
674   IntOp $4 ${APP_VERSION_REVISION} + 20
675   ${for} $5 0 $4
676    ${if} $MultiUser.Privileges == "Admin"
677    ${orif} $MultiUser.Privileges == "Power"
678     ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
679     # also check for an emergency release
680     ${if} $0 == ""
681      ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
682     ${endif}
683    ${else}
684     ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
685     # also check for an emergency release
686     ${if} $0 == ""
687      ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
688     ${endif}
689    ${endif}
690    ${if} $0 != ""
691     StrCpy $R5 $0 # store the read version number
692     StrCpy $OldVersionNumber "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5"
693     # we don't stop here because we want the latest installed version
694    ${endif} 
695   ${next}
696   
697   ${if} $OldVersionNumber > ${APP_SERIES_KEY}
698    # store the version number and reformat it temporarily for the error message
699    StrCpy $R0 $OldVersionNumber
700    StrCpy $OldVersionNumber $R5
701    MessageBox MB_OK|MB_ICONSTOP "$(NewerInstalled)" /SD IDOK
702    StrCpy $OldVersionNumber $R0
703    Abort
704   ${endif}
705
706   # this can be reset to "true" in section SecDesktop
707   StrCpy $CreateDesktopIcon "false"
708   StrCpy $CreateFileAssociations "false"
709  
710   ${IfNot} ${Silent}
711     # Show banner while installer is intializating 
712     Banner::show /NOUNLOAD "Checking system"
713   ${EndIf}
714  
715   Call SearchExternal
716   
717   #!if ${SETUPTYPE} == BUNDLE
718   # # don't let the installer sections appear when the programs are already installed
719   # ${if} $PathBibTeXEditor != ""
720   #  SectionSetText 3 "" # hides the corresponding uninstaller section, ${SecInstJabRef}
721   # ${endif}
722   #!endif
723   
724   # select sections of already installed spell-checker dictionaries, make them read-only
725   # and set the necessary size to 0 bytes
726   StrCpy $String $FoundDict
727   StrCpy $Search "af_ZA"
728   Call StrPoint # function from LyXUtils.nsh
729   ${if} $Pointer != "-1"
730    IntOp $0 ${SF_SELECTED} | ${SF_RO}
731    SectionSetFlags ${SecDAfrikaans} $0
732    SectionSetSize ${SecDAfrikaans} 0
733   ${endif}
734   StrCpy $Search "ar_SA"
735   Call StrPoint
736   ${if} $Pointer != "-1"
737    IntOp $0 ${SF_SELECTED} | ${SF_RO}
738    SectionSetFlags ${SecDArabic} $0
739    SectionSetSize ${SecDArabic} 0
740   ${endif}
741   StrCpy $Search "hy_AM"
742   Call StrPoint
743   ${if} $Pointer != "-1"
744    IntOp $0 ${SF_SELECTED} | ${SF_RO}
745    SectionSetFlags ${SecDArmenian} $0
746    SectionSetSize ${SecDArmenian} 0
747   ${endif}
748   StrCpy $Search "id_ID"
749   Call StrPoint
750   ${if} $Pointer != "-1"
751    IntOp $0 ${SF_SELECTED} | ${SF_RO}
752    SectionSetFlags ${SecDIndonesian} $0
753    SectionSetSize ${SecDIndonesian} 0
754   ${endif}
755   StrCpy $Search "ms_MY"
756   Call StrPoint
757   ${if} $Pointer != "-1"
758    IntOp $0 ${SF_SELECTED} | ${SF_RO}
759    SectionSetFlags ${SecDMalayan} $0
760    SectionSetSize ${SecDMalayan} 0
761   ${endif}
762   StrCpy $Search "be_BY"
763   Call StrPoint
764   ${if} $Pointer != "-1"
765    IntOp $0 ${SF_SELECTED} | ${SF_RO}
766    SectionSetFlags ${SecDBelarusian} $0
767    SectionSetSize ${SecDBelarusian} 0
768   ${endif}
769   StrCpy $Search "br_FR"
770   Call StrPoint
771   ${if} $Pointer != "-1"
772    IntOp $0 ${SF_SELECTED} | ${SF_RO}
773    SectionSetFlags ${SecDBreton} $0
774    SectionSetSize ${SecDBreton} 0
775   ${endif}
776   StrCpy $Search "bg_BG"
777   Call StrPoint
778   ${if} $Pointer != "-1"
779    IntOp $0 ${SF_SELECTED} | ${SF_RO}
780    SectionSetFlags ${SecDBulgarian} $0
781    SectionSetSize ${SecDBulgarian} 0
782   ${endif}
783   StrCpy $Search "ca_ES"
784   Call StrPoint
785   ${if} $Pointer != "-1"
786    IntOp $0 ${SF_SELECTED} | ${SF_RO}
787    SectionSetFlags ${SecDCatalanian} $0
788    SectionSetSize ${SecDCatalanian} 0
789   ${endif}
790   StrCpy $Search "cs_CZ"
791   Call StrPoint
792   ${if} $Pointer != "-1"
793    IntOp $0 ${SF_SELECTED} | ${SF_RO}
794    SectionSetFlags ${SecDCzech} $0
795    SectionSetSize ${SecDCzech} 0
796   ${endif}
797  
798   StrCpy $Search "cop_EG"
799   Call StrPoint
800   ${if} $Pointer != "-1"
801    IntOp $0 ${SF_SELECTED} | ${SF_RO}
802    SectionSetFlags ${SecDCoptic} $0
803    SectionSetSize ${SecDCoptic} 0
804   ${endif}
805   StrCpy $Search "cy_GB"
806   Call StrPoint
807   ${if} $Pointer != "-1"
808    IntOp $0 ${SF_SELECTED} | ${SF_RO}
809    SectionSetFlags ${SecDWelsh} $0
810    SectionSetSize ${SecDWelsh} 0
811   ${endif}
812   StrCpy $Search "da_DK"
813   Call StrPoint
814   ${if} $Pointer != "-1"
815    IntOp $0 ${SF_SELECTED} | ${SF_RO}
816    SectionSetFlags ${SecDDanish} $0
817    SectionSetSize ${SecDDanish} 0
818   ${endif}
819   StrCpy $Search "de_AT"
820   Call StrPoint
821   ${if} $Pointer != "-1"
822    IntOp $0 ${SF_SELECTED} | ${SF_RO}
823    SectionSetFlags ${SecDGermanAT} $0
824    SectionSetSize ${SecDGermanAT} 0
825   ${endif}
826   StrCpy $Search "de_CH"
827   Call StrPoint
828   ${if} $Pointer != "-1"
829    IntOp $0 ${SF_SELECTED} | ${SF_RO}
830    SectionSetFlags ${SecDGermanCH} $0
831    SectionSetSize ${SecDGermanCH} 0
832   ${endif}
833   StrCpy $Search "de_DE"
834   Call StrPoint
835   ${if} $Pointer != "-1"
836    IntOp $0 ${SF_SELECTED} | ${SF_RO}
837    SectionSetFlags ${SecDGermanD} $0
838    SectionSetSize ${SecDGermanD} 0
839   ${endif}
840   StrCpy $Search "el_GR"
841   Call StrPoint
842   ${if} $Pointer != "-1"
843    IntOp $0 ${SF_SELECTED} | ${SF_RO}
844    SectionSetFlags ${SecDGreek} $0
845    SectionSetSize ${SecDGreek} 0
846   ${endif}
847   StrCpy $Search "et_EE"
848   Call StrPoint
849   ${if} $Pointer != "-1"
850    IntOp $0 ${SF_SELECTED} | ${SF_RO}
851    SectionSetFlags ${SecDEstonian} $0
852    SectionSetSize ${SecDEstonian} 0
853   ${endif}
854   StrCpy $Search "en_AU"
855   Call StrPoint
856   ${if} $Pointer != "-1"
857    IntOp $0 ${SF_SELECTED} | ${SF_RO}
858    SectionSetFlags ${SecDEnglishAU} $0
859    SectionSetSize ${SecDEnglishAU} 0
860   ${endif}
861   StrCpy $Search "en_CA"
862   Call StrPoint
863   ${if} $Pointer != "-1"
864    IntOp $0 ${SF_SELECTED} | ${SF_RO}
865    SectionSetFlags ${SecDEnglishCA} $0
866    SectionSetSize ${SecDEnglishCA} 0
867   ${endif}
868   StrCpy $Search "en_GB"
869   Call StrPoint
870   ${if} $Pointer != "-1"
871    IntOp $0 ${SF_SELECTED} | ${SF_RO}
872    SectionSetFlags ${SecDEnglishGB} $0
873    SectionSetSize ${SecDEnglishGB} 0
874   ${endif}
875   StrCpy $Search "en_NZ"
876   Call StrPoint
877   ${if} $Pointer != "-1"
878    IntOp $0 ${SF_SELECTED} | ${SF_RO}
879    SectionSetFlags ${SecDEnglishNZ} $0
880    SectionSetSize ${SecDEnglishNZ} 0
881   ${endif}
882   StrCpy $Search "en_US"
883   Call StrPoint
884   ${if} $Pointer != "-1"
885    IntOp $0 ${SF_SELECTED} | ${SF_RO}
886    SectionSetFlags ${SecDEnglishUS} $0
887    SectionSetSize ${SecDEnglishUS} 0
888   ${endif}
889   StrCpy $Search "es_ES"
890   Call StrPoint
891   ${if} $Pointer != "-1"
892    IntOp $0 ${SF_SELECTED} | ${SF_RO}
893    SectionSetFlags ${SecDSpanishES} $0
894    SectionSetSize ${SecDSpanishES} 0
895   ${endif}
896   StrCpy $Search "es_MX"
897   Call StrPoint
898   ${if} $Pointer != "-1"
899    IntOp $0 ${SF_SELECTED} | ${SF_RO}
900    SectionSetFlags ${SecDSpanishMX} $0
901    SectionSetSize ${SecDSpanishMX} 0
902   ${endif}
903   StrCpy $Search "eo_EO"
904   Call StrPoint
905   ${if} $Pointer != "-1"
906    IntOp $0 ${SF_SELECTED} | ${SF_RO}
907    SectionSetFlags ${SecDEsperanto} $0
908    SectionSetSize ${SecDEsperanto} 0
909   ${endif}
910   StrCpy $Search "eu_ES"
911   Call StrPoint
912   ${if} $Pointer != "-1"
913    IntOp $0 ${SF_SELECTED} | ${SF_RO}
914    SectionSetFlags ${SecDBasque} $0
915    SectionSetSize ${SecDBasque} 0
916   ${endif}
917   StrCpy $Search "fa_IR"
918   Call StrPoint
919   ${if} $Pointer != "-1"
920    IntOp $0 ${SF_SELECTED} | ${SF_RO}
921    SectionSetFlags ${SecDFarsi} $0
922    SectionSetSize ${SecDFarsi} 0
923   ${endif}
924   StrCpy $Search "fr_CA"
925   Call StrPoint
926   ${if} $Pointer != "-1"
927    IntOp $0 ${SF_SELECTED} | ${SF_RO}
928    SectionSetFlags ${SecDFrenchCanada} $0
929    SectionSetSize ${SecDFrenchCanada} 0
930   ${endif}
931   StrCpy $Search "fr_FR"
932   Call StrPoint
933   ${if} $Pointer != "-1"
934    IntOp $0 ${SF_SELECTED} | ${SF_RO}
935    SectionSetFlags ${SecDFrench} $0
936    SectionSetSize ${SecDFrench} 0
937   ${endif}
938   StrCpy $Search "ga_IR"
939   Call StrPoint
940   ${if} $Pointer != "-1"
941    IntOp $0 ${SF_SELECTED} | ${SF_RO}
942    SectionSetFlags ${SecDGaelic} $0
943    SectionSetSize ${SecDGaelic} 0
944   ${endif}
945   StrCpy $Search "gd_GB"
946   Call StrPoint
947   ${if} $Pointer != "-1"
948    IntOp $0 ${SF_SELECTED} | ${SF_RO}
949    SectionSetFlags ${SecDScottish} $0
950    SectionSetSize ${SecDScottish} 0
951   ${endif}
952   StrCpy $Search "gl_ES"
953   Call StrPoint
954   ${if} $Pointer != "-1"
955    IntOp $0 ${SF_SELECTED} | ${SF_RO}
956    SectionSetFlags ${SecDGalician} $0
957    SectionSetSize ${SecDGalician} 0
958   ${endif}
959   StrCpy $Search "he_IL"
960   Call StrPoint
961   ${if} $Pointer != "-1"
962    IntOp $0 ${SF_SELECTED} | ${SF_RO}
963    SectionSetFlags ${SecDHebrew} $0
964    SectionSetSize ${SecDHebrew} 0
965   ${endif}
966   StrCpy $Search "hi_IN"
967   Call StrPoint
968   ${if} $Pointer != "-1"
969    IntOp $0 ${SF_SELECTED} | ${SF_RO}
970    SectionSetFlags ${SecDHindi} $0
971    SectionSetSize ${SecDHindi} 0
972   ${endif}
973   StrCpy $Search "hr_HR"
974   Call StrPoint
975   ${if} $Pointer != "-1"
976    IntOp $0 ${SF_SELECTED} | ${SF_RO}
977    SectionSetFlags ${SecDCroatian} $0
978    SectionSetSize ${SecDCroatian} 0
979   ${endif}
980   StrCpy $Search "hu_HU"
981   Call StrPoint
982   ${if} $Pointer != "-1"
983    IntOp $0 ${SF_SELECTED} | ${SF_RO}
984    SectionSetFlags ${SecDHungarian} $0
985    SectionSetSize ${SecDHungarian} 0
986   ${endif}
987   StrCpy $Search "ia_IA"
988   Call StrPoint
989   ${if} $Pointer != "-1"
990    IntOp $0 ${SF_SELECTED} | ${SF_RO}
991    SectionSetFlags ${SecDInterlingua} $0
992    SectionSetSize ${SecDInterlingua} 0
993   ${endif}
994   StrCpy $Search "is_IS"
995   Call StrPoint
996   ${if} $Pointer != "-1"
997    IntOp $0 ${SF_SELECTED} | ${SF_RO}
998    SectionSetFlags ${SecDIcelandic} $0
999    SectionSetSize ${SecDIcelandic} 0
1000   ${endif}
1001   StrCpy $Search "it_IT"
1002   Call StrPoint
1003   ${if} $Pointer != "-1"
1004    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1005    SectionSetFlags ${SecDItalian} $0
1006    SectionSetSize ${SecDItalian} 0
1007   ${endif}
1008   StrCpy $Search "kk_KZ"
1009   Call StrPoint
1010   ${if} $Pointer != "-1"
1011    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1012    SectionSetFlags ${SecDKazakh} $0
1013    SectionSetSize ${SecDKazakh} 0
1014   ${endif}
1015   StrCpy $Search "ko_KR"
1016   Call StrPoint
1017   ${if} $Pointer != "-1"
1018    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1019    SectionSetFlags ${SecDKorean} $0
1020    SectionSetSize ${SecDKorean} 0
1021   ${endif}
1022   StrCpy $Search "la_LA"
1023   Call StrPoint
1024   ${if} $Pointer != "-1"
1025    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1026    SectionSetFlags ${SecDLatin} $0
1027    SectionSetSize ${SecDLatin} 0
1028   ${endif}
1029   StrCpy $Search "lt_LT"
1030   Call StrPoint
1031   ${if} $Pointer != "-1"
1032    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1033    SectionSetFlags ${SecDLithuanian} $0
1034    SectionSetSize ${SecDLithuanian} 0
1035   ${endif}
1036   StrCpy $Search "lv_LV"
1037   Call StrPoint
1038   ${if} $Pointer != "-1"
1039    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1040    SectionSetFlags ${SecDLatvian} $0
1041    SectionSetSize ${SecDLatvian} 0
1042   ${endif}
1043   StrCpy $Search "mr_IN"
1044   Call StrPoint
1045   ${if} $Pointer != "-1"
1046    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1047    SectionSetFlags ${SecDMarathi} $0
1048    SectionSetSize ${SecDMarathi} 0
1049   ${endif}
1050   StrCpy $Search "nl_NL"
1051   Call StrPoint
1052   ${if} $Pointer != "-1"
1053    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1054    SectionSetFlags ${SecDDutch} $0
1055    SectionSetSize ${SecDDutch} 0
1056   ${endif}
1057   StrCpy $Search "nb_NO"
1058   Call StrPoint
1059   ${if} $Pointer != "-1"
1060    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1061    SectionSetFlags ${SecDNorwegianNB} $0
1062    SectionSetSize ${SecDNorwegianNB} 0
1063   ${endif}
1064   StrCpy $Search "nn_NO"
1065   Call StrPoint
1066   ${if} $Pointer != "-1"
1067    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1068    SectionSetFlags ${SecDNorwegianNN} $0
1069    SectionSetSize ${SecDNorwegianNN} 0
1070   ${endif}
1071   StrCpy $Search "oc_FR"
1072   Call StrPoint
1073   ${if} $Pointer != "-1"
1074    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1075    SectionSetFlags ${SecDOccitan} $0
1076    SectionSetSize ${SecDOccitan} 0
1077   ${endif}
1078   StrCpy $Search "pl_PL"
1079   Call StrPoint
1080   ${if} $Pointer != "-1"
1081    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1082    SectionSetFlags ${SecDPolish} $0
1083    SectionSetSize ${SecDPolish} 0
1084   ${endif}
1085   StrCpy $Search "pt_BR"
1086   Call StrPoint
1087   ${if} $Pointer != "-1"
1088    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1089    SectionSetFlags ${SecDPortugueseBR} $0
1090    SectionSetSize ${SecDPortugueseBR} 0
1091   ${endif}
1092   StrCpy $Search "pt_PT"
1093   Call StrPoint
1094   ${if} $Pointer != "-1"
1095    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1096    SectionSetFlags ${SecDPortuguesePT} $0
1097    SectionSetSize ${SecDPortuguesePT} 0
1098   ${endif}
1099   StrCpy $Search "ro_RO"
1100   Call StrPoint
1101   ${if} $Pointer != "-1"
1102    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1103    SectionSetFlags ${SecDRomanian} $0
1104    SectionSetSize ${SecDRomanian} 0
1105   ${endif}
1106   StrCpy $Search "ru_RU"
1107   Call StrPoint
1108   ${if} $Pointer != "-1"
1109    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1110    SectionSetFlags ${SecDRussian} $0
1111    SectionSetSize ${SecDRussian} 0
1112   ${endif}
1113   StrCpy $Search "dsb_DE"
1114   Call StrPoint
1115   ${if} $Pointer != "-1"
1116    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1117    SectionSetFlags ${SecDSorbianD} $0
1118    SectionSetSize ${SecDSorbianD} 0
1119   ${endif}
1120   StrCpy $Search "hsb_DE"
1121   Call StrPoint
1122   ${if} $Pointer != "-1"
1123    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1124    SectionSetFlags ${SecDSorbianH} $0
1125    SectionSetSize ${SecDSorbianH} 0
1126   ${endif}
1127   StrCpy $Search "sq_AL"
1128   Call StrPoint
1129   ${if} $Pointer != "-1"
1130    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1131    SectionSetFlags ${SecDAlbanian} $0
1132    SectionSetSize ${SecDAlbanian} 0
1133   ${endif}
1134   StrCpy $Search "sl_SI"
1135   Call StrPoint
1136   ${if} $Pointer != "-1"
1137    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1138    SectionSetFlags ${SecDSlovenian} $0
1139    SectionSetSize ${SecDSlovenian} 0
1140   ${endif}
1141   StrCpy $Search "sk_SK"
1142   Call StrPoint
1143   ${if} $Pointer != "-1"
1144    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1145    SectionSetFlags ${SecDSlovakian} $0
1146    SectionSetSize ${SecDSlovakian} 0
1147   ${endif}
1148   StrCpy $Search "sr_RS"
1149   Call StrPoint
1150   ${if} $Pointer != "-1"
1151    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1152    SectionSetFlags ${SecDSerbianC} $0
1153    SectionSetSize ${SecDSerbianC} 0
1154   ${endif}
1155   StrCpy $Search "sr_RS-Latin"
1156   Call StrPoint
1157   ${if} $Pointer != "-1"
1158    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1159    SectionSetFlags ${SecDSerbianL} $0
1160    SectionSetSize ${SecDSerbianL} 0
1161   ${endif}
1162   StrCpy $Search "sv_SE"
1163   Call StrPoint
1164   ${if} $Pointer != "-1"
1165    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1166    SectionSetFlags ${SecDSwedish} $0
1167    SectionSetSize ${SecDSwedish} 0
1168   ${endif}
1169   StrCpy $Search "ta_IN"
1170   Call StrPoint
1171   ${if} $Pointer != "-1"
1172    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1173    SectionSetFlags ${SecDTamil} $0
1174    SectionSetSize ${SecDTamil} 0
1175   ${endif}
1176   StrCpy $Search "te_IN"
1177   Call StrPoint
1178   ${if} $Pointer != "-1"
1179    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1180    SectionSetFlags ${SecDTelugu} $0
1181    SectionSetSize ${SecDTelugu} 0
1182   ${endif}
1183   StrCpy $Search "th_TH"
1184   Call StrPoint
1185   ${if} $Pointer != "-1"
1186    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1187    SectionSetFlags ${SecDThai} $0
1188    SectionSetSize ${SecDThai} 0
1189   ${endif}
1190   StrCpy $Search "bo_CN"
1191   Call StrPoint
1192   ${if} $Pointer != "-1"
1193    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1194    SectionSetFlags ${SecDTibetan} $0
1195    SectionSetSize ${SecDTibetan} 0
1196   ${endif}
1197   StrCpy $Search "tk_TM"
1198   Call StrPoint
1199   ${if} $Pointer != "-1"
1200    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1201    SectionSetFlags ${SecDTurkmen} $0
1202    SectionSetSize ${SecDTurkmen} 0
1203   ${endif}
1204   StrCpy $Search "tr_TR"
1205   Call StrPoint
1206   ${if} $Pointer != "-1"
1207    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1208    SectionSetFlags ${SecDTurkish} $0
1209    SectionSetSize ${SecDTurkish} 0
1210   ${endif}
1211   StrCpy $Search "uk_UA"
1212   Call StrPoint
1213   ${if} $Pointer != "-1"
1214    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1215    SectionSetFlags ${SecDUkrainian} $0
1216    SectionSetSize ${SecDUkrainian} 0
1217   ${endif}
1218   StrCpy $Search "ur_PK"
1219   Call StrPoint
1220   ${if} $Pointer != "-1"
1221    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1222    SectionSetFlags ${SecDUrdu} $0
1223    SectionSetSize ${SecDUrdu} 0
1224   ${endif}
1225   StrCpy $Search "vi_VN"
1226   Call StrPoint
1227   ${if} $Pointer != "-1"
1228    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1229    SectionSetFlags ${SecDVietnamese} $0
1230    SectionSetSize ${SecDVietnamese} 0
1231   ${endif}
1232   
1233   # select sections of already installed thesaurus dictionaries, make them read-only
1234   # and set the necessary size to 0 bytes
1235   StrCpy $String $FoundThes
1236   StrCpy $Search "ar_SA"
1237   Call StrPoint # function from LyXUtils.nsh
1238   ${if} $Pointer != "-1"
1239    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1240    SectionSetFlags ${SecTArabic} $0
1241    SectionSetSize ${SecTArabic} 0
1242   ${endif}
1243   StrCpy $Search "bg_BG"
1244   Call StrPoint
1245   ${if} $Pointer != "-1"
1246    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1247    SectionSetFlags ${SecTBulgarian} $0
1248    SectionSetSize ${SecTBulgarian} 0
1249   ${endif}
1250   StrCpy $Search "ca_ES"
1251   Call StrPoint
1252   ${if} $Pointer != "-1"
1253    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1254    SectionSetFlags ${SecTCatalan} $0
1255    SectionSetSize ${SecTCatalan} 0
1256   ${endif}
1257   StrCpy $Search "cs_CZ"
1258   Call StrPoint
1259   ${if} $Pointer != "-1"
1260    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1261    SectionSetFlags ${SecTCzech} $0
1262    SectionSetSize ${SecTCzech} 0
1263   ${endif}
1264   StrCpy $Search "da_DK"
1265   Call StrPoint
1266   ${if} $Pointer != "-1"
1267    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1268    SectionSetFlags ${SecTDanish} $0
1269    SectionSetSize ${SecTDanish} 0
1270   ${endif}
1271   StrCpy $Search "de_DE"
1272   Call StrPoint
1273   ${if} $Pointer != "-1"
1274    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1275    SectionSetFlags ${SecTGermanDA} $0
1276    SectionSetSize ${SecTGermanDA} 0
1277   ${endif} 
1278   StrCpy $Search "de_CH"
1279   Call StrPoint
1280   ${if} $Pointer != "-1"
1281    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1282    SectionSetFlags ${SecTGermanCH} $0
1283    SectionSetSize ${SecTGermanCH} 0
1284   ${endif}
1285   StrCpy $Search "en_AU"
1286   Call StrPoint
1287   ${if} $Pointer != "-1"
1288    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1289    SectionSetFlags ${SecTEnglishAU} $0
1290    SectionSetSize ${SecTEnglishAU} 0
1291   ${endif}
1292   StrCpy $Search "en_GB"
1293   Call StrPoint
1294   ${if} $Pointer != "-1"
1295    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1296    SectionSetFlags ${SecTEnglishGB} $0
1297    SectionSetSize ${SecTEnglishGB} 0
1298   ${endif} 
1299   StrCpy $Search "en_US"
1300   Call StrPoint
1301   ${if} $Pointer != "-1"
1302    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1303    SectionSetFlags ${SecTEnglishUS} $0
1304    SectionSetSize ${SecTEnglishUS} 0
1305   ${endif}
1306   StrCpy $Search "es_ES"
1307   Call StrPoint
1308   ${if} $Pointer != "-1"
1309    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1310    SectionSetFlags ${SecTSpanish} $0
1311    SectionSetSize ${SecTSpanish} 0
1312   ${endif}
1313   StrCpy $Search "fr_FR"
1314   Call StrPoint
1315   ${if} $Pointer != "-1"
1316    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1317    SectionSetFlags ${SecTFrench} $0
1318    SectionSetSize ${SecTFrench} 0
1319   ${endif}
1320   StrCpy $Search "ga_IR"
1321   Call StrPoint
1322   ${if} $Pointer != "-1"
1323    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1324    SectionSetFlags ${SecTGaelic} $0
1325    SectionSetSize ${SecTGaelic} 0
1326   ${endif}
1327   StrCpy $Search "gl_ES"
1328   Call StrPoint
1329   ${if} $Pointer != "-1"
1330    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1331    SectionSetFlags ${SecTGalician} $0
1332    SectionSetSize ${SecTGalician} 0
1333   ${endif}
1334   StrCpy $Search "el_GR"
1335   Call StrPoint
1336   ${if} $Pointer != "-1"
1337    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1338    SectionSetFlags ${SecTGreek} $0
1339    SectionSetSize ${SecTGreek} 0
1340   ${endif}
1341   StrCpy $Search "is_IS"
1342   Call StrPoint
1343   ${if} $Pointer != "-1"
1344    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1345    SectionSetFlags ${SecTIcelandic} $0
1346    SectionSetSize ${SecTIcelandic} 0
1347   ${endif}
1348   StrCpy $Search "it_IT"
1349   Call StrPoint
1350   ${if} $Pointer != "-1"
1351    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1352    SectionSetFlags ${SecTItalian} $0
1353    SectionSetSize ${SecTItalian} 0
1354   ${endif}
1355   StrCpy $Search "hu_HU"
1356   Call StrPoint
1357   ${if} $Pointer != "-1"
1358    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1359    SectionSetFlags ${SecTHungarian} $0
1360    SectionSetSize ${SecTHungarian} 0
1361   ${endif}
1362   StrCpy $Search "nb_NO"
1363   Call StrPoint
1364   ${if} $Pointer != "-1"
1365    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1366    SectionSetFlags ${SecTNorwegianNB} $0
1367    SectionSetSize ${SecTNorwegianNB} 0
1368   ${endif}
1369   StrCpy $Search "nn_NO"
1370   Call StrPoint
1371   ${if} $Pointer != "-1"
1372    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1373    SectionSetFlags ${SecTNorwegianNN} $0
1374    SectionSetSize ${SecTNorwegianNN} 0
1375   ${endif}
1376   StrCpy $Search "pl_PL"
1377   Call StrPoint
1378   ${if} $Pointer != "-1"
1379    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1380    SectionSetFlags ${SecTPolish} $0
1381    SectionSetSize ${SecTPolish} 0
1382   ${endif}
1383   StrCpy $Search "pt_PT"
1384   Call StrPoint
1385   ${if} $Pointer != "-1"
1386    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1387    SectionSetFlags ${SecTPortuguese} $0
1388    SectionSetSize ${SecTPortuguese} 0
1389   ${endif}
1390   StrCpy $Search "ro_RO"
1391   Call StrPoint
1392   ${if} $Pointer != "-1"
1393    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1394    SectionSetFlags ${SecTRomanian} $0
1395    SectionSetSize ${SecTRomanian} 0
1396   ${endif}
1397   StrCpy $Search "ru_RU"
1398   Call StrPoint
1399   ${if} $Pointer != "-1"
1400    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1401    SectionSetFlags ${SecTRussian} $0
1402    SectionSetSize ${SecTRussian} 0
1403   ${endif}
1404   StrCpy $Search "sl_SI"
1405   Call StrPoint
1406   ${if} $Pointer != "-1"
1407    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1408    SectionSetFlags ${SecTSlovenian} $0
1409    SectionSetSize ${SecTSlovenian} 0
1410   ${endif}
1411   StrCpy $Search "sk_SK"
1412   Call StrPoint
1413   ${if} $Pointer != "-1"
1414    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1415    SectionSetFlags ${SecTSlovakian} $0
1416    SectionSetSize ${SecTSlovakian} 0
1417   ${endif}
1418   StrCpy $Search "sv_SE"
1419   Call StrPoint
1420   ${if} $Pointer != "-1"
1421    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1422    SectionSetFlags ${SecTSwedish} $0
1423    SectionSetSize ${SecTSwedish} 0
1424   ${endif}
1425   StrCpy $Search "uk_UA"
1426   Call StrPoint
1427   ${if} $Pointer != "-1"
1428    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1429    SectionSetFlags ${SecTUkrainian} $0
1430    SectionSetSize ${SecTUkrainian} 0
1431   ${endif}
1432   
1433   ${IfNot} ${Silent}
1434     Banner::destroy
1435   ${EndIf}
1436
1437 FunctionEnd
1438
1439 # this function is called at first after starting the uninstaller
1440 Function un.onInit
1441
1442   !insertmacro MULTIUSER_UNINIT
1443
1444   # Check that LyX is not currently running
1445   FindProcDLL::FindProc "${BIN_LYX}"
1446   ${if} $R0 == "1"
1447    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
1448    Abort
1449   ${endif}
1450
1451   # set registry root key
1452   ${if} $MultiUser.Privileges == "Admin"
1453   ${orif} $MultiUser.Privileges == "Power"
1454     SetShellVarContext all
1455   ${else}
1456    SetShellVarContext current
1457   ${endif}
1458
1459   # Ascertain whether the user has sufficient privileges to uninstall.
1460   # abort when LyX was installed with admin permissions but the user doesn't have administrator privileges
1461   ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayVersion"
1462   ${if} $0 != ""
1463   ${andif} $MultiUser.Privileges != "Admin"
1464   ${andif} $MultiUser.Privileges != "Power"
1465    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)" /SD IDOK
1466    Abort
1467   ${endif}
1468   # warning when LyX couldn't be found in the registry
1469   ${if} $0 == "" # check in HKCU
1470    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayVersion"
1471    ${if} $0 == ""
1472      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)" /SD IDOK
1473    ${endif}
1474   ${endif}
1475   
1476   # Macro to investigate name of LyX's preferences folders to be able remove them
1477   !insertmacro UnAppPreSuff $AppPre $AppSuff # macro from LyXUtils.nsh
1478
1479   # test if MiKTeX was installed together with LyX
1480   ReadRegStr $0 SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
1481   ${if} $0 == "Yes${APP_SERIES_KEY}"
1482    SectionSetText 2 "MiKTeX" # names the corersponding uninstaller section
1483    StrCpy $LaTeXInstalled "MiKTeX"
1484   ${else}
1485    SectionSetText 2 "" # hides the corresponding uninstaller section
1486   ${endif}
1487   
1488   # question message if the user really wants to uninstall LyX
1489   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" /SD IDYES IDYES +2 # continue if yes
1490   Abort
1491
1492 FunctionEnd