2
* Copyright (C) 2002 Internet Software Consortium.
4
* Permission to use, copy, modify, and distribute this software for any
5
* purpose with or without fee is hereby granted, provided that the above
6
* copyright notice and this permission notice appear in all copies.
8
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
10
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
12
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
14
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
/* $Id: win32os.c,v 1.2 2002/08/03 01:36:24 mayer Exp $ */
22
#include <isc/win32os.h>
24
static BOOL bInit = FALSE;
25
static OSVERSIONINFOEX osVer;
28
initialize_action(void) {
34
* NOTE: VC++ 6.0 gets this function declaration wrong
35
* so we compensate by casting the argument
37
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
38
bSuccess = GetVersionEx((OSVERSIONINFO *) &osVer);
41
* Versions of NT before NT4.0 SP6 did not return the
42
* extra info that the EX structure provides and returns
43
* a failure so we need to retry with the old structure.
46
osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
47
bSuccess = GetVersionEx((OSVERSIONINFO *) &osVer);
53
isc_win32os_majorversion(void) {
55
return ((unsigned int)osVer.dwMajorVersion);
59
isc_win32os_minorversion(void) {
61
return ((unsigned int)osVer.dwMinorVersion);
65
isc_win32os_servicepackmajor(void) {
67
return ((unsigned int)osVer.wServicePackMajor);
71
isc_win32os_servicepackminor(void) {
73
return ((unsigned int)osVer.wServicePackMinor);
77
isc_win32os_versioncheck(unsigned int major, unsigned int minor,
78
unsigned int spmajor, unsigned int spminor) {
82
if (major < isc_win32os_majorversion())
84
if (major > isc_win32os_majorversion())
86
if (minor < isc_win32os_minorversion())
88
if (minor > isc_win32os_minorversion())
90
if (spmajor < isc_win32os_servicepackmajor())
92
if (spmajor > isc_win32os_servicepackmajor())
94
if (spminor < isc_win32os_servicepackminor())
96
if (spminor > isc_win32os_servicepackminor())
b'\\ No newline at end of file'