Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a slight workaround for #162
Fixes #147
Closing #39, checks are not quick enough to have them run before displaying
  • Loading branch information
rcmaehl committed Jun 29, 2021
1 parent 2ead43f commit e911acc
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 34 deletions.
54 changes: 32 additions & 22 deletions WhyNotWin11.au3
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ Func Main()
GUICtrlSetBkColor(-1, _HighContrast(0xF2F2F2))
EndIf

GUICtrlCreateLabel(_GetCPUInfo(2), 470, 560, 300, 20, $SS_CENTERIMAGE)
GUICtrlSetBkColor(-1, _HighContrast(0xF2F2F2))
GUICtrlCreateLabel(_GetGPUInfo(0), 470, 580, 300, 20, $SS_CENTERIMAGE)
GUICtrlSetBkColor(-1, _HighContrast(0xF2F2F2))

GUICtrlCreateLabel(_Translate("Your Windows 11 Compatibility Results are Below"), 130, 30, 640, 40, $SS_CENTER+$SS_CENTERIMAGE)
GUICtrlSetFont(-1, 18 * _GDIPlus_GraphicsGetDPIRatio()[0], $FW_SEMIBOLD, "", "", $CLEARTYPE_QUALITY)

Expand All @@ -270,8 +275,6 @@ Func Main()
GUICtrlSetFont(-1, 12 * _GDIPlus_GraphicsGetDPIRatio()[0], $FW_SEMIBOLD)
Next

GUISetState(@SW_SHOW, $hGUI)

$hFile = _TempFile()
$hDXFile = _TempFile(@TempDir, "dxdiag")
Run("dxdiag /whql:off /t " & $hDXFile)
Expand Down Expand Up @@ -315,25 +318,25 @@ Func Main()
If @error Then
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetTip($hCheck[2][0], _Translate("Unable to Check List") & @CRLF & _GetCPUInfo(2))
GUICtrlSetTip($hCheck[2][0], _Translate("Unable to Check List"))
EndIf
For $iLine = 1 to $iLines Step 1
$sLine = FileReadLine(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsAMD.txt", $iLine)
Select
Case @error = -1
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetData($hCheck[2][2], _Translate("Error Accessing List") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Error Accessing List"))
ExitLoop
Case $iLine = $iLines
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetData($hCheck[2][2], _Translate("Not Currently Listed as Compatible") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Not Currently Listed as Compatible"))
ExitLoop
Case StringInStr(_GetCPUInfo(2), $sLine)
GUICtrlSetData($hCheck[2][0], "OK")
GUICtrlSetBkColor($hCheck[2][0], 0x4CC355)
GUICtrlSetData($hCheck[2][2], _Translate("Listed as Compatible") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Listed as Compatible"))
ExitLoop
EndSelect
Next
Expand All @@ -342,25 +345,25 @@ Func Main()
If @error Then
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetData($hCheck[2][2], _Translate("Unable to Check List") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Unable to Check List"))
EndIf
For $iLine = 1 to $iLines Step 1
$sLine = FileReadLine(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsIntel.txt", $iLine)
Select
Case @error = -1
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetData($hCheck[2][2], _Translate("Error Accessing List") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Error Accessing List"))
ExitLoop
Case $iLine = $iLines
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetData($hCheck[2][2], _Translate("Not Currently Listed as Compatible") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Not Currently Listed as Compatible"))
ExitLoop
Case StringInStr(_GetCPUInfo(2), $sLine)
GUICtrlSetData($hCheck[2][0], "OK")
GUICtrlSetBkColor($hCheck[2][0], 0x4CC355)
GUICtrlSetData($hCheck[2][2], _Translate("Listed as Compatible") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Listed as Compatible"))
ExitLoop
EndSelect
Next
Expand All @@ -369,25 +372,25 @@ Func Main()
If @error Then
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetTip($hCheck[2][0], _Translate("Unable to Check List") & @CRLF & _GetCPUInfo(2))
GUICtrlSetTip($hCheck[2][0], _Translate("Unable to Check List"))
EndIf
For $iLine = 1 to $iLines Step 1
$sLine = FileReadLine(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsQualcomm.txt", $iLine)
Select
Case @error = -1
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetData($hCheck[2][2], _Translate("Error Accessing List") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Error Accessing List"))
ExitLoop
Case $iLine = $iLines
GUICtrlSetData($hCheck[2][0], "?")
GUICtrlSetBkColor($hCheck[2][0], 0xF4C141)
GUICtrlSetData($hCheck[2][2], _Translate("Not Currently Listed as Compatible") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Not Currently Listed as Compatible"))
ExitLoop
Case StringInStr(_GetCPUInfo(2), $sLine)
GUICtrlSetData($hCheck[2][0], "OK")
GUICtrlSetBkColor($hCheck[2][0], 0x4CC355)
GUICtrlSetData($hCheck[2][2], _Translate("Listed as Compatible") & @CRLF & _GetCPUInfo(2))
GUICtrlSetData($hCheck[2][2], _Translate("Listed as Compatible"))
ExitLoop
EndSelect
Next
Expand Down Expand Up @@ -415,11 +418,17 @@ Func Main()
GUICtrlSetData($hCheck[4][2], _GetCPUInfo(3) & " MHz")
EndIf

$aDisks = _GetDiskInfo(1)
Switch _GetDiskInfo(0)
Case "GPT"
GUICtrlSetData($hCheck[6][0], "OK")
GUICtrlSetBkColor($hCheck[6][0], 0x4CC355)
GUICtrlSetData($hCheck[6][2], _Translate("GPT Detected"))
If $aDisks[0] = $aDisks[1] Then
GUICtrlSetData($hCheck[6][0], "OK")
GUICtrlSetBkColor($hCheck[6][0], 0x4CC355)
Else
GUICtrlSetData($hCheck[6][0], "!")
GUICtrlSetBkColor($hCheck[6][0], 0xF4C141)
EndIf
GUICtrlSetData($hCheck[6][2], _Translate("GPT Detected") & @CRLF & $aDisks[1] & "/" & $aDisks[0] & " " & _Translate("Drive(s) Meet Requirements"))
Case Else
GUICtrlSetData($hCheck[6][0], "X")
GUICtrlSetBkColor($hCheck[6][0], 0xFA113D)
Expand Down Expand Up @@ -521,6 +530,7 @@ Func Main()
EndSelect

FileDelete($hFile)
GUISetState(@SW_SHOW, $hGUI)

While 1
$hMsg = GUIGetMsg()
Expand All @@ -542,27 +552,27 @@ Func Main()
Case StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM3")
GUICtrlSetData($hCheck[5][0], "OK")
GUICtrlSetBkColor($hCheck[5][0], 0x4CC355)
GUICtrlSetData($hCheck[5][2], _GetGPUInfo(0) & @CRLF & "DirectX 12 && WDDM 3")
GUICtrlSetData($hCheck[5][2], "DirectX 12 && WDDM 3")
Case StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM" & Chr(160) & "2") ; Non-English Languages
ContinueCase
Case StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:2") ; Non-English Languages
ContinueCase
Case StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM2")
GUICtrlSetData($hCheck[5][0], "OK")
GUICtrlSetBkColor($hCheck[5][0], 0x4CC355)
GUICtrlSetData($hCheck[5][2], _GetGPUInfo(0) & @CRLF & "DirectX 12 && WDDM 2")
GUICtrlSetData($hCheck[5][2], "DirectX 12 && WDDM 2")
Case Not StringInStr($sDXFile, "DDIVersion:12") And StringInStr($sDXFile, "DriverModel:WDDM2")
GUICtrlSetData($hCheck[5][0], "X")
GUICtrlSetBkColor($hCheck[5][0], 0xFA113D)
GUICtrlSetData($hCheck[5][2], _GetGPUInfo(0) & @CRLF & _Translate("No DirectX 12, but WDDM2"))
GUICtrlSetData($hCheck[5][2], _Translate("No DirectX 12, but WDDM2"))
Case StringInStr($sDXFile, "DDIVersion:12") And Not StringInStr($sDXFile, "DriverModel:WDDM2")
GUICtrlSetData($hCheck[5][0], "X")
GUICtrlSetBkColor($hCheck[5][0], 0xFA113D)
GUICtrlSetData($hCheck[5][2], _GetGPUInfo(0) & @CRLF & _Translate("DirectX 12, but no WDDM2"))
GUICtrlSetData($hCheck[5][2], _Translate("DirectX 12, but no WDDM2"))
Case Else
GUICtrlSetData($hCheck[5][0], "X")
GUICtrlSetBkColor($hCheck[5][0], 0xFA113D)
GUICtrlSetData($hCheck[5][2], _GetGPUInfo(0) & @CRLF & _Translate("No DirectX 12 or WDDM2"))
GUICtrlSetData($hCheck[5][2], _Translate("No DirectX 12 or WDDM2"))
EndSelect
FileDelete($hDXFile)

Expand Down
29 changes: 19 additions & 10 deletions includes/_Checks.au3
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ Func _ArchCheck()
EndFunc

Func _BootCheck()
Local $aReturn[2]

$aReturn[1] = _TempFile()
$aReturn[0] = Run("powershell -Command $env:firmware_type | Out-File -FilePath " & $aReturn[1], "", @SW_HIDE)
If @error Then
SetError(1, 0, 0)
Else
Return $aReturn
EndIf
$sFirmware = EnvGet("firmware_type")
Switch $sFirmware
Case "UEFI"
Return True
Case "Legacy"
Return False
Case Else
SetError(1, 0, 0)
EndSwitch
EndFunc

Func _CPUName($sCPU)
Func _CPUNameCheck($sCPU)
Select
Case StringInStr($sCPU, "AMD")
$iLines = _FileCountLines(@LocalAppDataDir & "\WhyNotWin11\SupportedProcessorsAMD.txt")
Expand Down Expand Up @@ -88,4 +88,13 @@ Func _CPUName($sCPU)
Case Else
Return False
EndSelect
EndFunc

Func _CPUCores()
If _GetCPUInfo(0) >= 2 Or _GetCPUInfo(1) >= 2 Then
Return True
Else
GUICtrlSetData($hCheck[3][0], "X")
GUICtrlSetBkColor($hCheck[3][0], 0xFA113D)
EndIf
EndFunc
10 changes: 8 additions & 2 deletions includes/_WMIC.au3
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ EndFunc

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
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
Else
Return 0
Expand All @@ -75,6 +79,8 @@ Func _GetDiskInfo($iFlag = 0)
Switch $iFlag
Case 0
Return StringLeft($sType,3)
Case 1
Return $aDisks
Case Else
Return 0
EndSwitch
Expand All @@ -91,7 +97,7 @@ Func _GetGPUInfo($iFlag = 0)

Local $Obj_Item
For $Obj_Item In $Col_Items
$sName &= $Obj_Item.Name & " / "
$sName &= $Obj_Item.Name & ", "
$sMemory = $obj_Item.AdapterRAM
Next
Else
Expand All @@ -100,7 +106,7 @@ Func _GetGPUInfo($iFlag = 0)
EndIf
Switch $iFlag
Case 0
Return StringTrimRight(String($sName), 3)
Return StringTrimRight(String($sName), 2)
Case 1
Return StringStripWS(String($sMemory), $STR_STRIPTRAILING)
Case Else
Expand Down

0 comments on commit e911acc

Please sign in to comment.