From 91b72f72dc433bce98f4ea6e6cc0d157426cda27 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 11 Jun 2010 21:21:27 +0000 Subject: [PATCH] [FORMATTING] Fix indentation. No code changes. svn path=/trunk/; revision=47758 --- reactos/base/setup/usetup/interface/usetup.c | 927 ++++++++++--------- 1 file changed, 483 insertions(+), 444 deletions(-) diff --git a/reactos/base/setup/usetup/interface/usetup.c b/reactos/base/setup/usetup/interface/usetup.c index a845d5df52b..da9d60a7d41 100644 --- a/reactos/base/setup/usetup/interface/usetup.c +++ b/reactos/base/setup/usetup/interface/usetup.c @@ -106,11 +106,10 @@ PrintString(char* fmt,...) static VOID -DrawBox( - IN SHORT xLeft, - IN SHORT yTop, - IN SHORT Width, - IN SHORT Height) +DrawBox(IN SHORT xLeft, + IN SHORT yTop, + IN SHORT Width, + IN SHORT Height) { COORD coPos; DWORD Written; @@ -118,97 +117,89 @@ DrawBox( /* draw upper left corner */ coPos.X = xLeft; coPos.Y = yTop; - FillConsoleOutputCharacterA( - StdOutput, - 0xDA, // '+', - 1, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xDA, // '+', + 1, + coPos, + &Written); /* draw upper edge */ coPos.X = xLeft + 1; coPos.Y = yTop; - FillConsoleOutputCharacterA( - StdOutput, - 0xC4, // '-', - Width - 2, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', + Width - 2, + coPos, + &Written); /* draw upper right corner */ coPos.X = xLeft + Width - 1; coPos.Y = yTop; - FillConsoleOutputCharacterA( - StdOutput, - 0xBF, // '+', - 1, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xBF, // '+', + 1, + coPos, + &Written); /* Draw right edge, inner space and left edge */ for (coPos.Y = yTop + 1; coPos.Y < yTop + Height - 1; coPos.Y++) { coPos.X = xLeft; - FillConsoleOutputCharacterA( - StdOutput, - 0xB3, // '|', - 1, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xB3, // '|', + 1, + coPos, + &Written); coPos.X = xLeft + 1; - FillConsoleOutputCharacterA( - StdOutput, - ' ', - Width - 2, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + ' ', + Width - 2, + coPos, + &Written); coPos.X = xLeft + Width - 1; - FillConsoleOutputCharacterA( - StdOutput, - 0xB3, // '|', - 1, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xB3, // '|', + 1, + coPos, + &Written); } /* draw lower left corner */ coPos.X = xLeft; coPos.Y = yTop + Height - 1; - FillConsoleOutputCharacterA( - StdOutput, - 0xC0, // '+', - 1, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xC0, // '+', + 1, + coPos, + &Written); /* draw lower edge */ coPos.X = xLeft + 1; coPos.Y = yTop + Height - 1; - FillConsoleOutputCharacterA( - StdOutput, - 0xC4, // '-', - Width - 2, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xC4, // '-', + Width - 2, + coPos, + &Written); /* draw lower right corner */ coPos.X = xLeft + Width - 1; coPos.Y = yTop + Height - 1; - FillConsoleOutputCharacterA( - StdOutput, - 0xD9, // '+', - 1, - coPos, - &Written); + FillConsoleOutputCharacterA(StdOutput, + 0xD9, // '+', + 1, + coPos, + &Written); } + VOID PopupError(PCCH Text, - PCCH Status, - PINPUT_RECORD Ir, - ULONG WaitEvent) + PCCH Status, + PINPUT_RECORD Ir, + ULONG WaitEvent) { SHORT yTop; SHORT xLeft; @@ -383,7 +374,7 @@ ConfirmQuit(PINPUT_RECORD Ir) BOOL Result = FALSE; MUIDisplayError(ERROR_NOT_INSTALLED, NULL, POPUP_WAIT_NONE); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -562,19 +553,22 @@ CheckUnattendedSetup(VOID) } } - /* search for LocaleID in the 'Unattend' section*/ - if (SetupFindFirstLineW (UnattendInf, L"Unattend", L"LocaleID", &Context)){ - if (INF_GetData (&Context, NULL, &Value)){ - LONG Id = wcstol(Value, NULL, 16); - swprintf(LocaleID,L"%08lx", Id); - } + /* search for LocaleID in the 'Unattend' section*/ + if (SetupFindFirstLineW (UnattendInf, L"Unattend", L"LocaleID", &Context)) + { + if (INF_GetData (&Context, NULL, &Value)) + { + LONG Id = wcstol(Value, NULL, 16); + swprintf(LocaleID,L"%08lx", Id); + } } - SetupCloseInfFile(UnattendInf); - + SetupCloseInfFile(UnattendInf); + DPRINT("Running unattended setup\n"); } + VOID UpdateKBLayout(VOID) { @@ -611,6 +605,7 @@ UpdateKBLayout(VOID) } } + static PAGE_NUMBER LanguagePage(PINPUT_RECORD Ir) { @@ -636,7 +631,7 @@ LanguagePage(PINPUT_RECORD Ir) MUIDisplayPage(LANGUAGE_PAGE); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -662,17 +657,17 @@ LanguagePage(PINPUT_RECORD Ir) MUIDisplayPage(LANGUAGE_PAGE); #endif - ScrollUpGenericList (LanguageList); + ScrollUpGenericList(LanguageList); } if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */ { - ScrollPageDownGenericList (LanguageList); + ScrollPageDownGenericList(LanguageList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */ { - ScrollPageUpGenericList (LanguageList); + ScrollPageUpGenericList(LanguageList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -729,12 +724,12 @@ SetupStartPage(PINPUT_RECORD Ir) /* Check whether a harddisk is available */ - Status = NtQuerySystemInformation (SystemDeviceInformation, - &Sdi, - sizeof(SYSTEM_DEVICE_INFORMATION), - &ReturnSize); + Status = NtQuerySystemInformation(SystemDeviceInformation, + &Sdi, + sizeof(SYSTEM_DEVICE_INFORMATION), + &ReturnSize); - if (!NT_SUCCESS (Status)) + if (!NT_SUCCESS(Status)) { CONSOLE_PrintTextXY(6, 15, "NtQuerySystemInformation() failed (Status 0x%08lx)", Status); MUIDisplayError(ERROR_DRIVE_INFORMATION, Ir, POPUP_WAIT_ENTER); @@ -784,14 +779,14 @@ SetupStartPage(PINPUT_RECORD Ir) } /* Open 'Version' section */ - if (!SetupFindFirstLineW (SetupInf, L"Version", L"Signature", &Context)) + if (!SetupFindFirstLineW(SetupInf, L"Version", L"Signature", &Context)) { MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } /* Get pointer 'Signature' key */ - if (!INF_GetData (&Context, NULL, &Value)) + if (!INF_GetData(&Context, NULL, &Value)) { MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; @@ -838,43 +833,43 @@ SetupStartPage(PINPUT_RECORD Ir) KeyboardList = CreateKeyboardDriverList(SetupInf); LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout); LanguageList = CreateLanguageList(SetupInf, DefaultLanguage); - - /* new part */ - - wcscpy(SelectedLanguageId,LocaleID); - - - /* first we hack LanguageList */ - ListEntry = GetFirstListEntry(LanguageList); - while (ListEntry != NULL) - { - if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) - { - DPRINT("found %S in LanguageList\n",GetListEntryUserData(ListEntry)); - SetCurrentListEntry(LanguageList, ListEntry); - break; - } + /* new part */ + wcscpy(SelectedLanguageId,LocaleID); - ListEntry = GetNextListEntry(ListEntry); - } - /* now LayoutList */ - ListEntry = GetFirstListEntry(LayoutList); + /* first we hack LanguageList */ + ListEntry = GetFirstListEntry(LanguageList); - while (ListEntry != NULL) - { - if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) - { - DPRINT("found %S in LayoutList\n",GetListEntryUserData(ListEntry)); - SetCurrentListEntry(LayoutList, ListEntry); - break; - } + while (ListEntry != NULL) + { + if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) + { + DPRINT("found %S in LanguageList\n",GetListEntryUserData(ListEntry)); + SetCurrentListEntry(LanguageList, ListEntry); + break; + } - ListEntry = GetNextListEntry(ListEntry); - } - SetConsoleCodePage(); + ListEntry = GetNextListEntry(ListEntry); + } - return INSTALL_INTRO_PAGE; + /* now LayoutList */ + ListEntry = GetFirstListEntry(LayoutList); + + while (ListEntry != NULL) + { + if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) + { + DPRINT("found %S in LayoutList\n",GetListEntryUserData(ListEntry)); + SetCurrentListEntry(LayoutList, ListEntry); + break; + } + + ListEntry = GetNextListEntry(ListEntry); + } + + SetConsoleCodePage(); + + return INSTALL_INTRO_PAGE; } return LANGUAGE_PAGE; @@ -923,6 +918,7 @@ IntroPage(PINPUT_RECORD Ir) return INTRO_PAGE; } + /* * License Page * RETURNS @@ -947,6 +943,7 @@ LicensePage(PINPUT_RECORD Ir) return LICENSE_PAGE; } + static PAGE_NUMBER RepairIntroPage(PINPUT_RECORD Ir) { @@ -996,7 +993,7 @@ InstallIntroPage(PINPUT_RECORD Ir) return SELECT_PARTITION_PAGE; } - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -1033,7 +1030,7 @@ ScsiControllerPage(PINPUT_RECORD Ir) SetStatusText(" ENTER = Continue F3 = Quit"); - while(TRUE) + while (TRUE) { ConInKey(Ir); @@ -1122,7 +1119,7 @@ DeviceSettingsPage(PINPUT_RECORD Ir) return SELECT_PARTITION_PAGE; } - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -1194,19 +1191,19 @@ ComputerSettingsPage(PINPUT_RECORD Ir) SaveGenericListState(ComputerList); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownGenericList (ComputerList); + ScrollDownGenericList(ComputerList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpGenericList (ComputerList); + ScrollUpGenericList(ComputerList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1245,19 +1242,19 @@ DisplaySettingsPage(PINPUT_RECORD Ir) SaveGenericListState(DisplayList); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownGenericList (DisplayList); + ScrollDownGenericList(DisplayList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpGenericList (DisplayList); + ScrollUpGenericList(DisplayList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1298,19 +1295,19 @@ KeyboardSettingsPage(PINPUT_RECORD Ir) SaveGenericListState(KeyboardList); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownGenericList (KeyboardList); + ScrollDownGenericList(KeyboardList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpGenericList (KeyboardList); + ScrollUpGenericList(KeyboardList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1349,29 +1346,29 @@ LayoutSettingsPage(PINPUT_RECORD Ir) SaveGenericListState(LayoutList); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownGenericList (LayoutList); + ScrollDownGenericList(LayoutList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpGenericList (LayoutList); + ScrollUpGenericList(LayoutList); } if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */ { - ScrollPageDownGenericList (LayoutList); + ScrollPageDownGenericList(LayoutList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */ { - ScrollPageUpGenericList (LayoutList); + ScrollPageUpGenericList(LayoutList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ @@ -1394,16 +1391,19 @@ LayoutSettingsPage(PINPUT_RECORD Ir) else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) { /* a-z */ - GenericListKeyPress (LayoutList , Ir->Event.KeyEvent.uChar.AsciiChar); + GenericListKeyPress(LayoutList , Ir->Event.KeyEvent.uChar.AsciiChar); } } return DISPLAY_SETTINGS_PAGE; } -static BOOL IsDiskSizeValid(PPARTENTRY PartEntry) + +static BOOL +IsDiskSizeValid(PPARTENTRY PartEntry) { ULONGLONG m; + /* check for unpartitioned space */ m = PartEntry->UnpartitionedLength; m = (m + (1 << 19)) >> 20; /* in MBytes (rounded) */ @@ -1411,11 +1411,11 @@ static BOOL IsDiskSizeValid(PPARTENTRY PartEntry) { return TRUE; } - - // check for partitioned space + + /* check for partitioned space */ m = PartEntry->PartInfo[0].PartitionLength.QuadPart; m = (m + (1 << 19)) >> 20; /* in MBytes (rounded) */ - if( m < RequiredPartitionDiskSpace) + if (m < RequiredPartitionDiskSpace) { /* partition is too small so ask for another partion */ DPRINT1("Partition is too small, required disk space is %lu MB\n", RequiredPartitionDiskSpace); @@ -1427,6 +1427,7 @@ static BOOL IsDiskSizeValid(PPARTENTRY PartEntry) } } + static PAGE_NUMBER SelectPartitionPage(PINPUT_RECORD Ir) { @@ -1434,11 +1435,10 @@ SelectPartitionPage(PINPUT_RECORD Ir) if (PartitionList == NULL) { - PartitionList = CreatePartitionList (2, - 19, - xScreen - 3, - yScreen - 3); - + PartitionList = CreatePartitionList(2, + 19, + xScreen - 3, + yScreen - 3); if (PartitionList == NULL) { /* FIXME: show an error dialog */ @@ -1446,9 +1446,9 @@ SelectPartitionPage(PINPUT_RECORD Ir) } } - CheckActiveBootPartition (PartitionList); + CheckActiveBootPartition(PartitionList); - DrawPartitionList (PartitionList); + DrawPartitionList(PartitionList); /* Warn about partitions created by Linux Fdisk */ if (WarnLinuxPartitions == TRUE && @@ -1486,11 +1486,12 @@ SelectPartitionPage(PINPUT_RECORD Ir) MUIDisplayError(ERROR_INSUFFICIENT_DISKSPACE, Ir, POPUP_WAIT_ANY_KEY); return SELECT_PARTITION_PAGE; /* let the user select another partition */ } + CreateNewPartition(PartitionList, MaxSize, TRUE); - return (SELECT_FILE_SYSTEM_PAGE); + return SELECT_FILE_SYSTEM_PAGE; } } else @@ -1500,11 +1501,12 @@ SelectPartitionPage(PINPUT_RECORD Ir) MUIDisplayError(ERROR_INSUFFICIENT_DISKSPACE, Ir, POPUP_WAIT_ANY_KEY); return SELECT_PARTITION_PAGE; /* let the user select another partition */ } - return(SELECT_FILE_SYSTEM_PAGE); + + return SELECT_FILE_SYSTEM_PAGE; } } - while(TRUE) + while (TRUE) { /* Update status text */ if (PartitionList->CurrentPartition == NULL || @@ -1524,7 +1526,7 @@ SelectPartitionPage(PINPUT_RECORD Ir) { if (ConfirmQuit(Ir) == TRUE) { - DestroyPartitionList (PartitionList); + DestroyPartitionList(PartitionList); PartitionList = NULL; return QUIT_PAGE; } @@ -1534,12 +1536,12 @@ SelectPartitionPage(PINPUT_RECORD Ir) else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownPartitionList (PartitionList); + ScrollDownPartitionList(PartitionList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpPartitionList (PartitionList); + ScrollUpPartitionList(PartitionList); } else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */ { @@ -1551,9 +1553,9 @@ SelectPartitionPage(PINPUT_RECORD Ir) if (PartitionList->CurrentPartition == NULL || PartitionList->CurrentPartition->Unpartitioned == TRUE) { - CreateNewPartition (PartitionList, - 0ULL, - TRUE); + CreateNewPartition(PartitionList, + 0ULL, + TRUE); } return SELECT_FILE_SYSTEM_PAGE; @@ -1586,9 +1588,9 @@ SelectPartitionPage(PINPUT_RECORD Ir) static VOID DrawInputField(ULONG FieldLength, - SHORT Left, - SHORT Top, - PCHAR FieldContent) + SHORT Left, + SHORT Top, + PCHAR FieldContent) { CHAR buf[100]; COORD coPos; @@ -1600,11 +1602,11 @@ DrawInputField(ULONG FieldLength, buf[FieldLength - strlen(FieldContent)] = 0; strcat(buf, FieldContent); - WriteConsoleOutputCharacterA (StdOutput, - buf, - strlen (buf), - coPos, - &Written); + WriteConsoleOutputCharacterA(StdOutput, + buf, + strlen(buf), + coPos, + &Written); } @@ -1614,13 +1616,13 @@ DrawInputField(ULONG FieldLength, static VOID ShowPartitionSizeInputBox(SHORT Left, - SHORT Top, - SHORT Right, - SHORT Bottom, - ULONG MaxSize, - PCHAR InputBuffer, - PBOOLEAN Quit, - PBOOLEAN Cancel) + SHORT Top, + SHORT Right, + SHORT Bottom, + ULONG MaxSize, + PCHAR InputBuffer, + PBOOLEAN Quit, + PBOOLEAN Cancel) { INPUT_RECORD Ir; COORD coPos; @@ -1642,8 +1644,8 @@ ShowPartitionSizeInputBox(SHORT Left, /* Print message */ coPos.X = Left + 2; coPos.Y = Top + 2; - strcpy (Buffer, MUIGetString(STRING_PARTITIONSIZE)); - iLeft = coPos.X + strlen (Buffer) + 1; + strcpy(Buffer, MUIGetString(STRING_PARTITIONSIZE)); + iLeft = coPos.X + strlen(Buffer) + 1; iTop = coPos.Y; WriteConsoleOutputCharacterA(StdOutput, @@ -1652,7 +1654,7 @@ ShowPartitionSizeInputBox(SHORT Left, coPos, &Written); - sprintf (Buffer, MUIGetString(STRING_MAXSIZE), MaxSize); + sprintf(Buffer, MUIGetString(STRING_MAXSIZE), MaxSize); coPos.X = iLeft + PARTITION_SIZE_INPUT_FIELD_LENGTH + 1; coPos.Y = iTop; WriteConsoleOutputCharacterA(StdOutput, @@ -1663,10 +1665,10 @@ ShowPartitionSizeInputBox(SHORT Left, sprintf(Buffer, "%lu", MaxSize); Index = strlen(Buffer); - DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH, - iLeft, - iTop, - Buffer); + DrawInputField(PARTITION_SIZE_INPUT_FIELD_LENGTH, + iLeft, + iTop, + Buffer); while (TRUE) { @@ -1699,10 +1701,10 @@ ShowPartitionSizeInputBox(SHORT Left, Index--; Buffer[Index] = 0; - DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH, - iLeft, - iTop, - Buffer); + DrawInputField(PARTITION_SIZE_INPUT_FIELD_LENGTH, + iLeft, + iTop, + Buffer); } else if ((Ir.Event.KeyEvent.uChar.AsciiChar != 0x00) && (Index < PARTITION_SIZE_INPUT_FIELD_LENGTH)) @@ -1715,20 +1717,20 @@ ShowPartitionSizeInputBox(SHORT Left, Index++; Buffer[Index] = 0; - DrawInputField (PARTITION_SIZE_INPUT_FIELD_LENGTH, - iLeft, - iTop, - Buffer); + DrawInputField(PARTITION_SIZE_INPUT_FIELD_LENGTH, + iLeft, + iTop, + Buffer); } } } - strcpy (InputBuffer, Buffer); + strcpy(InputBuffer, Buffer); } static PAGE_NUMBER -CreatePartitionPage (PINPUT_RECORD Ir) +CreatePartitionPage(PINPUT_RECORD Ir) { PDISKENTRY DiskEntry; PPARTENTRY PartEntry; @@ -1775,32 +1777,32 @@ CreatePartitionPage (PINPUT_RECORD Ir) if (DiskEntry->DriverName.Length > 0) { CONSOLE_PrintTextXY(6, 10, - MUIGetString(STRING_HDINFOPARTCREATE), - DiskSize, - Unit, - DiskEntry->DiskNumber, - DiskEntry->Port, - DiskEntry->Bus, - DiskEntry->Id, - &DiskEntry->DriverName); + MUIGetString(STRING_HDINFOPARTCREATE), + DiskSize, + Unit, + DiskEntry->DiskNumber, + DiskEntry->Port, + DiskEntry->Bus, + DiskEntry->Id, + &DiskEntry->DriverName); } else { CONSOLE_PrintTextXY(6, 10, - MUIGetString(STRING_HDDINFOUNK1), - DiskSize, - Unit, - DiskEntry->DiskNumber, - DiskEntry->Port, - DiskEntry->Bus, - DiskEntry->Id); + MUIGetString(STRING_HDDINFOUNK1), + DiskSize, + Unit, + DiskEntry->DiskNumber, + DiskEntry->Port, + DiskEntry->Bus, + DiskEntry->Id); } CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE)); #if 0 CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB", - PartitionList->CurrentPartition->UnpartitionedLength / (1024*1024)); + PartitionList->CurrentPartition->UnpartitionedLength / (1024*1024)); #endif CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION)); @@ -1812,8 +1814,8 @@ CreatePartitionPage (PINPUT_RECORD Ir) if (MaxSize > PARTITION_MAXSIZE) MaxSize = PARTITION_MAXSIZE; - ShowPartitionSizeInputBox (12, 14, xScreen - 12, 17, /* left, top, right, bottom */ - MaxSize, InputBuffer, &Quit, &Cancel); + ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */ + MaxSize, InputBuffer, &Quit, &Cancel); if (Quit == TRUE) { @@ -1861,9 +1863,9 @@ CreatePartitionPage (PINPUT_RECORD Ir) DPRINT ("Partition size: %I64u bytes\n", PartSize); - CreateNewPartition (PartitionList, - PartSize, - FALSE); + CreateNewPartition(PartitionList, + PartSize, + FALSE); return SELECT_PARTITION_PAGE; } @@ -1874,7 +1876,7 @@ CreatePartitionPage (PINPUT_RECORD Ir) static PAGE_NUMBER -DeletePartitionPage (PINPUT_RECORD Ir) +DeletePartitionPage(PINPUT_RECORD Ir) { PDISKENTRY DiskEntry; PPARTENTRY PartEntry; @@ -1950,22 +1952,22 @@ DeletePartitionPage (PINPUT_RECORD Ir) if (PartType == NULL) { CONSOLE_PrintTextXY(6, 10, - MUIGetString(STRING_HDDINFOUNK2), - (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber], - (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':', - PartEntry->PartInfo[PartNumber].PartitionType, - PartSize, - Unit); + MUIGetString(STRING_HDDINFOUNK2), + (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber], + (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':', + PartEntry->PartInfo[PartNumber].PartitionType, + PartSize, + Unit); } else { CONSOLE_PrintTextXY(6, 10, - " %c%c %s %I64u %s", - (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber], - (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':', - PartType, - PartSize, - Unit); + " %c%c %s %I64u %s", + (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber], + (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':', + PartType, + PartSize, + Unit); } #if 0 @@ -1988,25 +1990,25 @@ DeletePartitionPage (PINPUT_RECORD Ir) if (DiskEntry->DriverName.Length > 0) { CONSOLE_PrintTextXY(6, 12, - MUIGetString(STRING_HDINFOPARTDELETE), - DiskSize, - Unit, - DiskEntry->DiskNumber, - DiskEntry->Port, - DiskEntry->Bus, - DiskEntry->Id, - &DiskEntry->DriverName); + MUIGetString(STRING_HDINFOPARTDELETE), + DiskSize, + Unit, + DiskEntry->DiskNumber, + DiskEntry->Port, + DiskEntry->Bus, + DiskEntry->Id, + &DiskEntry->DriverName); } else { CONSOLE_PrintTextXY(6, 12, - MUIGetString(STRING_HDDINFOUNK3), - DiskSize, - Unit, - DiskEntry->DiskNumber, - DiskEntry->Port, - DiskEntry->Bus, - DiskEntry->Id); + MUIGetString(STRING_HDDINFOUNK3), + DiskSize, + Unit, + DiskEntry->DiskNumber, + DiskEntry->Port, + DiskEntry->Bus, + DiskEntry->Id); } while (TRUE) @@ -2016,7 +2018,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { - if (ConfirmQuit (Ir) == TRUE) + if (ConfirmQuit(Ir) == TRUE) { return QUIT_PAGE; } @@ -2029,7 +2031,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) } else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */ { - DeleteCurrentPartition (PartitionList); + DeleteCurrentPartition(PartitionList); return SELECT_PARTITION_PAGE; } @@ -2040,7 +2042,7 @@ DeletePartitionPage (PINPUT_RECORD Ir) static PAGE_NUMBER -SelectFileSystemPage (PINPUT_RECORD Ir) +SelectFileSystemPage(PINPUT_RECORD Ir) { PDISKENTRY DiskEntry; PPARTENTRY PartEntry; @@ -2155,17 +2157,17 @@ SelectFileSystemPage (PINPUT_RECORD Ir) if (PartType == NULL) { CONSOLE_PrintTextXY(8, 10, - MUIGetString(STRING_HDDINFOUNK4), - (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber], - (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':', - PartEntry->PartInfo[PartNumber].PartitionType, - PartSize, - PartUnit); + MUIGetString(STRING_HDDINFOUNK4), + (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber], + (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':', + PartEntry->PartInfo[PartNumber].PartitionType, + PartSize, + PartUnit); } else { CONSOLE_PrintTextXY(8, 10, - "%c%c %s %I64u %s", + "%c%c %s %I64u %s", (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : PartEntry->DriveLetter[PartNumber], (PartEntry->DriveLetter[PartNumber] == 0) ? '-' : ':', PartType, @@ -2187,7 +2189,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) if (FileSystemList == NULL) { - FileSystemList = CreateFileSystemList (6, 26, PartEntry->New, L"FAT"); + FileSystemList = CreateFileSystemList(6, 26, PartEntry->New, L"FAT"); if (FileSystemList == NULL) { /* FIXME: show an error dialog */ @@ -2196,7 +2198,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) /* FIXME: Add file systems to list */ } - DrawFileSystemList (FileSystemList); + DrawFileSystemList(FileSystemList); if (RepairUpdateFlag) { @@ -2211,7 +2213,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) return FORMAT_PARTITION_PAGE; } - return(CHECK_FILE_SYSTEM_PAGE); + return CHECK_FILE_SYSTEM_PAGE; } while (TRUE) @@ -2221,7 +2223,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { - if (ConfirmQuit (Ir) == TRUE) + if (ConfirmQuit(Ir) == TRUE) { return QUIT_PAGE; } @@ -2236,12 +2238,12 @@ SelectFileSystemPage (PINPUT_RECORD Ir) else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ { - ScrollDownFileSystemList (FileSystemList); + ScrollDownFileSystemList(FileSystemList); } else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ { - ScrollUpFileSystemList (FileSystemList); + ScrollUpFileSystemList(FileSystemList); } else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */ { @@ -2261,7 +2263,7 @@ SelectFileSystemPage (PINPUT_RECORD Ir) static ULONG -FormatPartitionPage (PINPUT_RECORD Ir) +FormatPartitionPage(PINPUT_RECORD Ir) { WCHAR PathBuffer[MAX_PATH]; PDISKENTRY DiskEntry; @@ -2289,7 +2291,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) PartEntry = PartitionList->CurrentPartition; PartNum = PartitionList->CurrentPartitionNumber; - while(TRUE) + while (TRUE) { if (!IsUnattendedSetup) { @@ -2299,7 +2301,7 @@ FormatPartitionPage (PINPUT_RECORD Ir) if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { - if (ConfirmQuit (Ir) == TRUE) + if (ConfirmQuit(Ir) == TRUE) { return QUIT_PAGE; } @@ -2358,14 +2360,14 @@ FormatPartitionPage (PINPUT_RECORD Ir) else if (!FileSystemList->Selected->FormatFunc) return QUIT_PAGE; - CheckActiveBootPartition (PartitionList); + CheckActiveBootPartition(PartitionList); #ifndef NDEBUG CONSOLE_PrintTextXY(6, 12, - "Disk: %I64u Cylinder: %I64u Track: %I64u", - DiskEntry->DiskSize, - DiskEntry->CylinderSize, - DiskEntry->TrackSize); + "Disk: %I64u Cylinder: %I64u Track: %I64u", + DiskEntry->DiskSize, + DiskEntry->CylinderSize, + DiskEntry->TrackSize); Line = 13; DiskEntry = PartitionList->CurrentDisk; @@ -2380,14 +2382,14 @@ FormatPartitionPage (PINPUT_RECORD Ir) for (i = 0; i < 4; i++) { CONSOLE_PrintTextXY(6, Line, - "%2u: %2u %c %12I64u %12I64u %2u %c", - i, - PartEntry->PartInfo[i].PartitionNumber, - PartEntry->PartInfo[i].BootIndicator ? 'A' : '-', - PartEntry->PartInfo[i].StartingOffset.QuadPart, - PartEntry->PartInfo[i].PartitionLength.QuadPart, - PartEntry->PartInfo[i].PartitionType, - PartEntry->PartInfo[i].RewritePartition ? '*' : ' '); + "%2u: %2u %c %12I64u %12I64u %2u %c", + i, + PartEntry->PartInfo[i].PartitionNumber, + PartEntry->PartInfo[i].BootIndicator ? 'A' : '-', + PartEntry->PartInfo[i].StartingOffset.QuadPart, + PartEntry->PartInfo[i].PartitionLength.QuadPart, + PartEntry->PartInfo[i].PartitionType, + PartEntry->PartInfo[i].RewritePartition ? '*' : ' '); Line++; } @@ -2402,39 +2404,40 @@ FormatPartitionPage (PINPUT_RECORD Ir) PartEntry = PartitionList->CurrentPartition; #endif - if (WritePartitionsToDisk (PartitionList) == FALSE) + if (WritePartitionsToDisk(PartitionList) == FALSE) { - DPRINT ("WritePartitionsToDisk() failed\n"); + DPRINT("WritePartitionsToDisk() failed\n"); MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } /* Set DestinationRootPath */ - RtlFreeUnicodeString (&DestinationRootPath); - swprintf (PathBuffer, - L"\\Device\\Harddisk%lu\\Partition%lu", - PartitionList->CurrentDisk->DiskNumber, - PartitionList->CurrentPartition->PartInfo[PartNum].PartitionNumber); - RtlCreateUnicodeString (&DestinationRootPath, - PathBuffer); - DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath); + RtlFreeUnicodeString(&DestinationRootPath); + swprintf(PathBuffer, + L"\\Device\\Harddisk%lu\\Partition%lu", + PartitionList->CurrentDisk->DiskNumber, + PartitionList->CurrentPartition->PartInfo[PartNum].PartitionNumber); + RtlCreateUnicodeString(&DestinationRootPath, + PathBuffer); + DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath); /* Set SystemRootPath */ - RtlFreeUnicodeString (&SystemRootPath); - swprintf (PathBuffer, - L"\\Device\\Harddisk%lu\\Partition%lu", - PartitionList->ActiveBootDisk->DiskNumber, - PartitionList->ActiveBootPartition-> - PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionNumber); - RtlCreateUnicodeString (&SystemRootPath, - PathBuffer); - DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath); + RtlFreeUnicodeString(&SystemRootPath); + swprintf(PathBuffer, + L"\\Device\\Harddisk%lu\\Partition%lu", + PartitionList->ActiveBootDisk->DiskNumber, + PartitionList->ActiveBootPartition-> + PartInfo[PartitionList->ActiveBootPartitionNumber].PartitionNumber); + RtlCreateUnicodeString(&SystemRootPath, + PathBuffer); + DPRINT("SystemRootPath: %wZ\n", &SystemRootPath); if (FileSystemList->Selected->FormatFunc) { - Status = FormatPartition(&DestinationRootPath, FileSystemList->Selected); + Status = FormatPartition(&DestinationRootPath, + FileSystemList->Selected); if (!NT_SUCCESS(Status)) { DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status); @@ -2455,14 +2458,15 @@ FormatPartitionPage (PINPUT_RECORD Ir) wcscat(PathBuffer, L"\\loader\\dosmbr.bin"); DPRINT("Install MBR bootcode: %S ==> %S\n", - PathBuffer, DestinationRootPath.Buffer); + PathBuffer, DestinationRootPath.Buffer); /* Install MBR bootcode */ - Status = InstallMbrBootCodeToDisk(PathBuffer, DestinationRootPath.Buffer); + Status = InstallMbrBootCodeToDisk(PathBuffer, + DestinationRootPath.Buffer); if (!NT_SUCCESS (Status)) { DPRINT1("InstallMbrBootCodeToDisk() failed (Status %lx)\n", - Status); + Status); return FALSE; } @@ -2479,10 +2483,10 @@ FormatPartitionPage (PINPUT_RECORD Ir) wcscat(PathBuffer, L"\\loader\\fat32.bin"); DPRINT("Install FAT32 bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - Status = InstallFat32BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); + DestinationRootPath.Buffer); + Status = InstallFat32BootCodeToDisk(PathBuffer, + DestinationRootPath.Buffer); if (!NT_SUCCESS(Status)) { DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status); @@ -2498,10 +2502,10 @@ FormatPartitionPage (PINPUT_RECORD Ir) wcscat(PathBuffer, L"\\loader\\fat.bin"); DPRINT("Install FAT bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - Status = InstallFat16BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); + DestinationRootPath.Buffer); + Status = InstallFat16BootCodeToDisk(PathBuffer, + DestinationRootPath.Buffer); if (!NT_SUCCESS(Status)) { DPRINT1("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status); @@ -2518,10 +2522,10 @@ FormatPartitionPage (PINPUT_RECORD Ir) wcscat(PathBuffer, L"\\loader\\ext2.bin"); DPRINT("Install EXT2 bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - Status = InstallFat32BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); + DestinationRootPath.Buffer); + Status = InstallFat32BootCodeToDisk(PathBuffer, + DestinationRootPath.Buffer); if (!NT_SUCCESS(Status)) { DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status); @@ -2601,7 +2605,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir) MUIGetString(STRING_QUITCONTINUE), NULL, POPUP_WAIT_NONE); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -2641,7 +2645,10 @@ CheckFileSystemPage(PINPUT_RECORD Ir) static PAGE_NUMBER -InstallDirectoryPage1(PWCHAR InstallDir, PDISKENTRY DiskEntry, PPARTENTRY PartEntry, UCHAR PartNum) +InstallDirectoryPage1(PWCHAR InstallDir, + PDISKENTRY DiskEntry, + PPARTENTRY PartEntry, + UCHAR PartNum) { WCHAR PathBuffer[MAX_PATH]; @@ -2673,7 +2680,7 @@ InstallDirectoryPage1(PWCHAR InstallDir, PDISKENTRY DiskEntry, PPARTENTRY PartEn wcscat(PathBuffer, InstallDir); RtlCreateUnicodeString(&DestinationArcPath, PathBuffer); - return(PREPARE_COPY_PAGE); + return PREPARE_COPY_PAGE; } @@ -2699,14 +2706,14 @@ InstallDirectoryPage(PINPUT_RECORD Ir) PartEntry = PartitionList->CurrentPartition; /* Search for 'DefaultPath' in the 'SetupData' section */ - if (!SetupFindFirstLineW (SetupInf, L"SetupData", L"DefaultPath", &Context)) + if (!SetupFindFirstLineW(SetupInf, L"SetupData", L"DefaultPath", &Context)) { MUIDisplayError(ERROR_FIND_SETUPDATA, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } /* Read the 'DefaultPath' data */ - if (INF_GetData (&Context, NULL, &DefaultPath)) + if (INF_GetData(&Context, NULL, &DefaultPath)) { wcscpy(InstallDir, DefaultPath); } @@ -2721,10 +2728,13 @@ InstallDirectoryPage(PINPUT_RECORD Ir) if (IsUnattendedSetup) { - return(InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry, PartitionList->CurrentPartitionNumber)); + return InstallDirectoryPage1(InstallDir, + DiskEntry, + PartEntry, + PartitionList->CurrentPartitionNumber); } - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -2732,13 +2742,16 @@ InstallDirectoryPage(PINPUT_RECORD Ir) (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ { if (ConfirmQuit(Ir) == TRUE) - return(QUIT_PAGE); + return QUIT_PAGE; break; } else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { - return (InstallDirectoryPage1 (InstallDir, DiskEntry, PartEntry, PartitionList->CurrentPartitionNumber)); + return InstallDirectoryPage1(InstallDir, + DiskEntry, + PartEntry, + PartitionList->CurrentPartitionNumber); } else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */ { @@ -2761,15 +2774,16 @@ InstallDirectoryPage(PINPUT_RECORD Ir) } } - return(INSTALL_DIRECTORY_PAGE); + return INSTALL_DIRECTORY_PAGE; } + static BOOLEAN AddSectionToCopyQueueCab(HINF InfFile, - PWCHAR SectionName, - PWCHAR SourceCabinet, - PCUNICODE_STRING DestinationPath, - PINPUT_RECORD Ir) + PWCHAR SectionName, + PWCHAR SourceCabinet, + PCUNICODE_STRING DestinationPath, + PINPUT_RECORD Ir) { INFCONTEXT FilesContext; INFCONTEXT DirContext; @@ -2779,12 +2793,12 @@ AddSectionToCopyQueueCab(HINF InfFile, PWCHAR TargetFileName; /* Search for the SectionName section */ - if (!SetupFindFirstLineW (InfFile, SectionName, NULL, &FilesContext)) + if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext)) { char Buffer[128]; sprintf(Buffer, MUIGetString(STRING_TXTSETUPFAILED), SectionName); PopupError(Buffer, MUIGetString(STRING_REBOOTCOMPUTER), Ir, POPUP_WAIT_ENTER); - return(FALSE); + return FALSE; } /* @@ -2794,7 +2808,7 @@ AddSectionToCopyQueueCab(HINF InfFile, do { /* Get source file name and target directory id */ - if (!INF_GetData (&FilesContext, &FileKeyName, &FileKeyValue)) + if (!INF_GetData(&FilesContext, &FileKeyName, &FileKeyValue)) { /* FIXME: Handle error! */ DPRINT1("INF_GetData() failed\n"); @@ -2802,107 +2816,20 @@ AddSectionToCopyQueueCab(HINF InfFile, } /* Get optional target file name */ - if (!INF_GetDataField (&FilesContext, 2, &TargetFileName)) + if (!INF_GetDataField(&FilesContext, 2, &TargetFileName)) TargetFileName = NULL; - DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); + DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); /* Lookup target directory */ - if (!SetupFindFirstLineW (InfFile, L"Directories", FileKeyValue, &DirContext)) + if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext)) { /* FIXME: Handle error! */ DPRINT1("SetupFindFirstLine() failed\n"); break; } - if (!INF_GetData (&DirContext, NULL, &DirKeyValue)) - { - /* FIXME: Handle error! */ - DPRINT1("INF_GetData() failed\n"); - break; - } - - if (!SetupQueueCopy(SetupFileQueue, - SourceCabinet, - SourceRootPath.Buffer, - SourceRootDir.Buffer, - FileKeyName, - DirKeyValue, - TargetFileName)) - { - /* FIXME: Handle error! */ - DPRINT1("SetupQueueCopy() failed\n"); - } - } while (SetupFindNextLine(&FilesContext, &FilesContext)); - - return TRUE; -} - -static BOOLEAN -AddSectionToCopyQueue(HINF InfFile, - PWCHAR SectionName, - PWCHAR SourceCabinet, - PCUNICODE_STRING DestinationPath, - PINPUT_RECORD Ir) -{ - INFCONTEXT FilesContext; - INFCONTEXT DirContext; - PWCHAR FileKeyName; - PWCHAR FileKeyValue; - PWCHAR DirKeyValue; - PWCHAR TargetFileName; - - if (SourceCabinet) - return AddSectionToCopyQueueCab(InfFile, L"SourceFiles", SourceCabinet, DestinationPath, Ir); - - /* Search for the SectionName section */ - if (!SetupFindFirstLineW (InfFile, SectionName, NULL, &FilesContext)) - { - char Buffer[128]; - sprintf(Buffer, MUIGetString(STRING_TXTSETUPFAILED), SectionName); - PopupError(Buffer, MUIGetString(STRING_REBOOTCOMPUTER), Ir, POPUP_WAIT_ENTER); - return FALSE; - } - - /* - * Enumerate the files in the section - * and add them to the file queue. - */ - do - { - /* Get source file name and target directory id */ - if (!INF_GetData (&FilesContext, &FileKeyName, &FileKeyValue)) - { - /* FIXME: Handle error! */ - DPRINT1("INF_GetData() failed\n"); - break; - } - - /* Get target directory id */ - if (!INF_GetDataField (&FilesContext, 13, &FileKeyValue)) - { - /* FIXME: Handle error! */ - DPRINT1("INF_GetData() failed\n"); - break; - } - - /* Get optional target file name */ - if (!INF_GetDataField (&FilesContext, 11, &TargetFileName)) - TargetFileName = NULL; - else if (!*TargetFileName) - TargetFileName = NULL; - - DPRINT ("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); - - /* Lookup target directory */ - if (!SetupFindFirstLineW (InfFile, L"Directories", FileKeyValue, &DirContext)) - { - /* FIXME: Handle error! */ - DPRINT1("SetupFindFirstLine() failed\n"); - break; - } - - if (!INF_GetData (&DirContext, NULL, &DirKeyValue)) + if (!INF_GetData(&DirContext, NULL, &DirKeyValue)) { /* FIXME: Handle error! */ DPRINT1("INF_GetData() failed\n"); @@ -2925,10 +2852,99 @@ AddSectionToCopyQueue(HINF InfFile, return TRUE; } + +static BOOLEAN +AddSectionToCopyQueue(HINF InfFile, + PWCHAR SectionName, + PWCHAR SourceCabinet, + PCUNICODE_STRING DestinationPath, + PINPUT_RECORD Ir) +{ + INFCONTEXT FilesContext; + INFCONTEXT DirContext; + PWCHAR FileKeyName; + PWCHAR FileKeyValue; + PWCHAR DirKeyValue; + PWCHAR TargetFileName; + + if (SourceCabinet) + return AddSectionToCopyQueueCab(InfFile, L"SourceFiles", SourceCabinet, DestinationPath, Ir); + + /* Search for the SectionName section */ + if (!SetupFindFirstLineW(InfFile, SectionName, NULL, &FilesContext)) + { + char Buffer[128]; + sprintf(Buffer, MUIGetString(STRING_TXTSETUPFAILED), SectionName); + PopupError(Buffer, MUIGetString(STRING_REBOOTCOMPUTER), Ir, POPUP_WAIT_ENTER); + return FALSE; + } + + /* + * Enumerate the files in the section + * and add them to the file queue. + */ + do + { + /* Get source file name and target directory id */ + if (!INF_GetData(&FilesContext, &FileKeyName, &FileKeyValue)) + { + /* FIXME: Handle error! */ + DPRINT1("INF_GetData() failed\n"); + break; + } + + /* Get target directory id */ + if (!INF_GetDataField(&FilesContext, 13, &FileKeyValue)) + { + /* FIXME: Handle error! */ + DPRINT1("INF_GetData() failed\n"); + break; + } + + /* Get optional target file name */ + if (!INF_GetDataField(&FilesContext, 11, &TargetFileName)) + TargetFileName = NULL; + else if (!*TargetFileName) + TargetFileName = NULL; + + DPRINT("FileKeyName: '%S' FileKeyValue: '%S'\n", FileKeyName, FileKeyValue); + + /* Lookup target directory */ + if (!SetupFindFirstLineW(InfFile, L"Directories", FileKeyValue, &DirContext)) + { + /* FIXME: Handle error! */ + DPRINT1("SetupFindFirstLine() failed\n"); + break; + } + + if (!INF_GetData(&DirContext, NULL, &DirKeyValue)) + { + /* FIXME: Handle error! */ + DPRINT1("INF_GetData() failed\n"); + break; + } + + if (!SetupQueueCopy(SetupFileQueue, + SourceCabinet, + SourceRootPath.Buffer, + SourceRootDir.Buffer, + FileKeyName, + DirKeyValue, + TargetFileName)) + { + /* FIXME: Handle error! */ + DPRINT1("SetupQueueCopy() failed\n"); + } + } while (SetupFindNextLine(&FilesContext, &FilesContext)); + + return TRUE; +} + + static BOOLEAN PrepareCopyPageInfFile(HINF InfFile, - PWCHAR SourceCabinet, - PINPUT_RECORD Ir) + PWCHAR SourceCabinet, + PINPUT_RECORD Ir) { WCHAR PathBuffer[MAX_PATH]; INFCONTEXT DirContext; @@ -2998,7 +3014,7 @@ PrepareCopyPageInfFile(HINF InfFile, /* Enumerate the directory values and create the subdirectories */ do { - if (!INF_GetData (&DirContext, NULL, &KeyValue)) + if (!INF_GetData(&DirContext, NULL, &KeyValue)) { DPRINT1("break\n"); break; @@ -3035,6 +3051,7 @@ PrepareCopyPageInfFile(HINF InfFile, return TRUE; } + static PAGE_NUMBER PrepareCopyPage(PINPUT_RECORD Ir) { @@ -3062,18 +3079,18 @@ PrepareCopyPage(PINPUT_RECORD Ir) } /* Search for the 'Cabinets' section */ - if (!SetupFindFirstLineW (SetupInf, L"Cabinets", NULL, &CabinetsContext)) + if (!SetupFindFirstLineW(SetupInf, L"Cabinets", NULL, &CabinetsContext)) { return FILE_COPY_PAGE; } /* - * Enumerate the directory values in the 'Cabinets' - * section and parse their inf files. - */ + * Enumerate the directory values in the 'Cabinets' + * section and parse their inf files. + */ do { - if (!INF_GetData (&CabinetsContext, NULL, &KeyValue)) + if (!INF_GetData(&CabinetsContext, NULL, &KeyValue)) break; wcscpy(PathBuffer, SourcePath.Buffer); @@ -3123,15 +3140,16 @@ PrepareCopyPage(PINPUT_RECORD Ir) return QUIT_PAGE; } #endif - } while (SetupFindNextLine (&CabinetsContext, &CabinetsContext)); + } while (SetupFindNextLine(&CabinetsContext, &CabinetsContext)); return FILE_COPY_PAGE; } + VOID NTAPI SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext, - IN BOOLEAN First) + IN BOOLEAN First) { SYSTEM_PERFORMANCE_INFORMATION PerfInfo; @@ -3156,11 +3174,13 @@ SetupUpdateMemoryInfo(IN PCOPYCONTEXT CopyContext, ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages); } -static UINT CALLBACK + +static UINT +CALLBACK FileCopyCallback(PVOID Context, - UINT Notification, - UINT_PTR Param1, - UINT_PTR Param2) + UINT Notification, + UINT_PTR Param1, + UINT_PTR Param2) { PCOPYCONTEXT CopyContext; @@ -3191,6 +3211,7 @@ FileCopyCallback(PVOID Context, return 0; } + static PAGE_NUMBER FileCopyPage(PINPUT_RECORD Ir) @@ -3223,9 +3244,9 @@ FileCopyPage(PINPUT_RECORD Ir) /* Create the paged pool progress bar */ CopyContext.MemoryBars[0] = CreateProgressBar(13, 40, - 13 + mem_bar_width, + 13 + mem_bar_width, 43, - 13, + 13, 44, FALSE, "Kernel Pool"); @@ -3233,7 +3254,7 @@ FileCopyPage(PINPUT_RECORD Ir) /* Create the non paged pool progress bar */ CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (mem_bar_width / 2), 40, - (xScreen / 2) + (mem_bar_width / 2), + (xScreen / 2) + (mem_bar_width / 2), 43, (xScreen / 2)- (mem_bar_width / 2), 44, @@ -3243,9 +3264,9 @@ FileCopyPage(PINPUT_RECORD Ir) /* Create the global memory progress bar */ CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - mem_bar_width, 40, - xScreen - 13, + xScreen - 13, 43, - xScreen - 13 - mem_bar_width, + xScreen - 13 - mem_bar_width, 44, FALSE, "Free Memory"); @@ -3267,6 +3288,7 @@ FileCopyPage(PINPUT_RECORD Ir) return REGISTRY_PAGE; } + static PAGE_NUMBER RegistryPage(PINPUT_RECORD Ir) { @@ -3322,7 +3344,8 @@ RegistryPage(PINPUT_RECORD Ir) DPRINT("Action: %S File: %S Section %S\n", Action, File, Section); - if (Action == NULL) break; // Hackfix + if (Action == NULL) + break; // Hackfix if (!_wcsicmp (Action, L"AddReg")) { @@ -3346,7 +3369,7 @@ RegistryPage(PINPUT_RECORD Ir) MUIDisplayError(ERROR_IMPORT_HIVE, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } - } while (SetupFindNextLine (&InfContext, &InfContext)); + } while (SetupFindNextLine(&InfContext, &InfContext)); /* Update display registry settings */ CONSOLE_SetStatusText(MUIGetString(STRING_DISPLAYETTINGSUPDATE)); @@ -3380,16 +3403,17 @@ RegistryPage(PINPUT_RECORD Ir) return QUIT_PAGE; } - if (!IsUnattendedSetup){ - - /* Update keyboard layout settings */ - CONSOLE_SetStatusText(MUIGetString(STRING_KEYBOARDSETTINGSUPDATE)); - if (!ProcessKeyboardLayoutRegistry(LayoutList)) - { - MUIDisplayError(ERROR_UPDATE_KBSETTINGS, Ir, POPUP_WAIT_ENTER); - return QUIT_PAGE; - } + if (!IsUnattendedSetup) + { + /* Update keyboard layout settings */ + CONSOLE_SetStatusText(MUIGetString(STRING_KEYBOARDSETTINGSUPDATE)); + if (!ProcessKeyboardLayoutRegistry(LayoutList)) + { + MUIDisplayError(ERROR_UPDATE_KBSETTINGS, Ir, POPUP_WAIT_ENTER); + return QUIT_PAGE; + } } + /* Add codepage information to registry */ CONSOLE_SetStatusText(MUIGetString(STRING_CODEPAGEINFOUPDATE)); if (!AddCodePage()) @@ -3485,7 +3509,7 @@ BootLoaderPage(PINPUT_RECORD Ir) MUIDisplayPage(BOOT_LOADER_PAGE); CONSOLE_InvertTextXY(8, Line, 60, 1); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -3495,8 +3519,11 @@ BootLoaderPage(PINPUT_RECORD Ir) CONSOLE_NormalTextXY(8, Line, 60, 1); Line++; - if (Line<12) Line=14; - if (Line>14) Line=12; + if (Line<12) + Line=14; + + if (Line>14) + Line=12; CONSOLE_InvertTextXY(8, Line, 60, 1); } @@ -3506,8 +3533,11 @@ BootLoaderPage(PINPUT_RECORD Ir) CONSOLE_NormalTextXY(8, Line, 60, 1); Line--; - if (Line<12) Line=14; - if (Line>14) Line=12; + if (Line<12) + Line=14; + + if (Line>14) + Line=12; CONSOLE_InvertTextXY(8, Line, 60, 1); } @@ -3551,7 +3581,7 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir) // SetStatusText(" Please wait..."); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -3678,7 +3708,7 @@ QuitPage(PINPUT_RECORD Ir) CONSOLE_SetStatusText(MUIGetString(STRING_REBOOTCOMPUTER2)); - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -3700,7 +3730,7 @@ SuccessPage(PINPUT_RECORD Ir) return FLUSH_PAGE; } - while(TRUE) + while (TRUE) { CONSOLE_ConInKey(Ir); @@ -3733,7 +3763,16 @@ RunUSetup(VOID) NtQuerySystemTime(&Time); - Status = RtlCreateUserThread(NtCurrentProcess(), NULL, TRUE, 0, 0, 0, PnpEventThread, &SetupInf, &hPnpThread, NULL); + Status = RtlCreateUserThread(NtCurrentProcess(), + NULL, + TRUE, + 0, + 0, + 0, + PnpEventThread, + &SetupInf, + &hPnpThread, + NULL); if (!NT_SUCCESS(Status)) hPnpThread = INVALID_HANDLE_VALUE;