* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* COPYRIGHT: See COPYING in the top level directory
static PGENERIC_LIST LayoutList = NULL;
static PGENERIC_LIST LanguageList = NULL;
+static LANGID LanguageId = 0;
+
/* FUNCTIONS ****************************************************************/
static VOID
UnattendInf = SetupOpenInfFileW(UnattendInfPath,
NULL,
INF_STYLE_WIN4,
+ LanguageId,
&ErrorLine);
if (UnattendInf == INVALID_HANDLE_VALUE)
if (LayoutList == NULL)
{
LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
+ if (LayoutList == NULL)
+ {
+ /* FIXME: Handle error! */
+ return;
+ }
}
ListEntry = GetFirstListEntry(LayoutList);
{
SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
+ LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF);
+
if (wcscmp(SelectedLanguageId, DefaultLanguage))
{
UpdateKBLayout();
SetupInf = SetupOpenInfFileW(FileNameBuffer,
NULL,
INF_STYLE_WIN4,
+ LanguageId,
&ErrorLine);
if (SetupInf == INVALID_HANDLE_VALUE)
ListEntry = GetNextListEntry(ListEntry);
}
- SetConsoleCodePage();
+ SetConsoleCodePage();
- return INSTALL_INTRO_PAGE;
+ return INSTALL_INTRO_PAGE;
}
return LANGUAGE_PAGE;
else
{
/* Round-up by cylinder size */
- PartSize = ROUND_UP (PartSize * 1024 * 1024,
- DiskEntry->CylinderSize);
+ PartSize = (PartSize * 1024 * 1024 + DiskEntry->CylinderSize - 1) /
+ DiskEntry->CylinderSize * DiskEntry->CylinderSize;
/* But never get larger than the unpartitioned disk space */
if (PartSize > PartEntry->UnpartitionedLength)
ULONGLONG PartSize;
PCHAR Unit;
PCHAR PartType;
+ UCHAR PartNumber;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
DiskEntry = PartitionList->CurrentDisk;
PartEntry = PartitionList->CurrentPartition;
+ PartNumber = PartitionList->CurrentPartitionNumber;
MUIDisplayPage(DELETE_PARTITION_PAGE);
}
else if (PartEntry->Unpartitioned == FALSE)
{
- if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_12) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_16) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_HUGE) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_XINT13))
+ if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_12) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_16) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_HUGE) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_XINT13))
{
PartType = "FAT";
}
- else if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
+ else if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32_XINT13))
{
PartType = "FAT32";
}
- else if (PartEntry->PartInfo[0].PartitionType == PARTITION_EXT2)
+ else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_EXT2)
{
PartType = "EXT2";
}
- else if (PartEntry->PartInfo[0].PartitionType == PARTITION_IFS)
+ else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_IFS)
{
PartType = "NTFS"; /* FIXME: Not quite correct! */
}
}
#if 0
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
+ if (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
{
- PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;
+ PartSize = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 29)) >> 30;
Unit = MUIGetString(STRING_GB);
}
else
#endif
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */
+ if (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */
{
- PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20;
+ PartSize = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 19)) >> 20;
Unit = MUIGetString(STRING_MB);
}
else
{
- PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 9)) >> 10;
+ PartSize = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 9)) >> 10;
Unit = MUIGetString(STRING_KB);
}
{
CONSOLE_PrintTextXY(6, 10,
MUIGetString(STRING_HDDINFOUNK2),
- (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
- (PartEntry->DriveLetter == 0) ? '-' : ':',
- PartEntry->PartInfo[0].PartitionType,
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber],
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':',
+ PartEntry->PartInfo[PartNumber].PartitionType,
PartSize,
Unit);
}
{
CONSOLE_PrintTextXY(6, 10,
" %c%c %s %I64u %s",
- (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
- (PartEntry->DriveLetter == 0) ? '-' : ':',
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber],
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':',
PartType,
PartSize,
Unit);
{
PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
+ UCHAR PartNumber;
ULONGLONG DiskSize;
ULONGLONG PartSize;
PCHAR DiskUnit;
DiskEntry = PartitionList->CurrentDisk;
PartEntry = PartitionList->CurrentPartition;
+ PartNumber = PartitionList->CurrentPartitionNumber;
/* adjust disk size */
if (DiskEntry->DiskSize >= 0x280000000ULL) /* 10 GB */
}
/* adjust partition size */
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
+ if (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
{
- PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;
+ PartSize = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 29)) >> 30;
PartUnit = MUIGetString(STRING_GB);
}
else
{
- PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20;
+ PartSize = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 19)) >> 20;
PartUnit = MUIGetString(STRING_MB);
}
/* adjust partition type */
- if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_12) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_16) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_HUGE) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_XINT13))
+ if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_12) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_16) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_HUGE) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_XINT13))
{
PartType = "FAT";
}
- else if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
+ else if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32) ||
+ (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32_XINT13))
{
PartType = "FAT32";
}
- else if (PartEntry->PartInfo[0].PartitionType == PARTITION_EXT2)
+ else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_EXT2)
{
PartType = "EXT2";
}
- else if (PartEntry->PartInfo[0].PartitionType == PARTITION_IFS)
+ else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_IFS)
{
PartType = "NTFS"; /* FIXME: Not quite correct! */
}
- else if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
+ else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_ENTRY_UNUSED)
{
PartType = MUIGetString(STRING_FORMATUNUSED);
}
#if 0
CONSOLE_PrintTextXY(8, 10, "Partition %lu (%I64u %s) %s of",
- PartEntry->PartInfo[0].PartitionNumber,
+ PartEntry->PartInfo[PartNumber].PartitionNumber,
PartSize,
PartUnit,
PartType);
{
CONSOLE_PrintTextXY(8, 10,
MUIGetString(STRING_HDDINFOUNK4),
- (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
- (PartEntry->DriveLetter == 0) ? '-' : ':',
- PartEntry->PartInfo[0].PartitionType,
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber],
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':',
+ PartEntry->PartInfo[PartNumber].PartitionType,
PartSize,
PartUnit);
}
{
CONSOLE_PrintTextXY(8, 10,
"%c%c %s %I64u %s",
- (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
- (PartEntry->DriveLetter == 0) ? '-' : ':',
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber],
+ (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':',
PartType,
PartSize,
PartUnit);
WCHAR PathBuffer[MAX_PATH];
PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
+ UCHAR PartNum;
NTSTATUS Status;
#ifndef NDEBUG
DiskEntry = PartitionList->CurrentDisk;
PartEntry = PartitionList->CurrentPartition;
+ PartNum = PartitionList->CurrentPartitionNumber;
while(TRUE)
{
{
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
- if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
+ if (PartEntry->PartInfo[PartNum].PartitionType == PARTITION_ENTRY_UNUSED)
{
if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0)
{
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200LL * 1024LL))
+ if (PartEntry->PartInfo[PartNum].PartitionLength.QuadPart < (4200LL * 1024LL))
{
/* FAT12 CHS partition (disk is smaller than 4.1MB) */
- PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_12;
+ PartEntry->PartInfo[PartNum].PartitionType = PARTITION_FAT_12;
}
- else if (PartEntry->PartInfo[0].StartingOffset.QuadPart < (1024LL * 255LL * 63LL * 512LL))
+ else if (PartEntry->PartInfo[PartNum].StartingOffset.QuadPart < (1024LL * 255LL * 63LL * 512LL))
{
/* Partition starts below the 8.4GB boundary ==> CHS partition */
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32LL * 1024LL * 1024LL))
+ if (PartEntry->PartInfo[PartNum].PartitionLength.QuadPart < (32LL * 1024LL * 1024LL))
{
/* FAT16 CHS partition (partiton size < 32MB) */
- PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
+ PartEntry->PartInfo[PartNum].PartitionType = PARTITION_FAT_16;
}
- else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
+ else if (PartEntry->PartInfo[PartNum].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
{
/* FAT16 CHS partition (partition size < 512MB) */
- PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
+ PartEntry->PartInfo[PartNum].PartitionType = PARTITION_HUGE;
}
else
{
/* FAT32 CHS partition (partition size >= 512MB) */
- PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32;
+ PartEntry->PartInfo[PartNum].PartitionType = PARTITION_FAT32;
}
}
else
{
/* Partition starts above the 8.4GB boundary ==> LBA partition */
- if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
+ if (PartEntry->PartInfo[PartNum].PartitionLength.QuadPart < (512LL * 1024LL * 1024LL))
{
/* FAT16 LBA partition (partition size < 512MB) */
- PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
+ PartEntry->PartInfo[PartNum].PartitionType = PARTITION_XINT13;
}
else
{
/* FAT32 LBA partition (partition size >= 512MB) */
- PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13;
+ PartEntry->PartInfo[PartNum].PartitionType = PARTITION_FAT32_XINT13;
}
}
}
else if (wcscmp(FileSystemList->Selected->FileSystem, L"EXT2") == 0)
- PartEntry->PartInfo[0].PartitionType = PARTITION_EXT2;
+ PartEntry->PartInfo[PartNum].PartitionType = PARTITION_EXT2;
else if (!FileSystemList->Selected->FormatFunc)
return QUIT_PAGE;
}
swprintf (PathBuffer,
L"\\Device\\Harddisk%lu\\Partition%lu",
PartitionList->CurrentDisk->DiskNumber,
- PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
+ PartitionList->CurrentPartition->PartInfo[PartNum].PartitionNumber);
RtlCreateUnicodeString (&DestinationRootPath,
PathBuffer);
DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath);
swprintf (PathBuffer,
L"\\Device\\Harddisk%lu\\Partition%lu",
PartitionList->ActiveBootDisk->DiskNumber,
- PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber);
+ PartitionList->ActiveBootPartition->
+ PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionNumber);
RtlCreateUnicodeString (&SystemRootPath,
PathBuffer);
DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath);
CheckActiveBootPartition(PartitionList);
}
+ /* Install MBR if necessary */
+ if (DiskEntry->NoMbr &&
+ DiskEntry->BiosDiskNumber == 0)
+ {
+ wcscpy(PathBuffer, SourceRootPath.Buffer);
+ wcscat(PathBuffer, L"\\loader\\dosmbr.bin");
+
+ DPRINT("Install MBR bootcode: %S ==> %S\n",
+ PathBuffer, DestinationRootPath.Buffer);
+
+ /* Install MBR bootcode */
+ Status = InstallMbrBootCodeToDisk(PathBuffer, DestinationRootPath.Buffer);
+ if (!NT_SUCCESS (Status))
+ {
+ DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n",
+ Status);
+ return FALSE;
+ }
+
+ DiskEntry->NoMbr = FALSE;
+ }
+
if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0)
{
/* FIXME: Install boot code. This is a hack! */
- if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13) ||
- (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32))
+ if ((PartEntry->PartInfo[PartNum].PartitionType == PARTITION_FAT32_XINT13) ||
+ (PartEntry->PartInfo[PartNum].PartitionType == PARTITION_FAT32))
{
wcscpy(PathBuffer, SourceRootPath.Buffer);
wcscat(PathBuffer, L"\\loader\\fat32.bin");
WCHAR PathBuffer[MAX_PATH];
CHAR Buffer[MAX_PATH];
NTSTATUS Status;
+ UCHAR PartNum = PartitionList->CurrentPartitionNumber;
/* FIXME: code duplicated in FormatPartitionPage */
/* Set DestinationRootPath */
swprintf(PathBuffer,
L"\\Device\\Harddisk%lu\\Partition%lu",
PartitionList->CurrentDisk->DiskNumber,
- PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
+ PartitionList->CurrentPartition->PartInfo[PartNum].PartitionNumber);
RtlCreateUnicodeString(&DestinationRootPath, PathBuffer);
DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath);
swprintf(PathBuffer,
L"\\Device\\Harddisk%lu\\Partition%lu",
PartitionList->ActiveBootDisk->DiskNumber,
- PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber);
+ PartitionList->ActiveBootPartition->PartInfo[PartNum].PartitionNumber);
RtlCreateUnicodeString(&SystemRootPath, PathBuffer);
DPRINT("SystemRootPath: %wZ\n", &SystemRootPath);
static PAGE_NUMBER
-InstallDirectoryPage1(PWCHAR InstallDir, PDISKENTRY DiskEntry, PPARTENTRY PartEntry)
+InstallDirectoryPage1(PWCHAR InstallDir, PDISKENTRY DiskEntry, PPARTENTRY PartEntry, UCHAR PartNum)
{
WCHAR PathBuffer[MAX_PATH];
swprintf(PathBuffer,
L"multi(0)disk(0)rdisk(%lu)partition(%lu)",
DiskEntry->BiosDiskNumber,
- PartEntry->PartInfo[0].PartitionNumber);
+ PartEntry->PartInfo[PartNum].PartitionNumber);
if (InstallDir[0] != L'\\')
wcscat(PathBuffer, L"\\");
if (IsUnattendedSetup)
{
- return(InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry));
+ return(InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry, PartitionList->CurrentPartitionNumber));
}
while(TRUE)
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
- return (InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry));
+ return (InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry, PartitionList->CurrentPartitionNumber));
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
{
InfFileSize,
(const CHAR*) NULL,
INF_STYLE_WIN4,
+ LanguageId,
&ErrorLine);
if (InfHandle == INVALID_HANDLE_VALUE)
FileCopyPage(PINPUT_RECORD Ir)
{
COPYCONTEXT CopyContext;
+ unsigned int mem_bar_width;
MUIDisplayPage(FILE_COPY_PAGE);
MUIGetString(STRING_SETUPCOPYINGFILES));
// fit memory bars to screen width, distribute them uniform
- unsigned int mem_bar_width = (xScreen - 26) / 5;
+ mem_bar_width = (xScreen - 26) / 5;
mem_bar_width -= mem_bar_width % 2; // make even
/* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
/* Create the paged pool progress bar */
CONSOLE_SetStatusText(MUIGetString(STRING_IMPORTFILE), File);
- if (!ImportRegistryFile(File, Section, Delete))
+ if (!ImportRegistryFile(File, Section, LanguageId, Delete))
{
DPRINT("Importing %S failed\n", File);
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
- PartitionType = PartitionList->ActiveBootPartition->PartInfo[0].PartitionType;
+ PartitionType = PartitionList->ActiveBootPartition->
+ PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionType;
+
+ if (IsUnattendedSetup)
+ {
+ if (UnattendMBRInstallType == 0) /* skip MBR installation */
+ {
+ return SUCCESS_PAGE;
+ }
+ else if (UnattendMBRInstallType == 1) /* install on floppy */
+ {
+ return BOOT_LOADER_FLOPPY_PAGE;
+ }
+ }
if (PartitionType == PARTITION_ENTRY_UNUSED)
{
return BOOT_LOADER_FLOPPY_PAGE;
}
- if (IsUnattendedSetup)
+ /* Unattended install on hdd? */
+ if (IsUnattendedSetup && UnattendMBRInstallType == 2)
{
- if (UnattendMBRInstallType == 0) /* skip MBR installation */
- {
- return SUCCESS_PAGE;
- }
- else if (UnattendMBRInstallType == 1) /* install on floppy */
- {
- return BOOT_LOADER_FLOPPY_PAGE;
- }
- else if (UnattendMBRInstallType == 2) /* install on hdd */
- {
- return BOOT_LOADER_HARDDISK_PAGE;
- }
+ return BOOT_LOADER_HARDDISK_PAGE;
}
MUIDisplayPage(BOOT_LOADER_PAGE);
UCHAR PartitionType;
NTSTATUS Status;
- PartitionType = PartitionList->ActiveBootPartition->PartInfo[0].PartitionType;
+ PartitionType = PartitionList->ActiveBootPartition->
+ PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionType;
if ((PartitionType == PARTITION_FAT_12) ||
(PartitionType == PARTITION_FAT_16) ||
(PartitionType == PARTITION_HUGE) ||