[Libreoffice-commits] core.git: avmedia/source fpicker/source setup_native/source shell/source vcl/win

Michael Stahl mstahl at redhat.com
Mon Jan 19 12:32:14 PST 2015


 avmedia/source/win/player.cxx                                             |    5 +++++
 fpicker/source/win32/misc/WinImplHelper.cxx                               |    5 +++++
 setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx |    8 +++++++-
 shell/source/win32/shlxthandler/propsheets/propsheets.cxx                 |    5 +++++
 shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx               |    5 +++++
 shell/source/win32/shlxthandler/util/utilities.cxx                        |    5 +++++
 vcl/win/source/app/salinst.cxx                                            |    6 ++++++
 7 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit 4500afcc1be7774b3c35ab69a20e36165ca5445a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jan 19 18:18:20 2015 +0100

    try to fix GetVersionEx deprecation warnings from Windows SDK 8.1
    
    Apparently GetVersionEx() is deprecated now, but the replacement header
    "versionhelpers.h" does not exist in older SDKs (at least not in 8.0),
    so try to determine the used SDK version by checking if the Windows 8.1
    version constant _WIN32_WINNT_WINBLUE (0x0602) exists.
    
    http://msdn.microsoft.com/en-us/library/windows/desktop/dn424972%28v=vs.85%29.aspx
    
    Change-Id: Ia9224a8c76823ada7cb294a600046c6a0fc843ad
    Reviewed-on: https://gerrit.libreoffice.org/14020
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index baf72ad..1d7040b 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -68,12 +68,17 @@ LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM
 
 bool isWindowsVistaOrHigher()
 {
+// the Win32 SDK 8.1 deprecates GetVersionEx()
+#ifdef _WIN32_WINNT_WINBLUE
+    return IsWindowsVistaOrGreater() ? true : false;
+#else
     // POST: return true if we are at least on Windows Vista
     OSVERSIONINFO osvi;
     ZeroMemory(&osvi, sizeof(osvi));
     osvi.dwOSVersionInfoSize = sizeof(osvi);
     GetVersionEx(&osvi);
     return  osvi.dwMajorVersion >= 6;
+#endif
 }
 
 
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx
index 84d76d7..8f470a2 100644
--- a/fpicker/source/win32/misc/WinImplHelper.cxx
+++ b/fpicker/source/win32/misc/WinImplHelper.cxx
@@ -63,6 +63,10 @@ const sal_Unicode   AMPERSAND_SIGN = L'&';
 
 bool SAL_CALL IsWindowsVistaOrNewer()
 {
+// the Win32 SDK 8.1 deprecates GetVersionEx()
+#ifdef _WIN32_WINNT_WINBLUE
+    return IsWindowsVistaOrGreater() ? true : false;
+#else
     OSVERSIONINFO osvi;
     osvi.dwOSVersionInfoSize = sizeof(osvi);
 
@@ -77,6 +81,7 @@ bool SAL_CALL IsWindowsVistaOrNewer()
          sal::static_int_cast< unsigned int >(0));
 
     return bRet;
+#endif
 }
 
 
diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
index f983338..5f8b15e 100644
--- a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
@@ -67,11 +67,17 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
     std::_tstring sDesktopFile = sOfficeMenuFolder + TEXT("Desktop.ini");
     std::_tstring   sIconFile = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ) + TEXT("program\\soffice.exe");
 
+// the Win32 SDK 8.1 deprecates GetVersionEx()
+#ifdef _WIN32_WINNT_WINBLUE
+    bool const bIsVistaOrLater = IsWindowsVistaOrGreater() ? true : false;
+#else
     OSVERSIONINFO   osverinfo;
     osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
     GetVersionEx( &osverinfo );
+    bool const bIsVistaOrLater = (osverinfo.dwMajorVersion >= 6);
+#endif
 
-    if (osverinfo.dwMajorVersion < 6 /* && osverinfo.dwMinorVersion  */ )
+    if (!bIsVistaOrLater)
     {
         WritePrivateProfileString(
             TEXT(".ShellClassInfo"),
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index 936b3db..824b7fd 100644
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -172,6 +172,10 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
 
 HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
 {
+// the Win32 SDK 8.1 deprecates GetVersionEx()
+#ifdef _WIN32_WINNT_WINBLUE
+    bool bIsVistaOrLater = IsWindowsVistaOrGreater() ? true : false;
+#else
     // Get OS version (we don't need the summary page on Windows Vista or later)
     OSVERSIONINFO sInfoOS;
 
@@ -179,6 +183,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddP
     sInfoOS.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
     GetVersionEx( &sInfoOS );
     bool bIsVistaOrLater = (sInfoOS.dwMajorVersion >= 6);
+#endif
 
     std::wstring proppage_header;
 
diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
index 8c62836..5d57a4f 100644
--- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
+++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx
@@ -68,6 +68,10 @@ namespace internal
 
     bool IsWindowsXP()
     {
+// the Win32 SDK 8.1 deprecates GetVersionEx()
+#ifdef _WIN32_WINNT_WINBLUE
+        return IsWindowsXPOrGreater() ? true : false;
+#else
         OSVERSIONINFO osvi;
         ZeroMemory(&osvi, sizeof(osvi));
         osvi.dwOSVersionInfoSize = sizeof(osvi);
@@ -75,6 +79,7 @@ namespace internal
 
         return ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
                 ((osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1)));
+#endif
     }
 
     /* Calculate where to position the signet image.
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 1f2423d..f97013ef 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -104,6 +104,10 @@ std::wstring GetResString(int ResId)
 */
 bool is_windows_xp_or_above()
 {
+// the Win32 SDK 8.1 deprecates GetVersionEx()
+#ifdef _WIN32_WINNT_WINBLUE
+    return IsWindowsXPOrGreater() ? true : false;
+#else
     OSVERSIONINFO osvi;
     ZeroMemory(&osvi, sizeof(osvi));
     osvi.dwOSVersionInfoSize = sizeof(osvi);
@@ -116,6 +120,7 @@ bool is_windows_xp_or_above()
         return true;
     }
     return false;
+#endif
 }
 
 
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 9610034..396b254 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -451,6 +451,11 @@ SalInstance* CreateSalInstance()
     aSalShlData.mbW7         = 0;
     memset( &aSalShlData.maVersionInfo, 0, sizeof(aSalShlData.maVersionInfo) );
     aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo );
+// the Win32 SDK 8.1 deprecates GetVersionEx()
+#ifdef _WIN32_WINNT_WINBLUE
+    aSalShlData.mbWXP = IsWindowsXPOrGreater() ? 1 : 0;
+    aSalShlData.mbW7 = IsWindows7OrGreater() ? 1 : 0;
+#else
     if ( GetVersionEx( &aSalShlData.maVersionInfo ) )
     {
         // Windows XP ?
@@ -462,6 +467,7 @@ SalInstance* CreateSalInstance()
        ( aSalShlData.maVersionInfo.dwMajorVersion == 6 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) )
         aSalShlData.mbW7 = 1;
     }
+#endif
 
     pSalData->mnAppThreadId = GetCurrentThreadId();
 


More information about the Libreoffice-commits mailing list