From 98118101e665aba93d014bfece2024764ea44b4e Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Thu, 12 Sep 2024 14:34:06 +0700 Subject: [PATCH] Cleaned some unneeded stuff in the setup binary, and restored exported functions for launching/restarting Explorer --- ExplorerPatcher/utility.c | 10 +++++++--- ExplorerPatcher/utility.h | 8 +++++--- ep_setup/ep_setup.vcxproj | 5 +++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ExplorerPatcher/utility.c b/ExplorerPatcher/utility.c index e247350..8a49aa7 100644 --- a/ExplorerPatcher/utility.c +++ b/ExplorerPatcher/utility.c @@ -138,7 +138,8 @@ __declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, L } #endif -/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) +#ifndef EP_BUILD_SETUP +__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) { Sleep(100); TCHAR wszExplorerPath[MAX_PATH + 1]; @@ -170,19 +171,20 @@ __declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, L return 0; } -/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) +__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) { Sleep(2000); ZZLaunchExplorer(hWnd, hInstance, lpszCmdLine, nCmdShow); return 0; } -/*__declspec(dllexport)*/ int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) +__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) { BeginExplorerRestart(NULL); FinishExplorerRestart(); return 0; } +#endif void* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize) { @@ -719,6 +721,7 @@ LSTATUS RegisterDWMService(DWORD dwDesiredState, DWORD dwOverride) return TRUE; } +#ifndef EP_BUILD_SETUP char* StrReplaceAllA(const char* s, const char* oldW, const char* newW, int* dwNewSize) { char* result; @@ -1140,6 +1143,7 @@ HRESULT InputBox(BOOL bPassword, HWND hWnd, LPCWSTR wszPrompt, LPCWSTR wszTitle, return hr; } +#endif UINT PleaseWaitTimeout = 0; HHOOK PleaseWaitHook = NULL; diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index 9314cda..f930fe8 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -131,11 +131,13 @@ __declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, __declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); #endif -/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); +#ifndef EP_BUILD_SETUP +__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); -/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); +__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); -/*__declspec(dllexport)*/ int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); +__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow); +#endif #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) diff --git a/ep_setup/ep_setup.vcxproj b/ep_setup/ep_setup.vcxproj index 281b63e..1935b68 100644 --- a/ep_setup/ep_setup.vcxproj +++ b/ep_setup/ep_setup.vcxproj @@ -225,6 +225,11 @@ $(SolutionDir)libs\zlib\build-$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + + + EP_BUILD_SETUP;%(PreprocessorDefinitions) + + WITH_ENCRYPTION;%(PreprocessorDefinitions)