From c236c8e88a6d3e30cc4acc9108cbce018ca872cc Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 13 Oct 2016 10:53:53 +0200 Subject: [PATCH] LoadLibraryEx returns null on error Returning <= HINSTANCE_ERROR (aka 32) on error was apparently a feature of LoadLibrary in 16-bit Windows 3 times. Change-Id: Idf9fbd84ac1fadb67449968b65cd5e8e391a39f2 Reviewed-on: https://gerrit.libreoffice.org/29752 Reviewed-by: Stephan Bergmann Tested-by: Stephan Bergmann --- .../source/win32/customactions/regactivex/regactivex.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx index bf33f71322c1..b4373185b7b1 100644 --- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx +++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx @@ -72,7 +72,7 @@ char* UnicodeToAnsiString( wchar_t* pUniString ) void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit ) { HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ); - if( !( hModule <= ( HINSTANCE )HINSTANCE_ERROR ) ) + if( hModule ) { DllNativeRegProc pNativeProc = ( DllNativeRegProc )GetProcAddress( hModule, "DllRegisterServerNative" ); if( pNativeProc!=NULL ) @@ -99,7 +99,7 @@ void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallFor void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit ) { HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ); - if( !( hModule <= ( HINSTANCE )HINSTANCE_ERROR ) ) + if( hModule ) { DllNativeUnregProc pNativeProc = ( DllNativeUnregProc )GetProcAddress( hModule, "DllUnregisterServerNative" ); if( pNativeProc!=NULL )