]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
Changed main registry entry (LyX\Version now).
[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 LyX\220
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 557
155 SectionEnd
156
157 Section /o "English (CA)" SecDEnglishCA
158  StrCpy $DictCodes "en_CA,$DictCodes"
159  AddSize 557
160 SectionEnd
161
162 Section "English (GB)" SecDEnglishGB
163  # already installed by default
164  SectionIn RO
165  #StrCpy $DictCodes "en_GB,$DictCodes"
166  AddSize 1044
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 551
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 "ქართული ენა" SecDGeorgian
238  StrCpy $DictCodes "ka_GE,$DictCodes"
239  AddSize 3952
240 SectionEnd
241
242 Section /o "עִברִית" SecDHebrew
243  StrCpy $DictCodes "he_IL,$DictCodes"
244  AddSize 3120
245 SectionEnd
246
247 Section /o "Hrvatski" SecDCroatian
248  StrCpy $DictCodes "hr_HR,$DictCodes"
249  AddSize 2240
250 SectionEnd
251
252 Section /o "Magyar" SecDHungarian
253  StrCpy $DictCodes "hu_HU,$DictCodes"
254  AddSize 3380
255 SectionEnd
256
257 Section /o "हिंदी" SecDHindi
258  StrCpy $DictCodes "hi_IN,$DictCodes"
259  AddSize 1900
260 SectionEnd
261
262 Section /o "Interlingua" SecDInterlingua
263  StrCpy $DictCodes "ia_IA,$DictCodes"
264  AddSize 613
265 SectionEnd
266
267 Section /o "Íslenska" SecDIcelandic
268  StrCpy $DictCodes "is_IS,$DictCodes"
269  AddSize 2320
270 SectionEnd
271
272 Section /o "Italiano" SecDItalian
273  StrCpy $DictCodes "it_IT,$DictCodes"
274  AddSize 1380
275 SectionEnd
276
277 Section /o "Қазақша" SecDKazakh
278  StrCpy $DictCodes "kk_KZ,$DictCodes"
279  AddSize 2120
280 SectionEnd
281
282 Section /o "한국어" SecDKorean
283  StrCpy $DictCodes "ko_KR,$DictCodes"
284  AddSize 16540
285 SectionEnd
286
287 Section /o "Latina" SecDLatin
288  StrCpy $DictCodes "la_LA,$DictCodes"
289  AddSize 2040
290 SectionEnd
291
292 Section /o "Lietuviu" SecDLithuanian
293  StrCpy $DictCodes "lt_LT,$DictCodes"
294  AddSize 1320
295 SectionEnd
296
297 Section /o "Latviešu" SecDLatvian
298  StrCpy $DictCodes "lv_LV,$DictCodes"
299  AddSize 2243
300 SectionEnd
301
302 Section /o "मराठी" SecDMarathi
303  StrCpy $DictCodes "mr_IN,$DictCodes"
304  AddSize 5290
305 SectionEnd
306
307 Section /o "Nederlands" SecDDutch
308  StrCpy $DictCodes "nl_NL,$DictCodes"
309  AddSize 1820
310 SectionEnd
311
312 Section /o "Norsk (Bokmål)" SecDNorwegianNB
313  StrCpy $DictCodes "nb_NO,$DictCodes"
314  AddSize 5291
315 SectionEnd
316
317 Section /o "Norsk (Nynorsk)" SecDNorwegianNN
318  StrCpy $DictCodes "nn_NO,$DictCodes"
319  AddSize 3292
320 SectionEnd
321
322 Section /o "Occitan" SecDOccitan
323  StrCpy $DictCodes "oc_FR,$DictCodes"
324  AddSize 31710
325 SectionEnd
326
327 Section /o "Polski" SecDPolish
328  StrCpy $DictCodes "pl_PL,$DictCodes"
329  AddSize 4540
330 SectionEnd
331
332 Section /o "Português (BR)" SecDPortugueseBR
333  StrCpy $DictCodes "pt_BR,$DictCodes"
334  AddSize 5280
335 SectionEnd
336
337 Section /o "Português (PT)" SecDPortuguesePT
338  StrCpy $DictCodes "pt_PT,$DictCodes"
339  AddSize 1568
340 SectionEnd
341
342 Section /o "Româna" SecDRomanian
343  StrCpy $DictCodes "ro_RO,$DictCodes"
344  AddSize 2255
345 SectionEnd
346
347 Section /o "Русский" SecDRussian
348  StrCpy $DictCodes "ru_RU,$DictCodes"
349  AddSize 1920
350 SectionEnd
351
352 Section /o "Serbšcina (Dolno)" SecDSorbianD
353  StrCpy $DictCodes "dsb_DE,$DictCodes"
354  AddSize 1035
355 SectionEnd
356
357 Section /o "Serbšcina (Horno)" SecDSorbianH
358  StrCpy $DictCodes "hsb_DE,$DictCodes"
359  AddSize 740
360 SectionEnd
361
362 Section /o "Shqip" SecDAlbanian
363  StrCpy $DictCodes "sq_AL,$DictCodes"
364  AddSize 2612
365 SectionEnd
366
367 Section /o "Slovenšcina" SecDSlovenian
368  StrCpy $DictCodes "sl_SI,$DictCodes"
369  AddSize 2910
370 SectionEnd
371
372 Section /o "Slovenský" SecDSlovakian
373  StrCpy $DictCodes "sk_SK,$DictCodes"
374  AddSize 3310
375 SectionEnd
376
377 Section /o "Српски (Ћирилица)" SecDSerbianC
378  StrCpy $DictCodes "sr_RS,$DictCodes"
379  AddSize 4401
380 SectionEnd
381
382 Section /o "Srpski (Latinica)" SecDSerbianL
383  StrCpy $DictCodes "sr_RS-Latin,$DictCodes"
384  AddSize 2843
385 SectionEnd
386
387 Section /o "Svenska" SecDSwedish
388  StrCpy $DictCodes "sv_SE,$DictCodes"
389  AddSize 2028
390 SectionEnd
391
392 Section /o "தமிழ்" SecDTamil
393  StrCpy $DictCodes "ta_IN,$DictCodes"
394  AddSize 5911
395 SectionEnd
396
397 Section /o "తెలుగు" SecDTelugu
398  StrCpy $DictCodes "te_IN,$DictCodes"
399  AddSize 3400
400 SectionEnd
401  
402 Section /o "ไทย" SecDThai
403  StrCpy $DictCodes "th_TH,$DictCodes"
404  AddSize 351
405 SectionEnd
406
407 Section /o "Tibetan" SecDTibetan
408  StrCpy $DictCodes "bo_CN,$DictCodes"
409  AddSize 7
410 SectionEnd
411
412 Section /o "Türkmençe" SecDTurkmen
413  StrCpy $DictCodes "tk_TM,$DictCodes"
414  AddSize 2797
415 SectionEnd
416
417 Section /o "Türkçe" SecDTurkish
418  StrCpy $DictCodes "tr_TR,$DictCodes"
419  AddSize 8870
420 SectionEnd
421
422 Section /o "Українська" SecDUkrainian
423  StrCpy $DictCodes "uk_UA,$DictCodes"
424  AddSize 6905
425 SectionEnd
426
427 Section /o "اردو" SecDUrdu
428  StrCpy $DictCodes "ur_PK,$DictCodes"
429  AddSize 1401
430 SectionEnd
431
432 Section /o "Tiếng Việt" SecDVietnamese
433  StrCpy $DictCodes "vi_VN,$DictCodes"
434  AddSize 40
435 SectionEnd
436
437 SectionGroupEnd
438
439
440 SectionGroup "$(SecThesaurus)" SecThesaurus
441
442 Section /o "العربية" SecTArabic
443  StrCpy $ThesCodes "ar_SA,$ThesCodes"
444  AddSize 799
445 SectionEnd
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 ${SecFileAssoc} "$(SecFileAssocDescription)"
587 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
588 !insertmacro MUI_DESCRIPTION_TEXT ${SecDictionaries} "$(SecDictionariesDescription)"
589 !insertmacro MUI_DESCRIPTION_TEXT ${SecThesaurus} "$(SecThesaurusDescription)"
590 !insertmacro MUI_FUNCTION_DESCRIPTION_END
591
592
593 # .onInit must be here after the section definition because we have to set
594 # the selection states of the dictionary sections
595 Function .onInit
596
597   !if ${APP_VERSION_ACHITECHTURE} = 64
598     ${IfNot} ${RunningX64}
599       MessageBox MB_OK|MB_ICONSTOP "Cannot install a 64 bit app on 32 bit Windows, please use the 32 bit installer" /SD IDOK
600       Abort
601     ${EndIf}
602   !EndIf
603
604   SetRegView ${APP_VERSION_ACHITECHTURE}
605
606   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
607   ${if} $R0 == "5.0" # 2000
608   ${orif} $R0 == "5.1" # XP
609   ${orif} $R0 == "5.2" # 2003
610   ${orif} $R0 == "6.0" # Vista
611     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 7 or newer." /SD IDOK
612     Quit
613   ${endif}
614   
615   # Check that LyX is not currently running
616   FindProcDLL::FindProc "${BIN_LYX}"
617   ${if} $R0 == "1"
618    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
619    Abort
620   ${endif}
621   
622   !insertmacro MULTIUSER_INIT
623   
624   # check if this LyX version is already installed
625   ${if} $MultiUser.Privileges == "Admin"
626   ${orif} $MultiUser.Privileges == "Power"
627    ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
628   ${else}
629    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayIcon"
630    # handle also the case that LyX is already installed in HKLM
631    ${if} $0 == ""
632     ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
633    ${endif}
634   ${endif}
635   ${if} $0 != ""
636    # check if the uninstaller was acidentally deleted
637    # if so don't bother the user if he realy wants to install a new LyX over an existing one
638    # because he won't have a chance to deny this
639    StrCpy $4 $0 -12 # remove '\bin\lyx.exe'
640    # (for FileCheck the variables $0 and $1 cannot be used)
641    !insertmacro FileCheck $5 "Uninstall-${APP_NAME}.exe" "$4" # macro from LyXUtils.nsh
642    ${if} $5 == "False"
643     Goto ForceInstallation
644    ${endif}
645    # installing over an existing installation of the same LyX release is not necessary
646    # if the users does this he most probably has a problem with LyX that can better be solved
647    # by reinstalling LyX
648    # for beta and other test releases over-installing can even cause errors
649    MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION "$(AlreadyInstalled)" /SD IDNO IDYES ForceInstallation 
650    Abort
651    ForceInstallation:
652   ${endif}
653   
654   # check if there is an existing LyX installation of the same LyX series
655   # we usually don't release more than 10 versions so with 20 we are safe to check if a newer version is installed
656   IntOp $4 ${APP_VERSION_REVISION} + 20
657   ${for} $5 0 $4
658    ${if} $MultiUser.Privileges == "Admin"
659    ${orif} $MultiUser.Privileges == "Power"
660     ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
661     # also check for an emergency release
662     ${if} $0 == ""
663      ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
664     ${endif}
665    ${else}
666     ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
667     # also check for an emergency release
668     ${if} $0 == ""
669      ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
670     ${endif}
671    ${endif}
672    ${if} $0 != ""
673     StrCpy $R5 $0 # store the read version number
674     StrCpy $OldVersionNumber "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5"
675     # we don't stop here because we want the latest installed version
676    ${endif} 
677   ${next}
678   
679   ${if} $OldVersionNumber > ${APP_SERIES_KEY}
680    # store the version number and reformat it temporarily for the error message
681    StrCpy $R0 $OldVersionNumber
682    StrCpy $OldVersionNumber $R5
683    MessageBox MB_OK|MB_ICONSTOP "$(NewerInstalled)" /SD IDOK
684    StrCpy $OldVersionNumber $R0
685    Abort
686   ${endif}
687
688   # this can be reset to "true" in section SecDesktop
689   StrCpy $CreateDesktopIcon "false"
690   StrCpy $CreateFileAssociations "false"
691  
692   ${IfNot} ${Silent}
693     # Show banner while installer is intializating 
694     Banner::show /NOUNLOAD "Checking system"
695   ${EndIf}
696  
697   Call SearchExternal
698   
699   # select sections of already installed spell-checker dictionaries, make them read-only
700   # and set the necessary size to 0 bytes
701   StrCpy $String $FoundDict
702   StrCpy $Search "af_ZA"
703   Call StrPoint # function from LyXUtils.nsh
704   ${if} $Pointer != "-1"
705    IntOp $0 ${SF_SELECTED} | ${SF_RO}
706    SectionSetFlags ${SecDAfrikaans} $0
707    SectionSetSize ${SecDAfrikaans} 0
708   ${endif}
709   StrCpy $Search "ar_SA"
710   Call StrPoint
711   ${if} $Pointer != "-1"
712    IntOp $0 ${SF_SELECTED} | ${SF_RO}
713    SectionSetFlags ${SecDArabic} $0
714    SectionSetSize ${SecDArabic} 0
715   ${endif}
716   StrCpy $Search "hy_AM"
717   Call StrPoint
718   ${if} $Pointer != "-1"
719    IntOp $0 ${SF_SELECTED} | ${SF_RO}
720    SectionSetFlags ${SecDArmenian} $0
721    SectionSetSize ${SecDArmenian} 0
722   ${endif}
723   StrCpy $Search "id_ID"
724   Call StrPoint
725   ${if} $Pointer != "-1"
726    IntOp $0 ${SF_SELECTED} | ${SF_RO}
727    SectionSetFlags ${SecDIndonesian} $0
728    SectionSetSize ${SecDIndonesian} 0
729   ${endif}
730   StrCpy $Search "ms_MY"
731   Call StrPoint
732   ${if} $Pointer != "-1"
733    IntOp $0 ${SF_SELECTED} | ${SF_RO}
734    SectionSetFlags ${SecDMalayan} $0
735    SectionSetSize ${SecDMalayan} 0
736   ${endif}
737   StrCpy $Search "be_BY"
738   Call StrPoint
739   ${if} $Pointer != "-1"
740    IntOp $0 ${SF_SELECTED} | ${SF_RO}
741    SectionSetFlags ${SecDBelarusian} $0
742    SectionSetSize ${SecDBelarusian} 0
743   ${endif}
744   StrCpy $Search "br_FR"
745   Call StrPoint
746   ${if} $Pointer != "-1"
747    IntOp $0 ${SF_SELECTED} | ${SF_RO}
748    SectionSetFlags ${SecDBreton} $0
749    SectionSetSize ${SecDBreton} 0
750   ${endif}
751   StrCpy $Search "bg_BG"
752   Call StrPoint
753   ${if} $Pointer != "-1"
754    IntOp $0 ${SF_SELECTED} | ${SF_RO}
755    SectionSetFlags ${SecDBulgarian} $0
756    SectionSetSize ${SecDBulgarian} 0
757   ${endif}
758   StrCpy $Search "ca_ES"
759   Call StrPoint
760   ${if} $Pointer != "-1"
761    IntOp $0 ${SF_SELECTED} | ${SF_RO}
762    SectionSetFlags ${SecDCatalanian} $0
763    SectionSetSize ${SecDCatalanian} 0
764   ${endif}
765   StrCpy $Search "cs_CZ"
766   Call StrPoint
767   ${if} $Pointer != "-1"
768    IntOp $0 ${SF_SELECTED} | ${SF_RO}
769    SectionSetFlags ${SecDCzech} $0
770    SectionSetSize ${SecDCzech} 0
771   ${endif}
772  
773   StrCpy $Search "cop_EG"
774   Call StrPoint
775   ${if} $Pointer != "-1"
776    IntOp $0 ${SF_SELECTED} | ${SF_RO}
777    SectionSetFlags ${SecDCoptic} $0
778    SectionSetSize ${SecDCoptic} 0
779   ${endif}
780   StrCpy $Search "cy_GB"
781   Call StrPoint
782   ${if} $Pointer != "-1"
783    IntOp $0 ${SF_SELECTED} | ${SF_RO}
784    SectionSetFlags ${SecDWelsh} $0
785    SectionSetSize ${SecDWelsh} 0
786   ${endif}
787   StrCpy $Search "da_DK"
788   Call StrPoint
789   ${if} $Pointer != "-1"
790    IntOp $0 ${SF_SELECTED} | ${SF_RO}
791    SectionSetFlags ${SecDDanish} $0
792    SectionSetSize ${SecDDanish} 0
793   ${endif}
794   StrCpy $Search "de_AT"
795   Call StrPoint
796   ${if} $Pointer != "-1"
797    IntOp $0 ${SF_SELECTED} | ${SF_RO}
798    SectionSetFlags ${SecDGermanAT} $0
799    SectionSetSize ${SecDGermanAT} 0
800   ${endif}
801   StrCpy $Search "de_CH"
802   Call StrPoint
803   ${if} $Pointer != "-1"
804    IntOp $0 ${SF_SELECTED} | ${SF_RO}
805    SectionSetFlags ${SecDGermanCH} $0
806    SectionSetSize ${SecDGermanCH} 0
807   ${endif}
808   StrCpy $Search "de_DE"
809   Call StrPoint
810   ${if} $Pointer != "-1"
811    IntOp $0 ${SF_SELECTED} | ${SF_RO}
812    SectionSetFlags ${SecDGermanD} $0
813    SectionSetSize ${SecDGermanD} 0
814   ${endif}
815   StrCpy $Search "el_GR"
816   Call StrPoint
817   ${if} $Pointer != "-1"
818    IntOp $0 ${SF_SELECTED} | ${SF_RO}
819    SectionSetFlags ${SecDGreek} $0
820    SectionSetSize ${SecDGreek} 0
821   ${endif}
822   StrCpy $Search "et_EE"
823   Call StrPoint
824   ${if} $Pointer != "-1"
825    IntOp $0 ${SF_SELECTED} | ${SF_RO}
826    SectionSetFlags ${SecDEstonian} $0
827    SectionSetSize ${SecDEstonian} 0
828   ${endif}
829   StrCpy $Search "en_AU"
830   Call StrPoint
831   ${if} $Pointer != "-1"
832    IntOp $0 ${SF_SELECTED} | ${SF_RO}
833    SectionSetFlags ${SecDEnglishAU} $0
834    SectionSetSize ${SecDEnglishAU} 0
835   ${endif}
836   StrCpy $Search "en_CA"
837   Call StrPoint
838   ${if} $Pointer != "-1"
839    IntOp $0 ${SF_SELECTED} | ${SF_RO}
840    SectionSetFlags ${SecDEnglishCA} $0
841    SectionSetSize ${SecDEnglishCA} 0
842   ${endif}
843   StrCpy $Search "en_GB"
844   Call StrPoint
845   ${if} $Pointer != "-1"
846    IntOp $0 ${SF_SELECTED} | ${SF_RO}
847    SectionSetFlags ${SecDEnglishGB} $0
848    SectionSetSize ${SecDEnglishGB} 0
849   ${endif}
850   StrCpy $Search "en_NZ"
851   Call StrPoint
852   ${if} $Pointer != "-1"
853    IntOp $0 ${SF_SELECTED} | ${SF_RO}
854    SectionSetFlags ${SecDEnglishNZ} $0
855    SectionSetSize ${SecDEnglishNZ} 0
856   ${endif}
857   StrCpy $Search "en_US"
858   Call StrPoint
859   ${if} $Pointer != "-1"
860    IntOp $0 ${SF_SELECTED} | ${SF_RO}
861    SectionSetFlags ${SecDEnglishUS} $0
862    SectionSetSize ${SecDEnglishUS} 0
863   ${endif}
864   StrCpy $Search "es_ES"
865   Call StrPoint
866   ${if} $Pointer != "-1"
867    IntOp $0 ${SF_SELECTED} | ${SF_RO}
868    SectionSetFlags ${SecDSpanishES} $0
869    SectionSetSize ${SecDSpanishES} 0
870   ${endif}
871   StrCpy $Search "es_MX"
872   Call StrPoint
873   ${if} $Pointer != "-1"
874    IntOp $0 ${SF_SELECTED} | ${SF_RO}
875    SectionSetFlags ${SecDSpanishMX} $0
876    SectionSetSize ${SecDSpanishMX} 0
877   ${endif}
878   StrCpy $Search "eo_EO"
879   Call StrPoint
880   ${if} $Pointer != "-1"
881    IntOp $0 ${SF_SELECTED} | ${SF_RO}
882    SectionSetFlags ${SecDEsperanto} $0
883    SectionSetSize ${SecDEsperanto} 0
884   ${endif}
885   StrCpy $Search "eu_ES"
886   Call StrPoint
887   ${if} $Pointer != "-1"
888    IntOp $0 ${SF_SELECTED} | ${SF_RO}
889    SectionSetFlags ${SecDBasque} $0
890    SectionSetSize ${SecDBasque} 0
891   ${endif}
892   StrCpy $Search "fa_IR"
893   Call StrPoint
894   ${if} $Pointer != "-1"
895    IntOp $0 ${SF_SELECTED} | ${SF_RO}
896    SectionSetFlags ${SecDFarsi} $0
897    SectionSetSize ${SecDFarsi} 0
898   ${endif}
899   StrCpy $Search "fr_CA"
900   Call StrPoint
901   ${if} $Pointer != "-1"
902    IntOp $0 ${SF_SELECTED} | ${SF_RO}
903    SectionSetFlags ${SecDFrenchCanada} $0
904    SectionSetSize ${SecDFrenchCanada} 0
905   ${endif}
906   StrCpy $Search "fr_FR"
907   Call StrPoint
908   ${if} $Pointer != "-1"
909    IntOp $0 ${SF_SELECTED} | ${SF_RO}
910    SectionSetFlags ${SecDFrench} $0
911    SectionSetSize ${SecDFrench} 0
912   ${endif}
913   StrCpy $Search "ga_IR"
914   Call StrPoint
915   ${if} $Pointer != "-1"
916    IntOp $0 ${SF_SELECTED} | ${SF_RO}
917    SectionSetFlags ${SecDGaelic} $0
918    SectionSetSize ${SecDGaelic} 0
919   ${endif}
920   StrCpy $Search "gd_GB"
921   Call StrPoint
922   ${if} $Pointer != "-1"
923    IntOp $0 ${SF_SELECTED} | ${SF_RO}
924    SectionSetFlags ${SecDScottish} $0
925    SectionSetSize ${SecDScottish} 0
926   ${endif}
927   StrCpy $Search "gl_ES"
928   Call StrPoint
929   ${if} $Pointer != "-1"
930    IntOp $0 ${SF_SELECTED} | ${SF_RO}
931    SectionSetFlags ${SecDGalician} $0
932    SectionSetSize ${SecDGalician} 0
933   ${endif}
934   StrCpy $Search "ka_GE"
935   Call StrPoint
936   ${if} $Pointer != "-1"
937    IntOp $0 ${SF_SELECTED} | ${SF_RO}
938    SectionSetFlags ${SecDGeorgian} $0
939    SectionSetSize ${SecDGeorgian} 0
940   ${endif}
941   StrCpy $Search "he_IL"
942   Call StrPoint
943   ${if} $Pointer != "-1"
944    IntOp $0 ${SF_SELECTED} | ${SF_RO}
945    SectionSetFlags ${SecDHebrew} $0
946    SectionSetSize ${SecDHebrew} 0
947   ${endif}
948   StrCpy $Search "hi_IN"
949   Call StrPoint
950   ${if} $Pointer != "-1"
951    IntOp $0 ${SF_SELECTED} | ${SF_RO}
952    SectionSetFlags ${SecDHindi} $0
953    SectionSetSize ${SecDHindi} 0
954   ${endif}
955   StrCpy $Search "hr_HR"
956   Call StrPoint
957   ${if} $Pointer != "-1"
958    IntOp $0 ${SF_SELECTED} | ${SF_RO}
959    SectionSetFlags ${SecDCroatian} $0
960    SectionSetSize ${SecDCroatian} 0
961   ${endif}
962   StrCpy $Search "hu_HU"
963   Call StrPoint
964   ${if} $Pointer != "-1"
965    IntOp $0 ${SF_SELECTED} | ${SF_RO}
966    SectionSetFlags ${SecDHungarian} $0
967    SectionSetSize ${SecDHungarian} 0
968   ${endif}
969   StrCpy $Search "ia_IA"
970   Call StrPoint
971   ${if} $Pointer != "-1"
972    IntOp $0 ${SF_SELECTED} | ${SF_RO}
973    SectionSetFlags ${SecDInterlingua} $0
974    SectionSetSize ${SecDInterlingua} 0
975   ${endif}
976   StrCpy $Search "is_IS"
977   Call StrPoint
978   ${if} $Pointer != "-1"
979    IntOp $0 ${SF_SELECTED} | ${SF_RO}
980    SectionSetFlags ${SecDIcelandic} $0
981    SectionSetSize ${SecDIcelandic} 0
982   ${endif}
983   StrCpy $Search "it_IT"
984   Call StrPoint
985   ${if} $Pointer != "-1"
986    IntOp $0 ${SF_SELECTED} | ${SF_RO}
987    SectionSetFlags ${SecDItalian} $0
988    SectionSetSize ${SecDItalian} 0
989   ${endif}
990   StrCpy $Search "kk_KZ"
991   Call StrPoint
992   ${if} $Pointer != "-1"
993    IntOp $0 ${SF_SELECTED} | ${SF_RO}
994    SectionSetFlags ${SecDKazakh} $0
995    SectionSetSize ${SecDKazakh} 0
996   ${endif}
997   StrCpy $Search "ko_KR"
998   Call StrPoint
999   ${if} $Pointer != "-1"
1000    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1001    SectionSetFlags ${SecDKorean} $0
1002    SectionSetSize ${SecDKorean} 0
1003   ${endif}
1004   StrCpy $Search "la_LA"
1005   Call StrPoint
1006   ${if} $Pointer != "-1"
1007    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1008    SectionSetFlags ${SecDLatin} $0
1009    SectionSetSize ${SecDLatin} 0
1010   ${endif}
1011   StrCpy $Search "lt_LT"
1012   Call StrPoint
1013   ${if} $Pointer != "-1"
1014    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1015    SectionSetFlags ${SecDLithuanian} $0
1016    SectionSetSize ${SecDLithuanian} 0
1017   ${endif}
1018   StrCpy $Search "lv_LV"
1019   Call StrPoint
1020   ${if} $Pointer != "-1"
1021    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1022    SectionSetFlags ${SecDLatvian} $0
1023    SectionSetSize ${SecDLatvian} 0
1024   ${endif}
1025   StrCpy $Search "mr_IN"
1026   Call StrPoint
1027   ${if} $Pointer != "-1"
1028    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1029    SectionSetFlags ${SecDMarathi} $0
1030    SectionSetSize ${SecDMarathi} 0
1031   ${endif}
1032   StrCpy $Search "nl_NL"
1033   Call StrPoint
1034   ${if} $Pointer != "-1"
1035    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1036    SectionSetFlags ${SecDDutch} $0
1037    SectionSetSize ${SecDDutch} 0
1038   ${endif}
1039   StrCpy $Search "nb_NO"
1040   Call StrPoint
1041   ${if} $Pointer != "-1"
1042    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1043    SectionSetFlags ${SecDNorwegianNB} $0
1044    SectionSetSize ${SecDNorwegianNB} 0
1045   ${endif}
1046   StrCpy $Search "nn_NO"
1047   Call StrPoint
1048   ${if} $Pointer != "-1"
1049    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1050    SectionSetFlags ${SecDNorwegianNN} $0
1051    SectionSetSize ${SecDNorwegianNN} 0
1052   ${endif}
1053   StrCpy $Search "oc_FR"
1054   Call StrPoint
1055   ${if} $Pointer != "-1"
1056    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1057    SectionSetFlags ${SecDOccitan} $0
1058    SectionSetSize ${SecDOccitan} 0
1059   ${endif}
1060   StrCpy $Search "pl_PL"
1061   Call StrPoint
1062   ${if} $Pointer != "-1"
1063    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1064    SectionSetFlags ${SecDPolish} $0
1065    SectionSetSize ${SecDPolish} 0
1066   ${endif}
1067   StrCpy $Search "pt_BR"
1068   Call StrPoint
1069   ${if} $Pointer != "-1"
1070    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1071    SectionSetFlags ${SecDPortugueseBR} $0
1072    SectionSetSize ${SecDPortugueseBR} 0
1073   ${endif}
1074   StrCpy $Search "pt_PT"
1075   Call StrPoint
1076   ${if} $Pointer != "-1"
1077    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1078    SectionSetFlags ${SecDPortuguesePT} $0
1079    SectionSetSize ${SecDPortuguesePT} 0
1080   ${endif}
1081   StrCpy $Search "ro_RO"
1082   Call StrPoint
1083   ${if} $Pointer != "-1"
1084    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1085    SectionSetFlags ${SecDRomanian} $0
1086    SectionSetSize ${SecDRomanian} 0
1087   ${endif}
1088   StrCpy $Search "ru_RU"
1089   Call StrPoint
1090   ${if} $Pointer != "-1"
1091    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1092    SectionSetFlags ${SecDRussian} $0
1093    SectionSetSize ${SecDRussian} 0
1094   ${endif}
1095   StrCpy $Search "dsb_DE"
1096   Call StrPoint
1097   ${if} $Pointer != "-1"
1098    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1099    SectionSetFlags ${SecDSorbianD} $0
1100    SectionSetSize ${SecDSorbianD} 0
1101   ${endif}
1102   StrCpy $Search "hsb_DE"
1103   Call StrPoint
1104   ${if} $Pointer != "-1"
1105    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1106    SectionSetFlags ${SecDSorbianH} $0
1107    SectionSetSize ${SecDSorbianH} 0
1108   ${endif}
1109   StrCpy $Search "sq_AL"
1110   Call StrPoint
1111   ${if} $Pointer != "-1"
1112    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1113    SectionSetFlags ${SecDAlbanian} $0
1114    SectionSetSize ${SecDAlbanian} 0
1115   ${endif}
1116   StrCpy $Search "sl_SI"
1117   Call StrPoint
1118   ${if} $Pointer != "-1"
1119    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1120    SectionSetFlags ${SecDSlovenian} $0
1121    SectionSetSize ${SecDSlovenian} 0
1122   ${endif}
1123   StrCpy $Search "sk_SK"
1124   Call StrPoint
1125   ${if} $Pointer != "-1"
1126    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1127    SectionSetFlags ${SecDSlovakian} $0
1128    SectionSetSize ${SecDSlovakian} 0
1129   ${endif}
1130   StrCpy $Search "sr_RS"
1131   Call StrPoint
1132   ${if} $Pointer != "-1"
1133    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1134    SectionSetFlags ${SecDSerbianC} $0
1135    SectionSetSize ${SecDSerbianC} 0
1136   ${endif}
1137   StrCpy $Search "sr_RS-Latin"
1138   Call StrPoint
1139   ${if} $Pointer != "-1"
1140    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1141    SectionSetFlags ${SecDSerbianL} $0
1142    SectionSetSize ${SecDSerbianL} 0
1143   ${endif}
1144   StrCpy $Search "sv_SE"
1145   Call StrPoint
1146   ${if} $Pointer != "-1"
1147    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1148    SectionSetFlags ${SecDSwedish} $0
1149    SectionSetSize ${SecDSwedish} 0
1150   ${endif}
1151   StrCpy $Search "ta_IN"
1152   Call StrPoint
1153   ${if} $Pointer != "-1"
1154    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1155    SectionSetFlags ${SecDTamil} $0
1156    SectionSetSize ${SecDTamil} 0
1157   ${endif}
1158   StrCpy $Search "te_IN"
1159   Call StrPoint
1160   ${if} $Pointer != "-1"
1161    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1162    SectionSetFlags ${SecDTelugu} $0
1163    SectionSetSize ${SecDTelugu} 0
1164   ${endif}
1165   StrCpy $Search "th_TH"
1166   Call StrPoint
1167   ${if} $Pointer != "-1"
1168    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1169    SectionSetFlags ${SecDThai} $0
1170    SectionSetSize ${SecDThai} 0
1171   ${endif}
1172   StrCpy $Search "bo_CN"
1173   Call StrPoint
1174   ${if} $Pointer != "-1"
1175    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1176    SectionSetFlags ${SecDTibetan} $0
1177    SectionSetSize ${SecDTibetan} 0
1178   ${endif}
1179   StrCpy $Search "tk_TM"
1180   Call StrPoint
1181   ${if} $Pointer != "-1"
1182    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1183    SectionSetFlags ${SecDTurkmen} $0
1184    SectionSetSize ${SecDTurkmen} 0
1185   ${endif}
1186   StrCpy $Search "tr_TR"
1187   Call StrPoint
1188   ${if} $Pointer != "-1"
1189    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1190    SectionSetFlags ${SecDTurkish} $0
1191    SectionSetSize ${SecDTurkish} 0
1192   ${endif}
1193   StrCpy $Search "uk_UA"
1194   Call StrPoint
1195   ${if} $Pointer != "-1"
1196    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1197    SectionSetFlags ${SecDUkrainian} $0
1198    SectionSetSize ${SecDUkrainian} 0
1199   ${endif}
1200   StrCpy $Search "ur_PK"
1201   Call StrPoint
1202   ${if} $Pointer != "-1"
1203    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1204    SectionSetFlags ${SecDUrdu} $0
1205    SectionSetSize ${SecDUrdu} 0
1206   ${endif}
1207   StrCpy $Search "vi_VN"
1208   Call StrPoint
1209   ${if} $Pointer != "-1"
1210    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1211    SectionSetFlags ${SecDVietnamese} $0
1212    SectionSetSize ${SecDVietnamese} 0
1213   ${endif}
1214   
1215   # select sections of already installed thesaurus dictionaries, make them read-only
1216   # and set the necessary size to 0 bytes
1217   StrCpy $String $FoundThes
1218   StrCpy $Search "ar_SA"
1219   Call StrPoint # function from LyXUtils.nsh
1220   ${if} $Pointer != "-1"
1221    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1222    SectionSetFlags ${SecTArabic} $0
1223    SectionSetSize ${SecTArabic} 0
1224   ${endif}
1225   StrCpy $Search "bg_BG"
1226   Call StrPoint
1227   ${if} $Pointer != "-1"
1228    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1229    SectionSetFlags ${SecTBulgarian} $0
1230    SectionSetSize ${SecTBulgarian} 0
1231   ${endif}
1232   StrCpy $Search "ca_ES"
1233   Call StrPoint
1234   ${if} $Pointer != "-1"
1235    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1236    SectionSetFlags ${SecTCatalan} $0
1237    SectionSetSize ${SecTCatalan} 0
1238   ${endif}
1239   StrCpy $Search "cs_CZ"
1240   Call StrPoint
1241   ${if} $Pointer != "-1"
1242    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1243    SectionSetFlags ${SecTCzech} $0
1244    SectionSetSize ${SecTCzech} 0
1245   ${endif}
1246   StrCpy $Search "da_DK"
1247   Call StrPoint
1248   ${if} $Pointer != "-1"
1249    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1250    SectionSetFlags ${SecTDanish} $0
1251    SectionSetSize ${SecTDanish} 0
1252   ${endif}
1253   StrCpy $Search "de_DE"
1254   Call StrPoint
1255   ${if} $Pointer != "-1"
1256    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1257    SectionSetFlags ${SecTGermanDA} $0
1258    SectionSetSize ${SecTGermanDA} 0
1259   ${endif} 
1260   StrCpy $Search "de_CH"
1261   Call StrPoint
1262   ${if} $Pointer != "-1"
1263    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1264    SectionSetFlags ${SecTGermanCH} $0
1265    SectionSetSize ${SecTGermanCH} 0
1266   ${endif}
1267   StrCpy $Search "en_AU"
1268   Call StrPoint
1269   ${if} $Pointer != "-1"
1270    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1271    SectionSetFlags ${SecTEnglishAU} $0
1272    SectionSetSize ${SecTEnglishAU} 0
1273   ${endif}
1274   StrCpy $Search "en_GB"
1275   Call StrPoint
1276   ${if} $Pointer != "-1"
1277    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1278    SectionSetFlags ${SecTEnglishGB} $0
1279    SectionSetSize ${SecTEnglishGB} 0
1280   ${endif} 
1281   StrCpy $Search "en_US"
1282   Call StrPoint
1283   ${if} $Pointer != "-1"
1284    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1285    SectionSetFlags ${SecTEnglishUS} $0
1286    SectionSetSize ${SecTEnglishUS} 0
1287   ${endif}
1288   StrCpy $Search "es_ES"
1289   Call StrPoint
1290   ${if} $Pointer != "-1"
1291    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1292    SectionSetFlags ${SecTSpanish} $0
1293    SectionSetSize ${SecTSpanish} 0
1294   ${endif}
1295   StrCpy $Search "fr_FR"
1296   Call StrPoint
1297   ${if} $Pointer != "-1"
1298    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1299    SectionSetFlags ${SecTFrench} $0
1300    SectionSetSize ${SecTFrench} 0
1301   ${endif}
1302   StrCpy $Search "ga_IR"
1303   Call StrPoint
1304   ${if} $Pointer != "-1"
1305    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1306    SectionSetFlags ${SecTGaelic} $0
1307    SectionSetSize ${SecTGaelic} 0
1308   ${endif}
1309   StrCpy $Search "gl_ES"
1310   Call StrPoint
1311   ${if} $Pointer != "-1"
1312    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1313    SectionSetFlags ${SecTGalician} $0
1314    SectionSetSize ${SecTGalician} 0
1315   ${endif}
1316   StrCpy $Search "el_GR"
1317   Call StrPoint
1318   ${if} $Pointer != "-1"
1319    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1320    SectionSetFlags ${SecTGreek} $0
1321    SectionSetSize ${SecTGreek} 0
1322   ${endif}
1323   StrCpy $Search "is_IS"
1324   Call StrPoint
1325   ${if} $Pointer != "-1"
1326    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1327    SectionSetFlags ${SecTIcelandic} $0
1328    SectionSetSize ${SecTIcelandic} 0
1329   ${endif}
1330   StrCpy $Search "it_IT"
1331   Call StrPoint
1332   ${if} $Pointer != "-1"
1333    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1334    SectionSetFlags ${SecTItalian} $0
1335    SectionSetSize ${SecTItalian} 0
1336   ${endif}
1337   StrCpy $Search "hu_HU"
1338   Call StrPoint
1339   ${if} $Pointer != "-1"
1340    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1341    SectionSetFlags ${SecTHungarian} $0
1342    SectionSetSize ${SecTHungarian} 0
1343   ${endif}
1344   StrCpy $Search "nb_NO"
1345   Call StrPoint
1346   ${if} $Pointer != "-1"
1347    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1348    SectionSetFlags ${SecTNorwegianNB} $0
1349    SectionSetSize ${SecTNorwegianNB} 0
1350   ${endif}
1351   StrCpy $Search "nn_NO"
1352   Call StrPoint
1353   ${if} $Pointer != "-1"
1354    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1355    SectionSetFlags ${SecTNorwegianNN} $0
1356    SectionSetSize ${SecTNorwegianNN} 0
1357   ${endif}
1358   StrCpy $Search "pl_PL"
1359   Call StrPoint
1360   ${if} $Pointer != "-1"
1361    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1362    SectionSetFlags ${SecTPolish} $0
1363    SectionSetSize ${SecTPolish} 0
1364   ${endif}
1365   StrCpy $Search "pt_PT"
1366   Call StrPoint
1367   ${if} $Pointer != "-1"
1368    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1369    SectionSetFlags ${SecTPortuguese} $0
1370    SectionSetSize ${SecTPortuguese} 0
1371   ${endif}
1372   StrCpy $Search "ro_RO"
1373   Call StrPoint
1374   ${if} $Pointer != "-1"
1375    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1376    SectionSetFlags ${SecTRomanian} $0
1377    SectionSetSize ${SecTRomanian} 0
1378   ${endif}
1379   StrCpy $Search "ru_RU"
1380   Call StrPoint
1381   ${if} $Pointer != "-1"
1382    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1383    SectionSetFlags ${SecTRussian} $0
1384    SectionSetSize ${SecTRussian} 0
1385   ${endif}
1386   StrCpy $Search "sl_SI"
1387   Call StrPoint
1388   ${if} $Pointer != "-1"
1389    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1390    SectionSetFlags ${SecTSlovenian} $0
1391    SectionSetSize ${SecTSlovenian} 0
1392   ${endif}
1393   StrCpy $Search "sk_SK"
1394   Call StrPoint
1395   ${if} $Pointer != "-1"
1396    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1397    SectionSetFlags ${SecTSlovakian} $0
1398    SectionSetSize ${SecTSlovakian} 0
1399   ${endif}
1400   StrCpy $Search "sv_SE"
1401   Call StrPoint
1402   ${if} $Pointer != "-1"
1403    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1404    SectionSetFlags ${SecTSwedish} $0
1405    SectionSetSize ${SecTSwedish} 0
1406   ${endif}
1407   StrCpy $Search "uk_UA"
1408   Call StrPoint
1409   ${if} $Pointer != "-1"
1410    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1411    SectionSetFlags ${SecTUkrainian} $0
1412    SectionSetSize ${SecTUkrainian} 0
1413   ${endif}
1414   
1415   ${IfNot} ${Silent}
1416     Banner::destroy
1417   ${EndIf}
1418
1419 FunctionEnd
1420
1421 # this function is called at first after starting the uninstaller
1422 Function un.onInit
1423
1424   SetRegView ${APP_VERSION_ACHITECHTURE}
1425
1426   !insertmacro MULTIUSER_UNINIT
1427
1428   # Check that LyX is not currently running
1429   FindProcDLL::FindProc "${BIN_LYX}"
1430   ${if} $R0 == "1"
1431    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
1432    Abort
1433   ${endif}
1434
1435   # set registry root key
1436   ${if} $MultiUser.Privileges == "Admin"
1437   ${orif} $MultiUser.Privileges == "Power"
1438     SetShellVarContext all
1439   ${else}
1440    SetShellVarContext current
1441   ${endif}
1442
1443   # Ascertain whether the user has sufficient privileges to uninstall.
1444   # abort when LyX was installed with admin permissions but the user doesn't have administrator privileges
1445   ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayVersion"
1446   ${if} $0 != ""
1447   ${andif} $MultiUser.Privileges != "Admin"
1448   ${andif} $MultiUser.Privileges != "Power"
1449    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)" /SD IDOK
1450    Abort
1451   ${endif}
1452   # warning when LyX couldn't be found in the registry
1453   ${if} $0 == "" # check in HKCU
1454    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayVersion"
1455    ${if} $0 == ""
1456      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)" /SD IDOK
1457    ${endif}
1458   ${endif}
1459   
1460   # Macro to investigate name of LyX's preferences folders to be able remove them
1461   !insertmacro UnAppPreSuff $AppPre $AppSuff # macro from LyXUtils.nsh
1462
1463   # test if MiKTeX was installed together with LyX
1464   ReadRegStr $0 SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
1465   ${if} $0 == "Yes${APP_SERIES_KEY}"
1466    SectionSetText 2 "MiKTeX" # names the corersponding uninstaller section
1467    StrCpy $LaTeXInstalled "MiKTeX"
1468   ${else}
1469    SectionSetText 2 "" # hides the corresponding uninstaller section
1470   ${endif}
1471   
1472   # question message if the user really wants to uninstall LyX
1473   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" /SD IDYES IDYES +2 # continue if yes
1474   Abort
1475
1476 FunctionEnd