mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 18:01:07 +00:00
[BOOTDATA]
- Remove hardcoded registry values: CurrentVersion, CSDVersion and CurrentBuildNumber from HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion. They are computed and stored there by the kernel. - All the versioning is controlled by the two values: CSDReleaseType and CSDVersion in HKLM\SYSTEM\CurrentControlSet\Control\Windows. Currently we target SP1. [NTDLL] The lpVersionInformation->szCSDVersion string should not be built by RtlGetVersion, but instead retrieved from the Peb->CSDVersion string that in turn is initialized by the NTDLL PE Loader. Normally this is a App-Compatibility-dependent string, but for now we somewhat hardcode it (it is built using the actual Peb->OSCSDVersion number). [RTL]: Rename some variables "à la NT" and use adequate types (but no code changes otherwise). [NTOS] - Fix PsGetVersion that should use the CmCSDVersionString variable. This API also returns TRUE if we are in checked build mode (the high byte of NtBuildNumber is flagged). - The kernel should initialize the CurrentVersion, CSDVersion and CurrentBuildNumber registry values (and few other ones) from the two main CSDReleaseType and CSDVersion values. - Fix the ReactOS-specific version+revision display in SOS mode. CORE-6611 CORE-7889 CORE-8877 svn path=/trunk/; revision=66735
This commit is contained in:
parent
7dbea55bd3
commit
c32ac4bd68
|
@ -154,9 +154,6 @@ HKLM,"SOFTWARE\Microsoft\Command Processor","AutoRun",0x00020000,""
|
||||||
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",,0x00000012
|
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",,0x00000012
|
||||||
|
|
||||||
; Version Information
|
; Version Information
|
||||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00000000,"5.2"
|
|
||||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00000000,"Service Pack 2"
|
|
||||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00000000,"3790"
|
|
||||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","InstallDate",0x00010003,0
|
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","InstallDate",0x00010003,0
|
||||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName",2,"ReactOS"
|
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName",2,"ReactOS"
|
||||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","RegDone",0x00000002,""
|
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","RegDone",0x00000002,""
|
||||||
|
|
|
@ -1220,6 +1220,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\ProductOptions","ProductSuite",0x00010002
|
||||||
; but we can also report as Workstation if some application needs it.
|
; but we can also report as Workstation if some application needs it.
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\ReactOS\Settings\Version","ReportAsWorkstation",0x00010001,0x00000000
|
HKLM,"SYSTEM\CurrentControlSet\Control\ReactOS\Settings\Version","ReportAsWorkstation",0x00010001,0x00000000
|
||||||
; Some installers check for SP1
|
; Some installers check for SP1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\Windows","CSDReleaseType",0x00010001,0x00000000
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\Windows","CSDVersion",0x00010001,0x00000100
|
HKLM,"SYSTEM\CurrentControlSet\Control\Windows","CSDVersion",0x00010001,0x00000100
|
||||||
|
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\SecurityProviders","SecurityProviders",2,"schannel.dll"
|
HKLM,"SYSTEM\CurrentControlSet\Control\SecurityProviders","SecurityProviders",2,"schannel.dll"
|
||||||
|
|
|
@ -1775,7 +1775,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
||||||
/* Check if we failed */
|
/* Check if we failed */
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Aassume System32 */
|
/* Assume System32 */
|
||||||
LdrpKnownDllObjectDirectory = NULL;
|
LdrpKnownDllObjectDirectory = NULL;
|
||||||
RtlInitUnicodeString(&LdrpKnownDllPath, StringBuffer);
|
RtlInitUnicodeString(&LdrpKnownDllPath, StringBuffer);
|
||||||
LdrpKnownDllPath.Length -= sizeof(WCHAR);
|
LdrpKnownDllPath.Length -= sizeof(WCHAR);
|
||||||
|
@ -2070,6 +2070,40 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
||||||
&ExecuteOptions,
|
&ExecuteOptions,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
|
|
||||||
|
// FIXME: Should be done by Application Compatibility features,
|
||||||
|
// by reading the registry, etc...
|
||||||
|
// For now, this is the old code from ntdll!RtlGetVersion().
|
||||||
|
RtlInitEmptyUnicodeString(&Peb->CSDVersion, NULL, 0);
|
||||||
|
if (((Peb->OSCSDVersion >> 8) & 0xFF) != 0)
|
||||||
|
{
|
||||||
|
WCHAR szCSDVersion[128];
|
||||||
|
ULONG i;
|
||||||
|
ULONG Length = ARRAYSIZE(szCSDVersion) - 1;
|
||||||
|
i = _snwprintf(szCSDVersion, Length,
|
||||||
|
L"Service Pack %d",
|
||||||
|
((Peb->OSCSDVersion >> 8) & 0xFF));
|
||||||
|
if (i < 0)
|
||||||
|
{
|
||||||
|
/* Null-terminate if it was overflowed */
|
||||||
|
szCSDVersion[Length] = UNICODE_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Length *= sizeof(WCHAR);
|
||||||
|
Peb->CSDVersion.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
Length + sizeof(UNICODE_NULL));
|
||||||
|
if (Peb->CSDVersion.Buffer)
|
||||||
|
{
|
||||||
|
Peb->CSDVersion.Length = Length;
|
||||||
|
Peb->CSDVersion.MaximumLength = Length + sizeof(UNICODE_NULL);
|
||||||
|
|
||||||
|
RtlCopyMemory(Peb->CSDVersion.Buffer,
|
||||||
|
szCSDVersion,
|
||||||
|
Peb->CSDVersion.MaximumLength);
|
||||||
|
Peb->CSDVersion.Buffer[Peb->CSDVersion.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if we had Shim Data */
|
/* Check if we had Shim Data */
|
||||||
if (OldShimData)
|
if (OldShimData)
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,6 +204,7 @@ LdrpFreeUnicodeString(IN PUNICODE_STRING StringIn)
|
||||||
/* Zero it out */
|
/* Zero it out */
|
||||||
RtlInitEmptyUnicodeString(StringIn, NULL, 0);
|
RtlInitEmptyUnicodeString(StringIn, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint,
|
LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint,
|
||||||
|
|
|
@ -69,26 +69,26 @@ SetRosSpecificInfo(IN OUT PRTL_OSVERSIONINFOEXW VersionInformation)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* NAME EXPORTED
|
* NAME EXPORTED
|
||||||
* RtlGetNtProductType
|
* RtlGetNtProductType
|
||||||
*
|
*
|
||||||
* DESCRIPTION
|
* DESCRIPTION
|
||||||
* Retrieves the OS product type.
|
* Retrieves the OS product type.
|
||||||
*
|
*
|
||||||
* ARGUMENTS
|
* ARGUMENTS
|
||||||
* ProductType Pointer to the product type variable.
|
* ProductType Pointer to the product type variable.
|
||||||
*
|
*
|
||||||
* RETURN VALUE
|
* RETURN VALUE
|
||||||
* TRUE if successful, otherwise FALSE
|
* TRUE if successful, otherwise FALSE
|
||||||
*
|
*
|
||||||
* NOTE
|
* NOTE
|
||||||
* ProductType can be one of the following values:
|
* ProductType can be one of the following values:
|
||||||
* 1 Workstation (WinNT)
|
* 1 Workstation (WinNT)
|
||||||
* 2 Server (LanmanNT)
|
* 2 Server (LanmanNT)
|
||||||
* 3 Advanced Server (ServerNT)
|
* 3 Advanced Server (ServerNT)
|
||||||
*
|
*
|
||||||
* REVISIONS
|
* REVISIONS
|
||||||
* 2000-08-10 ekohl
|
* 2000-08-10 ekohl
|
||||||
*
|
*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -100,53 +100,53 @@ RtlGetNtProductType(PNT_PRODUCT_TYPE ProductType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* NAME EXPORTED
|
* NAME EXPORTED
|
||||||
* RtlGetNtVersionNumbers
|
* RtlGetNtVersionNumbers
|
||||||
*
|
*
|
||||||
* DESCRIPTION
|
* DESCRIPTION
|
||||||
* Get the version numbers of the run time library.
|
* Get the version numbers of the run time library.
|
||||||
*
|
*
|
||||||
* ARGUMENTS
|
* ARGUMENTS
|
||||||
* pdwMajorVersion [OUT] Destination for the Major version
|
* pMajorVersion [OUT] Destination for the Major version
|
||||||
* pdwMinorVersion [OUT] Destination for the Minor version
|
* pMinorVersion [OUT] Destination for the Minor version
|
||||||
* pdwBuildNumber [OUT] Destination for the Build version
|
* pBuildNumber [OUT] Destination for the Build version
|
||||||
*
|
*
|
||||||
* RETURN VALUE
|
* RETURN VALUE
|
||||||
* Nothing.
|
* Nothing.
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* - Introduced in Windows XP (NT 5.1)
|
* - Introduced in Windows XP (NT 5.1)
|
||||||
* - Since this call didn't exist before XP, we report at least the version
|
* - Since this call didn't exist before XP, we report at least the version
|
||||||
* 5.1. This fixes the loading of msvcrt.dll as released with XP Home,
|
* 5.1. This fixes the loading of msvcrt.dll as released with XP Home,
|
||||||
* which fails in DLLMain() if the major version isn't 5.
|
* which fails in DLLMain() if the major version isn't 5.
|
||||||
*
|
*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
RtlGetNtVersionNumbers(OUT LPDWORD pdwMajorVersion,
|
RtlGetNtVersionNumbers(OUT PULONG pMajorVersion,
|
||||||
OUT LPDWORD pdwMinorVersion,
|
OUT PULONG pMinorVersion,
|
||||||
OUT LPDWORD pdwBuildNumber)
|
OUT PULONG pBuildNumber)
|
||||||
{
|
{
|
||||||
PPEB pPeb = NtCurrentPeb();
|
PPEB pPeb = NtCurrentPeb();
|
||||||
|
|
||||||
if (pdwMajorVersion)
|
if (pMajorVersion)
|
||||||
{
|
{
|
||||||
*pdwMajorVersion = pPeb->OSMajorVersion < 5 ? 5 : pPeb->OSMajorVersion;
|
*pMajorVersion = pPeb->OSMajorVersion < 5 ? 5 : pPeb->OSMajorVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdwMinorVersion)
|
if (pMinorVersion)
|
||||||
{
|
{
|
||||||
if ( (pPeb->OSMajorVersion < 5) ||
|
if ( (pPeb->OSMajorVersion < 5) ||
|
||||||
((pPeb->OSMajorVersion == 5) && (pPeb->OSMinorVersion < 1)) )
|
((pPeb->OSMajorVersion == 5) && (pPeb->OSMinorVersion < 1)) )
|
||||||
*pdwMinorVersion = 1;
|
*pMinorVersion = 1;
|
||||||
else
|
else
|
||||||
*pdwMinorVersion = pPeb->OSMinorVersion;
|
*pMinorVersion = pPeb->OSMinorVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdwBuildNumber)
|
if (pBuildNumber)
|
||||||
{
|
{
|
||||||
/* Windows really does this! */
|
/* Windows really does this! */
|
||||||
*pdwBuildNumber = (0xF0000000 | pPeb->OSBuildNumber);
|
*pBuildNumber = (0xF0000000 | pPeb->OSBuildNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,50 +157,51 @@ RtlGetNtVersionNumbers(OUT LPDWORD pdwMajorVersion,
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
|
RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
|
||||||
{
|
{
|
||||||
LONG i, MaxLength;
|
ULONG Length;
|
||||||
|
PPEB Peb = NtCurrentPeb();
|
||||||
|
|
||||||
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOW) ||
|
if (lpVersionInformation->dwOSVersionInfoSize != sizeof(RTL_OSVERSIONINFOW) &&
|
||||||
lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
|
lpVersionInformation->dwOSVersionInfoSize != sizeof(RTL_OSVERSIONINFOEXW))
|
||||||
{
|
{
|
||||||
PPEB Peb = NtCurrentPeb();
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
lpVersionInformation->dwMajorVersion = Peb->OSMajorVersion;
|
|
||||||
lpVersionInformation->dwMinorVersion = Peb->OSMinorVersion;
|
|
||||||
lpVersionInformation->dwBuildNumber = Peb->OSBuildNumber;
|
|
||||||
lpVersionInformation->dwPlatformId = Peb->OSPlatformId;
|
|
||||||
RtlZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
|
|
||||||
|
|
||||||
if(((Peb->OSCSDVersion >> 8) & 0xFF) != 0)
|
|
||||||
{
|
|
||||||
MaxLength = (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0])) - 1;
|
|
||||||
i = _snwprintf(lpVersionInformation->szCSDVersion,
|
|
||||||
MaxLength,
|
|
||||||
L"Service Pack %d",
|
|
||||||
((Peb->OSCSDVersion >> 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 = (Peb->OSCSDVersion >> 8) & 0xFF;
|
|
||||||
InfoEx->wServicePackMinor = Peb->OSCSDVersion & 0xFF;
|
|
||||||
InfoEx->wSuiteMask = SharedUserData->SuiteMask & 0xFFFF;
|
|
||||||
InfoEx->wProductType = SharedUserData->NtProductType;
|
|
||||||
InfoEx->wReserved = 0;
|
|
||||||
|
|
||||||
/* HACK: ReactOS specific changes, see bug-reports CORE-6611 and CORE-4620 (aka. #5003) */
|
|
||||||
SetRosSpecificInfo(InfoEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_INVALID_PARAMETER;
|
lpVersionInformation->dwMajorVersion = Peb->OSMajorVersion;
|
||||||
|
lpVersionInformation->dwMinorVersion = Peb->OSMinorVersion;
|
||||||
|
lpVersionInformation->dwBuildNumber = Peb->OSBuildNumber;
|
||||||
|
lpVersionInformation->dwPlatformId = Peb->OSPlatformId;
|
||||||
|
RtlZeroMemory(lpVersionInformation->szCSDVersion, sizeof(lpVersionInformation->szCSDVersion));
|
||||||
|
|
||||||
|
/* If we have a CSD version string, initialized by Application Compatibility... */
|
||||||
|
if (Peb->CSDVersion.Length && Peb->CSDVersion.Buffer && Peb->CSDVersion.Buffer[0] != UNICODE_NULL)
|
||||||
|
{
|
||||||
|
/* ... copy it... */
|
||||||
|
Length = min(wcslen(Peb->CSDVersion.Buffer), ARRAYSIZE(lpVersionInformation->szCSDVersion) - 1);
|
||||||
|
wcsncpy(lpVersionInformation->szCSDVersion, Peb->CSDVersion.Buffer, Length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* ... otherwise we just null-terminate it */
|
||||||
|
Length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Always null-terminate the user CSD version string */
|
||||||
|
lpVersionInformation->szCSDVersion[Length] = UNICODE_NULL;
|
||||||
|
|
||||||
|
if (lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
|
||||||
|
{
|
||||||
|
PRTL_OSVERSIONINFOEXW InfoEx = (PRTL_OSVERSIONINFOEXW)lpVersionInformation;
|
||||||
|
InfoEx->wServicePackMajor = (Peb->OSCSDVersion >> 8) & 0xFF;
|
||||||
|
InfoEx->wServicePackMinor = Peb->OSCSDVersion & 0xFF;
|
||||||
|
InfoEx->wSuiteMask = SharedUserData->SuiteMask & 0xFFFF;
|
||||||
|
InfoEx->wProductType = SharedUserData->NtProductType;
|
||||||
|
InfoEx->wReserved = 0;
|
||||||
|
|
||||||
|
/* HACK: ReactOS specific changes, see bug-reports CORE-6611 and CORE-4620 (aka. #5003) */
|
||||||
|
SetRosSpecificInfo(InfoEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -22,14 +22,14 @@ RtlGetVersion(OUT PRTL_OSVERSIONINFOW lpVersionInformation);
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
static BYTE
|
static UCHAR
|
||||||
RtlpVerGetCondition(IN ULONGLONG dwlConditionMask,
|
RtlpVerGetCondition(IN ULONGLONG ConditionMask,
|
||||||
IN DWORD dwTypeBitMask);
|
IN ULONG TypeMask);
|
||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
RtlpVerCompare(ULONG left, ULONG right, UCHAR condition)
|
RtlpVerCompare(ULONG left, ULONG right, UCHAR Condition)
|
||||||
{
|
{
|
||||||
switch (condition)
|
switch (Condition)
|
||||||
{
|
{
|
||||||
case VER_EQUAL:
|
case VER_EQUAL:
|
||||||
return (left == right);
|
return (left == right);
|
||||||
|
@ -56,9 +56,9 @@ RtlVerifyVersionInfo(IN PRTL_OSVERSIONINFOEXW VersionInfo,
|
||||||
IN ULONG TypeMask,
|
IN ULONG TypeMask,
|
||||||
IN ULONGLONG ConditionMask)
|
IN ULONGLONG ConditionMask)
|
||||||
{
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
RTL_OSVERSIONINFOEXW ver;
|
RTL_OSVERSIONINFOEXW ver;
|
||||||
NTSTATUS status;
|
BOOLEAN Comparison;
|
||||||
BOOLEAN comparison;
|
|
||||||
|
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
- Check the following special case on Windows (various versions):
|
- Check the following special case on Windows (various versions):
|
||||||
|
@ -68,17 +68,17 @@ RtlVerifyVersionInfo(IN PRTL_OSVERSIONINFOEXW VersionInfo,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ver.dwOSVersionInfoSize = sizeof(ver);
|
ver.dwOSVersionInfoSize = sizeof(ver);
|
||||||
status = RtlGetVersion((PRTL_OSVERSIONINFOW)&ver);
|
Status = RtlGetVersion((PRTL_OSVERSIONINFOW)&ver);
|
||||||
if (status != STATUS_SUCCESS) return status;
|
if (Status != STATUS_SUCCESS) return Status;
|
||||||
|
|
||||||
if (!TypeMask || !ConditionMask) return STATUS_INVALID_PARAMETER;
|
if (!TypeMask || !ConditionMask) return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (TypeMask & VER_PRODUCT_TYPE)
|
if (TypeMask & VER_PRODUCT_TYPE)
|
||||||
{
|
{
|
||||||
comparison = RtlpVerCompare(ver.wProductType,
|
Comparison = RtlpVerCompare(ver.wProductType,
|
||||||
VersionInfo->wProductType,
|
VersionInfo->wProductType,
|
||||||
RtlpVerGetCondition(ConditionMask, VER_PRODUCT_TYPE));
|
RtlpVerGetCondition(ConditionMask, VER_PRODUCT_TYPE));
|
||||||
if (!comparison)
|
if (!Comparison)
|
||||||
return STATUS_REVISION_MISMATCH;
|
return STATUS_REVISION_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,19 +105,19 @@ RtlVerifyVersionInfo(IN PRTL_OSVERSIONINFOEXW VersionInfo,
|
||||||
|
|
||||||
if (TypeMask & VER_PLATFORMID)
|
if (TypeMask & VER_PLATFORMID)
|
||||||
{
|
{
|
||||||
comparison = RtlpVerCompare(ver.dwPlatformId,
|
Comparison = RtlpVerCompare(ver.dwPlatformId,
|
||||||
VersionInfo->dwPlatformId,
|
VersionInfo->dwPlatformId,
|
||||||
RtlpVerGetCondition(ConditionMask, VER_PLATFORMID));
|
RtlpVerGetCondition(ConditionMask, VER_PLATFORMID));
|
||||||
if (!comparison)
|
if (!Comparison)
|
||||||
return STATUS_REVISION_MISMATCH;
|
return STATUS_REVISION_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TypeMask & VER_BUILDNUMBER)
|
if (TypeMask & VER_BUILDNUMBER)
|
||||||
{
|
{
|
||||||
comparison = RtlpVerCompare(ver.dwBuildNumber,
|
Comparison = RtlpVerCompare(ver.dwBuildNumber,
|
||||||
VersionInfo->dwBuildNumber,
|
VersionInfo->dwBuildNumber,
|
||||||
RtlpVerGetCondition(ConditionMask, VER_BUILDNUMBER));
|
RtlpVerGetCondition(ConditionMask, VER_BUILDNUMBER));
|
||||||
if (!comparison)
|
if (!Comparison)
|
||||||
return STATUS_REVISION_MISMATCH;
|
return STATUS_REVISION_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,79 +130,79 @@ RtlVerifyVersionInfo(IN PRTL_OSVERSIONINFOEXW VersionInfo,
|
||||||
* operator for VER_MAJORVERSION supersedes the others for VER_MINORVERSION,
|
* operator for VER_MAJORVERSION supersedes the others for VER_MINORVERSION,
|
||||||
* VER_SERVICEPACKMAJOR and VER_SERVICEPACKMINOR).
|
* VER_SERVICEPACKMAJOR and VER_SERVICEPACKMINOR).
|
||||||
*/
|
*/
|
||||||
BYTE condition = RtlpVerGetCondition(ConditionMask, TypeMask);
|
UCHAR Condition = RtlpVerGetCondition(ConditionMask, TypeMask);
|
||||||
|
|
||||||
comparison = TRUE;
|
Comparison = TRUE;
|
||||||
if (TypeMask & VER_MAJORVERSION)
|
if (TypeMask & VER_MAJORVERSION)
|
||||||
{
|
{
|
||||||
comparison = RtlpVerCompare(ver.dwMajorVersion,
|
Comparison = RtlpVerCompare(ver.dwMajorVersion,
|
||||||
VersionInfo->dwMajorVersion,
|
VersionInfo->dwMajorVersion,
|
||||||
condition);
|
Condition);
|
||||||
do_next_check = (ver.dwMajorVersion == VersionInfo->dwMajorVersion) &&
|
do_next_check = (ver.dwMajorVersion == VersionInfo->dwMajorVersion) &&
|
||||||
((condition != VER_EQUAL) || comparison);
|
((Condition != VER_EQUAL) || Comparison);
|
||||||
}
|
}
|
||||||
if ((TypeMask & VER_MINORVERSION) && do_next_check)
|
if ((TypeMask & VER_MINORVERSION) && do_next_check)
|
||||||
{
|
{
|
||||||
comparison = RtlpVerCompare(ver.dwMinorVersion,
|
Comparison = RtlpVerCompare(ver.dwMinorVersion,
|
||||||
VersionInfo->dwMinorVersion,
|
VersionInfo->dwMinorVersion,
|
||||||
condition);
|
Condition);
|
||||||
do_next_check = (ver.dwMinorVersion == VersionInfo->dwMinorVersion) &&
|
do_next_check = (ver.dwMinorVersion == VersionInfo->dwMinorVersion) &&
|
||||||
((condition != VER_EQUAL) || comparison);
|
((Condition != VER_EQUAL) || Comparison);
|
||||||
}
|
}
|
||||||
if ((TypeMask & VER_SERVICEPACKMAJOR) && do_next_check)
|
if ((TypeMask & VER_SERVICEPACKMAJOR) && do_next_check)
|
||||||
{
|
{
|
||||||
comparison = RtlpVerCompare(ver.wServicePackMajor,
|
Comparison = RtlpVerCompare(ver.wServicePackMajor,
|
||||||
VersionInfo->wServicePackMajor,
|
VersionInfo->wServicePackMajor,
|
||||||
condition);
|
Condition);
|
||||||
do_next_check = (ver.wServicePackMajor == VersionInfo->wServicePackMajor) &&
|
do_next_check = (ver.wServicePackMajor == VersionInfo->wServicePackMajor) &&
|
||||||
((condition != VER_EQUAL) || comparison);
|
((Condition != VER_EQUAL) || Comparison);
|
||||||
}
|
}
|
||||||
if ((TypeMask & VER_SERVICEPACKMINOR) && do_next_check)
|
if ((TypeMask & VER_SERVICEPACKMINOR) && do_next_check)
|
||||||
{
|
{
|
||||||
comparison = RtlpVerCompare(ver.wServicePackMinor,
|
Comparison = RtlpVerCompare(ver.wServicePackMinor,
|
||||||
VersionInfo->wServicePackMinor,
|
VersionInfo->wServicePackMinor,
|
||||||
condition);
|
Condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!comparison)
|
if (!Comparison)
|
||||||
return STATUS_REVISION_MISMATCH;
|
return STATUS_REVISION_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BYTE
|
static UCHAR
|
||||||
RtlpVerGetCondition(IN ULONGLONG dwlConditionMask,
|
RtlpVerGetCondition(IN ULONGLONG ConditionMask,
|
||||||
IN DWORD dwTypeBitMask)
|
IN ULONG TypeMask)
|
||||||
{
|
{
|
||||||
BYTE bConditionMask = 0;
|
UCHAR Condition = 0;
|
||||||
|
|
||||||
if (dwTypeBitMask & VER_PRODUCT_TYPE)
|
if (TypeMask & VER_PRODUCT_TYPE)
|
||||||
bConditionMask |= dwlConditionMask >> (7 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (7 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_SUITENAME)
|
else if (TypeMask & VER_SUITENAME)
|
||||||
bConditionMask |= dwlConditionMask >> (6 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (6 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_PLATFORMID)
|
else if (TypeMask & VER_PLATFORMID)
|
||||||
bConditionMask |= dwlConditionMask >> (3 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (3 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_BUILDNUMBER)
|
else if (TypeMask & VER_BUILDNUMBER)
|
||||||
bConditionMask |= dwlConditionMask >> (2 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (2 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
/*
|
/*
|
||||||
* We choose here the lexicographical order on the 4D space
|
* We choose here the lexicographical order on the 4D space
|
||||||
* {(Major ; Minor ; SP Major ; SP Minor)} to select the
|
* {(Major ; Minor ; SP Major ; SP Minor)} to select the
|
||||||
* appropriate comparison operator.
|
* appropriate comparison operator.
|
||||||
* Therefore the following 'else if' instructions must be in this order.
|
* Therefore the following 'else if' instructions must be in this order.
|
||||||
*/
|
*/
|
||||||
else if (dwTypeBitMask & VER_MAJORVERSION)
|
else if (TypeMask & VER_MAJORVERSION)
|
||||||
bConditionMask |= dwlConditionMask >> (1 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (1 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_MINORVERSION)
|
else if (TypeMask & VER_MINORVERSION)
|
||||||
bConditionMask |= dwlConditionMask >> (0 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (0 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
else if (TypeMask & VER_SERVICEPACKMAJOR)
|
||||||
bConditionMask |= dwlConditionMask >> (5 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (5 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
else if (TypeMask & VER_SERVICEPACKMINOR)
|
||||||
bConditionMask |= dwlConditionMask >> (4 * VER_NUM_BITS_PER_CONDITION_MASK);
|
Condition |= ConditionMask >> (4 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
|
|
||||||
bConditionMask &= VER_CONDITION_MASK;
|
Condition &= VER_CONDITION_MASK;
|
||||||
|
|
||||||
return bConditionMask;
|
return Condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -210,39 +210,39 @@ RtlpVerGetCondition(IN ULONGLONG dwlConditionMask,
|
||||||
*/
|
*/
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
NTAPI
|
NTAPI
|
||||||
VerSetConditionMask(IN ULONGLONG dwlConditionMask,
|
VerSetConditionMask(IN ULONGLONG ConditionMask,
|
||||||
IN DWORD dwTypeBitMask,
|
IN ULONG TypeMask,
|
||||||
IN BYTE bConditionMask)
|
IN UCHAR Condition)
|
||||||
{
|
{
|
||||||
ULONGLONG ullCondMask;
|
ULONGLONG ullCondMask;
|
||||||
|
|
||||||
if (dwTypeBitMask == 0)
|
if (TypeMask == 0)
|
||||||
return dwlConditionMask;
|
return ConditionMask;
|
||||||
|
|
||||||
bConditionMask &= VER_CONDITION_MASK;
|
Condition &= VER_CONDITION_MASK;
|
||||||
|
|
||||||
if (bConditionMask == 0)
|
if (Condition == 0)
|
||||||
return dwlConditionMask;
|
return ConditionMask;
|
||||||
|
|
||||||
ullCondMask = bConditionMask;
|
ullCondMask = Condition;
|
||||||
if (dwTypeBitMask & VER_PRODUCT_TYPE)
|
if (TypeMask & VER_PRODUCT_TYPE)
|
||||||
dwlConditionMask |= ullCondMask << (7 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (7 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_SUITENAME)
|
else if (TypeMask & VER_SUITENAME)
|
||||||
dwlConditionMask |= ullCondMask << (6 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (6 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
else if (TypeMask & VER_SERVICEPACKMAJOR)
|
||||||
dwlConditionMask |= ullCondMask << (5 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (5 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
else if (TypeMask & VER_SERVICEPACKMINOR)
|
||||||
dwlConditionMask |= ullCondMask << (4 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (4 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_PLATFORMID)
|
else if (TypeMask & VER_PLATFORMID)
|
||||||
dwlConditionMask |= ullCondMask << (3 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (3 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_BUILDNUMBER)
|
else if (TypeMask & VER_BUILDNUMBER)
|
||||||
dwlConditionMask |= ullCondMask << (2 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (2 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_MAJORVERSION)
|
else if (TypeMask & VER_MAJORVERSION)
|
||||||
dwlConditionMask |= ullCondMask << (1 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (1 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
else if (dwTypeBitMask & VER_MINORVERSION)
|
else if (TypeMask & VER_MINORVERSION)
|
||||||
dwlConditionMask |= ullCondMask << (0 * VER_NUM_BITS_PER_CONDITION_MASK);
|
ConditionMask |= ullCondMask << (0 * VER_NUM_BITS_PER_CONDITION_MASK);
|
||||||
|
|
||||||
return dwlConditionMask;
|
return ConditionMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -698,6 +698,14 @@ INIT_FUNCTION CM_SYSTEM_CONTROL_VECTOR CmControlVector[] =
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
L"Windows",
|
||||||
|
L"CSDReleaseType",
|
||||||
|
&CmNtCSDReleaseType,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
L"Nls\\Language",
|
L"Nls\\Language",
|
||||||
L"Default",
|
L"Default",
|
||||||
|
|
|
@ -2079,27 +2079,30 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
CmpSetVersionData(VOID)
|
CmpSetVersionData(VOID)
|
||||||
{
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING KeyName;
|
UNICODE_STRING KeyName;
|
||||||
UNICODE_STRING ValueName;
|
UNICODE_STRING ValueName;
|
||||||
UNICODE_STRING ValueData;
|
UNICODE_STRING ValueData;
|
||||||
|
ANSI_STRING TempString;
|
||||||
HANDLE SoftwareKeyHandle = NULL;
|
HANDLE SoftwareKeyHandle = NULL;
|
||||||
HANDLE MicrosoftKeyHandle = NULL;
|
HANDLE MicrosoftKeyHandle = NULL;
|
||||||
HANDLE WindowsNtKeyHandle = NULL;
|
HANDLE WindowsNtKeyHandle = NULL;
|
||||||
HANDLE CurrentVersionKeyHandle = NULL;
|
HANDLE CurrentVersionKeyHandle = NULL;
|
||||||
WCHAR Buffer[128];
|
WCHAR Buffer[128]; // Buffer large enough to contain a full ULONG in decimal representation,
|
||||||
NTSTATUS Status;
|
// and the full 'CurrentType' string.
|
||||||
|
|
||||||
/* Open the 'CurrentVersion' key */
|
/*
|
||||||
RtlInitUnicodeString(&KeyName,
|
* Open the 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' key
|
||||||
L"\\REGISTRY\\MACHINE\\SOFTWARE");
|
* (create the intermediate subkeys if needed).
|
||||||
|
*/
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\MACHINE\\SOFTWARE");
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtCreateKey(&SoftwareKeyHandle,
|
Status = NtCreateKey(&SoftwareKeyHandle,
|
||||||
KEY_CREATE_SUB_KEY,
|
KEY_CREATE_SUB_KEY,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
@ -2113,16 +2116,12 @@ CmpSetVersionData(VOID)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the 'CurrentVersion' key */
|
RtlInitUnicodeString(&KeyName, L"Microsoft");
|
||||||
RtlInitUnicodeString(&KeyName,
|
|
||||||
L"Microsoft");
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
SoftwareKeyHandle,
|
SoftwareKeyHandle,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtCreateKey(&MicrosoftKeyHandle,
|
Status = NtCreateKey(&MicrosoftKeyHandle,
|
||||||
KEY_CREATE_SUB_KEY,
|
KEY_CREATE_SUB_KEY,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
@ -2133,19 +2132,15 @@ CmpSetVersionData(VOID)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
|
DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
|
||||||
goto done;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the 'CurrentVersion' key */
|
RtlInitUnicodeString(&KeyName, L"Windows NT");
|
||||||
RtlInitUnicodeString(&KeyName,
|
|
||||||
L"Windows NT");
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
MicrosoftKeyHandle,
|
MicrosoftKeyHandle,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtCreateKey(&WindowsNtKeyHandle,
|
Status = NtCreateKey(&WindowsNtKeyHandle,
|
||||||
KEY_CREATE_SUB_KEY,
|
KEY_CREATE_SUB_KEY,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
@ -2156,19 +2151,15 @@ CmpSetVersionData(VOID)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
|
DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
|
||||||
goto done;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open the 'CurrentVersion' key */
|
RtlInitUnicodeString(&KeyName, L"CurrentVersion");
|
||||||
RtlInitUnicodeString(&KeyName,
|
|
||||||
L"CurrentVersion");
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&KeyName,
|
&KeyName,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
WindowsNtKeyHandle,
|
WindowsNtKeyHandle,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtCreateKey(&CurrentVersionKeyHandle,
|
Status = NtCreateKey(&CurrentVersionKeyHandle,
|
||||||
KEY_CREATE_SUB_KEY | KEY_SET_VALUE,
|
KEY_CREATE_SUB_KEY | KEY_SET_VALUE,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
@ -2179,30 +2170,22 @@ CmpSetVersionData(VOID)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
|
DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
|
||||||
goto done;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the 'CurrentType' value */
|
/* Set the 'CurrentVersion' value */
|
||||||
RtlInitUnicodeString(&ValueName,
|
RtlInitUnicodeString(&ValueName, L"CurrentVersion");
|
||||||
L"CurrentType");
|
NtSetValueKey(CurrentVersionKeyHandle,
|
||||||
|
&ValueName,
|
||||||
#ifdef CONFIG_SMP
|
0,
|
||||||
wcscpy(Buffer, L"Multiprocessor");
|
REG_SZ,
|
||||||
#else
|
CmVersionString.Buffer,
|
||||||
wcscpy(Buffer, L"Uniprocessor");
|
CmVersionString.Length + sizeof(WCHAR));
|
||||||
#endif
|
|
||||||
|
|
||||||
wcscat(Buffer, L" ");
|
|
||||||
|
|
||||||
#if (DBG == 1)
|
|
||||||
wcscat(Buffer, L"Checked");
|
|
||||||
#else
|
|
||||||
wcscat(Buffer, L"Free");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&ValueData,
|
|
||||||
Buffer);
|
|
||||||
|
|
||||||
|
/* Set the 'CurrentBuildNumber' value */
|
||||||
|
RtlInitUnicodeString(&ValueName, L"CurrentBuildNumber");
|
||||||
|
RtlInitEmptyUnicodeString(&ValueData, Buffer, sizeof(Buffer));
|
||||||
|
RtlIntegerToUnicodeString(NtBuildNumber & 0xFFFF, 10, &ValueData);
|
||||||
NtSetValueKey(CurrentVersionKeyHandle,
|
NtSetValueKey(CurrentVersionKeyHandle,
|
||||||
&ValueName,
|
&ValueName,
|
||||||
0,
|
0,
|
||||||
|
@ -2210,7 +2193,88 @@ CmpSetVersionData(VOID)
|
||||||
ValueData.Buffer,
|
ValueData.Buffer,
|
||||||
ValueData.Length + sizeof(WCHAR));
|
ValueData.Length + sizeof(WCHAR));
|
||||||
|
|
||||||
done:;
|
/* Set the 'BuildLab' value */
|
||||||
|
RtlInitUnicodeString(&ValueName, L"BuildLab");
|
||||||
|
RtlInitAnsiString(&TempString, NtBuildLab);
|
||||||
|
Status = RtlAnsiStringToUnicodeString(&ValueData, &TempString, FALSE);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
NtSetValueKey(CurrentVersionKeyHandle,
|
||||||
|
&ValueName,
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
ValueData.Buffer,
|
||||||
|
ValueData.Length + sizeof(WCHAR));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the 'CurrentType' value */
|
||||||
|
RtlInitUnicodeString(&ValueName, L"CurrentType");
|
||||||
|
|
||||||
|
swprintf(Buffer, L"%s %s",
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
L"Multiprocessor"
|
||||||
|
#else
|
||||||
|
L"Uniprocessor"
|
||||||
|
#endif
|
||||||
|
,
|
||||||
|
#if (DBG == 1)
|
||||||
|
L"Checked"
|
||||||
|
#else
|
||||||
|
L"Free"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
RtlInitUnicodeString(&ValueData, Buffer);
|
||||||
|
NtSetValueKey(CurrentVersionKeyHandle,
|
||||||
|
&ValueName,
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
ValueData.Buffer,
|
||||||
|
ValueData.Length + sizeof(WCHAR));
|
||||||
|
|
||||||
|
/* Set the 'CSDVersion' value */
|
||||||
|
RtlInitUnicodeString(&ValueName, L"CSDVersion");
|
||||||
|
if (CmCSDVersionString.Length != 0)
|
||||||
|
{
|
||||||
|
NtSetValueKey(CurrentVersionKeyHandle,
|
||||||
|
&ValueName,
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
CmCSDVersionString.Buffer,
|
||||||
|
CmCSDVersionString.Length + sizeof(WCHAR));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NtDeleteValueKey(CurrentVersionKeyHandle, &ValueName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the 'CSDBuildNumber' value */
|
||||||
|
RtlInitUnicodeString(&ValueName, L"CSDBuildNumber");
|
||||||
|
if (CmNtSpBuildNumber != 0)
|
||||||
|
{
|
||||||
|
RtlInitEmptyUnicodeString(&ValueData, Buffer, sizeof(Buffer));
|
||||||
|
RtlIntegerToUnicodeString(CmNtSpBuildNumber, 10, &ValueData);
|
||||||
|
NtSetValueKey(CurrentVersionKeyHandle,
|
||||||
|
&ValueName,
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
ValueData.Buffer,
|
||||||
|
ValueData.Length + sizeof(WCHAR));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NtDeleteValueKey(CurrentVersionKeyHandle, &ValueName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the 'SystemRoot' value */
|
||||||
|
RtlInitUnicodeString(&ValueName, L"SystemRoot");
|
||||||
|
NtSetValueKey(CurrentVersionKeyHandle,
|
||||||
|
&ValueName,
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
NtSystemRoot.Buffer,
|
||||||
|
NtSystemRoot.Length + sizeof(WCHAR));
|
||||||
|
|
||||||
|
Quit:
|
||||||
/* Close the keys */
|
/* Close the keys */
|
||||||
if (CurrentVersionKeyHandle != NULL)
|
if (CurrentVersionKeyHandle != NULL)
|
||||||
NtClose(CurrentVersionKeyHandle);
|
NtClose(CurrentVersionKeyHandle);
|
||||||
|
|
|
@ -41,9 +41,9 @@ typedef struct _INIT_BUFFER
|
||||||
/* NT Version Info */
|
/* NT Version Info */
|
||||||
ULONG NtMajorVersion = VER_PRODUCTMAJORVERSION;
|
ULONG NtMajorVersion = VER_PRODUCTMAJORVERSION;
|
||||||
ULONG NtMinorVersion = VER_PRODUCTMINORVERSION;
|
ULONG NtMinorVersion = VER_PRODUCTMINORVERSION;
|
||||||
#if DBG
|
#if DBG /* Checked Build */
|
||||||
ULONG NtBuildNumber = VER_PRODUCTBUILD | 0xC0000000;
|
ULONG NtBuildNumber = VER_PRODUCTBUILD | 0xC0000000;
|
||||||
#else
|
#else /* Free Build */
|
||||||
ULONG NtBuildNumber = VER_PRODUCTBUILD;
|
ULONG NtBuildNumber = VER_PRODUCTBUILD;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -920,10 +920,10 @@ ExpInitializeExecutive(IN ULONG Cpu,
|
||||||
ULONG PerfMemUsed;
|
ULONG PerfMemUsed;
|
||||||
PLDR_DATA_TABLE_ENTRY NtosEntry;
|
PLDR_DATA_TABLE_ENTRY NtosEntry;
|
||||||
PMESSAGE_RESOURCE_ENTRY MsgEntry;
|
PMESSAGE_RESOURCE_ENTRY MsgEntry;
|
||||||
ANSI_STRING CsdString;
|
ANSI_STRING CSDString;
|
||||||
size_t Remaining = 0;
|
size_t Remaining = 0;
|
||||||
PCHAR RcEnd = NULL;
|
PCHAR RcEnd = NULL;
|
||||||
CHAR VersionBuffer [65];
|
CHAR VersionBuffer[65];
|
||||||
|
|
||||||
/* Validate Loader */
|
/* Validate Loader */
|
||||||
if (!ExpIsLoaderValid(LoaderBlock))
|
if (!ExpIsLoaderValid(LoaderBlock))
|
||||||
|
@ -1076,17 +1076,11 @@ ExpInitializeExecutive(IN ULONG Cpu,
|
||||||
/* Setup initial system settings */
|
/* Setup initial system settings */
|
||||||
CmGetSystemControlValues(LoaderBlock->RegistryBase, CmControlVector);
|
CmGetSystemControlValues(LoaderBlock->RegistryBase, CmControlVector);
|
||||||
|
|
||||||
/* Load static defaults for Service Pack 1 and add our SVN revision */
|
/* Set the Service Pack Number and add it to the CSD Version number if needed */
|
||||||
/* Format of CSD : SPMajor - SPMinor */
|
|
||||||
CmNtCSDVersion = 0x100 | (KERNEL_VERSION_BUILD_HEX << 16);
|
|
||||||
CmNtCSDReleaseType = 0;
|
|
||||||
|
|
||||||
/* Set Service Pack data for Service Pack 1 */
|
|
||||||
CmNtSpBuildNumber = VER_PRODUCTBUILD_QFE;
|
CmNtSpBuildNumber = VER_PRODUCTBUILD_QFE;
|
||||||
if (!(CmNtCSDVersion & 0xFFFF0000))
|
if (((CmNtCSDVersion & 0xFFFF0000) == 0) && (CmNtCSDReleaseType == 1))
|
||||||
{
|
{
|
||||||
/* Check the release type */
|
CmNtCSDVersion |= (VER_PRODUCTBUILD_QFE << 16);
|
||||||
if (CmNtCSDReleaseType == 1) CmNtSpBuildNumber |= VER_PRODUCTBUILD_QFE << 16;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add loaded CmNtGlobalFlag value */
|
/* Add loaded CmNtGlobalFlag value */
|
||||||
|
@ -1140,22 +1134,22 @@ ExpInitializeExecutive(IN ULONG Cpu,
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Setup the string */
|
/* Setup the string */
|
||||||
RtlInitAnsiString(&CsdString, (PCHAR)MsgEntry->Text);
|
RtlInitAnsiString(&CSDString, (PCHAR)MsgEntry->Text);
|
||||||
|
|
||||||
/* Remove trailing newline */
|
/* Remove trailing newline */
|
||||||
while ((CsdString.Length > 0) &&
|
while ((CSDString.Length > 0) &&
|
||||||
((CsdString.Buffer[CsdString.Length - 1] == '\r') ||
|
((CSDString.Buffer[CSDString.Length - 1] == '\r') ||
|
||||||
(CsdString.Buffer[CsdString.Length - 1] == '\n')))
|
(CSDString.Buffer[CSDString.Length - 1] == '\n')))
|
||||||
{
|
{
|
||||||
/* Skip the trailing character */
|
/* Skip the trailing character */
|
||||||
CsdString.Length--;
|
CSDString.Length--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill the buffer with version information */
|
/* Fill the buffer with version information */
|
||||||
Status = RtlStringCbPrintfA(Buffer,
|
Status = RtlStringCbPrintfA(Buffer,
|
||||||
sizeof(Buffer),
|
sizeof(Buffer),
|
||||||
"%Z %u%c",
|
"%Z %u%c",
|
||||||
&CsdString,
|
&CSDString,
|
||||||
(CmNtCSDVersion & 0xFF00) >> 8,
|
(CmNtCSDVersion & 0xFF00) >> 8,
|
||||||
(CmNtCSDVersion & 0xFF) ?
|
(CmNtCSDVersion & 0xFF) ?
|
||||||
'A' + (CmNtCSDVersion & 0xFF) - 1 :
|
'A' + (CmNtCSDVersion & 0xFF) - 1 :
|
||||||
|
@ -1197,7 +1191,7 @@ ExpInitializeExecutive(IN ULONG Cpu,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we have an RC number */
|
/* Check if we have an RC number */
|
||||||
if (CmNtCSDVersion & 0xFFFF0000)
|
if ((CmNtCSDVersion & 0xFFFF0000) && (CmNtCSDReleaseType == 1))
|
||||||
{
|
{
|
||||||
/* Check if we have no version data yet */
|
/* Check if we have no version data yet */
|
||||||
if (!(*Buffer))
|
if (!(*Buffer))
|
||||||
|
@ -1223,10 +1217,12 @@ ExpInitializeExecutive(IN ULONG Cpu,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the version format string */
|
/* Add the version format string */
|
||||||
|
/* ReactOS specific: Append also the revision number */
|
||||||
Status = RtlStringCbPrintfA(RcEnd,
|
Status = RtlStringCbPrintfA(RcEnd,
|
||||||
Remaining,
|
Remaining,
|
||||||
"r%u",
|
"v.%u"
|
||||||
/*(CmNtCSDVersion & 0xFFFF0000) >> 16*/
|
" r%u",
|
||||||
|
(CmNtCSDVersion & 0xFFFF0000) >> 16,
|
||||||
KERNEL_VERSION_BUILD_HEX);
|
KERNEL_VERSION_BUILD_HEX);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -1236,9 +1232,9 @@ ExpInitializeExecutive(IN ULONG Cpu,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now setup the final string */
|
/* Now setup the final string */
|
||||||
RtlInitAnsiString(&CsdString, Buffer);
|
RtlInitAnsiString(&CSDString, Buffer);
|
||||||
Status = RtlAnsiStringToUnicodeString(&CmCSDVersionString,
|
Status = RtlAnsiStringToUnicodeString(&CmCSDVersionString,
|
||||||
&CsdString,
|
&CSDString,
|
||||||
TRUE);
|
TRUE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,9 +9,6 @@ extern ULONG ExpTickCountMultiplier;
|
||||||
extern ULONG ExpLastTimeZoneBias;
|
extern ULONG ExpLastTimeZoneBias;
|
||||||
extern POBJECT_TYPE ExEventPairObjectType;
|
extern POBJECT_TYPE ExEventPairObjectType;
|
||||||
extern POBJECT_TYPE _ExEventObjectType, _ExSemaphoreObjectType;
|
extern POBJECT_TYPE _ExEventObjectType, _ExSemaphoreObjectType;
|
||||||
extern ULONG NtBuildNumber;
|
|
||||||
extern ULONG NtMajorVersion;
|
|
||||||
extern ULONG NtMinorVersion;
|
|
||||||
extern FAST_MUTEX ExpEnvironmentLock;
|
extern FAST_MUTEX ExpEnvironmentLock;
|
||||||
extern ERESOURCE ExpFirmwareTableResource;
|
extern ERESOURCE ExpFirmwareTableResource;
|
||||||
extern LIST_ENTRY ExpFirmwareTableProviderListHead;
|
extern LIST_ENTRY ExpFirmwareTableProviderListHead;
|
||||||
|
@ -20,9 +17,8 @@ extern LIST_ENTRY ExpSystemResourcesList;
|
||||||
extern ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
|
extern ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
|
||||||
extern ULONG ExpUnicodeCaseTableDataOffset;
|
extern ULONG ExpUnicodeCaseTableDataOffset;
|
||||||
extern PVOID ExpNlsSectionPointer;
|
extern PVOID ExpNlsSectionPointer;
|
||||||
extern CHAR NtBuildLab[];
|
|
||||||
extern ULONG CmNtCSDVersion;
|
|
||||||
extern ULONG NtGlobalFlag;
|
extern ULONG NtGlobalFlag;
|
||||||
|
extern UNICODE_STRING NtSystemRoot;
|
||||||
extern ULONG ExpInitializationPhase;
|
extern ULONG ExpInitializationPhase;
|
||||||
extern ULONG ExpAltTimeZoneBias;
|
extern ULONG ExpAltTimeZoneBias;
|
||||||
extern LIST_ENTRY ExSystemLookasideListHead;
|
extern LIST_ENTRY ExSystemLookasideListHead;
|
||||||
|
@ -33,6 +29,19 @@ extern LIST_ENTRY ExpPagedLookasideListHead;
|
||||||
extern KSPIN_LOCK ExpNonPagedLookasideListLock;
|
extern KSPIN_LOCK ExpNonPagedLookasideListLock;
|
||||||
extern KSPIN_LOCK ExpPagedLookasideListLock;
|
extern KSPIN_LOCK ExpPagedLookasideListLock;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NT/Cm Version Info variables
|
||||||
|
*/
|
||||||
|
extern ULONG NtMajorVersion;
|
||||||
|
extern ULONG NtMinorVersion;
|
||||||
|
extern ULONG NtBuildNumber;
|
||||||
|
extern ULONG CmNtSpBuildNumber;
|
||||||
|
extern ULONG CmNtCSDVersion;
|
||||||
|
extern ULONG CmNtCSDReleaseType;
|
||||||
|
extern UNICODE_STRING CmVersionString;
|
||||||
|
extern UNICODE_STRING CmCSDVersionString;
|
||||||
|
extern CHAR NtBuildLab[];
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#define HANDLE_LOW_BITS (PAGE_SHIFT - 4)
|
#define HANDLE_LOW_BITS (PAGE_SHIFT - 4)
|
||||||
#define HANDLE_HIGH_BITS (PAGE_SHIFT - 3)
|
#define HANDLE_HIGH_BITS (PAGE_SHIFT - 3)
|
||||||
|
|
|
@ -30,7 +30,6 @@ IopTimerDispatch(
|
||||||
POBJECT_TYPE IoDeviceObjectType = NULL;
|
POBJECT_TYPE IoDeviceObjectType = NULL;
|
||||||
POBJECT_TYPE IoFileObjectType = NULL;
|
POBJECT_TYPE IoFileObjectType = NULL;
|
||||||
extern POBJECT_TYPE IoControllerObjectType;
|
extern POBJECT_TYPE IoControllerObjectType;
|
||||||
extern UNICODE_STRING NtSystemRoot;
|
|
||||||
BOOLEAN IoCountOperations = TRUE;
|
BOOLEAN IoCountOperations = TRUE;
|
||||||
ULONG IoReadOperationCount = 0;
|
ULONG IoReadOperationCount = 0;
|
||||||
LARGE_INTEGER IoReadTransferCount = {{0, 0}};
|
LARGE_INTEGER IoReadTransferCount = {{0, 0}};
|
||||||
|
|
|
@ -43,7 +43,7 @@ PVOID PspSystemDllSection;
|
||||||
PVOID PspSystemDllEntryPoint;
|
PVOID PspSystemDllEntryPoint;
|
||||||
|
|
||||||
UNICODE_STRING PsNtDllPathName =
|
UNICODE_STRING PsNtDllPathName =
|
||||||
RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll");
|
RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\ntdll.dll");
|
||||||
|
|
||||||
PHANDLE_TABLE PspCidTable;
|
PHANDLE_TABLE PspCidTable;
|
||||||
|
|
||||||
|
@ -658,28 +658,23 @@ PsInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
PsGetVersion(IN PULONG MajorVersion OPTIONAL,
|
PsGetVersion(OUT PULONG MajorVersion OPTIONAL,
|
||||||
IN PULONG MinorVersion OPTIONAL,
|
OUT PULONG MinorVersion OPTIONAL,
|
||||||
IN PULONG BuildNumber OPTIONAL,
|
OUT PULONG BuildNumber OPTIONAL,
|
||||||
IN PUNICODE_STRING CSDVersion OPTIONAL)
|
OUT PUNICODE_STRING CSDVersion OPTIONAL)
|
||||||
{
|
{
|
||||||
if (MajorVersion) *MajorVersion = NtMajorVersion;
|
if (MajorVersion) *MajorVersion = NtMajorVersion;
|
||||||
if (MinorVersion) *MinorVersion = NtMinorVersion;
|
if (MinorVersion) *MinorVersion = NtMinorVersion;
|
||||||
if (BuildNumber) *BuildNumber = NtBuildNumber;
|
if (BuildNumber ) *BuildNumber = NtBuildNumber & 0x3FFF;
|
||||||
|
|
||||||
if (CSDVersion)
|
if (CSDVersion)
|
||||||
{
|
{
|
||||||
CSDVersion->Length = 0;
|
|
||||||
CSDVersion->MaximumLength = 0;
|
|
||||||
CSDVersion->Buffer = NULL;
|
|
||||||
#if 0
|
|
||||||
CSDVersion->Length = CmCSDVersionString.Length;
|
CSDVersion->Length = CmCSDVersionString.Length;
|
||||||
CSDVersion->MaximumLength = CmCSDVersionString.Maximum;
|
CSDVersion->MaximumLength = CmCSDVersionString.MaximumLength;
|
||||||
CSDVersion->Buffer = CmCSDVersionString.Buffer;
|
CSDVersion->Buffer = CmCSDVersionString.Buffer;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the High word */
|
/* Return TRUE if this is a Checked Build */
|
||||||
return (NtBuildNumber >> 28) == 0xC;
|
return (NtBuildNumber >> 28) == 0xC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue