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>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 lasterr
= GetLastError();
37 result
= FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
|
38 FORMAT_MESSAGE_FROM_SYSTEM
|
39 FORMAT_MESSAGE_IGNORE_INSERTS
,
48 fprintf(stderr
, "Win32 API error (%ld):\t%s", lasterr
, buffer
);
49 LocalFree((HLOCAL
)buffer
);
52 fprintf(stderr
, "Win32 API error (%ld)", lasterr
);
57 main(int argc
, char ** argv
)
63 /* FIXME: GetVersionEx() is a Win32 API call, so there should be a
64 preliminary check to see if we're running bare-bones Windows3.xx
65 (or even lower?). 19990916 mortene. */
67 oiv
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFO
);
68 result
= GetVersionEx(&oiv
);
70 if (result
== FALSE
) {
74 char * platforms
[] = {
75 "Win32s on Windows 3.1",
76 "Win32 on Windows 95 or Windows 98",
77 "Win32 on Windows NT/Windows 2000",
82 switch (oiv
.dwPlatformId
) {
83 case VER_PLATFORM_WIN32s
: platformval
= 0; break;
84 case VER_PLATFORM_WIN32_WINDOWS
: platformval
= 1; break;
85 case VER_PLATFORM_WIN32_NT
: platformval
= 2; break;
89 "MajorVersion: %ld\nMinorVersion: %ld\nBuildNumber: 0x%lx\n"
90 "Platform: %s\nCSDVersion: '%s'\n",
91 oiv
.dwMajorVersion
, oiv
.dwMinorVersion
, oiv
.dwBuildNumber
,
92 platforms
[platformval
], oiv
.szCSDVersion
);