summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-04-05 13:15:42 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-05 23:13:15 +0200
commit515d2579d305a6127c6c194319a58eac62437e33 (patch)
treee283e99d3ed36c2f3a954df976604c7fea8d29fe /setup_native
parentedd163b5e148d1c71ff2c3f55455c971513a6f62 (diff)
Replace legacy dynamically-loaded functions with statically linked ones
We don't need the dynamic load complexity for these now with baseline Windows version being Windows 7 SP1. Stuff used only for compatibility with older versions was dumped. Change-Id: I810f271796cfd875cfa18a3081c9ad444fe57b3e Reviewed-on: https://gerrit.libreoffice.org/70321 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'setup_native')
-rw-r--r--setup_native/source/win32/customactions/quickstarter/quickstarter.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx
index 7b0f9a5bd18d..960274f393d0 100644
--- a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx
+++ b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx
@@ -93,17 +93,14 @@ static bool IsValidHandle( HANDLE handle )
static DWORD WINAPI GetModuleFileNameExW_( HANDLE hProcess, HMODULE hModule, PWSTR lpFileName, DWORD nSize )
{
- typedef DWORD (WINAPI *FN_PROC)( HANDLE hProcess, HMODULE hModule, LPWSTR lpFileName, DWORD nSize );
-
- static FN_PROC lpProc = nullptr;
-
- if ( !lpProc )
- {
+ static auto lpProc = []() {
HMODULE hLibrary = LoadLibraryW(L"PSAPI.DLL");
-
- if ( hLibrary )
- lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "GetModuleFileNameExW" ));
- }
+ decltype(GetModuleFileNameExW)* pRet = nullptr;
+ if (hLibrary)
+ pRet = reinterpret_cast<decltype(GetModuleFileNameExW)*>(
+ GetProcAddress(hLibrary, "GetModuleFileNameExW"));
+ return pRet;
+ }();
if ( lpProc )
return lpProc( hProcess, hModule, lpFileName, nSize );