2 * Use the GetVersionEx() Win32 API call to show information about
3 * which version of Windows we're running (or which version of Windows
4 * Wine believes it is masquerading as).
6 * Copyright 1999 by Morten Eriksen <mailto:mortene@sim.no>
15 /* External declaration here because we don't want to depend on Wine's
17 extern HINSTANCE MAIN_WinelibInit( int *argc, char *argv[] );
28 lasterr = GetLastError();
30 result = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
31 FORMAT_MESSAGE_FROM_SYSTEM |
32 FORMAT_MESSAGE_IGNORE_INSERTS,
41 fprintf(stderr, "Win32 API error (%ld):\t%s", lasterr, buffer);
42 LocalFree((HLOCAL)buffer);
45 fprintf(stderr, "Win32 API error (%ld)", lasterr);
50 main(int argc, char ** argv)
57 if (!(hinst = MAIN_WinelibInit(&argc, argv))) return 0;
60 /* FIXME: GetVersionEx() is a Win32 API call, so there should be a
61 preliminary check to see if we're running bare-bones Windows3.xx
62 (or even lower?). 19990916 mortene. */
64 oiv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
65 result = GetVersionEx(&oiv);
67 if (result == FALSE) {
71 char * platforms[] = {
72 "Win32s on Windows 3.1",
73 "Win32 on Windows 95 or Windows 98",
74 "Win32 on Windows NT/Windows 2000",
79 switch (oiv.dwPlatformId) {
80 case VER_PLATFORM_WIN32s: platformval = 0; break;
81 case VER_PLATFORM_WIN32_WINDOWS: platformval = 1; break;
82 case VER_PLATFORM_WIN32_NT: platformval = 2; break;
86 "MajorVersion: %ld\nMinorVersion: %ld\nBuildNumber: 0x%lx\n"
87 "Platform: %s\nCSDVersion: '%s'\n",
88 oiv.dwMajorVersion, oiv.dwMinorVersion, oiv.dwBuildNumber,
89 platforms[platformval], oiv.szCSDVersion);