Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for hardware.hta

(view source code of hardware.hta as plain text)

  1. <!DOCTYPE HTML>
  2. <html lang="en">
  3. <head>
  4. <title>Basic Hardware Inventory</title>
  5.  
  6. <meta name="viewport" content="width=device-width; initial-scale=1" />
  7.  
  8. <HTA:APPLICATION
  9.   APPLICATIONNAME="Basic Hardware Inventory"
  10.   ID="Hardware"
  11.   VERSION="9.03"
  12.   ICON="Hardware.ico"
  13.   SCROLL="auto"
  14.   SINGLEINSTANCE="yes"
  15.   WINDOWSTATE="maximize"/>
  16.  
  17. <style type="text/css">
  1. html {
  2. 	height: 100%;
  3. }
  4.  
  5. body {
  6. 	font: 11pt arial,sans-serif;
  7. 	color: black;
  8. 	background-color: white;
  9. 	padding: 20px 0;
  10. 	margin: 0;
  11. 	height: 100%;
  12. 	width: 100%;
  13. }
  14.  
  15. a {
  16. 	color: red;
  17. }
  18.  
  19. code {
  20. 	color: yellow;
  21. 	font-size: 110%;
  22. }
  23.  
  24. input[type=radio] {
  25. 	width: 2em;
  26. }
  27.  
  28. table {
  29. 	max-width: 100%;
  30. }
  31.  
  32. td {
  33. 	overflow-x: auto;
  34. 	text-align: left;
  35. }
  36.  
  37. tr {
  38. 	vertical-align: top;
  39. }
  40.  
  41. .Button {
  42. 	height: 2em;
  43. 	margin: 0 1em 0 1em;
  44. 	overflow: visible;
  45. 	padding: 2px;
  46. 	vertical-align: middle;
  47. 	width: 6em;
  48. }
  49.  
  50. .Center {
  51. 	margin-left: auto;
  52. 	margin-right: auto;
  53. 	text-align: center;
  54. }
  55.  
  56. .DebugOnly {
  57. 	display: none;
  58. }
  59.  
  60. .Left {
  61. 	text-align: left;
  62. }
  63.  
  64. .Nowrap {
  65. 	white-space: nowrap;
  66. }
  67.  
  68. .Top {
  69. 	vertical-align: top;
  70. }
  71.  
  72. #CreditsScreen, #HelpScreen {
  73. 	display: none;
  74. 	margin: 0 auto;
  75. 	max-width: 90%;
  76. 	width: 800px;
  77. }
  78.  
  79. #CreditsScreen .Button, #HelpScreen .Button {
  80. 	margin: 3px;
  81. }
  82.  
  83. #HelpScreen table tr td {
  84. 	text-align: left;
  85. }
  86.  
  87. @media screen
  88. {
  89. 	.PrintOnly {
  90. 		display: none;
  91. 	}
  92. }
  93.  
  94. @media print
  95. {
  96. 	body {
  97. 		font: 12pt arial,sans-serif;
  98. 		color: black;
  99. 		background-color: white;
  100. 		filter: unset;
  101. 		padding: 0;
  102. 		margin: 0;
  103. 		height: 100%;
  104. 	}
  105.  
  106. 	.DontPrint {
  107. 		display: none;
  108. 	}
  109.  
  110. 	.Nowrap {
  111. 		white-space: normal;
  112. 	}
  113. }
  1. </style>
  2. </head>
  3.  
  4. <script language="VBScript">
  1. Option Explicit
  2.  
  3. ' File IO constants
  4. Const TristateFalse      =  0
  5. Const TristateMixed      = -2
  6. Const TristateTrue       = -1
  7. Const TristateUseDefault = -2
  8.  
  9. Const ForAppending = 8
  10. Const ForReading   = 1
  11. Const ForWriting   = 2
  12.  
  13. ' Registry hives constants
  14. Const HKEY_CLASSES_ROOT   = &H80000000
  15. Const HKEY_CURRENT_USER   = &H80000001
  16. Const HKEY_LOCAL_MACHINE  = &H80000002
  17. Const HKEY_USERS          = &H80000003
  18. Const HKEY_CURRENT_CONFIG = &H80000005
  19.  
  20. ' Registry data types constants
  21. Const REG_SZ                         =  1
  22. Const REG_EXPAND_SZ                  =  2
  23. Const REG_BINARY                     =  3
  24. Const REG_DWORD                      =  4
  25. Const REG_DWORD_BIG_ENDIAN           =  5
  26. Const REG_LINK                       =  6
  27. Const REG_MULTI_SZ                   =  7
  28. Const REG_RESOURCE_LIST              =  8
  29. Const REG_FULL_RESOURCE_DESCRIPTOR   =  9
  30. Const REG_RESOURCE_REQUIREMENTS_LIST = 10
  31. Const REG_QWORD                      = 11
  32.  
  33. ' Character and year to be displayed in copyrights notices
  34. Const COPYRIGHTS_YEAR = 2024
  35. Dim COPYRIGHTS_CHAR
  36. COPYRIGHTS_CHAR = Chr( 169 ) ' May need correction in non-latin languages
  37.  
  38. Const KB = 1024
  39. Const MB = 1048576 ' 1024 * 1024
  40. Const GB = 1073741824 ' 1024 * 1024 * 1024
  41. Const TB = 1099511627776 ' 1024 * 1024 * 1024 * 1024
  42.  
  43. ' Variable to get elevation status
  44. Dim gvbIsElevated
  45.  
  46. ' Variable to hold local/remote check result
  47. Dim gvbIsLocalComputer
  48.  
  49. ' Variables to hold the command line
  50. Dim gvsCommandline, gvsCommandlineUC
  51.  
  52. ' Global File System Object
  53. Dim gvoFSO
  54.  
  55. ' Global variables to receive the WinSAT scores
  56. Dim sngCPU, sngDisk, sngMemory, sngTotal, sngVideo
  57.  
  58. ' Minimum window size
  59. Dim gviMinHeight, gviMinWidth
  60.  
  61. ' Configuration file
  62. Dim gvsConfigFile
  63.  
  64. ' Temporary files to display detailed query results and print previews
  65. Dim gvsDetailsFile, gvsPrintFile
  66.  
  67. ' Path to DMIDecode.exe
  68. Dim gvsDMIDecode
  69.  
  70. ' Dictionary objects to hold all defaults, permanent settings and session settings
  71. Dim gvaDefaultsBool, gvaDefaultsStr, gvaSettingsBool, gvaSettingsStr
  72.  
  73. ' Internet connection available?
  74. Dim gvbConnected
  75. gvbConnected = True
  76.  
  77. ' Random generator
  78. Dim gvoRandom
  79.  
  80. ' Registry DataTypes to string
  81. Dim gvaRegDataType(11)
  82. gvaRegDataType(1)  = "REG_SZ"
  83. gvaRegDataType(2)  = "REG_EXPAND_SZ"
  84. gvaRegDataType(3)  = "REG_BINARY"
  85. gvaRegDataType(4)  = "REG_DWORD"
  86. gvaRegDataType(5)  = "REG_DWORD_BIG_ENDIAN"
  87. gvaRegDataType(6)  = "REG_LINK"
  88. gvaRegDataType(7)  = "REG_MULTI_SZ"
  89. gvaRegDataType(8)  = "REG_RESOURCE_LIST"
  90. gvaRegDataType(9)  = "REG_FULL_RESOURCE_DESCRIPTOR"
  91. gvaRegDataType(10) = "REG_RESOURCE_REQUIREMENTS_LIST"
  92. gvaRegDataType(11) = "REG_QWORD"
  93.  
  94. ' WMI objects for all namespaces used in this HTA
  95. Dim gvoWMIlocalCimv2, gvoWMIrootCimv2, gvoWMIrootMSWinStorage, gvoWMIrootStandardCimv2, gvoWMIrootWMI
  96.  
  97. ' Other global variables
  98. Dim gvaCSSColors, gvaPATH, gvaVideo( )
  99. Dim gvbSilent, gvbWinPE
  100. Dim clrBgErr, clrTxtErr
  101. Dim gvcBanks, gvcCPU, gvcMemory
  102. Dim gviNumOS, gviMemSize, gviMemSpeed
  103. Dim gvoHDDInterfaces, gvoWSHShell
  104. Dim gvsDefaultBrowserName, gvsDefaultBrowserPath
  105. Dim gvsBIOSSerial, gvsComputer, gvsCSVTxt, gvsDebugText, gvsDetails, gvsHeader, gvsPATH, gvsSlots, gvsWinDrive
  106.  
  107.  
  108. Sub window_onload
  109. 	Dim blnComputer, strFile
  110.  
  111. 	' Global File System and WSH Shell objects must be initialized here because they are requireded now, before Initialize( ) subroutine has run
  112. 	Set gvoWSHShell      = CreateObject( "WScript.Shell" )
  113. 	Set gvoFSO           = CreateObject( "Scripting.FileSystemObject" )
  114. 	Set gvoWMIlocalCimv2 = GetObject( "winmgmts://./root/CIMV2" )
  115.  
  116. 	' Check if in WinPE
  117. 	gvbWinPE = CheckWinPE( )
  118.  
  119. 	' Initialize the program window
  120. 	AppVersion.innerHTML  = Hardware.Version
  121. 	HelpVer.innerHTML     = Hardware.Version
  122. 	CredVersion.innerHTML = Hardware.Version
  123. 	AppYear.innerHTML     = COPYRIGHTS_YEAR
  124. 	document.title = "Basic Hardware Inventory (Version " & Hardware.Version & ") " & COPYRIGHTS_CHAR & " 2005 - " & COPYRIGHTS_YEAR & ", Rob van der Woude"
  125.  
  126. 	' Initialize the program
  127. 	Initialize ' includes read and set defaults
  128. 	ConfigReadFile
  129. 	ConfigReadCommandline
  130. 	ConfigUpdateStatus
  131.  
  132. 	ButtonCopy.disabled  = True
  133. 	ButtonPaste.disabled = False
  134. 	ButtonPrint.disabled = True
  135. 	ButtonSave.disabled  = True
  136. 	If gvaSettingsBool.Item( "BASIC" ) Then
  137. 		ButtonBasic.value = "Full"
  138. 	End If
  139. 	CheckboxBIOS.Checked            = Not gvaSettingsBool.Item( "BASIC" )
  140. 	CheckboxCDROM.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  141. 	CheckboxCPU.Checked             = True
  142. 	CheckboxFDD.Checked             = Not gvaSettingsBool.Item( "BASIC" )
  143. 	CheckboxHDD.Checked             = True
  144. 	CheckboxKeyboard.Checked        = Not gvaSettingsBool.Item( "BASIC" )
  145. 	CheckboxMainBoard.Checked       = Not gvaSettingsBool.Item( "BASIC" )
  146. 	CheckboxMemory.Checked          = True
  147. 	CheckboxMonitor.Checked         = Not gvaSettingsBool.Item( "BASIC" )
  148. 	CheckboxMouse.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  149. 	CheckboxNIC.Checked             = Not gvaSettingsBool.Item( "BASIC" )
  150. 	CheckboxPorts.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  151. 	CheckboxVideo.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  152. 	CheckboxSound.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  153. 	ButtonDetailsBIOS.disabled      = True
  154. 	ButtonDetailsCPU.disabled       = True
  155. 	ButtonDetailsCDROM.disabled     = True
  156. 	ButtonDetailsFDD.disabled       = True
  157. 	ButtonDetailsHDD.disabled       = True
  158. 	ButtonDetailsKeyboard.disabled  = True
  159. 	ButtonDetailsMainBoard.disabled = True
  160. 	ButtonDetailsMemory.disabled    = True
  161. 	ButtonDetailsMonitor.disabled   = True
  162. 	ButtonDetailsMouse.disabled     = True
  163. 	ButtonDetailsNIC.disabled       = True
  164. 	ButtonDetailsPorts.disabled     = True
  165. 	ButtonDetailsSound.disabled     = True
  166. 	ButtonDetailsVideo.disabled     = True
  167.  
  168. 	If InStr( gvsCommandlineUC, "/?" ) Or InStr( gvsCommandlineUC, "/HELP" ) Then showHelp
  169.  
  170. 	If gvaSettingsBool.Item( "DEVTEST" ) Then Set gvoRandom = CreateObject( "System.Random" )
  171.  
  172. 	window.offscreenBuffering = True
  173.  
  174. 	gviNumOS = GetOSVer( )
  175. 	If Split( gviNumOS, "." )(0) < 8 Then
  176. 		MsgBox "As of version 9.00, this HTA requires Windows 8 or later." & vbCrLf & vbCrLf & "Use Hardware.hta version 8.04 for Windows 7 or older Windows versions.", vbOKOnly + vbExclamation, "Windows version issue"
  177. 		self.window.close
  178. 		Exit Sub
  179. 	End If
  180.  
  181. 	GetDefaultBrowser
  182.  
  183. 	If Not IsAdmin( True ) Then
  184. 		Self.window.close
  185. 		Exit Sub
  186. 	End If
  187.  
  188. 	blnComputer = CBool( InStr( gvsCommandlineUC, "/COMPUTER:" ) )
  189. 	gvbSilent   = gvaSettingsBool.Item( "COPY" ) Or gvaSettingsBool.Item( "PRINT" ) Or ( gvaSettingsStr.Item( "SAVE" ) <> "" )
  190. 	If gvbSilent Or blnComputer Then Inventory
  191. 	If gvbSilent Then
  192. 		If gvaSettingsBool.Item( "COPY" )      Then CopyToClipboard
  193. 		If gvaSettingsBool.Item( "PRINT" )     Then Print
  194. 		If gvaSettingsStr.Item( "SAVE" ) <> "" Then strFile = SaveTabDelimited( )
  195. 		window.close
  196. 		Exit Sub
  197. 	End If
  198.  
  199. 	' Start a separate thread/process for the update check
  200. 	setTimeout "CheckUpdate", 100, "VBScript"
  201.  
  202. 	ComputerName.focus
  203. End Sub
  204.  
  205.  
  206. Sub Add2CsvBIOS( )
  207. 	gvsHeader = gvsHeader _
  208. 	          & vbTab & "BIOS Manufacturer:" _
  209. 	          & vbTab & "BIOS Model:"   _
  210. 	          & vbTab & "BIOS Version:" _
  211. 	          & vbTab & "BIOS Date:"    _
  212. 	          & vbTab & "BIOS Serial Number:"
  213. 	On Error Resume Next ' REQUIRED
  214. 	gvsCSVTxt = gvsCSVTxt & vbTab
  215. 	gvsCSVTxt = gvsCSVTxt & BIOSManufacturer.value
  216. 	gvsCSVTxt = gvsCSVTxt & vbTab
  217. 	gvsCSVTxt = gvsCSVTxt & BIOSModel.value
  218. 	gvsCSVTxt = gvsCSVTxt & vbTab
  219. 	gvsCSVTxt = gvsCSVTxt & BIOSVersion.value
  220. 	gvsCSVTxt = gvsCSVTxt & vbTab
  221. 	gvsCSVTxt = gvsCSVTxt & BIOSDate.value
  222. 	gvsCSVTxt = gvsCSVTxt & vbTab
  223. 	gvsCSVTxt = gvsCSVTxt & gvsBIOSSerial
  224. 	On Error GoTo 0
  225. End Sub
  226.  
  227.  
  228. Sub Add2CsvCDROM( )
  229. 	Dim i
  230. 	On Error Resume Next ' REQUIRED
  231. 	For i = 0 To 64
  232. 		gvsCSVTxt = gvsCSVTxt _
  233. 		          & vbTab & document.getElementById( "CDROM" & i & "Model"     ).value _
  234. 		          & vbTab & document.getElementById( "CDROM" & i & "Firmware"  ).value _
  235. 		          & vbTab & document.getElementById( "CDROM" & i & "Interface" ).value
  236. 		If Err Then
  237. 			Exit For
  238. 		Else
  239. 			gvsHeader = gvsHeader _
  240. 			           & vbTab & "CDROM " & i & " Model:"    _
  241. 			           & vbTab & "CDROM " & i & " Firmware:" _
  242. 			           & vbTab & "CDROM " & i & " Interface:"
  243. 		End if
  244. 	Next
  245. 	On Error GoTo 0
  246. End Sub
  247.  
  248.  
  249. Sub Add2CsvCPU
  250. 	gvsHeader = gvsHeader _
  251. 	          & vbTab & "# CPUs:" _
  252. 	          & vbTab & "CPU Type:" _
  253. 	          & vbTab & "CPU Speed:" _
  254. 	          & vbTab & "CPU Socket:" _
  255. 	          & vbTab & "WinSat CPU Score:"
  256. 	On Error Resume Next ' REQUIRED
  257. 	gvsCSVTxt = gvsCSVTxt & vbTab
  258. 	gvsCSVTxt = gvsCSVTxt & CPUNumber.value
  259. 	gvsCSVTxt = gvsCSVTxt & vbTab
  260. 	gvsCSVTxt = gvsCSVTxt & CPUModel.value
  261. 	gvsCSVTxt = gvsCSVTxt & vbTab
  262. 	gvsCSVTxt = gvsCSVTxt & CPUSpeed.value
  263. 	gvsCSVTxt = gvsCSVTxt & vbTab
  264. 	gvsCSVTxt = gvsCSVTxt & CPUSocket.value
  265. 	gvsCSVTxt = gvsCSVTxt & vbTab
  266. 	gvsCSVTxt = gvsCSVTxt & CPUScore.value
  267. 	On Error GoTo 0
  268. End Sub
  269.  
  270.  
  271. Sub Add2CsvFDD( )
  272. 	Dim i
  273. 	On Error Resume Next ' REQUIRED
  274. 	For i = 0 To 256
  275. 		gvsCSVTxt = gvsCSVTxt _
  276. 		          & vbTab & document.getElementById( "FDD" & i & "DeviceID"    ).value _
  277. 		          & vbTab & document.getElementById( "FDD" & i & "Description" ).value _
  278. 		          & vbTab & document.getElementById( "FDD" & i & "Capacity"    ).value _
  279. 		          & vbTab & document.getElementById( "FDD" & i & "Interface"   ).value
  280. 		If Err Then
  281. 			Exit For
  282. 		Else
  283. 				gvsHeader = gvsHeader _
  284. 				          & vbTab & "FDD " & i & " Drive:"       _
  285. 				          & vbTab & "FDD " & i & " Description:" _
  286. 				          & vbTab & "FDD " & i & " Capacity:"    _
  287. 				          & vbTab & "FDD " & i & " Interface:"
  288. 		End If
  289. 	Next
  290. 	On Error GoTo 0
  291. End Sub
  292.  
  293.  
  294. Sub Add2CsvHDD( )
  295. 	Dim i
  296. 	On Error Resume Next ' REQUIRED
  297. 	For i = 0 To 256
  298. 		gvsCSVTxt = gvsCSVTxt _
  299. 		          & vbTab & document.getElementById( "HardDisk" & i & "Model"     ).value _
  300. 		          & vbTab & document.getElementById( "HardDisk" & i & "Size"      ).value _
  301. 		          & vbTab & document.getElementById( "HardDisk" & i & "Interface" ).value
  302. 		If Err Then
  303. 			Exit For
  304. 		Else
  305. 				gvsHeader = gvsHeader _
  306. 				          & vbTab & "HDD " & i & " Model:"     _
  307. 				          & vbTab & "HDD " & i & " Size (GB):" _
  308. 				          & vbTab & "HDD " & i & " Interface:"
  309. 		End If
  310. 	Next
  311. 	On Error GoTo 0
  312. 	gvsHeader = gvsHeader & vbTab & "WinSat Disk Score:"
  313. 	gvsCSVTxt = gvsCSVTxt & vbTab & DiskScore.value
  314. End Sub
  315.  
  316.  
  317. Sub Add2CsvKbd( )
  318. 	gvsHeader = gvsHeader _
  319. 	          & vbTab & "Keyboard Type:" _
  320. 	          & vbTab & "Keyboard Model:"
  321. 	On Error Resume Next ' REQUIRED
  322. 	gvsCSVTxt = gvsCSVTxt & vbTab
  323. 	gvsCSVTxt = gvsCSVTxt & KeyboardType.value
  324. 	gvsCSVTxt = gvsCSVTxt & vbTab
  325. 	gvsCSVTxt = gvsCSVTxt & KeyboardModel.value
  326. 	On Error GoTo 0
  327. End Sub
  328.  
  329.  
  330. Sub Add2CsvMainBoard( )
  331. 	gvsHeader = gvsHeader            & vbTab _
  332. 	          & "Chassis:"           & vbTab _
  333. 	          & "MB Manufacturer:"   & vbTab _
  334. 	          & "MB Model:"          & vbTab _
  335. 	          & "MB Version:"        & vbTab _
  336. 	          & "WinSAT Score:"
  337. 	gvsCSVTxt = gvsCSVTxt            & vbTab _
  338. 	          & ChassisType.value    & vbTab _
  339. 	          & MBManufacturer.value & vbTab _
  340. 	          & MBModel.value        & vbTab _
  341. 	          & MBVersion.value      & vbTab _
  342. 	          & WinSATScore.value
  343. End Sub
  344.  
  345.  
  346. Sub Add2CsvMemory
  347. 	gvsHeader = gvsHeader _
  348. 	          & vbTab & "# Memory Banks:" _
  349. 	          & vbTab & "# Memory Modules:" _
  350. 	          & vbTab & "Total Memory (MB):" _
  351. 	          & vbTab & "Memory Speed (ns):" _
  352. 	          & vbTab & "Memory FormFactor:" _
  353. 	          & vbTab & "WinSat Memory Score:"
  354.     On Error Resume Next ' REQUIRED
  355.     gvsCSVTxt = gvsCSVTxt & vbTab
  356.     gvsCSVTxt = gvsCSVTxt & gvcBanks
  357.     gvsCSVTxt = gvsCSVTxt & vbTab
  358.     gvsCSVTxt = gvsCSVTxt & gvcMemory
  359.     gvsCSVTxt = gvsCSVTxt & vbTab
  360.     gvsCSVTxt = gvsCSVTxt & MemorySize.value
  361.     gvsCSVTxt = gvsCSVTxt & vbTab
  362.     gvsCSVTxt = gvsCSVTxt & MemorySpeed.value
  363.     gvsCSVTxt = gvsCSVTxt & vbTab
  364.     gvsCSVTxt = gvsCSVTxt & MemoryFormFactor.value
  365.     gvsCSVTxt = gvsCSVTxt & vbTab
  366.     gvsCSVTxt = gvsCSVTxt & MemoryScore.value
  367. 	On Error GoTo 0
  368. End Sub
  369.  
  370.  
  371. Sub Add2CsvMouse( )
  372. 	gvsHeader = gvsHeader _
  373. 	          & vbTab & "Mouse Type:"    _
  374. 	          & vbTab & "Mouse Model:"
  375. 	On Error Resume Next ' REQUIRED
  376. 	gvsCSVTxt = gvsCSVTxt & vbTab
  377. 	gvsCSVTxt = gvsCSVTxt & MouseType.value
  378. 	gvsCSVTxt = gvsCSVTxt & vbTab
  379. 	gvsCSVTxt = gvsCSVTxt & MouseModel.value
  380. 	On Error GoTo 0
  381. End Sub
  382.  
  383.  
  384. Sub Add2CsvNIC
  385. 	Dim i
  386. 	On Error Resume Next ' REQUIRED
  387. 	For i = 0 To 64
  388. 		gvsCSVTxt = gvsCSVTxt _
  389. 		          & vbTab & document.getElementById( "NICModel" & i ).value _
  390. 		          & vbTab & document.getElementById( "MACAddress" & i ).value _
  391. 		          & vbTab & document.getElementById( "NICSpeed" & i ).value
  392. 		If Err Then
  393. 			Exit For
  394. 		Else
  395. 			gvsHeader = gvsHeader _
  396. 			          & vbTab & "NIC " & i & " Model (and medium):" _
  397. 			          & vbTab & "NIC " & i & " MAC Address:" _
  398. 			          & vbTab & "NIC " & i & " Speed:"
  399. 		End if
  400. 	Next
  401. 	On Error GoTo 0
  402. End Sub
  403.  
  404.  
  405. Sub Add2CsvPorts
  406. 	gvsHeader = gvsHeader _
  407. 	          & vbTab & "USB:" _
  408. 	          & vbTab & "System Slots:" _
  409. 	          & vbTab & "Parallel Ports:" _
  410. 	          & vbTab & "Serial Ports:"
  411. 	On Error Resume Next ' REQUIRED
  412. 	gvsCSVTxt = gvsCSVTxt & vbTab
  413. 	gvsCSVTxt = gvsCSVTxt & USB.value
  414. 	gvsCSVTxt = gvsCSVTxt & vbTab
  415. 	gvsCSVTxt = gvsCSVTxt & gvsSlots
  416. 	gvsCSVTxt = gvsCSVTxt & vbTab
  417. 	gvsCSVTxt = gvsCSVTxt & Parallel.value
  418. 	gvsCSVTxt = gvsCSVTxt & vbTab
  419. 	gvsCSVTxt = gvsCSVTxt & Serial.value
  420. 	On Error GoTo 0
  421. End Sub
  422.  
  423.  
  424. Sub Add2CsvSound
  425. 	gvsHeader = gvsHeader _
  426. 	          & vbTab & "Sound Card Model:" _
  427. 	          & vbTab & "Sound Card Manufacturer:"
  428. 	On Error Resume Next ' REQUIRED
  429. 	gvsCSVTxt = gvsCSVTxt & vbTab
  430. 	gvsCSVTxt = gvsCSVTxt & SoundCardManufacturer.value
  431. 	gvsCSVTxt = gvsCSVTxt & vbTab
  432. 	gvsCSVTxt = gvsCSVTxt & SoundCardModel.value
  433. 	On Error GoTo 0
  434. End Sub
  435.  
  436.  
  437. Sub Add2CsvVideo( )
  438. 	Dim i
  439. 	On Error Resume Next ' REQUIRED
  440. 	For i = 0 To 32
  441. 		gvsCSVTxt = gvsCSVTxt _
  442. 		          & vbTab & document.getElementById( "VideoModel"  & i ).value _
  443. 		          & vbTab & document.getElementById( "VideoMemory" & i ).value _
  444. 		          & vbTab & document.getElementById( "VideoMode"   & i ).value
  445. 		If Err Then
  446. 			Exit For
  447. 		Else
  448. 			gvsHeader = gvsHeader _
  449. 			          & vbTab & "Video " & i & " Model:" _
  450. 			          & vbTab & "Video " & i & " Memory (MB):" _
  451. 			          & vbTab & "Video " & i & " Mode:"
  452. 		End If
  453. 	Next
  454. 	gvsCSVTxt = gvsCSVTxt & vbTab & GraphicsScore.value
  455. 	gvsHeader = gvsHeader & vbTab & "WinSat Graphics Score:"
  456. 	On Error GoTo 0
  457. End Sub
  458.  
  459.  
  460. Function Align( myString, myLength )
  461. 	Align = Left( myString & Space( myLength ), myLength )
  462. End Function
  463.  
  464.  
  465. Sub Basic( )
  466. 	gvaSettingsBool.Item( "BASIC" ) = Not gvaSettingsBool.Item( "BASIC" )
  467. 	CheckboxBIOS.Checked            = Not gvaSettingsBool.Item( "BASIC" )
  468. 	CheckboxCDROM.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  469. 	CheckboxCPU.Checked             = True
  470. 	CheckboxHDD.Checked             = True
  471. 	CheckboxFDD.Checked             = Not gvaSettingsBool.Item( "BASIC" )
  472. 	CheckboxKeyboard.Checked        = Not gvaSettingsBool.Item( "BASIC" )
  473. 	CheckboxMainBoard.Checked       = Not gvaSettingsBool.Item( "BASIC" )
  474. 	CheckboxMemory.Checked          = True
  475. 	CheckboxMonitor.Checked         = Not gvaSettingsBool.Item( "BASIC" )
  476. 	CheckboxMouse.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  477. 	CheckboxNIC.Checked             = Not gvaSettingsBool.Item( "BASIC" )
  478. 	CheckboxPorts.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  479. 	CheckboxVideo.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  480. 	CheckboxSound.Checked           = Not gvaSettingsBool.Item( "BASIC" )
  481. 	If gvaSettingsBool.Item( "BASIC" ) Then
  482. 		ButtonBasic.value     = "Full"
  483. 		ButtonBasic.accessKey = "f"
  484. 	Else
  485. 		ButtonBasic.value     = "Basic"
  486. 		ButtonBasic.accessKey = "b"
  487. 	End If
  488. End Sub
  489.  
  490.  
  491. Function Chain( myCharList )
  492. 	Dim intChar, strChar, strCharChain
  493. 	Chain = ""
  494. 	If Not IsArray( myCharList ) Then
  495. 		If InStr( myCharList, ";" ) Then
  496. 			myCharList = Split( myCharList, ";" )
  497. 		ElseIf InStr( myCharList, "," ) Then
  498. 			myCharList = Split( myCharList, "," )
  499. 		Else
  500. 			Exit Function
  501. 		End If
  502. 	End If
  503. 	For Each intChar In myCharList
  504. 		If CInt( intChar ) = 0 Then
  505. 			' Uncomment next line to abort at first null character
  506. 			' Exit For
  507. 			' Comment next line when aborting at first null character
  508. 			strChar = " "
  509. 		Else
  510. 			strChar = Chr( intChar )
  511. 		End If
  512. 		strCharChain = strCharChain & strChar
  513. 	Next
  514. 	Chain = Trim( strCharChain )
  515. End Function
  516.  
  517.  
  518. Function CheckComputerName( myComputerName )
  519. 	Dim blnReady, colItems, objItem, objWMIService, strComputerName
  520. 	strComputerName = UCase( myComputerName )
  521. 	CheckComputerName = ""
  522. 	blnReady = False
  523. 	If Not gvbWinPE Then
  524. 		strComputerName = GetHostName( strComputerName )
  525. 		If strComputerName = "" Then
  526. 			MsgBox "Error while trying to ping computer " & strComputerName, vbOKOnly, "Connection Error"
  527. 			Reset
  528. 			Exit Function
  529. 		End If
  530. 	End If
  531. 	CheckComputerName = strComputerName
  532. End Function
  533.  
  534.  
  535. Sub CheckDMIDecode( )
  536. 	Dim blnFound, i
  537. 	blnFound = False
  538. 	If gvbWinPE Then Exit Sub
  539. 	For i = 0 To UBound( gvaPATH )
  540. 		With gvoFSO
  541. 			gvsDMIDecode = .BuildPath( gvaPATH(i), "dmidecode.exe" )
  542. 			If .FileExists( gvsDMIDecode ) Then
  543. 				blnFound = True
  544. 				Exit For
  545. 			End If
  546. 		End With
  547. 	Next
  548. 	gvaSettingsBool.Item( "DMIDECODE" ) = gvaSettingsBool.Item( "DMIDECODE" ) And blnFound
  549. 	CheckboxDMIDecode.disabled = Not blnFound
  550. 	DebugMessage "", "DMIDecode found: " & CStr( blnFound )
  551. End Sub
  552.  
  553.  
  554. Sub CheckKey( )
  555. 	' Backspace
  556. 	If SettingsScreen.style.display = "none" And MainScreen.style.display = "none" Then ' Not in Settings or Main screen
  557. 		If Self.window.event.keyCode =  8 Then
  558. 			ShowMain ' BackSpace => Back to main window
  559. 		End If
  560. 	End If
  561. 	' Escape
  562. 	If Self.window.event.keyCode = 27 Then
  563. 		ShowMain ' Esc => Back to main window
  564. 	End If
  565. 	' Enter
  566. 	If Not MainScreen.style.display = "none" Then ' In Main screen
  567. 		If Self.window.event.keyCode =  13 Then
  568. 			Inventory ' Enter => Start inventory
  569. 		End If
  570. 	End if
  571. 	If Self.window.event.altKey Then
  572. 		If Self.window.event.keyCode = 68 Then ' Alt+d, toggle Debug mode
  573. 			gvaSettingsBool.Item( "DEBUG" ) = Not gvaSettingsBool.Item( "DEBUG" )
  574. 			ConfigUpdateStatus
  575. 		End If
  576. 	End If
  577. End Sub
  578.  
  579.  
  580. Sub CheckUpdate( )
  581. 	Dim intAnswer, intButtons, lenLatestVer, strCurrentVer, strLatestver, strPrompt, strTitle
  582.  
  583. 	If Not gvaSettingsBool.Item( "NOUPD" ) And Not gvbWinPE Then
  584. 		' Change cursor to hourglass while checking for update
  585. 		Document.Body.style.Cursor = "wait"
  586.  
  587. 		intButtons = vbYesNoCancel + vbApplicationModal + vbInformation
  588. 		strCurrentVer = Split( Hardware.Version )(0)
  589. 		strLatestVer  = TextFromHTML( "https://www.robvanderwoude.com/updates/hardware.txt" )
  590.  
  591. 		If strCurrentVer <> strLatestver Then
  592. 			On Error Resume Next ' REQUIRED
  593. 			' Clear the IE cache
  594. 			gvoWSHShell.Run "RUNDll32.EXE InetCpl.cpl,ClearMyTracksByProcess 8", 7, True
  595. 			' Try again, read the latest version info from the web
  596. 			strLatestver = TextFromHTML( "https://www.robvanderwoude.com/updates/hardware.txt" )
  597. 			On Error Goto 0
  598. 		End If
  599.  
  600. 		DebugMessage "Check for Update", Align( "Connected to Internet:", 25 ) & gvbConnected  & vbCrLf & Align( "Current Version:", 25 ) & strCurrentVer & vbCrLf & Align( "Latest  Version:", 25 ) & strLatestver  & vbCrLf
  601.  
  602. 		If gvbConnected Then
  603. 			lenLatestVer = Len( strLatestVer )
  604. 			If lenLatestVer >= 4 And lenLatestVer <= 6 Then
  605. 				If strLatestVer < strCurrentVer Then
  606. 					strTitle  = "Unofficial version"
  607. 					strPrompt = "You seem to be using a pre-release version (" & strCurrentVer & ") of Hardware.hta." _
  608. 					          & vbCrLf & vbCrLf _
  609. 					          & "The latest official release is " & strLatestver _
  610. 					          & vbCrLf & vbCrLf _
  611. 					          & "Do you want to download the latest official release?"
  612. 					intAnswer = MsgBox( strPrompt, intButtons + vbDefaultButton2, strTitle )
  613. 					If intAnswer = vbYes Then
  614. 						gvoWSHShell.Run "https://www.robvanderwoude.com/hardware.php", 7, False
  615. 					End If
  616. 				End If
  617. 				If strLatestVer > strCurrentVer Then
  618. 					strTitle  = "Old version"
  619. 					strPrompt = "You are using version " & strCurrentVer & " of Hardware.hta." _
  620. 					          & vbCrLf & vbCrLf _
  621. 					          & "The latest official release is " & strLatestver _
  622. 					          & vbCrLf & vbCrLf _
  623. 					          & "Do you want to download the latest official release?"
  624. 					intAnswer = MsgBox( strPrompt, intButtons, strTitle )
  625. 					If intAnswer = vbYes Then
  626. 						gvoWSHShell.Run "https://www.robvanderwoude.com/hardware.php", 7, False
  627. 					End If
  628. 				End If
  629. 			Else
  630. 				strTitle  = "Update Check Failure"
  631. 				strPrompt = "Unable to check for updates." _
  632. 				          & vbCrLf & vbCrLf _
  633. 				          & "Do you want to ""manually"" check for updates now?"
  634. 				intAnswer = MsgBox( strPrompt, intButtons, strTitle )
  635. 				If intAnswer = vbYes Then
  636. 					gvoWSHShell.Run "https://www.robvanderwoude.com/hardware.php", 7, False
  637. 				End If
  638. 			End If
  639. 		End If
  640.  
  641. 		' Change cursor back to default
  642. 		Document.Body.style.Cursor = "default"
  643. 	End If
  644. End Sub
  645.  
  646.  
  647. Function CheckWinPE( )
  648. 	' Check if running in WinPE environment
  649. 	' Based on a tip by Mitch Tulloch
  650. 	' http://techgenix.com/HowtodetectwhetheryouareinWindowsPE/
  651. 	Dim arrKeys, blnWinPE, colItems, i, objItem, objReg, objWMIService
  652. 	blnWinPE = False
  653.     Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv" )
  654. 	objReg.EnumKey HKEY_LOCAL_MACHINE, "SYSTEM\ControlSet001\Control", arrKeys
  655. 	For i = 0 To UBound( arrKeys )
  656. 		If UCase( arrKeys(i) ) = "MININT" Then
  657. 			blnWinPE = True
  658. 			Exit For
  659. 		End If
  660. 	Next
  661. 	Set objReg = Nothing
  662. 	If blnWinPE Then
  663. 		' Find computer name when in WinPE
  664. 		' Based on code by Richie Schuster
  665. 		' http://www.sccmog.com/get-current-old-machine-name-winpe-vbscript/
  666. 		Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
  667. 		Set colItems = objWMIService.ExecQuery ( "Select * From Win32_LogicalDisk" )
  668. 		gvsWinDrive = ""
  669. 		For Each objItem in colItems
  670. 			' Find Windows system drive (won't work if Windows folder is renamed)
  671. 			If gvoFSO.FolderExists( gvoFSO.BuildPath( objItem.DeviceID, "Windows\System32\config" ) ) Then
  672. 				gvsWinDrive = objItem.DeviceID
  673. 			End If
  674. 		Next
  675. 		Set colItems = Nothing
  676. 		If gvsWinDrive <> "" Then
  677. 			' Mount registry hive from Windows Drive
  678. 			gvoWSHShell.Run "CMD.EXE /C REG.EXE Load HKLM\TempHive " & gvsWinDrive & "\windows\system32\config\system", 0, True
  679. 			' Read computer name from mounted registry hive
  680. 			gvsComputer = wshShell.RegRead( "HKEY_LOCAL_MACHINE\TempHive\ControlSet001\Control\ComputerName\ComputerName" )
  681. 			' Unmount temporary registry hive
  682. 			gvoWSHShell.Run "CMD.EXE /C REG.EXE Unload HKLM\TempHive", 0, True
  683. 		End If
  684. 		Set objWMIService = Nothing
  685. 	End If
  686. 	CheckWinPE = blnWinPE
  687. End Function
  688.  
  689.  
  690. Sub ConfigReadCommandline( )
  691. 	Dim objRE
  692. 	Dim strDebug, strItem, strKey, strSubItem
  693. 	For Each strKey In gvaSettingsBool.Keys
  694. 		If InStr( gvsCommandlineUC, "/" & UCase( strKey ) ) Then gvaSettingsBool.Item( strKey ) = True
  695. 	Next
  696. 	strItem = GetParameter( gvsCommandline, "COMPUTER" )
  697. 	If strItem <> "" Then gvaSettingsStr.Item( "COMPUTER" ) = UCase( strItem )
  698. 	strItem = GetParameter( gvsCommandline, "SAVE" )
  699. 	If strItem <> "" Then
  700. 		With gvoFSO
  701. 			strItem = .GetAbsolutePathName( strItem )
  702. 			If .FolderExists( .GetParentFolderName( strItem ) ) Then
  703. 				gvaSettingsStr.Item( "SAVE" ) = strItem
  704. 			Else
  705. 				gvaSettingsStr.Item( "SAVE" ) = ""
  706. 			End If
  707. 		End With
  708. 	End If
  709. 	strItem = GetParameter( gvsCommandline, "TEMPDIR" )
  710. 	If strItem <> "" And gvoFSO.FolderExists( strItem ) Then
  711. 		gvaSettingsStr.Item( "TEMPDIR" ) = strItem
  712. 	End If
  713. 	strItem = GetParameter( gvsCommandline, "THEME" )
  714. 	Select Case UCase( strItem )
  715. 		Case "BW":
  716. 			gvaSettingsStr.Item( "THEME" ) = "ThemeBW"
  717. 		Case "BLUE":
  718. 			gvaSettingsStr.Item( "THEME" ) = "ThemeBlue"
  719. 		Case "CUSTOM":
  720. 			gvaSettingsStr.Item( "THEME" ) = "ThemeCustom"
  721. 		Case "DARK":
  722. 			gvaSettingsStr.Item( "THEME" ) = "ThemeDark"
  723. 		Case "DEFAULT":
  724. 			gvaSettingsStr.Item( "THEME" ) = "ThemeBW"
  725. 		Case "RED":
  726. 			gvaSettingsStr.Item( "THEME" ) = "ThemeRed"
  727. 	End Select
  728. 	strSubItem = GetParameter( gvsCommandline, "CUSTOMCOLORS" )
  729. 	If ( strItem = "" Or gvaSettingsStr.Item( "THEME" ) = "ThemeCustom" ) And strSubItem <> "" Then
  730. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = LCase( strSubItem )
  731. 		gvaSettingsStr.Item( "THEME" )        = "ThemeCustom"
  732. 	End If
  733. 	strItem = GetParameter( gvsCommandline, "XML" )
  734. 	If strItem <> "" Then
  735. 		With gvoFSO
  736. 			strItem = .GetAbsolutePathName( strItem )
  737. 			If .FolderExists( .GetParentFolderName( strItem ) ) Then
  738. 				gvaSettingsStr.Item( "XML" ) = strItem
  739. 			End If
  740. 		End With
  741. 	End If
  742. 	strItem = GetParameter( gvsCommandline, "ZOOM" )
  743. 	If strItem <> "" Then
  744. 		If IsNumeric( strItem ) Then
  745. 			If CInt( strItem ) < 50 Then strItem = 50
  746. 			If CInt( strItem ) > 250 Then strItem = 250
  747. 			gvaSettingsStr.Item( "ZOOM" ) = CInt( strItem )
  748. 		End If
  749. 	End If
  750. 	strDebug = Align( "<u>Setting:</u>", 21 ) & "<u>Value:</u>" & vbCrLf
  751. 	For Each strKey In gvaSettingsBool.Keys
  752. 		strDebug = strDebug & Align( strKey, 14 ) & gvaSettingsBool.Item( strKey ) & vbCrLf
  753. 	Next
  754. 	For Each strKey In gvaSettingsStr.Keys
  755. 		strDebug = strDebug & Align( strKey, 14 ) & """" & gvaSettingsStr.Item( strKey ) & """" & vbCrLf
  756. 	Next
  757. 	DebugMessage "Settings After Reading Command Line", strDebug
  758. 	' Remove HTA path from command line
  759. 	Set objRE = New RegExp
  760. 	objRE.IgnoreCase = True
  761. 	objRE.Pattern = ".*?\.hta."
  762. 	If objRE.Test( gvsCommandline ) Then
  763. 		gvsCommandline = Trim( objRE.Replace( gvsCommandline, "" ) )
  764. 	End If
  765. 	DisplayCommandLine.innerHTML = gvsCommandline
  766. 	If gvaSettingsBool.item( "DEVTEST" ) Then
  767. 		' With /DEVTEST window size is 800x100, zoomfactor 75%
  768. 		gvaSettingsStr.Item( "ZOOM" ) = 75
  769. 		InputZoomFactor.value = "75"
  770. 		' Remove /DEVTEST from display
  771. 		objRE.Pattern = "/DEVTEST"
  772. 		If objRE.Test( DisplayCommandLine.innerHTML ) Then
  773. 			DisplayCommandLine.innerHTML = objRE.Replace( DisplayCommandLine.innerHTML, "" )
  774. 		End If
  775. 		objRE.Pattern = "\s+"
  776. 		DisplayCommandLine.innerHTML = objRE.Replace( DisplayCommandLine.innerHTML, " " )
  777. 	End If
  778. 	Set objRE = Nothing
  779. End Sub
  780.  
  781.  
  782. Sub ConfigReadDefaults( )
  783. 	Dim strDebug, strKey
  784. 	gvaDefaultsBool.Item( "BASIC" )       = False
  785. 	gvaDefaultsBool.Item( "CHAIN" )       = False
  786. 	gvaDefaultsBool.Item( "CM" )          = False
  787. 	gvaDefaultsBool.Item( "COPY" )        = False
  788. 	gvaDefaultsBool.Item( "DEBUG" )       = False
  789. 	gvaDefaultsBool.Item( "DEVTEST" )     = False
  790. 	gvaDefaultsBool.Item( "DMIDECODE" )   = False
  791. 	gvaDefaultsBool.Item( "DXDIAG" )      = False
  792. 	gvaDefaultsBool.Item( "KEEPXML" )     = False
  793. 	gvaDefaultsBool.Item( "NOUPD" )       = False
  794. 	gvaDefaultsBool.Item( "NOSCORES" )    = False
  795. 	gvaDefaultsBool.Item( "PRINT" )       = False
  796. 	gvaDefaultsBool.Item( "USBSTOR" )     = False
  797. 	gvaDefaultsBool.Item( "VIRTUAL" )     = False
  798. 	gvaDefaultsStr.Item( "COMPUTER" )     = GetLocalComputerName( )
  799. 	gvaDefaultsStr.Item( "CUSTOMCOLORS" ) = "white;black;blue;silver;black;black" ' Background;Captions;Links;ButtonFace;ButtonCaption;Code
  800. 	gvaSettingsStr.Item( "DEBUGLOG" )     = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 ) & ".debuglog.html"
  801. 	gvaDefaultsStr.Item( "SAVE" )         = ""
  802. 	gvaDefaultsStr.Item( "TEMPDIR" )      = gvoFSO.GetAbsolutePathName( gvoWSHShell.ExpandEnvironmentStrings( "%Temp%" ) )
  803. 	gvaDefaultsStr.Item( "THEME" )        = "ThemeBW" ' ThemeBlue, ThemeBW, ThemeCustom, ThemeDark or ThemeRed
  804. 	gvaDefaultsStr.Item( "XML" )          = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 ) & ".xml"
  805. 	gvaDefaultsStr.Item( "ZOOM" )         = 100
  806. 	ConfigSetDefaults
  807. 	strDebug = Align( "<u>Setting:</u>", 21 ) & "<u>Value:</u>" & vbCrLf
  808. 	For Each strKey In gvaDefaultsBool.Keys
  809. 		strDebug = strDebug & Align( strKey, 14 ) & gvaSettingsBool.Item( strKey ) & vbCrLf
  810. 	Next
  811. 	For Each strKey In gvaDefaultsStr.Keys
  812. 		strDebug = strDebug & Align( strKey, 14 ) & """" & gvaSettingsStr.Item( strKey ) & """" & vbCrLf
  813. 	Next
  814. 	DebugMessage "Settings After Reading Defaults", strDebug
  815. End Sub
  816.  
  817.  
  818. Sub ConfigReadFile( )
  819. 	Dim intMinSize, intSize
  820. 	Dim objFile, objRE
  821. 	Dim strDebug, strConfig, strItem, strKey, strSubItem, strUConfig
  822. 	If gvoFSO.FileExists( gvsConfigFile ) Then
  823. 		' Check config file size
  824. 		Set objFile = gvoFSO.GetFile( gvsConfigFile )
  825. 		intSize = objFile.Size
  826. 		Set objFile = Nothing
  827. 		' Check minimum required file size by "measuring" command line switch length
  828. 		intMinSize = 9999
  829. 		For Each strKey In gvaDefaultsBool.Keys
  830. 			intMinSize = Min( intMinSize, Len( strKey ) )
  831. 		Next
  832. 		' Add 1 for the forward slash
  833. 		intMinSize = intMinSize + 1
  834. 		' Config file is useless if its size is less than the length of the shortest command line switch
  835. 		If intSize < intMinSize Then
  836. 			gvoFSO.DeleteFile gvsConfigFile, True
  837. 		Else
  838. 			' Read the entire contents of the configuration file
  839. 			Set objFile = gvoFSO.OpenTextFile( gvsConfigFile, ForReading, False, TristateFalse )
  840. 			strConfig  = Trim( Replace( objFile.ReadAll( ), vbCrLf, " " ) )
  841. 			strUConfig = UCase( strConfig )
  842. 			objFile.Close
  843. 			Set objFile = Nothing
  844. 			' Replace all whitespace (space, tab, linefeed, carriage return, or any combination) by single spaces
  845. 			DisplayConfig.innerHTML = Join( Split( strConfig, vbCrLf ), " " )
  846. 			DisplayConfig.innerHTML = Join( Split( DisplayConfig.innerHTML, vbCr ), " " )
  847. 			DisplayConfig.innerHTML = Join( Split( DisplayConfig.innerHTML, vbLf ), " " )
  848. 			DisplayConfig.innerHTML = Trim( Join( Split( DisplayConfig.innerHTML, vbTab ), " " ) )
  849. 			' Remove /DEVTEST from display
  850. 			Set objRE = New RegExp
  851. 			objRE.Pattern = "/DEVTEST"
  852. 			objRE.IgnoreCase = True
  853. 			If objRE.Test( DisplayConfig.innerHTML ) Then
  854. 				DisplayConfig.innerHTML = objRE.Replace( DisplayConfig.innerHTML, "" )
  855. 			End If
  856. 			Set objRE  = Nothing
  857. 			For Each strKey In gvaSettingsBool.Keys
  858. 				If InStr( strUConfig, "/" & strKey ) Then gvaSettingsBool.Item( strKey ) = True
  859. 			Next
  860. 			strItem = GetParameter( strConfig, "THEME" )
  861. 			Select Case UCase( strItem )
  862. 				Case "BLUE":
  863. 					gvaSettingsStr.Item( "THEME" ) = "ThemeBlue"
  864. 				Case "BW":
  865. 					gvaSettingsStr.Item( "THEME" ) = "ThemeBW"
  866. 				Case "CUSTOM":
  867. 					gvaSettingsStr.Item( "THEME" ) = "ThemeCustom"
  868. 				Case "DARK":
  869. 					gvaSettingsStr.Item( "THEME" ) = "ThemeDark"
  870. 				Case "":
  871. 				Case "DEFAULT":
  872. 					gvaSettingsStr.Item( "THEME" ) = "ThemeBW"
  873. 				Case "RED":
  874. 					gvaSettingsStr.Item( "THEME" ) = "ThemeRed"
  875. 			End Select
  876. 			strSubItem = GetParameter( strConfig, "CUSTOMCOLORS" )
  877. 			If ( strItem = "" Or gvaSettingsStr.Item( "THEME" ) = "ThemeCustom" ) And strSubItem <> "" Then
  878. 				gvaSettingsStr.Item( "CUSTOMCOLORS" ) = LCase( strSubItem )
  879. 				gvaSettingsStr.Item( "THEME" )        = "ThemeCustom"
  880. 			End If
  881. 			strItem = GetParameter( strConfig, "XML" )
  882. 			If strItem <> "" Then
  883. 				With gvoFSO
  884. 					If .FolderExists( .GetParentFolderName( .GetAbsolutePathName( strItem ) ) ) Then
  885. 							gvaSettingsStr.Item( "XML" ) = .GetAbsolutePathName( strItem )
  886. 					End If
  887. 				End With
  888. 			End If
  889. 			strItem = GetParameter( strConfig, "ZOOM" )
  890. 			If strItem <> "" Then
  891. 				If IsNumeric( strItem ) Then
  892. 					If CInt( strItem ) < 50 Then strItem = 50
  893. 					If CInt( strItem ) > 250 Then strItem = 250
  894. 					gvaSettingsStr.Item( "ZOOM" ) = CInt( strItem )
  895. 				End If
  896. 			End If
  897. 		End If
  898. 	End If
  899. 	strDebug = Align( "<u>Setting:</u>", 21 ) & "<u>Value:</u>" & vbCrLf
  900. 	For Each strKey In gvaDefaultsBool.Keys
  901. 		strDebug = strDebug & Align( strKey, 14 ) & gvaSettingsBool.Item( strKey ) & vbCrLf
  902. 	Next
  903. 	For Each strKey In gvaDefaultsStr.Keys
  904. 		strDebug = strDebug & Align( strKey, 14 ) & """" & gvaSettingsStr.Item( strKey ) & """" & vbCrLf
  905. 	Next
  906. 	If gvaSettingsBool.Item( "DEBUG" ) And gvoFSO.FileExists( gvaSettingsStr.Item( "DEBUGLOG" ) ) Then gvoFSO.DeleteFile gvaSettingsStr.Item( "DEBUGLOG" ), True
  907. 	DebugMessage "Settings After Reading " & gvsConfigFile, strDebug
  908. End Sub
  909.  
  910.  
  911. Sub ConfigRemoveFile( )
  912. 	If gvoFSO.FileExists( gvsConfigFile ) Then gvoFSO.DeleteFile gvsConfigFile, True
  913. End Sub
  914.  
  915.  
  916. Sub ConfigReset( )
  917. 	ConfigRemoveFile
  918. 	DisplayConfig.innerHTML = ""
  919. 	ButtonEditCfg.disabled  = True
  920. 	ButtonReset.disabled    = True
  921. 	InputZoomFactor.value   = gvaDefaultsStr.Item( "ZOOM" )
  922. 	ConfigSetDefaults
  923. 	ConfigUpdateStatus
  924. End Sub
  925.  
  926.  
  927. Sub ConfigSaveChanges( )
  928. 	Dim objItem, objOption, strCustomColors, strDebug, strKey
  929. 	With gvoFSO
  930. 		If Not IsEmpty( InputDxDiag.value ) Then
  931. 			If .FolderExists( .GetParentFolderName( InputDxDiag.value ) ) Then
  932. 					InputDxDiag.value = .GetAbsolutePathName( InputDxDiag.value )
  933. 				End If
  934. 		End If
  935. 		If Not IsEmpty( InputDebugLogPath.value ) Then
  936. 			If .FolderExists( .GetParentFolderName( InputDebugLogPath.value ) ) Then
  937. 				InputDebugLogPath.value = .GetAbsolutePathName( InputDebugLogPath.value )
  938. 			End If
  939. 		End If
  940. 	End With
  941. 	gvaSettingsBool.Item( "CM" )        = CheckboxCM.checked
  942. 	gvaSettingsBool.Item( "CHAIN" )     = CheckboxCharacterChains.checked
  943. 	gvaSettingsBool.Item( "DEBUG" )     = CheckboxDebugMode.checked
  944. 	gvaSettingsBool.Item( "DMIDECODE" ) = CheckboxDMIDecode.checked
  945. 	gvaSettingsBool.Item( "DXDIAG" )    = CheckboxDxDiag.checked
  946. 	gvaSettingsBool.Item( "KEEPXML" )   = CheckboxKeepXML.checked
  947. 	gvaSettingsBool.Item( "NOUPD" )     = Not CheckboxCheckUpd.checked
  948. 	gvaSettingsBool.Item( "NOSCORES" )  = Not CheckboxScores.checked
  949. 	gvaSettingsBool.Item( "USBSTOR" )   = CheckboxUSBSTOR.checked
  950. 	gvaSettingsBool.Item( "VIRTUAL" )   = CheckboxVirtual.checked
  951. 	If gvaSettingsStr.Item( "XML" ) <> "" Then
  952. 		If InputDxDiag.value <> "" Then
  953. 			gvaSettingsStr.Item( "XML" ) = gvaDefaultsStr.Item( "XML" )
  954. 		Else
  955. 			gvaSettingsStr.Item( "XML" ) = InputDxDiag.value
  956. 		End If
  957. 	End If
  958. 	If InputDebugLogPath.value = "" Then
  959. 		gvaSettingsStr.Item( "DEBUGLOG" ) = gvaDefaultsStr.Item( "DEBUGLOG" )
  960. 	Else
  961. 		gvaSettingsStr.Item( "DEBUGLOG" ) = InputDebugLogPath.value
  962. 	End If
  963. 	If ThemeBlue.checked Then
  964. 		gvaSettingsStr.Item( "THEME" )        = "ThemeBlue"
  965. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = "darkblue;white;red;silver;black;yellow"
  966. 	ElseIf ThemeDark.checked Then
  967. 		gvaSettingsStr.Item( "THEME" )        = "ThemeDark"
  968. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = "black;white;gold;slategray;snow;red"
  969. 	ElseIf ThemeBW.checked Then
  970. 		gvaSettingsStr.Item( "THEME" )        = "ThemeBW"
  971. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = gvaDefaultsStr.Item( "CUSTOMCOLORS" )
  972. 	ElseIf ThemeRed.checked Then
  973. 		gvaSettingsStr.Item( "THEME" )        = "ThemeRed"
  974. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = "red;yellow;darkblue;silver;black;white"
  975. 	ElseIf ThemeCustom.checked Then
  976. 		For Each objOption In BackgroundColor.options
  977. 			If objOption.selected Then strCustomColors = objOption.value
  978. 		Next
  979. 		For Each objOption In CaptionsColor.options
  980. 			If objOption.selected Then strCustomColors = strCustomColors & ";" & objOption.value
  981. 		Next
  982. 		For Each objOption In LinksColor.options
  983. 			If objOption.selected Then strCustomColors = strCustomColors & ";" & objOption.value
  984. 		Next
  985. 		For Each objOption In ButtonFaceColor.options
  986. 			If objOption.selected Then strCustomColors = strCustomColors & ";" & objOption.value
  987. 		Next
  988. 		For Each objOption In ButtonCaptionsColor.options
  989. 			If objOption.selected Then strCustomColors = strCustomColors & ";" & objOption.value
  990. 		Next
  991. 		For Each objOption In CodeColor.options
  992. 			If objOption.selected Then strCustomColors = strCustomColors & ";" & objOption.value
  993. 		Next
  994. 		gvaSettingsStr.Item( "THEME" )        = "ThemeCustom"
  995. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = LCase( strCustomColors )
  996. 	End If
  997. 	If Not InputZoomFactor.value = gvaSettingsStr.Item( "ZOOM" ) Then
  998. 		If IsEmpty( InputZoomFactor.value ) Then
  999. 			InputZoomFactor.value = 100
  1000. 		Else
  1001. 			InputZoomFactor.value = Min( 250, Max( 50, InputZoomFactor.value ) )
  1002. 		End If
  1003. 		gvaSettingsStr.Item( "ZOOM" ) = InputZoomFactor.value
  1004. 		document.body.style.zoom = gvaSettingsStr.Item( "ZOOM" ) & "%"
  1005. 	End If
  1006. 	If ConfigTestIfDefault( ) Then
  1007. 		If gvoFSO.FileExists( gvsConfigFile ) Then
  1008. 			strDebug = "Deleting config file"
  1009. 			gvoFSO.DeleteFile gvsConfigFile, True
  1010. 		End If
  1011. 		DebugMessage "Save settings was clicked, but all settings are default", strDebug
  1012. 		ButtonReset.disabled = True
  1013. 	Else
  1014. 		strDebug = Align( "<u>Setting:</u>", 21 ) & "<u>Value:</u>" & vbCrLf
  1015. 		For Each strKey In gvaSettingsBool.Keys
  1016. 			strDebug = strDebug & Align( strKey, 14 ) & gvaSettingsBool.Item( strKey ) & vbCrLf
  1017. 		Next
  1018. 		For Each strKey In gvaSettingsStr.Keys
  1019. 			strDebug = strDebug & Align( strKey, 14 ) & """" & gvaSettingsStr.Item( strKey ) & """" & vbCrLf
  1020. 		Next
  1021. 		DebugMessage "Settings After Saving Changes", strDebug
  1022. 	End If
  1023. End Sub
  1024.  
  1025.  
  1026. Sub ConfigSaveFile( )
  1027. 	Dim objFile
  1028. 	dim strConfig, strKey
  1029. 	If ConfigTestIfDefault( ) Then
  1030. 		If gvoFSO.FileExists( gvsConfigFile ) Then
  1031. 			gvoFSO.DeleteFile gvsConfigFile, True
  1032. 			MsgBox "Since all settings are back to their default values, """ & gvsConfigFile & """ has been deleted", vbOKOnly, "Save Settings"
  1033. 		Else
  1034. 			MsgBox "Since all settings have their default values, nothing was saved", vbOKOnly, "Save Settings"
  1035. 		End If
  1036. 	Else
  1037. 		strConfig = ""
  1038. 		For Each strKey In gvaSettingsBool.Keys
  1039. 			If gvaSettingsBool.Item( strKey ) Then
  1040. 				strConfig = strConfig & " /" & strKey
  1041. 			End If
  1042. 		Next
  1043. 		If gvaSettingsBool.Item( "DXDIAG" ) And ( gvaSettingsStr.Item( "XML" ) <> "" ) Then
  1044. 			strConfig = strConfig & " /XML:" & gvaSettingsStr.Item( "XML" )
  1045. 		End If
  1046. 		If gvaSettingsStr.Item( "COMPUTER" ) <> "" Then
  1047. 			If UCase( gvaSettingsStr.Item( "COMPUTER" ) ) <> UCase( GetLocalComputerName ) Then
  1048. 				strConfig = strConfig & " /COMPUTER:" & UCase( gvaSettingsStr.Item( "COMPUTER" ) )
  1049. 			End If
  1050. 		End If
  1051. 		If gvaSettingsStr.Item( "THEME" ) <> "" And gvaSettingsStr.Item( "THEME" ) <> "ThemeBW" Then
  1052. 			strConfig = strConfig & " /THEME:" & Mid( gvaSettingsStr.Item( "THEME" ), 6 )
  1053. 			If gvaSettingsStr.Item( "THEME" ) = "ThemeCustom" Then
  1054. 				If gvaSettingsStr.Item( "CUSTOMCOLORS" ) <> "" Then
  1055. 					strConfig = Trim( strConfig & " /CUSTOMCOLORS:" & LCase( gvaSettingsStr.Item( "CUSTOMCOLORS" ) ) )
  1056. 				End If
  1057. 			End If
  1058. 		End If
  1059. 		If Not CInt( gvaSettingsStr.Item( "ZOOM" ) ) = 100 Then
  1060. 			strConfig = strConfig & " /ZOOM:" & gvaSettingsStr.Item( "ZOOM" )
  1061. 		End If
  1062. 		Set objFile = gvoFSO.OpenTextFile( gvsConfigFile, ForWriting, True, TristateFalse )
  1063. 		objFile.Write strConfig
  1064. 		objFile.Close
  1065. 		Set objFile = Nothing
  1066. 		DisplayConfig.innerHTML = strConfig
  1067. 		MsgBox "The new settings have been saved in """ & gvsConfigFile & """", vbOKOnly + vbInformation + vbApplicationModal, "Settings saved"
  1068. 		DebugMessage "Saving Settings to " & gvsConfigFile, strConfig
  1069. 	End If
  1070. End Sub
  1071.  
  1072.  
  1073. Sub ConfigSetDefaults( )
  1074. 		Dim strKey
  1075. 		For Each strKey In gvaDefaultsBool.Keys
  1076. 			gvaSettingsBool.Item( strKey ) = gvaDefaultsBool.Item( strKey )
  1077. 		Next
  1078. 		For Each strKey In gvaDefaultsStr.Keys
  1079. 			gvaSettingsStr.Item( strKey ) = gvaDefaultsStr.Item( strKey )
  1080. 		Next
  1081. End Sub
  1082.  
  1083.  
  1084. Function ConfigTestIfDefault( )
  1085. 	Dim blnStart, objChkBx, strTest
  1086. 	' In debug mode (best set on the command line), show a MessageBox with checkbox settings vs defaults
  1087. 	If gvaSettingsBool.Item( "DEBUG" ) Or ( InStr( gvsCommandlineUC, "/DEBUG" ) > 0 ) Then
  1088. 		blnStart = False
  1089. 		strTest = Align( "CHECKBOX", 23 ) & vbTab & Align( "CHECKED", 7 ) & vbTab & "BY DEFAULT" & vbCrLf _
  1090. 		        & Align( "=======",  23 ) & vbTab & Align( "======",  7 ) & vbTab & "========"   & vbCrLf & vbCrLf
  1091. 		For Each objChkBx In document.getElementsByTagName( "input" )
  1092. 			If objChkBx.type = "checkbox" Then
  1093. 				If InStr( objChkBx.id, "DMIDecode" ) > 0 Then
  1094. 					blnStart = True
  1095. 				End If
  1096. 				If blnStart Then
  1097. 					strTest = strTest & Align( objChkBx.id, 23 ) & vbTab & Align( objChkBx.checked, 20 ) & vbTab
  1098. 					If objChkBx.id = "CheckboxCM"              Then strTest = strTest & gvaDefaultsBool.Item( "CM" )
  1099. 					If objChkBx.id = "CheckboxCharacterChains" Then strTest = strTest & gvaDefaultsBool.Item( "CHAIN" )
  1100. 					If objChkBx.id = "CheckboxDebugMode"       Then strTest = strTest & gvaDefaultsBool.Item( "DEBUG" )
  1101. 					If objChkBx.id = "CheckboxDMIDecode"       Then strTest = strTest & gvaDefaultsBool.Item( "DMIDECODE" )
  1102. 					If objChkBx.id = "CheckboxDxDiag"          Then strTest = strTest & gvaDefaultsBool.Item( "DXDIAG" )
  1103. 					If objChkBx.id = "CheckboxKeepXML"         Then strTest = strTest & gvaDefaultsBool.Item( "KEEPXML" )
  1104. 					If objChkBx.id = "CheckboxCheckUpd"        Then strTest = strTest & Not gvaDefaultsBool.Item( "NOUPD" )
  1105. 					If objChkBx.id = "CheckboxScores"          Then strTest = strTest & Not gvaDefaultsBool.Item( "NOSCORES" )
  1106. 					If objChkBx.id = "CheckboxUSBSTOR"         Then strTest = strTest & gvaDefaultsBool.Item( "USBSTOR" )
  1107. 					If objChkBx.id = "CheckboxVirtual"         Then strTest = strTest & gvaDefaultsBool.Item( "VIRTUAL" )
  1108. 					strTest = strTest & vbCrLf
  1109. 				End If
  1110. 			End if
  1111. 		Next
  1112. 		MsgBox strTest, vbOKOnly, "Debugging Info for ConfigTestIfDefault( )"
  1113. 	End If ' end of debugging code
  1114.  
  1115. 	' Check all checkboxes in Settings screen and compare with defaults
  1116. 	If Not ( CheckboxCM.checked = gvaSettingsBool.Item( "CM" ) ) Then
  1117. 		ConfigTestIfDefault = False
  1118. 		Exit Function
  1119. 	End If
  1120. 	If Not ( CheckboxCharacterChains.checked = gvaDefaultsBool.Item( "CHAIN" ) ) Then
  1121. 		ConfigTestIfDefault = False
  1122. 		Exit Function
  1123. 	End If
  1124. 	If Not ( CheckboxDebugMode.checked = gvaDefaultsBool.Item( "DEBUG" ) ) Then
  1125. 		ConfigTestIfDefault = False
  1126. 		Exit Function
  1127. 	End If
  1128. 	If Not ( CheckboxDMIDecode.checked = gvaDefaultsBool.Item( "DMIDECODE" ) ) Then
  1129. 		ConfigTestIfDefault = False
  1130. 		Exit Function
  1131. 	End If
  1132. 	If Not ( CheckboxDxDiag.checked = gvaDefaultsBool.Item( "DXDIAG" ) ) Then
  1133. 		ConfigTestIfDefault = False
  1134. 		Exit Function
  1135. 	End If
  1136. 	If Not ( CheckboxKeepXML.checked = gvaDefaultsBool.Item( "KEEPXML" ) ) Then
  1137. 		ConfigTestIfDefault = False
  1138. 		Exit Function
  1139. 	End If
  1140. 	If ( CheckboxCheckUpd.checked = gvaDefaultsBool.Item( "NOUPD" ) ) Then
  1141. 		ConfigTestIfDefault = False
  1142. 		Exit Function
  1143. 	End If
  1144. 	If ( CheckboxScores.checked = gvaDefaultsBool.Item( "NOSCORES" ) ) Then
  1145. 		ConfigTestIfDefault = False
  1146. 		Exit Function
  1147. 	End If
  1148. 	If Not ( CheckboxUSBSTOR.checked = gvaDefaultsBool.Item( "USBSTOR" ) ) Then
  1149. 		ConfigTestIfDefault = False
  1150. 		Exit Function
  1151. 	End If
  1152. 	If Not ( CheckboxVirtual.checked = gvaDefaultsBool.Item( "VIRTUAL" ) ) Then
  1153. 		ConfigTestIfDefault = False
  1154. 		Exit Function
  1155. 	End If
  1156. 	If gvaSettingsStr.Item( "THEME" ) = "" Then
  1157. 		gvaSettingsStr.Item( "THEME" )        = gvaDefaultsStr.Item( "THEME" )
  1158. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = gvaDefaultsStr.Item( "CUSTOMCOLORS" )
  1159. 		document.getElementById( gvaDefaultsStr.Item( "THEME" ) ).checked = True
  1160. 	End If
  1161. 	If ThemeCustom.checked Or ThemeBlue.checked Or ThemeDark.checked Or ThemeRed.checked Then
  1162. 		ConfigTestIfDefault = False
  1163. 		Exit Function
  1164. 	End If
  1165. 	ConfigTestIfDefault = True
  1166. End Function
  1167.  
  1168.  
  1169. Sub ConfigUpdateStatus( )
  1170. 	Dim arrCustomColors, colElements, objElement, objOption
  1171. 	If gvaSettingsBool.Item( "BASIC" ) Then
  1172. 		ButtonBasic.value     = "Full"
  1173. 		ButtonBasic.accessKey = "f"
  1174. 	Else
  1175. 		ButtonBasic.value     = "Basic"
  1176. 		ButtonBasic.accessKey = "b"
  1177. 	End If
  1178. 	ButtonDeleteXML.disabled        = Not gvoFSO.FileExists( gvaSettingsStr.Item( "XML" ) )
  1179. 	CheckboxCM.checked              = gvaSettingsBool.Item( "CM" )
  1180. 	CheckboxCharacterChains.checked = gvaSettingsBool.Item( "CHAIN" )
  1181. 	CheckboxDebugMode.checked       = gvaSettingsBool.Item( "DEBUG" )
  1182. 	CheckDMIDecode
  1183. 	CheckboxDMIDecode.checked       = gvaSettingsBool.Item( "DMIDECODE" )
  1184. 	CheckboxDMIDecode.disabled      = gvbWinPE
  1185. 	CheckboxDxDiag.checked          = gvaSettingsBool.Item( "DXDIAG" ) And Not gvbWinPE
  1186. 	CheckboxDxDiag.disabled         = gvbWinPE
  1187. 	CheckboxKeepXML.checked         = gvaSettingsBool.Item( "KEEPXML" ) And gvaSettingsBool.Item( "DXDIAG" ) And Not gvbWinPE
  1188. 	CheckboxKeepXML.disabled        = gvbWinPE
  1189. 	CheckboxCheckUpd.checked        = Not gvaSettingsBool.Item( "NOUPD" )
  1190. 	CheckboxScores.checked          = Not gvaSettingsBool.Item( "NOSCORES" )
  1191. 	CheckboxUSBSTOR.checked         = gvaSettingsBool.Item( "USBSTOR" )
  1192. 	CheckboxVirtual.checked         = gvaSettingsBool.Item( "VIRTUAL" )
  1193. 	ComputerName.value              = gvaSettingsStr.Item( "COMPUTER" )
  1194. 	InputDxDiag.value               = gvaSettingsStr.Item( "XML" )
  1195. 	InputDxDiag.readonly            = Not CheckboxDxDiag.checked Or gvbWinPE
  1196. 	InputDebugLogPath.value         = gvaSettingsStr.Item( "DEBUGLOG" )
  1197. 	InputDebugLogPath.disabled      = Not gvaSettingsBool.Item( "DEBUG" )
  1198. 	If gvaSettingsStr.Item( "THEME" ) = "" Then
  1199. 		ThemeBW.checked = True
  1200. 	Else
  1201. 		document.getElementById( gvaSettingsStr.Item( "THEME" ) ).checked = True
  1202. 	End If
  1203. 	If ThemeCustom.checked Then
  1204. 		arrCustomColors = Split( gvaSettingsStr.Item( "CUSTOMCOLORS" ), ";" )
  1205. 		For Each objOption In BackgroundColor.options
  1206. 			objOption.selected = ( objOption.value = arrCustomColors(0) )
  1207. 		Next
  1208. 		For Each objOption In CaptionsColor.options
  1209. 			objOption.selected = ( objOption.value = arrCustomColors(1) )
  1210. 		Next
  1211. 		For Each objOption In LinksColor.options
  1212. 			objOption.selected = ( objOption.value = arrCustomColors(2) )
  1213. 		Next
  1214. 		For Each objOption In ButtonFaceColor.options
  1215. 			objOption.selected = ( objOption.value = arrCustomColors(3) )
  1216. 		Next
  1217. 		For Each objOption In ButtonCaptionsColor.options
  1218. 			objOption.selected = ( objOption.value = arrCustomColors(4) )
  1219. 		Next
  1220. 		For Each objOption In CodeColor.options
  1221. 			objOption.selected = ( objOption.value = arrCustomColors(5) )
  1222. 		Next
  1223. 	ElseIf ThemeBlue.checked Then
  1224. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = "darkblue;white;red;silver;black;yellow"
  1225. 		arrCustomColors                       = Split( gvaSettingsStr.Item( "CUSTOMCOLORS" ), ";" )
  1226. 	ElseIf ThemeDark.checked Then
  1227. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = "black;white;gold;slategray;snow;red"
  1228. 		arrCustomColors                       = Split( gvaSettingsStr.Item( "CUSTOMCOLORS" ), ";" )
  1229. 	ElseIf ThemeRed.checked Then
  1230. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = "red;yellow;darkblue;silver;black;white"
  1231. 		arrCustomColors                       = Split( gvaSettingsStr.Item( "CUSTOMCOLORS" ), ";" )
  1232. 	Else
  1233. 		gvaSettingsStr.Item( "CUSTOMCOLORS" ) = gvaDefaultsStr.Item( "CUSTOMCOLORS" )
  1234. 		arrCustomColors                       = Split( gvaSettingsStr.Item( "CUSTOMCOLORS" ), ";" )
  1235. 	End If
  1236. 	ListColors     "BackgroundColor",     arrCustomColors(0)
  1237. 	ListColors     "CaptionsColor",       arrCustomColors(1)
  1238. 	ListColors     "LinksColor",          arrCustomColors(2)
  1239. 	ListColors     "ButtonFaceColor",     arrCustomColors(3)
  1240. 	ListColors     "ButtonCaptionsColor", arrCustomColors(4)
  1241. 	ListColors     "CodeColor",           arrCustomColors(5)
  1242. 	SetCustomColor "BackgroundColor"
  1243. 	SetCustomColor "CaptionsColor"
  1244. 	SetCustomColor "LinksColor"
  1245. 	SetCustomColor "ButtonFaceColor"
  1246. 	SetCustomColor "ButtonCaptionsColor"
  1247. 	SetCustomColor "CodeColor"
  1248. 	document.body.style.zoom = gvaSettingsStr.Item( "ZOOM" ) & "%"
  1249. 	EnableWinSATScores
  1250. End Sub
  1251.  
  1252.  
  1253. Sub CopyToClipboard
  1254. 	On Error Resume Next ' REQUIRED
  1255. 	Document.parentWindow.clipboardData.setData "text", gvsHeader & vbCrLf & gvsCSVTxt & vbCrLf
  1256. 	If Err Then
  1257. 		MsgBox "An error occurred while trying to copy data to the clipboard:" & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Clipboard Error"
  1258. 	End If
  1259. 	On Error Goto 0
  1260. End Sub
  1261.  
  1262.  
  1263. Sub CreateDebugLogFile( )
  1264. 	Dim objDebugLog, strHTML
  1265. 	' Header for new debugging log file; note the "refresh" meta tag, allowing dynamic updates of the displayed log
  1266. 	strHTML = "<!DOCTYPE html>" & vbCrLf _
  1267. 	        & "<html lang=""en"">" _
  1268. 	        & vbCrLf _
  1269. 	        & "<head>" _
  1270. 	        & vbCrLf _
  1271. 	        & "<title>Basic Hardware Inventory Debugging Log " & gvsComputer & "</title>" _
  1272. 	        & vbCrLf _
  1273. 	        & "<meta http-equiv=""refresh"" content=""5"">" _
  1274. 	        & vbCrLf _
  1275. 	        & "</head>" _
  1276. 	        & vbCrLf _
  1277. 	        & "<body>" _
  1278. 	        & vbCrLf _
  1279. 	        & "<pre>" _
  1280. 	        & vbCrLf
  1281. 	' Create the new debugging log file, then close it
  1282. 	Set objDebugLog = gvoFSO.OpenTextFile( gvaSettingsStr.Item( "DEBUGLOG" ), ForWriting, True )
  1283. 	objDebugLog.Write strHTML
  1284. 	objDebugLog.Close
  1285. 	Set objDebugLog = Nothing
  1286. 	' Open the new debugging log file in the default browser (requires .html log file extension)
  1287. 	gvoWSHShell.Run gvaSettingsStr.Item( "DEBUGLOG" ), 7, False
  1288. End Sub
  1289.  
  1290.  
  1291. Function CreateLine( strProperty )
  1292. 	' This subroutine will split up a string into separate words:
  1293. 	' "SCSILogicalUnit" will be converted to "SCSI Logical Unit"
  1294. 	Dim chrA, chrB, chrC
  1295. 	Dim i, j, k
  1296. 	Dim strCaps, strLowc, strPropDescr
  1297.  
  1298. 	strPropDescr = strProperty
  1299. 	strCaps      = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  1300. 	strLowc      = LCase( strCaps )
  1301. 	' Default value, in case something goes wrong
  1302. 	CreateLine   = strProperty
  1303. 	i = 0
  1304. 	Do
  1305. 		i = i + 1
  1306. 		j = i + 1
  1307. 		If j >= Len( strPropDescr ) Then Exit Do
  1308. 		chrA = Mid( strPropDescr, i, 1 )
  1309. 		chrB = Mid( strPropDescr, j, 1 )
  1310. 		If InStr( strLowc, chrA ) > 0 And InStr( strCaps, chrB ) > 0 Then
  1311. 			strPropDescr = Left( strPropDescr, i ) & " " & Mid( strPropDescr, j )
  1312. 			i = i + 2
  1313. 			j = i + 1
  1314. 		End If
  1315. 	Loop
  1316. 	If Len( strPropDescr ) > 2 Then
  1317. 		i = 0
  1318. 		Do
  1319. 			i = i + 1
  1320. 			j = i + 1
  1321. 			k = i + 2
  1322. 			If k >= Len( strPropDescr ) Then Exit Do
  1323. 			chrA = Mid( strPropDescr, i, 1 )
  1324. 			chrB = Mid( strPropDescr, j, 1 )
  1325. 			chrC = Mid( strPropDescr, k, 1 )
  1326. 			If InStr( strCaps, chrA ) > 0 And InStr( strCaps, chrB ) > 0 And InStr( strLowc, chrC ) > 0 Then
  1327. 				strPropDescr = Left( strPropDescr, i ) & " " & Mid( strPropDescr, j )
  1328. 				i = i + 3
  1329. 				j = i + 1
  1330. 				k = i + 2
  1331. 			End If
  1332. 		Loop
  1333. 	End If
  1334. 	CreateLine = strPropDescr
  1335. End Function
  1336.  
  1337.  
  1338. Sub DebugMessage( myTitle, myMessage )
  1339. 	' If Debug Logging is enabled, create or open a debug log file, and append a debugging message
  1340. 	Dim objDebugLog, objRE, strDebugText
  1341. 	On Error Resume Next ' REQUIRED
  1342. 	If gvaSettingsBool.Item( "DEBUG" ) Then
  1343. 		If gvoFSO.FileExists( gvaSettingsStr.Item( "DEBUGLOG" ) ) Then
  1344. 			' Open existing log file and remove closing tags at the end of the HTML content
  1345. 			Set objDebugLog = gvoFSO.OpenTextFile( gvaSettingsStr.Item( "DEBUGLOG" ) )
  1346. 			strDebugText = objDebugLog.ReadAll( )
  1347. 			objDebugLog.Close
  1348. 			Set objRE = New RegExp
  1349. 			objRE.Global     = True
  1350. 			objRE.IgnoreCase = True
  1351. 			objRE.Pattern    = "</pre>\s*</body>\s*</html>\s*$"
  1352. 			Set objDebugLog = gvoFSO.OpenTextFile( gvaSettingsStr.Item( "DEBUGLOG" ), ForWriting, True )
  1353. 			objDebugLog.Write objRE.Replace( strDebugText, "" )
  1354. 			objDebugLog.Close
  1355. 			Set objDebugLog = Nothing
  1356. 		Else
  1357. 			' Create a new debugging log file and open it in the default browser
  1358. 			CreateDebugLogFile
  1359. 		End If
  1360. 		' Append debugging message to log file
  1361. 		Set objDebugLog = gvoFSO.OpenTextFile( gvaSettingsStr.Item( "DEBUGLOG" ), ForAppending, True )
  1362. 		If ( Trim( myTitle ) = "" ) Then
  1363. 			objDebugLog.WriteLine "[" & TimeStamp( ) & "] " & myMessage
  1364. 		Else
  1365. 			objDebugLog.WriteLine "[" & TimeStamp( ) & "] " & myTitle & vbCrLf & String( Len( myTitle ), "-" ) & vbCrLf & myMessage
  1366. 		End If
  1367. 		' Append closing tags at the end of the HTML content
  1368. 		objDebugLog.WriteLine vbCrLf & vbCrLf & "</pre>" & vbCrLf & "</body>" & vbCrLf & "</html>"
  1369. 		' Close the log file
  1370. 		objDebugLog.Close
  1371. 		Set objDebugLog = Nothing
  1372. 	End If
  1373. 	On Error GoTo 0
  1374. End Sub
  1375.  
  1376.  
  1377. Sub DeleteDxDiagXML( )
  1378. 	If InputDxDiag.value <> "" Then
  1379. 		On Error Resume Next ' REQUIRED
  1380. 		If gvoFSO.FileExists( InputDxDiag.value ) Then
  1381. 			gvoFSO.DeleteFile InputDxDiag.value, True
  1382. 		End If
  1383. 		If Err Then
  1384. 			MsgBox "Error while trying to delete the existing DxDiag XML file" & vbCrLf & """" & InputDxDiag.value & """", vbOKOnly + vbExclamation + vbApplicationModal, "File Delete Error"
  1385. 			Err.Clear
  1386. 		End If
  1387. 		On Error Goto 0
  1388. 	End If
  1389. 	ButtonDeleteXML.disabled = True
  1390. End Sub
  1391.  
  1392.  
  1393. Sub DetailsBIOS( )
  1394. 	gvsDetails = HandleClass( "Win32_BIOS", "root/CIMV2" )
  1395. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1396. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLValue( "/DxDiag/SystemInformation/BIOS" )
  1397. 	End If
  1398. 	If gvaSettingsBool.Item( "DMIDECODE" ) Then
  1399. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "BIOS" )
  1400. 	End If
  1401. 	DetailsWindow "BIOS", gvsDetails
  1402. End Sub
  1403.  
  1404.  
  1405. Sub DetailsCDROM( )
  1406. 	gvsDetails = HandleClass( "Win32_CDROMDrive",           "root/CIMV2" ) & vbCrLf & vbCrLf _
  1407. 	           & HandleClass( "Win32_IDEController",        "root/CIMV2" ) & vbCrLf & vbCrLf _
  1408. 	           & HandleClass( "Win32_SCSIController",       "root/CIMV2" ) & vbCrLf & vbCrLf _
  1409. 	           & HandleClass( "Win32_IDEControllerDevice",  "root/CIMV2" ) & vbCrLf & vbCrLf _
  1410. 	           & HandleClass( "Win32_SCSIControllerDevice", "root/CIMV2" )
  1411. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1412. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/LogicalDisks/LogicalDisk[HardDriveIndex = 0 and FileSystem <= """"]" )
  1413. 	End If
  1414. 	DetailsWindow "CD/DVD-ROM Drives and Controllers", gvsDetails
  1415. End Sub
  1416.  
  1417.  
  1418. Sub DetailsCPU( )
  1419. 	gvsDetails = HandleClass( "Win32_Processor", "root/CIMV2" ) & vbCrLf & vbCrLf _
  1420. 	           & HandleClass( "Win32_WinSAT",    "root/CIMV2" )
  1421. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1422. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLValue( "/DxDiag/SystemInformation/Processor" )
  1423. 	End If
  1424. 	If gvaSettingsBool.Item( "DMIDECODE" ) Then
  1425. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "Processor" )
  1426. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "Cache" )
  1427. 	End If
  1428. 	DetailsWindow "CPU", gvsDetails
  1429. End Sub
  1430.  
  1431.  
  1432. Sub DetailsFDD( )
  1433. 	On Error Resume Next ' REQUIRED
  1434. 	gvsDetails = HandleClass( "MSFT_Volume",         "root/Microsoft/Windows/Storage" ) & vbCrLf & vbCrLf _
  1435. 	           & HandleClass( "Win32_LogicalDisk",   "root/CIMV2" ) & vbCrLf & vbCrLf _
  1436. 	           & HandleClass( "Win32_PortConnector", "root/CIMV2" )
  1437. 	DetailsWindow "Floppy Disk Drives and Connectors", gvsDetails
  1438. 	On Error GoTo 0
  1439. End Sub
  1440.  
  1441.  
  1442. Sub DetailsHDD( )
  1443. 	Dim objRE
  1444. 	Set objRE = New RegExp
  1445. 	objRE.Global  = True
  1446. 	objRE.Pattern = vbcrlf & "+"
  1447. 	Set objRE = Nothing
  1448. 	On Error Resume Next ' REQUIRED
  1449. 	gvsDetails = HandleClass( "MSFT_PhysicalDisk",            "root/Microsoft/Windows/Storage" ) & vbCrLf & vbCrLf _
  1450. 	           & HandleClass( "MSFT_Volume",                  "root/Microsoft/Windows/Storage" ) & vbCrLf & vbCrLf _
  1451. 	           & HandleClass( "Win32_DiskDrive",              "root/CIMV2" ) & vbCrLf & vbCrLf _
  1452. 	           & HandleClass( "Win32_LogicalDiskToPartition", "root/CIMV2" ) & vbCrLf & vbCrLf _
  1453. 	           & HandleClass( "Win32_IDEController",          "root/CIMV2" ) & vbCrLf & vbCrLf _
  1454. 	           & HandleClass( "Win32_SCSIController",         "root/CIMV2" ) & vbCrLf & vbCrLf _
  1455. 	           & HandleClass( "Win32_IDEControllerDevice",    "root/CIMV2" ) & vbCrLf & vbCrLf _
  1456. 	           & HandleClass( "Win32_SCSIControllerDevice",   "root/CIMV2" ) & vbCrLf & vbCrLf _
  1457. 	           & HandleClass( "Win32_WinSAT",                 "root/CIMV2" )
  1458. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1459. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/LogicalDisks/LogicalDisk[Model > """" and FileSystem > """"]" )
  1460. 	End If
  1461. 	DetailsWindow "Disk Drives and Controllers", gvsDetails
  1462. 	On Error Goto 0
  1463. End Sub
  1464.  
  1465.  
  1466. Sub DetailsKeyboard( )
  1467. 	On Error Resume Next ' REQUIRED
  1468. 	gvsDetails = HandleClass( "Win32_Keyboard",             "root/CIMV2" ) & vbCrLf & vbCrLf _
  1469. 	           & HandleClass( "MSKeyboard_PortInformation", "root/WMI"   )
  1470. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1471. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/DirectInput" )
  1472. 	End If
  1473. 	DetailsWindow "Keyboard", gvsDetails
  1474. 	On Error Goto 0
  1475. End Sub
  1476.  
  1477.  
  1478. Sub DetailsMainBoard( )
  1479. 	gvsDetails = HandleClass( "Win32_BaseBoard",       "root/CIMV2" ) & vbCrLf & vbCrLf _
  1480. 	           & HandleClass( "Win32_SystemEnclosure", "root/CIMV2" ) & vbCrLf & vbCrLf _
  1481. 	           & HandleClass( "Win32_WinSAT",          "root/CIMV2" )
  1482. 	If gvaSettingsBool.Item( "DMIDECODE" ) Then
  1483. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "Baseboard" )
  1484. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "System" )
  1485. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "Chassis" )
  1486. 	End If
  1487. 	DetailsWindow "Main Board and Chassis", gvsDetails
  1488. End Sub
  1489.  
  1490.  
  1491. Sub DetailsMemory( )
  1492. 	gvsDetails = HandleClass( "Win32_PhysicalMemoryArray", "root/CIMV2" ) & vbCrLf & vbCrLf _
  1493. 	           & HandleClass( "Win32_PhysicalMemory",      "root/CIMV2" ) & vbCrLf & vbCrLf _
  1494. 	           & HandleClass( "Win32_WinSAT",              "root/CIMV2" )
  1495. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1496. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLValue( "/DxDiag/SystemInformation/Memory" )
  1497. 	End If
  1498. 	If gvaSettingsBool.Item( "DMIDECODE" ) Then
  1499. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "Memory" )
  1500. 	End If
  1501. 	DetailsWindow "Memory", gvsDetails
  1502. End Sub
  1503.  
  1504.  
  1505. Sub DetailsMonitor( )
  1506. 	On Error Resume Next ' REQUIRED
  1507. 	gvsDetails = HandleClass( "Win32_DesktopMonitor",         "root/CIMV2" ) & vbCrLf & vbCrLf _
  1508. 	           & HandleClass( "WmiMonitorBasicDisplayParams", "root/WMI"   ) & vbCrLf & vbCrLf _
  1509. 	           & HandleClass( "WmiMonitorID",                 "root/WMI"   ) & vbCrLf & vbCrLf _
  1510. 	           & "<h2>\\" & gvsComputer & "\root\default:StdRegProv</h2>"    & vbcrlf & vbcrlf _
  1511. 	           & "<h3>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY</h3>"  & vbCrLf & vbCrLf _
  1512. 	           & HandleRegEnum( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Enum\DISPLAY", 1 )
  1513. 	DetailsWindow "Monitors", gvsDetails
  1514. 	On Error Goto 0
  1515. End Sub
  1516.  
  1517.  
  1518. Sub DetailsMouse( )
  1519. 	On Error Resume Next ' REQUIRED
  1520. 	gvsDetails = HandleClass( "Win32_PointingDevice",       "root/CIMV2" ) & vbCrLf & vbCrLf _
  1521. 	           & HandleClass( "MSMouse_PortInformation",    "root/WMI"   )
  1522. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1523. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/DirectInput" )
  1524. 	End If
  1525. 	DetailsWindow "Mouse", gvsDetails
  1526. 	On Error Goto 0
  1527. End Sub
  1528.  
  1529.  
  1530. Sub DetailsNIC( )
  1531. 	On Error Resume Next ' REQUIRED
  1532. 	gvsDetails = HandleClass( "MSFT_NetAdapter",                            "root/StandardCimv2" ) & vbCrLf & vbCrLf _
  1533. 	           & HandleClass( "MSFT_NetAdapterAdvancedPropertySettingData", "root/StandardCimv2" ) & vbCrLf & vbCrLf _
  1534. 	           & HandleClass( "Win32_NetworkAdapter",                       "root/CIMV2"         ) & vbCrLf & vbCrLf _
  1535. 	           & HandleClass( "MSNdis_LinkSpeed",                           "root/WMI"           ) & vbCrLf & vbCrLf _
  1536. 	           & HandleClass( "MSNdis_PhysicalMediumType",                  "root/WMI"           )
  1537. 	DetailsWindow "Network Adapter", gvsDetails
  1538. 	On Error Goto 0
  1539. End Sub
  1540.  
  1541.  
  1542. Sub DetailsPorts( )
  1543. 	gvsDetails = HandleClass( "Win32_ParallelPort",            "root/CIMV2" ) & vbCrLf & vbCrLf _
  1544. 	           & HandleClass( "Win32_SerialPort",              "root/CIMV2" ) & vbCrLf & vbCrLf _
  1545. 	           & HandleClass( "Win32_SerialPortConfiguration", "root/CIMV2" ) & vbCrLf & vbCrLf _
  1546. 	           & HandleClass( "Win32_USBController",           "root/CIMV2" ) & vbCrLf & vbCrLf _
  1547. 	           & HandleClass( "Win32_1394ControllerDevice",    "root/CIMV2" ) & vbCrLf & vbCrLf _
  1548. 	           & HandleClass( "Win32_SystemSlot",              "root/CIMV2" ) & vbCrLf & vbCrLf _
  1549. 	           & HandleClass( "Win32_PortConnector",           "root/CIMV2" )
  1550. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1551. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/SystemDevices/SystemDevice" )
  1552. 	End If
  1553. 	If gvaSettingsBool.Item( "DMIDECODE" ) Then
  1554. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "Slot" )
  1555. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleDMIDetails( "Connector" )
  1556. 	End If
  1557. 	DetailsWindow "Ports and Slots", gvsDetails
  1558. End Sub
  1559.  
  1560.  
  1561. Sub DetailsSound( )
  1562. 	gvsDetails = HandleClass( "Win32_SoundDevice", "root/CIMV2" )
  1563. 	gvsDetails = gvsDetails & HandleRegEnum( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Enum\HDAUDIO", True )
  1564. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1565. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/DirectSound/SoundDevices/SoundDevice" )
  1566. 	End If
  1567. 	DetailsWindow "Sound Devices", gvsDetails
  1568. End Sub
  1569.  
  1570.  
  1571. Sub DetailsVideo( )
  1572. 	Dim arrSubKeys, i, intResult, objReg, strKey
  1573. 	gvsDetails = HandleClass( "Win32_VideoController",         "root/CIMV2" ) & vbCrLf & vbCrLf _
  1574. 	           & HandleClass( "CIM_VideoControllerResolution", "root/CIMV2" ) & vbCrLf & vbCrLf _
  1575. 	           & HandleClass( "Win32_WinSAT",                  "root/CIMV2" )
  1576. 	Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//" & gvsComputer & "/root/default:StdRegProv" )
  1577. 	strKey    = "SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}"
  1578. 	intResult = objReg.EnumKey( HKEY_LOCAL_MACHINE, strKey, arrSubKeys )
  1579. 	If intResult = 0 Then
  1580. 		For i = 0 To UBound( arrSubKeys )
  1581. 			If IsNumeric( arrSubKeys(i) ) Then
  1582. 				gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleRegEnum( HKEY_LOCAL_MACHINE, strKey & "\" & arrSubKeys(i), 0 )
  1583. 			End If
  1584. 		Next
  1585. 	End If
  1586. 	Set objReg = Nothing
  1587.  
  1588. 	If gvaSettingsBool.Item( "DXDIAG" ) Then
  1589. 		gvsDetails = gvsDetails & vbCrLf & vbCrLf & HandleXMLNode( "/DxDiag/DisplayDevices/DisplayDevice" )
  1590. 	End If
  1591. 	DetailsWindow "Display Adapters", gvsDetails
  1592. End Sub
  1593.  
  1594.  
  1595. Sub DetailsWindow( strCategory, gvsDetails )
  1596. 	Dim objDetailsFile, strHTMLBody, strHTMLFoot, strHTMLHead
  1597.  
  1598. 	strHTMLHead = "<html><head><title>" & strCategory & " details for " & gvsComputer & "</title></head><body>"
  1599. 	strHTMLBody = "<h1 style=""text-align: center;"">" & strCategory & " details for " & gvsComputer & "</h1> <pre style=""font-family: courier,monospace"">" & gvsDetails & "</pre>"
  1600. 	strHTMLFoot = "</body></html>"
  1601.  
  1602. 	' Create a temporary HTML file and open it in the default browser
  1603. 	Set objDetailsFile = gvoFSO.CreateTextFile( gvsDetailsFile )
  1604. 	objDetailsFile.Write( strHTMLHead )
  1605. 	objDetailsFile.Write( strHTMLBody )
  1606. 	objDetailsFile.Write( strHTMLFoot )
  1607. 	objDetailsFile.Close
  1608. 	Set objDetailsFile = Nothing
  1609. 	gvoWSHShell.Run gvsDetailsFile, , False
  1610. End Sub
  1611.  
  1612.  
  1613. Sub EditSettings( )
  1614. 	gvoWSHShell.Run "notepad.exe """ & gvsConfigFile & """", 1, True
  1615. 	ConfigReadFile
  1616. 	ConfigUpdateStatus
  1617. End Sub
  1618.  
  1619.  
  1620. Sub EnableWinSATScores( )
  1621. 	Dim objItem
  1622. 	' Hide WinSAT Score fields if not applicable
  1623. 	For Each objItem In document.all
  1624. 		If objItem.className = "Scores" Then
  1625. 			If gvaSettingsBool.Item( "NOSCORES" ) Or gvbWinPE Then
  1626. 				objItem.style.display    = "none"
  1627. 				objItem.style.visibility = "collapse"
  1628. 			Else
  1629. 				objItem.style.display    = "table-cell"
  1630. 				objItem.style.visibility = "visible"
  1631. 			End If
  1632. 		End If
  1633. 	Next
  1634. End Sub
  1635.  
  1636.  
  1637. Function GetBusType( myInt )
  1638. 	Dim arrBusTypes, strBusType
  1639. 	strBusType = "Unknown"
  1640. 	arrBusTypes = Split( "Unknown;SCSI;ATAPI;ATA;1394;SSA;Fibre Channel;USB;RAID;iSCSI;SAS;SATA;SD;MMC;Virtual;File Backed Virtual;Storage Spaces;NVMe;Microsoft Reserved", ";" )
  1641. 	If IsNumeric( myInt ) Then
  1642. 		If CInt( myint ) >= 0 And CInt( myInt ) <= UBound( arrBusTypes ) Then
  1643. 			strBusType = arrBusTypes( CInt( myInt ) )
  1644. 		End If
  1645. 	End If
  1646. 	GetBusType = strBusType
  1647. End Function
  1648.  
  1649.  
  1650. Function GetChassis( )
  1651. 	' Based on a script by Guy Thomas http://computerperformance.co.uk/
  1652. 	Dim colChassis, objChassis, strChassis
  1653. 	Set colChassis = gvoWMIrootCimv2.ExecQuery( "Select ChassisTypes from Win32_SystemEnclosure" )
  1654. 	For Each objChassis in colChassis
  1655. 		Select Case objChassis.ChassisTypes(0) ' ChassisTypes is returned as an array of integers
  1656. 			Case 1:
  1657. 				strChassis = "Maybe Virtual Machine"
  1658. 			Case 2:
  1659. 				strChassis = "Unknown"
  1660. 			Case 3:
  1661. 				strChassis = "Desktop"
  1662. 			Case 4:
  1663. 				strChassis = "Thin Desktop"
  1664. 			Case 5:
  1665. 				strChassis = "Pizza Box"
  1666. 			Case  6:
  1667. 				strChassis = "Mini Tower"
  1668. 			Case 7:
  1669. 				strChassis = "Full Tower"
  1670. 			Case 8:
  1671. 				strChassis = "Portable"
  1672. 			Case 9:
  1673. 				strChassis = "Laptop"
  1674. 			Case 10:
  1675. 				strChassis = "Notebook"
  1676. 			Case 11:
  1677. 				strChassis = "Hand Held"
  1678. 			Case 12:
  1679. 				strChassis = "Docking Station"
  1680. 			Case 13:
  1681. 				strChassis = "All in One"
  1682. 			Case 14:
  1683. 				strChassis = "Sub Notebook"
  1684. 			Case 15:
  1685. 				strChassis = "Space-Saving"
  1686. 			Case 16:
  1687. 				strChassis = "Lunch Box"
  1688. 			Case 17:
  1689. 				strChassis = "Main System Chassis"
  1690. 			Case 18:
  1691. 				strChassis = "Lunch Box"
  1692. 			Case 19:
  1693. 				strChassis = "SubChassis"
  1694. 			Case 20:
  1695. 				strChassis = "Bus Expansion Chassis"
  1696. 			Case 21:
  1697. 				strChassis = "Peripheral Chassis"
  1698. 			Case 22:
  1699. 				strChassis = "Storage Chassis"
  1700. 			Case 23:
  1701. 				strChassis = "Rack Mount Unit"
  1702. 			Case 24:
  1703. 				strChassis = "Sealed-Case PC"
  1704. 			Case Else:
  1705. 				strChassis = "Unknown"
  1706. 		End Select
  1707. 	Next
  1708. 	GetChassis = strChassis
  1709. End Function
  1710.  
  1711.  
  1712. Sub GetDefaultBrowser( )
  1713. 	Dim strProgID, wshShell
  1714. 	' Get default browser name
  1715. 	strProgID = gvoWSHShell.RegRead( "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice\ProgID" )
  1716. 	If InStr( strProgID, "-" ) Then
  1717. 		gvsDefaultBrowserName = Left( strProgID, InStr( strProgID, "-" ) - 1 )
  1718. 	Else
  1719. 		gvsDefaultBrowserName = strProgID
  1720. 	End If
  1721. 	If Right( gvsDefaultBrowserName, 4 ) = "HTML" Then gvsDefaultBrowserName = Left( gvsDefaultBrowserName, Len( gvsDefaultBrowserName ) - 4 )
  1722. 	If Right( gvsDefaultBrowserName, 3 ) = "HTM"  Then gvsDefaultBrowserName = Left( gvsDefaultBrowserName, Len( gvsDefaultBrowserName ) - 3 )
  1723. 	If Right( gvsDefaultBrowserName, 3 ) = "URL"  Then gvsDefaultBrowserName = Left( gvsDefaultBrowserName, Len( gvsDefaultBrowserName ) - 3 )
  1724. 	DebugMessage "", "Default browser name = """ & gvsDefaultBrowserName & """"
  1725. 	' Get default browser path
  1726. 	gvsDefaultBrowserPath = gvoWSHShell.RegRead( "HKEY_CLASSES_ROOT\" & strProgID & "\shell\open\command\" )
  1727. 	If Left( gvsDefaultBrowserPath, 1 ) = """" Then
  1728. 		gvsDefaultBrowserPath = Replace( Left( gvsDefaultBrowserPath, InStr( 2, gvsDefaultBrowserPath, """" ) ), """", "" )
  1729. 	ElseIf Not gvsDefaultBrowserPath = "" And Not gvsDefaultBrowserPath = Null Then
  1730. 		gvsDefaultBrowserPath = Left( gvsDefaultBrowserPath, InStr( gvsDefaultBrowserPath, " " ) - 1 )
  1731. 	End If
  1732. 	DebugMessage "", "Default browser path = """ & gvsDefaultBrowserPath & """"
  1733. End Sub
  1734.  
  1735.  
  1736. Function GetHostName( myComputer )
  1737. 	' This function uses a stripped version of my Hostname.cmd (version 3) batch file to get
  1738. 	' the hostname for the specified computer without requiring WMI access to that computer.
  1739. 	Dim objBatFile, objDatFile, strBatFile, strDatFile, strHostName
  1740. 	strHostName = myComputer
  1741. 	strBatFile  = gvoWSHShell.ExpandEnvironmentStrings( "%Temp%.\~hostname.bat" )
  1742. 	strDatFile  = strBatFile & ".dat"
  1743. 	With gvoFSO
  1744. 		If .FileExists( strBatFile ) Then .DeleteFile strBatFile
  1745. 		If .FileExists( strDatFile ) Then .DeleteFile strDatFile
  1746. 		Set objBatFile = .OpenTextFile( strBatFile, ForWriting, True, TristateFalse )
  1747. 		objBatFile.WriteLine "@ECHO OFF"
  1748. 		objBatFile.WriteLine "SETLOCAL ENABLEDELAYEDEXPANSION"
  1749. 		objBatFile.WriteLine "ECHO ""%~1"" | FIND.EXE "":"" >NUL && SET IPv4=|| SET IPv4=-4"
  1750. 		objBatFile.WriteLine "PING.EXE -a %1 %IPv4% -n 1 -w 100 | FIND.EXE ""["" >NUL && FOR /F ""tokens=2 delims=[]"" %%A IN ('PING.EXE -a %1 %IPv4% -n 1 -w 100 ^| FIND.EXE ""[""') DO FOR /F ""tokens=1,2 delims=[]"" %%B IN ('PING.EXE -a %%A %IPv4% -n 1 -w 100 ^| FIND.EXE ""[""') DO (FOR %%D IN (%%B) DO SET HostName=%%D)& FOR /F ""delims=."" %%E IN (""!HostName!"") DO (>""%~f0.dat"" ECHO.%%E)"
  1751. 		objBatFile.WriteLine "ENDLOCAL"
  1752. 		objBatFile.Close
  1753. 		Set objBatFile = Nothing
  1754. 		gvoWSHShell.Run strBatFile & " " & strHostName, 7, True
  1755. 		Sleep 1
  1756. 		.DeleteFile strBatFile
  1757. 		Set objDatFile = .OpenTextFile( strDatFile, ForReading, False, TristateFalse )
  1758. 		strHostName = objDatFile.ReadLine( )
  1759. 		objDatFile.Close
  1760. 		Set objDatFile = Nothing
  1761. 		.DeleteFile strDatFile
  1762. 	End With
  1763. 	GetHostName = strHostName
  1764. End Function
  1765.  
  1766.  
  1767. Function GetLocalComputerName( )
  1768. 	If gvbWinPE Then
  1769. 		GetLocalComputerName = GetLocalComputerNameWinPE( )
  1770. 	Else
  1771. 		GetLocalComputerName = UCase( gvoWSHShell.ExpandEnvironmentStrings( "%ComputerName%" ) )
  1772. 	End If
  1773. End Function
  1774.  
  1775.  
  1776. Function GetLocalComputerNameWinPE( )
  1777. ' Find computer name in WinPE
  1778. ' Based on code by Richie Schuster
  1779. ' http://www.sccmog.com/get-current-old-machine-name-winpe-vbscript/
  1780. ' Caveat: In case of a multi-boot system with multiple computer names, the script
  1781. '         only returns the computer name of the last Windows installation it finds
  1782. 	Dim colItems, objItem, objWMIService
  1783. 	GetLocalComputerNameWinPE = "localhost"
  1784. 	On Error Resume Next ' REQUIRED
  1785. 	' Find the Windows drive
  1786. 	If gvsWinDrive = "" Then
  1787. 		Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
  1788. 		Set colItems      = objWMIService.ExecQuery ( "SELECT * FROM Win32_LogicalDisk" )
  1789. 		For Each objItem in colItems
  1790. 			If gvoFSO.FolderExists( gvoFSO.BuildPath( objItem.DeviceID, "Windows\System32" ) ) Then
  1791. 				gvsWinDrive = objItem.DeviceID
  1792. 			End If
  1793. 		Next
  1794. 	End If
  1795. 	If gvsWinDrive <> "" Then
  1796. 		' Mount registry hive from Windows drive
  1797. 		gvoWSHShell.Run "CMD.EXE /C REG.EXE Load HKLM\TempHive " & gvsWinDrive & "\windows\system32\config\system", 0, True
  1798. 		' Read computer name from mounted registry hive
  1799. 		GetLocalComputerNameWinPE = UCase( gvoWSHShell.RegRead( "HKEY_LOCAL_MACHINE\TempHive\ControlSet001\Control\ComputerName\ComputerName\ComputerName" ) )
  1800. 		' Unmount registry hive from Windows drive
  1801. 		gvoWSHShell.Run "CMD.EXE /C REG.EXE Load HKLM\TempHive", 0, True
  1802. 	End If
  1803. 	Set colItems      = Nothing
  1804. 	Set objWMIService = Nothing
  1805. 	On Error Goto 0
  1806. End Function
  1807.  
  1808.  
  1809. Function GetMediaType( mtnumber )
  1810. 	Dim strMediaTypeDescription
  1811. 	strMediaTypeDescription = "Unknown"
  1812. 	Select Case mtnumber
  1813. 		Case 1:
  1814. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 1.2 MB"
  1815. 		Case 2:
  1816. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 1.44 MB"
  1817. 		Case 3:
  1818. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 2.88 MB"
  1819. 		Case 4:
  1820. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 20.8 MB"
  1821. 		Case 5:
  1822. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 720 KB"
  1823. 		Case 6:
  1824. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 360 KB"
  1825. 		Case 7:
  1826. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 320 KB"
  1827. 		Case 8:
  1828. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 320 KB"
  1829. 		Case 9:
  1830. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 180 KB"
  1831. 		Case 10:
  1832. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 160 KB"
  1833. 		Case 11:
  1834. 			strMediaTypeDescription = "Removable media other than floppy"
  1835. 		Case 12:
  1836. 			strMediaTypeDescription = "Fixed hard disk media"
  1837. 		Case 13:
  1838. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 120 MB"
  1839. 		Case 14:
  1840. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 640 KB"
  1841. 		Case 15:
  1842. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 640 KB"
  1843. 		Case 16:
  1844. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 720 KB"
  1845. 		Case 17:
  1846. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 1.2 MB"
  1847. 		Case 18:
  1848. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 1.23 MB"
  1849. 		Case 19:
  1850. 			strMediaTypeDescription = "5.25 Inch Floppy Disk 1.23 MB"
  1851. 		Case 20:
  1852. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 128 MB"
  1853. 		Case 21:
  1854. 			strMediaTypeDescription = "3.5 Inch Floppy Disk 230 MB"
  1855. 		Case 22:
  1856. 			strMediaTypeDescription = "8 Inch Floppy Disk 256 KB"
  1857. 		Case Else:
  1858. 			strMediaTypeDescription = "Unknown"
  1859. 	End Select
  1860. 	GetMediaType = strMediaTypeDescription
  1861. End Function
  1862.  
  1863.  
  1864. Function GetMemoryFormFactor( )
  1865. 	Dim colItems, objItem, objWMIService, intFormFactor, strFormFactor, strQuery
  1866. 	intFormFactor = 0
  1867. 	strFormFactor = ""
  1868. 	strQuery = "SELECT FormFactor FROM Win32_PhysicalMemory"
  1869. 	Set objWMIService = GetObject( "winmgmts://" & gvsComputer & "/root/CIMV2"   )
  1870. 	Set colItems = objWMIService.ExecQuery( strQuery )
  1871. 	If Not Err Then
  1872. 		For Each objItem In colItems
  1873. 			intFormFactor = CInt( objItem.FormFactor )
  1874. 		Next
  1875. 	End If
  1876. 	Select Case intFormFactor
  1877. 		Case 0:
  1878. 			strFormFactor = "Unknown"
  1879. 		Case 1:
  1880. 			strFormFactor = "Other"
  1881. 		Case 2:
  1882. 			strFormFactor = "SIP"
  1883. 		Case 3:
  1884. 			strFormFactor = "DIP"
  1885. 		Case 4:
  1886. 			strFormFactor = "ZIP"
  1887. 		Case 5:
  1888. 			strFormFactor = "SOJ"
  1889. 		Case 6:
  1890. 			strFormFactor = "Proprietary"
  1891. 		Case 7:
  1892. 			strFormFactor = "SIMM"
  1893. 		Case 8:
  1894. 			strFormFactor = "DIMM"
  1895. 		Case 9:
  1896. 			strFormFactor = "TSOP"
  1897. 		Case 10:
  1898. 			strFormFactor = "PGA"
  1899. 		Case 11:
  1900. 			strFormFactor = "RIMM"
  1901. 		Case 12:
  1902. 			strFormFactor = "SODIMM"
  1903. 		Case 13:
  1904. 			strFormFactor = "SRIMM"
  1905. 		Case 14:
  1906. 			strFormFactor = "SMD"
  1907. 		Case 15:
  1908. 			strFormFactor = "SSMP"
  1909. 		Case 16:
  1910. 			strFormFactor = "QFP"
  1911. 		Case 17:
  1912. 			strFormFactor = "TQFP"
  1913. 		Case 18:
  1914. 			strFormFactor = "SOIC"
  1915. 		Case 19:
  1916. 			strFormFactor = "LCC"
  1917. 		Case 20:
  1918. 			strFormFactor = "PLCC"
  1919. 		Case 21:
  1920. 			strFormFactor = "BGA"
  1921. 		Case 22:
  1922. 			strFormFactor = "FPBGA"
  1923. 		Case 23:
  1924. 			strFormFactor = "LGA"
  1925. 		Case Else:
  1926. 			strFormFactor = "Unknown"
  1927. 	End Select
  1928. 	GetMemoryFormFactor = strFormFactor
  1929. End Function
  1930.  
  1931.  
  1932. Function GetOSVer( )
  1933. 	Dim arrOS, colItems, objItem, objWMIService
  1934. 	GetOSVer = 0
  1935. 	Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
  1936. 	Set colItems = objWMIService.ExecQuery( "SELECT Version FROM Win32_OperatingSystem" )
  1937. 	If Not Err Then
  1938. 		For Each objItem In colItems
  1939. 			arrOS = Split( objItem.Version, "." )
  1940. 			If UBound( arrOS ) > 1 Then
  1941. 				GetOSVer = arrOS(0) & "." & arrOS(1)
  1942. 			Else
  1943. 				GetOSVer = arrOS(0)
  1944. 			End If
  1945. 		Next
  1946. 	End If
  1947. 	Set colItems      = Nothing
  1948. 	Set objWMIService = Nothing
  1949. End Function
  1950.  
  1951.  
  1952. Function GetParameter( myString, myParameter )
  1953. 	' Extract switch value from command line,
  1954. 	' e.g. GetParameter( "/CM /SIZE:1024x768 /NOUPD", "SIZE" ) to extract "1024x768"
  1955. 	Dim strItem, strParameter, strString
  1956. 	' Default return value is an empty string
  1957. 	strParameter = UCase( myParameter )
  1958. 	myString     = Trim( myString )
  1959. 	strString    = UCase( myString )
  1960. 	If InStr( strString, "/" & strParameter & ":" ) Then
  1961. 		' Step 1: extract switch and everything following it, e.g. "/SIZE:1024x768 /NOUPD"
  1962. 		strItem = Mid( myString, InStr( strString, "/" & strParameter & ":" ) )
  1963. 		' Check if there is anything following the switch and colon
  1964. 		If Len( strItem ) > Len( "/" & strParameter & ":" ) Then
  1965. 			' Step 2: remove the switch name and colon, e.g. in our example this leaves us with "1024x768 /NOUPD"
  1966. 			strItem = Mid( strItem, Len( "/" & strParameter & ":" ) + 1 )
  1967. 			' Check again if there is anything left to parse
  1968. 			If Len( strItem ) > 1 Then
  1969. 				' Check if the value starts with a doublequote
  1970. 				If Left( strItem, 1 ) = """" Then
  1971. 					' Remove the opening doublequote
  1972. 					strItem = Mid( strItem, 2 )
  1973. 					' Remove the closing doublequote and everything after it
  1974. 					strItem = Left( strItem, InStr( strItem, """" ) - 1 )
  1975. 				Else
  1976. 					' If not in doublequotes, remove the first space and everything following it,
  1977. 					' e.g. in our example this leaves us with "1024x768"
  1978. 					If InStr( strItem, " " ) Then strItem = Left( strItem, InStr( strItem, " " ) - 1 )
  1979. 				End If
  1980. 				' Return the result
  1981. 				GetParameter = Trim( strItem )
  1982. 			End If
  1983. 		End If
  1984. 	End If
  1985. End Function
  1986.  
  1987.  
  1988. Function GetRandomString( myLength )
  1989. 	Dim i, intChar, strResult
  1990. 	strResult = ""
  1991. 	For i = 1 To myLength
  1992. 		intChar = gvoRandom.Next_2( 48, 83 )
  1993. 		If intChar > 57 Then intChar = intChar + 7 ' numbers and captital letters only
  1994. 		strResult = strResult & Chr( intChar )
  1995. 	Next
  1996. 	GetRandomString = strResult
  1997. End Function
  1998.  
  1999.  
  2000. Function GetVideoRAM( myVideoCard )
  2001. 	' UInt32 cannot handle 4GB and greater, so we'll have to look it up in the registry
  2002. 	' Based on PowerShell code by "farag" at
  2003. 	' https://superuser.com/questions/1461858/fetch-correct-vram-for-gpu-via-command-line-on-windows/1497378#1497378
  2004. 	' Corrected for remote computers AND for multiple video controllers AND for both integrated and discrete video controllers by Steve Robertson
  2005. 	Dim arrSubKeys
  2006. 	Dim binVidMem
  2007. 	Dim i, intRegKeyCount, lngVidMem
  2008. 	Dim objReg
  2009. 	Dim strAdapterName, strRegKey, strSubKey, strVidMem
  2010.  
  2011. 	lngVidMem   = 0
  2012.  
  2013. 	strRegKey = "SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}"
  2014. 	Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//" & gvaSettingsStr.Item( "COMPUTER" ) & "/root/default:StdRegProv" )
  2015. 	If objReg.EnumKey( HKEY_LOCAL_MACHINE, strRegKey, arrSubKeys ) = 0 Then
  2016. 		For intRegKeyCount = 0 To UBound( arrSubKeys )
  2017. 			If IsNumeric( arrSubKeys( intRegKeyCount ) ) Then
  2018. 				strSubKey = strRegKey & "\" & Right( "0000" & intRegKeyCount, 4 )
  2019. 				If objReg.GetStringValue( HKEY_LOCAL_MACHINE, strSubKey, "DriverDesc", strAdapterName ) = 0 Then
  2020. 					If strAdapterName = myVideoCard Then
  2021. 						' If a value is specified for HardwareInformation.qwMemorySize, the memory size is 4GB or more and we can ignore HardwareInformation.MemorySize
  2022. 						If objReg.GetQWORDValue( HKEY_LOCAL_MACHINE, strSubKey, "HardwareInformation.qwMemorySize", lngVidMem ) = 0 Then
  2023. 							' lngVidMem contains the amount of video RAM in bytes
  2024. 						ElseIf objReg.GetDWORDValue( HKEY_LOCAL_MACHINE, strSubKey, "HardwareInformation.MemorySize", lngVidMem ) = 0 Then
  2025. 							' lngVidMem contains the amount of video RAM in bytes
  2026. 						ElseIf objReg.GetBinaryValue( HKEY_LOCAL_MACHINE, strSubKey, "HardwareInformation.MemorySize", binVidMem ) = 0 Then
  2027. 							' binVidMem contains the amount of video RAM in MB and specified in a binary array
  2028. 							strVidMem = ""
  2029. 							For i = 0 To UBound( binVidMem )
  2030. 								strVidMem = strVidMem & binVidMem( i )
  2031. 							Next
  2032. 							lngVidMem = Int( strVidMem ) * MB
  2033. 						Else
  2034. 							lngVidMem = 0
  2035. 						End If
  2036. 					End If
  2037. 				End If
  2038. 			End If
  2039. 		Next
  2040. 	Else
  2041. 		Exit Function
  2042. 	End If
  2043. 	Set objReg = Nothing
  2044. 	GetVideoRAM = Round( lngVidMem / MB )
  2045. End Function
  2046.  
  2047.  
  2048. Function HandleClass( myClass, myNameSpace )
  2049. ' This subroutine lists all properties and their values for a specified class.
  2050. ' Created using an example from a Microsoft TechNet ScriptCenter article:
  2051. ' http://www.microsoft.com/technet/scriptcenter/resources/guiguy/default.mspx
  2052. 	Dim blnNumChain, colItems, intChar, intPadding, intTest, objClass, objItem, objProperty, objWMIService2, strPadding, strProperties
  2053.  
  2054. 	On Error Resume Next ' REQUIRED
  2055.  
  2056. 	strProperties = "<h2>\\" & gvsComputer & "\" & Replace( myNameSpace, "/", "\" ) & ":" & myClass & "</h2>" & vbCrLf & vbCrLf
  2057.  
  2058. 	If LCase( myNameSpace ) = "root/cimv2" Then
  2059. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM " & myClass )
  2060. 		Set objClass = gvoWMIrootCimv2.Get( myClass )
  2061. 		If Err Then
  2062. 			HandleClass = strProperties & "<p>Error while trying to query \\" & gvsComputer & "\root\CIMV2\" & myClass & "</p>" & vbCrLf & vbCrLf
  2063. 			Exit Function
  2064. 		End If
  2065. 	ElseIf LCase( myNameSpace ) = "root/wmi" Then
  2066. 		Set colItems = gvoWMIrootWMI.ExecQuery( "SELECT * FROM " & myClass )
  2067. 		Set objClass = gvoWMIrootWMI.Get( myClass )
  2068. 		If Err Then
  2069. 			HandleClass = strProperties & "<p>Error while trying to query \\" & gvsComputer & "\root\WMI\" & myClass & "</p>" & vbCrLf & vbCrLf
  2070. 			Exit Function
  2071. 		End If
  2072. 	ElseIf LCase( myNameSpace ) = "root/standardcimv2" Then
  2073. 		Set colItems = gvoWMIrootStandardCimv2.ExecQuery( "SELECT * FROM " & myClass )
  2074. 		Set objClass = gvoWMIrootStandardCimv2.Get( myClass )
  2075. 		If Err Then
  2076. 			HandleClass = strProperties & "<p>Error while trying to query \\" & gvsComputer & "\root\StandardCimv2\" & myClass & "</p>" & vbCrLf & vbCrLf
  2077. 			Exit Function
  2078. 		End If
  2079. 	Else
  2080. 		Set objWMIService2 = GetObject( "winmgmts://" & gvsComputer & "/" & myNameSpace )
  2081. 		If Err Then
  2082. 			HandleClass = strProperties & "<p>Error while trying to connect to \\" & gvsComputer & "\" & Replace( myNameSpace, "/", "\" ) & "</p>" & vbCrLf & vbCrLf
  2083. 			Exit Function
  2084. 		End If
  2085. 		Set colItems = objWMIService2.ExecQuery( "SELECT * FROM " & myClass )
  2086. 		Set objClass = objWMIService2.Get( myClass )
  2087. 		If Err Then
  2088. 			HandleClass = strProperties & "<p>Error while trying to query \\" & gvsComputer & "\" & Replace( myNameSpace, "/", "\" ) & "\" & myClass & "</p>" & vbCrLf & vbCrLf
  2089. 			Exit Function
  2090. 		End If
  2091. 	End If
  2092.  
  2093. 	Select Case colItems.Count
  2094. 		Case 0
  2095. 			strProperties = strProperties & "<p>No instances.</p>" & vbCrLf & vbCrLf
  2096. 		Case 1
  2097. 			strProperties = strProperties & "<p>1 instance:</p>" & vbCrLf & vbCrLf
  2098. 		Case Else
  2099. 			strProperties = strProperties & "<p>" & colItems.Count & " instances:</p>" & vbCrLf & vbCrLf
  2100. 	End Select
  2101.  
  2102. 	For Each objItem In colItems
  2103. 		intPadding = 1
  2104. 		For Each objProperty In objClass.Properties_
  2105. 			intPadding = Max( intPadding, Len( CreateLine( objProperty.Name ) ) )
  2106. 		Next
  2107. 		strpadding = Space( intPadding )
  2108. 		For Each objProperty In objClass.Properties_
  2109. 			If objProperty.IsArray = True Then
  2110. 				blnNumChain = True
  2111. 				intTest     = 0
  2112. 				For Each intChar In Eval( "objItem." & objProperty.Name )
  2113. 					If IsNumeric( intChar ) Then
  2114. 						intTest = intTest + intChar
  2115. 					Else
  2116. 						blnNumChain = False
  2117. 						Exit For
  2118. 					End If
  2119. 				Next
  2120. 				If blnNumChain And gvaSettingsBool.Item( "CHAIN" ) And ( intTest > 0 ) And ( InStr( objProperty.Name, "Characteristic" ) < 1 ) And ( InStr( objProperty.Name, "Capabilit" ) < 1 ) Then
  2121. 					strProperties = strProperties & Left( CreateLine( objProperty.Name & " (array)"  ) & strPadding, intPadding ) & " : " & Eval( "Join( objItem." & objProperty.Name & ", "","" )" ) & vbCrLf
  2122. 					strProperties = strProperties & Left( CreateLine( objProperty.Name & " (string)" ) & strPadding, intPadding ) & " : " & Eval( "Chain( objItem." & objProperty.Name & " )" ) & vbCrLf
  2123. 				Else
  2124. 					strProperties = strProperties & Left( CreateLine( objProperty.Name ) & strPadding, intPadding ) & " : " & Eval( "Join( objItem." & objProperty.Name & ", "","" )" ) & vbCrLf
  2125. 				End If
  2126. 			Else
  2127. 				If IsDate( Eval( "objItem." & objProperty.Name ) ) Then
  2128. 					strProperties = strProperties & Left( CreateLine( objProperty.Name ) & strPadding, intPadding ) & " : " & FormatDateTime( Eval( "objItem." & objProperty.Name ) ) & vbCrLf
  2129. 				Else
  2130. 					strProperties = strProperties & Left( CreateLine( objProperty.Name ) & strPadding, intPadding ) & " : " & Eval( "objItem." & objProperty.Name ) & vbCrLf
  2131. 				End If
  2132. 			End If
  2133. 		Next
  2134. 		strProperties = strProperties & vbCrLf & vbCrLf
  2135. 	Next
  2136.  
  2137. 	Set objWMIService2 = Nothing
  2138.  
  2139. 	On Error Goto 0
  2140.  
  2141. 	HandleClass = strProperties
  2142. End Function
  2143.  
  2144.  
  2145. Function HandleDMIDetails( myType )
  2146. 	Dim objCMD, strMsg, strOutput
  2147. 	HandleDMIDetails = ""
  2148. 	If gvbWinPE Then Exit Function
  2149. 	On Error Resume Next ' REQUIRED
  2150. 	Set objCMD = gvoWSHShell.Exec( "CMD.EXE /C """ & gvsDMIDecode & """ --type " & LCase( myType ) & " 2>&1" )
  2151. 	strOutput = objCMD.StdOut.ReadAll
  2152. 	objCMD.Terminate
  2153. 	Set objCMD = Nothing
  2154. 	On Error Goto 0
  2155. 	HandleDMIDetails = "<h2>\\" & gvsComputer & " " & "DMI " & myType & " details</h2>" & vbCrLf & vbCrLf & "<pre>" & strOutput & "</pre>" & vbCrLf
  2156. End Function
  2157.  
  2158.  
  2159. Function HandleRegEnum( myHive, myRegPath, myRecursion )
  2160. 	Dim arrSubkeys, arrValueNames, arrValueTypes
  2161. 	Dim blnRecursion
  2162. 	Dim i, intMaxTypeLen, intMaxNameLen, intResult
  2163. 	Dim objReg
  2164. 	Dim strData, strHive, strResult
  2165. 	Dim varData
  2166. 	blnRecursion = ( myRecursion <> 0 )
  2167. 	strResult     = ""
  2168. 	intMaxTypeLen = 0
  2169. 	intMaxNameLen = 0
  2170. 	Select Case myHive
  2171. 		Case HKEY_CLASSES_ROOT
  2172. 			strHive = "HKEY_CLASSES_ROOT"
  2173. 		Case HKEY_CURRENT_USER
  2174. 			strHive = "HKEY_CURRENT_USER"
  2175. 		Case HKEY_LOCAL_MACHINE
  2176. 			strHive = "HKEY_LOCAL_MACHINE"
  2177. 		Case HKEY_USERS
  2178. 			strHive = "HKEY_USERS"
  2179. 		Case HKEY_CURRENT_CONFIG
  2180. 			strHive = "HKEY_CURRENT_CONFIG"
  2181. 		Case Else
  2182. 			strHive = myHive
  2183. 	End Select
  2184. 	On Error Resume Next ' REQUIRED
  2185. 	Set objReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!//" & gvsComputer & "/root/default:StdRegProv" )
  2186. 	strResult = "<h2>[" & strHive & "\" & myRegPath & "]</h2>" & vbCrLf
  2187. 	intResult = objReg.EnumValues( myHive, myRegPath, arrValueNames, arrValueTypes )
  2188. 	If intResult = 0 Then
  2189. 		If IsArray( arrValueNames ) And IsArray( arrValueTypes ) Then
  2190. 			For i = 0 To UBound( arrValueNames )
  2191. 				If Len( arrValueNames(i) )                 > intMaxNameLen Then intMaxNameLen = Len( arrValueNames(i) )
  2192. 				If Len( gvaRegDataType(arrValueTypes(i)) ) > intMaxTypeLen Then intMaxTypeLen = Len( gvaRegDataType(arrValueTypes(i)) )
  2193. 			Next
  2194. 			For i = 0 To UBound( arrValueNames )
  2195. 				strData = ""
  2196. 				Select Case arrValueTypes(i)
  2197. 					Case REG_SZ:
  2198. 						intResult = objReg.GetStringValue( myHive, myRegPath, arrValueNames(i), strData )
  2199. 					Case REG_EXPAND_SZ:
  2200. 						intResult = objReg.GetExpandedStringValue( myHive, myRegPath, arrValueNames(i), strData )
  2201. 					Case REG_BINARY:
  2202. 						intResult = objReg.GetBinaryValue( myHive, myRegPath, arrValueNames(i), varData )
  2203. 						If Not Err And IsArray( varData ) Then
  2204. 							strData = Join( varData, ";" )
  2205. 						End If
  2206. 					Case REG_DWORD, REG_DWORD_BIG_ENDIAN:
  2207. 						intResult = objReg.GetDWORDValue( myHive, myRegPath, arrValueNames(i), varData )
  2208. 						strData = "0x" & Right( String( 8, "0" ) & CStr( Hex( varData ) ), 8 ) & " (" & varData & ")"
  2209. 					Case REG_MULTI_SZ:
  2210. 						intResult = objReg.GetMultiStringValue( myHive, myRegPath, arrValueNames(i), varData )
  2211. 						strData = Join( varData, ";" )
  2212. 					Case REG_QWORD:
  2213. 						intResult = objReg.GetQWORDValue( myHive, myRegPath, arrValueNames(i), varData )
  2214. 						strData = "0x" & Right( String( 16, "0" ) & CStr( Hex( varData ) ), 16 ) & " (" & varData & ")"
  2215. 				End Select
  2216. 				If intResult = 0 Then
  2217. 					strResult = strResult & Left( arrValueNames(i) & Space( intMaxNameLen + 4 ), intMaxNameLen + 4) & Left( "[" & gvaRegDataType(arrValueTypes(i)) & "]" & Space( intMaxTypeLen + 4 ), intMaxTypeLen + 4 ) & strData & vbCrLf
  2218. 				End If
  2219. 			Next
  2220. 		End If
  2221. 	End If
  2222.  
  2223. 	If blnRecursion And intResult = 0 Then
  2224. 		strResult = strResult & vbCrLf
  2225. 		objReg.EnumKey myHive, myRegPath, arrSubkeys
  2226. 		If Not Err And IsArray( arrSubkeys ) Then
  2227. 			For i = 0 To UBound( arrSubkeys )
  2228. 				strResult = strResult & HandleRegEnum( myHive, myRegPath & "\" & arrSubkeys(i), 1 )
  2229. 			Next
  2230. 		End If
  2231. 	End If
  2232. 	Set objReg = Nothing
  2233. 	On Error Goto 0
  2234. 	HandleRegEnum = strResult
  2235. End Function
  2236.  
  2237.  
  2238. Function HandleXMLNode( myQuery )
  2239. 	Dim i, strDeviceType, strMsg, strQuery2
  2240. 	Dim colNodes, colNodes2, objNode, objNode2, objNode3, objNode4, objNode5, objNode6, xmlDoc
  2241. 	HandleXMLNode = ""
  2242. 	If gvbWinPE Then Exit Function
  2243. 	strDeviceType = Left( myQuery, InStrRev( myQuery, "/" ) - 1 )
  2244. 	strDeviceType = Mid( strDeviceType, InStrRev( strDeviceType, "/" ) + 1 )
  2245. 	strMsg        = "<h2>\\" & gvsComputer & " " & "DxDiag " & strDeviceType & " data</h2>" & vbCrLf & vbCrLf
  2246. 	On Error Resume Next ' REQUIRED
  2247. 	Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
  2248. 	xmlDoc.Async = "False"
  2249. 	xmlDoc.Load gvaSettingsStr.Item( "XML" )
  2250. 	Set colNodes = xmlDoc.selectNodes( myQuery )
  2251. 	Select Case colNodes.length
  2252. 		Case 0
  2253. 			strMsg = strMsg & "<p>No instances.</p>"
  2254. 		Case 1
  2255. 			strMsg = strMsg & "<p>1 instance:</p>"
  2256. 		Case Else
  2257. 			strMsg = strMsg & "<p>" & colNodes.length & " instances:</p>"
  2258. 	End Select
  2259. 	strMsg = strMsg & vbCrLf & vbCrLf & "<pre>"
  2260. 	For i = 0 To colNodes.length - 1
  2261. 		strQuery2 = myQuery & "[" & i & "]/*"
  2262. 		Set colNodes2 = xmlDoc.selectNodes( strQuery2 )
  2263. 		For Each objNode2 in colNodes2
  2264. 			If objNode2.childNodes.length = 1 Then
  2265. 				strMsg = strMsg & objNode2.nodeName & " = " & objNode2.text & vbCrLf
  2266. 			Else
  2267. 				strMsg = strMsg & objNode2.nodeName & ":" & vbCrLf
  2268. 				For Each objNode3 In objNode2.childNodes
  2269. 					If objNode3.childNodes.length = 1 Then
  2270. 						strMsg = strMsg & "  " & objNode3.nodeName & " = " & objNode3.text & vbCrLf
  2271. 					Else
  2272. 						strMsg = strMsg & objNode3.nodeName & ":" & vbCrLf
  2273. 						For Each objNode4 In objNode3.childNodes
  2274. 							If objNode4.childNodes.length = 1 Then
  2275. 								strMsg = strMsg & "  " & objNode4.nodeName & " = " & objNode4.text & vbCrLf
  2276. 							Else
  2277. 								strMsg = strMsg & objNode4.nodeName & ":" & vbCrLf
  2278. 								For Each objNode5 In objNode4.childNodes
  2279. 									If objNode5.childNodes.length = 1 Then
  2280. 										strMsg = strMsg & "  " & objNode5.nodeName & " = " & objNode5.text & vbCrLf
  2281. 									Else
  2282. 										strMsg = strMsg & objNode5.nodeName & ":" & vbCrLf
  2283. 										For Each objNode6 In objNode5.childNodes
  2284. 											strMsg = strMsg & "  " & objNode6.nodeName & " = " & objNode6.text & vbCrLf
  2285. 										Next
  2286. 									End If
  2287. 								Next
  2288. 							End If
  2289. 						Next
  2290. 					End If
  2291. 				Next
  2292. 			End If
  2293. 		Next
  2294. 		strMsg = strMsg & vbCrLf & vbCrLf
  2295. 	Next
  2296. 	strMsg = strMsg & "</pre>" & vbCrLf
  2297. 	Set colNodes2 = Nothing
  2298. 	Set colNodes  = Nothing
  2299. 	Set xmlDoc    = Nothing
  2300. 	On Error Goto 0
  2301. 	HandleXMLNode = strMsg
  2302. End Function
  2303.  
  2304.  
  2305. Function HandleXMLValue( myQuery )
  2306. 	Dim i, strDeviceType, strMsg, strQuery2
  2307. 	Dim colNodes, colNodes2, objNode, objNode2, objNode3, xmlDoc
  2308. 	HandleXMLValue = ""
  2309. 	If gvbWinPE Then Exit Function
  2310. 	strDeviceType  = Left( myQuery, InStrRev( myQuery, "/" ) - 1 )
  2311. 	strDeviceType  = Mid( strDeviceType, InStrRev( strDeviceType, "/" ) + 1 )
  2312. 	strMsg         = "<h2>\\" & gvsComputer & " " & "DxDiag " & strDeviceType & " data</h2>" & vbCrLf & vbCrLf
  2313. 	On Error Resume Next ' REQUIRED
  2314. 	Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
  2315. 	xmlDoc.Async = "False"
  2316. 	xmlDoc.Load gvaSettingsStr.Item( "XML" )
  2317. 	Set colNodes = xmlDoc.selectNodes( myQuery )
  2318. 	Select Case colNodes.length
  2319. 		Case 0
  2320. 			strMsg = strMsg & "<p>No instances.</p>"
  2321. 		Case 1
  2322. 			strMsg = strMsg & "<p>1 instance:</p>"
  2323. 		Case Else
  2324. 			strMsg = strMsg & "<p>" & colNodes.length & " instances:</p>"
  2325. 	End Select
  2326. 	strMsg = strMsg & vbCrLf & vbCrLf & "<pre>"
  2327. 	For i = 0 To colNodes.length - 1
  2328. 		strQuery2 = myQuery & "[" & i & "]"
  2329. 		Set colNodes2 = xmlDoc.selectNodes( strQuery2 )
  2330. 		For Each objNode2 in colNodes2
  2331. 			strMsg = strMsg & objNode2.nodeName & " #" & i & " : " & objNode2.text & vbCrLf
  2332. 		Next
  2333. 		strMsg = strMsg & vbCrLf & vbCrLf
  2334. 	Next
  2335. 	strMsg = strMsg & "</pre>" & vbCrLf
  2336. 	Set colNodes2 = Nothing
  2337. 	Set colNodes  = Nothing
  2338. 	Set xmlDoc    = Nothing
  2339. 	On Error Goto 0
  2340. 	HandleXMLValue = strMsg
  2341. End Function
  2342.  
  2343.  
  2344. Sub Initialize( )
  2345. 	Dim i, j, k, objRE
  2346. 	' Read PATH
  2347. 	gvsPATH = Trim( gvoWSHShell.ExpandEnvironmentStrings( "%PATH%" ) )
  2348. 	' Remove empty PATH entries
  2349. 	Set objRE = New RegExp
  2350. 	objRE.Pattern = ";\s+"
  2351. 	gvsPATH = Trim( objRE.Replace( gvsPATH, ";" ) )
  2352. 	objRE.Pattern = ";{2,}"
  2353. 	gvsPATH = Trim( objRE.Replace( gvsPATH, ";" ) )
  2354. 	objRE.Pattern = "(^;|;$)"
  2355. 	gvsPATH = Trim( objRE.Replace( gvsPATH, "" ) )
  2356. 	Set objRE = Nothing
  2357. 	' Split PATH into array of entries
  2358. 	gvaPATH = Split( gvsPATH, ";" )
  2359. 	k = UBound( gvaPATH )
  2360. 	' Trim PATH entries
  2361. 	For i = UBound( gvaPATH ) To 0 Step -1
  2362. 		gvaPATH(i) = Trim( gvaPATH(i) )
  2363. 		' Remove empty PATH entries
  2364. 		If gvaPATH(i) = "" Then
  2365. 			For j = i To k - 1
  2366. 				gvaPATH(j) = gvaPATH(j+1)
  2367. 			Next
  2368. 			k = k - 1
  2369. 		End If
  2370. 	Next
  2371. 	' Resize PATH array to account for removed entries
  2372. 	If k < UBound( gvaPATH ) Then
  2373. 		ReDim Preserve gvaPATH(k)
  2374. 	End If
  2375. 	' Check if in WinPE
  2376. 	gvbWinPE = CheckWinPE( )
  2377. 	If gvbWinPE Then DebugMessage "", "Running in WinPE"
  2378. 	' Reset counters
  2379. 	gvcBanks     = 0
  2380. 	gvcCPU       = 0
  2381. 	gvcMemory    = 0
  2382. 	gviMemSize   = 0
  2383. 	gviMemSpeed  = 0
  2384. 	gviNumOS     = 0
  2385. 	gviMinHeight = Min( 600, window.screen.height )
  2386. 	gviMinWidth  = Min( 800, window.screen.width  )
  2387. 	' Color changes on WMI connection errors
  2388. 	clrBgErr  = "Red"
  2389. 	clrTxtErr = "White"
  2390. 	' This HTA's command line
  2391. 	gvsCommandline   = Hardware.CommandLine
  2392. 	gvsCommandlineUC = UCase( gvsCommandline )
  2393. 	' Create a list of all interface colors available, and fill the theme settings dropdowns with them
  2394. 	ListCSSColors
  2395. 	ListColors "BackgroundColor",     "blue"
  2396. 	ListColors "CaptionsColor",       "white"
  2397. 	ListColors "LinksColor",          "red"
  2398. 	ListColors "ButtonFaceColor",     "silver"
  2399. 	ListColors "ButtonCaptionsColor", "blacl"
  2400. 	ListColors "CodeColor",           "yellow"
  2401. 	' Dictionary objects for global settings
  2402. 	Set gvaDefaultsBool = CreateObject( "Scripting.Dictionary" )
  2403. 	Set gvaDefaultsStr  = CreateObject( "Scripting.Dictionary" )
  2404. 	Set gvaSettingsBool = CreateObject( "Scripting.Dictionary" )
  2405. 	Set gvaSettingsStr  = CreateObject( "Scripting.Dictionary" )
  2406. 	' Read and set defaults
  2407. 	ConfigReadDefaults
  2408. 	' Paths of helper files
  2409. 	gvsConfigFile    = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 ) & ".cfg"
  2410. 	gvsDetailsFile   = gvoFSO.BuildPath( gvaSettingsStr.Item( "TEMPDIR" ), "~hardware~details.html" )
  2411. 	gvsPrintFile     = gvoFSO.BuildPath( gvaSettingsStr.Item( "TEMPDIR" ), "~hardware~print~preview.html" )
  2412. 	gvsDebugText     = ""
  2413. End Sub
  2414.  
  2415.  
  2416. Sub Inventory( )
  2417. 	Dim blnSuccess, colItems, i, objItem, objWMIService
  2418.  
  2419. 	'ComputerName.value = gvsComputer
  2420. 	gvsComputer = UCase( Trim( ComputerName.value ) )
  2421.  
  2422. 	If ComputerName.value <> UCase( gvsComputer ) Then
  2423. 		If gvsComputer <> "" Then
  2424. 			DebugMessage "", "Changing computer name from " & gvsComputer & " to " & Trim( ComputerName.value )
  2425. 		End If
  2426. 	End If
  2427.  
  2428. 	ComputerName.style.backgroundColor = "White"
  2429. 	ComputerName.style.color           = "Black"
  2430. 	ComputerName.disabled              = True
  2431.  
  2432. 	gvbIsLocalComputer = IsLocalComputer( )
  2433.  
  2434.     If ButtonRun.value = "Reset" Then
  2435.     	Reset
  2436.     Else
  2437. 	    ButtonRun.value            = "Reset"
  2438. 	    ButtonRun.accessKey        = "r"
  2439. 	    ButtonRun.title            = "Click here to clear all fields"
  2440. 	    ButtonRun.disabled         = True
  2441. 		CheckboxBIOS.disabled      = True
  2442. 		CheckboxCDROM.disabled     = True
  2443. 		CheckboxCPU.disabled       = True
  2444. 		CheckboxFDD.disabled       = True
  2445. 		CheckboxHDD.disabled       = True
  2446. 		CheckboxKeyboard.disabled  = True
  2447. 		CheckboxMouse.disabled     = True
  2448. 		CheckboxMainBoard.disabled = True
  2449. 		CheckboxMemory.disabled    = True
  2450. 		CheckboxMonitor.disabled   = True
  2451. 		CheckboxNIC.disabled       = True
  2452. 		CheckboxPorts.disabled     = True
  2453. 		CheckboxSound.disabled     = True
  2454. 		CheckboxVideo.disabled     = True
  2455. 		ButtonBasic.disabled       = True
  2456. 		ButtonPaste.disabled       = True
  2457. 		ButtonPrint.disabled       = True
  2458. 		ComputerName.disabled      = True
  2459.  
  2460. 		If Not CheckboxBIOS.Checked Then
  2461. 			BIOSHeader.style.display = "none"
  2462. 			BIOSRow.style.display    = "none"
  2463. 			BIOSFooter.style.display = "none"
  2464. 		End If
  2465. 		If Not CheckboxCDROM.Checked Then
  2466. 			CDROMHeader.style.display = "none"
  2467. 			CDROM0.style.display      = "none"
  2468. 			CDROMFooter.style.display = "none"
  2469. 		End If
  2470. 		If Not CheckboxCPU.Checked Then
  2471. 			CPUHeader.style.display = "none"
  2472. 			CPURow.style.display    = "none"
  2473. 			CPUFooter.style.display = "none"
  2474. 		End If
  2475. 		If Not CheckboxFDD.Checked Then
  2476. 			FDDHeader.style.display = "none"
  2477. 			FDD0.style.display      = "none"
  2478. 			FDDFooter.style.display = "none"
  2479. 		End If
  2480. 		If Not CheckboxHDD.Checked Then
  2481. 			HardDiskHeader.style.display = "none"
  2482. 			HardDisk0.style.display      = "none"
  2483. 			HardDiskFooter.style.display = "none"
  2484. 		End If
  2485. 		If Not CheckboxKeyboard.Checked Then
  2486. 			KeyboardHeader.style.display = "none"
  2487. 			KeyboardRow.style.display    = "none"
  2488. 			KeyboardFooter.style.display = "none"
  2489. 		End If
  2490. 		If Not CheckboxMainBoard.Checked Then
  2491. 			MainBoardHeader.style.display = "none"
  2492. 			MainBoardRow.style.display    = "none"
  2493. 			MainBoardFooter.style.display = "none"
  2494. 		End If
  2495. 		If Not CheckboxMemory.Checked Then
  2496. 			MemHeader.style.display = "none"
  2497. 			MemRow.style.display    = "none"
  2498. 			MemFooter.style.display = "none"
  2499. 		End If
  2500. 		If Not CheckboxMonitor.Checked Then
  2501. 			MonitorHeader.style.display = "none"
  2502. 			Monitor0.style.display      = "none"
  2503. 			MonitorFooter.style.display = "none"
  2504. 		End If
  2505. 		If Not CheckboxMouse.Checked Then
  2506. 			MouseHeader.style.display = "none"
  2507. 			MouseRow.style.display    = "none"
  2508. 			MouseFooter.style.display = "none"
  2509. 		End If
  2510. 		If Not CheckboxNIC.Checked Then
  2511. 			NICHeader.style.display = "none"
  2512. 			NIC0.style.display      = "none"
  2513. 			NICFooter.style.display = "none"
  2514. 		End If
  2515. 		If Not CheckboxPorts.Checked Then
  2516. 			PortsHeader.style.display = "none"
  2517. 			PortsRow.style.display    = "none"
  2518. 			PortsFooter.style.display = "none"
  2519. 		End If
  2520. 		If Not CheckboxSound.Checked Then
  2521. 			SoundHeader.style.display = "none"
  2522. 			SoundRow.style.display    = "none"
  2523. 			SoundFooter.style.display = "none"
  2524. 		End If
  2525. 		If Not CheckboxVideo.Checked Then
  2526. 			VideoHeader.style.display = "none"
  2527. 			Video0.style.display      = "none"
  2528. 			VideoFooter.style.display = "none"
  2529. 		End If
  2530.  
  2531. 		DebugMessage "", "Starting inventory"
  2532.  
  2533. 		On Error Resume Next ' REQUIRED
  2534.  
  2535. 		If gvbWinPE Then
  2536. 			gvsComputer        = UCase( InputBox( "Please enter the computer name", "Computer Name", gvsComputer ) )
  2537. 			ComputerName.value = gvsComputer
  2538. 			Set gvoWMIrootCimv2         = GetObject( "winmgmts://./root/CIMV2" )
  2539. 			Set gvoWMIrootMSWinStorage  = GetObject( "winmgmts://./root/Microsoft/Windows/Storage" )
  2540. 			Set gvoWMIrootStandardCimv2 = GetObject( "winmgmts://./root/StandardCimv2" )
  2541. 			Set gvoWMIrootWMI           = GetObject( "winmgmts://./root/WMI" )
  2542. 		Else
  2543. 			gvsComputer = ComputerName.value
  2544. 			If gvsComputer = "" Or gvsComputer = "." Then
  2545. 				gvsComputer        = GetLocalComputerName( )
  2546. 				ComputerName.value = gvsComputer
  2547. 			End If
  2548. 			Sleep 1
  2549. 			Set colItems = gvoWMIlocalCimv2.ExecQuery( "SELECT StatusCode FROM Win32_PingStatus WHERE Address='" & gvsComputer & "'" )
  2550. 			For Each objItem In colItems
  2551. 				If IsNull( objItem.StatusCode ) Or objItem.StatusCode <> 0 Then
  2552. 					On Error GoTo 0
  2553. 					MsgBox "Error while trying to ping computer " & gvsComputer, vbOKOnly, "Connection Error"
  2554. 					Reset
  2555. 					Exit Sub
  2556. 				End If
  2557. 			Next
  2558. 			Set gvoWMIrootCimv2 = GetObject( "winmgmts://" & gvsComputer & "/root/CIMV2" )
  2559. 			If Err Then
  2560. 				MsgBox "Error " & Err.Number & " while trying to get access to " & gvsComputer & ": " & Err.Description, vbOKOnly, "Remote WMI Error"
  2561. 				On Error GoTo 0
  2562. 				Reset
  2563. 				Exit Sub
  2564. 			End If
  2565. 			Set gvoWMIrootMSWinStorage  = GetObject( "winmgmts://" & gvsComputer & "/root/Microsoft/Windows/Storage" )
  2566. 			Set gvoWMIrootStandardCimv2 = GetObject( "winmgmts://" & gvsComputer & "/root/StandardCimv2" )
  2567. 			Set gvoWMIrootWMI           = GetObject( "winmgmts://" & gvsComputer & "/root/WMI" )
  2568. 		End If
  2569.  
  2570. 		' Diable WinSAT for Windows XP and older
  2571. 		If CInt( Left( CStr( gviNumOS ), 1 ) ) < 6 Then gvaDefaultsBool.Item( "NOSCORES"  ) = True
  2572. 		EnableWinSATScores
  2573.  
  2574. 		On Error Goto 0
  2575.  
  2576. 		gvsHeader = "Computer:" & vbTab & "WinPE"
  2577. 		gvsCSVTxt = gvsComputer & vbTab & CStr( gvbWinPE )
  2578.  
  2579.  
  2580. 		InventoryWinSATScores
  2581. 		InventoryCPU
  2582. 		InventoryMemory
  2583. 		InventoryFDD
  2584. 		InventoryHDD
  2585. 		InventoryCDROM
  2586. 		InventoryVideo
  2587. 		InventoryMonitor
  2588. 		InventorySound
  2589. 		InventoryNIC
  2590. 		InventoryMainBoard
  2591. 		InventoryKeyboard
  2592. 		InventoryMouse
  2593. 		InventoryPorts
  2594. 		InventoryBIOS
  2595.  
  2596. 		If CheckboxVideo.Checked Then
  2597. 			If gvaSettingsBool.Item( "DXDIAG" ) Then
  2598. 				blnSuccess = InventoryDirectX( )
  2599. 				If Not blnSuccess Then MsgBox "There was an error reading the DirectX data:" & vbCrLf & "Unable to load """ & gvaSettingsStr.Item( "XML" ) & """", vbOKOnly, "XML error"
  2600. 			End If
  2601. 			Add2CsvVideo
  2602. 		End If
  2603.  
  2604. 		If gvaSettingsBool.Item( "DEVTEST" ) Then
  2605. 			ComputerName.value = "MYPC"
  2606. 			InputDxDiag.value  = "C:\Scripts\Hardware.xml"
  2607. 		Else
  2608. 			ComputerName.value = gvsComputer
  2609. 		End If
  2610.  
  2611. 		' Write the inventory data to the hidden area named "PrintScreen".
  2612. 		' This allows printing with Ctrl+P instead of the Print button.
  2613. 		PrintScreen.innerHTML = PrintTable( )
  2614.  
  2615. 		Set colItems = document.getElementsByTagName( "input" )
  2616. 		For Each objItem In colItems
  2617. 			If objItem.type = "text" Then
  2618. 				objItem.title = objItem.value
  2619. 			End If
  2620. 		Next
  2621. 		Set colItems = Nothing
  2622.  
  2623. 		ButtonCopy.disabled  = False
  2624. 		ButtonPrint.disabled = False
  2625. 		ButtonSave.disabled  = False
  2626. 		ButtonRun.disabled   = False
  2627. 		ButtonSave.Focus( )
  2628. 	End If
  2629.  
  2630. 	DebugMessage "", "End of inventory"
  2631. End Sub
  2632.  
  2633.  
  2634. Sub InventoryBIOS( )
  2635. 	Dim colItems, objItem, objMatches, objRE
  2636. 	Dim strBIOSDate, strBIOSVersion
  2637.  
  2638. 	On Error Resume Next ' REQUIRED
  2639.  
  2640. 	If CheckBoxBIOS.Checked Then
  2641. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_BIOS WHERE PrimaryBIOS = True" )
  2642. 		If Not Err Then
  2643. 			For Each objItem In colItems
  2644. 				strBIOSVersion = objItem.SMBIOSBIOSVersion
  2645. 				strBIOSDate    = Mid( objItem.ReleaseDate, 5, 2 ) & "/" & Mid( objItem.ReleaseDate, 7, 2 ) & "/" & Left( objItem.ReleaseDate, 4 )
  2646. 				gvsBIOSSerial  = objItem.SerialNumber
  2647. 				If InStr( strBIOSVersion, ":" ) Then ' Convert 01:23:00 to 1.23.00
  2648. 					Set objRE = New RegExp
  2649. 					objRE.Pattern = "^\d+(:\d+)+$"
  2650. 					If objRE.Test( strBIOSVersion ) Then
  2651. 						strBIOSVersion = Replace( strBIOSVersion, ":", "." )
  2652. 						If Len( strBIOSVersion ) > 3 Then
  2653. 							If Left( strBIOSVersion, 1 ) = "0" And Not Left( strBIOSVersion, 2 ) = "0." Then
  2654. 								strBIOSVersion = Mid( strBIOSVersion, 2 )
  2655. 							End If
  2656. 						End If
  2657. 					End If
  2658. 				End If
  2659. 				If gvaSettingsBool.Item( "DEVTEST" ) Then strBIOSVersion = gvoRandom.Next_2( 1, 9 ) & "." & gvoRandom.Next_2( 0, 9 ) & gvoRandom.Next_2( 0, 9 )
  2660. 				BIOSManufacturer.value = objItem.Manufacturer
  2661. 				BIOSModel.value        = objItem.Name
  2662. 				BIOSVersion.value      = strBIOSVersion
  2663. 				BIOSDate.value         = strBIOSDate
  2664.  
  2665. 				ButtonDetailsBIOS.disabled = False
  2666. 			Next
  2667. 		End If
  2668.  
  2669. 		DebugMessage "", "BIOS inventory succeeded: " & CStr( Not ButtonDetailsBIOS.disabled )
  2670.  
  2671. 		Add2CsvBIOS
  2672. 	End If
  2673.  
  2674. 	On Error Goto 0
  2675. End Sub
  2676.  
  2677.  
  2678. Sub InventoryCDROM( )
  2679. 	Dim arrDeviceID, arrHardwareID, arrFirmware
  2680. 	Dim i, intIndex, intRow
  2681. 	Dim colItems, objCDROMFirmwares, objCDROMInterfaces, objCDROMModels, objCell, objItem, objTable, objTableRow
  2682. 	Dim strDeviceID, strDriveLetter, strElement, strFirmware, strInterface
  2683.  
  2684. 	If CheckboxCDROM.Checked Then
  2685. 		On Error Resume Next ' REQUIRED
  2686. 		' Find all CDROM drives without the word "virtual" in their name
  2687. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_CDROMDrive WHERE NOT Name LIKE '%Virtual%'" )
  2688. 		If Err Or IsNull( colItems ) Or colItems.Count = 0 Then
  2689. 			On Error Goto 0
  2690. 			If gvbWinPE And gvsWinDrive <> "" Then InventoryCDROMWinPE
  2691. 		Else
  2692. 			Set objCDROMFirmwares  = CreateObject( "System.Collections.Sortedlist" )
  2693. 			Set objCDROMInterfaces = CreateObject( "System.Collections.Sortedlist" )
  2694. 			Set objCDROMModels     = CreateObject( "System.Collections.Sortedlist" )
  2695. 			For Each objItem In colItems
  2696. 				' Use drive letter without colon as key for CDROM SortedLists
  2697. 				strDriveLetter = Left( objItem.Drive, 1 )
  2698. 				' Parse the PNP Device ID string to get the interface and firmware revision
  2699. 				' Example:
  2700. 				' IDE\CDROM_NEC_DVD_RW_ND-3520AW___________________3.05____\5&2E27B08F&0&0.0.0
  2701. 				' ===  <-  interface                               ====  <-  firmware revision
  2702. 				' The array arrDeviceID will contain 3 elements: "IDE",
  2703. 				' "CDROM_NEC_DVD_RW_ND-3520AW___________________3.05____" and "5&2E27B08F&0&0.0.0"
  2704. 				If InStr( objItem.DeviceID, "\" ) Then
  2705. 					arrDeviceID  = Split( Replace( objItem.DeviceID, "&amp;", "&" ), "\", 3, vbTextCompare )
  2706. 					strInterface = arrDeviceID(0)
  2707. 					strDeviceID  = arrDeviceID(1)
  2708. 					' In our example, strDeviceID will contain "CDROM_NEC_DVD_RW_ND-3520AW___________________3.05____"
  2709. 					' The array arrFirmware will contain the elements "CDROM", "NEC", "DVD", "RW", "ND-3520AW", "3.05" and ""
  2710. 					' strFirmware is assigned the value of the last non-empty element in the array
  2711. 					If InStr( strDeviceID, "_" ) Then
  2712. 						arrFirmware  = Split( strDeviceID, "_", -1, vbTextCompare )
  2713. 						If Left( strInterface, 3 ) = "USB" Then strInterface = "USB"
  2714. 						For Each strElement In arrFirmware
  2715. 							If CStr( strElement ) <> "" Then strFirmware = strElement
  2716. 						Next
  2717. 					End If
  2718. 					If gvaSettingsBool.Item( "DEVTEST" ) Then strFirmware = gvoRandom.Next_2( 1, 9 ) & "." & gvoRandom.Next_2( 0, 9 ) & gvoRandom.Next_2( 0, 9 )
  2719. 					objCDROMModels.Item( strDriveLetter )     = objItem.Name
  2720. 					objCDROMInterfaces.Item( strDriveLetter ) = strInterface
  2721. 					objCDROMFirmwares.Item( strDriveLetter )  = strFirmware
  2722. 				End If
  2723. 			Next
  2724.  
  2725.  
  2726. 			Set objTable = document.getElementById( "Results" )
  2727. 			intRow = document.getElementById( "CDROM0" ).rowIndex
  2728. 			CDROM0Index.value     = objCDROMModels.GetKey( 0 ) & ":"
  2729. 			CDROM0Model.value     = objCDROMModels.GetByIndex( 0 )
  2730. 			CDROM0Firmware.value  = objCDROMFirmwares.GetByIndex( 0 )
  2731. 			CDROM0Interface.value = objCDROMInterfaces.GetByIndex( 0 )
  2732.  
  2733. 			If objCDROMModels.Count > 1 Then
  2734. 				document.getElementById( "MultipleCDROMs" ).style.display = "inline"
  2735. 				For i = 1 To objCDROMModels.Count - 1
  2736. 					Set objTableRow   = objTable.insertRow( intRow + i )
  2737. 					objTableRow.id    = "CDROM" & i
  2738.  
  2739. 					Set objCell       = objTableRow.insertCell( 0 )
  2740. 					objCell.innerHTML = "&nbsp;"
  2741.  
  2742. 					Set objCell       = objTableRow.insertCell( 1 )
  2743. 					objCell.innerHTML = "&nbsp;"
  2744.  
  2745. 					Set objCell       = objTableRow.insertCell( 2 )
  2746. 					objCell.innerHTML = "&nbsp;"
  2747.  
  2748. 					Set objCell       = objTableRow.insertCell( 3 )
  2749. 					objCell.innerHTML = "&nbsp;"
  2750.  
  2751. 					Set objCell       = objTableRow.insertCell( 4 )
  2752. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Index"" size=""12"" value=""" & objCDROMModels.GetKey( i ) & ":"" readonly />"
  2753.  
  2754. 					Set objCell       = objTableRow.insertCell( 5 )
  2755. 					objCell.innerHTML = "&nbsp;"
  2756.  
  2757. 					Set objCell       = objTableRow.insertCell( 6 )
  2758. 					objCell.setAttribute "colSpan", 3
  2759. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Model"" size=""40"" value=""" & objCDROMModels.GetByIndex( i ) & """ readonly />"
  2760.  
  2761. 					Set objCell       = objTableRow.insertCell( 7 )
  2762. 					objCell.innerHTML = "&nbsp;"
  2763.  
  2764. 					Set objCell       = objTableRow.insertCell( 8 )
  2765. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Firmware"" size=""16"" value=""" & objCDROMFirmwares.GetByIndex( i ) & """ readonly />"
  2766.  
  2767. 					Set objCell       = objTableRow.insertCell( 9 )
  2768. 					objCell.innerHTML = "&nbsp;"
  2769.  
  2770. 					Set objCell       = objTableRow.insertCell( 10 )
  2771. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Interface"" size=""16"" value=""" & objCDROMInterfaces.GetByIndex( i ) & """ readonly />"
  2772.  
  2773. 					Set objCell      = Nothing
  2774. 					Set objTableRow  = Nothing
  2775. 				Next
  2776. 			End If
  2777.  
  2778. 			ButtonDetailsCDROM.disabled = ( objCDROMModels.Count = 0 )
  2779.  
  2780. 			DebugMessage "", "CDROM inventory succeeded: " & CStr( Not ButtonDetailsCDROM.disabled )
  2781.  
  2782. 			Set objTable           = Nothing
  2783. 			Set objCDROMModels     = Nothing
  2784. 			Set objCDROMFirmwares  = Nothing
  2785. 			Set objCDROMInterfaces = Nothing
  2786.  
  2787. 			On Error Goto 0
  2788.  
  2789. 			Add2CsvCDROM
  2790. 		End If
  2791. 	End If
  2792. End Sub
  2793.  
  2794.  
  2795. Sub InventoryCDROMWinPE( )
  2796. 	Dim arrHardwareID, arrRegKeys, arrSubKeys, arrTest
  2797. 	Dim dicDescriptions, dicFirmware, dicHardwareIDs, dicInterfaces
  2798. 	Dim colItems, objItem, objRE, objReg
  2799. 	Dim i, intIndex, j
  2800. 	Dim strDescription, strDictKey, strRegKey, strRegSubKey, strWMIQuery
  2801.  
  2802. 	Set dicDescriptions = CreateObject( "Scripting.Dictionary" )
  2803. 	Set dicFirmware     = CreateObject( "Scripting.Dictionary" )
  2804. 	Set dicHardwareIDs  = CreateObject( "Scripting.Dictionary" )
  2805. 	Set dicInterfaces   = CreateObject( "Scripting.Dictionary" )
  2806. 	Set objRE           = New RegExp
  2807.  
  2808. 	' Mount registry hive from Windows Drive
  2809. 	gvoWSHShell.Run "CMD.EXE /C REG.EXE Load HKLM\TempHive " & gvsWinDrive & "\windows\system32\config\system", 0, True
  2810.  
  2811. 	' Scan the temporary registry hive for IDE CDROM devices
  2812. 	strWMIQuery = "winmgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv"
  2813. 	Set objReg = GetObject( strWMIQuery )
  2814. 	objReg.EnumKey HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\IDE", arrRegKeys
  2815. 	If Not IsNull( arrRegKeys ) Then
  2816. 		For i = 0 To UBound( arrRegKeys )
  2817. 			strRegKey = arrRegKeys(i)
  2818. 			If Left( UCase( strRegKey ), 5 ) = "CDROM" Then
  2819. 				objReg.EnumKey HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\IDE\" & strRegKey, arrSubKeys
  2820. 				For Each strRegSubKey In arrSubKeys
  2821. 					objReg.GetMultiStringValue HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\IDE\" & strRegKey & "\" & strRegSubKey, "HardwareID", arrHardwareID
  2822. 					If Not IsNull( arrHardwareID ) Then
  2823. 						If InStr( UCase( arrHardwareID(0) ), "VIRTUAL" ) = 0 Then
  2824. 							If Left( UCase( arrHardwareID(0) ), 4 ) = "IDE\"  Then arrHardwareID(0) = Mid( arrHardwareID(0), 5 )
  2825. 							If Left( UCase( arrHardwareID(0) ), 5 ) = "CDROM" Then arrHardwareID(0) = Mid( arrHardwareID(0), 6 )
  2826. 							objReg.GetStringValue HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\IDE\" & strRegKey & "\" & strRegSubKey, "FriendlyName", strDescription
  2827. 							strDictKey = objRE.Replace( arrHardwareID(0), "" )
  2828. 							dicHardwareIDs.Item( strDictKey )  = arrHardwareID(0)
  2829. 							dicDescriptions.Item( strDictKey ) = strDescription
  2830. 							dicInterfaces.Item( strDictKey )   = "IDE"
  2831. 							arrTest = Split( arrHardwareID(0), "_" )
  2832. 							For j = 0 To UBound( arrTest )
  2833. 								If Not arrTest(i) = "" Then
  2834. 									dicFirmware.Item( strDictKey ) = arrTest(j)
  2835. 								End If
  2836. 							Next
  2837. 						End If
  2838. 						arrHardwareID = Null
  2839. 					End If
  2840. 				Next
  2841. 				arrSubKeys = Null
  2842. 			End If
  2843. 		Next
  2844. 		arrRegKeys = Null
  2845. 	End If
  2846.  
  2847. 	' Scan the temporary registry hive for SCSI CDROM devices
  2848. 	objReg.EnumKey HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\SCSI", arrRegKeys
  2849. 	If Not IsNull( arrRegKeys ) Then
  2850. 		For Each strRegKey In arrRegKeys
  2851. 			If Left( UCase( strRegKey ), 5 ) = "CDROM" Then
  2852. 				objReg.EnumKey HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\SCSI\" & strRegKey, arrSubKeys
  2853. 				For Each strRegSubKey In arrSubKeys
  2854. 					objReg.GetMultiStringValue HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\SCSI\" & strRegKey & "\" & strRegSubKey, "HardwareID", arrHardwareID
  2855. 					If Not IsNull( arrHardwareID ) Then
  2856. 						If InStr( UCase( arrHardwareID(0) ), "VIRTUAL" ) = 0 Then
  2857. 							If Left( UCase( arrHardwareID(0) ), 5 ) = "SCSI\" Then arrHardwareID(0) = Mid( arrHardwareID(0), 6 )
  2858. 							If Left( UCase( arrHardwareID(0) ), 5 ) = "CDROM" Then arrHardwareID(0) = Mid( arrHardwareID(0), 6 )
  2859. 							objReg.GetStringValue HKEY_LOCAL_MACHINE, "TempHive\ControlSet001\Enum\SCSI\" & strRegKey & "\" & strRegSubKey, "FriendlyName", strDescription
  2860. 							strDictKey = objRE.Replace( arrHardwareID(0), "" )
  2861. 							dicHardwareIDs.Item( strDictKey )  = arrHardwareID(0)
  2862. 							dicDescriptions.Item( strDictKey ) = strDescription
  2863. 							dicInterfaces.Item( strDictKey )   = "SCSI"
  2864. 							arrTest = Split( arrHardwareID(0), "_" )
  2865. 							For i = 0 To UBound( arrTest )
  2866. 								If Not arrTest(i) = "" Then
  2867. 									dicFirmware.Item( strDictKey ) = arrTest(i)
  2868. 								End If
  2869. 							Next
  2870. 						End If
  2871. 						arrHardwareID = Null
  2872. 					End If
  2873. 				Next
  2874. 				arrSubKeys = Null
  2875. 			End If
  2876. 		Next
  2877. 		arrRegKeys = Null
  2878. 	End If
  2879.  
  2880. 	' Show the results
  2881. 	If dicHardwareIDs.Count > 0 Then
  2882. 		CDROM0Index.value     = dicDescriptions.Keys(0)
  2883. 		CDROM0Model.value     = dicDescriptions(0)
  2884. 		CDROM0Firmware.value  = dicFirmware(0)
  2885. 		CDROM0Interface.value = dicInterfaces(0)
  2886.  
  2887. 		If objCDROMModels.Count > 1 Then
  2888. 			MultipleCDROMs.style.display = "inline"
  2889. 			Set objTable = document.getElementById( "Results" )
  2890. 			intRow = document.getElementById( "CDROM0" ).rowIndex
  2891. 			For i = 1 To objCDROMModels.Count - 1
  2892. 				Set objTableRow   = objTable.insertRow( intRow + i )
  2893. 				objTableRow.id    = "CDROM" & i
  2894. 				Set objCell       = objTableRow.insertCell( 0 )
  2895. 				objCell.innerHTML = "&nbsp;"
  2896. 				Set objCell       = objTableRow.insertCell( 1 )
  2897. 				objCell.innerHTML = "&nbsp;"
  2898. 				Set objCell       = objTableRow.insertCell( 2 )
  2899. 				objCell.innerHTML = "&nbsp;"
  2900. 				Set objCell       = objTableRow.insertCell( 3 )
  2901. 				objCell.innerHTML = "&nbsp;"
  2902. 				Set objCell       = objTableRow.insertCell( 4 )
  2903. 				objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Index"" size=""12"" value=""" & dicDescriptions.Keys(i) & ":"" readonly />"
  2904. 				Set objCell       = objTableRow.insertCell( 5 )
  2905. 				objCell.innerHTML = "&nbsp;"
  2906. 				Set objCell       = objTableRow.insertCell( 6 )
  2907. 				objcell.setAttribute "colSpan", 3
  2908. 				objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Model"" size=""40"" value=""" & dicDescriptions(i) & """ readonly />"
  2909. 				Set objCell       = objTableRow.insertCell( 7 )
  2910. 				objCell.innerHTML = "&nbsp;"
  2911. 				Set objCell       = objTableRow.insertCell( 8 )
  2912. 				objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Firmware"" size=""16"" value=""" & dicFirmware(i) & """ readonly />"
  2913. 				Set objCell       = objTableRow.insertCell( 9 )
  2914. 				objCell.innerHTML = "&nbsp;"
  2915. 				Set objCell       = objTableRow.insertCell( 10 )
  2916. 				objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""CDROM" & i & "Interface"" size=""16"" value=""" & dicInterfaces(i) & """ readonly />"
  2917. 				Set objCell      = Nothing
  2918. 				Set objTableRow  = Nothing
  2919. 			Next
  2920. 			Set objTable = Nothing
  2921. 		End If
  2922. 	End If
  2923.  
  2924. 	DebugMessage "", "CDROM inventory succeeded: " & CStr( Not ButtonDetailsCDROM.disabled )
  2925.  
  2926. 	' Unmount temporary registry hive
  2927. 	gvoWSHShell.Run "CMD.EXE /C REG.EXE Unload HKLM\TempHive", 0, True
  2928. 	Set dicDescriptions = Nothing
  2929. 	Set dicFirmware     = Nothing
  2930. 	Set dicHardwareIDs  = Nothing
  2931. 	Set dicInterfaces   = Nothing
  2932. 	Set objRE           = Nothing
  2933.  
  2934. 	Add2CsvCDROM
  2935. End Sub
  2936.  
  2937.  
  2938. Sub InventoryCPU( )
  2939. 	Dim colItems, objItem
  2940.  
  2941. 	If CheckBoxCPU.Checked Then
  2942. 		On Error Resume Next ' REQUIRED
  2943.  
  2944. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_Processor" )
  2945. 		If Not Err Then
  2946. 			gvcCPU = colItems.Count
  2947. 			CPUNumber.value = gvcCPU
  2948. 			If gvcCPU > 1 Then MultipleCPU.InnerHTML  = "s"
  2949. 			For Each objItem In colItems
  2950. 				CPUModel.value  = Trim( objItem.Name )
  2951. 				CPUSpeed.value  = objItem.CurrentClockSpeed
  2952. 				CPUSocket.value = objItem.SocketDesignation
  2953. 			Next
  2954. 			ButtonDetailsCPU.disabled = False
  2955. 		End If
  2956.  
  2957. 		On Error Goto 0
  2958.  
  2959. 		DebugMessage "", "CPU inventory succeeded: " & CStr( Not ButtonDetailsCPU.disabled )
  2960.  
  2961. 		Add2CsvCPU
  2962. 	End If
  2963. End Sub
  2964.  
  2965.  
  2966. Function InventoryDirectX( )
  2967. 	Dim blnLoaded, i
  2968. 	Dim colItems, colNodes, objItem, objNode, xmlDoc
  2969. 	Dim strDxDiag, strQuery, strSysDir
  2970.  
  2971. 	strSysDir = gvoWSHShell.ExpandEnvironmentStrings( "%Windir%\System32" )
  2972. 	strDxDiag = gvoFSO.BuildPath( strSysDir, "DxDiag.exe" )
  2973.  
  2974. 	' Delete old XML file if it exists, unless specified otherwise
  2975. 	If Not gvaSettingsBool.Item( "KEEPXML" ) Then
  2976. 		If gvoFSO.FileExists( gvaSettingsStr.Item( "XML" ) ) Then gvoFSO.DeleteFile gvaSettingsStr.Item( "XML" ), True
  2977. 	End If
  2978.  
  2979. 	' Run DXDIAG.EXE, if required, and save results in XML file
  2980. 	If gvoFSO.FileExists( gvaSettingsStr.Item( "XML" ) ) Then
  2981. 		If Not gvaSettingsBool.Item( "KEEPXML" ) Then
  2982. 			gvoFSO.DeleteFile gvaSettingsStr.Item( "XML" ), True
  2983. 			Sleep 2
  2984. 			gvoWSHShell.Run strDxDiag & " /whql:off /x " & gvaSettingsStr.Item( "XML" ), 7, False
  2985. 		End If
  2986. 	Else
  2987. 		gvoWSHShell.Run strDxDiag & " /whql:off /x " & gvaSettingsStr.Item( "XML" ), 7, False
  2988. 	End If
  2989.  
  2990. 	' Wait until XML file is created, 5 minutes maximum
  2991. 	For i = 1 To 150
  2992. 		Sleep 1
  2993. 		If gvoFSO.FileExists( gvaSettingsStr.Item( "XML" ) ) Then Exit For
  2994. 		Sleep 1
  2995. 	Next
  2996.  
  2997. 	' Wait for DXDIAG to close, 30 seconds maximum
  2998. 	Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_Process WHERE Caption='DxDiag.exe'" )
  2999. 	For i = 1 To 5
  3000. 		If colItems.count = 0 Then Exit For
  3001. 		Sleep 6
  3002. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_Process WHERE Caption='DxDiag.exe'" )
  3003. 	Next
  3004.  
  3005. 	' Open the XML file created by DXDIAG
  3006. 	Set xmlDoc = CreateObject( "Microsoft.XMLDOM" )
  3007. 	xmlDoc.Async = "False"
  3008. 	blnLoaded = xmlDoc.Load( gvaSettingsStr.Item( "XML" ) )
  3009. 	If Not blnLoaded Then
  3010. 		' Retry 5 times maximum, with 6 seconds interval
  3011. 		For i = 1 To 15
  3012. 			Sleep 2
  3013. 			blnLoaded = xmlDoc.Load( gvaSettingsStr.Item( "XML" ) )
  3014. 			If blnLoaded Then Exit For
  3015. 		Next
  3016. 		Sleep 2
  3017. 		MsgBox "Process DxDiag.exe still running", vbOKOnly, "DxDiag error"
  3018. 	End If
  3019.  
  3020. 	If blnLoaded Then
  3021. 		ReDim gvaVideo( 4, 0 )
  3022.  
  3023. 		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/DisplayMemory"
  3024. 		Set colNodes = xmlDoc.selectNodes( strQuery )
  3025. 		i = 0
  3026. 		For Each objNode in colNodes
  3027. 			ReDim Preserve gvaVideo( 4, i )
  3028. 			gvaVideo( 0, i ) = Trim( Replace( objNode.text, "MB", "" ) )
  3029. 			i = i + 1
  3030. 		Next
  3031.  
  3032. 		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/CurrentMode"
  3033. 		Set colNodes = xmlDoc.selectNodes( strQuery )
  3034. 		i = 0
  3035. 		For Each objNode in colNodes
  3036. 			gvaVideo( 1, i ) = Trim( objNode.text )
  3037. 			i = i + 1
  3038. 		Next
  3039.  
  3040. 		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/MonitorName"
  3041. 		Set colNodes = xmlDoc.selectNodes( strQuery )
  3042. 		i = 0
  3043. 		For Each objNode in colNodes
  3044. 			gvaVideo( 2, i ) = Trim( objNode.text )
  3045. 			i = i + 1
  3046. 		Next
  3047.  
  3048. 		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/MonitorModel"
  3049. 		Set colNodes = xmlDoc.selectNodes( strQuery )
  3050. 		i = 0
  3051. 		For Each objNode in colNodes
  3052. 			gvaVideo( 3, i ) = Trim( objNode.text )
  3053. 			i = i + 1
  3054. 		Next
  3055.  
  3056. 		strQuery = "/DxDiag/DisplayDevices/DisplayDevice/CardName"
  3057. 		Set colNodes = xmlDoc.selectNodes( strQuery )
  3058. 		i = 0
  3059. 		For Each objNode in colNodes
  3060. 			gvaVideo( 4, i ) = Trim( objNode.text )
  3061. 			i = i + 1
  3062. 		Next
  3063.  
  3064. 		InventoryDirectX = True
  3065. 	Else
  3066. 		InventoryDirectX = False
  3067. 	End If
  3068.  
  3069. 	' Clean up
  3070. 	Set colNodes = Nothing
  3071. 	Set xmlDoc   = Nothing
  3072.  
  3073. 	DebugMessage "", "DirectX inventory succeeded: " & CStr( InventoryDirectX )
  3074. End Function
  3075.  
  3076.  
  3077. Sub InventoryFDD( )
  3078. 	Dim cntAllFloppy, cntIntFloppy, cntUSBFloppy, i, intRow
  3079. 	Dim colItems, colItems2, objCell, objFDDCapacities, objFDDDescriptions, objFDDInterfaces, objItem, objItem2, objRE, objTable, objTableRow
  3080. 	Dim strDriveLetter, strInterface, strQuery
  3081.  
  3082. 	If CheckboxFDD.Checked Then
  3083. 		On Error Resume Next ' REQUIRED
  3084.  
  3085. 		strInterface = "Unknown"
  3086. 		cntAllFloppy = 0
  3087. 		cntIntFloppy = 0
  3088. 		cntUSBFloppy = 0
  3089.  
  3090. 		' Count total number of floppy disk drives
  3091. 		strQuery = "SELECT * FROM Win32_PnPEntity WHERE PNPClass='FloppyDisk'"
  3092. 		Set colItems = gvoWMIrootCimv2.ExecQuery( strQuery )
  3093. 		If Not Err Then cntAllFloppy = colItems.Count
  3094. 		' Count number of USB-attached floppy disk drives
  3095. 		strQuery = "SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID LIKE 'USBSTOR%FLOPPY%'"
  3096. 		Set colItems = gvoWMIrootCimv2.ExecQuery( strQuery )
  3097. 		If Not Err Then cntUSBFloppy = colItems.Count
  3098. 		' Count number of internal floppy drive connectors
  3099. 		strQuery = "SELECT * FROM Win32_PortConnector"
  3100. 		Set colItems = gvoWMIrootCimv2.ExecQuery( strQuery )
  3101. 		If Not Err Then
  3102. 			For Each objItem In colItems
  3103. 				If objItem.PortType <> Null Then
  3104. 					For i = 0 To Len( objItem.PortType ) - 1
  3105. 						If objItem.PortType(i) = 89 Or objItem.PortType(i) = 91 Then
  3106. 							cntIntFloppy = cntIntFloppy + 1
  3107. 						End If
  3108. 					Next
  3109. 				End If
  3110. 			Next
  3111. 		End If
  3112. 		' Check if all floppy drives have identical interface types; if not, too bad, it is impossible to link a specific floppy drive to a specific interface
  3113. 		If cntAllFloppy = cntUSBFloppy Then
  3114. 			strInterface = "USB"
  3115. 		ElseIf cntUSBFloppy = 0 And cntIntFloppy >= cntAllFloppy Then
  3116. 			strInterface = "Flatcable"
  3117. 		End If
  3118. 		' Find all floppy disk drives
  3119. 		strQuery = "SELECT * FROM Win32_LogicalDisk WHERE DriveType=2 AND MediaType IS NOT NULL AND MediaType != 0 AND MediaType != 11 AND MediaType != 12" 
  3120. 		Set colItems = gvoWMIrootCimv2.ExecQuery( strQuery )
  3121. 		If colItems.Count > 0 And Not Err Then
  3122. 			Set objFDDCapacities   = CreateObject( "System.Collections.Sortedlist" )
  3123. 			Set objFDDDescriptions = CreateObject( "System.Collections.Sortedlist" )
  3124. 			Set objFDDInterfaces   = CreateObject( "System.Collections.Sortedlist" )
  3125. 			Set objRE = New RegExp
  3126. 			For Each objItem In colItems
  3127. 				If Trim( "" & objItem.DeviceId ) <> "" Then
  3128. 					strDriveLetter = Left( objItem.DeviceId, 1 )
  3129. 					'Set colItems2 = objWMIService.ExecQuery( "SELECT * FROM MSFT_Volume WHERE DriveLetter=""" & strDriveLetter & """" )
  3130. 					objRE.Pattern    = "[\d\.]+\s*[MK]B$"
  3131. 					objRE.IgnoreCase = True
  3132. 					If objRE.Test( GetMediaType( objItem.MediaType ) ) Then
  3133. 						objFDDCapacities.Item( strDriveLetter ) = objRE.Execute( GetMediaType( objItem.MediaType ) )(0)
  3134. 					Else
  3135. 						objFDDCapacities.Item( strDriveLetter ) = "Unknown"
  3136. 					End If
  3137. 					objFDDDescriptions.Item( strDriveLetter ) = objItem.Description
  3138. 					objFDDInterfaces.Item( strDriveLetter )   = strInterface
  3139. 				End If
  3140. 			Next
  3141.  
  3142. 			FDD0DeviceID.value    = objFDDDescriptions.GetKey( 0 ) & ":"
  3143. 			FDD0Description.value = objFDDDescriptions.GetByIndex( 0 )
  3144. 			FDD0Capacity.value    = objFDDCapacities.GetByIndex( 0 )
  3145. 			FDD0Interface.value   = objFDDInterfaces.GetByIndex( 0 )
  3146.  
  3147. 			If objFDDDescriptions.Count > 1 Then
  3148. 				document.getElementById( "MultipleFDDs" ).style.display = "inline"
  3149. 				Set objTable = document.getElementById( "Results" )
  3150. 				intRow = document.getElementById( "FDD0" ).rowIndex
  3151. 				For i = 1 To objFDDDescriptions.Count - 1
  3152. 					Set objTableRow   = objTable.insertRow( intRow + i )
  3153. 					objTableRow.id    = "FDD" & i
  3154. 					Set objCell       = objTableRow.insertCell( 0 )
  3155. 					objCell.innerHTML = "&nbsp;"
  3156. 					Set objCell       = objTableRow.insertCell( 1 )
  3157. 					objCell.innerHTML = "&nbsp;"
  3158. 					Set objCell       = objTableRow.insertCell( 2 )
  3159. 					objCell.innerHTML = "&nbsp;"
  3160. 					Set objCell       = objTableRow.insertCell( 3 )
  3161. 					objCell.innerHTML = "&nbsp;"
  3162. 					Set objCell       = objTableRow.insertCell( 4 )
  3163. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""FDD" & i & "DeviceID"" size=""12"" value=""" & objFDDDescriptions.GetKey( i ) & ":"" readonly />"
  3164. 					Set objCell       = objTableRow.insertCell( 5 )
  3165. 					objCell.innerHTML = "&nbsp;"
  3166. 					Set objCell       = objTableRow.insertCell( 6 )
  3167. 					objcell.setAttribute "colSpan", 3
  3168. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""FDD" & i & "Description"" size=""40"" value=""" & objFDDDescriptions.GetByIndex( i ) & """ readonly />"
  3169. 					Set objCell       = objTableRow.insertCell( 7 )
  3170. 					objCell.innerHTML = "&nbsp;"
  3171. 					Set objCell       = objTableRow.insertCell( 8 )
  3172. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""FDD" & i & "Capacity"" size=""16"" value=""" & objFDDCapacities.GetByIndex( i ) & """ readonly />"
  3173. 					Set objCell       = objTableRow.insertCell( 9 )
  3174. 					objCell.innerHTML = "&nbsp;"
  3175. 					Set objCell       = objTableRow.insertCell( 10 )
  3176. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""FDD" & i & "Interface"" size=""16"" value=""" & objFDDInterfaces.GetByIndex( i ) & """ readonly />"
  3177. 					Set objCell       = Nothing
  3178. 					Set objTableRow   = Nothing
  3179. 				Next
  3180. 				Set objTable = Nothing
  3181. 			End If
  3182.  
  3183. 			Set objFDDDescriptions = Nothing
  3184. 			Set objFDDInterfaces   = Nothing
  3185.  
  3186. 			ButtonDetailsFDD.disabled = False
  3187. 		End If
  3188.  
  3189. 		On Error GoTo 0
  3190.  
  3191. 		DebugMessage "", "FDD inventory succeeded: " & CStr( Not ButtonDetailsFDD.disabled )
  3192.  
  3193. 		Add2CsvFDD
  3194. 	End If
  3195. End Sub
  3196.  
  3197.  
  3198. Sub InventoryHDD( )
  3199. 	Dim i, intRow
  3200. 	Dim colItems, objCell, objHDDInterfaces, objHDDModels, objHDDSizes, objItem, objTable, objTableRow
  3201. 	Dim strQuery
  3202.  
  3203. 	If CheckboxHDD.Checked Then
  3204. 		On Error Resume Next ' REQUIRED
  3205.  
  3206. 		strQuery = "SELECT * FROM MSFT_PhysicalDisk"
  3207. 		Set colItems = gvoWMIrootMSWinStorage.ExecQuery( strQuery )
  3208. 		If Not Err Then
  3209. 			' Using SortedList instead of array because there may be "gaps" in the list of disk indexes
  3210. 			Set objHDDInterfaces = CreateObject( "System.Collections.Sortedlist" )
  3211. 			Set objHDDModels     = CreateObject( "System.Collections.Sortedlist" )
  3212. 			Set objHDDSizes      = CreateObject( "System.Collections.Sortedlist" )
  3213. 			For Each objItem In colItems
  3214. 				If gvaSettingsBool.Item( "USBSTOR" ) Or Not GetBusType( objItem.BusType ) = "USB" Then
  3215. 					If gvaSettingsBool.Item( "VIRTUAL" ) Or InStr( LCase( objItem.FriendlyName ), "virtual" ) = 0 Then
  3216. 						objHDDModels.Item( CInt( objItem.DeviceID ) )     = objItem.FriendlyName
  3217. 						objHDDSizes.Item( CInt( objItem.DeviceID ) )      = Round( objItem.Size / GB )
  3218. 						objHDDInterfaces.Item( CInt( objItem.DeviceID ) ) = GetBusType( objItem.BusType )
  3219. 					End If
  3220. 				End If
  3221. 			Next
  3222.  
  3223. 			HardDisk0Index.value     = objHDDModels.GetKey( 0 ) & ":"
  3224. 			HardDisk0Model.value     = objHDDModels.GetByIndex( 0 )
  3225. 			HardDisk0Size.value      = objHDDSizes.GetByIndex( 0 )
  3226. 			HardDisk0Interface.value = objHDDInterfaces.GetByIndex( 0 )
  3227. 			ButtonDetailsHDD.disabled = False
  3228.  
  3229. 			If objHDDModels.Count > 1 Then
  3230. 				document.getElementById( "MultipleHDUs" ).style.display = "inline"
  3231. 				Set objTable = document.getElementById( "Results" )
  3232. 				intRow = document.getElementById( "HardDisk0" ).rowIndex
  3233. 				For i = 1 To objHDDModels.Count - 1
  3234. 					Set objTableRow   = objTable.insertRow( intRow + i )
  3235. 					objTableRow.id    = "HardDisk" & i
  3236. 					Set objCell       = objTableRow.insertCell( 0 )
  3237. 					objCell.innerHTML = "&nbsp;"
  3238. 					Set objCell       = objTableRow.insertCell( 1 )
  3239. 					objCell.innerHTML = "&nbsp;"
  3240. 					Set objCell       = objTableRow.insertCell( 2 )
  3241. 					objCell.innerHTML = "&nbsp;"
  3242. 					Set objCell       = objTableRow.insertCell( 3 )
  3243. 					objCell.innerHTML = "&nbsp;"
  3244. 					Set objCell       = objTableRow.insertCell( 4 )
  3245. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""HardDisk" & i & "Index"" size=""12"" value=""" & objHDDModels.GetKey( i ) & """ readonly />"
  3246. 					Set objCell       = objTableRow.insertCell( 5 )
  3247. 					objCell.innerHTML = "&nbsp;"
  3248. 					Set objCell       = objTableRow.insertCell( 6 )
  3249. 					objCell.setAttribute "colSpan", 3
  3250. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""HardDisk" & i & "Model"" size=""40"" value=""" & objHDDModels.GetByIndex( i ) & """ readonly />"
  3251. 					Set objCell       = objTableRow.insertCell( 7 )
  3252. 					objCell.innerHTML = "&nbsp;"
  3253. 					Set objCell       = objTableRow.insertCell( 8 )
  3254. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""HardDisk" & i & "Size"" size=""16"" value=""" & objHDDSizes.GetByIndex( i ) & """ readonly />"
  3255. 					Set objCell       = objTableRow.insertCell( 9 )
  3256. 					objCell.innerHTML = "&nbsp;"
  3257. 					Set objCell       = objTableRow.insertCell( 10 )
  3258. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""HardDisk" & i & "Interface"" size=""16"" value=""" & objHDDInterfaces.GetByIndex( i ) & """ readonly />"
  3259. 					Set objCell       = Nothing
  3260. 					Set objTableRow   = Nothing
  3261. 				Next
  3262. 				Set objTable = Nothing
  3263. 			End If
  3264.  
  3265. 			Set objHDDInterfaces = Nothing
  3266. 			Set objHDDModels     = Nothing
  3267. 			Set objHDDSizes      = Nothing
  3268. 		End If
  3269.  
  3270. 		On Error Goto 0
  3271.  
  3272. 		DebugMessage "", "HDD inventory succeeded: " & CStr( Not ButtonDetailsHDD.disabled )
  3273.  
  3274. 		Add2CsvHDD
  3275. 	End If
  3276. End Sub
  3277.  
  3278.  
  3279. Sub InventoryKeyboard( )
  3280. 	Dim arrConnectorTypes, arrHardwareTypes
  3281. 	Dim blnHideFkeys
  3282. 	Dim intButtons, intConnectorType, intCount, intFkeys, intLEDs
  3283. 	Dim colItems, objItem
  3284. 	Dim strConnectorType, strKbdPNP, strMouseModel, strMouseType
  3285.  
  3286. 	If CheckboxKeyboard.checked Then
  3287. 		' Enumeration of connector and hardware types
  3288. 		arrConnectorTypes = Array( "I8042", "Serial", "USB" )
  3289. 		ReDim Preserve arrDeviceInterfaces( 162 )
  3290. 		arrDeviceInterfaces( 160 ) = "Bus mouse DB-9"
  3291. 		arrDeviceInterfaces( 161 ) = "Bus mouse micro-DIN"
  3292. 		arrDeviceInterfaces( 162 ) = "USB"
  3293.  
  3294. 		On Error Resume Next ' REQUIRED
  3295.  
  3296. 		blnHideFkeys = Not gvbIsElevated
  3297.  
  3298. 		' Check for keyboard details in root/WMI - this may fail on access denied errors when not running with elevated privileges
  3299. 		intCount  = 0
  3300. 		strKbdPNP = ""
  3301. 		Set colItems = gvoWMIrootWMI.ExecQuery( "SELECT * FROM MSKeyboard_PortInformation WHERE Active = True" )
  3302. 		If Not Err Then
  3303. 			intCount = colItems.Count
  3304. 			If intCount > 1 Then
  3305. 				Set colItems = gvoWMIrootWMI.ExecQuery( "SELECT * FROM MSKeyboard_PortInformation WHERE Active = True AND Instancename LIKE 'HID\\%'" )
  3306. 				intCount = colItems.Count
  3307. 				If colItems.Count = 0 Then
  3308. 					Set colItems = gvoWMIrootWMI.ExecQuery( "SELECT * FROM MSKeyboard_PortInformation WHERE Active = True AND Instancename LIKE '%&%'" )
  3309. 				End If
  3310. 			End If
  3311. 			For Each objItem In colItems
  3312. 				intFkeys  = 0
  3313. 				intLEDs   = 0
  3314. 				strKbdPNP = Split( objItem.InstanceName, "\" )(1)
  3315. 				intFkeys  = objItem.FunctionKeys
  3316. 				intLEDs   = objItem.Indicators
  3317. 				KeyboardFkLEDs.value = intFkeys & " F-keys; " & intLEDs & " LEDs"
  3318. 				intConnectorType = objItem.ConnectorType
  3319. 				If Not IsEmpty( intConnectorType ) Then
  3320. 					strConnectorType = arrConnectorTypes( intConnectorType )
  3321. 					KeyboardConnector.value = strConnectorType
  3322. 				End If
  3323. 				blnHideFkeys = ( intFkeys = 0 And intLEDs = 0 )
  3324. 			Next
  3325. 			ButtonDetailsKeyboard.disabled = False
  3326. 		End If
  3327.  
  3328. 		If strKbdPNP = "" Then
  3329. 			' Check for keyboard details in root/CIMV2 - this is less likely to fail on access denied errors
  3330. 			intCount = 0
  3331. 			Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_Keyboard" )
  3332. 			If Not Err Then
  3333. 				intCount = colItems.Count
  3334. 				If intCount > 1 Then
  3335. 					Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_Keyboard WHERE NOT PNPDeviceID LIKE 'ACPI\\%'" )
  3336. 					intCount = colItems.Count
  3337. 					If colItems.Count = 0 Then
  3338. 						Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_Keyboard" )
  3339. 					End If
  3340. 				End If
  3341. 				For Each objItem In colItems
  3342. 					If KeyboardModel.value  = "" Then KeyboardModel.value = objItem.Description
  3343. 					If KeyboardType.value   = ""  Then KeyboardType.value  = objItem.Name
  3344. 					If KeyboardFkLEDs.value = "" Then
  3345. 						intFkeys = objItem.NumberOfFunctionkeys
  3346. 						If Not IsEmpty( intFkeys ) And intFkeys > 0 Then KeyboardFkLEDs.value = intFkeys & " F-keys"
  3347. 					End If
  3348. 					KeyboardModel.value = objItem.Description
  3349. 					KeyboardType.value  = objItem.Name
  3350. 					If KeyboardConnector.value = "" Then
  3351. 						strConnectorType = Split( objItem.PNPDeviceID, "\" )(0)
  3352. 						KeyboardConnector.value = strConnectorType
  3353. 					End If
  3354. 				Next
  3355. 				ButtonDetailsKeyboard.disabled = False
  3356. 			End If
  3357. 		Else
  3358. 			Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_Keyboard WHERE PNPDeviceID LIKE '%\\" & strKbdPNP & "\\%'" )
  3359. 			If Not Err Then
  3360. 				For Each objItem In colItems
  3361. 					KeyboardModel.value = objItem.Description
  3362. 					KeyboardType.value  = objItem.Name
  3363. 				Next
  3364. 				ButtonDetailsKeyboard.disabled = False
  3365. 			End If
  3366. 		End If
  3367.  
  3368. 		If blnHideFkeys Then 
  3369. 			' If not running with elevated privileges, this field contains nonsense
  3370. 			KeyboardHeaderFkLEDs.style.visibility = "hidden"
  3371. 			KeyboardFkLEDs.style.visibility       = "hidden"
  3372. 		Else
  3373. 			KeyboardHeaderFkLEDs.style.visibility = "visible"
  3374. 			KeyboardFkLEDs.style.visibility       = "visible"
  3375. 		End if
  3376.  
  3377. 		On Error Goto 0
  3378.  
  3379. 		DebugMessage "", "Keyboard inventory succeeded: " & CStr( Not ButtonDetailsKeyboard.disabled )
  3380.  
  3381. 		Add2CsvKbd
  3382. 	End If
  3383. End Sub
  3384.  
  3385.  
  3386. Sub InventoryMainBoard( )
  3387. 	Dim colItems, objItem, strMBVersion
  3388.  
  3389. 	If CheckboxMainBoard.Checked Then
  3390. 		On Error Resume Next ' REQUIRED
  3391.  
  3392. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_BaseBoard" )
  3393. 		If Not Err Then
  3394. 			For Each objItem In colItems
  3395. 				If gvaSettingsBool.Item( "DEVTEST" ) Then
  3396. 					strMBVersion = gvoRandom.Next_2( 1, 9 ) & "." & gvoRandom.Next_2( 0, 9 ) & gvoRandom.Next_2( 0, 9 )
  3397. 				Else
  3398. 					strMBVersion = objItem.Version
  3399. 				End If
  3400. 				MBManufacturer.value = objItem.Manufacturer
  3401. 				MBModel.value        = objItem.Product
  3402. 				MBVersion.value      = strMBVersion
  3403. 			Next
  3404. 			ButtonDetailsMainBoard.disabled = False
  3405. 		End If
  3406.  
  3407. 		On Error Goto 0
  3408.  
  3409. 		ChassisType.value = GetChassis( )
  3410.  
  3411. 		Add2CsvMainBoard
  3412. 	End If
  3413.  
  3414. 	On Error GoTo 0
  3415.  
  3416. 	DebugMessage "", "Main Board inventory succeeded: " & CStr( Not ButtonDetailsMainBoard.disabled )
  3417. End Sub
  3418.  
  3419.  
  3420. Sub InventoryMemory( )
  3421. 	Dim colItems, objItem
  3422.  
  3423. 	If CheckboxMemory.Checked Then
  3424. 		On Error Resume Next ' REQUIRED
  3425.  
  3426. 		' Capacity filter intended for HP/COMPAQ EVO models
  3427. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_PhysicalMemory WHERE Capacity > 524288" )
  3428. 		If Not Err Then
  3429. 			For Each objItem in colItems
  3430. 				gvcMemory = gvcMemory + 1
  3431. 				gviMemSize = gviMemSize + objItem.Capacity
  3432. 				If gviMemSpeed = 0 Or objItem.Speed < gviMemSpeed Then gviMemSpeed = objItem.Speed
  3433. 			Next
  3434. 			MemoryModules.value = gvcMemory
  3435. 			MemorySize.value    = Round( gviMemSize / MB )
  3436.  
  3437. 			Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_PhysicalMemoryArray" )
  3438. 			For Each objItem In colItems
  3439. 				If objItem.MemoryDevices > gvcBanks Then gvcBanks = objItem.MemoryDevices
  3440. 			Next
  3441. 			ButtonDetailsMemory.disabled = False
  3442. 		End If
  3443.  
  3444. 		On Error Goto 0
  3445.  
  3446. 		MemoryBanks.value = gvcBanks
  3447.  
  3448. 		MemoryFormfactor.value = GetMemoryFormFactor( )
  3449.  
  3450. 		MemorySpeed.value = gviMemSpeed
  3451.  
  3452. 		DebugMessage "", "Memory inventory succeeded: " & CStr( Not ButtonDetailsMemory.disabled )
  3453.  
  3454. 		Add2CsvMemory
  3455. 	End If
  3456. End Sub
  3457.  
  3458.  
  3459. Sub InventoryMonitor( )
  3460. 	Dim arrMonitorDescriptions( ), arrMonitorHardwareIDs( ), arrMonitorManufacturers( ), arrMonitorSerialNumbers( )
  3461. 	Dim blnIsDesktopMonitor
  3462. 	Dim i, intHeight, intIndex, intRow, intWidth, numRatio
  3463. 	Dim colItems, colItems2, objCell, objItem, objItem2, objMatches, objRE, objTable, objTableRow, objWMIService
  3464. 	Dim strDesktopMonitorDeviceDesc, strDesktopMonitorHardwareID, strDesktopMonitorMfg, strDeviceDesc, strInstanceName
  3465. 	Dim strKey, strMfg, strQuery, strQuery2, strSerialNumberID, strSerialNumberLength, strSize
  3466.  
  3467. 	If CheckboxMonitor.Checked Then
  3468. 		On Error Resume Next ' REQUIRED
  3469.  
  3470. 		ButtonDetailsMonitor.disabled = False
  3471.  
  3472. 		' Use Win32_DesktopMonitor to get all the details for 1 monitor only
  3473. 		strQuery = "SELECT * FROM Win32_DesktopMonitor WHERE NOT Description LIKE '%Default%'"
  3474. 		Set objWMIService = GetObject( "winmgmts://" & gvscomputer & "/root/CIMV2" )
  3475. 		Set colItems      = objWMIService.ExecQuery( strQuery )
  3476. 		If Not Err Then
  3477. 			For Each objItem In colItems
  3478. 				strDesktopMonitorHardwareID = UCase( objItem.PNPDeviceID )
  3479. 				strDesktopMonitorDeviceDesc = objItem.Description
  3480. 				strDesktopMonitorMfg        = objItem.MonitorManufacturer
  3481. 			Next
  3482. 		End If
  3483. 		Set colItems      = Nothing
  3484. 		Set objWMIService = Nothing
  3485.  
  3486. 		' Use WmiMonitorID to get some details for all monitors
  3487. 		strQuery = "SELECT * FROM WmiMonitorID"
  3488. 		Set objWMIService = GetObject( "winmgmts://" & gvsComputer & "/root/WMI" )
  3489. 		Set colItems      = objWMIService.ExecQuery( strQuery )
  3490. 		If colItems.Count > 0 Then
  3491. 			ReDim arrMonitorDescriptions( colItems.Count - 1 )
  3492. 			ReDim arrMonitorHardwareIDs( colItems.Count - 1 )
  3493. 			ReDim arrMonitorManufacturers( colItems.Count - 1 )
  3494. 			ReDim arrMonitorSerialNumbers( colItems.Count - 1 )
  3495. 			arrMonitorDescriptions(0)  = strDesktopMonitorDeviceDesc
  3496. 			arrMonitorHardwareIDs(0)   = strDesktopMonitorHardwareID
  3497. 			arrMonitorManufacturers(0) = strDesktopMonitorMfg
  3498. 			intIndex = 1
  3499. 		End If
  3500. 		For Each objItem In colItems
  3501. 			strInstanceName = UCase( objItem.InstanceName )
  3502. 			'strInstanceName = Replace( UCase( Split( objItem.Path_.Path, "=" )(1) ), """", "" ) ' In case the line above doesn't work
  3503. 			blnIsDesktopMonitor = ( InStr( strInstanceName, strDesktopMonitorHardwareID ) = 1 )
  3504. 			If Not blnIsDesktopMonitor Then
  3505. 				' If this is NOT the monitor returned by Win32_DesktopMonitor then we have to query the registry for the Device Description and Manufacturer
  3506. 				' First get the DeviceID as used in the registry by removing a trailing instance index from the InstanceName (e.g. remove "_0" or "_1")
  3507. 				Set objRE = New RegExp
  3508. 				objRE.Pattern = "_\d{1,3}$"
  3509. 				If objRE.Test( strInstanceName ) Then
  3510. 					strInstanceName = objRE.Replace( strInstanceName, "" )
  3511. 				End If
  3512. 				Set objRE = Nothing
  3513. 				arrMonitorHardwareIDs( intIndex ) = strInstanceName
  3514. 				' Read the Device Description from the registry for this monitor
  3515. 				strDeviceDesc = gvoWSHShell.RegRead( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & strInstanceName & "\DeviceDesc" )
  3516. 				If Not IsNull( strDeviceDesc ) Then
  3517. 					If Left( strDeviceDesc, 1 ) <> "(" And InStr( strDeviceDesc, ";" ) > 1 Then
  3518. 						strDeviceDesc = Mid( strDeviceDesc, InStr( strDeviceDesc, ";" ) + 1 )
  3519. 						arrMonitorDescriptions( intIndex ) = strDeviceDesc
  3520. 					End If
  3521. 				End If
  3522. 				' Read the Manufacturer from the registry for this monitor
  3523. 				strMfg = gvoWSHShell.RegRead( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" & strInstanceName & "\Mfg" )
  3524. 				If Not IsNull( strMfg ) Then
  3525. 					If Left( strMfg, 1 ) <> "(" And InStr( strMfg, ";" ) > 1 Then
  3526. 						strMfg = Mid( strMfg, InStr( strMfg, ";" ) + 1 )
  3527. 						arrMonitorManufacturers( intIndex ) = strMfg
  3528. 					End If
  3529. 				End If
  3530. 			End If
  3531. 			strSerialNumberLength = objItem.UserFriendlyNameLength
  3532. 			If gvaSettingsBool.Item( "DEVTEST" ) Then
  3533. 				strSerialNumberID = GetRandomString( strSerialNumberLength )
  3534. 			ElseIf strSerialNumberLength > 0 Then
  3535. 				strSerialNumberID = Chain( objItem.SerialNumberID )
  3536. 			Else
  3537. 				strSerialNumberID = ""
  3538. 			End If
  3539. 			If blnIsDesktopMonitor Then
  3540. 				arrMonitorSerialNumbers(0) = strSerialNumberID
  3541. 			Else
  3542. 				arrMonitorSerialNumbers( intIndex ) = strSerialNumberID
  3543. 			End If
  3544. 			' Get monitor dimensions for this monitor
  3545. 			strQuery2 = "SELECT * FROM WmiMonitorBasicDisplayParams WHERE InstanceName LIKE '" & Replace( strInstanceName, "\", "\\" ) & "%'"
  3546. 			Set colItems2 = objWMIService.ExecQuery( strQuery2 )
  3547. 			If Not Err Then
  3548. 				If colItems2.Count = 1 Then
  3549. 					For Each objItem2 in colItems2
  3550. 						intHeight   = objItem2.MaxVerticalImageSize
  3551. 						intWidth    = objitem2.MaxHorizontalImageSize
  3552. 						If intHeight * intWidth > 0 Then
  3553. 							numRatio = intWidth / intHeight
  3554. 							If gvaSettingsBool.Item( "CM" ) Then
  3555. 								strSize = " (" & intWidth  & " x " & intHeight & " cm"
  3556. 							Else
  3557. 								strSize = " (" & CInt( Sqr( ( intWidth * intWidth ) + ( intHeight * intHeight ) ) / 2.54 ) & """"
  3558. 							End If
  3559. 							If numRatio >= 1.45 Then
  3560. 								strSize = strSize & " widescreen"
  3561. 							End If
  3562. 							strSize = strSize & ")"
  3563. 							arrMonitorDescriptions( intIndex ) = arrMonitorDescriptions( intIndex ) & strSize
  3564. 						End If
  3565. 					Next
  3566. 				End If
  3567. 			End If
  3568. 		Next
  3569.  
  3570. 		If UBound( arrMonitorDescriptions ) >= 0 Then
  3571. 			document.getElementById( "MultipleMonitors" ).style.display = "inline"
  3572.  
  3573. 			MonitorIndex0.value        = 0
  3574. 			MonitorModel0.value        = arrMonitorDescriptions(0)
  3575. 			MonitorManufacturer0.value = arrMonitorManufacturers(0)
  3576. 			MonitorSerial0.value       = arrMonitorSerialNumbers(0)
  3577.  
  3578. 			If UBound( arrMonitorDescriptions ) > 0 Then
  3579. 				Set objTable = document.getElementById( "Results" )
  3580. 				intRow = document.getElementById( "Monitor0" ).rowIndex
  3581. 				For i = 1 To UBound( arrMonitorDescriptions )
  3582. 					Set objTableRow   = objTable.insertRow( intRow + i )
  3583. 					objTableRow.id    = "Monitor" & i
  3584. 					Set objCell       = objTableRow.insertCell( 0 )
  3585. 					objCell.innerHTML = "&nbsp;"
  3586. 					Set objCell       = objTableRow.insertCell( 1 )
  3587. 					objCell.innerHTML = "&nbsp;"
  3588. 					Set objCell       = objTableRow.insertCell( 2 )
  3589. 					objCell.innerHTML = "&nbsp;"
  3590. 					Set objCell       = objTableRow.insertCell( 3 )
  3591. 					objCell.innerHTML = "&nbsp;"
  3592. 					Set objCell       = objTableRow.insertCell( 4 )
  3593. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""MonitorIndex" & i & """ size=""12"" value=""" & i & """ readonly />"
  3594. 					Set objCell       = objTableRow.insertCell( 5 )
  3595. 					objCell.innerHTML = "&nbsp;"
  3596. 					Set objCell       = objTableRow.insertCell( 6 )
  3597. 					objcell.setAttribute "colSpan", 3
  3598. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""MonitorModel" & i & """ size=""40"" value=""" & arrMonitorDescriptions(i) & """ readonly />"
  3599. 					Set objCell       = objTableRow.insertCell( 7 )
  3600. 					objCell.innerHTML = "&nbsp;"
  3601. 					Set objCell       = objTableRow.insertCell( 8 )
  3602. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""MonitorManufacturer" & i & """ size=""16"" value=""" & arrMonitorManufacturers(i) & """ readonly />"
  3603. 					Set objCell       = objTableRow.insertCell( 9 )
  3604. 					objCell.innerHTML = "&nbsp;"
  3605. 					Set objCell       = objTableRow.insertCell( 10 )
  3606. 					objCell.innerHTML = "<input type=""text"" oncontextmenu=""this.select()"" id=""MonitorSerial" & i & """ size=""16"" value=""" & arrMonitorSerialNumbers(i) & """ readonly />"
  3607. 					Set objCell       = Nothing
  3608. 					Set objTableRow   = Nothing
  3609. 				Next
  3610. 				Set objTable = Nothing
  3611. 			End If
  3612. 		End If
  3613.  
  3614. 		DebugMessage "", "Monitor inventory succeeded: " & CStr( Not ButtonDetailsMonitor.disabled )
  3615.  
  3616. 		On Error Goto 0
  3617. 	End If
  3618. End Sub
  3619.  
  3620.  
  3621. Sub InventoryMouse( )
  3622. 	Dim arrConnectorTypes, arrDeviceInterfaces, arrHardwareTypes, arrPointingTypes
  3623. 	Dim intButtons, intConnectorType, intCount, intMouseType
  3624. 	Dim colItems, objItem
  3625. 	Dim strConnectorType, strMouseModel, strMouseType
  3626.  
  3627. 	If CheckboxMouse.checked Then
  3628. 		' Enumeration of connector and hardware types
  3629. 		arrConnectorTypes = Array( "PS/2", "Serial","USB" )
  3630. 		arrHardwareTypes  = Array( "Standard Mouse", "Standard Pointer", "Standard Absolute Pointer", "Tablet", "Touch Screen", "Pen", "Track Ball" )
  3631. 		ReDim Preserve arrHardwareTypes( 256 )
  3632. 		arrHardwareTypes( 256 ) = "Other"
  3633. 		arrPointingTypes  = Array( "Unknown", "Other", "Unknown", "Mouse", "Trackball", "Track Point", "Glide Point", "Touch Pad", "Touch Screen", "Mouse - Optical Sensor" )
  3634. 		arrDeviceInterfaces = Array( "Unknown", "Other", "Unknown", "Serial", "PS/2", "Infrared", "HP-HIL", "Bus mouse", "ADB (Apple Desktop Bus)" )
  3635. 		ReDim Preserve arrDeviceInterfaces( 162 )
  3636. 		arrDeviceInterfaces( 160 ) = "Bus mouse DB-9"
  3637. 		arrDeviceInterfaces( 161 ) = "Bus mouse micro-DIN"
  3638. 		arrDeviceInterfaces( 162 ) = "USB"
  3639.  
  3640. 		On Error Resume Next ' REQUIRED
  3641.  
  3642. 		' Check for mouse details in root/CIMV2 - this is not likely to fail on access denied errors
  3643. 		intCount = 0
  3644. 		Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_PointingDevice" )
  3645. 		If Not Err Then
  3646. 			intCount = colItems.Count
  3647. 			If intCount > 1 Then
  3648. 				Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_PointingDevice WHERE NOT PNPDeviceID LIKE 'ACPI\\%'" )
  3649. 				intCount = colItems.Count
  3650. 				If colItems.Count = 0 Then
  3651. 					Set colItems = gvoWMIrootCimv2.ExecQuery( "SELECT * FROM Win32_PointingDevice" )