Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1728 lines
55 KiB

  1. <%@Language=VBScript%>
  2. <%Option Explicit%>
  3. <%
  4. '-------------------------------------------------------------------------
  5. 'nicglobal_prop.asp: Configure network settings that apply to all network adapters
  6. ' on the server appliance.
  7. '
  8. ' Copyright (c) Microsoft Corporation. All rights reserved.
  9. '
  10. ' Date Description
  11. '15-01-2001 Created date
  12. '05-03-2001 Modified date
  13. '-------------------------------------------------------------------------
  14. %>
  15. <!-- #include virtual="/admin/inc_framework.asp"-->
  16. <!-- #include file="inc_network.asp" -->
  17. <!-- #include file="nicglobal_loc.asp" -->
  18. <%
  19. '-------------------------------------------------------------------------
  20. ' Global Variables and Constants
  21. '-------------------------------------------------------------------------
  22. Dim page 'Variable that receives the output page object when
  23. 'creating a page
  24. Dim G_objService 'WMI server object
  25. Dim G_objRegistry 'Registry object.Value is assigned by calling function regConnection
  26. Dim g_iTabDNS 'variable for DNS Resolution Tab
  27. Dim g_iTabTCP 'variable for TCP/IP Hosts Tab
  28. Dim g_iTabLMHosts 'variable for NetBIOS LMHOSTS Tab
  29. Dim g_iTabIPX 'variable for IPX Settings Tab
  30. 'Constants for Registry paths
  31. Const CONST_DNSREGISTEREDADAPTERSPATH = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
  32. Const CONST_DNSREGISTRYENABLELMHOSTSPATH = "SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
  33. Const CONST_NETBIOSREGISTRYENABLELMHOSTSPATH = "SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters"
  34. Const CONST_DRIVERSETCHOSTS = "\drivers\etc\hosts"
  35. Const CONST_DRIVERSETCLMHOSTS = "\drivers\etc\lmhosts"
  36. 'Constant for highest unsigned integer value. This is used to convert signed integer to unsigned integer
  37. Const UNSIGNEDINT_FORMATTER = 4294967296
  38. 'Max suffixes allowed is 20 (0 to 19)
  39. Const MAX_DNS_SUFFIXES = 19
  40. Dim SOURCE_FILE
  41. SOURCE_FILE = SA_GetScriptFileName()
  42. '-------------------------------------------------------------------------
  43. ' Form Variables
  44. '-------------------------------------------------------------------------
  45. Dim F_strLMHOSTS 'value of the LMHost file lookup.
  46. Dim F_strLMHOSTSLOOKUPSTATUS 'Status of LMHOSTS checkbox
  47. Dim F_strLMHOSTS_EDITSTATUS 'value of edit status of the LMHost file.
  48. Dim F_strLMHOSTSLOOKUP 'value of LMHOSTS checkbox
  49. Dim F_nNICIndex 'variable to save which instance of the
  50. 'Win32_NetworkAdapterConfiguration is the IP enabled.
  51. Dim F_strIPXSettings 'value of IPX settings(True/False)
  52. Dim F_strIPXVirtualNumber 'value of IPX Virtual Network number
  53. Dim F_strDNSSUFFIX 'DNS Suffixes radio button to use
  54. Dim F_strAPPENDDNSSUFFIX 'Append parent suffixes of primary DNS suffix option check box
  55. Dim F_strDNSsuffixes 'concatenated - list of DNS suffixes
  56. Dim F_strDomainSuffix 'Domain Suffix Name to be added
  57. Dim F_strTCPHostData 'To assign the contents of TCP/IP Hosts file
  58. Dim F_strPrimaryChecked 'value of primary DNS suffix Radio button
  59. Dim F_strPrimaryAndParentChecked 'value of parent suffixes of primary DNS suffix Radio button
  60. Dim F_strDNSSuffixesChecked 'value of specific DNS suffixes Radio button
  61. Dim F_strAppendDNSSuffix_EditStatus 'value of parent suffixes of primary DNS suffix Check box
  62. '-------------------------------------------------------------------------
  63. ' Entry point
  64. '-------------------------------------------------------------------------
  65. ' Check to see if IPX is installed
  66. Call GetInitialValues
  67. '
  68. ' Create Tabbed Property Page
  69. Call SA_CreatePage( L_PAGETITLE, "", PT_TABBED, page )
  70. Call SA_AddTabPage(page, L_DNS_RESOLUTION_TEXT, g_iTabDNS)
  71. Call SA_AddTabPage(page, L_TCP_HOSTS_TEXT , g_iTabTCP)
  72. Call SA_AddTabPage(page, L_NETBIOS_LMHOSTS_TEXT, g_iTabLMHosts)
  73. if F_strIPXSettings Then
  74. Call SA_AddTabPage(page, L_IPX_SETTINGS_TEXT , g_iTabIPX)
  75. End IF
  76. '
  77. ' Serve the page
  78. Call SA_ShowPage( page )
  79. '-------------------------------------------------------------------------
  80. 'Function: OnInitPage()
  81. 'Description: Called to signal first time processing for this page.
  82. 'Input Variables: PageIn,EventArg
  83. 'Output Variables: PageIn,EventArg
  84. 'Returns: True/False
  85. 'Global Variables: None
  86. '-------------------------------------------------------------------------
  87. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  88. 'To get the initial settings for DNS, and IPX from the system
  89. Call GetInitialValues
  90. 'To get the LMHosts and Hosts file contents
  91. Call GetLMHostsandTCPFileData
  92. 'Set the status of Checkbox and Textarea for LMHosts depending on the initial values
  93. Call SetLMHostStatus()
  94. Call SA_TraceOut(SOURCE_FILE, "OnInitPage")
  95. OnInitPage = TRUE
  96. End Function
  97. '---------------------------------------------------------------------------------
  98. 'Function: OnServeTabbedPropertyPage
  99. 'Description: Called when the page needs to be served.
  100. 'Input Variables: PageIn,EventArg,iTab,bIsVisible
  101. 'Output Variables: PageIn,EventArg
  102. 'Returns: TRUE to indicate no problems occured. FALSE to indicate errors.
  103. ' Returning FALSE will cause the page to be abandoned.
  104. 'Global Variables: g_iTabDNS,g_iTabTCP,g_iTabLMHosts,g_iTabIPX
  105. '----------------------------------------------------------------------------------
  106. Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  107. ByVal iTab, _
  108. ByVal bIsVisible, ByRef EventArg)
  109. Call SA_TraceOut(SOURCE_FILE, "OnServeTabbedPropertyPage")
  110. Select Case iTab
  111. Case g_iTabDNS
  112. Call ServeTabDNS(PageIn, bIsVisible)
  113. Case g_iTabTCP
  114. Call ServeTabTCP(PageIn, bIsVisible)
  115. Case g_iTabLMHosts
  116. Call ServeTabLMHosts(PageIn, bIsVisible)
  117. Case g_iTabIPX
  118. If F_strIPXSettings Then
  119. Call ServeTabIPX(PageIn, bIsVisible)
  120. End If
  121. Case Else
  122. 'Nothing
  123. End Select
  124. OnServeTabbedPropertyPage = TRUE
  125. End Function
  126. '-------------------------------------------------------------------------
  127. 'Function: OnPostBackPage()
  128. 'Description: Called to signal that the page has been posted-back.
  129. 'Input Variables: PageIn,EventArg
  130. 'Output Variables: PageIn,EventArg
  131. 'Returns: Always return TRUE
  132. 'Global Variables: F_(*)
  133. '-------------------------------------------------------------------------
  134. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  135. Call SA_TraceOut("nicglobal_prop.asp", "OnPostBackPage")
  136. 'Updating the variable for LMHosts
  137. F_strLMHOSTSLOOKUP = Request.Form("chkLMHOSTSLOOKUP")
  138. F_strLMHOSTS_EDITSTATUS = Request.Form("hdnLMHOSTS")
  139. 'Get the value from txaLMHosts when it is enabled
  140. F_strLMHOSTS = Request.Form("txaLMHOSTS")
  141. F_nNICIndex = Request.Form("hdnNICIndex")
  142. 'Updating the variable for DNS
  143. F_strPrimaryChecked = Request.Form("hdnradDNSPrimaryChecked")
  144. F_strDNSSuffixesChecked = Request.Form("hdnradDNSSuffixChecked")
  145. F_strPrimaryAndParentChecked = Request.Form("hdnchkAppendDNSSuffix")
  146. F_strAppendDNSSuffix = Request.Form("chkAPPENDDNSSUFFIX")
  147. F_strDNSSuffixes = Request.Form("hdnDNSSuffixes")
  148. F_strDNSSuffix = Request.Form("radDNSSUFFIX")
  149. F_strDomainSuffix = Request.Form("txtDomainSuffix")
  150. 'Updating the variable for IPX Settings
  151. F_strIPXVirtualNumber = Request.Form("txtIPXSettings")
  152. F_strIPXSettings = Request.Form("hdnIPXSettings")
  153. 'Updating the variable for TCP\IP Hosts
  154. F_strTCPHostData = Request.Form("txaTCPHosts")
  155. 'Set the status of Checkbox and Textarea for LMHosts depending on the values
  156. Call SetLMHostStatus()
  157. OnPostBackPage = TRUE
  158. End Function
  159. '-------------------------------------------------------------------------
  160. 'Function: OnSubmitPage()
  161. 'Description: Called when the page has been submitted for processing.
  162. 'Input Variables: PageIn,EventArg
  163. 'Output Variables: PageIn,EventArg
  164. 'Returns: True/False
  165. 'Global Variables: None
  166. '-------------------------------------------------------------------------
  167. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  168. Call SA_TraceOut(SOURCE_FILE, "OnSubmitPage")
  169. OnSubmitPage = False
  170. 'To set the DNS Resolution
  171. if Not(SetDNSResolutionSettings()) then
  172. Exit Function
  173. End if
  174. 'To set the LMHosts file and IPX settings
  175. if Not(SetLMHostsandIPXSettings()) then
  176. Exit Function
  177. End if
  178. 'To set the TCP/IP Hosts file
  179. if Not(SetTCPHostsData()) then
  180. Exit Function
  181. End if
  182. OnSubmitPage= True
  183. End Function
  184. '-------------------------------------------------------------------------
  185. 'Function: OnClosePage()
  186. 'Description: Called when the page is about to be closed.
  187. 'Input Variables: PageIn,EventArg
  188. 'Output Variables: PageIn,EventArg
  189. 'Returns: True/False
  190. 'Global Variables: None
  191. '-------------------------------------------------------------------------
  192. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  193. Call SA_TraceOut(SOURCE_FILE, "OnClosePage")
  194. OnClosePage = TRUE
  195. End Function
  196. '-------------------------------------------------------------------------
  197. 'Function: ServeTabDNS()
  198. 'Description: Serve DNS Resolution tab
  199. 'Input Variables: PageIn,bIsVisible
  200. 'Output Variables: PageIn
  201. 'Returns: gc_ERR_SUCCESS
  202. 'Global Variables: L_(*), G_(*)
  203. '-------------------------------------------------------------------------
  204. Private Function ServeTabDNS(ByRef PageIn, ByVal bIsVisible)
  205. Call SA_TraceOut(SOURCE_FILE, "ServeTabDNS(oPageIn, bIsVisible="+ CStr(bIsVisible) + ")")
  206. If ( bIsVisible ) Then
  207. 'ServeCommonJavaScriptDNS is called for DNS initialising,validating and set data
  208. Call ServeCommonJavaScriptDNS()
  209. 'ServeCommonJavaScript is Common JavaScript function
  210. Call ServeCommonJavaScript()
  211. %>
  212. <table valign="middle" align="left" border="0" cellspacing="0" cellpadding="0">
  213. <tr>
  214. <td nowrap colspan="3" class="TasksBody">
  215. <%=L_RESOLUTIONOFUNQUALIFIEDNAMES %>
  216. </td>
  217. </tr>
  218. <tr>
  219. <td align="left" colspan="3" class="TasksBody">
  220. <input type=radio class="FormRadioButton" <%=F_strPrimaryChecked %> value="PRIMARY" name="radDNSSUFFIX" onclick="OnRadioClick(this);">&nbsp;<%=L_APPEND_PRIMARYDNSSUFFIX%>
  221. </td>
  222. </tr>
  223. <tr>
  224. <td class="TasksBody">
  225. &nbsp;
  226. </td>
  227. <td align="left" colspan="2" class="TasksBody">
  228. <input type="checkbox" class="FormCheckBox" onclick="SetPageChanged(true);" <%=F_strAppendDNSSuffix_EditStatus%> value="PRIMARYANDPARENT" <%=F_strPrimaryAndParentChecked%> name="chkAPPENDDNSSUFFIX" >
  229. &nbsp;<%=L_APPEND_PRIMARYDNSSUFFIX_AND_PARENTSUFFIXES%>
  230. </td>
  231. </tr>
  232. <tr>
  233. <td colspan="3" class="TasksBody">
  234. <input type=radio class="FormRadioButton" <%=F_strDNSSuffixesChecked%> value="SPECIFIC" name=radDNSSUFFIX onclick="OnRadioClick(this); document.frmTask.txtDomainSuffix.focus()" >&nbsp;<%=L_APPEND_DNSSUFFIXES%>
  235. </td>
  236. </tr>
  237. <tr>
  238. <td class="TasksBody">
  239. &nbsp;
  240. </td>
  241. <td valign="top" rowspan="3" class="TasksBody">
  242. <select name="lstDNSSUFFIXES" size="4" style="width:100%;" onclick="ButtonStatus();">
  243. <%OutputDNSSUffixesToFormOptions()%>
  244. </select>
  245. </td>
  246. <td align="left" valign="top" class="TasksBody">
  247. <%
  248. Call SA_ServeOnClickButtonEx(L_UP, "", "MoveDNSSuffixUp()", 90, 0, "DISABLED", "btnUp")
  249. %>
  250. </td>
  251. </tr>
  252. <tr>
  253. <td class="TasksBody">
  254. &nbsp;
  255. </td>
  256. <td align="left" valign="top" class="TasksBody">
  257. <%
  258. Call SA_ServeOnClickButtonEx(L_DOWN, "", "MoveDNSSuffixDown()", 90, 0, "DISABLED", "btnDown")
  259. %>
  260. </td>
  261. </tr>
  262. <tr>
  263. <td class="TasksBody">
  264. &nbsp;
  265. </td>
  266. <td align="left" valign="top" class="TasksBody">
  267. <%
  268. Call SA_ServeOnClickButtonEx(L_REMOVE, "", "RemoveDNSSuffix()", 90, 0, "DISABLED", "btnRemove")
  269. %>
  270. </td>
  271. </tr>
  272. <tr>
  273. <td class="TasksBody">
  274. &nbsp;
  275. </td>
  276. <td colspan="2" class="TasksBody">
  277. <%=L_DOMAIN_SUFFIX_TEXT%>
  278. </td>
  279. </tr>
  280. <tr>
  281. <td class="TasksBody">
  282. &nbsp;
  283. </td>
  284. <td valign="top" class="TasksBody">
  285. <input type="Text" class="FormField" name=txtDomainSuffix size="45" maxlength="255" onkeyup="return addDNS(this,btnAdd)" onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE") value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDomainSuffix))%>">
  286. </td>
  287. <td align="left" valign="top" class="TasksBody">
  288. <%
  289. Call SA_ServeOnClickButtonEx(L_ADD, "", "AddNewDNSSuffix()", 90, 0, "DISABLED", "btnAdd")
  290. %>
  291. </td>
  292. </tr>
  293. <input type="hidden" name="hdnDNSSuffixes">
  294. <input type="hidden" name="hdnNICIndex" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_nNICIndex))%>">
  295. <input type="hidden" name="hdnradDNSPrimaryChecked" value="<%=F_strPrimaryChecked%>" >
  296. <input type="hidden" name="hdnradDNSSuffixChecked" value="<%=F_strDNSSuffixesChecked%>">
  297. <input type="hidden" name="hdnchkAppendDNSSuffix" value="<%=F_strPrimaryAndParentChecked%>" >
  298. </table>
  299. <%
  300. Else
  301. %>
  302. <input type="hidden" name="txtDomainSuffix" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDomainSuffix))%>">
  303. <input type="hidden" name="hdnDNSSuffixes" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDNSSuffixes))%>">
  304. <input type="hidden" name="radDNSSUFFIX" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strDNSSuffix))%>">
  305. <input type="hidden" name="hdnNICIndex" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_nNICIndex))%>">
  306. <input type="hidden" name="hdnradDNSPrimaryChecked" value="<%=F_strPrimaryChecked%>">
  307. <input type="hidden" name="hdnradDNSSuffixChecked" value="<%=F_strDNSSuffixesChecked%>">
  308. <input type="hidden" name="hdnchkAppendDNSSuffix" value="<%=F_strPrimaryAndParentChecked%>">
  309. <input type="hidden" name="chkAPPENDDNSSUFFIX" value="PRIMARYANDPARENT">
  310. <%
  311. End If
  312. ServeTabDNS = gc_ERR_SUCCESS
  313. End Function
  314. '-------------------------------------------------------------------------
  315. 'Function: ServeTabTCP()
  316. 'Description: Serves TCP/IP hosts tab
  317. 'Input Variables: PageIn,bIsVisible
  318. 'Output Variables: PageIn
  319. 'Returns: gc_ERR_SUCCESS
  320. 'Global Variables: L_(*),F_strTCPHostData
  321. '-------------------------------------------------------------------------
  322. Private Function ServeTabTCP(ByRef PageIn, ByVal bIsVisible)
  323. Call SA_TraceOut(SOURCE_FILE, "ServeTabTCP")
  324. If ( bIsVisible ) Then
  325. 'ServeCommonJavaScriptTCP is called for TCP/IP initialising,validating and set data
  326. Call ServeCommonJavaScriptTCP()
  327. 'ServeCommonJavaScript is Common JavaScript function
  328. Call ServeCommonJavaScript()
  329. %>
  330. <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  331. <tr>
  332. <td class="TasksBody" nowrap valign=top colspan="2">
  333. <%=L_TCPHOST%>
  334. </td>
  335. </tr>
  336. <tr>
  337. <td class="TasksBody">
  338. &nbsp;&nbsp;&nbsp;
  339. </td>
  340. <td class="TasksBody">
  341. <textarea class="FormField" rows="12" cols="90" wrap="off" name="txaTCPHOSTS" onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE")><%=Server.HTMLEncode(F_strTCPHostData)%></textarea>
  342. </td>
  343. </tr>
  344. <tr>
  345. <td colspan="2" class="TasksBody"><%=L_TCPHOSTTEXT%>
  346. </td>
  347. </tr>
  348. </table>
  349. <%
  350. Else
  351. %>
  352. <input type="hidden" name="txaTCPHOSTS" value = "<%=Server.HTMLEncode(F_strTCPHostData)%>">
  353. <%
  354. End If
  355. ServeTabTCP = gc_ERR_SUCCESS
  356. End Function
  357. '-------------------------------------------------------------------------
  358. 'Function: ServeTabLMHosts()
  359. 'Description: Serves LMHosts hosts tab
  360. 'Input Variables: PageIn,bIsVisible
  361. 'Output Variables: PageIn
  362. 'Returns: gc_ERR_SUCCESS
  363. 'Global Variables: L_(*),F_(*)
  364. '-------------------------------------------------------------------------
  365. Private Function ServeTabLMHosts(ByRef PageIn, ByVal bIsVisible)
  366. Call SA_TraceOut(SOURCE_FILE, "ServeTabLMHosts(PageIn, bIsVisible="+ CStr(bIsVisible) + ")")
  367. If ( bIsVisible ) Then
  368. 'ServeCommonJavaScriptLMHosts is called for LMHosts initialising,validating and set data
  369. Call ServeCommonJavaScriptLMHOSTS()
  370. 'ServeCommonJavaScript is a Common JavaScript function
  371. Call ServeCommonJavaScript()
  372. %>
  373. <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  374. <tr>
  375. <td nowrap class="TasksBody" colspan="4">
  376. <%=L_LMHOSTS%>
  377. </td>
  378. </tr>
  379. <tr>
  380. <td colspan="4" class="TasksBody">
  381. <input type="checkbox" class="FormCheckBox" name="chkLMHOSTSLOOKUP" <%=F_strLMHOSTSLOOKUPSTATUS%> value="<%=F_strLMHOSTSLOOKUP%>" onclick="EnableLMHostText()" >&nbsp;&nbsp;<%=L_ENABLED_LMHOSTS_LOOKUP%>
  382. </td>
  383. </tr>
  384. <tr>
  385. <td colspan="4" class="TasksBody">
  386. <textarea class="FormField" wrap="off" name="txaLMHOSTS" <%=F_strLMHOSTS_EDITSTATUS%> rows="12" cols="80" onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE") ><%=Server.HTMLEncode(F_strLMHOSTS)%></textarea>
  387. </td>
  388. </tr>
  389. <tr>
  390. <td colspan="4" class="TasksBody">
  391. <%=Server.HTMLEncode(SA_EscapeQuotes(L_LMHOSTS_MESSAGE_TEXT))%>
  392. </td>
  393. </tr>
  394. <input type="hidden" name="hdnLMHOSTS" value="<%=F_strLMHOSTS_EDITSTATUS%>">
  395. </table>
  396. <%
  397. Else
  398. %>
  399. <input type="hidden" name="chkLMHOSTSLOOKUP" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strLMHOSTSLOOKUP))%>" >
  400. <input type="hidden" name="txaLMHOSTS" value="<%=Server.HTMLEncode(F_strLMHOSTS)%>">
  401. <input type="hidden" name="hdnLMHOSTS" value="<%=F_strLMHOSTS_EDITSTATUS%>">
  402. <%
  403. End If
  404. ServeTabLMHosts = gc_ERR_SUCCESS
  405. End Function
  406. '-------------------------------------------------------------------------
  407. 'Function: ServeTabIPX()
  408. 'Description: Serves for IPX settings tab
  409. 'Input Variables: PageIn,bIsVisible
  410. 'Output Variables: PageIn
  411. 'Returns: gc_ERR_SUCCESS
  412. 'Global Variables: L_(*),F_(*)
  413. '-------------------------------------------------------------------------
  414. Private Function ServeTabIPX(ByRef PageIn, ByVal bIsVisible)
  415. Call SA_TraceOut(SOURCE_FILE, "ServeTabIPX(oPageIn, bIsVisible="+ CStr(bIsVisible) + ")")
  416. If ( bIsVisible ) Then
  417. 'ServeCommonJavaScriptIPX is called for IPX initialising,validating and set data
  418. Call ServeCommonJavaScriptIPX()
  419. 'ServeCommonJavaScript() is a Common JavaScript function
  420. Call ServeCommonJavaScript()
  421. If UCase(F_strIPXSettings) <> UCase("TRUE") then
  422. %>
  423. <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  424. <tr>
  425. <td class="TasksBody" nowrap>
  426. <%=L_IPX_SETTINGS_ERRORMESSAGE%>
  427. </td>
  428. </tr>
  429. </table>
  430. <%
  431. Else
  432. %> <table valign="middle" align="left" border=0 cellspacing="0" cellpadding="0">
  433. <tr>
  434. <td class="TasksBody" nowrap>
  435. <%=L_IPX_NETWORKNUMBER_TEXT%>&nbsp;&nbsp;
  436. <input type="text" class="FormField" name="txtIPXSettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXVirtualNumber))%>" onkeypress="checkKeyforHexNumbers(this)" onblur ="validateIPXSettings(this)" maxlength="8" size="20">
  437. </td>
  438. </tr>
  439. <tr>
  440. <td class="TasksBody" nowrap>
  441. <%=L_IPX_NETWORKSETTINGS_TEXT%>
  442. </td>
  443. </tr>
  444. </table>
  445. <%
  446. End If
  447. %>
  448. <input type="hidden" name="hdnIPXSettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXSettings))%>">
  449. <%
  450. Else
  451. If F_strIPXVirtualNumber <>"" then
  452. %>
  453. <input type="hidden" name="txtIPXSettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXVirtualNumber))%>">
  454. <%
  455. End If
  456. %>
  457. <input type="hidden" name="hdnipxsettings" value="<%=Server.HTMLEncode(SA_EscapeQuotes(F_strIPXSettings))%>">
  458. <%
  459. End If
  460. ServeTabIPX = gc_ERR_SUCCESS
  461. End Function
  462. '-------------------------------------------------------------------------
  463. 'Function: ServeCommonJavaScriptDNS
  464. 'Description: Serves in initialising the values,setting the form
  465. ' data and validating the form values for DNS tab
  466. 'Input Variables: None
  467. 'Output Variables: None
  468. 'Returns: None
  469. 'Global Variables: In:L_(*)-Localized strings
  470. '-------------------------------------------------------------------------
  471. Function ServeCommonJavaScriptDNS()
  472. %>
  473. <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  474. </script>
  475. <script language="javascript">
  476. //INIT for DNS Tab
  477. function Init()
  478. {
  479. var strReturnurl=location.href
  480. var tempCnt=strReturnurl.indexOf("&ReturnURL=");
  481. var straction=strReturnurl.substring(0,tempCnt)
  482. document.frmTask.action = straction
  483. document.frmTask.Method.value = ""
  484. var objlstSuffix=document.frmTask.lstDNSSUFFIXES;
  485. var objDomainSuffix=document.frmTask.txtDomainSuffix;
  486. if (document.frmTask.hdnradDNSPrimaryChecked.value.toUpperCase() == "CHECKED" )
  487. {
  488. document.frmTask.radDNSSUFFIX[0].checked = true
  489. if (document.frmTask.hdnchkAppendDNSSuffix.value.toUpperCase() == "CHECKED")
  490. {
  491. document.frmTask.chkAPPENDDNSSUFFIX.checked = true
  492. }
  493. else
  494. {
  495. document.frmTask.chkAPPENDDNSSUFFIX.checked = false
  496. }
  497. }
  498. if (document.frmTask.hdnradDNSSuffixChecked.value.toUpperCase() == "CHECKED")
  499. {
  500. document.frmTask.radDNSSUFFIX[1].checked = true
  501. }
  502. //Initializes the "DNS Suffixes to use " radio button group
  503. //and DNS suffixes list box
  504. if (objlstSuffix.length > 0)
  505. {
  506. objlstSuffix.options[0].selected = true;
  507. document.frmTask.btnUp.disabled = true;
  508. }
  509. if (objlstSuffix.length == 1)
  510. {
  511. objlstSuffix.options[0].selected = true;
  512. document.frmTask.btnDown.disabled = true;
  513. }
  514. if(document.frmTask.radDNSSUFFIX[0].checked)
  515. {
  516. EnableControls(document.frmTask.radDNSSUFFIX[0]);
  517. }
  518. else
  519. {
  520. EnableControls(document.frmTask.radDNSSUFFIX[1]);
  521. }
  522. //For clearing error when server side error occurs
  523. document.frmTask.onkeypress = ClearErr
  524. //Call to disabe the add button
  525. disableAddButton(objDomainSuffix,document.frmTask.btnAdd);
  526. SetPageChanged(false);
  527. if (objlstSuffix.length == 1)
  528. {
  529. objlstSuffix.options[0].selected = true;
  530. document.frmTask.btnDown.disabled = true;
  531. }
  532. }
  533. function ValidatePage()
  534. {
  535. if (getRadioButtonValue(document.frmTask.radDNSSUFFIX).toUpperCase() == "SPECIFIC" && document.frmTask.lstDNSSUFFIXES.length == 0 )
  536. {
  537. SA_DisplayErr ("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_SEARCH_METHOD_TEXT))%>");
  538. document.frmTask.onkeypress = ClearErr
  539. return false;
  540. }
  541. return true;
  542. }
  543. function SetData()
  544. {
  545. var objlstSuffix=document.frmTask.lstDNSSUFFIXES;
  546. var strList="";
  547. /*Retrieves values from DNS suffixes list box and concatenates them
  548. and stores it into a strList variable*/
  549. for ( var index=0; index < objlstSuffix.length; index++ )
  550. {
  551. strList += objlstSuffix.options[index].value + String.fromCharCode(1);
  552. }
  553. strList = strList.slice(0,strList.length-1);
  554. //Write the concatenated string into the hidden variable
  555. document.frmTask.hdnDNSSuffixes.value=strList;
  556. if(document.frmTask.radDNSSUFFIX[0].checked)
  557. {
  558. document.frmTask.hdnradDNSPrimaryChecked.value = "CHECKED"
  559. document.frmTask.hdnradDNSSuffixChecked.value = ""
  560. if (document.frmTask.chkAPPENDDNSSUFFIX.checked)
  561. {
  562. document.frmTask.hdnchkAppendDNSSuffix.value = "CHECKED"
  563. }
  564. else
  565. {
  566. document.frmTask.hdnchkAppendDNSSuffix.value = ""
  567. }
  568. }
  569. else
  570. {
  571. document.frmTask.hdnradDNSPrimaryChecked.value = ""
  572. document.frmTask.hdnradDNSSuffixChecked.value = "CHECKED"
  573. }
  574. }
  575. // OnTextInputChanged
  576. // function that is invoked whenever a text input field is modified on the page.
  577. function OnTextInputChanged(objText)
  578. {
  579. SetPageChanged(true);
  580. }
  581. // OnRadioOptionChanged
  582. // function that is invoked whenever a radio input field is modified on the page.
  583. function OnRadioOptionChanged(objRadio)
  584. {
  585. SetPageChanged(true);
  586. }
  587. //checks for initial ".", less than 255 chars, consecutive periods, less than
  588. //63 chars between two periods
  589. function checkdot(strInput)
  590. {
  591. var strSplit
  592. var intIndex
  593. if (strInput.charAt(0) == "." )
  594. {
  595. return false;
  596. }
  597. if (strInput.length > 255)
  598. {
  599. return false;
  600. }
  601. if (strInput.indexOf(".") != -1)
  602. {
  603. strSplit = strInput.split(".")
  604. for (intIndex = 0;intIndex < strSplit.length;intIndex++)
  605. {
  606. if (strSplit[intIndex].length > 63)
  607. {
  608. return false;
  609. }
  610. }
  611. }
  612. if (strInput.indexOf("..") != -1)
  613. {
  614. return false;
  615. }
  616. return true;
  617. }
  618. //Adds new suffix to DNS suffixes list box
  619. function AddNewDNSSuffix()
  620. {
  621. SetPageChanged(true);
  622. var objlstSuffix=document.frmTask.lstDNSSUFFIXES;
  623. var objDomainSuffix=document.frmTask.txtDomainSuffix;
  624. // checking for null value and for the invalid input by calling checkdot function
  625. if ( objDomainSuffix.value.length != 0 && !IsAllSpaces(objDomainSuffix.value) && checkdot(document.frmTask.txtDomainSuffix.value))
  626. {
  627. //Only a maximum of 20 entries are allowed in DNS Suffix list box
  628. if (objlstSuffix.length < 20)
  629. {
  630. //Add to the list
  631. if(!addToListBox(objlstSuffix, document.frmTask.btnAdd, objDomainSuffix.value, objDomainSuffix.value))
  632. {
  633. SA_DisplayErr("<%=Server.HTMLEncode(L_ERR_DNSSUFFIXALREADYEXISTS)%>");
  634. return false;
  635. }
  636. else
  637. {
  638. objDomainSuffix.value="";
  639. // call to disabe the add button
  640. disableAddButton(document.frmTask.txtDomainSuffix,document.frmTask.btnAdd);
  641. /* Checking the length Domain suffix list box ,
  642. and selecting the first entry and enabling REMOVE button */
  643. if ( objlstSuffix.length == 1)
  644. {
  645. document.frmTask.btnRemove.disabled= false ;
  646. document.frmTask.btnDown.disabled = true;
  647. document.frmTask.btnUp.disabled = true;
  648. objlstSuffix.options[objlstSuffix.length-1].selected=true;
  649. }
  650. else
  651. {
  652. if ( objlstSuffix.length > 0)
  653. {
  654. document.frmTask.btnRemove.disabled= false ;
  655. document.frmTask.btnDown.disabled = true
  656. document.frmTask.btnUp.disabled = false
  657. objlstSuffix.options[objlstSuffix.length-1].selected=true;
  658. }
  659. }
  660. }
  661. }
  662. }
  663. else
  664. {
  665. SA_DisplayErr ("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DNSNAME_TEXT))%>");
  666. document.frmTask.txtDomainSuffix.focus()
  667. document.frmTask.onkeypress = ClearErr;
  668. }
  669. }
  670. //Removes the selected suffix from DNS suffixes list box
  671. function RemoveDNSSuffix()
  672. {
  673. SetPageChanged(true);
  674. var objSuffix=document.frmTask.lstDNSSUFFIXES;
  675. var SelectedIndex=objSuffix.selectedIndex;
  676. if ( objSuffix.length > 1 )
  677. {
  678. objSuffix.options[SelectedIndex]=null;
  679. if ( objSuffix.length == 1 )
  680. {
  681. document.frmTask.btnUp.disabled = true;
  682. document.frmTask.btnDown.disabled = true;
  683. }
  684. else if (SelectedIndex == 0)
  685. {
  686. document.frmTask.btnUp.disabled = true;
  687. }
  688. else
  689. {
  690. if ((SelectedIndex-1) == 0)
  691. {
  692. document.frmTask.btnUp.disabled = true;
  693. }
  694. }
  695. }
  696. else
  697. {
  698. objSuffix.options[SelectedIndex]=null;
  699. document.frmTask.btnUp.disabled = true;
  700. document.frmTask.btnRemove.disabled = true;
  701. document.frmTask.btnDown.disabled = true;
  702. selectFocus(document.frmTask.txtDomainSuffix)
  703. }
  704. if (objSuffix.length>0)
  705. {
  706. objSuffix.options[objSuffix.length-1].selected = true;
  707. }
  708. }
  709. // end of function RemoveSuffix()
  710. // Enable or disable ADD and REMOVE Buttons on click event of Radio buttons
  711. function EnableControls(objRadio)
  712. {
  713. if ( objRadio.value == "PRIMARY" )
  714. {
  715. document.frmTask.btnAdd.disabled = true;
  716. document.frmTask.btnRemove.disabled = true;
  717. document.frmTask.btnUp.disabled = true;
  718. document.frmTask.btnDown.disabled = true;
  719. document.frmTask.txtDomainSuffix.disabled = true;
  720. document.frmTask.txtDomainSuffix.value = "";
  721. document.frmTask.lstDNSSUFFIXES.length = 0;
  722. document.frmTask.lstDNSSUFFIXES.disabled= true;
  723. document.frmTask.chkAPPENDDNSSUFFIX.disabled=false;
  724. }
  725. else
  726. {
  727. // call to disabe the add button
  728. disableAddButton(document.frmTask.txtDomainSuffix,document.frmTask.btnAdd);
  729. if(document.frmTask.lstDNSSUFFIXES.length == 0 )
  730. {
  731. document.frmTask.btnRemove.disabled = true ;
  732. document.frmTask.btnUp.disabled = true ;
  733. document.frmTask.btnDown.disabled = true ;
  734. }
  735. else
  736. {
  737. document.frmTask.btnRemove.disabled = false ;
  738. document.frmTask.btnDown.disabled = false ;
  739. if (document.frmTask.lstDNSSUFFIXES.selectedIndex != 0)
  740. {
  741. document.frmTask.btnUp.disabled = false ;
  742. }
  743. }
  744. document.frmTask.txtDomainSuffix.disabled = false;
  745. document.frmTask.lstDNSSUFFIXES.disabled= false;
  746. document.frmTask.chkAPPENDDNSSUFFIX.checked=false;
  747. document.frmTask.chkAPPENDDNSSUFFIX.disabled=true;
  748. }
  749. }
  750. function AddText(objTextBox,objButton)
  751. {
  752. var nKeyCode
  753. nKeyCode = window.event.keyCode;
  754. if (nKeyCode ==13)
  755. {
  756. objButton.click()
  757. return false
  758. }
  759. return true
  760. }
  761. function addDNS(objTextBox,objButton)
  762. {
  763. SetPageChanged(true);
  764. disableAddButton(objTextBox,objButton)
  765. return AddText(objTextBox,objButton)
  766. }
  767. function OnRadioClick(objControl)
  768. {
  769. SetPageChanged(true);
  770. EnableControls(objControl);
  771. }
  772. //To move up in DNS suffix list box
  773. function MoveDNSSuffixUp()
  774. {
  775. var objSuffix=document.frmTask.lstDNSSUFFIXES;
  776. var SelectedIndex=objSuffix.selectedIndex;
  777. var strChangedValue;
  778. var strOriginalValue;
  779. strChangedValue = objSuffix.options[SelectedIndex-1].value;
  780. strOriginalValue = objSuffix.options[SelectedIndex].value;
  781. objSuffix.options[SelectedIndex] = new Option(strChangedValue,strChangedValue,false,false);
  782. objSuffix.options[SelectedIndex-1] = new Option(strOriginalValue,strOriginalValue,false,false);
  783. document.frmTask.btnDown.disabled = false;
  784. objSuffix.options[SelectedIndex-1].selected=true;
  785. if ((SelectedIndex-1) == 0)
  786. {
  787. document.frmTask.btnUp.disabled = true;
  788. }
  789. }
  790. //To move down in DNS suffix list box
  791. function MoveDNSSuffixDown()
  792. {
  793. var objSuffix=document.frmTask.lstDNSSUFFIXES;
  794. var SelectedIndex=objSuffix.selectedIndex;
  795. var strChangedValue;
  796. var strOriginalValue;
  797. strChangedValue = objSuffix.options[SelectedIndex+1].value;
  798. strOriginalValue = objSuffix.options[SelectedIndex].value;
  799. objSuffix.options[SelectedIndex] = new Option(strChangedValue,strChangedValue,false,false);
  800. objSuffix.options[SelectedIndex+1] = new Option(strOriginalValue,strOriginalValue,false,false);
  801. document.frmTask.btnUp.disabled = false
  802. objSuffix.options[SelectedIndex+1].selected=true;
  803. if ( SelectedIndex == (objSuffix.length - 2) )
  804. {
  805. document.frmTask.btnDown.disabled = true
  806. }
  807. }
  808. //Function to make the up and down buttons Enabled or Disabled
  809. function ButtonStatus()
  810. {
  811. var objSuffix=document.frmTask.lstDNSSUFFIXES;
  812. var nSelectedIndex=objSuffix.selectedIndex;
  813. var nDnsListlength=objSuffix.length;
  814. if ( nSelectedIndex == 0)
  815. {
  816. document.frmTask.btnUp.disabled = true
  817. document.frmTask.btnDown.disabled = false
  818. }
  819. else
  820. {
  821. if ( nSelectedIndex == (objSuffix.length - 1))
  822. {
  823. document.frmTask.btnDown.disabled = true
  824. document.frmTask.btnUp.disabled = false
  825. }
  826. else
  827. {
  828. document.frmTask.btnUp.disabled = false
  829. document.frmTask.btnDown.disabled = false
  830. }
  831. }
  832. if(nDnsListlength==0 || nDnsListlength==1 )
  833. {
  834. document.frmTask.btnUp.disabled = true
  835. document.frmTask.btnDown.disabled = true
  836. }
  837. }
  838. </script>
  839. <%
  840. End Function
  841. '-------------------------------------------------------------------------
  842. 'Function: ServeCommonJavaScriptTCP
  843. 'Description: Serves in initialising the values,setting the form
  844. ' data and validating the form values for TCP/IP tab
  845. 'Input Variables: None
  846. 'Output Variables: None
  847. 'Returns: None
  848. 'Global Variables: None
  849. '-------------------------------------------------------------------------
  850. Function ServeCommonJavaScriptTCP()
  851. %>
  852. <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  853. </script>
  854. <script language="javascript">
  855. //INIT for TCP/IP Tab
  856. function Init()
  857. {
  858. }
  859. function ValidatePage()
  860. {
  861. return true;
  862. }
  863. function SetData()
  864. {
  865. }
  866. </script>
  867. <%
  868. End Function
  869. '-------------------------------------------------------------------------
  870. 'Function: ServeCommonJavaScriptLMHOSTS
  871. 'Description: Serves in initialising the values,setting the form
  872. ' data and validating the form values for LMHOSTS Tab
  873. 'Input Variables: None
  874. 'Output Variables: None
  875. 'Returns: None
  876. 'Global Variables: None
  877. '-------------------------------------------------------------------------
  878. Function ServeCommonJavaScriptLMHOSTS()
  879. %>
  880. <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  881. </script>
  882. <script language="javascript">
  883. //INIT for LMHOSTS Tab
  884. function Init()
  885. {
  886. }
  887. // LMHosts ValidatePage Function
  888. function ValidatePage()
  889. {
  890. //retaining the value in hidden variable when text area is disabled
  891. //document.frmTask.hdnLMHOSTSText.value=document.frmTask.txaLMHOSTS.value
  892. return true;
  893. }
  894. function SetData()
  895. {
  896. }
  897. // Enable or disable LMHost text area depending on the value of LMHOST LOOKUP Check Box
  898. function EnableLMHostText()
  899. {
  900. if (document.frmTask.chkLMHOSTSLOOKUP.checked)
  901. {
  902. document.frmTask.chkLMHOSTSLOOKUP.value = "CHECKED"
  903. document.frmTask.txaLMHOSTS.disabled = false;
  904. }
  905. else
  906. {
  907. document.frmTask.txaLMHOSTS.disabled = true;
  908. document.frmTask.chkLMHOSTSLOOKUP.value = ""
  909. }
  910. }
  911. </script>
  912. <%
  913. End Function
  914. '-------------------------------------------------------------------------
  915. 'Function: ServeCommonJavaScriptIPX
  916. 'Description: Serves in initialising the values,setting the form
  917. ' data and validating the form values for IPX settings
  918. 'Input Variables: None
  919. 'Output Variables: None
  920. 'Returns: None
  921. 'Global Variables: None
  922. '-------------------------------------------------------------------------
  923. Function ServeCommonJavaScriptIPX()
  924. %>
  925. <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  926. </script>
  927. <script language="javascript">
  928. //INIT for IPX settings Tab
  929. function Init()
  930. {
  931. }
  932. function ValidatePage()
  933. {
  934. return true;
  935. }
  936. function SetData()
  937. {
  938. }
  939. //To check for the keys. It should allow only 0-9 and A-F
  940. function checkKeyforHexNumbers(obj)
  941. {
  942. if (!((window.event.keyCode >=48 && window.event.keyCode <=57) || (window.event.keyCode >=65 && window.event.keyCode <=70) || (window.event.keyCode >=97 && window.event.keyCode <=102)))
  943. {
  944. window.event.keyCode = 0;
  945. obj.focus();
  946. }
  947. }
  948. //Validation for IPX settings Text Box
  949. function validateIPXSettings(obj)
  950. {
  951. var strIPXval
  952. var intIPXval
  953. strIPXval = document.frmTask.txtIPXSettings.value
  954. intIPXval = strIPXval.length
  955. if (intIPXval < 9)
  956. {
  957. for (i=0; i<(8 - intIPXval); i++)
  958. {
  959. strIPXval = 0 + strIPXval
  960. }
  961. }
  962. document.frmTask.txtIPXSettings.value = strIPXval.toUpperCase()
  963. }
  964. </script>
  965. <%
  966. End Function
  967. '-------------------------------------------------------------------------
  968. 'Function: ServeCommonJavaScript
  969. 'Description: Validating the form values
  970. 'Input Variables: None
  971. 'Output Variables: None
  972. 'Returns: None
  973. 'Global Variables: None
  974. '-------------------------------------------------------------------------
  975. Function ServeCommonJavaScript()
  976. %>
  977. <script language="javascript" src="<%=m_VirtualRoot%>inc_global.js">
  978. </script>
  979. <script language="javascript">
  980. //To disable Enter and Escape key actions
  981. function HandleKey(input)
  982. {
  983. if(input == "DISABLE")
  984. document.onkeypress = "";
  985. else
  986. document.onkeypress = HandleKeyPress;
  987. }
  988. </script>
  989. <%
  990. End Function
  991. '-------------------------------------------------------------------------
  992. 'Subroutine: GetInitialValues
  993. 'Description: Gets the initial settings for DNS, and IPX from the system
  994. 'Input Variables: None
  995. 'Output Variables: None
  996. 'Returns: None
  997. 'Global Variables: G_objService, F_nNICIndex,F_strIPXSettings,F_strIPXVirtualNumber
  998. ' F_strLMHOSTSLOOKUPSTATUS,F_strPrimaryChecked, F_strPrimaryAndParentChecked
  999. ' F_strDNSSuffixesChecked, F_strAppendDNSSuffix_EditStatus, G_objRegistry
  1000. ' L_(*)
  1001. '-------------------------------------------------------------------------
  1002. Sub GetInitialValues
  1003. Err.Clear
  1004. On Error Resume Next
  1005. Dim objNACCollection 'WMI connection
  1006. Dim objNICInstance 'To get instances of Win32_NetworkAdapterConfiguration
  1007. Dim nNICIndex 'Index for which IPEnabled is true
  1008. Dim strIPXSettings 'Value of IPXSettings
  1009. Dim strIPXVirtualNumber 'IPX network virtual number
  1010. Dim strWINSEnableLMHostsLookup 'value of WINSEnableLMHostsLookup
  1011. Dim nUseDomainNameDevolution 'Gets status of registry key
  1012. Dim strDNSDomainSuffixSearchOrder 'Value of DNSDomainSuffixSearchOrder
  1013. 'Getting registry connection
  1014. Call RegistryConnection()
  1015. Set G_objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1016. If Err.number<>0 then
  1017. Call SA_ServeFailurePageEx(L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE, mstrReturnURL)
  1018. Exit Sub
  1019. End if
  1020. 'Getting the Win32_NetworkAdapterConfiguration instance for which IPEnabled is true
  1021. Set objNACCollection = G_objService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled = true")
  1022. 'Error message when failed to get Win32_NetworkAdapterConfiguration instance
  1023. If Err.number <> 0 Then
  1024. Call SA_ServeFailurePageEx(L_COULDNOTGET_WIN32NETADAPTERCONFIG_ERRORMESSAGE, mstrReturnURL)
  1025. Exit Sub
  1026. End if
  1027. 'checking for the Zero count of the NIC cards if so raise error message
  1028. If (objNACCollection.Count = 0) Then
  1029. Call SA_ServeFailurePageEx(L_NO_IPENABLED_NICCARDS_FOUND_ERRORMESSAGE , mstrReturnURL)
  1030. Exit Sub
  1031. End If
  1032. 'Retrieving the values of Win32_NetworkAdapterConfiguration for which IP is enabled
  1033. For Each objNICInstance In objNACCollection
  1034. nNICIndex = objNICInstance.Index
  1035. strWINSEnableLMHostsLookup = objNICInstance.WINSEnableLMHostsLookup
  1036. strIPXSettings = objNICInstance.IPXEnabled
  1037. strIPXVirtualNumber = objNICInstance.IPXVirtualNetNumber
  1038. strDNSDomainSuffixSearchOrder = objNICInstance.DNSDomainSuffixSearchOrder
  1039. Exit For
  1040. Next
  1041. 'Assigning values to form variables
  1042. F_nNICIndex = nNICIndex
  1043. F_strIPXSettings = strIPXSettings
  1044. F_strIPXVirtualNumber = strIPXVirtualNumber
  1045. 'Getting registry settings and depending on that updating the form variables
  1046. If (IsNull(strDNSDomainSuffixSearchOrder) ) Then
  1047. F_strPrimaryChecked= "CHECKED"
  1048. nUseDomainNameDevolution=getRegkeyvalue(G_objRegistry,CONST_DNSREGISTEREDADAPTERSPATH,"UseDomainNameDevolution",CONST_DWORD)
  1049. If nUseDomainNameDevolution = 1 then
  1050. F_strPrimaryAndParentChecked = "CHECKED"
  1051. End if
  1052. Else
  1053. F_strDNSSuffixesChecked="CHECKED"
  1054. F_strAppendDNSSuffix_EditStatus = "DISABLED"
  1055. End if
  1056. 'Depending on WINSEnableLMHostsLookup updating the form variables for LMHOSTS
  1057. If strWINSEnableLMHostsLookup Then
  1058. F_strLMHOSTSLOOKUP = UCase("CHECKED")
  1059. End if
  1060. 'Releasing the object
  1061. Set objNICInstance = Nothing
  1062. Set objNACCollection = Nothing
  1063. End Sub
  1064. '-------------------------------------------------------------------------
  1065. 'Subroutine: GetLMHostsandTCPFileData
  1066. 'Description: Gets data in LMHosts and TCP Hosts file
  1067. 'Input Variables: None
  1068. 'Output Variables: None
  1069. 'Returns: None
  1070. 'Global Variables: L_(*)-Localized strings,F_strTCPHostData
  1071. ' F_strLMHOSTS, F_strLMHOSTSLOOKUP, F_strLMHOSTS_EDITSTATUS
  1072. '-------------------------------------------------------------------------
  1073. Sub GetLMHostsandTCPFileData()
  1074. Err.Clear
  1075. on error resume next
  1076. Dim objFileSystem 'File system object
  1077. Dim objFile 'Instance of LMHosts file system object
  1078. Dim strLMHostsFilePath 'LMHosts file path
  1079. Dim strTCPHostsFile 'TCP/IP file path
  1080. Dim objTCPFile 'Instance of TCP/IP Hosts file system object
  1081. 'Retrieving the path of TCP/IP Hosts File
  1082. strTCPHostsFile = GetSystemPath
  1083. strTCPHostsFile = strTCPHostsFile & CONST_DRIVERSETCHOSTS
  1084. 'Retrieving the path of LMHosts File
  1085. strLMHostsFilePath = GetSystemPath
  1086. strLMHostsFilePath = strLMHostsFilePath & CONST_DRIVERSETCLMHOSTS
  1087. 'Create file system object
  1088. Set objFileSystem= Server.CreateObject("Scripting.FileSystemObject")
  1089. 'Error in creating file system object
  1090. If Err.number <> 0 Then
  1091. SA_SetErrMsg L_ERROR_IN_CREATING_SCRIPTING_FILESYSTEMOBJECT_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1092. Exit Sub
  1093. End If
  1094. 'Create instance of TCP/IP Hosts file system object
  1095. Set objTCPFile=objFileSystem.OpenTextFile(strTCPHostsFile,1)
  1096. 'Read the TCP/IP Hosts file
  1097. If not objTCPFile.AtEndofStream Then
  1098. F_strTCPHostData = objTCPFile.readAll
  1099. End if
  1100. 'Close the file object
  1101. objTCPFile.close
  1102. 'Create instance of LMHosts file system object
  1103. Set objFile=objFileSystem.OpenTextFile(strLMHostsFilePath,1)
  1104. 'Read the LMHOSTS file
  1105. If not objFile.AtEndofStream Then
  1106. F_strLMHOSTS = objFile.ReadAll()
  1107. End IF
  1108. 'Close the file object
  1109. objFile.Close
  1110. Set objTCPFile = Nothing
  1111. Set objFileSystem = Nothing
  1112. Set objFile = Nothing
  1113. End Sub
  1114. '-------------------------------------------------------------------------
  1115. 'Function name: SetLMHostsandIPXSettings()
  1116. 'Description: Serves in updating LMHosts and IPX Settings
  1117. 'Input Variables: None
  1118. 'Output Variables: True/false
  1119. 'Returns: True/false
  1120. 'Global Variables: G_objService,F_nNICIndex, F_strLMHOSTSLOOKUP,
  1121. ' F_strLMHOSTS, L_(*)-Localized strings
  1122. '-------------------------------------------------------------------------
  1123. Function SetLMHostsandIPXSettings()
  1124. Err.Clear
  1125. On Error Resume Next
  1126. Dim strLMHostsFilePath
  1127. Dim nretval
  1128. Dim strLMHostspath
  1129. Dim objFileSystem
  1130. Dim objFile
  1131. SetLMHostsandIPXSettings = False
  1132. strLMHostspath = "\drivers\etc\lmhosts"
  1133. 'Getting registry connection
  1134. Call RegistryConnection()
  1135. 'Coverting F_strIPXVirtualNumber to hexadecimal
  1136. F_strIPXVirtualNumber = "&H" & F_strIPXVirtualNumber
  1137. 'Coverting F_strIPXVirtualNumber to long
  1138. F_strIPXVirtualNumber = CLng(F_strIPXVirtualNumber)
  1139. 'This is used to convert signed integer to unsigned integer
  1140. If F_strIPXVirtualNumber < 0 Then
  1141. F_strIPXVirtualNumber = F_strIPXVirtualNumber + UNSIGNEDINT_FORMATTER
  1142. End If
  1143. 'updating the registry with IPX Settings
  1144. If UCase(F_strIPXSettings) = UCase(True) then
  1145. nretval=updateRegkeyvalue(G_objRegistry,CONST_NETBIOSREGISTRYENABLELMHOSTSPATH,"VirtualNetworkNumber",F_strIPXVirtualNumber,CONST_DWORD)
  1146. End If
  1147. If Ucase(F_strLMHOSTSLOOKUP) = UCase("CHECKED") Then
  1148. 'updating the registry with the value of "EnableLMHOSTS" check box
  1149. nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTRYENABLELMHOSTSPATH,"EnableLMHOSTS",1,CONST_DWORD)
  1150. 'Get LMHosts file path
  1151. strLMHostsFilePath = GetSystemPath
  1152. strLMHostsFilePath = strLMHostsFilePath & strLMHostspath
  1153. 'Creating the File system object
  1154. Set objFileSystem= Server.CreateObject("Scripting.FileSystemObject")
  1155. If Err.number <> 0 Then
  1156. SA_SetErrMsg L_ERROR_IN_CREATING_SCRIPTING_FILESYSTEMOBJECT_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1157. Exit Function
  1158. End If
  1159. 'Creating the Text File object
  1160. Set objFile=objFileSystem.OpenTextFile(strLMHostsFilePath,2,True)
  1161. If Err.number <> 0 Then
  1162. SA_SetErrMsg L_ERROR_IN_CREATINGTEXTFILE_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1163. Exit Function
  1164. End If
  1165. 'Writing into the LMHOSTS file
  1166. objFile.Write F_strLMHOSTS
  1167. If Err.number <> 0 Then
  1168. SA_SetErrMsg L_ERROR_OCCURED_WHILE_UPDATING_HOSTSFILE & "(" & Hex(Err.Number) & ")"
  1169. Exit Function
  1170. End If
  1171. 'Close file object
  1172. objFile.Close
  1173. 'Release the objects
  1174. Set objFile = Nothing
  1175. Set objFileSystem = Nothing
  1176. Else
  1177. 'updating the registry with the value of "EnableLMHOSTS" check box
  1178. nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTRYENABLELMHOSTSPATH,"EnableLMHOSTS",0,CONST_DWORD)
  1179. End if
  1180. SetLMHostsandIPXSettings = True
  1181. End Function
  1182. '-------------------------------------------------------------------------
  1183. 'Function name: SetLMHostStatus()
  1184. 'Description: Set the status of Checkbox and Textarea for LMHosts
  1185. ' depending on the initial values
  1186. 'Input Variables: None
  1187. 'Output Variables: F_strLMHOSTSLOOKUPSTATUS,F_strLMHOSTS_EDITSTATUS
  1188. 'Returns: None
  1189. 'Global Variables: F_strLMHOSTSLOOKUP,F_strLMHOSTSLOOKUPSTATUS,F_strLMHOSTS_EDITSTATUS
  1190. '-------------------------------------------------------------------------
  1191. Function SetLMHostStatus()
  1192. Err.Clear
  1193. On Error Resume Next
  1194. If Ucase(F_strLMHOSTSLOOKUP) = Ucase("CHECKED") Then
  1195. F_strLMHOSTSLOOKUPSTATUS = Ucase("CHECKED")
  1196. F_strLMHOSTS_EDITSTATUS = Ucase("ENABLED")
  1197. Else
  1198. F_strLMHOSTSLOOKUPSTATUS = ""
  1199. F_strLMHOSTS_EDITSTATUS = Ucase("DISABLED")
  1200. End If
  1201. End Function
  1202. '-------------------------------------------------------------------------
  1203. 'Function name: SetDNSResolutionSettings()
  1204. 'Description: Serves in updating DNS Resolution
  1205. 'Input Variables: None
  1206. 'Output Variables: True or false
  1207. 'Returns: True or false
  1208. 'Global Variables: In:G_objService - WMI server object
  1209. ' In:G_objRegistry - Registry object .
  1210. ' In:F_strDNSSUFFIX - DNS Suffixes to use
  1211. ' In:F_strDNSSUFFIXes - String with concatenated DNS Suffixes to use
  1212. ' In:F_nNICIndex- instance of Win32_NetworkAdapterConfiguration for which IP enabled.
  1213. ' In:F_strAPPENDDNSSUFFIX - Append primary DNS suffix and parent suffixes option
  1214. ' In:F_strLMHOSTSLOOKUP - Value of LMHost Lookup check box
  1215. ' Out:F_strLMHOSTS - data into LMHost File
  1216. ' In:L_(*)-Localized strings
  1217. '-------------------------------------------------------------------------
  1218. Function SetDNSResolutionSettings
  1219. Err.Clear
  1220. On Error Resume Next
  1221. Dim objNetWorkAdCon
  1222. Dim arrDNSSuffixes
  1223. Dim nretval
  1224. SetDNSResolutionSettings = false
  1225. 'Getting registry conection
  1226. Call RegistryConnection()
  1227. 'Getting WMI connection
  1228. Set G_objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1229. If Err.number<>0 then
  1230. Call SA_ServeFailurePageEx(L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE, mstrReturnURL)
  1231. Exit Function
  1232. End if
  1233. 'Get the class Win32_NetworkAdapterConfiguration
  1234. Set objNetWorkAdCon = G_objService.Get("Win32_NetworkAdapterConfiguration")
  1235. 'Splitting the concatenated string into an array of DNS
  1236. arrDNSSuffixes = Split(F_strDNSSuffixes, Chr(1),-1,0)
  1237. If UCase(F_strDNSSuffix) = Ucase("SPECIFIC") Then
  1238. 'Setting the DNS array in order
  1239. objNetWorkAdCon.SetDNSSuffixSearchOrder( arrDNSSuffixes )
  1240. Else
  1241. If Trim(UCase(F_strDNSSuffix)) = Ucase("PRIMARY") Then
  1242. objNetWorkAdCon.SetDNSSuffixSearchOrder( Array() )
  1243. 'updating the registry with the value of "PRIMARYANDPARENT" check box
  1244. If Trim(UCase(F_strAppendDNSSuffix)) = "PRIMARYANDPARENT" then
  1245. nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTEREDADAPTERSPATH,"UseDomainNameDevolution",1,CONST_DWORD)
  1246. Else
  1247. nretval=updateRegkeyvalue(G_objRegistry,CONST_DNSREGISTEREDADAPTERSPATH,"UseDomainNameDevolution",0,CONST_DWORD)
  1248. End if
  1249. If Err.number <> 0 or nretval= FALSE Then
  1250. SA_SetErrMsg L_ERROR_IN_UPDATINGDNSSUFFIXES_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1251. Exit Function
  1252. End If
  1253. End If
  1254. End If
  1255. 'Release objects
  1256. Set objNetWorkAdCon = nothing
  1257. SetDNSResolutionSettings = True
  1258. End Function
  1259. '-------------------------------------------------------------------------
  1260. 'Function name: OutputDNSSUffixesToFormOptions()
  1261. 'Description: Serves in displaying the DNS domains in the list box.
  1262. 'Input Variables: None
  1263. 'Output Variables: None
  1264. 'Returns: None
  1265. 'Global Variables: In:G_objService - WMI server object
  1266. ' In:F_strDNSSuffixesChecked - value of specific DNS suffixes Radio button
  1267. ' In:F_nNICIndex - instance of Win32_NetworkAdapterConfiguration for which IP enabled .
  1268. ' In:L_(*)-Localized strings
  1269. '-------------------------------------------------------------------------
  1270. Function OutputDNSSUffixesToFormOptions()
  1271. Err.Clear
  1272. On Error Resume Next
  1273. Dim objAllNICInstances
  1274. Dim strSuffix
  1275. Dim nlowerbound,nupperbound,index
  1276. Dim arrDNSSuffixes
  1277. If not F_strDNSSuffixes = "" Then
  1278. 'Splitting the concatenated string into an array of DNS
  1279. arrDNSSuffixes = Split(F_strDNSSuffixes, Chr(1),-1,0)
  1280. 'Displaying DNS Suffixes from form
  1281. If UCase(G_SpecificChecked)="CHECKED" Then
  1282. For index = 0 to ubound(arrDNSSuffixes)
  1283. 'Writing the DNS Suffixes into the list box.
  1284. Response.Write "<OPTION VALUE='" & Server.HTMLEncode(arrDNSSuffixes(index)) & "' >" & Server.HTMLEncode(arrDNSSuffixes(index)) & "</OPTION>"
  1285. Next
  1286. End if
  1287. Else
  1288. Set G_objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1289. 'Getting the Win32_NetworkAdapterConfiguration for the NIC index for which IP is enabled.
  1290. Set objAllNICInstances = getNetworkAdapterObject(G_objService,F_nNICIndex)
  1291. 'DNS domain suffixes
  1292. If (IsNull(objAllNICInstances.DNSDomainSuffixSearchOrder) ) Then
  1293. Else
  1294. nlowerbound = LBound(objAllNICInstances.DNSDomainSuffixSearchOrder)
  1295. nupperbound = UBound(objAllNICInstances.DNSDomainSuffixSearchOrder)
  1296. End if
  1297. If nupperbound >= 20 then
  1298. nupperbound = MAX_DNS_SUFFIXES
  1299. End If
  1300. 'Displaying DNS Suffixes from system
  1301. If UCase(G_SpecificChecked)="CHECKED" Then
  1302. For index = nlowerbound to nupperbound
  1303. strSuffix = objAllNICInstances.DNSDomainSuffixSearchOrder(index)
  1304. 'Writing the DNS Suffixes into the list box.
  1305. Response.Write "<OPTION VALUE='" & Server.HTMLEncode(SA_EscapeQuotes(strSuffix)) & "' >" & Server.HTMLEncode(strSuffix) & "</OPTION>"
  1306. Next
  1307. End if
  1308. End If
  1309. End Function
  1310. '-------------------------------------------------------------------------
  1311. 'Function: SetTCPHostsData()
  1312. 'Description: serves to set the contents to TCP hosts file
  1313. 'Input Variables: None
  1314. 'Output Variables: None
  1315. 'Returns: None
  1316. 'Global Variables: F_strTCPHostData
  1317. '-------------------------------------------------------------------------
  1318. Function SetTCPHostsData()
  1319. On Error Resume Next
  1320. Err.Clear
  1321. Dim objFileSystem 'Creating file system object
  1322. Dim objFile 'Instance of file system object
  1323. Dim strTCPHostsFile 'TCP/IP Hosts File path
  1324. SetTCPHostsData = false
  1325. 'Get TCP/IP Hosts File path
  1326. strTCPHostsFile = GetSystemPath & "\drivers\etc\hosts"
  1327. 'Creating file system object
  1328. Set objFileSystem= Server.CreateObject("Scripting.FileSystemObject")
  1329. 'Error in creating file system object
  1330. If Err.number <> 0 Then
  1331. SA_SetErrMsg L_ERROR_IN_CREATING_SCRIPTING_FILESYSTEMOBJECT_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  1332. Exit Function
  1333. End If
  1334. 'Open the TCP/IP Hosts file
  1335. Set objFile=objFileSystem.OpenTextFile(strTCPHostsFile,2,True)
  1336. 'Update/Write into the TCP/IP Hosts file
  1337. objFile.write(F_strTCPHostData)
  1338. objFile.close
  1339. 'Release object
  1340. Set objFile = Nothing
  1341. Set objFileSystem=Nothing
  1342. SetTCPHostsData = True
  1343. End Function
  1344. '-------------------------------------------------------------------------
  1345. 'Function: GetSystemPath()
  1346. 'Description: To get the Operating System path
  1347. 'Input Variables: None
  1348. 'Output Variables: None
  1349. 'Returns: Operating system path
  1350. 'Global Variables: None
  1351. '-------------------------------------------------------------------------
  1352. Function GetSystemPath()
  1353. On Error Resume Next
  1354. Err.Clear
  1355. Dim objOS 'Create instance of Win32_OperatingSystem
  1356. Dim objOSInstance
  1357. Dim strSystemPath 'OS path
  1358. Dim objConnection 'Connection to WMI
  1359. Dim strQuery 'Query string
  1360. strQuery = "Select * from Win32_OperatingSystem"
  1361. 'Connection to WMI
  1362. set objConnection = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  1363. 'Error message incase faield to connect to WMI
  1364. If Err.number<>0 then
  1365. Call SA_ServeFailurePageEx(L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE, mstrReturnURL)
  1366. GetSystemPath=""
  1367. Exit Function
  1368. End if
  1369. 'Execute Query
  1370. Set objOS = objConnection.ExecQuery(strQuery)
  1371. 'Get OS installed path
  1372. For Each objOSInstance in objOS
  1373. strSystemPath = objOSInstance.SystemDirectory
  1374. Next
  1375. Set objOS = Nothing
  1376. Set objOSInstance = Nothing
  1377. Set objConnection = Nothing
  1378. GetSystemPath = strSystemPath
  1379. End Function
  1380. '-------------------------------------------------------------------------
  1381. 'Function: RegistryConnection()
  1382. 'Description: Sets G_objRegistry to the RegConnection function
  1383. 'Input Variables: None
  1384. 'Output Variables: None
  1385. 'Returns: None
  1386. 'Global Variables: G_objRegistry
  1387. '-------------------------------------------------------------------------
  1388. Function RegistryConnection()
  1389. On Error Resume Next
  1390. Err.Clear
  1391. 'Getting registry conection
  1392. Set G_objRegistry = RegConnection()
  1393. 'Checking for the object
  1394. If (G_objRegistry is Nothing) Then
  1395. Call SA_PageEx(L_SERVERCONNECTIONFAIL_ERRORMESSAGE, mstrReturnURL)
  1396. Exit Function
  1397. End If
  1398. End Function
  1399. %>