* cygcheck.cc (dump_sysinfo): Drop code trying to fetch OSVERSIONINFO

if fetching OSVERSIONINFOEX failed.  Drop code handling unsupported
	platform IDs.  Add code to tweak dwMinorVersion on Windows 8.1 if no
	manifest is present.
This commit is contained in:
Corinna Vinschen 2013-11-19 17:44:33 +00:00
parent 670c036efa
commit d134686a10
2 changed files with 22 additions and 21 deletions

View File

@ -1,3 +1,10 @@
2013-11-19 Corinna Vinschen <corinna@vinschen.de>
* cygcheck.cc (dump_sysinfo): Drop code trying to fetch OSVERSIONINFO
if fetching OSVERSIONINFOEX failed. Drop code handling unsupported
platform IDs. Add code to tweak dwMinorVersion on Windows 8.1 if no
manifest is present.
2013-11-19 Corinna Vinschen <corinna@vinschen.de> 2013-11-19 Corinna Vinschen <corinna@vinschen.de>
* Makefile.in (cygcheck.exe): Link against wininet.dll. * Makefile.in (cygcheck.exe): Link against wininet.dll.

View File

@ -1430,7 +1430,6 @@ dump_sysinfo ()
time_t now; time_t now;
char *found_cygwin_dll; char *found_cygwin_dll;
bool is_nt = false; bool is_nt = false;
bool more_info = true;
char osname[128]; char osname[128];
DWORD obcaseinsensitive = 1; DWORD obcaseinsensitive = 1;
HKEY key; HKEY key;
@ -1442,23 +1441,12 @@ dump_sysinfo ()
OSVERSIONINFOEX osversion; OSVERSIONINFOEX osversion;
osversion.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX); osversion.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (!GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&osversion))) if (!GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&osversion)))
{ display_error ("dump_sysinfo: GetVersionEx()");
more_info = false;
osversion.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (!GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&osversion)))
display_error ("dump_sysinfo: GetVersionEx()");
}
HMODULE k32 = GetModuleHandleW (L"kernel32.dll"); HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
switch (osversion.dwPlatformId) switch (osversion.dwPlatformId)
{ {
case VER_PLATFORM_WIN32s:
strcpy (osname, "32s (not supported)");
break;
case VER_PLATFORM_WIN32_WINDOWS:
strcpy (osname, "95/98/Me (not supported)");
break;
case VER_PLATFORM_WIN32_NT: case VER_PLATFORM_WIN32_NT:
is_nt = true; is_nt = true;
if (osversion.dwMajorVersion == 6) if (osversion.dwMajorVersion == 6)
@ -1477,15 +1465,21 @@ dump_sysinfo ()
? "7" : "2008 R2"); ? "7" : "2008 R2");
break; break;
case 2: case 2:
default:
/* No way to distinguish W8 and W8.1 by OS version numbers /* No way to distinguish W8 and W8.1 by OS version numbers
alone. */ alone, unless the executables have a matching manifest.
if (osversion.dwBuildNumber >= 9200) What a big, fat mess. */
strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION if (osversion.dwBuildNumber < 9200)
? "8.1" : "2012 R2"); {
else strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION
strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION ? "8" : "2012");
? "8" : "2012"); break;
}
/*FALLTHRU*/
case 3:
default:
osversion.dwMinorVersion = 3;
strcpy (osname, osversion.wProductType == VER_NT_WORKSTATION
? "8.1" : "2012 R2");
break; break;
} }
DWORD prod; DWORD prod;