選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

MessageSnifferInstaller2_1.nsi 187KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617
  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.2"
  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 IMail 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 ReportFalse
  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. ReportFalse:
  826. Return
  827. FunctionEnd
  828. Function SetInstallForMXGuard
  829. ; Currently, it doesn't matter where sniffer is for MXGuard, so
  830. ; we're going to put it at C:\MessageSniffer\MXGuard
  831. ;CreateDirectory "C:\MessageSniffer\"
  832. ;CreateDirectory "C:\MessageSniffer\MXGuardRoot" ; This will be where the SNFArchive goes for the MXGuard Install....
  833. ;StrCpy $MXGuardInstallFolder "C:\MessageSniffer\MXGuard"
  834. ;StrCpy $SNFServerInstallDir $MXGuardInstallFolder
  835. ;StrCpy $INSTDIR "$SNFServerInstallDir\SNF"
  836. FunctionEnd
  837. Function DetermineDeclude
  838. ; Declude is detected by the following methods:
  839. ; First you locate its defined registry call in the following key:
  840. ; HKLM SOFTWARE ComputerizedHorizons
  841. ; Relevant Keys from Declude: DecludeInstalled , MailConfigFilePath, RootMailPath, SmarterMailPath
  842. StrCpy $isDecludeInstalled "0" ; Default to no until proven otherwise.
  843. StrCpy $DecludeInstallFolder = "";
  844. ; Now detect Declude:
  845. ; This is useless, it comes in as "01" or something.... incomparable with -1-
  846. ; ReadRegStr $isDecludeInstalled HKLM "SOFTWARE\ComputerizedHorizons" "DecludeInstalled"
  847. ReadRegStr $DecludeInstallFolder HKLM "SOFTWARE\ComputerizedHorizons" "RootMailPath"
  848. StrCmp $DecludeInstallFolder "" ReportBad 0
  849. IfFileExists "$DecludeInstallFolderdeclude" 0 ReportBad ; the RootMailPath has an ending slash.
  850. StrCpy $isDecludeInstalled "1" ; Default to no until proven otherwise
  851. Return
  852. ReportBad:
  853. StrCpy $isDecludeInstalled "0" ; Default to no until proven otherwise
  854. Return
  855. ; The following items are of interest: DecludeInstalled 0 or 01
  856. ; MailConfigFilePath ( for smatermail will be SmarterMailServiceFolder/mailConfig.xml
  857. ; RootMailPath ( for smartermail will be C:\Smartermail\ ) Add "declude\" for declude folder
  858. ; SmarterMailPath ( For smartermail will be the service folder.)
  859. FunctionEnd ; end finding Declude
  860. Function SetInstallForDeclude
  861. ; NOTE: Declude puts a slash at the end of its root path key... so we need to remove the slash from the string
  862. StrCpy $1 $DecludeInstallFolder "" -1 ; get the last char.
  863. StrCmp $1 "\" 0 JustCopy ; if its a slash, then lop it off....
  864. StrCpy $DecludeInstallFolder $DecludeInstallFolder -1 ; Lop off last char.
  865. JustCopy:
  866. StrCpy $SNFServerInstallDir "$DecludeInstallFolder\declude" ; So we're going to install the SNF here....
  867. StrCpy $INSTDIR "$SNFServerInstallDir\SNF"
  868. FunctionEnd
  869. Function DetermineAlligate
  870. StrCpy $isAlligateInstalled "0" ; Default to no until proven otherwise.
  871. StrCpy $AlligateInstallFolder = "";
  872. ; Now detect Alligate:
  873. ReadRegStr $AlligateInstallFolder HKLM "SOFTWARE\SolidOak\Alligate\Settings" "InstallDir"
  874. StrCpy $AlligateInstallFolder $AlligateInstallFolder -1 ; lop last '\' off end of alligates paths.....
  875. ; If Alligate exists, get its folder:
  876. StrCmp $AlligateInstallFolder "" ReportBad 0
  877. StrCpy $isAlligateInstalled "1" ; Default to no until proven otherwise
  878. Return
  879. ReportBad:
  880. StrCpy $isAlligateInstalled "0" ; Default to no until proven otherwise
  881. Return
  882. Return
  883. FunctionEnd
  884. Function DetermineSmarterMail
  885. ; Smarter mail is detected by the following methods:
  886. ; First you locate its defined registry call in the following key:
  887. ; HKLM SOFTWARE SmarterTools SmarterMail InstallPath
  888. ; When found, you then look in that directory for the the Service Folder and open the mailConfig.xml file.
  889. ; And then you find the SpoolPath i.e.
  890. ; <spoolPath>c:\SmarterMail\Spool\</spoolPath>
  891. StrCpy $isSmarterMailInstalled "0" ; Default to no until proven otherwise.
  892. StrCpy $SmarterMailInstallFolder = "";
  893. ; Now detect SmarterMail:
  894. ReadRegStr $SmarterMailInstallFolder HKLM "SOFTWARE\SmarterTools\SmarterMail" "InstallPath"
  895. ; If Declude exists, get its folder:
  896. StrCmp $SmarterMailInstallFolder "" ReportBad 0
  897. StrCpy $isSmarterMailInstalled "1" ; Default to no until proven otherwise
  898. Return
  899. ReportBad:
  900. StrCpy $isSmarterMailInstalled "0" ; Default to no until proven otherwise
  901. Return
  902. ; This tells you where the Spool folder for SmarterMail folder is. Go up one directory and that is the root SmarterMail dir.
  903. ; This is where Declude will be installed if it is installed.
  904. ;
  905. return
  906. FunctionEnd
  907. Function DetermineImail
  908. StrCpy $isIMailInstalled "0" ; Default to no until proven otherwise.
  909. StrCpy $IMailInstallFolder = "";
  910. ; Now detect IMail:
  911. ReadRegStr $IMailInstallFolder HKLM "SOFTWARE\Ipswitch\Imail\Global" "TopDir"
  912. StrCmp $IMailInstallFolder "" ReportBad 0
  913. IfFileExists $IMailInstallFolder 0 ReportBad ; Check to see if path is valid.
  914. ; If Declude exists, get its folder:
  915. StrCpy $isIMailInstalled "1" ; Default to no until proven otherwise
  916. Return
  917. ReportBad:
  918. StrCpy $isIMailInstalled "0" ; Default to no until proven otherwise
  919. Return
  920. FunctionEnd
  921. Function DetermineInstallationPlatforms
  922. Call InitPlatformFlags
  923. ; This function determines and sets the flags on the installation platform options.
  924. ; We have several options available to us:
  925. ## ADDINGPLATFORM ## STEP 8 ADD LINE HERE TO CALL THE DetermineXYZPlatform option. This ensures that when the time comes to
  926. ## Check all the known/supported platforms, that the check gets run.
  927. ; First determine mail platforms.
  928. Call DetermineIMail
  929. Call DetermineSmarterMail
  930. Call DetermineAlligate
  931. ; Now determine implementation platforms.
  932. Call DetermineDeclude
  933. Call DetermineMXGuard
  934. Call DetermineMINIMI
  935. Call DetermineMDaemon
  936. FunctionEnd
  937. Function UninstallXYNTService
  938. ; This stops and uninstalls the XYNTService
  939. nsExec::Exec "NET STOP SNFService" "" SH_HIDE
  940. ifFileExists "$SNFServerInstallDir\SNF\XYNTService.exe" 0 +2
  941. nsExec::Exec "$SNFServerInstallDir\SNF\XYNTService -u" "" SH_HIDE ; This should run reguardless of where the master installer is located.
  942. ifFileExists "$SNFServerInstallDir\Sniffer\XYNTService.exe" 0 +2
  943. nsExec::Exec "$SNFServerInstallDir\Sniffer\XYNTService -u" "" SH_HIDE ; This should run reguardless of where the master installer is located.
  944. return
  945. FunctionEnd
  946. Function checkTelemetry
  947. ${GetBetween} "licenseid='" "'" "$INSTDIR\identity.xml" $LicenseID ; This makes it not brittly dependant on the default value. i.e. It would
  948. ${GetBetween} "authentication='" "'" "$INSTDIR\identity.xml" $Authentication
  949. ; first test for valid rulebase Status
  950. nsExec::Exec /TIMEOUT=700 '"$INSTDIR\snf2check.exe" "$INSTDIR\$LicenseID.snf" "$Authentication"' SH_HIDE
  951. pop $0
  952. ${If} $0 = "0"
  953. Detailprint " The Rulebase passes the snf2check.exe authentication."
  954. ${Else}
  955. Detailprint " Snf2check fails: "
  956. ${Switch} $0
  957. ${Case} "0"
  958. DetailPrint " SNFClient successfuly connected with SNFServer."
  959. Goto EndSNF2CheckTest
  960. ${Case} "65"
  961. DetailPrint " {65} ERROR_CMDLINE. SNF was called improperly."
  962. Goto EndSNF2CheckTest
  963. ${Case} "66"
  964. DetailPrint " {66}ERROR_LOGFILE Cannot open logfile."
  965. Goto EndSNF2CheckTest
  966. ${Case} "67"
  967. DetailPrint " {67} ERROR RULE FILE. Cannot open rules file."
  968. Goto EndSNF2CheckTest
  969. ${Case} "68"
  970. DetailPrint " {68} ERROR_RULE_DATA Cannot create pattern matrix."
  971. Goto EndSNF2CheckTest
  972. ${Case} "69"
  973. DetailPrint " {69} ERROR_MSG_FILE Cannot open message file."
  974. Goto EndSNF2CheckTest
  975. ${Case} "70"
  976. DetailPrint " {70} ERROR_ALLOCATION Allocation error during processing."
  977. Goto EndSNF2CheckTest
  978. ${Case} "71"
  979. DetailPrint " {71} ERROR_BAD_MATRIX Pattern trace went out of range."
  980. Goto EndSNF2CheckTest
  981. ${Case} "72"
  982. DetailPrint " {72} ERROR_MAX_EVALS The maximum number of evaluation paths was exceeded."
  983. Goto EndSNF2CheckTest
  984. ${Case} "73"
  985. DetailPrint " {73} ERROR_RULE_AUTH The rulebase file did not authenticate properly."
  986. Goto EndSNF2CheckTest
  987. ${Case} "99"
  988. DetailPrint " {99} ERROR_UNKNOWN"
  989. Goto EndSNF2CheckTest
  990. ${EndSwitch}
  991. EndSNF2CheckTest:
  992. ${EndIF}
  993. ifFileExists "$SNFServerInstallDir\App\MDaemon.exe" 0 +3
  994. Detailprint "MDaemon Install system check complete."
  995. return
  996. DetailPrint "Checking SNFService:"
  997. nsExec::Exec /TIMEOUT=700 "NET START SNFService" SH_HIDE
  998. pop $0
  999. ${Switch} $0
  1000. ${Case} "0"
  1001. DetailPrint " SNFService was started."
  1002. Goto EndSNFServiceTest
  1003. ${Case} "1"
  1004. DetailPrint " SNFService was not supported."
  1005. Goto EndSNFServiceTest
  1006. ${Case} "2"
  1007. DetailPrint " SNFService is running."
  1008. Goto EndSNFServiceTest
  1009. ${Case} "8"
  1010. DetailPrint " Unknown failure starting SNFService."
  1011. Goto EndSNFServiceTest
  1012. ${Case} "10"
  1013. DetailPrint " Installer has verified that SNFService is running."
  1014. Goto EndSNFServiceTest
  1015. ${EndSwitch}
  1016. EndSNFServiceTest:
  1017. ; These are the NET START return codes.
  1018. ; gs_service_status( 0) = "Success"
  1019. ; gs_service_status( 1) = "Not Supported"
  1020. ; gs_service_status( 2) = "Access Denied"
  1021. ; gs_service_status( 3) = "Dependent Services Running"
  1022. ; gs_service_status( 4) = "Invalid Service Control"
  1023. ; gs_service_status( 5) = "Service Cannot Accept Control"
  1024. ; gs_service_status( 6) = "Service Not Active"
  1025. ; gs_service_status( 7) = "Service Request Timeout"
  1026. ; gs_service_status( 8) = "Unknown Failure"
  1027. ; gs_service_status( 9) = "Path Not Found"
  1028. ; gs_service_status(10) = "Service Already Running"
  1029. ; gs_service_status(11) = "Service Database Locked"
  1030. ; gs_service_status(12) = "Service Dependency Deleted"
  1031. ; gs_service_status(13) = "Service Dependency Failure"
  1032. ; gs_service_status(14) = "Service Disabled"
  1033. ; gs_service_status(15) = "Service Logon Failure"
  1034. ; gs_service_status(16) = "Service Marked For Deletion"
  1035. ; gs_service_status(17) = "Service No Thread"
  1036. ; gs_service_status(18) = "Status Circular Dependency"
  1037. ; gs_service_status(19) = "Status Duplicate Name"
  1038. ; gs_service_status(20) = "Status Invalid Name"
  1039. ; gs_service_status(21) = "Status Invalid Parameter"
  1040. ; gs_service_status(22) = "Status Invalid Service Account"
  1041. ; gs_service_status(23) = "Status Service Exists"
  1042. ; gs_service_status(24) = "Service Already Paused"
  1043. Sleep 3000
  1044. DetailPrint "Waiting for SNFServer to spin up."
  1045. ; nsExec::ExecToLog /TIMEOUT=700 '$INSTDIR\SNFClient.exe -status.second'
  1046. nsExec::Exec /TIMEOUT=700 '$INSTDIR\SNFClient.exe -status.second' SH_HIDE ; This should run reguardless of where the master installer is located.
  1047. pop $0
  1048. ${Switch} $0
  1049. ${Case} "0"
  1050. DetailPrint " SNFClient successfuly connected with SNFServer."
  1051. Goto EndSNFClientTest
  1052. ${Case} "65"
  1053. DetailPrint " {65} ERROR_CMDLINE. SNF was called improperly."
  1054. Goto EndSNFClientTest
  1055. ${Case} "66"
  1056. DetailPrint " {66}ERROR_LOGFILE Cannot open logfile."
  1057. Goto EndSNFClientTest
  1058. ${Case} "67"
  1059. DetailPrint " {67} ERROR RULE FILE. Cannot open rules file."
  1060. Goto EndSNFClientTest
  1061. ${Case} "68"
  1062. DetailPrint " {68} ERROR_RULE_DATA Cannot create pattern matrix."
  1063. Goto EndSNFClientTest
  1064. ${Case} "69"
  1065. DetailPrint " {69} ERROR_MSG_FILE Cannot open message file."
  1066. Goto EndSNFClientTest
  1067. ${Case} "70"
  1068. DetailPrint " {70} ERROR_ALLOCATION Allocation error during processing."
  1069. Goto EndSNFClientTest
  1070. ${Case} "71"
  1071. DetailPrint " {71} ERROR_BAD_MATRIX Pattern trace went out of range."
  1072. Goto EndSNFClientTest
  1073. ${Case} "72"
  1074. DetailPrint " {72} ERROR_MAX_EVALS The maximum number of evaluation paths was exceeded."
  1075. Goto EndSNFClientTest
  1076. ${Case} "73"
  1077. DetailPrint " {73} ERROR_RULE_AUTH The rulebase file did not authenticate properly."
  1078. Goto EndSNFClientTest
  1079. ${Case} "99"
  1080. DetailPrint " {99} ERROR_UNKNOWN"
  1081. Goto EndSNFClientTest
  1082. ${EndSwitch}
  1083. EndSNFClientTest:
  1084. Detailprint "System test complete."
  1085. Return ; The Installed Restorer will have handled everything.
  1086. FunctionEnd
  1087. Section /o "New Install" g1o1
  1088. ; This uninstalls the XYNTService if it exists.
  1089. Call UninstallXYNTService
  1090. ; 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
  1091. ; in the root directory where the Archiver.exe or the Restorer.exe is going to be to give it a local reference.
  1092. Call OutputLocalRootInfoFile
  1093. ## ADDINGPLATFORM ## STEP 9 If you're install requires you to bounce a dependant service after doing all the installs,
  1094. ## ensure that that happens here.
  1095. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle1
  1096. ifFileExists "$MDaemonInstallFolder\App\MDaemon.exe" 0 TestNextHandle1
  1097. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1098. Sleep 1000
  1099. ;nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1100. ;Sleep 1000
  1101. TestNextHandle1:
  1102. StrCmp $isSNF4AlligateInstalled "1" 0 Handlenext1
  1103. nsExec::Exec 'net stop AgSMTPSvc' "" SH_HIDE
  1104. Sleep 1000
  1105. Handlenext1:
  1106. StrCmp $isMINIMIInstalled "1" 0 TestNext1
  1107. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1108. Sleep 1000
  1109. Testnext1:
  1110. StrCmp $isDecludeInstalled "1" 0 +2
  1111. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1112. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1113. SetOutPath $INSTDIR ; determines where to put the Restorer/Installer
  1114. File "Restorer.exe" ; Unpack the files.
  1115. ExecWait "$INSTDIR\Restorer.exe -F" ; Execute it.
  1116. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle
  1117. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1118. Sleep 3000
  1119. nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1120. Sleep 1000
  1121. TestNextHandle:
  1122. StrCmp $isSNF4AlligateInstalled "1" 0 Handlenext
  1123. nsExec::Exec 'net stop AgSMTPSvc' "" SH_HIDE
  1124. Sleep 1000
  1125. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /start' ; this will start it up with the reset FilterEXE registry settings.
  1126. Sleep 1000
  1127. nsExec::Exec 'net start AgSMTPSvc' "" SH_HIDE
  1128. Sleep 1000
  1129. Handlenext:
  1130. StrCmp $isMINIMIInstalled "1" 0 TestNext
  1131. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1132. Sleep 1000
  1133. nsExec::Exec 'NET START "IMail SMTP Server"' "" SH_HIDE
  1134. Sleep 1000
  1135. Testnext:
  1136. StrCmp $isDecludeInstalled "1" 0 ThenQuit
  1137. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1138. Sleep 1000
  1139. nsExec::Exec "NET START Decludeproc" "" SH_HIDE
  1140. ThenQuit:
  1141. call checkTelemetry
  1142. return
  1143. SectionEnd
  1144. Section /o "Install Fresh (Discard local configuration.)" g1o2
  1145. ; This uninstalls the XYNTService if it exists.
  1146. Call UninstallXYNTService
  1147. ; The decision tree here is do we want to maintain the configuration file, or blow it away.
  1148. ; this section is for blowing it away. We do record a rollback.
  1149. StrCpy $CustomFolderName "" ; Leaving this as empty string means Just use the default naming convention inside ArchiveSnapshot.
  1150. ; 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
  1151. ; in the root directory where the the Restorer.exe is going to be to give it a local reference.
  1152. Call OutputLocalRootInfoFile ; This needed to be done before you archive in order to get the LocalRoot.txt file included.
  1153. ; Now create the folder to dump the Restorer.exe into.
  1154. ifFileExists "$INSTDIR\*.*" +2 0
  1155. CreateDirectory "$INSTDIR" ; create folder.
  1156. ## ADDINGPLATFORM ## STEP 9B If you're install requires you to bounce a dependant service after doing all the installs,
  1157. ## ensure that that happens here as well as at #9.
  1158. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle
  1159. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1160. Sleep 1000
  1161. TestNextHandle:
  1162. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 Handlenext
  1163. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /Stop' "" SH_HIDE ; this will stop it and release the SNF4Alligate.exe file.
  1164. Sleep 1000
  1165. nsExec::Exec 'net stop AgSMTPSvc' SH_HIDE
  1166. Sleep 1000
  1167. Handlenext:
  1168. StrCmp $isDecludeInstalled "1" 0 +2
  1169. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1170. ; Exract the files.
  1171. SetOutPath $INSTDIR
  1172. File "Restorer.exe" ; Unpack the files.
  1173. SetOutPath $SNFServerInstallDir
  1174. ExecWait "$INSTDIR\Restorer.exe -F" ; execute it for fresh install.
  1175. ;nsExec::Exec 'NET START "SNFService"' "" SH_HIDE
  1176. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 Handlenext2
  1177. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /start' "" SH_HIDE ; this will start it up with the reset FilterEXE registry settings.
  1178. Sleep 1000
  1179. nsExec::Exec 'net start AgSMTPSvc' "" SH_HIDE
  1180. Sleep 1000
  1181. Handlenext2:
  1182. StrCmp $isMINIMIInstalled "1" 0 TestNext2
  1183. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1184. Sleep 1000
  1185. nsExec::Exec 'NET START "IMail SMTP Server"' "" SH_HIDE
  1186. Sleep 1000
  1187. Testnext2:
  1188. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle2
  1189. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1190. Sleep 3000
  1191. nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1192. Sleep 1000
  1193. TestNextHandle2:
  1194. StrCmp $isDecludeInstalled "1" 0 ThenQuit
  1195. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1196. nsExec::Exec "NET START Decludeproc" "" SH_HIDE
  1197. ThenQuit:
  1198. call checkTelemetry
  1199. return
  1200. SectionEnd
  1201. Section /o "Upgrade (Retain existing settings.)" g1o3
  1202. ; The decision tree here is do we want to maintain the configuration file, or blow it away.
  1203. ; this section is for blowing it away. We do archive
  1204. ;Stop the service if its working.
  1205. Call UninstallXYNTService
  1206. ; 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
  1207. ; in the root directory where the Archiver.exe or the Restorer.exe is going to be to give it a local reference.
  1208. Call OutputLocalRootInfoFile ; This needed to be done before you archive in order to get the LocalRoot.txt file included.
  1209. ############################################################
  1210. ; Now create the folder to dump the Restorer.exe into.
  1211. IfFileExists "$INSTDIR\*.*" +2 0
  1212. CreateDirectory "$INSTDIR" ; create folder if it doesn't exist. ( Meaning that the older sniffer files are left behind. )
  1213. ## ADDINGPLATFORM ## STEP 9C If you're install requires you to bounce a dependant service after doing all the installs,
  1214. ## ensure that that happens here as well as at #9 and #9B.
  1215. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle
  1216. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1217. Sleep 3000
  1218. ;nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1219. ;Sleep 1000
  1220. TestNextHandle:
  1221. StrCmp $isSNF4AlligateInstalled "1" 0 Handlenext
  1222. nsExec::Exec 'net stop AgSMTPSvc' "" SH_HIDE
  1223. Sleep 1000
  1224. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /stop' "" SH_HIDE
  1225. Sleep 1000 ; this will stop it and release the SNF4Alligate.exe file.
  1226. Handlenext:
  1227. ; Exract the files.
  1228. SetOutPath $INSTDIR
  1229. File "Restorer.exe" ; Unpack the files.
  1230. SetOutPath $SNFServerInstallDir
  1231. 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.
  1232. ;nsExec::Exec 'NET START "SNFService"' "" SH_HIDE
  1233. StrCmp $isMDaemonInstalled "1" 0 TestNextHandle2
  1234. nsExec::Exec 'NET STOP MDAEMON' "" SH_HIDE
  1235. Sleep 1000
  1236. nsExec::Exec 'net start MDAEMON' "" SH_HIDE
  1237. Sleep 1000
  1238. TestNextHandle2:
  1239. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 Handlenext3
  1240. nsExec::Exec '"$SNF4AlligateInstallFolder\AGFiltSvc.exe" /start' "" SH_HIDE
  1241. Sleep 1000 ; this will start it up with the reset FilterEXE registry settings.
  1242. nsExec::Exec 'net start AgSMTPSvc' "" SH_HIDE
  1243. Sleep 1000
  1244. Handlenext3:
  1245. ; If its a MINIMI install, bounce the IMAIL SMTP
  1246. StrCmp $isMINIMIInstalled "1" 0 TestNext
  1247. nsExec::Exec 'NET STOP "IMail SMTP Server"' "" SH_HIDE
  1248. Sleep 1000
  1249. nsExec::Exec 'NET START "IMail SMTP Server"' "" SH_HIDE
  1250. Sleep 1000
  1251. Testnext:
  1252. StrCmp $isDecludeInstalled "1" 0 ThenQuit
  1253. nsExec::Exec "NET STOP Decludeproc" "" SH_HIDE
  1254. nsExec::Exec "NET START Decludeproc" "" SH_HIDE
  1255. ThenQuit:
  1256. call checkTelemetry
  1257. return
  1258. SectionEnd
  1259. ; NOTE, if this doesn't exist in the current install, it must be greyed out.... or not displayed.
  1260. Section /o "Archive Utility" g1o4
  1261. ; The Intermediate archive display
  1262. ; page handles this in the event flow. By this point theres nothing to do.
  1263. SectionEnd
  1264. Section /o "Restore Utility" g1o5
  1265. ## This section is stubbed.
  1266. SectionEnd
  1267. ; NOTE, Same for this.... can't fire it, if it doesn't exist.
  1268. Section /o "Remove Install" g1o6
  1269. ; By this point, its been handled, so there's nothign to do. This response is handled
  1270. ; in the callback funciton of hte components selection page.
  1271. SectionEnd
  1272. Section /o "Status Viewer" g1o6B
  1273. ; Nothing happenes here. This is here to enable it to show up in the sections components viewer page.
  1274. SectionEnd
  1275. ;SectionGroupEnd
  1276. ;--------------------------------
  1277. ; Functions for control of components selection
  1278. ; $1 stores the status of group 1
  1279. ; $2 stores the status of group 2
  1280. ; Ok, this list is going to become a little different. We'e not detecting and displaying available options, we'e offeing options
  1281. ; ( 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
  1282. ; next custom page which will properly locate all the files.... )
  1283. ;SectionGroup /e "Platform Options" GRP_2
  1284. ## ADDINGPLATFORM ## STEP 10 This is very important. You must add an optional section ( indicated by the /o ) for your new platform.
  1285. ## 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
  1286. ## 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.
  1287. ## The placment order affects which number is returned when the user clicks it.
  1288. ## 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'.
  1289. ## So at the end of this list, add your new one.
  1290. ## ADDINGPLATFORM ## STEP 10B Give it a unique option name that is meaningful.
  1291. ## 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.
  1292. ## This became impossible to keep track after five or six options, so clearer names were swapped in.
  1293. ## ADDINGPLATFORM ## STEP 10C pay attention to where in the list you put your new option.
  1294. ## 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.
  1295. Section /o "Imail w/ Declude Install" gIWDI ; g1o7 Imail w/ Declude Install
  1296. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1297. ; MessageBox MB_OK "Selected Imail Declude option."
  1298. SectionEnd
  1299. Section /o "Imail MXGuard Install" gIMXI ; g1oA Imail w/ MXGuard Install
  1300. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1301. ;MessageBox MB_OK "Selected Imail MXGuard option."
  1302. SectionEnd
  1303. Section /o "Imail w/MINIMI for SNF" gIMMI ; g1o7B Imail MiniMi Install
  1304. ; Nothing happenes here. This is here to enable it to show up in the sections components viewer page.
  1305. SectionEnd
  1306. Section /o "SmarterMail w/ Declude Install" gSWDI ; g1o8 Smartermail W/ Declude 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 SmarterMail Declude option."
  1309. SectionEnd
  1310. Section /o "SmarterMail MXGuard Install" gSMXI ; g1oA2 Smartermail W/ MXGuard Install
  1311. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1312. ;MessageBox MB_OK "Selected Imail MXGuard option."
  1313. SectionEnd
  1314. Section /o "Alligate Install" gAWDI ; g1o9 Alligate w/
  1315. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1316. ;MessageBox MB_OK "Selected Alligate Declude option."
  1317. SectionEnd
  1318. SectionGroup /e "IceWarp" gIW
  1319. Section /o "IceWarp in ~A.V.~ position" gIWTI ; IcewWarp Tie In ( In AntiVirus Position )
  1320. ; this is the tie in to Icewarp via the filter. It may be expand with the IceWarp .dll tie in.
  1321. SectionEnd
  1322. Section /o "IceWarp As Custom-Filter (y/n) " gIWTICF ; IceWarp Tie In Custom Filter
  1323. ; this is the tie in to Icewarp via the filter. It may be expand with the IceWarp .dll tie in.
  1324. SectionEnd
  1325. Section /o "IceWarp As Custom-Filter (+5)" gIWTICF2 ; IceWarp Tie In Custom Filter 2
  1326. ; this is the tie in to Icewarp via the filter. It may be expand with the IceWarp .dll tie in.
  1327. SectionEnd
  1328. SectionGroupEnd
  1329. Section /o "MailSite Install" gMSI
  1330. ; this is the tie in to MailSite.
  1331. SectionEnd
  1332. Section /o "Kerio Mail Install" gKMI
  1333. ; this is the tie in to Kerio.
  1334. SectionEnd
  1335. Section /o "MDaemon Install" gMDDLL
  1336. ; this section is to tie in and install the dll for the MDaemon Mail Site.
  1337. SectionEnd
  1338. Section /o "Default SNF Install / Sniffer Install" gSNFI ; g1oB
  1339. ; This means that we made a fresh SNF folder and we're going to insert the files there.
  1340. ;MessageBox MB_OK "Selected DefaultSNF option."
  1341. SectionEnd
  1342. Section /o "Unknown Server - Declude Install" gUSWDI ; g1oC
  1343. ; Can't recognize what host is using Declude, but declude is there....
  1344. ; MessageBox MB_OK "Selected DefaultSNF option."
  1345. SectionEnd
  1346. Section /o "Other (custom/unknown combination)" gCUKC ; MDI_mx
  1347. SectionEnd
  1348. Function InitPlatformFlags
  1349. ; Used to clear the setup flags.
  1350. ## ADDINGPLATFORM ## STEP 11 Add a clear command here so when you want all the init flags to be cleared, they will all clear together.
  1351. StrCpy $isIceWarpInstalled "0"
  1352. StrCpy $isMailSiteInstalled "0"
  1353. StrCpy $isKerioInstalled "0"
  1354. StrCpy $isImailInstalled "0"
  1355. StrCpy $isSmarterMailInstalled "0"
  1356. StrCpy $isAlligateInstalled "0"
  1357. StrCpy $isDecludeInstalled "0"
  1358. StrCpy $isMXGuardInstalled "0"
  1359. StrCpy $isMINIMIInstalled "0"
  1360. StrCpy $isMDaemonInstalled "0"
  1361. StrCpy $SelectedCaseIndexForPlatformScreen "0" ; undetermined.
  1362. FunctionEND
  1363. Function ResetSectionNames
  1364. ; Used to reset the cleared section flags.
  1365. ## 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
  1366. ## to define the section in step 10a. The scripting program makes an option unavailable by clearing this text field. You need to have
  1367. ## 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.
  1368. SectionSetText ${g1o1} "New Install"
  1369. SectionSetText ${g1o2} "Install Fresh (Discard local configuration.)"
  1370. SectionSetText ${g1o3} "Upgrade (Retain existing settings.)"
  1371. SectionSetText ${g1o4} "Archive Utility"
  1372. SectionSetText ${g1o5} "Rollback Altered Files"
  1373. SectionSetText ${g1o6} "Remove Install"
  1374. SectionSetText ${g1o6B} "Status Viewer"
  1375. SectionSetText ${gIWDI} "Imail w/ Declude Install" ; g1o7
  1376. SectionSetText ${gIMXI} "Imail MXGuard Install" ; g1oA
  1377. SectionSetText ${gIMMI} "Imail w/MINIMI for SNF" ; g1o7B
  1378. SectionSetText ${gSWDI} "SmarterMail w/ Declude Install" ; g1o8
  1379. SectionSetText ${gSMXI} "SmarterMail MXGuard Install" ; g1oA2
  1380. SectionSetText ${gAWDI} "Alligate Install" ; g1o9
  1381. SectionSetText ${gIW} "IceWarp" ; g1o7
  1382. SectionSetText ${gIWTI} "IceWarp in ~A.V.~ position" ; g1o9
  1383. SectionSetText ${gIWTICF} "IceWarp as Content-Filter (y/n)"
  1384. SectionSetText ${gIWTICF2} "IceWarp as Content-Filter (+5)"
  1385. ;SectionSetText ${gMSI} "MailSite Install" ; g1o9
  1386. SectionSetText ${gMSI} "" ; g1o9
  1387. SectionSetText ${gKMI} "Kerio Install" ; g1o9
  1388. SectionSetText ${gMDDLL} "MDaemon Install" ; gMDDLL
  1389. SectionSetText ${gSNFI} "" ;SectionSetText ${gSNFI} "Default SNF Install / Sniffer Install" ; g1oB
  1390. SectionSetText ${gUSWDI} "" ;SectionSetText ${gUSWDI} "Unknown Server - Declude Install" ; g1oC
  1391. SectionSetText ${gCUKC} "Other (custom/unknown combination)" ; MDI_mx
  1392. FunctionEND
  1393. Function .onInit
  1394. ## Test for useable Service wrapper that this installer can hijack and control ( i.e. It was installed with this Installer,
  1395. ## even if its on a differing platform.
  1396. nsExec::Exec /TIMEOUT=1500 "NET STOP SNFService"
  1397. pop $0
  1398. StrCmp $0 "0" 0 NotStoppable ; needs to return zero to be known and available.....if not, inconclusive...
  1399. ## Service was stoppable. Not start it.
  1400. nsExec::Exec /TIMEOUT=1500 "NET START SNFService" SH_HIDE
  1401. pop $0
  1402. Goto FineToRunInstaller ; To be clean this needs to return zero also....
  1403. NotStoppable:
  1404. ## Wasn't running (Inconclusive) so we must test for SNFServer.exe and if so... tell them to manually stop the service/server first.
  1405. SetOutPath $Temp
  1406. ifFileExists "$Temp\SNFCLient.exe" +2 0
  1407. File "SNFClient.exe"
  1408. nsExec::Exec /TIMEOUT=1500 "$Temp\SNFClient.exe -status.second" SH_HIDE
  1409. pop $0
  1410. StrCmp $0 "0" 0 +3
  1411. MessageBox MB_OK "SNFServer was detected running on this system. You must stop the SNFServer in order to run this installer."
  1412. Quit
  1413. Delete "$Temp/SNFClient.exe"
  1414. SetOutPath $INSTDIR
  1415. FineToRunInstaller:
  1416. ; Ensure the utility manager only has one instance running at a time.
  1417. System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Sniffer Untility Mng") i .r1 ?e'
  1418. Pop $R0
  1419. StrCmp $R0 0 +3
  1420. MessageBox MB_OK|MB_ICONEXCLAMATION "The Message Sniffer Utility Manager is already running."
  1421. Abort
  1422. InitPluginsDir ; this is needed in order to use the plugins dir for the splash pictures.......
  1423. SetOutPath "$PLUGINSDIR" ; set the folder for unpacking the pictures...
  1424. ; Modal banner sample: show
  1425. File "SnifferSplash.bmp"
  1426. newadvsplash::show 3000 100 500 0x04025C "$PLUGINSDIR\SnifferSplash.bmp"
  1427. Sleep 1000 ; optional
  1428. Delete "$PLUGINSDIR\SnifferSplash.bmp"
  1429. ; Ok, enough gratuitous logo flashing... get to work....
  1430. ; Reset these vars for the FindApplication screen that may or maynot be used.
  1431. 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.
  1432. StrCpy $FindApplicationMessage "" ; if you want to customize the message you do that here. Set to blank for default.
  1433. StrCpy $MissingApplicationFolder "" ; if you have a starting point, stick it here... otherwise leave it blank.
  1434. StrCpy $Find_Explanation_INFO "" ; if you want a verbose instruction put it here.
  1435. ; Preset other navigation flow flags.
  1436. StrCpy $ArchivesAvailable "0" ; Defaulting to no, but will hold if there is an SNFArchives folder....
  1437. StrCpy $ShowRestoreOptionsPage "0" ; Default is true, unless proven otherwise, by no archives folder.
  1438. StrCpy $HandleUninstallPage "0" ; Execute the uninstall page is set to no by default, unless user selects the uninstall path on the 2nd Components page.
  1439. StrCpy $ShowTelemetryPage "0" ; Default is to ignore the status page.
  1440. ; Preset installation flags;
  1441. StrCpy $PreviousSnifferInstalled "0" ; Until proven otherwise, there is no previously installed sniffer engine.
  1442. StrCpy $MessageSnifferRestoreDir "" ; Fresh Install until restore archive is selected.
  1443. StrCpy $OldVersionOfSniffer "0" ; This is used to flag if we're dealing with the first install after an old sniffer folder.
  1444. StrCpy $currentPlatformSelection "55" ; default the option for the PlatformSelection to the Unknown Server install.
  1445. StrCpy $currentUtilitySelection "0" ; default the utility to NEW
  1446. StrCpy $Set_For_MINIMI_INSTALL "0" ; default the utilitn to not installing MINIMI
  1447. StrCpy $Set_For_SNF4Alligate_INSTALL "0" ; default the utilitn to not installing MINIMI
  1448. ; This will set the flags for what is displayable in the 1st components screen.. ( Platforms... ) Based on what they select there,
  1449. ; the exit function will determine and set the "INSTDIR...." and the Archives flags....
  1450. Call DetermineInstallationPlatforms ; This will determine what installations are available for display.
  1451. ; Obviously not all recognized email platforms will be displayed if they're not installed....
  1452. ; At this point, the above call nas determined
  1453. FunctionEnd
  1454. ############################################
  1455. ## 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.
  1456. ############################################
  1457. Function setBestPlatformGuess
  1458. FunctionEnd
  1459. #########################
  1460. ## setupPlatforms is called prior to the display of the first custom page.
  1461. ## This will check and setup the flags for the available items, and set the selected ones.
  1462. ## This was important to have in its own function and not in the init because of BACK... it was remembering the selection, and
  1463. ## not obeying the single selection option handler. So we had to reinit the page each time before its viewed.
  1464. Function setupPlatforms
  1465. ; 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.
  1466. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Platform Selection:"
  1467. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  1468. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Server 3.0 Install Utility:"
  1469. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  1470. Call ResetSectionNames ; This puts ALL the names back...
  1471. StrCpy $BaseRadioDefault $currentPlatformSelection ; This sets the platform default and seeds the onSelectChange macro selection.
  1472. ; onInit sets first one to 11 - SNFStandalone
  1473. ;
  1474. ; Make sure nothing that is being hidden is selected... this creates null-ignored clicks and wierd user interaction.
  1475. ; because of the modality of the radio buttons... ( even though not all options are being displayed, they're all there 1 - 12 of them
  1476. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked.
  1477. !insertmacro UnselectSection ${g1o2}
  1478. !insertmacro UnselectSection ${g1o3}
  1479. !insertmacro UnselectSection ${g1o4}
  1480. !insertmacro UnselectSection ${g1o5}
  1481. !insertmacro UnselectSection ${g1o6}
  1482. ; 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
  1483. ; platform references.
  1484. !insertmacro UnselectSection ${g1o6B} ; because this will be index 13..... so it must come after g1oC which is 12....
  1485. ;Of course, don't display install options on platform screen
  1486. SectionSetText ${g1o1} ""
  1487. SectionSetText ${g1o2} ""
  1488. SectionSetText ${g1o3} ""
  1489. SectionSetText ${g1o4} ""
  1490. SectionSetText ${g1o5} ""
  1491. SectionSetText ${g1o6} ""
  1492. SectionSetText ${g1o6B} ""
  1493. StrCmp $SelectedCaseIndexForPlatformScreen "0" 0 LeaveEnabled
  1494. ;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:
  1495. ; Disable the next button until selection is made.
  1496. Var /GLOBAL NextButton
  1497. GetDlgItem $NextButton $HWNDPARENT 1
  1498. EnableWindow $NextButton "0"
  1499. LeaveEnabled:
  1500. #################################################################################
  1501. ; NOTE: THE UNKNOWN DECLUDE OPTION WAS HIDDEN AND DEPRECATED.....
  1502. Var /GLOBAL testUnknownDeclude ; Use this to flag if we intend to use the unknownDeclude option
  1503. StrCpy $testUnknownDeclude "1" ; The only time we don't-test is if we can identify WHICH declude
  1504. ; So for the first time through....in addition to disabling the next button, we can just breeze through clearly the checkboxes.
  1505. ; First off: Show the platform options.
  1506. #################################################################################
  1507. ## ADDINGPLATFORM ## STEP 15 This is the platforms setup screen. We need to have the new platform be available for selection, so we do that
  1508. ## by adding it to the UnselectedSection list with the macros. If you use SectionSetText #NAME "" you are clearing the name, and it won't
  1509. ## show up in the displayed list. To have it show up as unselected, add the UnselectedSectionLine. ( You could add it selected too.. but
  1510. ## that gets annoying for a variety of reasons, so we default to everything off. Remember to keep it in the right list order. )
  1511. ; We'll always show these options...
  1512. ; the new paradigm is to show, and then attempt to check the intended one, and then alter the paths after the fact.....
  1513. !insertmacro UnselectSection ${gIWDI} ; g1o7
  1514. !insertmacro UnselectSection ${gIMXI} ; g1oA
  1515. !insertmacro UnselectSection ${gIMMI} ; g1o7B
  1516. !insertmacro UnselectSection ${gSWDI} ; g1o8
  1517. !insertmacro UnselectSection ${gSMXI} ; g1oA2
  1518. !insertmacro UnselectSection ${gAWDI} ; g1o9
  1519. SectionSetText ${gSNFI} "" ; not using this feature yt.
  1520. #!insertmacro UnselectSection ${gSNFI} ; g1oB
  1521. SectionSetText ${gUSWDI} "" ; !insertmacro UnselectSection ${gUSWDI} ; g1oC
  1522. !insertmacro UnselectSection ${gIWTI} ; Icewarp AS AV
  1523. !insertmacro UnselectSection ${gIWTICF} ; "IceWarp as Content-Filter (y/n)"
  1524. !insertmacro UnselectSection ${gIWTICF2} ; as Spam Score Contributer
  1525. #!insertmacro UnselectSection ${gMSI} ; MailSite
  1526. SectionSetText ${gMSI} ""
  1527. #!insertmacro UnselectSection ${gKMI} ; Kerio Mail Server
  1528. SectionSetText ${gKMI} ""
  1529. !insertmacro UnselectSection ${gMDDLL} ; MDaemon Dll option.
  1530. !insertmacro UnselectSection ${gCUKC} ; custom unknown combination
  1531. ; NOTE: ALl clears need to go ahead of the switch, cause we exit immediately after we've found a selection that was set.
  1532. ; - this would indicate a back event... (if $SelectedCaseIndexForPlatformScreen was set).......
  1533. ## ADDINGPLATFORM ## STEP 16 Add your newe platform in this switch statement in order to properly key on a preexisting selection,
  1534. ## 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
  1535. ## key as well as the keyname in brackets ${ THIS }
  1536. ; But if we HAVE one selected, we need to case through them, and only clear the ones that aren't selected:
  1537. ${Switch} $SelectedCaseIndexForPlatformScreen
  1538. ${Case} "gIWDI"
  1539. !insertmacro SelectSection ${gIWDI} ; g1o7
  1540. Return
  1541. ${Case} "gIMXI"
  1542. !insertmacro SelectSection ${gIMXI} ; g1oA
  1543. Return
  1544. ${Case} "gIMMI"
  1545. !insertmacro SelectSection ${gIMMI} ; g1o7B
  1546. Return
  1547. ${Case} "gSWDI"
  1548. !insertmacro SelectSection ${gSWDI} ; g1o8
  1549. Return
  1550. ${Case} "gSMXI"
  1551. !insertmacro SelectSection ${gSMXI} ; g1oA2
  1552. Return
  1553. ${Case} "gAWDI"
  1554. !insertmacro SelectSection ${gAWDI} ; g1o9
  1555. Return
  1556. ${Case} "gIWTI"
  1557. !insertmacro SelectSection ${gIWTI} ; Icewarp as AV position
  1558. Return
  1559. ${Case} "gIWTICF"
  1560. !insertmacro SelectSection ${gIWTICF} ; Icewarp as content filter
  1561. Return
  1562. ${Case} "gIWTICF2"
  1563. !insertmacro SelectSection ${gIWTICF2} ; Icewarp as spam score contributer
  1564. Return
  1565. ${Case} "gMSI"
  1566. #!insertmacro SelectSection ${gMSI} ; MailSite
  1567. Return
  1568. ${Case} "gKMI"
  1569. !insertmacro SelectSection ${gKMI} ; Kerio Mail
  1570. Return
  1571. ${Case} "gMDDLL"
  1572. !insertmacro SelectSection ${gMDDLL} ; MDaemon Mail
  1573. Return
  1574. ${Case} "gSNFI" ; NOT USEING THIS OPTION
  1575. !insertmacro UnselectSection ${gSNFI} ; g1o9
  1576. #!insertmacro SelectSection ${gSNFI} ; g1oB
  1577. Return
  1578. ${Case} "gUSWDI" ; NOT USEING THIS OPTION
  1579. !insertmacro SelectSection ${gUSWDI} ; g1oC
  1580. Return
  1581. ${Case} "gCUKC"
  1582. !insertmacro SelectSection ${gCUKC} ;
  1583. Return
  1584. ${Default}
  1585. ; If we get here, we have an unusual situation that leaks through. Don't let them through without a selection being defined.
  1586. EnableWindow $NextButton "0"
  1587. ${EndSwitch}
  1588. ; 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
  1589. ; need to make our best attempt at a guess.
  1590. ; here would be where we need to have made our best guess as to the install that seems to make the most sense:
  1591. call setBestPlatformGuess
  1592. FunctionEnd
  1593. #########################
  1594. ## setupComponents2 is called prior to the display of the components page. It will setup the empty or the unselected lists.
  1595. ## This was important to have in its own function and not in the init because of BACK... it was remembering the selection, and
  1596. ## not obeying the single selection option handler. So we had to reinit the page each time before its viewed.
  1597. Function setupComponents2
  1598. ;Var /GLOBAL NextButton
  1599. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Server 3.0 Install Utility:"
  1600. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  1601. ; Disable the next button until selection is made.
  1602. GetDlgItem $NextButton $HWNDPARENT 1
  1603. EnableWindow $NextButton "0"
  1604. ; We need to set the default radio button for the Utilities component view of the sections options now..
  1605. StrCpy $BaseRadioDefault $currentUtilitySelection ; This sets the platform default onIniti starts it on NEW but we may change that further down.....
  1606. Call ResetSectionNames ; This puts ALL the names back...
  1607. ## ADDINGPLATFORM ## STEP 13 Add your platform here, as an Unselected Section Call. ( To clear it from being selected. )
  1608. ## There is only one section list, but we screen it differently for the activities vs the platforms.
  1609. ## This is the first time, you see the ordinal commented. Remember to keep the order,
  1610. ## 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.
  1611. ; this makes sure there isn't anything selected thats hiding...
  1612. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked. 0
  1613. !insertmacro UnselectSection ${g1o2} ; none of the chekcboxes should be checked. 1
  1614. !insertmacro UnselectSection ${g1o3} ; none of the chekcboxes should be checked. 2
  1615. !insertmacro UnselectSection ${g1o4} ; none of the chekcboxes should be checked. 3
  1616. !insertmacro UnselectSection ${g1o5} ; none of the chekcboxes should be checked. 4
  1617. !insertmacro UnselectSection ${g1o6} ; none of the chekcboxes should be checked. 5
  1618. !insertmacro UnselectSection ${g1o6B} ; none of the chekcboxes should be checked. - This is status index 13 6
  1619. !insertmacro UnselectSection ${gIW}
  1620. !insertmacro UnselectSection ${gIWDI} ; g1o7 #7 is Imail with Declude
  1621. !insertmacro UnselectSection ${gIMXI} ; g1oA #8 is Imail with MXGuard
  1622. !insertmacro UnselectSection ${gIMMI} ; g1o7B #9 is IMail with MINIMI
  1623. !insertmacro UnselectSection ${gSWDI} ; g1o8 #10 is SmarterMail with Declude
  1624. !insertmacro UnselectSection ${gSMXI} ; g1oA2 #11 is SmarterMail with MXGuard
  1625. !insertmacro UnselectSection ${gAWDI} ; g1o9 #12 is Alligate
  1626. ; 13 is the SectionGroup
  1627. !insertmacro UnselectSection ${gIWTI} ; g1o9 #14 is Icewarp as AV position
  1628. !insertmacro UnselectSection ${gIWTICF} ; g1o9 #15 is Icewarp as content filter
  1629. !insertmacro UnselectSection ${gIWTICF2} ; g1o9 #16 is Icewarp as Spam Score contributer
  1630. !insertmacro UnselectSection ${gMSI} ; g1o9 #18 is MailSite
  1631. !insertmacro UnselectSection ${gKMI} ; g1o9 #19 is Kerio
  1632. !insertmacro UnselectSection ${gMDDLL} ; MDaemon Install #20 is SNF stand alone
  1633. !insertmacro UnselectSection ${gSNFI} ; g1oB #21 is SNF stand alone
  1634. !insertmacro UnselectSection ${gUSWDI} ; g1oC #22 is Unknown Server with Declude
  1635. !insertmacro UnselectSection ${gCUKC} ; #23 is Custom Unknown
  1636. ## ADDINGPLATFORM ## STEP 14 Now set it not to display on the activities screen.
  1637. ; First off: Hide the platform options because wer'e only showing components.
  1638. SectionSetText ${gIWDI} "" ; Imail with declude
  1639. SectionSetText ${gIMXI} "" ; Imail MXGuard
  1640. SectionSetText ${gIMMI} "" ; IMail w/ MINIMI
  1641. SectionSetText ${gSWDI} "" ; SmarterMail with Declude
  1642. SectionSetText ${gSMXI} "" ; SmarterMail with MXGuard
  1643. SectionSetText ${gAWDI} "" ; Nonused alligate option
  1644. SectionSetText ${gIW} ""
  1645. SectionSetText ${gIWTI} "" ; is Icewarp in AV position
  1646. SectionSetText ${gIWTICF} "" ; is Icewarp as Content Filter
  1647. SectionSetText ${gIWTICF2} "" ; is Icewarp as spam score contributer
  1648. SectionSetText ${gMSI} "" ; is MailSite
  1649. SectionSetText ${gKMI} "" ; is Kerio
  1650. SectionSetText ${gMDDLL} "" ; is Kerio
  1651. SectionSetText ${gSNFI} "" ; Nonused Sniffer standing alone somewhere..
  1652. SectionSetText ${gUSWDI} "" ; Unknown server w/ Declude
  1653. SectionSetText ${gCUKC} "" ; Custom unknown
  1654. ; Now we have two situations. The first was if there was no preexisting sniffer folder Thats easy.
  1655. StrCmp $PreviousSnifferInstalled "0" RunFreshInstaller RunChoices
  1656. RunFreshInstaller:
  1657. StrCmp $ArchivesAvailable "0" RunFreshNoRestore RunWithRestore
  1658. RunFreshNoRestore:
  1659. ; Setup the settings options for a fresh install:
  1660. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked.
  1661. SectionSetText ${g1o2} ""
  1662. SectionSetText ${g1o3} ""
  1663. SectionSetText ${g1o4} ""
  1664. SectionSetText ${g1o5} ""
  1665. SectionSetText ${g1o6} ""
  1666. SectionSetText ${g1o6B} "" ; obviously no status either.
  1667. Return
  1668. RunWithRestore: ; Now we're restoring to the previous state before EVERY install..... this is moot.
  1669. ; Setup the settings options for a fresh install:
  1670. !insertmacro UnselectSection ${g1o1}
  1671. SectionSetText ${g1o2} ""
  1672. SectionSetText ${g1o3} ""
  1673. SectionSetText ${g1o4} ""
  1674. SectionSetText ${g1o5} "" ; used to be when you had the option for restore....
  1675. SectionSetText ${g1o6} ""
  1676. SectionSetText ${g1o6B} "" ; obviously still no status either.
  1677. Return
  1678. RunChoices:
  1679. ; So we're going to allow the Utility Manager to offer the choices of what sniffer engine to use.
  1680. ; Setup the settings options for a fresh install:
  1681. ;!insertmacro UnselectSection ${another_section_id}
  1682. SectionSetText ${g1o1} ""
  1683. !insertmacro UnselectSection ${g1o2} ; none of the chekcboxes should be checked.
  1684. !insertmacro UnselectSection ${g1o3}
  1685. SectionSetText ${g1o4} "" ; used to be when you had the option for archive UnselectSection ${g1o4}
  1686. SectionSetText ${g1o5} "" ; used to be when you had the option for restore....
  1687. !insertmacro UnselectSection ${g1o6}
  1688. #ReadRegStr $0 HKLM "Software\MessageSniffer" "Install_Dir" ; "SRS_RollbackPath"
  1689. # ifErrors HideUninstaller AllowUninstaller ; So only on the condition that an installer hasn't run, do we consider blocking.
  1690. # AllowUninstaller:
  1691. # !insertmacro UnselectSection ${g1o6}
  1692. ## Goto NextItem
  1693. # HideUninstaller:
  1694. # SectionSetText ${g1o6} ""
  1695. NextItem:
  1696. !insertmacro UnselectSection ${g1o6B} ; now we can have status
  1697. ; So we DO need to set the default radio button for the Utilities to FRESH not NEW
  1698. StrCpy $BaseRadioDefault "1" ; This sets the platform default to new but we may change that further down.....
  1699. Return
  1700. FunctionEnd
  1701. Function Components2_Leave
  1702. ; Ok, we need to install MINIMI here, if its a valid installation, but if its just utilities then we don't.
  1703. StrCmp $ShowRestoreOptionsPage "1" 0 +4
  1704. ; Might as well handle this here. We dont' need another page.
  1705. MessageBox MB_OK "Attempting to Restore. This code should be stubbed."
  1706. ;ExecWait "Restorer.exe -R"
  1707. Quit
  1708. return ; If 4 was selected, we dont' install
  1709. StrCmp $ShowArchiveOptionsPage "1" 0 +2
  1710. return ; If 4 was selected, we dont' install
  1711. StrCmp $ShowTelemetryPage "1" 0 +2
  1712. return ; If 4 was selected, we dont' install
  1713. StrCmp $HandleUninstallPage "1" 0 +2
  1714. return ; If 4 was selected, we dont' install
  1715. StrCmp $Set_For_MINIMI_INSTALL "1" 0 done
  1716. StrCmp $SelectedCaseIndexForPlatformScreen "gIMMI" 0 done
  1717. call InstallMINIMI
  1718. done:
  1719. StrCmp $Set_For_SNF4Alligate_INSTALL "1" 0 done2
  1720. StrCmp $SelectedCaseIndexForPlatformScreen "gAWDI" 0 done2
  1721. call InstallSNF4Alligate
  1722. done2:
  1723. return
  1724. FunctionEnd
  1725. Function setupINSTALLDIR
  1726. ## 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
  1727. ## Find files page...... before you reset and mark all the features.... you need to revalidate the text boxes....
  1728. var /Global temp1 ; holds the strings from the lookup text boxes.
  1729. var /Global temp2
  1730. ## ADDINGPLATFORM ## STEP 17 This is the biggie. Here you need to add a complex case block to handle the popups of the specific platfomr,
  1731. ## 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.
  1732. ## Remember to keep the order. The requires customizing the itFileExists test to beable to confirm that the expected dependant file,
  1733. ## 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.
  1734. ## These cases start their search where the respective platform install folders are set to look by DetermineXYZPLatform...
  1735. ${Switch} $SelectedCaseIndexForPlatformScreen
  1736. ${Case} "gIWDI" ; zero indexed array... Imail with Declude gIWDI
  1737. ;; So this becomes a declude test....
  1738. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1739. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1740. ifFileExists "$temp1\global.cfg" +3 0 ; skip or notify then leave....
  1741. MessageBox MB_OK "Please select the location path where decludes global.cfg file exists."
  1742. Goto NoPassFromHere
  1743. ; and make sure the user didn't edit the string....
  1744. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1745. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1746. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1747. MessageBox MB_OK "You must define a folder as the install directory."
  1748. Goto NoPassFromHere
  1749. ;ok well override those settings if they're good.....
  1750. ; be sure it exists.
  1751. ifFileExists "$temp2\*.*" +2 0
  1752. CreateDirectory $temp2
  1753. ; set them p.
  1754. StrCpy $SNFServerInstallDir $temp1
  1755. StrCpy $INSTDIR $temp2
  1756. Goto ProceedWithInstallDirSetup ;
  1757. ${Case} "gIMXI"
  1758. # Handle MXGuard check...
  1759. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1760. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1761. ifFileExists "$temp1\mxguard.ini" +3 0 ; skip or notify then leave....
  1762. MessageBox MB_OK "Please select the location path where the mxguard.ini file exists."
  1763. Goto NoPassFromHere
  1764. ; and make sure the user didn't edit the string....
  1765. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1766. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1767. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1768. MessageBox MB_OK "You must define a folder as the install directory."
  1769. Goto NoPassFromHere
  1770. ; ok well override those settings if they're good.....
  1771. ; be sure it exists.
  1772. ifFileExists "$temp2\*.*" +2 0
  1773. CreateDirectory $temp2
  1774. ; set them p.
  1775. StrCpy $SNFServerInstallDir $temp1
  1776. StrCpy $INSTDIR $temp2
  1777. Goto ProceedWithInstallDirSetup ;
  1778. ${Case} "gIMMI"
  1779. # Handle MINIMI check...
  1780. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1781. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1782. ifFileExists "$temp1\SMTP32.EXE" +3 0 ; skip or notify then leave....
  1783. MessageBox MB_OK "Please select the location path where IMails SMTP32.exe resides."
  1784. Goto NoPassFromHere
  1785. ; and make sure the user didn't edit the string....
  1786. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1787. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1788. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1789. MessageBox MB_OK "You must define a folder as the install directory."
  1790. Goto NoPassFromHere
  1791. ; ok well override those settings if they're good.....
  1792. ; be sure it exists.
  1793. ifFileExists "$temp2\*.*" +2 0
  1794. CreateDirectory $temp2
  1795. ; set them p.
  1796. StrCpy $SNFServerInstallDir $temp1
  1797. StrCpy $INSTDIR $temp2
  1798. Goto ProceedWithInstallDirSetup ;
  1799. ${Case} "gSWDI" ; zero indexed array... Smartermail with Declude
  1800. ; So this becomes a declude test....
  1801. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1802. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1803. ifFileExists "$temp1\global.cfg" +3 0 ; skip or notify then leave....
  1804. MessageBox MB_OK "Please select the location path where decludes global.cfg file exists."
  1805. Goto NoPassFromHere
  1806. ; and make sure the user didn't edit the string....
  1807. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1808. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1809. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1810. MessageBox MB_OK "You must define a folder as the install directory."
  1811. Goto NoPassFromHere
  1812. ;ok well override those settings if they're good.....
  1813. ; be sure it exists.
  1814. ifFileExists "$temp2\*.*" +2 0
  1815. CreateDirectory $temp2
  1816. ; set them p.
  1817. StrCpy $SNFServerInstallDir $temp1
  1818. StrCpy $INSTDIR $temp2
  1819. Goto ProceedWithInstallDirSetup ;
  1820. ${Case} "gSMXI"
  1821. # Handle MXGuard check...
  1822. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1823. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1824. ifFileExists "$temp1\mxguard.ini" +3 0 ; skip or notify then leave....
  1825. MessageBox MB_OK "Please select the location path where the mxguard.ini file exists."
  1826. Goto NoPassFromHere
  1827. ; and make sure the user didn't edit the string....
  1828. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1829. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1830. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1831. MessageBox MB_OK "You must define a folder as the install directory."
  1832. Goto NoPassFromHere
  1833. ; ok well override those settings if they're good.....
  1834. ; be sure it exists.
  1835. ifFileExists "$temp2\*.*" +2 0
  1836. CreateDirectory $temp2
  1837. ; set them p.
  1838. StrCpy $SNFServerInstallDir $temp1
  1839. StrCpy $INSTDIR $temp2
  1840. Goto ProceedWithInstallDirSetup ;
  1841. ${Case} "gAWDI"
  1842. # Handle SNF4Alligate check...
  1843. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1844. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1845. ifFileExists "$temp1\AGFiltSvc.exe" +3 0 ; skip or notify then leave....
  1846. MessageBox MB_OK "Please select the location path where Alligates AGFiltSvc.exe resides."
  1847. Goto NoPassFromHere
  1848. ifFileExists "$temp1\Drop" +3 0 ; skip or notify then leave....
  1849. MessageBox MB_OK "There is no Drop folder in your Alligate location."
  1850. Goto NoPassFromHere
  1851. ifFileExists "$temp1\Drop" +3 0 ; skip or notify then leave....
  1852. MessageBox MB_OK "There is no Spool folder in your Alligate location."
  1853. Goto NoPassFromHere
  1854. ; and make sure the user didn't edit the string....
  1855. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1856. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1857. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1858. MessageBox MB_OK "You must define a folder as the install directory."
  1859. Goto NoPassFromHere
  1860. ; ok well override those settings if they're good.....
  1861. ; be sure it exists.
  1862. ifFileExists "$temp2\*.*" +2 0
  1863. CreateDirectory $temp2
  1864. ; set them p.
  1865. StrCpy $SNFServerInstallDir $temp1
  1866. StrCpy $INSTDIR $temp2
  1867. Goto ProceedWithInstallDirSetup ;
  1868. ${Case} "gIWTICF" ; let this drop through
  1869. ${Case} "gIWTICF2" ; let this drop through
  1870. ${Case} "gIWTI"
  1871. # Handle Icewarp check...
  1872. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1873. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1874. ifFileExists "$temp1\config\*.*" 0 NoPassFromHere ; shouldn't happen.. determine Icewarp should fail if not properly installed.
  1875. ifFileExists "$temp1\config\content.xml" +3 0 ; skip or notify then leave....
  1876. MessageBox MB_OK "Please select the location path where IceWarp is installed. [IceWarpRoot]\config\content.xml couldn't be found."
  1877. Goto NoPassFromHere
  1878. ; and make sure the user didn't edit the string....
  1879. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1880. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1881. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1882. MessageBox MB_OK "You must define a folder as the install directory."
  1883. Goto NoPassFromHere
  1884. ; ok well override those settings if they're good.....
  1885. ; be sure it exists.
  1886. ifFileExists "$temp2\*.*" +2 0
  1887. CreateDirectory $temp2
  1888. ; set them p.
  1889. StrCpy $SNFServerInstallDir $temp1
  1890. StrCpy $INSTDIR $temp2
  1891. Goto ProceedWithInstallDirSetup ;
  1892. ${Case} "gMSI"
  1893. ## WONT HAPPEN
  1894. ${Case} "gKMI"
  1895. ## WONT HAPPEN
  1896. ${Case} "gMDDLL"
  1897. # Handle MDaemon check...
  1898. ${NSD_GetText} $SNF_SearchFor_Location $R0
  1899. StrCpy $temp1 $R0 ; Set the global variable to the new authentication ID.
  1900. ifFileExists "$temp1\App\*.*" 0 NoPassFromHere ; shouldn't happen.. determine Icewarp should fail if not properly installed.
  1901. ifFileExists "$temp1\App\MDaemon.exe" +3 0 ; skip or notify then leave....
  1902. MessageBox MB_OK "Please select the location path where MDaemon is installed. [MDaemon]\App\MDaemon.exe couldn't be found."
  1903. Goto NoPassFromHere
  1904. ; and make sure the user didn't edit the string....
  1905. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1906. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1907. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1908. MessageBox MB_OK "You must define a folder as the install directory."
  1909. Goto NoPassFromHere
  1910. ; ok well override those settings if they're good.....
  1911. ; be sure it exists.
  1912. ifFileExists "$temp2\*.*" +2 0
  1913. CreateDirectory $temp2
  1914. ; set them p.
  1915. StrCpy $SNFServerInstallDir $temp1
  1916. StrCpy $INSTDIR $temp2
  1917. Goto ProceedWithInstallDirSetup ;
  1918. ${Case} "gSNFI"
  1919. ## WONT HAPPEN
  1920. ${Case} "gUSWDI"
  1921. ## WONT HAPPEN
  1922. ;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:"
  1923. ;StrCpy $MissingApplicationName "Generic Declude Install"
  1924. ;Goto ProceedWithInstallDirSetup ;
  1925. ${Case} "gCUKC"
  1926. ${NSD_GetText} $SNF_SearchFor_LocationB $R0
  1927. StrCpy $temp2 $R0 ; Set the global variable to the new authentication ID.
  1928. StrCmp $temp2 "" 0 +3 ; skip or notify then leave....
  1929. MessageBox MB_OK "You must define a folder as the install directory."
  1930. Goto NoPassFromHere
  1931. ; ok well override those settings if they're good.....
  1932. ; be sure it exists.
  1933. ifFileExists "$temp2\*.*" +2 0
  1934. CreateDirectory $temp2
  1935. ; set them p.
  1936. ${GetParent} $temp2 $SNFServerInstallDir ; get the parent of the selected folder and mark it as the master server dir.
  1937. StrCpy $INSTDIR $temp2
  1938. Goto ProceedWithInstallDirSetup ;
  1939. ${Default}
  1940. ; If we get here, we have an unusual situation that leaks through teh event handler.
  1941. ; Though its not possible, you can unclick a radio button that should always have one selected.
  1942. ; and put yourself in the original state of having nothing picked... if so, disable next.
  1943. EnableWindow $NextButton "0"
  1944. ${EndSwitch}
  1945. NoPassFromHere: ; this cancels the next because it didn't validate.
  1946. abort
  1947. ProceedWithInstallDirSetup:
  1948. ; ok we're good... here we have defined the INSDIR and the $SNFServerInstallDir
  1949. ## NOTE: Even though it would seem that there could be multiple Declude folders because they only use one set of registry keys
  1950. ## There can't be multiple FUNCTIONING decludes. So don't get confused even though SNF is going to remain abtracted....
  1951. StrCpy $OldVersionOfSniffer "0"
  1952. StrCpy $PreviousSnifferInstalled "0"
  1953. StrCpy $ArchivesAvailable "0"
  1954. ; So test to see if the message sniffer folder exists.
  1955. IfFileExists "$INSTDIR\identity.xml" SetPreviouslyInstalledFlag 0 ; Test for no folder at proper location.
  1956. StrCpy $PreviousSnifferInstalled "0" ; we key off the identity.xml file.
  1957. ; Set previous flag to false. ( default. , but kept here for clarity. )
  1958. Goto ContinueInit ; Skip setting the previous flag to true.....
  1959. SetPreviouslyInstalledFlag:
  1960. IfFileExists "$INSTDIR\$LicenseID.exe" 0 +2 ; Test for older install file keying off of nomerization of the executable.....
  1961. StrCpy $OldVersionOfSniffer "1" ; ( Declude comes with its own sniffer folder already made....
  1962. StrCpy $PreviousSnifferInstalled "1" ; Set flag for previously exists.
  1963. ContinueInit:
  1964. ## ARCHIVE NOTE: We are no longer offering archives, so we are hiding this code at the moment. ARCHIVES ARE NEVER AVAILABLE.
  1965. #IfFileExists "$SNFServerInstallDir\SNFArchive\*.*" 0 +2
  1966. StrCpy $ArchivesAvailable "0" ; This sets the state for the modified option set to offer restore possibilities....
  1967. ; 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
  1968. ; 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
  1969. ; but that limits us to one controlable archive..... if you turn off one installation and turn another on, this way it should heal itself.
  1970. # 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.
  1971. Call OutputLocalRootInfoFile
  1972. RETURN
  1973. FunctionEnd
  1974. Function OutputLocalRootInfoFile
  1975. ; 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
  1976. ; 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
  1977. ; but that limits us to one controlable archive..... if you turn off one installation and turn another on, this way it should heal itself.
  1978. SetOutPath $INSTDIR
  1979. Var /GLOBAL myContextFile
  1980. FileOpen $myContextFile "$INSTDIR\LocalRoot.txt" w
  1981. FileWrite $myContextFile "<root>$SNFServerInstallDir</root><cd>$INSTDIR</cd>"
  1982. FileClose $myContextFile
  1983. ; 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.
  1984. ; i.e. If you install Fresh the localroot.txt file is destroyed... so it needs to be rebuilt.
  1985. FunctionEnd
  1986. #####################################
  1987. ## .onSelChange is the callback event handler
  1988. ## for the components page.
  1989. Function .onSelChange
  1990. ; Now Enable the Next Button
  1991. GetDlgItem $NextButton $HWNDPARENT 1
  1992. EnableWindow $NextButton "1"
  1993. ; Radio Button State Checking code. Uncomment and run
  1994. ;Var /GLOBAL TestVar
  1995. ;StrCpy $TestVar ""
  1996. ;SectionGetFlags "${g1o1}" $R0
  1997. ;StrCpy $TestVar "g101:$R0$\n"
  1998. ;SectionGetFlags "${g1o2}" $R0
  1999. ;StrCpy $TestVar "$TestVar g102:$R0$\n"
  2000. ;SectionGetFlags "${g1o3}" $R0
  2001. ;StrCpy $TestVar "$TestVar g103:$R0$\n"
  2002. ;SectionGetFlags "${g1o4}" $R0
  2003. ;StrCpy $TestVar "$TestVar g104:$R0$\n"
  2004. ;SectionGetFlags "${g1o5}" $R0
  2005. ;StrCpy $TestVar "$TestVar g105:$R0$\n"
  2006. ;SectionGetFlags "${g1o6}" $R0
  2007. ;StrCpy $TestVar "$TestVar g106:$R0$\n"
  2008. ;SectionGetFlags "${g1o7}" $R0
  2009. ;StrCpy $TestVar "$TestVar g107:$R0$\n"
  2010. ;SectionGetFlags "${g1o8}" $R0
  2011. ;StrCpy $TestVar "$TestVar g108:$R0$\n"
  2012. ;SectionGetFlags "${g1o9}" $R0
  2013. ;StrCpy $TestVar "$TestVar g109:$R0$\n"
  2014. ;SectionGetFlags "${g1oA}" $R0
  2015. ;StrCpy $TestVar "$TestVar g10A:$R0$\n"
  2016. ;SectionGetFlags "${g1oA2}" $R0
  2017. ;StrCpy $TestVar "$TestVar g10A2:$R0$\n"
  2018. ;SectionGetFlags "${g1oB}" $R0
  2019. ;StrCpy $TestVar "$TestVar g10B:$R0$\n"
  2020. ;SectionGetFlags "${g1oC}" $R0
  2021. ;StrCpy $TestVar "$TestVar g10C:$R0$\n"
  2022. ;MessageBox MB_OK $TestVar
  2023. ; init $1
  2024. ;MessageBox MB_OK "Current setting: $1 / $BaseRadioDefault"
  2025. ; Problem: When a group is present, clicking the group creates the abstract effect ( when using the RadioButton macros. ) that
  2026. ; the last item in the group that wasn't highlighted becomes checked. Abberrant behavior. So to counteract that we
  2027. ; screen for the effect of the user clicking on the group header, and clear all boxes prior to the rest of the analysis.
  2028. ; 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
  2029. ; by clearing all the settings....
  2030. Var /Global TheAddition
  2031. Var /Global Report
  2032. StrCpy $Report ""
  2033. SectionGetFlags ${gIWTI} $TheAddition
  2034. StrCpy $Report $Report$TheAddition
  2035. SectionGetFlags ${gIWTICF} $TheAddition
  2036. StrCpy $Report $Report$TheAddition
  2037. SectionGetFlags ${gIWTICF2} $TheAddition
  2038. StrCpy $Report $Report$TheAddition
  2039. StrCmp $Report "111" 0 ContineButtonAnalysis
  2040. !insertmacro UnselectSection ${gIWTI}
  2041. !insertmacro UnselectSection ${gIWTICF}
  2042. !insertmacro UnselectSection ${gIWTICF2}
  2043. ContineButtonAnalysis:
  2044. ; This concludes the manual clearing/correcting of the group state.
  2045. ## ADDINGPLATFORM ## STEP 18 You must add the radiobutton detection code in here to detect the event and handle it.
  2046. ## Add it in the proper place in order. Increment the ordinal comments on everything below your entry.
  2047. StrCpy $1 $BaseRadioDefault
  2048. !insertmacro StartRadioButtons $1 ; Each of these is a macro that inserts handling code for the section named in ${g1o1}
  2049. ; These are the components
  2050. !insertmacro RadioButton ${g1o1} ; new
  2051. !insertmacro RadioButton ${g1o2} ; fresh
  2052. !insertmacro RadioButton ${g1o3} ; update
  2053. !insertmacro RadioButton ${g1o4} ; archive
  2054. !insertmacro RadioButton ${g1o5} ; restore
  2055. !insertmacro RadioButton ${g1o6} ; uninstall
  2056. !insertmacro RadioButton ${g1o6B} ; status...
  2057. ; 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 \
  2058. ; these are teh platforms.
  2059. !insertmacro RadioButton ${gIWDI} ; g1o7 #7 is Imail with Declude
  2060. !insertmacro RadioButton ${gIMXI} ; g1oA #8 is Imail with MXGuard
  2061. !insertmacro RadioButton ${gIMMI} ; g1o7B #9 is IMail with MINIMI
  2062. !insertmacro RadioButton ${gSWDI} ; g1o8 #10 is SmarterMail with Declude
  2063. !insertmacro RadioButton ${gSMXI} ; g1oA2 #11 is SmarterMail with MXGuard
  2064. !insertmacro RadioButton ${gAWDI} ; g1o9 #12 is Alligate
  2065. ; 13 is the Section Group
  2066. ;MessageBox MB_OK "$1"
  2067. !insertmacro RadioButton ${gIWTI} ; g1o9 #14 is Icewarp
  2068. ;MessageBox MB_OK "$1"
  2069. !insertmacro RadioButton ${gIWTICF} ; g1o9 #15 is Icewarp as content filter.
  2070. ;MessageBox MB_OK "$1"
  2071. !insertmacro RadioButton ${gIWTICF2} ; g1o9 #16 is Icewarp as spam contributer.
  2072. ;MessageBox MB_OK "$1"
  2073. !insertmacro RadioButton ${gMSI} ; g1o9 #18 is MailSite
  2074. !insertmacro RadioButton ${gKMI} ; g1o9 #19 is Kerio
  2075. !insertmacro RadioButton ${gMDDLL} ; g1o9 #20 is MDaemon
  2076. !insertmacro RadioButton ${gSNFI} ; g1oB #21 is SNF stand alone
  2077. !insertmacro RadioButton ${gUSWDI} ; g1oC #22 is Unknown Server with Declude
  2078. !insertmacro RadioButton ${gCUKC} ; #23 is Custom Unknown
  2079. ; On inspecting the flag state for all options under a group, the result for when you select the group is
  2080. ; 35 1 1 1 1 but when you select just a single option it is 98 0 0 0 1 for example....
  2081. ;Var /Global TheState
  2082. ;Var /Global TheAddition
  2083. ;SectionGetFlags ${MDI} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2084. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2085. ;SectionGetFlags ${MDI_mx} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2086. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2087. ;SectionGetFlags ${MDI_dc} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2088. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2089. ;SectionGetFlags ${MDI_mm} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2090. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2091. ;SectionGetFlags ${MDI_sa} $TheAddition ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2092. ;StrCpy $TheState "$TheState$\r$\n$TheAddition"
  2093. ;MessageBox MB_OK "$TheState"
  2094. ;!insertmacro RadioButton ${MDI} ;"Manually Detect Installation" This is the group header.
  2095. ; StrCmp $1 "15" 0 NextRadioButton ; it needs to be in the list for presentation
  2096. ; OK we're removing it from the list of Radiobutton macros cause we dont' ever want to have the group header be 'SET'
  2097. ; 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.
  2098. ; 98 indicates that something underneith it was selected, not the group header itself. See SectionSetFlags for the bit values
  2099. ; of the flags themselves..... but uncommentint the above code will popup the flag states at this point in the marco list....
  2100. ; This was for handling a group... but we're not doing that... so we don't care...
  2101. ; This setting checks, and if its 35 ( clicked it directly ) it will unset all its subcomponents, because they're mutually exclusive...
  2102. ;SectionGetFlags ${MDI} $TempRadioButtonFlagsVar ; but selecting it, mathematically selects ALL the options underneith... and that's not right.
  2103. ;StrCmp $TempRadioButtonFlagsVar "35" 0 NextRadioButton
  2104. ; MessageBox MB_OK "Please click on the platform you'd like to manually locate:"
  2105. ; IntOp $TempRadioButtonFlagsVar $TempRadioButtonFlagsVar & ${SECTION_OFF} ; so even thoug we have it here, we have to UNdo the errant click on this option.
  2106. ; SectionSetFlags ${MDI} $TempRadioButtonFlagsVar
  2107. ;NextRadioButton:
  2108. ;MessageBox MB_OK "The value for 1 after the group header is : $1"
  2109. ; EndTrappingButtons
  2110. !insertmacro EndRadioButtons
  2111. ; The Above code leaves var $1 holding the index of the radio button that was clicked.
  2112. ;DEBUG MessageBox MB_OK "Now setting: $1 / $BaseRadioDefault"
  2113. ## 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.
  2114. ## 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
  2115. ## 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.
  2116. ## Increment the ordinal in the comments for everything below your entry....
  2117. ; Even though we've got the above macro... because we're using this list for two screens
  2118. ; ( Forced on us because this function gets called from both pages on a select-Change event)
  2119. ; We need to Case-control the display on entry to the first page based on a flag we store...
  2120. ; because of that, the above macro isn't behaving nicely on the first click, so we need to
  2121. ; manually control final state... so here we clear them all, and then we reselect the one
  2122. ; that is notified as being clicked upon from the above code.....
  2123. !insertmacro UnselectSection ${g1o1} ; none of the chekcboxes should be checked. 0
  2124. !insertmacro UnselectSection ${g1o2} ; none of the chekcboxes should be checked. 1
  2125. !insertmacro UnselectSection ${g1o3} ; none of the chekcboxes should be checked. 2
  2126. !insertmacro UnselectSection ${g1o4} ; none of the chekcboxes should be checked. 3
  2127. !insertmacro UnselectSection ${g1o5} ; none of the chekcboxes should be checked. 4
  2128. !insertmacro UnselectSection ${g1o6} ; none of the chekcboxes should be checked. 5
  2129. !insertmacro UnselectSection ${g1o6B} ; none of the chekcboxes should be checked. - This is status index
  2130. !insertmacro UnselectSection ${gIWDI} ; g1o7 #7 is Imail with Declude
  2131. !insertmacro UnselectSection ${gIMXI} ; g1oA #8 is Imail with MXGuard
  2132. !insertmacro UnselectSection ${gIMMI} ; g1o7B #9 is IMail with MINIMI
  2133. !insertmacro UnselectSection ${gSWDI} ; g1o8 #10 is SmarterMail with Declude
  2134. !insertmacro UnselectSection ${gSMXI} ; g1oA2 #11 is SmarterMail with MXGuard
  2135. !insertmacro UnselectSection ${gAWDI} ; gAWDI #12 is Alligate
  2136. ; 13 is the Section Group.
  2137. !insertmacro UnselectSection ${gIWTI} ; gIWTI #14 is Icewarp
  2138. !insertmacro UnselectSection ${gIWTICF} ; gIWTICF #15 is Icewarp
  2139. !insertmacro UnselectSection ${gIWTICF2} ; gIWTICF2 #16 is Icewarp
  2140. !insertmacro UnselectSection ${gMSI} ; gMSI #18 is MailSite
  2141. !insertmacro UnselectSection ${gKMI} ; gKMI #19 is Kerio
  2142. !insertmacro UnselectSection ${gMDDLL} ; MDaemon #20 is MDaemon
  2143. !insertmacro UnselectSection ${gSNFI} ; g1oB #21 is SNF stand alone
  2144. !insertmacro UnselectSection ${gUSWDI} ; g1oC #22 is Unknown Server with Declude
  2145. !insertmacro UnselectSection ${gCUKC} ; #23 is Custom Unknown
  2146. ;MessageBox MB_OK "$1"
  2147. StrCpy $BaseRadioDefault $1 ; set this so that the next time through the click-handler it knows what to start with.
  2148. ;MessageBox MB_OK "Click result is:$1"
  2149. ## ADDINGPLATFORM ## STEP 20 OK! This is the doosey! Here is where the ordinal matters. Cause the code above, grabbed the event, and it will
  2150. ## 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
  2151. ## 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
  2152. ## you will end up with VERY STRANGE Event handling behavior.
  2153. ## Insert a new case element, custom code the effect you desire, and then increment every number below your entry.
  2154. ## Ignore the fact that 1 through 6 are at the very end, ( They are the returns for the activities. New, Fresh, Update, Remove etc. )
  2155. ## IF your install requires a custom call back you call that here.
  2156. ## Do not remove the StrCy $currentPlatformSelection $1 line. ( $1 is the register that returns the currently selected checkbox, and if you come back
  2157. ## to this screen, the screen remember what was selected based on the value contained by $currentPlatformSelection
  2158. ; Now based on the clicked selection mark it shown, and setup the proper flags.
  2159. ${Switch} $1
  2160. ${Case} "7" ; zero indexed array... Imail with Declude gIWDI
  2161. StrCpy $SelectedCaseIndexForPlatformScreen "gIWDI" ; Which is the first platform option....
  2162. !insertmacro SelectSection ${gIWDI} ; check Declude with Imail.
  2163. Call SetInstallForDeclude ; Set the install folder to put MessageSniffer in based on the Declude settings.
  2164. ; If Its declude, then its whatever declude is setup for.... i.e. Declude can't be both
  2165. ; IMail and Smartermail at the same time.... it will be one or the other.
  2166. ; StrCpy $INSTDIR
  2167. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2168. return ;
  2169. ${Case} "8"
  2170. StrCpy $SelectedCaseIndexForPlatformScreen "gIMXI"
  2171. !insertmacro SelectSection ${gIMXI} ; MXGuard with Imail
  2172. Call SetInstallForMXGuard
  2173. StrCpy $currentPlatformSelection $1
  2174. return
  2175. ${Case} "9"
  2176. StrCpy $SelectedCaseIndexForPlatformScreen "gIMMI" ; this marker is for the presetting the platforms screen on back event
  2177. !insertmacro SelectSection ${gIMMI} ; MINIMI with IMAIL
  2178. Call SetInstallForMINIMI
  2179. StrCpy $currentPlatformSelection $1 ; this marker is for remembering what was checked....
  2180. return
  2181. ${Case} "10"
  2182. StrCpy $SelectedCaseIndexForPlatformScreen "gSWDI"
  2183. !insertmacro SelectSection ${gSWDI} ; check Declude with Smartermail
  2184. Call SetInstallForDeclude ; Set the install folder to put MessageSniffer in based on the Declude settings.
  2185. ; If Its declude, then its whatever declude is setup for.... i.e. Declude can't be both
  2186. ; IMail and Smartermail at the same time.... it will be one or the other.
  2187. StrCpy $currentPlatformSelection $1
  2188. return
  2189. ${Case} "11"
  2190. StrCpy $SelectedCaseIndexForPlatformScreen "gSMXI"
  2191. !insertmacro SelectSection ${gSMXI} ; MXGuard with SmarterMail
  2192. Call SetInstallForMXGuard
  2193. StrCpy $currentPlatformSelection $1
  2194. return
  2195. ${Case} "12"
  2196. StrCpy $SelectedCaseIndexForPlatformScreen "gAWDI"
  2197. !insertmacro SelectSection ${gAWDI} ; Alligate
  2198. Call SetInstallForSNF4Alligate ; Set the install folder to put MessageSniffer in based on the non-existant Alligate settings...
  2199. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2200. return ;
  2201. ${Case} "13"
  2202. ${Case} "14"
  2203. WriteRegStr HKLM "SOFTWARE\MessageSniffer" "IceWarpType" "AV" ; tells the Installer script to insert in AV position. Script will consume flag;
  2204. StrCpy $SelectedCaseIndexForPlatformScreen "gIWTI"
  2205. !insertmacro SelectSection ${gIWTI} ; IceWarp TieIn.
  2206. ;Call SetInstallForIceWarp
  2207. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2208. return ;
  2209. ${Case} "15"
  2210. WriteRegStr HKLM "SOFTWARE\MessageSniffer" "IceWarpType" "CF" ; tells the Installer script to insert in dominant filter position. Script will consume flag;
  2211. StrCpy $SelectedCaseIndexForPlatformScreen "gIWTICF"
  2212. !insertmacro SelectSection ${gIWTICF} ; 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} "16"
  2217. WriteRegStr HKLM "SOFTWARE\MessageSniffer" "IceWarpType" "SS" ; tells the Installer script to insert with SpamScore contribution. Script will consume flag;
  2218. StrCpy $SelectedCaseIndexForPlatformScreen "gIWTICF2"
  2219. !insertmacro SelectSection ${gIWTICF2} ; 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} "18"
  2224. StrCpy $SelectedCaseIndexForPlatformScreen "gMSI"
  2225. !insertmacro SelectSection ${gMSI} ; MailStop
  2226. ;Call SetInstallForMailSite ; Set the install folder to put MessageSniffer in based on the non-existant Alligate settings...
  2227. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2228. return ;
  2229. ${Case} "19"
  2230. StrCpy $SelectedCaseIndexForPlatformScreen "gKMI"
  2231. !insertmacro SelectSection ${gKMI} ; Kerio
  2232. ;Call SetInstallForKerio ; Set the install folder to put MessageSniffer in based on the non-existant Alligate settings...
  2233. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2234. return ;
  2235. ${Case} "20"
  2236. StrCpy $SelectedCaseIndexForPlatformScreen "gMDDLL"
  2237. !insertmacro SelectSection ${gMDDLL} ; Kerio
  2238. ;Call SetInstallForMDaemon ; Set callback for the MDaemon install code
  2239. StrCpy $currentPlatformSelection $1 ; set this so that the next time through the click-handler it knows what to start with.
  2240. return ;
  2241. ${Case} "21" ## WON'T HAPPEN
  2242. StrCpy $SelectedCaseIndexForPlatformScreen "gSNFI"
  2243. !insertmacro SelectSection ${gSNFI} ; SnifferStandalone
  2244. # These vars are used by the page that looks for missing folders.
  2245. ;StrCpy $MissingApplicationName "Stand Alone Sniffer installation" ; This is used to identify the abstracted application name.
  2246. ; MissingApplicationFolder ; This is used to identify the abstracted application folder to start the search from
  2247. ;StrCpy $FindApplicationMessage "Please choose the folder where the $MissingApplicationName should reside." ; This is used to abstract the search page.
  2248. ;Call LocatePlatformScreen
  2249. ;StrCpy $SNFServerInstallDir $MissingApplicationFolder ; This will get the \SNF and the \SNFArchive folders built inside.....
  2250. ;StrCpy $INSTDIR "$SNFServerInstallDir\SNF"
  2251. ;StrCpy $currentPlatformSelection $1
  2252. return
  2253. ${Case} "22"
  2254. StrCpy $SelectedCaseIndexForPlatformScreen "gUSWDI"
  2255. !insertmacro SelectSection ${gUSWDI} ; Unknown Declude
  2256. ; Can't call this until you select the folders...Call SetInstallForDeclude ; No guarantees.... just install it in decludes folder.
  2257. StrCpy $currentPlatformSelection $1
  2258. return
  2259. ${Case} "23"
  2260. StrCpy $SelectedCaseIndexForPlatformScreen "gCUKC" ; this Custom unknown
  2261. ; doesn't matter where the folder is.. user will set it on the next screen.
  2262. !insertmacro SelectSection ${gCUKC} ;
  2263. return
  2264. # END THE Case elements for the Platforms OnSelectChange handling....
  2265. # These bottom ones are shown on the second components page.....
  2266. ${Case} "6" ; Handling the request to see the status page.
  2267. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2268. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2269. StrCpy $ShowTelemetryPage "1" ; don't show status utilities.
  2270. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2271. !insertmacro SelectSection ${g1o6B} ; INSTALL NEW chekcboxes should be checked.
  2272. StrCpy $currentUtilitySelection $1
  2273. Return
  2274. ${Case} "5" ; if 5 was selected we jump with no play to the uninstaller.
  2275. StrCpy $HandleUninstallPage "1" ; don't show uninstall screen.
  2276. StrCpy $ShowArchiveOptionsPage "0" ; don't show utilities.
  2277. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2278. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utility.
  2279. !insertmacro SelectSection ${g1o6} ; Just Uninstall should be checked.
  2280. StrCpy $currentUtilitySelection $1
  2281. Return
  2282. ${Case} "4"
  2283. StrCpy $ShowRestoreOptionsPage "1" ; If 4 was selected, we show the restore utility
  2284. StrCpy $ShowArchiveOptionsPage "0" ; don't show utilities.
  2285. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2286. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2287. !insertmacro SelectSection ${g1o5} ; Just RESTORE should be checked.
  2288. StrCpy $currentUtilitySelection $1
  2289. Return
  2290. ${Case} "3"
  2291. StrCpy $ShowArchiveOptionsPage "1" ; If 3 was selected, we show the archive utility
  2292. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utility.
  2293. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2294. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2295. !insertmacro SelectSection ${g1o4} ; JUST THE ARCHIVE chekcboxes should be checked.
  2296. StrCpy $currentUtilitySelection $1
  2297. Return
  2298. ${Case} "2"
  2299. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2300. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2301. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2302. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2303. !insertmacro SelectSection ${g1o3} ; INSTALL WITH SETTINGS chekcboxes should be checked.
  2304. StrCpy $currentUtilitySelection $1
  2305. Return
  2306. ${Case} "1"
  2307. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2308. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2309. StrCpy $ShowTelemetryPage "0" ; don't show statsu utilities.
  2310. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2311. !insertmacro SelectSection ${g1o2} ; INSTALL FRESH chekcboxes should be checked.
  2312. StrCpy $currentUtilitySelection $1
  2313. Return
  2314. ${Case} "0" ; Handling the 0 ( the expected result ) from clicking the NEW INSTALL button, ( but only when the Restore option is presented...)
  2315. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2316. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2317. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2318. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2319. !insertmacro SelectSection ${g1o1} ; INSTALL NEW chekcboxes should be checked.
  2320. StrCpy $currentUtilitySelection $1
  2321. Return
  2322. ${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.
  2323. StrCpy $ShowRestoreOptionsPage "0" ; don't show restore utilities.
  2324. StrCpy $ShowArchiveOptionsPage "0" ; don't show archive utilities.
  2325. StrCpy $ShowTelemetryPage "0" ; don't show status utilities.
  2326. StrCpy $HandleUninstallPage "0" ; don't show uninstall screen.
  2327. !insertmacro SelectSection ${g1o1} ; INSTALL NEW chekcboxes should be checked.
  2328. StrCpy $currentUtilitySelection "0"
  2329. Return
  2330. ${Default}
  2331. ; If we get here, we have an unusual situation that leaks through teh event handler.
  2332. ; Though its not possible, you can unclick a radio button that should always have one selected.
  2333. ; and put yourself in the original state of having nothing picked... if so, disable next.
  2334. EnableWindow $NextButton "0"
  2335. ${EndSwitch}
  2336. FunctionEnd
  2337. ; Ending Functions for control of components selection
  2338. ;-----------------------------------
  2339. Function nsDialogHandleUninstall
  2340. ; This page never shows. It will always complete and then return to the main components page. ( Or play through if $HandleUninstallPage= 0
  2341. StrCmp $HandleUninstallPage "1" 0 exit_nsDialogsUninstall
  2342. SetOutPath $INSTDIR
  2343. ifFileExists "$INSTDIR\uninstall.exe" 0 NotifyFind
  2344. SetOutPath $SNFServerInstallDir ; Reset this to enable the descturction of working directories.. THIS WAS THE CULPRET THAT HELD THE LOCK ON THE FOLDER!!!
  2345. ExecWait "$INSTDIR\uninstall.exe"
  2346. StrCpy $R9 "-4" ;Relative page number. See below.
  2347. Call RelGotoPage ; take me back to main screen
  2348. return ;
  2349. NotifyFind:
  2350. 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."
  2351. StrCpy $R9 "-4" ;Relative page number. See below.
  2352. Call RelGotoPage ; take me back to main screen
  2353. exit_nsDialogsUninstall:
  2354. return ;
  2355. FunctionEND
  2356. Function nsDialogsTelemetryShow
  2357. StrCmp $ShowTelemetryPage "1" 0 exit_nsDialogsTelemetry
  2358. !insertmacro BIMAGE "SnifferBannerArchive.bmp" ""
  2359. GetDlgItem $0 $HWNDPARENT 1
  2360. SendMessage $0 ${WM_SETTEXT} 0 "STR:Exit Status" ; set the next button text:
  2361. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Message Sniffer Server 3.0 Status Viewer:" ; set the window text.
  2362. Var /GLOBAL TEXTBOX_Telemetry
  2363. Var /GLOBAL TelemetryData
  2364. Var /GLOBAL TelemetryGo
  2365. nsDialogs::Create /NOUNLOAD 1018
  2366. Pop $0
  2367. ${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."
  2368. Pop $0
  2369. ${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.;
  2370. Pop $TEXTBOX_Telemetry
  2371. ${NSD_CreateButton} 0 180 30% 14u "Retest Status"
  2372. Pop $TelemetryGo
  2373. GetFunctionAddress $0 reloadTelemetry
  2374. nsDialogs::OnClick /NOUNLOAD $TelemetryGo $0
  2375. nsDialogs::Show
  2376. exit_nsDialogsTelemetry:
  2377. FunctionEnd
  2378. Function reloadTelemetry
  2379. ${GetBetween} "licenseid='" "'" "$INSTDIR\identity.xml" $LicenseID ; This makes it not brittly dependant on the default value. i.e. It would
  2380. ${GetBetween} "authentication='" "'" "$INSTDIR\identity.xml" $Authentication
  2381. StrCpy $TelemetryData "" "Starting Status Test.$\r$\n"
  2382. StrCpy $TelemetryData "" "$TelemetryData $\r$\nLicense = $LicenseID Authentication = $Authentication"
  2383. nsExec::ExecToStack 'NET START SNFService'
  2384. Pop $0 # return value/error/timeout
  2385. StrCpy $TelemetryData "$TelemetryData$\r$\n NET START Return Code: $0"
  2386. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2387. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2388. nsExec::ExecToStack '$INSTDIR\SNFService'
  2389. Pop $0 # return value/error/timeout
  2390. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2391. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2392. ; but first test for valid status
  2393. nsExec::ExecToStack '"$INSTDIR\snf2check.exe" "$INSTDIR\$LicenseID.snf" "$Authentication"'
  2394. Pop $0 # return value/error/timeout
  2395. StrCpy $TelemetryData "$TelemetryData$\r$\n snf2check return code: $0"
  2396. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2397. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2398. ;Sleep 5000
  2399. ;MessageBox MB_OK "$INSTDIR"
  2400. nsExec::ExecToStack '$INSTDIR\SNFClient -status.second'
  2401. Pop $0 # return value/error/timeout
  2402. StrCpy $TelemetryData "$TelemetryData$\r$\n SNFClient return code: $0"
  2403. Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
  2404. StrCpy $TelemetryData "$TelemetryData$\r$\n $1"
  2405. MessageBox MB_OK "$1"
  2406. SendMessage $TEXTBOX_Telemetry ${WM_SETTEXT} 0 "STR:$TelemetryData"
  2407. FunctionEND
  2408. Function nsDialogsTelemetryLeave
  2409. StrCpy $R9 "-1" ;Relative page number. See below.
  2410. Call RelGotoPage
  2411. FunctionEND
  2412. Function nsDialogInstall
  2413. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Install Utility Unpacking Components:" ; change text screen.
  2414. !insertmacro BIMAGE "SnifferBanner2.bmp" "" ; change banner image.
  2415. FunctionEND
  2416. Function .onUserAbort
  2417. ; If this happenes we don't want to leave a folder hanging there.
  2418. SetOutPath "$SNFServerInstallDir"
  2419. ;IfFileExists "$SNFServerInstallDir\SNF\mingwm10.dll" +2 0 ; If the dll exists, presume a decent install. If not... presume its screwed and delete it.
  2420. ;RMDir /r "$SNFServerInstallDir\SNF"
  2421. FunctionEnd
  2422. Function check_CompoundEnable
  2423. VAR /GLOBAL Compound_Enable1 ; a value to ensure enabling.
  2424. VAR /GLOBAL Compound_Enable2 ; another value that must be enabled to enable the next.
  2425. EnableWindow $NextButton "0" ; presume no.
  2426. StrCmp $Compound_Enable1 "0" 0 +2
  2427. return
  2428. StrCmp $Compound_Enable2 "0" 0 +2
  2429. return
  2430. #StrCmp $Compound_Enable3 "0" 0 +2
  2431. # return
  2432. EnableWindow $NextButton "1" ; presume no.
  2433. return
  2434. FunctionEnd
  2435. Function FindApplicationPath
  2436. Var /Global windowHandle
  2437. nsDialogs::Create /NOUNLOAD 1018
  2438. Pop $windowHandle
  2439. SendMessage $HWNDPARENT ${WM_SETTEXT} 0 "STR:Please locate the $MissingApplicationName folders."
  2440. !insertmacro BIMAGE "SnifferBanner.bmp" ""
  2441. ; Disable the next button until selection is made.
  2442. GetDlgItem $NextButton $HWNDPARENT 1
  2443. EnableWindow $NextButton "0"
  2444. #############################################################################
  2445. ## These variables hold the list of platforms for which we MAY install SNF.
  2446. ## There may be one, more or many.
  2447. ##VAR /GLOBAL isIceWarpInstalled
  2448. ##VAR /GLOBAL isMailSiteInstalled
  2449. ##VAR /GLOBAL isKerioInstalled
  2450. ##VAR /GLOBAL isImailInstalled
  2451. ##VAR /GLOBAL isSmarterMailInstalled
  2452. ##VAR /GLOBAL isAlligateInstalled
  2453. ##VAR /GLOBAL isDecludeInstalled
  2454. #VAR /GLOBAL isMXGuardInstalled
  2455. #VAR /GLOBAL isMINIMIInstalled
  2456. #VAR /GLOBAL Set_For_MINIMI_INSTALL ; may or may not be set, depending of if the user wants to re-install MINIMI
  2457. #VAR /GLOBAL SelectedCaseIndexForPlatformScreen ; This is the var for controlling the case display on the platform screen. Indxed top to bottom.
  2458. ## Now define the variables to hold the locations of WHERE we install SNF
  2459. ## in the event we select any of these options.
  2460. #VAR /GLOBAL IceWarpInstallFolder
  2461. #VAR /GLOBAL MailSiteInstallFolder
  2462. #VAR /GLOBAL KerioInstallFolder
  2463. #VAR /GLOBAL ImailInstallFolder
  2464. #VAR /GLOBAL SmarterMailInstallFolder
  2465. #VAR /GLOBAL AlligateInstallFolder
  2466. #VAR /GLOBAL DecludeInstallFolder
  2467. #VAR /GLOBAL MXGuardInstallFolder
  2468. #VAR /GLOBAL MINIMIInstallFolder
  2469. Var /Global HowToFindMessage ; var for holding the popped winhandle for the message control...
  2470. Var /Global SNF_StartLookingHere
  2471. StrCpy $SNF_StartLookingHere "C:\Program Files\SNF"
  2472. StrCpy $Compound_Enable1 "0" ; the default is you must declare at least the Sniffer directory....
  2473. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2474. ## ADDINGPLATFORM ## Step 21
  2475. ## Ok, here is the validation screens. This sub is called after you've selected the platform in the installer.
  2476. ## 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.
  2477. ## 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
  2478. ## 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
  2479. ## 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
  2480. ## keep it in the same order that you saw it in the list.
  2481. ## Steps to add this case block are:
  2482. ## Copy block. Alter DetermineXYZ call to test for specific platform.
  2483. ## Convert the file testing, adjust the user display responses.
  2484. ## If necessary, add NOPLATFORM block after Switch block.
  2485. ## Alter the default folder to display in the text block with SendMessage to hold the XYZInstallDir
  2486. ## Alter the paths in the ifFileExists tests, to reflect the platform desired.
  2487. ## Be sure to complete step 22, us the name that you unter as the callback in the NSD_OnClick button handler. i.e. LocateXYZFolder.
  2488. ## Fix the compound enable test to be happy if the proper files are where they should be.
  2489. ${Switch} $SelectedCaseIndexForPlatformScreen
  2490. ${Case} "gIWDI" ; zero indexed array... Imail with Declude gIWDI
  2491. 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:"
  2492. ## Handle the definition of the page for Imail and Declude
  2493. Call DetermineImail
  2494. StrCmp $IsImailInstalled "1" 0 NoImailFound
  2495. Call DetermineDeclude
  2496. StrCmp $IsDecludeInstalled "1" 0 NoDecludeFound
  2497. StrCpy $FindApplicationMessage "Imail was found. Please confirm the folder for Declude's global.cfg file. "
  2498. Goto +2
  2499. NoDecludeFound:
  2500. StrCpy $FindApplicationMessage "Imail was found. Declude was not. Please find Declude's global.cfg file."
  2501. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2502. Pop $SNF_SearchFor_Location ; handle
  2503. 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
  2504. ; For Declude, you need to add \declude to the end of the DecludeInstalationFolder......
  2505. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2506. Pop $SNF_SearchFor_Location_Button
  2507. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateDecludeFolder
  2508. ifFileExists "$SNFServerInstallDir\global.cfg" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2509. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2510. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2511. Call check_CompoundEnable
  2512. StrCpy $SNF_StartLookingHere "$SNFServerInstallDir\SNF" ; store the starting path here for looking.
  2513. Goto EndDisplayChoices
  2514. ${Case} "gIMXI"
  2515. 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:"
  2516. StrCpy $MissingApplicationName "Imail w/ MXGuard"
  2517. ## Handle the definition of the page for Imail and MINIMI
  2518. Call DetermineImail
  2519. StrCmp $IsImailInstalled "1" 0 NoImailFound
  2520. Call DetermineMXGuard
  2521. StrCmp $IsMXGuardInstalled "1" 0 NoMXGuardFound
  2522. StrCpy $FindApplicationMessage "Imail was found. Please confirm the folder for MXGuard. "
  2523. Goto +2
  2524. NoMXGuardFound:
  2525. StrCpy $FindApplicationMessage "Imail was found. MXGuard was not. Please find MXGuards/ install directory."
  2526. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2527. Pop $SNF_SearchFor_Location ; handle
  2528. 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
  2529. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2530. Pop $SNF_SearchFor_Location_Button
  2531. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMXGuardFolder
  2532. ifFileExists "$MXGuardInstallFolder\mxguard.ini" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2533. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2534. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2535. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2536. StrCpy $SNF_StartLookingHere "$MXGuardInstallFolder\SNF" ; store the starting path here for looking.
  2537. Goto EndDisplayChoices ;
  2538. ${Case} "gIMMI"
  2539. 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:"
  2540. StrCpy $MissingApplicationName "Imail w/ MINIMI"
  2541. ## Handle the definition of the page for Imail and MINIMI
  2542. Call DetermineImail
  2543. StrCmp $IsImailInstalled "1" 0 NoImailFound
  2544. Call DetermineMINIMI
  2545. StrCmp $IsMINIMIInstalled "1" 0 NoMINIMIFound
  2546. StrCpy $FindApplicationMessage "Imail was found. Please confirm the folder for MINIMI to be installed in $\nby finding Imail's location for smtp32. "
  2547. Goto +2
  2548. NoMINIMIFound:
  2549. StrCpy $FindApplicationMessage "Imail was found. MINIMI was not. Please confirm the location for MINIMI.$\n(Imail's location for smtp32.)"
  2550. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2551. Pop $SNF_SearchFor_Location ; handle
  2552. 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
  2553. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2554. Pop $SNF_SearchFor_Location_Button
  2555. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMINIMIFolder
  2556. ifFileExists "$MINIMIInstallFolder\SMTP32.exe" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2557. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2558. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2559. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2560. StrCpy $SNF_StartLookingHere "$MINIMIInstallFolder\SNF" ; store the starting path here for looking.
  2561. Goto EndDisplayChoices ;
  2562. ${Case} "gSWDI"
  2563. 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:"
  2564. StrCpy $MissingApplicationName "Smartermail w/ Declude"
  2565. ## Handle the definition of the page for Imail and Declude
  2566. Call DetermineSmarterMail
  2567. StrCmp $IsSmarterMailInstalled "1" 0 NoSmarterMail
  2568. Call DetermineDeclude ; handles both conditions.....
  2569. StrCmp $IsDecludeInstalled "1" 0 NoDeclude_Found
  2570. StrCpy $FindApplicationMessage "SmarterMail was found. Please confirm the folder for Declude's global.cfg file. "
  2571. Goto +2
  2572. NoDeclude_Found:
  2573. StrCpy $FindApplicationMessage "SmarterMail was found. Declude was not. Please find Declude's global.cfg file."
  2574. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2575. Pop $SNF_SearchFor_Location ; handle
  2576. 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
  2577. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2578. Pop $SNF_SearchFor_Location_Button
  2579. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateDecludeFolder
  2580. ifFileExists "$SNFServerInstallDir\global.cfg" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2581. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2582. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2583. Call check_CompoundEnable
  2584. StrCpy $SNF_StartLookingHere "$SNFServerInstallDir\SNF" ; store the starting path here for looking.
  2585. Goto EndDisplayChoices ;
  2586. ${Case} "gSMXI"
  2587. 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:"
  2588. StrCpy $MissingApplicationName "Smartermail w/ MXGuard"
  2589. ## Handle the definition of the page for Smartermail and and MXGuard
  2590. Call DetermineSmarterMail
  2591. StrCmp $IsSmarterMailInstalled "1" 0 NoSmarterMail
  2592. Call DetermineMXGuard
  2593. StrCmp $IsMXGuardInstalled "1" 0 NoSMMXGuardFound
  2594. StrCpy $FindApplicationMessage "SmarterMail was found. Please confirm the folder for MXGuard. "
  2595. Goto +2
  2596. NoSMMXGuardFound:
  2597. 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."
  2598. StrCmp $MXGuardInstallFolder "" 0 +2 ; If Its not empty then use what DetermineMXGuard found.... otherwise... use guess...
  2599. StrCpy $MXGuardInstallFolder "C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers"
  2600. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2601. Pop $SNF_SearchFor_Location ; handle
  2602. 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
  2603. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2604. Pop $SNF_SearchFor_Location_Button
  2605. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMXGuardFolder
  2606. ifFileExists "$MXGuardInstallFolder\mxguard.ini" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2607. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2608. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2609. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2610. StrCpy $SNF_StartLookingHere "$MXGuardInstallFolder\SNF" ; store the starting path here for looking.
  2611. #C:\Program Files\dgSoft Internet Services\mxGuard for Mail Servers
  2612. Goto EndDisplayChoices ;
  2613. ${Case} "gAWDI"
  2614. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with Alligate. You will need to confirm the location of the following items:"
  2615. StrCpy $MissingApplicationName "Alligate"
  2616. ## Handle the definition of the page for Imail and MINIMI
  2617. Call DetermineAlligate
  2618. StrCmp $IsAlligateInstalled "1" 0 NoAlligateFound
  2619. Call DetermineSNF4Alligate
  2620. StrCmp "1" 0 NoSNF4AlligateFound
  2621. StrCpy $FindApplicationMessage "Alligate was found. Please confirm the folder for SNF4Alligate to be installed in $\nby confirming Alligates install location for AGFiltSVC.exe "
  2622. Goto +2
  2623. NoSNF4AlligateFound:
  2624. StrCpy $FindApplicationMessage "Alligate was found. SNF4Alligate was not. Please confirm the location for SNF4Alligate \n(Same as Alligate's location for AGFiltSVC.exe)"
  2625. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2626. Pop $SNF_SearchFor_Location ; handle
  2627. 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
  2628. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2629. Pop $SNF_SearchFor_Location_Button
  2630. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateSNF4AlligateFolder
  2631. StrCpy $SNF4AlligateInstallFolder $AlligateInstallFolder
  2632. ifFileExists "$AlligateInstallFolder\AGFiltSvc.exe" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2633. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2634. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2635. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2636. StrCpy $SNF_StartLookingHere "$AlligateInstallFolder\SNF" ; store the starting path here for looking.
  2637. Goto EndDisplayChoices ;
  2638. ${Case} "gIWTICF"
  2639. ${Case} "gIWTICF2"
  2640. ${Case} "gIWTI"
  2641. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with Icewarp You will need to confirm the location of the following items:"
  2642. StrCpy $MissingApplicationName "Icewarp"
  2643. ## Handle the definition of the page for Imail and MINIMI
  2644. Call DetermineIceWarp
  2645. StrCmp $IsIceWarpInstalled "1" 0 NoIceWarpFound
  2646. IfFileExists "$IceWarpInstallFolder\config\content.xml" 0 NoContentXMLFound
  2647. StrCpy $FindApplicationMessage "IceWarp was found. Please confirm Icewarp's install location."
  2648. Goto +2
  2649. NoContentXMLFound:
  2650. StrCpy $FindApplicationMessage "IceWarp was found. Its content.xml was not. Please confirm the location of the [config] folder holding Merak\config\content.xml"
  2651. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2652. Pop $SNF_SearchFor_Location ; handle
  2653. 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
  2654. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2655. Pop $SNF_SearchFor_Location_Button
  2656. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateIceWarpFolder
  2657. ifFileExists "$IceWarpInstallFolder\config\content.xml" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2658. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2659. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2660. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2661. StrCpy $SNF_StartLookingHere "$IceWarpInstallFolder\SNF" ; store the starting path here for looking.
  2662. Goto EndDisplayChoices ;
  2663. ${Case} "gMSI"
  2664. StrCpy $Find_Explanation_INFO "MailSite isn't fully supported yet."
  2665. StrCpy $MissingApplicationName "MailSite"
  2666. StrCpy $FindApplicationMessage "MailSite was not found."
  2667. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2668. Pop $SNF_SearchFor_Location ; handle
  2669. 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
  2670. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2671. Pop $SNF_SearchFor_Location_Button
  2672. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMailSiteFolder
  2673. ifFileExists "$MailSiteInstallFolder\*.*" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2674. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2675. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2676. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2677. StrCpy $SNF_StartLookingHere "$MailSiteInstallFolder\SNF" ; store the starting path here for looking.
  2678. Goto EndDisplayChoices ;
  2679. ${Case} "gKMI"
  2680. StrCpy $Find_Explanation_INFO "Kerio isn't fully supported yet."
  2681. StrCpy $MissingApplicationName "Kerio"
  2682. StrCpy $FindApplicationMessage "Kerio was not found."
  2683. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2684. Pop $SNF_SearchFor_Location ; handle
  2685. 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
  2686. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2687. Pop $SNF_SearchFor_Location_Button
  2688. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateKerioFolder
  2689. ifFileExists "$KerioInstallFolder\*.*" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2690. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2691. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2692. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2693. StrCpy $SNF_StartLookingHere "$KerioInstallFolder\SNF" ; store the starting path here for looking.
  2694. Goto EndDisplayChoices ;
  2695. ${Case} "gMDDLL"
  2696. StrCpy $Find_Explanation_INFO "You have chosen to install Sniffer with MDaemon You will need to confirm the location of the following items:"
  2697. StrCpy $MissingApplicationName "MDaemon"
  2698. ## Handle the determination of MDaemon.
  2699. Call DetermineMDaemon
  2700. StrCmp $IsMDaemonInstalled "1" 0 NoMDaemon
  2701. StrCpy $FindApplicationMessage "MDaemon was found. Please confirm where SNF should reside:"
  2702. ifFileExists "$MDaemonInstallFolder\App\*.*" +2 0
  2703. StrCpy $FindApplicationMessage "MDaemons App folder was not found. Please confirm the MDaemon and SNF locations:"
  2704. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2705. Pop $SNF_SearchFor_Location ; handle
  2706. 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
  2707. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2708. Pop $SNF_SearchFor_Location_Button
  2709. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateMDaemonFolder
  2710. ifFileExists "$MDaemonInstallFolder\*.*" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2711. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2712. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2713. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2714. StrCpy $SNF_StartLookingHere "$MDaemonInstallFolder\SNF" ; store the starting path here for looking.
  2715. Goto EndDisplayChoices ;
  2716. ${Case} "gSNFI"
  2717. 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."
  2718. StrCpy $MissingApplicationName "Stand Alone Sniffer"
  2719. Goto EndDisplayChoices ;
  2720. ${Case} "gUSWDI"
  2721. 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:"
  2722. StrCpy $MissingApplicationName "Generic Declude Install"
  2723. ## Handle the definition of the page for Imail and Declude
  2724. Call DetermineDeclude ; handles both conditions.....
  2725. StrCmp $IsDecludeInstalled "1" 0 NoDeclude_Found
  2726. StrCpy $FindApplicationMessage "No supporting mail server was recognized. Please locate the folder holding Declude's global.cfg file. "
  2727. ${NSD_CreateDirRequest} 0 55% 75% 12u "" ; instructions
  2728. Pop $SNF_SearchFor_Location ; handle
  2729. 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
  2730. ${NSD_CreateBrowseButton} 340 55% 8% 12u "..."
  2731. Pop $SNF_SearchFor_Location_Button
  2732. ${NSD_OnClick} $SNF_SearchFor_Location_Button LocateDecludeFolder
  2733. ifFileExists "$SNFServerInstallDir\global.cfg" 0 +3 ; if the file exists then both folders could be ok... offer the next.
  2734. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2735. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2736. Call check_CompoundEnable
  2737. StrCpy $SNF_StartLookingHere "$SNFServerInstallDir\SNF" ; store the starting path here for looking.
  2738. Goto EndDisplayChoices ;
  2739. ${Case} "gCUKC"
  2740. 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."
  2741. StrCpy $MissingApplicationName "Custom / Unknown" ;
  2742. StrCpy $FindApplicationMessage ""
  2743. StrCpy $Compound_Enable2 "1" ; clear for double ok.
  2744. Call check_CompoundEnable
  2745. Goto EndDisplayChoices ;
  2746. ${Default}
  2747. ; If we get here, we have an unusual situation that leaks through teh event handler.
  2748. ; Though its not possible, you can unclick a radio button that should always have one selected.
  2749. ; and put yourself in the original state of having nothing picked... if so, disable next.
  2750. EnableWindow $NextButton "0"
  2751. ${EndSwitch}
  2752. EndDisplayChoices:
  2753. Var /GLOBAL FindINSTDIRMessage
  2754. StrCpy $FindINSTDIRMessage "Please locate the directory where you wish to install Message Sniffer. "
  2755. ; put in the header handlers.
  2756. ${NSD_CreateLabel} 0 0 75% 25% "$Find_Explanation_INFO"
  2757. Pop $0
  2758. ${NSD_CreateLabel} 0 25% 100% 30% "$FindApplicationMessage"
  2759. Pop $HowToFindMessage
  2760. ; Now put in the controls for handling the Sniffer Path.....
  2761. ${NSD_CreateLabel} 0 70% 100% 15 "Please confirm/locate the folder you wish Message Sniffer to be installed in."
  2762. Pop $HowToFindMessage
  2763. ${NSD_CreateDirRequest} 0 80% 75% 12u ""
  2764. Pop $SNF_SearchFor_LocationB
  2765. SendMessage $SNF_SearchFor_LocationB ${WM_SETTEXT} 0 "STR:$SNF_StartLookingHere" ; This is the look up for the SNIFFER Location....
  2766. ${NSD_CreateBrowseButton} 340 80% 8% 12u "..."
  2767. Pop $SNF_SearchFor_Location_ButtonB
  2768. ${NSD_OnClick} $SNF_SearchFor_Location_ButtonB LocateSNFInstallFolder
  2769. StrCmp $SNF_StartLookingHere "" +3 0
  2770. StrCpy $Compound_Enable1 "1" ; clear for double ok.
  2771. ;EnableWindow $NextButton "1" ; enable button, cause if you have 1 you have SOMETHING for the other...
  2772. Call check_CompoundEnable ; this will enable or hold based on multiple flags....
  2773. nsDialogs::Show
  2774. return
  2775. ; error handling
  2776. NoIceWarpFound:
  2777. ${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."
  2778. Pop $0
  2779. nsDialogs::Show
  2780. return
  2781. NoAlligateFound:
  2782. ${NSD_CreateLabel} 0 40 100% 80 "Alligate was not reliably installed. Registry keys do not exist. Please go back and select another install option."
  2783. Pop $0
  2784. nsDialogs::Show
  2785. return
  2786. NoImailFound:
  2787. ${NSD_CreateLabel} 0 40 100% 80 "IMail was not reliably installed. Registry keys do not exist. Please go back and select another install option."
  2788. Pop $0
  2789. nsDialogs::Show
  2790. return
  2791. NoSmarterMail:
  2792. ${NSD_CreateLabel} 0 40 100% 80 "Smartermail was not reliably installed. Registry keys do not exist. Please go back and select another install option."
  2793. Pop $0
  2794. nsDialogs::Show
  2795. return
  2796. NoMDaemon:
  2797. ${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."
  2798. Pop $0
  2799. nsDialogs::Show
  2800. return
  2801. FunctionEnd
  2802. ## ADDINGPLATFORM ## Step 21 These are the specific ( and somewhat redundant ) subs for validating each specific location. You can alter them
  2803. ## in order to satisfy the condition that all necessary files/folder exist. Otherwise, fail the compound enable variable, call check_CompoundEnable, and exit.
  2804. Function LocateIceWarpFolder
  2805. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2806. Pop $R0
  2807. ${If} $R0 != error
  2808. # NISIS 2.36
  2809. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2810. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2811. ${EndIf}
  2812. ifFileExists "$R0\config\content.xml" enableNext 0
  2813. MessageBox MB_OK "Unable to locate 'config\content.xml' in this selected folder. Please select the folder where [folder]\config\content.xml will resolve."
  2814. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2815. call check_CompoundEnable ; unenable.....
  2816. return
  2817. enableNext:
  2818. StrCpy $IceWarpInstallFolder $R0
  2819. ; but we can work with that either way.....
  2820. StrCpy $Compound_Enable2 "1"
  2821. call check_CompoundEnable ; unenable.....
  2822. return
  2823. FunctionEnd ;LocateIceWarpInstallFolder
  2824. Function LocateKerioFolder
  2825. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:Kerio Not Supported yet."
  2826. MessageBox MB_OK "Kerio is not yet supported."
  2827. FunctionEnd
  2828. Function LocateMailSiteFolder
  2829. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:MailSite Not Supported yet."
  2830. MessageBox MB_OK "MailSite is not yet supported."
  2831. FunctionEnd
  2832. Function LocateSNFInstallFolder
  2833. nsDialogs::SelectFolderDialog /NOUNLOAD $FindINSTDIRMessage $R0
  2834. Pop $R0
  2835. ${If} $R0 != error
  2836. # NISIS 2.36
  2837. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2838. SendMessage $SNF_SearchFor_LocationB ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2839. ${EndIf}
  2840. StrCmp $R0 "" 0 testNext ; Refuse to enable if not completed.... ( will need to have complete code for all folders.... i.e. validation screen)
  2841. EnableWindow $NextButton "0"
  2842. StrCpy $Compound_Enable1 "0" ; the default is you must declare at least the Sniffer directory....
  2843. return
  2844. testNext:
  2845. ; 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.
  2846. ifFileExists "$R0\SNFClient.exe" 0 testForOldSniffer ; if true, this means it exists... and the user selected the Sniffer directory.
  2847. StrCpy $INSTDIR $R0 ; Store install folder.....
  2848. Goto enableNext
  2849. testForOldSniffer:
  2850. ifFileExists "$R0\snf2check.exe" 0 useThisFolder ; if true, this means it exists... and the user selected an older Sniffer directory.
  2851. StrCpy $INSTDIR $R0 ; Store install folder.....
  2852. Goto enableNext
  2853. useThisFolder:
  2854. ; ok, but we need to determine if the SNF folder was already created here...
  2855. ${GetParent} $R0 $R1 ; put the parent of the selected folder a the SNFServerInstallDir.... and leave the archiver to deal....
  2856. ifFileExists "$R1\SNF\*.*" 0 +3
  2857. StrCpy $INSTDIR $R0 ; User selected the SNF directory...
  2858. Goto EnableNext ; But for our install directory.....
  2859. ifFileExists "$R1\Sniffer\*.*" 0 +3
  2860. StrCpy $INSTDIR $R0 ; User selected the sniffer directory...
  2861. Goto EnableNext ; But for our install directory.....
  2862. ; Ok well can't find any normal files, so we'll presume we mean make it here....
  2863. StrCpy $INSTDIR "$R0\SNF" ; Store install folder.....
  2864. CreateDirectory $INSTDIR ; If its not here, then we'll create it, and set it to SNF...
  2865. enableNext:
  2866. SendMessage $SNF_SearchFor_LocationB ${WM_SETTEXT} 0 "STR:$INSTDIR" ; This is the look up for the SNIFFER Location....
  2867. StrCpy $Compound_Enable1 "1" ; the default is you must declare at least the Sniffer directory....
  2868. Call check_CompoundEnable
  2869. ; This gets called in checkCompoundEnable if all the components agree.....;EnableWindow $NextButton "1"
  2870. return
  2871. FunctionEnd ;LocateSNFInstallFolder
  2872. Function LocateSNF4AlligateFolder
  2873. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2874. Pop $R0
  2875. ${If} $R0 != error
  2876. # NISIS 2.36
  2877. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2878. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2879. ${EndIf}
  2880. ifFileExists "$R0\AGFiltSvc.exe" enableNext 0
  2881. MessageBox MB_OK "Unable to locate 'AGFiltSvc.exe' in the selected folder. Please select the folder where Alligate's AGFiltSvc.exe exists."
  2882. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2883. call check_CompoundEnable ; unenable.....
  2884. return
  2885. enableNext:
  2886. StrCpy $SNF4AlligateInstallFolder $R0 ; Store declude folder.....
  2887. ifFileExists "$SNF4AlligateInstallFolder\SNF4Alligate.exe" 0 +2
  2888. StrCpy $IsMINIMIInstalled "1"
  2889. ; but we can work with that either way.....
  2890. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2891. call check_CompoundEnable ; unenable.....
  2892. return
  2893. FunctionEnd
  2894. Function LocateMINIMIFolder
  2895. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2896. Pop $R0
  2897. ${If} $R0 != error
  2898. # NISIS 2.36
  2899. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2900. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2901. ${EndIf}
  2902. ifFileExists "$R0\SMTP32.exe" enableNext 0
  2903. MessageBox MB_OK "Unable to locate 'SMTP32.exe' in the selected folder. Please select the folder where IMails SMTP32.exe exists."
  2904. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2905. call check_CompoundEnable ; unenable.....
  2906. return
  2907. enableNext:
  2908. StrCpy $MINIMIInstallFolder $R0 ; Store declude folder.....
  2909. ifFileExists "$MINIMIInstallFolder\SNFIMailShim.exe" 0 +2
  2910. StrCpy $IsMINIMIInstalled "1"
  2911. ; but we can work with that either way.....
  2912. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2913. call check_CompoundEnable ; unenable.....
  2914. return
  2915. FunctionEnd
  2916. ##
  2917. Function LocateMDaemonFolder
  2918. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2919. Pop $R0
  2920. ${If} $R0 != error
  2921. # NISIS 2.36
  2922. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2923. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2924. ${EndIf}
  2925. ifFileExists "$R0\SpamAssassin\rules\*.*" nextTest 0
  2926. MessageBox MB_OK "Unable to locate the Spam Assassin rules folder in the chosen MDaemon install location. Please select the root MDaemon Folder."
  2927. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2928. call check_CompoundEnable ; unenable.....
  2929. return
  2930. nextTest:
  2931. ifFileExists "$R0\app\MDaemon.exe" enableNext 0
  2932. MessageBox MB_OK "Unable to locate the [Root]\App\MDaemon.exe folder in the chosen MDaemon install location. Please select the root MDaemon Folder."
  2933. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2934. call check_CompoundEnable ; unenable.....
  2935. return
  2936. enableNext:
  2937. StrCpy $MXGuardInstallFolder $R0 ; Store declude folder.....
  2938. StrCpy $IsMXGuardInstalled "1"
  2939. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2940. call check_CompoundEnable ; unenable.....
  2941. return
  2942. FunctionEnd
  2943. Function LocateMXGuardFolder
  2944. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2945. Pop $R0
  2946. ${If} $R0 != error
  2947. # NISIS 2.36
  2948. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2949. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2950. ${EndIf}
  2951. ifFileExists "$R0\mxguard.ini" enableNext 0
  2952. MessageBox MB_OK "Unable to locate 'mxguard.ini' in the selected folder. Please select the folder where MXGuards .ini file resides."
  2953. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2954. call check_CompoundEnable ; unenable.....
  2955. return
  2956. enableNext:
  2957. StrCpy $MXGuardInstallFolder $R0 ; Store declude folder.....
  2958. StrCpy $IsMXGuardInstalled "1"
  2959. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2960. call check_CompoundEnable ; unenable.....
  2961. return
  2962. FunctionEnd
  2963. Function LocateDecludeFolder
  2964. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2965. Pop $R0
  2966. ${If} $R0 != error
  2967. # NISIS 2.36
  2968. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2969. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2970. ${EndIf}
  2971. ifFileExists "$R0\global.cfg" enableNext 0
  2972. MessageBox MB_OK "Unable to locate 'global.cfg' in the selected folder. Please select the folder where Decludes global.cfg resides."
  2973. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2974. call check_CompoundEnable ; unenable.....
  2975. return
  2976. enableNext:
  2977. StrCpy $DecludeInstallFolder $R0 ; Store declude folder.....
  2978. StrCpy $IsDecludeInstalled "1"
  2979. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  2980. call check_CompoundEnable ; unenable.....
  2981. return
  2982. FunctionEnd
  2983. Function LocateSmarterMailFolder
  2984. nsDialogs::SelectFolderDialog /NOUNLOAD $FindApplicationMessage $R0
  2985. Pop $R0
  2986. ${If} $R0 != error
  2987. # NISIS 2.36
  2988. # ${NSD_SetText} $DIGI.DestinationLocations.DirRequest1 "$R0"
  2989. SendMessage $SNF_SearchFor_Location ${WM_SETTEXT} 0 "STR:$R0" ; set the text box on the previous screen
  2990. ${EndIf}
  2991. ifFileExists "$R0\global.cfg" enableNext 0
  2992. MessageBox MB_OK "Unable to locate 'global.cfg' in the selected folder. Please select the folder where Decludes global.cfg resides."
  2993. StrCpy $Compound_Enable2 "0" ; but maybe the declude dir?
  2994. call check_CompoundEnable ; unenable.....
  2995. return
  2996. enableNext:
  2997. StrCpy $DecludeInstallFolder $R0 ; Store declude folder.....
  2998. StrCpy $IsDecludeInstalled "1"
  2999. StrCpy $Compound_Enable2 "1" ; but maybe the declude dir?
  3000. call check_CompoundEnable ; unenable.....
  3001. return
  3002. FunctionEnd
  3003. ## ADDINGPLATFORM ## Step 22
  3004. ## 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
  3005. ## are touching, for the one time rollback. ( Continue the same keyword thread in that file, in order to complete this process. GL.
  3006. ##