Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

MessageSnifferInstaller2_1.nsi 188KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624
  1. ; Script generated by the HM NIS Edit Script Wizard.
  2. ################################################################################################################################################
  3. ## NOTE FOR ADDING NEW PLATFORMS TO THIS SCRIPT, Search ON [ ## ADDINGPLATFORM ## ]
  4. ## These will be sequentially incremented NOTES. If you F3 through the script, handling each step as you go, you will not miss anything.
  5. ################################################################################################################################################
  6. ; HM NIS Edit Wizard helper defines
  7. !define PRODUCT_NAME "Message Sniffer Server Installer"
  8. ## ADDINGPLATFORM ## STEP 0 :: INCREMENT BUILD NUMBER If Desired.
  9. !define PRODUCT_VERSION "v3.3 - SNFv-E3.0.11"
  10. !define PRODUCT_PUBLISHER "Arm Research"
  11. SetCompressor lzma
  12. !include "WinMessages.nsh" ; needed for Word searching of the Plugins.dat file.
  13. !include "WordFunc.nsh" ; needed for Word searching of the Plugins.dat file.
  14. # already included !insertmacro GetParent ; replace the moveup directory function.....
  15. !include "Sections.nsh"
  16. !include "FileFunc.nsh" ; needed for the ${GetParent} directory calls
  17. !include "nsDialogs.nsh" ; needed to dynamically handle custom page creation
  18. !include "LogicLib.nsh" ; needed for if than do while.
  19. #!insertmacro GetTime ; compiler macro... needed to call before use
  20. !insertmacro WordFind ; compiler macro... needed to call before use
  21. #############################################################################
  22. ## These variables hold the list of platforms for which we MAY install SNF.
  23. ## There may be one, more or many.
  24. ## ADDINGPLATFORM ## STEP 1 :: Add the isXYZINSTALLED variable. This is a boolean flag to track a platform.
  25. VAR /GLOBAL isIceWarpInstalled
  26. VAR /GLOBAL isMailSiteInstalled
  27. VAR /GLOBAL isKerioInstalled
  28. VAR /GLOBAL isImailInstalled
  29. VAR /GLOBAL isSmarterMailInstalled
  30. VAR /GLOBAL isAlligateInstalled
  31. VAR /GLOBAL isDecludeInstalled
  32. VAR /GLOBAL isMXGuardInstalled
  33. VAR /GLOBAL isMINIMIInstalled
  34. VAR /GLOBAL isSNF4AlligateInstalled
  35. Var /GLOBAL isMDaemonInstalled
  36. ## ADDINGPLATFORM ## STEP 2 :: If it is a shim module, then you need to add this conditional in order to support reinstall-new-vs-just-use option for the shim.
  37. VAR /GLOBAL Set_For_MINIMI_INSTALL ; may or may not be set, depending of if the user wants to re-install MINIMI
  38. VAR /GLOBAL Set_For_SNF4Alligate_INSTALL ; may or may not be set, depending of if the user wants to re-install MINIMI
  39. VAR /GLOBAL SelectedCaseIndexForPlatformScreen ; This is the var for controlling the case display on the platform screen. Indxed top to bottom.
  40. ## Now define the variables to hold the locations of WHERE we install SNF
  41. ## in the event we select any of these options.
  42. ## ADDINGPLATFORM ## STEP 3 :: Add the variable that will hold the foldername for the given platform.
  43. VAR /GLOBAL IceWarpInstallFolder
  44. VAR /GLOBAL MailSiteInstallFolder
  45. VAR /GLOBAL KerioInstallFolder
  46. VAR /GLOBAL ImailInstallFolder
  47. VAR /GLOBAL SmarterMailInstallFolder
  48. VAR /GLOBAL AlligateInstallFolder
  49. VAR /GLOBAL DecludeInstallFolder
  50. VAR /GLOBAL MXGuardInstallFolder
  51. VAR /GLOBAL MINIMIInstallFolder
  52. VAR /GLOBAL SNF4AlligateInstallFolder
  53. VAR /GLOBAL MDaemonInstallFolder
  54. ##
  55. ##
  56. ##################################################################################
  57. ## Tests for file / directory finding
  58. Var /GLOBAL SNF_SearchFor_Location_Button
  59. Var /GLOBAL SNF_SearchFor_Location ; This is the variable that holds what platform folder we're looking for initially. ( Install Platform Screen )
  60. Var /GLOBAL SNF_SearchFor_Location_ButtonB
  61. Var /GLOBAL SNF_SearchFor_LocationB
  62. VAR /GLOBAL SNFServerInstallDir ; Path to the InstallDirectory.
  63. VAR /GLOBAL MessageSnifferRestoreDir ; Path to the ArchivedRestore Dir. Or blank for fresh install.
  64. ; VAR /GLOBAL PreExistingMessageSnifferInstallDirectory ; Path to MessageSniffer root directory
  65. VAR /GLOBAL PreviousSnifferInstalled ; Flag to indicate if there was a previous sniffer install.
  66. VAR /GLOBAL ArchivesAvailable ; Flag to indicate, if there isn't a sniffer version installed but there ARE archives... then we have another option set.
  67. VAR /GLOBAL OldVersionOfSniffer ; Flag to indicate that we need to deal with the /sniffer pathname.
  68. VAR /GLOBAL ShowTelemetryPage ; Flag to indicate that we need to show the status page.
  69. VAR /GLOBAL ShowRestoreOptionsPage ; The flag to determine if the user wanted to install/restore and so to show the
  70. ; options page for that.
  71. VAR /GLOBAL ShowArchiveOptionsPage ; Ok, this will be the flag to display the archive screen.
  72. VAR /GLOBAL HandleUninstallPage ; Ok, we don't want to flash to another page when we pick uninstall. ( It was jumping to the Master Utilities,
  73. ; installation screen before it called the section code... and it was looking strange from the user's persepctive
  74. ; like there was unintended page flicker.
  75. VAR /GLOBAL CustomFolderName ; User input variable to name the archive folder.
  76. VAR /GLOBAL LicenseID
  77. VAR /GLOBAL Authentication
  78. VAR /GLOBAL BaseRadioDefault ; this is the Int id of the section that will be the minimal permitted default on either the Platforms or the Utilities screen.
  79. VAR /GLOBAL currentPlatformSelection ; this is the Int id of the section that is the current select option for the Platforms or the Utilities screen.
  80. VAR /GLOBAL currentUtilitySelection
  81. # These vars are used by the page that looks for missing folders.
  82. Var /GLOBAL FindApplicationMessage ; This is used to abstract the search page.
  83. Var /GLOBAL MissingApplicationName ; This is used to identify the abstracted application name.
  84. Var /GLOBAL MissingApplicationFolder ; This is used to identify the abstracted application folder to start the search from
  85. Var /GLOBAL Find_Explanation_INFO ; if you want a verbose instruction put it here.
  86. # For holding the shortened version of paths.
  87. Var /GLOBAL localINSTDIR ; for use with shortente PROGR~1 path anmes.
  88. Var /GLOBAL localSERVDIR
  89. PageEx components
  90. ComponentText "Welcome to the Message Sniffer Platforms Screen. $\nPlease select the platform you will use with Message Sniffer." " " "Please select from these available platforms:"
  91. PageCallbacks "setupPlatforms" "" "" ; the setupPlatforms displays the lines based on DetermineInstallationPlatforms
  92. PageExEnd
  93. # Prior to this call, you would have to set the parameters to indicate that you were looking for something, and what that was... otherwise
  94. # This page will just skip. If the user selects default install, it will put it in a default folder but let the user select another if they choose.
  95. Page custom "FindApplicationPath" "setupINSTALLDIR" "Confirm Install Location:"
  96. ; setupINSTALLDIR sets the $INSTALLDIR and the archives folder flags if applicable for whatever
  97. ; installation is relevant.... ( This has complicated MessageSnifferRegistry entries...)
  98. PageEx components
  99. ComponentText "Welcome to the Message Sniffer Server Install Utility. Please select from the available activities." " " "Please select from the available activities:"
  100. PageCallbacks "setupComponents2" "" "Components2_Leave"
  101. PageExEnd
  102. Page custom "nsDialogsTelemetryShow" "nsDialogsTelemetryLeave" "Status Viewer"
  103. ;Page custom nsDialogsSelectRestoreDir nsDialogsSelectRestoreDir_leave "Restore Or Archive"
  104. ;Page custom nsDialogsSelectRestoreDir nsDialogsSelectRestoreDir_leave "Restore Or Archive"
  105. ;Page custom nsDialogsInstallRestoreDir nsDialogsInstallRestoreDir_leave "Install"
  106. ;Page custom nsDialogHandleArchive nsDialogArchive_leave "Archive"
  107. Page custom nsDialogHandleUninstall "" "Uninstall"
  108. Page instfiles nsDialogInstall "" ""
  109. Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  110. ## ADDINGPLATFORM ## STEP 4 :: INCREMENT BUILD NAME IF DESIRED
  111. OutFile "SNF_CS_Installer.exe"
  112. ShowInstDetails show
  113. AddBrandingImage left 140
  114. !insertmacro GetParent
  115. !macro BIMAGE IMAGE PARMS
  116. Push $0
  117. GetTempFileName $0
  118. File /oname=$0 "${IMAGE}"
  119. SetBrandingImage ${PARMS} $0
  120. Delete $0
  121. Pop $0
  122. !macroend
  123. ###############################################################################
  124. ##
  125. ## Open source functional additions from NSIS website. Provided by users.
  126. ##
  127. ##
  128. ###############################################################################
  129. ; BEGIN REPLACEINFILE SUBTOUTINES
  130. ; StrReplace
  131. ; Replaces all ocurrences of a given needle within a haystack with another string
  132. ; Written by dandaman32
  133. Var STR_REPLACE_VAR_0
  134. Var STR_REPLACE_VAR_1
  135. Var STR_REPLACE_VAR_2
  136. Var STR_REPLACE_VAR_3
  137. Var STR_REPLACE_VAR_4
  138. Var STR_REPLACE_VAR_5
  139. Var STR_REPLACE_VAR_6
  140. Var STR_REPLACE_VAR_7
  141. Var STR_REPLACE_VAR_8
  142. Function StrReplace
  143. Exch $STR_REPLACE_VAR_2
  144. Exch 1
  145. Exch $STR_REPLACE_VAR_1
  146. Exch 2
  147. Exch $STR_REPLACE_VAR_0
  148. StrCpy $STR_REPLACE_VAR_3 -1
  149. StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
  150. StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
  151. loop:
  152. IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
  153. StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
  154. StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
  155. StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
  156. Goto loop
  157. found:
  158. StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
  159. IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
  160. StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
  161. StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
  162. StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
  163. Goto loop
  164. done:
  165. Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
  166. Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
  167. Exch $STR_REPLACE_VAR_0
  168. FunctionEnd
  169. Function un.StrReplace
  170. Exch $STR_REPLACE_VAR_2
  171. Exch 1
  172. Exch $STR_REPLACE_VAR_1
  173. Exch 2
  174. Exch $STR_REPLACE_VAR_0
  175. StrCpy $STR_REPLACE_VAR_3 -1
  176. StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
  177. StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
  178. loop:
  179. IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
  180. StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
  181. StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
  182. StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
  183. Goto loop
  184. found:
  185. StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
  186. IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
  187. StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
  188. StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
  189. StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
  190. Goto loop
  191. done:
  192. Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
  193. Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
  194. Exch $STR_REPLACE_VAR_0
  195. FunctionEnd
  196. !macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
  197. Push "${HAYSTACK}"
  198. Push "${NEEDLE}"
  199. Push "${NEEDLE2}"
  200. Call StrReplace
  201. Pop "${OUT}"
  202. !macroend
  203. !macro un._strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
  204. Push "${HAYSTACK}"
  205. Push "${NEEDLE}"
  206. Push "${NEEDLE2}"
  207. Call un.StrReplace
  208. Pop "${OUT}"
  209. !macroend
  210. !define StrReplace '!insertmacro "_strReplaceConstructor"'
  211. !define un.StrReplace '!insertmacro "un._strReplaceConstructor"'
  212. !macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
  213. Push "${SOURCE_FILE}"
  214. Push "${SEARCH_TEXT}"
  215. Push "${REPLACEMENT}"
  216. Call RIF
  217. !macroend
  218. !macro un.ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
  219. Push "${SOURCE_FILE}"
  220. Push "${SEARCH_TEXT}"
  221. Push "${REPLACEMENT}"
  222. Call un.RIF
  223. !macroend
  224. Function RIF
  225. ClearErrors ; want to be a newborn
  226. Exch $0 ; REPLACEMENT
  227. Exch
  228. Exch $1 ; SEARCH_TEXT
  229. Exch 2
  230. Exch $2 ; SOURCE_FILE
  231. Push $R0 ; SOURCE_FILE file handle
  232. Push $R1 ; temporary file handle
  233. Push $R2 ; unique temporary file name
  234. Push $R3 ; a line to sar/save
  235. Push $R4 ; shift puffer
  236. IfFileExists $2 +1 RIF_error ; knock-knock
  237. FileOpen $R0 $2 "r" ; open the door
  238. GetTempFileName $R2 ; who's new?
  239. FileOpen $R1 $R2 "w" ; the escape, please!
  240. RIF_loop: ; round'n'round we go
  241. FileRead $R0 $R3 ; read one line
  242. IfErrors RIF_leaveloop ; enough is enough
  243. RIF_sar: ; sar - search and replace
  244. Push "$R3" ; (hair)stack
  245. Push "$1" ; needle
  246. Push "$0" ; blood
  247. Call StrReplace ; do the bartwalk
  248. StrCpy $R4 "$R3" ; remember previous state
  249. Pop $R3 ; gimme s.th. back in return!
  250. StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
  251. FileWrite $R1 "$R3" ; save the newbie
  252. Goto RIF_loop ; gimme more
  253. RIF_leaveloop: ; over'n'out, Sir!
  254. FileClose $R1 ; S'rry, Ma'am - clos'n now
  255. FileClose $R0 ; me 2
  256. ;MessageBox MB_OK "Files Closed. $R1 , $R0"
  257. Delete "$2.old" ; go away, Sire
  258. ;MessageBox MB_OK "Deleete $2.old"
  259. Rename "$2" "$2.old" ; step aside, Ma'am
  260. ;MessageBox MB_OK "Rename $2 to $2.old"
  261. Rename "$R2" "$2" ; hi, baby!
  262. ;MessageBox MB_OK "Rename $R2 to $2"
  263. Delete "$2.old"
  264. ClearErrors ; now i AM a newborn
  265. Goto RIF_out ; out'n'away
  266. RIF_error: ; ups - s.th. went wrong...
  267. SetErrors ; ...so cry, boy!
  268. RIF_out: ; your wardrobe?
  269. Pop $R4
  270. Pop $R3
  271. Pop $R2
  272. Pop $R1
  273. Pop $R0
  274. Pop $2
  275. Pop $0
  276. Pop $1
  277. FunctionEnd
  278. Function un.RIF
  279. ClearErrors ; want to be a newborn
  280. Exch $0 ; REPLACEMENT
  281. Exch
  282. Exch $1 ; SEARCH_TEXT
  283. Exch 2
  284. Exch $2 ; SOURCE_FILE
  285. Push $R0 ; SOURCE_FILE file handle
  286. Push $R1 ; temporary file handle
  287. Push $R2 ; unique temporary file name
  288. Push $R3 ; a line to sar/save
  289. Push $R4 ; shift puffer
  290. IfFileExists $2 +1 RIF_error ; knock-knock
  291. FileOpen $R0 $2 "r" ; open the door
  292. GetTempFileName $R2 ; who's new?
  293. FileOpen $R1 $R2 "w" ; the escape, please!
  294. RIF_loop: ; round'n'round we go
  295. FileRead $R0 $R3 ; read one line
  296. IfErrors RIF_leaveloop ; enough is enough
  297. RIF_sar: ; sar - search and replace
  298. Push "$R3" ; (hair)stack
  299. Push "$1" ; needle
  300. Push "$0" ; blood
  301. Call un.StrReplace ; do the bartwalk
  302. StrCpy $R4 "$R3" ; remember previous state
  303. Pop $R3 ; gimme s.th. back in return!
  304. StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
  305. FileWrite $R1 "$R3" ; save the newbie
  306. Goto RIF_loop ; gimme more
  307. RIF_leaveloop: ; over'n'out, Sir!
  308. FileClose $R1 ; S'rry, Ma'am - clos'n now
  309. FileClose $R0 ; me 2
  310. ;MessageBox MB_OK "Files Closed. $R1 , $R0"
  311. Delete "$2.old" ; go away, Sire
  312. ;MessageBox MB_OK "Deleete $2.old"
  313. Rename "$2" "$2.old" ; step aside, Ma'am
  314. ;MessageBox MB_OK "Rename $2 to $2.old"
  315. Rename "$R2" "$2" ; hi, baby!
  316. ;MessageBox MB_OK "Rename $R2 to $2"
  317. Delete "$2.old"
  318. ClearErrors ; now i AM a newborn
  319. Goto RIF_out ; out'n'away
  320. RIF_error: ; ups - s.th. went wrong...
  321. SetErrors ; ...so cry, boy!
  322. RIF_out: ; your wardrobe?
  323. Pop $R4
  324. Pop $R3
  325. Pop $R2
  326. Pop $R1
  327. Pop $R0
  328. Pop $2
  329. Pop $0
  330. Pop $1
  331. FunctionEnd
  332. ; END REPLACE IN FILE SUBROUTINES
  333. ; The following code is for finding strings inbetween two markers... reguardless of linefeeds.
  334. !macro GetBetween This AndThis In Return
  335. Push "${This}"
  336. Push "${AndThis}"
  337. Push "${In}"
  338. Call GetBetween
  339. Pop "${Return}"
  340. !macroend
  341. !define GetBetween "!insertmacro GetBetween"
  342. Function GetBetween
  343. Exch $R0 ; file ; $R0_Old + AndThis + This + Stack
  344. Exch ; AndThis + $R0_Old + This + Stack
  345. Exch $R1 ; before this (marker 2) ; $R1_Old + $R0_Old + This + Stack
  346. Exch 2 ; This + $R0_Old + $R1_Old + Stack
  347. Exch $R2 ; after this (marker 1) $R2_Old + $R0_OLD + $R1_Old + Stack
  348. Exch 2 ; $R1_Old + $R0_OLD + $R2_Old + Stack
  349. Exch ; $R0_Old + $R1_OLD + $R2_Old + Stack
  350. Exch 2 ; $R2_Old + $R1_OLD + $R0_Old + Stack
  351. Push $R3 ; marker 1 len R3,R2,R1,R0,Stack
  352. Push $R4 ; marker 2 len R4,R3,R2,R1,R0,Stack
  353. Push $R5 ; marker pos R5,R4,R3,R2,R1,R0,Stack
  354. Push $R6 ; file handle R6,R5,R4,R3,R2,R1,R0,Stack
  355. Push $R7 ; current line string R7,R6,R5,R4,R3,R2,R1,R0,Stack
  356. Push $R8 ; current chop R8,R7,R6,R5,R4,R3,R2,R1,R0,Stack
  357. FileOpen $R6 $R0 r
  358. StrLen $R4 $R2
  359. StrLen $R3 $R1
  360. StrCpy $R0 ""
  361. Read1:
  362. ClearErrors
  363. FileRead $R6 $R7
  364. IfErrors Done
  365. StrCpy $R5 0
  366. FindMarker1:
  367. IntOp $R5 $R5 - 1
  368. StrCpy $R8 $R7 $R4 $R5
  369. StrCmp $R8 "" Read1
  370. StrCmp $R8 $R2 0 FindMarker1
  371. IntOp $R5 $R5 + $R4
  372. StrCpy $R7 $R7 "" $R5
  373. StrCpy $R5 -1
  374. Goto FindMarker2
  375. Read2:
  376. ClearErrors
  377. FileRead $R6 $R7
  378. IfErrors Done
  379. StrCpy $R5 -1
  380. FindMarker2:
  381. IntOp $R5 $R5 + 1
  382. StrCpy $R8 $R7 $R3 $R5
  383. StrCmp $R8 "" 0 +3
  384. StrCpy $R0 $R0$R7
  385. Goto Read2
  386. StrCmp $R8 $R1 0 FindMarker2
  387. StrCpy $R7 $R7 $R5
  388. StrCpy $R0 $R0$R7
  389. Done:
  390. FileClose $R6
  391. Pop $R8
  392. Pop $R7
  393. Pop $R6
  394. Pop $R5
  395. Pop $R4
  396. Pop $R3
  397. Pop $R2
  398. Pop $R1
  399. Exch $R0
  400. FunctionEnd
  401. ; End code for FindBetween functions and macro
  402. ;----------------------------------------------------------------------------
  403. ; Title : Go to a NSIS page
  404. ; Short Name : RelGotoPage
  405. ; Last Changed : 22/Feb/2005
  406. ; Code Type : Function
  407. ; Code Sub-Type : Special Restricted Call, One-way StrCpy Input
  408. ;----------------------------------------------------------------------------
  409. ; Description : Makes NSIS to go to a specified page relatively from
  410. ; the current page. See this below for more information:
  411. ; "http://nsis.sf.net/wiki/Go to a NSIS page"
  412. ;----------------------------------------------------------------------------
  413. ; Function Call : StrCpy $R9 "(number|X)"
  414. ;
  415. ; - If a number > 0: Goes foward that number of
  416. ; pages. Code of that page will be executed, not
  417. ; returning to this point. If it excess the number of
  418. ; pages that are after that page, it simulates a
  419. ; "Cancel" click.
  420. ;
  421. ; - If a number < 0: Goes back that number of pages.
  422. ; Code of that page will be executed, not returning to
  423. ; this point. If it excess the number of pages that
  424. ; are before that page, it simulates a "Cancel" click.
  425. ;
  426. ; - If X: Simulates a "Cancel" click. Code will go to
  427. ; callback functions, not returning to this point.
  428. ;
  429. ; - If 0: Continues on the same page. Code will still
  430. ; be running after the call.
  431. ;
  432. ; Call RelGotoPage
  433. ;----------------------------------------------------------------------------
  434. ; Author : Diego Pedroso
  435. ; Author Reg. Name : deguix
  436. ;----------------------------------------------------------------------------
  437. Function RelGotoPage
  438. IntCmp $R9 0 0 Move Move
  439. StrCmp $R9 "X" 0 Move
  440. StrCpy $R9 "120"
  441. Move:
  442. SendMessage $HWNDPARENT "0x408" "$R9" ""
  443. FunctionEnd
  444. ## ADDINGPLATFORM ## STEP 5 :: Add DetermineXYZPlatform Subroutine.
  445. ##This is the code that looks/hunts to see if we can predetermine the folder for an expected platform.
  446. ## Besure to set the Folder and the IsInstalled varables for any specific DetermineXYZ sub that you add.
  447. Function DetermineMDaemon
  448. ; Clear flag.
  449. StrCpy $isMDaemonInstalled "0"
  450. ReadRegStr $MDaemonInstallFolder HKLM "SOFTWARE\Alt-N Technologies\MDaemon" "AppPath"
  451. StrCmp $MDaemonInstallFolder "" ReportFalse 0
  452. StrCpy $isMDaemonInstalled "1"
  453. ; But the App Registry var has the \App\ appended. We want that removed. soo...
  454. ${GetParent} $MDaemonInstallFolder $MDaemonInstallFolder ; get the parent of the AppPath and mark it as the master MDaemon dir.
  455. ; No the plugins.dat file might not exist, but we need to confirm that the folders are there.
  456. ifFileExists "$MDaemonInstallFolder\App\*.*" 0 ReportFalse
  457. ifFileExists "$MDaemonInstallFolder\SpamAssassin\rules\*.*" 0 ReportFalse
  458. StrCpy $isMDaemonInstalled "1"
  459. ReportFalse:
  460. Return
  461. FunctionEnd
  462. Function DetermineIceWarp
  463. ; Clear flag.
  464. StrCpy $isIceWarpInstalled "0"
  465. ; Icewarp registry files are stored in:
  466. ReadRegStr $IceWarpInstallFolder HKLM "SOFTWARE\IceWarp\Merak Mail Server" "InstallDir"
  467. StrCpy $IceWarpInstallFolder $IceWarpInstallFolder -1 ; Take the slash off the last end to conform with the rest of the paradigm.
  468. StrCmp $IceWarpInstallFolder "" ReportFalse 0
  469. StrCpy $isIceWarpInstalled "1"
  470. ; Now if they don't have any Content Filters created yet, there won't be a file. And we don't want that to be the case,
  471. ; so if we find the folder, then we'll create the file in anticipation of installing it.
  472. ifFileExists "$IceWarpInstallFolder\config\*.*" 0 skipFilecreation
  473. ifFileExists "$IceWarpInstallFolder\config\content.xml" skipFilecreation 0
  474. Var /GLOBAL tempFileHandle
  475. FileOpen $tempFileHandle "$IceWarpInstallFolder\config\content.xml" w ; so create an empty file. It doesn't bother IceWarp, and it will maintain the integrity
  476. FileClose $tempFileHandle
  477. skipFileCreation: ; of the file check portion of the directory selection popups.
  478. ReportFalse:
  479. Return
  480. FunctionEnd
  481. Function DetermineSNF4Alligate
  482. ; If there's no Alligate, there can't be SNF4Alligate
  483. StrCmp $isAlligateInstalled "0" ReportFalse 0
  484. ; Currently we have a small SMTP rerouting application called SNF4Alligate
  485. ; we can know this if we check the FilterEXE value
  486. Var /GLOBAL FilterEXE
  487. ReadRegStr $FilterEXE HKLM "SOFTWARE\SolidOak\Alligate\Settings" "FilterEXE"
  488. Var /GLOBAL SNF4AWordCount
  489. StrCmp $FilterEXE "" ReportFalse 0
  490. ${WordFind} $FilterEXE "SNF4Alligate" "E*" $SNF4AWordCount ; This will return in #R0 the number of times the delimiter was found in the testString.
  491. iferrors ReportFalse 0 ; if errors is true $R0 will be 1... indicating not-found...
  492. ${IF} $SNF4AWordCount > "0" ; But witn no errors, 1 means it found 1 instandce.
  493. ; then we display the option.
  494. ; It found the exe file in the path... good to go.
  495. StrCpy $isSNF4AlligateInstalled "1"
  496. ${endif}
  497. ; Now set the magic folder at:
  498. ReadRegStr $SNF4AlligateInstallFolder HKLM "SOFTWARE\SolidOak\Alligate\Settings" "InstallDir"
  499. StrCpy $SNF4AlligateInstallFolder $SNF4AlligateInstallFolder -1 ; Take the slash off the last end to conform with the rest of the paradigm.
  500. Return
  501. ReportFalse:
  502. StrCpy $isSNF4AlligateInstalled "0"
  503. StrCpy $SNF4AlligateInstallFolder ""
  504. FunctionEnd
  505. Function DetermineMINIMI
  506. ; If there's no imail, there can't be MINIMI
  507. StrCmp $isIMailInstalled "0" ReportFalse 0
  508. ; Currently we have a small SMTP rerouting application called MINIMI.
  509. ; we can know this if we check the send mail
  510. Var /GLOBAL SendNameValue
  511. ReadRegStr $SendNameValue HKLM "SOFTWARE\Ipswitch\IMail\Global" "SendName"
  512. Var /GLOBAL WordCount
  513. StrCmp $SendNameValue "" ReportFalse 0
  514. ${WordFind} $SendNameValue "SNFIMailShim.exe" "E*" $WordCount ; This will return in #R0 the number of times the delimiter was found in teh testString.
  515. iferrors ReportFalse 0 ; if errors is true $R0 will be 1... indicating not-found...
  516. ${IF} $WordCount > "0" ; But witn no errors, 1 means it found 1 instandce.
  517. ; then we display the option.
  518. ; It found the exe file in the path... good to go.
  519. StrCpy $isMINIMIInstalled "1"
  520. ${endif}
  521. ReportFalse:
  522. ; Now set the magic folder at:
  523. ReadRegStr $MINIMIInstallFolder HKLM "SOFTWARE\Ipswitch\IMail\Global" "TopDir"
  524. Return
  525. FunctionEnd
  526. ## ADDINGPLATFORM ## STEP 6 Add SetInstallForXYZPlatform suboutine.
  527. ## THIS IS ONLY NECESSARY FOR SHIM STYLE INSTALLS SUCH AS MINIMI OR SNF4ALLIGATE
  528. ## Test for the existance, reword the popup, and put the proper variables for the boolean flags.
  529. Function SetInstallForSNF4Alligate
  530. ; Ok , new happening here. Up to this point, the only thing that was different with the installs was where it was being put.
  531. ; The Install script was the same.... but here we have a branch effect. Because the setup for the install, isnt' just picking the placement folder.
  532. ; it now includes the installation of the SNF5Alligate application. So.... we need to set the flag for installing SNF4Alligate
  533. ; Presumabely IF SNF4Alligate has already been installed, we don't need to call it....
  534. Var /GLOBAL WAS_SNF4AlligateInstalledAlready
  535. ReadRegStr $WAS_SNF4AlligateInstalledAlready HKLM "Software\MessageSniffer" "isSNF4AlligateInstalled"
  536. iferrors Install_SNF4Alligate ; no key, just go and set the install flag, for after we leave the components page.
  537. StrCmp $WAS_SNF4AlligateInstalledAlready "1" 0 Install_SNF4Alligate ; if it is, then drop in and handle the tests.....
  538. MessageBox MB_OKCANCEL "A previous installation of SNF4Alligate was detected. Select OK to reinstall or CANCEL to work with the existing version?" IDOK Install_SNF4Alligate IDCANCEL SkipInstall
  539. Install_SNF4Alligate:
  540. StrCpy $Set_For_SNF4Alligate_INSTALL "1" # This is set because SetInstallForMINIMI gets called if you check the box, but we only want to call
  541. # the install on the page leave function.
  542. Return
  543. SkipInstall:
  544. StrCpy $Set_For_SNF4Alligate_INSTALL "0"
  545. Return
  546. FunctionEnd
  547. ## ADDINGPLATFORM ## STEP 7 Add installXYZPLATFORM Shim routine.
  548. ## THIS IS ONLY NECESSARY FOR SHIM STYLE INSTALLS SUCH AS MINIMI or SNF4ALIGATE.
  549. Function installSNF4Alligate
  550. ; This function puts SNF4Alligate in the proper location. It depends on an install of Alligate being present.
  551. ; if Alligate is not present this function exits.
  552. StrCmp $isAlligateInstalled "0" ReportFalse 0 ; ok, if Alligate is up, then we'll try to unpack SNF4Alligate
  553. ; It also registers with MessageSniffer the location of the SNF4Alligate Install.
  554. ; First we must find the FilterEXE key in the Alligate registry folder.
  555. ## So test to be sure the path is combined properly with Alligate
  556. Var /GLOBAL LocalKeyhandle
  557. Var /GLOBAL defaultHoldValue ; dummy var
  558. Var /GLOBAL defaultDeliveryValue ; dummy var
  559. nsExec::Exec 'NET STOP "Alligate SMTP Service"' '' SH_HIDE
  560. ;MessageBox MB_OK "Installing SNF4Alligate"
  561. ; Ok, SNF4Allgiate goes in Alligate's InstallDir, where it stores AgFiltSvc.exe
  562. ; Get InstallDir registry key....
  563. ReadRegStr $LocalKeyhandle HKLM "SOFTWARE\SolidOak\Alligate\Settings" "InstallDir"
  564. StrCmp $LocalKeyhandle "" ReportFalse 0 ; ensure no empty string.
  565. ; Local key handle now holds the top directory where AGFiltSvc.exe should reside.
  566. ; lop last char '\' off end
  567. StrCpy $LocalKeyhandle $LocalKeyhandle -1 ; because Alligate postpends a \ on the backside of their paths...
  568. IfFileExists "$LocalKeyhandle\AGFiltSvc.exe" +2 0
  569. MessageBox MB_OK "Can't find AGFiltSvc.exe in ImAlligate's root directory: $LocalKeyhandle. SNF4Alligate's xml config file will need manual file correction and you will need to install and start Alligates AGFiltSvc manually."
  570. ; Ok, file exists.... then we'll put MINIMI right here...
  571. StrCpy $SNF4AlligateInstallFolder $LocalKeyhandle
  572. SetOutPath $SNF4AlligateInstallFolder
  573. IfFileExists "$SNF4AlligateInstallFolder\SNF4Alligate.exe" 0 +2 ; if we're doing a re-install we need to be able to put it all back....
  574. Rename "$SNF4AlligateInstallFolder\SNF4Alligate.exe" "$SNF4AlligateInstallFolder\OLD_SNF4Alligate.exe" ; leave this to be consumed by the Archiver.
  575. File "SNF4Alligate.exe" ; We can install a new SNF4Alligate.exe file in case updates...
  576. ;Now create the hold location for SNF4Alligate:
  577. IfFileExists "$LocalKeyhandle\Hold\*.*" +2 0 ; check to see if exists, if so,skip line, otherwise make dir.
  578. CreateDirectory "$LocalKeyhandle\Hold" ; Recreates target folder. Sniffer and SNF safe...
  579. IfFileExists "$SNF4AlligateInstallFolder\SNF4Alligate.xml" UseExistingXML 0 ; if doesnt' exist then drop in.... and dump the file.
  580. ; If this was already installed, then editing it will create issues
  581. ; because you can't just take the target from Alligate cause SNF5Alligate has set itself to be the target.
  582. ; but if it doesn't exist then we just drop in here and write out the file.
  583. File "SNF4Alligate.xml"
  584. ; SNF4Alligate.xml files are unpacked.
  585. UseExistingXML:
  586. ; Set the processing folder.
  587. WriteRegStr HKLM "SOFTWARE\SolidOak\Alligate\Settings" "DropDir" "$SNF4AlligateInstallFolder\Drop"
  588. ; Set the user help keys for integration with the Alligate Controlpanel.
  589. WriteRegStr HKLM SOFTWARE\SolidOak\Alligate\Settings\Addins\MsgSniffer\ "ProcessDirHint" "Sniffer" ; this holds the verbage for the Alligate Inteface clue.
  590. WriteRegStr HKLM SOFTWARE\SolidOak\Alligate\Settings\Addins\MsgSniffer\ "ProcessDir" "$SNF4AlligateInstallFolder\Drop" ; This flags the directory.
  591. WriteRegStr HKLM SOFTWARE\SolidOak\Alligate\Settings\Addins\MsgSniffer\ "ProcessDirLabel" "If you are using the Routing table feature to expressly define processing directories then you will need to manually set the folders you want Sniffer to scan, to process messages in the \Drop\ folder." ; This is "Sniffer"
  592. ; Now we determine what Alligate was pointing at:
  593. ReadRegStr $LocalKeyhandle HKLM "SOFTWARE\SolidOak\Alligate\Settings" "FilterEXE"
  594. ; if this returns with an error and an empty string, the tag didn't exist. LocalKeyhandle will be "";
  595. ; WordCount is a dummy var defined in an earlier sub.... just a handler...
  596. ${WordFind} $LocalKeyhandle "SNF4Alligate.exe" "E*" $WordCount ; This will return in WordCount the number of times the delimiter was found in teh testString.
  597. iferrors NoSNFIPRESENT_OK SKIP_INCHAIN_DELIVERY_ALTERAION ; if errors is true this indicates not-found...
  598. ; If we have sniffy present then we need to skip all this file setup because the chain is intact.
  599. NoSNFIPRESENT_OK:
  600. StrCmp $LocalKeyhandle "" 0 SkipCreatingFilterExe ; $R0 equalling empty indicates that there was no target... otherwise notify user.... ( This test is redundant...
  601. WriteRegStr HKLM "SOFTWARE\SolidOak\Alligate\Settings" "FilterEXE" "SNF4Alligate.exe"
  602. WriteRegDWORD HKLM "SOFTWARE\SolidOak\Alligate\Settings" "FilterThreads" "20"
  603. SkipCreatingFilterExe:
  604. StrCmp $LocalKeyhandle "" +2 0 ; $R0 equalling empty indicates that there was no target... otherwise notify user.... ( This test is redundant...
  605. NoSMTP32: MessageBox MB_OK "Alligate is currently delivering its messages to: $LocalKeyHandle $\r$\n SNF4Alligate will insert itself ahead of that call, and send valid messages to its custom handler upon completion."
  606. ; Normal delivery line for SNF4Alligate looks like this: " <delivery program='d:\Alligate\XYZPDQ.exe'/>" or 'none'
  607. ${GetBetween} "<delivery program='" "'/>$\r$\n" "$SNF4AlligateInstallFolder\SNF4Alligate.xml" "$defaultDeliveryValue" ; This makes it not brittly dependant on the default value. i.e. It would
  608. ; If empty replace delivery with "none" otherwise replace with path/file.exe
  609. StrCmp $LocalKeyhandle "" 0 ReplaceWithValue
  610. !insertmacro ReplaceInFile "$SNF4AlligateInstallFolder\SNF4Alligate.xml" "<delivery program='$defaultDeliveryValue'/>$\r$\n" "<delivery program='none'/>$\r$\n"
  611. Goto NextTest
  612. ReplaceWithValue:
  613. !insertmacro ReplaceInFile "$SNF4AlligateInstallFolder\SNF4Alligate.xml" "<delivery program='$defaultDeliveryValue'/>$\r$\n" "<delivery program='$LocalKeyhandle'/>$\r$\n"
  614. NextTest:
  615. ClearErrors
  616. ## IS this an error? What if the LocalKeyHandle was Path\SNFClient.exe the following wouldn't make sense.
  617. ${GetBetween} "<hold path='" "'/>" "$SNF4AlligateInstallFolder\SNF4Alligate.xml" "$defaultHoldValue" ; This makes it not brittly dependant on the default value. i.e. It would
  618. StrCmp $defaultHoldValue "$LocalKeyhandle\Hold\" NextTest2 0 ; If there the same, don't replace, otherwise replace.
  619. !insertmacro ReplaceInFile "$SNF4AlligateInstallFolder\SNF4Alligate.xml" "<hold path='$defaultHoldValue'/>" "<hold path='$LocalKeyhandle\Hold\'/>"
  620. NextTest2: ClearErrors
  621. ; Hold is defined.
  622. SKIP_INCHAIN_DELIVERY_ALTERAION:
  623. ExecWait "$SNF4AlligateInstallFolder\AGFiltSvc.exe /install"
  624. iferrors WeMustUndo 0
  625. Done:
  626. SetOutPath $INSTDIR ; return this path to what it normally is.
  627. WriteRegStr HKLM "Software\MessageSniffer" "isSNF4AlligateInstalled" "1"
  628. WriteRegStr HKLM "Software\MessageSniffer" "SNF4AlligateInstallFolder" "$SNF4AlligateInstallFolder"
  629. ; good to go.
  630. StrCpy $isSNF4AlligateInstalled "1"
  631. nsExec::Exec 'NET START AgSMTPSvc' '' SH_HIDE
  632. nsExec::Exec 'NET START AGFiltSvc' '' SH_HIDE
  633. return
  634. ReportFalse: MessageBox MB_OK "Unable to find valid Alligate InstallDir from the registry. SNF4Alligate Install was aborted."
  635. nsExec::Exec 'NET START AgSMTPSvc' '' SH_HIDE
  636. Return
  637. WeMustUndo:
  638. MessageBox MB_OKCANCEL "Failed Attempt. Clean Up?$\r$\nDetails: SNF4Alligate install script was unable to write to the Alligate FilterEXE registry key. ( To instert SNF4Alligate into the message control stream. ) Click OK if you want the installer to remove and restore the intallation attempt? ( Cancel if you want to leave the two SNF4Aligate files. i.e. You might want to try to tie in SNF4Alligate through Alligate's Administration screens? )" IDOK cleanupFiles IDCANCEL leaveFiles
  639. nsExec::Exec 'NET START AgSMTPSvc' '' SH_HIDE
  640. cleanupFiles:
  641. ; since we couldn't edit the registry, we don't need to worry abou tit. Now Kill attempt:
  642. ifFileExists "$SNF4AlligateInstallFolder\SNF4AlligateNEW.xml" 0 +2
  643. Delete "$SNF4AlligateInstallFolder\SNF4AlligateNEW.xml"
  644. ifFileExists "$SNF4AlligateInstallFolder\OLD_SNF4Alligate.xml" 0 +2
  645. Delete "$SNF4AlligateInstallFolder\OLD_SNF4Alligate.xml"
  646. ifFileExists "$SNF4AlligateInstallFolder\OLD_SNF4Alligate.exe" 0 +2
  647. Delete "$SNF4AlligateInstallFolder\OLD_SNF4Alligate.exe"
  648. ifFileExists "$SNF4AlligateInstallFolder\SNF4Aligate.xml" 0 +2
  649. Delete "$SNF4AlligateInstallFolder\SNF4Alligate.xml"
  650. ifFileExists "$SNF4AlligateInstallFolder\SNF4Alligate.exe" 0 +2
  651. Delete "$SNF4AlligateInstallFolder\SNF4Alligate.exe"
  652. leaveFiles:
  653. return
  654. FunctionEnd
  655. Function SetInstallForMINIMI
  656. ; Ok , new happening here. Up to this point, the only thing that was different with the installs was where it was being put.
  657. ; The Install script was the same.... but here we have a branch effect. Because the setup for the install, isnt' just picking the placement folder.
  658. ; it now includes the installation of the MINIMI application. So.... we need to set the flag for installing MINIMI.
  659. ; Presumabely IF MINIMI has already been installed, we don't need to call it....
  660. Var /GLOBAL WAS_MINIMIInstalledAlready
  661. ReadRegStr $WAS_MINIMIInstalledAlready HKLM "Software\MessageSniffer" "isMINIMIInstalled"
  662. iferrors Install_MINIMI ; no key, just go and set the install flag, for after we leave the components page.
  663. StrCmp $WAS_MINIMIInstalledAlready "1" 0 Install_MINIMI ; if it is, then drop in and handle the tests.....
  664. MessageBox MB_OKCANCEL "A previous installation of MINIMI was detected. Select OK to reinstall or CANCEL to work with the existing version?" IDOK Install_MINIMI IDCANCEL SkipInstall
  665. Install_MINIMI:
  666. StrCpy $Set_For_MINIMI_INSTALL "1" # This is set because SetInstallForMINIMI gets called if you check the box, but we only want to call
  667. # the install on the page leave function.
  668. Return
  669. SkipInstall:
  670. StrCpy $Set_For_MINIMI_INSTALL "0"
  671. Return
  672. FunctionEnd
  673. Function installMINIMI
  674. ; This function puts MINIMI in the proper location. It depends on an install of IMail being present.
  675. ; if IMail is not present this function exits.
  676. StrCmp $isIMailInstalled "0" ReportFalse 0 ; ok, if Imail is up, then we'll try to unpack MINIMI.
  677. ; It also registers with MessageSniffer the location of the MINIMI Install.
  678. ; First we must find the SENDNAME key in the Imail folder.
  679. ## So test to be sure the path is combined properly with Imail
  680. ##Var /GLOBAL LocalKeyhandle - declared in installSNF4Alligate
  681. ##Var /GLOBAL defaultHoldValue ; dummy var - declared in installSNF4Alligate
  682. ##Var /GLOBAL defaultDeliveryValue ; dummy var - declared in installSNF4Alligate
  683. ;MessageBox MB_OK "Installing MINIM"
  684. ; Ok, MINIMI goes in IMAILS Top Directory, where it usually stores SMTP32.exe
  685. ; Get TopDir registry key....
  686. ReadRegStr $LocalKeyhandle HKLM "SOFTWARE\Ipswitch\IMail\Global" "TopDir"
  687. StrCmp $LocalKeyhandle "" ReportFalse 0 ; ensure no empty string.
  688. ; Local key handle now holds the top directory where SMTP32.exe should reside.
  689. IfFileExists "$LocalKeyhandle\SMTP32.exe" +2 0
  690. MessageBox MB_OK "Can't find SMTP32.exe in Imail's root directory: $LocalKeyhandle. MINIMI's xml config file will need manual file correction."
  691. ; Ok, file exists.... then we'll put MINIMI right here...
  692. StrCpy $MINIMIInstallFolder $LocalKeyhandle
  693. SetOutPath $MINIMIInstallFolder
  694. IfFileExists "$MINIMIInstallFolder\SNFIMailShim.exe" 0 +2 ; if we're doing a re-install we need to be able to put it all back....
  695. Rename "$MINIMIInstallFolder\SNFIMailShim.exe" "$MINIMIInstallFolder\OLD_SNFIMailShim.exe" ; leave this to be consumed by the Archiver.
  696. File "SNFIMailShim.exe" ; We can install a new SNFIMailShim.exe file in case updates...
  697. File "MIMIMIreadme.txt" ; output instruction file.
  698. IfFileExists "$MINIMIInstallFolder\SNFIMailShim.xml" UseExistingXML 0 ; if doesnt' exist then drop in.... and dump the file.
  699. ; If this was already installed, then editing it will create issues
  700. ; because you can't just take the target from IMail cause IMAIL has set MINIMI to be the target.
  701. ; but if it doesn't exist then we just drop in here and write out the file.
  702. File "SNFIMailShim.xml"
  703. ; MINIMI files are unpacked.
  704. UseExistingXML:
  705. ; if the MINIMI files were already installed, then we'll presume the registry settings and the folders are set up,
  706. ; and all the tests were run... so we're just going to plugin the things we currently know into a new file.... incase there are
  707. ; XML changes in the MINIMI xml file that don't require installer adjustment, but get repackaged. i.e. new settings etc.
  708. ; So handle the target setting.
  709. ;MessageBox MB_OKCancel "Would you like to keep your current MINIMI configuration, select cancel to reset to the defaults." IDOK SkipIt IDCANCEL DoIt
  710. ; DoIt:
  711. ; SetoutPath "$MINIMIInstallFolder"
  712. ; File /oname=SNFIMailShimNEW.xml "SNFIMailShim.xml" ; Ok, well even though we overwriting, we need to get the data out.... so put a temp file in.
  713. ; Var /GLOBAL existingSetting
  714. ; Normal delivery line for MINIM looks like this: " <delivery program='d:\IMail\smtp32.exe'/>"
  715. ; Get existing value
  716. ; ${GetBetween} "<delivery program='" "'/>$\r$\n" "$MINIMIInstallFolder\SNFIMailShim.xml" "$existingSetting" ; This makes it not brittly dependant on the default value. i.e. It would
  717. ; Get default value in new file
  718. ; ${GetBetween} "<delivery program='" "'/>$\r$\n" "$MINIMIInstallFolder\SNFIMailShimNEW.xml" "$defaultDeliveryValue" ; This makes it not brittly dependant on the default value. i.e. It would
  719. ; if different then replace new with old.
  720. ; StrCmp $existingSetting $defaultDeliveryValue SkipDeliveryReplacment 0 ; If they're the same, don't replace, otherwise replace.
  721. ; !insertmacro ReplaceInFile "$MINIMIInstallFolder\SNFIMailShimNEW.xml" "<delivery program='$defaultDeliveryValue'/>$\r$\n" "<delivery program='$existingSetting'/>$\r$\n"
  722. ; SkipDeliveryReplacment: ClearErrors
  723. ; Now do for the hold path.... all other settings are gone baby gone....
  724. ; ${GetBetween} "<hold path='" "\spam\'/>$\r$\n" "$MINIMIInstallFolder\SNFIMailShim.xml" "$existingSetting" ; This makes it not brittly dependant on the default value. i.e. It would
  725. ; ${GetBetween} "<hold path='" "\spam\'/>$\r$\n" "$MINIMIInstallFolder\SNFIMailShimNEW.xml" "$defaultHoldValue" ; This makes it not brittly dependant on the default value. i.e. It would
  726. ; StrCmp $existingSetting $$defaultHoldValue SkipHoldFolderReplacement 0 ; If there the same, don't replace, otherwise replace.
  727. ; !insertmacro ReplaceInFile "$MINIMIInstallFolder\SNFIMailShimNEW.xml" "<hold path='$defaultHoldValue\spam\'/>$\r$\n" "<hold path='$existingSetting\spam\'/>$\r$\n"
  728. ; SkipHoldFolderReplacement: ClearErrors
  729. ; Now delete existing config file.
  730. ; Rename "$MINIMIInstallFolder\SNFIMailShim.xml" "$MINIMIInstallFolder\OLD_SNFIMailShim.xml"
  731. ; NOTE: This should be archived.... in a perfect world..... leaving it for the Archiver to grab when it wants to.
  732. ; Rename "$MINIMIInstallFolder\SNFIMailShimNEW.xml" "$MINIMIInstallFolder\SNFIMailShim.xml"
  733. ; SkipIt:
  734. ; Now we determine what IMail was pointing at:
  735. ReadRegStr $LocalKeyhandle HKLM "SOFTWARE\Ipswitch\IMail\Global" "SendName"
  736. ; WordCount is a dummy var defined in an earlier sub.... just a handler...
  737. ${WordFind} $LocalKeyhandle "SNFIMailShim.exe" "E*" $WordCount ; This will return in #R0 the number of times the delimiter was found in teh testString.
  738. iferrors NoSNFIPRESENT_OK SKIP_INCHAIN_DELIVERY_ALTERAION ; if errors is true $R0 will be 1... indicating not-found...
  739. ; If we have sniffy present then we need to skip all this file setup because the chain is intact.
  740. NoSNFIPRESENT_OK:
  741. ${WordFind} $LocalKeyhandle "SMTP32.exe" "E*" $WordCount ; This will return in #R0 the number of times the delimiter was found in teh testString.
  742. iferrors NoSMTP32 0 ; if errors is true $R0 will be 1... indicating not-found...
  743. StrCmp $WordCount "0" 0 +2 ; $R0 equalling zero indicates that SMTP32.exe was not the target... notify user.... ( This test is redundant...)
  744. ; then we record the SendMail32.exe path.
  745. NoSMTP32: MessageBox MB_OK "IMail is currently delivering its messages to: $LocalKeyHandle $\r$\n MINIMI will insert itself ahead of that call, and send valid messages to its custom handler upon completion."
  746. ; Normal delivery line for MINIM looks like this: " <delivery program='d:\IMail\smtp32.exe'/>"
  747. ${GetBetween} "<delivery program='" "'/>$\r$\n" "$MINIMIInstallFolder\SNFIMailShim.xml" "$defaultDeliveryValue" ; This makes it not brittly dependant on the default value. i.e. It would
  748. StrCmp $defaultDeliveryValue $LocalKeyhandle NextTest 0 ; If they're the same, don't replace, otherwise replace.
  749. !insertmacro ReplaceInFile "$MINIMIInstallFolder\SNFIMailShim.xml" "<delivery program='$defaultDeliveryValue'/>$\r$\n" "<delivery program='$LocalKeyhandle'/>$\r$\n"
  750. NextTest: ClearErrors
  751. ;Now get the spool location for IMAIL:
  752. ReadRegStr $LocalKeyhandle HKLM "SOFTWARE\Ipswitch\IMail\Global" "SpoolDir" ; Grab the path to the spool folder.
  753. ; We presume to put the storage/hold folder for MINIMI inside the spool directory...
  754. IfFileExists "$LocalKeyhandle\spam\*.*" +2 0 ; check to see if exists, if so,skip line, otherwise make dir.
  755. CreateDirectory "$LocalKeyhandle\spam" ; Recreates target folder. Sniffer and SNF safe...
  756. ; Ok, Spool is good, now set file for hold directory...
  757. ; Normal hold definition for MINIMI looks like this: <hold path='d:\IMail\spool\spam\'/>
  758. ${GetBetween} "<hold path='" "\spam\'/>$\r$\n" "$MINIMIInstallFolder\SNFIMailShim.xml" "$defaultHoldValue" ; This makes it not brittly dependant on the default value. i.e. It would
  759. StrCmp $defaultHoldValue $LocalKeyhandle NextTest2 0 ; If there the same, don't replace, otherwise replace.
  760. !insertmacro ReplaceInFile "$MINIMIInstallFolder\SNFIMailShim.xml" "<hold path='$defaultHoldValue\spam\'/>$\r$\n" "<hold path='$LocalKeyhandle\spam\'/>$\r$\n"
  761. NextTest2: ClearErrors
  762. ; Hold is defined.
  763. SKIP_INCHAIN_DELIVERY_ALTERAION: ; but still upgrade MINIMI to the proper location in the SENDNAME registry key....
  764. WriteRegStr HKLM "SOFTWARE\Ipswitch\IMail\Global" "SendName" "$MINIMIInstallFolder\SNFIMailShim.exe"
  765. iferrors WeMustUndo 0
  766. Done:
  767. SetOutPath $INSTDIR ; return this path to what it normally is.
  768. WriteRegStr HKLM "Software\MessageSniffer" "isMINIMIInstalled" "1"
  769. WriteRegStr HKLM "Software\MessageSniffer" "MINIMIInstallFolder" "$MINIMIInstallFolder"
  770. ; good to go.
  771. StrCpy $isMINIMIInstalled "1"
  772. return
  773. ReportFalse: MessageBox MB_OK "Unable to find valid IMail TopDirector from the registry. MINIMI Install was aborted."
  774. Return
  775. WeMustUndo:
  776. MessageBox MB_OKCANCEL "Failed Attempt. Clean Up?$\r$\nDetails: MINIMI Install script was unable to write to the IMail SendName registry key. ( To instert MINIMI into the message control stream. ) Click OK if you want the installer to remove and restore the intallation attempt? ( Cancel if you want to leave the three MINIMI files. i.e. You might want to try to tie in MINIMI through Imails Administration screens? )" IDOK cleanupFiles IDCANCEL leaveFiles
  777. cleanupFiles:
  778. ; since we couldn't edit the registry, we don't need to worry abou tit. Now Kill attempt:
  779. ifFileExists "$MINIMIInstallFolder\SNFIMailShimNEW.xml" 0 +2
  780. Delete "$MINIMIInstallFolder\SNFIMailShimNEW.xml"
  781. ifFileExists "$MINIMIInstallFolder\OLD_SNFIMailShim.xml" 0 +2
  782. Delete "$MINIMIInstallFolder\OLD_SNFIMailShim.xml"
  783. ifFileExists "$MINIMIInstallFolder\OLD_SNFIMailShim.exe" 0 +2
  784. Delete "$MINIMIInstallFolder\OLD_SNFIMailShim.exe"
  785. ifFileExists "$MINIMIInstallFolder\SNFIMailShim.xml" 0 +2
  786. Delete "$MINIMIInstallFolder\SNFIMailShim.xml"
  787. ifFileExists "$MINIMIInstallFolder\SNFIMailShim.exe" 0 +2
  788. Delete "$MINIMIInstallFolder\SNFIMailShim.exe"
  789. ifFileExists "$MINIMIInstallFolder\MIMIMIreadme.txt" 0 +2
  790. Delete "$MINIMIInstallFolder\MIMIMIreadme.txt"
  791. leaveFiles:
  792. return
  793. FunctionEnd
  794. Function DetermineMXGuard
  795. ; NOTE: Currently the only test for MXGuard being installed is a looking at IMAILS SendName parameter.
  796. ; Versions of 4.1 of MXGUard will have a registry key put in for our use.
  797. ; The alternative is to ask for it, ???? or to guess in C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers
  798. ; dont' forget there can be the mxhook.exe
  799. StrCpy $isMXGuardInstalled "0"
  800. ;; If Imail is activated with MXGuard then its HKEY_LOCAL_MACHINE\SOFTWARE\Ipswitch\IMail\Global\SendName
  801. ;; registry entry will look like: C:\\anypath\\imailtomxguard.exe This is valid test for MXGuard 3.2 - present.
  802. Var /GLOBAL MXPathVar
  803. Var /GLOBAl testVar
  804. StrCmp $isIMailInstalled "1" 0 TestSmarterMail
  805. ## So test to be sure the path is combined properly with Imail
  806. ReadRegStr $MXPathVar HKLM "SOFTWARE\Ipswitch\IMail\Global" "SendName"
  807. StrCmp $MXPathVar "" ReportFalse 0
  808. ${WordFind} $MXPathVar "imailtomxguard.exe" "E*" $R0 ; This will return in #R0 the number of times the delimiter was found in teh testString.
  809. iferrors ReportFalse 0 ; if errors is true $R0 will be 1... indicating not-found...
  810. ${IF} $R0 > "0" ; But witn no errors, 1 means it found 1 instandce.
  811. ; then we display the option.
  812. ; It found the exe file in the path... good to go.
  813. StrCpy $isMXGuardInstalled "1"
  814. ${GetParent} $MXPathVar $MXGuardInstallFolder
  815. ${endif}
  816. Return
  817. TestSmarterMail:
  818. StrCmp $isSmarterMailInstalled "1" 0 ReportFalse
  819. ifFileExists "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers\mxGuard.xml" 0 Try4Pt2
  820. ; well we lucked out. Looks like its here.
  821. ${GetBetween} "<type>" "</type>" "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers\mxGuard.xml" "$testVar"
  822. StrCmp $testVar "SmarterMail" 0 ReportFalse
  823. StrCpy $isMXGuardInstalled "1"
  824. StrCpy $MXGuardInstallFolder "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers"
  825. Try4Pt2:
  826. ifFileExists "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers v4.2\mxGuard.xml" 0 ReportFalse
  827. ; well we lucked out. Looks like its here.
  828. ${GetBetween} "<type>" "</type>" "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers v4.2\mxGuard.xml" "$testVar"
  829. StrCmp $testVar "SmarterMail" 0 ReportFalse
  830. StrCpy $isMXGuardInstalled "1"
  831. StrCpy $MXGuardInstallFolder "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers v4.2"
  832. ReportFalse:
  833. Return
  834. FunctionEnd
  835. Function SetInstallForMXGuard
  836. ; Currently, it doesn't matter where sniffer is for MXGuard, so
  837. ; we're going to put it at C:\MessageSniffer\MXGuard
  838. ;CreateDirectory "C:\MessageSniffer\"
  839. ;CreateDirectory "C:\MessageSniffer\MXGuardRoot" ; This will be where the SNFArchive goes for the MXGuard Install....
  840. ;StrCpy $MXGuardInstallFolder "C:\MessageSniffer\MXGuard"
  841. ;StrCpy $SNFServerInstallDir $MXGuardInstallFolder
  842. ;StrCpy $INSTDIR "$SNFServerInstallDir\SNF"
  843. FunctionEnd
  844. Function DetermineDeclude
  845. ; Declude is detected by the following methods:
  846. ; First you locate its defined registry call in the following key:
  847. ; HKLM SOFTWARE ComputerizedHorizons
  848. ; Relevant Keys from Declude: DecludeInstalled , MailConfigFilePath, RootMailPath, SmarterMailPath
  849. StrCpy $isDecludeInstalled "0" ; Default to no until proven otherwise.
  850. StrCpy $DecludeInstallFolder = "";
  851. ; Now detect Declude:
  852. ; This is useless, it comes in as "01" or something.... incomparable with -1-
  853. ; ReadRegStr $isDecludeInstalled HKLM "SOFTWARE\ComputerizedHorizons" "DecludeInstalled"
  854. ReadRegStr $DecludeInstallFolder HKLM "SOFTWARE\ComputerizedHorizons" "RootMailPath"
  855. StrCmp $DecludeInstallFolder "" ReportBad 0
  856. IfFileExists "$DecludeInstallFolderdeclude" 0 ReportBad ; the RootMailPath has an ending slash.
  857. StrCpy $isDecludeInstalled "1" ; Default to no until proven otherwise
  858. Return
  859. ReportBad:
  860. StrCpy $isDecludeInstalled "0" ; Default to no until proven otherwise
  861. Return
  862. ; The following items are of interest: DecludeInstalled 0 or 01
  863. ; MailConfigFilePath ( for smatermail will be SmarterMailServiceFolder/mailConfig.xml
  864. ; RootMailPath ( for smartermail will be C:\Smartermail\ ) Add "declude\" for declude folder
  865. ; SmarterMailPath ( For smartermail will be the service folder.)
  866. FunctionEnd ; end finding Declude
  867. Function SetInstallForDeclude
  868. ; NOTE: Declude puts a slash at the end of its root path key... so we need to remove the slash from the string
  869. StrCpy $1 $DecludeInstallFolder "" -1 ; get the last char.
  870. StrCmp $1 "\" 0 JustCopy ; if its a slash, then lop it off....
  871. StrCpy $DecludeInstallFolder $DecludeInstallFolder -1 ; Lop off last char.
  872. JustCopy:
  873. StrCpy $SNFServerInstallDir "$DecludeInstallFolder\declude" ; So we're going to install the SNF here....
  874. StrCpy $INSTDIR "$SNFServerInstallDir\SNF"
  875. FunctionEnd
  876. Function DetermineAlligate
  877. StrCpy $isAlligateInstalled "0" ; Default to no until proven otherwise.
  878. StrCpy $AlligateInstallFolder = "";
  879. ; Now detect Alligate:
  880. ReadRegStr $AlligateInstallFolder HKLM "SOFTWARE\SolidOak\Alligate\Settings" "InstallDir"
  881. StrCpy $AlligateInstallFolder $AlligateInstallFolder -1 ; lop last '\' off end of alligates paths.....
  882. ; If Alligate exists, get its folder:
  883. StrCmp $AlligateInstallFolder "" ReportBad 0
  884. StrCpy $isAlligateInstalled "1" ; Default to no until proven otherwise
  885. Return
  886. ReportBad:
  887. StrCpy $isAlligateInstalled "0" ; Default to no until proven otherwise
  888. Return
  889. Return
  890. FunctionEnd
  891. Function DetermineSmarterMail
  892. ; Smarter mail is detected by the following methods:
  893. ; First you locate its defined registry call in the following key:
  894. ; HKLM SOFTWARE SmarterTools SmarterMail InstallPath
  895. ; When found, you then look in that directory for the the Service Folder and open the mailConfig.xml file.
  896. ; And then you find the SpoolPath i.e.
  897. ; <spoolPath>c:\SmarterMail\Spool\</spoolPath>
  898. StrCpy $isSmarterMailInstalled "0" ; Default to no until proven otherwise.
  899. StrCpy $SmarterMailInstallFolder = "";
  900. ; Now detect SmarterMail:
  901. ReadRegStr $SmarterMailInstallFolder HKLM "SOFTWARE\SmarterTools\SmarterMail" "InstallPath"
  902. ; If Declude exists, get its folder:
  903. StrCmp $SmarterMailInstallFolder "" ReportBad 0
  904. StrCpy $isSmarterMailInstalled "1" ; Default to no until proven otherwise
  905. Return
  906. ReportBad:
  907. StrCpy $isSmarterMailInstalled "0" ; Default to no until proven otherwise
  908. Return
  909. ; This tells you where the Spool folder for SmarterMail folder is. Go up one directory and that is the root SmarterMail dir.
  910. ; This is where Declude will be installed if it is installed.
  911. ;
  912. return
  913. FunctionEnd
  914. Function DetermineImail
  915. StrCpy $isIMailInstalled "0" ; Default to no until proven otherwise.
  916. StrCpy $IMailInstallFolder = "";
  917. ; Now detect IMail:
  918. ReadRegStr $IMailInstallFolder HKLM "SOFTWARE\Ipswitch\Imail\Global" "TopDir"
  919. StrCmp $IMailInstallFolder "" ReportBad 0
  920. IfFileExists $IMailInstallFolder 0 ReportBad ; Check to see if path is valid.
  921. ; If Declude exists, get its folder:
  922. StrCpy $isIMailInstalled "1" ; Default to no until proven otherwise
  923. Return
  924. ReportBad:
  925. StrCpy $isIMailInstalled "0" ; Default to no until proven otherwise
  926. Return
  927. FunctionEnd
  928. Function DetermineInstallationPlatforms
  929. Call InitPlatformFlags
  930. ; This function determines and sets the flags on the installation platform options.
  931. ; We have several options available to us:
  932. ## ADDINGPLATFORM ## STEP 8 ADD LINE HERE TO CALL THE DetermineXYZPlatform option. This ensures that when the time comes to
  933. ## Check all the known/supported platforms, that the check gets run.
  934. ; First determine mail platforms.
  935. Call DetermineIMail
  936. Call DetermineSmarterMail
  937. Call DetermineAlligate
  938. ; Now determine implementation platforms.
  939. Call DetermineDeclude
  940. Call DetermineMXGuard
  941. Call DetermineMINIMI
  942. Call DetermineMDaemon
  943. FunctionEnd
  944. Function UninstallXYNTService
  945. ; This stops and uninstalls the XYNTService
  946. nsExec::Exec "NET STOP SNFService" "" SH_HIDE
  947. ifFileExists "$SNFServerInstallDir\SNF\XYNTService.exe" 0 +2
  948. nsExec::Exec "$SNFServerInstallDir\SNF\XYNTService -u" "" SH_HIDE ; This should run reguardless of where the master installer is located.
  949. ifFileExists "$SNFServerInstallDir\Sniffer\XYNTService.exe" 0 +2
  950. nsExec::Exec "$SNFServerInstallDir\Sniffer\XYNTService -u" "" SH_HIDE ; This should run reguardless of where the master installer is located.
  951. return
  952. FunctionEnd
  953. Function checkTelemetry
  954. ${GetBetween} "licenseid='" "'" "$INSTDIR\identity.xml" $LicenseID ; This makes it not brittly dependant on the default value. i.e. It would
  955. ${GetBetween} "authentication='" "'" "$INSTDIR\identity.xml" $Authentication
  956. ; first test for valid rulebase Status
  957. nsExec::Exec /TIMEOUT=700 '"$INSTDIR\snf2check.exe" "$INSTDIR\$LicenseID.snf" "$Authentication"' SH_HIDE
  958. pop $0
  959. ${If} $0 = "0"
  960. Detailprint " The Rulebase passes the snf2check.exe authentication."
  961. ${Else}
  962. Detailprint " Snf2check fails: "
  963. ${Switch} $0
  964. ${Case} "0"
  965. DetailPrint " SNFClient successfuly connected with SNFServer."
  966. Goto EndSNF2CheckTest
  967. ${Case} "65"
  968. DetailPrint " {65} ERROR_CMDLINE. SNF was called improperly."
  969. Goto EndSNF2CheckTest
  970. ${Case} "66"
  971. DetailPrint " {66}ERROR_LOGFILE Cannot open logfile."
  972. Goto EndSNF2CheckTest
  973. ${Case} "67"
  974. DetailPrint " {67} ERROR RULE FILE. Cannot open rules file."
  975. Goto EndSNF2CheckTest
  976. ${Case} "68"
  977. DetailPrint " {68} ERROR_RULE_DATA Cannot create pattern matrix."
  978. Goto EndSNF2CheckTest
  979. ${Case} "69"
  980. DetailPrint " {69} ERROR_MSG_FILE Cannot open message file."
  981. Goto EndSNF2CheckTest
  982. ${Case} "70"
  983. DetailPrint " {70} ERROR_ALLOCATION Allocation error during processing."
  984. Goto EndSNF2CheckTest
  985. ${Case} "71"
  986. DetailPrint " {71} ERROR_BAD_MATRIX Pattern trace went out of range."
  987. Goto EndSNF2CheckTest
  988. ${Case} "72"
  989. DetailPrint " {72} ERROR_MAX_EVALS The maximum number of evaluation paths was exceeded."
  990. Goto EndSNF2CheckTest
  991. ${Case} "73"
  992. DetailPrint " {73} ERROR_RULE_AUTH The rulebase file did not authenticate properly."
  993. Goto EndSNF2CheckTest
  994. ${Case} "99"
  995. DetailPrint " {99} ERROR_UNKNOWN"
  996. Goto EndSNF2CheckTest
  997. ${EndSwitch}
  998. EndSNF2CheckTest:
  999. ${EndIF}
  1000. ifFileExists "$SNFServerInstallDir\App\MDaemon.exe" 0 +3
  1001. Detailprint "MDaemon Install system check complete."
  1002. return
  1003. DetailPrint "Checking SNFService:"
  1004. nsExec::Exec /TIMEOUT=700 "NET START SNFService" SH_HIDE
  1005. pop $0
  1006. ${Switch} $0
  1007. ${Case} "0"
  1008. DetailPrint " SNFService was started."
  1009. Goto EndSNFServiceTest
  1010. ${Case} "1"
  1011. DetailPrint " SNFService was not supported."
  1012. Goto EndSNFServiceTest
  1013. ${Case} "2"
  1014. DetailPrint " SNFService is running."
  1015. Goto EndSNFServiceTest
  1016. ${Case} "8"
  1017. DetailPrint " Unknown failure starting SNFService."
  1018. Goto EndSNFServiceTest
  1019. ${Case} "10"
  1020. DetailPrint " Installer has verified that SNFService is running."
  1021. Goto EndSNFServiceTest
  1022. ${EndSwitch}
  1023. EndSNFServiceTest:
  1024. ; These are the NET START return codes.
  1025. ; gs_service_status( 0) = "Success"
  1026. ; gs_service_status( 1) = "Not Supported"
  1027. ; gs_service_status( 2) = "Access Denied"
  1028. ; gs_service_status( 3) = "Dependent Services Running"
  1029. ; gs_service_status( 4) = "Invalid Service Control"
  1030. ; gs_service_status( 5) = "Service Cannot Accept Control"
  1031. ; gs_service_status( 6) = "Service Not Active"
  1032. ; gs_service_status( 7) = "Service Request Timeout"
  1033. ; gs_service_status( 8) = "Unknown Failure"
  1034. ; gs_service_status( 9) = "Path Not Found"
  1035. ; gs_service_status(10) = "Service Already Running"
  1036. ; gs_service_status(11) = "Service Database Locked"
  1037. ; gs_service_status(12) = "Service Dependency Deleted"
  1038. ; gs_service_status(13) = "Service Dependency Failure"
  1039. ; gs_service_status(14) = "Service Disabled"
  1040. ; gs_service_status(15) = "Service Logon Failure"
  1041. ; gs_service_status(16) = "Service Marked For Deletion"
  1042. ; gs_service_status(17) = "Service No Thread"
  1043. ; gs_service_status(18) = "Status Circular Dependency"
  1044. ; gs_service_status(19) = "Status Duplicate Name"
  1045. ; gs_service_status(20) = "Status Invalid Name"
  1046. ; gs_service_status(21) = "Status Invalid Parameter"
  1047. ; gs_service_status(22) = "Status Invalid Service Account"
  1048. ; gs_service_status(23) = "Status Service Exists"
  1049. ; gs_service_status(24) = "Service Already Paused"
  1050. Sleep 3000
  1051. DetailPrint "Waiting for SNFServer to spin up."
  1052. ; nsExec::ExecToLog /TIMEOUT=700 '$INSTDIR\SNFClient.exe -status.second'
  1053. nsExec::Exec /TIMEOUT=700 '$INSTDIR\SNFClient.exe -status.second' SH_HIDE ; This should run reguardless of where the master installer is located.
  1054. pop $0
  1055. ${Switch} $0
  1056. ${Case} "0"
  1057. DetailPrint " SNFClient successfuly connected with SNFServer."
  1058. Goto EndSNFClientTest
  1059. ${Case} "65"
  1060. DetailPrint " {65} ERROR_CMDLINE. SNF was called improperly."
  1061. Goto EndSNFClientTest
  1062. ${Case} "66"
  1063. DetailPrint " {66}ERROR_LOGFILE Cannot open logfile."
  1064. Goto EndSNFClientTest
  1065. ${Case} "67"
  1066. DetailPrint " {67} ERROR RULE FILE. Cannot open rules file."
  1067. Goto EndSNFClientTest
  1068. ${Case} "68"
  1069. DetailPrint " {68} ERROR_RULE_DATA Cannot create pattern matrix."
  1070. Goto EndSNFClientTest
  1071. ${Case} "69"
  1072. DetailPrint " {69} ERROR_MSG_FILE Cannot open message file."
  1073. Goto EndSNFClientTest
  1074. ${Case} "70"
  1075. DetailPrint " {70} ERROR_ALLOCATION Allocation error during processing."
  1076. Goto EndSNFClientTest
  1077. ${Case} "71"
  1078. DetailPrint " {71} ERROR_BAD_MATRIX Pattern trace went out of range."
  1079. Goto EndSNFClientTest
  1080. ${Case} "72"
  1081. DetailPrint " {72} ERROR_MAX_EVALS The maximum number of evaluation paths was exceeded."
  1082. Goto EndSNFClientTest
  1083. ${Case} "73"
  1084. DetailPrint " {73} ERROR_RULE_AUTH The rulebase file did not authenticate properly."
  1085. Goto EndSNFClientTest
  1086. ${Case} "99"
  1087. DetailPrint " {99} ERROR_UNKNOWN"
  1088. Goto EndSNFClientTest
  1089. ${EndSwitch}
  1090. EndSNFClientTest:
  1091. Detailprint "System test complete."
  1092. Return ; The Installed Restorer will have handled everything.
  1093. FunctionEnd
  1094. Section /o "New Install" g1o1
  1095. ; This uninstalls the XYNTService if it exists.
  1096. Call UninstallXYNTService
  1097. ; Lastly, since we don't want to redo all this activity when we finally DO get to the archiver or the installer..... we need to put a local file
  1098. ; in the root directory where the Archiver.exe or the Restorer.exe is going to be to give it a local reference.
  1099. Call OutputLocalRootInfoFile
  1100. ## ADDINGPLATFORM ## STEP 9 If you're install requires you to bounce a dependant service after doing all the installs,
  1101. ## ensure that that happens here.
  1102. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle1
  1103. ifFileExists "$MDaemonInstallFolder\App\MDaemon.exe" 0 TestNextHandle1
  1104. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1105. Sleep 1000
  1106. ;nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1107. ;Sleep 1000
  1108. TestNextHandle1:
  1109. StrCmp $isSNF4AlligateInstalled "1" 0 Handlenext1
  1110. nsExec::Exec 'net stop AgSMTPSvc' "" SH_HIDE
  1111. Sleep 1000
  1112. Handlenext1:
  1113. StrCmp $isMINIMIInstalled "1" 0 TestNext1
  1114. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1115. Sleep 1000
  1116. Testnext1:
  1117. StrCmp $isDecludeInstalled "1" 0 +2
  1118. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1119. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1120. SetOutPath $INSTDIR ; determines where to put the Restorer/Installer
  1121. File "Restorer.exe" ; Unpack the files.
  1122. ExecWait "$INSTDIR\Restorer.exe -F" ; Execute it.
  1123. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle
  1124. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1125. Sleep 3000
  1126. nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1127. Sleep 1000
  1128. TestNextHandle:
  1129. StrCmp $isSNF4AlligateInstalled "1" 0 Handlenext
  1130. nsExec::Exec 'net stop AgSMTPSvc' "" SH_HIDE
  1131. Sleep 1000
  1132. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /start' ; this will start it up with the reset FilterEXE registry settings.
  1133. Sleep 1000
  1134. nsExec::Exec 'net start AgSMTPSvc' "" SH_HIDE
  1135. Sleep 1000
  1136. Handlenext:
  1137. StrCmp $isMINIMIInstalled "1" 0 TestNext
  1138. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1139. Sleep 1000
  1140. nsExec::Exec 'NET START "IMail SMTP Server"' "" SH_HIDE
  1141. Sleep 1000
  1142. Testnext:
  1143. StrCmp $isDecludeInstalled "1" 0 ThenQuit
  1144. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1145. Sleep 1000
  1146. nsExec::Exec "NET START Decludeproc" "" SH_HIDE
  1147. ThenQuit:
  1148. call checkTelemetry
  1149. return
  1150. SectionEnd
  1151. Section /o "Install Fresh (Discard local configuration.)" g1o2
  1152. ; This uninstalls the XYNTService if it exists.
  1153. Call UninstallXYNTService
  1154. ; The decision tree here is do we want to maintain the configuration file, or blow it away.
  1155. ; this section is for blowing it away. We do record a rollback.
  1156. StrCpy $CustomFolderName "" ; Leaving this as empty string means Just use the default naming convention inside ArchiveSnapshot.
  1157. ; Lastly, since we don't want to redo all this activity when we finally DO get to the archiver or the installer..... we need to put a local file
  1158. ; in the root directory where the the Restorer.exe is going to be to give it a local reference.
  1159. Call OutputLocalRootInfoFile ; This needed to be done before you archive in order to get the LocalRoot.txt file included.
  1160. ; Now create the folder to dump the Restorer.exe into.
  1161. ifFileExists "$INSTDIR\*.*" +2 0
  1162. CreateDirectory "$INSTDIR" ; create folder.
  1163. ## ADDINGPLATFORM ## STEP 9B If you're install requires you to bounce a dependant service after doing all the installs,
  1164. ## ensure that that happens here as well as at #9.
  1165. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle
  1166. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1167. Sleep 1000
  1168. TestNextHandle:
  1169. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 Handlenext
  1170. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /Stop' "" SH_HIDE ; this will stop it and release the SNF4Alligate.exe file.
  1171. Sleep 1000
  1172. nsExec::Exec 'net stop AgSMTPSvc' SH_HIDE
  1173. Sleep 1000
  1174. Handlenext:
  1175. StrCmp $isDecludeInstalled "1" 0 +2
  1176. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1177. ; Exract the files.
  1178. SetOutPath $INSTDIR
  1179. File "Restorer.exe" ; Unpack the files.
  1180. SetOutPath $SNFServerInstallDir
  1181. ExecWait "$INSTDIR\Restorer.exe -F" ; execute it for fresh install.
  1182. ;nsExec::Exec 'NET START "SNFService"' "" SH_HIDE
  1183. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 Handlenext2
  1184. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /start' "" SH_HIDE ; this will start it up with the reset FilterEXE registry settings.
  1185. Sleep 1000
  1186. nsExec::Exec 'net start AgSMTPSvc' "" SH_HIDE
  1187. Sleep 1000
  1188. Handlenext2:
  1189. StrCmp $isMINIMIInstalled "1" 0 TestNext2
  1190. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1191. Sleep 1000
  1192. nsExec::Exec 'NET START "IMail SMTP Server"' "" SH_HIDE
  1193. Sleep 1000
  1194. Testnext2:
  1195. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle2
  1196. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1197. Sleep 3000
  1198. nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1199. Sleep 1000
  1200. TestNextHandle2:
  1201. StrCmp $isDecludeInstalled "1" 0 ThenQuit
  1202. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1203. nsExec::Exec "NET START Decludeproc" "" SH_HIDE
  1204. ThenQuit:
  1205. call checkTelemetry
  1206. return
  1207. SectionEnd
  1208. Section /o "Upgrade (Retain existing settings.)" g1o3
  1209. ; The decision tree here is do we want to maintain the configuration file, or blow it away.
  1210. ; this section is for blowing it away. We do archive
  1211. ;Stop the service if its working.
  1212. Call UninstallXYNTService
  1213. ; Since we don't want to redo all this path determination activity when we finally DO get to the archiver or the installer..... we need to put a local file
  1214. ; in the root directory where the Archiver.exe or the Restorer.exe is going to be to give it a local reference.
  1215. Call OutputLocalRootInfoFile ; This needed to be done before you archive in order to get the LocalRoot.txt file included.
  1216. ############################################################
  1217. ; Now create the folder to dump the Restorer.exe into.
  1218. IfFileExists "$INSTDIR\*.*" +2 0
  1219. CreateDirectory "$INSTDIR" ; create folder if it doesn't exist. ( Meaning that the older sniffer files are left behind. )
  1220. ## ADDINGPLATFORM ## STEP 9C If you're install requires you to bounce a dependant service after doing all the installs,
  1221. ## ensure that that happens here as well as at #9 and #9B.
  1222. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle
  1223. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1224. Sleep 3000
  1225. ;nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1226. ;Sleep 1000
  1227. TestNextHandle:
  1228. StrCmp $isSNF4AlligateInstalled "1" 0 Handlenext
  1229. nsExec::Exec 'net stop AgSMTPSvc' "" SH_HIDE
  1230. Sleep 1000
  1231. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /stop' "" SH_HIDE
  1232. Sleep 1000 ; this will stop it and release the SNF4Alligate.exe file.
  1233. Handlenext:
  1234. ; Exract the files.
  1235. SetOutPath $INSTDIR
  1236. File "Restorer.exe" ; Unpack the files.
  1237. SetOutPath $SNFServerInstallDir
  1238. ExecWait "$INSTDIR\Restorer.exe" ; execute it for fresh install. THIS IS THE DIFFERENCE NO -F in the command line attempts to ressurect the existing files.
  1239. ;nsExec::Exec 'NET START "SNFService"' "" SH_HIDE
  1240. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle2
  1241. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1242. Sleep 1000
  1243. nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1244. Sleep 1000
  1245. TestNextHandle2:
  1246. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 Handlenext3
  1247. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /start' "" SH_HIDE
  1248. Sleep 1000 ; this will start it up with the reset FilterEXE registry settings.
  1249. nsExec::Exec 'net start AgSMTPSvc' "" SH_HIDE
  1250. Sleep 1000
  1251. Handlenext3:
  1252. ; If its a MINIMI install, bounce the IMAIL SMTP
  1253. StrCmp $isMINIMIInstalled "1" 0 TestNext
  1254. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1255. Sleep 1000
  1256. nsExec::Exec 'NET START "IMail SMTP Server"' "" SH_HIDE
  1257. Sleep 1000
  1258. Testnext:
  1259. StrCmp $isDecludeInstalled "1" 0 ThenQuit
  1260. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1261. nsExec::Exec "NET START Decludeproc" "" SH_HIDE
  1262. ThenQuit:
  1263. call checkTelemetry
  1264. return
  1265. SectionEnd
  1266. ; NOTE, if this doesn't exist in the current install, it must be greyed out.... or not displayed.
  1267. Section /o "Archive Utility" g1o4
  1268. ; The Intermediate archive display
  1269. ; page handles this in the event flow. By this point theres nothing to do.
  1270. SectionEnd
  1271. Section /o "Restore Utility" g1o5
  1272. ## This section is stubbed.
  1273. SectionEnd
  1274. ; NOTE, Same for this.... can't fire it, if it doesn't exist.
  1275. Section /o "Remove Install" g1o6
  1276. ; By this point, its been handled, so there's nothign to do. This response is handled
  1277. ; in the callback funciton of hte components selection page.
  1278. SectionEnd
  1279. Section /o "Status Viewer" g1o6B
  1280. ; Nothing happenes here. This is here to enable it to show up in the sections components viewer page.
  1281. SectionEnd
  1282. ;SectionGroupEnd
  1283. ;--------------------------------
  1284. ; Functions for control of components selection
  1285. ; $1 stores the status of group 1
  1286. ; $2 stores the status of group 2
  1287. ; Ok, this list is going to become a little different. We'e not detecting and displaying available options, we'e offeing options
  1288. ; ( albite if we find one, we mark it as the recommended one. ) but that means the onSelect doesn't really set anything until after the
  1289. ; next custom page which will properly locate all the files.... )
  1290. ;SectionGroup /e "Platform Options" GRP_2
  1291. ## ADDINGPLATFORM ## STEP 10 This is very important. You must add an optional section ( indicated by the /o ) for your new platform.
  1292. ## You need to add it in the placement that you want it to appear in the list. BUT!!!! IF you insert it in the middle, you have to patch all
  1293. ## ordinal responses for the swithc-case handling code for items below it. So unless you have a VERY good reason, add it at the end.
  1294. ## The placment order affects which number is returned when the user clicks it.
  1295. ## i.e. When a user clicks the option, it will come back with an ordinal say "20" for the ID of the checkbox that triggered the 'event'.
  1296. ## So at the end of this list, add your new one.
  1297. ## ADDINGPLATFORM ## STEP 10B Give it a unique option name that is meaningful.
  1298. ## For example: gIWDI means [I]mail[W/][D]eclude[I]nstall. Note that some of them have commented ones to the right like g107 meaning group1option7.
  1299. ## This became impossible to keep track after five or six options, so clearer names were swapped in.
  1300. ## ADDINGPLATFORM ## STEP 10C pay attention to where in the list you put your new option.
  1301. ## There are more places you need to insert items, and you should insert them in the same place in all the lists. This will keep things easier later.
  1302. Section /o "Imail w/ Declude Install" gIWDI ; g1o7 Imail w/ Declude Install
  1303. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1304. ; MessageBox MB_OK "Selected Imail Declude option."
  1305. SectionEnd
  1306. Section /o "Imail MXGuard Install" gIMXI ; g1oA Imail w/ MXGuard Install
  1307. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1308. ;MessageBox MB_OK "Selected Imail MXGuard option."
  1309. SectionEnd
  1310. Section /o "Imail w/MINIMI for SNF" gIMMI ; g1o7B Imail MiniMi Install
  1311. ; Nothing happenes here. This is here to enable it to show up in the sections components viewer page.
  1312. SectionEnd
  1313. Section /o "SmarterMail w/ Declude Install" gSWDI ; g1o8 Smartermail W/ Declude Install
  1314. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1315. ;MessageBox MB_OK "Selected SmarterMail Declude option."
  1316. SectionEnd
  1317. Section /o "SmarterMail MXGuard Install" gSMXI ; g1oA2 Smartermail W/ MXGuard Install
  1318. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1319. ;MessageBox MB_OK "Selected Imail MXGuard option."
  1320. SectionEnd
  1321. Section /o "Alligate Install" gAWDI ; g1o9 Alligate w/
  1322. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1323. ;MessageBox MB_OK "Selected Alligate Declude option."
  1324. SectionEnd
  1325. SectionGroup /e "IceWarp" gIW
  1326. Section /o "IceWarp in ~A.V.~ position" gIWTI ; IcewWarp Tie In ( In AntiVirus Position )
  1327. ; this is the tie in to Icewarp via the filter. It may be expand with the IceWarp .dll tie in.
  1328. SectionEnd
  1329. Section /o "IceWarp As Custom-Filter (y/n) " gIWTICF ; IceWarp Tie In Custom Filter
  1330. ; this is the tie in to Icewarp via the filter. It may be expand with the IceWarp .dll tie in.
  1331. SectionEnd
  1332. Section /o "IceWarp As Custom-Filter (+5)" gIWTICF2 ; IceWarp Tie In Custom Filter 2
  1333. ; this is the tie in to Icewarp via the filter. It may be expand with the IceWarp .dll tie in.
  1334. SectionEnd
  1335. SectionGroupEnd
  1336. Section /o "MailSite Install" gMSI
  1337. ; this is the tie in to MailSite.
  1338. SectionEnd
  1339. Section /o "Kerio Mail Install" gKMI
  1340. ; this is the tie in to Kerio.
  1341. SectionEnd
  1342. Section /o "MDaemon Install" gMDDLL
  1343. ; this section is to tie in and install the dll for the MDaemon Mail Site.
  1344. SectionEnd
  1345. Section /o "Default SNF Install / Sniffer Install" gSNFI ; g1oB
  1346. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1347. ;MessageBox MB_OK "Selected DefaultSNF option."
  1348. SectionEnd
  1349. Section /o "Unknown Server - Declude Install" gUSWDI ; g1oC
  1350. ; Can't recognize what host is using Declude, but declude is there....
  1351. ; MessageBox MB_OK "Selected DefaultSNF option."
  1352. SectionEnd
  1353. Section /o "Other (custom/unknown combination)" gCUKC ; MDI_mx
  1354. SectionEnd
  1355. Function InitPlatformFlags
  1356. ; Used to clear the setup flags.
  1357. ## ADDINGPLATFORM ## STEP 11 Add a clear command here so when you want all the init flags to be cleared, they will all clear together.
  1358. StrCpy $isIceWarpInstalled "0"
  1359. StrCpy $isMailSiteInstalled "0"
  1360. StrCpy $isKerioInstalled "0"
  1361. StrCpy $isImailInstalled "0"
  1362. StrCpy $isSmarterMailInstalled "0"
  1363. StrCpy $isAlligateInstalled "0"
  1364. StrCpy $isDecludeInstalled "0"
  1365. StrCpy $isMXGuardInstalled "0"
  1366. StrCpy $isMINIMIInstalled "0"
  1367. StrCpy $isMDaemonInstalled "0"
  1368. StrCpy $SelectedCaseIndexForPlatformScreen "0" ; undetermined.
  1369. FunctionEND
  1370. Function ResetSectionNames
  1371. ; Used to reset the cleared section flags.
  1372. ## ADDINGPLATFORM ## STEP 12 Add the text that you want to appear for the new platform option. Should be the same as the text you entered
  1373. ## to define the section in step 10a. The scripting program makes an option unavailable by clearing this text field. You need to have
  1374. ## the line in this list, so that if you need to refresh the screen, or go back, etc, the script can get the original values and reset them.
  1375. SectionSetText ${g1o1} "New Install"
  1376. SectionSetText ${g1o2} "Install Fresh (Discard local configuration.)"
  1377. SectionSetText ${g1o3} "Upgrade (Retain existing settings.)"
  1378. SectionSetText ${g1o4} "Archive Utility"
  1379. SectionSetText ${g1o5} "Rollback Altered Files"
  1380. SectionSetText ${g1o6} "Remove Install"
  1381. SectionSetText ${g1o6B} "Status Viewer"
  1382. SectionSetText ${gIWDI} "Imail w/ Declude Install" ; g1o7
  1383. SectionSetText ${gIMXI} "Imail MXGuard Install" ; g1oA
  1384. SectionSetText ${gIMMI} "Imail w/MINIMI for SNF" ; g1o7B
  1385. SectionSetText ${gSWDI} "SmarterMail w/ Declude Install" ; g1o8
  1386. SectionSetText ${gSMXI} "SmarterMail MXGuard Install" ; g1oA2
  1387. SectionSetText ${gAWDI} "Alligate Install" ; g1o9
  1388. SectionSetText ${gIW} "IceWarp" ; g1o7
  1389. SectionSetText ${gIWTI} "IceWarp in ~A.V.~ position" ; g1o9
  1390. SectionSetText ${gIWTICF} "IceWarp as Content-Filter (y/n)"
  1391. SectionSetText ${gIWTICF2} "IceWarp as Content-Filter (+5)"
  1392. ;SectionSetText ${gMSI} "MailSite Install" ; g1o9
  1393. SectionSetText ${gMSI} "" ; g1o9
  1394. SectionSetText ${gKMI} "Kerio Install" ; g1o9
  1395. SectionSetText ${gMDDLL} "MDaemon Install" ; gMDDLL
  1396. SectionSetText ${gSNFI} "" ;SectionSetText ${gSNFI} "Default SNF Install / Sniffer Install" ; g1oB
  1397. SectionSetText ${gUSWDI} "" ;SectionSetText ${gUSWDI} "Unknown Server - Declude Install" ; g1oC
  1398. SectionSetText ${gCUKC} "Other (custom/unknown combination)" ; MDI_mx
  1399. FunctionEND
  1400. Function .onInit
  1401. ## Test for useable Service wrapper that this installer can hijack and control ( i.e. It was installed with this Installer,
  1402. ## even if its on a differing platform.
  1403. nsExec::Exec /TIMEOUT=1500 "NET STOP SNFService"
  1404. pop $0
  1405. StrCmp $0 "0" 0 NotStoppable ; needs to return zero to be known and available.....if not, inconclusive...
  1406. ## Service was stoppable. Not start it.
  1407. nsExec::Exec /TIMEOUT=1500 "NET START SNFService" SH_HIDE
  1408. pop $0
  1409. Goto FineToRunInstaller ; To be clean this needs to return zero also....
  1410. NotStoppable:
  1411. ## Wasn't running (Inconclusive) so we must test for SNFServer.exe and if so... tell them to manually stop the service/server first.
  1412. SetOutPath $Temp
  1413. ifFileExists "$Temp\SNFCLient.exe" +2 0
  1414. File "SNFClient.exe"
  1415. nsExec::Exec /TIMEOUT=1500 "$Temp\SNFClient.exe -status.second" SH_HIDE
  1416. pop $0
  1417. StrCmp $0 "0" 0 +3
  1418. MessageBox MB_OK "SNFServer was detected running on this system. You must stop the SNFServer in order to run this installer."
  1419. Quit
  1420. Delete "$Temp/SNFClient.exe"
  1421. SetOutPath $INSTDIR
  1422. FineToRunInstaller:
  1423. ; Ensure the utility manager only has one instance running at a time.
  1424. System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Sniffer Untility Mng") i .r1 ?e'
  1425. Pop $R0
  1426. StrCmp $R0 0 +3
  1427. MessageBox MB_OK|MB_ICONEXCLAMATION "The Message Sniffer Utility Manager is already running."
  1428. Abort
  1429. InitPluginsDir ; this is needed in order to use the plugins dir for the splash pictures.......
  1430. SetOutPath "$PLUGINSDIR" ; set the folder for unpacking the pictures...
  1431. ; Modal banner sample: show
  1432. File "SnifferSplash.bmp"
  1433. newadvsplash::show 3000 100 500 0x04025C "$PLUGINSDIR\SnifferSplash.bmp"
  1434. Sleep 1000 ; optional
  1435. Delete "$PLUGINSDIR\SnifferSplash.bmp"
  1436. ; Ok, enough gratuitous logo flashing... get to work....
  1437. ; Reset these vars for the FindApplication screen that may or maynot be used.
  1438. StrCpy $MissingApplicationName "" ; if we use the find page, this is the name of what we're looking for. It'll show up on the title and label.
  1439. StrCpy $FindApplicationMessage "" ; if you want to customize the message you do that here. Set to blank for default.
  1440. StrCpy $MissingApplicationFolder "" ; if you have a starting point, stick it here... otherwise leave it blank.
  1441. StrCpy $Find_Explanation_INFO "" ; if you want a verbose instruction put it here.
  1442. ; Preset other navigation flow flags.
  1443. StrCpy $ArchivesAvailable "0" ; Defaulting to no, but will hold if there is an SNFArchives folder....
  1444. StrCpy $ShowRestoreOptionsPage "0" ; Default is true, unless proven otherwise, by no archives folder.
  1445. StrCpy $HandleUninstallPage "0" ; Execute the uninstall page is set to no by default, unless user selects the uninstall path on the 2nd Components page.
  1446. StrCpy $ShowTelemetryPage "0" ; Default is to ignore the status page.
  1447. ; Preset installation flags;
  1448. StrCpy $PreviousSnifferInstalled "0" ; Until proven otherwise, there is no previously installed sniffer engine.
  1449. StrCpy $MessageSnifferRestoreDir "" ; Fresh Install until restore archive is selected.
  1450. StrCpy $OldVersionOfSniffer "0" ; This is used to flag if we're dealing with the first install after an old sniffer folder.
  1451. StrCpy $currentPlatformSelection "55" ; default the option for the PlatformSelection to the Unknown Server install.
  1452. StrCpy $currentUtilitySelection "0" ; default the utility to NEW
  1453. StrCpy $Set_For_MINIMI_INSTALL "0" ; default the utilitn to not installing MINIMI
  1454. StrCpy $Set_For_SNF4Alligate_INSTALL "0" ; default the utilitn to not installing MINIMI
  1455. ; This will set the flags for what is displayable in the 1st components screen.. ( Platforms... ) Based on what they select there,
  1456. ; the exit function will determine and set the "INSTDIR...." and the Archives flags....
  1457. Call DetermineInstallationPlatforms ; This will determine what installations are available for display.
  1458. ; Obviously not all recognized email platforms will be displayed if they're not installed....
  1459. ; At this point, the above call nas determined
  1460. FunctionEnd
  1461. ############################################
  1462. ## This function attempts to make the best guess of the available known platforms, and checks the one on the screen that makes the most sense.
  1463. ############################################
  1464. Function setBestPlatformGuess
  1465. FunctionEnd
  1466. #########################
  1467. ## setupPlatforms is called prior to the display of the first custom page.
  1468. ## This will check and setup the flags for the available items, and set the selected ones.
  1469. ## This was important to have in its own function and not in the init because of BACK... it was remembering the selection, and
  1470. ## not obeying the single selection option handler. So we had to reinit the page each time before its viewed.
  1471. Function setupPlatforms
  1472. ; This gets run if we want to show Install Platforms, not utilities. We change the title and the image but we use the same components screen.
  1473. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Platform Selection:"
  1474. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  1475. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Server 3.0 Install Utility:"
  1476. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  1477. Call ResetSectionNames ; This puts ALL the names back...
  1478. StrCpy $BaseRadioDefault $currentPlatformSelection ; This sets the platform default and seeds the onSelectChange macro selection.
  1479. ; onInit sets first one to 11 - SNFStandalone
  1480. ;
  1481. ; Make sure nothing that is being hidden is selected... this creates null-ignored clicks and wierd user interaction.
  1482. ; because of the modality of the radio buttons... ( even though not all options are being displayed, they're all there 1 - 12 of them
  1483. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked.
  1484. !insertmacro UnselectSection ${g1o2}
  1485. !insertmacro UnselectSection ${g1o3}
  1486. !insertmacro UnselectSection ${g1o4}
  1487. !insertmacro UnselectSection ${g1o5}
  1488. !insertmacro UnselectSection ${g1o6}
  1489. ; This was added after the order of the rest... and so I'm wondering if its essential to keep it in order for the sake of the
  1490. ; platform references.
  1491. !insertmacro UnselectSection ${g1o6B} ; because this will be index 13..... so it must come after g1oC which is 12....
  1492. ;Of course, don't display install options on platform screen
  1493. SectionSetText ${g1o1} ""
  1494. SectionSetText ${g1o2} ""
  1495. SectionSetText ${g1o3} ""
  1496. SectionSetText ${g1o4} ""
  1497. SectionSetText ${g1o5} ""
  1498. SectionSetText ${g1o6} ""
  1499. SectionSetText ${g1o6B} ""
  1500. StrCmp $SelectedCaseIndexForPlatformScreen "0" 0 LeaveEnabled
  1501. ;if We haven't been to this screen before, the case flag will be zero. And we leave teh Next button disabled.... otherwise we leave it enabled:
  1502. ; Disable the next button until selection is made.
  1503. Var /GLOBAL NextButton
  1504. GetDlgItem $NextButton $HWNDPARENT 1
  1505. EnableWindow $NextButton "0"
  1506. LeaveEnabled:
  1507. #################################################################################
  1508. ; NOTE: THE UNKNOWN DECLUDE OPTION WAS HIDDEN AND DEPRECATED.....
  1509. Var /GLOBAL testUnknownDeclude ; Use this to flag if we intend to use the unknownDeclude option
  1510. StrCpy $testUnknownDeclude "1" ; The only time we don't-test is if we can identify WHICH declude
  1511. ; So for the first time through....in addition to disabling the next button, we can just breeze through clearly the checkboxes.
  1512. ; First off: Show the platform options.
  1513. #################################################################################
  1514. ## ADDINGPLATFORM ## STEP 15 This is the platforms setup screen. We need to have the new platform be available for selection, so we do that
  1515. ## by adding it to the UnselectedSection list with the macros. If you use SectionSetText #NAME "" you are clearing the name, and it won't
  1516. ## show up in the displayed list. To have it show up as unselected, add the UnselectedSectionLine. ( You could add it selected too.. but
  1517. ## that gets annoying for a variety of reasons, so we default to everything off. Remember to keep it in the right list order. )
  1518. ; We'll always show these options...
  1519. ; the new paradigm is to show, and then attempt to check the intended one, and then alter the paths after the fact.....
  1520. !insertmacro UnselectSection ${gIWDI} ; g1o7
  1521. !insertmacro UnselectSection ${gIMXI} ; g1oA
  1522. !insertmacro UnselectSection ${gIMMI} ; g1o7B
  1523. !insertmacro UnselectSection ${gSWDI} ; g1o8
  1524. !insertmacro UnselectSection ${gSMXI} ; g1oA2
  1525. !insertmacro UnselectSection ${gAWDI} ; g1o9
  1526. SectionSetText ${gSNFI} "" ; not using this feature yt.
  1527. #!insertmacro UnselectSection ${gSNFI} ; g1oB
  1528. SectionSetText ${gUSWDI} "" ; !insertmacro UnselectSection ${gUSWDI} ; g1oC
  1529. !insertmacro UnselectSection ${gIWTI} ; Icewarp AS AV
  1530. !insertmacro UnselectSection ${gIWTICF} ; "IceWarp as Content-Filter (y/n)"
  1531. !insertmacro UnselectSection ${gIWTICF2} ; as Spam Score Contributer
  1532. #!insertmacro UnselectSection ${gMSI} ; MailSite
  1533. SectionSetText ${gMSI} ""
  1534. #!insertmacro UnselectSection ${gKMI} ; Kerio Mail Server
  1535. SectionSetText ${gKMI} ""
  1536. !insertmacro UnselectSection ${gMDDLL} ; MDaemon Dll option.
  1537. !insertmacro UnselectSection ${gCUKC} ; custom unknown combination
  1538. ; NOTE: ALl clears need to go ahead of the switch, cause we exit immediately after we've found a selection that was set.
  1539. ; - this would indicate a back event... (if $SelectedCaseIndexForPlatformScreen was set).......
  1540. ## ADDINGPLATFORM ## STEP 16 Add your newe platform in this switch statement in order to properly key on a preexisting selection,
  1541. ## if the user moves back a screen in the installer. Remember to stay in order as a form of habit. Keep the same form. Change the case text
  1542. ## key as well as the keyname in brackets ${ THIS }
  1543. ; But if we HAVE one selected, we need to case through them, and only clear the ones that aren't selected:
  1544. ${Switch} $SelectedCaseIndexForPlatformScreen
  1545. ${Case} "gIWDI"
  1546. !insertmacro SelectSection ${gIWDI} ; g1o7
  1547. Return
  1548. ${Case} "gIMXI"
  1549. !insertmacro SelectSection ${gIMXI} ; g1oA
  1550. Return
  1551. ${Case} "gIMMI"
  1552. !insertmacro SelectSection ${gIMMI} ; g1o7B
  1553. Return
  1554. ${Case} "gSWDI"
  1555. !insertmacro SelectSection ${gSWDI} ; g1o8
  1556. Return
  1557. ${Case} "gSMXI"
  1558. !insertmacro SelectSection ${gSMXI} ; g1oA2
  1559. Return
  1560. ${Case} "gAWDI"
  1561. !insertmacro SelectSection ${gAWDI} ; g1o9
  1562. Return
  1563. ${Case} "gIWTI"
  1564. !insertmacro SelectSection ${gIWTI} ; Icewarp as AV position
  1565. Return
  1566. ${Case} "gIWTICF"
  1567. !insertmacro SelectSection ${gIWTICF} ; Icewarp as content filter
  1568. Return
  1569. ${Case} "gIWTICF2"
  1570. !insertmacro SelectSection ${gIWTICF2} ; Icewarp as spam score contributer
  1571. Return
  1572. ${Case} "gMSI"
  1573. #!insertmacro SelectSection ${gMSI} ; MailSite
  1574. Return
  1575. ${Case} "gKMI"
  1576. !insertmacro SelectSection ${gKMI} ; Kerio Mail
  1577. Return
  1578. ${Case} "gMDDLL"
  1579. !insertmacro SelectSection ${gMDDLL} ; MDaemon Mail
  1580. Return
  1581. ${Case} "gSNFI" ; NOT USEING THIS OPTION
  1582. !insertmacro UnselectSection ${gSNFI} ; g1o9
  1583. #!insertmacro SelectSection ${gSNFI} ; g1oB
  1584. Return
  1585. ${Case} "gUSWDI" ; NOT USEING THIS OPTION
  1586. !insertmacro SelectSection ${gUSWDI} ; g1oC
  1587. Return
  1588. ${Case} "gCUKC"
  1589. !insertmacro SelectSection ${gCUKC} ;
  1590. Return
  1591. ${Default}
  1592. ; If we get here, we have an unusual situation that leaks through. Don't let them through without a selection being defined.
  1593. EnableWindow $NextButton "0"
  1594. ${EndSwitch}
  1595. ; IF we were here, then we skipped through the switch, and didn't take. That means that there wasn't a remembered setting... and we
  1596. ; need to make our best attempt at a guess.
  1597. ; here would be where we need to have made our best guess as to the install that seems to make the most sense:
  1598. call setBestPlatformGuess
  1599. FunctionEnd
  1600. #########################
  1601. ## setupComponents2 is called prior to the display of the components page. It will setup the empty or the unselected lists.
  1602. ## This was important to have in its own function and not in the init because of BACK... it was remembering the selection, and
  1603. ## not obeying the single selection option handler. So we had to reinit the page each time before its viewed.
  1604. Function setupComponents2
  1605. ;Var /GLOBAL NextButton
  1606. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Server 3.0 Install Utility:"
  1607. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  1608. ; Disable the next button until selection is made.
  1609. GetDlgItem $NextButton $HWNDPARENT 1
  1610. EnableWindow $NextButton "0"
  1611. ; We need to set the default radio button for the Utilities component view of the sections options now..
  1612. StrCpy $BaseRadioDefault $currentUtilitySelection ; This sets the platform default onIniti starts it on NEW but we may change that further down.....
  1613. Call ResetSectionNames ; This puts ALL the names back...
  1614. ## ADDINGPLATFORM ## STEP 13 Add your platform here, as an Unselected Section Call. ( To clear it from being selected. )
  1615. ## There is only one section list, but we screen it differently for the activities vs the platforms.
  1616. ## This is the first time, you see the ordinal commented. Remember to keep the order,
  1617. ## increment any ordinals below your new one, and notice the point that you need to bump them all down for later, in the case element.
  1618. ; this makes sure there isn't anything selected thats hiding...
  1619. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked. 0
  1620. !insertmacro UnselectSection ${g1o2} ; none of the chekcboxes should be checked. 1
  1621. !insertmacro UnselectSection ${g1o3} ; none of the chekcboxes should be checked. 2
  1622. !insertmacro UnselectSection ${g1o4} ; none of the chekcboxes should be checked. 3
  1623. !insertmacro UnselectSection ${g1o5} ; none of the chekcboxes should be checked. 4
  1624. !insertmacro UnselectSection ${g1o6} ; none of the chekcboxes should be checked. 5
  1625. !insertmacro UnselectSection ${g1o6B} ; none of the chekcboxes should be checked. - This is status index 13 6
  1626. !insertmacro UnselectSection ${gIW}
  1627. !insertmacro UnselectSection ${gIWDI} ; g1o7 #7 is Imail with Declude
  1628. !insertmacro UnselectSection ${gIMXI} ; g1oA #8 is Imail with MXGuard
  1629. !insertmacro UnselectSection ${gIMMI} ; g1o7B #9 is IMail with MINIMI
  1630. !insertmacro UnselectSection ${gSWDI} ; g1o8 #10 is SmarterMail with Declude
  1631. !insertmacro UnselectSection ${gSMXI} ; g1oA2 #11 is SmarterMail with MXGuard
  1632. !insertmacro UnselectSection ${gAWDI} ; g1o9 #12 is Alligate
  1633. ; 13 is the SectionGroup
  1634. !insertmacro UnselectSection ${gIWTI} ; g1o9 #14 is Icewarp as AV position
  1635. !insertmacro UnselectSection ${gIWTICF} ; g1o9 #15 is Icewarp as content filter
  1636. !insertmacro UnselectSection ${gIWTICF2} ; g1o9 #16 is Icewarp as Spam Score contributer
  1637. !insertmacro UnselectSection ${gMSI} ; g1o9 #18 is MailSite
  1638. !insertmacro UnselectSection ${gKMI} ; g1o9 #19 is Kerio
  1639. !insertmacro UnselectSection ${gMDDLL} ; MDaemon Install #20 is SNF stand alone
  1640. !insertmacro UnselectSection ${gSNFI} ; g1oB #21 is SNF stand alone
  1641. !insertmacro UnselectSection ${gUSWDI} ; g1oC #22 is Unknown Server with Declude
  1642. !insertmacro UnselectSection ${gCUKC} ; #23 is Custom Unknown
  1643. ## ADDINGPLATFORM ## STEP 14 Now set it not to display on the activities screen.
  1644. ; First off: Hide the platform options because wer'e only showing components.
  1645. SectionSetText ${gIWDI} "" ; Imail with declude
  1646. SectionSetText ${gIMXI} "" ; Imail MXGuard
  1647. SectionSetText ${gIMMI} "" ; IMail w/ MINIMI
  1648. SectionSetText ${gSWDI} "" ; SmarterMail with Declude
  1649. SectionSetText ${gSMXI} "" ; SmarterMail with MXGuard
  1650. SectionSetText ${gAWDI} "" ; Nonused alligate option
  1651. SectionSetText ${gIW} ""
  1652. SectionSetText ${gIWTI} "" ; is Icewarp in AV position
  1653. SectionSetText ${gIWTICF} "" ; is Icewarp as Content Filter
  1654. SectionSetText ${gIWTICF2} "" ; is Icewarp as spam score contributer
  1655. SectionSetText ${gMSI} "" ; is MailSite
  1656. SectionSetText ${gKMI} "" ; is Kerio
  1657. SectionSetText ${gMDDLL} "" ; is Kerio
  1658. SectionSetText ${gSNFI} "" ; Nonused Sniffer standing alone somewhere..
  1659. SectionSetText ${gUSWDI} "" ; Unknown server w/ Declude
  1660. SectionSetText ${gCUKC} "" ; Custom unknown
  1661. ; Now we have two situations. The first was if there was no preexisting sniffer folder Thats easy.
  1662. StrCmp $PreviousSnifferInstalled "0" RunFreshInstaller RunChoices
  1663. RunFreshInstaller:
  1664. StrCmp $ArchivesAvailable "0" RunFreshNoRestore RunWithRestore
  1665. RunFreshNoRestore:
  1666. ; Setup the settings options for a fresh install:
  1667. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked.
  1668. SectionSetText ${g1o2} ""
  1669. SectionSetText ${g1o3} ""
  1670. SectionSetText ${g1o4} ""
  1671. SectionSetText ${g1o5} ""
  1672. SectionSetText ${g1o6} ""
  1673. SectionSetText ${g1o6B} "" ; obviously no status either.
  1674. Return
  1675. RunWithRestore: ; Now we're restoring to the previous state before EVERY install..... this is moot.
  1676. ; Setup the settings options for a fresh install:
  1677. !insertmacro UnselectSection ${g1o1}
  1678. SectionSetText ${g1o2} ""
  1679. SectionSetText ${g1o3} ""
  1680. SectionSetText ${g1o4} ""
  1681. SectionSetText ${g1o5} "" ; used to be when you had the option for restore....
  1682. SectionSetText ${g1o6} ""
  1683. SectionSetText ${g1o6B} "" ; obviously still no status either.
  1684. Return
  1685. RunChoices:
  1686. ; So we're going to allow the Utility Manager to offer the choices of what sniffer engine to use.
  1687. ; Setup the settings options for a fresh install:
  1688. ;!insertmacro UnselectSection ${another_section_id}
  1689. SectionSetText ${g1o1} ""
  1690. !insertmacro UnselectSection ${g1o2} ; none of the chekcboxes should be checked.
  1691. !insertmacro UnselectSection ${g1o3}
  1692. SectionSetText ${g1o4} "" ; used to be when you had the option for archive UnselectSection ${g1o4}
  1693. SectionSetText ${g1o5} "" ; used to be when you had the option for restore....
  1694. !insertmacro UnselectSection ${g1o6}
  1695. #ReadRegStr $0 HKLM "Software\MessageSniffer" "Install_Dir" ; "SRS_RollbackPath"
  1696. # ifErrors HideUninstaller AllowUninstaller ; So only on the condition that an installer hasn't run, do we consider blocking.
  1697. # AllowUninstaller:
  1698. # !insertmacro UnselectSection ${g1o6}
  1699. ## Goto NextItem
  1700. # HideUninstaller:
  1701. # SectionSetText ${g1o6} ""
  1702. NextItem:
  1703. !insertmacro UnselectSection ${g1o6B} ; now we can have status
  1704. ; So we DO need to set the default radio button for the Utilities to FRESH not NEW
  1705. StrCpy $BaseRadioDefault "1" ; This sets the platform default to new but we may change that further down.....
  1706. Return
  1707. FunctionEnd
  1708. Function Components2_Leave
  1709. ; Ok, we need to install MINIMI here, if its a valid installation, but if its just utilities then we don't.
  1710. StrCmp $ShowRestoreOptionsPage "1" 0 +4
  1711. ; Might as well handle this here. We dont' need another page.
  1712. MessageBox MB_OK "Attempting to Restore. This code should be stubbed."
  1713. ;ExecWait "Restorer.exe -R"
  1714. Quit
  1715. return ; If 4 was selected, we dont' install
  1716. StrCmp $ShowArchiveOptionsPage "1" 0 +2
  1717. return ; If 4 was selected, we dont' install
  1718. StrCmp $ShowTelemetryPage "1" 0 +2
  1719. return ; If 4 was selected, we dont' install
  1720. StrCmp $HandleUninstallPage "1" 0 +2
  1721. return ; If 4 was selected, we dont' install
  1722. StrCmp $Set_For_MINIMI_INSTALL "1" 0 done
  1723. StrCmp $SelectedCaseIndexForPlatformScreen "gIMMI" 0 done
  1724. call InstallMINIMI
  1725. done:
  1726. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 done2
  1727. StrCmp $SelectedCaseIndexForPlatformScreen "gAWDI" 0 done2
  1728. call InstallSNF4Alligate
  1729. done2:
  1730. return
  1731. FunctionEnd
  1732. Function setupINSTALLDIR
  1733. ## NOTE This call was moved to the back of the file lookup screen. that is to say that this is now the validation screen for the
  1734. ## Find files page...... before you reset and mark all the features.... you need to revalidate the text boxes....
  1735. var /Global temp1 ; holds the strings from the lookup text boxes.
  1736. var /Global temp2
  1737. ## ADDINGPLATFORM ## STEP 17 This is the biggie. Here you need to add a complex case block to handle the popups of the specific platfomr,
  1738. ## to find the necessary folders, and to set the install folders for both the platform, as well as where Sniffer is going to be installed.
  1739. ## Remember to keep the order. The requires customizing the itFileExists test to beable to confirm that the expected dependant file,
  1740. ## is indeed where the installer expects to find it. If it isn't there, it won't progress until the user locates the proper folder.
  1741. ## These cases start their search where the respective platform install folders are set to look by DetermineXYZPLatform...
  1742. ${Switch} $SelectedCaseIndexForPlatformScreen
  1743. ${Case} "gIWDI" ; zero indexed array... Imail with Declude gIWDI
  1744. ;; So this becomes a declude test....
  1745. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1746. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1747. ifFileExists "$temp1\global.cfg" +3 0 ; skip or notify then leave....
  1748. MessageBox MB_OK "Please select the location path where decludes global.cfg file exists."
  1749. Goto NoPassFromHere
  1750. ; and make sure the user didn't edit the string....
  1751. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1752. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1753. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1754. MessageBox MB_OK "You must define a folder as the install directory."
  1755. Goto NoPassFromHere
  1756. ;ok well override those settings if they're good.....
  1757. ; be sure it exists.
  1758. ifFileExists "$temp2\*.*" +2 0
  1759. CreateDirectory $temp2
  1760. ; set them p.
  1761. StrCpy $SNFServerInstallDir $temp1
  1762. StrCpy $INSTDIR $temp2
  1763. Goto ProceedWithInstallDirSetup ;
  1764. ${Case} "gIMXI"
  1765. # Handle MXGuard check...
  1766. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1767. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1768. ifFileExists "$temp1\mxguard.ini" +3 0 ; skip or notify then leave....
  1769. MessageBox MB_OK "Please select the location path where the mxguard.ini file exists."
  1770. Goto NoPassFromHere
  1771. ; and make sure the user didn't edit the string....
  1772. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1773. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1774. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1775. MessageBox MB_OK "You must define a folder as the install directory."
  1776. Goto NoPassFromHere
  1777. ; ok well override those settings if they're good.....
  1778. ; be sure it exists.
  1779. ifFileExists "$temp2\*.*" +2 0
  1780. CreateDirectory $temp2
  1781. ; set them p.
  1782. StrCpy $SNFServerInstallDir $temp1
  1783. StrCpy $INSTDIR $temp2
  1784. Goto ProceedWithInstallDirSetup ;
  1785. ${Case} "gIMMI"
  1786. # Handle MINIMI check...
  1787. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1788. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1789. ifFileExists "$temp1\SMTP32.EXE" +3 0 ; skip or notify then leave....
  1790. MessageBox MB_OK "Please select the location path where IMails SMTP32.exe resides."
  1791. Goto NoPassFromHere
  1792. ; and make sure the user didn't edit the string....
  1793. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1794. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1795. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1796. MessageBox MB_OK "You must define a folder as the install directory."
  1797. Goto NoPassFromHere
  1798. ; ok well override those settings if they're good.....
  1799. ; be sure it exists.
  1800. ifFileExists "$temp2\*.*" +2 0
  1801. CreateDirectory $temp2
  1802. ; set them p.
  1803. StrCpy $SNFServerInstallDir $temp1
  1804. StrCpy $INSTDIR $temp2
  1805. Goto ProceedWithInstallDirSetup ;
  1806. ${Case} "gSWDI" ; zero indexed array... Smartermail with Declude
  1807. ; So this becomes a declude test....
  1808. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1809. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1810. ifFileExists "$temp1\global.cfg" +3 0 ; skip or notify then leave....
  1811. MessageBox MB_OK "Please select the location path where decludes global.cfg file exists."
  1812. Goto NoPassFromHere
  1813. ; and make sure the user didn't edit the string....
  1814. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1815. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1816. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1817. MessageBox MB_OK "You must define a folder as the install directory."
  1818. Goto NoPassFromHere
  1819. ;ok well override those settings if they're good.....
  1820. ; be sure it exists.
  1821. ifFileExists "$temp2\*.*" +2 0
  1822. CreateDirectory $temp2
  1823. ; set them p.
  1824. StrCpy $SNFServerInstallDir $temp1
  1825. StrCpy $INSTDIR $temp2
  1826. Goto ProceedWithInstallDirSetup ;
  1827. ${Case} "gSMXI"
  1828. # Handle MXGuard check...
  1829. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1830. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1831. ifFileExists "$temp1\mxguard.ini" +3 0 ; skip or notify then leave....
  1832. MessageBox MB_OK "Please select the location path where the mxguard.ini file exists."
  1833. Goto NoPassFromHere
  1834. ; and make sure the user didn't edit the string....
  1835. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1836. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1837. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1838. MessageBox MB_OK "You must define a folder as the install directory."
  1839. Goto NoPassFromHere
  1840. ; ok well override those settings if they're good.....
  1841. ; be sure it exists.
  1842. ifFileExists "$temp2\*.*" +2 0
  1843. CreateDirectory $temp2
  1844. ; set them p.
  1845. StrCpy $SNFServerInstallDir $temp1
  1846. StrCpy $INSTDIR $temp2
  1847. Goto ProceedWithInstallDirSetup ;
  1848. ${Case} "gAWDI"
  1849. # Handle SNF4Alligate check...
  1850. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1851. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1852. ifFileExists "$temp1\AGFiltSvc.exe" +3 0 ; skip or notify then leave....
  1853. MessageBox MB_OK "Please select the location path where Alligates AGFiltSvc.exe resides."
  1854. Goto NoPassFromHere
  1855. ifFileExists "$temp1\Drop" +3 0 ; skip or notify then leave....
  1856. MessageBox MB_OK "There is no Drop folder in your Alligate location."
  1857. Goto NoPassFromHere
  1858. ifFileExists "$temp1\Drop" +3 0 ; skip or notify then leave....
  1859. MessageBox MB_OK "There is no Spool folder in your Alligate location."
  1860. Goto NoPassFromHere
  1861. ; and make sure the user didn't edit the string....
  1862. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1863. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1864. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1865. MessageBox MB_OK "You must define a folder as the install directory."
  1866. Goto NoPassFromHere
  1867. ; ok well override those settings if they're good.....
  1868. ; be sure it exists.
  1869. ifFileExists "$temp2\*.*" +2 0
  1870. CreateDirectory $temp2
  1871. ; set them p.
  1872. StrCpy $SNFServerInstallDir $temp1
  1873. StrCpy $INSTDIR $temp2
  1874. Goto ProceedWithInstallDirSetup ;
  1875. ${Case} "gIWTICF" ; let this drop through
  1876. ${Case} "gIWTICF2" ; let this drop through
  1877. ${Case} "gIWTI"
  1878. # Handle Icewarp check...
  1879. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1880. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1881. ifFileExists "$temp1\config\*.*" 0 NoPassFromHere ; shouldn't happen.. determine Icewarp should fail if not properly installed.
  1882. ifFileExists "$temp1\config\content.xml" +3 0 ; skip or notify then leave....
  1883. MessageBox MB_OK "Please select the location path where IceWarp is installed. [IceWarpRoot]\config\content.xml couldn't be found."
  1884. Goto NoPassFromHere
  1885. ; and make sure the user didn't edit the string....
  1886. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1887. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1888. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1889. MessageBox MB_OK "You must define a folder as the install directory."
  1890. Goto NoPassFromHere
  1891. ; ok well override those settings if they're good.....
  1892. ; be sure it exists.
  1893. ifFileExists "$temp2\*.*" +2 0
  1894. CreateDirectory $temp2
  1895. ; set them p.
  1896. StrCpy $SNFServerInstallDir $temp1
  1897. StrCpy $INSTDIR $temp2
  1898. Goto ProceedWithInstallDirSetup ;
  1899. ${Case} "gMSI"
  1900. ## WONT HAPPEN
  1901. ${Case} "gKMI"
  1902. ## WONT HAPPEN
  1903. ${Case} "gMDDLL"
  1904. # Handle MDaemon check...
  1905. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1906. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1907. ifFileExists "$temp1\App\*.*" 0 NoPassFromHere ; shouldn't happen.. determine Icewarp should fail if not properly installed.
  1908. ifFileExists "$temp1\App\MDaemon.exe" +3 0 ; skip or notify then leave....
  1909. MessageBox MB_OK "Please select the location path where MDaemon is installed. [MDaemon]\App\MDaemon.exe couldn't be found."
  1910. Goto NoPassFromHere
  1911. ; and make sure the user didn't edit the string....
  1912. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1913. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1914. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1915. MessageBox MB_OK "You must define a folder as the install directory."
  1916. Goto NoPassFromHere
  1917. ; ok well override those settings if they're good.....
  1918. ; be sure it exists.
  1919. ifFileExists "$temp2\*.*" +2 0
  1920. CreateDirectory $temp2
  1921. ; set them p.
  1922. StrCpy $SNFServerInstallDir $temp1
  1923. StrCpy $INSTDIR $temp2
  1924. Goto ProceedWithInstallDirSetup ;
  1925. ${Case} "gSNFI"
  1926. ## WONT HAPPEN
  1927. ${Case} "gUSWDI"
  1928. ## WONT HAPPEN
  1929. ;StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer in an identified Declude install. You will need to confirm the location of the following items:"
  1930. ;StrCpy $MissingApplicationName "Generic Declude Install"
  1931. ;Goto ProceedWithInstallDirSetup ;
  1932. ${Case} "gCUKC"
  1933. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1934. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1935. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1936. MessageBox MB_OK "You must define a folder as the install directory."
  1937. Goto NoPassFromHere
  1938. ; ok well override those settings if they're good.....
  1939. ; be sure it exists.
  1940. ifFileExists "$temp2\*.*" +2 0
  1941. CreateDirectory $temp2
  1942. ; set them p.
  1943. ${GetParent} $temp2 $SNFServerInstallDir ; get the parent of the selected folder and mark it as the master server dir.
  1944. StrCpy $INSTDIR $temp2
  1945. Goto ProceedWithInstallDirSetup ;
  1946. ${Default}
  1947. ; If we get here, we have an unusual situation that leaks through teh event handler.
  1948. ; Though its not possible, you can unclick a radio button that should always have one selected.
  1949. ; and put yourself in the original state of having nothing picked... if so, disable next.
  1950. EnableWindow $NextButton "0"
  1951. ${EndSwitch}
  1952. NoPassFromHere: ; this cancels the next because it didn't validate.
  1953. abort
  1954. ProceedWithInstallDirSetup:
  1955. ; ok we're good... here we have defined the INSDIR and the $SNFServerInstallDir
  1956. ## NOTE: Even though it would seem that there could be multiple Declude folders because they only use one set of registry keys
  1957. ## There can't be multiple FUNCTIONING decludes. So don't get confused even though SNF is going to remain abtracted....
  1958. StrCpy $OldVersionOfSniffer "0"
  1959. StrCpy $PreviousSnifferInstalled "0"
  1960. StrCpy $ArchivesAvailable "0"
  1961. ; So test to see if the message sniffer folder exists.
  1962. IfFileExists "$INSTDIR\identity.xml" SetPreviouslyInstalledFlag 0 ; Test for no folder at proper location.
  1963. StrCpy $PreviousSnifferInstalled "0" ; we key off the identity.xml file.
  1964. ; Set previous flag to false. ( default. , but kept here for clarity. )
  1965. Goto ContinueInit ; Skip setting the previous flag to true.....
  1966. SetPreviouslyInstalledFlag:
  1967. IfFileExists "$INSTDIR\$LicenseID.exe" 0 +2 ; Test for older install file keying off of nomerization of the executable.....
  1968. StrCpy $OldVersionOfSniffer "1" ; ( Declude comes with its own sniffer folder already made....
  1969. StrCpy $PreviousSnifferInstalled "1" ; Set flag for previously exists.
  1970. ContinueInit:
  1971. ## ARCHIVE NOTE: We are no longer offering archives, so we are hiding this code at the moment. ARCHIVES ARE NEVER AVAILABLE.
  1972. #IfFileExists "$SNFServerInstallDir\SNFArchive\*.*" 0 +2
  1973. StrCpy $ArchivesAvailable "0" ; This sets the state for the modified option set to offer restore possibilities....
  1974. ; Lastly, since we don't want to redo all this activity when we finally DO get to the archiver or the installer..... we need to put a local file
  1975. ; in the root directory where the Archiver.exe or the Restorer.exe is going to be to give it a local reference. We could use a registry key
  1976. ; but that limits us to one controlable archive..... if you turn off one installation and turn another on, this way it should heal itself.
  1977. # This lets the internal installer program utilize all the sorting and sifting we did to determine the actual path of where to put the stuff.
  1978. Call OutputLocalRootInfoFile
  1979. RETURN
  1980. FunctionEnd
  1981. Function OutputLocalRootInfoFile
  1982. ; Lastly, since we don't want to redo all this activity when we finally DO get to the archiver or the installer..... we need to put a local file
  1983. ; in the root directory where the Archiver.exe or the Restorer.exe is going to be to give it a local reference. We could use a registry key
  1984. ; but that limits us to one controlable archive..... if you turn off one installation and turn another on, this way it should heal itself.
  1985. SetOutPath $INSTDIR
  1986. Var /GLOBAL myContextFile
  1987. FileOpen $myContextFile "$INSTDIR\LocalRoot.txt" w
  1988. FileWrite $myContextFile "<root>$SNFServerInstallDir</root><cd>$INSTDIR</cd>"
  1989. FileClose $myContextFile
  1990. ; NOTE: THis code is called in the SECTION area for FRESH install as well as ...setupINSTALLDIR because it needs to happen After the removal of the original folder.
  1991. ; i.e. If you install Fresh the localroot.txt file is destroyed... so it needs to be rebuilt.
  1992. FunctionEnd
  1993. #####################################
  1994. ## .onSelChange is the callback event handler
  1995. ## for the components page.
  1996. Function .onSelChange
  1997. ; Now Enable the Next Button
  1998. GetDlgItem $NextButton $HWNDPARENT 1
  1999. EnableWindow $NextButton "1"
  2000. ; Radio Button State Checking code. Uncomment and run
  2001. ;Var /GLOBAL TestVar
  2002. ;StrCpy $TestVar ""
  2003. ;SectionGetFlags "${g1o1}" $R0
  2004. ;StrCpy $TestVar "g101:$R0$\n"
  2005. ;SectionGetFlags "${g1o2}" $R0
  2006. ;StrCpy $TestVar "$TestVar g102:$R0$\n"
  2007. ;SectionGetFlags "${g1o3}" $R0
  2008. ;StrCpy $TestVar "$TestVar g103:$R0$\n"
  2009. ;SectionGetFlags "${g1o4}" $R0
  2010. ;StrCpy $TestVar "$TestVar g104:$R0$\n"
  2011. ;SectionGetFlags "${g1o5}" $R0
  2012. ;StrCpy $TestVar "$TestVar g105:$R0$\n"
  2013. ;SectionGetFlags "${g1o6}" $R0
  2014. ;StrCpy $TestVar "$TestVar g106:$R0$\n"
  2015. ;SectionGetFlags "${g1o7}" $R0
  2016. ;StrCpy $TestVar "$TestVar g107:$R0$\n"
  2017. ;SectionGetFlags "${g1o8}" $R0
  2018. ;StrCpy $TestVar "$TestVar g108:$R0$\n"
  2019. ;SectionGetFlags "${g1o9}" $R0
  2020. ;StrCpy $TestVar "$TestVar g109:$R0$\n"
  2021. ;SectionGetFlags "${g1oA}" $R0
  2022. ;StrCpy $TestVar "$TestVar g10A:$R0$\n"
  2023. ;SectionGetFlags "${g1oA2}" $R0
  2024. ;StrCpy $TestVar "$TestVar g10A2:$R0$\n"
  2025. ;SectionGetFlags "${g1oB}" $R0
  2026. ;StrCpy $TestVar "$TestVar g10B:$R0$\n"
  2027. ;SectionGetFlags "${g1oC}" $R0
  2028. ;StrCpy $TestVar "$TestVar g10C:$R0$\n"
  2029. ;MessageBox MB_OK $TestVar
  2030. ; init $1
  2031. ;MessageBox MB_OK "Current setting: $1 / $BaseRadioDefault"
  2032. ; Problem: When a group is present, clicking the group creates the abstract effect ( when using the RadioButton macros. ) that
  2033. ; the last item in the group that wasn't highlighted becomes checked. Abberrant behavior. So to counteract that we
  2034. ; screen for the effect of the user clicking on the group header, and clear all boxes prior to the rest of the analysis.
  2035. ; This is going to flag if the group was selected by the user clickin on the header of the IceWarp Group. We will then preempt that
  2036. ; by clearing all the settings....
  2037. Var /Global TheAddition
  2038. Var /Global Report
  2039. StrCpy $Report ""
  2040. SectionGetFlags ${gIWTI} $TheAddition
  2041. StrCpy $Report $Report$TheAddition
  2042. SectionGetFlags ${gIWTICF} $TheAddition
  2043. StrCpy $Report $Report$TheAddition
  2044. SectionGetFlags ${gIWTICF2} $TheAddition
  2045. StrCpy $Report $Report$TheAddition
  2046. StrCmp $Report "111" 0 ContineButtonAnalysis
  2047. !insertmacro UnselectSection ${gIWTI}
  2048. !insertmacro UnselectSection ${gIWTICF}
  2049. !insertmacro UnselectSection ${gIWTICF2}
  2050. ContineButtonAnalysis:
  2051. ; This concludes the manual clearing/correcting of the group state.
  2052. ## ADDINGPLATFORM ## STEP 18 You must add the radiobutton detection code in here to detect the event and handle it.
  2053. ## Add it in the proper place in order. Increment the ordinal comments on everything below your entry.
  2054. StrCpy $1 $BaseRadioDefault
  2055. !insertmacro StartRadioButtons $1 ; Each of these is a macro that inserts handling code for the section named in ${g1o1}
  2056. ; These are the components
  2057. !insertmacro RadioButton ${g1o1} ; new
  2058. !insertmacro RadioButton ${g1o2} ; fresh
  2059. !insertmacro RadioButton ${g1o3} ; update
  2060. !insertmacro RadioButton ${g1o4} ; archive
  2061. !insertmacro RadioButton ${g1o5} ; restore
  2062. !insertmacro RadioButton ${g1o6} ; uninstall
  2063. !insertmacro RadioButton ${g1o6B} ; status...
  2064. ; and we add them in the order we're writing the code, not the display order ( handled in by the order we define the sections order )$\r$\n \
  2065. ; these are teh platforms.
  2066. !insertmacro RadioButton ${gIWDI} ; g1o7 #7 is Imail with Declude
  2067. !insertmacro RadioButton ${gIMXI} ; g1oA #8 is Imail with MXGuard
  2068. !insertmacro RadioButton ${gIMMI} ; g1o7B #9 is IMail with MINIMI
  2069. !insertmacro RadioButton ${gSWDI} ; g1o8 #10 is SmarterMail with Declude
  2070. !insertmacro RadioButton ${gSMXI} ; g1oA2 #11 is SmarterMail with MXGuard
  2071. !insertmacro RadioButton ${gAWDI} ; g1o9 #12 is Alligate
  2072. ; 13 is the Section Group
  2073. ;MessageBox MB_OK "$1"
  2074. !insertmacro RadioButton ${gIWTI} ; g1o9 #14 is Icewarp
  2075. ;MessageBox MB_OK "$1"
  2076. !insertmacro RadioButton ${gIWTICF} ; g1o9 #15 is Icewarp as content filter.
  2077. ;MessageBox MB_OK "$1"
  2078. !insertmacro RadioButton ${gIWTICF2} ; g1o9 #16 is Icewarp as spam contributer.
  2079. ;MessageBox MB_OK "$1"
  2080. !insertmacro RadioButton ${gMSI} ; g1o9 #18 is MailSite
  2081. !insertmacro RadioButton ${gKMI} ; g1o9 #19 is Kerio
  2082. !insertmacro RadioButton ${gMDDLL} ; g1o9 #20 is MDaemon
  2083. !insertmacro RadioButton ${gSNFI} ; g1oB #21 is SNF stand alone
  2084. !insertmacro RadioButton ${gUSWDI} ; g1oC #22 is Unknown Server with Declude
  2085. !insertmacro RadioButton ${gCUKC} ; #23 is Custom Unknown
  2086. ; On inspecting the flag state for all options under a group, the result for when you select the group is
  2087. ; 35 1 1 1 1 but when you select just a single option it is 98 0 0 0 1 for example....
  2088. ;Var /Global TheState
  2089. ;Var /Global TheAddition
  2090. ;SectionGetFlags ${MDI} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2091. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2092. ;SectionGetFlags ${MDI_mx} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2093. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2094. ;SectionGetFlags ${MDI_dc} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2095. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2096. ;SectionGetFlags ${MDI_mm} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2097. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2098. ;SectionGetFlags ${MDI_sa} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2099. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2100. ;MessageBox MB_OK "$TheState"
  2101. ;!insertmacro RadioButton ${MDI} ;"Manually Detect Installation" This is the group header.
  2102. ; StrCmp $1 "15" 0 NextRadioButton ; it needs to be in the list for presentation
  2103. ; OK we're removing it from the list of Radiobutton macros cause we dont' ever want to have the group header be 'SET'
  2104. ; but we need to trap and undo the selection of all its members.... so we check to see if its flag is set to 35 or 98.
  2105. ; 98 indicates that something underneith it was selected, not the group header itself. See SectionSetFlags for the bit values
  2106. ; of the flags themselves..... but uncommentint the above code will popup the flag states at this point in the marco list....
  2107. ; This was for handling a group... but we're not doing that... so we don't care...
  2108. ; This setting checks, and if its 35 ( clicked it directly ) it will unset all its subcomponents, because they're mutually exclusive...
  2109. ;SectionGetFlags ${MDI} $TempRadioButtonFlagsVar ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2110. ;StrCmp $TempRadioButtonFlagsVar "35" 0 NextRadioButton
  2111. ; MessageBox MB_OK "Please click on the platform you'd like to manually locate:"
  2112. ; IntOp $TempRadioButtonFlagsVar $TempRadioButtonFlagsVar & ${SECTION_OFF} ; so even thoug we have it here, we have to UNdo the errant click on this option.
  2113. ; SectionSetFlags ${MDI} $TempRadioButtonFlagsVar
  2114. ;NextRadioButton:
  2115. ;MessageBox MB_OK "The value for 1 after the group header is : $1"
  2116. ; EndTrappingButtons
  2117. !insertmacro EndRadioButtons
  2118. ; The Above code leaves var $1 holding the index of the radio button that was clicked.
  2119. ;DEBUG MessageBox MB_OK "Now setting: $1 / $BaseRadioDefault"
  2120. ## ADDINGPLATFORM ## STEP 19 You must add the command to clear all checkboxes. We need to do this in order to manually control what gets displayed.
  2121. ## the above code, saved the ordinal of what came back from the click event. But when you have sub-elements, it requires manual handling of
  2122. ## which option to activate in order to have the proper item or subitem show the check. SO ENTER IN YOUR CLEAR LINE with your proper section name.
  2123. ## Increment the ordinal in the comments for everything below your entry....
  2124. ; Even though we've got the above macro... because we're using this list for two screens
  2125. ; ( Forced on us because this function gets called from both pages on a select-Change event)
  2126. ; We need to Case-control the display on entry to the first page based on a flag we store...
  2127. ; because of that, the above macro isn't behaving nicely on the first click, so we need to
  2128. ; manually control final state... so here we clear them all, and then we reselect the one
  2129. ; that is notified as being clicked upon from the above code.....
  2130. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked. 0
  2131. !insertmacro UnselectSection ${g1o2} ; none of the chekcboxes should be checked. 1
  2132. !insertmacro UnselectSection ${g1o3} ; none of the chekcboxes should be checked. 2
  2133. !insertmacro UnselectSection ${g1o4} ; none of the chekcboxes should be checked. 3
  2134. !insertmacro UnselectSection ${g1o5} ; none of the chekcboxes should be checked. 4
  2135. !insertmacro UnselectSection ${g1o6} ; none of the chekcboxes should be checked. 5
  2136. !insertmacro UnselectSection ${g1o6B} ; none of the chekcboxes should be checked. - This is status index
  2137. !insertmacro UnselectSection ${gIWDI} ; g1o7 #7 is Imail with Declude
  2138. !insertmacro UnselectSection ${gIMXI} ; g1oA #8 is Imail with MXGuard
  2139. !insertmacro UnselectSection ${gIMMI} ; g1o7B #9 is IMail with MINIMI
  2140. !insertmacro UnselectSection ${gSWDI} ; g1o8 #10 is SmarterMail with Declude
  2141. !insertmacro UnselectSection ${gSMXI} ; g1oA2 #11 is SmarterMail with MXGuard
  2142. !insertmacro UnselectSection ${gAWDI} ; gAWDI #12 is Alligate
  2143. ; 13 is the Section Group.
  2144. !insertmacro UnselectSection ${gIWTI} ; gIWTI #14 is Icewarp
  2145. !insertmacro UnselectSection ${gIWTICF} ; gIWTICF #15 is Icewarp
  2146. !insertmacro UnselectSection ${gIWTICF2} ; gIWTICF2 #16 is Icewarp
  2147. !insertmacro UnselectSection ${gMSI} ; gMSI #18 is MailSite
  2148. !insertmacro UnselectSection ${gKMI} ; gKMI #19 is Kerio
  2149. !insertmacro UnselectSection ${gMDDLL} ; MDaemon #20 is MDaemon
  2150. !insertmacro UnselectSection ${gSNFI} ; g1oB #21 is SNF stand alone
  2151. !insertmacro UnselectSection ${gUSWDI} ; g1oC #22 is Unknown Server with Declude
  2152. !insertmacro UnselectSection ${gCUKC} ; #23 is Custom Unknown
  2153. ;MessageBox MB_OK "$1"
  2154. StrCpy $BaseRadioDefault $1 ; set this so that the next time through the click-handler it knows what to start with.
  2155. ;MessageBox MB_OK "Click result is:$1"
  2156. ## ADDINGPLATFORM ## STEP 20 OK! This is the doosey! Here is where the ordinal matters. Cause the code above, grabbed the event, and it will
  2157. ## comeback with master ordinal. ( Not the ordinal of what was SHOWN in the list.) So even if you only displayed six items, the ordinal could come
  2158. ## back with a 18. The Switch below, is ENTIRELY BASED ON THAT ORDINAL... which is why, if don't bump all the case elements BELOW YOUR ENTRY
  2159. ## you will end up with VERY STRANGE Event handling behavior.
  2160. ## Insert a new case element, custom code the effect you desire, and then increment every number below your entry.
  2161. ## Ignore the fact that 1 through 6 are at the very end, ( They are the returns for the activities. New, Fresh, Update, Remove etc. )
  2162. ## IF your install requires a custom call back you call that here.
  2163. ## Do not remove the StrCy $currentPlatformSelection $1 line. ( $1 is the register that returns the currently selected checkbox, and if you come back
  2164. ## to this screen, the screen remember what was selected based on the value contained by $currentPlatformSelection
  2165. ; Now based on the clicked selection mark it shown, and setup the proper flags.
  2166. ${Switch} $1
  2167. ${Case} "7" ; zero indexed array... Imail with Declude gIWDI
  2168. StrCpy $SelectedCaseIndexForPlatformScreen "gIWDI" ; Which is the first platform option....
  2169. !insertmacro SelectSection ${gIWDI} ; check Declude with Imail.
  2170. Call SetInstallForDeclude ; Set the install folder to put MessageSniffer in based on the Declude settings.
  2171. ; If Its declude, then its whatever declude is setup for.... i.e. Declude can't be both
  2172. ; IMail and Smartermail at the same time.... it will be one or the other.
  2173. ; StrCpy $INSTDIR
  2174. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2175. return ;
  2176. ${Case} "8"
  2177. StrCpy $SelectedCaseIndexForPlatformScreen "gIMXI"
  2178. !insertmacro SelectSection ${gIMXI} ; MXGuard with Imail
  2179. Call SetInstallForMXGuard
  2180. StrCpy $currentPlatformSelection $1
  2181. return
  2182. ${Case} "9"
  2183. StrCpy $SelectedCaseIndexForPlatformScreen "gIMMI" ; this marker is for the presetting the platforms screen on back event
  2184. !insertmacro SelectSection ${gIMMI} ; MINIMI with IMAIL
  2185. Call SetInstallForMINIMI
  2186. StrCpy $currentPlatformSelection $1 ; this marker is for remembering what was checked....
  2187. return
  2188. ${Case} "10"
  2189. StrCpy $SelectedCaseIndexForPlatformScreen "gSWDI"
  2190. !insertmacro SelectSection ${gSWDI} ; check Declude with Smartermail
  2191. Call SetInstallForDeclude ; Set the install folder to put MessageSniffer in based on the Declude settings.
  2192. ; If Its declude, then its whatever declude is setup for.... i.e. Declude can't be both
  2193. ; IMail and Smartermail at the same time.... it will be one or the other.
  2194. StrCpy $currentPlatformSelection $1
  2195. return
  2196. ${Case} "11"
  2197. StrCpy $SelectedCaseIndexForPlatformScreen "gSMXI"
  2198. !insertmacro SelectSection ${gSMXI} ; MXGuard with SmarterMail
  2199. Call SetInstallForMXGuard
  2200. StrCpy $currentPlatformSelection $1
  2201. return
  2202. ${Case} "12"
  2203. StrCpy $SelectedCaseIndexForPlatformScreen "gAWDI"
  2204. !insertmacro SelectSection ${gAWDI} ; Alligate
  2205. Call SetInstallForSNF4Alligate ; Set the install folder to put MessageSniffer in based on the non-existant Alligate settings...
  2206. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2207. return ;
  2208. ${Case} "13"
  2209. ${Case} "14"
  2210. WriteRegStr HKLM "SOFTWARE\MessageSniffer" "IceWarpType" "AV" ; tells the Installer script to insert in AV position. Script will consume flag;
  2211. StrCpy $SelectedCaseIndexForPlatformScreen "gIWTI"
  2212. !insertmacro SelectSection ${gIWTI} ; IceWarp TieIn.
  2213. ;Call SetInstallForIceWarp
  2214. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2215. return ;
  2216. ${Case} "15"
  2217. WriteRegStr HKLM "SOFTWARE\MessageSniffer" "IceWarpType" "CF" ; tells the Installer script to insert in dominant filter position. Script will consume flag;
  2218. StrCpy $SelectedCaseIndexForPlatformScreen "gIWTICF"
  2219. !insertmacro SelectSection ${gIWTICF} ; IceWarp TieIn.
  2220. ;Call SetInstallForIceWarp
  2221. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2222. return ;
  2223. ${Case} "16"
  2224. WriteRegStr HKLM "SOFTWARE\MessageSniffer" "IceWarpType" "SS" ; tells the Installer script to insert with SpamScore contribution. Script will consume flag;
  2225. StrCpy $SelectedCaseIndexForPlatformScreen "gIWTICF2"
  2226. !insertmacro SelectSection ${gIWTICF2} ; IceWarp TieIn.
  2227. ;Call SetInstallForIceWarp
  2228. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2229. return ;
  2230. ${Case} "18"
  2231. StrCpy $SelectedCaseIndexForPlatformScreen "gMSI"
  2232. !insertmacro SelectSection ${gMSI} ; MailStop
  2233. ;Call SetInstallForMailSite ; Set the install folder to put MessageSniffer in based on the non-existant Alligate settings...
  2234. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2235. return ;
  2236. ${Case} "19"
  2237. StrCpy $SelectedCaseIndexForPlatformScreen "gKMI"
  2238. !insertmacro SelectSection ${gKMI} ; Kerio
  2239. ;Call SetInstallForKerio ; Set the install folder to put MessageSniffer in based on the non-existant Alligate settings...
  2240. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2241. return ;
  2242. ${Case} "20"
  2243. StrCpy $SelectedCaseIndexForPlatformScreen "gMDDLL"
  2244. !insertmacro SelectSection ${gMDDLL} ; Kerio
  2245. ;Call SetInstallForMDaemon ; Set callback for the MDaemon install code
  2246. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2247. return ;
  2248. ${Case} "21" ## WON'T HAPPEN
  2249. StrCpy $SelectedCaseIndexForPlatformScreen "gSNFI"
  2250. !insertmacro SelectSection ${gSNFI} ; SnifferStandalone
  2251. # These vars are used by the page that looks for missing folders.
  2252. ;StrCpy $MissingApplicationName "Stand Alone Sniffer installation" ; This is used to identify the abstracted application name.
  2253. ; MissingApplicationFolder ; This is used to identify the abstracted application folder to start the search from
  2254. ;StrCpy $FindApplicationMessage "Please choose the folder where the $MissingApplicationName should reside." ; This is used to abstract the search page.
  2255. ;Call LocatePlatformScreen
  2256. ;StrCpy $SNFServerInstallDir $MissingApplicationFolder ; This will get the \SNF and the \SNFArchive folders built inside.....
  2257. ;StrCpy $INSTDIR "$SNFServerInstallDir\SNF"
  2258. ;StrCpy $currentPlatformSelection $1
  2259. return
  2260. ${Case} "22"
  2261. StrCpy $SelectedCaseIndexForPlatformScreen "gUSWDI"
  2262. !insertmacro SelectSection ${gUSWDI} ; Unknown Declude
  2263. ; Can't call this until you select the folders...Call SetInstallForDeclude ; No guarantees.... just install it in decludes folder.
  2264. StrCpy $currentPlatformSelection $1
  2265. return
  2266. ${Case} "23"
  2267. StrCpy $SelectedCaseIndexForPlatformScreen "gCUKC" ; this Custom unknown
  2268. ; doesn't matter where the folder is.. user will set it on the next screen.
  2269. !insertmacro SelectSection ${gCUKC} ;
  2270. return
  2271. # END THE Case elements for the Platforms OnSelectChange handling....
  2272. # These bottom ones are shown on the second components page.....
  2273. ${Case} "6" ; Handling the request to see the status page.
  2274. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2275. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2276. StrCpy $ShowTelemetryPage "1" ; don't show status utilities.
  2277. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2278. !insertmacro SelectSection ${g1o6B} ; INSTALL NEW chekcboxes should be checked.
  2279. StrCpy $currentUtilitySelection $1
  2280. Return
  2281. ${Case} "5" ; if 5 was selected we jump with no play to the uninstaller.
  2282. StrCpy $HandleUninstallPage "1" ; don't show uninstall screen.
  2283. StrCpy $ShowArchiveOptionsPage "0" ; don't show utilities.
  2284. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2285. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utility.
  2286. !insertmacro SelectSection ${g1o6} ; Just Uninstall should be checked.
  2287. StrCpy $currentUtilitySelection $1
  2288. Return
  2289. ${Case} "4"
  2290. StrCpy $ShowRestoreOptionsPage "1" ; If 4 was selected, we show the restore utility
  2291. StrCpy $ShowArchiveOptionsPage "0" ; don't show utilities.
  2292. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2293. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2294. !insertmacro SelectSection ${g1o5} ; Just RESTORE should be checked.
  2295. StrCpy $currentUtilitySelection $1
  2296. Return
  2297. ${Case} "3"
  2298. StrCpy $ShowArchiveOptionsPage "1" ; If 3 was selected, we show the archive utility
  2299. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utility.
  2300. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2301. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2302. !insertmacro SelectSection ${g1o4} ; JUST THE ARCHIVE chekcboxes should be checked.
  2303. StrCpy $currentUtilitySelection $1
  2304. Return
  2305. ${Case} "2"
  2306. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2307. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2308. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2309. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2310. !insertmacro SelectSection ${g1o3} ; INSTALL WITH SETTINGS chekcboxes should be checked.
  2311. StrCpy $currentUtilitySelection $1
  2312. Return
  2313. ${Case} "1"
  2314. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2315. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2316. StrCpy $ShowTelemetryPage "0" ; don't show statsu utilities.
  2317. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2318. !insertmacro SelectSection ${g1o2} ; INSTALL FRESH chekcboxes should be checked.
  2319. StrCpy $currentUtilitySelection $1
  2320. Return
  2321. ${Case} "0" ; Handling the 0 ( the expected result ) from clicking the NEW INSTALL button, ( but only when the Restore option is presented...)
  2322. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2323. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2324. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2325. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2326. !insertmacro SelectSection ${g1o1} ; INSTALL NEW chekcboxes should be checked.
  2327. StrCpy $currentUtilitySelection $1
  2328. Return
  2329. ${Case} "\" ; When NEW INSTALL is by itself...or some reason the subroutine is returning slash as the result of clicking the NEW button when its the only option.
  2330. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2331. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2332. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2333. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2334. !insertmacro SelectSection ${g1o1} ; INSTALL NEW chekcboxes should be checked.
  2335. StrCpy $currentUtilitySelection "0"
  2336. Return
  2337. ${Default}
  2338. ; If we get here, we have an unusual situation that leaks through teh event handler.
  2339. ; Though its not possible, you can unclick a radio button that should always have one selected.
  2340. ; and put yourself in the original state of having nothing picked... if so, disable next.
  2341. EnableWindow $NextButton "0"
  2342. ${EndSwitch}
  2343. FunctionEnd
  2344. ; Ending Functions for control of components selection
  2345. ;-----------------------------------
  2346. Function nsDialogHandleUninstall
  2347. ; This page never shows. It will always complete and then return to the main components page. ( Or play through if $HandleUninstallPage= 0
  2348. StrCmp $HandleUninstallPage "1" 0 exit_nsDialogsUninstall
  2349. SetOutPath $INSTDIR
  2350. ifFileExists "$INSTDIR\uninstall.exe" 0 NotifyFind
  2351. SetOutPath $SNFServerInstallDir ; Reset this to enable the descturction of working directories.. THIS WAS THE CULPRET THAT HELD THE LOCK ON THE FOLDER!!!
  2352. ExecWait "$INSTDIR\uninstall.exe"
  2353. StrCpy $R9 "-4" ;Relative page number. See below.
  2354. Call RelGotoPage ; take me back to main screen
  2355. return ;
  2356. NotifyFind:
  2357. MessageBox MB_OK "Message Sniffer Utility is unable to locate the Uninstaller in the proper directory. Please search for the uninstall.exe in the proper directory."
  2358. StrCpy $R9 "-4" ;Relative page number. See below.
  2359. Call RelGotoPage ; take me back to main screen
  2360. exit_nsDialogsUninstall:
  2361. return ;
  2362. FunctionEND
  2363. Function nsDialogsTelemetryShow
  2364. StrCmp $ShowTelemetryPage "1" 0 exit_nsDialogsTelemetry
  2365. !insertmacro BIMAGE "SnifferBannerArchive.bmp" ""
  2366. GetDlgItem $0 $HWNDPARENT 1
  2367. SendMessage $0 ${WM_SETTEXT} 0 "STR:Exit Status" ; set the next button text:
  2368. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Server 3.0 Status Viewer:" ; set the window text.
  2369. Var /GLOBAL TEXTBOX_Telemetry
  2370. Var /GLOBAL TelemetryData
  2371. Var /GLOBAL TelemetryGo
  2372. nsDialogs::Create /NOUNLOAD 1018
  2373. Pop $0
  2374. ${NSD_CreateLabel} 0 0 100% 90 "Greetings. This is the quick status checking screen. You may press the test buttons to manually reload the status and rulebase authentication validation."
  2375. Pop $0
  2376. ${NSD_CreateLabel} 0 30 100% 80u "Press to load status...." ; Default text goes in the quotes if you want something in the text box initially.;
  2377. Pop $TEXTBOX_Telemetry
  2378. ${NSD_CreateButton} 0 180 30% 14u "Retest Status"
  2379. Pop $TelemetryGo
  2380. GetFunctionAddress $0 reloadTelemetry
  2381. nsDialogs::OnClick /NOUNLOAD $TelemetryGo $0
  2382. nsDialogs::Show
  2383. exit_nsDialogsTelemetry:
  2384. FunctionEnd
  2385. Function reloadTelemetry
  2386. ${GetBetween} "licenseid='" "'" "$INSTDIR\identity.xml" $LicenseID ; This makes it not brittly dependant on the default value. i.e. It would
  2387. ${GetBetween} "authentication='" "'" "$INSTDIR\identity.xml" $Authentication
  2388. StrCpy $TelemetryData "" "Starting Status Test.$\r$\n"
  2389. StrCpy $TelemetryData "" "$TelemetryData $\r$\nLicense = $LicenseID Authentication = $Authentication"
  2390. nsExec::ExecToStack 'NET START SNFService'
  2391. Pop $0 # return value/error/timeout
  2392. StrCpy $TelemetryData "$TelemetryData$\r$\n NET START Return Code: $0"
  2393. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2394. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2395. nsExec::ExecToStack '$INSTDIR\SNFService'
  2396. Pop $0 # return value/error/timeout
  2397. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2398. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2399. ; but first test for valid status
  2400. nsExec::ExecToStack '"$INSTDIR\snf2check.exe" "$INSTDIR\$LicenseID.snf" "$Authentication"'
  2401. Pop $0 # return value/error/timeout
  2402. StrCpy $TelemetryData "$TelemetryData$\r$\n snf2check return code: $0"
  2403. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2404. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2405. ;Sleep 5000
  2406. ;MessageBox MB_OK "$INSTDIR"
  2407. nsExec::ExecToStack '$INSTDIR\SNFClient -status.second'
  2408. Pop $0 # return value/error/timeout
  2409. StrCpy $TelemetryData "$TelemetryData$\r$\n SNFClient return code: $0"
  2410. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2411. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2412. MessageBox MB_OK "$1"
  2413. SendMessage $TEXTBOX_Telemetry ${WM_SETTEXT} 0 "STR:$TelemetryData"
  2414. FunctionEND
  2415. Function nsDialogsTelemetryLeave
  2416. StrCpy $R9 "-1" ;Relative page number. See below.
  2417. Call RelGotoPage
  2418. FunctionEND
  2419. Function nsDialogInstall
  2420. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Install Utility Unpacking Components:" ; change text screen.
  2421. !insertmacro BIMAGE "SnifferBanner2.bmp" "" ; change banner image.
  2422. FunctionEND
  2423. Function .onUserAbort
  2424. ; If this happenes we don't want to leave a folder hanging there.
  2425. SetOutPath "$SNFServerInstallDir"
  2426. ;IfFileExists "$SNFServerInstallDir\SNF\mingwm10.dll" +2 0 ; If the dll exists, presume a decent install. If not... presume its screwed and delete it.
  2427. ;RMDir /r "$SNFServerInstallDir\SNF"
  2428. FunctionEnd
  2429. Function check_CompoundEnable
  2430. VAR /GLOBAL Compound_Enable1 ; a value to ensure enabling.
  2431. VAR /GLOBAL Compound_Enable2 ; another value that must be enabled to enable the next.
  2432. EnableWindow $NextButton "0" ; presume no.
  2433. StrCmp $Compound_Enable1 "0" 0 +2
  2434. return
  2435. StrCmp $Compound_Enable2 "0" 0 +2
  2436. return
  2437. #StrCmp $Compound_Enable3 "0" 0 +2
  2438. # return
  2439. EnableWindow $NextButton "1" ; presume no.
  2440. return
  2441. FunctionEnd
  2442. Function FindApplicationPath
  2443. Var /Global windowHandle
  2444. nsDialogs::Create /NOUNLOAD 1018
  2445. Pop $windowHandle
  2446. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Please locate the $MissingApplicationName folders."
  2447. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  2448. ; Disable the next button until selection is made.
  2449. GetDlgItem $NextButton $HWNDPARENT 1
  2450. EnableWindow $NextButton "0"
  2451. #############################################################################
  2452. ## These variables hold the list of platforms for which we MAY install SNF.
  2453. ## There may be one, more or many.
  2454. ##VAR /GLOBAL isIceWarpInstalled
  2455. ##VAR /GLOBAL isMailSiteInstalled
  2456. ##VAR /GLOBAL isKerioInstalled
  2457. ##VAR /GLOBAL isImailInstalled
  2458. ##VAR /GLOBAL isSmarterMailInstalled
  2459. ##VAR /GLOBAL isAlligateInstalled
  2460. ##VAR /GLOBAL isDecludeInstalled
  2461. #VAR /GLOBAL isMXGuardInstalled
  2462. #VAR /GLOBAL isMINIMIInstalled
  2463. #VAR /GLOBAL Set_For_MINIMI_INSTALL ; may or may not be set, depending of if the user wants to re-install MINIMI
  2464. #VAR /GLOBAL SelectedCaseIndexForPlatformScreen ; This is the var for controlling the case display on the platform screen. Indxed top to bottom.
  2465. ## Now define the variables to hold the locations of WHERE we install SNF
  2466. ## in the event we select any of these options.
  2467. #VAR /GLOBAL IceWarpInstallFolder
  2468. #VAR /GLOBAL MailSiteInstallFolder
  2469. #VAR /GLOBAL KerioInstallFolder
  2470. #VAR /GLOBAL ImailInstallFolder
  2471. #VAR /GLOBAL SmarterMailInstallFolder
  2472. #VAR /GLOBAL AlligateInstallFolder
  2473. #VAR /GLOBAL DecludeInstallFolder
  2474. #VAR /GLOBAL MXGuardInstallFolder
  2475. #VAR /GLOBAL MINIMIInstallFolder
  2476. Var /Global HowToFindMessage ; var for holding the popped winhandle for the message control...
  2477. Var /Global SNF_StartLookingHere
  2478. StrCpy $SNF_StartLookingHere "C:\Program Files\SNF"
  2479. StrCpy $Compound_Enable1 "0" ; the default is you must declare at least the Sniffer directory....
  2480. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2481. ## ADDINGPLATFORM ## Step 21
  2482. ## Ok, here is the validation screens. This sub is called after you've selected the platform in the installer.
  2483. ## It calls a switch on what platform, and based on that switch, it displays and runs tests on the folders it can find, or knows about.
  2484. ## If it finds the expected files, then its all rosy and it enables the <NEXT> button. If not, it will force the user to lookup the target
  2485. ## and redisplay this page to test if the new locaton has the expected files. If it can't find the expected files, it won't let the installer
  2486. ## proceed, and it won't install. The case is driven off of the short name of the SECTION, so is NOT ordinal based, but its just nice to
  2487. ## keep it in the same order that you saw it in the list.
  2488. ## Steps to add this case block are:
  2489. ## Copy block. Alter DetermineXYZ call to test for specific platform.
  2490. ## Convert the file testing, adjust the user display responses.
  2491. ## If necessary, add NOPLATFORM block after Switch block.
  2492. ## Alter the default folder to display in the text block with SendMessage to hold the XYZInstallDir
  2493. ## Alter the paths in the ifFileExists tests, to reflect the platform desired.
  2494. ## Be sure to complete step 22, us the name that you unter as the callback in the NSD_OnClick button handler. i.e. LocateXYZFolder.
  2495. ## Fix the compound enable test to be happy if the proper files are where they should be.
  2496. ${Switch} $SelectedCaseIndexForPlatformScreen
  2497. ${Case} "gIWDI" ; zero indexed array... Imail with Declude gIWDI
  2498. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer under Declude with an Imail configuration. You will need to confirm the location of the following items:"
  2499. ## Handle the definition of the page for Imail and Declude
  2500. Call DetermineImail
  2501. StrCmp $IsImailInstalled "1" 0 NoImailFound
  2502. Call DetermineDeclude
  2503. StrCmp $IsDecludeInstalled "1" 0 NoDecludeFound
  2504. StrCpy $FindApplicationMessage "Imail was found. Please confirm the folder for Declude's global.cfg file. "
  2505. Goto +2
  2506. NoDecludeFound:
  2507. StrCpy $FindApplicationMessage "Imail was found. Declude was not. Please find Declude's global.cfg file."
  2508. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2509. Pop $SNF_SearchFor_Location ; handle
  2510. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$SNFServerInstallDir" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2511. ; For Declude, you need to add \declude to the end of the DecludeInstalationFolder......
  2512. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2513. Pop $SNF_SearchFor_Location_Button
  2514. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateDecludeFolder
  2515. ifFileExists "$SNFServerInstallDir\global.cfg" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2516. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2517. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2518. Call check_CompoundEnable
  2519. StrCpy $SNF_StartLookingHere "$SNFServerInstallDir\SNF" ; store the starting path here for looking.
  2520. Goto EndDisplayChoices
  2521. ${Case} "gIMXI"
  2522. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer under MXGuard with an Imail configuration. You will need to confirm the location of the following items:"
  2523. StrCpy $MissingApplicationName "Imail w/ MXGuard"
  2524. ## Handle the definition of the page for Imail and MINIMI
  2525. Call DetermineImail
  2526. StrCmp $IsImailInstalled "1" 0 NoImailFound
  2527. Call DetermineMXGuard
  2528. StrCmp $IsMXGuardInstalled "1" 0 NoMXGuardFound
  2529. StrCpy $FindApplicationMessage "Imail was found. Please confirm the folder for MXGuard. "
  2530. Goto +2
  2531. NoMXGuardFound:
  2532. StrCpy $FindApplicationMessage "Imail was found. MXGuard was not. Please find MXGuards/ install directory."
  2533. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2534. Pop $SNF_SearchFor_Location ; handle
  2535. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$MXGuardInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2536. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2537. Pop $SNF_SearchFor_Location_Button
  2538. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMXGuardFolder
  2539. ifFileExists "$MXGuardInstallFolder\mxguard.ini" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2540. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2541. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2542. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2543. StrCpy $SNF_StartLookingHere "$MXGuardInstallFolder\SNF" ; store the starting path here for looking.
  2544. Goto EndDisplayChoices ;
  2545. ${Case} "gIMMI"
  2546. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with MINIMI for the Imail server. You will need to confirm the location of the following items:"
  2547. StrCpy $MissingApplicationName "Imail w/ MINIMI"
  2548. ## Handle the definition of the page for Imail and MINIMI
  2549. Call DetermineImail
  2550. StrCmp $IsImailInstalled "1" 0 NoImailFound
  2551. Call DetermineMINIMI
  2552. StrCmp $IsMINIMIInstalled "1" 0 NoMINIMIFound
  2553. StrCpy $FindApplicationMessage "Imail was found. Please confirm the folder for MINIMI to be installed in $\nby finding Imail's location for smtp32. "
  2554. Goto +2
  2555. NoMINIMIFound:
  2556. StrCpy $FindApplicationMessage "Imail was found. MINIMI was not. Please confirm the location for MINIMI.$\n(Imail's location for smtp32.)"
  2557. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2558. Pop $SNF_SearchFor_Location ; handle
  2559. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$MINIMIInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2560. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2561. Pop $SNF_SearchFor_Location_Button
  2562. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMINIMIFolder
  2563. ifFileExists "$MINIMIInstallFolder\SMTP32.exe" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2564. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2565. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2566. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2567. StrCpy $SNF_StartLookingHere "$MINIMIInstallFolder\SNF" ; store the starting path here for looking.
  2568. Goto EndDisplayChoices ;
  2569. ${Case} "gSWDI"
  2570. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with Declude under SmarterMail. You will need to confirm the location of the following items:"
  2571. StrCpy $MissingApplicationName "Smartermail w/ Declude"
  2572. ## Handle the definition of the page for Imail and Declude
  2573. Call DetermineSmarterMail
  2574. StrCmp $IsSmarterMailInstalled "1" 0 NoSmarterMail
  2575. Call DetermineDeclude ; handles both conditions.....
  2576. StrCmp $IsDecludeInstalled "1" 0 NoDeclude_Found
  2577. StrCpy $FindApplicationMessage "SmarterMail was found. Please confirm the folder for Declude's global.cfg file. "
  2578. Goto +2
  2579. NoDeclude_Found:
  2580. StrCpy $FindApplicationMessage "SmarterMail was found. Declude was not. Please find Declude's global.cfg file."
  2581. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2582. Pop $SNF_SearchFor_Location ; handle
  2583. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$SNFServerInstallDir" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2584. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2585. Pop $SNF_SearchFor_Location_Button
  2586. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateDecludeFolder
  2587. ifFileExists "$SNFServerInstallDir\global.cfg" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2588. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2589. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2590. Call check_CompoundEnable
  2591. StrCpy $SNF_StartLookingHere "$SNFServerInstallDir\SNF" ; store the starting path here for looking.
  2592. Goto EndDisplayChoices ;
  2593. ${Case} "gSMXI"
  2594. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with MXGuard under SmarterMail. You will need to confirm the location of the following items:"
  2595. StrCpy $MissingApplicationName "Smartermail w/ MXGuard"
  2596. ## Handle the definition of the page for Smartermail and and MXGuard
  2597. Call DetermineSmarterMail
  2598. StrCmp $IsSmarterMailInstalled "1" 0 NoSmarterMail
  2599. Call DetermineMXGuard
  2600. StrCmp $IsMXGuardInstalled "1" 0 NoSMMXGuardFound
  2601. StrCpy $FindApplicationMessage "SmarterMail was found. Please confirm the folder for MXGuard. "
  2602. Goto +2
  2603. NoSMMXGuardFound:
  2604. StrCpy $FindApplicationMessage "SmarterMail was found. MXGuard was not. Please find MXGuards mxguard.ini file. $\nTypical locations would be in: [root]\Program Files\dgSoft Internet Services\mxGuard for Mail Servers."
  2605. StrCmp $MXGuardInstallFolder "" 0 +2 ; If Its not empty then use what DetermineMXGuard found.... otherwise... use guess...
  2606. StrCpy $MXGuardInstallFolder "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers"
  2607. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2608. Pop $SNF_SearchFor_Location ; handle
  2609. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$MXGuardInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2610. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2611. Pop $SNF_SearchFor_Location_Button
  2612. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMXGuardFolder
  2613. ifFileExists "$MXGuardInstallFolder\mxguard.ini" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2614. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2615. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2616. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2617. StrCpy $SNF_StartLookingHere "$MXGuardInstallFolder\SNF" ; store the starting path here for looking.
  2618. #C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers
  2619. Goto EndDisplayChoices ;
  2620. ${Case} "gAWDI"
  2621. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with Alligate. You will need to confirm the location of the following items:"
  2622. StrCpy $MissingApplicationName "Alligate"
  2623. ## Handle the definition of the page for Imail and MINIMI
  2624. Call DetermineAlligate
  2625. StrCmp $IsAlligateInstalled "1" 0 NoAlligateFound
  2626. Call DetermineSNF4Alligate
  2627. StrCmp "1" 0 NoSNF4AlligateFound
  2628. StrCpy $FindApplicationMessage "Alligate was found. Please confirm the folder for SNF4Alligate to be installed in $\nby confirming Alligates install location for AGFiltSVC.exe "
  2629. Goto +2
  2630. NoSNF4AlligateFound:
  2631. StrCpy $FindApplicationMessage "Alligate was found. SNF4Alligate was not. Please confirm the location for SNF4Alligate \n(Same as Alligate's location for AGFiltSVC.exe)"
  2632. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2633. Pop $SNF_SearchFor_Location ; handle
  2634. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$AlligateInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2635. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2636. Pop $SNF_SearchFor_Location_Button
  2637. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateSNF4AlligateFolder
  2638. StrCpy $SNF4AlligateInstallFolder $AlligateInstallFolder
  2639. ifFileExists "$AlligateInstallFolder\AGFiltSvc.exe" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2640. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2641. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2642. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2643. StrCpy $SNF_StartLookingHere "$AlligateInstallFolder\SNF" ; store the starting path here for looking.
  2644. Goto EndDisplayChoices ;
  2645. ${Case} "gIWTICF"
  2646. ${Case} "gIWTICF2"
  2647. ${Case} "gIWTI"
  2648. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with Icewarp You will need to confirm the location of the following items:"
  2649. StrCpy $MissingApplicationName "Icewarp"
  2650. ## Handle the definition of the page for Imail and MINIMI
  2651. Call DetermineIceWarp
  2652. StrCmp $IsIceWarpInstalled "1" 0 NoIceWarpFound
  2653. IfFileExists "$IceWarpInstallFolder\config\content.xml" 0 NoContentXMLFound
  2654. StrCpy $FindApplicationMessage "IceWarp was found. Please confirm Icewarp's install location."
  2655. Goto +2
  2656. NoContentXMLFound:
  2657. StrCpy $FindApplicationMessage "IceWarp was found. Its content.xml was not. Please confirm the location of the [config] folder holding Merak\config\content.xml"
  2658. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2659. Pop $SNF_SearchFor_Location ; handle
  2660. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$IceWarpInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2661. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2662. Pop $SNF_SearchFor_Location_Button
  2663. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateIceWarpFolder
  2664. ifFileExists "$IceWarpInstallFolder\config\content.xml" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2665. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2666. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2667. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2668. StrCpy $SNF_StartLookingHere "$IceWarpInstallFolder\SNF" ; store the starting path here for looking.
  2669. Goto EndDisplayChoices ;
  2670. ${Case} "gMSI"
  2671. StrCpy $Find_Explanation_INFO "MailSite isn't fully supported yet."
  2672. StrCpy $MissingApplicationName "MailSite"
  2673. StrCpy $FindApplicationMessage "MailSite was not found."
  2674. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2675. Pop $SNF_SearchFor_Location ; handle
  2676. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$MailSiteInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2677. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2678. Pop $SNF_SearchFor_Location_Button
  2679. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMailSiteFolder
  2680. ifFileExists "$MailSiteInstallFolder\*.*" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2681. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2682. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2683. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2684. StrCpy $SNF_StartLookingHere "$MailSiteInstallFolder\SNF" ; store the starting path here for looking.
  2685. Goto EndDisplayChoices ;
  2686. ${Case} "gKMI"
  2687. StrCpy $Find_Explanation_INFO "Kerio isn't fully supported yet."
  2688. StrCpy $MissingApplicationName "Kerio"
  2689. StrCpy $FindApplicationMessage "Kerio was not found."
  2690. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2691. Pop $SNF_SearchFor_Location ; handle
  2692. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$KerioInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2693. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2694. Pop $SNF_SearchFor_Location_Button
  2695. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateKerioFolder
  2696. ifFileExists "$KerioInstallFolder\*.*" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2697. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2698. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2699. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2700. StrCpy $SNF_StartLookingHere "$KerioInstallFolder\SNF" ; store the starting path here for looking.
  2701. Goto EndDisplayChoices ;
  2702. ${Case} "gMDDLL"
  2703. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with MDaemon You will need to confirm the location of the following items:"
  2704. StrCpy $MissingApplicationName "MDaemon"
  2705. ## Handle the determination of MDaemon.
  2706. Call DetermineMDaemon
  2707. StrCmp $IsMDaemonInstalled "1" 0 NoMDaemon
  2708. StrCpy $FindApplicationMessage "MDaemon was found. Please confirm where SNF should reside:"
  2709. ifFileExists "$MDaemonInstallFolder\App\*.*" +2 0
  2710. StrCpy $FindApplicationMessage "MDaemons App folder was not found. Please confirm the MDaemon and SNF locations:"
  2711. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2712. Pop $SNF_SearchFor_Location ; handle
  2713. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$MDaemonInstallFolder" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2714. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2715. Pop $SNF_SearchFor_Location_Button
  2716. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMDaemonFolder
  2717. ifFileExists "$MDaemonInstallFolder\*.*" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2718. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2719. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2720. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2721. StrCpy $SNF_StartLookingHere "$MDaemonInstallFolder\SNF" ; store the starting path here for looking.
  2722. Goto EndDisplayChoices ;
  2723. ${Case} "gSNFI"
  2724. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer in a stand alone. You will need to confirm the location of the install directory."
  2725. StrCpy $MissingApplicationName "Stand Alone Sniffer"
  2726. Goto EndDisplayChoices ;
  2727. ${Case} "gUSWDI"
  2728. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer in an unidentified Declude install. You will need to confirm the location of the following items:"
  2729. StrCpy $MissingApplicationName "Generic Declude Install"
  2730. ## Handle the definition of the page for Imail and Declude
  2731. Call DetermineDeclude ; handles both conditions.....
  2732. StrCmp $IsDecludeInstalled "1" 0 NoDeclude_Found
  2733. StrCpy $FindApplicationMessage "No supporting mail server was recognized. Please locate the folder holding Declude's global.cfg file. "
  2734. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2735. Pop $SNF_SearchFor_Location ; handle
  2736. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$SNFServerInstallDir" ; yes, the var comes from the registry with an apended '/'... it stupid... This is the look up for the global.cfg
  2737. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2738. Pop $SNF_SearchFor_Location_Button
  2739. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateDecludeFolder
  2740. ifFileExists "$SNFServerInstallDir\global.cfg" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2741. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2742. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2743. Call check_CompoundEnable
  2744. StrCpy $SNF_StartLookingHere "$SNFServerInstallDir\SNF" ; store the starting path here for looking.
  2745. Goto EndDisplayChoices ;
  2746. ${Case} "gCUKC"
  2747. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer in a stand alone. You will need to confirm the location of the install directory."
  2748. StrCpy $MissingApplicationName "Custom / Unknown" ;
  2749. StrCpy $FindApplicationMessage ""
  2750. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2751. Call check_CompoundEnable
  2752. Goto EndDisplayChoices ;
  2753. ${Default}
  2754. ; If we get here, we have an unusual situation that leaks through teh event handler.
  2755. ; Though its not possible, you can unclick a radio button that should always have one selected.
  2756. ; and put yourself in the original state of having nothing picked... if so, disable next.
  2757. EnableWindow $NextButton "0"
  2758. ${EndSwitch}
  2759. EndDisplayChoices:
  2760. Var /GLOBAL FindINSTDIRMessage
  2761. StrCpy $FindINSTDIRMessage "Please locate the directory where you wish to install Message Sniffer. "
  2762. ; put in the header handlers.
  2763. ${NSD_CreateLabel} 0 0 75% 25% "$Find_Explanation_INFO"
  2764. Pop $0
  2765. ${NSD_CreateLabel} 0 25% 100% 30% "$FindApplicationMessage"
  2766. Pop $HowToFindMessage
  2767. ; Now put in the controls for handling the Sniffer Path.....
  2768. ${NSD_CreateLabel} 0 70% 100% 15 "Please confirm/locate the folder you wish Message Sniffer to be installed in."
  2769. Pop $HowToFindMessage
  2770. ${NSD_CreateDirRequest} 0 80% 75% 12u ""
  2771. Pop $SNF_SearchFor_LocationB
  2772. SendMessage $SNF_SearchFor_LocationB ${WM_SETTEXT} 0 "STR:$SNF_StartLookingHere" ; This is the look up for the SNIFFER Location....
  2773. ${NSD_CreateBrowseButton} 340 80% 8% 12u "..."
  2774. Pop $SNF_SearchFor_Location_ButtonB
  2775. ${NSD_OnClick} $SNF_SearchFor_Location_ButtonB LocateSNFInstallFolder
  2776. StrCmp $SNF_StartLookingHere "" +3 0
  2777. StrCpy $Compound_Enable1 "1" ; clear for double ok.
  2778. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2779. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2780. nsDialogs::Show
  2781. return
  2782. ; error handling
  2783. NoIceWarpFound:
  2784. ${NSD_CreateLabel} 0 40 100% 80 "IceWarp was not reliably installed. Either the registry keys do not exist, or The Content.XML file does not exist in the Merak\config\ folder."
  2785. Pop $0
  2786. nsDialogs::Show
  2787. return
  2788. NoAlligateFound:
  2789. ${NSD_CreateLabel} 0 40 100% 80 "Alligate was not reliably installed. Registry keys do not exist. Please go back and select another install option."
  2790. Pop $0
  2791. nsDialogs::Show
  2792. return
  2793. NoImailFound:
  2794. ${NSD_CreateLabel} 0 40 100% 80 "IMail was not reliably installed. Registry keys do not exist. Please go back and select another install option."
  2795. Pop $0
  2796. nsDialogs::Show
  2797. return
  2798. NoSmarterMail:
  2799. ${NSD_CreateLabel} 0 40 100% 80 "Smartermail was not reliably installed. Registry keys do not exist. Please go back and select another install option."
  2800. Pop $0
  2801. nsDialogs::Show
  2802. return
  2803. NoMDaemon:
  2804. ${NSD_CreateLabel} 0 40 100% 80 "MDaemon was not reliably installed or registry keys do not exist. Please go back and select another install option."
  2805. Pop $0
  2806. nsDialogs::Show
  2807. return
  2808. FunctionEnd
  2809. ## ADDINGPLATFORM ## Step 21 These are the specific ( and somewhat redundant ) subs for validating each specific location. You can alter them
  2810. ## in order to satisfy the condition that all necessary files/folder exist. Otherwise, fail the compound enable variable, call check_CompoundEnable, and exit.
  2811. Function LocateIceWarpFolder
  2812. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2813. Pop $R0
  2814. ${If} $R0 != error
  2815. # NISIS 2.36
  2816. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2817. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2818. ${EndIf}
  2819. ifFileExists "$R0\config\content.xml" enableNext 0
  2820. MessageBox MB_OK "Unable to locate 'config\content.xml' in this selected folder. Please select the folder where [folder]\config\content.xml will resolve."
  2821. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2822. call check_CompoundEnable ; unenable.....
  2823. return
  2824. enableNext:
  2825. StrCpy $IceWarpInstallFolder $R0
  2826. ; but we can work with that either way.....
  2827. StrCpy $Compound_Enable2 "1"
  2828. call check_CompoundEnable ; unenable.....
  2829. return
  2830. FunctionEnd ;LocateIceWarpInstallFolder
  2831. Function LocateKerioFolder
  2832. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:Kerio Not Supported yet."
  2833. MessageBox MB_OK "Kerio is not yet supported."
  2834. FunctionEnd
  2835. Function LocateMailSiteFolder
  2836. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:MailSite Not Supported yet."
  2837. MessageBox MB_OK "MailSite is not yet supported."
  2838. FunctionEnd
  2839. Function LocateSNFInstallFolder
  2840. nsDialogs::SelectFolderDialog /NOUNLOAD $FindINSTDIRMessage $R0
  2841. Pop $R0
  2842. ${If} $R0 != error
  2843. # NISIS 2.36
  2844. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2845. SendMessage $SNF_SearchFor_LocationB ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2846. ${EndIf}
  2847. StrCmp $R0 "" 0 testNext ; Refuse to enable if not completed.... ( will need to have complete code for all folders.... i.e. validation screen)
  2848. EnableWindow $NextButton "0"
  2849. StrCpy $Compound_Enable1 "0" ; the default is you must declare at least the Sniffer directory....
  2850. return
  2851. testNext:
  2852. ; Here we have a challenge. The user can select the folder IN WHICH the SNF resides.../ will reside... or they can select the SNF folder itself.
  2853. ifFileExists "$R0\SNFClient.exe" 0 testForOldSniffer ; if true, this means it exists... and the user selected the Sniffer directory.
  2854. StrCpy $INSTDIR $R0 ; Store install folder.....
  2855. Goto enableNext
  2856. testForOldSniffer:
  2857. ifFileExists "$R0\snf2check.exe" 0 useThisFolder ; if true, this means it exists... and the user selected an older Sniffer directory.
  2858. StrCpy $INSTDIR $R0 ; Store install folder.....
  2859. Goto enableNext
  2860. useThisFolder:
  2861. ; ok, but we need to determine if the SNF folder was already created here...
  2862. ${GetParent} $R0 $R1 ; put the parent of the selected folder a the SNFServerInstallDir.... and leave the archiver to deal....
  2863. ifFileExists "$R1\SNF\*.*" 0 +3
  2864. StrCpy $INSTDIR $R0 ; User selected the SNF directory...
  2865. Goto EnableNext ; But for our install directory.....
  2866. ifFileExists "$R1\Sniffer\*.*" 0 +3
  2867. StrCpy $INSTDIR $R0 ; User selected the sniffer directory...
  2868. Goto EnableNext ; But for our install directory.....
  2869. ; Ok well can't find any normal files, so we'll presume we mean make it here....
  2870. StrCpy $INSTDIR "$R0\SNF" ; Store install folder.....
  2871. CreateDirectory $INSTDIR ; If its not here, then we'll create it, and set it to SNF...
  2872. enableNext:
  2873. SendMessage $SNF_SearchFor_LocationB ${WM_SETTEXT} 0 "STR:$INSTDIR" ; This is the look up for the SNIFFER Location....
  2874. StrCpy $Compound_Enable1 "1" ; the default is you must declare at least the Sniffer directory....
  2875. Call check_CompoundEnable
  2876. ; This gets called in checkCompoundEnable if all the components agree.....;EnableWindow $NextButton "1"
  2877. return
  2878. FunctionEnd ;LocateSNFInstallFolder
  2879. Function LocateSNF4AlligateFolder
  2880. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2881. Pop $R0
  2882. ${If} $R0 != error
  2883. # NISIS 2.36
  2884. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2885. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2886. ${EndIf}
  2887. ifFileExists "$R0\AGFiltSvc.exe" enableNext 0
  2888. MessageBox MB_OK "Unable to locate 'AGFiltSvc.exe' in the selected folder. Please select the folder where Alligate's AGFiltSvc.exe exists."
  2889. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2890. call check_CompoundEnable ; unenable.....
  2891. return
  2892. enableNext:
  2893. StrCpy $SNF4AlligateInstallFolder $R0 ; Store declude folder.....
  2894. ifFileExists "$SNF4AlligateInstallFolder\SNF4Alligate.exe" 0 +2
  2895. StrCpy $IsMINIMIInstalled "1"
  2896. ; but we can work with that either way.....
  2897. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2898. call check_CompoundEnable ; unenable.....
  2899. return
  2900. FunctionEnd
  2901. Function LocateMINIMIFolder
  2902. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2903. Pop $R0
  2904. ${If} $R0 != error
  2905. # NISIS 2.36
  2906. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2907. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2908. ${EndIf}
  2909. ifFileExists "$R0\SMTP32.exe" enableNext 0
  2910. MessageBox MB_OK "Unable to locate 'SMTP32.exe' in the selected folder. Please select the folder where IMails SMTP32.exe exists."
  2911. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2912. call check_CompoundEnable ; unenable.....
  2913. return
  2914. enableNext:
  2915. StrCpy $MINIMIInstallFolder $R0 ; Store declude folder.....
  2916. ifFileExists "$MINIMIInstallFolder\SNFIMailShim.exe" 0 +2
  2917. StrCpy $IsMINIMIInstalled "1"
  2918. ; but we can work with that either way.....
  2919. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2920. call check_CompoundEnable ; unenable.....
  2921. return
  2922. FunctionEnd
  2923. ##
  2924. Function LocateMDaemonFolder
  2925. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2926. Pop $R0
  2927. ${If} $R0 != error
  2928. # NISIS 2.36
  2929. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2930. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2931. ${EndIf}
  2932. ifFileExists "$R0\SpamAssassin\rules\*.*" nextTest 0
  2933. MessageBox MB_OK "Unable to locate the Spam Assassin rules folder in the chosen MDaemon install location. Please select the root MDaemon Folder."
  2934. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2935. call check_CompoundEnable ; unenable.....
  2936. return
  2937. nextTest:
  2938. ifFileExists "$R0\app\MDaemon.exe" enableNext 0
  2939. MessageBox MB_OK "Unable to locate the [Root]\App\MDaemon.exe folder in the chosen MDaemon install location. Please select the root MDaemon Folder."
  2940. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2941. call check_CompoundEnable ; unenable.....
  2942. return
  2943. enableNext:
  2944. StrCpy $MXGuardInstallFolder $R0 ; Store declude folder.....
  2945. StrCpy $IsMXGuardInstalled "1"
  2946. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2947. call check_CompoundEnable ; unenable.....
  2948. return
  2949. FunctionEnd
  2950. Function LocateMXGuardFolder
  2951. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2952. Pop $R0
  2953. ${If} $R0 != error
  2954. # NISIS 2.36
  2955. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2956. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2957. ${EndIf}
  2958. ifFileExists "$R0\mxguard.ini" enableNext 0
  2959. MessageBox MB_OK "Unable to locate 'mxguard.ini' in the selected folder. Please select the folder where MXGuards .ini file resides."
  2960. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2961. call check_CompoundEnable ; unenable.....
  2962. return
  2963. enableNext:
  2964. StrCpy $MXGuardInstallFolder $R0 ; Store declude folder.....
  2965. StrCpy $IsMXGuardInstalled "1"
  2966. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2967. call check_CompoundEnable ; unenable.....
  2968. return
  2969. FunctionEnd
  2970. Function LocateDecludeFolder
  2971. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2972. Pop $R0
  2973. ${If} $R0 != error
  2974. # NISIS 2.36
  2975. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2976. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2977. ${EndIf}
  2978. ifFileExists "$R0\global.cfg" enableNext 0
  2979. MessageBox MB_OK "Unable to locate 'global.cfg' in the selected folder. Please select the folder where Decludes global.cfg resides."
  2980. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2981. call check_CompoundEnable ; unenable.....
  2982. return
  2983. enableNext:
  2984. StrCpy $DecludeInstallFolder $R0 ; Store declude folder.....
  2985. StrCpy $IsDecludeInstalled "1"
  2986. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2987. call check_CompoundEnable ; unenable.....
  2988. return
  2989. FunctionEnd
  2990. Function LocateSmarterMailFolder
  2991. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2992. Pop $R0
  2993. ${If} $R0 != error
  2994. # NISIS 2.36
  2995. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2996. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2997. ${EndIf}
  2998. ifFileExists "$R0\global.cfg" enableNext 0
  2999. MessageBox MB_OK "Unable to locate 'global.cfg' in the selected folder. Please select the folder where Decludes global.cfg resides."
  3000. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  3001. call check_CompoundEnable ; unenable.....
  3002. return
  3003. enableNext:
  3004. StrCpy $DecludeInstallFolder $R0 ; Store declude folder.....
  3005. StrCpy $IsDecludeInstalled "1"
  3006. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  3007. call check_CompoundEnable ; unenable.....
  3008. return
  3009. FunctionEnd
  3010. ## ADDINGPLATFORM ## Step 22
  3011. ## Open the Restorer executable, and add all the file adjustment code there. ( Don't forget to use the rollback features to preserve any files that you
  3012. ## are touching, for the one time rollback. ( Continue the same keyword thread in that file, in order to complete this process. GL.
  3013. ##