From 658b4ff8fd6654aac15f84a93954f974de984b33 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 27 Sep 2003 08:14:56 +0000 Subject: [PATCH] * wincap.cc (wincapc::init): Allow requesting server info for NT4 SP6. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/wincap.cc | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6f09fbd08..d2924ade9 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2003-09-27 Corinna Vinschen + + * wincap.cc (wincapc::init): Allow requesting server info for NT4 SP6. + 2003-09-27 Christopher Faylor * path.cc (symlink_info::check): Use new introducer for mknod'ed files. diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index 0f69abee9..a56f0a159 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -533,13 +533,15 @@ void wincapc::init () { const char *os; + bool has_osversioninfoex = false; if (caps) return; // already initialized memset (&version, 0, sizeof version); + /* Request simple version info first. */ version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - GetVersionEx (reinterpret_cast (&version)); + GetVersionEx (reinterpret_cast(&version)); switch (version.dwPlatformId) { @@ -555,10 +557,15 @@ wincapc::init () if (strcmp (version.szCSDVersion, "Service Pack 4") < 0) caps = &wincap_nt4; else - caps = &wincap_nt4sp4; + { + caps = &wincap_nt4sp4; + if (strcmp (version.szCSDVersion, "Service Pack 6") >= 0) + has_osversioninfoex = true; + } break; case 5: os = "NT"; + has_osversioninfoex = true; switch (version.dwMinorVersion) { case 0: @@ -612,9 +619,11 @@ wincapc::init () break; } - if (((wincaps *)this->caps)->is_winnt && version.dwMajorVersion > 4) + if (has_osversioninfoex) { - version.dwOSVersionInfoSize = sizeof version; + /* Request extended version to get server info. + Available since NT4 SP6. */ + version.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX); GetVersionEx (reinterpret_cast(&version)); if (version.wProductType != VER_NT_WORKSTATION) ((wincaps *)this->caps)->is_server = true;