[VB] Advanced Systems Analysis {30% COMPLETE}


SUBMITTED BY: Guest

DATE: April 5, 2013, 1:06 a.m.

FORMAT: Text only

SIZE: 10.6 kB

HITS: 1014

  1. 'C# version coming with v1.0; Full Release will be on HackForums.net, alpha releases here, beta & alpha versions here.
  2. 'UNDER CONSTRUCTION. 30% COMPLETE. ALPHA RELEASE.
  3. 'Lucid Development
  4. 'Advanced Systems Analysis ---- UNDER CONSTRUCTION. 30% COMPLETE. ALPHA RELEASE.
  5. 'Featuers:
  6. ' OperatingSystem Information: (4% done)
  7. ' OS Version
  8. ' Name, Major, Minor, Build, Revision
  9. ' CPU Information: (63% done)
  10. ' AddressWidth
  11. ' Architecture
  12. ' Availability
  13. ' Caption
  14. ' COnfigManagerErrorCode
  15. ' ConfigManagerUserConfig
  16. ' CpuStatus
  17. ' CreationClassName
  18. ' CurrentClockSpeed
  19. ' CurrentVoltage
  20. ' DataWidth
  21. ' Description
  22. ' DeviceID
  23. ' ErrorCleared
  24. ' ErrorDescription
  25. ' ExtClock
  26. ' Family
  27. ' InstallDate
  28. ' L2CacheSize
  29. ' L2CacheSpeed
  30. ' L3CacheSize
  31. ' L3CacheSpeed
  32. ' LastErrorCode
  33. ' Level
  34. ' LoadPercentage
  35. ' Manufacturer
  36. ' MaxClockSpeed
  37. ' Name
  38. ' NumberOfCores
  39. ' NumberOfLogicalProcessors
  40. ' OtherFamilyDescription
  41. ' PNPDeviceID
  42. ' User Information (1% done)
  43. ' User Name
  44. ' Screen Resolution
  45. ' Computer Info (.5% done)
  46. ' WinDir()
  47. Imports System.Management
  48. Namespace LucidDevelopment ' ASA v0.3-b12-ALPHA
  49. Class OSVersionInfo
  50. 'These are basics, since these are easy to grab I'm not including very many in this version. v2 of this class will be more extensive
  51. Public Function GetOSVersion() As String
  52. Select Case Environment.OSVersion.Platform
  53. Case PlatformID.Win32S
  54. Return "Win 3.1"
  55. Case PlatformID.Win32Windows
  56. Select Case Environment.OSVersion.Version.Minor
  57. Case 0
  58. Return "Win95"
  59. Case 10
  60. Return "Win98"
  61. Case 90
  62. Return "WinME"
  63. Case Else
  64. Return "Unknown"
  65. End Select
  66. Case PlatformID.Win32NT
  67. Select Case Environment.OSVersion.Version.Major
  68. Case 3
  69. Return "NT 3.51"
  70. Case 4
  71. Return "NT 4.0"
  72. Case 5
  73. Select Case _
  74. Environment.OSVersion.Version.Minor
  75. Case 0
  76. Return "Win2000"
  77. Case 1
  78. Return "WinXP"
  79. Case 2
  80. Return "Win2003"
  81. End Select
  82. Case 6
  83. Return "Vista/Windows 7"
  84. Case Else
  85. Return "Unknown"
  86. End Select
  87. Case PlatformID.WinCE
  88. Return "Win CE"
  89. End Select
  90. Return "Unknown"
  91. End Function
  92. Public Function GetVersionMajor() As String
  93. Return Environment.OSVersion.Version.Major.ToString
  94. End Function
  95. Public Function GetVersionMinor() As String
  96. Return Environment.OSVersion.Version.Minor.ToString
  97. End Function
  98. Public Function GetVersionBuild() As String
  99. Return Environment.OSVersion.Version.Build.ToString
  100. End Function
  101. Public Function GetVersionRevision() As String
  102. Return Environment.OSVersion.Version.Revision.ToString
  103. End Function
  104. End Class
  105. Class CPUInfo
  106. Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_Processor")
  107. Private Function getObj(s As String) As String
  108. Try
  109. For Each queryObj As ManagementObject In searcher.[Get]()
  110. Return queryObj(s)
  111. Next
  112. Catch ex As Exception
  113. Return "Feil i søket '" & s & "' - " & ex.ToString
  114. End Try
  115. Return "Verdi Ukjent"
  116. End Function
  117. Public Function AddressWidth() As String
  118. Return getObj("AddressWidth")
  119. End Function
  120. Public Function Architecture() As String
  121. Return getObj("Architecture")
  122. End Function
  123. Public Function Availability() As String
  124. Return getObj("Availability")
  125. End Function
  126. Public Function Caption() As String
  127. Return getObj("Caption")
  128. End Function
  129. Public Function ConfigManagerErrorCode() As String
  130. Return getObj("ConfigManagerErrorCode")
  131. End Function
  132. Public Function ConfigManagerUserConfig() As String
  133. Return getObj("ConfigManagerUserConfig")
  134. End Function
  135. Public Function CpuStatus() As String
  136. Return getObj("CpuStatus")
  137. End Function
  138. Public Function CreationClassName() As String
  139. Return getObj("CreationClassName")
  140. End Function
  141. Public Function CurrentClockSpeed() As String
  142. Return getObj("CurrentClockSpeed")
  143. End Function
  144. Public Function CurrentVoltage() As String
  145. Return getObj("CurrentVoltage")
  146. End Function
  147. Public Function DataWidth() As String
  148. Return getObj("DataWidth")
  149. End Function
  150. Public Function Description() As String
  151. Return getObj("Description")
  152. End Function
  153. Public Function DeviceID() As String
  154. Return getObj("DeviceID")
  155. End Function
  156. Public Function ErrorCleared() As String
  157. Return getObj("ErrorCleared")
  158. End Function
  159. Public Function ErrorDescription() As String
  160. Return getObj("ErrorDescription")
  161. End Function
  162. Public Function ExtClock() As String
  163. Return getObj("ExtClock")
  164. End Function
  165. Public Function Family() As String
  166. Return getObj("Family")
  167. End Function
  168. Public Function InstallDate() As String
  169. Return getObj("InstallDate")
  170. End Function
  171. Public Function L2CacheSize() As String
  172. Return getObj("L2CacheSize")
  173. End Function
  174. Public Function L2CacheSpeed() As String
  175. Return getObj("L2CacheSpeed")
  176. End Function
  177. Public Function L3CacheSize() As String
  178. Return getObj("L3CacheSize")
  179. End Function
  180. Public Function L3CacheSpeed() As String
  181. Return getObj("L3CacheSpeed")
  182. End Function
  183. Public Function LastErrorCode() As String
  184. Return getObj("LastErrorCode")
  185. End Function
  186. Public Function Level() As String
  187. Return getObj("Level")
  188. End Function
  189. Public Function LoadPercentage() As String
  190. Return getObj("LoadPercentage")
  191. End Function
  192. Public Function Manufacturer() As String
  193. Return getObj("Manufacturer")
  194. End Function
  195. Public Function MaxClockSpeed() As String
  196. Return getObj("MaxClockSpeed")
  197. End Function
  198. Public Function Name() As String
  199. Return getObj("Name")
  200. End Function
  201. Public Function NumberOfCores() As String
  202. Return getObj("NumberOfCores")
  203. End Function
  204. Public Function NumberOfLogicalProcessors() As String
  205. Return getObj("NumberOfLogicalProcessors")
  206. End Function
  207. Public Function OtherFamilyDescription() As String
  208. Return getObj("OtherFamilyDescription")
  209. End Function
  210. Public Function PNPDeviceID() As String
  211. Return getObj("PNPDeviceID")
  212. End Function
  213. Public Function CPUID() As String
  214. Dim computer As String = "."
  215. Dim wmi As Object = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2")
  216. Dim processors As Object = wmi.ExecQuery("Select * from " & "Win32_Processor")
  217. Dim cpu_ids As String = ""
  218. For Each cpu As Object In processors
  219. cpu_ids = cpu_ids & ", " & cpu.ProcessorId
  220. Next cpu
  221. If cpu_ids.Length > 0 Then cpu_ids = cpu_ids.Substring(2)
  222. Return cpu_ids
  223. End Function
  224. Public Function SystemSerialNumber() As String
  225. ' Get the Windows Management Instrumentation object.
  226. Dim wmi As Object = GetObject("WinMgmts:")
  227. ' Get the "base boards" (mother boards).
  228. Dim serial_numbers As String = ""
  229. Dim mother_boards As Object = _
  230. wmi.InstancesOf("Win32_BaseBoard")
  231. For Each board As Object In mother_boards
  232. serial_numbers &= ", " & board.SerialNumber
  233. Next board
  234. If serial_numbers.Length > 0 Then serial_numbers = _
  235. serial_numbers.Substring(2)
  236. Return serial_numbers
  237. End Function
  238. End Class
  239. Class UserInfo
  240. Public Function UserName() As String
  241. Return SystemInformation.UserName
  242. End Function
  243. Public Function Resolution() As String
  244. Return "(" & SystemInformation.WorkingArea.Width & ", " & SystemInformation.WorkingArea.Height & ")"
  245. End Function
  246. End Class
  247. Class ComputerInfo
  248. Public Function WinDir() As String
  249. Return Environ$("windir")
  250. End Function
  251. End Class
  252. End Namespace

comments powered by Disqus