confserv.pl 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773
  1. #========================================================================
  2. #
  3. # Microsoft Travel Technologies - Travel Server Configuration Script
  4. #
  5. # Copyright <cp> 1997 Microsoft Corporation, All Rights Reserved
  6. #
  7. # Modification History:
  8. # ---Date--- -Blame-- -Description of change------------------------
  9. # 1997.09.01 MarkSn Created.
  10. #
  11. #========================================================================
  12. {
  13. require "nt.ph";
  14. require "registry.pl";
  15. if (! &_vCSInitialize())
  16. {
  17. die;
  18. }
  19. &_vOpenLog($ENV{'temp'}, "$ENV{'COMPUTERNAME'}Conf");
  20. if (&_fGetDirections())
  21. {
  22. if ($g_fLogOpen)
  23. {
  24. &_vLogSilent("$g_sLogFilename");
  25. &_vLogSilent('-' x 50);
  26. &_vLogSilent("Microsoft Travel Technologies");
  27. &_vLogSilent("Travel Server Configuration Script - log file");
  28. &_vLogSilent('-' x 50);
  29. }
  30. my $sMessage = "\r\nStarting Travel Server configuration process.\r\nClean = '$g_fClean'\r\nQuiet = '$g_fQuiet'\r\nInput = '$g_sInputFilename'\r\nOutput = '$g_sOutputFilename'\r\nReport = '$g_sReportFilename'";
  31. &NTWriteEventLog( $ENV{"COMPUTERNAME"}, $0, EVENTLOG_INFORMATION_TYPE, 0, 0, &NULL, 0, $sMessage);
  32. &_vFollowDirections();
  33. # &NTWriteEventLog( $ENV{"COMPUTERNAME"}, $0, EVENTLOG_INFORMATION_TYPE, 0, 0, &NULL, 0, "\r\nFinished configuring Travel Server.\r\n");
  34. &_vCloseLog();
  35. print "Complete.";
  36. }
  37. }
  38. # ===========================================================================
  39. # This function determines what the user wants us to do. This can come from
  40. # command-line parameters, which could also specify an import file from which
  41. # to get more directions, or we could walk the user through a set of dialogs
  42. # to query for the instructions. Returns $true if successful in getting the
  43. # options necessary to continue, $false if not.
  44. #
  45. sub _fGetDirections
  46. {
  47. if (($#ARGV+1) eq 0)
  48. {
  49. # no command line parameters means that the user wants us to ask what to do.
  50. if (&_cDialog("Main") eq 'x')
  51. {
  52. return $false;
  53. }
  54. $g_fClean = (&_sGetOptionValueByName('Main', 'clean') eq 'X');
  55. $g_fNoChanges = (&_sGetOptionValueByName('Main', 'report') eq 'X');
  56. $g_sReportFilename = &_sGetSettingValueByName('Main', 'repfil');
  57. $g_sInputFilename = &_sGetSettingValueByName('Main', 'inpfil');
  58. $g_sOutputFilename = &_sGetSettingValueByName('Main', 'outfil');
  59. }
  60. else
  61. {
  62. # Parse the command line parameters to determine what the user
  63. # wants us to do.
  64. my $i = 0;
  65. for ($i=0; $i <= $#ARGV; $i++)
  66. {
  67. if ($ARGV[$i] =~ /-q()*/)
  68. {
  69. if ($g_fQuiet)
  70. {
  71. print "Syntax: '-q' specified twice.\n";
  72. &_vPrintHelp();
  73. return $false;
  74. }
  75. $g_fQuiet = $true;
  76. }
  77. elsif ($ARGV[$i] =~ /-c()*/)
  78. {
  79. $g_fClean = $true;
  80. }
  81. elsif ($ARGV[$i] =~ /-n()*/)
  82. {
  83. $g_fNoChanges = $true;
  84. }
  85. elsif ($ARGV[$i] =~ /-r()*/)
  86. {
  87. # parse for filename as next token
  88. $i++;
  89. if ($i gt $#ARGV)
  90. {
  91. print "Syntax: ran out of tokens for '-r' filename.\n";
  92. &_vPrintHelp();
  93. return $false;
  94. }
  95. if ($ARGV[$i] =~ /-()*/)
  96. {
  97. print "Syntax: missing or invalid filename for '-r': '$ARGV[$i]'.\n";
  98. &_vPrintHelp();
  99. return $false;
  100. }
  101. $g_sReportFilename = $ARGV[$i];
  102. }
  103. elsif ($ARGV[$i] =~ /-i()*/)
  104. {
  105. # parse for filename as next token
  106. $i++;
  107. if ($i gt $#ARGV)
  108. {
  109. print "Syntax: ran out of tokens for '-i' filename.\n";
  110. &_vPrintHelp();
  111. return $false;
  112. }
  113. if ($ARGV[$i] =~ /-()*/)
  114. {
  115. print "Syntax: missing or invalid filename for '-i': '$ARGV[$i]'.\n";
  116. &_vPrintHelp();
  117. return $false;
  118. }
  119. $g_sInputFilename = $ARGV[$i];
  120. }
  121. elsif ($ARGV[$i] =~ /-o()*/)
  122. {
  123. # parse for filename as next token
  124. $i++;
  125. if ($i gt $#ARGV)
  126. {
  127. print "Syntax: ran out of tokens for '-o' filename.\n";
  128. &_vPrintHelp();
  129. return $false;
  130. }
  131. if ($ARGV[$i] =~ /-()*/)
  132. {
  133. print "Syntax: missing or invalid filename for '-o': '$ARGV[$i]'.\n";
  134. &_vPrintHelp();
  135. return $false;
  136. }
  137. $g_sOutputFilename = $ARGV[$i];
  138. }
  139. elsif ($ARGV[$i] =~ /-h()*/ || $ARGV[$i] =~ /-\?()*/)
  140. {
  141. &_vPrintHelp();
  142. return $false;
  143. }
  144. else
  145. {
  146. print "Syntax: Unrecognized token.\n";
  147. &_vPrintHelp();
  148. return $false;
  149. }
  150. }
  151. }
  152. if (!$g_fClean)
  153. { # input filename required if not clean
  154. if ($g_fQuiet) # can't ask for input, so must error out
  155. {
  156. if ($g_sInputFilename eq "")
  157. {
  158. print "Input filename required.\n";
  159. return $false;
  160. }
  161. elsif(!-e $g_sInputFilename)
  162. {
  163. print "Missing or invalid input filename: '$g_sInputFilename'.\n";
  164. return $false;
  165. }
  166. }
  167. elsif ($g_sInputFilename eq "")
  168. {
  169. return (&_cQuestionnaire() ne 'x');
  170. }
  171. else
  172. {
  173. # open the input file and read the override settings.
  174. if (open INPFILE, "<$g_sInputFilename")
  175. {
  176. my $iLine = 0;
  177. # print "File open successful.\n";
  178. # the first line _may_ be "REGEDIT". If so, ignore it.
  179. my $sFileFormat = <INPFILE>;
  180. chop $sFileFormat;
  181. if ($sFileFormat eq "REGEDIT4")
  182. {
  183. $iLine++;
  184. my $sHive = "";
  185. my $sKey = "";
  186. my $sLocation = "";
  187. my $sValueName = "";
  188. my $sValue = "";
  189. my $sClass = "";
  190. while(<INPFILE>)
  191. {
  192. $iLine++;
  193. chop; # remove the carriage return from the end of the line
  194. next if (!/\S/); # if line doesn't contain a non-whitespace character, skip it
  195. # print "$_\n";
  196. if (/\[(.+?)\\(.+)]/)
  197. {
  198. # print "Line $iLine: Found key descriptor: '$1' '$2'\n";
  199. my $sx = $1;
  200. my $sy = $2;
  201. if ($sx eq "HKLM" || $sx eq "HKEY_LOCAL_MACHINE")
  202. {
  203. $sHive = &HKEY_LOCAL_MACHINE;
  204. $sKey = $sy;
  205. }
  206. elsif ($sx eq "HKEY_CLASSES_ROOT")
  207. {
  208. $sHive = &HKEY_CLASSES_ROOT;
  209. $sKey = $sy;
  210. }
  211. elsif ($sx eq "HKEY_CURRENT_USER")
  212. {
  213. $sHive = &HKEY_CURRENT_USER;
  214. $sKey = $sy;
  215. }
  216. elsif ($sx eq "HKEY_USERS")
  217. {
  218. $sHive = &HKEY_USERS;
  219. $sKey = $sy;
  220. }
  221. else
  222. {
  223. &_vLog("Line $iLine: Unrecognized hive descriptor '$sx'");
  224. return $false;
  225. }
  226. $sLocation = &_sGetLocationFromHiveKey($sHive, $sKey);
  227. # print "Location: '$sLocation'\n";
  228. }
  229. else
  230. {
  231. if (/"(.+?)"=(.+)/)
  232. {
  233. $sValueName = $1;
  234. $_ = $2;
  235. if (/"(.+)"/)
  236. {
  237. $sClass = &REG_SZ;
  238. $sValue = $1;
  239. }
  240. elsif ($_ eq "\"\"")
  241. {
  242. $sClass = &REG_SZ;
  243. $sValue = "";
  244. }
  245. elsif (/dword:(.+)/)
  246. {
  247. $sClass = &REG_DWORD;
  248. $sValue = hex($1);
  249. }
  250. else
  251. {
  252. &_vLog("Line $iLine: Unsupported class for value '$_'");
  253. return $false;
  254. }
  255. if ($sLocation eq "")
  256. {
  257. &_vLog("Line $iLine: Value descriptor without hive");
  258. return $false;
  259. }
  260. # print "Line $iLine: Found value descriptor: '$sValueName'='$sValue'\n";
  261. my ($sTable,$iEntry) = _snGetTableIndexFromLocationValueName($sLocation, $sValueName);
  262. if ($sTable eq "" && $iEntry eq 0)
  263. {
  264. &_vLog( "Line $iLine: Value '$sValueName' not supported." );
  265. return $false;
  266. }
  267. if ($$sTable[$iEntry+2] eq $sClass)
  268. {
  269. $$sTable[$iEntry+3] = $sValue;
  270. }
  271. else
  272. {
  273. &_vLog( "Line $iLine: Input file class mismatch." );
  274. return $false;
  275. }
  276. }
  277. else
  278. {
  279. # any line that doesn't start with '[' or '"' is a comment
  280. # &_vLog("Line $iLine: Unrecognized format.");
  281. # return $false;
  282. }
  283. }
  284. }
  285. }
  286. elsif ($sFileFormat eq "REGEDIT")
  287. {
  288. &_vLog("REGEDIT file format not currently supported.");
  289. return $false;
  290. }
  291. else
  292. {
  293. &_vLog("Unrecognized file format not supported.");
  294. return $false;
  295. }
  296. }
  297. else
  298. {
  299. &_vLog( "Unable to open input file, '$g_sInputFilename'" );
  300. return $false;
  301. }
  302. }
  303. }
  304. if ($g_sOutputFilename eq "")
  305. {
  306. $g_sOutputFilename = &_sGetUniqueFilename("$ENV{'TEMP'}\\ConfServOutput", "txt");
  307. }
  308. if ($g_sOutputFilename ne "")
  309. {
  310. # open output file and add the headers
  311. if (open OUTFILE, ">$g_sOutputFilename")
  312. {
  313. print OUTFILE "REGEDIT4\n";
  314. print OUTFILE "* This file created by ConfServ.pl\n";
  315. print OUTFILE "* Use this file to revert to the settings prior to running ConfServ.pl\n";
  316. print OUTFILE "\n";
  317. }
  318. else
  319. {
  320. &_vLog( "Unable to open output file, '$g_sOutputFilename'" );
  321. return $false;
  322. }
  323. }
  324. return $true;
  325. }
  326. # ===========================================================================
  327. # This function asks the user for the mandatory registry settings. Then
  328. # they are asked if they want to edit any of the optional settings. After
  329. # that, they are asked if they want to add any of the optional-existing keys.
  330. #
  331. sub _cQuestionnaire
  332. {
  333. my $iQ = 0;
  334. my $iMax = $#srRegMandatory;
  335. for ($iQ = 0; $iQ <= $iMax; $iQ+=5)
  336. {
  337. my $sKey = $srRegMandatory[$iQ];
  338. my $sHive = &_sGetTableColValByColVal("srRegLocations", 3, 1, 0, $sKey);
  339. my $sHiveFriendly = &_sGetHiveFriendlyName($sHive);
  340. my $sClass = $srRegMandatory[$iQ+2];
  341. my $sClassFriendly = &_sGetClassFriendlyName($sClass);
  342. my $sTree = &_sGetTableColValByColVal("srRegLocations", 3, 2, 0, $sKey);
  343. my ($fSucc,$sValue)= &_fsGetRegValue($sHive, $sTree, $srRegMandatory[$iQ+1]);
  344. &_vPrintHeading();
  345. print "- Required Settings ----------------------------------------------------\n";
  346. print " Hive: $sHiveFriendly\n";
  347. print " Tree: $sTree\n";
  348. print " Key Name: $srRegMandatory[$iQ+1]\n";
  349. print " Class: $sClassFriendly\n\n";
  350. my $sLabel = " Description: ";
  351. my $sDesc = $srRegMandatory[$iQ+4];
  352. my $iD = 0;
  353. for ($iD = 0; $iD < 5; $iD++)
  354. {
  355. $_ = $sDesc;
  356. ($sPortion, $sDesc) = /(.{1,55})(.*)/;
  357. print "$sLabel$sPortion\n";
  358. $sLabel = " ";
  359. }
  360. print "\n";
  361. if ($fSucc)
  362. {
  363. print "Current Value: '$sValue'\n";
  364. }
  365. else
  366. {
  367. print "Current Value: (key does not exist)\n";
  368. }
  369. if ($srRegMandatory[$iQ+3] ne $sValue)
  370. {
  371. print "Change Value To: '$srRegMandatory[$iQ+3]'\n\n";
  372. }
  373. else
  374. {
  375. print "\n\n";
  376. }
  377. print "- What do you want to do? ----------------------------------------------\n";
  378. print "(e) Edit Setting (b) Back (n) Next (x) Exit\n\n";
  379. $cChoice = &_cAskSet($true, "Please choose one:", "ebnx", "x");
  380. if ($cChoice eq 'x')
  381. {
  382. return $cChoice;
  383. }
  384. elsif ($cChoice eq 'e')
  385. {
  386. $srRegMandatory[$iQ+3] = &_sQueryAndConfirm($srRegMandatory[$iQ+3], "Value for '$srRegMandatory[$iQ+1]'");
  387. $iQ -= 5;
  388. }
  389. elsif ($cChoice eq 'b')
  390. {
  391. if ($iQ gt 0)
  392. {
  393. $iQ -= 10;
  394. }
  395. else
  396. {
  397. $iQ -= 5;
  398. }
  399. }
  400. }
  401. # TODO: ask them about the big set of options.
  402. # TODO: ask them about the last set of keys that don't even have to exist.
  403. }
  404. # ===========================================================================
  405. # This function retrieves the specified value from the registry.
  406. #
  407. sub _fsGetRegValue
  408. {
  409. local ($sHive, $sRegKey, $sRegValueName) = @_;
  410. if (&NTRegOpenKeyEx ($sHive, $sRegKey, 0, &KEY_ALL_ACCESS, $key))
  411. # if (&NTRegOpenKey ($sHive, $sRegKey, $key))
  412. {
  413. my $sRegValue = "";
  414. if (&NTRegQueryValueEx ($key, $sRegValueName, 0, $sClass, $sRegValue))
  415. {
  416. if ($sClass eq 1)
  417. {
  418. return ($true, $sRegValue);
  419. }
  420. elsif ($sClass eq 4)
  421. {
  422. my $sTest = unpack( "I", $sRegValue );
  423. return ($true, $sTest);
  424. }
  425. else
  426. {
  427. print "*** unsupported class found for $sRegKey\\$sRegValueName($sClass)!!!\n";
  428. return ($false, "");
  429. }
  430. }
  431. else
  432. {
  433. # print "NTRegQueryValueEx failed.\n";
  434. }
  435. }
  436. else
  437. {
  438. # print "NTRegOpenKeyEx failed.\n";
  439. }
  440. return ($false, "");
  441. }
  442. # ===========================================================================
  443. # This function is passed a registry hive identifier and a key-value name,
  444. # the value name. The value will be deleted.
  445. #
  446. sub _fRemoveRegValue
  447. {
  448. local ($sHive, $sKey, $sValue) = @_;
  449. if (&NTRegOpenKeyEx ($sHive, $sKey, 0, &KEY_ALL_ACCESS, $key))
  450. {
  451. if (&NTRegDeleteValue($key, $sValue))
  452. {
  453. return $true;
  454. }
  455. }
  456. else
  457. {
  458. &_vLog( "Unable to open reg key to delete." );
  459. }
  460. return $false;
  461. }
  462. # ===========================================================================
  463. # This function is passed a registry hive identifier and a key-value name,
  464. # the value name, plus a new value. The reg key is set to the new value.
  465. #
  466. sub _fChangeRegValue
  467. {
  468. local ($sHive, $sKey, $sClass, $sValueName, $sNewValue) = @_;
  469. if (&NTRegCreateKeyEx ($sHive, $sKey, &NULL, "mtt", &REG_OPTION_NON_VOLATILE, &KEY_ALL_ACCESS, &NULL, $hkey, $disposition))
  470. {
  471. if ($sClass eq &REG_SZ)
  472. {
  473. if (&NTRegSetValueEx( $hkey, $sValueName, &NULL, $sClass, $sNewValue))
  474. {
  475. return $true;
  476. }
  477. }
  478. elsif ($sClass eq &REG_DWORD)
  479. {
  480. #my $sTest = pack( "I", $sNewValue );
  481. if (&NTRegSetValueEx( $hkey, $sValueName, &NULL, $sClass, $sNewValue))
  482. {
  483. return $true;
  484. }
  485. }
  486. else
  487. {
  488. print "*** unsupported class found for $sKey\\$sValueName($sClass)!!!\n";
  489. return $false;
  490. }
  491. }
  492. else
  493. {
  494. print "Unable to create key.\n";
  495. }
  496. return $false;
  497. }
  498. # ===========================================================================
  499. # This function acts on what the user specified they want us to do.
  500. #
  501. sub _vFollowDirections
  502. {
  503. my $sLastKey = "";
  504. my $iQ = 0;
  505. my $iMax = $#srRegMandatory;
  506. for ($iQ = 0; $iQ <= $iMax; $iQ+=5)
  507. {
  508. if ($g_sOutputFilename ne "" && $sLastKey ne $srRegMandatory[$iQ])
  509. {
  510. $sLastKey = $srRegMandatory[$iQ];
  511. print OUTFILE "[]\n";
  512. }
  513. my $sAction = &_sUpdateRegistryValues( "srRegMandatory", $iQ );
  514. &_vLogSilent( $sAction );
  515. }
  516. $iMax = $#srRegAdvanced;
  517. for ($iQ = 0; $iQ <= $iMax; $iQ+=5)
  518. {
  519. my $sAction = &_sUpdateRegistryValues( "srRegAdvanced", $iQ );
  520. &_vLogSilent( $sAction );
  521. }
  522. $iMax = $#srRegOptional;
  523. for ($iQ = 0; $iQ <= $iMax; $iQ+=5)
  524. {
  525. my $sAction = &_sUpdateRegistryValues( "srRegOptional", $iQ );
  526. &_vLogSilent( $sAction );
  527. }
  528. }
  529. # ===========================================================================
  530. # This function acts on what the user specified they want us to do.
  531. #
  532. sub _sUpdateRegistryValues
  533. {
  534. local ($sTable, $iQ) = @_;
  535. my $sKey = $$sTable[$iQ];
  536. my $sHive = &_sGetTableColValByColVal("srRegLocations", 3, 1, 0, $sKey);
  537. my $sHiveFriendly = &_sGetHiveFriendlyName($sHive);
  538. my $sClass = $$sTable[$iQ+2];
  539. my $sClassFriendly = &_sGetClassFriendlyName($sClass);
  540. my $sTree = &_sGetTableColValByColVal("srRegLocations", 3, 2, 0, $sKey);
  541. my ($fSucc,$sValue)= &_fsGetRegValue($sHive, $sTree, $$sTable[$iQ+1]);
  542. my $sNewValue = $$sTable[$iQ+3];
  543. local $sAction = "[$$sTable[$iQ+1]] ";
  544. if ($fSucc)
  545. {
  546. $sAction = $sAction . "found [$sValue], ";
  547. # $sOutput =
  548. if ($g_fClean)
  549. {
  550. $sAction = $sAction . "removing.";
  551. if (!&_fRemoveRegValue ($sHive, $sTree, $$sTable[$iQ+1]))
  552. {
  553. $sAction = $sAction . " ***FAILED***";
  554. }
  555. }
  556. else
  557. {
  558. if ($sValue eq $sNewValue)
  559. {
  560. $sAction = $sAction . "no change.";
  561. }
  562. else
  563. {
  564. $sAction = $sAction . "changes to [$sNewValue].";
  565. if (!$g_fNoChanges)
  566. {
  567. if (&_fChangeRegValue ($sHive, $sTree, $sClass, $$sTable[$iQ+1], $sNewValue))
  568. {
  569. my ($fNewSucc, $sChangedValue) = &_fsGetRegValue($sHive, $sTree, $$sTable[$iQ+1]);
  570. if (!$fNewSucc || ($sChangedValue ne $sNewValue))
  571. {
  572. $sAction = $sAction . " ***FAILED***";
  573. }
  574. }
  575. else
  576. {
  577. $sAction = $sAction . " ***FAILED***";
  578. }
  579. }
  580. }
  581. }
  582. }
  583. else
  584. {
  585. $sAction = $sAction . "not found, ";
  586. if ($g_fClean)
  587. {
  588. $sAction = $sAction . "so can't remove.";
  589. }
  590. else
  591. {
  592. $sAction = $sAction . "add value [$sNewValue].";
  593. if (!$g_fNoChanges)
  594. {
  595. if (&_fChangeRegValue ($sHive, $sTree, $sClass, $$sTable[$iQ+1], $sNewValue))
  596. {
  597. my ($fNewSucc, $sChangedValue) = &_fsGetRegValue($sHive, $sTree, $$sTable[$iQ+1]);
  598. if (!$fNewSucc || ($sChangedValue ne $sNewValue))
  599. {
  600. $sAction = $sAction . " ***FAILED***";
  601. }
  602. }
  603. else
  604. {
  605. $sAction = $sAction . " ***FAILED***";
  606. }
  607. }
  608. }
  609. }
  610. return $sAction;
  611. }
  612. # ===========================================================================
  613. # This function acts on what the user specified they want us to do.
  614. #
  615. sub _vPrintHelp
  616. {
  617. # &_vPrintHeading();
  618. print "Format: ConfigGateway [options]\n";
  619. print " where [options] can be one or more of the following:\n";
  620. print " -i(nput) <filename>\n";
  621. print " Uses <filename> for override values.\n";
  622. print " -o(utput) <filename> | NOFILE\n";
  623. print " <filename> specifies location of backup settings file.\n";
  624. print " 'NOFILE' causes no output file to be generated.\n";
  625. print " -c(lean)\n";
  626. print " Clears all settings.\n";
  627. print " -n(o changes)\n";
  628. print " Generate report, but don't change registry.\n";
  629. print " -r(eport) <filename>\n";
  630. print " Outputs values for all settings in readable format.\n";
  631. print " -q(uiet)\n";
  632. print " Causes no output to be displayed on the screen.\n";
  633. print " Syntax or other errors will still be displayed.\n";
  634. print " -h(elp), -?\n";
  635. print " Causes this help screen to be displayed.\n";
  636. return;
  637. }
  638. # ===========================================================================
  639. # This dialog function asks what components to install, and calls other
  640. # subroutines based on whether the component selected has more options
  641. # that can be modified.
  642. #
  643. sub _cDialog
  644. {
  645. local($sDialogName) = @_;
  646. &_vLogSilent("$sDialogName Dialog");
  647. my $sOptions = "srOption$sDialogName";
  648. my $sSettings = "srSetting$sDialogName";
  649. my $sValidChoices = "";
  650. my $cChoice = "";
  651. my $cChoiceName = "";
  652. while ($true)
  653. {
  654. &_vPrintHeading();
  655. $sValidChoices = "";
  656. print "- Install Settings -----------------------------------------------------\n";
  657. my $nSettings = ($#$sSettings)+1;
  658. my $i = 0;
  659. for ($i = 0; $i < $nSettings; $i+=4)
  660. {
  661. $sValidChoices .= $$sSettings[$i];
  662. print " $$sSettings[$i]. $$sSettings[$i+2] [$$sSettings[$i+3]]\n";
  663. }
  664. print "\n";
  665. print "- Install Options ------------------------------------------------------\n";
  666. local $nOptions = ($#$sOptions)+1;
  667. for ($i = 0; $i < $nOptions; $i+=4)
  668. {
  669. $sValidChoices .= $$sOptions[$i];
  670. $cActive = &_cGetActiveFlagByName($sDialogName, $$sOptions[$i+1]);
  671. print " $cActive $$sOptions[$i]. $$sOptions[$i+2]\n";
  672. }
  673. print "\n";
  674. print "- What do you want to do? ----------------------------------------------\n";
  675. print "Edit setting/option by letter/number (n) Next (x) Exit\n\n";
  676. $sValidChoices .= "nx";
  677. $cChoice = &_cAskSet($true, "Please choose one:", $sValidChoices, "x");
  678. if (index("nx", $cChoice) ge 0)
  679. {
  680. return $cChoice;
  681. }
  682. elsif ($cChoice =~ /[a-m]/) # valid settings can be a thru m
  683. {
  684. my $cChoiceName = &_sGetSettingNameByIndex($sDialogName, $cChoice);
  685. my $sChoiceValue = &_sGetSettingValueByName($sDialogName, $cChoiceName);
  686. my $sChoiceDesc = &_sGetSettingDescByName($sDialogName, $cChoiceName);
  687. $sChoiceValue = &_sQueryAndConfirm($sChoiceValue, $sChoiceDesc);
  688. &_vSetSettingValueByName($sDialogName, $cChoiceName, $sChoiceValue);
  689. }
  690. else
  691. {
  692. my $cChoiceName = &_sGetOptionNameByIndex($sDialogName, $cChoice);
  693. my $sChoiceDesc = &_sGetOptionDescByName($sDialogName, $cChoiceName);
  694. my $sChoiceValue = &_sGetOptionValueByName($sDialogName, $cChoiceName);
  695. if ($sChoiceValue eq ' ' || $sChoiceValue eq 'X')
  696. {
  697. $sChoiceValue = ' ';
  698. if (&_fAskYN( $true, "Install $sChoiceDesc" ))
  699. {
  700. $sChoiceValue = 'X';
  701. }
  702. &_vSetOptionValueByName($sDialogName, $cChoiceName, $sChoiceValue);
  703. }
  704. else
  705. {
  706. &_cDialog($sChoiceValue);
  707. }
  708. }
  709. }
  710. }
  711. # ===========================================================================
  712. # Ask the user to confirm or re-enter the specified answer to the specified
  713. # question.
  714. #
  715. sub _sQueryAndConfirm
  716. {
  717. local($value, $title) = @_;
  718. &_vLogSilent("Option is [$title], value is [$value].");
  719. while (! &_fAskYN ($true, "$title [$value]. Okay?"))
  720. {
  721. print "Enter the alternate value now: ";
  722. $value = <STDIN>;
  723. chop $value;
  724. &_vLogSilent("Option is [$title], user changed value to [$value].");
  725. }
  726. $value;
  727. }
  728. # ===========================================================================
  729. # This function is called recursively to determine what the setting of the
  730. # item is: install, don't install, or install some.
  731. #
  732. sub _cGetActiveFlagByName
  733. {
  734. my ($sDialogName, $sName) = @_;
  735. my $sOptActive = &_sGetOptionValueByName($sDialogName, $sName);
  736. if ($sOptActive eq ' ' || $sOptActive eq 'X')
  737. {
  738. return $sOptActive;
  739. }
  740. else
  741. {
  742. # see if any of the active settings are on now for the sub-dialog
  743. my $fSomeOn = $false;
  744. my $fSomeOff = $false;
  745. my $sTable = "srOption$sOptActive";
  746. my $nItems = ($#$sTable)+1;
  747. my $i = 0;
  748. for ($i = 0; $i < $nItems; $i+=4)
  749. {
  750. my $sTableName = $$sTable[$i+1];
  751. my $cSubActive = &_cGetActiveFlagByName($sOptActive, $sTableName);
  752. if ($cSubActive eq ' ') { $fSomeOff = $true; }
  753. else { $fSomeOn = $true; }
  754. }
  755. if ($fSomeOn)
  756. {
  757. if ($fSomeOff) { return '*'; }
  758. else { return 'X'; }
  759. }
  760. else { return ' '; }
  761. }
  762. }
  763. # ===========================================================================
  764. # This subroutine is called when something bad happens that potentially means
  765. # the script needs to stop. The user is, however, given the choice to abort,
  766. # retry or ignore. If the user selects abort, the subroutine never returns.
  767. # If retry, false is returned. If ignore, true is returned.
  768. #
  769. sub _vDieAndLogReason
  770. {
  771. local ($reason) = @_;
  772. open (CURDIR, "cd |");
  773. $curdir = <CURDIR>;
  774. close CURDIR;
  775. chop $curdir;
  776. &_vLog ("*** An unexpected error occurred!");
  777. &_vLog ("*** Explanation [$reason]");
  778. &_vLog ("*** Current dir [$curdir]");
  779. $resolution = &_cAskSet( $true, "Abort, retry or ignore and continue?", "ari", "a");
  780. if ($resolution eq "a")
  781. {
  782. &_vLog ("Log files can be found in $ENV{'TEMP'}");
  783. die $reason;
  784. }
  785. else
  786. {
  787. return ($resolution eq "i");
  788. }
  789. }
  790. # ===========================================================================
  791. # If not pausing, always returns true. Else asks the user a yes/no question
  792. # and returns the result
  793. #
  794. sub _fAskYN
  795. {
  796. local($fAsk, $question) = @_;
  797. return (&_cAskSet( $fAsk, $question, "yn", "y" ) eq 'y');
  798. }
  799. # ===========================================================================
  800. # This subroutine is passed a question to ask the user, in $question. If
  801. # the $fAsk flag is true, the question will be asked. If false, the question
  802. # will not be asked, but the default answer will be returned. The default
  803. # answer is passed in $default, and the set of valid answers is passed in $set.
  804. # Note: it is assumed that $default is one character, and $set contains
  805. # a concatenation of one character possible valid user choices.
  806. #
  807. sub _cAskSet
  808. {
  809. local($fAsk, $question, $set, $default) = @_;
  810. $fproceed = $default;
  811. if ($fAsk)
  812. {
  813. $fproceed = "";
  814. while ($fproceed eq "")
  815. {
  816. print "$question ($set): ";
  817. $fproceed = &_cQueryForCharFromSet($set);
  818. }
  819. }
  820. &_vLogSilent ("$question = $fproceed");
  821. # print "Answer is '$fproceed'.\n";
  822. $fproceed;
  823. }
  824. # ===========================================================================
  825. # Get first character of response & eat rest of line.
  826. #
  827. sub _cQueryForCharFromSet
  828. {
  829. local($getkeystring) = @_;
  830. $getchoice = getc;
  831. if ($getchoice ne "\n")
  832. {
  833. while (1)
  834. {
  835. $geta = getc;
  836. if ($geta eq "\n")
  837. {
  838. last;
  839. }
  840. }
  841. }
  842. if (index ($getkeystring, $getchoice) < 0)
  843. {
  844. print "Please select one of ($getkeystring)\n";
  845. $getchoice = "";
  846. }
  847. $getchoice;
  848. }
  849. # ===========================================================================
  850. # Open the log file used to output messages as the script goes along. If it
  851. # works, the field $g_fLogOpen will be set to $true, and $g_sLogFilename will
  852. # contain the filename of the log file.
  853. #
  854. sub _vOpenLog
  855. {
  856. local($sDir, $sBase) = @_;
  857. $g_sLogFilename = &_sGetUniqueFilename("$sDir\\$sBase", "txt");
  858. my $fRC = $false;
  859. do { $fRC = open (PROPLOG, ">$g_sLogFilename")
  860. } until ( $fRC || &_vDieAndLogReason ("create logfile '$g_sLogFilename'"));
  861. $g_fLogOpen = $fRC;
  862. }
  863. # ===========================================================================
  864. # Create a unique filename based on the specified filename root and extension.
  865. # This is done simply by adding a "-i" where 'i' is a number starting with '0'
  866. # and incrementing by 1, until the filename does not exist.
  867. #
  868. sub _sGetUniqueFilename
  869. {
  870. local($sRoot, $sExt) = @_;
  871. my $i = 0;
  872. while (-e "$sRoot-$i.$sExt")
  873. {
  874. $i = $i + 1;
  875. }
  876. return "$sRoot-$i.$sExt";
  877. }
  878. # ===========================================================================
  879. # Place action information in log file, and echo to screen. An action does
  880. # not start with a comment character or the date/time. Just the action code
  881. # and the data.
  882. #
  883. sub _vLogAction
  884. {
  885. local ($sMessage) = @_;
  886. if ($g_fLogOpen || $fLogAnyway)
  887. {
  888. ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime;
  889. $sLogDate = sprintf "%02d/%02d/%02d %02d:%02d:%02d", $mon+1, $mday, $year, $hour, $min, $sec;
  890. my $sContinued = '';
  891. while ($sMessage ne '')
  892. {
  893. $sLogString = "#$sLogDate $sContinued$sMessage";
  894. $sContinued = '+ ';
  895. $_ = $sLogString;
  896. ($sPortion, $sMessage) = /(.{1,79})(.*)/;
  897. if ($g_fLogOpen) # (defined(PROPLOG))
  898. {
  899. print PROPLOG "$sPortion\n";
  900. }
  901. print "$sPortion\n";
  902. }
  903. }
  904. }
  905. # ===========================================================================
  906. # Place information in log file, and echo to screen.
  907. #
  908. sub _vLog
  909. {
  910. local ($sMessage) = @_;
  911. if ($g_fLogOpen || $fLogAnyway)
  912. {
  913. ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime;
  914. $sLogDate = sprintf "%02d/%02d/%02d %02d:%02d:%02d", $mon+1, $mday, $year, $hour, $min, $sec;
  915. my $sContinued = '';
  916. while ($sMessage ne '')
  917. {
  918. $sLogString = "# $sLogDate $sContinued$sMessage";
  919. $sContinued = '+ ';
  920. $_ = $sLogString;
  921. ($sPortion, $sMessage) = /(.{1,79})(.*)/;
  922. if (defined(PROPLOG))
  923. {
  924. print PROPLOG "$sPortion\n";
  925. }
  926. print "$sPortion\n";
  927. }
  928. }
  929. }
  930. # ===========================================================================
  931. # Place information in log file only.
  932. #
  933. sub _vLogSilent
  934. {
  935. if ($fLogAnyway)
  936. {
  937. &_vLog(@_);
  938. }
  939. elsif ($g_fLogOpen)
  940. {
  941. ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime;
  942. $logdate = sprintf "%02d/%02d/%02d %02d:%02d:%02d", $mon+1, $mday, $year, $hour, $min, $sec;
  943. if (defined(PROPLOG))
  944. {
  945. printf PROPLOG "# $logdate @_\n";
  946. }
  947. }
  948. }
  949. # ===========================================================================
  950. # Close the log file used to output messages as the script goes along.
  951. #
  952. sub _vCloseLog
  953. {
  954. if ($g_fLogOpen)
  955. {
  956. close PROPLOG;
  957. $g_fLogOpen = $false;
  958. }
  959. }
  960. # ===========================================================================
  961. # This subroutine simply displays that heading lines at the top of the screen.
  962. sub _vPrintHeading
  963. {
  964. system ("cls");
  965. print "$0\n";
  966. print '-' x 72;
  967. print "\nMicrosoft Travel Technologies - Travel Server Configuration Script\n";
  968. print "Copyright (c) 1997 Microsoft Corporation, All Rights Reserved.\n\n";
  969. }
  970. #========================================================================
  971. # This function retrieves a row of data from the settings table specified.
  972. # The second parameter identifies the value in the 2nd column of the
  973. # row to return.
  974. #
  975. sub _ssssGetSettingByName
  976. {
  977. local ($sDlg, $sName) = @_;
  978. local $sTable = "srSetting$sDlg";
  979. local $nItems = ($#$sTable)+1;
  980. for ($i = 0; $i < $nItems; $i+=4)
  981. {
  982. local $sTableName = $$sTable[$i+1];
  983. if ($sTableName eq $sName)
  984. {
  985. return ($$sTable[$i], $$sTable[$i+1], $$sTable[$i+2], $$sTable[$i+3]);
  986. }
  987. }
  988. &_vLog("GetSettingByName: dialog='$sDlg', name='$sName' not found.");
  989. return ('', '', '', '');
  990. }
  991. #========================================================================
  992. # This function retrieves a row of data from the options table specified.
  993. # The second parameter identifies the value in the 2nd column of the
  994. # row to return.
  995. #
  996. sub _ssssGetOptionByName
  997. {
  998. local ($sDlg, $sName) = @_;
  999. local $sTable = "srOption$sDlg";
  1000. local $nItems = ($#$sTable)+1;
  1001. for ($i = 0; $i < $nItems; $i+=4)
  1002. {
  1003. local $sTableName = $$sTable[$i+1];
  1004. if ($sTableName eq $sName)
  1005. {
  1006. return ($$sTable[$i], $$sTable[$i+1], $$sTable[$i+2], $$sTable[$i+3]);
  1007. }
  1008. }
  1009. &_vLog("GetOptionByName: dialog='$sDlg', name='$sName' not found.");
  1010. return ('', '', '', '');
  1011. }
  1012. #========================================================================
  1013. # This function retrieves a row of data from the settings table specified.
  1014. # The second parameter identifies the value in the 2nd column of the
  1015. # row to return.
  1016. #
  1017. sub _sGetSettingNameByIndex
  1018. {
  1019. local ($sDlg, $sIndex) = @_;
  1020. local $sTable = "srSetting$sDlg";
  1021. local $nItems = ($#$sTable)+1;
  1022. for ($i = 0; $i < $nItems; $i+=4)
  1023. {
  1024. local $sTableIndex = $$sTable[$i];
  1025. if ($sTableIndex eq $sIndex)
  1026. {
  1027. return $$sTable[$i+1];
  1028. }
  1029. }
  1030. &_vLog("GetSettingNameByIndex: dialog='$sDlg', index='$sIndex' not found.");
  1031. return '';
  1032. }
  1033. #========================================================================
  1034. # This function retrieves a row of data from the settings table specified.
  1035. # The second parameter identifies the value in the 2nd column of the
  1036. # row to return.
  1037. #
  1038. sub _sGetSettingValueByName
  1039. {
  1040. local ($sDlg, $sName) = @_;
  1041. local $sTable = "srSetting$sDlg";
  1042. local $nItems = ($#$sTable)+1;
  1043. for ($i = 0; $i < $nItems; $i+=4)
  1044. {
  1045. local $sTableName = $$sTable[$i+1];
  1046. if ($sTableName eq $sName)
  1047. {
  1048. return $$sTable[$i+3];
  1049. }
  1050. }
  1051. &_vLog("GetSettingValueByName: dialog='$sDlg', name='$sName' not found.");
  1052. return '';
  1053. }
  1054. #========================================================================
  1055. # This function retrieves a row of data from the settings table specified.
  1056. # The second parameter identifies the value in the 2nd column of the
  1057. # row to return.
  1058. #
  1059. sub _sGetSettingDescByName
  1060. {
  1061. local ($sDlg, $sName) = @_;
  1062. local $sTable = "srSetting$sDlg";
  1063. local $nItems = ($#$sTable)+1;
  1064. for ($i = 0; $i < $nItems; $i+=4)
  1065. {
  1066. local $sTableName = $$sTable[$i+1];
  1067. if ($sTableName eq $sName)
  1068. {
  1069. return $$sTable[$i+2];
  1070. }
  1071. }
  1072. &_vLog("GetSettingDescByName: dialog='$sDlg', name='$sName' not found.");
  1073. return '';
  1074. }
  1075. #========================================================================
  1076. # This function sets the value for a row of data from the settings table
  1077. # specified. The second parameter identifies the value in the 2nd column
  1078. # of the row to modify and the third parameter is the new value.
  1079. #
  1080. sub _vSetSettingValueByName
  1081. {
  1082. local ($sDlg, $sName, $sNewValue) = @_;
  1083. local $sTable = "srSetting$sDlg";
  1084. local $nItems = ($#$sTable)+1;
  1085. for ($i = 0; $i < $nItems; $i+=4)
  1086. {
  1087. local $sTableName = $$sTable[$i+1];
  1088. if ($sTableName eq $sName)
  1089. {
  1090. $$sTable[$i+3] = $sNewValue;
  1091. return;
  1092. }
  1093. }
  1094. &_vLog("SetSettingValueByName: dialog='$sDlg', name='$sName' not found.");
  1095. }
  1096. #========================================================================
  1097. # This function retrieves a row of data from the options table specified.
  1098. # The second parameter identifies the value in the 2nd column of the
  1099. # row to return.
  1100. #
  1101. sub _sGetOptionNameByIndex
  1102. {
  1103. local ($sDlg, $sIndex) = @_;
  1104. local $sTable = "srOption$sDlg";
  1105. local $nItems = ($#$sTable)+1;
  1106. for ($i = 0; $i < $nItems; $i+=4)
  1107. {
  1108. local $sTableIndex = $$sTable[$i];
  1109. if ($sTableIndex eq $sIndex)
  1110. {
  1111. return $$sTable[$i+1];
  1112. }
  1113. }
  1114. &_vLog("GetOptionNameByIndex: dialog='$sDlg', index='$sIndex' not found.");
  1115. return '';
  1116. }
  1117. #========================================================================
  1118. # This function retrieves a row of data from the options table specified.
  1119. # The second parameter identifies the value in the 2nd column of the
  1120. # row to return.
  1121. #
  1122. sub _sGetOptionValueByName
  1123. {
  1124. local ($sDlg, $sName) = @_;
  1125. local $sTable = "srOption$sDlg";
  1126. local $nItems = ($#$sTable)+1;
  1127. for ($i = 0; $i < $nItems; $i+=4)
  1128. {
  1129. local $sTableName = $$sTable[$i+1];
  1130. if ($sTableName eq $sName)
  1131. {
  1132. return $$sTable[$i+3];
  1133. }
  1134. }
  1135. &_vLog("GetOptionValueByName: dialog='$sDlg', name='$sName' not found.");
  1136. return '';
  1137. }
  1138. #========================================================================
  1139. # This function retrieves a row of data from the options table specified.
  1140. # The second parameter identifies the value in the 2nd column of the
  1141. # row to return.
  1142. #
  1143. sub _sGetOptionDescByName
  1144. {
  1145. local ($sDlg, $sName) = @_;
  1146. local $sTable = "srOption$sDlg";
  1147. local $nItems = ($#$sTable)+1;
  1148. for ($i = 0; $i < $nItems; $i+=4)
  1149. {
  1150. local $sTableName = $$sTable[$i+1];
  1151. if ($sTableName eq $sName)
  1152. {
  1153. return $$sTable[$i+2];
  1154. }
  1155. }
  1156. &_vLog("GetOptionDescByName: dialog='$sDlg', name='$sName' not found.");
  1157. return '';
  1158. }
  1159. #========================================================================
  1160. # This function sets the value for a row of data from the options table
  1161. # specified. The second parameter identifies the value in the 2nd column
  1162. # of the row to modify and the third parameter is the new value.
  1163. #
  1164. sub _vSetOptionValueByName
  1165. {
  1166. local ($sDlg, $sName, $sNewValue) = @_;
  1167. local $sTable = "srOption$sDlg";
  1168. local $nItems = ($#$sTable)+1;
  1169. for ($i = 0; $i < $nItems; $i+=4)
  1170. {
  1171. local $sTableName = $$sTable[$i+1];
  1172. if ($sTableName eq $sName)
  1173. {
  1174. $$sTable[$i+3] = $sNewValue;
  1175. return;
  1176. }
  1177. }
  1178. &_vLog("SetOptionValueByName: dialog='$sDlg', name='$sName' not found.");
  1179. }
  1180. #========================================================================
  1181. # This function returns the row number and column value based on the
  1182. # column, column value and number of columns in the table.
  1183. #
  1184. sub _sGetTableColValByColVal
  1185. {
  1186. local ($sTable, $nNumCols, $nRetCol, $nCol, $sColVal) = @_;
  1187. my $i = 0;
  1188. my $iTable = $#$sTable;
  1189. for ($i=0; $i <= $iTable; $i += $nNumCols)
  1190. {
  1191. my $sTableColVal = $$sTable[$i+$nCol];
  1192. # print "_sGetTableColValByColVal: i=$i, $nNumCols, comparing '$sColVal' to '$sTableColVal'.\n";
  1193. if ($sTableColVal eq $sColVal)
  1194. {
  1195. my $sRetColVal = $$sTable[$i+$nRetCol];
  1196. return $sRetColVal;
  1197. }
  1198. }
  1199. return "";
  1200. }
  1201. sub _sGetHiveFriendlyName
  1202. {
  1203. local ($sHive) = @_;
  1204. if ($sHive eq &HKEY_LOCAL_MACHINE)
  1205. {
  1206. return "HKLM";
  1207. }
  1208. elsif ($sHive eq &HKEY_CLASSES_ROOT)
  1209. {
  1210. return "HKCR";
  1211. }
  1212. elsif ($sHive eq &HKEY_CURRENT_USER)
  1213. {
  1214. return "HKCU";
  1215. }
  1216. elsif ($sHive eq &HKEY_USERS)
  1217. {
  1218. return "HKU";
  1219. }
  1220. return $sHive;
  1221. }
  1222. sub _sGetClassFriendlyName
  1223. {
  1224. local ($sClass) = @_;
  1225. if ($sClass eq '1')
  1226. {
  1227. return "REG_SZ";
  1228. }
  1229. elsif ($sClass eq '4')
  1230. {
  1231. return "REG_DWORD";
  1232. }
  1233. return "I don't know what the heck it is";
  1234. }
  1235. sub _sGetLocationFromHiveKey
  1236. {
  1237. local ($sHive,$sKey) = @_;
  1238. my $i = 0;
  1239. my $iTable = $#srRegLocations;
  1240. for ($i=0; $i <= $iTable; $i += 3)
  1241. {
  1242. # print "Comparing '\L$srRegLocations[$i+2]\E' to '\L$sKey\E'.\n";
  1243. if ($srRegLocations[$i+1] eq $sHive && "\L$srRegLocations[$i+2]\E" eq "\L$sKey\E")
  1244. {
  1245. return $srRegLocations[$i];
  1246. }
  1247. }
  1248. return "";
  1249. }
  1250. sub _snGetTableIndexFromLocationValueName
  1251. {
  1252. local ($sLocation,$sValueName) = @_;
  1253. # print "Looking for '$sLocation', '$sValueName'.\n";
  1254. @srTables =
  1255. (
  1256. 'srRegMandatory',
  1257. 'srRegAdvanced',
  1258. 'srRegOptional',
  1259. 'srRegObsolete'
  1260. );
  1261. my $j = 0;
  1262. my $jTable = $#srTables;
  1263. for ($j=0; $j <= $jTable; $j++)
  1264. {
  1265. my $i = 0;
  1266. my $sTableName = $srTables[$j];
  1267. my $iTable = $#$sTableName;
  1268. for ($i=0; $i <= $iTable; $i += 5)
  1269. {
  1270. # print "Comparing against ($i) '$$sTableName[$i]', '$$sTableName[$i+1]'.\n";
  1271. if ($$sTableName[$i] eq $sLocation && "\L$$sTableName[$i+1]\E" eq "\L$sValueName\E")
  1272. {
  1273. # print "Match!\n";
  1274. return ($sTableName, $i);
  1275. }
  1276. }
  1277. }
  1278. return "", 0;
  1279. }
  1280. #========================================================================
  1281. # This section interacts with the installer to determine what components
  1282. # should be installed.
  1283. #
  1284. sub _vCSInitialize
  1285. {
  1286. # print "Initializing...\n";
  1287. $true = (1 == 1);
  1288. $false = (!$true);
  1289. $fLogAnyway = $false; # $true;
  1290. $g_fLogOpen = $false;
  1291. $g_fQuiet = $false;
  1292. $g_fClean = $false;
  1293. $g_fNoChanges = $false;
  1294. $g_sInputFilename = "";
  1295. $g_sOutputFilename = "";
  1296. $g_sReportFilename = "";
  1297. #----------------------------------------------------------------------------------
  1298. # Dialog - Main Dialog
  1299. @srSettingMain =
  1300. ( # idx --Name--- --Description----------------------- --Value--------------
  1301. 'a', 'inpfil', 'Input filename ', "",
  1302. 'b', 'outfil', 'Output filename ', "",
  1303. 'c', 'repfil', 'Report filename ', "",
  1304. );
  1305. @srOptionMain =
  1306. ( # idx --Name--- --Description----------------------- --Value--------------
  1307. '1', 'clean', 'Clear all settings', ' ',
  1308. '2', 'report', 'Report only (no changes)', ' ',
  1309. );
  1310. #----------------------------------------------------------------------------------
  1311. # This section is for specifying the registry options that will be setup for each
  1312. # of the various components.
  1313. #----------------------------------------------------------------------------------
  1314. # &REG_SZ = '1';
  1315. # &REG_DWORD = '4';
  1316. my $fRC = $false;
  1317. my $sSQLServerDriverLoc = "xxx";
  1318. ($fRC, $sSQLServerDriverLoc) = &_fsGetRegValue( &HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\SQL Server", "Driver");
  1319. if (!$fRC || $sSQLServerDriverLoc eq "")
  1320. {
  1321. print "Unable to locate SQL Server Driver!!! Can't continue.\n";
  1322. return $false;
  1323. }
  1324. @srRegLocations =
  1325. ( # --Name----- --Hive------------- --Location------------------------------------
  1326. 'shr', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\shared",
  1327. 'x25', &HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Travel\\shared\\x25comm",
  1328. 'svr', &HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Travel\\Server",
  1329. 'dsn', &HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Travel\\Server\\Database\\DataSourceName",
  1330. 'mst', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\MSTravelObject",
  1331. 'usg', &HKEY_LOCAL_MACHINE, "Software\\Microsoft\\travel\\Server\\MSTravelObject\\UsageLog",
  1332. 'ccd', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\CreditCards",
  1333. 'ssp', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Sabresp",
  1334. 'ss1', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Sabresp\\1",
  1335. 'ss2', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Sabresp\\9001",
  1336. 'ssm', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\SSM",
  1337. 'lfs', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\LFS",
  1338. 'wsp', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Wssp",
  1339. 'wsh', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Wssp\\Hot",
  1340. 'wse', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Wssp\\Hot\\ExcludeCarriers",
  1341. 'wsc', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Wssp\\Hot\\PlatingCarriers",
  1342. 'wsv', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Wssp\\Hot\\ExcludeVerbiageUnknown",
  1343. 'wsx', &HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\travel\\Server\\Wssp\\Hot\\ExcludeVerbiageOperatedBy",
  1344. 'ods', &HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources",
  1345. 'ohf', &HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBC.INI\\HotelFinder",
  1346. 'ocl', &HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBC.INI\\CRSLog",
  1347. 'ose', &HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBC.INI\\ServerETA",
  1348. );
  1349. # These values are always queried for during configuration, or a value is
  1350. # expected if running from an import file. The value in the registry is
  1351. # always replaced by what is specified.
  1352. @srRegMandatory =
  1353. ( # --Loc-- --Name------------- --Class---- --Value--------------- --Description-------------------------
  1354. 'mst', 'LoadSPsOnStartup', &REG_SZ, "1", "ServiceProvider's to load (1=WorldSpan,2=SABRE,3=Cabbage,4=Apollo,5=Galileo,6=SystemOne,7=Amadeus,8=AmexLFS,9=HotelInfo,10=CabbageCon)",
  1355. 'mst', 'LoadRoutersOnStartup', &REG_SZ, "1,3,4,10001,10002", "Products Ids supported (1=Expedia,2=Wilbur,3=ExpUK,4=ExpCA,5=ExpAU,9001+=CorpTest,10001=NWBrand,10002=COBrand,100010+=CorpReal).",
  1356. 'x25', "NoX25Card", &REG_DWORD, 0, "Enter 1 if the machine is using an Eicon card, 0 if not.",
  1357. 'x25', "SocketX25PrimaryServer", &REG_SZ, "$ENV{'COMPUTERNAME'}", "Enter the primary X25 server this gateway server will reference. If this machine has an Eicon card, you will generally want to specify this machine's name.",
  1358. 'x25', "SocketX25BackupServers", &REG_SZ, "", "List the server(s) that this gateway server should reference as backup in case of communications problems with the primary X25 server.",
  1359. 'x25', "X25Socket", &REG_DWORD, 1023, "Use '1023' for MOSWest and Saturn, '7123' for Rasta.",
  1360. 'x25', "X25Countries", &REG_DWORD, 4, "Enter the number of countries that the X25 server's communication line supports.",
  1361. 'shr', "MailServers", &REG_SZ, "207.68.149.229", "Use 'trav' for Rasta, '131.107.17.21' or 'travbeta.microsoft.com' for Saturn, or '207.68.149.229' for moswest.",
  1362. 'ohf', "Server", &REG_SZ, "TRAVSQL", "SQL server where the hotel database lives",
  1363. 'ocl', "Server", &REG_SZ, "MTTDEV02", "SQL server where the CRS log database lives",
  1364. 'ose', "Server", &REG_SZ, "MTTDEV02", "SQL server where the travel server database lives",
  1365. );
  1366. # get the initial value for each key from the registry
  1367. {
  1368. my $iQ = 0;
  1369. my $iMax = $#srRegMandatory;
  1370. for ($iQ = 0; $iQ <= $iMax; $iQ+=5)
  1371. {
  1372. my $sKey = $srRegMandatory[$iQ];
  1373. my $sHive = &_sGetTableColValByColVal("srRegLocations", 3, 1, 0, $sKey);
  1374. my $sClass = $srRegMandatory[$iQ+2];
  1375. my $sTree = &_sGetTableColValByColVal("srRegLocations", 3, 2, 0, $sKey);
  1376. my ($fSucc,$sValue)= &_fsGetRegValue($sHive, $sTree, $srRegMandatory[$iQ+1]);
  1377. if ($fSucc)
  1378. {
  1379. $srRegMandatory[$iQ+3] = $sValue;
  1380. }
  1381. }
  1382. }
  1383. # These values are never asked for, but may be overridden from a value
  1384. # in an import file. The value in the registry is always replaced by
  1385. # what is specified.
  1386. @srRegAdvanced =
  1387. ( # --Loc-- --Name------------- --Class---- -Val- --Description-------------------------
  1388. 'x25', "SocketSweepInterval", &REG_DWORD, 5000, "",
  1389. 'x25', "SocketTransactionExpirationInterval", &REG_DWORD, 270000, "",
  1390. 'x25', "PingInterval", &REG_DWORD, 600000, "",
  1391. 'x25', "X25ErrorsBeforeReset", &REG_DWORD, 5, "",
  1392. 'x25', "X25ErrorResetInterval", &REG_DWORD, 60000, "",
  1393. 'x25', "X25ResetTryInterval", &REG_DWORD, 60000, "",
  1394. 'x25', "X25NoResponseIntervalTilReset", &REG_DWORD, 270000, "",
  1395. 'x25', "PongTimeout", &REG_DWORD, 10000, "",
  1396. 'x25', "WaitForEiconInit", &REG_DWORD, 60000, "",
  1397. 'svr', "Datastore_CreatePerfCounters", &REG_DWORD, 1, "",
  1398. 'svr', "PerfLogIntervalMS", &REG_DWORD, 300000, "",
  1399. 'svr', "EnableAutoPassword", &REG_DWORD, 0, "1=enable the Automated Password Reminder script, 0=disable with nice message 0xFFFFFFFF=disable with hack abort",
  1400. 'x25', "EiconPort", &REG_DWORD, 1, "",
  1401. 'x25', "SweepInterval", &REG_DWORD, 5000, "",
  1402. 'x25', "TransactionExpirationInterval", &REG_DWORD, 240000, "",
  1403. 'x25', "TransactionExpIntervalQueue0", &REG_DWORD, 120000, "",
  1404. 'x25', "TransactionExpIntervalQueue1", &REG_DWORD, 100000, "",
  1405. 'x25', "TransactionExpIntervalQueue2", &REG_DWORD, 15000, "",
  1406. 'x25', "ReceiveBufferSize", &REG_DWORD, 8192, "",
  1407. 'x25', "NumThreads", &REG_DWORD, 1, "",
  1408. 'x25', "ipmask", &REG_SZ, "255.255.255.255", "",
  1409. 'x25', "SMIQueue", &REG_DWORD, 5, "",
  1410. 'x25', "SMIQueueRecheckCount", &REG_DWORD, 10, "",
  1411. 'x25', "fHeavyInstrument", &REG_DWORD, 1, "1=Enable heavy instrumentation",
  1412. 'x25', "X25TimeoutErrorThreshold", &REG_DWORD, 60, "",
  1413. 'x25', "ShortCircuitTimeout", &REG_DWORD, 210000, "",
  1414. 'x25', "HopelesslyLostTime", &REG_DWORD, (15*60*1000), "",
  1415. 'x25', "QueueServiceRate", &REG_DWORD, 3, "",
  1416. 'x25', "RemoteDTEST0", &REG_SZ, "234523456789", "",
  1417. 'x25', "LocalDTEST0", &REG_SZ, "234523456788", "",
  1418. 'x25', "RemoteDTESMI0", &REG_SZ, "234523456786", "",
  1419. 'x25', "LocalDTESMI0", &REG_SZ, "234523456788", "",
  1420. 'x25', "STQueue0", &REG_DWORD, 36, "",
  1421. 'x25', "STSimultaneousTimeoutsMax0", &REG_DWORD, 18, "",
  1422. 'x25', "RemoteDTEST1", &REG_SZ, "234523456789", "",
  1423. 'x25', "LocalDTEST1", &REG_SZ, "234523456788", "",
  1424. 'x25', "RemoteDTESMI1", &REG_SZ, "234523456784", "",
  1425. 'x25', "LocalDTESMI1", &REG_SZ, "234523456788", "",
  1426. 'x25', "STQueue1", &REG_DWORD, 36, "",
  1427. 'x25', "STSimultaneousTimeoutsMax1", &REG_DWORD, 18, "",
  1428. 'x25', "RemoteDTEST2", &REG_SZ, "234523456789", "",
  1429. 'x25', "LocalDTEST2", &REG_SZ, "234523456788", "",
  1430. 'x25', "RemoteDTESMI2", &REG_SZ, "234523456788", "",
  1431. 'x25', "LocalDTESMI2", &REG_SZ, "234523456788", "",
  1432. 'x25', "STQueue2", &REG_DWORD, 36, "",
  1433. 'x25', "STSimultaneousTimeoutsMax2", &REG_DWORD, 18, "",
  1434. 'x25', "RemoteDTEST3", &REG_SZ, "234523456790", "",
  1435. 'x25', "LocalDTEST3", &REG_SZ, "234523456788", "",
  1436. 'x25', "RemoteDTESMI3", &REG_SZ, "234523456791", "",
  1437. 'x25', "LocalDTESMI3", &REG_SZ, "234523456788", "",
  1438. 'x25', "STQueue3", &REG_DWORD, 10, "",
  1439. 'x25', "STSimultaneousTimeoutsMax3", &REG_DWORD, 5, "",
  1440. 'x25', "RemoteDTEST4", &REG_SZ, "234523456792", "",
  1441. 'x25', "LocalDTEST4", &REG_SZ, "234523456788", "",
  1442. 'x25', "RemoteDTESMI4", &REG_SZ, "234523456780", "",
  1443. 'x25', "LocalDTESMI4", &REG_SZ, "234523456788", "",
  1444. 'x25', "STQueue4", &REG_DWORD, 10, "",
  1445. 'x25', "STSimultaneousTimeoutsMax4", &REG_DWORD, 5, "",
  1446. 'x25', "RemoteDTEST5", &REG_SZ, "234523456789", "",
  1447. 'x25', "LocalDTEST5", &REG_SZ, "234523456788", "",
  1448. 'x25', "RemoteDTESMI5", &REG_SZ, "234523456778", "",
  1449. 'x25', "LocalDTESMI5", &REG_SZ, "234523456788", "",
  1450. 'x25', "STQueue5", &REG_DWORD, 10, "",
  1451. 'x25', "STSimultaneousTimeoutsMax5", &REG_DWORD, 5, "",
  1452. 'x25', "STSimultaneousTimeoutsMax0", &REG_DWORD, 18, "",
  1453. 'x25', "ThrottleMaxPendingST0", &REG_DWORD, 18, "",
  1454. 'x25', "ThrottleMaxPendingSMI0", &REG_DWORD, 18, "",
  1455. 'x25', "ThrottleMaxPendingST1", &REG_DWORD, 18, "",
  1456. 'x25', "ThrottleMaxPendingSMI1", &REG_DWORD, 4, "",
  1457. 'x25', "ThrottleMaxPendingST2", &REG_DWORD, 18, "",
  1458. 'x25', "ThrottleMaxPendingSMI2", &REG_DWORD, 20, "20 for MOSWest and Saturn, 5 for Rasta",
  1459. 'x25', "ThrottleMaxPendingST3", &REG_DWORD, 3, "",
  1460. 'x25', "ThrottleMaxPendingSMI3", &REG_DWORD, 5, "",
  1461. 'x25', "ThrottleMaxPendingST4", &REG_DWORD, 18, "18 for MOSWest and Saturn, 5 for Rasta",
  1462. 'x25', "ThrottleMaxPendingSMI4", &REG_DWORD, 5, "5 for MOSWest and Saturn, 20 for Rasta",
  1463. 'x25', "ThrottleMaxPendingST5", &REG_DWORD, 5, "",
  1464. 'x25', "ThrottleMaxPendingSMI5", &REG_DWORD, 5, "",
  1465. 'x25', "ThrottleMaxPendingEffect", &REG_DWORD, 70, "",
  1466. 'x25', "ThrottleMaxQueueEffect", &REG_DWORD, 100, "",
  1467. 'dsn', "ServerETA", &REG_SZ, "ServerETA", "",
  1468. 'dsn', "ServerFare", &REG_SZ, "ServerFare", "",
  1469. 'dsn', "CRSLog", &REG_SZ, "CRSLog", "",
  1470. 'dsn', "HotelFinder", &REG_SZ, "HotelFinder", "",
  1471. 'usg', "Enable", &REG_DWORD, 1, "",
  1472. 'ccd', "Card0DigitCheck", &REG_DWORD, 1, "Card0 (Visa) - do the mod 10 digit check",
  1473. 'ccd', "Card0StartDigitLow0", &REG_SZ, "4", "Card0 (Visa) - starting digits in range of 4",
  1474. 'ccd', "Card0StartDigitHigh0", &REG_SZ, "4", "Card0 (Visa) - to 4...",
  1475. 'ccd', "Card0NumValidDigits0", &REG_DWORD, 13, "Card0 (Visa) - can have 13 digits",
  1476. 'ccd', "Card0NumValidDigits1", &REG_DWORD, 16, "Card0 (Visa) - can have 16 digits",
  1477. 'ccd', "Card0AirlinesRefuse", &REG_SZ, "6U,LZ,WD,6F,WT,PK,RO", "Not accepted by Air Ukraine, Balkan Bulgarian, Halisa Air, Laker Airways, Nigeria Airways, Pakistan Intl, Tarom Romanian",
  1478. 'ccd', "Card1DigitCheck", &REG_DWORD, 1, "Card1 (MC) - do the mod 10 digit check",
  1479. 'ccd', "Card1StartDigitLow0", &REG_SZ, "51", "Card1 (MC) - starting digits in range of 51",
  1480. 'ccd', "Card1StartDigitHigh0", &REG_SZ, "55", "Card1 (MC) - to 55...",
  1481. 'ccd', "Card1NumValidDigits0", &REG_DWORD, 13, "Card1 (MC) - can have 13 digits",
  1482. 'ccd', "Card1NumValidDigits1", &REG_DWORD, 16, "Card1 (MC) - can have 16 digits",
  1483. 'ccd', "Card1AirlinesRefuse", &REG_SZ, "6U,GF,WD,6F,WT,PK,RO", "Not accepted by Air Ukraine, Gulf Air, Halisa Air, Laker Airways, Nigeria Airways, Pakistan Intl, Tarom Romanian",
  1484. 'ccd', "Card2DigitCheck", &REG_DWORD, 1, "Card2 (AmEx) - do the mod 10 digit check",
  1485. 'ccd', "Card2StartDigitLow0", &REG_SZ, "34", "Card2 (AmEx) - starting digits in range of 34",
  1486. 'ccd', "Card2StartDigitHigh0", &REG_SZ, "34", "Card2 (AmEx) - to 34...",
  1487. 'ccd', "Card2StartDigitLow1", &REG_SZ, "37", "Card2 (AmEx) - or starting digits in range of 37",
  1488. 'ccd', "Card2StartDigitHigh1", &REG_SZ, "37", "Card2 (AmEx) - to 37...",
  1489. 'ccd', "Card2NumValidDigits0", &REG_DWORD, 15, "Card2 (AmEx) - can have 15 digits",
  1490. 'ccd', "Card2AirlinesRefuse", &REG_SZ, "NK,RO", "Not accepted by Spirit Airlines, Tarom Romanian",
  1491. 'ccd', "Card3DigitCheck", &REG_DWORD, 1, "Card3 (Discover) - do the mod 10 digit check",
  1492. 'ccd', "Card3StartDigitLow0", &REG_SZ, "6011", "Card3 (Discover) - starting digits in range of 6011",
  1493. 'ccd', "Card3StartDigitHigh0", &REG_SZ, "6011", "Card3 (Discover) - to 6011...",
  1494. 'ccd', "Card3NumValidDigits0", &REG_DWORD, 16, "Card3 (Discover) - can have 16 digits",
  1495. 'ccd', "Card3AirlinesRefuse", &REG_SZ, "EI,SU,AF,AI,CW,FJ,UK,6U,NH,IW,OZ,OS,LZ,BA,CP,C8,CI,MS,LY,EK,BR,AY,GA,GH,GF,GY,WD,JL,KL,KU,6F,LO,8M,MH,MA,OA,PK,PR,PH,RJ,SN,SV,SK,SA,GD,TP,RO,TR,T3,RG,OD", "Not accepted by a bunch of airlines...",
  1496. 'ccd', "Card4DigitCheck", &REG_DWORD, 0, "Card4 (Diners Card) - do the mod 10 digit check",
  1497. 'ccd', "Card4StartDigitLow0", &REG_SZ, "38", "Card4 (Diners Card) - starting digits in range of 38",
  1498. 'ccd', "Card4StartDigitHigh0", &REG_SZ, "38", "Card4 (Diners Card) - to 38...",
  1499. 'ccd', "Card4NumValidDigits0", &REG_DWORD, 14, "Card4 (Diners Card) - can have 14 digits",
  1500. 'ccd', "Card5DigitCheck", &REG_DWORD, 0, "Card5 (UATP Card) - bugbug: what's the right check?",
  1501. 'ccd', "Card6DigitCheck", &REG_DWORD, 0, "Card6 (Carte Blanche) - bugbug: what's the right check?",
  1502. 'ssp', "MaxHotelReturn", &REG_DWORD, 25, "The maximum number of hotels to return to the UI.",
  1503. 'ssp', "MaxHotelRetrieve", &REG_DWORD, 100, "The maximum number of hotels to return to the UI.",
  1504. 'ssp', "MaxFareReturn", &REG_DWORD, 50, "The maximum number of hotels to return to the UI.",
  1505. 'ssp', "CreditCheckDisabled", &REG_DWORD, 0, "1 = enabled, 0 = disabled",
  1506. 'ssp', "BogusCreditCard", &REG_SZ, "1234999987654321", "The bogus credit card number",
  1507. 'ssp', "BogusCreditCardEnabled", &REG_DWORD, 1, "not used",
  1508. 'ssp', "IATA000", &REG_SZ, "1153818", "",
  1509. 'ssp', "IATA001", &REG_SZ, "1153818", "",
  1510. 'ssp', "IATA002", &REG_SZ, "1153818", "",
  1511. 'ss1', "AAA", &REG_SZ, "R7W4", "",
  1512. 'ss1', "PrimarySTAR", &REG_SZ, "", "",
  1513. 'ss1', "SecondarySTAR", &REG_SZ, "", "",
  1514. 'ssm', "ServerPort", &REG_DWORD, 7127, "Socket port used to communicate with SSM Server.",
  1515. 'ssm', "Server", &REG_SZ, "travsab1", "SSM Server name.",
  1516. 'ssm', "BackupServers", &REG_SZ, "", "Comma separated list of SSM Server's to use if the main one goes down (or its UDR dies)...",
  1517. 'ssm', "GDSPort", &REG_DWORD, 6969, "Port on UDR for GDS transactions.",
  1518. 'ssm', "TextPort", &REG_DWORD, 6966, "Port on UDR for native host transactions (i.e. for SabreTPF).",
  1519. 'ssm', "PendingInterval", &REG_DWORD, 15000, "When we have a session 'out' we wake up this often to see if it should be expired.",
  1520. 'ssm', "KeepAliveInterval", &REG_DWORD, 60000, "Wake up this often to see if any of our 'in' sessions need to be 're-primed', lest they timeout on Sabre.",
  1521. 'ssm', "RePrimeInterval", &REG_DWORD, 420000, "When the keep-alive interval kicks off, it looks for sessions that haven't been used in this long, and re-primes them.",
  1522. 'ssm', "MaxIdleInterval", &REG_DWORD, 420000, "When a session is out, the pending thread will expire it if it hasn't been used in this long.",
  1523. 'ssm', "ComTimeoutInterval", &REG_DWORD, 60000, "When waiting for a response from Sabre, if it doesn't come back in this time, we time it out.",
  1524. 'ssm', "StealInterval", &REG_DWORD, 10000, "If blocked in GetSession(), we try to steal sessions from the other port this often.",
  1525. 'ssm', "RetryPrimaryInterval", &REG_DWORD, 180000, "When we lose our connection to the primary server, we try to reconnect this often.",
  1526. 'ssm', "StartingSessions", &REG_DWORD, 10, "When the server init's, it primes this many sessions for use (will grow dynamically, if necessary/possible).",
  1527. 'ssm', "UDRServer", &REG_SZ, "157.54.208.53", "UDR's IP or server name.",
  1528. 'ssm', "NumCIDs", &REG_DWORD, 1, "# of Countries supported by SSM (each must have a registry entry PseudoCityForCIDx (where x is 0 through NumCIDs-1). Must be in same order as TravelCountryId...",
  1529. 'ssm', "PseudoCityForCID0", &REG_SZ, "R7W4", "PseudoCity for CID # 0 (USA).",
  1530. 'wse', "ExcludeCarriers", &REG_SZ, "LZ 2G ZK GF 6F PK NK RB NE RN J7 5C UP 8M M5", "",
  1531. 'wsc', "PlatingCarriers", &REG_SZ, "2R 3M 7H AA AC AD AF AI AM AN AQ AR AS AT AV AY AZ BA BD BR BW CF CI CM CO CP CW CX DL EH EI EK F9 FF FI FJ FL FQ GA GD GH GU GY HA HP IB IW JI JL JM JR KE KL KP KS KU KW KX LA LB LH LM LO LR LT LY MA MH ML MP MS MX NH NW NZ OA OK OS OZ PH PL PR PY PZ QF QQ RG RJ RK RO RV SA SK SN SQ SR SU SV SX T3 TA TE TG TK TP TR TW TZ UA UC UK UN US VC VE VP VS VX WV YV YX", "",
  1532. 'wsv', "ExcludeVerbiageUnknown", &REG_SZ, "\tCOND STOPOVER TRAF\tNO LOCAL TRAFFIC\tSUBJ TO GOVT APPROVAL\t", "",
  1533. 'wsx', "ExcludeVerbiageOperatedBy", &REG_SZ, "", "",
  1534. 'wsp', "ThreadHungInterval", &REG_DWORD, (45*60*1000), "(45 min) response processing threads that live longer than this are assumed hung",
  1535. 'wsp', "PerfDumpIntervalMS", &REG_DWORD, (15*60*1000), "(15 min) wssp performanec logging interval",
  1536. 'lfs', "CRSLoggingOn", &REG_DWORD, 1, "Log LFS transactions?",
  1537. 'lfs', "LFSServer", &REG_SZ, "travsab1", "LFS server name or IP.",
  1538. 'lfs', "LFSPort", &REG_DWORD, 3000, "Port on LFS server.",
  1539. 'lfs', "LFSTimeout", &REG_DWORD, 480000, "We will wait this many milliseconds for a response from LFS or timeout from pending thread (this value should be gt LFSExpirePending).",
  1540. 'lfs', "LFSWakeupPending", &REG_DWORD, 60000, "Pending thread wakes up every this many milliseconds (when there are any transactions pending).",
  1541. 'lfs', "LFSExpirePending", &REG_DWORD, 420000, "Pending thread times out transactions > than this many millseconds.",
  1542. 'lfs', "LFSReconnectInterval", &REG_DWORD, 10000, "When we lose the socket to the LFS server, we'll retry to connect every this often.",
  1543. 'ods', "CRSLog", &REG_SZ, "SQL Server", "",
  1544. 'ods', "HotelFinder", &REG_SZ, "SQL Server", "",
  1545. 'ods', "ServerETA", &REG_SZ, "SQL Server", "",
  1546. 'ohf', "Description", &REG_SZ, "Travel Group Database", "",
  1547. 'ohf', "Driver", &REG_SZ, $sSQLServerDriverLoc, "",
  1548. 'ohf', "UseProcForPrepare", &REG_SZ, "No", "",
  1549. 'ohf', "QuotedId", &REG_SZ, "Yes", "",
  1550. 'ohf', "AnsiNPW", &REG_SZ, "Yes", "",
  1551. 'ohf', "OemToAnsi", &REG_SZ, "No", "",
  1552. 'ohf', "LastUser", &REG_SZ, "", "",
  1553. 'ohf', "Trusted_Connection", &REG_SZ, "", "",
  1554. 'ocl', "Description", &REG_SZ, "Travel Group Database", "",
  1555. 'ocl', "Driver", &REG_SZ, $sSQLServerDriverLoc, "",
  1556. 'ocl', "UseProcForPrepare", &REG_SZ, "No", "",
  1557. 'ocl', "QuotedId", &REG_SZ, "Yes", "",
  1558. 'ocl', "AnsiNPW", &REG_SZ, "Yes", "",
  1559. 'ocl', "OemToAnsi", &REG_SZ, "No", "",
  1560. 'ocl', "LastUser", &REG_SZ, "", "",
  1561. 'ocl', "Trusted_Connection", &REG_SZ, "", "",
  1562. 'ose', "Driver", &REG_SZ, $sSQLServerDriverLoc, "",
  1563. 'ose', "Description", &REG_SZ, "Travel Group Database", "",
  1564. 'ose', "UseProcForPrepare", &REG_SZ, "No", "",
  1565. 'ose', "QuotedId", &REG_SZ, "Yes", "",
  1566. 'ose', "AnsiNPW", &REG_SZ, "Yes", "",
  1567. 'ose', "OemToAnsi", &REG_SZ, "No", "",
  1568. 'ose', "Trusted_Connection", &REG_SZ, "", "",
  1569. 'ose', "LastUser", &REG_SZ, "", "",
  1570. );
  1571. # These values are never asked for. The value may not be specified in an
  1572. # import file. If present in the registry, it will be deleted.
  1573. @srRegObsolete =
  1574. ( # --Loc-- --Name------------- --Class---- -Val- --Description-------------------------
  1575. );
  1576. # These values are never asked for. The value may be overridden by an
  1577. # option in an import file. Unless overridden, the registry value will
  1578. # not be modified.
  1579. @srRegOptional =
  1580. ( # --Loc-- --Name------------- --Class---- -Val- --Description-------------------------
  1581. 'wsp', "LOGSPXX000", &REG_DWORD, 0, "kNone",
  1582. 'wsp', "LOGSPXX001", &REG_DWORD, 0, "kAirAvail",
  1583. 'wsp', "LOGSPXX002", &REG_DWORD, 1, "kPassthrough",
  1584. 'wsp', "LOGSPXX003", &REG_DWORD, 1, "kPricing",
  1585. 'wsp', "LOGSPXX004", &REG_DWORD, 0, "kFareRules",
  1586. 'wsp', "LOGSPXX005", &REG_DWORD, 1, "kBooking",
  1587. 'wsp', "LOGSPXX006", &REG_DWORD, 0, "kCarAvail",
  1588. 'wsp', "LOGSPXX007", &REG_DWORD, 0, "kCarRules",
  1589. 'wsp', "LOGSPXX008", &REG_DWORD, 0, "kPowerShopper",
  1590. 'wsp', "LOGSPXX009", &REG_DWORD, 0, "kFare",
  1591. 'wsp', "LOGSPXX010", &REG_DWORD, 1, "kHotelAvail",
  1592. 'wsp', "LOGSPXX011", &REG_DWORD, 1, "kCredAvail",
  1593. 'wsp', "LOGSPXX012", &REG_DWORD, 1, "kFlightReserve",
  1594. 'wsp', "LOGSPXX013", &REG_DWORD, 1, "kCarPurchase",
  1595. 'wsp', "LOGSPXX014", &REG_DWORD, 1, "kFlightPurchase",
  1596. 'wsp', "LOGSPXX015", &REG_DWORD, 0, "kCurrencyConvert",
  1597. 'wsp', "LOGSPXX016", &REG_DWORD, 1, "kFlightCancel",
  1598. 'wsp', "LOGSPXX017", &REG_DWORD, 1, "kFlightChange",
  1599. 'wsp', "LOGSPXX018", &REG_DWORD, 1, "kCurrentItin",
  1600. 'wsp', "LOGSPXX019", &REG_DWORD, 1, "kHotelBook",
  1601. 'wsp', "LOGSPXX020", &REG_DWORD, 1, "kCarCancel",
  1602. 'wsp', "LOGSPXX021", &REG_DWORD, 0, "kCarDetails",
  1603. 'wsp', "LOGSPXX022", &REG_DWORD, 0, "kCarAllDetails",
  1604. 'wsp', "LOGSPXX023", &REG_DWORD, 1, "kTravelRecordCancel",
  1605. 'wsp', "LOGSPXX024", &REG_DWORD, 0, "kSeatAssign",
  1606. 'wsp', "LOGSPXX025", &REG_DWORD, 1, "kOpenPNR",
  1607. 'wsp', "LOGSPXX026", &REG_DWORD, 1, "kPlacePNRInQueue",
  1608. 'wsp', "LOGSPXX027", &REG_DWORD, 1, "kCommitChanges",
  1609. 'wsp', "LOGSPXX028", &REG_DWORD, 1, "kHotelRules",
  1610. 'wsp', "LOGSPXX029", &REG_DWORD, 1, "kHotelCancel",
  1611. 'wsp', "LOGSPXX030", &REG_DWORD, 0, "kCarFetch",
  1612. 'wsp', "LOGSPXX031", &REG_DWORD, 1, "kHotelFetch",
  1613. 'wsp', "LOGSPXX032", &REG_DWORD, 0, "kZoneDiff",
  1614. 'wsp', "LOGSPXX033", &REG_DWORD, 0, "kSetCustRefNum",
  1615. 'wsp', "LOGSPXX034", &REG_DWORD, 1, "kPricePNR",
  1616. 'wsp', "LOGSPXX035", &REG_DWORD, 1, "kSMIPassthrough",
  1617. 'wsp', "LOGSPXX036", &REG_DWORD, 1, "kNativeMode",
  1618. 'wsp', "LOGSPXX037", &REG_DWORD, 1, "kFlightOptions",
  1619. 'wsp', "LOGSPXX038", &REG_DWORD, 1, "kSetItinInfo",
  1620. 'wsp', "LOGSPXX039", &REG_DWORD, 0, "kAirSegmentData",
  1621. 'wsp', "LOGSPXX040", &REG_DWORD, 0, "",
  1622. 'wsp', "LOGSPXX041", &REG_DWORD, 0, "",
  1623. 'wsp', "LOGSPXX042", &REG_DWORD, 0, "",
  1624. 'wsp', "LOGSPXX043", &REG_DWORD, 0, "",
  1625. 'wsp', "LOGSPXX044", &REG_DWORD, 0, "",
  1626. 'wsp', "LOGSPXX045", &REG_DWORD, 0, "",
  1627. 'wsp', "LOGSPXX046", &REG_DWORD, 0, "",
  1628. 'wsp', "LOGSPXX047", &REG_DWORD, 0, "",
  1629. 'wsp', "LOGSPXX048", &REG_DWORD, 0, "",
  1630. 'wsp', "LOGSPXX049", &REG_DWORD, 0, "",
  1631. );
  1632. return $true
  1633. }