* wincap.cc (wincapc::init): Allow requesting server info for NT4 SP6.

This commit is contained in:
Corinna Vinschen 2003-09-27 08:14:56 +00:00
parent 341d295422
commit 658b4ff8fd
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2003-09-27 Corinna Vinschen <corinna@vinschen.de>
* wincap.cc (wincapc::init): Allow requesting server info for NT4 SP6.
2003-09-27 Christopher Faylor <cgf@redhat.com> 2003-09-27 Christopher Faylor <cgf@redhat.com>
* path.cc (symlink_info::check): Use new introducer for mknod'ed files. * path.cc (symlink_info::check): Use new introducer for mknod'ed files.

View File

@ -533,13 +533,15 @@ void
wincapc::init () wincapc::init ()
{ {
const char *os; const char *os;
bool has_osversioninfoex = false;
if (caps) if (caps)
return; // already initialized return; // already initialized
memset (&version, 0, sizeof version); memset (&version, 0, sizeof version);
/* Request simple version info first. */
version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
GetVersionEx (reinterpret_cast<LPOSVERSIONINFO> (&version)); GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&version));
switch (version.dwPlatformId) switch (version.dwPlatformId)
{ {
@ -555,10 +557,15 @@ wincapc::init ()
if (strcmp (version.szCSDVersion, "Service Pack 4") < 0) if (strcmp (version.szCSDVersion, "Service Pack 4") < 0)
caps = &wincap_nt4; caps = &wincap_nt4;
else else
caps = &wincap_nt4sp4; {
caps = &wincap_nt4sp4;
if (strcmp (version.szCSDVersion, "Service Pack 6") >= 0)
has_osversioninfoex = true;
}
break; break;
case 5: case 5:
os = "NT"; os = "NT";
has_osversioninfoex = true;
switch (version.dwMinorVersion) switch (version.dwMinorVersion)
{ {
case 0: case 0:
@ -612,9 +619,11 @@ wincapc::init ()
break; 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<LPOSVERSIONINFO>(&version)); GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&version));
if (version.wProductType != VER_NT_WORKSTATION) if (version.wProductType != VER_NT_WORKSTATION)
((wincaps *)this->caps)->is_server = true; ((wincaps *)this->caps)->is_server = true;