From 515d2579d305a6127c6c194319a58eac62437e33 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 5 Apr 2019 13:15:42 +0300 Subject: 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 --- .../win32/customactions/quickstarter/quickstarter.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'setup_native') 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( + GetProcAddress(hLibrary, "GetModuleFileNameExW")); + return pRet; + }(); if ( lpProc ) return lpProc( hProcess, hModule, lpFileName, nSize ); -- cgit