2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/rtl/misc.c
5 * PURPOSE: Various functions
10 /* INCLUDES *****************************************************************/
16 /* GLOBALS *******************************************************************/
18 extern ULONG NtGlobalFlag
;
19 extern ULONG NtMajorVersion
;
20 extern ULONG NtMinorVersion
;
21 extern ULONG NtOSCSDVersion
;
23 /* FUNCTIONS *****************************************************************/
30 RtlGetNtGlobalFlags(VOID
)
40 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
)
44 if (lpVersionInformation
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOW
) ||
45 lpVersionInformation
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
47 lpVersionInformation
->dwMajorVersion
= NtMajorVersion
;
48 lpVersionInformation
->dwMinorVersion
= NtMinorVersion
;
49 lpVersionInformation
->dwBuildNumber
= NtBuildNumber
;
50 lpVersionInformation
->dwPlatformId
= VER_PLATFORM_WIN32_NT
;
51 RtlZeroMemory(lpVersionInformation
->szCSDVersion
, sizeof(lpVersionInformation
->szCSDVersion
));
52 if(((CmNtCSDVersion
>> 8) & 0xFF) != 0)
54 MaxLength
= (sizeof(lpVersionInformation
->szCSDVersion
) / sizeof(lpVersionInformation
->szCSDVersion
[0])) - 1;
55 i
= _snwprintf(lpVersionInformation
->szCSDVersion
,
58 ((CmNtCSDVersion
>> 8) & 0xFF));
61 /* null-terminate if it was overflowed */
62 lpVersionInformation
->szCSDVersion
[MaxLength
] = L
'\0';
65 if (lpVersionInformation
->dwOSVersionInfoSize
== sizeof(OSVERSIONINFOEXW
))
67 RTL_OSVERSIONINFOEXW
*InfoEx
= (RTL_OSVERSIONINFOEXW
*)lpVersionInformation
;
68 InfoEx
->wServicePackMajor
= (USHORT
)(CmNtCSDVersion
>> 8) & 0xFF;
69 InfoEx
->wServicePackMinor
= (USHORT
)(CmNtCSDVersion
& 0xFF);
70 InfoEx
->wSuiteMask
= (USHORT
)SharedUserData
->SuiteMask
;
71 InfoEx
->wProductType
= SharedUserData
->NtProductType
;
74 return STATUS_SUCCESS
;
77 return STATUS_INVALID_PARAMETER
;