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.

195 lines
6.3 KiB

  1. var _bFriendlyUIEnabled = false;
  2. var _bMultipleUsersEnabled = false;
  3. function PageInit()
  4. {
  5. top.window.PopulateLeftPane(idRelatedTaskContent.innerHTML, idLearnAboutContent.innerHTML);
  6. var oWShell = top.window.GetWShell();
  7. var strAbort = null;
  8. //
  9. // NTRAID#NTBUG9-298329-2001/03/30-jeffreys
  10. //
  11. // If the Netware client is installed, disable the friendly UI.
  12. //
  13. try
  14. {
  15. // This throws an error if the key or value doesn't exist
  16. var strNetProviders = oWShell.RegRead("HKLM\\SYSTEM\\CurrentControlSet\\Control\\NetworkProvider\\Order\\ProviderOrder");
  17. if (-1 != strNetProviders.indexOf("NWCWorkstation") || -1 != strNetProviders.indexOf("NetwareWorkstation"))
  18. {
  19. // The Netware client is installed
  20. strAbort = top.window.L_NetWareClient_ErrorMessage;
  21. }
  22. }
  23. catch (error)
  24. {
  25. // No provider info, so assume no Netware; proceed normally
  26. }
  27. if (null == strAbort)
  28. {
  29. //
  30. // NTRAID#NTBUG9-307739-2001/03/14-jeffreys
  31. //
  32. // Some apps install their own Gina, which prevents the friendly
  33. // logon UI and FUS from running.
  34. //
  35. try
  36. {
  37. // This throws an error if the key or value doesn't exist
  38. var szGinaDLL = oWShell.RegRead("HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\\GinaDLL");
  39. //
  40. // If that didn't throw an error, then a GinaDLL value exists.
  41. // Doesn't matter what it is; disable everything and tell the user.
  42. //
  43. // See CSystemSettings::IsMicrosoftGINA in shell\ext\gina\systemsettings.cpp.
  44. //
  45. strAbort = top.window.L_NonStandardGina_ErrorMessage.replace(/%1/g, szGinaDLL);
  46. }
  47. catch (error)
  48. {
  49. // GinaDLL value is not set; proceed normally
  50. }
  51. }
  52. // If necessary, disable the page and quit.
  53. if (null != strAbort)
  54. {
  55. idWelcomeGroup.checked = false;
  56. idWelcomeGroup.disabled = true;
  57. idShutdown.checked = false;
  58. idShutdownGroup.disabled = true;
  59. idOK.disabled = true;
  60. alert(strAbort);
  61. return;
  62. }
  63. var oLocalMachine = top.window.GetLocalMachine();
  64. _bFriendlyUIEnabled = oLocalMachine.isFriendlyUIEnabled;
  65. _bMultipleUsersEnabled = oLocalMachine.isMultipleUsersEnabled;
  66. idWelcome.checked = _bFriendlyUIEnabled;
  67. idShutdown.checked = _bMultipleUsersEnabled;
  68. idWelcome.onclick = OnClickWelcome;
  69. OnClickWelcome();
  70. if (!_bMultipleUsersEnabled && oLocalMachine.isOfflineFilesEnabled && confirm(top.window.L_CSCNoFUS_ErrorMessage))
  71. {
  72. top.window.GetShell().ShellExecute('rundll32.exe','cscui.dll,CSCOptions_RunDLL '+top.window.document.title);
  73. top.window.g_Navigator.back();
  74. }
  75. idWelcome.focus();
  76. }
  77. function OnClickWelcome()
  78. {
  79. // only allow Fast User Switching if Friendly Logon is ON
  80. // and we're not running on ia64 and Offline Files is disabled (if FUS is already off).
  81. if (idWelcome.checked && (_bMultipleUsersEnabled || !top.window.GetLocalMachine().isOfflineFilesEnabled))
  82. {
  83. idShutdown.checked = _bMultipleUsersEnabled;
  84. idShutdownGroup.disabled = false;
  85. }
  86. else
  87. {
  88. idShutdown.checked = false;
  89. idShutdownGroup.disabled = true;
  90. }
  91. }
  92. function ApplyAdvChanges()
  93. {
  94. var nErr = 0;
  95. var szMsg = null;
  96. if (idShutdown.checked != _bMultipleUsersEnabled)
  97. {
  98. try
  99. {
  100. top.window.GetLocalMachine().isMultipleUsersEnabled = idShutdown.checked;
  101. _bMultipleUsersEnabled = idShutdown.checked;
  102. }
  103. catch (error)
  104. {
  105. nErr = (error.number & 0x7fffffff);
  106. szMsg = top.window.L_MultiUser_ErrorMessage;
  107. // The interesting errors occur when disabling FUS
  108. if (!idShutdown.checked)
  109. {
  110. switch (nErr)
  111. {
  112. case 0xA0046: // CTL_E_PERMISSIONDENIED
  113. // We get Access Denied when we try to disable multiple
  114. // user mode with multiple users logged on.
  115. szMsg = top.window.L_MultiUserMulti_ErrorMessage;
  116. break;
  117. case 0x71B7E: // ERROR_CTX_NOT_CONSOLE
  118. // Can't disable FUS remotely.
  119. szMsg = top.window.L_MultiUserRemote_ErrorMessage;
  120. break;
  121. case 0x70032: // ERROR_NOT_SUPPORTED
  122. // Can't disable FUS from the console when remote
  123. // connections are enabled and we're not in session 0.
  124. szMsg = top.window.L_MultiUserSession0_ErrorMessage;
  125. break;
  126. }
  127. }
  128. idShutdown.checked = _bMultipleUsersEnabled;
  129. }
  130. }
  131. if (idWelcome.checked != _bFriendlyUIEnabled)
  132. {
  133. if (0 == nErr)
  134. {
  135. try
  136. {
  137. top.window.GetLocalMachine().isFriendlyUIEnabled = idWelcome.checked;
  138. _bFriendlyUIEnabled = idWelcome.checked;
  139. }
  140. catch (error)
  141. {
  142. nErr = (error.number & 0x7fffffff);
  143. szMsg = top.window.L_FriendlyUI_ErrorMessage;
  144. if (_bMultipleUsersEnabled && !_bFriendlyUIEnabled)
  145. {
  146. // We evidently enabled FUS above but failed to enable
  147. // Friendly UI. FUS can't be on without Friendly UI,
  148. // so turn it off again.
  149. try
  150. {
  151. top.window.GetLocalMachine().isMultipleUsersEnabled = false;
  152. _bMultipleUsersEnabled = false;
  153. }
  154. catch (error)
  155. {
  156. // give up
  157. }
  158. }
  159. }
  160. }
  161. if (0 != nErr)
  162. {
  163. idWelcome.checked = _bFriendlyUIEnabled;
  164. OnClickWelcome();
  165. }
  166. }
  167. if (0 == nErr)
  168. top.window.g_Navigator.navigate("mainpage2.htm", true);
  169. else if (szMsg)
  170. alert(szMsg);
  171. }