1 | /*
|
---|
2 | * synergy -- mouse and keyboard sharing utility
|
---|
3 | * Copyright (C) 2004 Chris Schoeneman
|
---|
4 | *
|
---|
5 | * This package is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * found in the file COPYING that should have accompanied this file.
|
---|
8 | *
|
---|
9 | * This package is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | * GNU General Public License for more details.
|
---|
13 | */
|
---|
14 |
|
---|
15 | #define WIN32_LEAN_AND_MEAN
|
---|
16 |
|
---|
17 | #include "CArchSystemWindows.h"
|
---|
18 | #include <windows.h>
|
---|
19 |
|
---|
20 | //
|
---|
21 | // CArchSystemWindows
|
---|
22 | //
|
---|
23 |
|
---|
24 | CArchSystemWindows::CArchSystemWindows()
|
---|
25 | {
|
---|
26 | // do nothing
|
---|
27 | }
|
---|
28 |
|
---|
29 | CArchSystemWindows::~CArchSystemWindows()
|
---|
30 | {
|
---|
31 | // do nothing
|
---|
32 | }
|
---|
33 |
|
---|
34 | std::string
|
---|
35 | CArchSystemWindows::getOSName() const
|
---|
36 | {
|
---|
37 | OSVERSIONINFO info;
|
---|
38 | info.dwOSVersionInfoSize = sizeof(info);
|
---|
39 | if (GetVersionEx(&info)) {
|
---|
40 | switch (info.dwPlatformId) {
|
---|
41 | case VER_PLATFORM_WIN32_NT:
|
---|
42 | if (info.dwMajorVersion == 5 && info.dwMinorVersion == 2) {
|
---|
43 | return "Microsoft Windows Server 2003";
|
---|
44 | }
|
---|
45 | if (info.dwMajorVersion == 5 && info.dwMinorVersion == 1) {
|
---|
46 | return "Microsoft Windows Server XP";
|
---|
47 | }
|
---|
48 | if (info.dwMajorVersion == 5 && info.dwMinorVersion == 0) {
|
---|
49 | return "Microsoft Windows Server 2000";
|
---|
50 | }
|
---|
51 | if (info.dwMajorVersion <= 4) {
|
---|
52 | return "Microsoft Windows NT";
|
---|
53 | }
|
---|
54 | char buffer[100];
|
---|
55 | sprintf(buffer, "Microsoft Windows %d.%d",
|
---|
56 | info.dwMajorVersion, info.dwMinorVersion);
|
---|
57 | return buffer;
|
---|
58 |
|
---|
59 | case VER_PLATFORM_WIN32_WINDOWS:
|
---|
60 | if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0) {
|
---|
61 | if (info.szCSDVersion[1] == 'C' ||
|
---|
62 | info.szCSDVersion[1] == 'B') {
|
---|
63 | return "Microsoft Windows 95 OSR2";
|
---|
64 | }
|
---|
65 | return "Microsoft Windows 95";
|
---|
66 | }
|
---|
67 | if (info.dwMajorVersion == 4 && info.dwMinorVersion == 10) {
|
---|
68 | if (info.szCSDVersion[1] == 'A') {
|
---|
69 | return "Microsoft Windows 98 SE";
|
---|
70 | }
|
---|
71 | return "Microsoft Windows 98";
|
---|
72 | }
|
---|
73 | if (info.dwMajorVersion == 4 && info.dwMinorVersion == 90) {
|
---|
74 | return "Microsoft Windows ME";
|
---|
75 | }
|
---|
76 | if (info.dwMajorVersion == 4) {
|
---|
77 | return "Microsoft Windows unknown 95 family";
|
---|
78 | }
|
---|
79 | break;
|
---|
80 |
|
---|
81 | default:
|
---|
82 | break;
|
---|
83 | }
|
---|
84 | }
|
---|
85 | return "Microsoft Windows <unknown>";
|
---|
86 | }
|
---|