mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-27 17:00:59 +01:00
Initial commit
This commit is contained in:
parent
29a3c23afd
commit
00745079de
31
ExplorerPatcher.sln
Normal file
31
ExplorerPatcher.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31410.357
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExplorerPatcher", "ExplorerPatcher\ExplorerPatcher.vcxproj", "{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Release|x64.Build.0 = Release|x64
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{DED2A41B-0EA8-4D8E-8A02-31A29EF9F91C}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {1D4372C5-52FF-4B30-9C71-5ED6F36C1966}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
157
ExplorerPatcher/ExplorerPatcher.vcxproj
Normal file
157
ExplorerPatcher/ExplorerPatcher.vcxproj
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="resource.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{ded2a41b-0ea8-4d8e-8a02-31a29ef9f91c}</ProjectGuid>
|
||||||
|
<RootNamespace>ExplorerPatcher</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
32
ExplorerPatcher/ExplorerPatcher.vcxproj.filters
Normal file
32
ExplorerPatcher/ExplorerPatcher.vcxproj.filters
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="resource.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="resource.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
254
ExplorerPatcher/main.c
Normal file
254
ExplorerPatcher/main.c
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
#pragma comment(linker,"\"/manifestdependency:type='win32' \
|
||||||
|
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
|
||||||
|
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <tlhelp32.h>
|
||||||
|
#include <Psapi.h>
|
||||||
|
|
||||||
|
#define APP_NAME TEXT("Windows Explorer")
|
||||||
|
#define NOP 0x90
|
||||||
|
#define PATCH_OFFSET 0x8cb33
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-administrative-rights
|
||||||
|
BOOL IsElevated() {
|
||||||
|
BOOL fRet = FALSE;
|
||||||
|
HANDLE hToken = NULL;
|
||||||
|
if (OpenProcessToken(
|
||||||
|
GetCurrentProcess(),
|
||||||
|
TOKEN_QUERY,
|
||||||
|
&hToken
|
||||||
|
))
|
||||||
|
{
|
||||||
|
TOKEN_ELEVATION Elevation;
|
||||||
|
DWORD cbSize = sizeof(TOKEN_ELEVATION);
|
||||||
|
if (GetTokenInformation(
|
||||||
|
hToken,
|
||||||
|
TokenElevation,
|
||||||
|
&Elevation,
|
||||||
|
sizeof(Elevation),
|
||||||
|
&cbSize
|
||||||
|
)) {
|
||||||
|
fRet = Elevation.TokenIsElevated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hToken) {
|
||||||
|
CloseHandle(hToken);
|
||||||
|
}
|
||||||
|
return fRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
int install_uninstall()
|
||||||
|
{
|
||||||
|
TCHAR buffer[200], szFileName[MAX_PATH], szReadName[MAX_PATH] = { 0 };
|
||||||
|
HKEY hKey;
|
||||||
|
DWORD dwReadBytes;
|
||||||
|
|
||||||
|
if (IsElevated())
|
||||||
|
{
|
||||||
|
dwReadBytes = MAX_PATH;
|
||||||
|
GetModuleFileName(NULL, szFileName, MAX_PATH);
|
||||||
|
if (RegOpenKeyEx(
|
||||||
|
HKEY_LOCAL_MACHINE,
|
||||||
|
TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"),
|
||||||
|
0,
|
||||||
|
KEY_READ | KEY_SET_VALUE,
|
||||||
|
&hKey
|
||||||
|
) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
goto error_setup;
|
||||||
|
}
|
||||||
|
RegGetValue(
|
||||||
|
hKey,
|
||||||
|
NULL,
|
||||||
|
TEXT("Taskman"),
|
||||||
|
RRF_RT_REG_SZ,
|
||||||
|
NULL,
|
||||||
|
szReadName,
|
||||||
|
(LPDWORD)(&dwReadBytes)
|
||||||
|
);
|
||||||
|
if (!wcscmp(szFileName, szReadName))
|
||||||
|
{
|
||||||
|
if (RegDeleteValue(
|
||||||
|
hKey,
|
||||||
|
TEXT("Taskman")
|
||||||
|
) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
goto error_setup;
|
||||||
|
}
|
||||||
|
MessageBox(
|
||||||
|
0,
|
||||||
|
TEXT("Uninstall successful."),
|
||||||
|
APP_NAME,
|
||||||
|
MB_ICONINFORMATION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (RegSetValueEx(
|
||||||
|
hKey,
|
||||||
|
TEXT("Taskman"),
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
(const BYTE*)szFileName, (DWORD)(
|
||||||
|
#ifdef UNICODE
|
||||||
|
wcslen(szFileName)
|
||||||
|
#else
|
||||||
|
strlen(szFileName)
|
||||||
|
#endif
|
||||||
|
* sizeof(TCHAR))
|
||||||
|
) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
goto error_setup;
|
||||||
|
}
|
||||||
|
MessageBox(
|
||||||
|
0,
|
||||||
|
TEXT("Successfully installed Taskman registry key."),
|
||||||
|
APP_NAME,
|
||||||
|
MB_ICONINFORMATION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
error_setup:
|
||||||
|
#ifdef UNICODE
|
||||||
|
swprintf(buffer, 200,
|
||||||
|
#else
|
||||||
|
sprintf(buffer,
|
||||||
|
#endif
|
||||||
|
TEXT("An error occured when servicing the product (%d)."), GetLastError());
|
||||||
|
MessageBox(
|
||||||
|
0,
|
||||||
|
buffer,
|
||||||
|
APP_NAME,
|
||||||
|
MB_ICONERROR
|
||||||
|
);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int WINAPI wWinMain(
|
||||||
|
_In_ HINSTANCE hInstance,
|
||||||
|
_In_opt_ HINSTANCE hPrevInstance,
|
||||||
|
_In_ LPWSTR lpCmdLine,
|
||||||
|
_In_ int nShowCmd
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HANDLE hExplorer, hSnapshot;
|
||||||
|
DWORD dwExplorerPID = 0, dwOldValue;
|
||||||
|
SIZE_T dwNumberOfBytes;
|
||||||
|
uintptr_t dwInjectedAddr = 0;
|
||||||
|
const char szPayload[6] = { NOP, NOP, NOP, NOP, NOP, NOP };
|
||||||
|
PROCESSENTRY32 pe32 = { 0 };
|
||||||
|
MODULEENTRY32 me32 = { 0 };
|
||||||
|
THREADENTRY32 th32 = { 0 };
|
||||||
|
TCHAR szExplorerPath[MAX_PATH];
|
||||||
|
|
||||||
|
if (install_uninstall())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||||||
|
hSnapshot = CreateToolhelp32Snapshot(
|
||||||
|
TH32CS_SNAPPROCESS,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
if (Process32First(hSnapshot, &pe32) == TRUE)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (!wcscmp(pe32.szExeFile, TEXT("explorer.exe")))
|
||||||
|
{
|
||||||
|
dwExplorerPID = pe32.th32ProcessID;
|
||||||
|
DebugActiveProcess(dwExplorerPID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (Process32Next(hSnapshot, &pe32) == TRUE);
|
||||||
|
}
|
||||||
|
CloseHandle(hSnapshot);
|
||||||
|
if (!dwExplorerPID)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((hExplorer = OpenProcess(
|
||||||
|
PROCESS_VM_READ |
|
||||||
|
PROCESS_VM_WRITE |
|
||||||
|
PROCESS_QUERY_INFORMATION |
|
||||||
|
PROCESS_VM_OPERATION |
|
||||||
|
SYNCHRONIZE,
|
||||||
|
FALSE,
|
||||||
|
dwExplorerPID
|
||||||
|
)) != NULL && GetModuleFileNameEx(
|
||||||
|
hExplorer,
|
||||||
|
NULL,
|
||||||
|
szExplorerPath,
|
||||||
|
sizeof(szExplorerPath)
|
||||||
|
))
|
||||||
|
{
|
||||||
|
CharLower(szExplorerPath);
|
||||||
|
me32.dwSize = sizeof(MODULEENTRY32);
|
||||||
|
hSnapshot = CreateToolhelp32Snapshot(
|
||||||
|
TH32CS_SNAPMODULE,
|
||||||
|
dwExplorerPID
|
||||||
|
);
|
||||||
|
if (Module32First(hSnapshot, &me32) == TRUE)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (!wcscmp(CharLower(me32.szExePath), szExplorerPath))
|
||||||
|
{
|
||||||
|
dwInjectedAddr = (uintptr_t)me32.modBaseAddr + PATCH_OFFSET;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (Module32Next(hSnapshot, &me32) == TRUE);
|
||||||
|
}
|
||||||
|
CloseHandle(hSnapshot);
|
||||||
|
|
||||||
|
if (dwInjectedAddr)
|
||||||
|
{
|
||||||
|
VirtualProtectEx(
|
||||||
|
hExplorer,
|
||||||
|
(LPVOID)dwInjectedAddr,
|
||||||
|
sizeof(szPayload),
|
||||||
|
PAGE_EXECUTE_READWRITE,
|
||||||
|
&dwOldValue
|
||||||
|
);
|
||||||
|
WriteProcessMemory(
|
||||||
|
hExplorer,
|
||||||
|
(LPVOID)dwInjectedAddr,
|
||||||
|
szPayload,
|
||||||
|
sizeof(szPayload),
|
||||||
|
&dwNumberOfBytes
|
||||||
|
);
|
||||||
|
VirtualProtectEx(
|
||||||
|
hExplorer,
|
||||||
|
(LPVOID)dwInjectedAddr,
|
||||||
|
sizeof(szPayload),
|
||||||
|
dwOldValue,
|
||||||
|
(PDWORD)(&dwNumberOfBytes)
|
||||||
|
);
|
||||||
|
DebugActiveProcessStop(dwExplorerPID);
|
||||||
|
/*
|
||||||
|
WaitForSingleObject(
|
||||||
|
hExplorer,
|
||||||
|
INFINITE
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
CloseHandle(hExplorer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugActiveProcessStop(dwExplorerPID);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
14
ExplorerPatcher/resource.h
Normal file
14
ExplorerPatcher/resource.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ generated include file.
|
||||||
|
// Used by resource.rc
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
100
ExplorerPatcher/resource.rc
Normal file
100
ExplorerPatcher/resource.rc
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
// Microsoft Visual C++ generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "winres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// English (United States) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
#pragma code_page(1252)
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"#include ""winres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 22000,1,0,0
|
||||||
|
PRODUCTVERSION 22000,1,0,0
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "VALINET Solutions SRL"
|
||||||
|
VALUE "FileDescription", "Explorer Patcher"
|
||||||
|
VALUE "FileVersion", "22000.1.0.0"
|
||||||
|
VALUE "InternalName", "Explorer.exe"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
|
||||||
|
VALUE "OriginalFilename", "Explorer.exe"
|
||||||
|
VALUE "ProductName", "Explorer Patcher"
|
||||||
|
VALUE "ProductVersion", "22000.1.0.0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (United States) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
12
README.md
12
README.md
@ -1,2 +1,10 @@
|
|||||||
# ExplorerPatcher
|
# Explorer Patcher
|
||||||
ExplorerPatcher allows using the old taskbar in Windows 11 without the side effects of UndockingDisabled.
|
Explorer Patcher is a patcher that enables various stuff in Explorer. For the moment, it includes the following:
|
||||||
|
|
||||||
|
* allows using the old taskbar in Windows 11 without the side effects of UndockingDisabled and with fully working search, modern apps showing properly, screen snip still working etc
|
||||||
|
|
||||||
|
A detailed description of how this works is available on my web site [here](https://valinet.ro/2021/08/09/Restore-Windows-11-to-working-Windows-10-UI.html).
|
||||||
|
|
||||||
|
Precompiled binaries are available in [Releases](https://github.com/valinet/ExplorerPatcher/releases).
|
||||||
|
|
||||||
|
To install, save the executable in a safe directory, run it once as an administrator to have it register as [Taskman](https://www.geoffchappell.com/notes/windows/shell/explorer/taskman.htm) for Explorer and just restart Explorer or reboot.
|
||||||
|
Loading…
Reference in New Issue
Block a user