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.

771 lines
25 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' AppleTalkSvc_prop.asp : This page configures the parameters of Apple talk service
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 9-Mar-2001 Creation date
  11. '-------------------------------------------------------------------------
  12. %>
  13. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  14. <!-- #include virtual="/admin/inc_framework.asp" -->
  15. <!-- #include file="loc_appletalksvc_msg.asp" -->
  16. <%
  17. '-------------------------------------------------------------------------
  18. 'Form Variables
  19. '------------------------------------------------------------------------
  20. Dim SOURCE_FILE
  21. SOURCE_FILE = SA_GetScriptFileName()
  22. Dim F_chkSavePassword 'Varible to store the save passwors check box status
  23. Dim F_radSessions 'Varible to store the sessins radio button status
  24. Dim F_radSessionsUnlimited 'to store "checked" ,if unlimited radio button is checked
  25. Dim F_radSessionslimitto 'to store "checked" ,if limitto radio button is checked
  26. Dim F_txaLogonMessage 'variable to hold the logon message(text area content)
  27. Dim F_txtLimitto 'variable to hold the session limit to number
  28. Dim F_cboAuthenticationValues 'variable to hold the Authentication Values
  29. Dim F_nServerOptions 'to hold the server options number obtained from registry
  30. Dim F_nMaxSessions 'to hold the max session value obtained from registry
  31. '-------------------------------------------------------------------------
  32. ' Global Variables
  33. '-------------------------------------------------------------------------
  34. Dim page 'frame work variables
  35. Dim G_objRegistry 'registry connection
  36. 'Constants
  37. Const CONST_MACFILEREGISTRYPATH = "SYSTEM\CurrentControlSet\Services\MacFile\Parameters"
  38. Const CONST_MAXVALUE = 4294967295
  39. 'Constants for the numbers stored in registry
  40. Const CONST_NUM_MICROSOFTONLY = 48
  41. Const CONST_NUM_APPLECLEARTEXT = 18
  42. Const CONST_NUM_APPLEENCRYPTED = 80
  43. Const CONST_NUM_APPLECLEARTEXTORMICROSOFT = 50
  44. Const CONST_NUM_APPLEENCRYPTEDORMICROSOFT = 112
  45. Const CONST_NUM_MICROSOFTONLY_CHECKED = 52
  46. Const CONST_NUM_APPLECLEARTEXT_CHECKED = 22
  47. Const CONST_NUM_APPLEENCRYPTED_CHECKED = 84
  48. Const CONST_NUM_APPLECLEARTEXTORMICROSOFT_CHECKED = 54
  49. Const CONST_NUM_APPLEENCRYPTEDORMICROSOFT_CHECKED = 116
  50. Const CONST_CHECKNUM = 4
  51. Const CONST_MACFILESVC = "MacFile"
  52. Const CONST_WORKSTATIONSVC = "lanmanworkstation"
  53. Const CONST_CHECKED = "CHECKED"
  54. Const CONST_MAXSESSIONS =-1
  55. Const CONST_LIMITVAL =1
  56. Const CONST_UNLIMITED ="unlimited"
  57. Const CONST_LIMITTO ="limitto"
  58. 'const for reg kay names
  59. Const CONST_KEYMAXSESSIONS = "MaxSessions"
  60. Const CONST_KEYLOGINMSG = "LoginMsg"
  61. Const CONST_KEYSERVEROPTIONS = "ServerOptions"
  62. F_nMaxSessions = Cint(0)
  63. '-------------------------------------------------------------------------
  64. ' Localisation Variables
  65. '-------------------------------------------------------------------------
  66. Dim g_iTabAppleTalk
  67. '
  68. ' Create a Property Page
  69. Call SA_CreatePage(L_PAGETITLE_APPLETALK_TEXT, "", PT_TABBED, page )
  70. Call SA_AddTabPage(page, L_GENERALTAB_APPLETALK_TEXT, g_iTabAppleTalk)
  71. '
  72. ' Serve the page
  73. Call SA_ShowPage( page )
  74. '-------------------------------------------------------------------------
  75. 'Function: OnInitPage()
  76. 'Description: Called to signal first time processing for this page.
  77. ' Use this method to do first time initialization tasks
  78. 'Input Variables: PageIn,EventArg
  79. 'Output Variables: None
  80. 'Returns: True/False
  81. 'Global Variables: None
  82. '-------------------------------------------------------------------------
  83. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  84. Call RegistryConnection()
  85. 'getting the logon message form registry
  86. F_txaLogonMessage = GetAppletalkConfigValues(CONST_KEYLOGINMSG,CONST_STRING)
  87. 'getting the server options value from registry
  88. F_nServerOptions = GetAppletalkConfigValues(CONST_KEYSERVEROPTIONS,CONST_DWORD)
  89. 'making the check box checked
  90. Select case F_nServerOptions
  91. case CONST_NUM_APPLECLEARTEXT_CHECKED,CONST_NUM_APPLECLEARTEXTORMICROSOFT_CHECKED,CONST_NUM_MICROSOFTONLY_CHECKED ,CONST_NUM_APPLEENCRYPTED_CHECKED ,CONST_NUM_APPLEENCRYPTEDORMICROSOFT_CHECKED
  92. F_chkSavePassword = CONST_CHECKED
  93. End Select
  94. 'getting the value of authentication type with reference to the server options value
  95. Select case F_nServerOptions
  96. case CONST_NUM_MICROSOFTONLY,CONST_NUM_MICROSOFTONLY_CHECKED
  97. F_cboAuthenticationValues = CONST_NUM_MICROSOFTONLY
  98. case CONST_NUM_APPLECLEARTEXT,CONST_NUM_APPLECLEARTEXT_CHECKED
  99. F_cboAuthenticationValues = CONST_NUM_APPLECLEARTEXT
  100. case CONST_NUM_APPLEENCRYPTED,CONST_NUM_APPLEENCRYPTED_CHECKED
  101. F_cboAuthenticationValues = CONST_NUM_APPLEENCRYPTED
  102. case CONST_NUM_APPLECLEARTEXTORMICROSOFT,CONST_NUM_APPLECLEARTEXTORMICROSOFT_CHECKED
  103. F_cboAuthenticationValues = CONST_NUM_APPLECLEARTEXTORMICROSOFT
  104. case CONST_NUM_APPLEENCRYPTEDORMICROSOFT,CONST_NUM_APPLEENCRYPTEDORMICROSOFT_CHECKED
  105. F_cboAuthenticationValues = CONST_NUM_APPLEENCRYPTEDORMICROSOFT
  106. case else
  107. 'setting the default to "Microsoft only"
  108. F_cboAuthenticationValues = CONST_NUM_MICROSOFTONLY
  109. End Select
  110. 'the max session value obtained from registry
  111. F_nMaxSessions = GetAppletalkConfigValues(CONST_KEYMAXSESSIONS,CONST_DWORD)
  112. If(F_nMaxSessions = "") then
  113. F_nMaxSessions = Cint(0)
  114. End If
  115. 'making the sessions check box checked
  116. If F_nMaxSessions = CONST_MAXSESSIONS then
  117. F_radSessionsUnlimited = CONST_CHECKED
  118. F_txtLimitto = CONST_LIMITVAL
  119. Else
  120. F_radSessionslimitto = CONST_CHECKED
  121. F_txtLimitto =ConvertSINT_UINT ( F_nMaxSessions)
  122. End If
  123. OnInitPage = TRUE
  124. End Function
  125. '---------------------------------------------------------------------
  126. 'Function: OnServeTabbedPropertyPage
  127. 'Description: Called when the page needs to be served.
  128. 'Input Variables: PageIn,EventArg,iTab,bIsVisible
  129. 'Output Variables: PageIn,EventArg
  130. 'Returns: TRUE to indicate not problems occured. FALSE to indicate errors.
  131. ' Returning FALSE will cause the page to be abandoned.
  132. 'Global Variables: g_iTabDNS,g_iTabTCP,g_iTabLMHosts,g_iTabIPX
  133. '---------------------------------------------------------------------
  134. Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  135. ByVal iTab, _
  136. ByVal bIsVisible, ByRef EventArg)
  137. Select Case iTab
  138. Case g_iTabAppleTalk
  139. Call ServeTabGeneral(PageIn, bIsVisible)
  140. End Select
  141. OnServeTabbedPropertyPage = TRUE
  142. End Function
  143. '-------------------------------------------------------------------------
  144. 'Function: OnPostBackPage()
  145. 'Description: Called to signal that the page has been posted-back.
  146. 'Input Variables: PageIn,EventArg
  147. 'Output Variables: PageIn,EventArg
  148. 'Returns: True/False
  149. 'Global Variables: None
  150. '-------------------------------------------------------------------------
  151. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  152. 'get the save passwors check box status
  153. F_chkSavePassword = Request.Form("hdnchkSavePassword")
  154. 'get the sessins radio button status
  155. F_radSessions = Request.Form("hdnradSessions")
  156. 'to make the check box selected on submit
  157. Select case lcase(F_radSessions)
  158. case CONST_UNLIMITED
  159. F_radSessionsUnlimited = CONST_CHECKED
  160. case CONST_LIMITTO
  161. F_radSessionslimitto = CONST_CHECKED
  162. End Select
  163. 'get the text area content - LogonMessage
  164. F_txaLogonMessage = Request.Form("txaLogonMessage")
  165. 'get the session limit to number
  166. F_txtLimitto = Request.Form("txtLimitto")
  167. F_cboAuthenticationValues = Request.Form("hdncboAuthenticationValues")
  168. OnPostBackPage = TRUE
  169. End Function
  170. '-------------------------------------------------------------------------
  171. 'Function: OnSubmitPage()
  172. 'Description: Called when the page has been submitted for processing.
  173. 'Input Variables: PageIn,EventArg
  174. 'Output Variables: PageIn,EventArg
  175. 'Returns: True/False
  176. 'Global Variables: None
  177. '-------------------------------------------------------------------------
  178. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  179. Dim nReturnValue 'return value
  180. Const CONST_MSG_MAXBYTES = 199 ' max bytes allowed for logon message
  181. ' check for the maximum number of bytes allowed in the logon message
  182. If LenB(F_txaLogonMessage) > CONST_MSG_MAXBYTES Then
  183. Call SA_SetErrMsg(L_LONG_LOGONMESSAGE_ERRORMESSAGE)
  184. OnSubmitPage = False
  185. Exit Function
  186. End If
  187. Call RegistryConnection()
  188. 'updating Loginmsg in registry
  189. call UpdateAppletalkConfigValues(CONST_KEYLOGINMSG,F_txaLogonMessage,CONST_STRING)
  190. 'Updating the checkbox for save password and authenication type in registry
  191. F_nServerOptions = F_cboAuthenticationValues
  192. If lcase(F_chkSavePassword) = lcase(CONST_CHECKED) then
  193. F_nServerOptions = F_nServerOptions + CONST_CHECKNUM
  194. End IF
  195. call UpdateAppletalkConfigValues(CONST_KEYSERVEROPTIONS,F_nServerOptions,CONST_DWORD)
  196. 'Updating the Sessions-no of clients connected to the value
  197. If Lcase(F_radSessions) = Lcase(CONST_UNLIMITED) then
  198. call UpdateAppletalkConfigValues(CONST_KEYMAXSESSIONS,CONST_MAXVALUE,CONST_DWORD)
  199. Else
  200. call UpdateAppletalkConfigValues(CONST_KEYMAXSESSIONS,F_txtLimitto,CONST_DWORD)
  201. End IF
  202. Call StopAndStartService()
  203. OnSubmitPage = True
  204. End Function
  205. '---------------------------------------------------------------------
  206. 'Function: OnClosePage
  207. 'Description: Called when the page is about to be closed.
  208. 'Input Variables: PageIn,EventArg
  209. 'Output Variables: PageIn,EventArg
  210. 'Returns: True/False
  211. 'Global Variables: None'
  212. '---------------------------------------------------------------------
  213. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  214. OnClosePage = TRUE
  215. End Function
  216. '-------------------------------------------------------------------------
  217. 'Function: ServeTabGeneral()
  218. 'Description: Serves LMHosts hosts tab
  219. 'Input Variables: PageIn,bIsVisible
  220. 'Output Variables: PageIn
  221. 'Returns: gc_ERR_SUCCESS
  222. 'Global Variables: None
  223. '-------------------------------------------------------------------------
  224. Private Function ServeTabGeneral(ByRef PageIn, ByVal bIsVisible)
  225. Call SA_TraceOut(SOURCE_FILE, "ServeTabGeneral(PageIn, bIsVisible="+ CStr(bIsVisible) + ")")
  226. If ( bIsVisible ) Then
  227. Call ServeCommonJavaScript()
  228. %>
  229. <TABLE WIDTH=100% VALIGN="middle" ALIGN="left" BORDER=0 CELLSPACING=0 CELLPADDING=2 >
  230. <TR>
  231. <TD CLASS="TasksBody" NOWRAP>
  232. <%=L_LOGONMESSAGE_TEXT%>
  233. </TD>
  234. <TD CLASS="TasksBody" COLSPAN=2>
  235. </TD>
  236. </TR>
  237. <TR>
  238. <TD CLASS="TasksBody" COLSPAN=4>
  239. <TEXTAREA CLASS="TextArea" WRAP="on" style="DISPLAY: list-item; OVERFLOW: auto" NAME="txaLogonMessage" ROWS=6 COLS=50 onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE") ><%=F_txaLogonMessage%></TEXTAREA>
  240. </TD>
  241. </TR>
  242. <TR>
  243. <TD CLASS="TasksBody" NOWRAP>
  244. <%=L_SECURITY_TEXT%>
  245. </TD>
  246. </TR>
  247. <TR>
  248. <TD CLASS="TasksBody" colspan=4>&nbsp;&nbsp;
  249. <INPUT TYPE="CHECKBOX" CLASS="FormField" NAME="chkSavePassword" <%=F_chkSavePassword%> > <%=L_SAVEPASSWORD_TEXT%>
  250. </TD>
  251. </TR>
  252. <TR>
  253. <TD CLASS="TasksBody" colspan=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  254. <%=L_ENABLEAUTHENTICATION_TEXT%>&nbsp;&nbsp;&nbsp;&nbsp;
  255. <SELECT NAME="cboAuthenticationValues" STYLE="WIDTH:234px" CLASS="FormField">
  256. <%getAuthenticationvalues%>
  257. </SELECT>
  258. </TD>
  259. </TR>
  260. <TR>
  261. <TD CLASS="TasksBody">&nbsp;</TD>
  262. </TR>
  263. <TR>
  264. <TD CLASS="TasksBody" NOWRAP>
  265. <%=L_SESSIONS_TEXT%>
  266. </TD>
  267. </TR>
  268. <TR>
  269. <TD CLASS="TasksBody"> &nbsp;&nbsp;
  270. <INPUT TYPE=RADIO CLASS="FormField" NAME=radSessions VALUE="unlimited" <%=F_radSessionsUnlimited%> OnClick="DisableLimittoText()"> <%=L_UNLIMITED_TEXT%>
  271. </TD>
  272. </TR>
  273. <TR>
  274. <TD CLASS="TasksBody"> &nbsp;&nbsp;
  275. <INPUT TYPE=RADIO CLASS="FormField" NAME=radSessions VALUE="limitto" <%=F_radSessionslimitto%> OnClick="EnableLimittoText()" > <%=L_LIMITTO_TEXT%>
  276. <INPUT TYPE="Text" CLASS="FormField" NAME="txtLimitto" Maxlength = "10" onblur="limittovalue()" VALUE="<%=F_txtLimitto%>" OnKeyPress="javascript:checkKeyforNumbers(this);" >
  277. </TD>
  278. </TR>
  279. </TABLE>
  280. <INPUT TYPE=HIDDEN NAME="hdnchkSavePassword">
  281. <INPUT TYPE=HIDDEN NAME="hdnradSessions">
  282. <INPUT TYPE=HIDDEN NAME="hdncboAuthenticationValues">
  283. <%
  284. Else%>
  285. <INPUT TYPE=HIDDEN NAME="hdnchkSavePassword" Value="<%=F_chkSavePassword%>">
  286. <INPUT TYPE=HIDDEN NAME="hdnradSessions" Value="<%=F_radSessions%>" >
  287. <INPUT TYPE=HIDDEN NAME="txaLogonMessage" Value="<%=F_txaLogonMessage%>" >
  288. <INPUT TYPE=HIDDEN NAME="txtLimitto" Value="<%=F_txtLimitto%>" >
  289. <INPUT TYPE=HIDDEN NAME="cboAuthenticationValues" Value="<%=F_cboAuthenticationValues%>" >
  290. <INPUT TYPE=HIDDEN NAME="hdncboAuthenticationValues" Value="<%=F_cboAuthenticationValues%>" >
  291. <%
  292. End If
  293. End Function
  294. '-------------------------------------------------------------------------
  295. 'Function: ServeCommonJavaScript
  296. 'Description: validating the form values
  297. 'Input Variables: None
  298. 'Output Variables: None
  299. 'Returns: None
  300. 'Global Variables: None
  301. '-------------------------------------------------------------------------
  302. Function ServeCommonJavaScript()
  303. %>
  304. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  305. </script>
  306. <script language="JavaScript">
  307. //
  308. // Microsoft Server Appliance Web Framework Support Functions
  309. // Copyright (c) Microsoft Corporation. All rights reserved.
  310. //
  311. // Init Function
  312. // -----------
  313. // This function is called by the Web Framework to allow the page
  314. // to perform first time initialization.
  315. //
  316. // This function must be included or a javascript runtime error will occur.
  317. //
  318. function Init()
  319. {
  320. if(document.frmTask.radSessions[1].checked)
  321. {
  322. document.frmTask.txtLimitto.disabled = false;
  323. }
  324. else
  325. {
  326. document.frmTask.txtLimitto.disabled = true;
  327. }
  328. }
  329. // ValidatePage Function
  330. // ------------------
  331. // This function is called by the Web Framework as part of the
  332. // submit processing. Use this function to validate user input. Returning
  333. // false will cause the submit to abort.
  334. //
  335. // This function must be included or a javascript runtime error will occur.
  336. //
  337. // Returns: True if the page is OK, false if error(s) exist.
  338. function ValidatePage()
  339. {
  340. return true;
  341. }
  342. // SetData Function
  343. // --------------
  344. // This function is called by the Web Framework and is called
  345. // only if ValidatePage returned a success (true) code. Typically you would
  346. // modify hidden form fields at this point.
  347. //
  348. // This function must be included or a javascript runtime error will occur.
  349. //
  350. function SetData()
  351. {
  352. var strChecked="CHECKED"
  353. //getting the checkbox state
  354. if(document.frmTask.chkSavePassword.checked)
  355. {
  356. document.frmTask.hdnchkSavePassword.value=strChecked
  357. }
  358. else
  359. {
  360. document.frmTask.hdnchkSavePassword.value=""
  361. }
  362. //getting the selected radio button
  363. if(document.frmTask.radSessions[0].checked)
  364. {
  365. document.frmTask.hdnradSessions.value=document.frmTask.radSessions[0].value
  366. }
  367. if(document.frmTask.radSessions[1].checked)
  368. {
  369. document.frmTask.hdnradSessions.value=document.frmTask.radSessions[1].value
  370. }
  371. limittovalue();
  372. // updating combo box value
  373. document.frmTask.hdncboAuthenticationValues.value = document.frmTask.cboAuthenticationValues.value;
  374. }
  375. //Enabling the linitto text box when limitto radio button is clicked
  376. function EnableLimittoText()
  377. {
  378. if(document.frmTask.radSessions[1].checked)
  379. {
  380. document.frmTask.txtLimitto.disabled = false;
  381. }
  382. }
  383. //Disabling the linitto text box when unlimited radio button is clicked
  384. function DisableLimittoText()
  385. {
  386. if(document.frmTask.radSessions[0].checked)
  387. {
  388. document.frmTask.txtLimitto.disabled = true;
  389. }
  390. }
  391. //making the limitto textbox value 1 ,if it is entered as zero
  392. function limittovalue()
  393. {
  394. var intNulValue=0
  395. var intMinValue=1
  396. var intMaxValue=4294967295
  397. if((document.frmTask.txtLimitto.value)== intNulValue)
  398. {
  399. document.frmTask.txtLimitto.value = intMinValue
  400. }
  401. if((document.frmTask.txtLimitto.value)> intMaxValue)
  402. {
  403. document.frmTask.txtLimitto.value = intMaxValue
  404. }
  405. }
  406. //To disable Enter and escape key actions when
  407. // the focus is in TextArea (Logon Message)
  408. function HandleKey(input)
  409. {
  410. ClearErr();
  411. var strDisable="DISABLE"
  412. if(input == strDisable)
  413. document.onkeypress = "";
  414. else
  415. document.onkeypress = HandleKeyPress;
  416. }
  417. </script>
  418. <%
  419. End Function
  420. '-------------------------------------------------------------------------
  421. 'SUB: getAuthenticationvalues()
  422. 'Description: Lists the available types of authentication the server will accept.
  423. ' and lists in the combo box
  424. 'Input Variables: None
  425. 'Output Variables: None
  426. 'Returns: None
  427. 'Global Variables: None
  428. '-------------------------------------------------------------------------
  429. Sub getAuthenticationvalues
  430. 'making the authenticated value getting selected
  431. If F_cboAuthenticationValues = 48 then
  432. Response.Write "<OPTION selected value = 48>" &L_MICROSOFTONLY_TEXT & "</OPTION>"
  433. Else
  434. Response.Write "<OPTION value = 48>" &L_MICROSOFTONLY_TEXT & "</OPTION>"
  435. End If
  436. If F_cboAuthenticationValues = 18 then
  437. Response.Write "<OPTION selected value = 18>" &L_APPLECLEAR_TEXT & "</OPTION>"
  438. Else
  439. Response.Write "<OPTION value = 18>" &L_APPLECLEAR_TEXT & "</OPTION>"
  440. End If
  441. If F_cboAuthenticationValues = 80 then
  442. Response.Write "<OPTION selected value = 80>" &L_APPLEENCRYPTED_TEXT& "</OPTION>"
  443. Else
  444. Response.Write "<OPTION value = 80>" &L_APPLEENCRYPTED_TEXT & "</OPTION>"
  445. End If
  446. If F_cboAuthenticationValues = 50 then
  447. Response.Write "<OPTION selected value = 50>" &L_APPLECLEAR_MICROSOFT_TEXT & "</OPTION>"
  448. Else
  449. Response.Write "<OPTION value = 50>" &L_APPLECLEAR_MICROSOFT_TEXT & "</OPTION>"
  450. End If
  451. If F_cboAuthenticationValues = 112 then
  452. Response.Write "<OPTION selected value = 112>" &L_APPLEENCRYPTED_MICROSOFT_TEXT & "</OPTION>"
  453. Else
  454. Response.Write "<OPTION value = 112>" &L_APPLEENCRYPTED_MICROSOFT_TEXT & "</OPTION>"
  455. End If
  456. End Sub
  457. '-------------------------------------------------------------------------
  458. 'Function: GetAppletalkConfigValues()
  459. 'Description: Get the Appletalk serviec Configuration Values in Registry
  460. 'Input Variables: keyName --> Reg key name that has to be updated
  461. ' regtype --> Reg Key Data Type
  462. 'Output Variables: None
  463. 'Returns: GetAppletalkConfigValues --> GetAppletalk regkey value of the given key name
  464. 'Global Variables: G_objRegistry,CONST_MACFILEREGISTRYPATH
  465. 'Error handling is done here with On Error Resume Next
  466. '-------------------------------------------------------------------------
  467. Function GetAppletalkConfigValues(keyName,regtype)
  468. Err.Clear
  469. On Error Resume Next
  470. 'Get the Appletalk serviec Configuration Values in Registry
  471. GetAppletalkConfigValues = getRegkeyvalue(G_objRegistry,CONST_MACFILEREGISTRYPATH,keyName,regtype)
  472. If Err.number <> 0 then
  473. SA_ServeFailurePage L_RETRIEVE_REGISTRYVALUES_ERRORMESSAGE
  474. End If
  475. End Function
  476. '-------------------------------------------------------------------------
  477. 'Sub: UpdateAppletalkConfigValues()
  478. 'Description: Update the Appletalk serviec Configuration Values in Registry
  479. 'Input Variables: keyName --> Reg key name that has to be updated
  480. ' regtype --> Reg Key Data Type
  481. ' KeyValue --> Reg key Value that has to be updated
  482. 'Output Variables: None
  483. 'Returns: None
  484. 'Global Variables: G_objRegistry,CONST_MACFILEREGISTRYPATH
  485. 'Error handling is done here with On Error Resume Next
  486. '-------------------------------------------------------------------------
  487. Sub UpdateAppletalkConfigValues(keyName,KeyValue,regtype)
  488. Err.Clear
  489. On Error Resume Next
  490. Dim nReturnValue
  491. 'Update the Appletalk serviec Configuration Values in Registry
  492. nReturnValue = updateRegkeyvalue(G_objRegistry,CONST_MACFILEREGISTRYPATH,keyName,KeyValue,regtype)
  493. If nReturnValue <> True then
  494. SetErrMsg L_UPDATING_REGISTRYVALUES_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  495. End If
  496. End Sub
  497. '-------------------------------------------------------------------------
  498. 'Function: RegistryConnection()
  499. 'Description: Sets G_objRegistry to the RegConnection function
  500. 'Input Variables: None
  501. 'Output Variables: None
  502. 'Returns: None
  503. 'Global Variables: G_objRegistry
  504. '-------------------------------------------------------------------------
  505. Function RegistryConnection()
  506. On Error Resume Next
  507. Err.Clear
  508. 'Getting registry conection
  509. Set G_objRegistry = RegConnection()
  510. 'Checking for the object
  511. If (G_objRegistry is Nothing) Then
  512. SA_ServeFailurePage L_REGCONNECTIONFAIL_ERRORMESSAGE
  513. Exit Function
  514. End If
  515. End Function
  516. '-------------------------------------------------------------------------
  517. 'Function name: ConvertSINT_UINT
  518. 'Synopsis: Converts Signed int to Unsigned int
  519. 'Input Variables: number (Signed)
  520. 'Output Variables: number (Unsigned)
  521. 'Returns: None
  522. 'Global Variables: None
  523. '-------------------------------------------------------------------------
  524. Function ConvertSINT_UINT(intValue)
  525. Const UINT_FORMAT=4294967296
  526. if ( intValue >= 0 ) then
  527. ConvertSINT_UINT = intValue
  528. Exit function
  529. end if
  530. ConvertSINT_UINT = UINT_FORMAT + intValue
  531. End Function
  532. '-------------------------------------------------------------------------
  533. 'SubRoutine: StopAndStartService
  534. 'Synopsis: Stoping and starting the Required services.
  535. 'Input Variables: None
  536. 'Output Variables: None
  537. 'Returns: None
  538. 'Global Variables: In:L_*-Localization strings
  539. '-------------------------------------------------------------------------
  540. Sub StopAndStartService()
  541. Err.Clear
  542. On Error Resume Next
  543. Dim objService 'To get wmi connection
  544. Dim strWMIpath 'To get wmi path
  545. Dim objAppleTalkSvc 'To get wmi class instance
  546. Dim iMaxNum
  547. Dim iMaxTrys
  548. Const STATE_STOPPED = "Stopped"
  549. Const STATE_RUNNING = "Running"
  550. Const CONST_STOPPENDING = "stop pending"
  551. Const CONST_STARTPENDING = "start pending"
  552. iMaxNum = &H100000
  553. iMaxTrys = 25
  554. Dim nValue
  555. 'Getting wmi connection
  556. Set objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  557. If Err.number<>0 then
  558. SA_ServeFailurePage( L_WMI_CONNECTIONFAIL_ERRORMESSAGE)
  559. Exit Sub
  560. End If
  561. 'Macfile service path
  562. strWMIpath = "Win32_Service.Name=" & chr(34) & CONST_MACFILESVC & chr(34)
  563. 'taking the instance of macfile service
  564. Set objAppleTalkSvc=objService.get(strWMIpath)
  565. If Err.number<>0 then
  566. SA_ServeFailurePage(L_WMI_INSTANCEFAIL_ERRORMESSAGE)
  567. Exit Sub
  568. End If
  569. 'stop and start the mac service
  570. If ( objAppleTalkSvc.State = CONST_STOPPENDING OR objAppleTalkSvc.State = CONST_STARTPENDING OR objAppleTalkSvc.State = STATE_STOPPED ) Then
  571. Exit Sub
  572. End If
  573. if( objAppleTalkSvc.State <> STATE_STOPPED) then
  574. objAppleTalkSvc.StopService()
  575. Dim i
  576. Dim NumTrys
  577. NumTrys = 0
  578. Do While ( TRUE)
  579. if objAppleTalkSvc.State = STATE_STOPPED then
  580. Call SA_TraceOut("AppleTalkSvc_prop", "service stopped")
  581. Exit Do
  582. end if
  583. 'sleep for some time
  584. for i=0 to iMaxNum
  585. next
  586. if ( NumTrys > iMaxTrys ) then
  587. Call SA_TraceOut("AppleTalkSvc_prop", "Service is stop pending state")
  588. Exit Sub
  589. end if
  590. NumTrys = NumTrys + 1
  591. Set objAppleTalkSvc = Nothing
  592. Set objAppleTalkSvc=objService.get(strWMIpath)
  593. Loop
  594. end if 'if( objAppleTalkSvc.State <> STATE_STOPPED)
  595. if( objAppleTalkSvc.State <> STATE_STARTED) then
  596. 'try to start the service
  597. objAppleTalkSvc.StartService()
  598. NumTrys = 0
  599. Do While ( TRUE)
  600. if objAppleTalkSvc.State = STATE_RUNNING then
  601. Call SA_TraceOut("AppleTalkSvc_prop", "service started")
  602. Exit Do
  603. end if
  604. 'sleep for some time
  605. for i=0 to iMaxNum
  606. next
  607. if ( NumTrys > iMaxTrys ) then
  608. Call SA_TraceOut("AppleTalkSvc_prop", "Service is in start pending state")
  609. Exit Sub
  610. end if
  611. NumTrys = NumTrys + 1
  612. Set objAppleTalkSvc = Nothing
  613. Set objAppleTalkSvc=objService.get(strWMIpath)
  614. Loop
  615. end if 'if( objAppleTalkSvc.State <> STATE_STARTED)
  616. End Sub
  617. %>