diff --git a/README.md b/README.md index 67e48e0..560e719 100644 --- a/README.md +++ b/README.md @@ -34,19 +34,17 @@ My patch takes advantage of this result caching behavior by setting the "hasn't - **No system files are modified!** - Heuristic-based patching, which means it will usually keep working even after updates. - C is best language. -- No external dependencies except for Microsoft Visual C++ 2017 Redistributable. +- No external dependencies. ### How to install/uninstall? Just download the [latest release](../../releases/latest), and extract the `wufuc` folder to a permanent location (like `C:\Program Files\wufuc`) and then 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.{72EEE38B-9997-42BD-85D3-2DD96DA17307}` task, then restart your computer. +To uninstall run `uninstall_wufuc.bat` as administrator. ### 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 revert any changes made to `wuaueng.dll`. +I've included a utility script called `repair_wuaueng.dll.bat`. When you run it, it will initiate an `sfc` scan and revert any changes made to `wuaueng.dll`. ### How to see wufuc's debugging message output? @@ -54,9 +52,7 @@ You will need to download [DebugView](https://technet.microsoft.com/en-us/sysint The best way to get a log of the entire life-cycle of wufuc is to do the following: -1. Disable wufuc in Task Scheduler. -2. Restart your computer. -3. Start `Dbgview.exe` as administrator and check `Capture -> Capture Global Win32`. -4. Enable wufuc in Task Scheduler. -5. Run wufuc in Task Scheduler. -6. Output will be shown in DebugView. +1. Disable wufuc by running `disable_wufuc.bat` as administrator. +2. Start `Dbgview.exe` as administrator and check `Capture -> Capture Global Win32`. +3. Enable wufuc by running `enable_wufuc.bat` as administrator. +4. Output will be shown in DebugView. diff --git a/install/install_wufuc.bat b/install/install_wufuc.bat index f58dc4f..010a54e 100644 --- a/install/install_wufuc.bat +++ b/install/install_wufuc.bat @@ -1,5 +1,5 @@ @echo off -title wufuc installer - v0.6.0.1 +title wufuc installer :: Copyright (C) 2017 zeffy :: This program is free software: you can redistribute it and/or modify @@ -47,6 +47,9 @@ goto :unsupported_os set "WINDOWS_ARCHITECTURE=x64" set "wufuc_dll=%~dp0wufuc64.dll" +for /f "tokens=*" %%i in ('wmic /output:stdout datafile where "name='%wufuc_dll:\=\\%'" get Version /value ^| find "="') do set "%%i" +title wufuc installer - v%Version% + :check_ver wmic /output:stdout os get version | findstr "^6\.1\." >nul && ( set "WINDOWS_VER=6.1" diff --git a/install/uninstall_wufuc.bat b/install/uninstall_wufuc.bat index 119fd04..ca92e0c 100644 --- a/install/uninstall_wufuc.bat +++ b/install/uninstall_wufuc.bat @@ -1,5 +1,5 @@ @echo off -title wufuc uninstaller - v0.6.0.1 +title wufuc uninstaller :: Copyright (C) 2017 zeffy :: This program is free software: you can redistribute it and/or modify @@ -45,12 +45,14 @@ goto :die set "WINDOWS_ARCHITECTURE=x64" set "wufuc_dll=%~dp0wufuc64.dll" +for /f "tokens=*" %%i in ('wmic /output:stdout datafile where "name='%wufuc_dll:\=\\%'" get Version /value ^| find "="') do set "%%i" +title wufuc uninstaller - v%Version% + :confirmation set /p CONTINUE=Enter 'Y' if you want to uninstall wufuc: if /I not "%CONTINUE%"=="Y" goto :cancel echo. -:uninstall set "wufuc_task=wufuc.{72EEE38B-9997-42BD-85D3-2DD96DA17307}" rundll32 "%wufuc_dll%",Rundll32Unload schtasks /Delete /TN "%wufuc_task%" /F diff --git a/install/utility scripts/disable_wufuc.bat b/install/utility scripts/disable_wufuc.bat new file mode 100644 index 0000000..b668803 --- /dev/null +++ b/install/utility scripts/disable_wufuc.bat @@ -0,0 +1,70 @@ +@echo off +title wufuc utility - disable task +:: 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 . + +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 +) + +if /I "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( + goto :is_x64 +) else ( + if /I "%PROCESSOR_ARCHITEW6432%"=="AMD64" ( + goto :is_x64 + ) + if /I "%PROCESSOR_ARCHITECTURE%"=="x86" ( + set "WINDOWS_ARCHITECTURE=x86" + set "wufuc_dll=%~dp0wufuc32.dll" + goto :confirmation + ) +) +goto :die + +:is_x64 +set "WINDOWS_ARCHITECTURE=x64" +set "wufuc_dll=%~dp0..\wufuc64.dll" + +:confirmation +set /p CONTINUE=Enter 'Y' if you want to disable wufuc: +if /I not "%CONTINUE%"=="Y" goto :cancel +echo. + +set "wufuc_task=wufuc.{72EEE38B-9997-42BD-85D3-2DD96DA17307}" +rundll32 "%wufuc_dll%",Rundll32Unload +schtasks /Change /TN "%wufuc_task%" /DISABLE + +echo. +echo Disabled wufuc! The patch will remain active until you restart. + +: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 diff --git a/install/utility scripts/enable_wufuc.bat b/install/utility scripts/enable_wufuc.bat new file mode 100644 index 0000000..8c682ba --- /dev/null +++ b/install/utility scripts/enable_wufuc.bat @@ -0,0 +1,51 @@ +@echo off +title wufuc utility - enable task +:: 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 . + +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 +) + +set /p CONTINUE=Enter 'Y' if you want to enable wufuc: +if /I not "%CONTINUE%"=="Y" goto :cancel +echo. + +set "wufuc_task=wufuc.{72EEE38B-9997-42BD-85D3-2DD96DA17307}" +schtasks /Change /TN "%wufuc_task%" /ENABLE +schtasks /Run /TN "%wufuc_task%" + +echo. +echo Enabled and started wufuc! + +: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 diff --git a/install/repair_wuaueng.dll.bat b/install/utility scripts/repair_wuaueng.dll.bat similarity index 95% rename from install/repair_wuaueng.dll.bat rename to install/utility scripts/repair_wuaueng.dll.bat index 4fc7525..b06eadd 100644 --- a/install/repair_wuaueng.dll.bat +++ b/install/utility scripts/repair_wuaueng.dll.bat @@ -1,5 +1,5 @@ @echo off -title install wufuc ^(repair wuaueng.dll^) - v0.6.0.1 +title wufuc utility - repair wuaueng.dll :: Copyright (C) 2017 zeffy :: This program is free software: you can redistribute it and/or modify @@ -27,7 +27,6 @@ fltmc >nul 2>&1 || ( 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. diff --git a/install/wufuc64.dll b/install/wufuc64.dll new file mode 100644 index 0000000..4709945 Binary files /dev/null and b/install/wufuc64.dll differ diff --git a/wufuc/util.c b/wufuc/util.c index 1e17082..3f3a200 100644 --- a/wufuc/util.c +++ b/wufuc/util.c @@ -5,18 +5,6 @@ #include #include "util.h" -BOOL IsWindows7Or8Point1(void) { - return IsWindows7() || IsWindows8Point1(); -} - -BOOL IsWindows7(void) { - return IsWindows7OrGreater() && !IsWindows8OrGreater(); -} - -BOOL IsWindows8Point1(void) { - return IsWindows8Point1OrGreater() && !IsWindows10OrGreater(); -} - VOID DetourIAT(HMODULE hModule, LPSTR lpFuncName, LPVOID *lpOldAddress, LPVOID lpNewAddress) { LPVOID *lpAddress = FindIAT(hModule, lpFuncName); if (!lpAddress || *lpAddress == lpNewAddress) { @@ -145,6 +133,18 @@ VOID ResumeAndCloseThreads(HANDLE *lphThreads, SIZE_T cb) { _tdbgprintf(_T("Resumed threads.")); } +BOOL IsWindows7Or8Point1(void) { + return IsWindows7() || IsWindows8Point1(); +} + +BOOL IsWindows7(void) { + return IsWindows7OrGreater() && !IsWindows8OrGreater(); +} + +BOOL IsWindows8Point1(void) { + return IsWindows8Point1OrGreater() && !IsWindows10OrGreater(); +} + VOID _wdbgprintf(LPCWSTR format, ...) { WCHAR buffer[0x1000]; va_list argptr; diff --git a/wufuc/util.h b/wufuc/util.h index 28cf5f8..15cb760 100644 --- a/wufuc/util.h +++ b/wufuc/util.h @@ -3,12 +3,6 @@ EXTERN_C IMAGE_DOS_HEADER __ImageBase; #define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase) -BOOL IsWindows7Or8Point1(void); - -BOOL IsWindows7(void); - -BOOL IsWindows8Point1(void); - VOID DetourIAT(HMODULE hModule, LPSTR lpFuncName, LPVOID *lpOldAddress, LPVOID lpNewAddress); #define DETOUR_IAT(x, y) \ @@ -28,6 +22,12 @@ VOID SuspendProcessThreads(DWORD dwProcessId, DWORD dwThreadId, HANDLE *lphThrea VOID ResumeAndCloseThreads(HANDLE *lphThreads, SIZE_T dwSize); +BOOL IsWindows7Or8Point1(void); + +BOOL IsWindows7(void); + +BOOL IsWindows8Point1(void); + VOID _wdbgprintf(LPCWSTR format, ...); VOID _dbgprintf(LPCSTR format, ...); //#ifdef _DEBUG diff --git a/wufuc/version.rc b/wufuc/version.rc index 16de7ec..7166805 100644 Binary files a/wufuc/version.rc and b/wufuc/version.rc differ