summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorTino Rachui <tra@openoffice.org>2002-03-21 06:41:31 +0000
committerTino Rachui <tra@openoffice.org>2002-03-21 06:41:31 +0000
commit7f3a03d6b6c761ff0e041fc26e709688ebd8f730 (patch)
tree48ad97b87fddcb2ead48e51be0b7901354774ad7 /fpicker
parentca8deb5ff99766fc9fd013689111cec219ae26bf (diff)
#89491#additional methods for detecting os version
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/misc/WinImplHelper.cxx83
-rw-r--r--fpicker/source/win32/misc/WinImplHelper.hxx15
2 files changed, 80 insertions, 18 deletions
diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx
index 9bee6af08b5c..01ebb1667f97 100644
--- a/fpicker/source/win32/misc/WinImplHelper.cxx
+++ b/fpicker/source/win32/misc/WinImplHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WinImplHelper.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: tra $ $Date: 2001-11-14 16:43:47 $
+ * last change: $Author: tra $ $Date: 2002-03-21 07:41:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,32 +107,85 @@ const rtl::OUString AMPERSAND = OUString::createFromAscii( "&" );
const sal_Unicode AMPERSAND_SIGN = L'&';
//------------------------------------------------------------
-// determine if we are running under Win2000
+// OS NAME Platform Major Minor
+//
+// Windows NT 3.51 VER_PLATFORM_WIN32_NT 3 51
+// Windows NT 4.0 VER_PLATFORM_WIN32_NT 4 0
+// Windows 2000 VER_PLATFORM_WIN32_NT 5 0
+// Windows XP VER_PLATFORM_WIN32_NT 5 1
+// Windows 95 VER_PLATFORM_WIN32_WINDOWS 4 0
+// Windows 98 VER_PLATFORM_WIN32_WINDOWS 4 10
+// Windows ME VER_PLATFORM_WIN32_WINDOWS 4 90
//------------------------------------------------------------
-sal_Bool SAL_CALL IsWin2000( )
+bool SAL_CALL IsWindowsVersion(unsigned int PlatformId, unsigned int MajorVersion, int MinorVersion = -1)
{
- OSVERSIONINFOEX osvi;
- BOOL bOsVersionInfoEx;
- sal_Bool bRet = sal_False;
+ OSVERSIONINFOEXA osvi;
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
- osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFOEX );
- bOsVersionInfoEx = GetVersionEx( ( OSVERSIONINFO* )&osvi );
- if( !bOsVersionInfoEx )
+ if(!GetVersionExA((OSVERSIONINFOA*)&osvi))
{
// if OSVERSIONINFOEX doesn't work
- osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
- if( !GetVersionEx( ( OSVERSIONINFO* )&osvi ) )
- return sal_False;
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
+ if(!GetVersionEx((OSVERSIONINFOA*)&osvi))
+ return false;
}
- if( ( VER_PLATFORM_WIN32_NT == osvi.dwPlatformId ) && ( osvi.dwMajorVersion >= 5 ) )
- bRet = sal_True;
+ bool bRet = (PlatformId == osvi.dwPlatformId) &&
+ (MajorVersion == osvi.dwMajorVersion);
+
+ if (MinorVersion > -1)
+ bRet = bRet && (MinorVersion == osvi.dwMinorVersion);
return bRet;
}
//------------------------------------------------------------
+// determine if we are running under Win2000
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindows2000()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 0);
+}
+
+//------------------------------------------------------------
+//
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindowsXP()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5, 1);
+}
+
+//------------------------------------------------------------
+//
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindows98()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_WINDOWS, 4, 10);
+}
+
+//------------------------------------------------------------
+//
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindowsME()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_WINDOWS, 4, 90);
+}
+
+//------------------------------------------------------------
+//
+//------------------------------------------------------------
+
+bool SAL_CALL IsWindows2000Platform()
+{
+ return IsWindowsVersion(VER_PLATFORM_WIN32_NT, 5);
+}
+
+//------------------------------------------------------------
//
//------------------------------------------------------------
diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx
index cd93816eeced..e4cb4f19b4d1 100644
--- a/fpicker/source/win32/misc/WinImplHelper.hxx
+++ b/fpicker/source/win32/misc/WinImplHelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WinImplHelper.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: tra $ $Date: 2001-11-14 16:43:47 $
+ * last change: $Author: tra $ $Date: 2002-03-21 07:41:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,7 +89,16 @@
// deklarations
//------------------------------------------------------------------------
-sal_Bool SAL_CALL IsWin2000( );
+bool SAL_CALL IsWindows2000();
+bool SAL_CALL IsWindowsXP();
+bool SAL_CALL IsWindows98();
+bool SAL_CALL IsWindowsME();
+
+// returns true if the platform is
+// Windows 2000 or above
+bool SAL_CALL IsWindows2000Platform();
+
+#define IsWin2000 IsWindows2000
// set actions
void SAL_CALL ListboxAddItem(