include vc redist and wuaueng.dll repair script

This commit is contained in:
zeffy
2017-06-04 13:33:13 -07:00
parent 9ceec98964
commit 2276f86a04
4 changed files with 88 additions and 12 deletions

View File

@@ -16,9 +16,9 @@ There have even been people with older Intel and AMD systems who have been locke
## Bad Microsoft! ## Bad Microsoft!
<sup>If you are interested, you can read my original write up on discovering the CPU check [here](../../tree/old-kb4012218-19).</sup> If you are interested, you can read my original write up on discovering the CPU check [here](../../tree/old-kb4012218-19).
Basically, inside a file called `wuaueng.dll` there are two functions: [`IsDeviceServiceable(void)`](https://gist.github.com/zeffy/e5ec266952932bc905eb0cbc6ed72185) and [`IsCPUSupported(void)`](https://gist.github.com/zeffy/1a8f8984d2bec97ae24af63a76278694). `IsDeviceServiceable(void)` is essentially a wrapper around `IsCPUSupported(void)` that caches the result it recieves and returns it on subsequent calls. Basically, inside a file called `wuaueng.dll` there are two functions: [`IsDeviceServiceable(void)`](https://gist.github.com/zeffy/e5ec266952932bc905eb0cbc6ed72185) and [`IsCPUSupported(void)`](https://gist.github.com/zeffy/1a8f8984d2bec97ae24af63a76278694). `IsDeviceServiceable(void)` is essentially a wrapper around `IsCPUSupported(void)` that caches the result it recieves and recycles it on subsequent calls.
My patch takes advantage of this result caching behavior by setting the "hasn't run once" value to `FALSE` and the cached result to `TRUE`. My patch takes advantage of this result caching behavior by setting the "hasn't run once" value to `FALSE` and the cached result to `TRUE`.
@@ -28,4 +28,21 @@ My patch takes advantage of this result caching behavior by setting the "hasn't
- `wufuc` determines what service host process the Windows Update service (`wuauserv`) runs in, and injects itself into it. - `wufuc` determines what service host process the Windows Update service (`wuauserv`) runs in, and injects itself into it.
- Once injected, it applies a hook to `LoadLibraryEx` that automatically patches `wuaueng.dll` when it is loaded. - Once injected, it applies a hook to `LoadLibraryEx` that automatically patches `wuaueng.dll` when it is loaded.
- Any previously loaded `wuaueng.dll` is also patched. - Any previously loaded `wuaueng.dll` is also patched.
- **No system files are modified!**
### Several improvements over my script-based approach:
- **No system files are modified!***
- Heuristic byte signature patching persists over new updates.
- C is best language.
- No external dependencies except for Microsoft Visual C++ 2015 Redistributable.
### How to install/uninstall?
Just run move the `wufuc` folder to wherever you want and run `install_wufuc.bat` as administrator.
To uninstall run `uninstall_wufuc.bat` as administrator.
To temporarily disable the patch, just go to the Task Scheduler and disable the `wufuc.{ ... }` task, then restart your computer.
### How do I remove your old patch and use this instead?
I've included a utility script called `repair_wuaueng.dll.bat` that will initiate an sfc scan and attempt to automatically revert any changes made to `wuaueng.dll`.

View File

@@ -82,9 +82,9 @@ for %%a in (%SUPPORTED_HOTFIXES%) do (
) )
echo. echo.
echo Warning - Detected that no supported updates are installed! echo WARNING - Detected that no supported updates are installed!
echo. echo.
echo This can be a false warning, if you are sure you know you need wufuc you echo This can be a false warning, if you are certain that need wufuc then you
echo can continue (there will be no side effects even if you don't need it) echo can continue (there will be no side effects even if you don't need it)
set /p CONTINUE=Enter 'Y' if you still want to continue: set /p CONTINUE=Enter 'Y' if you still want to continue:
@@ -101,18 +101,26 @@ set /p CONTINUE=Enter 'Y' if you want to install wufuc:
if /I not "%CONTINUE%"=="Y" goto :cancel if /I not "%CONTINUE%"=="Y" goto :cancel
echo. echo.
set "vcredist_path=%~dp0_Redist\vcredist_%WINDOWS_ARCHITECTURE%.exe"
if exist "%vcredist_path%" (
echo Installing Microsoft Visual C^+^+ 2017 Redistributable ^(%WINDOWS_ARCHITECTURE%^)...
"%vcredist_path%" /passive /norestart
goto :install
)
echo Couldn't locate and install Microsoft Visual C^+^+ 2017 Redistributable ^(%WINDOWS_ARCHITECTURE%^).
set /p CONTINUE=Enter 'Y' if you still want to continue:
if /I not "%CONTINUE%"=="Y" goto :cancel
echo.
:install :install
set "wufuc_task=wufuc.{72EEE38B-9997-42BD-85D3-2DD96DA17307}" set "wufuc_task=wufuc.{72EEE38B-9997-42BD-85D3-2DD96DA17307}"
schtasks /Create /XML "%~dp0wufuc.xml" /TN "%wufuc_task%" /F schtasks /Create /XML "%~dp0wufuc.xml" /TN "%wufuc_task%" /F
echo %ERRORLEVEL%
schtasks /Change /TN "%wufuc_task%" /TR "'%systemroot%\system32\rundll32.exe' """%wufuc_dll%""",Rundll32Entry" schtasks /Change /TN "%wufuc_task%" /TR "'%systemroot%\system32\rundll32.exe' """%wufuc_dll%""",Rundll32Entry"
echo %ERRORLEVEL%
schtasks /Change /TN "%wufuc_task%" /ENABLE schtasks /Change /TN "%wufuc_task%" /ENABLE
echo %ERRORLEVEL%
rundll32 "%wufuc_dll%",Rundll32Unload rundll32 "%wufuc_dll%",Rundll32Unload
echo %ERRORLEVEL%
schtasks /Run /TN "%wufuc_task%" schtasks /Run /TN "%wufuc_task%"
echo %ERRORLEVEL%
echo. echo.
echo Installed and started wufuc! echo Installed and started wufuc!
@@ -129,4 +137,4 @@ exit
echo. echo.
echo Canceled by user, press any key to exit... echo Canceled by user, press any key to exit...
pause >nul pause >nul
exit exit

View File

@@ -0,0 +1,51 @@
@echo off
title install wufuc (repair wuaueng.dll) - v0.6
:: Copyright (C) 2017 zeffy
:: This program is free software: you can redistribute it and/or modify
:: it under the terms of the GNU General Public License as published by
:: the Free Software Foundation, either version 3 of the License, or
:: (at your option) any later version.
:: This program is distributed in the hope that it will be useful,
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
:: GNU General Public License for more details.
:: You should have received a copy of the GNU General Public License
:: along with this program. If not, see <http://www.gnu.org/licenses/>.
echo Copyright (C) 2017 zeffy
echo This program comes with ABSOLUTELY NO WARRANTY.
echo This is free software, and you are welcome to redistribute it
echo under certain conditions; see COPYING.txt for details.
echo.
fltmc >nul 2>&1 || (
echo This batch script requires administrator privileges. Right-click on
echo %~nx0 and select "Run as administrator".
goto :die
)
:confirmation
echo You may want to use this script if you previously modified wuaueng.dll
echo with "aio-wuaueng.dll-patch.bat" or by other means.
echo.
echo This will run the sfc utility and it will restore any changes that were made.
set /p CONTINUE=Enter 'Y' if you want to repair wuaueng.dll:
if /I not "%CONTINUE%"=="Y" goto :cancel
sfc /SCANFILE="%systemroot%\System32\wuaueng.dll"
:die
echo.
echo Press any key to exit...
pause >nul
exit
:cancel
echo.
echo Canceled by user, press any key to exit...
pause >nul
exit

View File

@@ -68,4 +68,4 @@ exit
echo. echo.
echo Canceled by user, press any key to exit... echo Canceled by user, press any key to exit...
pause >nul pause >nul
exit exit