8f2d30a205466bcf204148e2d1f4348d243b6f91
[reactos.git] / reactos / ntoskrnl / rtl / misc.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/rtl/misc.c
6 * PURPOSE: Various functions
7 *
8 * PROGRAMMERS: Hartmut Birr
9 */
10
11 /* INCLUDES *****************************************************************/
12
13 #include <ntoskrnl.h>
14 #define NDEBUG
15 #include <internal/debug.h>
16
17 /* GLOBALS *******************************************************************/
18
19 extern ULONG NtGlobalFlag;
20 extern ULONG NtMajorVersion;
21 extern ULONG NtMinorVersion;
22 extern ULONG NtOSCSDVersion;
23
24 /* FUNCTIONS *****************************************************************/
25
26 /*
27 * @implemented
28 */
29 ULONG
30 STDCALL
31 RtlGetNtGlobalFlags(VOID)
32 {
33 return(NtGlobalFlag);
34 }
35
36
37 /*
38 * @implemented
39 */
40 NTSTATUS STDCALL
41 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
42 {
43 if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) ||
44 lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
45 {
46 lpVersionInformation->dwMajorVersion = NtMajorVersion;
47 lpVersionInformation->dwMinorVersion = NtMinorVersion;
48 lpVersionInformation->dwBuildNumber = NtBuildNumber;
49 lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
50 if(((NtOSCSDVersion >> 8) & 0xFF) != 0)
51 {
52 int i = _snwprintf(lpVersionInformation->szCSDVersion,
53 (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0])) - 1,
54 L"Service Pack %d",
55 ((NtOSCSDVersion >> 8) & 0xFF));
56 lpVersionInformation->szCSDVersion[i] = L'\0';
57 }
58 else
59 {
60 RtlZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
61 }
62 if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))
63 {
64 RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)lpVersionInformation;
65 InfoEx->wServicePackMajor = (NtOSCSDVersion >> 8) & 0xFF;
66 InfoEx->wServicePackMinor = NtOSCSDVersion & 0xFF;
67 InfoEx->wSuiteMask = SharedUserData->SuiteMask;
68 InfoEx->wProductType = SharedUserData->NtProductType;
69 }
70
71 return STATUS_SUCCESS;
72 }
73
74 return STATUS_INVALID_PARAMETER;
75 }
76