show debug info on failure, more error checking
This commit is contained in:
@@ -14,18 +14,20 @@
|
|||||||
:: You should have received a copy of the GNU General Public License
|
:: You should have received a copy of the GNU General Public License
|
||||||
:: along with this program. If not, see <http://www.gnu.org/licenses/>.
|
:: along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
echo Copyright (C) 2017 zeffy ^<https://github.com/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.
|
||||||
|
|
||||||
net session >nul 2>&1 || (
|
net session >nul 2>&1 || (
|
||||||
echo This batch script requires administrator privileges. Right-click on
|
echo This batch script requires administrator privileges. Right-click on
|
||||||
echo %~nx0 and select "Run as administrator".
|
echo %~nx0 and select "Run as administrator".
|
||||||
goto :die
|
goto :die
|
||||||
)
|
)
|
||||||
|
|
||||||
if not exist "%~dp0patches\" (
|
set "SYSTEM32_DIR=%systemroot%\System32"
|
||||||
echo Patches folder not found! Make sure you extracted all the files from
|
set "WUAUENG_DLL=%SYSTEM32_DIR%\wuaueng.dll"
|
||||||
echo the .zip, and the 'patches' folder is in the same location
|
|
||||||
echo as %~nx0, and try again.
|
|
||||||
goto :die
|
|
||||||
)
|
|
||||||
|
|
||||||
echo Checking system requirements...
|
echo Checking system requirements...
|
||||||
|
|
||||||
@@ -37,40 +39,38 @@ if /I "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
|
|||||||
goto :is_x64
|
goto :is_x64
|
||||||
)
|
)
|
||||||
if /I "%PROCESSOR_ARCHITECTURE%"=="x86" (
|
if /I "%PROCESSOR_ARCHITECTURE%"=="x86" (
|
||||||
set "WINDOWS_BITNESS=x86"
|
set "WINDOWS_ARCHITECTURE=x86"
|
||||||
set "XDELTA3_EXE=%~dp0xdelta3-3.0.11-i686.exe"
|
set "XDELTA3_EXE=%~dp0xdelta3-3.0.11-i686.exe"
|
||||||
goto :find_xdelta
|
goto :find_xdelta3
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
goto :unsupported
|
goto :unsupported_os
|
||||||
|
|
||||||
:is_x64
|
:is_x64
|
||||||
set "WINDOWS_BITNESS=x64"
|
set "WINDOWS_ARCHITECTURE=x64"
|
||||||
set "XDELTA3_EXE=%~dp0xdelta3-3.0.11-x86_64.exe"
|
set "XDELTA3_EXE=%~dp0xdelta3-3.0.11-x86_64.exe"
|
||||||
|
|
||||||
:find_xdelta
|
:find_xdelta3
|
||||||
echo.
|
echo.
|
||||||
if not exist "%XDELTA3_EXE%" (
|
if not exist "%XDELTA3_EXE%" (
|
||||||
echo xdelta3 %WINDOWS_BITNESS% not found! Make sure you extracted all the files from
|
call :file_not_found "%XDELTA3_EXE%"
|
||||||
echo the .zip. Make sure both of the xdelta3 .exe files are in the same location
|
|
||||||
echo as %~nx0, and try again.
|
|
||||||
goto :die
|
goto :die
|
||||||
)
|
)
|
||||||
|
|
||||||
wmic /output:stdout os get version | findstr "^6\.1\." >nul && (
|
wmic /output:stdout os get version | findstr "^6\.1\." >nul && (
|
||||||
set "WINDOWS_VER=6.1"
|
set "WINDOWS_VER=6.1"
|
||||||
set "SUPPORTED_HOTFIXES=KB4015552 KB4015549 KB4015546 KB4012218"
|
set "SUPPORTED_HOTFIXES=KB4015552 KB4015549 KB4015546 KB4012218"
|
||||||
echo Detected supported operating system: Windows 7 %WINDOWS_BITNESS%
|
echo Detected supported operating system: Windows 7 %WINDOWS_ARCHITECTURE%
|
||||||
goto :check_hotfix
|
goto :check_hotfix
|
||||||
)
|
)
|
||||||
wmic /output:stdout os get version | findstr "^6\.3\." >nul && (
|
wmic /output:stdout os get version | findstr "^6\.3\." >nul && (
|
||||||
set "WINDOWS_VER=8.1"
|
set "WINDOWS_VER=8.1"
|
||||||
set "SUPPORTED_HOTFIXES=KB4015553 KB4015550 KB4015547 KB4012219"
|
set "SUPPORTED_HOTFIXES=KB4015553 KB4015550 KB4015547 KB4012219"
|
||||||
echo Detected supported operating system: Windows 8.1 %WINDOWS_BITNESS%
|
echo Detected supported operating system: Windows 8.1 %WINDOWS_ARCHITECTURE%
|
||||||
goto :check_hotfix
|
goto :check_hotfix
|
||||||
)
|
)
|
||||||
|
|
||||||
:unsupported
|
:unsupported_os
|
||||||
echo Detected that you are using an unsupported operating system.
|
echo Detected that you are using an unsupported operating system.
|
||||||
echo.
|
echo.
|
||||||
echo This patch only works on the following versions of Windows:
|
echo This patch only works on the following versions of Windows:
|
||||||
@@ -91,12 +91,13 @@ for %%a in (%SUPPORTED_HOTFIXES%) do (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Detected that no supported updates are installed! If you
|
echo Detected that no supported updates are installed! If you are getting
|
||||||
echo are getting unsupported hardware errors in Windows Update, please
|
echo unsupported hardware errors in Windows Update, please create an issue
|
||||||
echo create an issue and post a list of any recently installed
|
echo and I will try to help you out.
|
||||||
echo Windows updates that could have introduced it, and I will try
|
echo.
|
||||||
echo to help you out.
|
|
||||||
echo https://github.com/zeffy/kb4012218-19/issues
|
echo https://github.com/zeffy/kb4012218-19/issues
|
||||||
|
echo.
|
||||||
|
call :show_debug_info
|
||||||
goto :die
|
goto :die
|
||||||
|
|
||||||
:confirmation
|
:confirmation
|
||||||
@@ -138,14 +139,14 @@ goto :ask
|
|||||||
|
|
||||||
:begin
|
:begin
|
||||||
echo.
|
echo.
|
||||||
set "DELTA_FILE=%~dp0patches\Windows%WINDOWS_VER%-%INSTALLED_HOTFIX%-%WINDOWS_BITNESS%-%PATCH_TYPE%.xdelta"
|
set "DELTA_FILE=%~dp0patches\Windows%WINDOWS_VER%-%INSTALLED_HOTFIX%-%WINDOWS_ARCHITECTURE%-%PATCH_TYPE%.xdelta"
|
||||||
set "SYSTEM32_DIR=%systemroot%\System32"
|
if not exist "%DELTA_FILE%" (
|
||||||
set "WUAUENG_DLL=%SYSTEM32_DIR%\wuaueng.dll"
|
call :file_not_found "%DELTA_FILE%"
|
||||||
|
goto :die
|
||||||
for /f "delims=" %%a in ('wmic os get localdatetime ^| find "."') do set dt=%%a
|
)
|
||||||
set "TIMESTAMP=%dt:~0,4%-%dt:~4,2%-%dt:~6,2%_%dt:~8,2%-%dt:~10,2%-%dt:~12,2%"
|
call :set_timestamp_var
|
||||||
set "BACKUP_FILE=%WUAUENG_DLL%_%TIMESTAMP%_%random%_before-%PATCH_TYPE%.bak"
|
set "BACKUP_FILE=%WUAUENG_DLL%_%TIMESTAMP%_before-%PATCH_TYPE%.bak"
|
||||||
set "ACL_TEMP_FILE=%temp%\wuaueng.dll_acl_%TIMESTAMP%_%random%.txt"
|
set "ACL_TEMP_FILE=%temp%\wuaueng.dll_acl_%TIMESTAMP%.txt"
|
||||||
|
|
||||||
net stop wuauserv
|
net stop wuauserv
|
||||||
|
|
||||||
@@ -174,7 +175,10 @@ if defined THERE_WAS_AN_ERROR (
|
|||||||
echo If you didn't screw with the script or anything like that and this
|
echo If you didn't screw with the script or anything like that and this
|
||||||
echo error was unexpected, please create an issue and include the output
|
echo error was unexpected, please create an issue and include the output
|
||||||
echo of this window in your post.
|
echo of this window in your post.
|
||||||
|
echo.
|
||||||
echo https://github.com/zeffy/kb4012218-19/issues
|
echo https://github.com/zeffy/kb4012218-19/issues
|
||||||
|
echo.
|
||||||
|
call :show_debug_info
|
||||||
) else (
|
) else (
|
||||||
echo Successfully %PATCH_TYPE%ed!
|
echo Successfully %PATCH_TYPE%ed!
|
||||||
echo If you want to revert the changes that have been made for whatever
|
echo If you want to revert the changes that have been made for whatever
|
||||||
@@ -185,19 +189,72 @@ if defined THERE_WAS_AN_ERROR (
|
|||||||
echo by renaming it back to wuaueng.dll, changing the owner back to
|
echo by renaming it back to wuaueng.dll, changing the owner back to
|
||||||
echo "NT Service\TrustedInstaller", and restoring the original permissions from
|
echo "NT Service\TrustedInstaller", and restoring the original permissions from
|
||||||
echo '%ACL_TEMP_FILE%'.
|
echo '%ACL_TEMP_FILE%'.
|
||||||
echo However, be careful to make sure you only restore the backup that is the same
|
echo However, make absolutely sure you only restore the backup that is the same
|
||||||
echo version as the current wuaueng.dll, or you could corrupt the WinSxS component
|
echo version as the current wuaueng.dll, or you could corrupt the WinSxS component
|
||||||
echo store.
|
echo store.
|
||||||
)
|
)
|
||||||
|
|
||||||
:die
|
:die
|
||||||
echo.
|
echo.
|
||||||
echo Press any key to close . . .
|
echo Press any key to exit...
|
||||||
pause >nul
|
pause >nul
|
||||||
exit
|
exit
|
||||||
|
|
||||||
:cancel
|
:cancel
|
||||||
echo.
|
echo.
|
||||||
echo Canceled by user input, press any key to close . . .
|
echo Canceled by user, press any key to exit...
|
||||||
pause >nul
|
pause >nul
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
:show_debug_info
|
||||||
|
echo Gathering debugging information, please wait...
|
||||||
|
call :set_timestamp_var
|
||||||
|
set "DEBUG_LOG_FILE=%temp%\%~nx0-debuginfo_%TIMESTAMP%.log"
|
||||||
|
|
||||||
|
echo.>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ^<details^>>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ## Operating System>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ```>>"%DEBUG_LOG_FILE%"
|
||||||
|
wmic os get BuildNumber,Caption,MUILanguages,OSArchitecture,OSLanguage,Version /value | findstr /V "^$" >>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ```>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
|
||||||
|
echo ## Installed Hotfixes>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ```>>"%DEBUG_LOG_FILE%"
|
||||||
|
wmic qfe get HotFixID,InstalledOn /value | findstr /V "^$" >>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ```>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
|
||||||
|
echo ## wuaueng.dll Properties>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ```>>"%DEBUG_LOG_FILE%"
|
||||||
|
certutil -hashfile "%WUAUENG_DLL%" MD5 | find /V "CertUtil" >>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
certutil -hashfile "%WUAUENG_DLL%" SHA1 | find /V "CertUtil" >>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
certutil -hashfile "%WUAUENG_DLL%" SHA256 | find /V "CertUtil" >>"%DEBUG_LOG_FILE%"
|
||||||
|
echo.>>"%DEBUG_LOG_FILE%"
|
||||||
|
|
||||||
|
wmic datafile where "name='%WUAUENG_DLL:\=\\%'" get CreationDate,FileSize,InstallDate,LastAccessed,LastModified,Version /value | findstr /V "^$" >>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ```>>"%DEBUG_LOG_FILE%"
|
||||||
|
echo ^</details^>>>"%DEBUG_LOG_FILE%"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Done! Please copy the text from Notepad into your GitHub issue.
|
||||||
|
echo Opening log file in 5 seconds...
|
||||||
|
timeout /t 5 /nobreak >nul
|
||||||
|
start "" notepad "%DEBUG_LOG_FILE%"
|
||||||
|
exit /b
|
||||||
|
|
||||||
|
:set_timestamp_var
|
||||||
|
for /f "delims=" %%a in ('wmic os get localdatetime ^| find "."') do set dt=%%a
|
||||||
|
set "TIMESTAMP=%dt:~0,4%-%dt:~4,2%-%dt:~6,2%_%dt:~8,2%-%dt:~10,2%-%dt:~12,2%_%dt:~15,6%"
|
||||||
|
exit /b
|
||||||
|
|
||||||
|
:file_not_found
|
||||||
|
echo File "%~1" not found!
|
||||||
|
echo Make sure you extracted all the files from the release .zip and try again.
|
||||||
|
exit /b
|
||||||
|
Reference in New Issue
Block a user