mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-02-17 11:08:41 +01:00
Moved ep_dwm as separate executable
This commit is contained in:
parent
aa4803ce73
commit
e5c4e8bf02
@ -12,6 +12,7 @@ EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_setup", "ep_setup\ep_setup.vcxproj", "{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9} = {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}
|
||||
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87} = {1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_setup_patch", "ep_setup_patch\ep_setup_patch.vcxproj", "{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}"
|
||||
@ -19,6 +20,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_setup_patch", "ep_setup_
|
||||
{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF} = {2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_dwm", "ep_dwm\ep_dwm\ep_dwm.vcxproj", "{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|amd64 = Debug|amd64
|
||||
@ -59,6 +62,12 @@ Global
|
||||
{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|amd64.ActiveCfg = Release|x64
|
||||
{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|amd64.Build.0 = Release|x64
|
||||
{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|IA-32.ActiveCfg = Release|Win32
|
||||
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|amd64.ActiveCfg = Debug|x64
|
||||
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|amd64.Build.0 = Debug|x64
|
||||
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|IA-32.ActiveCfg = Debug|x64
|
||||
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|amd64.ActiveCfg = Release|x64
|
||||
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|amd64.Build.0 = Release|x64
|
||||
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|IA-32.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -201,14 +201,6 @@
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\ep_dwm\ep_dwm\ep_dwm.c">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EP_DWM_NO_DLLMAIN;EP_DWM_NO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">EP_DWM_NO_DLLMAIN;EP_DWM_NO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EP_DWM_NO_DLLMAIN;EP_DWM_NO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">EP_DWM_NO_DLLMAIN;EP_DWM_NO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_error.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@ -300,7 +292,6 @@
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\ep_dwm\ep_dwm\ep_dwm.h" />
|
||||
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_def.h" />
|
||||
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_error.h" />
|
||||
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_IconPainter.h" />
|
||||
@ -315,6 +306,7 @@
|
||||
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_WindowSwitcherLayoutWindow.h" />
|
||||
<ClInclude Include="..\version.h" />
|
||||
<ClInclude Include="ArchiveMenu.h" />
|
||||
<ClInclude Include="def.h" />
|
||||
<ClInclude Include="dxgi_imp.h" />
|
||||
<ClInclude Include="fmemopen.h" />
|
||||
<ClInclude Include="getline.h" />
|
||||
|
@ -28,12 +28,6 @@
|
||||
<Filter Include="Settings">
|
||||
<UniqueIdentifier>{190d08ad-4a1d-4b58-81a1-6403eeb3cd2a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\ep_dwm">
|
||||
<UniqueIdentifier>{50a6ac61-12c4-460e-a9d1-cdaf9bf7e7b1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\ep_dwm">
|
||||
<UniqueIdentifier>{fd25654b-7123-401a-86c7-90413d703f30}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h">
|
||||
@ -129,8 +123,8 @@
|
||||
<ClInclude Include="..\libs\sws\SimpleWindowSwitcher\sws_IconPainter.h">
|
||||
<Filter>Header Files\sws</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ep_dwm\ep_dwm\ep_dwm.h">
|
||||
<Filter>Header Files\ep_dwm</Filter>
|
||||
<ClInclude Include="def.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -211,9 +205,6 @@
|
||||
<ClCompile Include="..\libs\sws\SimpleWindowSwitcher\sws_tshwnd.c">
|
||||
<Filter>Source Files\sws</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ep_dwm\ep_dwm\ep_dwm.c">
|
||||
<Filter>Source Files\ep_dwm</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="settings.reg">
|
||||
|
@ -327,101 +327,7 @@ LSTATUS GUI_Internal_RegSetValueExW(
|
||||
}
|
||||
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_DisableRoundedCorners"))
|
||||
{
|
||||
WCHAR wszPath[MAX_PATH];
|
||||
GetSystemDirectoryW(wszPath, MAX_PATH);
|
||||
wcscat_s(wszPath, MAX_PATH, L"\\cmd.exe");
|
||||
|
||||
WCHAR wszSCPath[MAX_PATH];
|
||||
GetSystemDirectoryW(wszSCPath, MAX_PATH);
|
||||
wcscat_s(wszSCPath, MAX_PATH, L"\\sc.exe");
|
||||
|
||||
WCHAR wszRundll32[MAX_PATH];
|
||||
GetSystemDirectoryW(wszRundll32, MAX_PATH);
|
||||
wcscat_s(wszRundll32, MAX_PATH, L"\\rundll32.exe");
|
||||
|
||||
WCHAR wszEP[MAX_PATH];
|
||||
GetWindowsDirectoryW(wszEP, MAX_PATH);
|
||||
wcscat_s(wszEP, MAX_PATH, L"\\dxgi.dll");
|
||||
|
||||
WCHAR wszTaskkill[MAX_PATH];
|
||||
GetSystemDirectoryW(wszTaskkill, MAX_PATH);
|
||||
wcscat_s(wszTaskkill, MAX_PATH, L"\\taskkill.exe");
|
||||
|
||||
WCHAR wszArgumentsRegister[MAX_PATH * 10];
|
||||
swprintf_s(
|
||||
wszArgumentsRegister,
|
||||
MAX_PATH * 10,
|
||||
L"/c \""
|
||||
L"\"%s\" create ep_dwm_" _T(EP_CLSID_LITE) L" binPath= \"\\\"%s\\\" \\\"%s\\\",ZZDWM\" DisplayName= \"ExplorerPatcher Desktop Window Manager Service\" start= auto & "
|
||||
L"\"%s\" description ep_dwm_" _T(EP_CLSID_LITE) L" \"Implements functionality to disable rounded corners for windows\" & "
|
||||
L"\"%s\" start ep_dwm_" _T(EP_CLSID_LITE)
|
||||
L"\"",
|
||||
wszSCPath,
|
||||
wszRundll32,
|
||||
wszEP,
|
||||
wszSCPath,
|
||||
wszSCPath
|
||||
);
|
||||
WCHAR wszArgumentsUnRegister[MAX_PATH * 10];
|
||||
swprintf_s(
|
||||
wszArgumentsUnRegister,
|
||||
MAX_PATH * 10,
|
||||
L"/c \""
|
||||
L"\"%s\" stop ep_dwm_" _T(EP_CLSID_LITE) L" & "
|
||||
L"\"%s\" delete ep_dwm_" _T(EP_CLSID_LITE) L" & "
|
||||
L"\"",
|
||||
wszSCPath,
|
||||
wszSCPath
|
||||
);
|
||||
wprintf(L"%s\n", wszArgumentsRegister);
|
||||
|
||||
BOOL bAreRoundedCornersDisabled = FALSE;
|
||||
HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, L"Global\\ep_dwm_" _T(EP_CLSID));
|
||||
if (h_exists)
|
||||
{
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
bAreRoundedCornersDisabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bAreRoundedCornersDisabled = FALSE;
|
||||
}
|
||||
CloseHandle(h_exists);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetLastError() == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
bAreRoundedCornersDisabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bAreRoundedCornersDisabled = FALSE;
|
||||
}
|
||||
}
|
||||
if ((bAreRoundedCornersDisabled && *(DWORD*)lpData) || (!bAreRoundedCornersDisabled && !*(DWORD*)lpData))
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
SHELLEXECUTEINFO ShExecInfo = { 0 };
|
||||
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
|
||||
ShExecInfo.hwnd = NULL;
|
||||
ShExecInfo.lpVerb = L"runas";
|
||||
ShExecInfo.lpFile = wszPath;
|
||||
ShExecInfo.lpParameters = !bAreRoundedCornersDisabled ? wszArgumentsRegister : wszArgumentsUnRegister;
|
||||
ShExecInfo.lpDirectory = NULL;
|
||||
ShExecInfo.nShow = SW_HIDE;
|
||||
ShExecInfo.hInstApp = NULL;
|
||||
if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)
|
||||
{
|
||||
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
|
||||
DWORD dwExitCode = 0;
|
||||
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
|
||||
CloseHandle(ShExecInfo.hProcess);
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
return RegisterDWMService(*(DWORD*)lpData, 0);
|
||||
}
|
||||
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_RegisterAsShellExtension"))
|
||||
{
|
||||
@ -612,7 +518,7 @@ LSTATUS GUI_Internal_RegQueryValueExW(
|
||||
}
|
||||
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_DisableRoundedCorners"))
|
||||
{
|
||||
HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, L"Global\\ep_dwm_" _T(EP_CLSID));
|
||||
HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, _T(EP_DWM_EVENTNAME));
|
||||
if (h_exists)
|
||||
{
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
|
21
ExplorerPatcher/def.h
Normal file
21
ExplorerPatcher/def.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef _H_DEF_H_
|
||||
#define _H_DEF_H_
|
||||
#define APPID L"Microsoft.Windows.Explorer"
|
||||
#define REGPATH "SOFTWARE\\ExplorerPatcher"
|
||||
#define REGPATH_OLD "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher"
|
||||
#define REGPATH_STARTMENU REGPATH_OLD
|
||||
#define SPECIAL_FOLDER CSIDL_PROGRAM_FILES
|
||||
#define SPECIAL_FOLDER_LEGACY CSIDL_APPDATA
|
||||
#define PRODUCT_NAME "ExplorerPatcher"
|
||||
#define PRODUCT_PUBLISHER "VALINET Solutions SRL"
|
||||
#define APP_RELATIVE_PATH "\\" PRODUCT_NAME
|
||||
#define EP_CLSID_LITE "D17F1E1A-5919-4427-8F89-A1A8503CA3EB"
|
||||
#define EP_CLSID "{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}"
|
||||
#define DOSMODE_OFFSET 78
|
||||
#define SETUP_UTILITY_NAME "ep_setup.exe"
|
||||
#define TOAST_BUFSIZ 1024
|
||||
#define SEH_REGPATH "Control Panel\\Quick Actions\\Control Center\\QuickActionsStateCapture\\ExplorerPatcher"
|
||||
#define EP_SETUP_HELPER_SWITCH "/CreateExplorerShellUnelevatedAfterServicing"
|
||||
#define EP_DWM_SERVICENAME "ep_dwm_" EP_CLSID_LITE
|
||||
#define EP_DWM_EVENTNAME "Global\\ep_dwm_2_" EP_CLSID_LITE
|
||||
#endif
|
@ -162,13 +162,6 @@ HRESULT WINAPI _DllGetClassObject(
|
||||
REFIID riid,
|
||||
LPVOID* ppv
|
||||
);
|
||||
#ifdef _WIN64
|
||||
BOOL ep_dwm_StartService(LPWSTR wszServiceName, LPWSTR wszEventName);
|
||||
__declspec(dllexport) int ZZDWM(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
ep_dwm_StartService(L"ep_dwm_Service_" _T(EP_CLSID), L"Global\\ep_dwm_" _T(EP_CLSID));
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma region "Updates"
|
||||
#ifdef _WIN64
|
||||
|
@ -681,3 +681,111 @@ void ToggleTaskbarAutohide()
|
||||
SHAppBarMessage(ABM_SETSTATE, &abd);
|
||||
}
|
||||
}
|
||||
|
||||
LSTATUS RegisterDWMService(DWORD dwDesiredState, DWORD dwOverride)
|
||||
{
|
||||
WCHAR wszPath[MAX_PATH];
|
||||
GetSystemDirectoryW(wszPath, MAX_PATH);
|
||||
wcscat_s(wszPath, MAX_PATH, L"\\cmd.exe");
|
||||
|
||||
WCHAR wszSCPath[MAX_PATH];
|
||||
GetSystemDirectoryW(wszSCPath, MAX_PATH);
|
||||
wcscat_s(wszSCPath, MAX_PATH, L"\\sc.exe");
|
||||
|
||||
WCHAR wszRundll32[MAX_PATH];
|
||||
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszRundll32);
|
||||
wcscat_s(wszRundll32, MAX_PATH, _T(APP_RELATIVE_PATH));
|
||||
wcscat_s(wszRundll32, MAX_PATH, L"\\ep_dwm.exe");
|
||||
|
||||
WCHAR wszEP[MAX_PATH];
|
||||
GetWindowsDirectoryW(wszEP, MAX_PATH);
|
||||
wcscat_s(wszEP, MAX_PATH, L"\\dxgi.dll");
|
||||
|
||||
WCHAR wszTaskkill[MAX_PATH];
|
||||
GetSystemDirectoryW(wszTaskkill, MAX_PATH);
|
||||
wcscat_s(wszTaskkill, MAX_PATH, L"\\taskkill.exe");
|
||||
|
||||
WCHAR wszArgumentsRegister[MAX_PATH * 10];
|
||||
swprintf_s(
|
||||
wszArgumentsRegister,
|
||||
MAX_PATH * 10,
|
||||
L"/c \""
|
||||
L"\"%s\" create " _T(EP_DWM_SERVICENAME) L" binPath= \"\\\"%s\\\" %s\" DisplayName= \"ExplorerPatcher Desktop Window Manager Service\" start= auto & "
|
||||
L"\"%s\" description " _T(EP_DWM_SERVICENAME) L" \"Service for managing aspects related to the Desktop Window Manager.\" & "
|
||||
L"\"%s\" %s " _T(EP_DWM_SERVICENAME)
|
||||
L"\"",
|
||||
wszSCPath,
|
||||
wszRundll32,
|
||||
_T(EP_DWM_SERVICENAME) L" " _T(EP_DWM_EVENTNAME),
|
||||
wszSCPath,
|
||||
wszSCPath,
|
||||
(!dwOverride || dwOverride == 3) ? L"start" : L"query"
|
||||
);
|
||||
WCHAR wszArgumentsUnRegister[MAX_PATH * 10];
|
||||
swprintf_s(
|
||||
wszArgumentsUnRegister,
|
||||
MAX_PATH * 10,
|
||||
L"/c \""
|
||||
L"\"%s\" stop " _T(EP_DWM_SERVICENAME) L" & "
|
||||
L"\"%s\" delete " _T(EP_DWM_SERVICENAME) L" & "
|
||||
L"\"",
|
||||
wszSCPath,
|
||||
wszSCPath
|
||||
);
|
||||
wprintf(L"%s\n", wszArgumentsRegister);
|
||||
|
||||
BOOL bAreRoundedCornersDisabled = FALSE;
|
||||
if (dwOverride)
|
||||
{
|
||||
bAreRoundedCornersDisabled = !(dwOverride - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, _T(EP_DWM_EVENTNAME));
|
||||
if (h_exists)
|
||||
{
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
bAreRoundedCornersDisabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bAreRoundedCornersDisabled = FALSE;
|
||||
}
|
||||
CloseHandle(h_exists);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetLastError() == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
bAreRoundedCornersDisabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bAreRoundedCornersDisabled = FALSE;
|
||||
}
|
||||
}
|
||||
if ((bAreRoundedCornersDisabled && dwDesiredState) || (!bAreRoundedCornersDisabled && !dwDesiredState))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
SHELLEXECUTEINFO ShExecInfo = { 0 };
|
||||
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
|
||||
ShExecInfo.hwnd = NULL;
|
||||
ShExecInfo.lpVerb = L"runas";
|
||||
ShExecInfo.lpFile = wszPath;
|
||||
ShExecInfo.lpParameters = !bAreRoundedCornersDisabled ? wszArgumentsRegister : wszArgumentsUnRegister;
|
||||
ShExecInfo.lpDirectory = NULL;
|
||||
ShExecInfo.nShow = SW_HIDE;
|
||||
ShExecInfo.hInstApp = NULL;
|
||||
if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)
|
||||
{
|
||||
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
|
||||
DWORD dwExitCode = 0;
|
||||
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
|
||||
CloseHandle(ShExecInfo.hProcess);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
@ -19,22 +19,7 @@
|
||||
#include "queryversion.h"
|
||||
#pragma comment(lib, "Psapi.lib")
|
||||
|
||||
#define APPID L"Microsoft.Windows.Explorer"
|
||||
#define REGPATH "SOFTWARE\\ExplorerPatcher"
|
||||
#define REGPATH_OLD "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher"
|
||||
#define REGPATH_STARTMENU REGPATH_OLD
|
||||
#define SPECIAL_FOLDER CSIDL_PROGRAM_FILES
|
||||
#define SPECIAL_FOLDER_LEGACY CSIDL_APPDATA
|
||||
#define PRODUCT_NAME "ExplorerPatcher"
|
||||
#define PRODUCT_PUBLISHER "VALINET Solutions SRL"
|
||||
#define APP_RELATIVE_PATH "\\" PRODUCT_NAME
|
||||
#define EP_CLSID_LITE "D17F1E1A-5919-4427-8F89-A1A8503CA3EB"
|
||||
#define EP_CLSID "{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}"
|
||||
#define DOSMODE_OFFSET 78
|
||||
#define SETUP_UTILITY_NAME "ep_setup.exe"
|
||||
#define TOAST_BUFSIZ 1024
|
||||
#define SEH_REGPATH "Control Panel\\Quick Actions\\Control Center\\QuickActionsStateCapture\\ExplorerPatcher"
|
||||
#define EP_SETUP_HELPER_SWITCH "/CreateExplorerShellUnelevatedAfterServicing"
|
||||
#include "def.h"
|
||||
|
||||
#define WM_MSG_GUI_SECTION WM_USER + 1
|
||||
#define WM_MSG_GUI_SECTION_GET 1
|
||||
@ -249,6 +234,8 @@ void LaunchPropertiesGUI(HMODULE hModule);
|
||||
|
||||
BOOL SystemShutdown(BOOL reboot);
|
||||
|
||||
LSTATUS RegisterDWMService(DWORD dwDesiredState, DWORD dwOverride);
|
||||
|
||||
inline long long milliseconds_now() {
|
||||
LARGE_INTEGER s_frequency;
|
||||
BOOL s_use_qpc = QueryPerformanceFrequency(&s_frequency);
|
||||
|
2
ep_dwm
2
ep_dwm
@ -1 +1 @@
|
||||
Subproject commit e058f2e8cc13dc094ba55f472a1ade969d260526
|
||||
Subproject commit cb881d8bcc22bfb518782f340e03aa7c3204a6f7
|
@ -333,6 +333,19 @@ int WINAPI wWinMain(
|
||||
wcscat_s(wszPath, MAX_PATH, L"\\" _T(PRODUCT_NAME) L".amd64.dll");
|
||||
bOk = InstallResource(TRUE, hInstance, IDR_EP_AMD64, wszPath);
|
||||
}
|
||||
if (argc >= 2)
|
||||
{
|
||||
wcsncpy_s(wszPath, MAX_PATH, wargv[1], MAX_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetCurrentDirectoryW(MAX_PATH, wszPath);
|
||||
}
|
||||
if (bOk)
|
||||
{
|
||||
wcscat_s(wszPath, MAX_PATH, L"\\ep_dwm.exe");
|
||||
bOk = InstallResource(TRUE, hInstance, IDR_EP_DWM, wszPath);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -434,6 +447,37 @@ int WINAPI wWinMain(
|
||||
CloseHandle(sei.hProcess);
|
||||
}
|
||||
|
||||
BOOL bAreRoundedCornersDisabled = FALSE;
|
||||
HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, L"Global\\ep_dwm_" _T(EP_CLSID));
|
||||
if (h_exists)
|
||||
{
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
bAreRoundedCornersDisabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bAreRoundedCornersDisabled = FALSE;
|
||||
}
|
||||
CloseHandle(h_exists);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetLastError() == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
bAreRoundedCornersDisabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bAreRoundedCornersDisabled = FALSE;
|
||||
}
|
||||
}
|
||||
if (bAreRoundedCornersDisabled)
|
||||
{
|
||||
RegisterDWMService(0, 1);
|
||||
RegisterDWMService(0, 3);
|
||||
}
|
||||
|
||||
WCHAR wszSCPath[MAX_PATH];
|
||||
GetSystemDirectoryW(wszSCPath, MAX_PATH);
|
||||
wcscat_s(wszSCPath, MAX_PATH, L"\\sc.exe");
|
||||
@ -443,7 +487,7 @@ int WINAPI wWinMain(
|
||||
ShExecInfo.hwnd = NULL;
|
||||
ShExecInfo.lpVerb = L"runas";
|
||||
ShExecInfo.lpFile = wszSCPath;
|
||||
ShExecInfo.lpParameters = L"stop ep_dwm_" _T(EP_CLSID_LITE);
|
||||
ShExecInfo.lpParameters = L"stop " _T(EP_DWM_SERVICENAME);
|
||||
ShExecInfo.lpDirectory = NULL;
|
||||
ShExecInfo.nShow = SW_HIDE;
|
||||
ShExecInfo.hInstApp = NULL;
|
||||
@ -579,6 +623,12 @@ int WINAPI wWinMain(
|
||||
bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath);
|
||||
}
|
||||
if (bOk)
|
||||
{
|
||||
PathRemoveFileSpecW(wszPath);
|
||||
wcscat_s(wszPath, MAX_PATH, L"\\ep_dwm.exe");
|
||||
bOk = InstallResource(bInstall, hInstance, IDR_EP_DWM, wszPath);
|
||||
}
|
||||
if (bOk)
|
||||
{
|
||||
bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);
|
||||
}
|
||||
@ -612,7 +662,7 @@ int WINAPI wWinMain(
|
||||
wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\" _T(SETUP_UTILITY_NAME) L"\" /uninstall");
|
||||
bOk = SetupUninstallEntry(bInstall, wszPath);
|
||||
}
|
||||
ShExecInfo.lpParameters = bInstall ? L"start ep_dwm_" _T(EP_CLSID_LITE) : L"delete ep_dwm_" _T(EP_CLSID_LITE);
|
||||
ShExecInfo.lpParameters = bInstall ? L"start " _T(EP_DWM_SERVICENAME) : L"delete " _T(EP_DWM_SERVICENAME);
|
||||
if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)
|
||||
{
|
||||
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
|
||||
|
@ -94,6 +94,8 @@ IDR_EP_AMD64 RCDATA "..\\build\\Release\\ExplorerPatcher.
|
||||
|
||||
IDR_EP_IA32 RCDATA "..\\build\\Release\\ExplorerPatcher.IA-32.dll"
|
||||
|
||||
IDR_EP_DWM RCDATA "..\\build\\Release\\ep_dwm.exe"
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -169,6 +169,10 @@
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\build\Debug\ep_dwm.exe">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</None>
|
||||
<None Include="..\build\Debug\ExplorerPatcher.amd64.dll">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@ -177,6 +181,14 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</None>
|
||||
<None Include="..\build\Release\ep_dwm.exe">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</ExcludedFromBuild>
|
||||
</None>
|
||||
<None Include="..\build\Release\ExplorerPatcher.amd64.dll">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
|
@ -46,5 +46,7 @@
|
||||
</None>
|
||||
<None Include="..\build\Debug\ExplorerPatcher.amd64.dll" />
|
||||
<None Include="..\build\Debug\ExplorerPatcher.IA-32.dll" />
|
||||
<None Include="..\build\Release\ep_dwm.exe" />
|
||||
<None Include="..\build\Debug\ep_dwm.exe" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -94,6 +94,8 @@ IDR_EP_AMD64 RCDATA "..\\build\\Debug\\ExplorerPatcher.am
|
||||
|
||||
IDR_EP_IA32 RCDATA "..\\build\\Debug\\ExplorerPatcher.IA-32.dll"
|
||||
|
||||
IDR_EP_DWM RCDATA "..\\build\\Debug\\ep_dwm.exe"
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
//
|
||||
#define IDR_EP_AMD64 103
|
||||
#define IDR_EP_IA32 104
|
||||
#define IDR_EP_DWM 105
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user