Code: Select all
XIncludeFile "COMatePLUS.pbi"
Procedure.s GetDWORDValue(hkey.i, strKeyPath.s, strValueName.s)
Define.COMateObject oReg
strComputer.s = "."
oReg = COMate_GetObject("winmgmts:\\.\root\default:StdRegProv", "")
oReg\Invoke("GetDWORDValue(" + Str(hkey) + ", '" + strKeyPath + "', '" + strValueName + "', " + Str(@dwValue) + " BYREF)")
dw_dword_value$ = Str(dwValue)
oReg\Release()
ProcedureReturn dw_dword_value$
EndProcedure
Procedure.s ConfigManager_ErrorCode(cm_ec.i)
Select cm_ec
Case 0
Error_Code_Type$ = "Device is working properly"
Case 1
Error_Code_Type$ = "Device is Not configured correctly."
Case 2
Error_Code_Type$ = "Windows cannot load the driver For this device."
Case 3
Error_Code_Type$ = "Driver For this device might be corrupted, Or the system may be low on memory or other resources."
Case 4
Error_Code_Type$ = "Device is Not working properly. One of its drivers or the registry might be corrupted."
Case 5
Error_Code_Type$ = "Driver For the device requires a resource that Windows cannot manage."
Case 6
Error_Code_Type$ = "Boot configuration For the device conflicts With other devices."
Case 7
Error_Code_Type$ = "Cannot filter."
Case 8
Error_Code_Type$ = "Driver loader For the device is missing."
Case 9
Error_Code_Type$ = "Device is Not working properly. The controlling firmware is incorrectly reporting the resources for the device."
Case 10
Error_Code_Type$ = "Device cannot start."
Case 11
Error_Code_Type$ = "Device failed."
Case 12
Error_Code_Type$ = "Device cannot find enough free resources To use."
Case 13
Error_Code_Type$ = "Windows cannot verify the device's resources."
Case 14
Error_Code_Type$ = "Device cannot work properly Until the computer is restarted."
Case 15
Error_Code_Type$ = "Device is Not working properly due To a possible re-Enumeration problem."
Case 16
Error_Code_Type$ = "Windows cannot identify all of the resources that the device uses."
Case 17
Error_Code_Type$ = "Device is requesting an unknown resource type."
Case 18
Error_Code_Type$ = "Device drivers must be reinstalled."
Case 19
Error_Code_Type$ = "Failure using the VxD loader."
Case 20
Error_Code_Type$ = "Registry might be corrupted."
Case 21
Error_Code_Type$ = "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device."
Case 22
Error_Code_Type$ = "Device is disabled."
Case 23
Error_Code_Type$ = "System failure. If changing the device driver is ineffective, see the hardware documentation."
Case 24
Error_Code_Type$ = "Device is Not present, Not working properly, Or does Not have all of its drivers installed."
Case 25
Error_Code_Type$ = "Windows is still setting up the device."
Case 26
Error_Code_Type$ = "Windows is still setting up the device."
Case 27
Error_Code_Type$ = "Device does Not have valid log configuration."
Case 28
Error_Code_Type$ = "Device drivers are Not installed."
Case 29
Error_Code_Type$ = "Device is disabled. The device firmware did Not provide the required resources."
Case 30
Error_Code_Type$ = "Device is using an IRQ resource that another device is using."
Case 31
Error_Code_Type$ = "Device is Not working properly. Windows cannot load the required device drivers."
EndSelect
ProcedureReturn Error_Code_Type$
EndProcedure
Procedure Volume_Info()
Define.COMateObject objWMIService, WinVOLInfo
colWinVOLInfo.COMateEnumObject
strComputer.s = "."
objWMIService = COMate_GetObject("winmgmts:\\" + strComputer + "\root\cimv2", "")
If objWMIService
colWinVOLInfo = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_Volume')")
If colWinVOLInfo
WinVOLInfo = colWinVOLInfo\GetNextObject()
While WinVOLInfo
VVOL_SysName$ = WinVOLInfo\GetStringProperty("Name")
VVOL_Description$ = WinVOLInfo\GetStringProperty("Description")
VVOL_DriveLetter$ = WinVOLInfo\GetStringProperty("DriveLetter") + "\"
If FindString(VVOL_SysName$, "\\?\",1) <> 0
Raid_Part_note.i = #True
VVOL_DriveLetter_NotePart$ = "Probable RAID partition, no drive letter for this partition normal for RAID Arrays.)"
Else
Raid_Part_note.i = #False
EndIf
VVOL_DeviceID$ = WinVOLInfo\GetStringProperty("DeviceID")
VVOL_PNPDeviceID$ = WinVOLInfo\GetStringProperty("PNPDeviceID")
VVOL_FileSystem$ = WinVOLInfo\GetStringProperty("FileSystem")
VVOL_Label$ = WinVOLInfo\GetStringProperty("Label")
VVOL_FreeSpace$ = WinVOLInfo\GetStringProperty("FreeSpace")
VVOL_Capacity$ = WinVOLInfo\GetStringProperty("Capacity")
VVOL_MaximumFileNameLength$ = Str(WinVOLInfo\GetIntegerProperty("MaximumFileNameLength"))
VVOL_NumberOfBlocks$ = WinVOLInfo\GetStringProperty("NumberOfBlocks")
VVOL_BlockSize$ = WinVOLInfo\GetStringProperty("BlockSize")
VVOL_Purpose$ = WinVOLInfo\GetStringProperty("Purpose")
VVOL_ErrorDescription$ = WinVOLInfo\GetStringProperty("ErrorDescription")
Select WinVOLInfo\GetIntegerProperty("DriveType")
Case 0
VVOL_DriveType$ = "Unknown"
Case 1
VVOL_DriveType$ = "No Root Directory"
Case 2
VVOL_DriveType$ = "Removable Disk"
Case 3
VVOL_DriveType$ = "Local Disk"
Case 4
VVOL_DriveType$ = "Network Drive"
Case 5
VVOL_DriveType$ = "Compact Disk"
Case 6
VVOL_DriveType$ = "Ram Disk"
EndSelect
If WinVOLInfo\GetIntegerProperty("DirtyBitSet") = 0
VVOL_VolumeDirty$ = "False - Chkdsk will not run at the next restart."
Else
VVOL_VolumeDirty$ = "True - Chkdsk method is automatically run by the system at the next restart."
EndIf
If WinVOLInfo\GetIntegerProperty("SupportsDiskQuotas") = 0
VVOL_SupportsDiskQuotas$ = "This volume does not supports disk quotas."
Else
VVOL_SupportsDiskQuotas$ = "This volume supports disk quotas."
EndIf
If WinVOLInfo\GetIntegerProperty("QuotasEnabled") = 0
VVOL_QuotasEnabled$ = "Quota management is not enabled for this volume."
Else
VVOL_QuotasEnabled$ = "Quota management is enabled for this volume."
EndIf
If WinVOLInfo\GetIntegerProperty("Automount") = 0
VVOL_Automount$ = "False"
Else
VVOL_Automount$ = "True"
EndIf
If WinVOLInfo\GetIntegerProperty("IndexingEnabled") = 0
VVOL_IndexingEnabled$ = "False - Context Indexing is not enabled"
Else
VVOL_IndexingEnabled$ = "True - Context Indexing is enabled"
EndIf
VVOL_ConfigManagerErrorCode$ = ConfigManager_ErrorCode(WinVOLInfo\GetIntegerProperty("ConfigManagerErrorCode"))
rmv_str_1$ = RemoveString(VVOL_DeviceID$, "\\?\", #PB_String_NoCase, 1)
rmv_str_2$ = RemoveString(rmv_str_1$, "\", #PB_String_NoCase, 1)
HKEY_Drive$ = "SOFTWARE\Microsoft\Dfrg\Statistics\" + rmv_str_2$
TotalUsedClusters$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "TotalUsedClusters")
TotalClusters$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "TotalClusters")
BytesPerCluster$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "BytesPerCluster")
FragmentedSpace$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "FragmentedSpace")
AvgFragmentsPerFile$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "AvgFragmentsPerFile")
MovableFiles$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "MovableFiles")
UnmovableFiles$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "UnmovableFiles")
FragmentedFiles$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "FragmentedFiles")
DirectoryCount$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "DirectoryCount")
FragmentedDirectories$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "FragmentedDirectories")
FreeSpaceCount$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "FreeSpaceCount")
AvgFreeSpaceSize$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "AvgFreeSpaceSize")
LargestFreeSpaceSize$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "LargestFreeSpaceSize")
TotalMFTRecords$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "TotalMFTRecords")
InUseMFTRecords$ = GetDWORDValue(#HKEY_LOCAL_MACHINE, HKEY_Drive$, "InUseMFTRecords")
Debug VVOL_SysName$ + " Name = " + " " + VVOL_Name$
Debug VVOL_SysName$ + " Drive Letter Path = " + " " + VVOL_DriveLetter$
Debug VVOL_SysName$ + " Label= " + " " + VVOL_Label$
Debug VVOL_SysName$ + " Description = " + " " + VVOL_Description$
Debug VVOL_SysName$ + " Drive Type = " + " " + VVOL_DriveType$
Debug VVOL_SysName$ + " Purpose = " + " " + VVOL_Purpose$
Debug VVOL_SysName$ + " Auto Mount = " + " " + VVOL_Automount$
Debug VVOL_SysName$ + " Device ID = " + " " + VVOL_DeviceID$
Debug VVOL_SysName$ + " PNP Device ID = " + " " + VVOL_PNPDeviceID$
Debug VVOL_SysName$ + " File System = " + " " + VVOL_FileSystem$
Debug VVOL_SysName$ + " Capacity = " + " " + VVOL_Capacity$ + " Bytes"
Debug VVOL_SysName$ + " Free Space = " + " " + VVOL_FreeSpace$ + " Bytes"
Debug VVOL_SysName$ + " Number Of Blocks = " + " " + VVOL_NumberOfBlocks$
Debug VVOL_SysName$ + " Block Size = " + " " + VVOL_BlockSize$
Debug VVOL_SysName$ + " Volume Dirty = " + " " + VVOL_VolumeDirty$
Debug VVOL_SysName$ + " Supports Disk Quotas = " + " " + VVOL_SupportsDiskQuotas$
Debug VVOL_SysName$ + " Quotas Enabled = " + " " + VVOL_QuotasEnabled$
Debug VVOL_SysName$ + " Indexing Enabled = " + " " + VVOL_IndexingEnabled$
Debug VVOL_SysName$ + " Maximum File Name Length = " + " " + VVOL_MaximumFileNameLength$
If VVOL_Status$ = "Pred Fail"
Debug VVOL_SysName$ + " WARNING !" + " THIS DEVICE IS PREDICTING FAILURE IN THE NEAR FUTURE!!! RECOMMEND IMMEDIATE BACK UP !!!"
EndIf
Debug VVOL_SysName$ + " Error Code Info = " + " " + VVOL_ConfigManagerErrorCode$
Debug VVOL_SysName$ + " Error Description = " + " " + VVOL_ErrorDescription$
Debug VVOL_SysName$ + " Defrag Stat: Total Used Clusters = " + " " + TotalUsedClusters$
Debug VVOL_SysName$ + " Defrag Stat: Total Clusters = " + " " + TotalClusters$
Debug VVOL_SysName$ + " Defrag Stat: Bytes Per Cluster = " + " " + BytesPerCluster$
Debug VVOL_SysName$ + " Defrag Stat: Fragmented Space = " + " " + FragmentedSpace$
Debug VVOL_SysName$ + " Defrag Stat: Movable Files = " + " " + MovableFiles$
Debug VVOL_SysName$ + " Defrag Stat: Unmovable Files = " + " " + UnmovableFiles$
Debug VVOL_SysName$ + " Defrag Stat: Fragmented Files = " + " " + FragmentedFiles$
Debug VVOL_SysName$ + " Defrag Stat: Avg Fragments Per File = " + " " + AvgFragmentsPerFile$
Debug VVOL_SysName$ + " Defrag Stat: Directory Count = " + " " + DirectoryCount$
Debug VVOL_SysName$ + " Defrag Stat: Fragmented Directories = " + " " + FragmentedDirectories$
Debug VVOL_SysName$ + " Defrag Stat: Free Space Count = " + " " + FreeSpaceCount$
Debug VVOL_SysName$ + " Defrag Stat: Avg Free Space Size = " + " " + AvgFreeSpaceSize$
Debug VVOL_SysName$ + " Defrag Stat: Largest Free Space Size = " + " " + LargestFreeSpaceSize$
Debug VVOL_SysName$ + " Defrag Stat: Total MFT Records = " + " " + TotalMFTRecords$
Debug VVOL_SysName$ + " Defrag Stat: In Use MFT Records = " + " " + InUseMFTRecords$
If Raid_Part_note = #True
Debug "ADDITIONAL INFORMATION FOR THIS ENTRY = " + " " + VVOL_DriveLetter_NotePart$
EndIf
Debug "============================="
WinVOLInfo\Release()
WinVOLInfo = colWinVOLInfo\GetNextObject()
Wend
colWinVOLInfo\Release()
EndIf
objWMIService\Release()
Else
MessageRequester("Error", "WinVOLInfo")
EndIf
EndProcedure
Volume_Info()