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.

252 lines
9.6 KiB

  1. VERSION 5.00
  2. Begin VB.Form frmAbout
  3. BorderStyle = 3 'Fixed Dialog
  4. Caption = "About Project1"
  5. ClientHeight = 3630
  6. ClientLeft = 45
  7. ClientTop = 330
  8. ClientWidth = 5655
  9. ClipControls = 0 'False
  10. LinkTopic = "Form1"
  11. MaxButton = 0 'False
  12. MinButton = 0 'False
  13. ScaleHeight = 3630
  14. ScaleWidth = 5655
  15. ShowInTaskbar = 0 'False
  16. StartUpPosition = 1 'CenterOwner
  17. Tag = "1059"
  18. Begin VB.PictureBox picIcon
  19. AutoSize = -1 'True
  20. BackColor = &H00C0C0C0&
  21. ClipControls = 0 'False
  22. Height = 540
  23. Left = 240
  24. Picture = "frmAbout.frx":0000
  25. ScaleHeight = 480
  26. ScaleMode = 0 'User
  27. ScaleWidth = 480
  28. TabIndex = 2
  29. TabStop = 0 'False
  30. Top = 240
  31. Width = 540
  32. End
  33. Begin VB.CommandButton cmdOK
  34. Cancel = -1 'True
  35. Caption = "OK"
  36. Default = -1 'True
  37. Height = 345
  38. Left = 4245
  39. TabIndex = 0
  40. Tag = "1061"
  41. Top = 2625
  42. Width = 1260
  43. End
  44. Begin VB.CommandButton cmdSysInfo
  45. Caption = "&System Info..."
  46. Height = 345
  47. Left = 4260
  48. TabIndex = 1
  49. Tag = "1060"
  50. Top = 3075
  51. Width = 1245
  52. End
  53. Begin VB.Label lblDescription
  54. Caption = "App Description"
  55. ForeColor = &H00000000&
  56. Height = 1170
  57. Left = 1050
  58. TabIndex = 6
  59. Tag = "1065"
  60. Top = 1125
  61. Width = 3885
  62. End
  63. Begin VB.Label lblTitle
  64. Caption = "Visual Basic MetaEdit"
  65. ForeColor = &H00000000&
  66. Height = 480
  67. Left = 1050
  68. TabIndex = 5
  69. Tag = "1064"
  70. Top = 240
  71. Width = 3885
  72. End
  73. Begin VB.Line Line1
  74. BorderColor = &H00808080&
  75. BorderStyle = 6 'Inside Solid
  76. Index = 1
  77. X1 = 225
  78. X2 = 5450
  79. Y1 = 2430
  80. Y2 = 2430
  81. End
  82. Begin VB.Line Line1
  83. BorderColor = &H00FFFFFF&
  84. BorderWidth = 2
  85. Index = 0
  86. X1 = 240
  87. X2 = 5450
  88. Y1 = 2445
  89. Y2 = 2445
  90. End
  91. Begin VB.Label lblVersion
  92. Caption = "Version 1.0"
  93. Height = 225
  94. Left = 1050
  95. TabIndex = 4
  96. Tag = "1063"
  97. Top = 780
  98. Width = 3885
  99. End
  100. Begin VB.Label lblDisclaimer
  101. Caption = "Warning: ..."
  102. ForeColor = &H00000000&
  103. Height = 825
  104. Left = 255
  105. TabIndex = 3
  106. Tag = "1062"
  107. Top = 2625
  108. Width = 3870
  109. End
  110. End
  111. Attribute VB_Name = "frmAbout"
  112. Attribute VB_GlobalNameSpace = False
  113. Attribute VB_Creatable = False
  114. Attribute VB_PredeclaredId = True
  115. Attribute VB_Exposed = False
  116. ' Reg Key Security Options...
  117. Const KEY_ALL_ACCESS = &H2003F
  118. ' Reg Key ROOT Types...
  119. Const HKEY_LOCAL_MACHINE = &H80000002
  120. Const ERROR_SUCCESS = 0
  121. Const REG_SZ = 1 ' Unicode nul terminated string
  122. Const REG_DWORD = 4 ' 32-bit number
  123. Const gREGKEYSYSINFOLOC = "SOFTWARE\Microsoft\Shared Tools Location"
  124. Const gREGVALSYSINFOLOC = "MSINFO"
  125. Const gREGKEYSYSINFO = "SOFTWARE\Microsoft\Shared Tools\MSINFO"
  126. Const gREGVALSYSINFO = "PATH"
  127. Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
  128. Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long
  129. Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
  130. Private Sub Form_Load()
  131. LoadResStrings Me
  132. lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
  133. lblTitle.Caption = App.Title
  134. End Sub
  135. Private Sub cmdSysInfo_Click()
  136. Call StartSysInfo
  137. End Sub
  138. Private Sub cmdOK_Click()
  139. Unload Me
  140. End Sub
  141. Public Sub StartSysInfo()
  142. On Error GoTo SysInfoErr
  143. Dim rc As Long
  144. Dim SysInfoPath As String
  145. ' Try To Get System Info Program Path\Name From Registry...
  146. If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then
  147. ' Try To Get System Info Program Path Only From Registry...
  148. ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
  149. ' Validate Existance Of Known 32 Bit File Version
  150. If (Dir(SysInfoPath & "\MSINFO32.EXE") <> "") Then
  151. SysInfoPath = SysInfoPath & "\MSINFO32.EXE"
  152. ' Error - File Can Not Be Found...
  153. Else
  154. GoTo SysInfoErr
  155. End If
  156. ' Error - Registry Entry Can Not Be Found...
  157. Else
  158. GoTo SysInfoErr
  159. End If
  160. Call Shell(SysInfoPath, vbNormalFocus)
  161. Exit Sub
  162. SysInfoErr:
  163. MsgBox "System Information Is Unavailable At This Time", vbOKOnly
  164. End Sub
  165. Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean
  166. Dim i As Long ' Loop Counter
  167. Dim rc As Long ' Return Code
  168. Dim hKey As Long ' Handle To An Open Registry Key
  169. Dim hDepth As Long '
  170. Dim KeyValType As Long ' Data Type Of A Registry Key
  171. Dim tmpVal As String ' Tempory Storage For A Registry Key Value
  172. Dim KeyValSize As Long ' Size Of Registry Key Variable
  173. '------------------------------------------------------------
  174. ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...}
  175. '------------------------------------------------------------
  176. rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key
  177. If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Error...
  178. tmpVal = String$(1024, 0) ' Allocate Variable Space
  179. KeyValSize = 1024 ' Mark Variable Size
  180. '------------------------------------------------------------
  181. ' Retrieve Registry Key Value...
  182. '------------------------------------------------------------
  183. rc = RegQueryValueEx(hKey, SubKeyRef, 0, KeyValType, tmpVal, KeyValSize) ' Get/Create Key Value
  184. If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Errors
  185. If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then ' Win95 Adds Null Terminated String...
  186. tmpVal = Left(tmpVal, KeyValSize - 1) ' Null Found, Extract From String
  187. Else ' WinNT Does NOT Null Terminate String...
  188. tmpVal = Left(tmpVal, KeyValSize) ' Null Not Found, Extract String Only
  189. End If
  190. '------------------------------------------------------------
  191. ' Determine Key Value Type For Conversion...
  192. '------------------------------------------------------------
  193. Select Case KeyValType ' Search Data Types...
  194. Case REG_SZ ' String Registry Key Data Type
  195. KeyVal = tmpVal ' Copy String Value
  196. Case REG_DWORD ' Double Word Registry Key Data Type
  197. For i = Len(tmpVal) To 1 Step -1 ' Convert Each Bit
  198. KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1))) ' Build Value Char. By Char.
  199. Next
  200. KeyVal = Format$("&h" + KeyVal) ' Convert Double Word To String
  201. End Select
  202. GetKeyValue = True ' Return Success
  203. rc = RegCloseKey(hKey) ' Close Registry Key
  204. Exit Function ' Exit
  205. GetKeyError: ' Cleanup After An Error Has Occured...
  206. KeyVal = "" ' Set Return Val To Empty String
  207. GetKeyValue = False ' Return Failure
  208. rc = RegCloseKey(hKey) ' Close Registry Key
  209. End Function