--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c 2005-11-18 20:35:42 UTC (rev 19328)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c 2005-11-18 22:04:17 UTC (rev 19329)
@@ -117,7 +117,7 @@
} __attribute__((packed)) CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
-static char Hex[] = "0123456789ABCDEF";
+static WCHAR Hex[] = L"0123456789ABCDEF";
static unsigned int delay_count = 1;
@@ -247,7 +247,7 @@
/* Set 'Component Information' value */
Error = RegSetValue(ComponentKey,
- "Component Information",
+ L"Component Information",
REG_BINARY,
(PCHAR)&CompInfo,
sizeof(CM_COMPONENT_INFORMATION));
@@ -264,7 +264,7 @@
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PNP_BIOS_DEVICE_NODE DeviceNode;
PCM_PNP_BIOS_INSTALLATION_CHECK InstData;
- char Buffer[80];
+ WCHAR Buffer[80];
FRLDRHKEY BusKey;
ULONG x;
ULONG NodeSize = 0;
@@ -302,8 +302,8 @@
DbgPrint((DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize * NodeCount));
/* Create new bus key */
- sprintf(Buffer,
- "MultifunctionAdapter\\%u", *BusNumber);
+ swprintf(Buffer,
+ L"MultifunctionAdapter\\%u", *BusNumber);
Error = RegCreateKey(SystemKey,
Buffer,
&BusKey);
@@ -324,10 +324,10 @@
/* Set 'Identifier' value */
Error = RegSetValue(BusKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- "PNP BIOS",
- 9);
+ (PCHAR)L"PNP BIOS",
+ 9 * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
@@ -402,7 +402,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(BusKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -484,7 +484,7 @@
DiskGeometry->BytesPerSector));
Error = RegSetValue(DiskKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -507,7 +507,7 @@
ULONG i;
ULONG Checksum;
ULONG Signature;
- CHAR Identifier[20];
+ WCHAR Identifier[20];
LONG Error;
/* Read the MBR */
@@ -541,7 +541,7 @@
Identifier[5] = Hex[(Checksum >> 8) & 0x0F];
Identifier[6] = Hex[(Checksum >> 4) & 0x0F];
Identifier[7] = Hex[Checksum & 0x0F];
- Identifier[8] = '-';
+ Identifier[8] = L'-';
Identifier[9] = Hex[(Signature >> 28) & 0x0F];
Identifier[10] = Hex[(Signature >> 24) & 0x0F];
Identifier[11] = Hex[(Signature >> 20) & 0x0F];
@@ -550,17 +550,17 @@
Identifier[14] = Hex[(Signature >> 8) & 0x0F];
Identifier[15] = Hex[(Signature >> 4) & 0x0F];
Identifier[16] = Hex[Signature & 0x0F];
- Identifier[17] = '-';
- Identifier[18] = 'A';
+ Identifier[17] = L'-';
+ Identifier[18] = L'A';
Identifier[19] = 0;
- DbgPrint((DPRINT_HWDETECT, "Identifier: %x\n", Identifier));
+ DbgPrint((DPRINT_HWDETECT, "Identifier: %S\n", Identifier));
/* Set identifier */
Error = RegSetValue(DiskKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Identifier,
- 20);
+ (PCHAR)Identifier,
+ sizeof(Identifier));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -577,7 +577,7 @@
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_INT13_DRIVE_PARAMETER Int13Drives;
GEOMETRY Geometry;
- CHAR Buffer[80];
+ WCHAR Buffer[80];
FRLDRHKEY DiskKey;
ULONG DiskCount;
ULONG Size;
@@ -662,7 +662,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(SystemKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -679,9 +679,9 @@
for (i = 0; i < DiskCount; i++)
{
/* Create disk key */
- sprintf (Buffer,
- "DiskController\\0\\DiskPeripheral\\%u",
- i);
+ swprintf (Buffer,
+ L"DiskController\\0\\DiskPeripheral\\%u",
+ i);
Error = RegCreateKey(BusKey,
Buffer,
@@ -691,7 +691,7 @@
DbgPrint((DPRINT_HWDETECT, "Failed to create drive key\n"));
continue;
}
- DbgPrint((DPRINT_HWDETECT, "Created key: %s\n", Buffer));
+ DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", Buffer));
/* Set disk values */
SetHarddiskConfigurationData(DiskKey, 0x80 + i);
@@ -745,8 +745,8 @@
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PCM_FLOPPY_DEVICE_DATA FloppyData;
- char KeyName[32];
- char Identifier[20];
+ WCHAR KeyName[32];
+ WCHAR Identifier[20];
FRLDRHKEY PeripheralKey;
ULONG Size;
LONG Error;
@@ -766,10 +766,10 @@
Ptr = GetInt1eTable();
- sprintf(KeyName, "FloppyDiskPeripheral\\%u", FloppyNumber);
+ swprintf(KeyName, L"FloppyDiskPeripheral\\%u", FloppyNumber);
Error = RegCreateKey(ControllerKey,
- "FloppyDiskPeripheral\\0",
+ KeyName,
&PeripheralKey);
if (Error != ERROR_SUCCESS)
{
@@ -777,7 +777,7 @@
return;
}
- DbgPrint((DPRINT_HWDETECT, "Created key: %s\n", KeyName));
+ DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", KeyName));
/* Set 'ComponentInformation' value */
SetComponentInformation(PeripheralKey,
@@ -818,7 +818,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(PeripheralKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -832,12 +832,12 @@
}
/* Set 'Identifier' value */
- sprintf(Identifier, "FLOPPY%u", FloppyNumber + 1);
+ swprintf(Identifier, L"FLOPPY%u", FloppyNumber + 1);
Error = RegSetValue(PeripheralKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
(PCHAR)Identifier,
- strlen(Identifier) + 1);
+ (wcslen(Identifier) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -868,7 +868,7 @@
return;
Error = RegCreateKey(BusKey,
- "DiskController\\0",
+ L"DiskController\\0",
&ControllerKey);
if (Error != ERROR_SUCCESS)
{
@@ -928,7 +928,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(ControllerKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -1112,12 +1112,13 @@
{
CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
char Buffer[256];
- char Identifier[256];
+ WCHAR Identifier[256];
FRLDRHKEY PeripheralKey;
ULONG MouseType;
ULONG Length;
ULONG i;
ULONG j;
+ ULONG k;
LONG Error;
DbgPrint((DPRINT_HWDETECT,
@@ -1150,12 +1151,13 @@
Buffer));
/* Copy PnpId string */
- memcpy(&Identifier[0],
- &Buffer[3],
- 7);
- memcpy(&Identifier[7],
- " - ",
- 4);
+ for (i = 0; i < 7; i++)
+ {
+ Identifier[i] = Buffer[3+i];
+ }
+ memcpy(&Identifier[7],
+ L" - ",
+ 3 * sizeof(WCHAR));
/* Skip device serial number */
i = 10;
@@ -1209,43 +1211,44 @@
i -= 3;
if (i > j + 1)
{
- memcpy(&Identifier[10],
- &Buffer[j],
- i - j);
+ for (k = 0; k < i - j; k++)
+ {
+ Identifier[k + 10] = Buffer[k + j];
+ }
Identifier[10 + (i-j)] = 0;
}
}
DbgPrint((DPRINT_HWDETECT,
- "Identifier string: %s\n",
+ "Identifier string: %S\n",
Identifier));
}
- if (Length == 0 || strlen(Identifier) < 11)
+ if (Length == 0 || wcslen(Identifier) < 11)
{
switch (MouseType)
{
case MOUSE_TYPE_LOGITECH:
- strcpy (Identifier,
- "LOGITECH SERIAL MOUSE");
+ wcscpy (Identifier,
+ L"LOGITECH SERIAL MOUSE");
break;
case MOUSE_TYPE_WHEELZ:
- strcpy (Identifier,
- "MICROSOFT SERIAL MOUSE WITH WHEEL");
+ wcscpy (Identifier,
+ L"MICROSOFT SERIAL MOUSE WITH WHEEL");
break;
case MOUSE_TYPE_MICROSOFT:
default:
- strcpy (Identifier,
- "MICROSOFT SERIAL MOUSE");
+ wcscpy (Identifier,
+ L"MICROSOFT SERIAL MOUSE");
break;
}
}
/* Create 'PointerPeripheral' key */
Error = RegCreateKey(ControllerKey,
- "PointerPeripheral\\0",
+ L"PointerPeripheral\\0",
&PeripheralKey);
if (Error != ERROR_SUCCESS)
{
@@ -1269,7 +1272,7 @@
FullResourceDescriptor.PartialResourceList.Count = 0;
Error = RegSetValue(PeripheralKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR)&FullResourceDescriptor,
sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
@@ -1283,10 +1286,10 @@
/* Set 'Identifier' value */
Error = RegSetValue(PeripheralKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Identifier,
- strlen(Identifier) + 1);
+ (PCHAR)Identifier,
+ (wcslen(Identifier) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -1305,7 +1308,7 @@
PCM_SERIAL_DEVICE_DATA SerialDeviceData;
ULONG Irq[4] = {4, 3, 4, 3};
ULONG Base;
- char Buffer[80];
+ WCHAR Buffer[80];
PUSHORT BasePtr;
ULONG ControllerNumber = 0;
FRLDRHKEY ControllerKey;
@@ -1329,8 +1332,8 @@
Base));
/* Create controller key */
- sprintf(Buffer,
- "SerialController\\%u",
+ swprintf(Buffer,
+ L"SerialController\\%u",
ControllerNumber);
Error = RegCreateKey(BusKey,
@@ -1341,7 +1344,7 @@
DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
continue;
}
- DbgPrint((DPRINT_HWDETECT, "Created key: %s\n", Buffer));
+ DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", Buffer));
/* Set 'ComponentInformation' value */
SetComponentInformation(ControllerKey,
@@ -1398,7 +1401,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(ControllerKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -1411,14 +1414,14 @@
}
/* Set 'Identifier' value */
- sprintf(Buffer,
- "COM%u",
- i + 1);
+ swprintf(Buffer,
+ L"COM%u",
+ i + 1);
Error = RegSetValue(ControllerKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Buffer,
- strlen(Buffer) + 1);
+ (PCHAR)Buffer,
+ (wcslen(Buffer) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -1430,8 +1433,11 @@
"Created value: Identifier %s\n",
Buffer));
- /* Detect serial mouse */
- DetectSerialPointerPeripheral(ControllerKey, Base);
+ if (!Rs232PortInUse(Base))
+ {
+ /* Detect serial mouse */
+ DetectSerialPointerPeripheral(ControllerKey, Base);
+ }
ControllerNumber++;
}
@@ -1444,7 +1450,7 @@
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
ULONG Irq[3] = {7, 5, (ULONG)-1};
- char Buffer[80];
+ WCHAR Buffer[80];
FRLDRHKEY ControllerKey;
PUSHORT BasePtr;
ULONG Base;
@@ -1469,9 +1475,9 @@
Base));
/* Create controller key */
- sprintf(Buffer,
- "ParallelController\\%u",
- ControllerNumber);
+ swprintf(Buffer,
+ L"ParallelController\\%u",
+ ControllerNumber);
Error = RegCreateKey(BusKey,
Buffer,
@@ -1481,7 +1487,7 @@
DbgPrint((DPRINT_HWDETECT, "Failed to create controller key\n"));
continue;
}
- DbgPrint((DPRINT_HWDETECT, "Created key: %s\n", Buffer));
+ DbgPrint((DPRINT_HWDETECT, "Created key: %S\n", Buffer));
/* Set 'ComponentInformation' value */
SetComponentInformation(ControllerKey,
@@ -1531,7 +1537,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(ControllerKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -1544,14 +1550,14 @@
}
/* Set 'Identifier' value */
- sprintf(Buffer,
- "PARALLEL%u",
+ swprintf(Buffer,
+ L"PARALLEL%u",
i + 1);
Error = RegSetValue(ControllerKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Buffer,
- strlen(Buffer) + 1);
+ (PCHAR)Buffer,
+ (wcslen(Buffer) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -1637,7 +1643,6 @@
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
PCM_KEYBOARD_DEVICE_DATA KeyboardData;
FRLDRHKEY PeripheralKey;
- char Buffer[80];
ULONG Size;
LONG Error;
@@ -1645,7 +1650,7 @@
{
/* Create controller key */
Error = RegCreateKey(ControllerKey,
- "KeyboardPeripheral\\0",
+ L"KeyboardPeripheral\\0",
&PeripheralKey);
if (Error != ERROR_SUCCESS)
{
@@ -1691,7 +1696,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(PeripheralKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR)FullResourceDescriptor,
Size);
@@ -1704,13 +1709,11 @@
}
/* Set 'Identifier' value */
- strcpy(Buffer,
- "PCAT_ENHANCED");
Error = RegSetValue(PeripheralKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Buffer,
- strlen(Buffer) + 1);
+ (PCHAR)L"PCAT_ENHANCED",
+ 14 * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -1732,7 +1735,7 @@
/* Create controller key */
Error = RegCreateKey(BusKey,
- "KeyboardController\\0",
+ L"KeyboardController\\0",
&ControllerKey);
if (Error != ERROR_SUCCESS)
{
@@ -1793,7 +1796,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(ControllerKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR)FullResourceDescriptor,
Size);
@@ -1929,7 +1932,7 @@
/* Create controller key */
Error = RegCreateKey(BusKey,
- "PointerController\\0",
+ L"PointerController\\0",
&ControllerKey);
if (Error != ERROR_SUCCESS)
{
@@ -1961,7 +1964,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(ControllerKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR)&FullResourceDescriptor,
sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
@@ -1980,7 +1983,7 @@
/* Create peripheral key */
Error = RegCreateKey(ControllerKey,
- "PointerPeripheral\\0",
+ L"PointerPeripheral\\0",
&PeripheralKey);
if (Error != ERROR_SUCCESS)
{
@@ -2003,7 +2006,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(PeripheralKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR)&FullResourceDescriptor,
sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
@@ -2018,10 +2021,10 @@
/* Set 'Identifier' value */
Error = RegSetValue(PeripheralKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- "MICROSOFT PS2 MOUSE",
- 20);
+ (PCHAR)L"MICROSOFT PS2 MOUSE",
+ 20 * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -2037,13 +2040,13 @@
static VOID
DetectDisplayController(FRLDRHKEY BusKey)
{
- CHAR Buffer[80];
+ WCHAR Buffer[80];
FRLDRHKEY ControllerKey;
USHORT VesaVersion;
LONG Error;
Error = RegCreateKey(BusKey,
- "DisplayController\\0",
+ L"DisplayController\\0",
&ControllerKey);
if (Error != ERROR_SUCCESS)
{
@@ -2076,21 +2079,21 @@
if (VesaVersion >= 0x0200)
{
- strcpy(Buffer,
- "VBE Display");
+ wcscpy(Buffer,
+ L"VBE Display");
}
else
{
- strcpy(Buffer,
- "VGA Display");
+ wcscpy(Buffer,
+ L"VGA Display");
}
/* Set 'Identifier' value */
Error = RegSetValue(ControllerKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Buffer,
- strlen(Buffer) + 1);
+ (PCHAR)Buffer,
+ (wcslen(Buffer) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT,
@@ -2107,14 +2110,14 @@
DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber)
{
PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor;
- char Buffer[80];
+ WCHAR Buffer[80];
FRLDRHKEY BusKey;
ULONG Size;
LONG Error;
/* Create new bus key */
- sprintf(Buffer,
- "MultifunctionAdapter\\%u", *BusNumber);
+ swprintf(Buffer,
+ L"MultifunctionAdapter\\%u", *BusNumber);
Error = RegCreateKey(SystemKey,
Buffer,
&BusKey);
@@ -2135,10 +2138,10 @@
/* Set 'Identifier' value */
Error = RegSetValue(BusKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- "ISA",
- 4);
+ (PCHAR)L"ISA",
+ 4 * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
@@ -2164,7 +2167,7 @@
/* Set 'Configuration Data' value */
Error = RegSetValue(BusKey,
- "Configuration Data",
+ L"Configuration Data",
REG_FULL_RESOURCE_DESCRIPTOR,
(PCHAR) FullResourceDescriptor,
Size);
@@ -2207,7 +2210,7 @@
/* Create the 'System' key */
Error = RegCreateKey(NULL,
- "\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
+ L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System",
&SystemKey);
if (Error != ERROR_SUCCESS)
{
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c 2005-11-18 20:35:42 UTC (rev 19328)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c 2005-11-18 22:04:17 UTC (rev 19329)
@@ -105,8 +105,9 @@
DetectCPU(FRLDRHKEY CpuKey,
FRLDRHKEY FpuKey)
{
- CHAR VendorIdentifier[13];
- CHAR Identifier[64];
+ WCHAR VendorIdentifier[13];
+ CHAR tmpVendorIdentifier[13];
+ WCHAR Identifier[64];
ULONG FeatureSet;
FRLDRHKEY CpuInstKey;
FRLDRHKEY FpuInstKey;
@@ -122,7 +123,7 @@
/* Create the CPU instance key */
Error = RegCreateKey(CpuKey,
- "0",
+ L"0",
&CpuInstKey);
if (Error != ERROR_SUCCESS)
{
@@ -132,7 +133,7 @@
/* Create the FPU instance key */
Error = RegCreateKey(FpuKey,
- "0",
+ L"0",
&FpuInstKey);
if (Error != ERROR_SUCCESS)
{
@@ -147,21 +148,22 @@
/* Get vendor identifier */
GetCpuid(0, &eax, &ebx, &ecx, &edx);
- VendorIdentifier[12] = 0;
- Ptr = (ULONG*)&VendorIdentifier[0];
+ tmpVendorIdentifier[12] = 0;
+ Ptr = (ULONG*)&tmpVendorIdentifier[0];
*Ptr = ebx;
Ptr++;
*Ptr = edx;
Ptr++;
*Ptr = ecx;
+ swprintf(VendorIdentifier, L"%s", tmpVendorIdentifier);
/* Get Identifier */
GetCpuid(1, &eax, &ebx, &ecx, &edx);
- sprintf(Identifier,
- "x86 Family %u Model %u Stepping %u",
- (unsigned int)((eax >> 8) & 0x0F),
- (unsigned int)((eax >> 4) & 0x0F),
- (unsigned int)(eax & 0x0F));
+ swprintf(Identifier,
+ L"x86 Family %u Model %u Stepping %u",
+ (unsigned int)((eax >> 8) & 0x0F),
+ (unsigned int)((eax >> 4) & 0x0F),
+ (unsigned int)(eax & 0x0F));
FeatureSet = edx;
if (((eax >> 8) & 0x0F) >= 5)
SupportTSC = TRUE;
@@ -170,9 +172,9 @@
{
DbgPrint((DPRINT_HWDETECT, "CPUID not supported\n"));
- strcpy(VendorIdentifier, "Unknown");
- sprintf(Identifier,
- "x86 Family %u Model %u Stepping %u",
+ wcscpy(VendorIdentifier, L"Unknown");
+ swprintf(Identifier,
+ L"x86 Family %u Model %u Stepping %u",
(unsigned int)((eax >> 8) & 0x0F),
(unsigned int)((eax >> 4) & 0x0F),
(unsigned int)(eax & 0x0F));
@@ -187,7 +189,7 @@
DbgPrint((DPRINT_HWDETECT, "FeatureSet: %x\n", FeatureSet));
Error = RegSetValue(CpuInstKey,
- "FeatureSet",
+ L"FeatureSet",
REG_DWORD,
(PCHAR)&FeatureSet,
sizeof(ULONG));
@@ -197,36 +199,36 @@
}
/* Set 'Identifier' value (CPU and FPU) */
- DbgPrint((DPRINT_HWDETECT, "Identifier: %s\n", Identifier));
+ DbgPrint((DPRINT_HWDETECT, "Identifier: %S\n", Identifier));
Error = RegSetValue(CpuInstKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Identifier,
- strlen(Identifier) + 1);
+ (PCHAR)Identifier,
+ (wcslen(Identifier) + 1)* sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
}
Error = RegSetValue(FpuInstKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Identifier,
- strlen(Identifier) + 1);
+ (PCHAR)Identifier,
+ (wcslen(Identifier) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
}
/* Set 'VendorIdentifier' value (CPU only) */
- DbgPrint((DPRINT_HWDETECT, "Vendor Identifier: %s\n", VendorIdentifier));
+ DbgPrint((DPRINT_HWDETECT, "Vendor Identifier: %S\n", VendorIdentifier));
Error = RegSetValue(CpuInstKey,
- "VendorIdentifier",
+ L"VendorIdentifier",
REG_SZ,
- VendorIdentifier,
- strlen(VendorIdentifier) + 1);
+ (PCHAR)VendorIdentifier,
+ (wcslen(VendorIdentifier) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
@@ -242,7 +244,7 @@
CpuSpeed = GetCpuSpeed();
Error = RegSetValue(CpuInstKey,
- "~MHz",
+ L"~MHz",
REG_DWORD,
(PCHAR)&CpuSpeed,
sizeof(ULONG));
@@ -259,9 +261,10 @@
FRLDRHKEY FpuKey,
PMP_PROCESSOR_ENTRY CpuEntry)
{
- char VendorIdentifier[13];
- char Identifier[64];
- char Buffer[8];
+ WCHAR VendorIdentifier[13];
+ CHAR tmpVendorIdentifier[13];
+ WCHAR Identifier[64];
+ WCHAR Buffer[8];
ULONG FeatureSet;
FRLDRHKEY CpuInstKey;
FRLDRHKEY FpuInstKey;
@@ -274,7 +277,7 @@
ULONG CpuSpeed;
/* Get processor instance number */
- sprintf(Buffer, "%u", CpuEntry->LocalApicId);
+ swprintf(Buffer, L"%u", CpuEntry->LocalApicId);
/* Create the CPU instance key */
Error = RegCreateKey(CpuKey,
@@ -298,17 +301,18 @@
/* Get 'VendorIdentifier' */
GetCpuid(0, &eax, &ebx, &ecx, &edx);
- VendorIdentifier[12] = 0;
- Ptr = (ULONG*)&VendorIdentifier[0];
+ tmpVendorIdentifier[12] = 0;
+ Ptr = (ULONG*)&tmpVendorIdentifier[0];
*Ptr = ebx;
Ptr++;
*Ptr = edx;
Ptr++;
*Ptr = ecx;
+ swprintf(VendorIdentifier, L"%s", tmpVendorIdentifier);
/* Get 'Identifier' */
- sprintf(Identifier,
- "x86 Family %u Model %u Stepping %u",
+ swprintf(Identifier,
+ L"x86 Family %u Model %u Stepping %u",
(ULONG)((CpuEntry->CpuSignature >> 8) & 0x0F),
(ULONG)((CpuEntry->CpuSignature >> 4) & 0x0F),
(ULONG)(CpuEntry->CpuSignature & 0x0F));
@@ -331,7 +335,7 @@
DbgPrint((DPRINT_HWDETECT, "FeatureSet: %x\n", FeatureSet));
Error = RegSetValue(CpuInstKey,
- "FeatureSet",
+ L"FeatureSet",
REG_DWORD,
(PCHAR)&FeatureSet,
sizeof(ULONG));
@@ -341,36 +345,36 @@
}
/* Set 'Identifier' value (CPU and FPU) */
- DbgPrint((DPRINT_HWDETECT, "Identifier: %s\n", Identifier));
+ DbgPrint((DPRINT_HWDETECT, "Identifier: %S\n", Identifier));
Error = RegSetValue(CpuInstKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Identifier,
- strlen(Identifier) + 1);
+ (PCHAR)Identifier,
+ (wcslen(Identifier) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
}
Error = RegSetValue(FpuInstKey,
- "Identifier",
+ L"Identifier",
REG_SZ,
- Identifier,
- strlen(Identifier) + 1);
+ (PCHAR)Identifier,
+ (wcslen(Identifier) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
}
/* Set 'VendorIdentifier' value (CPU only) */
- DbgPrint((DPRINT_HWDETECT, "Vendor Identifier: %s\n", VendorIdentifier));
+ DbgPrint((DPRINT_HWDETECT, "Vendor Identifier: %S\n", VendorIdentifier));
Error = RegSetValue(CpuInstKey,
- "VendorIdentifier",
+ L"VendorIdentifier",
REG_SZ,
[truncated at 1000 lines; 1944 more skipped]