diff --git a/CHANGELOG.md b/CHANGELOG.md index f17ec96..45ad457 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index 753923f..bcd0360 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -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); diff --git a/ExplorerPatcher/GUI.h b/ExplorerPatcher/GUI.h index 4c1c6c1..8e96356 100644 --- a/ExplorerPatcher/GUI.h +++ b/ExplorerPatcher/GUI.h @@ -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( diff --git a/version.h b/version.h index 94538de..39f7b54 100644 --- a/version.h +++ b/version.h @@ -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"