1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-18 16:54:13 +01:00

GUI: Lock ExplorerFrame into memory

This commit is contained in:
Valentin Radu 2021-12-28 16:06:37 +02:00
parent 3464f77c74
commit de581b6097
4 changed files with 32 additions and 18 deletions

View File

@ -48,6 +48,7 @@ Tested on OS build 22000.376.
* Possibility to set position on screen (top/bottom) from the Properties UI
* Restoring default settings only asks for elevation if required (for the moment, only if you have registered the application as shell extension) (.18)
* Fixed the context menu not working (and a potential associated crash) of the new Microsoft IME (#598, #588) (.19) (huge thanks to @Simplestas)
* GUI: Lock `ExplorerFrame` into memory (.20)
#### Simple Window Switcher

View File

@ -834,9 +834,9 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
//}
//else
//{
HMODULE hExplorerFrame = LoadLibraryExW(L"ExplorerFrame.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
LoadStringW(hExplorerFrame, 50222, text, 260);
FreeLibrary(hExplorerFrame);
//HMODULE hExplorerFrame = LoadLibraryExW(L"ExplorerFrame.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
LoadStringW(_this->hExplorerFrame, 50222, text, 260);
//FreeLibrary(hExplorerFrame);
wchar_t* p = wcschr(text, L'(');
if (p)
{
@ -2472,6 +2472,7 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
_this.section = 0;
_this.dwStatusbarY = 0;
_this.hIcon = NULL;
_this.hExplorerFrame = NULL;
ZeroMemory(
wszPath,
@ -2504,24 +2505,30 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
RegisterClassW(&wc);
TCHAR title[260];
HMODULE hExplorerFrame = LoadLibraryExW(L"ExplorerFrame.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
LoadStringW(hExplorerFrame, 50222, title, 260); // 726 = File Explorer
FreeLibrary(hExplorerFrame);
wchar_t* p = wcschr(title, L'(');
if (p)
_this.hExplorerFrame = LoadLibraryExW(L"ExplorerFrame.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
if (_this.hExplorerFrame)
{
p--;
if (p == L' ')
LoadStringW(_this.hExplorerFrame, 50222, title, 260); // 726 = File Explorer
wchar_t* p = wcschr(title, L'(');
if (p)
{
*p = 0;
p--;
if (p == L' ')
{
*p = 0;
}
else
{
p++;
*p = 0;
}
}
else
if (title[0] == 0)
{
p++;
*p = 0;
LoadStringW(hModule, IDS_PRODUCTNAME, title, 260);
}
}
if (title[0] == 0)
else
{
LoadStringW(hModule, IDS_PRODUCTNAME, title, 260);
}
@ -2598,6 +2605,11 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
DispatchMessage(&msg);
}
if (_this.hExplorerFrame)
{
FreeLibrary(_this.hExplorerFrame);
}
if (hShell32)
{
CloseHandle(_this.hIcon);

View File

@ -70,6 +70,7 @@ typedef struct _GUI
UINT GUI_CAPTION_LINE_HEIGHT;
long long LeftClickTime;
long long LastClickTime;
HMODULE hExplorerFrame;
} GUI;
static HRESULT GUI_AboutProc(

View File

@ -1,7 +1,7 @@
#define VER_MAJOR 22000
#define VER_MINOR 376
#define VER_BUILD_HI 40
#define VER_BUILD_LO 19
#define VER_BUILD_LO 20
#define VER_FLAGS VS_FF_PRERELEASE
@ -12,5 +12,5 @@
#define VER_STR(arg) #arg
// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22000.376.40.19"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.376.40.19"
#define VER_FILE_STRING VALUE "FileVersion", "22000.376.40.20"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.376.40.20"