From e8a83e4454bcfbe833c0be332289e12bf90c6543 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Wed, 7 Jul 2021 22:25:20 +0200 Subject: [PATCH 01/31] Update .gitignore for --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index b14e0011..eeca40c9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ WhyNot.txt WhyNotWin11_stripped.au3 del.au3 Config/config.st + +# Backupfolder from Tidy in "ISN AutoIt Studio" +**/Backup/*.au3 From 3a28392f351198f8b43696ec8def4f766993485f Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Wed, 7 Jul 2021 22:37:42 +0200 Subject: [PATCH 02/31] Small improvements --- WhyNotWin11.au3 | 12 ++++++++---- includes/_Checks.au3 | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index f8f7f53e..eed0a2f1 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -31,6 +31,8 @@ FileChangeDir(@SystemDir) If @OSVersion = 'WIN_10' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 1) +#Region Includes +; Default UDF includes #include #include #include @@ -48,10 +50,10 @@ If @OSVersion = 'WIN_10' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetPr #include #include -Global $WINDOWS_DRIVE = EnvGet("SystemDrive") - +; Include external functions #include "Includes\ResourcesEx.au3" +; Internals internal scripts #include "Includes\_WMIC.au3" #include "Includes\_Checks.au3" #include "Includes\_Theming.au3" @@ -59,6 +61,7 @@ Global $WINDOWS_DRIVE = EnvGet("SystemDrive") #include "Includes\_GetDiskInfo.au3" #include "Includes\_Translations.au3" ; #include "includes\WhyNotWin11_accessibility.au3" +#EndRegion Opt("TrayIconHide", 1) Opt("TrayAutoPause", 0) @@ -224,6 +227,7 @@ Func Main() Local Const $DPI_RATIO = _GDIPlus_GraphicsGetDPIRatio()[0] Local $aDisks, $aPartitions + #Region Init WMI data ProgressOn("WhyNotWin11", "Loading WMIC") ProgressSet(0, "_GetCPUInfo()") _GetCPUInfo() @@ -236,6 +240,8 @@ Func Main() ProgressSet(80, "_GetDiskInfoFromWmi") _GetDiskInfoFromWmi($aDisks, $aPartitions, 1) ProgressSet(100, "Done") + ProgressOff() + #EndRegion Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) GUISetBkColor(_HighContrast(0xF8F8F8)) @@ -581,8 +587,6 @@ Func Main() #EndRegion Settings GUI GUISwitch($hGUI) - - ProgressOff() GUISetState(@SW_SHOW, $hGUI) Local $hMsg, $sDXFile diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index b604eeb6..e0c4be0d 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -1,6 +1,6 @@ #include-once #include -#include ".\_WMIC.au3" +#include "_WMIC.au3" Func _ArchCheck() Select From 96c017b49325f142806dbd07a1e2bcd8d1e5920c Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Wed, 7 Jul 2021 22:43:59 +0200 Subject: [PATCH 03/31] Update/replace from --- WhyNotWin11.au3 | 2 +- includes/GetDiskInfoFromWmi.au3 | 153 ++++++++++++++++++++++++++++++++ includes/_GetDiskInfo.au3 | 88 ------------------ 3 files changed, 154 insertions(+), 89 deletions(-) create mode 100644 includes/GetDiskInfoFromWmi.au3 delete mode 100644 includes/_GetDiskInfo.au3 diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index eed0a2f1..de5ad4b7 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -52,13 +52,13 @@ If @OSVersion = 'WIN_10' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetPr ; Include external functions #include "Includes\ResourcesEx.au3" +#include "Includes\GetDiskInfoFromWmi.au3" ; Internals internal scripts #include "Includes\_WMIC.au3" #include "Includes\_Checks.au3" #include "Includes\_Theming.au3" #include "Includes\_Resources.au3" -#include "Includes\_GetDiskInfo.au3" #include "Includes\_Translations.au3" ; #include "includes\WhyNotWin11_accessibility.au3" #EndRegion diff --git a/includes/GetDiskInfoFromWmi.au3 b/includes/GetDiskInfoFromWmi.au3 new file mode 100644 index 00000000..8cb2e4b2 --- /dev/null +++ b/includes/GetDiskInfoFromWmi.au3 @@ -0,0 +1,153 @@ +; Includes +;---------- +#include-once +#include + + + +#cs +=============================================================================================================================== + Title ...............: _GetDiskInfoFromWmi (GitHub: https://github.com/htcfreek/AutoIt-Scripts) + 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 ............: + 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. + + 2021-07-04 (v1.3) + Fixed: Typos + Added: DiskType filter + Added: Constants + Added: Required includes + Added: Error handling + Changed: Improved comments + Changed: Disk property header renamed: WindowsRunningOnDisk (SystemRoot) -> WindowsRunningOnDisk (SystemDisk) + Changed: Partition property header renamed: PartitionIsSystemRoot -> PartitionIsSystemDisk + + 2021-07-02 (v1.2) + Added: Disk properties Manufacturer, InterfaceType, MediaType, SerialNumber, Status + Added: Partition property: Filesystem + Changed: Disk property header renamed: SystemIsBootedFromDisk -> WindowsRunningOnDisk (SystemRoot) + Changed: Partition property header renamed: SystemIsBootedFromPartition -> PartitionIsSystemRoot + + 2021-07-02 (v1.0) + New: Initial release + +#ce + + + +; Global constants +; ----------------- +Global Const $DiskInfoWmi_TableHeader_Yes = 1 +Global Const $DiskInfoWmi_TableHeader_No = 0 +Global Const $DiskInfoWmi_DiskType_All = "%" +Global Const $DiskInfoWmi_DiskType_External = "External%" +Global Const $DiskInfoWmi_DiskType_Removable = "Removable%" +Global Const $DiskInfoWmi_DiskType_Fixed = "Fixed%" +Global Const $DiskInfoWmi_DiskType_Unknown = "Unknown%" + + + +; Function +; --------- +Func _GetDiskInfoFromWmi(ByRef $aDiskList, ByRef $aPartitionList, $bAddTableHeader = $DiskInfoWmi_TableHeader_Yes, $sFilterDiskType = $DiskInfoWmi_DiskType_All) + ; Name ...............: _GetDiskInfoFromWmi + ; Author .............: htcfreek (Heiko) - https://github.com/htcfreek + ; Input parameter ....: ByRef $aDiskList = Array var for list of disks. + ; ByRef $aPartitionList = Array var for list of partitions. + ; [$bAddTableHeader = $DiskInfoWmi_TableHeader_Yes] = Should array tables have a header row. (Values: 0|1 or $DiskInfoWmi_TableHeader_Yes|$DiskInfoWmi_TableHeader_No) + ; [$sFilterDiskType = $DiskInfoWmi_DiskType_All] = Which type of disk should be included in result. (Values: $DiskInfoWmi_DiskType_All|$DiskInfoWmi_DiskType_External|$DiskInfoWmi_DiskType_Removable|$DiskInfoWmi_DiskType_Fixed|$DiskInfoWmi_DiskType_Unknown) + ; Output parameter ...: none + ; On WMI-Error .......: @error = 1 + + + ; Initialize function wide vars + Local $aDisks[0][12] + Local $aPartitions[0][13] + Local $iDiskArrayCount = 0 ; Initialize counter to write some disk data later in correct array row. + Local $iPartArrayCount = 0 ; Initialize counter to write partition data later in correct array row. + + + ; Add Array header + 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" + _ArrayAdd($aPartitions, $sPartitionHeader, 0, "||") + $iDiskArrayCount += 1 + $iPartArrayCount += 1 + EndIf + + ; Get Information from WMI + Local $oWmiInstance = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2') + If (IsObj($oWmiInstance)) And (Not @error) Then + ; Get Disks + Local $oPhysicalDisks = $oWmiInstance.ExecQuery('Select * from Win32_DiskDrive WHERE MediaType like "' & $sFilterDiskType & '"') + For $oDisk In $oPhysicalDisks + ; Add Disk data to Array + Local $iDisk = $oDisk.Index + Local $sNewDisk = $iDisk & "||" & $oDisk.DeviceID & "||" & $oDisk.Manufacturer & "||" & $oDisk.Model & "||" & $oDisk.InterfaceType & "||" & $oDisk.MediaType & "||" & $oDisk.SerialNumber & "||" & $oDisk.Status & "||" & $oDisk.Size & "||" & "" & "||" & $oDisk.Partitions & "||" & False + _ArrayAdd($aDisks, $sNewDisk, 0, "||") + + ; Get Partitions + Local $oPartitions = $oWmiInstance.ExecQuery("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" & $oDisk.DeviceID & "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition") + For $oPartition In $oPartitions + ; Add Partition data to Array + Local $iPartition = $oPartition.Index + Local $sNewPart = $iDisk & "||" & $iPartition & "||" & $oPartition.DeviceID & "||" & $oPartition.Type & "||" & $oPartition.PrimaryPartition & "||" & $oPartition.BootPartition & "||" & "" & "||" & "" & "||" & "" & "||" & $oPartition.Size & "||" & "" & "||" & "" & "||" & False + _ArrayAdd($aPartitions, $sNewPart, 0, "||") + + ; Set DiskInitStyle + If StringRegExp($oPartition.Type, "^GPT.*") Then + $aDisks[$iDiskArrayCount][9] = "GPT" + Else + $aDisks[$iDiskArrayCount][9] = "MBR" + EndIf + + ; Get logical disks + Local $oLogicalDisks = $oWmiInstance.ExecQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" & $oPartition.DeviceID & "'} WHERE AssocClass = Win32_LogicalDiskToPartition") + For $oLogicalDisk In $oLogicalDisks + ; Add logical disk data to array + $aPartitions[$iPartArrayCount][6] = $oLogicalDisk.DeviceID + $aPartitions[$iPartArrayCount][7] = $oLogicalDisk.VolumeName + $aPartitions[$iPartArrayCount][8] = $oLogicalDisk.FileSystem + $aPartitions[$iPartArrayCount][9] = $oLogicalDisk.Size ; Value of LogicalDisk.Size is different to Size of DiskPartition.Size!! + $aPartitions[$iPartArrayCount][10] = ($oLogicalDisk.Size - $oLogicalDisk.FreeSpace) + $aPartitions[$iPartArrayCount][11] = $oLogicalDisk.FreeSpace + + ; Detect SystemBootDisk + If $oLogicalDisk.DeviceID = EnvGet("SystemDrive") Then + $aDisks[$iDiskArrayCount][11] = True + $aPartitions[$iPartArrayCount][12] = True + EndIf + Next + + ; Array counter (Partitions) + 1 + $iPartArrayCount += 1 + Next + + ; Array counter (Disks) + 1 + $iDiskArrayCount += 1 + Next + Else + ; If WMI-Error then set @error + SetError(1) + EndIf + + ; Return Data + $aDiskList = $aDisks + $aPartitionList = $aPartitions +EndFunc ;==>_GetDiskInfoFromWmi diff --git a/includes/_GetDiskInfo.au3 b/includes/_GetDiskInfo.au3 deleted file mode 100644 index f5c353e0..00000000 --- a/includes/_GetDiskInfo.au3 +++ /dev/null @@ -1,88 +0,0 @@ -#include-once - -#include - -Func _GetDiskInfoFromWmi(ByRef $aDiskList, ByRef $aPartitionList, $bAddTableHeader = 1) - ; Name: _GetDiskInfoFromWmi (GitHub: - https://github.com/htcfreek/AutoIt-Scripts) - ; Author: htcfreek (Heiko) - https://github.com/htcfreek - ; Version: 1.2 - ; License: GNU LGPLv3 - ; Input parameter: ByRef $aDiskList = Array var for list of disks.; ByRef $aPartitionList = Array var for list of partitions.; [$bAddTableHeader = 1] = Should array tables have a header rows. - ; Output parameter: none - ; Required includes: - - - ; Initialize function wide vars - Local $aDisks[0][12] - Local $aPartitions[0][13] - Local $iDiskArrayCount = 0 ; Initialize counter to write some disk data later in correct array row. - Local $iPartArrayCount = 0 ; Initialize counter to write partition data later in correct array row. - - - ; Add Array header - If ($bAddTableHeader = 1) Then - Local $sDiskHeader = "DiskNum" & "||" & "DiskDeviceID" & "||" & "DiskManufacturer" & "||" & "DiskModel" & "||" & "DiskInterfacetype" & "||" & "DiskMediatype" & "||" & "DiskSerialnumber" & "||" & "DiskState" & "||" & "DiskSize" & "||" & "DiskInitType" & "||" & "DiskPartitionCount" & "||" & "WindowsRunningOnDisk (SystemRoot)" - _ArrayAdd($aDisks, $sDiskHeader, 0, "||") - Local $sPartitionHeader = "DiskNum" & "||" & "PartitionNum" & "||" & "PartitionID" & "||" & "PartitionType" & "||" & "PartitionIsPrimary" & "||" & "PartIsBootPartition" & "||" & "PartitionLetter" & "||" & "PartitionLabel" & "||" & "PartitionFilesystem" & "||" & "PartitionSizeTotal" & "||" & "PartitionSizeUsed" & "||" & "PartitionSizeFree" & "||" & "PartitionIsSystemRoot" - _ArrayAdd($aPartitions, $sPartitionHeader, 0, "||") - $iDiskArrayCount += 1 - $iPartArrayCount += 1 - EndIf - - ; Get Information from WMI - Local $oWmiInstance = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2') - If (IsObj($oWmiInstance)) And (Not @error) Then - ; Get Disks - Local $oPhysicalDisks = $oWmiInstance.ExecQuery('Select * from Win32_DiskDrive') - For $oDisk In $oPhysicalDisks - ; Add Disk data to Array - Local $iDisk = $oDisk.Index - Local $sNewDisk = $iDisk & "||" & $oDisk.DeviceID & "||" & $oDisk.Manufacturer & "||" & $oDisk.Model & "||" & $oDisk.Interfacetype & "||" & $oDisk.Mediatype & "||" & $oDisk.Serialnumber & "||" & $oDisk.Status & "||" & $oDisk.Size & "||" & "" & "||" & $oDisk.Partitions & "||" & False - _ArrayAdd($aDisks, $sNewDisk, 0, "||") - - ; Get Partitions - Local $oPartitions = $oWmiInstance.ExecQuery("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" & $oDisk.DeviceID & "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition") - For $oPartition In $oPartitions - ; Add Partition data to Array - Local $iPartition = $oPartition.Index - Local $sNewPart = $iDisk & "||" & $iPartition & "||" & $oPartition.DeviceID & "||" & $oPartition.Type & "||" & $oPartition.PrimaryPartition & "||" & $oPartition.BootPartition & "||" & "" & "||" & "" & "||" & "" & "||" & $oPartition.Size & "||" & "" & "||" & "" & "||" & False - _ArrayAdd($aPartitions, $sNewPart, 0, "||") - - ; Set DiskInitStyle - If StringRegExp ( $oPartition.Type, "^GPT.*") Then - $aDisks[$iDiskArrayCount][9] = "GPT" - Else - $aDisks[$iDiskArrayCount][9] = "MBR" - EndIf - - ; Get LogicalDisk - Local $oLogicalDisks = $oWmiInstance.ExecQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" & $oPartition.DeviceID & "'} WHERE AssocClass = Win32_LogicalDiskToPartition") - For $oLogicalDisk In $oLogicalDisks - ; Add logical disk data to array - $aPartitions[$iPartArrayCount][6] = $oLogicalDisk.DeviceID - $aPartitions[$iPartArrayCount][7] = $oLogicalDisk.VolumeName - $aPartitions[$iPartArrayCount][8] = $oLogicalDisk.Filesystem - $aPartitions[$iPartArrayCount][9] = $oLogicalDisk.Size ; Value of LogicalDisk.Size is different to Size of DiskPartition.Size!! - $aPartitions[$iPartArrayCount][10] = ($oLogicalDisk.Size - $oLogicalDisk.FreeSpace) - $aPartitions[$iPartArrayCount][11] = $oLogicalDisk.FreeSpace - - ; Detect SystemBootDisk - If $oLogicalDisk.DeviceID = Envget("SystemDrive") Then - $aDisks[$iDiskArrayCount][11] = True - $aPartitions[$iPartArrayCount][12] = True - EndIf - Next - - ; ArrayCounter + 1 - $iPartArrayCount += 1 - Next - - ; ArrayCounter + 1 - $iDiskArrayCount += 1 - Next - EndIf - - ; Return Data - $aDiskList = $aDisks - $aPartitionList = $aPartitions -EndFunc ;==>_GetDiskInfoFromWmi From 22e988dc2275f82161ae650d49938ddf6f07dc19 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Wed, 7 Jul 2021 22:54:58 +0200 Subject: [PATCH 04/31] Remove old functions and mark parts to update --- WhyNotWin11.au3 | 70 +++++++++++++++++++------------------------- includes/_Checks.au3 | 27 ++--------------- includes/_WMIC.au3 | 35 ++-------------------- 3 files changed, 34 insertions(+), 98 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index de5ad4b7..ed220773 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -165,11 +165,12 @@ Func ChecksOnly() $aDirectX = _DirectXStartCheck() - Local $aDisks, $aPartitions - _GetDiskInfoFromWmi($aDisks, $aPartitions, 1) - $aResults[6][0] = _GPTCheck($aDisks) - $aResults[6][1] = @error - $aResults[6][2] = @extended +;~ // ToDo: Update this part +;~ Local $aDisks, $aPartitions +;~ _GetDiskInfoFromWmi($aDisks, $aPartitions, 1) +;~ $aResults[6][0] = _GPTCheck($aDisks) +;~ $aResults[6][1] = @error +;~ $aResults[6][2] = @extended $aResults[7][0] = _MemCheck() $aResults[7][1] = @error @@ -179,9 +180,10 @@ Func ChecksOnly() $aResults[8][1] = @error $aResults[8][2] = @extended - $aResults[9][0] = _SpaceCheck() - $aResults[9][1] = @error - $aResults[9][2] = @extended +;~ // ToDo: Update this part +;~ $aResults[9][0] = _SpaceCheck() +;~ $aResults[9][1] = @error +;~ $aResults[9][2] = @extended $aResults[10][0] = _TPMCheck() $aResults[10][1] = @error @@ -228,19 +230,20 @@ Func Main() Local $aDisks, $aPartitions #Region Init WMI data - ProgressOn("WhyNotWin11", "Loading WMIC") - ProgressSet(0, "_GetCPUInfo()") - _GetCPUInfo() - ProgressSet(20, "_GetDiskInfo()") - _GetDiskInfo() - ProgressSet(40, "_GetGPUInfo()") - _GetGPUInfo() - ProgressSet(60, "_GetTPMInfo()") - _GetTPMInfo() - ProgressSet(80, "_GetDiskInfoFromWmi") - _GetDiskInfoFromWmi($aDisks, $aPartitions, 1) - ProgressSet(100, "Done") - ProgressOff() +;~ // ToDo: Update this part +;~ ProgressOn("WhyNotWin11", "Loading WMIC") +;~ ProgressSet(0, "_GetCPUInfo()") +;~ _GetCPUInfo() +;~ ProgressSet(20, "_GetDiskInfo()") +;~ _GetDiskInfo() +;~ ProgressSet(40, "_GetGPUInfo()") +;~ _GetGPUInfo() +;~ ProgressSet(60, "_GetTPMInfo()") +;~ _GetTPMInfo() +;~ ProgressSet(80, "_GetDiskInfoFromWmi") +;~ _GetDiskInfoFromWmi($aDisks, $aPartitions, 1) +;~ ProgressSet(100, "Done") +;~ ProgressOff() #EndRegion Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) @@ -506,18 +509,9 @@ Func Main() Local $aDirectX $aDirectX = _DirectXStartCheck() - If _GPTCheck($aDisks) Then - If @error Then - _GUICtrlSetState($hCheck[6][0], $iPass) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "GPT Detected")) - Else - _GUICtrlSetState($hCheck[6][0], $iPass) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "GPT Detected")) - EndIf - Else - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "GPT Not Detected") & @CRLF & @error) - _GUICtrlSetState($hCheck[6][0], $iFail) - EndIf + #Region - GPTCheck + ;~ // ToDo: Update this part + #EndRegion If _MemCheck() Then _GUICtrlSetState($hCheck[7][0], $iPass) @@ -539,13 +533,9 @@ Func Main() GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Disabled / Not Detected")) EndSwitch - _SpaceCheck() - GUICtrlSetData($hCheck[9][2], @error & " GB " & $WINDOWS_DRIVE & @CRLF & @extended & " " & _Translate($iMUI, "Drive(s) Meet Requirements")) - If _SpaceCheck() Then - _GUICtrlSetPass($hCheck[9][0]) - Else - _GUICtrlSetFail($hCheck[9][0]) - EndIf + #Region - SpaceCheck + ;~ // ToDo: Update this part + #EndRegion - SpaceCheck Select Case _GetTPMInfo(0) = False diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index e0c4be0d..23c61856 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -114,16 +114,7 @@ Func _GetDirectXCheck($aArray) EndFunc ;==>_GetDirectXCheck Func _GPTCheck($aDisks) - For $iLoop = 0 To UBound($aDisks) - 1 - If $aDisks[$iLoop][11] = "True" Then - Switch $aDisks[$iLoop][9] - Case "GPT" - Return True - Case Else - Return SetError($aDisks[$iLoop][9], 0, False) - EndSwitch - EndIf - Next +;~ // ToDo: Update this part EndFunc ;==>_GPTCheck Func _MemCheck() @@ -166,21 +157,7 @@ Func _SecureBootCheck() EndFunc ;==>_SecureBootCheck Func _SpaceCheck() - Local $sWindows = EnvGet("SystemDrive") - - Local $iFree = Round(DriveSpaceTotal($sWindows) / 1024, 0) - Local $aDrives = DriveGetDrive($DT_FIXED) - Local $iDrives = 0 - - For $iLoop = 1 To $aDrives[0] Step 1 - If Round(DriveSpaceTotal($aDrives[$iLoop]) / 1024, 0) >= 64 Then $iDrives += 1 - Next - - If $iFree >= 64 Then - Return SetError($iFree, $iDrives, True) - Else - Return SetError($iFree, $iDrives, False) - EndIf +;~ // ToDo: Update this part EndFunc ;==>_SpaceCheck Func _TPMCheck() diff --git a/includes/_WMIC.au3 b/includes/_WMIC.au3 index d7c33064..c8f9f79f 100644 --- a/includes/_WMIC.au3 +++ b/includes/_WMIC.au3 @@ -56,39 +56,8 @@ Func _GetCPUInfo($iFlag = 0) EndSwitch EndFunc ;==>_GetCPUInfo -Func _GetDiskInfo($iFlag = 0) - Local Static $sType - Local Static $aDisks[2] - - If Not $sType <> "" Then - Local $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2') ; - If (IsObj($Obj_WMIService)) And (Not @error) Then - Local $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_DiskPartition where BootPartition=True') - - $aDisks[0] = 0 - $aDisks[1] = 0 - Local $Obj_Item - For $Obj_Item In $Col_Items - $aDisks[0] += 1 - $sType = $Obj_Item.Type - If StringLeft($sType, 3) = "GPT" Then $aDisks[1] += 1 - Next - If $aDisks[0] > 0 Then $sType = "GPT" - Else - $aDisks[0] = 0 - $aDisks[1] = "?" - Return $aDisks - EndIf - EndIf - Switch $iFlag - Case 0 - Return StringLeft($sType, 3) - Case 1 - Return $aDisks - Case Else - Return 0 - EndSwitch -EndFunc ;==>_GetDiskInfo +;~ // ToDo: Update this part +; ... Func _GetGPUInfo($iFlag = 0) Local Static $sName From b0f7c2391bce9706926a6c9a89591d54227e83ba Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Wed, 7 Jul 2021 23:18:52 +0200 Subject: [PATCH 05/31] Add new function <_GetDiskProperties> --- WhyNotWin11.au3 | 29 ++++++++++------------- includes/_WMIC.au3 | 58 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 68 insertions(+), 19 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index ed220773..8ad9edf2 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -165,9 +165,8 @@ Func ChecksOnly() $aDirectX = _DirectXStartCheck() + _GetDiskProperties() ;~ // ToDo: Update this part -;~ Local $aDisks, $aPartitions -;~ _GetDiskInfoFromWmi($aDisks, $aPartitions, 1) ;~ $aResults[6][0] = _GPTCheck($aDisks) ;~ $aResults[6][1] = @error ;~ $aResults[6][2] = @extended @@ -227,23 +226,19 @@ Func Main() Local Enum $FontSmall, $FontMedium, $FontLarge, $FontExtraLarge Local Const $DPI_RATIO = _GDIPlus_GraphicsGetDPIRatio()[0] - Local $aDisks, $aPartitions #Region Init WMI data -;~ // ToDo: Update this part -;~ ProgressOn("WhyNotWin11", "Loading WMIC") -;~ ProgressSet(0, "_GetCPUInfo()") -;~ _GetCPUInfo() -;~ ProgressSet(20, "_GetDiskInfo()") -;~ _GetDiskInfo() -;~ ProgressSet(40, "_GetGPUInfo()") -;~ _GetGPUInfo() -;~ ProgressSet(60, "_GetTPMInfo()") -;~ _GetTPMInfo() -;~ ProgressSet(80, "_GetDiskInfoFromWmi") -;~ _GetDiskInfoFromWmi($aDisks, $aPartitions, 1) -;~ ProgressSet(100, "Done") -;~ ProgressOff() + ProgressOn("WhyNotWin11", "Loading WMIC") + ProgressSet(0, "_GetCPUInfo()") + _GetCPUInfo() + ProgressSet(25, "_GetDiskProperties()") + _GetDiskProperties() + ProgressSet(50, "_GetGPUInfo()") + _GetGPUInfo() + ProgressSet(75, "_GetTPMInfo()") + _GetTPMInfo() + ProgressSet(100, "Done") + ProgressOff() #EndRegion Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) diff --git a/includes/_WMIC.au3 b/includes/_WMIC.au3 index c8f9f79f..d5bb56d1 100644 --- a/includes/_WMIC.au3 +++ b/includes/_WMIC.au3 @@ -56,8 +56,62 @@ Func _GetCPUInfo($iFlag = 0) EndSwitch EndFunc ;==>_GetCPUInfo -;~ // ToDo: Update this part -; ... +Func _GetDiskProperties($iFlag = 0) + ; Desc ......... : Call _GetDiskInfoFromWmi() to get the disk and partition informations. The selected information will be returned. + ; Parameters ... : $iFlag = 0 => Init WMI data. + ; .............. : $iFlag = 1 => Return array with disk information. + ; .............. : $iFlag = 2 => Return array with partition information. + ; .............. : $iFlag = 3 => Return information of disk with system (Windows) partition. + ; .............. : $iFlag = 4 => Return information of system (Windows) partition. + ; On error ..... : Return SetError(1, 1, "Error_WmiFailed"), if WMI failed. + ; .............. : Return SetError(1, 2, "Error_IncorrectFlag"), if $iFlag is unknown. + ; .............. : Return SetError(1, 3, "Error_NoDataReturned"), if not data can be returned. + + Static $aDiskArray + Static $aPartitionArray + + ; Get WMI data + If (Not $aDiskArray) Or (Not $aPartitionArray) Then + ; Get disk datat for fixed (internal) disks. + _GetDiskInfoFromWmi($aDiskArray, $aPartitionArray, $DiskInfoWmi_TableHeader_No, $DiskInfoWmi_DiskType_Fixed) + If @error = 1 Then Return SetError(1, 1, "Error_WmiFailed") + EndIf + + ; Return data based on $iFlag or exit function + Switch $iFlag + Case 0 + ; Exit function after init WMI data + Return + Case 1 + ; Return array with disk information. + Return $aDiskArray + Case 2 + ; Return array with partition information. + Return $aPartitionArray + Case 3 + ; Return information of disk with system (Windows) partition. + For $i = 0 To UBound($aDiskArray) - 1 Step 1 + ; If windows is bootet from disk... + If $aDiskArray[$i][11] = True Then + Return $aDiskArray[$i] + EndIf + Next + Case 4 + ; Return information of system (Windows) partition. + For $i = 0 To UBound($aPartitionArray) - 1 Step 1 + ; If windows is bootet from partition... + If $aPartitionArray[$i][12] = True Then + Return $aPartitionArray[$i] + EndIf + Next + Case Else + ; If $iFlag was incorrect... + Return SetError(1, 2, "Error_IncorrectFlag") + EndSwitch + + ; If no data returned before... + SetError(1, 3, "Error_NoDataReturned") +EndFunc ;==>_GetDiskProperties Func _GetGPUInfo($iFlag = 0) Local Static $sName From 60a7bc81ade60877e2bca2c0a5a8c74ec58a220c Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Wed, 7 Jul 2021 23:47:36 +0200 Subject: [PATCH 06/31] Add new function --- WhyNotWin11.au3 | 18 +++++++++++++----- includes/_Checks.au3 | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index 8ad9edf2..d92d16e2 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -166,10 +166,9 @@ Func ChecksOnly() $aDirectX = _DirectXStartCheck() _GetDiskProperties() -;~ // ToDo: Update this part -;~ $aResults[6][0] = _GPTCheck($aDisks) -;~ $aResults[6][1] = @error -;~ $aResults[6][2] = @extended + $aResults[6][0] = _GPTCheck() + $aResults[6][1] = (_GPTCheck() = "GPT") ? "GPT" : (_GPTCheck() = "MBR") ? "MBR" : "" + $aResults[6][2] = "" $aResults[7][0] = _MemCheck() $aResults[7][1] = @error @@ -505,7 +504,16 @@ Func Main() $aDirectX = _DirectXStartCheck() #Region - GPTCheck - ;~ // ToDo: Update this part + Switch _GPTCheck() + Case "GPT" + _GUICtrlSetPass($hCheck[6][0]) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: GPT") & @CRLF & _Translate($iMUI, "Drive meets requirement.")) + Case "MBR" + _GUICtrlSetFail($hCheck[6][0]) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: MBR") & @CRLF & _Translate($iMUI, "Drive does not meet requirement.")) + Case Else + ; Do Nothing!! + EndSwitch #EndRegion If _MemCheck() Then diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index 23c61856..b81a86db 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -113,8 +113,19 @@ Func _GetDirectXCheck($aArray) EndIf EndFunc ;==>_GetDirectXCheck -Func _GPTCheck($aDisks) -;~ // ToDo: Update this part +Func _GPTCheck() + ; Desc ......... : Call _GetDiskInfoFromWmi() to get the disk and partition informations. The selected information will be returned. + ; Parameters ... : + ; On error ..... : True | False | SetError(1, 1, "Error_CheckFailed") + + Switch _GetDiskProperties(1)[11] + Case "GPT" + Return True + Case "MBR" + Return False + Case Else + Return SetError(1, 1, "Error_CheckFailed") + EndSwitch EndFunc ;==>_GPTCheck Func _MemCheck() From 5a112b022158679f5f4bc9d4cc10bd8ed0561539 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Wed, 7 Jul 2021 23:54:22 +0200 Subject: [PATCH 07/31] Fix function --- includes/_Checks.au3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index b81a86db..c53144d8 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -118,7 +118,7 @@ Func _GPTCheck() ; Parameters ... : ; On error ..... : True | False | SetError(1, 1, "Error_CheckFailed") - Switch _GetDiskProperties(1)[11] + Switch _GetDiskProperties(3)[11] ; 3 = SystemDisk properties, 11 = Array field for DiskInitType Case "GPT" Return True Case "MBR" From e578335a00514e744b84b0bf60a2f4043123e1bf Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 00:40:20 +0200 Subject: [PATCH 08/31] Add new --- WhyNotWin11.au3 | 21 +++++++++++++---- includes/_Checks.au3 | 56 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 66 insertions(+), 11 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index d92d16e2..3ed5feb4 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -178,10 +178,9 @@ Func ChecksOnly() $aResults[8][1] = @error $aResults[8][2] = @extended -;~ // ToDo: Update this part -;~ $aResults[9][0] = _SpaceCheck() -;~ $aResults[9][1] = @error -;~ $aResults[9][2] = @extended + $aResults[9][0] = _SpaceCheck(0) + $aResults[9][1] = (_SpaceCheck(1) <> "Error_CheckFailed") ? _SpaceCheck(1) : "" ; Disk size + $aResults[9][2] = (_SpaceCheck(2) <> "Error_CheckFailed") ? _SpaceCheck(2) : "" ; Partiton size $aResults[10][0] = _TPMCheck() $aResults[10][1] = @error @@ -537,7 +536,19 @@ Func Main() EndSwitch #Region - SpaceCheck - ;~ // ToDo: Update this part + if _SpaceCheck(2) >= 64 and _SpaceCheck(1) >= 64 Then + ; Partition and Disk >= 64 GB + _GUICtrlSetPass($hCheck[8][0]) + GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both passed.")) + ElseIf _SpaceCheck(2) < 64 and _SpaceCheck(1) >= 64 Then + ; Partition < 64 GB and Disk >= 64 GB + _GUICtrlSetWarn($hCheck[8][0]) + GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Partition failed.")) + ElseIf _SpaceCheck(2) < 64 and _SpaceCheck(1) < 64 Then + ; Partition and Disk < 64 GB + _GUICtrlSetFail($hCheck[8][0]) + GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both Failed.")) + EndIf #EndRegion - SpaceCheck Select diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index c53144d8..f13f4c3e 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -116,15 +116,18 @@ EndFunc ;==>_GetDirectXCheck Func _GPTCheck() ; Desc ......... : Call _GetDiskInfoFromWmi() to get the disk and partition informations. The selected information will be returned. ; Parameters ... : - ; On error ..... : True | False | SetError(1, 1, "Error_CheckFailed") + ; Return value . : True | False | SetError(1, 1, "Error_CheckFailed") - Switch _GetDiskProperties(3)[11] ; 3 = SystemDisk properties, 11 = Array field for DiskInitType + ; Check for error + _GetDiskProperties(3) ; 3 = SystemDisk properties + if @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + + ; Check DiskInitType + Switch _GetDiskProperties(3)[9] ; 9 = Array field for DiskInitType Case "GPT" Return True Case "MBR" Return False - Case Else - Return SetError(1, 1, "Error_CheckFailed") EndSwitch EndFunc ;==>_GPTCheck @@ -167,8 +170,49 @@ Func _SecureBootCheck() EndSwitch EndFunc ;==>_SecureBootCheck -Func _SpaceCheck() -;~ // ToDo: Update this part +Func _SpaceCheck($iFlag) + ; Desc ......... : Call _GetDiskInfoFromWmi() to get the disk and partition informations. The selected information will be returned. + ; Parameters ... : $iFlag = 0 => Return if system disk and system partition ready. + ; Parameters ... : $iFlag = 1 => Return size of system disk in GB. + ; Parameters ... : $iFlag = 2 => Return size of system partition in GB. + ; Parameters ... : $iFlag = 3 => Return count of internal Win11 ready disks. + ; Parameters ... : $iFlag = 4 => Return count of all internal disks. + ; On error ..... : SetError(1, 1, "Error_CheckFailed") + + ; Check for error + _GetDiskProperties(4) + if @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + + ; Get size + Local $iDiskSize = Round(_GetDiskProperties(3)[8] / 1024 / 1024 / 1024) + Local $iPartitionSize = Round(_GetDiskProperties(4)[9] / 1024 / 1024 / 1024) + + Switch $iFlag + Case 0 + ; Return readiness state + return ($iDiskSize >= 64 AND $iPartitionSize >= 64) ? True : False + Case 1 + ; Return size of disk + Return $iDiskSize + Case 2 + ; Return size of partiton + Return $iPartitionSize + Case 3 + ; Count Disk with sie >= 64 GB. + Local $aDisks = _GetDiskProperties(1) + Local $iDiskCount = 0 + For $i = 0 To UBound($aDisks) - 1 + if _GetDiskProperties(1)[$i][8] >= 64 Then + $iDiskCount += 1 + EndIf + Next + Return $iDiskCount + Case 4 + Return UBound($aDisks) + Case Else + ; $iFlag unknown + Return SetError(1, 1, "Error_CheckFailed") + EndSwitch EndFunc ;==>_SpaceCheck Func _TPMCheck() From a33ccfc663d1df74d21cf8fddaa5709ee1b61986 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 00:44:12 +0200 Subject: [PATCH 09/31] Tidy source --- WhyNotWin11.au3 | 40 ++++++++++++++++++++-------------------- includes/_Checks.au3 | 12 ++++++------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index 3ed5feb4..e181b58d 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -61,7 +61,7 @@ If @OSVersion = 'WIN_10' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetPr #include "Includes\_Resources.au3" #include "Includes\_Translations.au3" ; #include "includes\WhyNotWin11_accessibility.au3" -#EndRegion +#EndRegion Includes Opt("TrayIconHide", 1) Opt("TrayAutoPause", 0) @@ -237,7 +237,7 @@ Func Main() _GetTPMInfo() ProgressSet(100, "Done") ProgressOff() - #EndRegion + #EndRegion Init WMI data Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) GUISetBkColor(_HighContrast(0xF8F8F8)) @@ -367,7 +367,7 @@ Func Main() Local $hBannerText = GUICtrlCreateLabel("", 130, 560, 90, 40, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetFont(-1, $aFonts[$FontSmall] * $DPI_RATIO, $FW_NORMAL, $GUI_FONTUNDER) GUICtrlSetBkColor(-1, _HighContrast(0xE6E6E6)) - + Local $sBannerURL = _SetBannerText($hBannerText, $hBanner) #ce Maybe Readd Later @@ -503,7 +503,7 @@ Func Main() $aDirectX = _DirectXStartCheck() #Region - GPTCheck - Switch _GPTCheck() + Switch _GPTCheck() Case "GPT" _GUICtrlSetPass($hCheck[6][0]) GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: GPT") & @CRLF & _Translate($iMUI, "Drive meets requirement.")) @@ -512,8 +512,8 @@ Func Main() GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: MBR") & @CRLF & _Translate($iMUI, "Drive does not meet requirement.")) Case Else ; Do Nothing!! - EndSwitch - #EndRegion + EndSwitch + #EndRegion - GPTCheck If _MemCheck() Then _GUICtrlSetState($hCheck[7][0], $iPass) @@ -536,19 +536,19 @@ Func Main() EndSwitch #Region - SpaceCheck - if _SpaceCheck(2) >= 64 and _SpaceCheck(1) >= 64 Then - ; Partition and Disk >= 64 GB - _GUICtrlSetPass($hCheck[8][0]) - GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both passed.")) - ElseIf _SpaceCheck(2) < 64 and _SpaceCheck(1) >= 64 Then - ; Partition < 64 GB and Disk >= 64 GB - _GUICtrlSetWarn($hCheck[8][0]) - GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Partition failed.")) - ElseIf _SpaceCheck(2) < 64 and _SpaceCheck(1) < 64 Then - ; Partition and Disk < 64 GB - _GUICtrlSetFail($hCheck[8][0]) - GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both Failed.")) - EndIf + If _SpaceCheck(2) >= 64 And _SpaceCheck(1) >= 64 Then + ; Partition and Disk >= 64 GB + _GUICtrlSetPass($hCheck[8][0]) + GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both passed.")) + ElseIf _SpaceCheck(2) < 64 And _SpaceCheck(1) >= 64 Then + ; Partition < 64 GB and Disk >= 64 GB + _GUICtrlSetWarn($hCheck[8][0]) + GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Partition failed.")) + ElseIf _SpaceCheck(2) < 64 And _SpaceCheck(1) < 64 Then + ; Partition and Disk < 64 GB + _GUICtrlSetFail($hCheck[8][0]) + GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both Failed.")) + EndIf #EndRegion - SpaceCheck Select @@ -802,4 +802,4 @@ EndFunc ;==>_GUICtrlSetFail Func _GUICtrlSetWarn($hCtrl, $symbol = "?") GUICtrlSetData($hCtrl, $symbol) GUICtrlSetBkColor($hCtrl, 0xF4C141) -EndFunc ;==>_GUICtrlSetWarn \ No newline at end of file +EndFunc ;==>_GUICtrlSetWarn diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index f13f4c3e..fa9ca82d 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -120,7 +120,7 @@ Func _GPTCheck() ; Check for error _GetDiskProperties(3) ; 3 = SystemDisk properties - if @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") ; Check DiskInitType Switch _GetDiskProperties(3)[9] ; 9 = Array field for DiskInitType @@ -181,16 +181,16 @@ Func _SpaceCheck($iFlag) ; Check for error _GetDiskProperties(4) - if @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") ; Get size - Local $iDiskSize = Round(_GetDiskProperties(3)[8] / 1024 / 1024 / 1024) - Local $iPartitionSize = Round(_GetDiskProperties(4)[9] / 1024 / 1024 / 1024) + Local $iDiskSize = Round(_GetDiskProperties(3)[8] / 1024 / 1024 / 1024) + Local $iPartitionSize = Round(_GetDiskProperties(4)[9] / 1024 / 1024 / 1024) Switch $iFlag Case 0 ; Return readiness state - return ($iDiskSize >= 64 AND $iPartitionSize >= 64) ? True : False + Return ($iDiskSize >= 64 And $iPartitionSize >= 64) ? True : False Case 1 ; Return size of disk Return $iDiskSize @@ -202,7 +202,7 @@ Func _SpaceCheck($iFlag) Local $aDisks = _GetDiskProperties(1) Local $iDiskCount = 0 For $i = 0 To UBound($aDisks) - 1 - if _GetDiskProperties(1)[$i][8] >= 64 Then + If _GetDiskProperties(1)[$i][8] >= 64 Then $iDiskCount += 1 EndIf Next From 8044e39a9c6578ebabe22f9934b40199a7ee33e7 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 01:12:11 +0200 Subject: [PATCH 10/31] Fixes and improving progress --- WhyNotWin11.au3 | 32 +++++++++++++++++--------------- includes/_Checks.au3 | 8 ++++---- includes/_WMIC.au3 | 5 +++-- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index e181b58d..b17dd07f 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -226,17 +226,16 @@ Func Main() Local Const $DPI_RATIO = _GDIPlus_GraphicsGetDPIRatio()[0] #Region Init WMI data - ProgressOn("WhyNotWin11", "Loading WMIC") + ProgressOn("WhyNotWin11", "Loading ...") ProgressSet(0, "_GetCPUInfo()") _GetCPUInfo() - ProgressSet(25, "_GetDiskProperties()") + ProgressSet(20, "_GetDiskProperties()") _GetDiskProperties() - ProgressSet(50, "_GetGPUInfo()") + ProgressSet(40, "_GetGPUInfo()") _GetGPUInfo() - ProgressSet(75, "_GetTPMInfo()") + ProgressSet(60, "_GetTPMInfo()") _GetTPMInfo() - ProgressSet(100, "Done") - ProgressOff() + ProgressSet(80, "Loading Gui...") #EndRegion Init WMI data Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) @@ -504,10 +503,10 @@ Func Main() #Region - GPTCheck Switch _GPTCheck() - Case "GPT" + Case True _GUICtrlSetPass($hCheck[6][0]) GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: GPT") & @CRLF & _Translate($iMUI, "Drive meets requirement.")) - Case "MBR" + Case False _GUICtrlSetFail($hCheck[6][0]) GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: MBR") & @CRLF & _Translate($iMUI, "Drive does not meet requirement.")) Case Else @@ -536,18 +535,18 @@ Func Main() EndSwitch #Region - SpaceCheck - If _SpaceCheck(2) >= 64 And _SpaceCheck(1) >= 64 Then + If _SpaceCheck(2) >= 64 And _SpaceCheck(1) >= 64 Then ; Partition and Disk >= 64 GB - _GUICtrlSetPass($hCheck[8][0]) - GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both passed.")) + _GUICtrlSetState($hCheck[9][0], $iPass) + GUICtrlSetData($hCheck[9][2], _Translate($iMUI, "Both passed.")) ElseIf _SpaceCheck(2) < 64 And _SpaceCheck(1) >= 64 Then ; Partition < 64 GB and Disk >= 64 GB - _GUICtrlSetWarn($hCheck[8][0]) - GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Partition failed.")) + _GUICtrlSetState($hCheck[9][0], $iWarn) + GUICtrlSetData($hCheck[9][2], _Translate($iMUI, "Partition failed.")) ElseIf _SpaceCheck(2) < 64 And _SpaceCheck(1) < 64 Then ; Partition and Disk < 64 GB - _GUICtrlSetFail($hCheck[8][0]) - GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Both Failed.")) + _GUICtrlSetState($hCheck[9][0], $iFail) + GUICtrlSetData($hCheck[9][2], _Translate($iMUI, "Both Failed.")) EndIf #EndRegion - SpaceCheck @@ -589,6 +588,9 @@ Func Main() EndIf #EndRegion Settings GUI + + ProgressSet(100) + ProgressOff() GUISwitch($hGUI) GUISetState(@SW_SHOW, $hGUI) diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index fa9ca82d..a0fb7337 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -123,7 +123,7 @@ Func _GPTCheck() If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") ; Check DiskInitType - Switch _GetDiskProperties(3)[9] ; 9 = Array field for DiskInitType + Switch _GetDiskProperties(3)[0][9] ; 9 = Array field for DiskInitType Case "GPT" Return True Case "MBR" @@ -183,9 +183,9 @@ Func _SpaceCheck($iFlag) _GetDiskProperties(4) If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") - ; Get size - Local $iDiskSize = Round(_GetDiskProperties(3)[8] / 1024 / 1024 / 1024) - Local $iPartitionSize = Round(_GetDiskProperties(4)[9] / 1024 / 1024 / 1024) + ; Get size (Arrays form _GetDiskProperties is a 2D-Array.) + Local $iDiskSize = Round(_GetDiskProperties(3)[0][8] / 1024 / 1024 / 1024) + Local $iPartitionSize = Round(_GetDiskProperties(4)[0][9] / 1024 / 1024 / 1024) Switch $iFlag Case 0 diff --git a/includes/_WMIC.au3 b/includes/_WMIC.au3 index d5bb56d1..34f69aec 100644 --- a/includes/_WMIC.au3 +++ b/includes/_WMIC.au3 @@ -93,7 +93,8 @@ Func _GetDiskProperties($iFlag = 0) For $i = 0 To UBound($aDiskArray) - 1 Step 1 ; If windows is bootet from disk... If $aDiskArray[$i][11] = True Then - Return $aDiskArray[$i] + ; Return row as 1D-Array + Return _ArrayExtract($aDiskArray, $i, $i) EndIf Next Case 4 @@ -101,7 +102,7 @@ Func _GetDiskProperties($iFlag = 0) For $i = 0 To UBound($aPartitionArray) - 1 Step 1 ; If windows is bootet from partition... If $aPartitionArray[$i][12] = True Then - Return $aPartitionArray[$i] + Return _ArrayExtract($aPartitionArray, $i, $i) EndIf Next Case Else From 6439d9dcf8bad6c3d2d8b03f0dfd69b85119a7ae Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 02:02:55 +0200 Subject: [PATCH 11/31] Small fixes and improvements --- WhyNotWin11.au3 | 17 +++++++++-------- includes/_Checks.au3 | 24 ++++++++++++++++-------- includes/_WMIC.au3 | 3 ++- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index b17dd07f..c354699c 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -505,10 +505,10 @@ Func Main() Switch _GPTCheck() Case True _GUICtrlSetPass($hCheck[6][0]) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: GPT") & @CRLF & _Translate($iMUI, "Drive meets requirement.")) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: GPT") & @CRLF & _Translate($iMUI, "Disk meets requirement.")) Case False _GUICtrlSetFail($hCheck[6][0]) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System drive: MBR") & @CRLF & _Translate($iMUI, "Drive does not meet requirement.")) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: MBR") & @CRLF & _Translate($iMUI, "Disk does not meet requirement.")) Case Else ; Do Nothing!! EndSwitch @@ -535,18 +535,19 @@ Func Main() EndSwitch #Region - SpaceCheck - If _SpaceCheck(2) >= 64 And _SpaceCheck(1) >= 64 Then + $sSpaceResultFirstLine = _SpaceCheck(3) & " " & _SpaceCheck(4) & " GB, " & _Translate($iMUI, "Disk") & " " & _SpaceCheck(1) & ": " & _SpaceCheck(2) & " GB" + If _SpaceCheck(4) >= 64 And _SpaceCheck(2) >= 64 Then ; Partition and Disk >= 64 GB _GUICtrlSetState($hCheck[9][0], $iPass) - GUICtrlSetData($hCheck[9][2], _Translate($iMUI, "Both passed.")) - ElseIf _SpaceCheck(2) < 64 And _SpaceCheck(1) >= 64 Then + GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Both passed.")) + ElseIf _SpaceCheck(4) < 64 And _SpaceCheck(2) >= 64 Then ; Partition < 64 GB and Disk >= 64 GB _GUICtrlSetState($hCheck[9][0], $iWarn) - GUICtrlSetData($hCheck[9][2], _Translate($iMUI, "Partition failed.")) - ElseIf _SpaceCheck(2) < 64 And _SpaceCheck(1) < 64 Then + GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition not passed. Disk passed.")) + ElseIf _SpaceCheck(4) < 64 And _SpaceCheck(2) < 64 Then ; Partition and Disk < 64 GB _GUICtrlSetState($hCheck[9][0], $iFail) - GUICtrlSetData($hCheck[9][2], _Translate($iMUI, "Both Failed.")) + GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Both didn't pass.")) EndIf #EndRegion - SpaceCheck diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index a0fb7337..d31a9973 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -173,17 +173,19 @@ EndFunc ;==>_SecureBootCheck Func _SpaceCheck($iFlag) ; Desc ......... : Call _GetDiskInfoFromWmi() to get the disk and partition informations. The selected information will be returned. ; Parameters ... : $iFlag = 0 => Return if system disk and system partition ready. - ; Parameters ... : $iFlag = 1 => Return size of system disk in GB. - ; Parameters ... : $iFlag = 2 => Return size of system partition in GB. - ; Parameters ... : $iFlag = 3 => Return count of internal Win11 ready disks. - ; Parameters ... : $iFlag = 4 => Return count of all internal disks. + ; .............. : $iFlag = 1 => Number of system disk. + ; .............. : $iFlag = 2 => Return size of system disk in GB. + ; .............. : $iFlag = 3 => Letter of system partition. + ; .............. : $iFlag = 4 => Return size of system partition in GB. + ; .............. : $iFlag = 5 => Return count of internal Win11 ready disks. + ; .............. : $iFlag = 6 => Return count of all internal disks. ; On error ..... : SetError(1, 1, "Error_CheckFailed") ; Check for error _GetDiskProperties(4) If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") - ; Get size (Arrays form _GetDiskProperties is a 2D-Array.) + ; Get size (Arrays form _GetDiskProperties are 2D-Arrays.) Local $iDiskSize = Round(_GetDiskProperties(3)[0][8] / 1024 / 1024 / 1024) Local $iPartitionSize = Round(_GetDiskProperties(4)[0][9] / 1024 / 1024 / 1024) @@ -192,12 +194,18 @@ Func _SpaceCheck($iFlag) ; Return readiness state Return ($iDiskSize >= 64 And $iPartitionSize >= 64) ? True : False Case 1 + ; Return number of System disk + Return _GetDiskProperties(3)[0][0] ; (Array form _GetDiskProperties is a 2D-Array.) + Case 2 ; Return size of disk Return $iDiskSize - Case 2 + Case 3 + ; Return letter of system partition + Return _GetDiskProperties(4)[0][6] ; (Array form _GetDiskProperties is a 2D-Array.) + Case 4 ; Return size of partiton Return $iPartitionSize - Case 3 + Case 5 ; Count Disk with sie >= 64 GB. Local $aDisks = _GetDiskProperties(1) Local $iDiskCount = 0 @@ -207,7 +215,7 @@ Func _SpaceCheck($iFlag) EndIf Next Return $iDiskCount - Case 4 + Case 6 Return UBound($aDisks) Case Else ; $iFlag unknown diff --git a/includes/_WMIC.au3 b/includes/_WMIC.au3 index 34f69aec..47b8ba11 100644 --- a/includes/_WMIC.au3 +++ b/includes/_WMIC.au3 @@ -93,7 +93,7 @@ Func _GetDiskProperties($iFlag = 0) For $i = 0 To UBound($aDiskArray) - 1 Step 1 ; If windows is bootet from disk... If $aDiskArray[$i][11] = True Then - ; Return row as 1D-Array + ; Return row as only neede row Return _ArrayExtract($aDiskArray, $i, $i) EndIf Next @@ -102,6 +102,7 @@ Func _GetDiskProperties($iFlag = 0) For $i = 0 To UBound($aPartitionArray) - 1 Step 1 ; If windows is bootet from partition... If $aPartitionArray[$i][12] = True Then + ; Rerturn only neede row Return _ArrayExtract($aPartitionArray, $i, $i) EndIf Next From ae1ede2ba192ea96e825b88c104f2b0c2ace7df2 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:01:52 +0200 Subject: [PATCH 12/31] Fix merge conflict --- WhyNotWin11.au3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index ddbecf33..95290274 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -511,10 +511,10 @@ Func Main() #Region - GPTCheck Switch _GPTCheck() Case True - _GUICtrlSetPass($hCheck[6][0]) + _GUICtrlSetState($hCheck[6][0], $iPass) GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: GPT") & @CRLF & _Translate($iMUI, "Disk meets requirement.")) Case False - _GUICtrlSetFail($hCheck[6][0]) + _GUICtrlSetState($hCheck[6][0], $iFail) GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: MBR") & @CRLF & _Translate($iMUI, "Disk does not meet requirement.")) Case Else ; Do Nothing!! From 1a0c96f71f79555ec86dec3d49ece006ddd88b3e Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:04:30 +0200 Subject: [PATCH 13/31] Fix typos --- WhyNotWin11.au3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index 95290274..0f39bd69 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -33,7 +33,7 @@ FileChangeDir(@SystemDir) If @OSVersion = 'WIN_10' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 1) #Region Includes -; Default UDF includes +; Include default UDFs #include #include #include @@ -55,7 +55,7 @@ If @OSVersion = 'WIN_10' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetPr #include "Includes\ResourcesEx.au3" #include "Includes\GetDiskInfoFromWmi.au3" -; Internals internal scripts +; Include internal WNW11 scripts #include "Includes\_WMIC.au3" #include "Includes\_Checks.au3" #include "Includes\_Theming.au3" From 678b5629da2a94513897015129eb9f10f9acd72a Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:08:19 +0200 Subject: [PATCH 14/31] Fix function --- includes/_WMIC.au3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/_WMIC.au3 b/includes/_WMIC.au3 index 47b8ba11..3465df09 100644 --- a/includes/_WMIC.au3 +++ b/includes/_WMIC.au3 @@ -92,7 +92,7 @@ Func _GetDiskProperties($iFlag = 0) ; Return information of disk with system (Windows) partition. For $i = 0 To UBound($aDiskArray) - 1 Step 1 ; If windows is bootet from disk... - If $aDiskArray[$i][11] = True Then + If $aDiskArray[$i][11] = "True" Then ; Return row as only neede row Return _ArrayExtract($aDiskArray, $i, $i) EndIf @@ -101,7 +101,7 @@ Func _GetDiskProperties($iFlag = 0) ; Return information of system (Windows) partition. For $i = 0 To UBound($aPartitionArray) - 1 Step 1 ; If windows is bootet from partition... - If $aPartitionArray[$i][12] = True Then + If $aPartitionArray[$i][12] = "True" Then ; Rerturn only neede row Return _ArrayExtract($aPartitionArray, $i, $i) EndIf From 771e9c89f766ae59219a44b6609f3ef664d2ce12 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:16:28 +0200 Subject: [PATCH 15/31] Improve check message --- WhyNotWin11.au3 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index 0f39bd69..c42b4861 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -512,10 +512,10 @@ Func Main() Switch _GPTCheck() Case True _GUICtrlSetState($hCheck[6][0], $iPass) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: GPT") & @CRLF & _Translate($iMUI, "Disk meets requirement.")) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: GPT") & @CRLF & _Translate($iMUI, "Requirement meet.")) Case False _GUICtrlSetState($hCheck[6][0], $iFail) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: MBR") & @CRLF & _Translate($iMUI, "Disk does not meet requirement.")) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: MBR") & @CRLF & _Translate($iMUI, "Requirement not meet.")) Case Else ; Do Nothing!! EndSwitch @@ -546,15 +546,15 @@ Func Main() If _SpaceCheck(4) >= 64 And _SpaceCheck(2) >= 64 Then ; Partition and Disk >= 64 GB _GUICtrlSetState($hCheck[9][0], $iPass) - GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Both passed.")) + GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition and disk passed.")) ElseIf _SpaceCheck(4) < 64 And _SpaceCheck(2) >= 64 Then ; Partition < 64 GB and Disk >= 64 GB _GUICtrlSetState($hCheck[9][0], $iWarn) - GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition not passed. Disk passed.")) + GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition not passed, but disk.")) ElseIf _SpaceCheck(4) < 64 And _SpaceCheck(2) < 64 Then ; Partition and Disk < 64 GB _GUICtrlSetState($hCheck[9][0], $iFail) - GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Both didn't pass.")) + GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition and disk not pass.")) EndIf #EndRegion - SpaceCheck From 3f4c374769e6bb8d620be35d4a6236052077ba82 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:21:54 +0200 Subject: [PATCH 16/31] Add missing word to lang files (#440) --- Langs/0000.lang | 1 + Langs/0407.lang | 1 + Langs/0409.lang | 1 + 3 files changed, 3 insertions(+) diff --git a/Langs/0000.lang b/Langs/0000.lang index a732da3f..1b8293fc 100644 --- a/Langs/0000.lang +++ b/Langs/0000.lang @@ -65,6 +65,7 @@ Invalid Release Tags Received!= Invalid Release Types Received!= Update Available= An Update is Available, would you like to download it?= +Warning= [Descriptions] Architecture=The amount of data your CPU and OS can process at once. 32-Bit OS result requires a disk wipe and new Windows 11 install. 32-Bit CPU requires a CPU replacement. Boot=A method your motherboard uses to load Windows. Legacy results can be fixed on newer motherboards in your BIOS/UEFI settings. Refer to your motherboard manual. diff --git a/Langs/0407.lang b/Langs/0407.lang index 9732931c..b7cbe1a8 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -57,3 +57,4 @@ Invalid Release Tags Received!=Ungültige Release-Tags erhalten! Invalid Release Types Received!=Ungültige Release-Types erhalten! Update Available=Update verfügbar An Update is Available, would you like to download it?=Ein Update ist verfügbar. Möchten Sie es herunterladen? +Warning=Warnung diff --git a/Langs/0409.lang b/Langs/0409.lang index 971e0029..52bd20e9 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -64,6 +64,7 @@ Invalid Release Tags Received!=Invalid Release Tags Received! Invalid Release Types Received!=Invalid Release Types Received! Update Available=Update Available An Update is Available, would you like to download it?=An Update is Available, would you like to download it? +Warning=Warning [Descriptions] Architecture=The amount of data your CPU and OS can process at once. 32-Bit OS result requires a disk wipe and new Windows 11 install. 32-Bit CPU requires a CPU replacement. Boot=A method your motherboard uses to load Windows. Legacy results can be fixed on newer motherboards in your BIOS/UEFI settings. Refer to your motherboard manual. From 9546595b11859e81a4035c08114a3af2388d0614 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:32:37 +0200 Subject: [PATCH 17/31] update lang files --- Langs/0000.lang | 7 +++++-- Langs/0407.lang | 9 ++++++--- Langs/0409.lang | 9 ++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Langs/0000.lang b/Langs/0000.lang index 1b8293fc..da7b8107 100644 --- a/Langs/0000.lang +++ b/Langs/0000.lang @@ -39,14 +39,17 @@ Not Currently Listed as Compatible= Listed as Compatible= Cores= Threads= -GPT Detected= -GPT Not Detected= +Requirement meet.= +Requirement not meet.= Enabled= Supported= Not Supported= Disabled / Not Detected= Drive(s) Meet Requirements= 0 Drives Meet Requirements= +Partition and disk passed.= +Partition not passed, but disk.= +Partition and disk passed.= TPM Missing / Disabled= Detected= DirectX 12 and WDDM 3= diff --git a/Langs/0407.lang b/Langs/0407.lang index b7cbe1a8..918e9f59 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -1,6 +1,6 @@ [MetaData] Language=German - Germany -Translator=botflakes, JimBim89, schmelto, speedy-pc +Translator=botflakes, JimBim89, schmelto, speedy-pc, htcfreek Version= 2.3.1.0 [Strings] Donate=Spenden @@ -32,13 +32,16 @@ Not Currently Listed as Compatible=CPU derzeit nicht als kompatibel gelistet Listed as Compatible=CPU als kompatibel gelistet Cores=Kerne Threads=Threads -GPT Detected=GPT erkannt -GPT Not Detected=GPT nicht erkannt +Requirement meet.=Requirement meet. +Requirement not meet.=Requirement not meet. Enabled=aktiviert Supported=unterstützt Not Supported=nicht unterstützt Disabled / Not Detected=deaktiviert oder nicht erkannt Drive(s) Meet Requirements=Laufwerk(e) kompatibel +Partition and disk passed.=Partition and Laufwerk bestanden. +Partition not passed, but disk.=Partition nicht bestanden, aber Laufwerk. +Partition and disk passed.=Partition and Platte bestanden. TPM Missing / Disabled=TPM fehlt oder deaktiviert Detected=erkannt DirectX 12 and WDDM 3=DirectX 12 und WDDM 3 diff --git a/Langs/0409.lang b/Langs/0409.lang index 52bd20e9..e59146e6 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -1,6 +1,6 @@ [MetaData] Language=English - United States -Translator=rcmaehl +Translator=rcmaehl, htcfreek Version=2.3.1.0 [Font] Extra Large=24 @@ -39,12 +39,15 @@ Not Currently Listed as Compatible=Not Currently Listed as Compatible Listed as Compatible=Listed as Compatible Cores=# Cores Threads=# Threads -GPT Detected=GPT Detected -GPT Not Detected=GPT Not Detected +Requirement meet.=Anforderung erfüllt. +Requirement not meet.=Anforderung nicht erfüllt. Enabled=Enabled Supported=Supported Disabled / Not Detected=Disabled / Not Detected Drive(s) Meet Requirements=Drive(s) Meet Requirements +Partition and disk passed.=Partition and disk passed. +Partition not passed, but disk.=Partition not passed, but disk. +Partition and disk passed.=Partition and disk passed. TPM Missing / Disabled=TPM Missing / Disabled Not Supported=Not Supported Detected=Detected From ca32c023e7387cda0ddc86050b353cec4b83859f Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:34:24 +0200 Subject: [PATCH 18/31] Fix typo in .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index eeca40c9..22f21db3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,5 @@ WhyNotWin11_stripped.au3 del.au3 Config/config.st -# Backupfolder from Tidy in "ISN AutoIt Studio" +# Backup directory from Tidy in "ISN AutoIt Studio" **/Backup/*.au3 From 6fb92415b831465862a2fcafa06cca7c046358c9 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 8 Jul 2021 23:48:50 +0200 Subject: [PATCH 19/31] Fix lang files after update --- Langs/0407.lang | 8 ++++---- Langs/0409.lang | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Langs/0407.lang b/Langs/0407.lang index 918e9f59..a4818a90 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -32,16 +32,16 @@ Not Currently Listed as Compatible=CPU derzeit nicht als kompatibel gelistet Listed as Compatible=CPU als kompatibel gelistet Cores=Kerne Threads=Threads -Requirement meet.=Requirement meet. -Requirement not meet.=Requirement not meet. +Requirement meet.=Anforderung erfüllt. +Requirement not meet.=Anforderung nicht erfüllt. Enabled=aktiviert Supported=unterstützt Not Supported=nicht unterstützt Disabled / Not Detected=deaktiviert oder nicht erkannt Drive(s) Meet Requirements=Laufwerk(e) kompatibel -Partition and disk passed.=Partition and Laufwerk bestanden. +Partition and disk passed.=Partition und Laufwerk bestanden. Partition not passed, but disk.=Partition nicht bestanden, aber Laufwerk. -Partition and disk passed.=Partition and Platte bestanden. +Partition and disk passed.=Partition und Platte bestanden. TPM Missing / Disabled=TPM fehlt oder deaktiviert Detected=erkannt DirectX 12 and WDDM 3=DirectX 12 und WDDM 3 diff --git a/Langs/0409.lang b/Langs/0409.lang index e59146e6..adfa421e 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -39,8 +39,8 @@ Not Currently Listed as Compatible=Not Currently Listed as Compatible Listed as Compatible=Listed as Compatible Cores=# Cores Threads=# Threads -Requirement meet.=Anforderung erfüllt. -Requirement not meet.=Anforderung nicht erfüllt. +Requirement meet.=Requirement meet. +Requirement not meet.=Requirement not meet. Enabled=Enabled Supported=Supported Disabled / Not Detected=Disabled / Not Detected From a10cc0c1b7d089c4c13dc8c3b11dc2ca69410e6f Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 9 Jul 2021 01:03:00 +0200 Subject: [PATCH 20/31] Update disk checks; Tidy source --- WhyNotWin11.au3 | 115 +++++++++++++++++++------------------ includes/_Checks.au3 | 94 +++++++++++++++++++++++------- includes/_Translations.au3 | 2 +- includes/_WMIC.au3 | 44 ++++++++------ 4 files changed, 162 insertions(+), 93 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index c42b4861..68722832 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -166,8 +166,8 @@ Func ChecksOnly() $aDirectX = _DirectXStartCheck() _GetDiskProperties() - $aResults[6][0] = _GPTCheck() - $aResults[6][1] = (_GPTCheck() = "GPT") ? "GPT" : (_GPTCheck() = "MBR") ? "MBR" : "" + $aResults[6][0] = _GPTCheck(0) + $aResults[6][1] = (_GPTCheck(0) = "GPT") ? "GPT" : (_GPTCheck(0) = "MBR") ? "MBR" : "" $aResults[6][2] = "" $aResults[7][0] = _MemCheck() @@ -225,18 +225,18 @@ Func Main() Local Enum $FontSmall, $FontMedium, $FontLarge, $FontExtraLarge Local Const $DPI_RATIO = _GDIPlus_GraphicsGetDPIRatio()[0] - #Region Init WMI data - ProgressOn("WhyNotWin11", "Loading ...") - ProgressSet(0, "_GetCPUInfo()") - _GetCPUInfo() - ProgressSet(20, "_GetDiskProperties()") - _GetDiskProperties() - ProgressSet(40, "_GetGPUInfo()") - _GetGPUInfo() - ProgressSet(60, "_GetTPMInfo()") - _GetTPMInfo() - ProgressSet(80, "Loading Gui...") - #EndRegion Init WMI data +;~ #Region Init WMI data +;~ ProgressOn("WhyNotWin11", "Loading ...") +;~ ProgressSet(0, "_GetCPUInfo()") +;~ _GetCPUInfo() +;~ ProgressSet(20, "_GetDiskProperties()") +;~ _GetDiskProperties() +;~ ProgressSet(40, "_GetGPUInfo()") +;~ _GetGPUInfo() +;~ ProgressSet(60, "_GetTPMInfo()") +;~ _GetTPMInfo() +;~ ProgressSet(80, "Loading Gui...") +;~ #EndRegion Init WMI data Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) GUISetBkColor(_HighContrast(0xF8F8F8)) @@ -369,7 +369,7 @@ Func Main() Local $hBannerText = GUICtrlCreateLabel("", 130, 560, 90, 40, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetFont(-1, $aFonts[$FontSmall] * $DPI_RATIO, $FW_NORMAL, $GUI_FONTUNDER) GUICtrlSetBkColor(-1, _HighContrast(0xE6E6E6)) - + Local $sBannerURL = _SetBannerText($hBannerText, $hBanner) #ce Maybe Readd Later @@ -426,10 +426,10 @@ Func Main() Next _GDIPlus_Shutdown() -#cs - Local $hDXFile = _TempFile(@TempDir, "dxdiag") - Local $hDXPID = Run(@SystemDir & "\dxdiag.exe /whql:off /t " & $hDXFile) -#ce + #cs + Local $hDXFile = _TempFile(@TempDir, "dxdiag") + Local $hDXPID = Run(@SystemDir & "\dxdiag.exe /whql:off /t " & $hDXFile) + #ce Switch _ArchCheck() Case True @@ -509,12 +509,12 @@ Func Main() $aDirectX = _DirectXStartCheck() #Region - GPTCheck - Switch _GPTCheck() + Switch _GPTCheck(0) Case True _GUICtrlSetState($hCheck[6][0], $iPass) GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: GPT") & @CRLF & _Translate($iMUI, "Requirement meet.")) Case False - _GUICtrlSetState($hCheck[6][0], $iFail) + _GUICtrlSetState($hCheck[6][0], $iFail) GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: MBR") & @CRLF & _Translate($iMUI, "Requirement not meet.")) Case Else ; Do Nothing!! @@ -542,16 +542,19 @@ Func Main() EndSwitch #Region - SpaceCheck - $sSpaceResultFirstLine = _SpaceCheck(3) & " " & _SpaceCheck(4) & " GB, " & _Translate($iMUI, "Disk") & " " & _SpaceCheck(1) & ": " & _SpaceCheck(2) & " GB" - If _SpaceCheck(4) >= 64 And _SpaceCheck(2) >= 64 Then + Local $iDiskSpace = _SpaceCheck(2) + Local $iPartitionSpace = _SpaceCheck(4) + Local $sSpaceResultFirstLine = _SpaceCheck(3) & " " & $iPartitionSpace & " GB, " & _Translate($iMUI, "Disk") & " " & _SpaceCheck(1) & ": " & $iDiskSpace & " GB" + ; -- Check + If $iDiskSpace >= 64 And $iPartitionSpace >= 64 Then ; Partition and Disk >= 64 GB _GUICtrlSetState($hCheck[9][0], $iPass) GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition and disk passed.")) - ElseIf _SpaceCheck(4) < 64 And _SpaceCheck(2) >= 64 Then + ElseIf $iDiskSpace < 64 And $iPartitionSpace >= 64 Then ; Partition < 64 GB and Disk >= 64 GB _GUICtrlSetState($hCheck[9][0], $iWarn) GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition not passed, but disk.")) - ElseIf _SpaceCheck(4) < 64 And _SpaceCheck(2) < 64 Then + ElseIf $iDiskSpace < 64 And $iPartitionSpace < 64 Then ; Partition and Disk < 64 GB _GUICtrlSetState($hCheck[9][0], $iFail) GUICtrlSetData($hCheck[9][2], $sSpaceResultFirstLine & @CRLF & _Translate($iMUI, "Partition and disk not pass.")) @@ -596,7 +599,7 @@ Func Main() EndIf #EndRegion Settings GUI - + ProgressSet(100) ProgressOff() @@ -641,36 +644,36 @@ Func Main() EndSwitch EndSwitch $aDirectX = Null -#cs - Case (Not ProcessExists($hDXPID)) And FileExists($hDXFile) - $sDXFile = StringStripWS(StringStripCR(FileRead($hDXFile)), $STR_STRIPALL) - Select - Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM" & Chr(160) & "3") ; Non-English Languages - ContinueCase - Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:3") ; Non-English Languages - ContinueCase - Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM3") - _GUICtrlSetState($hCheck[5][0], $iPass) - GUICtrlSetData($hCheck[5][2], "DirectX 12 && WDDM 3") ; <== No translation, "DirectX 12 and WDDM 3" in LANG-file - Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM" & Chr(160) & "2") ; Non-English Languages - ContinueCase - Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:2") ; Non-English Languages - ContinueCase - Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM2") - _GUICtrlSetState($hCheck[5][0], $iPass) - GUICtrlSetData($hCheck[5][2], "DirectX 12 && WDDM 2") ; <== No translation, "DirectX 12 and WDDM 2" in LANG-file - Case Not StringInStr($sDXFile, "FeatureLevels:12") Or Not StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM2") - _GUICtrlSetState($hCheck[5][0], $iPass) - GUICtrlSetData($hCheck[5][2], _Translate($iMUI, "No DirectX 12, but WDDM2")) - Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And Not StringInStr($sDXFile, "DriverModel:WDDM2") - _GUICtrlSetState($hCheck[5][0], $iFail) - GUICtrlSetData($hCheck[5][2], _Translate($iMUI, "DirectX 12, but no WDDM2")) - Case Else - _GUICtrlSetState($hCheck[5][0], $iFail) - GUICtrlSetData($hCheck[5][2], _Translate($iMUI, "No DirectX 12 or WDDM2")) - EndSelect - FileDelete($hDXFile) -#ce + #cs + Case (Not ProcessExists($hDXPID)) And FileExists($hDXFile) + $sDXFile = StringStripWS(StringStripCR(FileRead($hDXFile)), $STR_STRIPALL) + Select + Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM" & Chr(160) & "3") ; Non-English Languages + ContinueCase + Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:3") ; Non-English Languages + ContinueCase + Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM3") + _GUICtrlSetState($hCheck[5][0], $iPass) + GUICtrlSetData($hCheck[5][2], "DirectX 12 && WDDM 3") ; <== No translation, "DirectX 12 and WDDM 3" in LANG-file + Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM" & Chr(160) & "2") ; Non-English Languages + ContinueCase + Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:2") ; Non-English Languages + ContinueCase + Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM2") + _GUICtrlSetState($hCheck[5][0], $iPass) + GUICtrlSetData($hCheck[5][2], "DirectX 12 && WDDM 2") ; <== No translation, "DirectX 12 and WDDM 2" in LANG-file + Case Not StringInStr($sDXFile, "FeatureLevels:12") Or Not StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM2") + _GUICtrlSetState($hCheck[5][0], $iPass) + GUICtrlSetData($hCheck[5][2], _Translate($iMUI, "No DirectX 12, but WDDM2")) + Case StringInStr($sDXFile, "FeatureLevels:12") Or StringInStr($sDXFile, "DDIVersion:12") And Not StringInStr($sDXFile, "DriverModel:WDDM2") + _GUICtrlSetState($hCheck[5][0], $iFail) + GUICtrlSetData($hCheck[5][2], _Translate($iMUI, "DirectX 12, but no WDDM2")) + Case Else + _GUICtrlSetState($hCheck[5][0], $iFail) + GUICtrlSetData($hCheck[5][2], _Translate($iMUI, "No DirectX 12 or WDDM2")) + EndSelect + FileDelete($hDXFile) + #ce Case $hMsg = $hDumpLang FileDelete(@LocalAppDataDir & "\WhyNotWin11\langs\") diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index 49b2a31c..413efd1f 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -113,22 +113,55 @@ Func _GetDirectXCheck($aArray) EndIf EndFunc ;==>_GetDirectXCheck -Func _GPTCheck() +Func _GPTCheck($iFlag) ; Desc ......... : Call _GetDiskInfoFromWmi() to get the disk and partition informations. The selected information will be returned. - ; Parameters ... : - ; Return value . : True | False | SetError(1, 1, "Error_CheckFailed") + ; Parameters ... : $iFlag = 0 => Return init type of system disk. + ; .............. : $iFlag = 1 => Return count of internal GPT disks. + ; .............. : $iFlag = 2 => Return count of all internal disks. + ; .............. : $iFlag = 3 => Return array with all disk. (Columns: DiskNum | InitType | CheckResult) + ; On error ..... : SetError(1, 1, "Error_CheckFailed") - ; Check for error - _GetDiskProperties(3) ; 3 = SystemDisk properties - If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + ; Vars + Local Static $aDisks + If (Not $aDisks) Then + $aDisks = _GetDiskProperties(1) ; Array with all disks + If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + EndIf + Local $aReturnDiskArray[0][3] + _ArrayAdd($aReturnDiskArray, "Disk" & "|" & "Type" & "|" & "Check result") - ; Check DiskInitType - Switch _GetDiskProperties(3)[0][9] ; 9 = Array field for DiskInitType - Case "GPT" - Return True - Case "MBR" - Return False + ; Return data based on $iFlag + Switch $iFlag + Case 0 + ; Return data of system disk. + Switch _GetDiskProperties(3)[0][9] ; 9 = Array field for DiskInitType + Case "GPT" + Return True + Case "MBR" + Return False + EndSwitch + Case 1 + ; Count int. GPT disks + Local $iDiskCount = 0 + For $i = 0 To UBound($aDisks) - 1 + If $aDisks[$i][9] = "GPT" Then + $iDiskCount += 1 + EndIf + Next + Return $iDiskCount + Case 2 + ; Return count of all int. disks + Return UBound($aDisks) + Case 3 + ; Return array with all disk inf format Number|Type|Result + For $i = 0 To UBound($aDisks) - 1 + Local $sDiskRow = $aDisks[$i][0] & "|" & $aDisks[$i][9] & "|" & (($aDisks[$i][9] = "GPT") ? "True" : "False") + _ArrayAdd($aReturnDiskArray, $sDiskRow) + Next + Return $aReturnDiskArray EndSwitch + ; Check DiskInitType + EndFunc ;==>_GPTCheck Func _MemCheck() @@ -179,16 +212,30 @@ Func _SpaceCheck($iFlag) ; .............. : $iFlag = 4 => Return size of system partition in GB. ; .............. : $iFlag = 5 => Return count of internal Win11 ready disks. ; .............. : $iFlag = 6 => Return count of all internal disks. + ; .............. : $iFlag = 7 => Return array with all disk. (Columns: DiskNum | Size (GB) | CheckResult) ; On error ..... : SetError(1, 1, "Error_CheckFailed") - ; Check for error - _GetDiskProperties(4) - If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + ; Ini tvars + Local Static $bInitDone = False + Local Static $iDiskSize + Local Static $iPartitionSize + Local Static $aDisks + Local $aReturnDiskArray[0][3] + _ArrayAdd($aReturnDiskArray, "Disk" & "|" & "Size (GB)" & "|" & "Check result") + + ; Init data + If (Not $bInitDone = True) Then + ; Check for error by retriving disk data + _GetDiskProperties(4) + If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") - ; Get size (Arrays form _GetDiskProperties are 2D-Arrays.) - Local $iDiskSize = Round(_GetDiskProperties(3)[0][8] / 1024 / 1024 / 1024) - Local $iPartitionSize = Round(_GetDiskProperties(4)[0][9] / 1024 / 1024 / 1024) + ; Get size (Arrays form _GetDiskProperties are 2D-Arrays.) & vars + $iDiskSize = Round(_GetDiskProperties(3)[0][8] / 1024 / 1024 / 1024) + $iPartitionSize = Round(_GetDiskProperties(4)[0][9] / 1024 / 1024 / 1024) + $aDisks = _GetDiskProperties(1) + EndIf + ; Return data based on $iFlag Switch $iFlag Case 0 ; Return readiness state @@ -207,16 +254,23 @@ Func _SpaceCheck($iFlag) Return $iPartitionSize Case 5 ; Count Disk with sie >= 64 GB. - Local $aDisks = _GetDiskProperties(1) Local $iDiskCount = 0 For $i = 0 To UBound($aDisks) - 1 - If _GetDiskProperties(1)[$i][8] >= 64 Then + If $aDisks[$i][8] >= 64 Then $iDiskCount += 1 EndIf Next Return $iDiskCount Case 6 + ; Return count of internal disks Return UBound($aDisks) + Case 7 + ; Return array with all disk inf format Number|Syze|Result + For $i = 0 To UBound($aDisks) - 1 + Local $sDiskRow = $aDisks[$i][0] & "|" & Round(_GetDiskProperties(3)[$i][8] / 1024 / 1024 / 1024) & "|" & (($aDisks[$i][8] >= 64) ? "True" : "False") + _ArrayAdd($aReturnDiskArray, $sDiskRow) + Next + Return $aReturnDiskArray Case Else ; $iFlag unknown Return SetError(1, 1, "Error_CheckFailed") diff --git a/includes/_Translations.au3 b/includes/_Translations.au3 index 7590c1e5..37426042 100644 --- a/includes/_Translations.au3 +++ b/includes/_Translations.au3 @@ -18,7 +18,7 @@ Func _GetDescriptions($iMUI) $aDescriptions[10] = IniRead(@LocalAppDataDir & "\WhyNotWin11\Langs\" & $iMUI & ".lang", "Descriptions", "TPM", "A security module used by Windows. All modern AMD CPUs contain one; Some modern Intel CPUs contain one. Check your BIOS/UEFI settings. Refer to your motherboard manual.") Return $aDescriptions -EndFunc +EndFunc ;==>_GetDescriptions Func _GetFile($sFile, $sFormat = $FO_READ) Local Const $hFileOpen = FileOpen($sFile, $sFormat) diff --git a/includes/_WMIC.au3 b/includes/_WMIC.au3 index 3465df09..3c6f20a3 100644 --- a/includes/_WMIC.au3 +++ b/includes/_WMIC.au3 @@ -67,8 +67,10 @@ Func _GetDiskProperties($iFlag = 0) ; .............. : Return SetError(1, 2, "Error_IncorrectFlag"), if $iFlag is unknown. ; .............. : Return SetError(1, 3, "Error_NoDataReturned"), if not data can be returned. - Static $aDiskArray - Static $aPartitionArray + Local Static $aDiskArray + Local Static $aPartitionArray + Local Static $iSysDisk + Local Static $iSysPartition ; Get WMI data If (Not $aDiskArray) Or (Not $aPartitionArray) Then @@ -77,6 +79,28 @@ Func _GetDiskProperties($iFlag = 0) If @error = 1 Then Return SetError(1, 1, "Error_WmiFailed") EndIf + ; Get sys disk and sys partition num + If (Not $iSysDisk) Then + For $i = 0 To UBound($aDiskArray) - 1 Step 1 + ; If windows is bootet from disk... + If $aDiskArray[$i][11] = "True" Then + ; Return row as only neede row + $iSysDisk = $i + ExitLoop + EndIf + Next + EndIf + If (Not $iSysPartition) Then + For $i = 0 To UBound($aPartitionArray) - 1 Step 1 + ; If windows is bootet from disk... + If $aPartitionArray[$i][12] = "True" Then + ; Return row as only neede row + $iSysPartition = $i + ExitLoop + EndIf + Next + EndIf + ; Return data based on $iFlag or exit function Switch $iFlag Case 0 @@ -90,22 +114,10 @@ Func _GetDiskProperties($iFlag = 0) Return $aPartitionArray Case 3 ; Return information of disk with system (Windows) partition. - For $i = 0 To UBound($aDiskArray) - 1 Step 1 - ; If windows is bootet from disk... - If $aDiskArray[$i][11] = "True" Then - ; Return row as only neede row - Return _ArrayExtract($aDiskArray, $i, $i) - EndIf - Next + Return _ArrayExtract($aDiskArray, $iSysDisk, $iSysDisk) Case 4 ; Return information of system (Windows) partition. - For $i = 0 To UBound($aPartitionArray) - 1 Step 1 - ; If windows is bootet from partition... - If $aPartitionArray[$i][12] = "True" Then - ; Rerturn only neede row - Return _ArrayExtract($aPartitionArray, $i, $i) - EndIf - Next + Return _ArrayExtract($aPartitionArray, $iSysPartition, $iSysPartition) Case Else ; If $iFlag was incorrect... Return SetError(1, 2, "Error_IncorrectFlag") From 8821c726c08d3ee17641f1da2deebeca664f2a63 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 9 Jul 2021 01:08:08 +0200 Subject: [PATCH 21/31] small fixes --- WhyNotWin11.au3 | 26 +++++++++++++------------- includes/_Checks.au3 | 4 +--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index 68722832..1c9cc766 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -225,18 +225,18 @@ Func Main() Local Enum $FontSmall, $FontMedium, $FontLarge, $FontExtraLarge Local Const $DPI_RATIO = _GDIPlus_GraphicsGetDPIRatio()[0] -;~ #Region Init WMI data -;~ ProgressOn("WhyNotWin11", "Loading ...") -;~ ProgressSet(0, "_GetCPUInfo()") -;~ _GetCPUInfo() -;~ ProgressSet(20, "_GetDiskProperties()") -;~ _GetDiskProperties() -;~ ProgressSet(40, "_GetGPUInfo()") -;~ _GetGPUInfo() -;~ ProgressSet(60, "_GetTPMInfo()") -;~ _GetTPMInfo() -;~ ProgressSet(80, "Loading Gui...") -;~ #EndRegion Init WMI data + #Region Init WMI data + ProgressOn("WhyNotWin11", "Loading ...") + ProgressSet(0, "_GetCPUInfo()") + _GetCPUInfo() + ProgressSet(20, "_GetDiskProperties()") + _GetDiskProperties() + ProgressSet(40, "_GetGPUInfo()") + _GetGPUInfo() + ProgressSet(60, "_GetTPMInfo()") + _GetTPMInfo() + ProgressSet(80, "Loading Gui...") + #EndRegion Init WMI data Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) GUISetBkColor(_HighContrast(0xF8F8F8)) @@ -369,7 +369,7 @@ Func Main() Local $hBannerText = GUICtrlCreateLabel("", 130, 560, 90, 40, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetFont(-1, $aFonts[$FontSmall] * $DPI_RATIO, $FW_NORMAL, $GUI_FONTUNDER) GUICtrlSetBkColor(-1, _HighContrast(0xE6E6E6)) - + Local $sBannerURL = _SetBannerText($hBannerText, $hBanner) #ce Maybe Readd Later diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index 413efd1f..beeb68fc 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -153,15 +153,13 @@ Func _GPTCheck($iFlag) ; Return count of all int. disks Return UBound($aDisks) Case 3 - ; Return array with all disk inf format Number|Type|Result + ; Return array with all disk in the format Number|Type|Result For $i = 0 To UBound($aDisks) - 1 Local $sDiskRow = $aDisks[$i][0] & "|" & $aDisks[$i][9] & "|" & (($aDisks[$i][9] = "GPT") ? "True" : "False") _ArrayAdd($aReturnDiskArray, $sDiskRow) Next Return $aReturnDiskArray EndSwitch - ; Check DiskInitType - EndFunc ;==>_GPTCheck Func _MemCheck() From 1c0b4dff965939cebd93c8b7844b3b44dbf1252e Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 9 Jul 2021 01:33:41 +0200 Subject: [PATCH 22/31] Remove added word (See conversation on #440) --- Langs/0000.lang | 1 - Langs/0407.lang | 1 - Langs/0409.lang | 1 - 3 files changed, 3 deletions(-) diff --git a/Langs/0000.lang b/Langs/0000.lang index da7b8107..b4d9205d 100644 --- a/Langs/0000.lang +++ b/Langs/0000.lang @@ -68,7 +68,6 @@ Invalid Release Tags Received!= Invalid Release Types Received!= Update Available= An Update is Available, would you like to download it?= -Warning= [Descriptions] Architecture=The amount of data your CPU and OS can process at once. 32-Bit OS result requires a disk wipe and new Windows 11 install. 32-Bit CPU requires a CPU replacement. Boot=A method your motherboard uses to load Windows. Legacy results can be fixed on newer motherboards in your BIOS/UEFI settings. Refer to your motherboard manual. diff --git a/Langs/0407.lang b/Langs/0407.lang index a4818a90..9ae72912 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -60,4 +60,3 @@ Invalid Release Tags Received!=Ungültige Release-Tags erhalten! Invalid Release Types Received!=Ungültige Release-Types erhalten! Update Available=Update verfügbar An Update is Available, would you like to download it?=Ein Update ist verfügbar. Möchten Sie es herunterladen? -Warning=Warnung diff --git a/Langs/0409.lang b/Langs/0409.lang index adfa421e..9ba12ba8 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -67,7 +67,6 @@ Invalid Release Tags Received!=Invalid Release Tags Received! Invalid Release Types Received!=Invalid Release Types Received! Update Available=Update Available An Update is Available, would you like to download it?=An Update is Available, would you like to download it? -Warning=Warning [Descriptions] Architecture=The amount of data your CPU and OS can process at once. 32-Bit OS result requires a disk wipe and new Windows 11 install. 32-Bit CPU requires a CPU replacement. Boot=A method your motherboard uses to load Windows. Legacy results can be fixed on newer motherboards in your BIOS/UEFI settings. Refer to your motherboard manual. From 5bc1ccca2947264154ede23f457356e9f6f981c1 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 9 Jul 2021 02:06:52 +0200 Subject: [PATCH 23/31] Fix incorrect lang files. --- Langs/0000.lang | 2 +- Langs/0407.lang | 2 +- Langs/0409.lang | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Langs/0000.lang b/Langs/0000.lang index b4d9205d..06b873d6 100644 --- a/Langs/0000.lang +++ b/Langs/0000.lang @@ -49,7 +49,7 @@ Drive(s) Meet Requirements= 0 Drives Meet Requirements= Partition and disk passed.= Partition not passed, but disk.= -Partition and disk passed.= +Partition and disk not passed.= TPM Missing / Disabled= Detected= DirectX 12 and WDDM 3= diff --git a/Langs/0407.lang b/Langs/0407.lang index 9ae72912..bc468046 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -41,7 +41,7 @@ Disabled / Not Detected=deaktiviert oder nicht erkannt Drive(s) Meet Requirements=Laufwerk(e) kompatibel Partition and disk passed.=Partition und Laufwerk bestanden. Partition not passed, but disk.=Partition nicht bestanden, aber Laufwerk. -Partition and disk passed.=Partition und Platte bestanden. +Partition and disk not passed.=Partition und Laufwerk nicht bestanden. TPM Missing / Disabled=TPM fehlt oder deaktiviert Detected=erkannt DirectX 12 and WDDM 3=DirectX 12 und WDDM 3 diff --git a/Langs/0409.lang b/Langs/0409.lang index 9ba12ba8..46e85b9a 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -47,7 +47,7 @@ Disabled / Not Detected=Disabled / Not Detected Drive(s) Meet Requirements=Drive(s) Meet Requirements Partition and disk passed.=Partition and disk passed. Partition not passed, but disk.=Partition not passed, but disk. -Partition and disk passed.=Partition and disk passed. +Partition and disk not passed.=Partition and disk not passed. TPM Missing / Disabled=TPM Missing / Disabled Not Supported=Not Supported Detected=Detected From 838eafb3279151ce91f9d6bff54ebf54b7fb9886 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 9 Jul 2021 21:15:35 +0200 Subject: [PATCH 24/31] Fix Typo --- Langs/0000.lang | 4 ++-- Langs/0407.lang | 4 ++-- Langs/0409.lang | 4 ++-- WhyNotWin11.au3 | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Langs/0000.lang b/Langs/0000.lang index 06b873d6..8ae28381 100644 --- a/Langs/0000.lang +++ b/Langs/0000.lang @@ -39,8 +39,8 @@ Not Currently Listed as Compatible= Listed as Compatible= Cores= Threads= -Requirement meet.= -Requirement not meet.= +Requirement met.= +Requirement not met.= Enabled= Supported= Not Supported= diff --git a/Langs/0407.lang b/Langs/0407.lang index bc468046..61e57eca 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -32,8 +32,8 @@ Not Currently Listed as Compatible=CPU derzeit nicht als kompatibel gelistet Listed as Compatible=CPU als kompatibel gelistet Cores=Kerne Threads=Threads -Requirement meet.=Anforderung erfüllt. -Requirement not meet.=Anforderung nicht erfüllt. +Requirement met.=Anforderung erfüllt. +Requirement not met.=Anforderung nicht erfüllt. Enabled=aktiviert Supported=unterstützt Not Supported=nicht unterstützt diff --git a/Langs/0409.lang b/Langs/0409.lang index 46e85b9a..811353c3 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -39,8 +39,8 @@ Not Currently Listed as Compatible=Not Currently Listed as Compatible Listed as Compatible=Listed as Compatible Cores=# Cores Threads=# Threads -Requirement meet.=Requirement meet. -Requirement not meet.=Requirement not meet. +Requirement met.=Requirement met. +Requirement not met.=Requirement not met. Enabled=Enabled Supported=Supported Disabled / Not Detected=Disabled / Not Detected diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index aed25ed6..037bb4d5 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -513,10 +513,10 @@ Func Main() Switch _GPTCheck(0) Case True _GUICtrlSetState($hCheck[6][0], $iPass) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: GPT") & @CRLF & _Translate($iMUI, "Requirement meet.")) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: GPT") & @CRLF & _Translate($iMUI, "Requirement met.")) Case False _GUICtrlSetState($hCheck[6][0], $iFail) - GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: MBR") & @CRLF & _Translate($iMUI, "Requirement not meet.")) + GUICtrlSetData($hCheck[6][2], _Translate($iMUI, "System disk: MBR") & @CRLF & _Translate($iMUI, "Requirement not met.")) Case Else ; Do Nothing!! EndSwitch From 8fc267ba7eedf67f2a841eb1e5f8c633f7eee048 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 9 Jul 2021 21:18:16 +0200 Subject: [PATCH 25/31] Tidy source --- WhyNotWin11.au3 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index 037bb4d5..47a58c83 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -249,14 +249,14 @@ Func Main() GUICtrlSetDefColor($aColors[$iText]) GUICtrlSetDefBkColor($aColors[$iBackground]) -#cs - Local $sCheck = _CheckAppsUseLightTheme() - If @error Then - ;;; - ElseIf Not $sCheck Then - GUICtrlSetDefColor(0xFFFFFF) - EndIf -#ce + #cs + Local $sCheck = _CheckAppsUseLightTheme() + If @error Then + ;;; + ElseIf Not $sCheck Then + GUICtrlSetDefColor(0xFFFFFF) + EndIf + #ce Local $hDumpLang = GUICtrlCreateDummy() @@ -375,7 +375,7 @@ Func Main() Local $hBannerText = GUICtrlCreateLabel("", 130, 560, 90, 40, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetFont(-1, $aFonts[$FontSmall] * $DPI_RATIO, $FW_NORMAL, $GUI_FONTUNDER) GUICtrlSetBkColor(-1, _HighContrast(0xE6E6E6)) - + Local $sBannerURL = _SetBannerText($hBannerText, $hBanner) #ce Maybe Readd Later From b1af2709b8e928270895bc1de02255380e567150 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 9 Jul 2021 21:27:12 +0200 Subject: [PATCH 26/31] Clean up lang files --- Langs/0000.lang | 2 -- Langs/0407.lang | 1 - Langs/0409.lang | 1 - 3 files changed, 4 deletions(-) diff --git a/Langs/0000.lang b/Langs/0000.lang index 8ae28381..09f012ed 100644 --- a/Langs/0000.lang +++ b/Langs/0000.lang @@ -45,8 +45,6 @@ Enabled= Supported= Not Supported= Disabled / Not Detected= -Drive(s) Meet Requirements= -0 Drives Meet Requirements= Partition and disk passed.= Partition not passed, but disk.= Partition and disk not passed.= diff --git a/Langs/0407.lang b/Langs/0407.lang index 61e57eca..fa22fe9f 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -38,7 +38,6 @@ Enabled=aktiviert Supported=unterstützt Not Supported=nicht unterstützt Disabled / Not Detected=deaktiviert oder nicht erkannt -Drive(s) Meet Requirements=Laufwerk(e) kompatibel Partition and disk passed.=Partition und Laufwerk bestanden. Partition not passed, but disk.=Partition nicht bestanden, aber Laufwerk. Partition and disk not passed.=Partition und Laufwerk nicht bestanden. diff --git a/Langs/0409.lang b/Langs/0409.lang index 811353c3..f0cbfcec 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -44,7 +44,6 @@ Requirement not met.=Requirement not met. Enabled=Enabled Supported=Supported Disabled / Not Detected=Disabled / Not Detected -Drive(s) Meet Requirements=Drive(s) Meet Requirements Partition and disk passed.=Partition and disk passed. Partition not passed, but disk.=Partition not passed, but disk. Partition and disk not passed.=Partition and disk not passed. From f591834f0fa8cd4fb302c21c3ab3dd2b6311852d Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sat, 10 Jul 2021 17:03:04 +0200 Subject: [PATCH 27/31] Fix merge mistakes and improve loading bar --- Langs/0000.lang | 3 ++- Langs/0407.lang | 5 +++-- Langs/0409.lang | 3 ++- WhyNotWin11.au3 | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Langs/0000.lang b/Langs/0000.lang index 12c0fe19..44d74655 100644 --- a/Langs/0000.lang +++ b/Langs/0000.lang @@ -67,8 +67,9 @@ Invalid Release Types Received!= Update Available= An Update is Available, would you like to download it?= Done= -Loading WMIC= Warning= +Loading ...= +User interface= [Descriptions] Architecture=The amount of data your CPU and OS can process at once. 32-Bit OS result requires a disk wipe and new Windows 11 install. 32-Bit CPU requires a CPU replacement. Boot=A method your motherboard uses to load Windows. Legacy results can be fixed on newer motherboards in your BIOS/UEFI settings. Refer to your motherboard manual. diff --git a/Langs/0407.lang b/Langs/0407.lang index 87357155..b9f2a1a0 100644 --- a/Langs/0407.lang +++ b/Langs/0407.lang @@ -60,5 +60,6 @@ Invalid Release Types Received!=Ungültige Release-Types erhalten! Update Available=Update verfügbar An Update is Available, would you like to download it?=Ein Update ist verfügbar. Möchten Sie es herunterladen? Done=Fertig -Loading WMIC=Lade WMIC -Warning=Warnung \ No newline at end of file +Warning=Warnung +Loading ...=Lade ... +User interface=Benutzeroberfläche \ No newline at end of file diff --git a/Langs/0409.lang b/Langs/0409.lang index d04f5705..cb052db2 100644 --- a/Langs/0409.lang +++ b/Langs/0409.lang @@ -67,8 +67,9 @@ Invalid Release Types Received!=Invalid Release Types Received! Update Available=Update Available An Update is Available, would you like to download it?=An Update is Available, would you like to download it? Done=Done -Loading WMIC=Loading WMIC Warning=Warning +Loading ...=Loading ... +User interface=User interface [Descriptions] Architecture=The amount of data your CPU and OS can process at once. 32-Bit OS result requires a disk wipe and new Windows 11 install. 32-Bit CPU requires a CPU replacement. Boot=A method your motherboard uses to load Windows. Legacy results can be fixed on newer motherboards in your BIOS/UEFI settings. Refer to your motherboard manual. diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index c5d57485..dca32feb 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -230,7 +230,7 @@ Func Main() Local Enum $FontSmall, $FontMedium, $FontLarge, $FontExtraLarge #Region Init WMI data - ProgressOn("WhyNotWin11", "Loading ...") + ProgressOn("WhyNotWin11", _Translate($iMUI, "Loading ...")) ProgressSet(0, "_GetCPUInfo()") _GetCPUInfo() ProgressSet(20, "_GetDiskProperties()") @@ -239,7 +239,7 @@ Func Main() _GetGPUInfo() ProgressSet(60, "_GetTPMInfo()") _GetTPMInfo() - ProgressSet(80, "Loading Gui...") + ProgressSet(80, _Translate($iMUI, "User interface")) #EndRegion Init WMI data Local $hGUI = GUICreate("WhyNotWin11", 800, 600, -1, -1, BitOR($WS_POPUP, $WS_BORDER)) From c1bba7087d6db6e459983ae134a03a7a1d190e5a Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sat, 10 Jul 2021 17:04:05 +0200 Subject: [PATCH 28/31] Tidy source --- WhyNotWin11.au3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index dca32feb..c7f5000b 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -375,7 +375,7 @@ Func Main() Local $hBannerText = GUICtrlCreateLabel("", 130, 560, 90, 40, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetFont(-1, $aFonts[$FontSmall] * $DPI_RATIO, $FW_NORMAL, $GUI_FONTUNDER) GUICtrlSetBkColor(-1, _HighContrast(0xE6E6E6)) - + Local $sBannerURL = _SetBannerText($hBannerText, $hBanner) #ce Maybe Readd Later From 15fd318c6063e920f1e0d261156d560fbb2174de Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Mon, 12 Jul 2021 00:34:37 +0200 Subject: [PATCH 29/31] Fix to many wmi calls are done. --- includes/_Checks.au3 | 16 +++++++++------- includes/_WMIC.au3 | 34 ++++++++++------------------------ 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/includes/_Checks.au3 b/includes/_Checks.au3 index ddc7d959..de018999 100644 --- a/includes/_Checks.au3 +++ b/includes/_Checks.au3 @@ -123,7 +123,7 @@ Func _GPTCheck($iFlag) ; Vars Local Static $aDisks - If (Not $aDisks) Then + If ($aDisks = Null) Then $aDisks = _GetDiskProperties(1) ; Array with all disks If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") EndIf @@ -214,7 +214,7 @@ Func _SpaceCheck($iFlag) ; On error ..... : SetError(1, 1, "Error_CheckFailed") ; Ini tvars - Local Static $bInitDone = False + Local Static $bInitDone Local Static $iDiskSize Local Static $iPartitionSize Local Static $aDisks @@ -222,15 +222,17 @@ Func _SpaceCheck($iFlag) _ArrayAdd($aReturnDiskArray, "Disk" & "|" & "Size (GB)" & "|" & "Check result") ; Init data - If (Not $bInitDone = True) Then - ; Check for error by retriving disk data - _GetDiskProperties(4) - If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") - + If ($bInitDone <> True) Then ; Get size (Arrays form _GetDiskProperties are 2D-Arrays.) & vars $iDiskSize = Round(_GetDiskProperties(3)[0][8] / 1024 / 1024 / 1024) $iPartitionSize = Round(_GetDiskProperties(4)[0][9] / 1024 / 1024 / 1024) $aDisks = _GetDiskProperties(1) + + ; Check for error + If @error = 1 Then Return SetError(1, 1, "Error_CheckFailed") + + ; Set init done + $bInitDone = True EndIf ; Return data based on $iFlag diff --git a/includes/_WMIC.au3 b/includes/_WMIC.au3 index 3c6f20a3..b29d6593 100644 --- a/includes/_WMIC.au3 +++ b/includes/_WMIC.au3 @@ -69,36 +69,22 @@ Func _GetDiskProperties($iFlag = 0) Local Static $aDiskArray Local Static $aPartitionArray - Local Static $iSysDisk - Local Static $iSysPartition + Local Static $aSysDisk + Local Static $aSysPartition ; Get WMI data - If (Not $aDiskArray) Or (Not $aPartitionArray) Then + If ($aDiskArray = "") Or ($aPartitionArray = "") Then ; Get disk datat for fixed (internal) disks. _GetDiskInfoFromWmi($aDiskArray, $aPartitionArray, $DiskInfoWmi_TableHeader_No, $DiskInfoWmi_DiskType_Fixed) If @error = 1 Then Return SetError(1, 1, "Error_WmiFailed") EndIf ; Get sys disk and sys partition num - If (Not $iSysDisk) Then - For $i = 0 To UBound($aDiskArray) - 1 Step 1 - ; If windows is bootet from disk... - If $aDiskArray[$i][11] = "True" Then - ; Return row as only neede row - $iSysDisk = $i - ExitLoop - EndIf - Next - EndIf - If (Not $iSysPartition) Then - For $i = 0 To UBound($aPartitionArray) - 1 Step 1 - ; If windows is bootet from disk... - If $aPartitionArray[$i][12] = "True" Then - ; Return row as only neede row - $iSysPartition = $i - ExitLoop - EndIf - Next + If ($aSysDisk = "") Or ($aSysPartition = "") Then + Local $iSysDisk = _ArraySearch($aDiskArray, "True", 0, 0, 0, 0, 1, 11) ; Row 11 = IsSysDisk + $aSysDisk = _ArrayExtract($aDiskArray, $iSysDisk, $iSysDisk) + Local $iSysPartition = _ArraySearch($aPartitionArray, "True", 0, 0, 0, 0, 1, 12) ; Row 12 = IsSysPartition + $aSysPartition = _ArrayExtract($aPartitionArray, $iSysPartition, $iSysPartition) EndIf ; Return data based on $iFlag or exit function @@ -114,10 +100,10 @@ Func _GetDiskProperties($iFlag = 0) Return $aPartitionArray Case 3 ; Return information of disk with system (Windows) partition. - Return _ArrayExtract($aDiskArray, $iSysDisk, $iSysDisk) + Return $aSysDisk Case 4 ; Return information of system (Windows) partition. - Return _ArrayExtract($aPartitionArray, $iSysPartition, $iSysPartition) + Return $aSysPartition Case Else ; If $iFlag was incorrect... Return SetError(1, 2, "Error_IncorrectFlag") From c74fa13bbe2e9fbc3cc4c70ecabd015cbc3fe223 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Mon, 12 Jul 2021 00:58:36 +0200 Subject: [PATCH 30/31] Fix layout --- WhyNotWin11.au3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WhyNotWin11.au3 b/WhyNotWin11.au3 index b183568d..00bdcd2f 100644 --- a/WhyNotWin11.au3 +++ b/WhyNotWin11.au3 @@ -375,7 +375,7 @@ Func Main() Local $hBannerText = GUICtrlCreateLabel("", 130, 560, 90, 40, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetFont(-1, $aFonts[$FontSmall] * $DPI_RATIO, $FW_NORMAL, $GUI_FONTUNDER) GUICtrlSetBkColor(-1, _HighContrast(0xE6E6E6)) - + Local $sBannerURL = _SetBannerText($hBannerText, $hBanner) #ce Maybe Readd Later @@ -419,7 +419,7 @@ Func Main() GUICtrlSetFont(-1, $aFonts[$FontLarge] * $DPI_RATIO, $FW_NORMAL) $hCheck[$iRow][2] = GUICtrlCreateLabel(_Translate($iMUI, "Checking..."), 450, 110 + $iRow * 40, 300, 40, $SS_SUNKEN) Switch $iRow - Case 0, 3, 9 + Case 0, 3, 6, 9 GUICtrlSetStyle(-1, $SS_CENTER + $SS_SUNKEN) Case Else GUICtrlSetStyle(-1, $SS_CENTER + $SS_SUNKEN + $SS_CENTERIMAGE) From b0bd0c91d3ae6cfcd0a6108df119fe52b2eaed8f Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Mon, 12 Jul 2021 01:06:12 +0200 Subject: [PATCH 31/31] fix build warnings --- includes/GetDiskInfoFromWmi.au3 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/GetDiskInfoFromWmi.au3 b/includes/GetDiskInfoFromWmi.au3 index 8cb2e4b2..53be36b6 100644 --- a/includes/GetDiskInfoFromWmi.au3 +++ b/includes/GetDiskInfoFromWmi.au3 @@ -14,12 +14,15 @@ Language ............: English Description .........: Get disk and partition informations from WMI. Author ..............: htcfreek (Heiko) - https://github.com/htcfreek [original] - Modified ............: + Modified ............: 2021-07-12 (htcfreek): Temporary fix build warnings until new version is released. Required includes ...: Array.au3 Dll .................: =============================================================================================================================== CHANGELOG: + 2021-07-12 (v1.4.1 + temporary fix) + Fix: Build warings for non declared vars $sDiskHeader, $sPartitionHeader + 2021-07-06 (v1.4.1) Fixed: Code styling @@ -83,9 +86,9 @@ Func _GetDiskInfoFromWmi(ByRef $aDiskList, ByRef $aPartitionList, $bAddTableHead ; Add Array header If ($bAddTableHeader = 1) Then - $sDiskHeader = "DiskNum" & "||" & "DiskDeviceID" & "||" & "DiskManufacturer" & "||" & "DiskModel" & "||" & "DiskInterfaceType" & "||" & "DiskMediaType" & "||" & "DiskSerialNumber" & "||" & "DiskState" & "||" & "DiskSize" & "||" & "DiskInitType" & "||" & "DiskPartitionCount" & "||" & "WindowsRunningOnDisk (SystemDrive)" + Local $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" + Local $sPartitionHeader = "DiskNum" & "||" & "PartitionNum" & "||" & "PartitionID" & "||" & "PartitionType" & "||" & "PartitionIsPrimary" & "||" & "PartitionIsBootPartition" & "||" & "PartitionLetter" & "||" & "PartitionLabel" & "||" & "PartitionFileSystem" & "||" & "PartitionSizeTotal" & "||" & "PartitionSizeUsed" & "||" & "PartitionSizeFree" & "||" & "PartitionIsSystemDrive" _ArrayAdd($aPartitions, $sPartitionHeader, 0, "||") $iDiskArrayCount += 1 $iPartArrayCount += 1