Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

812 lines
26 KiB

  1. var remoteServer;//local if not set
  2. var g_dictDrivers = null; //dictionary. key = deviceID, item = issigned
  3. function DisplayLocStrings() {
  4. WaitMessage.innerHTML = MSG_WAIT;
  5. Refresh.innerHTML = TAG_REFRESH;
  6. localHardDrive.all.Caption.innerHTML = TAG_LOCALDISK;
  7. with(Display.all) {
  8. Caption.innerHTML = TAG_DISPLAY;
  9. label1.innerHTML = TAG_TYPE + ":";
  10. label2.innerHTML = TAG_COLOR + ":";
  11. label3.innerHTML = TAG_RESOLUTION + ":";
  12. label4.innerHTML = TAG_SCRSAVER + ":";
  13. }
  14. with(Video.all) {
  15. Caption.innerHTML = TAG_VIDEOCARD;
  16. label1.innerHTML = TAG_MODEL + ":";
  17. label2.innerHTML = TAG_DRIVER + ":";
  18. }
  19. with(Modem.all) {
  20. Caption.innerHTML = TAG_MODEM;
  21. label1.innerHTML = TAG_MANUFACTURER + ":";
  22. label2.innerHTML = TAG_MODEL + ":";
  23. label3.innerHTML = TAG_DRIVER + ":";
  24. }
  25. with(Sound.all) {
  26. Caption.innerHTML = TAG_SOUNDCARD;
  27. label1.innerHTML = TAG_MANUFACTURER + ":";
  28. label2.innerHTML = TAG_MODEL + ":";
  29. label3.innerHTML = TAG_DRIVER + ":";
  30. }
  31. with(Usb.all) {
  32. Caption.innerHTML = TAG_USBCTRLR;
  33. label1.innerHTML = TAG_MANUFACTURER + ":";
  34. label2.innerHTML = TAG_MODEL + ":";
  35. label3.innerHTML = TAG_DRIVER + ":";
  36. }
  37. with(Network.all) {
  38. Caption.innerHTML = TAG_NWCARD;
  39. label1.innerHTML = TAG_MODEL + ":";
  40. label2.innerHTML = TAG_DRIVER + ":";
  41. }
  42. with(Cddrive.all) {
  43. Caption.innerHTML = TAG_CDROMDRIVE;
  44. label1.innerHTML = TAG_MANUFACTURER + ":";
  45. label2.innerHTML = TAG_MODEL + ":";
  46. label3.innerHTML = TAG_DRIVER + ":";
  47. }
  48. with(Memory.all) {
  49. Caption.innerHTML = TAG_MEMORY;
  50. label1.innerHTML = TAG_CAPACITY + ":";
  51. }
  52. Floppy.all.Caption.innerHTML = TAG_FLOPPYDRIVE;
  53. Printers.all.Caption.innerHTML = TAG_PRINTERS;
  54. }
  55. function IsSigned(id) {
  56. var bSigned = null; //unknown
  57. if(g_dictDrivers.Exists(id))
  58. {
  59. var bSigned = g_dictDrivers.Item(id);
  60. }
  61. return bSigned;
  62. }
  63. function GetDriverInfo()
  64. {
  65. g_dictDrivers = new ActiveXObject("Scripting.Dictionary");
  66. var loc = wbemlocator;
  67. var svcs = loc.ConnectServer(remoteServer);
  68. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  69. var strQuery = "Select DeviceID, IsSigned From Win32_PnPSignedDriver";
  70. var colDevices = new Enumerator(svcs.ExecQuery(strQuery));
  71. for(; !colDevices.atEnd(); colDevices.moveNext())
  72. {
  73. var device = colDevices.item();
  74. try
  75. {
  76. g_dictDrivers.add(device.DeviceID, device.IsSigned);
  77. }
  78. catch(e)
  79. {
  80. //do nothing
  81. }
  82. }
  83. }
  84. var INCR_UNIT = 100/11;//move progress bar in increments of INCR_UNIT
  85. function LoadChores(taskId) {
  86. try {
  87. switch(taskId)
  88. {
  89. case 0:
  90. remoteServer = ShowServerName(TAG_HARDWARE);
  91. break;
  92. case 1:
  93. DrawProgressBar(INCR_UNIT, TAG_LOCALDISK);
  94. break;
  95. case 2:
  96. GetDriverInfo();//PENDING deserves it's own taskid
  97. getLocalHardDrive();
  98. break;
  99. case 3:
  100. DrawProgressBar(INCR_UNIT * 2, TAG_DISPLAY);
  101. case 4:
  102. getDisplay();
  103. break;
  104. case 5:
  105. DrawProgressBar(INCR_UNIT * 3, TAG_VIDEOCARD);
  106. break;
  107. case 6:
  108. getVideoCard();
  109. break;
  110. case 7:
  111. DrawProgressBar(INCR_UNIT * 4, TAG_MODEM);
  112. break;
  113. case 8:
  114. getModem();
  115. break;
  116. case 8:
  117. DrawProgressBar(INCR_UNIT * 5, TAG_SOUNDCARD);
  118. break;
  119. case 9:
  120. getSoundCard();
  121. break;
  122. case 10:
  123. DrawProgressBar(INCR_UNIT * 6, TAG_USBCTRLR);
  124. break;
  125. case 11:
  126. getUSB();
  127. break;
  128. case 12:
  129. DrawProgressBar(INCR_UNIT * 7, TAG_NWCARD);
  130. break;
  131. case 13:
  132. getNetworkCard();
  133. break;
  134. case 14:
  135. DrawProgressBar(INCR_UNIT * 8, TAG_CDROMDRIVE);
  136. break;
  137. case 15:
  138. getCDDrive();
  139. break;
  140. case 16:
  141. DrawProgressBar(INCR_UNIT * 9, TAG_FLOPPYDRIVE);
  142. break;
  143. case 17:
  144. getFloppyDrive();
  145. break;
  146. case 18:
  147. DrawProgressBar(INCR_UNIT * 10, TAG_PRINTERS);
  148. break;
  149. case 19:
  150. getPrinter();
  151. break;
  152. case 20:
  153. DrawProgressBar(INCR_UNIT * 11, TAG_MEMORY);
  154. break;
  155. case 21:
  156. getMemory();
  157. break;
  158. default:
  159. taskId = -1;
  160. _header.style.display = "none";
  161. _data.style.display = "";
  162. _body.style.cursor= "default";
  163. }
  164. if(taskId >= 0)
  165. window.setTimeout("LoadChores(" + ++taskId + ")", TIMEOUT);
  166. }
  167. catch (e) {
  168. HandleErr(e);
  169. }
  170. }
  171. function dispatchFunction() {
  172. _body.style.cursor= "wait";
  173. SetProgressBarImage();
  174. DisplayLocStrings();
  175. window.setTimeout("LoadChores(0)", TIMEOUT);
  176. }
  177. function displayTableSegment(outerDiv, dataArray) {
  178. var strMsg = "<table width=\"100%\" cellspacing=0 cellpadding=0><tr class=\"sys-table-cell-bgcolor1 sys-font-body sys-color-body\"><td align='left' style=\"padding : 0.5em;\">%arg1%</td></tr></table>";
  179. var strHTML = "";
  180. var noOfInstances = dataArray.length;
  181. if (noOfInstances == 0)
  182. document.all[outerDiv].outerHTML = strMsg.replace(/%arg1%/, TAG_NOTINSTALLED);
  183. else
  184. {
  185. var tableElement = document.all[outerDiv.charAt(0).toUpperCase() + outerDiv.substr(1)];
  186. for(var i=0; i < noOfInstances; i++)
  187. {
  188. for(var k=0; k < dataArray[i].length; k++)
  189. if (dataArray[i][k] != null)
  190. document.all[outerDiv + "_" + (k+1)].innerHTML = dataArray[i][k];
  191. strHTML = strHTML + (strHTML == "" ? "" : "&nbsp;") + tableElement.outerHTML;
  192. }
  193. tableElement.outerHTML = strHTML;
  194. }
  195. }
  196. //same as displayTableSegment, except process two items at a time.
  197. function displayTableSegmentEx(outerDiv, dataArray) {
  198. var tableElement = document.all[outerDiv];
  199. var strHTML = "";
  200. var strMsg = "<table width=\"100%\" cellspacing=0 cellpadding=0><tr class=\"sys-table-cell-bgcolor1 sys-font-body sys-color-body\"><td align='left' style=\"padding : 0.5em;\">%arg1%</td></tr></table>";
  201. var strBlankTbl = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr class=\"sys-table-cell-bgcolor1\"><td style=\"padding : 0.5em;\">&nbsp;</td></tr></table>";
  202. var noOfInstances = dataArray.length;
  203. if (noOfInstances == 0)
  204. tableElement.outerHTML = strMsg.replace(/%arg1%/, TAG_NOTINSTALLED);
  205. else {
  206. for(var i=0; i<noOfInstances; i+=2) {
  207. for(var j=0, l=dataArray[i].length; j<2; j++) {
  208. if ((i+j) < noOfInstances) {
  209. for(var k=0; k<l; k++)
  210. if (dataArray[i+j][k] != null)
  211. tableElement.all[outerDiv + "_" + (j+1) + "_" + (k+1)].innerHTML = dataArray[i+j][k];
  212. }
  213. else if (tableElement.all.part2 != null)
  214. tableElement.all.part2.outerHTML = strBlankTbl;
  215. }
  216. strHTML += tableElement.outerHTML;
  217. }
  218. tableElement.outerHTML = strHTML;
  219. }
  220. }
  221. function displayLocalHardDriveInfo(localDisks) {
  222. var localDriveElement;
  223. var partitionElement;
  224. var strHTMLDisks = "";
  225. var strHTMLPartition = "";
  226. var s1 = document.all["localHardDrive"].outerHTML;
  227. var s2 = document.all["partition"].outerHTML;
  228. var strBlankTbl = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr class=\"sys-table-cell-bgcolor1\"><td style=\"padding : 0.5em;\">&nbsp;</td></tr></table>";
  229. var strMsg = "<table width=\"100%\" cellspacing=0 cellpadding=0><tr class=\"sys-table-cell-bgcolor1 sys-font-body sys-color-body\"><td align='left' style=\"padding : 0.5em;\">%arg1%</td></tr></table>";
  230. if (localDisks.length == 0)
  231. document.all["partition"].outerHTML = strMsg.replace(/%arg1%/, TAG_NOTINSTALLED);
  232. else {
  233. for(var i = 0; i < localDisks.length ; i++)//for each device
  234. {
  235. var iPartitions = localDisks[i].length - 1;
  236. document.all["localHardDrive"].outerHTML = s1;
  237. localDriveElement = document.all["localHardDrive"];
  238. localDriveElement.all["localHardDrive_partitionStatus"].innerHTML = "(" + (iPartitions > 1?TAG_PARTITIONED:TAG_NONPARTITIONED) + ")";
  239. localDriveElement.all["localHardDrive_model"].innerHTML = localDisks[i][0];
  240. if (document.all["partition"].length == null)
  241. partitionElement = document.all["partition"];
  242. else {
  243. document.all["partition"][0].outerHTML = s2;
  244. partitionElement = document.all["partition"][0];
  245. }
  246. strHTMLPartition = "";
  247. var iRows = 1;
  248. if (iPartitions > 2)
  249. iRows = parseInt(iPartitions/2) + (iPartitions%2);
  250. for(var k = 1, j = 1; k <= iRows; k++) {
  251. for(var l = 1; l <= 2; l++) {
  252. if (j < localDisks[i].length)
  253. for(var m = 0; m < localDisks[i][j].length; m++)
  254. partitionElement.all["partition_" + l + "_" + (m+1)].innerHTML=localDisks[i][j][m];
  255. else if (partitionElement.all.part2 != null)
  256. partitionElement.all.part2.outerHTML = strBlankTbl;
  257. j++;
  258. }
  259. strHTMLPartition += partitionElement.outerHTML;
  260. }
  261. partitionElement.outerHTML = strHTMLPartition;
  262. strHTMLDisks += localDriveElement.outerHTML;
  263. }
  264. localDriveElement.outerHTML = strHTMLDisks;
  265. }
  266. }
  267. function getLocalHardDrive()
  268. {
  269. //Local Hard Drive
  270. var loc = wbemlocator;
  271. var svcs = loc.ConnectServer(remoteServer)
  272. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  273. var strQuery = "Select * From Win32_DiskDrive";
  274. var colLocalDisks = new Enumerator(svcs.ExecQuery(strQuery));
  275. /*
  276. localDisks[0] -> localDiskInfo
  277. ...
  278. localDisks[n] -> localDiskInfo
  279. */
  280. var localDisks = new Array();
  281. for(; !colLocalDisks.atEnd(); colLocalDisks.moveNext())
  282. {/*
  283. localDiskInfo[0] = Local Disk Model
  284. localDiskInfo[1] -> partitionInfo[0] = Disk Name
  285. ... partitionInfo[1] = Used Space
  286. partitionInfo[2] = Free Space
  287. partitionInfo[3] = Disk Usage Image Name
  288. localDiskInfo[n] -> -do-
  289. */
  290. var localDiskInfo = new Array();
  291. var localDisk = colLocalDisks.item();
  292. strQuery = "Associators of {Win32_DiskDrive.DeviceID=\"" + localDisk.DeviceID.replace(/\\/g, "\\\\") + "\"} Where ResultClass = Win32_DiskPartition";
  293. var colPartitions = new Enumerator(svcs.ExecQuery(strQuery));
  294. localDiskInfo[0] = localDisk.Model ? localDisk.Model : "";
  295. if(colPartitions.atEnd())
  296. {
  297. var partitionInfo = new Array(5);
  298. partitionInfo[0] = TAG_INSTALLED;
  299. partitionInfo[1] = "";
  300. partitionInfo[2] = TAG_NONE;
  301. partitionInfo[3] = TAG_USED + ":";
  302. partitionInfo[4] = TAG_UNKNOWN;
  303. partitionInfo[5] = TAG_FREE + ":";
  304. partitionInfo[6] = TAG_UNKNOWN;
  305. localDiskInfo[localDiskInfo.length] = partitionInfo;
  306. }
  307. for(; !colPartitions.atEnd(); colPartitions.moveNext())
  308. {
  309. var partition = colPartitions.item();
  310. strQuery = "Associators of {Win32_DiskPartition.DeviceID=\"" + partition.DeviceID + "\"} Where ResultClass = Win32_LogicalDisk";
  311. var colLogicalDisks = new Enumerator(svcs.ExecQuery(strQuery));
  312. if (!colLogicalDisks.atEnd())
  313. {
  314. var logicalDisk = colLogicalDisks.item();
  315. with (logicalDisk)
  316. {
  317. var partitionInfo = new Array(5);
  318. partitionInfo[0] = "(" + Name + ")";
  319. partitionInfo[1] = TAG_CAPACITY + " - " + (Size ? fig2Words(Size) : TAG_UNKNOWN) + "&nbsp;";
  320. var nUsedSpace = (Size && FreeSpace ? Size - FreeSpace : null);
  321. if(Size && FreeSpace)
  322. {
  323. var nPerUsage = Math.round(nUsedSpace/(nUsedSpace + parseInt(FreeSpace)) * 100);
  324. var strGifPath = "Graphics\\33x16pie\\" + determineRange(nPerUsage) + "_chart.gif";
  325. partitionInfo[2] = "<IMG Border=0 SRC=" + strGifPath + ">";
  326. }
  327. else
  328. partitionInfo[2] = "&nbsp;";
  329. partitionInfo[3] = TAG_USED + ":";
  330. partitionInfo[4] = nUsedSpace ? fig2Words(nUsedSpace) : TAG_UNKNOWN;
  331. partitionInfo[5] = TAG_FREE + ":";
  332. partitionInfo[6] = FreeSpace ? fig2Wordsfloor(FreeSpace) : TAG_UNKNOWN;
  333. //for(i=0; i < partitionInfo.length; i++)
  334. //alert("partitionInfo[" + i + "]=" + partitionInfo[i]);
  335. localDiskInfo[localDiskInfo.length] = partitionInfo;
  336. }//EO with (logicalDisk)
  337. }else{
  338. var partitionInfo = new Array(5);
  339. partitionInfo[0] = TAG_INSTALLED;
  340. partitionInfo[1] = TAG_CAPACITY + " - " + (partition.Size ? fig2Words(partition.Size) : TAG_UNKNOWN) + "&nbsp;";
  341. partitionInfo[2] = TAG_NONE;
  342. partitionInfo[3] = TAG_USED + ":";
  343. partitionInfo[4] = TAG_UNKNOWN;
  344. partitionInfo[5] = TAG_FREE + ":";
  345. partitionInfo[6] = TAG_UNKNOWN;
  346. localDiskInfo[localDiskInfo.length] = partitionInfo;
  347. }
  348. }//for colPartitions
  349. localDisks[localDisks.length] = localDiskInfo;
  350. }//for colLocalDisks
  351. displayLocalHardDriveInfo(localDisks);
  352. }//EO getLocalHardDrive
  353. function getDisplay()
  354. {
  355. //Display
  356. var loc = wbemlocator;
  357. var svcs = loc.ConnectServer(remoteServer)
  358. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  359. var scrSavrActive = "";
  360. var color = "";
  361. var resolution = "";
  362. var strQuery = "Select * From Win32_ComputerSystem";
  363. var colCompSys = new Enumerator(svcs.ExecQuery(strQuery));
  364. if (!colCompSys.atEnd())
  365. {
  366. scrSavrActive = TAG_UNKNOWN;
  367. var inst = colCompSys.item();
  368. if(inst.UserName)
  369. {
  370. strQuery = "Select * From Win32_Desktop Where Name = \"" + inst.UserName.replace(/\\/g, "\\\\") + "\"";
  371. var colDesktop = new Enumerator(svcs.ExecQuery(strQuery));
  372. if (!colDesktop.atEnd())
  373. {
  374. inst = colDesktop.item();
  375. scrSavrActive = (inst.ScreenSaverExecutable==null)? TAG_NOTACTIVE : TAG_ACTIVE;
  376. }
  377. }
  378. }
  379. var cls = svcs.get("Win32_VideoController");
  380. var colVdoCtrl = new Enumerator(cls.Instances_())
  381. if (!colVdoCtrl.atEnd())
  382. {
  383. var inst = colVdoCtrl.item();
  384. color = getColorString(inst.CurrentBitsPerPixel);
  385. resolution = inst.CurrentHorizontalResolution + " x " + inst.CurrentVerticalResolution;
  386. }
  387. var cls = svcs.get("Win32_DesktopMonitor");
  388. var insts = new Enumerator(cls.Instances_())
  389. var mainArray = new Array();
  390. for(; !insts.atEnd(); insts.moveNext())
  391. {
  392. var inst = insts.item();
  393. var subArray = new Array(4);
  394. subArray[0] = inst.MonitorType;
  395. subArray[1] = color;//same across all instances of desktopMonitor
  396. subArray[2] = resolution;//same across all instances of desktopMonitor
  397. subArray[3] = scrSavrActive;//same across all instances of desktopMonitor
  398. mainArray[mainArray.length] = subArray;
  399. }
  400. displayTableSegment("display", mainArray);
  401. }
  402. function getVideoCard()
  403. {
  404. //Video
  405. var loc = wbemlocator;
  406. var svcs = loc.ConnectServer(remoteServer)
  407. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  408. var cls = svcs.get("Win32_VideoController");
  409. var insts = new Enumerator(cls.Instances_())
  410. var mainArray = new Array();
  411. for(; !insts.atEnd(); insts.moveNext())
  412. {
  413. var inst = insts.item();
  414. var subArray = new Array(2);
  415. subArray[0] = inst.Name;
  416. var strDriver = ""; //driver file + manufacturer + install dt + signed or not
  417. strQuery = "Associators of {Win32_PnPEntity.DeviceID=\"" + inst.PNPDeviceID.replace(/\\/g, "\\\\") + "\"} Where Resultclass = CIM_Datafile";
  418. var colData = new Enumerator(svcs.ExecQuery(strQuery));
  419. if (!colData.atEnd())
  420. {
  421. var data = colData.item();
  422. strDriver = data.FileName + "." + data.Extension + "<BR>";
  423. strDriver+= getDateTime(data.InstallDate) + "<BR>" ;
  424. strDriver+= "<span onmouseover='ShowTip(this)'>" + (IsSigned(inst.PNPDeviceID) ? TAG_SUPPORTED : TAG_NOTSUPPORTED) + "</span>";
  425. }
  426. subArray[1] = strDriver;
  427. mainArray[mainArray.length] = subArray;
  428. }
  429. displayTableSegment("video", mainArray);
  430. }
  431. function getPrinter()
  432. {
  433. var isDefault = false;
  434. var DEFAULT_PRN_IMG = "<img border=0 src=\"Graphics\\check.gif\">";
  435. //Printer
  436. var loc = wbemlocator;
  437. var svcs = loc.ConnectServer(remoteServer)
  438. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  439. var cls = svcs.get("Win32_Printer");
  440. var insts = new Enumerator(cls.Instances_())
  441. var mainArray = new Array();
  442. for(; !insts.atEnd(); insts.moveNext())
  443. {
  444. var inst = insts.item();
  445. var subArray = new Array(4);
  446. isDefault = inst.Default;
  447. if(isDefault)
  448. {
  449. subArray[0] = DEFAULT_PRN_IMG;
  450. subArray[1] = TAG_DEFAULTPRINTER;
  451. }
  452. else
  453. subArray[0] = subArray[1] = "&nbsp;";
  454. subArray[2] = inst.DriverName;
  455. subArray[3] = TAG_DRIVER + ":";
  456. var strDriver = TAG_UNKNOWN; //driver file + manufacturer + install dt + signed or not
  457. strQuery = "Associators of {Win32_Printer.DeviceID=\"" + inst.DeviceID.replace(/\\/g, "\\\\") + "\"} Where Resultclass = CIM_Datafile";
  458. var colData = new Enumerator(svcs.ExecQuery(strQuery));
  459. if(!colData.atEnd())
  460. {
  461. var data = colData.item();
  462. strDriver = data.FileName + "." + data.Extension + "<BR>";
  463. strDriver+= getDateTime(data.InstallDate) + "<BR>" ;
  464. if(inst.DeviceID != null)
  465. {
  466. var bSigned = IsSigned(inst.DeviceID);
  467. if(null != bSigned)
  468. strDriver+= "<span onmouseover='ShowTip(this)'>" + (bSigned ? TAG_SUPPORTED : TAG_NOTSUPPORTED) + "</span>";
  469. else
  470. strDriver+= TAG_UNKNOWN;
  471. }
  472. else
  473. strDriver+= TAG_UNKNOWN;
  474. }
  475. subArray[4] = strDriver;
  476. //always show the default printer first.
  477. if(isDefault && mainArray.length > 0)
  478. {
  479. var arrTmp = mainArray[0];
  480. mainArray[0] = subArray;
  481. subArray = arrTmp;
  482. }
  483. mainArray[mainArray.length] = subArray;
  484. }
  485. displayTableSegmentEx("printer", mainArray);
  486. }
  487. function getSoundCard()
  488. {
  489. //Sound
  490. var loc = wbemlocator;
  491. var svcs = loc.ConnectServer(remoteServer)
  492. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  493. var cls = svcs.get("Win32_SoundDevice");
  494. var insts = new Enumerator(cls.Instances_())
  495. var mainArray = new Array();
  496. for(; !insts.atEnd(); insts.moveNext())
  497. {
  498. var inst = insts.item();
  499. var subArray = new Array(3);
  500. subArray[0] = inst.Manufacturer ? inst.Manufacturer : TAG_UNKNOWN;
  501. subArray[1] = inst.ProductName;
  502. var strDriver = ""; //driver file + manufacturer + install dt + signed or not
  503. strQuery = "Associators of {Win32_PnPEntity.DeviceID=\"" + inst.PNPDeviceID.replace(/\\/g, "\\\\") + "\"} Where Resultclass = CIM_Datafile";
  504. var colData = new Enumerator(svcs.ExecQuery(strQuery));
  505. if (!colData.atEnd())
  506. {
  507. var data = colData.item();
  508. strDriver = data.FileName + "." + data.Extension + "<BR>";
  509. strDriver+= getDateTime(data.InstallDate) + "<BR>" ;
  510. strDriver+= "<span onmouseover='ShowTip(this)'>" + (IsSigned(inst.PNPDeviceID) ? TAG_SUPPORTED : TAG_NOTSUPPORTED) + "</span>";
  511. }
  512. subArray[2] = strDriver;
  513. mainArray[mainArray.length] = subArray;
  514. }
  515. displayTableSegment("sound", mainArray);
  516. }
  517. function getUSB()
  518. {
  519. //USB
  520. var loc = wbemlocator;
  521. var svcs = loc.ConnectServer(remoteServer)
  522. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  523. var cls = svcs.get("Win32_USBController");
  524. var insts = new Enumerator(cls.Instances_())
  525. var mainArray = new Array();
  526. for(; !insts.atEnd(); insts.moveNext())
  527. {
  528. var inst = insts.item();
  529. var subArray = new Array(3);
  530. subArray[0] = inst.Manufacturer ? inst.Manufacturer : TAG_UNKNOWN;
  531. subArray[1] = inst.Name;
  532. var strDriver = ""; //driver file + manufacturer + install dt + signed or not
  533. strQuery = "Associators of {Win32_PnPEntity.DeviceID=\"" + inst.PNPDeviceID.replace(/\\/g, "\\\\") + "\"} Where Resultclass = CIM_Datafile";
  534. var colData = new Enumerator(svcs.ExecQuery(strQuery));
  535. if (!colData.atEnd())
  536. {
  537. var data = colData.item();
  538. strDriver = data.FileName + "." + data.Extension + "<BR>";
  539. strDriver+= getDateTime(data.InstallDate) + "<BR>" ;
  540. strDriver+= "<span onmouseover='ShowTip(this)'>" + (IsSigned(inst.PNPDeviceID) ? TAG_SUPPORTED : TAG_NOTSUPPORTED) + "</span>";
  541. }
  542. subArray[2] = strDriver;
  543. mainArray[mainArray.length] = subArray;
  544. }
  545. displayTableSegment("usb", mainArray);
  546. }
  547. function getNetworkCard()
  548. {
  549. //Network Card
  550. var loc = wbemlocator;
  551. var svcs = loc.ConnectServer(remoteServer)
  552. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  553. var strQuery = "Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = TRUE";
  554. var insts = new Enumerator(svcs.ExecQuery(strQuery));
  555. var mainArray = new Array();
  556. for(; !insts.atEnd(); insts.moveNext())
  557. {
  558. var inst = insts.item();
  559. var subArray = new Array(2);
  560. subArray[0] = inst.Description;
  561. var strDriver = TAG_UNKNOWN; //driver file + manufacturer + install dt + signed or not
  562. strQuery = "Associators of {Win32_NetworkAdapterConfiguration.Index=" + inst.Index + "}";
  563. var colNetworkAdapter = new Enumerator(svcs.ExecQuery(strQuery));
  564. if (!colNetworkAdapter.atEnd())
  565. {
  566. var networkAdapter = colNetworkAdapter.item();
  567. if(networkAdapter.PNPDeviceID)
  568. {
  569. strQuery = "Associators of {Win32_PnPEntity.DeviceID=\"" + networkAdapter.PNPDeviceID.replace(/\\/g, "\\\\") + "\"} Where Resultclass = CIM_Datafile";
  570. var colData = new Enumerator(svcs.ExecQuery(strQuery));
  571. if (!colData.atEnd())
  572. {
  573. var data = colData.item();
  574. strDriver = data.FileName + "." + data.Extension + "<BR>";
  575. strDriver+= getDateTime(data.InstallDate) + "<BR>" ;
  576. strDriver+= "<span onmouseover='ShowTip(this)'>" + (IsSigned(networkAdapter.PNPDeviceID) ? TAG_SUPPORTED : TAG_NOTSUPPORTED) + "</span>";
  577. }
  578. }
  579. }
  580. subArray[1] = strDriver;
  581. mainArray[mainArray.length] = subArray;
  582. }
  583. displayTableSegment("network", mainArray);
  584. }
  585. function getCDDrive()
  586. {
  587. //CD Drive
  588. var loc = wbemlocator;
  589. var svcs = loc.ConnectServer(remoteServer)
  590. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  591. var cls = svcs.get("Win32_CDROMDrive");
  592. var insts = new Enumerator(cls.Instances_())
  593. var mainArray = new Array();
  594. for(; !insts.atEnd(); insts.moveNext())
  595. {
  596. var inst = insts.item();
  597. var subArray = new Array(4);
  598. subArray[0] = "(" + inst.Drive + ")";
  599. subArray[1] = inst.Manufacturer ? inst.Manufacturer : TAG_UNKNOWN;
  600. subArray[2] = inst.Name;
  601. var strDriver = ""; //driver file + manufacturer + install dt + signed or not
  602. strQuery = "Associators of {Win32_PnPEntity.DeviceID=\"" + inst.PNPDeviceID.replace(/\\/g, "\\\\") + "\"} Where Resultclass = CIM_Datafile";
  603. var colData = new Enumerator(svcs.ExecQuery(strQuery));
  604. if (!colData.atEnd())
  605. {
  606. var data = colData.item();
  607. strDriver = data.FileName + "." + data.Extension + "<BR>";
  608. strDriver+= getDateTime(data.InstallDate) + "<BR>" ;
  609. strDriver+= "<span onmouseover='ShowTip(this)'>" + (IsSigned(inst.PNPDeviceID) ? TAG_SUPPORTED : TAG_NOTSUPPORTED) + "</span>";
  610. }
  611. subArray[3] = strDriver;
  612. mainArray[mainArray.length] = subArray;
  613. }
  614. displayTableSegment("cddrive", mainArray);
  615. }//EO getCDDrive
  616. function getFloppyDrive()
  617. {
  618. var DEVICETYPE_REMOVABLE = 2;
  619. var DEVICETYPE_LOCAL = 3;
  620. var DEVICETYPE_COMPACT = 5;
  621. //Floppy Drive
  622. var loc = wbemlocator;
  623. var svcs = loc.ConnectServer(remoteServer);
  624. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  625. var strQuery = "Select * From Win32_LogicalDisk Where DriveType = " + DEVICETYPE_REMOVABLE;
  626. var insts = new Enumerator(svcs.ExecQuery(strQuery));
  627. var mainArray = new Array();
  628. for(; !insts.atEnd(); insts.moveNext())
  629. {
  630. var inst = insts.item();
  631. var subArray = new Array(2);
  632. subArray[0] = "(" + inst.Name + ")";//drive letter
  633. subArray[1] = TAG_INSTALLED;
  634. mainArray[mainArray.length] = subArray;
  635. }
  636. displayTableSegment("floppy", mainArray);
  637. }//EO getFloppyDrive
  638. function getModem()
  639. {
  640. //Modem
  641. var loc = wbemlocator;
  642. var svcs = loc.ConnectServer(remoteServer)
  643. svcs.Security_.impersonationlevel = wbemImpersonationLevelImpersonate;
  644. var cls = svcs.get("Win32_POTSModem");
  645. var insts = new Enumerator(cls.Instances_())
  646. var mainArray = new Array();
  647. for(; !insts.atEnd(); insts.moveNext())
  648. {
  649. var inst = insts.item();
  650. var subArray = new Array(3);
  651. subArray[0] = inst.Manufacturer ? inst.Manufacturer : TAG_UNKNOWN;
  652. subArray[1] = inst.Model;
  653. var strDriver = TAG_UNKNOWN;
  654. if(inst.PNPDeviceID)
  655. {
  656. strQuery = "Associators of {Win32_PnPEntity.DeviceID=\"" + inst.PNPDeviceID.replace(/\\/g, "\\\\") + "\"} Where Resultclass = CIM_Datafile";
  657. var colData = new Enumerator(svcs.ExecQuery(strQuery));
  658. if (!colData.atEnd())
  659. {
  660. var data = colData.item();
  661. strDriver = data.FileName + "." + data.Extension + "<BR>";
  662. strDriver+= getDateTime(data.InstallDate) + "<BR>" ;
  663. strDriver+= "<span onmouseover='ShowTip(this)'>" + (IsSigned(inst.PNPDeviceID) ? TAG_SUPPORTED : TAG_NOTSUPPORTED) + "</span>";
  664. }
  665. }
  666. subArray[2] = strDriver;
  667. mainArray[mainArray.length] = subArray;
  668. }
  669. displayTableSegment("modem", mainArray);
  670. }//EO getModem
  671. function getMemory()
  672. {
  673. var locator = wbemlocator;
  674. var service = locator.ConnectServer(remoteServer);
  675. service.Security_.impersonationlevel = 3;
  676. var coll = new Enumerator(service.ExecQuery("Select Capacity from Win32_PhysicalMemory"));
  677. var memCapacity = null;
  678. mainArray = new Array();
  679. if (!coll.atEnd())
  680. {
  681. for (;!coll.atEnd();coll.moveNext())
  682. {
  683. var p = coll.item();
  684. if(!isNaN(p.Capacity))
  685. memCapacity += parseInt(p.Capacity); //in bytes.
  686. }
  687. }
  688. else
  689. {
  690. var insts = new Enumerator(service.ExecQuery("Select * from Win32_ComputerSystem"));
  691. for(; !insts.atEnd(); insts.moveNext())
  692. {
  693. var inst = insts.item();
  694. memCapacity += parseInt(inst.TotalPhysicalMemory); //in bytes.
  695. }
  696. }
  697. var subArray = new Array(1);
  698. subArray[0] = memCapacity ? fig2Words(memCapacity) : TAG_UNKNOWN;
  699. mainArray[mainArray.length] = subArray;
  700. displayTableSegment("memory", mainArray);
  701. }//EO getMemory