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.

371 lines
9.9 KiB

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