Source code of Windows XP (NT5)
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.

246 lines
7.5 KiB

  1. //
  2. // This file contains script that is common to all the shell files.
  3. //
  4. // Activation errors
  5. var ERR_ACT_UNINITIALIZED = -1;
  6. var ERR_ACT_SUCCESS = 0;
  7. var ERR_ACT_INACCESSIBLE = 1;
  8. var ERR_ACT_INVALID_PID = 2;
  9. var ERR_ACT_USED_PID = 3;
  10. var ERR_ACT_INTERNAL_WINDOWS_ERR = 4;
  11. var ERR_ACT_BLOCKED_PID = 5;
  12. var ERR_ACT_CORRUPTED_PID = 6;
  13. var ERR_ACT_NETWORK_FAILURE = 7;
  14. var ERR_ACT_DEDICATED_PID_ENTRY = 8;
  15. // Global variables
  16. var g_ProductName = "Windows XP";
  17. var g_ActivationRequired = window.external.NeedActivation();
  18. var g_DoActivation = false;
  19. var g_ActivationStatus = ERR_ACT_UNINITIALIZED;
  20. var g_act_specific_error = 0;
  21. var g_OOBEMUIDir = window.external.GetOOBEMUIPath();
  22. // generic missing OEM Name error string. This is being used in msobshel.htm and error.js
  23. var L_MissingOEMName_Text = "Error: Missing OEM Name in oobeinfo.ini [Branding] section.";
  24. // window.external object caches
  25. var DebugObj = null;
  26. // Mandatory Initialization Code
  27. if (null == DebugObj){
  28. DebugObj = new Object;
  29. DebugObj = window.external.Debug;
  30. }
  31. ///////////////////////////////////////////////////////////////////////////////
  32. // trace
  33. //
  34. // Send trace output to setuplog.txt and the debugger. Requires that
  35. // HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\OOBE\MsDebug=DWORD:1.
  36. // Output to the debugger requires a checked version of syssetup.dll.
  37. //
  38. ///////////////////////////////////////////////////////////////////////////////
  39. function trace(sMsg)
  40. {
  41. DebugObj.Trace(sMsg);
  42. }
  43. function Navigate(strURL)
  44. {
  45. // We are showing the next page. Make sure the cursor is normal
  46. try
  47. {
  48. g.document.body.style.cursor = "default";
  49. }
  50. catch(e){}
  51. strURL = g_OOBEMUIDir + "\\" + strURL;
  52. trace("Navigate: " + strURL);
  53. g.navigate(strURL);
  54. } // Navigate
  55. var g_CheckFinishAgain = true;
  56. function CheckFinishStatus()
  57. {
  58. if (g_CheckFinishAgain)
  59. {
  60. if (g_DoActivation)
  61. g_IsActivationSuccessful = true;
  62. else
  63. g_IsActivationSuccessful = false;
  64. if (g_PostToMS)
  65. g_IsMSRegistrationSuccessful = true;
  66. else
  67. g_IsMSRegistrationSuccessful = false;
  68. if (g_PostToOEM)
  69. g_IsOEMRegistrationSuccessful = true;
  70. else
  71. g_IsOEMRegistrationSuccessful = false;
  72. }
  73. }
  74. <!--REQUIRED FUNCTION NAME-->
  75. function ActivationComplete(status, status_errcode)
  76. {
  77. g_CheckFinishAgain = true;
  78. if ( status != null) {
  79. g_ActivationStatus = status;
  80. if ( g_ActivationStatus != ERR_ACT_SUCCESS ) {
  81. trace("Activation failed. Error = " + g_ActivationStatus);
  82. // These vars are for use in our finish page.
  83. g_IsActivationSuccessful = false;
  84. g_IsMSRegistrationSuccessful = false;
  85. g_IsOEMRegistrationSuccessful = false;
  86. g_act_specific_error = status_errcode;
  87. GoNavigate(CKPT_ACT_MSG);
  88. return;
  89. }
  90. else
  91. {
  92. CheckFinishStatus();
  93. // we don't want CheckFinishStatus() to run again since g_DoActivation is set to false a few lines after this line, which causes some problems for the finish page.
  94. g_CheckFinishAgain = false;
  95. }
  96. g_ActivationRequired = false;
  97. g_DoActivation = false;
  98. StatusObj.set_Status(MS_REGISTRATION, true);
  99. }
  100. if (g_PostToOEM)
  101. {
  102. if (0 == RegisterObj.get_OEMAddRegPage)
  103. {
  104. window.external.PostRegData(POST_TO_OEM);
  105. StatusObj.set_Status(OEM_REGISTRATION, true);
  106. g_IgnoreDialErr = true;
  107. PopCKPT(CKPT_REGDIAL);
  108. PopCKPT(CKPT_REGISTER3);
  109. PopCKPT(); // either CKPT_REGISTER1 or CKPT_ACTIVATION
  110. CheckFinishStatus();
  111. if (InReminderMode())
  112. GoNavigate(CKPT_ACT_MSG); // if we reach here, we were successful in our activation. Desktop.
  113. else
  114. GoNavigate(CKPT_ICONN); // if we reach here, we were successful in our activation. Full screen. But we don't show the congrats page anymore.
  115. }
  116. else
  117. {
  118. //
  119. // OEM should set the OEM_REGISTRATION once user has completed registration
  120. // on the oemadd.htm by calling StatusObj.set_Status(OEM_REGISTRATION, true)
  121. //
  122. g_IgnoreDialErr = true;
  123. if ( APP_REG_MODE == window.external.Directions.get_AppMode() )
  124. {
  125. Navigate("html\\oemreg\\roemadd.htm");
  126. }
  127. else
  128. {
  129. Navigate("html\\oemreg\\oemadd.htm");
  130. }
  131. }
  132. }
  133. else
  134. {
  135. g_IgnoreDialErr = true;
  136. PopCKPT(CKPT_REGDIAL);
  137. PopCKPT(CKPT_REGISTER3);
  138. PopCKPT(); // either CKPT_REGISTER1 or CKPT_ACTIVATION
  139. CheckFinishStatus();
  140. if (InReminderMode())
  141. GoNavigate(CKPT_ACT_MSG); // if we reach here, we were successful in our activation. Desktop.
  142. else
  143. GoNavigate(CKPT_ICONN); // if we reach here, we were successful in our activation. Full screen. But we don't show the congrats page anymore.
  144. }
  145. if ((g_PostToMS && g_PostToOEM && (1 == RegisterObj.get_PostToOEM)) ||
  146. ((0 == RegisterObj.get_PostToOEM) && g_PostToMS))
  147. {
  148. if ( APP_REG_MODE == window.external.Directions.get_AppMode() )
  149. {
  150. // If user register both MS and OEM or
  151. // if user register MS while OEM disable posting,
  152. // then we won't remind user
  153. window.external.StopRemind(REMIND_REG);
  154. }
  155. else
  156. {
  157. // If user register both MS and OEM or
  158. // if user register MS while OEM disable posting,
  159. // reminder has already created, need to delete it
  160. window.external.DeleteRemind(REMIND_REG);
  161. }
  162. }
  163. }
  164. // LANGUAGE SETTINGS
  165. // sort order
  166. var SORT_DEFAULT = 0x0; // sorting default
  167. // primary languages
  168. var LANG_JAPANESE = 0x11;
  169. var LANG_KOREAN = 0x12;
  170. var LANG_CHINESE = 0x04;
  171. // sub languages
  172. var SUBLANG_KOREAN = 0x01; // Korean (Extended Wansung)
  173. var SUBLANG_CHINESE_TRADITIONAL = 0x01; // Taiwan
  174. var SUBLANG_CHINESE_SIMPLIFIED = 0x02; // Chinese (PR China)
  175. var SUBLANG_DEFAULT = 0x01; // user default
  176. ///////////////////////////////////////////////////////////////////////////////
  177. // MAKELANGID
  178. //
  179. // Creates a complete language identifier from a primary and a secondary
  180. // language identifier.
  181. //
  182. ///////////////////////////////////////////////////////////////////////////////
  183. function MAKELANGID(p, s)
  184. {
  185. return (( s << 10) | p);
  186. }
  187. function MAKELCID(lgid, srtid)
  188. {
  189. return ((srtid << 16) | lgid);
  190. }
  191. function IsKoreanLocale() {
  192. var language = ApiObj.get_UserDefaultUILanguage();
  193. if (language == MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN), SORT_DEFAULT)) {
  194. return true;
  195. }
  196. return false;
  197. }
  198. function IsFarEastLocale()
  199. {
  200. // if local is Korean, Simplified Chinese,
  201. // Traditional Chinese,or Japanese then we return true
  202. var language = ApiObj.get_UserDefaultUILanguage();
  203. if (language == MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN), SORT_DEFAULT) ||
  204. language == MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), SORT_DEFAULT) ||
  205. language == MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT) ||
  206. language == MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT))
  207. return true
  208. else
  209. return false;
  210. }