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