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 * major [OUT] Destination for the Major version
60 * minor [OUT] Destination for the Minor version
61 * build [OUT] Destination for the Build version
67 * Introduced in Windows XP (NT5.1)
73 RtlGetNtVersionNumbers(LPDWORD major
, LPDWORD minor
, LPDWORD build
)
75 PPEB pPeb
= NtCurrentPeb();
79 /* msvcrt.dll as released with XP Home fails in DLLMain() if the
80 * major version is not 5. So, we should never set a version < 5 ...
81 * This makes sense since this call didn't exist before XP anyway.
83 *major
= pPeb
->OSMajorVersion
< 5 ? 5 : pPeb
->OSMajorVersion
;
88 if (pPeb
->OSMinorVersion
<= 5)
89 *minor
= pPeb
->OSMinorVersion
< 1 ? 1 : pPeb
->OSMinorVersion
;
91 *minor
= pPeb
->OSMinorVersion
;
96 /* FIXME: Does anybody know the real formula? */
97 *build
= (0xF0000000 | pPeb
->OSBuildNumber
);
105 RtlGetVersion(RTL_OSVERSIONINFOW
*Info
)
109 if (Info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOW
) ||
110 Info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
112 PPEB Peb
= NtCurrentPeb();
114 Info
->dwMajorVersion
= Peb
->OSMajorVersion
;
115 Info
->dwMinorVersion
= Peb
->OSMinorVersion
;
116 Info
->dwBuildNumber
= Peb
->OSBuildNumber
;
117 Info
->dwPlatformId
= Peb
->OSPlatformId
;
118 RtlZeroMemory(Info
->szCSDVersion
, sizeof(Info
->szCSDVersion
));
119 if(((Peb
->OSCSDVersion
>> 8) & 0xFF) != 0)
121 MaxLength
= (sizeof(Info
->szCSDVersion
) / sizeof(Info
->szCSDVersion
[0])) - 1;
122 i
= _snwprintf(Info
->szCSDVersion
,
125 ((Peb
->OSCSDVersion
>> 8) & 0xFF));
128 /* null-terminate if it was overflowed */
129 Info
->szCSDVersion
[MaxLength
] = L
'\0';
132 if (Info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
134 RTL_OSVERSIONINFOEXW
*InfoEx
= (RTL_OSVERSIONINFOEXW
*)Info
;
135 InfoEx
->wServicePackMajor
= (Peb
->OSCSDVersion
>> 8) & 0xFF;
136 InfoEx
->wServicePackMinor
= Peb
->OSCSDVersion
& 0xFF;
137 InfoEx
->wSuiteMask
= SharedUserData
->SuiteMask
;
138 InfoEx
->wProductType
= SharedUserData
->NtProductType
;
141 return STATUS_SUCCESS
;
144 return STATUS_INVALID_PARAMETER
;