Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbseifert <none@none>2003-10-30 09:08:04 +0300
committerbseifert <none@none>2003-10-30 09:08:04 +0300
commitf049e2df4b09dc19a7d76e2d33b8cfcb5370e9dc (patch)
treef2f04cd33835591b8e32953d093a1527a75f3464 /windirstat/getosplatformstring.cpp
parent98a363ad8bd075b1abd702b7d380692ec0c470d6 (diff)
Initial revision
Diffstat (limited to 'windirstat/getosplatformstring.cpp')
-rw-r--r--windirstat/getosplatformstring.cpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/windirstat/getosplatformstring.cpp b/windirstat/getosplatformstring.cpp
new file mode 100644
index 0000000..d5826f1
--- /dev/null
+++ b/windirstat/getosplatformstring.cpp
@@ -0,0 +1,97 @@
+// getosplatformstring.cpp - Implementation of GetOsPlatformString()
+//
+// WinDirStat - Directory Statistics
+// Copyright (C) 2003 Bernhard Seifert
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Author: bseifert@users.sourceforge.net, bseifert@daccord.net
+
+#include "stdafx.h"
+#include "windirstat.h"
+#include "getosplatformstring.h"
+
+CString GetOsPlatformString()
+{
+ CString ret;
+
+ OSVERSIONINFO osvi;
+ ZeroMemory(&osvi, sizeof(osvi));
+ osvi.dwOSVersionInfoSize= sizeof(osvi);
+
+ if (!GetVersionEx(&osvi))
+ {
+ return LoadString(IDS__UNKNOWN_);
+ }
+
+ switch (osvi.dwPlatformId)
+ {
+ case VER_PLATFORM_WIN32_NT:
+ if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
+ ret= _T("Windows Server 2003");
+ else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
+ ret= _T("Windows XP");
+ else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
+ ret= _T("Windows 2000");
+ else if (osvi.dwMajorVersion <= 4)
+ ret= _T("Windows NT");
+ else
+ ret.Format(_T("Windows %u.%u"), osvi.dwMajorVersion, osvi.dwMinorVersion);
+ if (lstrlen(osvi.szCSDVersion) > 0)
+ {
+ CString s;
+ s.Format(_T(" (%s)"), osvi.szCSDVersion);
+ ret+= s;
+ }
+ break;
+
+ case VER_PLATFORM_WIN32_WINDOWS:
+ if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
+ {
+ ret= _T("Windows 95");
+ if (osvi.szCSDVersion[1] == _T('C') || osvi.szCSDVersion[1] == _T('B'))
+ ret+= _T(" OSR2");
+ }
+ else if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
+ {
+ ret= _T("Windows 98");
+ if (osvi.szCSDVersion[1] == _T('A'))
+ ret+= _T(" SE");
+ }
+ else if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
+ {
+ ret= _T("Windows ME");
+ }
+ else
+ {
+ ret.Format(_T("<platform %u %u.%u>"), osvi.dwPlatformId, osvi.dwMajorVersion, osvi.dwMinorVersion);
+ }
+ break;
+
+ case VER_PLATFORM_WIN32s:
+ ret= _T("Win32s\n"); // ooops!!
+ break;
+
+ default:
+ ret.Format(_T("<platform id %u>"), osvi.dwPlatformId);
+ break;
+ }
+
+ return ret;
+}
+
+
+
+