3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * PURPOSE: Various functions
6 * FILE: lib/ntdll/rtl/misc.c
7 * PROGRAMER: Eric Kohl <ekohl@zr-online.de>
12 /* INCLUDES *****************************************************************/
18 /**********************************************************************
23 * Retrieves the OS product type.
26 * ProductType Pointer to the product type variable.
29 * TRUE if successful, otherwise FALSE
32 * ProductType can be one of the following values:
33 * 1 Workstation (Winnt)
35 * 3 Advanced Server (Servernt)
44 RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType
)
46 *ProductType
= SharedUserData
->NtProductType
;
50 /**********************************************************************
52 * RtlGetNtVersionNumbers
55 * Get the version numbers of the run time library.
58 * major [OUT] Destination for the Major version
59 * minor [OUT] Destination for the Minor version
60 * build [OUT] Destination for the Build version
66 * Introduced in Windows XP (NT5.1)
72 RtlGetNtVersionNumbers(LPDWORD major
, LPDWORD minor
, LPDWORD build
)
74 PPEB pPeb
= NtCurrentPeb();
78 /* msvcrt.dll as released with XP Home fails in DLLMain() if the
79 * major version is not 5. So, we should never set a version < 5 ...
80 * This makes sense since this call didn't exist before XP anyway.
82 *major
= pPeb
->OSMajorVersion
< 5 ? 5 : pPeb
->OSMajorVersion
;
87 if (pPeb
->OSMinorVersion
<= 5)
88 *minor
= pPeb
->OSMinorVersion
< 1 ? 1 : pPeb
->OSMinorVersion
;
90 *minor
= pPeb
->OSMinorVersion
;
95 /* FIXME: Does anybody know the real formula? */
96 *build
= (0xF0000000 | pPeb
->OSBuildNumber
);
105 RtlGetNtGlobalFlags(VOID
)
107 PPEB pPeb
= NtCurrentPeb();
108 return pPeb
->NtGlobalFlag
;
117 RtlEncodePointer(IN PVOID Pointer
)
122 Status
= NtQueryInformationProcess(NtCurrentProcess(),
128 if(!NT_SUCCESS(Status
))
130 DPRINT1("Failed to receive the process cookie! Status: 0x%x\n", Status
);
134 return (PVOID
)((ULONG_PTR
)Pointer
^ Cookie
);