mirror of
https://github.com/reactos/reactos.git
synced 2025-04-28 01:11:35 +00:00
[NTOSKRNL]: RtlGetVersion in the kernel does not fail, does not return a CSD version, and should not be returning negative build numbers. Fix it so that it works as it should (and anyone that relied on correct build numbers will no longer fail).
svn path=/trunk/; revision=59717
This commit is contained in:
parent
f762bc3a74
commit
1f8570be62
1 changed files with 21 additions and 39 deletions
|
@ -33,51 +33,33 @@ RtlGetNtGlobalFlags(VOID)
|
|||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
|
||||
{
|
||||
LONG i;
|
||||
ULONG MaxLength;
|
||||
PAGED_CODE();
|
||||
|
||||
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) ||
|
||||
lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
|
||||
/* Return the basics */
|
||||
lpVersionInformation->dwMajorVersion = NtMajorVersion;
|
||||
lpVersionInformation->dwMinorVersion = NtMinorVersion;
|
||||
lpVersionInformation->dwBuildNumber = NtBuildNumber & 0x3FFF;
|
||||
lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
||||
|
||||
/* Check if this is the extended version */
|
||||
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
|
||||
{
|
||||
lpVersionInformation->dwMajorVersion = NtMajorVersion;
|
||||
lpVersionInformation->dwMinorVersion = NtMinorVersion;
|
||||
lpVersionInformation->dwBuildNumber = NtBuildNumber;
|
||||
lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
||||
RtlZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
|
||||
|
||||
if(((CmNtCSDVersion >> 8) & 0xFF) != 0)
|
||||
{
|
||||
MaxLength = (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0])) - 1;
|
||||
i = _snwprintf(lpVersionInformation->szCSDVersion,
|
||||
MaxLength,
|
||||
L"Service Pack %d",
|
||||
((CmNtCSDVersion >> 8) & 0xFF));
|
||||
if (i < 0)
|
||||
{
|
||||
/* Null-terminate if it was overflowed */
|
||||
lpVersionInformation->szCSDVersion[MaxLength] = L'\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
|
||||
{
|
||||
PRTL_OSVERSIONINFOEXW InfoEx = (PRTL_OSVERSIONINFOEXW)lpVersionInformation;
|
||||
InfoEx->wServicePackMajor = (USHORT)(CmNtCSDVersion >> 8) & 0xFF;
|
||||
InfoEx->wServicePackMinor = (USHORT)(CmNtCSDVersion & 0xFF);
|
||||
InfoEx->wSuiteMask = (USHORT)(SharedUserData->SuiteMask & 0xFFFF);
|
||||
InfoEx->wProductType = SharedUserData->NtProductType;
|
||||
InfoEx->wReserved = 0;
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
PRTL_OSVERSIONINFOEXW InfoEx = (PRTL_OSVERSIONINFOEXW)lpVersionInformation;
|
||||
InfoEx->wServicePackMajor = (USHORT)(CmNtCSDVersion >> 8) & 0xFF;
|
||||
InfoEx->wServicePackMinor = (USHORT)(CmNtCSDVersion & 0xFF);
|
||||
InfoEx->wSuiteMask = (USHORT)(SharedUserData->SuiteMask & 0xFFFF);
|
||||
InfoEx->wProductType = SharedUserData->NtProductType;
|
||||
InfoEx->wReserved = 0;
|
||||
}
|
||||
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
/* Always succeed */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue