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.

446 lines
8.1 KiB

  1. <!--
  2. Copyright (c) 1998-99 by Microsoft Corporation
  3. ctltest.htm
  4. Owner: YAsmi
  5. -->
  6. <HTML>
  7. <BODY>
  8. <OBJECT CLASSID="clsid:CEBC955E-58AF-11D2-A30A-00A0C903492B" HEIGHT="0" ID="WUV3IS" WIDTH="0"></OBJECT>
  9. <div backgroundcolor=lightblue>
  10. <div backgroundcolor=blue width=10%>
  11. </div>
  12. </div>
  13. <br>
  14. Puid <INPUT NAME=txtPUID TYPE=TEXT>
  15. <button id=cmdSelect>Select</button>
  16. <button id=cmdUnSelect>UnSelect</button>
  17. <button id=cmdRemoveSelect>Select For Removal</button>
  18. <button id=cmdDependancies>Show Dependancies</button> &nbsp &nbsp
  19. <button id=cmdPersonHide>Person Hide</button> &nbsp &nbsp
  20. <button id=cmdPersonUnHide>Person Unide</button> &nbsp &nbsp
  21. <p>
  22. <button id=cmdRefresh>Refresh</button> &nbsp &nbsp
  23. <button id=cmdInstallSelected>Install Selected Items</button> &nbsp &nbsp
  24. <button id=cmdRemoveSelected>Remove Selected tems</button> &nbsp &nbsp
  25. <button id=cmdShowHistory>Show History</button> &nbsp &nbsp
  26. <button id=cmdShowMetrics>Show Metrics</button> &nbsp &nbsp
  27. <button id=cmdShowEULAs>Show EULAs</button> &nbsp &nbsp
  28. <button id=cmdSetStrings>Set Strings</button> &nbsp &nbsp
  29. <p>
  30. <IFRAME WIDTH= 100% HEIGHT=80% id=fraDisplay></IFRAME>
  31. <SCRIPT LANGUAGE="VBScript">
  32. Option Explicit
  33. 'const Server = "http://yasmi2/v3content2"
  34. 'const Server = "http://wusite/v3site/3-5-99"
  35. 'const Server = "http://fear/v3content/test/bld18"
  36. const Server = "http://fear/v3content/beta/bld75/ident"
  37. const Locale = "0x00000409"
  38. Dim CatPuid
  39. Sub Window_OnLoad()
  40. cmdSetStrings_OnClick
  41. Display
  42. End Sub
  43. Sub Display()
  44. dim html
  45. Dim Force98
  46. Force98 = False
  47. html = ""
  48. CatPuid = 0
  49. if Not Force98 then
  50. html = html & GetCatalogHTML("Catalog List", 0, 0)
  51. end if
  52. if CatPuid = 0 then
  53. 'force
  54. html = html & GetCatalogHTML("Forced Catalog 90702", 90702, 2)
  55. else
  56. html = html & GetCatalogHTML("Product Catalog " & CStr(CatPuid), CatPuid, 0)
  57. end if
  58. 'html = html & GetItemHTML("Item 19", 19)
  59. 'html = html & GetItemHTML("Item 79", 79)
  60. fraDisplay.document.body.innerHTML = html
  61. End Sub
  62. Sub cmdRemoveSelect_OnClick()
  63. Dim Flag
  64. if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
  65. MsgBox "Please enter a PUID first"
  66. Exit Sub
  67. end if
  68. Flag = &H44 'REMOVE+SELECT
  69. WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
  70. End Sub
  71. Sub cmdSelect_OnClick()
  72. Dim Flag
  73. if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
  74. MsgBox "Please enter a PUID first"
  75. Exit Sub
  76. end if
  77. Flag = &H04 'SELECT
  78. WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
  79. End Sub
  80. Sub cmdUnSelect_OnClick()
  81. Dim Flag
  82. if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
  83. MsgBox "Please enter a PUID first"
  84. Exit Sub
  85. end if
  86. Flag = &H08 'UNSELECT
  87. WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
  88. End Sub
  89. Sub cmdPersonUnHide_OnClick()
  90. Dim Flag
  91. if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
  92. MsgBox "Please enter a PUID first"
  93. Exit Sub
  94. end if
  95. Flag = &H80 'ITEM_STATE_PERSONALIZE_UNHIDE
  96. WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
  97. End Sub
  98. Sub cmdPersonHide_OnClick()
  99. Dim Flag
  100. if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
  101. MsgBox "Please enter a PUID first"
  102. Exit Sub
  103. end if
  104. Flag = &H10 'ITEM_STATE_PERSONALIZE_HIDE
  105. WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
  106. End Sub
  107. Sub cmdRefresh_OnClick()
  108. Display
  109. End Sub
  110. Sub cmdSetStrings_OnClick()
  111. Dim Strs
  112. exit sub
  113. Strs = Array( _
  114. "Download*progress:", _
  115. "Download*time*remaining:", _
  116. "Install*progress:", _
  117. "Cancel*", _
  118. "%d KB/%d KB*", _
  119. "%d sec*", _
  120. "%d min*", _
  121. "%d hr %d min*", _
  122. "Microsoft*Windows*Update", _
  123. "You*must*restart Windows so that installation can finish.", _
  124. "Do*you want*to restart now?")
  125. WUV3IS.SetStrings Strs, 0
  126. End Sub
  127. Sub cmdInstallSelected_OnClick()
  128. Dim Arr
  129. Dim I
  130. Dim J
  131. Dim S
  132. Arr = WUV3IS.InstallSelectedItems(Server, 0, "")
  133. S = ""
  134. For I = 0 To UBound(Arr)
  135. For J = 0 to UBound(Arr, 2)
  136. S = S & Arr(I, J) & ","
  137. Next
  138. S = S & vbCrlf
  139. Next
  140. MsgBox S
  141. WUV3IS.FinalizeInstall 1
  142. End Sub
  143. Sub cmdRemoveSelected_OnClick()
  144. WUV3IS.RemoveSelectedItems()
  145. End Sub
  146. Sub cmdShowMetrics_OnClick()
  147. Dim Arr
  148. Dim I
  149. Dim J
  150. Dim S
  151. Arr = WUV3IS.GetInstallMetrics()
  152. S = ""
  153. For I = 0 To UBound(Arr)
  154. For J = 0 to UBound(Arr, 2)
  155. S = S & Arr(I, J) & ","
  156. Next
  157. S = S & vbCrlf
  158. Next
  159. MsgBox S
  160. End Sub
  161. Sub cmdShowHistory_OnClick()
  162. Dim Arr
  163. Dim I
  164. Dim J
  165. Dim S
  166. Dim U
  167. Arr = WUV3IS.GetInstallHistory
  168. S = ""
  169. U = UBound(Arr)
  170. For I = 0 To U
  171. if (U - I) <= 5 then
  172. For J = 0 to UBound(Arr, 2)
  173. S = S & Arr(I, J) & ","
  174. Next
  175. S = S & vbCrlf
  176. end if
  177. Next
  178. MsgBox S, 0, "History (Last Few Entries)"
  179. End Sub
  180. Sub cmdShowEULAs_OnClick()
  181. Dim Arr
  182. Dim I
  183. Dim J
  184. Dim S
  185. S = WUV3IS.GetContentURL()
  186. MsgBox "Content URL: " & S
  187. Arr = WUV3IS.GetEula()
  188. S = ""
  189. For I = 0 To UBound(Arr)
  190. For J = 0 to UBound(Arr, 2)
  191. S = S & Arr(I, J) & ","
  192. Next
  193. S = S & vbCrlf
  194. Next
  195. MsgBox S
  196. End Sub
  197. Sub cmdDependancies_OnClick()
  198. Dim Arr
  199. Dim I
  200. Dim S
  201. if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
  202. MsgBox "Please enter a PUID first"
  203. Exit Sub
  204. end if
  205. Arr = WUV3IS.GetDependencyList(CInt(txtPUID.value))
  206. S = ""
  207. For I = 0 To UBound(Arr)
  208. S = S & CStr(Arr(I))
  209. S = S & vbCrlf
  210. Next
  211. MsgBox S
  212. End Sub
  213. function GetCatalogHTML(Title, Puid, Platform)
  214. Dim html
  215. Dim i
  216. Dim j
  217. Dim Arr
  218. Dim sCol
  219. Dim Filter
  220. Filter = &H800 'show personalized hidden items as well
  221. Arr = WUV3IS.GetCatalog(Puid, Server, Platform, Locale, Filter, 0)
  222. html = "<H1>" & Title & "</H1><P> <TABLE BORDER=1>"
  223. For i = 0 To UBound(Arr)
  224. if Puid = 0 then
  225. CatPuid = Arr(0, 0)
  226. end if
  227. html = html & "<TR>"
  228. For j = 0 to ubound(Arr, 2)
  229. if j = 2 then 'description
  230. sCol = Left(Arr(i, j), 60) & " ..."
  231. elseif j = 3 then 'ItemStatus
  232. sCol = ItemStatusString(CLng(Arr(i, j)))
  233. else
  234. sCol = Arr(i, j)
  235. end if
  236. html = html & "<TD>" & sCol & "</TD>"
  237. Next
  238. html = html & "</TR>"
  239. Next
  240. html = html & "</TABLE><P>"
  241. GetCatalogHTML = html
  242. End Function
  243. function GetItemHTML(Title, Puid)
  244. Dim html
  245. Dim j
  246. Dim Arr
  247. Dim sCol
  248. Arr = WUV3IS.GetCatalogItem(Puid)
  249. html = "<H1>" & Title & "</H1><P> <TABLE BORDER=1>"
  250. html = html & "<TR>"
  251. For j = 0 to ubound(Arr)
  252. if j = 2 then 'description
  253. sCol = Left(Arr(j), 60) & " ..."
  254. elseif j = 3 then 'ItemStatus
  255. sCol = ItemStatusString(CLng(Arr(j)))
  256. else
  257. sCol = Arr(j)
  258. end if
  259. html = html & "<TD>" & sCol & "</TD>"
  260. Next
  261. html = html & "</TR>"
  262. html = html & "</TABLE><P>"
  263. GetItemHTML = html
  264. End Function
  265. Function ItemStatusString(lStatus)
  266. Dim S
  267. S = CStr(lStatus)
  268. AddFlag S, lStatus, "HIDDEN" , &H00000001 'Catalog item hidden.
  269. AddFlag S, lStatus, "SELECTED" , &H00000002 'Catalog item selected for installation.
  270. AddFlag S, lStatus, "NEW" , &H00000004 'Catalog item is a new offering.
  271. AddFlag S, lStatus, "POWER" , &H00000008 'Catalog item is best for power users.
  272. AddFlag S, lStatus, "REGISTRATION" , &H00000010 'Catalog item requires that the client be registered.
  273. AddFlag S, lStatus, "COOL" , &H00000020 'Catalog item is considered an interesting item.
  274. AddFlag S, lStatus, "PATCH" , &H00000040 'Catalog item is a patch so requires special handling.
  275. AddFlag S, lStatus, "SECTION" , &H00000080 'Catalog item is a section header.
  276. AddFlag S, lStatus, "SUBSECTION" , &H00000100 'Catalog item is a sub section header.
  277. AddFlag S, lStatus, "SUBSUBSECTION" , &H00000200 'Catalog item is a sub sub section header.
  278. AddFlag S, lStatus, "CRITICALUPDATE", &H00004000 'Catalog item is marked as a critical update item.
  279. AddFlag S, lStatus, "EXCLUSIVE" , &H00008000 'Catalog item is exclusive it cannot be selected with other components.
  280. AddFlag S, lStatus, "INSTALL" , &H00000400
  281. AddFlag S, lStatus, "UPDATE" , &H00000800
  282. AddFlag S, lStatus, "CURRENT" , &H00001000
  283. AddFlag S, lStatus, "UNKNOWN" , &H00002000
  284. AddFlag S, lStatus, "PERSON-HIDE" , &H00010000
  285. ItemStatusString = S
  286. End Function
  287. Sub AddFlag(ioStr, lValue, sFlagText, lFlag)
  288. if (lValue AND lFlag) <> 0 then
  289. if ioStr <> "" then
  290. ioStr = ioStr & "<BR>"
  291. End If
  292. ioStr = ioStr & sFlagText
  293. End If
  294. End Sub
  295. </SCRIPT>
  296. </BODY>
  297. </HTML>