#include "chkdsk.h"
#include "cmdcons.h"
#include "format.h"
-#include "settings.h"
#define NDEBUG
#include <debug.h>
-// HACK!
-#include <strsafe.h>
-
/* GLOBALS & LOCALS *********************************************************/
UpdateKBLayout(VOID)
{
PGENERIC_LIST_ENTRY ListEntry;
- LPCWSTR pszNewLayout;
+ PCWSTR pszNewLayout;
- pszNewLayout = MUIDefaultKeyboardLayout();
+ pszNewLayout = MUIDefaultKeyboardLayout(SelectedLanguageId);
if (LayoutList == NULL)
{
- LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
+ LayoutList = CreateKeyboardLayoutList(SetupInf, SelectedLanguageId, DefaultKBLayout);
if (LayoutList == NULL)
{
/* FIXME: Handle error! */
}
}
- /* Load the font */
- USetupData.LanguageId = 0;
SelectedLanguageId = DefaultLanguage;
+ USetupData.LanguageId = 0;
+
+ /* Load the font */
SetConsoleCodePage();
UpdateKBLayout();
{
NewLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
- if (SelectedLanguageId != NewLanguageId)
+ if (wcscmp(SelectedLanguageId, NewLanguageId))
{
/* Clear the language page */
MUIClearPage(LANGUAGE_PAGE);
ComputerList = CreateComputerTypeList(SetupInf);
DisplayList = CreateDisplayDriverList(SetupInf);
KeyboardList = CreateKeyboardDriverList(SetupInf);
- LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
+
LanguageList = CreateLanguageList(SetupInf, DefaultLanguage);
/* new part */
+ SelectedLanguageId = DefaultLanguage;
wcscpy(SelectedLanguageId, USetupData.LocaleID);
USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
+ LayoutList = CreateKeyboardLayoutList(SetupInf, SelectedLanguageId, DefaultKBLayout);
+
/* first we hack LanguageList */
ListEntry = GetFirstListEntry(LanguageList);
while (ListEntry != NULL)
DeviceSettingsPage(PINPUT_RECORD Ir)
{
static ULONG Line = 16;
+ CHAR CurrentItemText[256];
/* Initialize the computer settings list */
if (ComputerList == NULL)
/* Initialize the keyboard layout list */
if (LayoutList == NULL)
{
- LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
+ LayoutList = CreateKeyboardLayoutList(SetupInf, SelectedLanguageId, DefaultKBLayout);
if (LayoutList == NULL)
{
/* FIXME: report error */
MUIDisplayPage(DEVICE_SETTINGS_PAGE);
- CONSOLE_SetTextXY(25, 11, GetListEntryText(GetCurrentListEntry(ComputerList)));
- CONSOLE_SetTextXY(25, 12, GetListEntryText(GetCurrentListEntry(DisplayList)));
- CONSOLE_SetTextXY(25, 13, GetListEntryText(GetCurrentListEntry(KeyboardList)));
- CONSOLE_SetTextXY(25, 14, GetListEntryText(GetCurrentListEntry(LayoutList)));
+ sprintf(CurrentItemText, "%S", GetListEntryText(GetCurrentListEntry(ComputerList)));
+ CONSOLE_SetTextXY(25, 11, CurrentItemText);
+ sprintf(CurrentItemText, "%S", GetListEntryText(GetCurrentListEntry(DisplayList)));
+ CONSOLE_SetTextXY(25, 12, CurrentItemText);
+ sprintf(CurrentItemText, "%S", GetListEntryText(GetCurrentListEntry(KeyboardList)));
+ CONSOLE_SetTextXY(25, 13, CurrentItemText);
+ sprintf(CurrentItemText, "%S", GetListEntryText(GetCurrentListEntry(LayoutList)));
+ CONSOLE_SetTextXY(25, 14, CurrentItemText);
CONSOLE_InvertTextXY(24, Line, 48, 1);
return SELECT_PARTITION_PAGE;
}
- StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+ RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu\\",
PartitionList->CurrentDisk->DiskNumber,
PartitionList->CurrentPartition->PartitionNumber);
}
/* Set PartitionRootPath */
- StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+ RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu",
DiskEntry->DiskNumber,
PartEntry->PartitionNumber);
}
/* Set PartitionRootPath */
- StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+ RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu",
DiskEntry->DiskNumber,
PartEntry->PartitionNumber);
/* Create 'USetupData.DestinationRootPath' string */
RtlFreeUnicodeString(&USetupData.DestinationRootPath);
- StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+ RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu\\",
DiskEntry->DiskNumber,
PartEntry->PartitionNumber);
/** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/
/* Create 'USetupData.DestinationArcPath' */
RtlFreeUnicodeString(&USetupData.DestinationArcPath);
- StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+ RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\",
DiskEntry->BiosDiskNumber,
PartEntry->PartitionNumber);
/* Installation path */
DPRINT("InstallationPath: '%S'\n", DirKeyValue);
- StringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
- USetupData.SourceRootDir.Buffer);
+ RtlStringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
+ USetupData.SourceRootDir.Buffer);
DPRINT("InstallationPath(2): '%S'\n", CompleteOrigDirName);
}
/* Absolute path */
DPRINT("AbsolutePath: '%S'\n", DirKeyValue);
- StringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
- DirKeyValue);
+ RtlStringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName),
+ DirKeyValue);
DPRINT("AbsolutePath(2): '%S'\n", CompleteOrigDirName);
}
*/
/* Get destination path */
- StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), USetupData.DestinationPath.Buffer);
+ RtlStringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), USetupData.DestinationPath.Buffer);
DPRINT("FullPath(1): '%S'\n", PathBuffer);
/* Installation path */
DPRINT("InstallationPath: '%S'\n", DirKeyValue);
- StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer),
- USetupData.DestinationPath.Buffer);
+ RtlStringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer),
+ USetupData.DestinationPath.Buffer);
DPRINT("InstallationPath(2): '%S'\n", PathBuffer);
}
/* See the explanation for this test above */
/* Update display registry settings */
- CONSOLE_SetStatusText(MUIGetString(STRING_DISPLAYETTINGSUPDATE));
+ CONSOLE_SetStatusText(MUIGetString(STRING_DISPLAYSETTINGSUPDATE));
if (!ProcessDisplayRegistry(SetupInf, DisplayList))
{
MUIDisplayError(ERROR_UPDATE_DISPLAY_SETTINGS, Ir, POPUP_WAIT_ENTER);
/* Add keyboard layouts */
CONSOLE_SetStatusText(MUIGetString(STRING_ADDKBLAYOUTS));
- if (!AddKeyboardLayouts())
+ if (!AddKeyboardLayouts(SelectedLanguageId))
{
MUIDisplayError(ERROR_ADDING_KBLAYOUTS, Ir, POPUP_WAIT_ENTER);
goto Cleanup;
}
/* Set GeoID */
- if (!SetGeoID(MUIGetGeoID()))
+ if (!SetGeoID(MUIGetGeoID(SelectedLanguageId)))
{
MUIDisplayError(ERROR_UPDATE_GEOID, Ir, POPUP_WAIT_ENTER);
goto Cleanup;
{
/* Update keyboard layout settings */
CONSOLE_SetStatusText(MUIGetString(STRING_KEYBOARDSETTINGSUPDATE));
- if (!ProcessKeyboardLayoutRegistry(LayoutList))
+ if (!ProcessKeyboardLayoutRegistry(LayoutList, SelectedLanguageId))
{
MUIDisplayError(ERROR_UPDATE_KBSETTINGS, Ir, POPUP_WAIT_ENTER);
goto Cleanup;
/* Add codepage information to registry */
CONSOLE_SetStatusText(MUIGetString(STRING_CODEPAGEINFOUPDATE));
- if (!AddCodePage())
+ if (!AddCodePage(SelectedLanguageId))
{
MUIDisplayError(ERROR_ADDING_CODEPAGE, Ir, POPUP_WAIT_ENTER);
goto Cleanup;
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
RtlFreeUnicodeString(&USetupData.SystemRootPath);
- StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+ RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
L"\\Device\\Harddisk%lu\\Partition%lu\\",
PartitionList->SystemPartition->DiskEntry->DiskNumber,
PartitionList->SystemPartition->PartitionNumber);
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
- if (DoesDirExist(NULL, L"\\Device\\Floppy0\\") == FALSE)
- {
- MUIDisplayError(ERROR_NO_FLOPPY, Ir, POPUP_WAIT_ENTER);
- return BOOT_LOADER_FLOPPY_PAGE;
- }
-
- Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath, &USetupData.DestinationArcPath);
+ Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath,
+ &USetupData.DestinationArcPath);
if (!NT_SUCCESS(Status))
{
- /* Print error message */
+ if (Status == STATUS_DEVICE_NOT_READY)
+ MUIDisplayError(ERROR_NO_FLOPPY, Ir, POPUP_WAIT_ENTER);
+
+ /* TODO: Print error message */
return BOOT_LOADER_FLOPPY_PAGE;
}
{
NTSTATUS Status;
WCHAR DestinationDevicePathBuffer[MAX_PATH];
- WCHAR SourceMbrPathBuffer[MAX_PATH];
- WCHAR DstPath[MAX_PATH];
/* Step 1: Write the VBR */
Status = InstallVBRToPartition(&USetupData.SystemRootPath,
}
/* Step 2: Write the MBR */
- StringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
+ RtlStringCchPrintfW(DestinationDevicePathBuffer, ARRAYSIZE(DestinationDevicePathBuffer),
L"\\Device\\Harddisk%d\\Partition0",
PartitionList->SystemPartition->DiskEntry->DiskNumber);
-
- CombinePaths(SourceMbrPathBuffer, ARRAYSIZE(SourceMbrPathBuffer), 2, USetupData.SourceRootPath.Buffer, L"\\loader\\dosmbr.bin");
-
- if (IsThereAValidBootSector(DestinationDevicePathBuffer))
- {
- /* Save current MBR */
- CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, USetupData.SystemRootPath.Buffer, L"mbr.old");
-
- DPRINT1("Save MBR: %S ==> %S\n", DestinationDevicePathBuffer, DstPath);
- Status = SaveBootSector(DestinationDevicePathBuffer, DstPath, sizeof(PARTITION_SECTOR));
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("SaveBootSector() failed (Status %lx)\n", Status);
- // Don't care if we succeeded or not saving the old MBR, just go ahead.
- }
- }
-
- DPRINT1("Install MBR bootcode: %S ==> %S\n",
- SourceMbrPathBuffer, DestinationDevicePathBuffer);
- Status = InstallMbrBootCodeToDisk(SourceMbrPathBuffer,
+ Status = InstallMbrBootCodeToDisk(&USetupData.SystemRootPath,
+ &USetupData.SourceRootPath,
DestinationDevicePathBuffer);
if (!NT_SUCCESS(Status))
{
- DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n",
- Status);
+ DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n", Status);
MUIDisplayError(ERROR_INSTALL_BOOTCODE, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
}