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.

599 lines
19 KiB

  1. VERSION 5.00
  2. Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  4. Begin VB.Form HssX
  5. Caption = "HSC Extensions Manager"
  6. ClientHeight = 8235
  7. ClientLeft = 3135
  8. ClientTop = 2280
  9. ClientWidth = 6240
  10. LinkTopic = "Form1"
  11. ScaleHeight = 8235
  12. ScaleWidth = 6240
  13. Begin MSComctlLib.StatusBar StatusBar1
  14. Align = 2 'Align Bottom
  15. Height = 285
  16. Left = 0
  17. TabIndex = 21
  18. Top = 7950
  19. Width = 6240
  20. _ExtentX = 11007
  21. _ExtentY = 503
  22. _Version = 393216
  23. BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
  24. NumPanels = 1
  25. BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
  26. EndProperty
  27. EndProperty
  28. End
  29. Begin VB.TextBox txtAuxFolder
  30. Height = 300
  31. Left = 30
  32. TabIndex = 18
  33. Top = 1245
  34. Width = 5355
  35. End
  36. Begin VB.TextBox txtCabFile
  37. Height = 300
  38. Left = 30
  39. TabIndex = 17
  40. Top = 720
  41. Width = 5355
  42. End
  43. Begin VB.CommandButton cmdExecuteExts
  44. Caption = "E&xecute Extensions"
  45. Height = 375
  46. Left = 3750
  47. TabIndex = 16
  48. Top = 7560
  49. Width = 1800
  50. End
  51. Begin MSComctlLib.ListView lstvwExtensions
  52. Height = 2070
  53. Left = 30
  54. TabIndex = 15
  55. Top = 3195
  56. Width = 6150
  57. _ExtentX = 10848
  58. _ExtentY = 3651
  59. LabelWrap = -1 'True
  60. HideSelection = -1 'True
  61. OLEDropMode = 1
  62. Checkboxes = -1 'True
  63. _Version = 393217
  64. ForeColor = -2147483640
  65. BackColor = -2147483643
  66. BorderStyle = 1
  67. Appearance = 1
  68. OLEDropMode = 1
  69. NumItems = 1
  70. BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
  71. Object.Width = 2540
  72. EndProperty
  73. End
  74. Begin VB.Frame fraSKU
  75. Caption = "SKU"
  76. Height = 1575
  77. Left = 30
  78. TabIndex = 5
  79. Top = 1560
  80. Width = 6135
  81. Begin VB.CheckBox chkStandard
  82. Caption = "32-bit Standard"
  83. Height = 255
  84. Left = 240
  85. TabIndex = 14
  86. Top = 480
  87. Width = 1695
  88. End
  89. Begin VB.CheckBox chkProfessional
  90. Caption = "32-bit Professional"
  91. Height = 255
  92. Left = 240
  93. TabIndex = 13
  94. Top = 720
  95. Width = 1695
  96. End
  97. Begin VB.CheckBox chkServer
  98. Caption = "32-bit Server"
  99. Height = 255
  100. Left = 3120
  101. TabIndex = 12
  102. Top = 240
  103. Width = 2055
  104. End
  105. Begin VB.CheckBox chkAdvancedServer
  106. Caption = "32-bit Advanced Server"
  107. Height = 255
  108. Left = 3120
  109. TabIndex = 11
  110. Top = 480
  111. Width = 2055
  112. End
  113. Begin VB.CheckBox chkDataCenterServer
  114. Caption = "32-bit Datacenter Server"
  115. Height = 255
  116. Left = 3120
  117. TabIndex = 10
  118. Top = 960
  119. Width = 2055
  120. End
  121. Begin VB.CheckBox chkProfessional64
  122. Caption = "64-bit Professional"
  123. Height = 255
  124. Left = 240
  125. TabIndex = 9
  126. Top = 960
  127. Width = 1695
  128. End
  129. Begin VB.CheckBox chkAdvancedServer64
  130. Caption = "64-bit Advanced Server"
  131. Height = 255
  132. Left = 3120
  133. TabIndex = 8
  134. Top = 720
  135. Width = 2055
  136. End
  137. Begin VB.CheckBox chkDataCenterServer64
  138. Caption = "64-bit Datacenter Server"
  139. Height = 255
  140. Left = 3120
  141. TabIndex = 7
  142. Top = 1200
  143. Width = 2055
  144. End
  145. Begin VB.CheckBox chkWindowsMillennium
  146. Caption = "Windows Me"
  147. Height = 255
  148. Left = 240
  149. TabIndex = 6
  150. Top = 240
  151. Width = 1695
  152. End
  153. End
  154. Begin SHDocVwCtl.WebBrowser wb
  155. Height = 2235
  156. Left = 45
  157. TabIndex = 4
  158. Top = 5280
  159. Width = 6165
  160. ExtentX = 10874
  161. ExtentY = 3942
  162. ViewMode = 0
  163. Offline = 0
  164. Silent = 0
  165. RegisterAsBrowser= 0
  166. RegisterAsDropTarget= 1
  167. AutoArrange = 0 'False
  168. NoClientEdge = 0 'False
  169. AlignLeft = 0 'False
  170. ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  171. Location = "res://C:\WINNT\system32\shdoclc.dll/dnserror.htm#http:///"
  172. End
  173. Begin VB.CommandButton cmdClose
  174. Caption = "&Close"
  175. Height = 375
  176. Left = 5565
  177. TabIndex = 3
  178. Top = 7560
  179. Width = 675
  180. End
  181. Begin VB.CommandButton cmdGo
  182. Caption = "&Go"
  183. Height = 315
  184. Left = 5415
  185. TabIndex = 2
  186. Top = 240
  187. Width = 675
  188. End
  189. Begin VB.TextBox txtExtensionsFolder
  190. Height = 300
  191. Left = 30
  192. TabIndex = 0
  193. Top = 240
  194. Width = 5355
  195. End
  196. Begin VB.Label Label3
  197. Caption = "Auxiliary Folder for Storing Extensions Output:"
  198. Height = 240
  199. Left = 75
  200. TabIndex = 20
  201. Top = 1035
  202. Width = 3555
  203. End
  204. Begin VB.Label Label2
  205. Caption = "Cab File Location:"
  206. Height = 240
  207. Left = 45
  208. TabIndex = 19
  209. Top = 525
  210. Width = 3000
  211. End
  212. Begin VB.Label Label1
  213. Caption = "Extension Tools Directory Location:"
  214. Height = 240
  215. Left = 30
  216. TabIndex = 1
  217. Top = 15
  218. Width = 3000
  219. End
  220. Begin VB.Menu mnuExt
  221. Caption = "Extension Right Click Menu"
  222. Visible = 0 'False
  223. Begin VB.Menu mnuEdit
  224. Caption = "Edit"
  225. End
  226. Begin VB.Menu mnuDelete
  227. Caption = "Delete"
  228. End
  229. End
  230. End
  231. Attribute VB_Name = "HssX"
  232. Attribute VB_GlobalNameSpace = False
  233. Attribute VB_Creatable = False
  234. Attribute VB_PredeclaredId = True
  235. Attribute VB_Exposed = False
  236. ' ==========================================================================================
  237. Option Explicit
  238. Private m_strTempXMLFile As String ' Temporary File for XML Rendering
  239. Private m_oDomList As IXMLDOMNodeList ' List of Extensions
  240. Private WithEvents m_oHssExt As HssExts
  241. Attribute m_oHssExt.VB_VarHelpID = -1
  242. Private m_oFs As Scripting.FileSystemObject
  243. Private m_bIndrag As Boolean ' This variable is used to control
  244. ' dragging inside the Listview
  245. Private m_oCachedExt As IXMLDOMNode ' This is the Cached DOMNODE
  246. ' which is saved on MouseUp
  247. ' event from the ListView.
  248. ' We need to cache it because
  249. ' Menus are event driven.
  250. Private m_dblTimeLeftButtonDown As Double ' Tracks how long the Mouse Down button was pressed.
  251. Private Sub Form_Initialize()
  252. Set m_oHssExt = New HssExts
  253. Set m_oFs = New Scripting.FileSystemObject
  254. End Sub
  255. Private Sub Form_Load()
  256. With Me
  257. .txtExtensionsFolder = App.Path + "\Extensions"
  258. .txtAuxFolder = App.Path + "\AuxFolder"
  259. .txtCabFile = App.Path + "\hcdata.cab"
  260. End With
  261. ' Let's Get a Temporary File Name
  262. m_strTempXMLFile = Environ$("TEMP") + "\" + m_oFs.GetTempName + ".xml"
  263. Dim oFh As Scripting.TextStream
  264. Set oFh = m_oFs.CreateTextFile(m_strTempXMLFile)
  265. oFh.WriteLine "<Note>When you click on an extension in the List Above, the HSS Tool Extension XML Entry will show up here</Note>"
  266. oFh.Close
  267. wb.Navigate m_strTempXMLFile
  268. ' let's kick the first Extensions Search.
  269. ' txtExtensionsFolder_Change
  270. End Sub
  271. Private Sub chkAdvancedServer_Click()
  272. cmdGo_Click
  273. End Sub
  274. Private Sub chkAdvancedServer64_Click()
  275. cmdGo_Click
  276. End Sub
  277. Private Sub chkDataCenterServer_Click()
  278. cmdGo_Click
  279. End Sub
  280. Private Sub chkDataCenterServer64_Click()
  281. cmdGo_Click
  282. End Sub
  283. Private Sub chkProfessional_Click()
  284. cmdGo_Click
  285. End Sub
  286. Private Sub chkProfessional64_Click()
  287. cmdGo_Click
  288. End Sub
  289. Private Sub chkServer_Click()
  290. cmdGo_Click
  291. End Sub
  292. Private Sub chkStandard_Click()
  293. cmdGo_Click
  294. End Sub
  295. Private Sub chkWindowsMillennium_Click()
  296. cmdGo_Click
  297. End Sub
  298. Private Sub cmdExecuteExts_Click()
  299. m_oHssExt.ExecuteExtensions m_oDomList, Me.txtCabFile, Me.txtAuxFolder
  300. End Sub
  301. Private Sub cmdClose_Click()
  302. Unload Me
  303. End Sub
  304. Private Sub cmdGo_Click()
  305. Dim oDomList As IXMLDOMNodeList
  306. Set m_oDomList = m_oHssExt.GetExtensionsList(Me.txtExtensionsFolder, SkuCollection)
  307. With Me.lstvwExtensions
  308. .LabelEdit = lvwManual
  309. .ListItems.Clear
  310. .View = lvwReport
  311. .ColumnHeaders(1).Text = "Select Extensions to Run"
  312. .ColumnHeaders(1).Width = lstvwExtensions.Width - 85
  313. If (m_oDomList Is Nothing) Then GoTo Common_Exit
  314. Dim oDomNode As IXMLDOMNode
  315. Dim l As ListItem
  316. For Each oDomNode In m_oDomList
  317. Set l = .ListItems.Add(Text:=oDomNode.selectSingleNode("display-name").Text)
  318. Set l.Tag = oDomNode
  319. Next
  320. End With
  321. Common_Exit:
  322. End Sub
  323. Private Function SkuCollection() As Scripting.Dictionary
  324. Set SkuCollection = New Scripting.Dictionary
  325. If (Me.chkAdvancedServer) Then
  326. SkuCollection.Add "ADV", "ADV"
  327. End If
  328. If (Me.chkAdvancedServer64) Then
  329. SkuCollection.Add "ADV64", "ADV64"
  330. End If
  331. If (Me.chkDataCenterServer) Then
  332. SkuCollection.Add "DAT", "DAT"
  333. End If
  334. If (Me.chkDataCenterServer64) Then
  335. SkuCollection.Add "DAT64", "DAT64"
  336. End If
  337. If (Me.chkProfessional) Then
  338. SkuCollection.Add "PRO", "PRO"
  339. End If
  340. If (Me.chkProfessional64) Then
  341. SkuCollection.Add "PRO64", "PRO64"
  342. End If
  343. If (Me.chkServer) Then
  344. SkuCollection.Add "SRV", "SRV"
  345. End If
  346. If (Me.chkStandard) Then
  347. SkuCollection.Add "STD", "STD"
  348. End If
  349. If (Me.chkWindowsMillennium) Then
  350. SkuCollection.Add "WINME", "WINME"
  351. End If
  352. End Function
  353. Private Sub lstvwExtensions_Click()
  354. DisplayTaxonomyEntry2 lstvwExtensions, m_oDomList, wb
  355. End Sub
  356. Private Sub lstvwExtensions_ItemCheck(ByVal Item As MSComctlLib.ListItem)
  357. Dim oElem As IXMLDOMElement
  358. ' Set oElem = m_oDomList.Item(lstvwExtensions.HitTest(Item.Left, Item.Top).Index - 1).selectSingleNode("run-this-extension")
  359. Set oElem = Item.Tag
  360. Set oElem = oElem.selectSingleNode("run-this-extension")
  361. oElem.Text = IIf(Item.Checked, "yes", "no")
  362. End Sub
  363. Private Sub lstvwExtensions_DragDrop(source As Control, x As Single, y As Single)
  364. DoDragDrop lstvwExtensions, source, x, y
  365. End Sub
  366. Private Sub lstvwExtensions_DragOver(source As Control, x As Single, y As Single, State As Integer)
  367. DoDragOver lstvwExtensions, source, x, y, State
  368. End Sub
  369. Private Sub lstvwExtensions_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  370. If (Button = vbLeftButton) Then
  371. m_dblTimeLeftButtonDown = HighResTimer
  372. End If
  373. End Sub
  374. Private Sub lstvwExtensions_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  375. ' Debug.Print "Button = " & Button & " - Shift = " & Shift
  376. Select Case Button
  377. Case vbRightButton
  378. If (Not lstvwExtensions.HitTest(x, y) Is Nothing) Then
  379. Set m_oCachedExt = lstvwExtensions.HitTest(x, y).Tag
  380. PopupMenu mnuExt
  381. Set m_oCachedExt = Nothing
  382. End If
  383. Case vbLeftButton
  384. m_dblTimeLeftButtonDown = 0
  385. End Select
  386. End Sub
  387. Private Sub lstvwExtensions_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  388. DoMouseMove lstvwExtensions, Button, Shift, x, y
  389. End Sub
  390. Sub DoMouseMove(lvw As ListView, Button As Integer, Shift As Integer, x As Single, y As Single)
  391. If (Button = vbLeftButton) Then
  392. If (LeftButtonWasPressedLongEnough) Then ' Signal a Drag operation.
  393. ' Set the drag icon with the CreateDragImage method.
  394. If (Not lvw.SelectedItem Is Nothing) Then
  395. m_bIndrag = True ' Set the flag to true.
  396. lvw.DragIcon = lvw.SelectedItem.CreateDragImage
  397. lvw.Drag vbBeginDrag ' Drag operation.
  398. End If
  399. End If
  400. Else
  401. m_bIndrag = False
  402. End If
  403. ' Debug.Print "DoMouseMove Called from " & lvw.Name; "_MouseMove. m_bIndrag = " & m_bIndrag
  404. End Sub
  405. Private Function LeftButtonWasPressedLongEnough() As Boolean
  406. LeftButtonWasPressedLongEnough = False
  407. If (m_dblTimeLeftButtonDown <> 0) Then
  408. LeftButtonWasPressedLongEnough = ((HighResTimer - m_dblTimeLeftButtonDown) > 0.4)
  409. End If
  410. End Function
  411. Sub DoDragOver(lvw As ListView, source As Control, x As Single, y As Single, State As Integer)
  412. If m_bIndrag = True Then
  413. ' Set DropHighlight to the mouse's coordinates.
  414. Set lvw.DropHighlight = lvw.HitTest(x, y)
  415. End If
  416. End Sub
  417. Sub DoDragDrop(lvw As ListView, _
  418. source As Control, x As Single, y As Single _
  419. )
  420. If lvw.DropHighlight Is Nothing Then GoTo Common_Exit
  421. If (lvw Is source) Then
  422. ' We are on the Same Tree, so we need
  423. If lvw.SelectedItem.Index = lvw.DropHighlight.Index Then GoTo Common_Exit
  424. ' Temporary Variables to keep The List view Item contents.
  425. Dim strLi1 As String, strSli1 As String, strSli2 As String
  426. Dim oTag As Object, bChecked As Boolean
  427. ' The direction in which the List Items will be moved
  428. ' on the list to make room for the move
  429. Dim lDirection As Long
  430. If (lvw.DropHighlight.Index < lvw.SelectedItem.Index) Then
  431. lDirection = -1
  432. Else
  433. lDirection = 1
  434. End If
  435. With lvw.SelectedItem
  436. bChecked = .Checked
  437. Set oTag = .Tag
  438. strLi1 = .Text
  439. ' strSli1 = .ListSubItems(1).Text
  440. ' strSli2 = .ListSubItems(2).Text
  441. End With
  442. Dim i As Long
  443. For i = lvw.SelectedItem.Index To lvw.DropHighlight.Index - lDirection Step lDirection
  444. With lvw.ListItems
  445. .Item(i).Checked = .Item(i + lDirection).Checked
  446. Set .Item(i).Tag = .Item(i + lDirection).Tag
  447. .Item(i) = .Item(i + lDirection)
  448. ' .Item(i).ListSubItems(1) = .Item(i + lDirection).ListSubItems(1)
  449. ' .Item(i).ListSubItems(2) = .Item(i + lDirection).ListSubItems(2)
  450. End With
  451. Next i
  452. With lvw.DropHighlight
  453. .Checked = bChecked
  454. Set .Tag = oTag
  455. .Text = strLi1
  456. ' .ListSubItems(1).Text = strSli1
  457. ' .ListSubItems(2).Text = strSli2
  458. End With
  459. Debug.Print lvw.SelectedItem.Text & " dropped on " & lvw.DropHighlight.Text
  460. End If
  461. Common_Exit:
  462. ' This is the exit Condition for Shutting Down the Drag operation
  463. Set lvw.DropHighlight = Nothing: m_bIndrag = False
  464. Exit Sub
  465. End Sub
  466. Private Sub lstvwExtensions_OLEDragDrop( _
  467. Data As MSComctlLib.DataObject, _
  468. Effect As Long, Button As Integer, _
  469. Shift As Integer, _
  470. x As Single, _
  471. y As Single _
  472. )
  473. If Data.GetFormat(vbCFFiles) Then
  474. Dim vFN
  475. For Each vFN In Data.Files
  476. ' Screen.MousePointer = vbHourglass
  477. ' Screen.MousePointer = 99
  478. ' Screen.MouseIcon = LoadPicture(Environ$("WINDIR") + "\cursors\wait_m.cur")
  479. Select Case UCase$(m_oFs.GetExtensionName(vFN))
  480. Case "EXE", "VBS", "JS", "BAT", "PL"
  481. If (Not m_oHssExt.ExtensionExists(m_oFs.GetFileName(vFN))) Then
  482. Dim oFext As frmExt: Set oFext = New frmExt
  483. oFext.DropFile Nothing, vFN, "MSFT"
  484. cmdGo_Click
  485. Else
  486. MsgBox "This Extension was already added to the Extensions System " + vbCrLf + _
  487. "in case you want to update it, please remove first the old " + vbCrLf + _
  488. "extension and then retry the operation", vbInformation, _
  489. Me.Caption
  490. End If
  491. End Select
  492. ' Screen.MousePointer = vbDefault
  493. Next vFN
  494. End If
  495. End Sub
  496. Private Sub m_oHssExt_RunStatus(ByVal strExt As String, bCancel As Boolean)
  497. Me.StatusBar1.SimpleText = strExt
  498. End Sub
  499. Private Sub mnuDelete_Click()
  500. m_oHssExt.DeleteExtension m_oCachedExt
  501. cmdGo_Click
  502. End Sub
  503. Private Sub mnuEdit_Click()
  504. MsgBox "Edit Menu"
  505. End Sub
  506. Private Sub txtExtensionsFolder_Change()
  507. Dim bEnabled As Boolean
  508. bEnabled = m_oFs.FolderExists(Me.txtExtensionsFolder)
  509. With Me
  510. .txtAuxFolder.Enabled = bEnabled
  511. .txtCabFile.Enabled = bEnabled
  512. .lstvwExtensions.Enabled = bEnabled
  513. .fraSKU.Enabled = bEnabled
  514. .cmdExecuteExts.Enabled = bEnabled
  515. .cmdGo.Enabled = bEnabled
  516. End With
  517. cmdGo_Click
  518. End Sub
  519. Sub DisplayTaxonomyEntry2(oList As ListView, oResultsList As IXMLDOMNodeList, wBrowser As WebBrowser)
  520. If (oList.SelectedItem Is Nothing) Then GoTo Common_Exit
  521. Dim oDom As DOMDocument: Set oDom = New DOMDocument
  522. oDom.loadXML oList.SelectedItem.Tag.xml
  523. oDom.save m_strTempXMLFile
  524. wBrowser.Navigate m_strTempXMLFile
  525. Common_Exit:
  526. End Sub