Skip to content

Commit

Permalink
GetDiskInfoFromWmi: Bump version to 1.4.1; Tidy source code
Browse files Browse the repository at this point in the history
  • Loading branch information
htcfreek committed Jul 6, 2021
1 parent 76184d8 commit 2d2c63d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/GetDiskInfoFromWmi/GetDiskInfoFromWmi.au3
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@
#cs
===============================================================================================================================
Title ...............: _GetDiskInfoFromWmi (GitHub: https://github.com/htcfreek/AutoIt-Scripts)
Version .............: 1.4
Version .............: 1.4.1
License .............: GNU LGPLv3
AutoIt Version ......: 3.3.14.5+
Language ............: English
Description .........: Get disk and partition informations from WMI.
Author ..............: htcfreek (Heiko) - https://github.com/htcfreek [original]
Modified ............:
Modified ............:
Required includes ...: Array.au3
Dll .................:
===============================================================================================================================
CHANGELOG:
2021-07-06 (v1.4.1)
Fixed: Code styling
2021-07-05 (v1.4)
Fixed: Typos in script and example.
Expand Down Expand Up @@ -79,7 +82,7 @@ Func _GetDiskInfoFromWmi(ByRef $aDiskList, ByRef $aPartitionList, $bAddTableHead


; Add Array header
if ($bAddTableHeader = 1) Then
If ($bAddTableHeader = 1) Then
$sDiskHeader = "DiskNum" & "||" & "DiskDeviceID" & "||" & "DiskManufacturer" & "||" & "DiskModel" & "||" & "DiskInterfaceType" & "||" & "DiskMediaType" & "||" & "DiskSerialNumber" & "||" & "DiskState" & "||" & "DiskSize" & "||" & "DiskInitType" & "||" & "DiskPartitionCount" & "||" & "WindowsRunningOnDisk (SystemDrive)"
_ArrayAdd($aDisks, $sDiskHeader, 0, "||")
$sPartitionHeader = "DiskNum" & "||" & "PartitionNum" & "||" & "PartitionID" & "||" & "PartitionType" & "||" & "PartitionIsPrimary" & "||" & "PartitionIsBootPartition" & "||" & "PartitionLetter" & "||" & "PartitionLabel" & "||" & "PartitionFileSystem" & "||" & "PartitionSizeTotal" & "||" & "PartitionSizeUsed" & "||" & "PartitionSizeFree" & "||" & "PartitionIsSystemDrive"
Expand Down Expand Up @@ -108,7 +111,7 @@ Func _GetDiskInfoFromWmi(ByRef $aDiskList, ByRef $aPartitionList, $bAddTableHead
_ArrayAdd($aPartitions, $sNewPart, 0, "||")

; Set DiskInitStyle
if StringRegExp($oPartition.Type, "^GPT.*") Then
If StringRegExp($oPartition.Type, "^GPT.*") Then
$aDisks[$iDiskArrayCount][9] = "GPT"
Else
$aDisks[$iDiskArrayCount][9] = "MBR"
Expand All @@ -126,7 +129,7 @@ Func _GetDiskInfoFromWmi(ByRef $aDiskList, ByRef $aPartitionList, $bAddTableHead
$aPartitions[$iPartArrayCount][11] = $oLogicalDisk.FreeSpace

; Detect SystemBootDisk
if $oLogicalDisk.DeviceID = EnvGet("SystemDrive") Then
If $oLogicalDisk.DeviceID = EnvGet("SystemDrive") Then
$aDisks[$iDiskArrayCount][11] = True
$aPartitions[$iPartArrayCount][12] = True
EndIf
Expand Down
2 changes: 1 addition & 1 deletion src/GetDiskInfoFromWmi/UsageExample.au3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Local $aOutputDisks
Local $aOutputPartitions
_GetDiskInfoFromWmi($aOutputDisks, $aOutputPartitions, $DiskInfoWmi_TableHeader_Yes, $DiskInfoWmi_DiskType_Fixed)
If @error Then MSGBOX(16, @ScriptName, "Something went wrong!")
If @error Then MsgBox(16, @ScriptName, "Something went wrong!")

_ArrayDisplay($aOutputDisks, "Disks")
_ArrayDisplay($aOutputPartitions, "Partitions")

0 comments on commit 2d2c63d

Please sign in to comment.