NSIS.template.in.in 141 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628
  1. /*-----------------------------------------------------------------------------------------------------
  2. NSIS Installer script for OpenCPN (Windows)
  3. NSIS version 2.46
  4. Written by Gunther Pilz (Netsurfer) netsurfer@opencpn.de
  5. -------------------------------------------------------------------------------------------------------
  6. CMake variables
  7. CPACK_PACKAGE_NAME "OpenCPN"
  8. CPACK_NSIS_PACKAGE_NAME_LC "opencpn"
  9. CPACK_PACKAGE_VENDOR "opencpn.org"
  10. CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}
  11. CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}
  12. CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}
  13. CPACK_PACKAGE_VERSION ${PACKAGE_VERSION}
  14. CPACK_NSIS_INSTALLED_ICON_NAME "opencpn.exe"
  15. CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/bitmaps\\\\opencpn.ico"
  16. CPACK_NSIS_EXTRA_INSTALL_COMMANDS ${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
  17. CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/data/license.txt"
  18. CPACK_BUILDWIN_DIR "${CMAKE_SOURCE_DIR}/buildwin"
  19. CPACK_NSIS_DIR "${CMAKE_SOURCE_DIR}/buildwin/NSIS_Unicode")
  20. #CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_CURRENT_BINARY_DIR};${PACKAGE_NAME};ALL;/"
  21. #CPACK_PACKAGE_EXECUTABLES ${PACKAGE_NAME} "OpenCPN"
  22. #CPACK_PACKAGE_INSTALL_DIRECTORY ${PACKAGE_NAME} "OpenCPN"
  23. #CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenCPN ${PACKAGE_VERSION}"
  24. #CPACK_NSIS_LINK_NAME "${CPACK_PACKAGE_NAME} ${PACKAGE_VERSION}"
  25. #CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_NAME} Version ${PACKAGE_VERSION}"
  26. #CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.opencpn.org"
  27. #CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.opencpn.org"
  28. #CPACK_NSIS_CONTACT "http:\\\\\\\\www.opencpn.org"
  29. #CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_setup"
  30. ----------------------------------------------------------------------------------------------------------*/
  31. ; Enabled on MINGW builds:
  32. ;!define NSIS_PACKEDVERSION true
  33. ;# Set compression
  34. SetCompressor /FINAL lzma
  35. !ifdef NSIS_PACKEDVERSION
  36. Unicode true
  37. !endif
  38. ;--------------------------------
  39. ;# You must define these values
  40. !define OCPN_INSTALLER_VERSION "1.0.0"
  41. /*
  42. !define CPACK_NSIS_INSTALLED_ICON_NAME "opencpn.exe"
  43. !define CPACK_NSIS_PACKAGE_NAME_LC "opencpn"
  44. !define CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_NAME} ${PACKAGE_VERSION}"
  45. !define CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/bitmaps/opencpn.ico"
  46. !define CPACK_BUILDWIN_DIR "${CMAKE_SOURCE_DIR}/buildwin"
  47. !define CPACK_NSIS_DIR "${CMAKE_SOURCE_DIR}/buildwin/NSIS_Unicode"
  48. */
  49. !define /date YEAR "%Y"
  50. !define OUTPUT_FILE_NAME "@CPACK_NSIS_PACKAGE_NAME_LC@_@CPACK_PACKAGE_VERSION@_setup.exe"
  51. !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
  52. !define REG_ROOT_KEY "Software"
  53. !define REG_KEY "Software\OpenCPN"
  54. !define REG_ROOT_KEY_UN "Software\Microsoft\Windows\CurrentVersion\Uninstall"
  55. !define REG_KEY_UN "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN @CPACK_PACKAGE_VERSION@"
  56. !define CSIDL_LOCAL_APPDATA "0x1C"
  57. !define Explode "!insertmacro Explode"
  58. !define unExplode "!insertmacro unExplode"
  59. ;--------------------------------
  60. ;# Variables
  61. Var INST_USER_SID
  62. Var CONFIG_EXISTS
  63. Var CONFIG_EMPTY
  64. Var INI_EXISTS
  65. Var CHARTDB_EXISTS
  66. Var SENC_EXISTS
  67. Var CM93_EXISTS
  68. Var NAVOBJ_EXISTS
  69. Var LOG_EXISTS
  70. Var REG_LANG
  71. Var Count_SecGrpResetConfig
  72. Var SecGrpEndSetConfig_Text
  73. Var RESET_CONFIG
  74. Var STARTMENU_FOLDER
  75. Var OLD_INSTALLS
  76. Var Prev_Install_RegKey
  77. Var MULTIPLE_INSTALLS
  78. Var VERSION_EXISTS
  79. Var VERSION_NEWER
  80. Var VERSION_OLDER
  81. Var CANCEL_INSTALLER
  82. Var VERSION_DATE
  83. Var LANG_NAME
  84. Var Status_SecGrpSetConfig
  85. Var MAJOR_D
  86. Var MINOR_D
  87. Var PATCH_D
  88. Var PATCH_ND
  89. Var LM_VERSION
  90. Var LM_VERSION_INST
  91. Var LM_VERSION_UNINST
  92. Var latest_version
  93. Var latest_pathexe
  94. Var BU_X
  95. Var BU_Y
  96. Var UAT
  97. Var OUAT
  98. Var USERS_APPDATA
  99. Var ADMIN_APPDATA
  100. Var USERS_NAME
  101. Var counter_tmp
  102. Var CurrentDirVar
  103. Var CurrentFileVar
  104. Var CONTEXT
  105. Var REG_CHARTDIRS
  106. Var USERNAME
  107. Var IS_ADMIN
  108. Var Compare_Version_Result
  109. Var Inst_Or_Uninst
  110. Var Marquee_Handle
  111. Var Banner_Text_Blink
  112. Var error_tmp
  113. # onSelChange
  114. Var ConfigSetLang
  115. Var ConfigSetChartDir
  116. Var SetConfig
  117. # Installer Pages
  118. Var Skip_Page_CleanUp
  119. Var Skip_Page_TypeInst
  120. Var Skip_Page_SetConfig
  121. Var Skip_Page_Directory
  122. Var Skip_Page_Startmenu
  123. Var Skip_Page_Confirm
  124. # Page_TypeInst
  125. Var Label_TypeInst_Reinstall
  126. Var RB_Reinstall
  127. Var Label_TypeInst_Upgrade
  128. Var RB_Upgrade
  129. Var Label_TypeInst_Downgrade
  130. Var RB_Downgrade
  131. Var Label_TypeInst_Parallel
  132. Var GroupBox_TypeInst
  133. Var RB_Parallel
  134. Var TI_REINSTALL
  135. Var TI_UPGRADE
  136. Var TI_DOWNGRADE
  137. Var TI_PARALLEL
  138. Var GroupBox_Size
  139. Var INSTALL_TYPE
  140. # Page_SetConfig
  141. Var Label_SetConfig
  142. Var GroupBox_Language_SetConfig
  143. Var CheckBox_Language_SetConfig
  144. Var GroupBox_ChartDir_SetConfig
  145. Var DirRequest_SetConfig
  146. Var Button_Delete_SetConfig
  147. Var Button_DeleteAll_SetConfig
  148. Var Button_Add_SetConfig
  149. Var ListBox_SetConfig
  150. ;# Page_SetConfig_Leave
  151. Var CHART_DIR_TMP_FILE
  152. Var CHART_DIR_EMPTY
  153. Var CONFIG_SET_LANG
  154. # Uninstaller Pages
  155. Var Skip_UnPage_Components
  156. ;--------------------------------
  157. ;# Execution Level
  158. RequestExecutionLevel highest
  159. ;--------------------------------
  160. ;# Includes
  161. !addincludedir "@CPACK_NSIS_DIR@/Include"
  162. !addplugindir "@CPACK_NSIS_DIR@/Plugins"
  163. !include MUI2.nsh
  164. !include LogicLib.nsh
  165. !include nsDialogs.nsh
  166. !include Sections.nsh
  167. !include StrFunc.nsh
  168. !include WordFunc.nsh
  169. !include TextFunc.nsh
  170. !include FileFunc.nsh
  171. !include WinVer.nsh
  172. !include UAC.nsh
  173. !define MUI_UI "@CPACK_NSIS_DIR@/UI/opencpn_ui.exe"
  174. ;--------------------------------
  175. ;# General
  176. ;# Name and file
  177. Name "@CPACK_NSIS_PACKAGE_NAME@"
  178. OutFile "@CPACK_TOPLEVEL_DIRECTORY@/${OUTPUT_FILE_NAME}"
  179. ;# Default installation folder
  180. InstallDir "$PROGRAMFILES\OpenCPN"
  181. BrandingText /TRIMLEFT "OpenCPN $(Installer) v${OCPN_INSTALLER_VERSION}"
  182. ;--------------------------------
  183. ;# Interface Settings
  184. !define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
  185. !define MUI_CUSTOMFUNCTION_UNGUIINIT un.myGuiInit
  186. !define MUI_ABORTWARNING
  187. ;# MUI Settings / Header
  188. !define MUI_ICON "@CPACK_PACKAGE_ICON@"
  189. !define MUI_HEADERIMAGE
  190. !define MUI_HEADERIMAGE_LEFT
  191. !define MUI_HEADERIMAGE_BITMAP "@CPACK_NSIS_DIR@\Bitmaps\header-install.bmp"
  192. !define MUI_HEADERIMAGE_UNBITMAP "@CPACK_NSIS_DIR@\Bitmaps\header-uninstall.bmp"
  193. ;# MUI Settings / Wizard
  194. !define MUI_WELCOMEFINISHPAGE_BITMAP "@CPACK_NSIS_DIR@\Bitmaps\wizard-install.bmp"
  195. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "@CPACK_NSIS_DIR@\Bitmaps\wizard-uninstall.bmp"
  196. ;# Set Multi-Language settings
  197. ;# Language Selection Dialog Settings
  198. ;# Show all languages, despite user's codepage
  199. !define MUI_LANGDLL_ALLLANGUAGES
  200. /*
  201. ;# Remember the installer language
  202. !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
  203. !define MUI_LANGDLL_REGISTRY_KEY "${REG_KEY_UN}"
  204. !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
  205. !define MUI_LANGDLL_WINDOWTITLE "$(LangDialog_Title)"
  206. !define MUI_LANGDLL_INFO "$(LangDialog_Text)"
  207. */
  208. ;--------------------------------
  209. ;# Calls for making respective functions available
  210. ${StrLoc}
  211. ;--------------------------------
  212. ;##################################################################################################
  213. ;# Macros #
  214. ;##################################################################################################
  215. !ifndef ___EnumHKU___
  216. !define ___EnumHKU___
  217. !include LogicLib.nsh
  218. !include WordFunc.nsh
  219. !define TOKEN_QUERY 0x0008
  220. !define TOKEN_ADJUST_PRIVILEGES 0x0020
  221. !define SE_RESTORE_NAME SeRestorePrivilege
  222. !define SE_PRIVILEGE_ENABLED 0x00000002
  223. !define HKEY_USERS 0x80000003
  224. Var key
  225. Var logged
  226. Var EnumHKU_counter
  227. Var SID
  228. Var USERPROFILE
  229. !macro _EnumHKU_AdjustTokens
  230. StrCpy $R1 0
  231. System::Call "kernel32::GetCurrentProcess() i .R0"
  232. System::Call "advapi32::OpenProcessToken(i R0, i ${TOKEN_QUERY}|${TOKEN_ADJUST_PRIVILEGES}, *i R1R1) i .R0"
  233. ${If} $R0 != 0
  234. System::Call "advapi32::LookupPrivilegeValue(t n, t '${SE_RESTORE_NAME}', *l .R2) i .R0"
  235. ${If} $R0 != 0
  236. System::Call "*(i 1, l R2, i ${SE_PRIVILEGE_ENABLED}) i .R0"
  237. System::Call "advapi32::AdjustTokenPrivileges(i R1, i 0, i R0, i 0, i 0, i 0)"
  238. System::Free $R0
  239. ${EndIf}
  240. System::Call "kernel32::CloseHandle(i R1)"
  241. ${EndIf}
  242. !macroend
  243. !macro _EnumHKU_InvokeCallback CALLBACK SUBKEY
  244. Push $0
  245. Push $1
  246. Push $R0
  247. Push $R1
  248. Push $R2
  249. Push $R3
  250. Push $R4
  251. Push $R5
  252. Push $R6
  253. Push "${SUBKEY}"
  254. Call "${CALLBACK}"
  255. Pop $R6
  256. Pop $R5
  257. Pop $R4
  258. Pop $R3
  259. Pop $R2
  260. Pop $R1
  261. Pop $R0
  262. Pop $1
  263. Pop $0
  264. !macroend
  265. !macro _EnumHKU_Load FILE CALLBACK SUBKEY
  266. GetFullPathName /SHORT $R2 ${FILE}
  267. System::Call "advapi32::RegLoadKeyW(i ${HKEY_USERS}, t '${SUBKEY}', t R2) i .R3"
  268. ${If} $R3 == 0
  269. !insertmacro _EnumHKU_InvokeCallback ${CALLBACK} "${SUBKEY}"
  270. ;System::Call "advapi32::RegUnLoadKeyW(i ${HKEY_USERS}, t '${SUBKEY}')"
  271. IntOp $EnumHKU_counter $EnumHKU_counter + 1
  272. ${EndIf}
  273. !macroend
  274. !macro EnumHKU UN CALLBACK SUBKEY
  275. Push $0
  276. Push $1
  277. StrCpy $EnumHKU_counter 0
  278. GetFunctionAddress $0 "${CALLBACK}"
  279. StrCpy $1 "${SUBKEY}_$EnumHKU_counter"
  280. StrCpy $key ${SUBKEY}
  281. Call ${UN}_EnumHKU
  282. Pop $1
  283. Pop $0
  284. !macroend
  285. !define EnumHKU '!insertmacro EnumHKU ""'
  286. !define un.EnumHKU '!insertmacro EnumHKU "un."'
  287. !macro _EnumHKU UN
  288. Function ${UN}_EnumHKU
  289. Push $R0
  290. Push $R1
  291. Push $R2
  292. Push $R3
  293. Push $R4
  294. Push $R5
  295. Push $R6
  296. # enumerate logged on users
  297. StrCpy $R0 0
  298. ${Do}
  299. EnumRegKey $R1 HKU "" $R0
  300. ${If} $R1 != ""
  301. StrLen $R4 $R1
  302. ${If} $R4 > 8
  303. StrCpy $R6 0
  304. ${WordFind} "$R1" "_Classes" "E*" $R6
  305. IfErrors 0 cont
  306. ReadRegStr $R5 HKU "$R1\Volatile Environment" USERPROFILE
  307. ExpandEnvStrings $R5 $R5
  308. StrCpy $USERPROFILE $R5
  309. StrCpy $logged "on"
  310. !insertmacro _EnumHKU_InvokeCallback $0 $R1
  311. StrCpy $USERPROFILE ""
  312. StrCpy $logged ""
  313. ${EndIf}
  314. cont:
  315. IntOp $R0 $R0 + 1
  316. ${EndIf}
  317. ${LoopUntil} $R1 == ""
  318. # enumerate logged off users
  319. System::Call "kernel32::GetVersion() i .R0"
  320. IntOp $R0 $R0 & 0x80000000
  321. ${If} $R0 == 0
  322. # nt
  323. !insertmacro _EnumHKU_AdjustTokens
  324. StrCpy $R0 0
  325. ${Do}
  326. EnumRegKey $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $R0
  327. ${If} $R1 != ""
  328. StrLen $R4 $R1
  329. ${If} $R4 > 8
  330. ClearErrors
  331. ReadRegStr $R5 HKU "$R1\Volatile Environment" HOMEPATH
  332. IfErrors 0 cont1
  333. ReadRegStr $R5 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$R1" ProfileImagePath
  334. ExpandEnvStrings $R5 $R5
  335. StrCpy $USERPROFILE $R5
  336. StrCpy $logged "off"
  337. !insertmacro _EnumHKU_Load "$R5\NTUSER.DAT" $0 $1
  338. StrCpy $1 "$key_$EnumHKU_counter"
  339. StrCpy $USERPROFILE ""
  340. StrCpy $logged ""
  341. ${EndIf}
  342. cont1:
  343. IntOp $R0 $R0 + 1
  344. ${EndIf}
  345. ${LoopUntil} $R1 == ""
  346. ${Else}
  347. # 9x
  348. ClearErrors
  349. FindFirst $R1 $R2 "$WINDIR\Profiles\*.*"
  350. ${Unless} ${Errors}
  351. ${Do}
  352. ${If} $R2 != "."
  353. ${AndIf} $R2 != ".."
  354. ${If} ${FileExists} "$WINDIR\Profiles\$R2\USER.DAT"
  355. !insertmacro _EnumHKU_Load "$WINDIR\Profiles\$R2\USER.DAT" $0 $1
  356. ${EndIf}
  357. ${EndIf}
  358. ClearErrors
  359. FindNext $R1 $R2
  360. ${LoopUntil} ${Errors}
  361. FindClose $R1
  362. ${EndUnless}
  363. ${Endif}
  364. Pop $R6
  365. Pop $R5
  366. Pop $R4
  367. Pop $R3
  368. Pop $R2
  369. Pop $R1
  370. Pop $R0
  371. FunctionEnd
  372. !macroend
  373. !insertmacro _EnumHKU ""
  374. !insertmacro _EnumHKU "un."
  375. !endif
  376. !macro IndexOf Var Str Char
  377. Push "${Char}"
  378. Push "${Str}"
  379. Call IndexOf
  380. Pop "${Var}"
  381. !macroend
  382. !define IndexOf "!insertmacro IndexOf"
  383. !macro RIndexOf Var Str Char
  384. Push "${Char}"
  385. Push "${Str}"
  386. Call RIndexOf
  387. Pop "${Var}"
  388. !macroend
  389. !define RIndexOf "!insertmacro RIndexOf"
  390. !macro Explode Length Separator String
  391. Push `${Separator}`
  392. Push `${String}`
  393. Call Explode
  394. Pop `${Length}`
  395. !macroend
  396. !macro unExplode Length Separator String
  397. Push `${Separator}`
  398. Push `${String}`
  399. Call un.Explode
  400. Pop `${Length}`
  401. !macroend
  402. !ifndef _RecFind_Included
  403. !define _RecFind_Included
  404. Var _RecFindVar1
  405. Var _RecFindVar2
  406. !macro _RecFindOpen Dir CurrentDirVar CurrentFileVar
  407. !define _Local `${__LINE__}`
  408. !define _Dir `${Dir}`
  409. !define _CurrentDirVar `${CurrentDirVar}`
  410. !define _CurrentFileVar `${CurrentFileVar}`
  411. !define _RecFindOpenSet
  412. StrCpy $_RecFindVar2 1
  413. Push ``
  414. `nextDir${_Local}:`
  415. Pop `${_CurrentDirVar}`
  416. IntOp $_RecFindVar2 $_RecFindVar2 - 1
  417. !macroend
  418. !define RecFindOpen `!insertmacro _RecFindOpen`
  419. !macro _RecFindFirst
  420. !ifndef _RecFindOpenSet
  421. !error `Incorrect use of RecFind commands!`
  422. !else
  423. !define _RecFindFirstSet
  424. !endif
  425. ClearErrors
  426. FindFirst $_RecFindVar1 `${_CurrentFileVar}` `${_Dir}${_CurrentDirVar}\*.*`
  427. IfErrors `Done${_Local}`
  428. `checkFile${_Local}:`
  429. StrCmp ${_CurrentFileVar} . `nextFile${_Local}`
  430. StrCmp ${_CurrentFileVar} .. `nextFile${_Local}`
  431. IfFileExists `${_Dir}${_CurrentDirVar}\${_CurrentFileVar}\*.*` 0 +4
  432. Push `${_CurrentDirVar}\${_CurrentFileVar}`
  433. IntOp $_RecFindVar2 $_RecFindVar2 + 1
  434. Goto `nextFile${_Local}`
  435. !macroend
  436. !define RecFindFirst `!insertmacro _RecFindFirst`
  437. !macro _RecFindNext
  438. !ifndef _RecFindOpenSet | _RecFindFirstSet
  439. !error `Incorrect use of RecFind commands!`
  440. !else
  441. !define _RecFindNextSet
  442. !endif
  443. `nextFile${_Local}:`
  444. ClearErrors
  445. FindNext $_RecFindVar1 `${_CurrentFileVar}`
  446. IfErrors 0 `checkFile${_Local}`
  447. StrCmp $_RecFindVar2 0 +3
  448. FindClose $_RecFindVar1
  449. Goto `nextDir${_Local}`
  450. !macroend
  451. !define RecFindNext `!insertmacro _RecFindNext`
  452. !macro _RecFindClose
  453. !ifndef _RecFindOpenSet | _RecFindFirstSet | _RecFindNextSet
  454. !error `Incorrect use of RecFind commands!`
  455. !else
  456. !undef _RecFindOpenSet
  457. !undef _RecFindFirstSet
  458. !undef _RecFindNextSet
  459. !endif
  460. `Done${_Local}:`
  461. FindClose $_RecFindVar1
  462. StrCmp $_RecFindVar2 0 +4
  463. Pop $_RecFindVar1
  464. IntOp $_RecFindVar2 $_RecFindVar2 - 1
  465. Goto -3
  466. !undef _CurrentFileVar
  467. !undef _CurrentDirVar
  468. !undef _Dir
  469. !undef _Local
  470. !macroend
  471. !define RecFindClose `!insertmacro _RecFindClose`
  472. !endif
  473. ;--------------------------------------------------------------------------------------------------
  474. ;##################################################################################################
  475. ;# PAGES #
  476. ;##################################################################################################
  477. ;# Installer Pages #
  478. ;##################################################################################################
  479. /* Var Skip_Page_CleanUp
  480. Var Skip_Page_TypeInst
  481. Var Skip_Page_SetConfig
  482. Var Skip_Page_Directory
  483. Var Skip_Page_Startmenu
  484. Var Skip_Page_Confirm
  485. */
  486. ;# Welcome page
  487. !define MUI_WELCOMEPAGE_TITLE_3LINES
  488. !insertmacro MUI_PAGE_WELCOME
  489. ;# License page
  490. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE Page_License_Leave
  491. ;!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
  492. !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
  493. !define MUI_LICENSEPAGE_TEXT_BOTTOM $(License_Message)
  494. !insertmacro MUI_PAGE_LICENSE $(license)
  495. ;# Clean up page - only shown if previous installation(s) <= 2.2.823 were found - checked in .onInit function
  496. Page custom Page_CleanUp Page_CleanUp_Leave
  497. ;# Install type page - only shown if previous installation(s) > 2.2.823 were found - checked in .onInit function
  498. Page custom Page_TypeInst Page_TypeInst_Leave
  499. ;# Components page
  500. !define MUI_COMPONENTSPAGE_SMALLDESC
  501. !define MUI_PAGE_HEADER_TEXT $(CP_HEADER_TEXT)
  502. !define MUI_PAGE_HEADER_SUBTEXT $(CP_HEADER_SUBTEXT)
  503. !define MUI_COMPONENTSPAGE_TEXT_TOP $(CP_TOP)
  504. !define MUI_COMPONENTSPAGE_TEXT_COMPLIST $(CP_COMPLIST)
  505. !define MUI_COMPONENTSPAGE_TEXT_INSTTYPE "" ;#CHANGE $(CP_INSTTYPE)
  506. ;!define MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE $(CP_DESCRIPTION_TITLE) ;# for this we can use the default text
  507. ;!define MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO $(CP_DESCRIPTION_INFO) ;# for this we can use the default text
  508. !define MUI_PAGE_CUSTOMFUNCTION_PRE Page_Components_Pre
  509. !define MUI_PAGE_CUSTOMFUNCTION_SHOW Page_Components_Show
  510. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE Page_Components_Leave
  511. !insertmacro MUI_PAGE_COMPONENTS
  512. ;# Directory page - allows for changing/ selecting the install directory
  513. !define MUI_DIRECTORYPAGE_VERIFYONLEAVE
  514. !define MUI_PAGE_CUSTOMFUNCTION_PRE Page_Directory_Pre
  515. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE Page_Directory_Leave
  516. !insertmacro MUI_PAGE_DIRECTORY
  517. ;# Start Menu Folder page - allows for changing/ selecting the Start Menu Folder (if Shortcuts get installed is configured on the Components page)
  518. !define MUI_STARTMENUPAGE_NODISABLE
  519. !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
  520. !define MUI_STARTMENUPAGE_REGISTRY_KEY "${REG_KEY_UN}"
  521. !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartMenuFolder"
  522. !define MUI_STARTMENUPAGE_DEFAULTFOLDER "OpenCPN"
  523. !define MUI_PAGE_CUSTOMFUNCTION_PRE Page_Startmenu_Pre
  524. !insertmacro MUI_PAGE_STARTMENU "Application" $STARTMENU_FOLDER
  525. ;# Set Config page - selecting chart director[y|ies] and setting the language in opencpn.ini - only available if opencpn.ini does not exist (or is being deleted)
  526. Page custom Page_SetConfig Page_SetConfig_Leave
  527. ;# Confirm page - shows all settings for the installation (is mainly needed to always have the 'Install' button on the right page, ie. if Start Menu page is skipped)
  528. Page custom Page_Confirm
  529. ;# Install page
  530. !define MUI_PAGE_CUSTOMFUNCTION_SHOW Page_Instfiles_Show
  531. !insertmacro MUI_PAGE_INSTFILES
  532. ;# Finish page
  533. #!define MUI_FINISHPAGE_RUN opencpn.exe
  534. !define MUI_FINISHPAGE_RUN
  535. !define MUI_FINISHPAGE_RUN_FUNCTION ExecAppFile
  536. !define MUI_FINISHPAGE_SHOWREADME install.log
  537. !define MUI_FINISHPAGE_SHOWREADME_TEXT $(Show_Readme_Text)
  538. !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
  539. !define MUI_FINISHPAGE_LINK $(Finish_Link_Text)
  540. !define MUI_FINISHPAGE_LINK_LOCATION $(Finish_Link_URL)
  541. !define MUI_FINISHPAGE_LINK_COLOR 000080
  542. !define MUI_FINISHPAGE_NOREBOOTSUPPORT
  543. !define MUI_FINISHPAGE_TITLE_3LINES
  544. !insertmacro MUI_PAGE_FINISH
  545. ;--------------------------------
  546. ;##################################################################################################
  547. ;# Uninstaller Pages #
  548. ;##################################################################################################
  549. ;# Welcome page
  550. !define MUI_WELCOMEPAGE_TITLE_3LINES
  551. !insertmacro MUI_UNPAGE_WELCOME
  552. ;# Components page
  553. !define MUI_PAGE_CUSTOMFUNCTION_PRE un.Page_Components_Pre
  554. !insertmacro MUI_UNPAGE_COMPONENTS
  555. ;# Confirm page
  556. !insertmacro MUI_UNPAGE_CONFIRM
  557. ;# Uninstall page
  558. !insertmacro MUI_UNPAGE_INSTFILES
  559. ;# Finish page
  560. !define MUI_FINISHPAGE_TITLE_3LINES
  561. !insertmacro MUI_UNPAGE_FINISH
  562. ;--------------------------------------------------------------------------------------------------
  563. ;##################################################################################################
  564. ;# Languages #
  565. ;##################################################################################################
  566. ;# Languages
  567. !insertmacro MUI_LANGUAGE "English" ;# first language is the default language
  568. !insertmacro MUI_LANGUAGE "German"
  569. !include /NONFATAL "Langstrings_GERMAN.nsh"
  570. !insertmacro MUI_LANGUAGE "French"
  571. !include /NONFATAL "Langstrings_FRENCH.nsh"
  572. !insertmacro MUI_LANGUAGE "Czech"
  573. !include /NONFATAL "Langstrings_CZECH.nsh"
  574. !insertmacro MUI_LANGUAGE "Danish"
  575. !include /NONFATAL "Langstrings_DANISH.nsh"
  576. !insertmacro MUI_LANGUAGE "Spanish"
  577. !include /NONFATAL "Langstrings_SPANISH.nsh"
  578. !insertmacro MUI_LANGUAGE "Italian"
  579. !include /NONFATAL "Langstrings_ITALIAN.nsh"
  580. !insertmacro MUI_LANGUAGE "Dutch"
  581. !include /NONFATAL "Langstrings_DUTCH.nsh"
  582. !insertmacro MUI_LANGUAGE "Polish"
  583. !include /NONFATAL "Langstrings_POLISH.nsh"
  584. !insertmacro MUI_LANGUAGE "PortugueseBR"
  585. !include /NONFATAL "Langstrings_PORTUGUESEBR.nsh"
  586. !insertmacro MUI_LANGUAGE "Portuguese"
  587. !include /NONFATAL "Langstrings_PORTUGUESE.nsh"
  588. !insertmacro MUI_LANGUAGE "Russian"
  589. !include /NONFATAL "Langstrings_RUSSIAN.nsh"
  590. !insertmacro MUI_LANGUAGE "Swedish"
  591. !include /NONFATAL "Langstrings_SWEDISH.nsh"
  592. !insertmacro MUI_LANGUAGE "Finnish"
  593. !include /NONFATAL "Langstrings_FINNISH.nsh"
  594. !insertmacro MUI_LANGUAGE "Norwegian"
  595. !include /NONFATAL "Langstrings_NORWEGIAN.nsh"
  596. !insertmacro MUI_LANGUAGE "TradChinese"
  597. !include /NONFATAL "Langstrings_CHINESETW.nsh"
  598. !insertmacro MUI_LANGUAGE "Turkish"
  599. !include /NONFATAL "Langstrings_TURKISH.nsh"
  600. ;!insertmacro MUI_LANGUAGE "Hungarian"
  601. ;!include /NONFATAL "Langstrings_HUNGARIAN.nsh"
  602. ;--------------------------------
  603. ;# Reserve Files
  604. ;# If you are using solid compression, files that are required before
  605. ;# the actual installation should be stored first in the data block,
  606. ;# because this will make your installer start faster.
  607. !insertmacro MUI_RESERVEFILE_LANGDLL
  608. ;# Remember the installer language
  609. !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
  610. !define MUI_LANGDLL_REGISTRY_KEY "${REG_KEY_UN}"
  611. !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
  612. !define MUI_LANGDLL_WINDOWTITLE $(LangDialog_Title)
  613. !define MUI_LANGDLL_INFO $(LangDialog_Text)
  614. ;--------------------------------------------------------------------------------------------------
  615. ;##################################################################################################
  616. ;# S E C T I O N S #
  617. ;##################################################################################################
  618. ;# Installer Sections #
  619. ;##################################################################################################
  620. Section "-Topmost Section" SecTopmost ;# this needs to be always the first section to be executed!
  621. SetShellVarContext all
  622. SetOutPath $INSTDIR
  623. ;!ifndef NSIS_PACKEDVERSION
  624. ; LogSet on
  625. ;!endif
  626. ${If} $INSTALL_TYPE == 1
  627. ${OrIf} $INSTALL_TYPE == 2
  628. ${OrIf} $INSTALL_TYPE == 3
  629. ReadRegStr $0 HKLM "$Prev_Install_RegKey" "UninstallString"
  630. ${StrFilter} "$0" "" "" "$\"" $0
  631. ClearErrors
  632. ExecWait '"$0" /S /type=1 _?=$INSTDIR'
  633. IfErrors 0 +2
  634. DetailPrint "Error on uninstalling"
  635. Sleep 100
  636. Delete $0
  637. ${EndIf}
  638. SectionEnd
  639. ;# Reset/ Delete Config Section
  640. SectionGroup "!Reset Config Section Group" SecGrpResetConfig
  641. Section /o "Delete Config File Section" SecDeleteConfigFile
  642. ;# Delete config file (opencpn.ini)
  643. SetShellVarContext all
  644. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini"
  645. Delete "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini"
  646. ClearErrors
  647. ${EndIf}
  648. SectionEnd
  649. Section /o "Delete ChartDB Section" SecDeleteChartDB
  650. ;# Delete chart DB (CHRTLIST.DAT)
  651. SetShellVarContext all
  652. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\CHRTLIST.DAT"
  653. Delete "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\CHRTLIST.DAT"
  654. ClearErrors
  655. ${EndIf}
  656. SectionEnd
  657. Section /o "Delete SENC Section" SecDeleteSENC
  658. ;# Delete SENC directory
  659. SetShellVarContext all
  660. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\SENC\*.*"
  661. RMDir /r "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\SENC"
  662. ClearErrors
  663. ${EndIf}
  664. SectionEnd
  665. Section /o "Delete SENC Section" SecDeleteCM93
  666. ;# Delete SENC directory
  667. SetShellVarContext all
  668. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\cm93\*.*"
  669. RMDir /r "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\cm93"
  670. ClearErrors
  671. ${EndIf}
  672. SectionEnd
  673. Section /o "Delete Navobject Section" SecDeleteNavobjFile
  674. ;# Delete navobject file (navobj.xml)
  675. SetShellVarContext all
  676. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\navobj.xml"
  677. Delete "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\navobj.xml"
  678. ClearErrors
  679. ${EndIf}
  680. SectionEnd
  681. Section /o "Delete Log File Section" SecDeleteLogFile
  682. ;# Delete log file (opencpn.log)
  683. SetShellVarContext all
  684. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.log"
  685. Delete "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.log"
  686. ClearErrors
  687. ${EndIf}
  688. SectionEnd
  689. SectionGroupEnd
  690. ;# Shortcut Section
  691. SectionGroup /e "!Shortcuts Section Group" SecGrpShortcuts
  692. Section "Startmenu Shortcut Section" SecShortcutStartmenu
  693. ;# Start Menu
  694. SetShellVarContext all
  695. SetOutPath $INSTDIR
  696. !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  697. ;# Create shortcuts
  698. CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
  699. CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenCPN @CPACK_PACKAGE_VERSION@.lnk" "$INSTDIR\opencpn.exe"
  700. CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenCPN @CPACK_PACKAGE_VERSION@ - No OpenGL.lnk" "$INSTDIR\opencpn.exe" "/no_opengl"
  701. CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER\$(Uninstall_Folder_Name)"
  702. CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\$(Uninstall_Folder_Name)\$(Uninstall_Link).lnk" "$INSTDIR\Uninstall @CPACK_PACKAGE_VERSION@.exe"
  703. !insertmacro MUI_STARTMENU_WRITE_END
  704. SectionEnd
  705. Section "Desktop Shortcut Section" SecShortcutDesktop
  706. SetShellVarContext all
  707. CreateShortCut "$DESKTOP\OpenCPN @CPACK_PACKAGE_VERSION@.lnk" "$INSTDIR\opencpn.exe"
  708. SectionEnd
  709. SectionGroupEnd
  710. ;# Write Config Section
  711. Section "!Set Config Section" SecSetConfig
  712. ;# Write settings for config file (opencpn.ini) to HKLM Software\OpenCPN
  713. ${If} $CONFIG_SET_LANG == 1
  714. ;Call Write_Reg_Lang
  715. WriteRegStr HKLM "Software\OpenCPN" "InstallerLanguage" $REG_LANG
  716. ${EndIf}
  717. ${If} $CHART_DIR_TMP_FILE == 1
  718. Call Write_Reg_ChartDirs
  719. ${EndIf}
  720. SectionEnd
  721. ;# Install Section /hidden
  722. Section "-Install Section" SecInstall
  723. ;#File "@CPACK_BINDIR@\_CPack_Packages\win32\NSIS\opencpn_@CPACK_PACKAGE_VERSION@_setup\bin\opencpn-cmd.exe"
  724. ;#File "@CPACK_BINDIR@\_CPack_Packages\win32\NSIS\opencpn_@CPACK_PACKAGE_VERSION@_setup\bin\opencpn-glutil.exe"
  725. @CPACK_NSIS_FULL_INSTALL@
  726. @CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
  727. ;# Create uninstaller
  728. WriteUninstaller "$INSTDIR\Uninstall @CPACK_PACKAGE_VERSION@.exe"
  729. ;# Registry Entries
  730. SetShellVarContext all ;# make sure that we write to HKLM
  731. ;# HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN <DisplayVersion>
  732. WriteRegStr SHCTX "${REG_KEY_UN}" "DisplayName" "@CPACK_PACKAGE_NAME@ @CPACK_PACKAGE_VERSION@"
  733. WriteRegStr SHCTX "${REG_KEY_UN}" "DisplayVersion" "@CPACK_PACKAGE_VERSION@"
  734. WriteRegStr SHCTX "${REG_KEY_UN}" "CompareVersion" "$VERSION_DATE"
  735. WriteRegStr SHCTX "${REG_KEY_UN}" "StartMenuPath" "$SMPROGRAMS\$STARTMENU_FOLDER"
  736. WriteRegStr SHCTX "${REG_KEY_UN}" "InstallLocation" "$INSTDIR"
  737. WriteRegStr SHCTX "${REG_KEY_UN}" "UninstallString" "$\"$INSTDIR\Uninstall @CPACK_PACKAGE_VERSION@.exe$\""
  738. WriteRegStr SHCTX "${REG_KEY_UN}" "QuietUninstallString" "$\"$INSTDIR\Uninstall @CPACK_PACKAGE_VERSION@.exe /S$\""
  739. WriteRegStr SHCTX "${REG_KEY_UN}" "ConfigLocation" "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@"
  740. WriteRegStr SHCTX "${REG_KEY_UN}" "DisplayIcon" "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
  741. WriteRegStr SHCTX "${REG_KEY_UN}" "Publisher" "@CPACK_PACKAGE_VENDOR@"
  742. WriteRegDWORD SHCTX "${REG_KEY_UN}" "VersionMajor" $MAJOR_D
  743. WriteRegDWORD SHCTX "${REG_KEY_UN}" "VersionMinor" $MINOR_D
  744. WriteRegDWORD SHCTX "${REG_KEY_UN}" "VersionPatch" $PATCH_D
  745. WriteRegDWORD SHCTX "${REG_KEY_UN}" "NoModify" 1
  746. WriteRegDWORD SHCTX "${REG_KEY_UN}" "NoRepair" 1
  747. WriteRegStr SHCTX "${REG_KEY_UN}" "HelpLink" "http://opencpn.org/"
  748. WriteRegStr SHCTX "${REG_KEY_UN}" "URLInfoAbout" "http://opencpn.org/"
  749. WriteRegStr SHCTX "${REG_KEY_UN}" "Contact" "http://opencpn.org/"
  750. WriteRegStr SHCTX "${REG_KEY_UN}" "InstallUser" "$USERS_NAME"
  751. ${If} ${UAC_IsInnerInstance}
  752. WriteRegStr SHCTX "${REG_KEY_UN}" "InstallAdminUser" "$USERNAME"
  753. ${EndIf}
  754. ;# Create the config folder if it does not exist and set full access rights to it
  755. ${IfNot} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*"
  756. CreateDirectory "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@"
  757. Sleep 250
  758. ${EndIf}
  759. AccessControl::GrantOnFile "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete + FullAccess"
  760. ;# Save the log file
  761. StrCpy $0 "$INSTDIR\install.log"
  762. Push $0
  763. IfSilent +2 0
  764. Call DumpLog
  765. SectionEnd
  766. ;--------------------------------
  767. ;##################################################################################################
  768. ;# Uninstaller Sections #
  769. ;##################################################################################################
  770. Section "-un.Delete Config RegKey" UnSecDeleteConfigRegKey
  771. DeleteRegKey HKLM "${REG_KEY}"
  772. SectionEnd
  773. Section /o "-un.Backup Config to RegKey" UnSecBackupConfigToRegKey
  774. SetShellVarContext all
  775. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini"
  776. ClearErrors
  777. StrCpy $0 ""
  778. StrCpy $2 0
  779. loop:
  780. IntOp $2 $2 + 1
  781. ReadINIStr $1 "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini" "ChartDirectories" "ChartDir$2"
  782. StrCmp $1 "" cont
  783. ${WordReplace} "$1" "\\" "\" "+" $3
  784. ${unExplode} $4 "^" "$3"
  785. Pop $5
  786. StrCmp $5 "" cont
  787. StrCmp $0 "" 0 +2
  788. StrCpy $0 $5
  789. StrCpy $0 "$0;$5"
  790. Goto loop
  791. cont:
  792. WriteRegStr HKLM "${REG_KEY}" "ChartDirs" "$0"
  793. ReadINIStr $0 "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini" "Settings" "Locale"
  794. StrCmp $0 "" +2 0
  795. WriteRegStr HKLM "${REG_KEY}" "InstallerLanguage" "$0"
  796. ${EndIf}
  797. SectionEnd
  798. Section "un.Delete Config Folder" UnSecDeleteConfigFolder
  799. SetShellVarContext all
  800. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*"
  801. RMDir /r "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@"
  802. ClearErrors
  803. ${EndIf}
  804. SectionEnd
  805. Section "-un.Uninstall" UnSecUninstall
  806. ;# Delete all Shortcuts
  807. Push $INSTDIR
  808. Call un.Delete_Desktop_Shortcuts
  809. Push $INSTDIR
  810. Call un.Delete_Start_Menu_Shortcuts
  811. ;# Delete subdirs and files in INSTDIR
  812. ;# Remove the uninstaller itself
  813. ReadRegStr $0 HKLM "${REG_KEY_UN}" "UninstallString"
  814. ${StrFilter} "$0" "" "" "$\"" $0
  815. Delete $0
  816. ;#Delete $INSTDIR\opencpn-cmd.exe
  817. ;#Delete $INSTDIR\opencpn-glutil.exe
  818. ;# Remove the installation log file
  819. Delete "$INSTDIR\install.log"
  820. @CPACK_NSIS_DELETE_FILES@
  821. @CPACK_NSIS_DELETE_DIRECTORIES@
  822. ;# Remove the installation directory INSTDIR if it is empty
  823. ClearErrors
  824. RMDir "$INSTDIR"
  825. IfErrors 0 cont
  826. IfSilent cont
  827. MessageBox MB_OK|MB_ICONEXCLAMATION "$(Msg_Error_Remove_InstDir)"
  828. cont:
  829. ;# Remove RegKey
  830. DeleteRegKey HKLM "${REG_KEY_UN}"
  831. SectionEnd
  832. ;--------------------------------------------------------------------------------------------------
  833. ;##################################################################################################
  834. ;# F U N C T I O N S #
  835. ;##################################################################################################
  836. ;# Installer Functions #
  837. ;##################################################################################################
  838. ;# .onInit Function
  839. Function .onInit
  840. ;# Check if Windows version is at least XP (not Win 98, Win 2000 or older)
  841. ${IfNot} ${AtLeastWinXP}
  842. MessageBox MB_OK|MB_ICONEXCLAMATION "$(Installer_Unsupported_Windows_Version)"
  843. Abort
  844. ${Else}
  845. ${If} ${IsWinXP}
  846. ${AndIf} ${AtMostServicePack} 2
  847. MessageBox MB_OK|MB_ICONEXCLAMATION "$(Installer_Unsupported_XP_SP_Version)"
  848. Abort
  849. ${EndIf}
  850. ${EndIf}
  851. ;Prevent multiple instances of the installer
  852. ${IfNot} ${UAC_IsInnerInstance}
  853. System::Call 'kernel32::CreateMutexW(i 0, i 0, t "ocpn_inst_@CPACK_PACKAGE_VERSION@") i .r1 ?e'
  854. Pop $R0
  855. StrCmp $R0 0 +3
  856. MessageBox MB_OK|MB_ICONEXCLAMATION "$(Installer_Running)"
  857. Abort
  858. ${EndIf}
  859. Call GetUserInfo
  860. StrCpy $USERS_NAME $USERNAME
  861. ;# Macros to be inserted
  862. ${If} $IS_ADMIN == 1
  863. !insertmacro MUI_LANGDLL_DISPLAY
  864. ${EndIf}
  865. SetShellVarContext current
  866. StrCpy $USERS_APPDATA $APPDATA
  867. StrCpy $ADMIN_APPDATA $APPDATA
  868. ;# UAC check if user has Admin privileges and prompt for elevation if not
  869. uac_tryagain:
  870. !insertmacro UAC_RunElevated
  871. StrCpy $Inst_Or_Uninst "$(Installer)"
  872. ${Switch} $0
  873. ${Case} 0
  874. ${IfThen} $1 = 1 ${|} Quit ${|} ;# we are the outer process, the inner process has done its work, we are done
  875. ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;# we are admin, let the show go on
  876. ${If} $1 = 3 ;# RunAs completed successfully, but with a non-admin user
  877. MessageBox mb_IconExclamation|mb_TopMost|mb_SetForeground "$(Msg_UAC_Admin_Retry)" /SD IDNO IDOK uac_tryagain IDNO 0
  878. ${EndIf}
  879. ;# fall-through and die
  880. ${Case} 1223
  881. MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(Msg_UAC_Admin_Abort)"
  882. Quit
  883. ${Case} 1062
  884. MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(Msg_UAC_Logon_Abort)"
  885. Quit
  886. ${Default}
  887. MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(Msg_UAC_No_Elevation)"
  888. Quit
  889. ${EndSwitch}
  890. ########## from here we can be sure to run with admin privileges ##########
  891. ;# Delete all temporary files created during the installation
  892. Delete "$TEMP\opencpn_*.tmp"
  893. ;DeleteRegKey HKCU "Software\OpenCPN" ;# remove RegKey possibly exists - was used by versions 2.2.808 to 2.2.823
  894. ;# Check for unloaded Registry hive from previous installation attempt e.g. when installer crashed
  895. StrCpy $0 0
  896. !insertmacro _EnumHKU_AdjustTokens
  897. ${Do}
  898. EnumRegKey $1 HKU "" $0
  899. StrCmp $1 "" done
  900. IntOp $0 $0 + 1
  901. ClearErrors
  902. ${WordFind} "$1" "opencpn-inst-tmp-sid" "E*" $2
  903. IfErrors +2 0
  904. System::Call "advapi32::RegUnLoadKeyW(i ${HKEY_USERS}, t '$1') i .r3"
  905. ${Loop}
  906. done:
  907. ${If} ${UAC_IsInnerInstance}
  908. !insertmacro UAC_AsUser_GetGlobalVar $USERS_APPDATA
  909. !insertmacro UAC_AsUser_GetGlobalVar $USERS_NAME
  910. ${EndIf}
  911. ClearErrors
  912. Var /GLOBAL INST_PARAMS
  913. Var /GLOBAL FORCE_SCAN
  914. ${GetParameters} $INST_PARAMS
  915. ${GetOptions} "$INST_PARAMS" "/scan" $FORCE_SCAN
  916. IfErrors +2
  917. # Get the user's SID from the username
  918. ReadRegStr $0 HKCU "Volatile Environment" "USERNAME"
  919. System::Call /NOUNLOAD '*(&w${NSIS_MAX_STRLEN})i.R9'
  920. System::Call /NOUNLOAD 'advapi32::LookupAccountNameW(,t "$0",i R9,*i ${NSIS_MAX_STRLEN},w .R8,*i ${NSIS_MAX_STRLEN},*i .r4)i.r5'
  921. System::Call /NOUNLOAD 'advapi32::ConvertSidToStringSidW(i R9,*t .R8)i.r5'
  922. StrCpy $INST_USER_SID $R8
  923. Call VersionDate
  924. ;# check for previous installed versions conforming to this installer
  925. Call Check_Prev_Installs
  926. ;# check for old installed versions prior to the ones that uses this installer
  927. StrCpy $OLD_INSTALLS 0
  928. Call Reg_Scan_Old_Versions_HKLM
  929. Call EnumProfileList
  930. Call Get_Users_Values
  931. ${If} $OLD_INSTALLS == 0
  932. StrCpy $Skip_Page_CleanUp 1
  933. ${EndIf}
  934. ;# make sure that the DWORD values for the Registry only contain digits
  935. ${StrFilter} "@CPACK_PACKAGE_VERSION_MAJOR@" "1" "" "" $MAJOR_D
  936. ${StrFilter} "@CPACK_PACKAGE_VERSION_MINOR@" "1" "" "" $MINOR_D
  937. ${StrFilter} "@CPACK_PACKAGE_VERSION_PATCH@" "1" "" "" $PATCH_D
  938. ;Call GetAllUsers
  939. FunctionEnd
  940. ;--------------------------------
  941. ;# myGuiInit Function
  942. /*
  943. Var CONFIG_EMPTY
  944. Var INI_EXISTS
  945. Var CHARTDB_EXISTS
  946. Var SENC_EXISTS
  947. Var CM93_EXISTS
  948. Var NAVOBJ_EXISTS
  949. Var LOG_EXISTS
  950. Var REG_LANG
  951. Var Count_SecGrpResetConfig
  952. Var SecGrpEndSetConfig_Text
  953. */
  954. Function myGuiInit
  955. ;Get chosen installer language
  956. ${Switch} $LANGUAGE
  957. ${Case} ${LANG_CZECH}
  958. StrCpy $LANG_NAME "Čeština"
  959. StrCpy $REG_LANG "cs_CZ"
  960. ${Break}
  961. ${Case} ${LANG_DANISH}
  962. StrCpy $LANG_NAME "Dansk"
  963. StrCpy $REG_LANG "da_DK"
  964. ${Break}
  965. ${Case} ${LANG_GERMAN}
  966. StrCpy $LANG_NAME "Deutsch"
  967. StrCpy $REG_LANG "de_DE"
  968. ${Break}
  969. ${Case} ${LANG_ENGLISH}
  970. StrCpy $LANG_NAME "English"
  971. StrCpy $REG_LANG "en_US"
  972. ${Break}
  973. ${Case} ${LANG_SPANISH}
  974. StrCpy $LANG_NAME "Español"
  975. StrCpy $REG_LANG "es_ES"
  976. ${Break}
  977. ${Case} ${LANG_FRENCH}
  978. StrCpy $LANG_NAME "Français"
  979. StrCpy $REG_LANG "fr_FR"
  980. ${Break}
  981. ${Case} ${LANG_ITALIAN}
  982. StrCpy $LANG_NAME "Italiano"
  983. StrCpy $REG_LANG "it_IT"
  984. ${Break}
  985. ${Case} ${LANG_DUTCH}
  986. StrCpy $LANG_NAME "Nederlandse"
  987. StrCpy $REG_LANG "nl_NL"
  988. ${Break}
  989. ${Case} ${LANG_POLISH}
  990. StrCpy $LANG_NAME "Polski"
  991. StrCpy $REG_LANG "pl_PL"
  992. ${Break}
  993. ${Case} ${LANG_PORTUGUESE}
  994. StrCpy $LANG_NAME "Português"
  995. StrCpy $REG_LANG "pt_PT"
  996. ${Break}
  997. ${Case} ${LANG_PORTUGUESEBR}
  998. StrCpy $LANG_NAME "Português Brasileiro"
  999. StrCpy $REG_LANG "pt_BR"
  1000. ${Break}
  1001. ${Case} ${LANG_SWEDISH}
  1002. StrCpy $LANG_NAME "Svenska"
  1003. StrCpy $REG_LANG "sv_SE"
  1004. ${Break}
  1005. ${Case} ${LANG_RUSSIAN}
  1006. StrCpy $LANG_NAME "Русский"
  1007. StrCpy $REG_LANG "ru_RU"
  1008. ${Break}
  1009. ${Case} ${LANG_NORWEGIAN}
  1010. StrCpy $LANG_NAME "Norsk"
  1011. StrCpy $REG_LANG "nb_NO"
  1012. ${Break}
  1013. ${Case} ${LANG_FINNISH}
  1014. StrCpy $LANG_NAME "Suomalainen"
  1015. StrCpy $REG_LANG "fi_FI"
  1016. ${Break}
  1017. ${Case} ${LANG_TRADCHINESE}
  1018. StrCpy $LANG_NAME "正體中文"
  1019. StrCpy $REG_LANG "zh_TW"
  1020. ${Break}
  1021. ${Case} ${LANG_Turkish}
  1022. StrCpy $LANG_NAME "Türkçe"
  1023. StrCpy $REG_LANG "tr_TR"
  1024. ${Break}
  1025. ${Default}
  1026. ${Break}
  1027. ${EndSwitch}
  1028. ;# Set Sections Text
  1029. SectionSetText ${SecGrpShortcuts} $(SecGrpShortcuts_Text)
  1030. SectionSetText ${SecShortcutStartmenu} $(SecShortcutStartmenu_Text)
  1031. SectionSetText ${SecShortcutDesktop} $(SecShortcutDesktop_Text)
  1032. SectionSetText ${SecSetConfig} $(SecSetConfig_Text)
  1033. ;# Look for config dir ("%APPDATA%\opencpn) and the several config files
  1034. Call Check_Config_Exists
  1035. ${If} $CONFIG_EXISTS != 1
  1036. ${OrIf} $CONFIG_EMPTY == 1
  1037. Call Hide_SecGrpResetConfig
  1038. IntOp $0 ${SF_SELECTED} | ${SF_BOLD}
  1039. SectionSetFlags ${SecSetConfig} $0
  1040. StrCpy $SetConfig 1
  1041. ${EndIf}
  1042. SetShellVarContext all ;# switch SetShellVarContext back to ALL
  1043. FunctionEnd
  1044. ;--------------------------------
  1045. ;# onSelChange
  1046. ;Var ConfigSetLang
  1047. ;Var ConfigSetChartDir
  1048. ;Var SetConfig
  1049. Function .onSelChange
  1050. ;# Check if all available Sections in SecGrpResetConfig are selected => set SecGrpResetConfig to selected instead of partially selected
  1051. Push $0
  1052. Push $1
  1053. Push $2
  1054. Push $3
  1055. Push $R0
  1056. Push $R1
  1057. StrCpy $0 ${SecGrpResetConfig}
  1058. StrCpy $1 0
  1059. StrCpy $2 0
  1060. ${Do}
  1061. IntOp $0 $0 + 1
  1062. ${If} ${SectionIsSectionGroupEnd} $0
  1063. Goto end
  1064. ${EndIf}
  1065. SectionGetText $0 $R0
  1066. ${If} $R0 != ""
  1067. ${AndIf} ${SectionIsSelected} $0
  1068. Goto found_selected
  1069. ${ElseIf} $R0 != ""
  1070. ${AndIfNot} ${SectionIsSelected} $0
  1071. Goto found_unselected
  1072. ${EndIf}
  1073. ${Loop}
  1074. found_selected:
  1075. StrCpy $0 ${SecGrpResetConfig}
  1076. ${Do}
  1077. IntOp $0 $0 + 1
  1078. ${If} ${SectionIsSectionGroupEnd} $0
  1079. Goto end
  1080. ${EndIf}
  1081. SectionGetText $0 $R0
  1082. ${If} $R0 == ""
  1083. ${AndIfNot} ${SectionIsSelected} $0
  1084. SectionSetFlags $0 ${SF_SELECTED}
  1085. ${EndIf}
  1086. ${Loop}
  1087. found_unselected:
  1088. StrCpy $0 ${SecGrpResetConfig}
  1089. ${Do}
  1090. IntOp $0 $0 + 1
  1091. ${If} ${SectionIsSectionGroupEnd} $0
  1092. Goto end
  1093. ${EndIf}
  1094. SectionGetText $0 $R0
  1095. ${If} $R0 == ""
  1096. ${AndIf} ${SectionIsSelected} $0
  1097. !insertmacro ClearSectionFlag $0 ${SF_SELECTED}
  1098. ${EndIf}
  1099. ${Loop}
  1100. end:
  1101. SectionGetText ${SecDeleteConfigFile} $R1
  1102. ${If} $R1 != ""
  1103. ${IfNot} ${SectionIsReadOnly} ${SecSetConfig}
  1104. ${AndIfNot} ${SectionIsSelected} ${SecSetConfig}
  1105. ${AndIf} $SetConfig == 1
  1106. StrCpy $SetConfig 0
  1107. ${EndIf}
  1108. ${IfNot} ${SectionIsSelected} ${SecDeleteConfigFile}
  1109. ${AndIf} ${SectionIsSelected} ${SecSetConfig}
  1110. !insertmacro ClearSectionFlag ${SecSetConfig} ${SF_SELECTED}
  1111. IntOp $0 ${SF_RO} | ${SF_BOLD}
  1112. SectionSetFlags ${SecSetConfig} $0
  1113. ;SectionSetFlags ${SecSetConfig} ${SF_RO}
  1114. StrCpy $SetConfig 1
  1115. ${ElseIfNot} ${SectionIsSelected} ${SecDeleteConfigFile}
  1116. ${AndIfNot} ${SectionIsSelected} ${SecSetConfig}
  1117. IntOp $0 ${SF_RO} | ${SF_BOLD}
  1118. SectionSetFlags ${SecSetConfig} $0
  1119. ;SectionSetFlags ${SecSetConfig} ${SF_RO}
  1120. StrCpy $SetConfig 0
  1121. ${ElseIf} ${SectionIsSelected} ${SecDeleteConfigFile}
  1122. ${AndIfNot} ${SectionIsSelected} ${SecSetConfig}
  1123. ${AndIf} $SetConfig == 1
  1124. !insertmacro ClearSectionFlag ${SecSetConfig} ${SF_RO}
  1125. IntOp $0 ${SF_SELECTED} | ${SF_BOLD}
  1126. SectionSetFlags ${SecSetConfig} $0
  1127. ;SectionSetFlags ${SecSetConfig} ${SF_SELECTED}
  1128. ${ElseIf} ${SectionIsSelected} ${SecDeleteConfigFile}
  1129. ${AndIf} $SetConfig == 0
  1130. !insertmacro ClearSectionFlag ${SecSetConfig} ${SF_RO}
  1131. StrCpy $SetConfig 0
  1132. ${EndIf}
  1133. ${EndIf}
  1134. Pop $R1
  1135. Pop $R0
  1136. Pop $3
  1137. Pop $2
  1138. Pop $1
  1139. Pop $0
  1140. FunctionEnd
  1141. Function .OnInstFailed
  1142. Call InstallerEnd
  1143. FunctionEnd
  1144. Function .OnInstSuccess
  1145. Call InstallerEnd
  1146. FunctionEnd
  1147. Function .onGUIEnd
  1148. Call InstallerEnd
  1149. FunctionEnd
  1150. Function InstallerEnd
  1151. ;# Delete all temporary files created during the installation
  1152. Delete "$TEMP\opencpn_*.tmp"
  1153. ${If} $EnumHKU_counter > 0
  1154. ${ForEach} $1 $EnumHKU_counter 0 - 1
  1155. System::Call "advapi32::RegUnLoadKeyW(i ${HKEY_USERS}, t '$key_$1')"
  1156. ${Next}
  1157. ${Endif}
  1158. FunctionEnd
  1159. ;--------------------------------
  1160. ;##################################################################################################
  1161. ;# Installer Page Functions #
  1162. ;##################################################################################################
  1163. ;# Page_License_Leave
  1164. Function Page_License_Leave
  1165. FindWindow $mui.ComponentsPage "#32770" "" $HWNDPARENT
  1166. System::Call "*(i 0, i 0, i 4, i 8) i .r1"
  1167. System::Call "User32::MapDialogRect(i $mui.ComponentsPage, i r1) i .r2"
  1168. System::Call "*$1(i .r2, i.r3, i.r4, i.r5)"
  1169. System::Free $1
  1170. StrCpy $BU_X $4
  1171. StrCpy $BU_Y $5
  1172. FunctionEnd
  1173. ;--------------------------------
  1174. ;# Page_CleanUp
  1175. Var Label_CleanUp
  1176. Var Label_FullScan_CleanUp
  1177. Var GroupBox_CleanUp
  1178. Var ListBox_CleanUp
  1179. Var Button_FullScan_CleanUp
  1180. Var Button_UnselectAll_CleanUp
  1181. Var Button_SelectAll_CleanUp
  1182. Var Button_Uninstall_Selected_CleanUp
  1183. Var Banner_Handle
  1184. Var MSG_Box_Uninstall_Shown
  1185. Function Page_CleanUp
  1186. ${If} $Skip_Page_CleanUp == 1
  1187. Abort
  1188. ${EndIf}
  1189. !ifndef PBS_MARQUEE
  1190. !define PBS_MARQUEE 0x08
  1191. !endif
  1192. !ifndef PBM_SETMARQUEE
  1193. !define PBM_SETMARQUEE 0x040A
  1194. !endif
  1195. !ifndef GWL_STYLE
  1196. !define GWL_STYLE -16
  1197. !endif
  1198. ${IfNot} $MSG_Box_Uninstall_Shown == 1
  1199. MessageBox MB_YESNO|MB_ICONQUESTION "$(Msg_Uninstall_Old_Versions)" IDYES cont IDNO skip
  1200. ${Else}
  1201. Goto cont
  1202. ${EndIf}
  1203. skip:
  1204. Abort
  1205. cont:
  1206. StrCpy $MSG_Box_Uninstall_Shown 1
  1207. !insertmacro MUI_HEADER_TEXT "$(Page_CleanUp_Title)" "$(Page_CleanUp_Subtitle)"
  1208. nsDialogs::Create /NOUNLOAD 1018
  1209. Pop $0
  1210. ${If} $0 == error
  1211. Abort
  1212. ${EndIf}
  1213. ${NSD_CreateLabel} 0 0 200u 16u "$(LAB_FullScan_CleanUp)"
  1214. Pop $Label_FullScan_CleanUp
  1215. ${NSD_CreateButton} 220u 0 70u 15u "$(BT_FullScan_CleanUp)"
  1216. Pop $Button_FullScan_CleanUp
  1217. GetFunctionAddress $0 Button_FullScan_CleanUp_Click
  1218. nsDialogs::OnClick /NOUNLOAD $Button_FullScan_CleanUp $0
  1219. ${NSD_CreateLabel} 0 22u 100% 24u "$(Label_CleanUp_Text)"
  1220. Pop $Label_CleanUp
  1221. ${NSD_CreateGroupBox} 0 55u 100% 85u "$(Install_Location_Default)"
  1222. Pop $GroupBox_CleanUp
  1223. !define __NSD_ListBoxMultiselect_CLASS LISTBOX
  1224. !define __NSD_ListBoxMultiselect_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${LBS_DISABLENOSCROLL}|${LBS_HASSTRINGS}|${LBS_NOINTEGRALHEIGHT}|${LBS_NOTIFY}|${LBS_MULTIPLESEL}
  1225. !define __NSD_ListBoxMultiselect_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
  1226. !insertmacro __NSD_DefineControl ListBoxMultiselect
  1227. ${NSD_CreateListboxMultiselect} 10u 70u 200u 65u "$(LB_CleanUp)"
  1228. Pop $ListBox_CleanUp
  1229. GetFunctionAddress $0 ListBox_CleanUp_Change
  1230. nsDialogs::OnChange /NOUNLOAD $ListBox_CleanUp $0
  1231. ${NSD_CreateButton} 220u 70u 70u 15u "$(BT_UnselectAll_CleanUp)"
  1232. Pop $Button_UnselectAll_CleanUp
  1233. GetFunctionAddress $0 Button_UnselectAll_CleanUp_Click
  1234. nsDialogs::OnClick /NOUNLOAD $Button_UnselectAll_CleanUp $0
  1235. ${NSD_CreateButton} 220u 100u 70u 15u "$(BT_SelectAll_CleanUp)"
  1236. Pop $Button_SelectAll_CleanUp
  1237. GetFunctionAddress $0 Button_SelectAll_CleanUp_Click
  1238. nsDialogs::OnClick /NOUNLOAD $Button_SelectAll_CleanUp $0
  1239. ${NSD_CreateButton} 220u 120u 70u 15u "$(BT_Uninstall_Selected_CleanUp)"
  1240. Pop $Button_Uninstall_Selected_CleanUp
  1241. GetFunctionAddress $0 Button_Uninstall_Selected_CleanUp_Click
  1242. nsDialogs::OnClick /NOUNLOAD $Button_Uninstall_Selected_CleanUp $0
  1243. ;# First check if HDD scan was already done
  1244. ${If} ${FileExists} "$TEMP\opencpn_hdd_full_scan.tmp"
  1245. EnableWindow $Button_FullScan_CleanUp 0
  1246. EnableWindow $Label_FullScan_CleanUp 0
  1247. SendMessage $GroupBox_CleanUp ${WM_SETTEXT} 0 "STR:$(Install_Location_HDD_Scan)"
  1248. ClearErrors
  1249. FileOpen $R0 "$TEMP\opencpn_hdd_full_scan.tmp" r
  1250. IfErrors done1
  1251. ${Do}
  1252. FileReadUTF16LE $R0 $R1
  1253. ${If} $R1 == ""
  1254. Goto done1
  1255. ${Else}
  1256. ${TrimNewLines} $R1 $R1
  1257. SendMessage $ListBox_CleanUp ${LB_ADDSTRING} 0 "STR:$R1"
  1258. ${EndIf}
  1259. ${Loop}
  1260. done1:
  1261. FileClose $R0
  1262. ;# if not get values from LM_VERSION and opencpn_old_installs.tmp file
  1263. ${Else}
  1264. ${IfNot} ${FileExists} "$TEMP\opencpn_hdd_quick_scan.tmp"
  1265. ;# Scan the default locations for program installations on a per-user and all-users basis
  1266. Banner::show /NOUNLOAD /set 76 "$(Search_old_installations)"
  1267. Banner::getWindow /NOUNLOAD
  1268. Pop $Banner_Handle
  1269. ShowWindow $Banner_Handle ${SW_HIDE}
  1270. ${NSD_AddExStyle} $Banner_Handle ${WS_EX_APPWINDOW}
  1271. ShowWindow $Banner_Handle ${SW_SHOW}
  1272. GetDlgItem $2 $Banner_Handle 1030
  1273. SendMessage $2 ${WM_SETTEXT} 0 "STR:$(text_please_wait_1)"
  1274. ; Get progress bar handle.
  1275. GetDlgItem $Marquee_Handle $Banner_Handle 1004
  1276. ; Set PBS_MARQUEE style for the progress bar control.
  1277. System::Call "user32::GetWindowLong(i $Marquee_Handle, i ${GWL_STYLE}) i .r1"
  1278. System::Call "user32::SetWindowLong(i $Marquee_Handle, i ${GWL_STYLE}, i $1|${PBS_MARQUEE})"
  1279. ; Send PBM_SETMARQUEE message to start the marquee.
  1280. ; lParam is time in milliseconds between marquee animation updates.
  1281. SendMessage $Marquee_Handle ${PBM_SETMARQUEE} 1 50
  1282. System::Call "User32::SetWindowPos(i $Banner_Handle, i -1, i 0, i 0, i 0, i 0, i 83)"
  1283. HideWindow
  1284. Call Quick_Scan_Old_Versions
  1285. ShowWindow $HWNDPARENT ${SW_SHOW}
  1286. BringToFront
  1287. SendMessage $Marquee_Handle ${PBM_SETMARQUEE} 0 0
  1288. System::Call "user32::SetWindowLong(i $Marquee_Handle, i ${GWL_STYLE}, i $1)"
  1289. Banner::destroy
  1290. ${EndIf}
  1291. ClearErrors
  1292. FileOpen $R0 "$TEMP\opencpn_hdd_quick_scan.tmp" r
  1293. IfErrors done2
  1294. ${Do}
  1295. FileReadUTF16LE $R0 $R1
  1296. ${If} $R1 == ""
  1297. Goto done2
  1298. ${Else}
  1299. ${TrimNewLines} $R1 $R1
  1300. SendMessage $ListBox_CleanUp ${LB_ADDSTRING} 0 "STR:$R1"
  1301. ${EndIf}
  1302. ${Loop}
  1303. done2:
  1304. FileClose $R0
  1305. ${EndIf}
  1306. /*
  1307. ;# Pre-select all listbox-items
  1308. ${NSD_LB_GetCount} $ListBox_CleanUp $1
  1309. IntOp $1 $1 - 1
  1310. SendMessage $ListBox_CleanUp ${LB_SELITEMRANGEEX} 0 $1
  1311. */
  1312. Call ListBox_CleanUp_Change
  1313. nsDialogs::Show
  1314. FunctionEnd
  1315. Function Button_FullScan_CleanUp_Click
  1316. SendMessage $ListBox_CleanUp ${LB_RESETCONTENT} 0 0
  1317. Banner::show /NOUNLOAD /set 76 "$(Scanning_HDD)"
  1318. Banner::getWindow /NOUNLOAD
  1319. Pop $Banner_Handle
  1320. ShowWindow $Banner_Handle ${SW_HIDE}
  1321. SendMessage $Banner_Handle ${WM_SETTEXT} 0 "STR:$(OCPN_Scanning_HDD)"
  1322. ${NSD_AddExStyle} $Banner_Handle ${WS_EX_APPWINDOW}
  1323. ShowWindow $Banner_Handle ${SW_SHOW}
  1324. GetDlgItem $2 $Banner_Handle 1030
  1325. SendMessage $2 ${WM_SETTEXT} 0 "STR:$(text_please_wait_1)"
  1326. ; Get progress bar handle.
  1327. GetDlgItem $Marquee_Handle $Banner_Handle 1004
  1328. ; Set PBS_MARQUEE style for the progress bar control.
  1329. System::Call "user32::GetWindowLong(i $Marquee_Handle, i ${GWL_STYLE}) i .r1"
  1330. System::Call "user32::SetWindowLong(i $Marquee_Handle, i ${GWL_STYLE}, i $1|${PBS_MARQUEE})"
  1331. ; Send PBM_SETMARQUEE message to start the marquee.
  1332. ; lParam is time in milliseconds between marquee animation updates.
  1333. SendMessage $Marquee_Handle ${PBM_SETMARQUEE} 1 50
  1334. System::Call "User32::SetWindowPos(i $Banner_Handle, i -1, i 0, i 0, i 0, i 0, i 83)"
  1335. HideWindow
  1336. Call Full_Scan_Old_Versions
  1337. ${If} ${FileExists} "$TEMP\opencpn_hdd_full_scan.tmp"
  1338. Delete "$TEMP\opencpn_hdd_quick_scan.tmp"
  1339. ${EndIf}
  1340. ;# If install locations were found compare with Registry keys
  1341. ${If} $counter_tmp > 0
  1342. ${If} $LM_VERSION_INST != ""
  1343. ClearErrors
  1344. FileOpen $R0 "$TEMP\opencpn_hdd_full_scan.tmp" r
  1345. IfErrors done1
  1346. ${Do}
  1347. FileReadUTF16LE $R0 $R1
  1348. ${If} $R1 == ""
  1349. Goto done1
  1350. ${Else}
  1351. ${TrimNewLines} $R1 $R1
  1352. StrCmp $R1 $R2 done1
  1353. ${EndIf}
  1354. ${Loop}
  1355. ;# Path from Registry key wasn't found => delete RegKey
  1356. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1"
  1357. StrCpy $LM_VERSION_INST ""
  1358. done1:
  1359. FileClose $R0
  1360. ${EndIf}
  1361. ${If} ${FileExists} "$TEMP\opencpn_old_installs.tmp"
  1362. ;# Clear the stack
  1363. ClearErrors
  1364. ${Do}
  1365. Pop $0
  1366. IfErrors empty
  1367. ${Loop}
  1368. empty:
  1369. ClearErrors
  1370. FileOpen $R0 "$TEMP\opencpn_old_installs.tmp" r
  1371. IfErrors done3
  1372. ${Do}
  1373. FileReadUTF16LE $R0 $R3
  1374. FileReadUTF16LE $R0 $R2
  1375. ${If} $R3 == ""
  1376. Goto done3
  1377. ${Else}
  1378. ${TrimNewLines} $R3 $R3
  1379. ${TrimNewLines} $R2 $R2
  1380. FileReadUTF16LE $R0 $R1
  1381. ${TrimNewLines} $R1 $R1
  1382. ClearErrors
  1383. FileOpen $0 "$TEMP\opencpn_hdd_full_scan.tmp" r
  1384. IfErrors next
  1385. ${Do}
  1386. FileReadUTF16LE $0 $1
  1387. ${If} $1 == ""
  1388. Goto next
  1389. ${Else}
  1390. ${TrimNewLines} $1 $1
  1391. StrCmp $1 $R1 done2
  1392. ${EndIf}
  1393. ${Loop}
  1394. ;# Path from Registry key wasn't found => delete RegKey
  1395. DeleteRegKey HKU $R3
  1396. Goto next
  1397. done2:
  1398. Push $R1
  1399. Push $R2
  1400. Push $R3
  1401. next:
  1402. FileClose $0
  1403. ${EndIf}
  1404. ${Loop}
  1405. done3:
  1406. FileClose $R0
  1407. ClearErrors
  1408. FileOpen $R0 "$TEMP\opencpn_old_installs.tmp" w
  1409. IfErrors done4
  1410. ${Do}
  1411. Pop $R1
  1412. IfErrors done4
  1413. FileWriteUTF16LE $R0 $R1
  1414. FileWriteUTF16LE $R0 "$\r$\n"
  1415. ${Loop}
  1416. done4:
  1417. FileClose $R0
  1418. ${EndIf}
  1419. ${EndIf}
  1420. EnableWindow $Button_FullScan_CleanUp 0 ;# Disable the Scan HDD button after scan was done
  1421. EnableWindow $Label_FullScan_CleanUp 0 ;# Disable the Scan HDD label after scan was done
  1422. SendMessage $GroupBox_CleanUp ${WM_SETTEXT} 0 "STR:$(Install_Location_HDD_Scan)"
  1423. ShowWindow $HWNDPARENT ${SW_SHOW}
  1424. BringToFront
  1425. ; Stop the marquee and set the old styles back for the progress bar control.
  1426. SendMessage $Marquee_Handle ${PBM_SETMARQUEE} 0 0
  1427. System::Call "user32::SetWindowLong(i $Marquee_Handle, i ${GWL_STYLE}, i $1)"
  1428. Banner::destroy
  1429. FunctionEnd
  1430. Function Button_UnselectAll_CleanUp_Click
  1431. SendMessage $ListBox_CleanUp ${LB_SETSEL} FALSE -1
  1432. Call ListBox_CleanUp_Change
  1433. FunctionEnd
  1434. Function Button_SelectAll_CleanUp_Click
  1435. ${NSD_LB_GetCount} $ListBox_CleanUp $1
  1436. IntOp $1 $1 - 1
  1437. ${If} $1 == 0
  1438. IntOp $1 $1 + 1
  1439. ${EndIf}
  1440. SendMessage $ListBox_CleanUp ${LB_SELITEMRANGEEX} 0 $1
  1441. Call ListBox_CleanUp_Change
  1442. FunctionEnd
  1443. Function ListBox_CleanUp_Change
  1444. SendMessage $ListBox_CleanUp ${LB_GETSELCOUNT} 0 0 $1
  1445. ${NSD_LB_GetCount} $ListBox_CleanUp $2
  1446. ${If} $2 > 0
  1447. ${If} $1 == 0
  1448. EnableWindow $Button_Uninstall_Selected_CleanUp 0
  1449. EnableWindow $Button_UnselectAll_CleanUp 0
  1450. EnableWindow $Button_SelectAll_CleanUp 1
  1451. ${ElseIf} $1 > 0
  1452. ${AndIf} $1 == $2
  1453. EnableWindow $Button_Uninstall_Selected_CleanUp 1
  1454. EnableWindow $Button_UnselectAll_CleanUp 1
  1455. EnableWindow $Button_SelectAll_CleanUp 0
  1456. ${Else}
  1457. EnableWindow $Button_Uninstall_Selected_CleanUp 1
  1458. EnableWindow $Button_UnselectAll_CleanUp 1
  1459. EnableWindow $Button_SelectAll_CleanUp 1
  1460. ${EndIf}
  1461. ${Else}
  1462. EnableWindow $Button_Uninstall_Selected_CleanUp 0
  1463. EnableWindow $Button_UnselectAll_CleanUp 0
  1464. EnableWindow $Button_SelectAll_CleanUp 0
  1465. ${EndIf}
  1466. FunctionEnd
  1467. Var Uninstall_Path_Tmp
  1468. Function Button_Uninstall_Selected_CleanUp_Click
  1469. EnableWindow $Button_Uninstall_Selected_CleanUp 0
  1470. SendMessage $ListBox_CleanUp ${LB_GETSELCOUNT} 0 0 $1
  1471. ${NSD_LB_GetCount} $ListBox_CleanUp $2
  1472. ClearErrors
  1473. FileOpen $R0 "$TEMP\opencpn_uninstall.tmp" w
  1474. IfErrors done
  1475. IntOp $2 $2 - 1
  1476. ${ForEach} $3 $2 0 - 1
  1477. SendMessage $ListBox_CleanUp ${LB_GETSEL} $3 0 $4
  1478. ${If} $4 > 0
  1479. System::Call "User32::SendMessage(i $ListBox_CleanUp, i ${LB_GETTEXT}, i $3, t .r5)"
  1480. FileWriteUTF16LE $R0 "$5"
  1481. FileWriteUTF16LE $R0 "$\r$\n"
  1482. SendMessage $ListBox_CleanUp ${LB_DELETESTRING} $3 0
  1483. ${EndIf}
  1484. ${Next}
  1485. done:
  1486. FileClose $R0
  1487. Call ListBox_CleanUp_Change
  1488. StrCpy $R8 ""
  1489. StrCpy $R7 ""
  1490. StrCpy $R6 ""
  1491. StrCpy $R5 ""
  1492. ${If} ${FileExists} "$TEMP\opencpn_uninstall.tmp"
  1493. ${If} ${FileExists} "$TEMP\opencpn_hdd_full_scan.tmp"
  1494. StrCpy $R8 "opencpn_hdd_full_scan.tmp"
  1495. ${ElseIf} ${FileExists} "$TEMP\opencpn_hdd_quick_scan.tmp"
  1496. StrCpy $R8 "opencpn_hdd_quick_scan.tmp"
  1497. ${EndIf}
  1498. ${If} ${FileExists} "$TEMP\opencpn_old_installs.tmp"
  1499. StrCpy $R7 1
  1500. ${EndIf}
  1501. ${If} ${FileExists} "$TEMP\opencpn_old_uninstall_regkeys.tmp"
  1502. StrCpy $R6 1
  1503. ${EndIf}
  1504. ${If} ${FileExists} "$TEMP\opencpn_appdata.tmp"
  1505. StrCpy $R5 1
  1506. ${EndIf}
  1507. ClearErrors
  1508. FileOpen $R4 "$TEMP\opencpn_uninstall.tmp" r
  1509. IfErrors end
  1510. loop:
  1511. ClearErrors
  1512. FileReadUTF16LE $R4 $0
  1513. IfErrors end
  1514. StrCmp $0 "" loop
  1515. StrCmp $0 "$\r$\n" loop
  1516. ${TrimNewLines} $0 $0
  1517. StrCpy $Uninstall_Path_Tmp $0
  1518. ;# Delete installation directory
  1519. ClearErrors
  1520. Call Delete_Installation_Dir
  1521. IfErrors 0 +2
  1522. MessageBox MB_OK|MB_ICONEXCLAMATION "Error RMDir: $0" ;#ON ERROR
  1523. ;# If deleted installation was the one in the HKLM ...\OpenCPN_is1 subkey => delete RegKey
  1524. ${If} $LM_VERSION_INST != ""
  1525. StrCmp $0 $LM_VERSION_INST 0 cont
  1526. ClearErrors
  1527. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1"
  1528. IfErrors 0 +2
  1529. MessageBox MB_OK|MB_ICONEXCLAMATION "Error DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1" ;#ON ERROR
  1530. StrCpy $LM_VERSION ""
  1531. StrCpy $LM_VERSION_INST ""
  1532. StrCpy $LM_VERSION_UNINST ""
  1533. ${EndIf}
  1534. cont:
  1535. ;# Delete Start Menu shortcuts
  1536. Push $Uninstall_Path_Tmp
  1537. Call Delete_Start_Menu_Shortcuts
  1538. ;# Delete Desktop shortcuts
  1539. Push $Uninstall_Path_Tmp
  1540. Call Delete_Desktop_Shortcuts
  1541. ;# Delete RegKeys in HKU Software\opencpn.org\...
  1542. ${If} $R7 == 1
  1543. Call Update_Old_Installs
  1544. ${EndIf}
  1545. ;# Delete RegKeys in HKU Software\...\Uninstall\OpenCPN
  1546. ${If} $R6 == 1
  1547. Call Update_Old_Uninstalls
  1548. ${EndIf}
  1549. ;# Delete %APPDATA\opencpn folder
  1550. ${If} $R5 == 1
  1551. Call Update_Appdata
  1552. ${EndIf}
  1553. ${IfNot} $R8 == ""
  1554. Call Update_HDD_Scan
  1555. ${EndIf}
  1556. Goto loop
  1557. end:
  1558. FileClose $R4
  1559. Delete "$TEMP\opencpn_uninstall.tmp"
  1560. StrCpy $Uninstall_Path_Tmp ""
  1561. ${EndIf}
  1562. ${NSD_LB_GetCount} $ListBox_CleanUp $2
  1563. ${If} $2 == 0 ;# listbox is empty - all were uninstalled
  1564. StrCpy $Skip_Page_CleanUp 1
  1565. GetDlgItem $0 $HWNDPARENT 1
  1566. SendMessage $0 ${BM_CLICK} 0 0
  1567. ${EndIf}
  1568. FunctionEnd
  1569. Function Update_HDD_Scan
  1570. Push $0
  1571. Push $1
  1572. Push $2
  1573. Push $3
  1574. Push $4
  1575. Push $R0
  1576. Push $R8
  1577. ClearErrors
  1578. FileOpen $0 "$TEMP\$R8" r ;# open target file for reading
  1579. GetTempFileName $R0 ;# get new temp file name
  1580. FileOpen $1 $R0 w ;# open temp file for writing
  1581. IfErrors end
  1582. loop:
  1583. FileReadUTF16LE $0 $2 ;# read line from target file
  1584. IfErrors done ;# check if end of file reached
  1585. ${TrimNewLines} $2 $2
  1586. StrCmp $2 "$Uninstall_Path_Tmp" +2 ;# compare line with search string with CR/LF
  1587. FileWriteUTF16LE $1 "$2$\r$\n" ;# write line to temp file
  1588. Goto loop
  1589. done:
  1590. FileClose $0 ;# close target file
  1591. FileClose $1 ;# close temp file
  1592. Delete "$TEMP\$R8" ;# delete target file
  1593. CopyFiles /SILENT $R0 "$TEMP\$R8" ;# copy temp file to target file
  1594. Delete $R0 ;# delete temp file
  1595. end:
  1596. Pop $R8
  1597. Pop $R0
  1598. Pop $4
  1599. Pop $3
  1600. Pop $2
  1601. Pop $1
  1602. Pop $0
  1603. FunctionEnd
  1604. Function Update_Old_Installs
  1605. Push $0
  1606. Push $1
  1607. Push $2
  1608. Push $3
  1609. Push $4
  1610. Push $R0
  1611. Push $R1
  1612. ClearErrors
  1613. FileOpen $0 "$TEMP\opencpn_old_installs.tmp" r ;# open target file for reading
  1614. GetTempFileName $R0 ;# get new temp file name
  1615. FileOpen $1 $R0 w ;# open temp file for writing
  1616. IfErrors end
  1617. loop:
  1618. FileReadUTF16LE $0 $4 ;# read line from target file
  1619. FileReadUTF16LE $0 $3 ;# read line from target file
  1620. FileReadUTF16LE $0 $2 ;# read line from target file
  1621. IfErrors done ;# check if end of file reached
  1622. ${TrimNewLines} $2 $2
  1623. StrCmp $2 "$Uninstall_Path_Tmp" +5 ;# compare line with search string with CR/LF
  1624. FileWriteUTF16LE $1 $4 ;# write line to temp file
  1625. FileWriteUTF16LE $1 $3 ;# write line to temp file
  1626. FileWriteUTF16LE $1 "$2$\r$\n" ;# write line to temp file
  1627. Goto loop
  1628. ${TrimNewLines} $4 $4
  1629. DeleteRegKey HKU "$4"
  1630. ${WordFind} "$4" "\" "-2{*" $4
  1631. DeleteRegKey /ifempty HKU "$4"
  1632. ClearErrors
  1633. Goto loop
  1634. done:
  1635. FileClose $0 ;# close target file
  1636. FileClose $1 ;# close temp file
  1637. Delete "$TEMP\opencpn_old_installs.tmp" ;# delete target file
  1638. CopyFiles /SILENT $R0 "$TEMP\opencpn_old_installs.tmp" ;# copy temp file to target file
  1639. Delete $R0 ;# delete temp file
  1640. end:
  1641. Pop $R1
  1642. Pop $R0
  1643. Pop $4
  1644. Pop $3
  1645. Pop $2
  1646. Pop $1
  1647. Pop $0
  1648. FunctionEnd
  1649. Function Update_Old_Uninstalls
  1650. Push $0
  1651. Push $1
  1652. Push $2
  1653. Push $3
  1654. Push $4
  1655. Push $R0
  1656. Push $R1
  1657. ClearErrors
  1658. FileOpen $0 "$TEMP\opencpn_old_uninstall_regkeys.tmp" r ;# open target file for reading
  1659. GetTempFileName $R0 ;# get new temp file name
  1660. FileOpen $1 $R0 w ;# open temp file for writing
  1661. IfErrors end
  1662. loop:
  1663. FileReadUTF16LE $0 $4 ;# read line from target file
  1664. FileReadUTF16LE $0 $3 ;# read line from target file
  1665. FileReadUTF16LE $0 $2 ;# read line from target file
  1666. IfErrors done ;# check if end of file reached
  1667. ${TrimNewLines} $2 $2
  1668. StrCmp $2 "$Uninstall_Path_Tmp" +5 ;# compare line with search string with CR/LF
  1669. FileWriteUTF16LE $1 $4 ;# write line to temp file
  1670. FileWriteUTF16LE $1 $3 ;# write line to temp file
  1671. FileWriteUTF16LE $1 "$2$\r$\n" ;# write line to temp file
  1672. Goto loop
  1673. ${TrimNewLines} $3 $3
  1674. DeleteRegKey HKU "$3"
  1675. ClearErrors
  1676. Goto loop
  1677. done:
  1678. FileClose $0 ;# close target file
  1679. FileClose $1 ;# close temp file
  1680. Delete "$TEMP\opencpn_old_uninstall_regkeys.tmp" ;# delete target file
  1681. CopyFiles /SILENT $R0 "$TEMP\opencpn_old_uninstall_regkeys.tmp" ;# copy temp file to target file
  1682. Delete $R0 ;# delete temp file
  1683. end:
  1684. Pop $R1
  1685. Pop $R0
  1686. Pop $4
  1687. Pop $3
  1688. Pop $2
  1689. Pop $1
  1690. Pop $0
  1691. FunctionEnd
  1692. Function Update_Appdata
  1693. Push $0
  1694. Push $1
  1695. Push $2
  1696. Push $3
  1697. Push $4
  1698. Push $R0
  1699. Push $R1
  1700. ClearErrors
  1701. FileOpen $0 "$TEMP\opencpn_appdata.tmp" r ;# open target file for reading
  1702. GetTempFileName $R0 ;# get new temp file name
  1703. FileOpen $1 $R0 w ;# open temp file for writing
  1704. IfErrors end
  1705. loop:
  1706. FileReadUTF16LE $0 $4 ;# read line from target file
  1707. FileReadUTF16LE $0 $3 ;# read line from target file
  1708. FileReadUTF16LE $0 $2 ;# read line from target file
  1709. IfErrors done ;# check if end of file reached
  1710. ${TrimNewLines} $2 $2
  1711. StrCmp $2 "$Uninstall_Path_Tmp" +5 ;# compare line with search string with CR/LF
  1712. FileWriteUTF16LE $1 $4 ;# write line to temp file
  1713. FileWriteUTF16LE $1 $3 ;# write line to temp file
  1714. FileWriteUTF16LE $1 "$2$\r$\n" ;# write line to temp file
  1715. Goto loop
  1716. ${TrimNewLines} $3 $3
  1717. RMDir /r "$3\opencpn"
  1718. ClearErrors
  1719. Goto loop
  1720. done:
  1721. FileClose $0 ;# close target file
  1722. FileClose $1 ;# close temp file
  1723. Delete "$TEMP\opencpn_appdata.tmp" ;# delete target file
  1724. CopyFiles /SILENT $R0 "$TEMP\opencpn_appdata.tmp" ;# copy temp file to target file
  1725. Delete $R0 ;# delete temp file
  1726. end:
  1727. Pop $R1
  1728. Pop $R0
  1729. Pop $4
  1730. Pop $3
  1731. Pop $2
  1732. Pop $1
  1733. Pop $0
  1734. FunctionEnd
  1735. ;--------------------------------
  1736. ;# Page_CleanUp_Leave
  1737. Function Page_CleanUp_Leave
  1738. ${NSD_LB_GetCount} $ListBox_CleanUp $2
  1739. ${If} $2 > 0 ;# listbox is not empty - not all old versions were uninstalled
  1740. MessageBox MB_YESNO|MB_ICONQUESTION "$(Msg_Not_All_Old_Uninstalled)" IDYES leaving
  1741. Abort
  1742. ${EndIf}
  1743. leaving:
  1744. SendMessage $ListBox_CleanUp ${LB_RESETCONTENT} 0 0
  1745. FunctionEnd
  1746. ;--------------------------------
  1747. ;# Page_TypeInst
  1748. /* Var Label_TypeInst_Reinstall
  1749. Var RB_Reinstall
  1750. Var Label_TypeInst_Upgrade
  1751. Var RB_Upgrade
  1752. Var Label_TypeInst_Downgrade
  1753. Var RB_Downgrade
  1754. Var Label_TypeInst_Parallel
  1755. Var GroupBox_TypeInst
  1756. Var RB_Parallel
  1757. Var TI_REINSTALL
  1758. Var TI_UPGRADE
  1759. Var TI_DOWNGRADE
  1760. Var TI_PARALLEL
  1761. Var GroupBox_Size
  1762. Var INSTALL_TYPE
  1763. */
  1764. Function Page_TypeInst
  1765. ${If} $Skip_Page_TypeInst == 1
  1766. Abort
  1767. ${EndIf}
  1768. ${If} $VERSION_EXISTS == 1
  1769. !insertmacro MUI_HEADER_TEXT $(Page_TypeInst_Title_Exists) $(Page_TypeInst_Subtitle_Exists)
  1770. ${ElseIf} $MULTIPLE_INSTALLS == 1
  1771. !insertmacro MUI_HEADER_TEXT $(Page_TypeInst_Title_1) $(Page_TypeInst_Subtitle_1)
  1772. ${ElseIf} $MULTIPLE_INSTALLS > 1
  1773. !insertmacro MUI_HEADER_TEXT $(Page_TypeInst_Title) $(Page_TypeInst_Subtitle)
  1774. ${EndIf}
  1775. nsDialogs::Create /NOUNLOAD 1018
  1776. Pop $0
  1777. ${If} $0 == error
  1778. Abort
  1779. ${EndIf}
  1780. ;Case 1: same version already installed => Option 1: Reinstall
  1781. ${If} $VERSION_EXISTS == 1
  1782. ${NSD_CreateLabel} 0 0 100% 40u "$(Label_TypeInst_Reinstall_Text)"
  1783. Pop $Label_TypeInst_Reinstall
  1784. ${NSD_CreateRadioButton} 10u 65u 100% 10u "$(RB_Reinstall_TypeInst_Text)"
  1785. Pop $RB_Reinstall
  1786. ${NSD_AddStyle} $RB_Reinstall ${WS_GROUP}
  1787. ${NSD_SetState} $RB_Reinstall ${BST_CHECKED}
  1788. StrCpy $GroupBox_Size 1
  1789. ;Case 2: one older previous installation => Option 1: Upgrade Option 2: Parallel Installation
  1790. ${ElseIf} $MULTIPLE_INSTALLS == 1
  1791. ${AndIf} $VERSION_NEWER == 1
  1792. ${NSD_CreateLabel} 0 0 100% 32u "$(Label_TypeInst_Upgrade_Text)"
  1793. Pop $Label_TypeInst_Upgrade
  1794. ${NSD_CreateRadioButton} 10u 65u 100% 10u "$(RB_Upgrade_TypeInst_Text)"
  1795. Pop $RB_Upgrade
  1796. ${NSD_AddStyle} $RB_Upgrade ${WS_GROUP}
  1797. ${If} $TI_UPGRADE != ""
  1798. ${NSD_SetState} $RB_Upgrade $TI_UPGRADE
  1799. ${ElseIf} $TI_UPGRADE == ""
  1800. ${AndIf} $TI_PARALLEL == ""
  1801. ${NSD_SetState} $RB_Upgrade ${BST_CHECKED}
  1802. ${EndIf}
  1803. ${NSD_CreateRadioButton} 10u 85u 100% 10u "$(RB_Parallel_TypeInst_Text)"
  1804. Pop $RB_Parallel
  1805. ${If} $TI_PARALLEL != ""
  1806. ${NSD_SetState} $RB_Parallel $TI_PARALLEL
  1807. ${EndIf}
  1808. StrCpy $GroupBox_Size 2
  1809. ;Case 3: one newer previous installation => Option 1: Downgrade Option 2: Parallel Installation
  1810. ${ElseIf} $MULTIPLE_INSTALLS == 1
  1811. ${AndIf} $VERSION_OLDER == 1
  1812. ${NSD_CreateLabel} 0 0 100% 32u "$(Label_TypeInst_Downgrade_Text)"
  1813. Pop $Label_TypeInst_Downgrade
  1814. ${NSD_CreateRadioButton} 10u 65u 100% 10u "$(RB_Downgrade_TypeInst_Text)"
  1815. Pop $RB_Downgrade
  1816. ${NSD_AddStyle} $RB_Downgrade ${WS_GROUP}
  1817. ${If} $TI_DOWNGRADE != ""
  1818. ${NSD_SetState} $RB_Upgrade $TI_DOWNGRADE
  1819. ${ElseIf} $TI_DOWNGRADE == ""
  1820. ${AndIf} $TI_PARALLEL == ""
  1821. ${NSD_SetState} $RB_Downgrade ${BST_CHECKED}
  1822. ${EndIf}
  1823. ${NSD_CreateRadioButton} 10u 85u 100% 10u "$(RB_Parallel_TypeInst_Text)"
  1824. Pop $RB_Parallel
  1825. ${If} $TI_PARALLEL != ""
  1826. ${NSD_SetState} $RB_Parallel $TI_PARALLEL
  1827. ${EndIf}
  1828. StrCpy $GroupBox_Size 2
  1829. ;Case 4: more than one previous installation => Option 1: Parallel Installation
  1830. ${ElseIf} $MULTIPLE_INSTALLS > 1
  1831. ${NSD_CreateLabel} 0 0 100% 32u "$(Label_TypeInst_Parallel_Text)"
  1832. Pop $Label_TypeInst_Parallel
  1833. ${NSD_CreateRadioButton} 10u 65u 100% 10u "$(RB_Parallel_TypeInst_Text)"
  1834. Pop $RB_Parallel
  1835. ${NSD_AddStyle} $RB_Parallel ${WS_GROUP}
  1836. ${NSD_SetState} $RB_Parallel ${BST_CHECKED}
  1837. StrCpy $GroupBox_Size 1
  1838. ${EndIf}
  1839. ${If} $GroupBox_Size == 1
  1840. ${NSD_CreateGroupBox} 0 50u 100% 35u "Install Type"
  1841. Pop $GroupBox_TypeInst
  1842. ${ElseIf} $GroupBox_Size == 2
  1843. ${NSD_CreateGroupBox} 0 50u 100% 55u "Install Type"
  1844. Pop $GroupBox_TypeInst
  1845. ${EndIf}
  1846. nsDialogs::Show
  1847. FunctionEnd
  1848. ;--------------------------------
  1849. ;# Page_TypeInst_Leave
  1850. Function Page_TypeInst_Leave
  1851. ${If} $RB_Reinstall != ""
  1852. ${NSD_GetState} $RB_Reinstall $TI_REINSTALL
  1853. ${EndIf}
  1854. ${If} $RB_Upgrade != ""
  1855. ${NSD_GetState} $RB_Upgrade $TI_UPGRADE
  1856. ${EndIf}
  1857. ${If} $RB_Downgrade != ""
  1858. ${NSD_GetState} $RB_Downgrade $TI_DOWNGRADE
  1859. ${EndIf}
  1860. ${If} $RB_Parallel != ""
  1861. ${NSD_GetState} $RB_Parallel $TI_PARALLEL
  1862. ${EndIf}
  1863. StrCpy $Skip_Page_Directory ""
  1864. ${If} $TI_REINSTALL == 1
  1865. StrCpy $INSTALL_TYPE 1
  1866. ${ElseIf} $TI_UPGRADE == 1
  1867. StrCpy $INSTALL_TYPE 2
  1868. ${ElseIf} $TI_DOWNGRADE == 1
  1869. StrCpy $INSTALL_TYPE 3
  1870. ${ElseIf} $TI_PARALLEL == 1
  1871. StrCpy $INSTALL_TYPE 4
  1872. ${EndIf}
  1873. ${If} $INSTALL_TYPE == 1
  1874. ${OrIf} $INSTALL_TYPE == 2
  1875. ${OrIf} $INSTALL_TYPE == 3
  1876. StrCpy $Skip_Page_Directory 1
  1877. ReadRegStr $0 HKLM "$Prev_Install_RegKey" "InstallLocation"
  1878. StrCpy $INSTDIR $0
  1879. ${EndIf}
  1880. ; On Upgrade or Downgrade, tentatively trim any Package Version trailer from install location
  1881. ${If} $INSTALL_TYPE == 2
  1882. ${OrIf} $INSTALL_TYPE == 3
  1883. StrCpy $R1 0
  1884. Push $INSTDIR
  1885. Push "OpenCPN"
  1886. Push ">"
  1887. Call StrLoc
  1888. Pop $0
  1889. StrCpy $R1 $INSTDIR $0
  1890. StrCpy $R1 "$R1OpenCPN"
  1891. StrLen $R2 $INSTDIR
  1892. StrLen $R3 $R1
  1893. ; If Previous install dir was a parallel, make the upgrade also parallel.
  1894. ${If} $R2 > $R3
  1895. StrCpy $INSTDIR "$R1 @CPACK_PACKAGE_VERSION@"
  1896. ${Else}
  1897. StrCpy $INSTDIR $R1
  1898. ${Endif}
  1899. ${Endif}
  1900. ${If} $INSTALL_TYPE == 4
  1901. StrCpy $INSTDIR "$PROGRAMFILES\OpenCPN @CPACK_PACKAGE_VERSION@"
  1902. ${EndIf}
  1903. FunctionEnd
  1904. ;--------------------------------
  1905. ;# Page_Components_Pre
  1906. Function Page_Components_Pre
  1907. FunctionEnd
  1908. ;--------------------------------
  1909. ;# Page_Components_Show
  1910. Function Page_Components_Show
  1911. ;# change controls size and position on the Components Page
  1912. Push $0
  1913. Push $1
  1914. Push $2
  1915. Push $3
  1916. Push $4
  1917. Push $5
  1918. Push $6
  1919. Push $7
  1920. FindWindow $mui.ComponentsPage "#32770" "" $HWNDPARENT
  1921. ;GetDlgItem $mui.ComponentsPage.Text $mui.ComponentsPage 1006
  1922. GetDlgItem $mui.ComponentsPage.InstTypesText $mui.ComponentsPage 1021
  1923. ShowWindow $mui.ComponentsPage.InstTypesText ${SW_HIDE}
  1924. GetDlgItem $mui.ComponentsPage.ComponentsText $mui.ComponentsPage 1022
  1925. GetDlgItem $mui.ComponentsPage.InstTypes $mui.ComponentsPage 1017
  1926. ShowWindow $mui.ComponentsPage.InstTypes ${SW_HIDE}
  1927. GetDlgItem $mui.ComponentsPage.Components $mui.ComponentsPage 1032
  1928. GetDlgItem $mui.ComponentsPage.DescriptionTitle $mui.ComponentsPage 1042
  1929. GetDlgItem $mui.ComponentsPage.DescriptionText $mui.ComponentsPage 1043
  1930. GetDlgItem $mui.ComponentsPage.SpaceRequired $mui.ComponentsPage 1023
  1931. ShowWindow $mui.ComponentsPage.SpaceRequired ${SW_HIDE}
  1932. Push "198"
  1933. Push "40"
  1934. Push "100"
  1935. Push "100"
  1936. Call DU2Pix
  1937. System::Call "User32::SetWindowPos(i $mui.ComponentsPage.DescriptionTitle, i 0, i $1, i $2, i $3, i $4, i 64)" ;# 1042
  1938. Push "203"
  1939. Push "50"
  1940. Push "90"
  1941. Push "85"
  1942. Call DU2Pix
  1943. System::Call "User32::SetWindowPos(i $mui.ComponentsPage.DescriptionText, i 0, i $1, i $2, i $3, i $4, i 64)" ;# 1043
  1944. Push "0"
  1945. Push "25"
  1946. Push "300"
  1947. Push "15"
  1948. Call DU2Pix
  1949. System::Call "User32::SetWindowPos(i $mui.ComponentsPage.ComponentsText, i 0, i $1, i $2, i $3, i $4, i 64)" ;# 1022
  1950. Push "0"
  1951. Push "40"
  1952. Push "195"
  1953. Push "100"
  1954. Call DU2Pix
  1955. System::Call "User32::SetWindowPos(i $mui.ComponentsPage.Components, i 0, i $1, i $2, i $3, i $4, i 64)" ;# 1032
  1956. Pop $7
  1957. Pop $6
  1958. Pop $5
  1959. Pop $4
  1960. Pop $3
  1961. Pop $2
  1962. Pop $1
  1963. Pop $0
  1964. FunctionEnd
  1965. ;--------------------------------
  1966. ;# Page_Components_Leave
  1967. Function Page_Components_Leave
  1968. ${IfNot} ${SectionIsSelected} ${SecSetConfig}
  1969. StrCpy $Skip_Page_SetConfig 1
  1970. ${Else}
  1971. StrCpy $Skip_Page_SetConfig 0
  1972. ${EndIf}
  1973. ${IfNot} ${SectionIsSelected} ${SecShortcutStartmenu}
  1974. StrCpy $Skip_Page_Startmenu 1
  1975. ${Else}
  1976. StrCpy $Skip_Page_Startmenu 0
  1977. ${EndIf}
  1978. FunctionEnd
  1979. ;--------------------------------
  1980. ;# Page_Directory_Pre
  1981. Function Page_Directory_Pre
  1982. ${If} $Skip_Page_Directory == 1
  1983. Abort
  1984. ${EndIf}
  1985. FunctionEnd
  1986. ;--------------------------------
  1987. ;# Page_Directory_Leave
  1988. Function Page_Directory_Leave
  1989. GetInstDirError $R0
  1990. ${If} $R0 > 0 ;# Invalid path entered
  1991. MessageBox MB_OK|MB_ICONSTOP "$(Msg_Path_Invalid)"
  1992. Abort
  1993. ${EndIf}
  1994. ${If} $INSTALL_TYPE == 4
  1995. ${AndIf} ${FileExists} "$INSTDIR\opencpn.exe"
  1996. MessageBox MB_OK|MB_ICONSTOP "$(Msg_Path_Installation_Exists)"
  1997. Abort
  1998. ${EndIf}
  1999. FunctionEnd
  2000. ;--------------------------------
  2001. ;# Page_Startmenu_Pre
  2002. Function Page_Startmenu_Pre
  2003. ${If} $Skip_Page_Startmenu == 1
  2004. Abort
  2005. ${EndIf}
  2006. ${If} $INSTALL_TYPE == 1
  2007. ${OrIf} $INSTALL_TYPE == 2
  2008. ${OrIf} $INSTALL_TYPE == 3
  2009. ReadRegStr $0 HKLM "$Prev_Install_RegKey" "StartMenuFolder"
  2010. StrCpy $STARTMENU_FOLDER $0
  2011. ${EndIf}
  2012. FunctionEnd
  2013. ;--------------------------------
  2014. /*# Page_SetConfig
  2015. Var Label_SetConfig
  2016. Var GroupBox_Language_SetConfig
  2017. Var CheckBox_Language_SetConfig
  2018. Var GroupBox_ChartDir_SetConfig
  2019. Var DirRequest_SetConfig
  2020. Var Button_Delete_SetConfig
  2021. Var Button_DeleteAll_SetConfig
  2022. Var Button_Add_SetConfig
  2023. Var ListBox_SetConfig
  2024. */
  2025. Function Page_SetConfig
  2026. ${If} $Skip_Page_SetConfig == 1
  2027. Abort
  2028. ${EndIf}
  2029. !insertmacro MUI_HEADER_TEXT $(Page_SetConfig_Title) $(Page_SetConfig_Subtitle)
  2030. nsDialogs::Create /NOUNLOAD 1018
  2031. Pop $0
  2032. ${If} $0 == error
  2033. Abort
  2034. ${EndIf}
  2035. ${NSD_CreateLabel} 0 0 100% 16u "$(Label_SetConfig_Text)"
  2036. Pop $Label_SetConfig
  2037. ${NSD_CreateGroupBox} 0 20u 100% 30u "$(GB_Language_SetConfig_Text)"
  2038. Pop $GroupBox_Language_SetConfig
  2039. ${NSD_CreateCheckBox} 10u 35u 100% 10u "$(CB_Language_SetConfig_Text)"
  2040. Pop $CheckBox_Language_SetConfig
  2041. ;StrCmp $CONFIG_SET_LANG "" cont
  2042. ${If} $CONFIG_SET_LANG == ""
  2043. ${NSD_SetState} $CheckBox_Language_SetConfig ${BST_CHECKED}
  2044. Goto cont
  2045. ${EndIf}
  2046. StrCmp $CONFIG_SET_LANG 0 0 +2
  2047. ${NSD_SetState} $CheckBox_Language_SetConfig ${BST_UNCHECKED}
  2048. StrCmp $CONFIG_SET_LANG 1 0 +2
  2049. ${NSD_SetState} $CheckBox_Language_SetConfig ${BST_CHECKED}
  2050. cont:
  2051. ${NSD_CreateGroupBox} 0 55u 100% 85u "$(GB_ChartDir_SetConfig_Text)"
  2052. Pop $GroupBox_ChartDir_SetConfig
  2053. ${NSD_CreateButton} 220u 70u 60u 15u "$(BT_Delete_SetConfig_Text)"
  2054. Pop $Button_Delete_SetConfig
  2055. GetFunctionAddress $0 Button_Delete_SetConfig_Click
  2056. nsDialogs::OnClick /NOUNLOAD $Button_Delete_SetConfig $0
  2057. ${NSD_CreateButton} 220u 88u 60u 15u "$(BT_DeleteAll_SetConfig_Text)"
  2058. Pop $Button_DeleteAll_SetConfig
  2059. GetFunctionAddress $0 Button_DeleteAll_SetConfig_Click
  2060. nsDialogs::OnClick /NOUNLOAD $Button_DeleteAll_SetConfig $0
  2061. ${NSD_CreateButton} 220u 115u 60u 15u "$(BT_Browse_SetConfig_Text)"
  2062. Pop $Button_Add_SetConfig
  2063. GetFunctionAddress $0 Button_Add_SetConfig_Click
  2064. nsDialogs::OnClick /NOUNLOAD $Button_Add_SetConfig $0
  2065. ${NSD_CreateListBox} 10u 70u 200u 60u $(LB_SetConfig)
  2066. Pop $ListBox_SetConfig
  2067. GetFunctionAddress $0 ListBox_SetConfig_Change
  2068. nsDialogs::OnChange /NOUNLOAD $ListBox_SetConfig $0
  2069. ${IfNot} $CHART_DIR_EMPTY == 1
  2070. SetShellVarContext all
  2071. ${If} ${FileExists} "$TEMP\opencpn_chart_dirs.tmp"
  2072. ClearErrors
  2073. FileOpen $R0 "$TEMP\opencpn_chart_dirs.tmp" r
  2074. IfErrors end
  2075. loop:
  2076. ClearErrors
  2077. FileReadUTF16LE $R0 $1
  2078. IfErrors end
  2079. ${TrimNewLines} $1 $1
  2080. SendMessage $ListBox_SetConfig ${LB_ADDSTRING} 0 "STR:$1"
  2081. Goto loop
  2082. end:
  2083. FileClose $R0
  2084. ${ElseIf} $INI_EXISTS == 1
  2085. StrCpy $R2 0
  2086. loop2:
  2087. IntOp $R2 $R2 + 1
  2088. ReadINIStr $R1 "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini" "ChartDirectories" "ChartDir$R2"
  2089. StrCmp $R1 "" cont2
  2090. ${WordReplace} "$R1" "\\" "\" "+" $R3
  2091. ${Explode} $R4 "^" "$R3"
  2092. Pop $R5
  2093. StrCmp $R5 "" cont2
  2094. SendMessage $ListBox_SetConfig ${LB_ADDSTRING} 0 "STR:$R5"
  2095. Goto loop2
  2096. ${Else}
  2097. ReadRegStr $0 HKLM "Software\OpenCPN" "ChartDirs"
  2098. StrCmp $0 "" cont2
  2099. ${Explode} $3 ";" "$0"
  2100. ${For} $1 1 $3
  2101. Pop $2
  2102. ${TrimNewLines} $2 $2
  2103. SendMessage $ListBox_SetConfig ${LB_ADDSTRING} 0 "STR:$2"
  2104. ${Next}
  2105. ${EndIf}
  2106. ${EndIf}
  2107. cont2:
  2108. Call ListBox_SetConfig_Change
  2109. nsDialogs::Show
  2110. FunctionEnd
  2111. Function Button_Delete_SetConfig_Click
  2112. SendMessage $ListBox_SetConfig ${LB_GETCURSEL} 0 0 $0
  2113. SendMessage $ListBox_SetConfig ${LB_DELETESTRING} $0 0
  2114. Call ListBox_SetConfig_Change
  2115. FunctionEnd
  2116. Function Button_DeleteAll_SetConfig_Click
  2117. SendMessage $ListBox_SetConfig ${LB_RESETCONTENT} 0 0
  2118. Call ListBox_SetConfig_Change
  2119. FunctionEnd
  2120. Function Button_Add_SetConfig_Click
  2121. Var /GLOBAL Initial_Dir
  2122. StrCmp $Initial_Dir "" 0 +3
  2123. SetShellVarContext all
  2124. StrCpy $Initial_Dir "$DOCUMENTS"
  2125. nsDialogs::SelectFolderDialog /NOUNLOAD "$(Select_Chart_Directory)" "$Initial_Dir"
  2126. Pop $0
  2127. ${If} $0 == error
  2128. Abort
  2129. ${EndIf}
  2130. StrCpy $Initial_Dir $0
  2131. ${NSD_LB_GetCount} $ListBox_SetConfig $2
  2132. ${If} $2 > 0
  2133. SendMessage $ListBox_SetConfig ${LB_FINDSTRINGEXACT} -1 "STR:$0" $6
  2134. ${IfNot} $6 < 0
  2135. Goto end
  2136. ${EndIf}
  2137. ${EndIf}
  2138. SendMessage $ListBox_SetConfig ${LB_ADDSTRING} 0 "STR:$0"
  2139. end:
  2140. Call ListBox_SetConfig_Change
  2141. FunctionEnd
  2142. Function ListBox_SetConfig_Change
  2143. ${NSD_LB_GetCount} $ListBox_SetConfig $0
  2144. ${If} $0 > 0
  2145. StrCpy $CHART_DIR_EMPTY 0
  2146. ${NSD_LB_GetSelection} $ListBox_SetConfig $1
  2147. ${If} $1 != ""
  2148. EnableWindow $Button_Delete_SetConfig 1
  2149. ${Else}
  2150. EnableWindow $Button_Delete_SetConfig 0
  2151. ${EndIf}
  2152. EnableWindow $Button_DeleteAll_SetConfig 1
  2153. ${Else}
  2154. EnableWindow $Button_Delete_SetConfig 0
  2155. EnableWindow $Button_DeleteAll_SetConfig 0
  2156. StrCpy $CHART_DIR_EMPTY 1
  2157. ${EndIf}
  2158. FunctionEnd
  2159. ;--------------------------------
  2160. /*# Page_SetConfig_Leave
  2161. Var CHART_DIR_TMP_FILE
  2162. */
  2163. Function Page_SetConfig_Leave
  2164. ${NSD_LB_GetCount} $ListBox_SetConfig $0
  2165. ${If} $0 > 0
  2166. ClearErrors
  2167. FileOpen $R0 "$TEMP\opencpn_chart_dirs.tmp" w
  2168. IfErrors done
  2169. IntOp $0 $0 - 1
  2170. ${For} $1 0 $0
  2171. SendMessage $ListBox_SetConfig ${LB_SETCURSEL} $1 0
  2172. System::Call "User32::SendMessage(i $ListBox_SetConfig, i ${LB_GETTEXT}, i $1, t .r2)"
  2173. FileWriteUTF16LE $R0 $2
  2174. FileWriteUTF16LE $R0 "$\r$\n"
  2175. ${Next}
  2176. FileClose $R0
  2177. StrCpy $CHART_DIR_TMP_FILE 1
  2178. ${Else}
  2179. StrCpy $CHART_DIR_EMPTY 1
  2180. ${EndIf}
  2181. done:
  2182. ${NSD_GetState} $CheckBox_Language_SetConfig $0
  2183. ${If} $0 == ${BST_CHECKED}
  2184. StrCpy $CONFIG_SET_LANG 1
  2185. ${Else}
  2186. StrCpy $CONFIG_SET_LANG 0
  2187. ${EndIf}
  2188. FunctionEnd
  2189. ;--------------------------------
  2190. ;# Page_Confirm
  2191. Var Install_Options
  2192. Var TEXT_INSTALL_OPTIONS
  2193. Function Page_Confirm
  2194. !insertmacro MUI_HEADER_TEXT $(Page_Confirm_Title) $(Page_Confirm_Subtitle)
  2195. ;# gather all installation settings and prepare (string) variable '$Install_Options' to display
  2196. ;# add the installation type to '$Install_Options'
  2197. StrCpy $Install_Options "$(Installation_Type):$\r$\n"
  2198. ${If} $Skip_Page_TypeInst != 1
  2199. ${Switch} $INSTALL_TYPE
  2200. ${Case} 1
  2201. StrCpy $Install_Options "$Install_Options$\t$(Type_Reinstall)"
  2202. ${Break}
  2203. ${Case} 2
  2204. StrCpy $Install_Options "$Install_Options$\t$(Type_Upgrade)"
  2205. ${Break}
  2206. ${Case} 3
  2207. StrCpy $Install_Options "$Install_Options$\t$(Type_Downgrade)"
  2208. ${Break}
  2209. ${Case} 4
  2210. StrCpy $Install_Options "$Install_Options$\t$(Type_Parallel_Installation)"
  2211. ${Break}
  2212. ${Default}
  2213. ${Break}
  2214. ${EndSwitch}
  2215. ${Else}
  2216. StrCpy $Install_Options "$Install_Options$\t$(Type_Fresh_Installation)"
  2217. ${EndIf}
  2218. ;# add the installation directory to '$Install_Options'
  2219. StrCpy $Install_Options "$Install_Options$\r$\n$\r$\n$(Installation_Directory):$\r$\n$\t$INSTDIR"
  2220. ;# add the delete config settings to '$Install_Options'
  2221. ${If} $CONFIG_EXISTS == 1
  2222. ${AndIf} $CONFIG_EMPTY != 1
  2223. StrCpy $Install_Options "$Install_Options$\r$\n$\r$\n$(Installation_Delete_Config):"
  2224. SectionGetFlags ${SecGrpResetConfig} $0
  2225. SectionGetFlags ${SecGrpResetConfig} $1
  2226. IntOp $0 $0 & ${SF_SELECTED}
  2227. IntOp $1 $1 & ${SF_PSELECTED}
  2228. StrCmp $0 0 +3 0
  2229. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(SecGrpResetConfig_Text)"
  2230. Goto cont
  2231. StrCmp $1 0 none_selected 0
  2232. SectionGetFlags ${SecDeleteConfigFile} $0
  2233. IntOp $0 $0 & ${SF_SELECTED}
  2234. StrCmp $0 0 +2 0
  2235. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(SecDeleteConfigFile_Text)"
  2236. SectionGetFlags ${SecDeleteChartDB} $0
  2237. IntOp $0 $0 & ${SF_SELECTED}
  2238. StrCmp $0 0 +2 0
  2239. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(SecDeleteChartDB_Text)"
  2240. SectionGetFlags ${SecDeleteSENC} $0
  2241. IntOp $0 $0 & ${SF_SELECTED}
  2242. StrCmp $0 0 +2 0
  2243. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(SecDeleteSENC_Text)"
  2244. SectionGetFlags ${SecDeleteCM93} $0
  2245. IntOp $0 $0 & ${SF_SELECTED}
  2246. StrCmp $0 0 +2 0
  2247. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(SecDeleteCM93_Text)"
  2248. SectionGetFlags ${SecDeleteNavobjFile} $0
  2249. IntOp $0 $0 & ${SF_SELECTED}
  2250. StrCmp $0 0 +2 0
  2251. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(SecDeleteNavobjFile_Text)"
  2252. SectionGetFlags ${SecDeleteLogFile} $0
  2253. IntOp $0 $0 & ${SF_SELECTED}
  2254. StrCmp $0 0 +2 0
  2255. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(SecDeleteLogFile_Text)"
  2256. Goto cont
  2257. none_selected:
  2258. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(text_none)"
  2259. cont:
  2260. ${EndIf}
  2261. ;# add the shortcut settings to '$Install_Options'
  2262. StrCpy $Install_Options "$Install_Options$\r$\n$\r$\n$(Create_Shortcuts):"
  2263. SectionGetFlags ${SecShortcutStartmenu} $0
  2264. IntOp $0 $0 & ${SF_SELECTED}
  2265. ${If} $0 != 0
  2266. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(Create_Shortcut_Start_Menu): $STARTMENU_FOLDER"
  2267. StrCpy $2 1
  2268. ${Else}
  2269. StrCpy $2 0
  2270. ${EndIf}
  2271. SectionGetFlags ${SecShortcutDesktop} $0
  2272. IntOp $0 $0 & ${SF_SELECTED}
  2273. ${If} $0 != 0
  2274. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(Create_Shortcut_Desktop): $DESKTOP"
  2275. ${Else}
  2276. StrCmp $2 0 0 +2
  2277. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(text_none)"
  2278. ${EndIf}
  2279. ;# add the pre-config settings to '$Install_Options'
  2280. ${IfNot} ${SectionIsReadOnly} ${SecSetConfig}
  2281. ${AndIf} ${SectionIsSelected} ${SecSetConfig}
  2282. StrCpy $Install_Options "$Install_Options$\r$\n$\r$\n$(SecSetConfig_Text):"
  2283. StrCmp $CONFIG_SET_LANG 1 0 +2
  2284. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(CB_Language_SetConfig_Text)"
  2285. StrCmp $CHART_DIR_TMP_FILE 1 0 end
  2286. IfFileExists "$TEMP\opencpn_chart_dirs.tmp" 0 end
  2287. StrCpy $Install_Options "$Install_Options$\r$\n$\t$(GB_ChartDir_SetConfig_Text)"
  2288. ClearErrors
  2289. FileOpen $0 "$TEMP\opencpn_chart_dirs.tmp" r
  2290. IfErrors end
  2291. ${Do}
  2292. FileReadUTF16LE $0 $1
  2293. IfErrors done
  2294. ${TrimNewLines} $1 $1
  2295. StrCmp $1 "" +2
  2296. StrCpy $Install_Options "$Install_Options$\r$\n$\t - $1"
  2297. ${Loop}
  2298. done:
  2299. FileClose $0
  2300. end:
  2301. ${EndIf}
  2302. ;# end '$Install_Options'
  2303. nsDialogs::Create /NOUNLOAD 1018
  2304. Pop $0
  2305. ${If} $0 == error
  2306. Abort
  2307. ${EndIf}
  2308. nsDialogs::CreateControl EDIT "${__NSD_Text_STYLE}|${WS_VSCROLL}|${WS_HSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN}|${ES_READONLY}" "${__NSD_Text_EXSTYLE}" 0 0 100% 100% "$Install_Options"
  2309. Pop $TEXT_INSTALL_OPTIONS
  2310. nsDialogs::Show
  2311. FunctionEnd
  2312. ;# Page_Instfiles_Show
  2313. Function Page_Instfiles_Show
  2314. w7tbp::Start
  2315. FunctionEnd
  2316. ;--------------------------------
  2317. ;##################################################################################################
  2318. ;# General Installer Functions #
  2319. ;##################################################################################################
  2320. Function GetAllUsers
  2321. ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
  2322. System::Call 'netapi32::NetUserEnum(w "\\$0",i 0,i 2,*i .R0,i ${NSIS_MAX_STRLEN}, *i .R1,*i .R2,*i .r1)i .r2'
  2323. StrCpy $R8 $R0
  2324. IntOp $R2 $R2 - 1
  2325. ${ForEach} $9 0 $R2 + 1
  2326. System::Call "*$R0(w.R9)"
  2327. MessageBox MB_OK "[$R9]"
  2328. IntOp $R0 $R0 + 4
  2329. ${Next}
  2330. System::Call 'netapi32.dll::NetApiBufferFree(i R8)i .R1'
  2331. FunctionEnd
  2332. Function Hide_SecGrpResetConfig
  2333. Push $0
  2334. !insertmacro ClearSectionFlag ${SecDeleteConfigFile} ${SF_SELECTED}
  2335. SectionSetText ${SecDeleteConfigFile} ""
  2336. !insertmacro ClearSectionFlag ${SecDeleteChartDB} ${SF_SELECTED}
  2337. SectionSetText ${SecDeleteChartDB} ""
  2338. !insertmacro ClearSectionFlag ${SecDeleteSENC} ${SF_SELECTED}
  2339. SectionSetText ${SecDeleteSENC} ""
  2340. !insertmacro ClearSectionFlag ${SecDeleteCM93} ${SF_SELECTED}
  2341. SectionSetText ${SecDeleteCM93} ""
  2342. !insertmacro ClearSectionFlag ${SecDeleteNavobjFile} ${SF_SELECTED}
  2343. SectionSetText ${SecDeleteNavobjFile} ""
  2344. !insertmacro ClearSectionFlag ${SecDeleteLogFile} ${SF_SELECTED}
  2345. SectionSetText ${SecDeleteLogFile} ""
  2346. !insertmacro ClearSectionFlag ${SecGrpResetConfig} ${SF_SECGRP}
  2347. !insertmacro ClearSectionFlag ${SecGrpResetConfig} ${SF_SELECTED}
  2348. SectionSetFlags ${SecGrpResetConfig} 0
  2349. SectionSetText ${SecGrpResetConfig} ""
  2350. IntOp $0 ${SecDeleteLogFile} + 1
  2351. !insertmacro ClearSectionFlag $0 ${SF_SECGRPEND}
  2352. SectionSetText $0 ""
  2353. Pop $0
  2354. FunctionEnd
  2355. Function Check_Config_Exists
  2356. ;# Look for config dir ("%APPDATA%\opencpn) and the several config files
  2357. SetShellVarContext all
  2358. ${IfNot} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*"
  2359. ${If} ${FileExists} "$USERS_APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*"
  2360. CreateDirectory "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@"
  2361. Sleep 250
  2362. AccessControl::GrantOnFile "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete + FullAccess"
  2363. CopyFiles /SILENT "$USERS_APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*" "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@"
  2364. ${ElseIf} ${FileExists} "$ADMIN_APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*"
  2365. CreateDirectory "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@"
  2366. Sleep 250
  2367. AccessControl::GrantOnFile "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete + FullAccess"
  2368. CopyFiles /SILENT "$ADMIN_APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*" "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@"
  2369. ${EndIf}
  2370. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini"
  2371. DeleteINISec "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini" Directories
  2372. ${EndIf}
  2373. ${EndIf}
  2374. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\*.*"
  2375. StrCpy $CONFIG_EXISTS 1
  2376. SectionSetText ${SecGrpResetConfig} $(SecGrpResetConfig_Text)
  2377. ${EndIf}
  2378. StrCpy $Count_SecGrpResetConfig 0
  2379. ${If} $CONFIG_EXISTS == 1
  2380. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini"
  2381. StrCpy $INI_EXISTS 1
  2382. IntOp $Count_SecGrpResetConfig $Count_SecGrpResetConfig + 1
  2383. SectionSetText ${SecDeleteConfigFile} $(SecDeleteConfigFile_Text)
  2384. ${Else}
  2385. !insertmacro ClearSectionFlag ${SecDeleteConfigFile} ${SF_SELECTED}
  2386. SectionSetText ${SecDeleteConfigFile} ""
  2387. ${EndIf}
  2388. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\CHRTLIST.DAT"
  2389. StrCpy $CHARTDB_EXISTS 1
  2390. IntOp $Count_SecGrpResetConfig $Count_SecGrpResetConfig + 1
  2391. SectionSetText ${SecDeleteChartDB} $(SecDeleteChartDB_Text)
  2392. ${Else}
  2393. !insertmacro ClearSectionFlag ${SecDeleteChartDB} ${SF_SELECTED}
  2394. SectionSetText ${SecDeleteChartDB} ""
  2395. ${EndIf}
  2396. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\SENC\*.*"
  2397. StrCpy $SENC_EXISTS 1
  2398. IntOp $Count_SecGrpResetConfig $Count_SecGrpResetConfig + 1
  2399. SectionSetText ${SecDeleteSENC} $(SecDeleteSENC_Text)
  2400. ${Else}
  2401. !insertmacro ClearSectionFlag ${SecDeleteSENC} ${SF_SELECTED}
  2402. SectionSetText ${SecDeleteSENC} ""
  2403. ${EndIf}
  2404. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\cm93\*.*"
  2405. StrCpy $CM93_EXISTS 1
  2406. IntOp $Count_SecGrpResetConfig $Count_SecGrpResetConfig + 1
  2407. SectionSetText ${SecDeleteCM93} $(SecDeleteCM93_Text)
  2408. ${Else}
  2409. !insertmacro ClearSectionFlag ${SecDeleteCM93} ${SF_SELECTED}
  2410. SectionSetText ${SecDeleteCM93} ""
  2411. ${EndIf}
  2412. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\navobj.xml"
  2413. StrCpy $NAVOBJ_EXISTS 1
  2414. IntOp $Count_SecGrpResetConfig $Count_SecGrpResetConfig + 1
  2415. SectionSetText ${SecDeleteNavobjFile} $(SecDeleteNavobjFile_Text)
  2416. ${Else}
  2417. !insertmacro ClearSectionFlag ${SecDeleteNavobjFile} ${SF_SELECTED}
  2418. SectionSetText ${SecDeleteNavobjFile} ""
  2419. ${EndIf}
  2420. ${If} ${FileExists} "$APPDATA\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.log"
  2421. StrCpy $LOG_EXISTS 1
  2422. IntOp $Count_SecGrpResetConfig $Count_SecGrpResetConfig + 1
  2423. SectionSetText ${SecDeleteLogFile} $(SecDeleteLogFile_Text)
  2424. ${Else}
  2425. !insertmacro ClearSectionFlag ${SecDeleteLogFile} ${SF_SELECTED}
  2426. SectionSetText ${SecDeleteLogFile} ""
  2427. ${EndIf}
  2428. ${If} $Count_SecGrpResetConfig == 0
  2429. StrCpy $CONFIG_EMPTY 1
  2430. ${EndIf}
  2431. !insertmacro ClearSectionFlag ${SecSetConfig} ${SF_SELECTED}
  2432. IntOp $0 ${SF_RO} | ${SF_BOLD}
  2433. SectionSetFlags ${SecSetConfig} $0
  2434. ;SectionSetFlags ${SecSetConfig} ${SF_RO}
  2435. StrCpy $SetConfig 0
  2436. ${EndIf}
  2437. FunctionEnd
  2438. Function Reg_Scan_Old_Versions_HKLM
  2439. ;# Registry look-up
  2440. ;# Versions prior to 2.2.727 write RegKey "OpenCPN_is1" to "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall"
  2441. ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1 "DisplayName"
  2442. ${If} $0 != ""
  2443. ${StrFilter} "$0" "31" "." " " $1
  2444. StrCpy $LM_VERSION "$1"
  2445. ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1 "UninstallString"
  2446. ${StrFilter} "$0" "" "" "$\"" $2
  2447. ${If} ${FileExists} "$2"
  2448. ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1 "QuietUninstallString"
  2449. ${StrFilter} "$0" "" "" "$\"" $3
  2450. StrCpy $LM_VERSION_UNINST $3
  2451. ReadRegStr $4 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1 "InstallLocation"
  2452. ${TrimNewLines} $4 $4
  2453. ${If} ${FileExists} "$4opencpn.exe"
  2454. ${AndIf} ${FileExists} "$4unins*.exe"
  2455. ;# check if last character of $4 is a "\" and if so remove it
  2456. ${RIndexOf} $6 "$4" "\"
  2457. ${If} $6 == 1
  2458. ${WordReplace} "$4" "\" "" "-1" $4
  2459. ${EndIf}
  2460. StrCpy $LM_VERSION_INST $4
  2461. IntOp $OLD_INSTALLS $OLD_INSTALLS + 1
  2462. ;StrCpy $VERSION_NEWER 1
  2463. ${Else}
  2464. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN_is1"
  2465. StrCpy $LM_VERSION ""
  2466. StrCpy $LM_VERSION_UNINST ""
  2467. ${EndIf}
  2468. ${EndIf}
  2469. ${EndIf}
  2470. FunctionEnd
  2471. Function EnumProfileList
  2472. ${EnumHKU} Callback_EnumProfileList opencpn-inst-tmp-sid
  2473. FunctionEnd
  2474. Function Callback_EnumProfileList
  2475. ;# Get the SID or tmpkey from the stack
  2476. Pop $SID
  2477. ClearErrors
  2478. ${If} ${FileExists} "$TEMP\opencpn_users_sid.tmp"
  2479. FileOpen $R0 "$TEMP\opencpn_users_sid.tmp" a
  2480. FileSeek $R0 0 END
  2481. ${Else}
  2482. FileOpen $R0 "$TEMP\opencpn_users_sid.tmp" w
  2483. ${EndIf}
  2484. IfErrors done
  2485. FileWriteUTF16LE $R0 "$SID"
  2486. FileWriteUTF16LE $R0 "$\r$\n"
  2487. FileWriteUTF16LE $R0 "$USERPROFILE"
  2488. FileWriteUTF16LE $R0 "$\r$\n"
  2489. FileClose $R0
  2490. done:
  2491. FunctionEnd
  2492. Function Get_Users_Values
  2493. Var /GLOBAL tmp_file_handle
  2494. StrCpy $SID ""
  2495. ClearErrors
  2496. ${If} ${FileExists} "$TEMP\opencpn_users_sid.tmp"
  2497. FileOpen $tmp_file_handle "$TEMP\opencpn_users_sid.tmp" r
  2498. IfErrors end
  2499. ${Do}
  2500. FileReadUTF16LE $tmp_file_handle $SID
  2501. FileReadUTF16LE $tmp_file_handle $USERPROFILE
  2502. StrCmp $SID "" done
  2503. ${TrimNewLines} $SID $SID
  2504. ${TrimNewLines} $USERPROFILE $USERPROFILE
  2505. ;# List of functions to call
  2506. Call Users_Appdata_Paths
  2507. Call Users_StartMenu_Paths
  2508. Call Users_Desktop_Paths
  2509. Call Users_Personal_Paths
  2510. Call Reg_Scan_Old_Versions_HKCU
  2511. ${Loop}
  2512. done:
  2513. FileClose $tmp_file_handle
  2514. StrCpy $SID ""
  2515. StrCpy $USERPROFILE ""
  2516. ${EndIf}
  2517. end:
  2518. FunctionEnd
  2519. Function Users_Appdata_Paths
  2520. ReadRegStr $1 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" AppData
  2521. ${WordReplace} "$1" "%USERPROFILE%" "$USERPROFILE" "+" $2
  2522. ExpandEnvStrings $2 $2
  2523. StrCmp $2 "" done
  2524. StrCpy $5 "none"
  2525. ;# check if an OpenCPN config folder exists in the given path
  2526. ${If} ${FileExists} "$2\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini"
  2527. ReadINIStr $3 "$2\@CPACK_NSIS_PACKAGE_NAME_LC@\opencpn.ini" Directories S57DataLocation
  2528. ${WordReplace} "$3" "\\" "\" "+" $4
  2529. ${WordFind} "$4" "\" "-2{*" $5
  2530. StrCmp $5 "" 0 +2
  2531. StrCpy $5 "none"
  2532. ${EndIf}
  2533. ClearErrors
  2534. ${If} ${FileExists} "$TEMP\opencpn_appdata.tmp"
  2535. FileOpen $R0 "$TEMP\opencpn_appdata.tmp" a
  2536. FileSeek $R0 0 END
  2537. ${Else}
  2538. FileOpen $R0 "$TEMP\opencpn_appdata.tmp" w
  2539. ${EndIf}
  2540. IfErrors done
  2541. FileWriteUTF16LE $R0 "$SID"
  2542. FileWriteUTF16LE $R0 "$\r$\n"
  2543. FileWriteUTF16LE $R0 "$2"
  2544. FileWriteUTF16LE $R0 "$\r$\n"
  2545. FileWriteUTF16LE $R0 "$5"
  2546. FileWriteUTF16LE $R0 "$\r$\n"
  2547. FileClose $R0
  2548. done:
  2549. FunctionEnd
  2550. Function Users_Personal_Paths
  2551. ReadRegStr $1 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" Personal
  2552. ${WordReplace} "$1" "%USERPROFILE%" "$USERPROFILE" "+" $2
  2553. ExpandEnvStrings $2 $2
  2554. ClearErrors
  2555. ${If} ${FileExists} "$TEMP\opencpn_personal.tmp"
  2556. FileOpen $R0 "$TEMP\opencpn_personal.tmp" a
  2557. IfErrors done
  2558. FileSeek $R0 0 END
  2559. ${Else}
  2560. FileOpen $R0 "$TEMP\opencpn_personal.tmp" w
  2561. IfErrors done
  2562. ${EndIf}
  2563. FileWriteUTF16LE $R0 "$SID"
  2564. FileWriteUTF16LE $R0 "$\r$\n"
  2565. FileWriteUTF16LE $R0 "$2"
  2566. FileWriteUTF16LE $R0 "$\r$\n"
  2567. FileClose $R0
  2568. done:
  2569. FunctionEnd
  2570. Function Users_StartMenu_Paths
  2571. ReadRegStr $1 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" "Start Menu"
  2572. ${WordReplace} "$1" "%USERPROFILE%" "$USERPROFILE" "+" $2
  2573. ExpandEnvStrings $2 $2
  2574. ClearErrors
  2575. ${If} ${FileExists} "$TEMP\opencpn_startmenu.tmp"
  2576. FileOpen $R0 "$TEMP\opencpn_startmenu.tmp" a
  2577. FileSeek $R0 0 END
  2578. ${Else}
  2579. FileOpen $R0 "$TEMP\opencpn_startmenu.tmp" w
  2580. ${EndIf}
  2581. IfErrors done
  2582. FileWriteUTF16LE $R0 "$SID"
  2583. FileWriteUTF16LE $R0 "$\r$\n"
  2584. FileWriteUTF16LE $R0 "$2"
  2585. FileWriteUTF16LE $R0 "$\r$\n"
  2586. FileClose $R0
  2587. done:
  2588. FunctionEnd
  2589. Function Users_Desktop_Paths
  2590. ReadRegStr $1 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" Desktop
  2591. ${WordReplace} "$1" "%USERPROFILE%" "$USERPROFILE" "+" $2
  2592. ExpandEnvStrings $2 $2
  2593. ClearErrors
  2594. ${If} ${FileExists} "$TEMP\opencpn_desktop.tmp"
  2595. FileOpen $R0 "$TEMP\opencpn_desktop.tmp" a
  2596. FileSeek $R0 0 END
  2597. ${Else}
  2598. FileOpen $R0 "$TEMP\opencpn_desktop.tmp" w
  2599. ${EndIf}
  2600. IfErrors done
  2601. FileWriteUTF16LE $R0 "$SID"
  2602. FileWriteUTF16LE $R0 "$\r$\n"
  2603. FileWriteUTF16LE $R0 "$2"
  2604. FileWriteUTF16LE $R0 "$\r$\n"
  2605. FileClose $R0
  2606. done:
  2607. FunctionEnd
  2608. ;Var latest_version
  2609. ;Var latest_pathexe
  2610. Function Reg_Scan_Old_Versions_HKCU
  2611. ;# Versions from 2.2.727 up to 2.2.xxxx write RegKey "OpenCPN" to "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\"
  2612. ;# and also RegKey "OpenCPN <version>" to "HKCU\Software\opencpn.org\"
  2613. ;# Find latest installed version => it's the one found in "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN"
  2614. ReadRegStr $0 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN" "DisplayVersion"
  2615. ${If} $0 != ""
  2616. StrCpy $latest_version $0
  2617. ReadRegStr $0 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN" "DisplayIcon"
  2618. StrCpy $latest_pathexe $0
  2619. ReadRegStr $0 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN" "UninstallString"
  2620. ;StrCpy $CU_VERSION_UNINST $0
  2621. ${WordFind} "$0" "\" "-2{*" $1
  2622. ${If} ${FileExists} "$1\opencpn.exe"
  2623. ${AndIf} ${FileExists} "$1\unins*.exe"
  2624. ClearErrors
  2625. ${If} ${FileExists} "$TEMP\opencpn_old_uninstall_regkeys.tmp"
  2626. FileOpen $R0 "$TEMP\opencpn_old_uninstall_regkeys.tmp" a
  2627. FileSeek $R0 0 END
  2628. ${Else}
  2629. FileOpen $R0 "$TEMP\opencpn_old_uninstall_regkeys.tmp" w
  2630. ${EndIf}
  2631. IfErrors done
  2632. FileWriteUTF16LE $R0 "$SID$\r$\n"
  2633. FileWriteUTF16LE $R0 "$SID\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN$\r$\n"
  2634. FileWriteUTF16LE $R0 "$1$\r$\n"
  2635. FileClose $R0
  2636. ${Else}
  2637. DeleteRegKey HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenCPN"
  2638. ${EndIf}
  2639. ${EndIf}
  2640. done:
  2641. ClearErrors
  2642. ${Do}
  2643. Pop $0
  2644. IfErrors empty
  2645. ${Loop}
  2646. empty:
  2647. StrCpy $0 0
  2648. StrCpy $1 ""
  2649. ${Do}
  2650. EnumRegKey $1 HKU "$SID\Software\opencpn.org" $0
  2651. StrCmp $1 "" done1
  2652. IntOp $0 $0 + 1
  2653. Push $1
  2654. ${Loop}
  2655. done1:
  2656. ${If} $0 > 0
  2657. ClearErrors
  2658. ${If} ${FileExists} "$TEMP\opencpn_old_installs.tmp"
  2659. FileOpen $R0 "$TEMP\opencpn_old_installs.tmp" a
  2660. FileSeek $R0 0 END
  2661. ${Else}
  2662. FileOpen $R0 "$TEMP\opencpn_old_installs.tmp" w
  2663. ${EndIf}
  2664. IfErrors done2
  2665. ${Do}
  2666. Pop $R1
  2667. IfErrors finished
  2668. ${StrFilter} "$R1" "31" "." " " $R2 ;# R2 = version
  2669. ;StrCpy $CU_VERSION $R2
  2670. ReadRegStr $R3 HKU "$SID\Software\opencpn.org\$R1" "" ;# R3 = install path
  2671. ReadRegStr $R4 HKU "$SID\Software\opencpn.org\$R1" "Start Menu Folder" ;# R4 = Start Menu Folder
  2672. ReadRegStr $R5 HKU "$SID\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" "Start Menu" ;# R5 = Start Menu Path
  2673. ${WordReplace} "$R5" "%USERPROFILE%" "$USERPROFILE" "+" $R5
  2674. ExpandEnvStrings $R5 $R5
  2675. ;StrCpy $CU_VERSION_INST "$R3\"
  2676. ${If} "$R3\opencpn.exe" == $latest_pathexe
  2677. ${AndIf} $R2 != $latest_version
  2678. DeleteRegKey HKU "$SID\Software\opencpn.org\$R1"
  2679. ${ElseIf} ${FileExists} "$R3\opencpn.exe"
  2680. ${AndIf} ${FileExists} "$R3\unins*.exe"
  2681. FileWriteUTF16LE $R0 "$SID\Software\opencpn.org\$R1"
  2682. FileWriteUTF16LE $R0 "$\r$\n"
  2683. FileWriteUTF16LE $R0 "$R5\$R4"
  2684. FileWriteUTF16LE $R0 "$\r$\n"
  2685. FileWriteUTF16LE $R0 "$R3"
  2686. FileWriteUTF16LE $R0 "$\r$\n"
  2687. IntOp $OLD_INSTALLS $OLD_INSTALLS + 1
  2688. ;StrCpy $VERSION_NEWER 1
  2689. ${Else}
  2690. DeleteRegKey HKU "$SID\Software\opencpn.org\$R1"
  2691. DeleteRegKey /ifempty HKU "$SID\Software\opencpn.org"
  2692. ${EndIf}
  2693. ${Loop}
  2694. finished:
  2695. FileClose $R0
  2696. ${Else}
  2697. DeleteRegKey HKU "$SID\Software\opencpn.org"
  2698. ${EndIf}
  2699. done2:
  2700. StrCpy $latest_version ""
  2701. StrCpy $latest_pathexe ""
  2702. FunctionEnd
  2703. Function Quick_Scan_Old_Versions
  2704. ;# Scan the given Drive for file "opencpn.exe"
  2705. ${If} ${FileExists} "$TEMP\opencpn_personal.tmp"
  2706. ClearErrors
  2707. FileOpen $R0 "$TEMP\opencpn_personal.tmp" r
  2708. IfErrors end
  2709. ${Do}
  2710. FileReadUTF16LE $R0 $R1
  2711. FileReadUTF16LE $R0 $R2
  2712. IfErrors done
  2713. StrCmp $R2 "" done
  2714. ${TrimNewLines} $R2 $R2
  2715. ${Locate} "$R2" "/L=F /M=opencpn.exe" "Found_OpenCPN_Installation"
  2716. ${Loop}
  2717. done:
  2718. FileClose $R0
  2719. ${EndIf}
  2720. end:
  2721. ${Locate} "$PROGRAMFILES" "/L=F /M=opencpn.exe" "Found_OpenCPN_Installation"
  2722. FunctionEnd
  2723. Function Found_OpenCPN_Installation
  2724. Push $R0
  2725. Push $R1
  2726. ${If} ${FileExists} "$R8\unins*.exe"
  2727. ${If} ${FileExists} "$TEMP\opencpn_prev_installs.tmp"
  2728. ClearErrors
  2729. FileOpen $R1 "$TEMP\opencpn_prev_installs.tmp" r
  2730. IfErrors cont
  2731. ${Do}
  2732. FileReadUTF16LE $R1 $R2
  2733. FileReadUTF16LE $R1 $R3
  2734. StrCmp $R2 "" done
  2735. ${TrimNewLines} $R2 $R2
  2736. ${TrimNewLines} $R3 $R3
  2737. StrCmp $R3 $R8 found
  2738. ${LoopUntil} $R2 == ""
  2739. done:
  2740. FileClose $R1
  2741. Goto cont
  2742. found:
  2743. FileClose $R1
  2744. Goto end
  2745. ${EndIf}
  2746. cont:
  2747. IntOp $counter_tmp $counter_tmp + 1
  2748. ClearErrors
  2749. ${IfNot} ${FileExists} "$TEMP\opencpn_hdd_quick_scan.tmp"
  2750. FileOpen $R0 "$TEMP\opencpn_hdd_quick_scan.tmp" w
  2751. IfErrors end
  2752. ${Else}
  2753. FileOpen $R0 "$TEMP\opencpn_hdd_quick_scan.tmp" a
  2754. IfErrors end
  2755. FileSeek $R0 0 END
  2756. ${EndIf}
  2757. FileWriteUTF16LE $R0 "$R8"
  2758. FileWriteUTF16LE $R0 "$\r$\n"
  2759. FileClose $R0
  2760. ${EndIf}
  2761. end:
  2762. Pop $R1
  2763. Pop $R0
  2764. Push $0
  2765. FunctionEnd
  2766. ;Var counter_tmp
  2767. Function Full_Scan_Old_Versions
  2768. ;# Get all HDD Drive Letters on the system
  2769. StrCpy $counter_tmp 0
  2770. ${GetDrives} "HDD" "Scan_Drive"
  2771. FunctionEnd
  2772. Function Scan_Drive
  2773. ;# Scan the given Drive for file "opencpn.exe"
  2774. /*;#DEBUG - scan only crtain drives
  2775. ${IfNot} $9 == "D:\"
  2776. ;${AndIfNot} $9 == "F:\"
  2777. Goto end
  2778. ${EndIf}
  2779. ;#DEBUG End */
  2780. StrCpy $3 "$(Banner_Scan_Drive)"
  2781. GetDlgItem $2 $Banner_Handle 76
  2782. SendMessage $2 ${WM_SETTEXT} 0 "STR:$3"
  2783. ${Locate} "$9" "/L=F /M=opencpn.exe" "Found_OCPN_Exe"
  2784. end:
  2785. Push $0
  2786. FunctionEnd
  2787. Function Found_OCPN_Exe
  2788. Push $1
  2789. ClearErrors
  2790. StrCpy $1 0
  2791. StrCpy $2 0
  2792. ${WordFind} "$R8" "\RECYCLER\" "E*" $1
  2793. ${WordFind} "$R8" "\$$Recycle.Bin" "E*" $2
  2794. IfErrors 0 cont1
  2795. ${If} $1 == 1
  2796. ${AndIf} $2 == 1
  2797. Goto cont2
  2798. ${EndIf}
  2799. cont1:
  2800. ${If} $1 > 0
  2801. ${OrIf} $2 > 0
  2802. Goto end
  2803. ${EndIf}
  2804. cont2:
  2805. ${If} ${FileExists} "$R8\unins*.exe"
  2806. ${If} ${FileExists} "$TEMP\opencpn_prev_installs.tmp"
  2807. ClearErrors
  2808. FileOpen $R1 "$TEMP\opencpn_prev_installs.tmp" r
  2809. IfErrors cont3
  2810. ${Do}
  2811. FileReadUTF16LE $R1 $R2
  2812. FileReadUTF16LE $R1 $R3
  2813. StrCmp $R2 "" done
  2814. ${TrimNewLines} $R2 $R2
  2815. ${TrimNewLines} $R3 $R3
  2816. StrCmp $R3 $R8 found
  2817. ${LoopUntil} $R2 == ""
  2818. done:
  2819. FileClose $R1
  2820. Goto cont3
  2821. found:
  2822. FileClose $R1
  2823. Goto end
  2824. ${EndIf}
  2825. cont3:
  2826. IntOp $counter_tmp $counter_tmp + 1
  2827. GetDlgItem $2 $Banner_Handle 1030
  2828. StrCmp $counter_tmp 1 0 +3
  2829. StrCpy $R4 "$(Banner_Installation_Found_Singular)"
  2830. Goto +2
  2831. StrCpy $R4 "$(Banner_Installation_Found_Plural)"
  2832. SendMessage $2 ${WM_SETTEXT} 0 "STR:$R4"
  2833. SendMessage $ListBox_CleanUp ${LB_ADDSTRING} 0 "STR:$R8"
  2834. ClearErrors
  2835. ${IfNot} ${FileExists} "$TEMP\opencpn_hdd_full_scan.tmp"
  2836. FileOpen $R0 "$TEMP\opencpn_hdd_full_scan.tmp" w
  2837. IfErrors end
  2838. ${Else}
  2839. FileOpen $R0 "$TEMP\opencpn_hdd_full_scan.tmp" a
  2840. IfErrors end
  2841. FileSeek $R0 0 END
  2842. ${EndIf}
  2843. FileWriteUTF16LE $R0 "$R8"
  2844. FileWriteUTF16LE $R0 "$\r$\n"
  2845. FileClose $R0
  2846. end:
  2847. ${EndIf}
  2848. Pop $1
  2849. Push $0
  2850. FunctionEnd
  2851. Function Delete_Installation_Dir
  2852. StrCmp $Uninstall_Path_Tmp "" end
  2853. ;# Check subdirs and remove them recursive ...
  2854. ${If} ${FileExists} "$Uninstall_Path_Tmp\doc\*.*"
  2855. RMDir /r "$Uninstall_Path_Tmp\doc"
  2856. ${EndIf}
  2857. ${If} ${FileExists} "$Uninstall_Path_Tmp\lang\*.*"
  2858. RMDir /r "$Uninstall_Path_Tmp\lang"
  2859. ${EndIf}
  2860. ${If} ${FileExists} "$Uninstall_Path_Tmp\Microsoft.VC80.CRT\*.*"
  2861. RMDir /r "$Uninstall_Path_Tmp\Microsoft.VC80.CRT"
  2862. ${EndIf}
  2863. ${If} ${FileExists} "$Uninstall_Path_Tmp\s57data\*.*"
  2864. RMDir /r "$Uninstall_Path_Tmp\s57data"
  2865. ${EndIf}
  2866. ${If} ${FileExists} "$Uninstall_Path_Tmp\sounds\*.*"
  2867. RMDir /r "$Uninstall_Path_Tmp\sounds"
  2868. ${EndIf}
  2869. ${If} ${FileExists} "$Uninstall_Path_Tmp\TCDATA\*.*"
  2870. RMDir /r "$Uninstall_Path_Tmp\TCDATA"
  2871. ${EndIf}
  2872. ${If} ${FileExists} "$Uninstall_Path_Tmp\gshhs\*.*"
  2873. RMDir /r "$Uninstall_Path_Tmp\gshhs"
  2874. ${EndIf}
  2875. ${If} ${FileExists} "$Uninstall_Path_Tmp\plugins\*.*"
  2876. RMDir /r "$Uninstall_Path_Tmp\plugins"
  2877. ${EndIf}
  2878. ${If} ${FileExists} "$Uninstall_Path_Tmp\share\*.*"
  2879. RMDir /r "$Uninstall_Path_Tmp\share"
  2880. ${EndIf}
  2881. ;# Check files and delete them ...
  2882. ${If} ${FileExists} "$Uninstall_Path_Tmp\opencpn.exe"
  2883. Delete "$Uninstall_Path_Tmp\opencpn.exe"
  2884. ${EndIf}
  2885. ${If} ${FileExists} "$Uninstall_Path_Tmp\license.txt"
  2886. Delete "$Uninstall_Path_Tmp\license.txt"
  2887. ${EndIf}
  2888. ${If} ${FileExists} "$Uninstall_Path_Tmp\unins000.dat"
  2889. Delete "$Uninstall_Path_Tmp\unins000.dat"
  2890. ${EndIf}
  2891. ${If} ${FileExists} "$Uninstall_Path_Tmp\unins000.exe"
  2892. Delete "$Uninstall_Path_Tmp\unins000.exe"
  2893. ${EndIf}
  2894. ${If} ${FileExists} "$Uninstall_Path_Tmp\install.log"
  2895. Delete "$Uninstall_Path_Tmp\install.log"
  2896. ${EndIf}
  2897. ${If} ${FileExists} "$Uninstall_Path_Tmp\install.log"
  2898. Delete "$Uninstall_Path_Tmp\install.log"
  2899. ${EndIf}
  2900. Push $0
  2901. Push $1
  2902. Push $2
  2903. Push $R9
  2904. Push $R8
  2905. Push $R7
  2906. Push $R6
  2907. ;# Find the Uninstall file
  2908. ${Locate} "$Uninstall_Path_Tmp" "/L=F /M=Uninstall*.exe /G=0" "Delete_Located_File_Single"
  2909. ;# Find the wx.. DLLs
  2910. ${Locate} "$Uninstall_Path_Tmp" "/L=F /M=wx*.dll /G=0" "Delete_Located_File_Multi"
  2911. ;# Dummy call of Locate as it does not properly close its handle and so the dir cannot be deleted though it might be empty
  2912. ${Locate} "C:\" "/L=DE /M=*.* /G=0" "Dummy_Function"
  2913. ;# Remove the installation dir ($Uninstall_Path_Tmp) if empty
  2914. RMDir "$Uninstall_Path_Tmp"
  2915. ${If} ${FileExists} "$Uninstall_Path_Tmp\*.*"
  2916. Sleep 250
  2917. RMDir "$Uninstall_Path_Tmp"
  2918. ${EndIf}
  2919. Pop $R6
  2920. Pop $R7
  2921. Pop $R8
  2922. Pop $R9
  2923. Pop $2
  2924. Pop $1
  2925. Pop $0
  2926. end:
  2927. FunctionEnd
  2928. ;# Helper-Functions for Delete_Installation_Dir
  2929. Function Delete_Located_File_Single
  2930. Delete "$R9"
  2931. StrCpy $0 StopLocate
  2932. Push $0
  2933. FunctionEnd
  2934. Function Delete_Located_File_Multi
  2935. Delete "$R9"
  2936. Push $0
  2937. FunctionEnd
  2938. Function Dummy_Function
  2939. StrCpy $0 StopLocate
  2940. Push $0
  2941. FunctionEnd
  2942. ;# End Helper-Functions
  2943. Function ExecAppFile
  2944. !insertmacro UAC_AsUser_ExecShell 'open' '$INSTDIR\opencpn.exe' '' '$INSTDIR' ''
  2945. loop:
  2946. System::Call user32::GetForegroundWindow()i.r0
  2947. Sleep 200
  2948. IntCmpU $0 $hwndparent loop
  2949. FunctionEnd
  2950. Function DU2Pix
  2951. Pop $4
  2952. Pop $3
  2953. Pop $2
  2954. Pop $1
  2955. IntOp $1 $1 * $BU_X
  2956. IntOp $1 $1 / 4
  2957. IntOp $2 $2 * $BU_Y
  2958. IntOp $2 $2 / 8
  2959. IntOp $3 $3 * $BU_X
  2960. IntOp $3 $3 / 4
  2961. IntOp $4 $4 * $BU_Y
  2962. IntOp $4 $4 / 8
  2963. FunctionEnd
  2964. ;!define LVM_GETITEMCOUNT 0x1004 ;# ANSI
  2965. ;!define LVM_GETITEMTEXT 0x102D ;# ANSI
  2966. !ifndef LVM_GETITEMCOUNT
  2967. !define LVM_GETITEMCOUNT 0x1004
  2968. !define LVM_GETITEMTEXT 0x1073
  2969. !endif
  2970. Function DumpLog
  2971. Exch $5
  2972. Push $0
  2973. Push $1
  2974. Push $2
  2975. Push $3
  2976. Push $4
  2977. Push $6
  2978. FindWindow $0 "#32770" "" $HWNDPARENT
  2979. GetDlgItem $0 $0 1016
  2980. StrCmp $0 0 error
  2981. FileOpen $5 $5 "w"
  2982. FileWriteWord $5 0xfeff ; Write the BOM
  2983. StrCmp $5 0 error
  2984. SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
  2985. System::StrAlloc ${NSIS_MAX_STRLEN}
  2986. Pop $3
  2987. StrCpy $2 0
  2988. System::Call "*(i, i, i, i, i, i, i, i, i) i \
  2989. (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
  2990. loop: StrCmp $2 $6 done
  2991. System::Call "User32::SendMessageW(i, i, i, i) i \
  2992. ($0, ${LVM_GETITEMTEXT}, $2, r1)"
  2993. System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
  2994. FileWriteUTF16LE $5 "$4$\r$\n"
  2995. IntOp $2 $2 + 1
  2996. Goto loop
  2997. done:
  2998. FileClose $5
  2999. System::Free $1
  3000. System::Free $3
  3001. Goto exit
  3002. error:
  3003. MessageBox MB_OK error
  3004. exit:
  3005. Pop $6
  3006. Pop $4
  3007. Pop $3
  3008. Pop $2
  3009. Pop $1
  3010. Pop $0
  3011. Exch $5
  3012. FunctionEnd
  3013. Function Write_Reg_ChartDirs
  3014. ClearErrors
  3015. FileOpen $R0 "$TEMP\opencpn_chart_dirs.tmp" r
  3016. IfErrors end
  3017. loop:
  3018. FileReadUTF16LE $R0 $R1
  3019. IfErrors done
  3020. ${TrimNewLines} $R1 $R1
  3021. ${If} $REG_CHARTDIRS == ""
  3022. StrCpy $REG_CHARTDIRS "$R1"
  3023. ${Else}
  3024. StrCpy $REG_CHARTDIRS "$REG_CHARTDIRS;$R1"
  3025. ${EndIf}
  3026. Goto loop
  3027. done:
  3028. FileClose $R0
  3029. WriteRegStr HKLM "Software\OpenCPN" "ChartDirs" $REG_CHARTDIRS
  3030. end:
  3031. FunctionEnd
  3032. Function IndexOf
  3033. Exch $R0
  3034. Exch
  3035. Exch $R1
  3036. Push $R2
  3037. Push $R3
  3038. StrCpy $R3 $R0
  3039. StrCpy $R0 -1
  3040. IntOp $R0 $R0 + 1
  3041. StrCpy $R2 $R3 1 $R0
  3042. StrCmp $R2 "" +2
  3043. StrCmp $R2 $R1 +2 -3
  3044. StrCpy $R0 -1
  3045. Pop $R3
  3046. Pop $R2
  3047. Pop $R1
  3048. Exch $R0
  3049. FunctionEnd
  3050. Function RIndexOf
  3051. Exch $R0
  3052. Exch
  3053. Exch $R1
  3054. Push $R2
  3055. Push $R3
  3056. StrCpy $R3 $R0
  3057. StrCpy $R0 0
  3058. IntOp $R0 $R0 + 1
  3059. StrCpy $R2 $R3 1 -$R0
  3060. StrCmp $R2 "" +2
  3061. StrCmp $R2 $R1 +2 -3
  3062. StrCpy $R0 -1
  3063. Pop $R3
  3064. Pop $R2
  3065. Pop $R1
  3066. Exch $R0
  3067. FunctionEnd
  3068. ;##################################################################################################
  3069. ;# Uninstaller Functions #
  3070. ;##################################################################################################
  3071. ;# un.onInit Function
  3072. Function un.onInit
  3073. ;Prevent multiple instances of the uninstaller
  3074. ${IfNot} ${UAC_IsInnerInstance}
  3075. System::Call 'kernel32::CreateMutexW(i 0, i 0, t "ocpn_uninst_@CPACK_PACKAGE_VERSION@") i .r1 ?e'
  3076. Pop $R0
  3077. StrCmp $R0 0 +3
  3078. MessageBox MB_OK|MB_ICONEXCLAMATION "$(Uninstaller_Running)"
  3079. Abort
  3080. ${EndIf}
  3081. Call un.GetUserInfo
  3082. StrCpy $USERS_NAME $USERNAME
  3083. ;# Macros to be inserted
  3084. ${If} $IS_ADMIN == 1
  3085. !insertmacro MUI_UNGETLANGUAGE
  3086. ${EndIf}
  3087. StrCpy $USERS_APPDATA $APPDATA
  3088. ;# UAC check if user has Admin privileges and prompt for elevation if not
  3089. uac_tryagain:
  3090. !insertmacro UAC_RunElevated
  3091. StrCpy $Inst_Or_Uninst "$(Uninstaller)"
  3092. ${Switch} $0
  3093. ${Case} 0
  3094. ${IfThen} $1 = 1 ${|} Quit ${|} ;# we are the outer process, the inner process has done its work, we are done
  3095. ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;# we are admin, let the show go on
  3096. ${If} $1 = 3 ;# RunAs completed successfully, but with a non-admin user
  3097. MessageBox mb_IconExclamation|mb_TopMost|mb_SetForeground "$(Msg_UAC_Admin_Retry)" /SD IDNO IDOK uac_tryagain IDNO 0
  3098. ${EndIf}
  3099. ;# fall-through and die
  3100. ${Case} 1223
  3101. MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(Msg_UAC_Admin_Abort)"
  3102. Quit
  3103. ${Case} 1062
  3104. MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(Msg_UAC_Logon_Abort)"
  3105. Quit
  3106. ${Default}
  3107. MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "$(Msg_UAC_No_Elevation)"
  3108. Quit
  3109. ${EndSwitch}
  3110. ########## from here we can be sure to run with admin privileges ##########
  3111. SectionSetText ${UnSecDeleteConfigFolder} $(UnSecDeleteConfigFolder_Text)
  3112. ClearErrors
  3113. Var /GLOBAL UN_INST_PARAMS
  3114. Var /GLOBAL UN_INST_HELP
  3115. Var /GLOBAL UN_INST_TYPE
  3116. StrCpy $UN_INST_TYPE ""
  3117. ${GetParameters} $UN_INST_PARAMS
  3118. StrCmp $UN_INST_PARAMS "" no_params
  3119. ${GetOptions} "$UN_INST_PARAMS" "/?" $UN_INST_HELP
  3120. IfErrors +3
  3121. StrCpy $UN_INST_HELP "help"
  3122. Goto end
  3123. ClearErrors
  3124. ${GetOptions} "$UN_INST_PARAMS" "/type" $UN_INST_TYPE
  3125. IfErrors no_type_param
  3126. ${Switch} $UN_INST_TYPE
  3127. ${Case} "=1" ;# 1 = Program Files only (Remove/ Delete: Program Files)
  3128. StrCpy $UN_INST_TYPE 1
  3129. !insertmacro ClearSectionFlag ${UnSecDeleteConfigFolder} ${SF_SELECTED}
  3130. !insertmacro ClearSectionFlag ${UnSecDeleteConfigRegKey} ${SF_SELECTED}
  3131. ${Break}
  3132. ${Case} "=2" ;# 2 = Preserve Config folder (Remove/ Delete: Program Files + RegKey)
  3133. StrCpy $UN_INST_TYPE 2
  3134. !insertmacro ClearSectionFlag ${UnSecDeleteConfigFolder} ${SF_SELECTED}
  3135. ${Break}
  3136. ${Case} "=3" ;# 3 = Preserve RegKey (Remove/ Delete: Program Files + Config folder)
  3137. StrCpy $UN_INST_TYPE 3
  3138. !insertmacro ClearSectionFlag ${UnSecDeleteConfigRegKey} ${SF_SELECTED}
  3139. SectionSetFlags ${UnSecBackupConfigToRegKey} ${SF_SELECTED}
  3140. ${Break}
  3141. ${Case} "=4" ;# 4 = Delete Config folder (Remove/ Delete: Config folder)
  3142. StrCpy $UN_INST_TYPE 4
  3143. !insertmacro ClearSectionFlag ${UnSecUninstall} ${SF_SELECTED}
  3144. !insertmacro ClearSectionFlag ${UnSecDeleteConfigRegKey} ${SF_SELECTED}
  3145. SectionSetFlags ${UnSecBackupConfigToRegKey} ${SF_SELECTED}
  3146. ${Break}
  3147. ${Case} "=5" ;# 5 = Delete RegKey (Remove/ Delete: RegKey)
  3148. StrCpy $UN_INST_TYPE 5
  3149. !insertmacro ClearSectionFlag ${UnSecUninstall} ${SF_SELECTED}
  3150. !insertmacro ClearSectionFlag ${UnSecDeleteConfigFolder} ${SF_SELECTED}
  3151. ${Break}
  3152. ${Default}
  3153. StrCpy $9 $UN_INST_TYPE
  3154. StrCpy $UN_INST_TYPE "error_type" ;# unknown value given for the type parameter => MsgBox => Quit
  3155. ${Break}
  3156. ${EndSwitch}
  3157. StrCmp $UN_INST_TYPE "error_type" 0 cont
  3158. MessageBox MB_OK|MB_ICONEXCLAMATION "$(Msg_Unknown_Type_Param)"
  3159. Quit
  3160. no_type_param:
  3161. ;# If no parameter 'type' is given assume full uninstall
  3162. StrCpy $UN_INST_TYPE 0 ;# 0 = Full Uninstall (Remove/ Delete: Program Files + Config folder + RegKey)
  3163. Goto cont
  3164. no_params:
  3165. ;# If no parameters are given assume full uninstall
  3166. StrCpy $UN_INST_TYPE 0 ;# 0 = Full Uninstall (Remove/ Delete: Program Files + Config folder + RegKey)
  3167. cont:
  3168. ;# Delete all temporary files created during the installation
  3169. Delete "$TEMP\opencpn_*.tmp"
  3170. Call un.VersionDate
  3171. Call un.Check_Prev_Installs
  3172. ;# If there are other installations of OCPN do not remove the config folder!
  3173. ${If} $UN_INST_TYPE == 0
  3174. ${AndIf} $VERSION_EXISTS == 1
  3175. ${AndIf} $MULTIPLE_INSTALLS > 1
  3176. StrCpy $Skip_UnPage_Components 1
  3177. !insertmacro ClearSectionFlag ${UnSecDeleteConfigFolder} ${SF_SELECTED}
  3178. ${EndIf}
  3179. ReadRegStr $0 HKLM "${REG_KEY_UN}" "CompareVersion"
  3180. end:
  3181. FunctionEnd
  3182. Function un.myGuiInit
  3183. ${If} $UN_INST_HELP == "help"
  3184. MessageBox MB_OK|MB_ICONINFORMATION "$(Msg_Uninstaller_Param_Help)"
  3185. Quit
  3186. ${EndIf}
  3187. FunctionEnd
  3188. ;--------------------------------
  3189. ;##################################################################################################
  3190. ;# Uninstaller Page Functions #
  3191. ;##################################################################################################
  3192. ;# UnPage_Components_Pre
  3193. Function un.Page_Components_Pre
  3194. ${If} $Skip_UnPage_Components == 1
  3195. Abort
  3196. ${EndIf}
  3197. FunctionEnd
  3198. ;--------------------------------
  3199. ;##################################################################################################
  3200. ;# General Uninstaller Functions #
  3201. ;##################################################################################################
  3202. ;--------------------------------
  3203. ;##################################################################################################
  3204. ;# Shared Functions #
  3205. ;##################################################################################################
  3206. !macro GetUserInfo_Macro un
  3207. Function ${un}GetUserInfo
  3208. ClearErrors
  3209. UserInfo::GetName
  3210. ${If} ${Errors}
  3211. StrCpy $IS_ADMIN 1
  3212. Return
  3213. ${EndIf}
  3214. Pop $USERNAME
  3215. UserInfo::GetAccountType
  3216. Pop $R0
  3217. StrCpy $UAT $R0
  3218. ${If} ${IsNT}
  3219. ${AndIf} ${IsWinNT4}
  3220. ${If} $R0 == "Admin"
  3221. StrCpy $IS_ADMIN 1
  3222. ${Else}
  3223. StrCpy $IS_ADMIN 0
  3224. ${EndIf}
  3225. Goto end
  3226. ${EndIf}
  3227. ${Switch} $R0
  3228. ${Case} "Admin"
  3229. ${Case} "Power"
  3230. StrCpy $IS_ADMIN 1
  3231. ${Break}
  3232. ${Default}
  3233. StrCpy $IS_ADMIN 0
  3234. ${Break}
  3235. ${EndSwitch}
  3236. UserInfo::GetOriginalAccountType
  3237. Pop $OUAT
  3238. end:
  3239. FunctionEnd
  3240. !macroend
  3241. !insertmacro GetUserInfo_Macro ""
  3242. !insertmacro GetUserInfo_Macro "un."
  3243. !macro Check_Prev_Installs_Macro un
  3244. Function ${un}Check_Prev_Installs
  3245. StrCpy $R0 0
  3246. StrCpy $R1 ""
  3247. StrCpy $R5 0
  3248. StrCpy $VERSION_EXISTS 0
  3249. SetShellVarContext all
  3250. ${Do}
  3251. EnumRegKey $R1 SHCTX "${REG_ROOT_KEY_UN}" $R0
  3252. ${If} $R1 != ""
  3253. StrLen $R2 $R1
  3254. ${WordFind} "$R1" " " "+1" $R3
  3255. IntOp $R0 $R0 + 1
  3256. ${If} $R3 == "OpenCPN"
  3257. ${AndIf} $R2 > 7
  3258. ReadRegStr $R4 SHCTX "${REG_ROOT_KEY_UN}\$R1" "CompareVersion"
  3259. ReadRegStr $R6 SHCTX "${REG_ROOT_KEY_UN}\$R1" "InstallLocation"
  3260. ${If} $R4 != ""
  3261. ${VersionCompare} $VERSION_DATE $R4 $Compare_Version_Result
  3262. ${Switch} $Compare_Version_Result
  3263. ${Case} 0 ;equal
  3264. StrCpy $VERSION_EXISTS 1
  3265. ${Break}
  3266. ${Case} 1 ;version to install is newer
  3267. StrCpy $VERSION_NEWER 1
  3268. ${Break}
  3269. ${Case} 2 ;version to install is older
  3270. StrCpy $VERSION_OLDER 1
  3271. ${Break}
  3272. ${Default}
  3273. ${Break}
  3274. ${EndSwitch}
  3275. IntOp $R5 $R5 + 1
  3276. StrCpy $Prev_Install_RegKey "${REG_ROOT_KEY_UN}\$R1"
  3277. ${EndIf}
  3278. StrCmp ${un} "" 0 uninst ;# only execute when it is the Installer function
  3279. ${If} $R6 != ""
  3280. ClearErrors
  3281. ${If} ${FileExists} "$TEMP\opencpn_prev_installs.tmp"
  3282. FileOpen $0 "$TEMP\opencpn_prev_installs.tmp" a
  3283. FileSeek $0 0 END
  3284. ${Else}
  3285. FileOpen $0 "$TEMP\opencpn_prev_installs.tmp" w
  3286. ${EndIf}
  3287. IfErrors done
  3288. FileWriteUTF16LE $0 "$R1$\r$\n"
  3289. FileWriteUTF16LE $0 "$R6$\r$\n"
  3290. FileClose $0
  3291. done:
  3292. ${EndIf}
  3293. ${If} $VERSION_EXISTS == 1
  3294. ${Break}
  3295. ${EndIf}
  3296. uninst:
  3297. ${EndIf}
  3298. ${Else}
  3299. Goto done2
  3300. ${EndIf}
  3301. ${Loop}
  3302. done2:
  3303. ${If} $R5 > 0
  3304. StrCpy $MULTIPLE_INSTALLS $R5
  3305. ${Else}
  3306. StrCpy $MULTIPLE_INSTALLS 0
  3307. ${EndIf}
  3308. ${If} $MULTIPLE_INSTALLS == 0
  3309. StrCpy $Skip_Page_TypeInst 1
  3310. ${Else}
  3311. StrCpy $Skip_Page_TypeInst 0
  3312. ${EndIf}
  3313. FunctionEnd
  3314. !macroend
  3315. !insertmacro Check_Prev_Installs_Macro ""
  3316. !insertmacro Check_Prev_Installs_Macro "un."
  3317. /* VersionDate
  3318. normalizes the CPACK_PACKAGE_VERSION_PATCH to a comparable format 'yyyy.[02|19].mmdd.00'
  3319. 02 = Beta version
  3320. 19 = Stable release
  3321. IN: CPACK_PACKAGE_VERSION_PATCH
  3322. OUT: $VERSION_DATE
  3323. */
  3324. Var Patch_Version
  3325. Var Version_Digits_Only
  3326. Var Version_Unified
  3327. Var Patch_Date
  3328. !macro VersionDate_Macro un
  3329. Function ${un}VersionDate
  3330. StrCpy $Patch_Version "@CPACK_PACKAGE_VERSION_PATCH@"
  3331. ${If} $Patch_Version == ""
  3332. StrCpy $Patch_Version "0000"
  3333. ${EndIf}
  3334. StrLen $0 "$Patch_Version"
  3335. ${StrFilter} "$Patch_Version" "1" "" "" $Version_Digits_Only
  3336. StrLen $1 $Version_Digits_Only
  3337. ;# Patch version contains non-digit characters
  3338. ${If} $0 != $1
  3339. ${StrFilter} "$Patch_Version" "-2" "" "" $PATCH_ND
  3340. ${If} $1 == 3
  3341. StrCpy $Version_Unified "b${YEAR}0$Patch_Version"
  3342. ${ElseIf} $1 == 2
  3343. StrCpy $Version_Unified "s${YEAR}00$Patch_Version"
  3344. ${ElseIf} $1 == 1
  3345. StrCpy $Version_Unified "s${YEAR}000$Patch_Version"
  3346. ${Else}
  3347. StrCpy $Version_Unified "b${YEAR}$Patch_Version"
  3348. ${EndIf}
  3349. ${VersionConvert} $Version_Unified "" $Patch_Date
  3350. StrCpy $VERSION_DATE "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.$Patch_Date"
  3351. ;# Patch version contains only digits
  3352. ${Else}
  3353. ${If} $0 == 3
  3354. StrCpy $Version_Unified "b${YEAR}0$Patch_Version"
  3355. ${ElseIf} $0 == 2
  3356. StrCpy $Version_Unified "s${YEAR}00$Patch_Version"
  3357. ${ElseIf} $0 == 1
  3358. StrCpy $Version_Unified "s${YEAR}000$Patch_Version"
  3359. ${Else}
  3360. StrCpy $Version_Unified "b${YEAR}$Patch_Version"
  3361. ${EndIf}
  3362. ${VersionConvert} $Version_Unified "" $Patch_Date
  3363. StrCpy $VERSION_DATE "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.$Patch_Date.00"
  3364. ${EndIf}
  3365. FunctionEnd
  3366. !macroend
  3367. !insertmacro VersionDate_Macro ""
  3368. !insertmacro VersionDate_Macro "un."
  3369. !macro Delete_Start_Menu_Shortcuts_Macro un
  3370. Function ${un}Delete_Start_Menu_Shortcuts
  3371. Pop $9
  3372. Push $R0
  3373. Push $R1
  3374. Push $R2
  3375. Push $R3
  3376. Push $R4
  3377. ${TrimNewLines} $9 $9
  3378. SetShellVarContext all
  3379. ${RecFindOpen} "$STARTMENU" $CurrentDirVar $CurrentFileVar
  3380. ${RecFindFirst}
  3381. ClearErrors
  3382. ${WordFind} "$CurrentFileVar" ".lnk" "E*" $8
  3383. IfErrors next
  3384. IntCmp $8 1 0 next 0
  3385. ShellLink::GetShortCutWorkingDirectory "$STARTMENU$CurrentDirVar\$CurrentFileVar"
  3386. Pop $0
  3387. StrCmp "$0" "" +2
  3388. StrCmp "$0" "$9" 0 next
  3389. ShellLink::GetShortCutTarget "$STARTMENU$CurrentDirVar\$CurrentFileVar"
  3390. Pop $1
  3391. ${WordFind2X} "$1" "\" ".exe" "-1" $7
  3392. ClearErrors
  3393. ${WordFind} "$7" "uninstall" "E*" $6
  3394. IfErrors 0 +2
  3395. StrCpy $6 0
  3396. ;#NON-DEBUG
  3397. ${If} $7 == "opencpn"
  3398. ${OrIf} $7 == "Uninstall"
  3399. ${OrIf} $7 == "unins000"
  3400. ${OrIf} $6 == 1
  3401. Delete "$STARTMENU$CurrentDirVar\$CurrentFileVar"
  3402. StrCmp $CurrentDirVar "" next
  3403. ClearErrors
  3404. RMDir "$STARTMENU$CurrentDirVar"
  3405. Sleep 250
  3406. IfErrors 0 check_parent
  3407. ${If} ${FileExists} "$STARTMENU$CurrentDirVar\*.*"
  3408. ClearErrors
  3409. RMDir "$STARTMENU$CurrentDirVar"
  3410. Sleep 250
  3411. IfErrors next check_parent
  3412. ${EndIf}
  3413. Goto next
  3414. check_parent:
  3415. StrCpy $R3 "$STARTMENU$CurrentDirVar"
  3416. Push $R3
  3417. Call ${un}Parent_Dirs_Check
  3418. ${EndIf}
  3419. next:
  3420. ${RecFindNext}
  3421. ${RecFindClose}
  3422. ${If} ${FileExists} "$TEMP\opencpn_startmenu.tmp"
  3423. FileOpen $R0 "$TEMP\opencpn_startmenu.tmp" r
  3424. IfErrors end
  3425. ${Do}
  3426. FileReadUTF16LE $R0 $R1
  3427. FileReadUTF16LE $R0 $R2
  3428. ${TrimNewLines} $R1 $R1
  3429. ${TrimNewLines} $R2 $R2
  3430. StrCmp $R2 "" 0 +2
  3431. ${Break}
  3432. ${RecFindOpen} "$R2" $CurrentDirVar $CurrentFileVar
  3433. ${RecFindFirst}
  3434. ClearErrors
  3435. ${WordFind} "$CurrentFileVar" ".lnk" "E*" $8
  3436. IfErrors next1
  3437. IntCmp $8 1 0 next1 0
  3438. ShellLink::GetShortCutWorkingDirectory "$R2$CurrentDirVar\$CurrentFileVar"
  3439. Pop $0
  3440. StrCmp "$0" "$9" 0 next1
  3441. ShellLink::GetShortCutTarget "$R2$CurrentDirVar\$CurrentFileVar"
  3442. Pop $1
  3443. ${WordFind2X} "$1" "\" ".exe" "-1" $7
  3444. ;#NON-DEBUG
  3445. ${If} $7 == "opencpn"
  3446. ${OrIf} $7 == "Uninstall"
  3447. ${OrIf} $7 == "unins000"
  3448. Delete "$R2$CurrentDirVar\$CurrentFileVar"
  3449. StrCmp $CurrentDirVar "" next1
  3450. ClearErrors
  3451. RMDir "$R2$CurrentDirVar"
  3452. Sleep 250
  3453. IfErrors 0 check_parent1
  3454. ${If} ${FileExists} "$R2$CurrentDirVar\*.*"
  3455. ClearErrors
  3456. RMDir "$R2$CurrentDirVar"
  3457. Sleep 250
  3458. IfErrors next1 check_parent1
  3459. ${EndIf}
  3460. Goto next1
  3461. check_parent1:
  3462. StrCpy $R3 "$STARTMENU$CurrentDirVar"
  3463. Push $R3
  3464. Call ${un}Parent_Dirs_Check
  3465. ${EndIf}
  3466. next1:
  3467. ${RecFindNext}
  3468. ${RecFindClose}
  3469. ${LoopUntil} $R2 == ""
  3470. FileClose $R0
  3471. ${EndIf}
  3472. end:
  3473. Call ${un}Delete_Empty_Parents
  3474. Pop $R4
  3475. Pop $R3
  3476. Pop $R2
  3477. Pop $R1
  3478. Pop $R0
  3479. FunctionEnd
  3480. !macroend
  3481. !insertmacro Delete_Start_Menu_Shortcuts_Macro ""
  3482. !insertmacro Delete_Start_Menu_Shortcuts_Macro "un."
  3483. !macro Delete_Desktop_Shortcuts_Macro un
  3484. Function ${un}Delete_Desktop_Shortcuts
  3485. Pop $9
  3486. Push $R0
  3487. Push $R1
  3488. Push $R2
  3489. Push $R3
  3490. ${TrimNewLines} $9 $9
  3491. SetShellVarContext all
  3492. ${RecFindOpen} "$DESKTOP" $CurrentDirVar $CurrentFileVar
  3493. ${RecFindFirst}
  3494. ClearErrors
  3495. ${WordFind} "$CurrentFileVar" ".lnk" "E*" $8
  3496. IfErrors next
  3497. IntCmp $8 1 0 next 0
  3498. ShellLink::GetShortCutWorkingDirectory "$DESKTOP$CurrentDirVar\$CurrentFileVar"
  3499. Pop $0
  3500. StrCmp "$0" "" +2
  3501. StrCmp "$0" "$9" 0 next
  3502. ShellLink::GetShortCutTarget "$DESKTOP$CurrentDirVar\$CurrentFileVar"
  3503. Pop $1
  3504. ${WordFind2X} "$1" "\" ".exe" "-1" $7
  3505. ClearErrors
  3506. ${WordFind} "$7" "uninstall" "E*" $6
  3507. IfErrors 0 +2
  3508. StrCpy $6 0
  3509. ;#NON-DEBUG
  3510. ${If} $7 == "opencpn"
  3511. ${OrIf} $7 == "Uninstall"
  3512. ${OrIf} $7 == "unins000"
  3513. ${OrIf} $6 == 1
  3514. Delete "$DESKTOP$CurrentDirVar\$CurrentFileVar"
  3515. StrCmp $CurrentDirVar "" next
  3516. RMDir "$DESKTOP$CurrentDirVar"
  3517. Sleep 250
  3518. IfErrors 0 check_parent
  3519. ${If} ${FileExists} "$DESKTOP$CurrentDirVar\*.*"
  3520. ClearErrors
  3521. RMDir "$DESKTOP$CurrentDirVar"
  3522. Sleep 250
  3523. IfErrors next check_parent
  3524. ${EndIf}
  3525. Goto next
  3526. check_parent:
  3527. StrCpy $R3 "$DESKTOP$CurrentDirVar"
  3528. Push $R3
  3529. Call ${un}Parent_Dirs_Check
  3530. ${EndIf}
  3531. next:
  3532. ${RecFindNext}
  3533. ${RecFindClose}
  3534. ${If} ${FileExists} "$TEMP\opencpn_desktop.tmp"
  3535. FileOpen $R0 "$TEMP\opencpn_desktop.tmp" r
  3536. IfErrors end
  3537. ${Do}
  3538. FileReadUTF16LE $R0 $R1
  3539. FileReadUTF16LE $R0 $R2
  3540. ${TrimNewLines} $R1 $R1
  3541. ${TrimNewLines} $R2 $R2
  3542. StrCmp $R2 "" 0 +2
  3543. ${Break}
  3544. ${RecFindOpen} "$R2" $CurrentDirVar $CurrentFileVar
  3545. ${RecFindFirst}
  3546. ClearErrors
  3547. ${WordFind} "$CurrentFileVar" ".lnk" "E*" $8
  3548. IfErrors next1
  3549. IntCmp $8 1 0 next1 0
  3550. ShellLink::GetShortCutWorkingDirectory "$R2$CurrentDirVar\$CurrentFileVar"
  3551. Pop $0
  3552. StrCmp "$0" "$9" 0 next1
  3553. ShellLink::GetShortCutTarget "$R2$CurrentDirVar\$CurrentFileVar"
  3554. Pop $1
  3555. ${WordFind2X} "$1" "\" ".exe" "-1" $7
  3556. ;#NON-DEBUG
  3557. ${If} $7 == "opencpn"
  3558. ${OrIf} $7 == "Uninstall"
  3559. ${OrIf} $7 == "unins000"
  3560. Delete "$R2$CurrentDirVar\$CurrentFileVar"
  3561. StrCmp $CurrentDirVar "" next1
  3562. RMDir "$R2$CurrentDirVar"
  3563. Sleep 250
  3564. IfErrors 0 check_parent1
  3565. ${If} ${FileExists} "$R2$CurrentDirVar\*.*"
  3566. ClearErrors
  3567. RMDir "$R2$CurrentDirVar"
  3568. Sleep 250
  3569. IfErrors next1 check_parent1
  3570. ${EndIf}
  3571. Goto next1
  3572. check_parent1:
  3573. StrCpy $R3 "$STARTMENU$CurrentDirVar"
  3574. Push $R3
  3575. Call ${un}Parent_Dirs_Check
  3576. ${EndIf}
  3577. next1:
  3578. ${RecFindNext}
  3579. ${RecFindClose}
  3580. ${LoopUntil} $R2 == ""
  3581. FileClose $R0
  3582. ${EndIf}
  3583. end:
  3584. Call ${un}Delete_Empty_Parents
  3585. Pop $R3
  3586. Pop $R2
  3587. Pop $R1
  3588. Pop $R0
  3589. FunctionEnd
  3590. !macroend
  3591. !insertmacro Delete_Desktop_Shortcuts_Macro ""
  3592. !insertmacro Delete_Desktop_Shortcuts_Macro "un."
  3593. !macro Parent_Dirs_Check_Macro un
  3594. Function ${un}Parent_Dirs_Check
  3595. Pop $R3
  3596. Push $R4
  3597. ClearErrors
  3598. ${If} ${FileExists} "$TEMP\opencpn_check_parent.tmp"
  3599. FileOpen $R4 "$TEMP\opencpn_check_parent.tmp" a
  3600. IfErrors end
  3601. ${Else}
  3602. FileOpen $R4 "$TEMP\opencpn_check_parent.tmp" w
  3603. IfErrors end
  3604. ${EndIf}
  3605. ${WordFind} "$R3" "\" "E-2{*" $R3
  3606. IfErrors close
  3607. FileWriteUTF16LE $R4 "$R3$\r$\n"
  3608. close:
  3609. FileClose $R4
  3610. end:
  3611. Pop $R4
  3612. FunctionEnd
  3613. !macroend
  3614. !insertmacro Parent_Dirs_Check_Macro ""
  3615. !insertmacro Parent_Dirs_Check_Macro "un."
  3616. !macro Delete_Empty_Parents_Macro un
  3617. Function ${un}Delete_Empty_Parents
  3618. Push $R3
  3619. Push $R4
  3620. Push $R5
  3621. ClearErrors
  3622. ${If} ${FileExists} "$TEMP\opencpn_check_parent.tmp"
  3623. FileOpen $R4 "$TEMP\opencpn_check_parent.tmp" r
  3624. IfErrors end
  3625. ${Do}
  3626. FileReadUTF16LE $R4 $R3
  3627. IfErrors close
  3628. ${TrimNewLines} "$R3" $R3
  3629. ${DirState} $R3 $R5
  3630. StrCmp $R5 0 0 next
  3631. ClearErrors
  3632. RMDir "$R3"
  3633. Sleep 250
  3634. IfErrors next
  3635. loop:
  3636. ${WordFind} "$R3" "\" "E-2{*" $R3
  3637. IfErrors next
  3638. StrCpy $error_tmp 0
  3639. Push $R3
  3640. Call ${un}Delete_Empty_Dir
  3641. StrCmp $error_tmp 1 loop
  3642. next:
  3643. ${Loop}
  3644. close:
  3645. FileClose $R4
  3646. Delete "$TEMP\opencpn_check_parent.tmp"
  3647. ${EndIf}
  3648. end:
  3649. Pop $R5
  3650. Pop $R4
  3651. Pop $R3
  3652. FunctionEnd
  3653. !macroend
  3654. !insertmacro Delete_Empty_Parents_Macro ""
  3655. !insertmacro Delete_Empty_Parents_Macro "un."
  3656. !macro Delete_Empty_Dir_Macro un
  3657. Function ${un}Delete_Empty_Dir
  3658. Push $R3
  3659. Exch
  3660. Pop $R3
  3661. Push $R4
  3662. ${DirState} $R3 $R4
  3663. StrCmp $R4 0 0 end
  3664. RMDir "$R3"
  3665. Sleep 100
  3666. StrCpy $error_tmp 1
  3667. end:
  3668. Pop $R4
  3669. Pop $R3
  3670. FunctionEnd
  3671. !macroend
  3672. !insertmacro Delete_Empty_Dir_Macro ""
  3673. !insertmacro Delete_Empty_Dir_Macro "un."
  3674. ; Initialize variables
  3675. Var explString
  3676. Var explSeparator
  3677. Var explStrLen
  3678. Var explSepLen
  3679. Var explOffset
  3680. Var explTmp
  3681. Var explTmp2
  3682. Var explTmp3
  3683. Var explArrCount
  3684. !macro Explodes_Macro un
  3685. Function ${un}Explode
  3686. /*; Initialize variables
  3687. Var /GLOBAL explString
  3688. Var /GLOBAL explSeparator
  3689. Var /GLOBAL explStrLen
  3690. Var /GLOBAL explSepLen
  3691. Var /GLOBAL explOffset
  3692. Var /GLOBAL explTmp
  3693. Var /GLOBAL explTmp2
  3694. Var /GLOBAL explTmp3
  3695. Var /GLOBAL explArrCount
  3696. */
  3697. ; Get input from user
  3698. Pop $explString
  3699. Pop $explSeparator
  3700. ; Calculates initial values
  3701. StrLen $explStrLen $explString
  3702. StrLen $explSepLen $explSeparator
  3703. StrCpy $explArrCount 1
  3704. ${If} $explStrLen <= 1 ; If we got a single character
  3705. ${OrIf} $explSepLen > $explStrLen ; or separator is larger than the string,
  3706. Push $explString ; then we return initial string with no change
  3707. Push 1 ; and set array's length to 1
  3708. Return
  3709. ${EndIf}
  3710. ; Set offset to the last symbol of the string
  3711. StrCpy $explOffset $explStrLen
  3712. IntOp $explOffset $explOffset - 1
  3713. ; Clear temp string to exclude the possibility of appearance of occasional data
  3714. StrCpy $explTmp ""
  3715. StrCpy $explTmp2 ""
  3716. StrCpy $explTmp3 ""
  3717. ; Loop until the offset becomes negative
  3718. ${Do}
  3719. ; If offset becomes negative, it is time to leave the function
  3720. ${IfThen} $explOffset == -1 ${|} ${ExitDo} ${|}
  3721. ; Remove everything before and after the searched part ("TempStr")
  3722. StrCpy $explTmp $explString $explSepLen $explOffset
  3723. ${If} $explTmp == $explSeparator
  3724. ; Calculating offset to start copy from
  3725. IntOp $explTmp2 $explOffset + $explSepLen ; Offset equals to the current offset plus length of separator
  3726. StrCpy $explTmp3 $explString "" $explTmp2
  3727. Push $explTmp3 ; Throwing array item to the stack
  3728. IntOp $explArrCount $explArrCount + 1 ; Increasing array's counter
  3729. StrCpy $explString $explString $explOffset 0 ; Cutting all characters beginning with the separator entry
  3730. StrLen $explStrLen $explString
  3731. ${EndIf}
  3732. ${If} $explOffset = 0 ; If the beginning of the line met and there is no separator,
  3733. ; copying the rest of the string
  3734. ${If} $explSeparator == "" ; Fix for the empty separator
  3735. IntOp $explArrCount $explArrCount - 1
  3736. ${Else}
  3737. Push $explString
  3738. ${EndIf}
  3739. ${EndIf}
  3740. IntOp $explOffset $explOffset - 1
  3741. ${Loop}
  3742. Push $explArrCount
  3743. FunctionEnd
  3744. !macroend
  3745. !insertmacro Explodes_Macro ""
  3746. !insertmacro Explodes_Macro "un."
  3747. !macro isEmptyDir_Macro un
  3748. Function ${un}isEmptyDir
  3749. # Stack -> # Stack: <directory>
  3750. Exch $0 # Stack: $0
  3751. Push $1 # Stack: $1, $0
  3752. FindFirst $0 $1 "$0\*.*"
  3753. StrCmp $1 "." 0 _notempty
  3754. FindNext $0 $1
  3755. StrCmp $1 ".." 0 _notempty
  3756. ClearErrors
  3757. FindNext $0 $1
  3758. IfErrors 0 _notempty
  3759. FindClose $0
  3760. Pop $1 # Stack: $0
  3761. StrCpy $0 1
  3762. Exch $0 # Stack: 1 (true)
  3763. Goto _end
  3764. _notempty:
  3765. FindClose $0
  3766. Pop $1 # Stack: $0
  3767. StrCpy $0 0
  3768. Exch $0 # Stack: 0 (false)
  3769. _end:
  3770. FunctionEnd
  3771. !macroend
  3772. !insertmacro isEmptyDir_Macro ""
  3773. !insertmacro isEmptyDir_Macro "un."
  3774. ;--------------------------------------------------------------------------------------------------
  3775. ;##################################################################################################
  3776. ;# D E S C R I P T I O N S #
  3777. ;##################################################################################################
  3778. ;# Installer Descriptions #
  3779. ;##################################################################################################
  3780. ;# License page
  3781. LicenseLangString license ${LANG_ENGLISH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3782. LicenseLangString license ${LANG_GERMAN} "@CPACK_RESOURCE_FILE_LICENSE@"
  3783. LicenseLangString license ${LANG_FRENCH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3784. LicenseLangString license ${LANG_CZECH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3785. LicenseLangString license ${LANG_DANISH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3786. LicenseLangString license ${LANG_SPANISH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3787. LicenseLangString license ${LANG_ITALIAN} "@CPACK_RESOURCE_FILE_LICENSE@"
  3788. LicenseLangString license ${LANG_DUTCH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3789. LicenseLangString license ${LANG_POLISH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3790. LicenseLangString license ${LANG_PORTUGUESE} "@CPACK_RESOURCE_FILE_LICENSE@"
  3791. LicenseLangString license ${LANG_PORTUGUESEBR} "@CPACK_RESOURCE_FILE_LICENSE@"
  3792. LicenseLangString license ${LANG_RUSSIAN} "@CPACK_RESOURCE_FILE_LICENSE@"
  3793. LicenseLangString license ${LANG_SWEDISH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3794. LicenseLangString license ${LANG_FINNISH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3795. LicenseLangString license ${LANG_NORWEGIAN} "@CPACK_RESOURCE_FILE_LICENSE@"
  3796. LicenseLangString license ${LANG_TRADCHINESE} "@CPACK_RESOURCE_FILE_LICENSE@"
  3797. LicenseLangString license ${LANG_TURKISH} "@CPACK_RESOURCE_FILE_LICENSE@"
  3798. ;LicenseLangString license ${LANG_HUNGARIAN} "@CPACK_RESOURCE_FILE_LICENSE@"
  3799. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  3800. !insertmacro MUI_DESCRIPTION_TEXT ${SecGrpResetConfig} $(SecGrpResetConfig_Desc)
  3801. !insertmacro MUI_DESCRIPTION_TEXT ${SecDeleteConfigFile} $(SecDeleteConfigFile_Desc)
  3802. !insertmacro MUI_DESCRIPTION_TEXT ${SecDeleteChartDB} $(SecDeleteChartDB_Desc)
  3803. !insertmacro MUI_DESCRIPTION_TEXT ${SecDeleteSENC} $(SecDeleteSENC_Desc)
  3804. !insertmacro MUI_DESCRIPTION_TEXT ${SecDeleteCM93} $(SecDeleteCM93_Desc)
  3805. !insertmacro MUI_DESCRIPTION_TEXT ${SecDeleteNavobjFile} $(SecDeleteNavobjFile_Desc)
  3806. !insertmacro MUI_DESCRIPTION_TEXT ${SecDeleteLogFile} $(SecDeleteLogFile_Desc)
  3807. !insertmacro MUI_DESCRIPTION_TEXT ${SecGrpShortcuts} $(SecGrpShortcuts_Desc)
  3808. !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcutStartmenu} $(SecShortcutStartmenu_Desc)
  3809. !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcutDesktop} $(SecShortcutDesktop_Desc)
  3810. !insertmacro MUI_DESCRIPTION_TEXT ${SecSetConfig} $(SecSetConfig_Desc)
  3811. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  3812. ;--------------------------------
  3813. ;##################################################################################################
  3814. ;# Uninstaller Descriptions #
  3815. ;##################################################################################################
  3816. !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
  3817. !insertmacro MUI_DESCRIPTION_TEXT ${UnSecDeleteConfigFolder} $(UnSecDeleteConfigFolder_Desc)
  3818. !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
  3819. ;--------------------------------------------------------------------------------------------------
  3820. ;##################################################################################################
  3821. ;# Language Strings #
  3822. ;##################################################################################################
  3823. ;#DO NOT EDIT THE NEXT LINE!!! It is needed for the online generating of the translation files!
  3824. ;#Language Strings Start as of: 2010-10-10
  3825. ;#IMPORTANT: Do not end a multi-line with $\"
  3826. LangString Installer ${LANG_ENGLISH} "installer"
  3827. LangString Uninstaller ${LANG_ENGLISH} "uninstaller"
  3828. ;Installer running on unsupported version of Windows
  3829. LangString Installer_Unsupported_Windows_Version ${LANG_ENGLISH} "Your Windows version is not supported (it's too old)!$\r$\nYou need at least Windows XP SP3."
  3830. ;Installer running on Windows XP without SP3
  3831. LangString Installer_Unsupported_XP_SP_Version ${LANG_ENGLISH} "Your Windows XP Service Pack version is not supported (it's too old)!$\r$\nYou need at least Windows XP SP3."
  3832. ;Installer already running
  3833. LangString Installer_Running ${LANG_ENGLISH} "The installer is already running."
  3834. ;Uninstaller already running
  3835. LangString Uninstaller_Running ${LANG_ENGLISH} "The uninstaller is already running."
  3836. ;Language Dialog
  3837. LangString LangDialog_Title ${LANG_ENGLISH} "@CPACK_PACKAGE_NAME@ @CPACK_PACKAGE_VERSION@ Installation"
  3838. LangString LangDialog_Text ${LANG_ENGLISH} "Please select a language:"
  3839. ;License dialog
  3840. LangString License_Message ${LANG_ENGLISH} "OpenCPN is software libre. You are encouraged and legally \
  3841. entitled to copy, reinstall, modify, and redistribute this program \
  3842. for yourself and your friends under the terms of the GPL. $\r$\nSmooth sailing!"
  3843. ;Clean up page
  3844. LangString text_please_wait_1 ${LANG_ENGLISH} "... please wait!"
  3845. LangString Scanning_HDD ${LANG_ENGLISH} "Scanning HDD ..."
  3846. LangString OCPN_Scanning_HDD ${LANG_ENGLISH} "OpenCPN: Scan HDD ..., please wait!"
  3847. LangString Search_old_installations ${LANG_ENGLISH} "Searching for old installations"
  3848. LangString Install_Location_Default ${LANG_ENGLISH} "Install Locations by default paths (may not find all)"
  3849. LangString Install_Location_HDD_Scan ${LANG_ENGLISH} "Install Location by full HDD scan (most reliable)"
  3850. LangString Label_CleanUp_Text ${LANG_ENGLISH} "Click on a list-item to select/ unselect it or Select ALL (recommended) and then Uninstall selected."
  3851. LangString BT_Uninstall_Selected_CleanUp ${LANG_ENGLISH} "Uninstall Selected"
  3852. LangString BT_SelectAll_CleanUp ${LANG_ENGLISH} "Select ALL"
  3853. LangString BT_UnselectAll_CleanUp ${LANG_ENGLISH} "Unselect ALL"
  3854. LangString LB_CleanUp ${LANG_ENGLISH} "Listbox Text"
  3855. LangString BT_FullScan_CleanUp ${LANG_ENGLISH} "Scan HDD ..."
  3856. LangString LAB_FullScan_CleanUp ${LANG_ENGLISH} "Scan the HDD for the most reliable detection.$\r$\nATTENTION: may last several minutes!"
  3857. LangString Page_CleanUp_Title ${LANG_ENGLISH} "Uninstall older Version"
  3858. LangString Page_CleanUp_Subtitle ${LANG_ENGLISH} "Incompatible version detected"
  3859. ;Components Page
  3860. ;Header
  3861. LangString CP_HEADER_TEXT ${LANG_ENGLISH} "Installation Settings"
  3862. ;Subheader
  3863. LangString CP_HEADER_SUBTEXT ${LANG_ENGLISH} "Choose the settings for the installation"
  3864. ;Top
  3865. LangString CP_TOP ${LANG_ENGLISH} "Check or uncheck the options for the installation.$\r$\nClick 'Next' to continue."
  3866. ;Installation type
  3867. LangString CP_INSTTYPE ${LANG_ENGLISH} "Installation type:"
  3868. ;Components list
  3869. LangString CP_COMPLIST ${LANG_ENGLISH} "Adjust the settings individually:"
  3870. ;Directory page
  3871. ;Set Config page
  3872. LangString Page_SetConfig_Title ${LANG_ENGLISH} "Default configuration settings"
  3873. LangString Page_SetConfig_Subtitle ${LANG_ENGLISH} "Preconfigure settings for OpenCPN"
  3874. LangString Select_Chart_Directory ${LANG_ENGLISH} "Please select a chart directory to add to OpenCPN"
  3875. LangString BT_Browse_SetConfig_Text ${LANG_ENGLISH} "Browse..."
  3876. LangString BT_DeleteAll_SetConfig_Text ${LANG_ENGLISH} "Delete ALL"
  3877. LangString BT_Delete_SetConfig_Text ${LANG_ENGLISH} "Delete"
  3878. LangString GB_ChartDir_SetConfig_Text ${LANG_ENGLISH} "Add Chart Directory"
  3879. LangString CB_Language_SetConfig_Text ${LANG_ENGLISH} "Set OpenCPN program language to $LANG_NAME"
  3880. LangString GB_Language_SetConfig_Text ${LANG_ENGLISH} "Set OpenCPN program language"
  3881. LangString Label_SetConfig_Text ${LANG_ENGLISH} "Configure preconfig settings for the OpenCPN program.$\r$\nThese settings are saved in the file opencpn.ini."
  3882. ;Confirm page
  3883. LangString Page_Confirm_Title ${LANG_ENGLISH} "Ready to Install"
  3884. LangString Page_Confirm_Subtitle ${LANG_ENGLISH} "Check the installation options"
  3885. LangString Installation_Type ${LANG_ENGLISH} "Setup type"
  3886. LangString Installation_Directory ${LANG_ENGLISH} "Destination location"
  3887. LangString Create_Shortcuts ${LANG_ENGLISH} "Create shortcuts"
  3888. LangString Type_Reinstall ${LANG_ENGLISH} "Reinstallation"
  3889. LangString Type_Upgrade ${LANG_ENGLISH} "Upgrade"
  3890. LangString Type_Downgrade ${LANG_ENGLISH} "Downgrade"
  3891. LangString Type_Parallel_Installation ${LANG_ENGLISH} "Parallel installation"
  3892. LangString Type_Fresh_Installation ${LANG_ENGLISH} "New installation"
  3893. LangString Shortcuts ${LANG_ENGLISH} "Shortcuts"
  3894. LangString Create_Shortcut_Start_Menu ${LANG_ENGLISH} "in the Start Menu folder"
  3895. LangString Create_Shortcut_Desktop ${LANG_ENGLISH} "on the Desktop"
  3896. LangString not_selected ${LANG_ENGLISH} "not selected"
  3897. LangString text_none ${LANG_ENGLISH} "none"
  3898. ;Installer Sections
  3899. ;Reset config
  3900. LangString SecGrpResetConfig_Text ${LANG_ENGLISH} "Reset ALL OpenCPN configuration files"
  3901. ;Delete Config file (opencpn.ini)
  3902. LangString SecDeleteConfigFile_Text ${LANG_ENGLISH} "Delete config file (opencpn.ini)"
  3903. ;Delete Chart DB (CHRTLIST.DAT)
  3904. LangString SecDeleteChartDB_Text ${LANG_ENGLISH} "Delete Chart Database file (CHRTLIST.DAT)"
  3905. ;Delete SENC directory
  3906. LangString SecDeleteSENC_Text ${LANG_ENGLISH} "Delete SENC directory"
  3907. ;Delete CM93 directory
  3908. LangString SecDeleteCM93_Text ${LANG_ENGLISH} "Delete CM93 Directory"
  3909. ;Delete Log file (opencpn.log)
  3910. LangString SecDeleteLogFile_Text ${LANG_ENGLISH} "Delete Log file (opencpn.log)"
  3911. ;Delete navobj.xml
  3912. LangString SecDeleteNavobjFile_Text ${LANG_ENGLISH} "Delete Navobject file (navobj.xml)"
  3913. ;Set config
  3914. LangString SecSetConfig_Text ${LANG_ENGLISH} "OpenCPN Configuration Settings"
  3915. ;Set language
  3916. LangString SecSetConfigLang_Text ${LANG_ENGLISH} "Set language to $LANG_NAME"
  3917. ;Set chart dir(s)
  3918. LangString SecSetConfigChartDir_Text ${LANG_ENGLISH} "Select Chart Directories"
  3919. ;Uninstaller Sections
  3920. ;Reset config
  3921. LangString UnSecDeleteConfigFolder_Text ${LANG_ENGLISH} "Delete Config folder"
  3922. ;Installer Descriptions
  3923. LangString SecGrpResetConfig_Desc ${LANG_ENGLISH} "Deletes ALL files and subdirectories in the configuration folder."
  3924. LangString SecDeleteConfigFile_Desc ${LANG_ENGLISH} "Deletes the configuration file. This file helds also Routes and Waypoints."
  3925. LangString SecDeleteChartDB_Desc ${LANG_ENGLISH} "Deletes the Chart DB file."
  3926. LangString SecDeleteSENC_Desc ${LANG_ENGLISH} "Deletes the SENC subfolder which helds the Bitmaps and S57 chart cache files."
  3927. LangString SecDeleteCM93_Desc ${LANG_ENGLISH} "Deletes the cm93 subfolder which helds the cached cm93 chart outlines."
  3928. LangString SecDeleteNavobjFile_Desc ${LANG_ENGLISH} "Deletes the file 'navobj.xml' in the config folder. This file contains the Tracks."
  3929. LangString SecDeleteLogFile_Desc ${LANG_ENGLISH} "Deletes the OpenCPN log file 'opencpn.log'."
  3930. LangString SecGrpShortcuts_Desc ${LANG_ENGLISH} "Creates shortcuts in both, the Start Menu and on the Desktop."
  3931. LangString SecShortcutStartmenu_Desc ${LANG_ENGLISH} "Creates shortcuts for OpenCPN and the Uninstaller in the Start Menu - configurable on the next page."
  3932. LangString SecShortcutDesktop_Desc ${LANG_ENGLISH} "Creates a shortcut for OpenCPN on the Desktop."
  3933. LangString SecSetConfig_Desc ${LANG_ENGLISH} "Preconfigure the language setting and the chart dir(s) for OpenCPN. When selected a separate page is shown for configuration."
  3934. ;Uninstaller Descriptions
  3935. LangString UnSecDeleteConfigFolder_Desc ${LANG_ENGLISH} "Deletes the config folder and all its files and subdirectories."
  3936. ;Un-install Link
  3937. LangString Uninstall_Link ${LANG_ENGLISH} "Uninstall @CPACK_PACKAGE_NAME@ @CPACK_PACKAGE_VERSION@"
  3938. ;Multiple Install > 1
  3939. ;Title
  3940. LangString Page_TypeInst_Title ${LANG_ENGLISH} "Previous Installations"
  3941. ;Subtitle
  3942. LangString Page_TypeInst_Subtitle ${LANG_ENGLISH} "$MULTIPLE_INSTALLS installations of OpenCPN found.$\r$\nChoose how you want to install OpenCPN."
  3943. ;Multiple Install = 1
  3944. ;Title
  3945. LangString Page_TypeInst_Title_1 ${LANG_ENGLISH} "Already Installed"
  3946. ;Subtitle
  3947. LangString Page_TypeInst_Subtitle_1 ${LANG_ENGLISH} "Found installed version of OpenCPN.$\r$\nChoose how you want to install OpenCPN."
  3948. ;Version exists
  3949. ;Title
  3950. LangString Page_TypeInst_Title_Exists ${LANG_ENGLISH} "Version Already Installed"
  3951. ;Subtitle
  3952. LangString Page_TypeInst_Subtitle_Exists ${LANG_ENGLISH} "OpenCPN @CPACK_PACKAGE_VERSION@ is already installed.$\r$\nChoose how you want to install OpenCPN."
  3953. ;Label
  3954. LangString Label_TypeInst_Reinstall_Text ${LANG_ENGLISH} "OpenCPN @CPACK_PACKAGE_VERSION@ is already installed on your system. You can reinstall the version now using the previous settings. If you wish to install the program with different settings, cancel installation and un-install the existing version first. Click Next to continue."
  3955. ;Radio button 'Reinstall'
  3956. LangString RB_Reinstall_TypeInst_Text ${LANG_ENGLISH} "Reinstall using previous settings"
  3957. ;Version newer
  3958. ;Label
  3959. LangString Label_TypeInst_Upgrade_Text ${LANG_ENGLISH} "An older version of OpenCPN is installed on your system. Select the installation type you want to perform and click Next to continue."
  3960. ;Radio button 'Upgrade'
  3961. LangString RB_Upgrade_TypeInst_Text ${LANG_ENGLISH} "Upgrade OpenCPN using previous settings (recommended)"
  3962. ;Version older
  3963. ;Label
  3964. LangString Label_TypeInst_Downgrade_Text ${LANG_ENGLISH} "A newer version of OpenCPN is installed on your system. It is not recommended to downgrade to an older version. Select the installation type you want to perform and click Next to continue."
  3965. ;Radio button 'Downgrade'
  3966. LangString RB_Downgrade_TypeInst_Text ${LANG_ENGLISH} "Downgrade OpenCPN using previous settings (recommended)"
  3967. ;Multiple versions
  3968. ;Label
  3969. LangString Label_TypeInst_Parallel_Text ${LANG_ENGLISH} "Setup has detected several installed versions of OpenCPN on your system. It is recommended to have only one version of OpenCPN installed at a time. Select the operation you want to perform and click Next to continue."
  3970. ;Radio button 'Parallel Installation'
  3971. LangString RB_Parallel_TypeInst_Text ${LANG_ENGLISH} "Parallel Installation (advanced users)"
  3972. ;Empty string - needed for Components page
  3973. LangString EmptyString ${LANG_ENGLISH} ""
  3974. ;Finish page
  3975. LangString Show_Readme_Text ${LANG_ENGLISH} "Show Install Log file"
  3976. LangString Finish_Link_Text ${LANG_ENGLISH} "OpenCPN website (Internet connection required)"
  3977. LangString Finish_Link_URL ${LANG_ENGLISH} "http://opencpn.info/?ref=installer&user=$USERS_NAME&lang=$REG_LANG&version=@CPACK_PACKAGE_VERSION@"
  3978. ;Message Boxes
  3979. LangString Msg_UAC_Admin_Retry ${LANG_ENGLISH} "This $Inst_Or_Uninst requires admin access!$\r$\nPlease log on as an Administrator and try again."
  3980. LangString Msg_UAC_Admin_Abort ${LANG_ENGLISH} "This $Inst_Or_Uninst requires admin privileges, aborting!"
  3981. LangString Msg_UAC_Logon_Abort ${LANG_ENGLISH} "Logon service not running, aborting!"
  3982. LangString Msg_UAC_No_Elevation ${LANG_ENGLISH} "Unable to elevate , error $0"
  3983. LangString Msg_Error_Remove_InstDir ${LANG_ENGLISH} "The installation directory$\r$\n'$INSTDIR'$\r$\ncould not be removed because it is not empty."
  3984. LangString Msg_Path_Invalid ${LANG_ENGLISH} "The entered path is invalid!$\r$\n$\r$\nPlease check your input."
  3985. LangString Msg_Path_Installation_Exists ${LANG_ENGLISH} "There already exists an installation of OpenCPN in the given path.$\r$\nIf you wish to use this path, first uninstall the version. Or select another path for this installation."
  3986. LangString Msg_Uninstall_Old_Versions ${LANG_ENGLISH} "Setup has detected at least one older version of OpenCPN which is not compatible with the new version control.$\r$\n\
  3987. It is recommended to first uninstall all of these installations (this does not affect your Config files) and clean-up the Registry.$\r$\n\
  3988. If you click Yes on the next page a listbox with all installation locations will be shown and you will have the possibility to select the installations you wish to uninstall.$\r$\n\
  3989. If you are unsure about possible other previous installations than those shown in the listbox, you can also perform a scan of the entire \
  3990. Harddisk (ATTENTION: This may take several minutes) to find all install locations (recommended).$\r$\n$\r$\n\
  3991. Do you want to uninstall the old version(s)?"
  3992. LangString Msg_Not_All_Old_Uninstalled ${LANG_ENGLISH} "You have not uninstalled all previous installations.$\r$\n$\r$\nDo you want to continue anyway?"
  3993. LangString Msg_Uninstaller_Param_Help ${LANG_ENGLISH} "Uninstaller Help$\r$\n$\r$\nUse the command line or a shortcut to run the uninstaller:$\r$\n$INSTDIR\Uninstall @CPACK_PACKAGE_VERSION@.exe [/?] | [/S], [/type=X]$\r$\n$\r$\nParameters:$\r$\n/?$\tshows this help message box$\r$\n/S$\truns the uninstaller in silent mode$\r$\n$\twill do a full uninstall if called without any type parameter$\r$\n/type=X$\tX must be a digit between 1 and 5$\r$\n$\t1 = Removes only the program files$\r$\n$\t2 = Removes only the program files + preconfig RegKey$\r$\n$\t3 = Removes the program files + config folder$\r$\n$\tpreserves the preconfig RegKey$\r$\n$\t4 = Deletes only the config folder$\r$\n$\t5 = Deletes only the preconfig RegKey$\r$\n$\r$\nEntering any other number or value will quit the uninstaller with a message box without removing or deleting anything."
  3994. LangString Msg_Unknown_Type_Param ${LANG_ENGLISH} "The entered value '$9' for the type parameter is not valid!$\r$\nUse $INSTDIR\Uninstall @CPACK_PACKAGE_VERSION@.exe /?$\r$\nto see a list of valid values."
  3995. ;added on 2010-10-16
  3996. LangString SecGrpShortcuts_Text ${LANG_ENGLISH} "Create Shortcuts"
  3997. LangString SecShortcutStartmenu_Text ${LANG_ENGLISH} "Add Shortcuts to the Start Menu"
  3998. LangString SecShortcutDesktop_Text ${LANG_ENGLISH} "Create Shortcut on the Desktop"
  3999. LangString Installation_Delete_Config ${LANG_ENGLISH} "Delete (existing) Config Subdirectories/ Files"
  4000. ;added on 2010-10-17
  4001. LangString Banner_Scan_Drive ${LANG_ENGLISH} "Scanning Drive $9"
  4002. LangString Banner_Installation_Found_Singular ${LANG_ENGLISH} "Found $counter_tmp installation"
  4003. LangString Banner_Installation_Found_Plural ${LANG_ENGLISH} "Found $counter_tmp installations"
  4004. ;added on 2010-10-21
  4005. LangString Uninstall_Folder_Name ${LANG_ENGLISH} "Uninstall"
  4006. ;added on 2011-06-13
  4007. LangString ^NameDA ${LANG_ENGLISH} "@CPACK_PACKAGE_NAME@ Version @CPACK_PACKAGE_VERSION@"
  4008. LangString Installer ${LANG_ENGLISH} "Installer"
  4009. ;#EOF