Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Continue on #412
  • Loading branch information
rcmaehl committed Jul 6, 2021
1 parent deaf30f commit 30382f8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 76 deletions.
21 changes: 7 additions & 14 deletions WhyNotWin11.au3
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ If @OSVersion = 'WIN_10' Then DllCall(@SystemDir & "\User32.dll", "bool", "SetPr
#include <StringConstants.au3>
#include <WindowsConstants.au3>

Global $WINDOWS_DRIVE = EnvGet("SystemDrive")

#include ".\Includes\_WMIC.au3"
#include ".\Includes\_Checks.au3"
#include ".\Includes\Resources.au3"
Expand All @@ -72,7 +74,6 @@ If @OSBuild >= 22000 Or _WinAPI_GetProcAddress($__g_hModule, "wine_get_host_vers
Exit 1
EndIf

Global $WINDOWS_DRIVE = EnvGet("SystemDrive")
If $CmdLine[0] > 0 Then ProcessCMDLine()
ExtractFiles()
Main()
Expand Down Expand Up @@ -147,7 +148,7 @@ Func ChecksOnly()
$aResults[2][1] = @error
$aResults[2][2] = @extended

$aResults[3][0] = _CPUCoresCheck()
$aResults[3][0] = _CPUCoresCheck(_GetCPUInfo(0), _GetCPUInfo(1))
$aResults[3][1] = @error
$aResults[3][2] = @extended

Expand Down Expand Up @@ -488,7 +489,7 @@ Func Main()
EndIf

#Region - Determining CPU properties
If _GetCPUInfo(0) >= 2 Or _GetCPUInfo(1) >= 2 Then
If _CPUCoresCheck(_GetCPUInfo(0), _GetCPUInfo(1)) Then
_GUICtrlSetPass($hCheck[3][0])
Else
_GUICtrlSetFail($hCheck[3][0])
Expand Down Expand Up @@ -542,20 +543,12 @@ Func Main()
GUICtrlSetData($hCheck[8][2], _Translate($iMUI, "Disabled / Not Detected"))
EndSwitch

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 Round(DriveSpaceTotal($WINDOWS_DRIVE) / 1024, 0) >= 64 Then
If _SpaceCheck() Then
_GUICtrlSetPass($hCheck[9][0])
Else
_GUICtrlSetFail($hCheck[9][0])
EndIf
GUICtrlSetData($hCheck[9][2], Round(DriveSpaceTotal($WINDOWS_DRIVE) / 1024, 0) & " GB " & $WINDOWS_DRIVE & @CRLF & $iDrives & " " & _Translate($iMUI, "Drive(s) Meet Requirements"))
GUICtrlSetData($hCheck[9][2], @error & " GB " & $WINDOWS_DRIVE & @CRLF & @extended & " " & _Translate($iMUI, "Drive(s) Meet Requirements"))

Select
Case _GetTPMInfo(0) = False
Expand All @@ -579,7 +572,7 @@ Func Main()
EndSelect

#Region Settings GUI
Local $hSettings = GUICreate(_Translate($iMUI, "Settings"), 670, 558, 102, 2, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
Local $hSettings = GUICreate(_Translate($iMUI, "Settings"), 698, 528, 102, 32, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
Local $bSettings = False
GUISetBkColor(_HighContrast(0xF8F8F8))
GUISetFont($aFonts[$FontSmall] * $DPI_RATIO, $FW_BOLD, "", "Arial")
Expand Down
93 changes: 31 additions & 62 deletions includes/_Checks.au3
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include-once
#include <File.au3>
#include ".\_WMIC.au3"

Func _ArchCheck()
Select
Expand Down Expand Up @@ -27,73 +28,40 @@ Func _BootCheck()
EndFunc ;==>_BootCheck

Func _CPUNameCheck($sCPU)
Local $iLines
Local $iLines, $sLine, $ListFile
Select
Case StringInStr($sCPU, "AMD")
$iLines = _FileCountLines(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsAMD.txt")
If @error Then
SetError(1, 0, 0)
EndIf
Local $sLine
For $iLine = 1 To $iLines Step 1
$sLine = FileReadLine(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsAMD.txt", $iLine)
Select
Case @error = -1
SetError(2, 0, False)
ExitLoop
Case $iLine = $iLines
SetError(3, 0, False)
ExitLoop
Case StringInStr($sCPU, $sLine)
Return True
ExitLoop
EndSelect
Next
$ListFile = "\WhyNotWin11\SupportedProcessorsAMD.txt"
Case StringInStr($sCPU, "Intel")
$iLines = _FileCountLines(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsIntel.txt")
If @error Then
SetError(1, 0, 0)
EndIf
For $iLine = 1 To $iLines Step 1
$sLine = FileReadLine(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsIntel.txt", $iLine)
Select
Case @error = -1
SetError(2, 0, False)
ExitLoop
Case $iLine = $iLines
SetError(3, 0, False)
ExitLoop
Case StringInStr($sCPU, $sLine)
Return True
ExitLoop
EndSelect
Next
$ListFile = "\WhyNotWin11\SupportedProcessorsIntel.txt"
Case StringInStr($sCPU, "SnapDragon") Or StringInStr($sCPU, "Microsoft")
$iLines = _FileCountLines(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsQualcomm.txt")
If @error Then
SetError(1, 0, 0)
EndIf
For $iLine = 1 To $iLines Step 1
$sLine = FileReadLine(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsQualcomm.txt", $iLine)
Select
Case @error = -1
SetError(2, 0, False)
ExitLoop
Case $iLine = $iLines
SetError(3, 0, False)
ExitLoop
Case StringInStr($sCPU, $sLine)
Return True
ExitLoop
EndSelect
Next
Case Else
Return False
$ListFile = "\WhyNotWin11\SupportedProcessorsQualcomm.txt"
EndSelect

If $ListFile = Null Then
Return False
Else
$iLines = _FileCountLines(@LocalAppDataDir & $ListFile)
If @error Then Return SetError(1, 0, 0)
For $iLine = 1 To $iLines Step 1
$sLine = FileReadLine(@LocalAppDataDir & $ListFile, $iLine)
Select
Case @error
SetError(2, 0, False)
ExitLoop
Case $iLine = $iLines
SetError(3, 0, False)
ExitLoop
Case StringInStr($sCPU, $sLine)
Return True
ExitLoop
EndSelect
Next
EndIf
EndFunc ;==>_CPUNameCheck

Func _CPUCoresCheck()
If _GetCPUInfo(0) >= 2 Or _GetCPUInfo(1) >= 2 Then
Func _CPUCoresCheck($iCores, $iThreads)
If $iCores >= 2 Or $iThreads >= 2 Then
Return True
Else
Return False
Expand Down Expand Up @@ -199,17 +167,18 @@ Func _SecureBootCheck()
EndFunc ;==>_SecureBootCheck

Func _SpaceCheck()
Local $iFree = Round(DriveSpaceTotal($WINDOWS_DRIVE) / 1024, 0) >= 64
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 Round(DriveSpaceTotal("C:\") / 1024, 0) >= 64 Then
If $iFree >= 64 Then
Return $iDrives
Else
SetError($iDrives, 0, 0)
SetError($iFree, $iDrives, 0)
EndIf
EndFunc ;==>_SpaceCheck

Expand Down

0 comments on commit 30382f8

Please sign in to comment.