update for HEAD-2003091401
[reactos.git] / lib / ntdll / rtl / misc.c
1 /* $Id$
2  *
3  * COPYRIGHT:         See COPYING in the top level directory
4  * PROJECT:           ReactOS kernel
5  * PURPOSE:           Various functions
6  * FILE:              lib/ntdll/rtl/misc.c
7  * PROGRAMER:         Eric Kohl <ekohl@zr-online.de>
8  * REVISION HISTORY:
9  *                    10/08/2000: Created
10  */
11
12 /* INCLUDES *****************************************************************/
13
14 #include <windows.h>
15 #include <ddk/ntddk.h>
16 #include <ntdll/rtl.h>
17
18 /* GLOBALS ******************************************************************/
19
20 extern ULONG NtGlobalFlag;
21
22 /* FUNCTIONS ****************************************************************/
23
24 /**********************************************************************
25  * NAME                                                 EXPORTED
26  *      RtlGetNtGlobalFlags
27  *
28  * DESCRIPTION
29  *      Retrieves the global os flags.
30  *
31  * ARGUMENTS
32  *      None
33  *
34  * RETURN VALUE
35  *      global flags
36  *
37  * REVISIONS
38  *      2000-08-10 ekohl
39  */
40
41 ULONG STDCALL
42 RtlGetNtGlobalFlags(VOID)
43 {
44   return(NtGlobalFlag);
45 }
46
47
48 /**********************************************************************
49  * NAME                                                 EXPORTED
50  *      RtlGetNtProductType
51  *
52  * DESCRIPTION
53  *      Retrieves the OS product type.
54  *
55  * ARGUMENTS
56  *      ProductType     Pointer to the product type variable.
57  *
58  * RETURN VALUE
59  *      TRUE if successful, otherwise FALSE
60  *
61  * NOTE
62  *      ProductType can be one of the following values:
63  *        1     Workstation (Winnt)
64  *        2     Server (Lanmannt)
65  *        3     Advanced Server (Servernt)
66  *
67  * REVISIONS
68  *      2000-08-10 ekohl
69  *
70  * @implemented
71  */
72
73 BOOLEAN STDCALL
74 RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType)
75 {
76   *ProductType = SharedUserData->NtProductType;
77   return(TRUE);
78 }
79
80 /**********************************************************************
81  * NAME                                                 EXPORTED
82  *      RtlGetNtVersionNumbers
83  *
84  * DESCRIPTION
85  *      Get the version numbers of the run time library.
86  *
87  * ARGUMENTS
88  *      major [OUT]     Destination for the Major version
89  *      minor [OUT]     Destination for the Minor version
90  *      build [OUT]     Destination for the Build version
91  *
92  * RETURN VALUE
93  *      Nothing.
94  *
95  * NOTE
96  *      Introduced in Windows XP (NT5.1)
97  *
98  * @implemented
99  */
100
101 void STDCALL
102 RtlGetNtVersionNumbers(LPDWORD major, LPDWORD minor, LPDWORD build)
103 {
104         PPEB pPeb = NtCurrentPeb();
105
106         if (major)
107         {
108                 /* msvcrt.dll as released with XP Home fails in DLLMain() if the
109                  * major version is not 5. So, we should never set a version < 5 ...
110                  * This makes sense since this call didn't exist before XP anyway.
111                  */
112                 *major = pPeb->OSMajorVersion < 5 ? 5 : pPeb->OSMajorVersion;
113         }
114
115         if (minor)
116         {
117                 *minor = pPeb->OSMinorVersion;
118         }
119
120         if (build)
121         {
122                 /* FIXME: Does anybody know the real formula? */
123                 *build = (0xF0000000 | pPeb->OSBuildNumber);
124         }
125 }
126
127 /* EOF */