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.

415 lines
11 KiB

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmMain
  4. Caption = "MiscFixes"
  5. ClientHeight = 6825
  6. ClientLeft = 270
  7. ClientTop = 450
  8. ClientWidth = 9390
  9. LinkTopic = "Form1"
  10. ScaleHeight = 6825
  11. ScaleWidth = 9390
  12. StartUpPosition = 3 'Windows Default
  13. Begin VB.CheckBox chkPopulate
  14. Caption = "&Populate Help Image"
  15. Height = 255
  16. Left = 120
  17. TabIndex = 12
  18. Top = 1560
  19. Width = 1935
  20. End
  21. Begin VB.TextBox txtOutput
  22. Height = 4335
  23. Left = 120
  24. MultiLine = -1 'True
  25. ScrollBars = 3 'Both
  26. TabIndex = 15
  27. Top = 2400
  28. Width = 9135
  29. End
  30. Begin VB.CommandButton cmdClose
  31. Caption = "Close"
  32. Height = 375
  33. Left = 8400
  34. TabIndex = 14
  35. Top = 1920
  36. Width = 855
  37. End
  38. Begin VB.CommandButton cmdBrowse
  39. Caption = "..."
  40. Height = 255
  41. Index = 3
  42. Left = 8880
  43. TabIndex = 11
  44. Top = 1200
  45. Width = 375
  46. End
  47. Begin VB.CommandButton cmdBrowse
  48. Caption = "..."
  49. Height = 255
  50. Index = 2
  51. Left = 8880
  52. TabIndex = 8
  53. Top = 840
  54. Width = 375
  55. End
  56. Begin VB.CommandButton cmdBrowse
  57. Caption = "..."
  58. Height = 255
  59. Index = 1
  60. Left = 8880
  61. TabIndex = 5
  62. Top = 480
  63. Width = 375
  64. End
  65. Begin VB.CommandButton cmdBrowse
  66. Caption = "..."
  67. Height = 255
  68. Index = 0
  69. Left = 8880
  70. TabIndex = 2
  71. Top = 120
  72. Width = 375
  73. End
  74. Begin MSComDlg.CommonDialog dlgCommon
  75. Left = 2040
  76. Top = 1560
  77. _ExtentX = 847
  78. _ExtentY = 847
  79. _Version = 393216
  80. End
  81. Begin VB.TextBox txtIn
  82. Height = 285
  83. Index = 3
  84. Left = 1200
  85. TabIndex = 10
  86. Top = 1200
  87. Width = 7575
  88. End
  89. Begin VB.TextBox txtIn
  90. Height = 285
  91. Index = 1
  92. Left = 1200
  93. TabIndex = 4
  94. Top = 480
  95. Width = 7575
  96. End
  97. Begin VB.CommandButton cmdGo
  98. Caption = "Go"
  99. Height = 375
  100. Left = 7440
  101. TabIndex = 13
  102. Top = 1920
  103. Width = 855
  104. End
  105. Begin VB.TextBox txtIn
  106. Height = 285
  107. Index = 2
  108. Left = 1200
  109. TabIndex = 7
  110. Top = 840
  111. Width = 7575
  112. End
  113. Begin VB.TextBox txtIn
  114. Height = 285
  115. Index = 0
  116. Left = 1200
  117. TabIndex = 1
  118. Top = 120
  119. Width = 7575
  120. End
  121. Begin VB.Label lbl
  122. Caption = "HH&T To Add"
  123. Height = 255
  124. Index = 3
  125. Left = 120
  126. TabIndex = 9
  127. Top = 1200
  128. Width = 1095
  129. End
  130. Begin VB.Label lbl
  131. Caption = "&Output CAB"
  132. Height = 255
  133. Index = 1
  134. Left = 120
  135. TabIndex = 3
  136. Top = 480
  137. Width = 855
  138. End
  139. Begin VB.Label lbl
  140. Caption = "&SubSite XML"
  141. Height = 255
  142. Index = 2
  143. Left = 120
  144. TabIndex = 6
  145. Top = 840
  146. Width = 1095
  147. End
  148. Begin VB.Label lbl
  149. Caption = "&Input CAB"
  150. Height = 255
  151. Index = 0
  152. Left = 120
  153. TabIndex = 0
  154. Top = 120
  155. Width = 855
  156. End
  157. End
  158. Attribute VB_Name = "frmMain"
  159. Attribute VB_GlobalNameSpace = False
  160. Attribute VB_Creatable = False
  161. Attribute VB_PredeclaredId = True
  162. Attribute VB_Exposed = False
  163. Option Explicit
  164. ' Make sure that these letters correspond to the Alt key combinations.
  165. Private Const OPT_CAB_IN_C As String = "i"
  166. Private Const OPT_CAB_OUT_C As String = "o"
  167. Private Const OPT_SS_XML_C As String = "s"
  168. Private Const OPT_HHT_C As String = "t"
  169. Private Const OPT_POPULATE_C As String = "p"
  170. Private Const OPT_CLOSE_ON_WARNING_C As String = "qw"
  171. Private Const OPT_CLOSE_ALWAYS_C As String = "qa"
  172. Private Const OPT_HELP_C As String = "h,?,help"
  173. Private Enum INPUT_INDEX_E
  174. II_CAB_IN_E = 0
  175. II_CAB_OUT_E = 1
  176. II_SS_XML_E = 2
  177. II_HHT_E = 3
  178. End Enum
  179. Private Const MAX_INPUT_INDEX_C As Long = 3
  180. Private p_strSeparator As String
  181. Private p_blnWarning As Boolean
  182. Private p_blnError As Boolean
  183. Private p_clsSizer As Sizer
  184. Private Sub p_DisplayHelp()
  185. Dim str As String
  186. str = "Usage: " & vbCrLf & vbCrLf & _
  187. App.EXEName & " /i <Input CAB> /o <Output CAB> /s <SubSite XML> /t <HHT To Add> /p /qw /qa" & vbCrLf & vbCrLf & _
  188. "The /s, /t, /p, /qw, and /qa arguments are optional." & vbCrLf & _
  189. "/qw makes the window go away even if there are Warnings." & vbCrLf & _
  190. "/qa makes the window go away even if there are Errors and/or Warnings." & vbCrLf & _
  191. """" & App.EXEName & " /?"" displays this message."
  192. Output str, LOGGING_TYPE_NORMAL_E
  193. Output p_strSeparator, LOGGING_TYPE_NORMAL_E
  194. End Sub
  195. Private Sub Form_Load()
  196. cmdGo.Default = True
  197. cmdClose.Cancel = True
  198. Set p_clsSizer = New Sizer
  199. SetLogFile
  200. Output "Version " & App.Major & "." & App.Minor & "." & App.Revision, LOGGING_TYPE_NORMAL_E
  201. p_strSeparator = String(80, "-")
  202. Output p_strSeparator, LOGGING_TYPE_NORMAL_E
  203. p_ProcessCommandLine
  204. End Sub
  205. Private Sub p_ProcessCommandLine()
  206. Dim strCommand As String
  207. Dim blnCloseOnWarning As Boolean
  208. Dim blnCloseAlways As Boolean
  209. Dim blnClose As Boolean
  210. strCommand = Trim$(Command$)
  211. If (strCommand = "") Then
  212. Exit Sub
  213. End If
  214. txtIn(II_CAB_IN_E) = GetOption(strCommand, OPT_CAB_IN_C, True)
  215. txtIn(II_CAB_OUT_E) = GetOption(strCommand, OPT_CAB_OUT_C, True)
  216. txtIn(II_SS_XML_E) = GetOption(strCommand, OPT_SS_XML_C, True)
  217. txtIn(II_HHT_E) = GetOption(strCommand, OPT_HHT_C, True)
  218. If (OptionExists(strCommand, OPT_POPULATE_C, True)) Then
  219. chkPopulate.Value = vbChecked
  220. End If
  221. blnCloseOnWarning = OptionExists(strCommand, OPT_CLOSE_ON_WARNING_C, True)
  222. blnCloseAlways = OptionExists(strCommand, OPT_CLOSE_ALWAYS_C, True)
  223. If (OptionExists(strCommand, OPT_HELP_C, True)) Then
  224. p_DisplayHelp
  225. ElseIf (Len(strCommand) <> 0) Then
  226. cmdGo_Click
  227. If (p_blnError) Then
  228. ' If an error occurred, then close the window only if OPT_CLOSE_ALWAYS_C is specified.
  229. If (blnCloseAlways) Then
  230. blnClose = True
  231. End If
  232. ElseIf (p_blnWarning) Then
  233. ' If a warning occurred, but there was no error, then close the window only if
  234. ' OPT_CLOSE_ON_WARNING_C or OPT_CLOSE_ALWAYS_C is specified.
  235. If (blnCloseOnWarning Or blnCloseAlways) Then
  236. blnClose = True
  237. End If
  238. Else
  239. ' If there was no warning or error, then close the window.
  240. blnClose = True
  241. End If
  242. If (blnClose) Then
  243. cmdClose_Click
  244. End If
  245. End If
  246. End Sub
  247. Private Sub cmdGo_Click()
  248. On Error GoTo LError
  249. Dim strCABIn As String
  250. Dim strCABOut As String
  251. Dim strSubSiteXML As String
  252. Dim strHHT As String
  253. Dim blnPopulateHelpImage As Boolean
  254. Output "Start: " & Date & " " & Time, LOGGING_TYPE_NORMAL_E
  255. strCABIn = Trim$(txtIn(II_CAB_IN_E).Text)
  256. strCABOut = Trim$(txtIn(II_CAB_OUT_E).Text)
  257. strSubSiteXML = Trim$(txtIn(II_SS_XML_E).Text)
  258. strHHT = Trim$(txtIn(II_HHT_E).Text)
  259. If (chkPopulate.Value = vbChecked) Then
  260. blnPopulateHelpImage = True
  261. End If
  262. If ((strCABIn = "") Or (strCABOut = "")) Then
  263. Output "Please specify the Input and Output CABs", LOGGING_TYPE_ERROR_E
  264. GoTo LError
  265. End If
  266. Me.Enabled = False
  267. MainFunction strCABIn, strCABOut, strSubSiteXML, strHHT, blnPopulateHelpImage
  268. LEnd:
  269. Output "End: " & Date & " " & Time, LOGGING_TYPE_NORMAL_E
  270. Output "The log file is: " & GetLogFileName, LOGGING_TYPE_NORMAL_E
  271. Output p_strSeparator, LOGGING_TYPE_NORMAL_E
  272. Me.Enabled = True
  273. Exit Sub
  274. LError:
  275. GoTo LEnd
  276. End Sub
  277. Private Sub cmdClose_Click()
  278. Unload Me
  279. End Sub
  280. Private Sub cmdBrowse_Click(Index As Integer)
  281. On Error GoTo LError
  282. dlgCommon.CancelError = True
  283. dlgCommon.Flags = cdlOFNHideReadOnly
  284. dlgCommon.Filter = "All Files (*.*)|*.*"
  285. dlgCommon.ShowOpen
  286. txtIn(Index).Text = dlgCommon.FileName
  287. LEnd:
  288. Exit Sub
  289. LError:
  290. Select Case Err.Number
  291. Case cdlCancel
  292. ' Nothing. The user cancelled.
  293. End Select
  294. GoTo LEnd
  295. End Sub
  296. Private Sub Form_Activate()
  297. On Error GoTo LError
  298. p_SetSizingInfo
  299. DoEvents
  300. LError:
  301. End Sub
  302. Private Sub Form_Resize()
  303. On Error GoTo LError
  304. p_clsSizer.Resize
  305. LError:
  306. End Sub
  307. Private Sub p_SetSizingInfo()
  308. Dim intIndex As Long
  309. For intIndex = 0 To MAX_INPUT_INDEX_C
  310. p_clsSizer.AddControl txtIn(intIndex)
  311. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = Me
  312. p_clsSizer.ReferenceDimension(DIM_RIGHT_E) = DIM_WIDTH_E
  313. p_clsSizer.AddControl cmdBrowse(intIndex)
  314. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
  315. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  316. Next
  317. p_clsSizer.AddControl cmdGo
  318. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
  319. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  320. p_clsSizer.AddControl cmdClose
  321. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
  322. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  323. p_clsSizer.AddControl txtOutput
  324. Set p_clsSizer.ReferenceControl(DIM_RIGHT_E) = Me
  325. p_clsSizer.ReferenceDimension(DIM_RIGHT_E) = DIM_WIDTH_E
  326. Set p_clsSizer.ReferenceControl(DIM_BOTTOM_E) = Me
  327. p_clsSizer.ReferenceDimension(DIM_BOTTOM_E) = DIM_HEIGHT_E
  328. End Sub
  329. Public Sub Output( _
  330. ByVal i_str As String, _
  331. ByVal i_enumLoggingType As LOGGING_TYPE_E _
  332. )
  333. OutputToTextBoxAndWriteLog txtOutput, i_str, i_enumLoggingType
  334. If (i_enumLoggingType = LOGGING_TYPE_ERROR_E) Then
  335. p_blnError = True
  336. ElseIf (i_enumLoggingType = LOGGING_TYPE_WARNING_E) Then
  337. p_blnWarning = True
  338. End If
  339. End Sub