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.

456 lines
13 KiB

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