18 #include <sys/utsname.h>
36 const char *client_version;
37 const char *server_version;
38 } win_version_table[] = {
49 { 10, 0,
"Windows 10",
"Windows Server 2016" },
50 { 6, 3,
"Windows 8.1",
"Windows Server 2012 R2" },
51 { 6, 2,
"Windows 8",
"Windows Server 2012" },
52 { 6, 1,
"Windows 7",
"Windows Server 2008 R2" },
53 { 6, 0,
"Windows Vista",
"Windows Server 2008" },
54 { 5, 2,
"Windows XP Professional",
"Windows Server 2003" },
56 { 5, 1,
"Windows XP",
"Windows XP Server" },
57 { 5, 0,
"Windows 2000 Professional",
"Windows 2000 Server" },
74 if (uname(&u) != -1) {
85 const char *plat = NULL;
86 memset(&info, 0,
sizeof(info));
87 info.dwOSVersionInfoSize =
sizeof(info);
88 if (! GetVersionEx((LPOSVERSIONINFO)&info)) {
89 strlcpy(
uname_result,
"Bizarre version of Windows where GetVersionEx"
95 if (info.wProductType == VER_NT_SERVER ||
96 info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
103 for (i=0; win_version_table[i].major>0; ++i) {
104 if (win_version_table[i].major == info.dwMajorVersion &&
105 win_version_table[i].minor == info.dwMinorVersion) {
107 plat = win_version_table[i].server_version;
111 plat = win_version_table[i].client_version;
119 if (info.dwMajorVersion > win_version_table[0].major ||
120 (info.dwMajorVersion == win_version_table[0].major &&
121 info.dwMinorVersion > win_version_table[0].minor))
123 "Very recent version of Windows [major=%d,minor=%d]",
124 (
int)info.dwMajorVersion,(
int)info.dwMinorVersion);
127 "Unrecognized version of Windows [major=%d,minor=%d]",
128 (
int)info.dwMajorVersion,(
int)info.dwMinorVersion);
138 if (info.dwMajorVersion > 6 ||
139 (info.dwMajorVersion == 6 && info.dwMinorVersion >= 2)) {
146 if (!is_server && !is_client) {
Header for compat_string.c.
int tor_snprintf(char *str, size_t size, const char *format,...)
#define MOCK_IMPL(rv, funcname, arglist)
static int uname_result_is_set
const char * get_uname(void)
static char uname_result[256]