diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/inc/config.hxx | 6 | ||||
-rw-r--r-- | shell/inc/global.hxx | 2 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx | 3 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/propsheets/propsheets.cxx | 2 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/shlxthdl.cxx | 2 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/util/utilities.cxx | 20 |
6 files changed, 25 insertions, 10 deletions
diff --git a/shell/inc/config.hxx b/shell/inc/config.hxx index 58b5dd4bfc3c..4f4847667643 100644 --- a/shell/inc/config.hxx +++ b/shell/inc/config.hxx @@ -20,12 +20,6 @@ #ifndef INCLUDED_SHELL_INC_INTERNAL_CONFIG_HXX #define INCLUDED_SHELL_INC_INTERNAL_CONFIG_HXX -#ifdef _AMD64_ -#define MODULE_NAME L"shlxthdl_x64.dll" -#else -#define MODULE_NAME L"shlxthdl.dll" -#endif - #define COLUMN_HANDLER_DESCRIPTIVE_NAME L"LibreOffice Column Handler" #define INFOTIP_HANDLER_DESCRIPTIVE_NAME L"LibreOffice Infotip Handler" #define PROPSHEET_HANDLER_DESCRIPTIVE_NAME L"LibreOffice Property Sheet Handler" diff --git a/shell/inc/global.hxx b/shell/inc/global.hxx index a729d59301e8..fa2b655f5e4c 100644 --- a/shell/inc/global.hxx +++ b/shell/inc/global.hxx @@ -25,6 +25,8 @@ #endif #include <windows.h> +HMODULE GetCurrentModuleHandle(); + extern LONG g_DllRefCnt; #endif diff --git a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx index 08beac81985c..5f0705c74d7a 100644 --- a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx +++ b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx @@ -22,6 +22,7 @@ #include "document_statistic.hxx" #include <utilities.hxx> #include <config.hxx> +#include <global.hxx> #include <commctrl.h> #include <resource.h> @@ -87,7 +88,7 @@ void list_view_builder::build(statistic_group_list_t& gl) void list_view_builder::setup_list_view() { HIMAGELIST h_ils = ImageList_Create(16,15,ILC_MASK, 7, 0); - HBITMAP h_bmp = LoadBitmapW(GetModuleHandleW(MODULE_NAME), MAKEINTRESOURCEW(IDB_PROPERTY_IMAGES)); + HBITMAP h_bmp = LoadBitmapW(GetCurrentModuleHandle(), MAKEINTRESOURCEW(IDB_PROPERTY_IMAGES)); ImageList_AddMasked(h_ils, h_bmp, RGB(255, 0, 255)); (void) ListView_SetImageList(hwnd_list_view_, h_ils, LVSIL_SMALL); diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx index 218b921332a0..48a125d581fc 100644 --- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx +++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx @@ -171,7 +171,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNSVADDPROPSHEETPAGE lpfnAd // add the summary property page psp.dwSize = sizeof(psp); psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_USECALLBACK; - psp.hInstance = GetModuleHandleW(MODULE_NAME); + psp.hInstance = GetCurrentModuleHandle(); psp.lParam = reinterpret_cast<LPARAM>(this); psp.pfnCallback = reinterpret_cast<LPFNPSPCALLBACKW>(CPropertySheet::PropPageSummaryCallback); diff --git a/shell/source/win32/shlxthandler/shlxthdl.cxx b/shell/source/win32/shlxthandler/shlxthdl.cxx index 6383cc2f60c0..9a5b8a37917c 100644 --- a/shell/source/win32/shlxthandler/shlxthdl.cxx +++ b/shell/source/win32/shlxthandler/shlxthdl.cxx @@ -303,7 +303,7 @@ STDAPI DllRegisterServer() WCHAR ModuleFileName[MAX_PATH]; GetModuleFileNameW( - GetModuleHandleW(MODULE_NAME), + GetCurrentModuleHandle(), ModuleFileName, sizeof(ModuleFileName)/sizeof(ModuleFileName[0])); diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx index 489474b53baf..27bf12c211c7 100644 --- a/shell/source/win32/shlxthandler/util/utilities.cxx +++ b/shell/source/win32/shlxthandler/util/utilities.cxx @@ -22,6 +22,7 @@ #include <memory> #include <config.hxx> +#include <global.hxx> #include <utilities.hxx> // constants @@ -81,7 +82,7 @@ std::wstring GetResString(int ResId) { wchar_t szResStr[MAX_RES_STRING]; - int rc = LoadStringW( GetModuleHandleW(MODULE_NAME), ResId, szResStr, sizeof(szResStr) ); + int rc = LoadStringW( GetCurrentModuleHandle(), ResId, szResStr, sizeof(szResStr) ); OutputDebugStringFormatW( L"GetResString: read %d chars\n", rc ); // OSL_ENSURE(rc, "String resource not found"); @@ -544,4 +545,21 @@ LCID LocaleSetToLCID( const LocaleSet_t & Locale ) return MAKELCID( MAKELANGID( usPrimaryLang, usSubLang ), SORT_DEFAULT ); } +// The function is defined in the static library, and thus its address is local to current module +HMODULE GetCurrentModuleHandle() +{ + HMODULE h{}; + + if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS + | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + reinterpret_cast<LPCWSTR>(&GetCurrentModuleHandle), &h) + == 0) + { + const DWORD dwError = GetLastError(); + OutputDebugStringFormatW( + L"GetCurrentModuleHandle: GetModuleHandleExW failed, error is 0x%X", dwError); + } + return h; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |