Browse Source

GUI: Lock ExplorerFrame into memory

pull/886/head 22000.376.40.20_de581b6
Valentin Radu 4 years ago
parent
commit
de581b6097
  1. 1
      CHANGELOG.md
  2. 42
      ExplorerPatcher/GUI.c
  3. 1
      ExplorerPatcher/GUI.h
  4. 6
      version.h

1
CHANGELOG.md

@ -48,6 +48,7 @@ Tested on OS build 22000.376.
* Possibility to set position on screen (top/bottom) from the Properties UI * 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) * 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) * 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 #### Simple Window Switcher

42
ExplorerPatcher/GUI.c

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

1
ExplorerPatcher/GUI.h

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

6
version.h

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

Loading…
Cancel
Save