ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

version.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:       See COPYING in the top level directory
00003  * PROJECT:         ReactOS system libraries
00004  * FILE:            lib/ntdll/rtl/process.c
00005  * PURPOSE:         Process functions
00006  * PROGRAMMER:      Ariadne ( ariadne@xs4all.nl)
00007  * UPDATE HISTORY:
00008  *                  Created 01/11/98
00009  */
00010 
00011 /* INCLUDES ****************************************************************/
00012 
00013 #include <ntdll.h>
00014 #define NDEBUG
00015 #include <debug.h>
00016 
00017 /* FUNCTIONS ****************************************************************/
00018 
00019 /**********************************************************************
00020  * NAME                         EXPORTED
00021  *  RtlGetNtProductType
00022  *
00023  * DESCRIPTION
00024  *  Retrieves the OS product type.
00025  *
00026  * ARGUMENTS
00027  *  ProductType Pointer to the product type variable.
00028  *
00029  * RETURN VALUE
00030  *  TRUE if successful, otherwise FALSE
00031  *
00032  * NOTE
00033  *  ProductType can be one of the following values:
00034  *    1 Workstation (Winnt)
00035  *    2 Server (Lanmannt)
00036  *    3 Advanced Server (Servernt)
00037  *
00038  * REVISIONS
00039  *  2000-08-10 ekohl
00040  *
00041  * @implemented
00042  */
00043 
00044 BOOLEAN NTAPI
00045 RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType)
00046 {
00047   *ProductType = SharedUserData->NtProductType;
00048   return(TRUE);
00049 }
00050 
00051 /**********************************************************************
00052  * NAME                         EXPORTED
00053  *  RtlGetNtVersionNumbers
00054  *
00055  * DESCRIPTION
00056  *  Get the version numbers of the run time library.
00057  *
00058  * ARGUMENTS
00059  *  major [OUT] Destination for the Major version
00060  *  minor [OUT] Destination for the Minor version
00061  *  build [OUT] Destination for the Build version
00062  *
00063  * RETURN VALUE
00064  *  Nothing.
00065  *
00066  * NOTE
00067  *  Introduced in Windows XP (NT5.1)
00068  *
00069  * @implemented
00070  */
00071 
00072 void NTAPI
00073 RtlGetNtVersionNumbers(LPDWORD major, LPDWORD minor, LPDWORD build)
00074 {
00075     PPEB pPeb = NtCurrentPeb();
00076 
00077     if (major)
00078     {
00079         /* msvcrt.dll as released with XP Home fails in DLLMain() if the
00080          * major version is not 5. So, we should never set a version < 5 ...
00081          * This makes sense since this call didn't exist before XP anyway.
00082          */
00083         *major = pPeb->OSMajorVersion < 5 ? 5 : pPeb->OSMajorVersion;
00084     }
00085 
00086     if (minor)
00087     {
00088         if (pPeb->OSMinorVersion <= 5)
00089             *minor = pPeb->OSMinorVersion < 1 ? 1 : pPeb->OSMinorVersion;
00090         else
00091             *minor = pPeb->OSMinorVersion;
00092     }
00093 
00094     if (build)
00095     {
00096         /* FIXME: Does anybody know the real formula? */
00097         *build = (0xF0000000 | pPeb->OSBuildNumber);
00098     }
00099 }
00100 
00101 /*
00102 * @implemented
00103 */
00104 NTSTATUS NTAPI
00105 RtlGetVersion(RTL_OSVERSIONINFOW *Info)
00106 {
00107    LONG i, MaxLength;
00108 
00109    if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) ||
00110        Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
00111    {
00112       PPEB Peb = NtCurrentPeb();
00113 
00114       Info->dwMajorVersion = Peb->OSMajorVersion;
00115       Info->dwMinorVersion = Peb->OSMinorVersion;
00116       Info->dwBuildNumber = Peb->OSBuildNumber;
00117       Info->dwPlatformId = Peb->OSPlatformId;
00118       RtlZeroMemory(Info->szCSDVersion, sizeof(Info->szCSDVersion));
00119       if(((Peb->OSCSDVersion >> 8) & 0xFF) != 0)
00120       {
00121         MaxLength = (sizeof(Info->szCSDVersion) / sizeof(Info->szCSDVersion[0])) - 1;
00122         i = _snwprintf(Info->szCSDVersion,
00123                        MaxLength,
00124                        L"Service Pack %d",
00125                        ((Peb->OSCSDVersion >> 8) & 0xFF));
00126         if (i < 0)
00127         {
00128            /* null-terminate if it was overflowed */
00129            Info->szCSDVersion[MaxLength] = L'\0';
00130         }
00131       }
00132       if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
00133       {
00134          RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)Info;
00135          InfoEx->wServicePackMajor = (Peb->OSCSDVersion >> 8) & 0xFF;
00136          InfoEx->wServicePackMinor = Peb->OSCSDVersion & 0xFF;
00137          InfoEx->wSuiteMask = SharedUserData->SuiteMask;
00138          InfoEx->wProductType = SharedUserData->NtProductType;
00139       }
00140 
00141       return STATUS_SUCCESS;
00142    }
00143 
00144    return STATUS_INVALID_PARAMETER;
00145 }
00146 
00147 /* EOF */

Generated on Sat May 26 2012 04:18:05 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.