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.

269 lines
9.4 KiB

  1. INTRODUCTION
  2. -------------------
  3. This document details how to add an external module, such as a tutorial, to
  4. OOBE. The information here is based on the mouse tutorial in ME OOBE.
  5. Goals for adding external modules:
  6. * Look and feel remains the same
  7. * OOBE navigation system is used
  8. * External module can be developed and tested with little help from OOBE
  9. development
  10. TEMPLATES
  11. -----------------
  12. To address all three of these issues a set of template HTML and script files
  13. have been developed. These can be found in
  14. %SDXROOT%\ADMIN\NTSETUP\OOBE\HTML\TEMPLATE:
  15. * external.htm is the template for HTML files
  16. * external.js for script modules
  17. * testshel.htm is the OOBE shell to use for testing
  18. %SDXROOT%\ADMIN\NTSETUP\OOBE\HTML
  19. |
  20. |-- mymodule.js
  21. |
  22. |-- TEMPLATES
  23. |
  24. |-- testshel.htm
  25. |-- external.htm
  26. |-- external.js
  27. There can be as many HTML pages as are required. There should be exactly on
  28. script module and one test shell.
  29. When working with these templates, replace _MODULE_ with the name of
  30. your module and _MODULEDIR_ with the name of the directory
  31. containing your modules HTML files.
  32. ADDING FILES TO THE NT SOURCE TREE
  33. ------------------------------------
  34. HTML pages should be added to a subdirectory of
  35. %SDXROOT%\ADMIN\NTSETUP\OOBE\HTML\HTML. Images should be in an IMAGES
  36. subdirectory below this directory. Script modules should be added to
  37. %SDXROOT%\ADMIN\NTSETUP\OOBE\HTML.
  38. %SDXROOT%\ADMIN\NTSETUP\OOBE\HTML
  39. |
  40. |-- mymod.js
  41. |
  42. |-- HTML
  43. |
  44. |-- MYMODULE
  45. |
  46. |-- mymod_a.htm
  47. |-- mymod_b.htm
  48. |-- ...
  49. |-- mymod_n.htm
  50. |
  51. |-- IMAGES
  52. |
  53. |-- mymod.jpg
  54. FILE NAMING
  55. -----------------
  56. The name of your module subdirectory, the first page of your module, and your
  57. script file should be the same as the name of your module. For example, if your
  58. module is named MyMod, then your module subdirectory would be named MyMod, the
  59. first page of the module should be named MyMod.htm and your scripts should be
  60. in MyMod.js. This will allow the shell scripts to find your first page and
  61. scripts files. Other files may be named as you wish. All files should have 8.3
  62. names.
  63. VARIABLE AND FUNCTION NAMING
  64. --------------------------------
  65. Since your module will be dropped into a public name space it is a good idea to
  66. prepend all global variable and function names with the name of your module.
  67. TEST INSTALLATION
  68. -----------------
  69. For testing purposes:
  70. * copy the test shell to %windir%\system32\oobe\msobshel.htm. This replaces
  71. the real OOBE shell with one that references your module.
  72. * copy your script file to %windir%\system32\oobe.
  73. * copy your HTML files to %windir%\system32\oobe\html\MyMod
  74. * copy your image files to %windir%\system32\oobe\html\MyMod\images
  75. %WINDIR%\SYSTEM32\OOBE
  76. |
  77. |-- msobshel.htm (renamed from testshel.htm)
  78. |-- mymod.js
  79. |
  80. |-- HTML
  81. |
  82. |-- MYMOD
  83. |
  84. |-- mymod_a.htm
  85. |-- mymod_b.htm
  86. |-- ...
  87. |-- mymod_n.htm
  88. |
  89. |-- IMAGES
  90. |
  91. |-- mymod.jpg
  92. WHISTLER INSTALLATION
  93. -----------------------
  94. For installation by Whistler setup OOBE development will need the following
  95. information:
  96. * name of the directory your module is enlisted in
  97. * name of all HTML files
  98. * name of all image files
  99. * name of the script file
  100. SCRIPT MODULES
  101. ---------------------
  102. Scripts should be written in JScript.
  103. The script module will be included in the appropriate shell modules
  104. (msobshel.htm, dskshell.htm, ispshell.htm, regshell.htm) via a script tag.
  105. <SCRIPT LANGUAGE=jscript SRC="MyMod.js"></SCRIPT>.
  106. If you named your script file per the naming convention suggestions this will
  107. be done automatically.
  108. Scripting docs can be found at http://msdn.microsoft.com/scripting.
  109. OOBE NAVIGATION
  110. ----------------
  111. Navigation within your module is accomplished by creating a mapping between
  112. each file and the one that is to follow it. These mappings are stored in a
  113. Scripting.Dictionary object. The initialization should occur in the
  114. MyMod_InitSimpleNavMap function.
  115. For each page except the last add a line
  116. like the following:
  117. g_SimpleNavMap.Add("MyMod.htm",
  118. MyModDir+"MyMod_a.htm"
  119. );
  120. The function called in response to the ONLOAD event will call
  121. InitButtons("DoMyModButtons"). This will set the ONCLICK handlers for the
  122. Back and Next buttons to window.parent.SimpleNavBack and
  123. window.parent.SimpleNavNext respectively. SimpleNavNext looks up the current
  124. page in g_SimpleNavMap, retrieves the path to the next page, and navigates to
  125. it. SimpleNavBack simply calls window.parent.history.back.
  126. The last page must call window.parent.GoNext(); This will cause
  127. OOBE to navigate to the page that should follow the external module.
  128. DEBUGGING
  129. --------------
  130. * Install the Script Debugger from Control Panel\Add/Remove Programs\Add/Remove
  131. Windows Components.
  132. * ALWAYS set HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\OOBE
  133. * OemDebug = 1 to turn on error popups and allow switching between OOBE and
  134. other tasks (such as ntsd and regedit)
  135. * MsDebug = 1 to allow tracing to the debugger from script.
  136. * To send trace output to the debugger use the window.parent.trace(str)
  137. function in testshel.htm. See the GoNavigate function in testshel.htm for
  138. examples.
  139. * Occasionally an error popup will be activated but not displayed. This will
  140. appear to you as if OOBE has hung. Try pressing the Enter or Esc keys to
  141. dismiss the popup and continue. If this happens continually, try putting a
  142. try...catch block around the suspect code and write the exception info to the
  143. debugger using trace( ). For example,
  144. try
  145. {
  146. // suspect code
  147. }
  148. catch (err)
  149. {
  150. window.parent.trace("ERROR: " + err.number + ":" + err.description);
  151. }
  152. * While OOBE is running you can press Shift+F10 to bring up a console window.
  153. This is especially helpful when something breaks in system context.
  154. RUNNING OOBE IN SYSTEM CONTEXT
  155. ---------------------------------
  156. OOBE runs in the system context (prior to any user logon). This can present
  157. problems if subsystems that we rely on assume a user is logged in. To run OOBE
  158. in this context do the following:
  159. * Set HKLM\System\Setup\
  160. * CmdLine = %windir%\system32\oobe\msoobe.exe /f
  161. * SetupType = 2 (no reboot)
  162. * MiniSetupInProgress = 1
  163. * Reboot the system
  164. The system will initialize, verify that the disks are okay, then run OOBE.
  165. EXTERNAL DEV TASKS
  166. --------------------------
  167. Developers of external modules will need to perform the following tasks:
  168. * Develop pages and scripts based on template files.
  169. * Test pages and scripts using testshel.htm. Ideally this should be done in
  170. system context (ie. prior to logon). See the RUNNING OOBE IN SYSTEM CONTEXT
  171. section for more details.
  172. * Supply OOBE development with the following information:
  173. * Module name
  174. * Name of first HTML file (for checkpoint)
  175. * Name of script file (so it can be included in shell scripts)
  176. * Where module fits in OOBE flow
  177. EXTERNAL DEV INFO
  178. -----------------------
  179. * window.external methods
  180. These are methods provided by OOBE via the window.external object in the
  181. Browser object.
  182. * InfoObj.get_FirstName
  183. Retrieves the user's first name.
  184. * InfoObj.get_LastName
  185. Retrieves the user's last name.
  186. * ApiObj.get_SystemDirectory
  187. Retrieves the path to the system directory.
  188. * DebugObj.Trace
  189. Output trace statements to the debugger from script.
  190. * DebugObj.get_MsDebugMode
  191. Is MsDebugMode on? If it is not, Trace does not work.
  192. * DebugObj.get_OemDebugMode
  193. Is OemDebugMode on? If it is not, you won't see error popups or be able to
  194. switch from OOBE to other apps.
  195. * Registry entries
  196. * Main OOBE reg key
  197. * HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\OOBE
  198. * CKPT (Key)
  199. This is the checkpoint stack that tracks where the user has been.
  200. Whack this to restart OOBE.
  201. * Temp (Key)
  202. Temporary data store. We keep information here until OOBE has been
  203. successfully completed.
  204. * OemDebug (REG_DWORD)
  205. Set this to 1 turns on error notification and allow focus to shift away
  206. from OOBE.
  207. shift focus away from OOBE.
  208. * MsDebug (REG_DWORD)
  209. Set this to 1 to turn on tracing to the debugger from script
  210. (DebugObj.Trace).
  211. * System setup key
  212. * HKLM\System\Setup
  213. This key controls the way the way that setup apps are run.
  214. * CmdLine (REG_SZ)
  215. Command line to be run by winlogon at startup. For OOBE set this to
  216. %windir%\system32\oobe\msoobe.exe /f
  217. * SetupType (REG_DWORD)
  218. Set this to 0x00000002 to run the CmdLine.
  219. * MiniSetupInProgress (REG_DWORD)
  220. Set this to 0x00000001. OOBE mimics the state of mini-setup.
  221. * Template HTML and script files
  222. OOBE DEV TASKS
  223. -------------------
  224. OOBE development will need to perform the following tasks to hook an external
  225. module into OOBE:
  226. * Add checkpoint for external module
  227. * Add case for external module to GoNext, GoBack, GoCancel, GoNavigate as
  228. appropriate
  229. * Add entry for checkpoint to status menus
  230. * Call MyMod_InitSimpleNavMap( ) in InitCKPT()
  231. * Call g_MyModLastPage = MyModGetLastPage() from InitCKPT()
  232. * Create a temporary msobshel.htm with above items for testing purposes.