2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/ntdll/rtl/process.c
5 * PURPOSE: Process functions
6 * PROGRAMMER: Ariadne (ariadne@xs4all.nl)
11 /* INCLUDES ****************************************************************/
17 /* FUNCTIONS ****************************************************************/
19 /**********************************************************************
24 * Retrieves the OS product type.
27 * ProductType Pointer to the product type variable.
30 * TRUE if successful, otherwise FALSE
33 * ProductType can be one of the following values:
34 * 1 Workstation (WinNT)
36 * 3 Advanced Server (ServerNT)
45 RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType
)
47 *ProductType
= SharedUserData
->NtProductType
;
51 /**********************************************************************
53 * RtlGetNtVersionNumbers
56 * Get the version numbers of the run time library.
59 * pdwMajorVersion [OUT] Destination for the Major version
60 * pdwMinorVersion [OUT] Destination for the Minor version
61 * pdwBuildNumber [OUT] Destination for the Build version
67 * - Introduced in Windows XP (NT 5.1)
68 * - Since this call didn't exist before XP, we report at least the version
69 * 5.1. This fixes the loading of msvcrt.dll as released with XP Home,
70 * which fails in DLLMain() if the major version isn't 5.
76 RtlGetNtVersionNumbers(OUT LPDWORD pdwMajorVersion
,
77 OUT LPDWORD pdwMinorVersion
,
78 OUT LPDWORD pdwBuildNumber
)
80 PPEB pPeb
= NtCurrentPeb();
84 *pdwMajorVersion
= pPeb
->OSMajorVersion
< 5 ? 5 : pPeb
->OSMajorVersion
;
89 if ( (pPeb
->OSMajorVersion
< 5) ||
90 ((pPeb
->OSMajorVersion
== 5) && (pPeb
->OSMinorVersion
< 1)) )
93 *pdwMinorVersion
= pPeb
->OSMinorVersion
;
98 /* Windows really does this! */
99 *pdwBuildNumber
= (0xF0000000 | pPeb
->OSBuildNumber
);
107 RtlGetVersion(RTL_OSVERSIONINFOW
*Info
)
111 if (Info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOW
) ||
112 Info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
114 PPEB Peb
= NtCurrentPeb();
116 Info
->dwMajorVersion
= Peb
->OSMajorVersion
;
117 Info
->dwMinorVersion
= Peb
->OSMinorVersion
;
118 Info
->dwBuildNumber
= Peb
->OSBuildNumber
;
119 Info
->dwPlatformId
= Peb
->OSPlatformId
;
120 RtlZeroMemory(Info
->szCSDVersion
, sizeof(Info
->szCSDVersion
));
121 if(((Peb
->OSCSDVersion
>> 8) & 0xFF) != 0)
123 MaxLength
= (sizeof(Info
->szCSDVersion
) / sizeof(Info
->szCSDVersion
[0])) - 1;
124 i
= _snwprintf(Info
->szCSDVersion
,
127 ((Peb
->OSCSDVersion
>> 8) & 0xFF));
130 /* null-terminate if it was overflowed */
131 Info
->szCSDVersion
[MaxLength
] = L
'\0';
134 if (Info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
136 RTL_OSVERSIONINFOEXW
*InfoEx
= (RTL_OSVERSIONINFOEXW
*)Info
;
137 InfoEx
->wServicePackMajor
= (Peb
->OSCSDVersion
>> 8) & 0xFF;
138 InfoEx
->wServicePackMinor
= Peb
->OSCSDVersion
& 0xFF;
139 InfoEx
->wSuiteMask
= SharedUserData
->SuiteMask
& 0xFFFF;
140 InfoEx
->wProductType
= SharedUserData
->NtProductType
;
143 return STATUS_SUCCESS
;
146 return STATUS_INVALID_PARAMETER
;