From 598fa7fea7ed059b959aa307146baa8e6b968c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sat, 18 Dec 2004 21:06:25 +0000 Subject: [PATCH] Set version info to NT 4.0 Build 1381 Service Pack 6 and include ReactOS version number after Windows version in szCSDVersion svn path=/trunk/; revision=12202 --- reactos/lib/kernel32/misc/env.c | 34 ++++++++++++++++++++++++++++----- reactos/ntoskrnl/ps/process.c | 4 ++-- reactos/subsys/system/cmd/ver.c | 22 +++++++++++++++------ 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/reactos/lib/kernel32/misc/env.c b/reactos/lib/kernel32/misc/env.c index b9ae5dc3875..477a3e4eace 100644 --- a/reactos/lib/kernel32/misc/env.c +++ b/reactos/lib/kernel32/misc/env.c @@ -1,4 +1,4 @@ -/* $Id: env.c,v 1.25 2004/01/23 21:16:03 ekohl Exp $ +/* $Id: env.c,v 1.26 2004/12/18 21:06:25 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -254,6 +254,7 @@ GetVersionExW( ) { PPEB pPeb = NtCurrentPeb(); + WCHAR *RosVersion; /* TODO: move this into RtlGetVersion */ switch(lpVersionInformation->dwOSVersionInfoSize) @@ -281,12 +282,18 @@ GetVersionExW( lpVersionInformation->dwBuildNumber = pPeb->OSBuildNumber; lpVersionInformation->dwPlatformId = pPeb->OSPlatformId; - /* version string is "ReactOS x.y.z" */ + /* First the Windows compatible string */ + _snwprintf(lpVersionInformation->szCSDVersion, + sizeof(lpVersionInformation->szCSDVersion) / sizeof(WCHAR), + L"Service Pack %u", pPeb->SPMajorVersion); + /* Add the Reactos-specific string */ + RosVersion = lpVersionInformation->szCSDVersion + wcslen(lpVersionInformation->szCSDVersion) + 1; wcsncpy ( - lpVersionInformation->szCSDVersion, + RosVersion, L"ReactOS " KERNEL_VERSION_STR L" (Build " KERNEL_VERSION_BUILD_STR L")", - sizeof(lpVersionInformation->szCSDVersion) / sizeof(WCHAR) + sizeof(lpVersionInformation->szCSDVersion) / sizeof(WCHAR) - + ((RosVersion - lpVersionInformation->szCSDVersion) + 1) ); /* null-terminate, just in case */ @@ -377,7 +384,24 @@ GetVersionExA( ] = 0; wstrVerStr.Length = wcslen(wstrVerStr.Buffer) * sizeof(WCHAR); - /* convert the version string */ + /* convert the win version string */ + nErrCode = RtlUnicodeStringToAnsiString(&strVerStr, &wstrVerStr, FALSE); + + if(!NT_SUCCESS(nErrCode)) + { + /* failure */ + SetLastErrorByStatus(nErrCode); + return FALSE; + } + + wstrVerStr.Buffer = oviVerInfo.szCSDVersion + wstrVerStr.Length / sizeof(WCHAR) + 1; + wstrVerStr.MaximumLength = sizeof(oviVerInfo.szCSDVersion) - (wstrVerStr.Length + sizeof(WCHAR)); + wstrVerStr.Length = wcslen(wstrVerStr.Buffer) * sizeof(WCHAR); + strVerStr.Buffer = lpVersionInformation->szCSDVersion + strVerStr.Length + 1; + strVerStr.MaximumLength = sizeof(lpVersionInformation->szCSDVersion) - (strVerStr.Length + 1); + strVerStr.Length = 0; + + /* convert the ReactOS version string */ nErrCode = RtlUnicodeStringToAnsiString(&strVerStr, &wstrVerStr, FALSE); if(!NT_SUCCESS(nErrCode)) diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index cfaed3e18c6..727bf63e84f 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.158 2004/12/05 15:42:42 weiden Exp $ +/* $Id: process.c,v 1.159 2004/12/18 21:06:25 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -499,7 +499,7 @@ PsCreatePeb(HANDLE ProcessHandle, Peb->OSMajorVersion = 4; Peb->OSMinorVersion = 0; - Peb->OSBuildNumber = 0; + Peb->OSBuildNumber = 1381; Peb->OSPlatformId = 2; //VER_PLATFORM_WIN32_NT; Peb->SPMajorVersion = 6; diff --git a/reactos/subsys/system/cmd/ver.c b/reactos/subsys/system/cmd/ver.c index 311489961d1..4cc70c70fe6 100644 --- a/reactos/subsys/system/cmd/ver.c +++ b/reactos/subsys/system/cmd/ver.c @@ -27,17 +27,27 @@ VOID ShortVersion (VOID) { OSVERSIONINFO VersionInfo; + unsigned RosVersionLen; + LPTSTR RosVersion; ConOutPuts (_T("\n" SHELLINFO)); VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if (GetVersionEx(&VersionInfo) && 0 == _tcsnicmp(VersionInfo.szCSDVersion, _T("ReactOS"), 7)) - { - ConOutPrintf(_T("%S running on %s"), SHELLVER, VersionInfo.szCSDVersion); - } - else - { +#ifdef _UNICODE ConOutPrintf(_T("%S"), SHELLVER); +#else + ConOutPrintf(_T("%s"), SHELLVER); +#endif /* _UNICODE */ + memset(VersionInfo.szCSDVersion, 0, sizeof(VersionInfo.szCSDVersion)); + if (GetVersionEx(&VersionInfo)) + { + RosVersion = VersionInfo.szCSDVersion + _tcslen(VersionInfo.szCSDVersion) + 1; + RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) - + (RosVersion - VersionInfo.szCSDVersion); + if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion, _T("ReactOS"), 7)) + { + ConOutPrintf(_T(" running on %s"), RosVersion); + } } ConOutPuts (_T("\n")); }