NTSTATUS NTAPI
RtlGetVersion(RTL_OSVERSIONINFOW *Info)
{
if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) ||
Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
{
PPEB Peb = NtCurrentPeb();
Info->dwMajorVe rsion = Peb->OSMajorVersion;
Info->dwMinorVe rsion = Peb->OSMinorVersion;
Info->dwBuildNu mber = Peb->OSBuildNumber;
Info->dwPlatfor mId = Peb->OSPlatformId;
if(((Peb->OSCSD Version >> 8) & 0xFF) != 0)
{
int i = _snwprintf(Info->szCSDVersion,
(sizeof(Info ->szCSDVersion) / sizeof(Info->szCSDVersion[0])) - 1,
L"Service Pack %d",
((Peb->OS CSDVersion >> 8) & 0xFF));
Info->szCSDVersion = L'\0';
}
else
{
RtlZeroMemory(Info->szCSDVersion, sizeof(Info->szCSDVersion));
}
if (Info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
{
RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)Info;
InfoEx->wServicePackMajor = (Peb->OSCSDVersion >> 8) & 0xFF;
InfoEx->wServicePackMinor = Peb->OSCSDVersion & 0xFF;
InfoEx->wSuiteMask = SharedUserData->SuiteMask;
InfoEx->wProductType = SharedUserData->NtProductType;
}
return STATUS_SUCCESS;
}
return STATUS_INVALID_PARAMETER;
}