Skip to content

Commit

Permalink
fix: replace wmic (deprecated)
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Jun 10, 2024
1 parent f398a46 commit de28d5d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
@echo off

:: Check if hyper threading is enabled
for /f "tokens=2 delims==" %%a in ('wmic cpu get NumberOfCores /value') do set "PHYSICAL_CORES=%%a"
for /f "tokens=2 delims==" %%a in ('wmic cpu get NumberOfLogicalProcessors /value') do set "LOGICAL_CORES=%%a"
if "%LOGICAL_CORES%" GTR "%PHYSICAL_CORES%" goto :hyperThreading
powershell -NonI -NoP -C "$proc = Get-CimInstance Win32_Processor; if ([int]$proc.NumberOfLogicalProcessors -gt [int]$proc.NumberOfCores) { exit 262 }"
if "%errorlevel%"=="262" goto :hyperThreading

if "%~1" neq "/silent" (
echo This forces your CPU to work at its maximum speed always, ensure you have good cooling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ whoami /user | find /i "S-1-5-18" > nul 2>&1 || (
:main
:: Enable Spectre and Meltdown
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverrideMask" /t REG_DWORD /d "3" /f > nul
wmic cpu get name | findstr "Intel" > nul && (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverride" /t REG_DWORD /d "0" /f > nul
)
wmic cpu get name | findstr "AMD" > nul && (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverride" /t REG_DWORD /d "64" /f > nul
)
powershell -NonI -NoP -C "$proc = (Get-CimInstance Win32_Processor).Name; $env:CPU = if ($proc | sls 'Intel' -Quiet) {'0'} elseif ($proc | sls 'AMD' -Quiet) {'64'}"
if "%CPU%" neq "" (
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "FeatureSettingsOverride" /t REG_DWORD /d "%CPU%" /f > nul
)

:: Enable Structured Exception Handling Overwrite Protection (SEHOP)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel" /v "DisableExceptionChainValidation" /t REG_DWORD /d "0" /f > nul
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fltmc > nul 2>&1 || (
echo Setting network settings to Atlas defaults...

:: Set network adapter driver registry key
for /f %%a in ('wmic path Win32_NetworkAdapter get PNPDeviceID^| findstr /L "PCI\VEN_"') do (
for /f "usebackq" %%a in (`powershell -NonI -NoP -C "(Get-CimInstance Win32_NetworkAdapter).PNPDeviceID | sls 'PCI\\VEN_'"`) do (
for /f "tokens=3" %%b in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\%%a" /v "Driver"') do (
set "netKey=HKLM\SYSTEM\CurrentControlSet\Control\Class\%%b"
) > nul 2>&1
Expand Down

0 comments on commit de28d5d

Please sign in to comment.