Author: ion
Date: Fri May 11 01:36:24 2007
New Revision: 26685
URL: http://svn.reactos.org/svn/reactos?rev=26685&view=rev
Log:
- Add code to detect and save the BIOS Version string to the registry. We use the same detection patterns as Windows for now (Ver, Rev, Rel, v0-9).
- All BIOS Version strings are scanned and saved in a REG_MULTI_SZ key, as on Windows. QEMU BIOS Version String is correctly detected as the CVS/SVN $ID tag, which is good enough.
Modified:
trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
Modified: trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/i386/cmhar…
==============================================================================
--- trunk/reactos/ntoskrnl/config/i386/cmhardwr.c (original)
+++ trunk/reactos/ntoskrnl/config/i386/cmhardwr.c Fri May 11 01:36:24 2007
@@ -17,6 +17,17 @@
PCHAR CmpID1 = "80%u86-%c%x";
PCHAR CmpID2 = "x86 Family %u Model %u Stepping %u";
+PCHAR CmpBiosStrings[] =
+{
+ "Ver",
+ "Rev",
+ "Rel",
+ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
+ "v 0", "v 1", "v 2", "v 3", "v 4", "v 5", "v 6", "v 7", "v 8", "v 9",
+ NULL
+};
+
+PCHAR CmpBiosBegin, CmpBiosSearchStart, CmpBiosSearchEnd;
/* FUNCTIONS *****************************************************************/
@@ -117,30 +128,126 @@
return FALSE;
}
+BOOLEAN
+NTAPI
+CmpGetBiosVersion(IN PCHAR BiosStart,
+ IN ULONG BiosLength,
+ IN PCHAR BiosVersion)
+{
+ CHAR Buffer[128];
+ PCHAR p, pp;
+ USHORT i;
+
+ /* Check if we were given intitial data for the search */
+ if (BiosStart)
+ {
+ /* Save it for later use */
+ CmpBiosBegin = BiosStart;
+ CmpBiosSearchStart = BiosStart + 1;
+ CmpBiosSearchEnd = BiosStart + BiosLength - 2;
+ }
+
+ /* Now loop the BIOS area */
+ for (;;)
+ {
+ /* Start an initial search looking for numbers and periods */
+ pp = NULL;
+ while (CmpBiosSearchStart <= CmpBiosSearchEnd)
+ {
+ /* Check if we have an "x.y" version string */
+ if ((*CmpBiosSearchStart == '.') &&
+ (*(CmpBiosSearchStart + 1) >= '0') &&
+ (*(CmpBiosSearchStart + 1) <= '9') &&
+ (*(CmpBiosSearchStart - 1) >= '0') &&
+ (*(CmpBiosSearchStart - 1) <= '9'))
+ {
+ /* Start looking in this area for the actual BIOS Version */
+ pp = CmpBiosSearchStart;
+ break;
+ }
+ else
+ {
+ /* Keep searching */
+ CmpBiosSearchStart++;
+ }
+ }
+
+ /* Break out if we're went past the BIOS area */
+ if (CmpBiosSearchStart > CmpBiosSearchEnd) return FALSE;
+
+ /* Move to the next 2 bytes */
+ CmpBiosSearchStart += 2;
+
+ /* Null-terminate our scratch buffer and start the string here */
+ Buffer[127] = ANSI_NULL;
+ p = &Buffer[127];
+
+ /* Go back one character since we're doing this backwards */
+ pp--;
+
+ /* Loop the identifier we found as long as it's valid */
+ i = 0;
+ while ((i++ < 127) &&
+ (pp >= CmpBiosBegin) &&
+ (*pp >= ' ') &&
+ (*pp != '$'))
+ {
+ /* Copy the character */
+ *--p = *pp--;
+ }
+
+ /* Go past the last character since we went backwards */
+ pp++;
+
+ /* Loop the strings we recognize */
+ for (i = 0; CmpBiosStrings[i]; i++)
+ {
+ /* Check if a match was found */
+ if (strstr(p, CmpBiosStrings[i])) goto Match;
+ }
+ }
+
+Match:
+ /* Skip until we find a space */
+ for (; *pp == ' '; pp++);
+
+ /* Loop the final string */
+ i = 0;
+ do
+ {
+ /* Copy the character into the final string */
+ BiosVersion[i] = *pp++;
+ } while ((++i < 127) &&
+ (pp <= (CmpBiosSearchEnd + 1)) &&
+ (*pp >= ' ') &&
+ (*pp != '$'));
+
+ /* Null-terminate the version string */
+ BiosVersion[i] = ANSI_NULL;
+ return TRUE;
+}
+
NTSTATUS
NTAPI
CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
UNICODE_STRING KeyName, ValueName, Data, SectionName;
OBJECT_ATTRIBUTES ObjectAttributes;
- ULONG HavePae;
+ ULONG HavePae, CacheSize, ViewSize, Length, TotalLength = 0, i, Disposition;
NTSTATUS Status;
HANDLE KeyHandle, BiosHandle, SystemHandle, FpuHandle, SectionHandle;
- ULONG Disposition;
CONFIGURATION_COMPONENT_DATA ConfigData;
CHAR Buffer[128];
- ULONG i, ExtendedId, Dummy;
+ ULONG ExtendedId, Dummy;
PKPRCB Prcb;
USHORT IndexTable[MaximumType + 1] = {0};
ANSI_STRING TempString;
- PCHAR PartialString = NULL;
+ PCHAR PartialString = NULL, BiosVersion;
CHAR CpuString[48];
- ULONG CacheSize;
PVOID BaseAddress = NULL;
LARGE_INTEGER ViewBase = {{0}};
ULONG_PTR VideoRomBase;
- ULONG ViewSize;
- PCHAR BiosVersion;
+ PCHAR CurrentVersion;
/* Open the SMSS Memory Management key */
RtlInitUnicodeString(&KeyName,
@@ -281,7 +388,7 @@
ConfigData.ComponentEntry.AffinityMask = AFFINITY_MASK(i);
ConfigData.ComponentEntry.Identifier = Buffer;
- /* For 386 cpus, the CPU String is the identifier */
+ /* For 386 cpus, the CPU pp is the identifier */
if (Prcb->CpuType == 3) strcpy(Buffer, "80387");
/* Save the ID string length now that we've created it */
@@ -475,7 +582,7 @@
ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
}
- /* Allocate BIOS Version String Buffer */
+ /* Allocate BIOS Version pp Buffer */
BiosVersion = ExAllocatePoolWithTag(PagedPool, PAGE_SIZE, TAG_CM);
/* Setup settings to map the 64K BIOS ROM */
@@ -539,6 +646,56 @@
/* Close the bios information handle */
NtClose(BiosHandle);
+
+ /* Get the BIOS Version */
+ if (CmpGetBiosVersion(BaseAddress, 16* PAGE_SIZE, Buffer))
+ {
+ /* Start at the beginning of our buffer */
+ CurrentVersion = BiosVersion;
+ do
+ {
+ /* Convert to Unicode */
+ RtlInitAnsiString(&TempString, Buffer);
+ RtlAnsiStringToUnicodeString(&Data, &TempString, TRUE);
+
+ /* Calculate the length of this string and copy it in */
+ Length = Data.Length + sizeof(UNICODE_NULL);
+ RtlMoveMemory(CurrentVersion, Data.Buffer, Length);
+
+ /* Free the unicode string */
+ RtlFreeUnicodeString(&Data);
+
+ /* Update the total length and see if we're out of space */
+ TotalLength += Length;
+ if (TotalLength + 256 + sizeof(UNICODE_NULL) > PAGE_SIZE)
+ {
+ /* One more string would push us out, so stop here */
+ break;
+ }
+
+ /* Go to the next string inside the multi-string buffer */
+ CurrentVersion += Length;
+
+ /* Query the next BIOS Version */
+ } while (CmpGetBiosVersion(NULL, 0, Buffer));
+
+ /* Check if we found any strings at all */
+ if (TotalLength)
+ {
+ /* Add the final null-terminator */
+ *(PWSTR)CurrentVersion = UNICODE_NULL;
+ TotalLength += sizeof(UNICODE_NULL);
+
+ /* Write the BIOS Version to the registry */
+ RtlInitUnicodeString(&ValueName, L"SystemBiosVersion");
+ Status = NtSetValueKey(SystemHandle,
+ &ValueName,
+ 0,
+ REG_MULTI_SZ,
+ BiosVersion,
+ TotalLength);
+ }
+ }
}
/* Unmap the section */
Author: ion
Date: Fri May 11 00:43:40 2007
New Revision: 26683
URL: http://svn.reactos.org/svn/reactos?rev=26683&view=rev
Log:
- CmpInitializeMachineDependentConfiguration: Use the same strategy as for the BIOS to get the Video ROM BIOS Date as well and save it into VideoBiosDate.
Modified:
trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
Modified: trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/i386/cmhar…
==============================================================================
--- trunk/reactos/ntoskrnl/config/i386/cmhardwr.c (original)
+++ trunk/reactos/ntoskrnl/config/i386/cmhardwr.c Fri May 11 00:43:40 2007
@@ -540,7 +540,59 @@
/* Close the bios information handle */
NtClose(BiosHandle);
}
- }
+
+ /* Unmap the section */
+ ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
+ }
+
+ /* Now prepare for Video BIOS Mapping of 32KB */
+ BaseAddress = 0;
+ ViewSize = 8 * PAGE_SIZE;
+ ViewBase.LowPart = VideoRomBase;
+ ViewBase.HighPart = 0;
+
+ /* Map it */
+ Status = ZwMapViewOfSection(SectionHandle,
+ NtCurrentProcess(),
+ &BaseAddress,
+ 0,
+ ViewSize,
+ &ViewBase,
+ &ViewSize,
+ ViewUnmap,
+ MEM_DOS_LIM,
+ PAGE_READWRITE);
+ if (NT_SUCCESS(Status))
+ {
+ /* Scan the ROM to get the BIOS Date */
+ if (CmpGetBiosDate(BaseAddress, 8 * PAGE_SIZE, Buffer, FALSE))
+ {
+ /* Convert it to Unicode */
+ RtlInitAnsiString(&TempString, Buffer);
+ RtlAnsiStringToUnicodeString(&Data, &TempString, TRUE);
+
+ /* Write the date into the registry */
+ RtlInitUnicodeString(&ValueName, L"VideoBiosDate");
+ Status = NtSetValueKey(SystemHandle,
+ &ValueName,
+ 0,
+ REG_SZ,
+ Data.Buffer,
+ Data.Length + sizeof(UNICODE_NULL));
+
+ /* Free the string */
+ RtlFreeUnicodeString(&Data);
+ }
+
+ /* Unmap the section */
+ ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
+ }
+
+ /* Close the section */
+ ZwClose(SectionHandle);
+
+ /* Free the BIOS version string buffer */
+ if (BiosVersion) ExFreePool(BiosVersion);
Quickie:
/* Close the procesor handle */
Author: ion
Date: Thu May 10 23:06:52 2007
New Revision: 26681
URL: http://svn.reactos.org/svn/reactos?rev=26681&view=rev
Log:
- CmpInitializeMachineDependentConfiguration: Add Processor Name and Vendor ID as well (the former doesnt' work on QEMU because QEMU desn't support CPUID-EX, but on VMWare, I get: Dual Core AMD Opteron(tm) Processor 185.
Modified:
trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
Modified: trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/i386/cmhar…
==============================================================================
--- trunk/reactos/ntoskrnl/config/i386/cmhardwr.c (original)
+++ trunk/reactos/ntoskrnl/config/i386/cmhardwr.c Thu May 10 23:06:52 2007
@@ -24,7 +24,7 @@
NTAPI
CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- UNICODE_STRING KeyName, ValueName;
+ UNICODE_STRING KeyName, ValueName, Data;
OBJECT_ATTRIBUTES ObjectAttributes;
ULONG HavePae;
NTSTATUS Status;
@@ -32,9 +32,12 @@
ULONG Disposition;
CONFIGURATION_COMPONENT_DATA ConfigData;
CHAR Buffer[128];
- ULONG i;
+ ULONG i, ExtendedId, Dummy;
PKPRCB Prcb;
USHORT IndexTable[MaximumType + 1] = {0};
+ ANSI_STRING TempString;
+ PCHAR PartialString = NULL;
+ CHAR CpuString[48];
/* Open the SMSS Memory Management key */
RtlInitUnicodeString(&KeyName,
@@ -198,6 +201,81 @@
/* Close this new handle */
NtClose(FpuHandle);
+ /* Stay on this CPU only */
+ KeSetSystemAffinityThread(Prcb->SetMember);
+ if (!Prcb->CpuID)
+ {
+ /* Uh oh, no CPUID! */
+ }
+ else
+ {
+ /* Check if we have extended CPUID that supports name ID */
+ Ki386Cpuid(0x80000000, &ExtendedId, &Dummy, &Dummy, &Dummy);
+ if (ExtendedId >= 0x80000004)
+ {
+ /* Do all the CPUIDs requred to get the full name */
+ PartialString = CpuString;
+ for (ExtendedId = 2; ExtendedId <= 4; ExtendedId++)
+ {
+ /* Do the CPUID and save the name string */
+ Ki386Cpuid(0x80000000 | ExtendedId,
+ (PULONG)PartialString,
+ (PULONG)PartialString + 1,
+ (PULONG)PartialString + 2,
+ (PULONG)PartialString + 3);
+
+ /* Go to the next name string */
+ PartialString += 16;
+ }
+
+ /* Null-terminate it */
+ CpuString[48] = ANSI_NULL;
+ }
+ }
+
+ /* Go back to user affinity */
+ KeRevertToUserAffinityThread();
+
+ /* Check if we have a CPU Name */
+ if (PartialString)
+ {
+ /* Convert it to Unicode */
+ RtlInitAnsiString(&TempString, CpuString);
+ RtlAnsiStringToUnicodeString(&Data, &TempString, TRUE);
+
+ /* Add it to the registry */
+ RtlInitUnicodeString(&ValueName, L"ProcessorNameString");
+ Status = NtSetValueKey(KeyHandle,
+ &ValueName,
+ 0,
+ REG_SZ,
+ Data.Buffer,
+ Data.Length + sizeof(UNICODE_NULL));
+
+ /* Free the temporary buffer */
+ RtlFreeUnicodeString(&Data);
+ }
+
+ /* Check if we had a Vendor ID */
+ if (Prcb->VendorString)
+ {
+ /* Convert it to Unicode */
+ RtlInitAnsiString(&TempString, Prcb->VendorString);
+ RtlAnsiStringToUnicodeString(&Data, &TempString, TRUE);
+
+ /* Add it to the registry */
+ RtlInitUnicodeString(&ValueName, L"VendorIdentifier");
+ Status = NtSetValueKey(KeyHandle,
+ &ValueName,
+ 0,
+ REG_SZ,
+ Data.Buffer,
+ Data.Length + sizeof(UNICODE_NULL));
+
+ /* Free the temporary buffer */
+ RtlFreeUnicodeString(&Data);
+ }
+
/* Check if we have features bits */
if (Prcb->FeatureBits)
{
Author: mbosma
Date: Thu May 10 20:54:52 2007
New Revision: 26676
URL: http://svn.reactos.org/svn/reactos?rev=26676&view=rev
Log:
Proper color names.
Modified:
trunk/tools/RosBE-Windows/Tools/config/options.c
trunk/tools/RosBE-Windows/Tools/config/todo.txt
Modified: trunk/tools/RosBE-Windows/Tools/config/options.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/o…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/options.c (original)
+++ trunk/tools/RosBE-Windows/Tools/config/options.c Thu May 10 20:54:52 2007
@@ -24,9 +24,9 @@
#include "resources.h"
// note: do not change the order - theses are the color under winxp they might differ in another OSes
-WCHAR* Colors[] = { L"black", L"dark blue", L"green", L"turquoise", L"dark red", L"violett",
- L"olive", L"light grey", L"dark grey", L"light blue", L"light green",
- L"don't know what this color is called", L"light red", L"pink", L"yellow", L"white" };
+WCHAR* Colors[] = { L"black", L"dark blue", L"green", L"turquoise", L"dark red", L"purple",
+ L"ochar", L"light grey", L"dark grey", L"light blue", L"light green",
+ L"cyan", L"light red", L"magenta", L"yellow", L"white" };
int WriteSettings (HWND hwnd)
{
Modified: trunk/tools/RosBE-Windows/Tools/config/todo.txt
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/config/t…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/config/todo.txt (original)
+++ trunk/tools/RosBE-Windows/Tools/config/todo.txt Thu May 10 20:54:52 2007
@@ -1,11 +1,9 @@
ToDo:
+- Fix control size / positions
- Load old settings
- Disable Save button if there are no changes
-- Check Log path before saving
+- Check validity of log path before saving
- Exe and dialog icon
-- Fix control size / positions
- Use styled controls (uxtheme) for dialog
-- Find out how to disable
-- Font preview
-- ;abye cool logo as Bitmap
-- find out the name of color 0xB
+- Find out how to disable ... button
+- Font preview