Kaydet (Commit) 50d330c3 authored tarafından Fridrich Štrba's avatar Fridrich Štrba Kaydeden (comit) Fridrich Strba

Shell32.dll is already loaded

Since the vcllo.dll links already the shell32.dll because of its symbol
SHAddToRecentDocs, no need to increase reference of that library. Just
get the module handle.

Moreover, a mere presence of the symbol SHGetPropertyStoreForWindow in
shell32.dll indicates that we are running at least on Windows 7 or Windows
Server 2008 R2. There is thus no need to check for the library version.

Change-Id: I9ddfb8407fd805faf588779ac5fa8c10a0ae8898
Reviewed-on: https://gerrit.libreoffice.org/5016Reviewed-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
Tested-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
üst f9cde6e6
...@@ -1910,38 +1910,16 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID ) ...@@ -1910,38 +1910,16 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx // http://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx
// A window's properties must be removed before the window is closed. // A window's properties must be removed before the window is closed.
WCHAR szShell32[MAX_PATH];
GetSystemDirectoryW( szShell32, MAX_PATH );
wcscat( szShell32, L"\\Shell32.dll" );
HINSTANCE hinstDll = LoadLibraryW( szShell32 );
if( hinstDll )
{
DLLVERSIONINFO dvi;
ZeroMemory(&dvi, sizeof(dvi));
dvi.cbSize = sizeof(dvi);
DLLGETVERSIONPROC pDllGetVersion;
pDllGetVersion = ( DLLGETVERSIONPROC )GetProcAddress( hinstDll, "DllGetVersion" );
HRESULT hr = (*pDllGetVersion)(&dvi);
if( SUCCEEDED(hr) )
{
#define PACKVERSION(major,minor) MAKELONG(minor,major)
DWORD dwVersion = PACKVERSION( dvi.dwMajorVersion, dvi.dwMinorVersion );
// shell32 in Windows 7 is version 6.1.
if( dwVersion >= PACKVERSION(6,1) )
{
typedef HRESULT ( WINAPI *SHGETPROPERTYSTOREFORWINDOW )( HWND, REFIID, void ** ); typedef HRESULT ( WINAPI *SHGETPROPERTYSTOREFORWINDOW )( HWND, REFIID, void ** );
SHGETPROPERTYSTOREFORWINDOW pSHGetPropertyStoreForWindow; SHGETPROPERTYSTOREFORWINDOW pSHGetPropertyStoreForWindow;
pSHGetPropertyStoreForWindow = pSHGetPropertyStoreForWindow = ( SHGETPROPERTYSTOREFORWINDOW )GetProcAddress(
( SHGETPROPERTYSTOREFORWINDOW ) GetProcAddress( hinstDll, "SHGetPropertyStoreForWindow" ); GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" );
// A mere presence of the symbol means we are at least on Windows 7 or Windows Server 2008 R2
if( pSHGetPropertyStoreForWindow ) if( pSHGetPropertyStoreForWindow )
{ {
IPropertyStore *pps; IPropertyStore *pps;
HRESULT hr = ( *pSHGetPropertyStoreForWindow ) ( mhWnd, IID_PPV_ARGS(&pps) ); HRESULT hr = pSHGetPropertyStoreForWindow ( mhWnd, IID_PPV_ARGS(&pps) );
if ( SUCCEEDED(hr) ) if ( SUCCEEDED(hr) )
{ {
PROPVARIANT pv; PROPVARIANT pv;
...@@ -1963,10 +1941,6 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID ) ...@@ -1963,10 +1941,6 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
} }
} }
} }
}
}
FreeLibrary( hinstDll );
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment