3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/rtl/misc.c
6 * PURPOSE: Various functions
8 * PROGRAMMERS: Hartmut Birr
11 /* INCLUDES *****************************************************************/
15 #include <internal/debug.h>
17 /* GLOBALS *******************************************************************/
19 extern ULONG NtGlobalFlag
;
20 extern ULONG NtMajorVersion
;
21 extern ULONG NtMinorVersion
;
22 extern ULONG NtOSCSDVersion
;
24 /* header hell made me do this...sorry */
25 typedef struct _OSVERSIONINFOW
{
26 DWORD dwOSVersionInfoSize
;
31 WCHAR szCSDVersion
[ 128 ];
32 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
34 typedef struct _OSVERSIONINFOEXW
{
35 DWORD dwOSVersionInfoSize
;
40 WCHAR szCSDVersion
[ 128 ];
41 WORD wServicePackMajor
;
42 WORD wServicePackMinor
;
46 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
48 #ifndef VER_PLATFORM_WIN32_NT
49 #define VER_PLATFORM_WIN32_NT (2)
52 /* FUNCTIONS *****************************************************************/
59 RtlGetNtGlobalFlags(VOID
)
69 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
)
71 if (lpVersionInformation
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOW
) ||
72 lpVersionInformation
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
74 lpVersionInformation
->dwMajorVersion
= NtMajorVersion
;
75 lpVersionInformation
->dwMinorVersion
= NtMinorVersion
;
76 lpVersionInformation
->dwBuildNumber
= NtBuildNumber
;
77 lpVersionInformation
->dwPlatformId
= VER_PLATFORM_WIN32_NT
;
78 if(((NtOSCSDVersion
>> 8) & 0xFF) != 0)
80 int i
= _snwprintf(lpVersionInformation
->szCSDVersion
,
81 (sizeof(lpVersionInformation
->szCSDVersion
) / sizeof(lpVersionInformation
->szCSDVersion
[0])) - 1,
83 ((NtOSCSDVersion
>> 8) & 0xFF));
84 lpVersionInformation
->szCSDVersion
[i
] = L
'\0';
88 RtlZeroMemory(lpVersionInformation
->szCSDVersion
, sizeof(lpVersionInformation
->szCSDVersion
));
90 if (lpVersionInformation
->dwOSVersionInfoSize
== sizeof(OSVERSIONINFOEXW
))
92 RTL_OSVERSIONINFOEXW
*InfoEx
= (RTL_OSVERSIONINFOEXW
*)lpVersionInformation
;
93 InfoEx
->wServicePackMajor
= (NtOSCSDVersion
>> 8) & 0xFF;
94 InfoEx
->wServicePackMinor
= NtOSCSDVersion
& 0xFF;
95 InfoEx
->wSuiteMask
= SharedUserData
->SuiteMask
;
96 InfoEx
->wProductType
= SharedUserData
->NtProductType
;
99 return STATUS_SUCCESS
;
102 return STATUS_INVALID_PARAMETER
;