Advertisement
Guest User

Untitled

a guest
Dec 5th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. #RequireAdmin
  2. #Include <GuiListView.au3>
  3. #include <GuiconstantsEx.au3>
  4. #include <WindowsConstants.au3>
  5. #include <GuiEdit.au3>
  6.  
  7. $title = "A.I.X.O.A. v0.1"
  8. $ifilepath = @WindowsDir & "\system32\drivers\etc\hosts"
  9.  
  10. ;GUI
  11. GUICreate( $title , 720, 380,-1,-1)
  12.  
  13.  
  14. ;hosts file
  15. $Hfile = FileOpen($ifilepath,16)
  16. If $Hfile = -1 Then
  17. MsgBox(0, "Error", "Unable to open file.")
  18. EndIf
  19. $Hcontent = BinaryToString(FileRead($Hfile))
  20. FileClose($Hfile)
  21.  
  22.  
  23. ;Tab greenC8EDCC red2D01EE blueFF0000
  24. GUICtrlCreateTab(1,5,720,373)
  25. GUICtrlCreateTabItem("CPU")
  26. $cpuinfo = GUICtrlCreateListView("Description|CPU infomation",10,35,700,300)
  27. $refreshCpu = GUICtrlCreateButton("Refresh",10,340,105,30)
  28. GUICtrlCreateTabItem("Drive")
  29. $Dinfo = GUICtrlCreateListView("Drive|Drive Name|Free space|Total space|File system|Status|Drive Serial",10,35,700,300)
  30. $refreshDrive = GUICtrlCreateButton("Refresh",10,340,105,30)
  31. GUICtrlCreateTabItem("Important file")
  32. $hosts = GUICtrlCreateEdit($Hcontent,10,35,700,300)
  33. $saveH = GUICtrlCreateButton("Save",10,340,105,30)
  34. $hostsfile = GUICtrlCreateButton("Hosts",125,340,105,30)
  35. $winini = GUICtrlCreateButton("Win.ini",240,340,105,30)
  36. $systemini = GUICtrlCreateButton("system.ini",355,340,105,30)
  37. $bootini = GUICtrlCreateButton("boot.ini",470,340,105,30)
  38. GUICtrlCreateTabItem("BIOS")
  39. $BiosList = GUICtrlCreateListView("Description|Basic Input Output System infomation",10,35,700,300)
  40.  
  41. ;tab contents
  42. ;cpu tab
  43. _CPURegistryInfo()
  44. _GUICtrlListView_DeleteAllItems($cpuinfo)
  45. GUICtrlCreateListViewItem("Name|"& $aCPUInfo[2],$cpuinfo)
  46. GUICtrlCreateListViewItem("# of thread|"& $aCPUInfo[0],$cpuinfo)
  47. GUICtrlCreateListViewItem("CPU speed|"& Round($aCPUInfo[1]/1000,1) &"Ghz" , $cpuinfo)
  48. GUICtrlCreateListViewItem("Identifier|"& $aCPUInfo[3],$cpuinfo)
  49. GUICtrlCreateListViewItem("Vendor|"& $aCPUInfo[4],$cpuinfo)
  50. ;drive tab
  51. _DriveInfo()
  52. _GUICtrlListView_DeleteAllItems($Dinfo)
  53. For $i = 1 to $DriveNum[0]
  54. GUICtrlCreateListViewItem($DriveNum[$i] &"|"& $Dlabel[$i] &"|"& Round($Dfree[$i]/1000,1) &"GB|"& Round($Dtotal[$i]/1000,1) &"GB|"& $Dfs[$i] &"|"& $Dstatus[$i] &"|"& $Dserial[$i],$Dinfo)
  55. Next
  56.  
  57.  
  58. ; GUI MESSAGE LOOP
  59. GuiSetState()
  60.  
  61. Do
  62. $msg = GUIGetMsg()
  63.  
  64. Select
  65. Case $msg = $refreshCpu
  66. _GUICtrlListView_DeleteAllItems($cpuinfo)
  67. GUICtrlCreateListViewItem("Name|"& $aCPUInfo[2],$cpuinfo)
  68. GUICtrlCreateListViewItem("# of thread|"& $aCPUInfo[0],$cpuinfo)
  69. GUICtrlCreateListViewItem("CPU speed|"& Round($aCPUInfo[1]/1000,1) &"Ghz" , $cpuinfo)
  70. GUICtrlCreateListViewItem("Identifier|"& $aCPUInfo[3],$cpuinfo)
  71. GUICtrlCreateListViewItem("Vendor|"& $aCPUInfo[4],$cpuinfo)
  72.  
  73. Case $msg = $refreshDrive
  74. _GUICtrlListView_DeleteAllItems($Dinfo)
  75. For $i = 1 to $DriveNum[0]
  76. GUICtrlCreateListViewItem($DriveNum[$i] &"|"& $Dlabel[$i] &"|"& Round($Dfree[$i]/1000,1) &"GB|"& Round($Dtotal[$i]/1000,1) &"GB|"& $Dfs[$i] &"|"& $Dstatus[$i] &"|"& $Dserial[$i],$Dinfo)
  77. Next
  78.  
  79. Case $msg = $saveH
  80. $Hfile = FileOpen($ifilepath,2)
  81. $Hwrite = FileWrite($Hfile,_GUICtrlEdit_GetText($hosts))
  82. FileClose($Hfile)
  83. If $Hwrite = 1 Then
  84. MsgBox(0,"Aixoa editor","Save successful")
  85. Else
  86. MsgBox(0,"Aixoa editor","Save failure")
  87. EndIf
  88.  
  89. Case $msg = $bootini
  90. $ifilepath = StringReplace(@windowsdir,"WINDOWS","") & "boot.ini"
  91.  
  92.  
  93. Case $msg = $systemini
  94. $ifilepath = @windowsdir & "\system.ini"
  95. _openinifile()
  96. _GUICtrlEdit_Destroy($hosts)
  97. $hosts = GUICtrlCreateEdit($Hcontent,10,35,700,300)
  98.  
  99. Case $msg = $winini
  100. $ifilepath = @windowsdir & "\win.ini"
  101. EndSelect
  102.  
  103. Until $msg = $GUI_EVENT_CLOSE
  104.  
  105. ;===========================Funtions========================
  106. ; [0] = # of Reported CPU's (can include 'logical' processors as well (# CPU's * # of hyperthreads))
  107. ; [1] = CPU Speed (Mhz)
  108. ; [2] = CPU Name
  109. ; [3] = Identifier (family, model, stepping)
  110. ; [4] = Vendor name
  111. ; [5] = Feature Set (unsure what values are which..)
  112. ; Failure: @error = same as returned by RegEnumKey(), with an empty array ([0] = -1 though)
  113. ; @error = 1 = unable to open requested key
  114. ; @error = 2 = unable to open requested Main key
  115. ; @error = 3 = unable to connect to *remote* registry (not likely a return here)
  116. ; @error = -1 = unable to retrieve requested subkey (key instance out of range)
  117. ; ===============================================================================================================================
  118.  
  119. Func _CPURegistryInfo()
  120. Global $aCPUInfo[6]
  121.  
  122. $aCPUInfo[0]=EnvGet("NUMBER_OF_PROCESSORS")
  123.  
  124. If @error Then Return SetError(@error,0,$aCPUInfo)
  125.  
  126. $aCPUInfo[1] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","~MHz")
  127. $aCPUInfo[2] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","ProcessorNameString")
  128. $aCPUInfo[3] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","Identifier")
  129. $aCPUInfo[4] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","VendorIdentifier")
  130. $aCPUInfo[5] = RegRead ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","FeatureSet")
  131.  
  132. Return $aCPUInfo
  133. EndFunc
  134. ;----------------------------------------
  135. Func _DriveInfo()
  136. Global $DriveNum[12]
  137. Global $Dlabel[12]
  138. Global $Dfree[12]
  139. Global $Dtotal[12]
  140. Global $Dfs[12]
  141. Global $Dstatus[12]
  142. Global $Dserial[12]
  143. $DriveNum = DriveGetDrive("fixed")
  144. For $i = 1 To $DriveNum[0]
  145. $Dlabel[$i] = DriveGetLabel($DriveNum[$i])
  146. $Dfree[$i] = DriveSpaceFree($DriveNum[$i])
  147. $Dtotal[$i] = DriveSpaceTotal($DriveNum[$i])
  148. $Dfs[$i] = DriveGetFileSystem($DriveNum[$i])
  149. $Dstatus[$i] = DriveStatus($DriveNum[$i])
  150. $Dserial[$i] = DriveGetSerial($DriveNum[$i])
  151. Next
  152.  
  153. EndFunc
  154. ;====================================================================
  155. Func _openinifile()
  156. $Hfile = FileOpen($ifilepath,1)
  157. If $Hfile = -1 Then
  158. MsgBox(0, "Error", "Unable to open file.")
  159. EndIf
  160. $Hcontent = FileRead($Hfile)
  161. FileClose($Hfile)
  162. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement