adig: RFC4034 resource record type detection
[platform/upstream/c-ares.git] / ares_platform.c
1
2
3 /* Copyright 1998 by the Massachusetts Institute of Technology.
4  *
5  * Permission to use, copy, modify, and distribute this
6  * software and its documentation for any purpose and without
7  * fee is hereby granted, provided that the above copyright
8  * notice appear in all copies and that both that copyright
9  * notice and this permission notice appear in supporting
10  * documentation, and that the name of M.I.T. not be used in
11  * advertising or publicity pertaining to distribution of the
12  * software without specific, written prior permission.
13  * M.I.T. makes no representations about the suitability of
14  * this software for any purpose.  It is provided "as is"
15  * without express or implied warranty.
16  */
17
18 #include "ares_setup.h"
19 #include "ares_platform.h"
20
21 #if defined(WIN32) && !defined(MSDOS)
22
23 #define V_PLATFORM_WIN32s         0
24 #define V_PLATFORM_WIN32_WINDOWS  1
25 #define V_PLATFORM_WIN32_NT       2
26 #define V_PLATFORM_WIN32_CE       3
27
28 win_platform getplatform(void)
29 {
30   OSVERSIONINFOEX OsvEx;
31
32   memset(&OsvEx, 0, sizeof(OsvEx));
33   OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
34   if (!GetVersionEx((void *)&OsvEx))
35     {
36       memset(&OsvEx, 0, sizeof(OsvEx));
37       OsvEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
38       if (!GetVersionEx((void *)&OsvEx))
39         return WIN_UNKNOWN;
40     }
41
42   switch(OsvEx.dwPlatformId)
43     {
44       case V_PLATFORM_WIN32s:
45         return WIN_3X;
46
47       case V_PLATFORM_WIN32_WINDOWS:
48         return WIN_9X;
49
50       case V_PLATFORM_WIN32_NT:
51         return WIN_NT;
52
53       case V_PLATFORM_WIN32_CE:
54         return WIN_CE;
55
56       default:
57         return WIN_UNKNOWN;
58     }
59 }
60
61 #endif