summaryrefslogtreecommitdiff
path: root/src/pal/src/misc/version.cpp
blob: db5e61b8ad6b2982e3627ccf1c94a247adea309c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
//

/*++



Module Name:

    version.c

Abstract:

    Implementation of functions for getting platform.OS versions.

Revision History:



--*/

#include "pal/palinternal.h"
#include "pal/dbgmsg.h"

SET_DEFAULT_DEBUG_CHANNEL(MISC);

/*++
Function:
  GetVersionExA



GetVersionEx

The GetVersionEx function obtains extended information about the
version of the operating system that is currently running.

Parameters

lpVersionInfo 
       [in/out] Pointer to an OSVERSIONINFO data structure that the
       function fills with operating system version information.

       Before calling the GetVersionEx function, set the
       dwOSVersionInfoSize member of the OSVERSIONINFO data structure
       to sizeof(OSVERSIONINFO).

Return Values

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error
information, call GetLastError. The function fails if you specify an
invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO
structure.

--*/
BOOL
PALAPI
GetVersionExA(
	      IN OUT LPOSVERSIONINFOA lpVersionInformation)
{
    BOOL bRet = TRUE;
    PERF_ENTRY(GetVersionExA);
    ENTRY("GetVersionExA (lpVersionInformation=%p)\n", lpVersionInformation);

    if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOA))
    {
        lpVersionInformation->dwMajorVersion = 5;       /* same as WIN2000 */
        lpVersionInformation->dwMinorVersion = 0;       /* same as WIN2000 */
        lpVersionInformation->dwBuildNumber = 0;
        lpVersionInformation->dwPlatformId = VER_PLATFORM_UNIX;
        lpVersionInformation->szCSDVersion[0] = '\0'; /* no service pack */
    } 
    else 
    {
        SetLastError(ERROR_INVALID_PARAMETER);
        bRet = FALSE;
    }
    LOGEXIT("GetVersionExA returning BOOL %d\n", bRet);
    PERF_EXIT(GetVersionExA);
    return bRet;
}


/*++
Function:
  GetVersionExW

See GetVersionExA
--*/
BOOL
PALAPI
GetVersionExW(
	      IN OUT LPOSVERSIONINFOW lpVersionInformation)
{
    BOOL bRet = TRUE;

    PERF_ENTRY(GetVersionExW);
    ENTRY("GetVersionExW (lpVersionInformation=%p)\n", lpVersionInformation);

    if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOW))
    {
        lpVersionInformation->dwMajorVersion = 5;       /* same as WIN2000 */
        lpVersionInformation->dwMinorVersion = 0;       /* same as WIN2000 */
        lpVersionInformation->dwBuildNumber = 0;
        lpVersionInformation->dwPlatformId = VER_PLATFORM_UNIX;
        lpVersionInformation->szCSDVersion[0] = '\0'; /* no service pack */
    } 
    else 
    {
        SetLastError(ERROR_INVALID_PARAMETER);
        bRet =  FALSE;
    }
    LOGEXIT("GetVersionExW returning BOOL %d\n", bRet);
    PERF_EXIT(GetVersionExW);
    return bRet;
}