From 42db286418ebc27ac6ffe56789eb980bc0da7435 Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Thu, 24 Jul 2003 14:25:33 +0000 Subject: [PATCH] RtlGetNtVersionNumbers (from WINE) svn path=/trunk/; revision=5239 --- reactos/lib/ntdll/def/ntdll.def | 3 +- reactos/lib/ntdll/def/ntdll.edf | 3 +- reactos/lib/ntdll/makefile | 4 +-- reactos/lib/ntdll/rtl/misc.c | 52 ++++++++++++++++++++++++++++++++- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index bb531a01a75..99c3c01aa87 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -1,4 +1,4 @@ -; $Id: ntdll.def,v 1.104 2003/07/06 23:04:19 hyperion Exp $ +; $Id: ntdll.def,v 1.105 2003/07/24 14:25:32 royce Exp $ ; ; ReactOS Operating System ; @@ -429,6 +429,7 @@ RtlGetGroupSecurityDescriptor@12 RtlGetLongestNtPathLength@0 RtlGetNtGlobalFlags@0 RtlGetNtProductType@4 +RtlGetNtVersionNumbers@12 RtlGetOwnerSecurityDescriptor@12 RtlGetProcessHeaps@8 RtlGetSaclSecurityDescriptor@16 diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index 1bd2a61b2bb..b24a8ce6f3f 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -1,4 +1,4 @@ -; $Id: ntdll.edf,v 1.93 2003/07/06 23:04:19 hyperion Exp $ +; $Id: ntdll.edf,v 1.94 2003/07/24 14:25:32 royce Exp $ ; ; ReactOS Operating System ; @@ -428,6 +428,7 @@ RtlGetGroupSecurityDescriptor=RtlGetGroupSecurityDescriptor@12 RtlGetLongestNtPathLength=RtlGetLongestNtPathLength@0 RtlGetNtGlobalFlags=RtlGetNtGlobalFlags@0 RtlGetNtProductType=RtlGetNtProductType@4 +RtlGetNtVersionNumbers=RtlGetNtVersionNumbers@12 RtlGetOwnerSecurityDescriptor=RtlGetOwnerSecurityDescriptor@12 RtlGetProcessHeaps=RtlGetProcessHeaps@8 RtlGetSaclSecurityDescriptor=RtlGetSaclSecurityDescriptor@16 diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index 80e44132c98..7f4c60de026 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.89 2003/07/11 20:55:43 gvg Exp $ +# $Id: makefile,v 1.90 2003/07/24 14:25:32 royce Exp $ PATH_TO_TOP = ../.. @@ -16,7 +16,7 @@ TARGET_LFLAGS = -Wl,--file-alignment,0x1000 \ -Wl,--section-alignment,0x1000 \ -nostartfiles -nostdlib -TARGET_SDKLIBS = string.a rosrtl.a +TARGET_SDKLIBS = string.a rosrtl.a kernel32.a TARGET_GCCLIBS = gcc diff --git a/reactos/lib/ntdll/rtl/misc.c b/reactos/lib/ntdll/rtl/misc.c index 2e1cbb7cca5..1835cccc5f3 100644 --- a/reactos/lib/ntdll/rtl/misc.c +++ b/reactos/lib/ntdll/rtl/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.6 2003/07/11 13:50:23 royce Exp $ +/* $Id: misc.c,v 1.7 2003/07/24 14:25:33 royce Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -11,6 +11,7 @@ /* INCLUDES *****************************************************************/ +#include #include #include @@ -76,4 +77,53 @@ RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType) return(TRUE); } +/********************************************************************** + * NAME EXPORTED + * RtlGetNtVersionNumbers + * + * DESCRIPTION + * Get the version numbers of the run time library. + * + * ARGUMENTS + * major [OUT] Destination for the Major version + * minor [OUT] Destination for the Minor version + * build [OUT] Destination for the Build version + * + * RETURN VALUE + * Nothing. + * + * NOTE + * Introduced in Windows XP (NT5.1) + * + * @implemented + */ + +void STDCALL +RtlGetNtVersionNumbers(LPDWORD major, LPDWORD minor, LPDWORD build) +{ + OSVERSIONINFOEXW versionInfo; + versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); + GetVersionExW((OSVERSIONINFOW*)&versionInfo); + + if (major) + { + /* msvcrt.dll as released with XP Home fails in DLLMain() if the + * major version is not 5. So, we should never set a version < 5 ... + * This makes sense since this call didn't exist before XP anyway. + */ + *major = versionInfo.dwMajorVersion < 5 ? 5 : versionInfo.dwMajorVersion; + } + + if (minor) + { + *minor = versionInfo.dwMinorVersion; + } + + if (build) + { + /* FIXME: Does anybody know the real formula? */ + *build = (0xF0000000 | versionInfo.dwBuildNumber); + } +} + /* EOF */