reactos操作系统实现(57)

前端之家收集整理的这篇文章主要介绍了reactos操作系统实现(57)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

当分区好后,就需要选择这些分区使用什么样的文件系统,目前主要支持FATFAT32EXT2NTFS文件系统。这些功能是通过下面的函数实现的,如下:

#001 static PAGE_NUMBER

#002 SelectFileSystemPage (PINPUT_RECORD Ir)

#003 {

#004 PDISKENTRY DiskEntry;

#005 PPARTENTRY PartEntry;

#006 ULONGLONG DiskSize;

#007 ULONGLONG PartSize;

#008 PCHAR DiskUnit;

#009 PCHAR PartUnit;

#010 PCHAR PartType;

#011

判断分区是否有效。

#012 if (PartitionList == NULL ||

#013 PartitionList->CurrentDisk == NULL ||

#014 PartitionList->CurrentPartition == NULL)

#015 {

#016 /* FIXME: show an error dialog */

#017 return QUIT_PAGE;

#018 }

#019

#020 DiskEntry = PartitionList->CurrentDisk;

#021 PartEntry = PartitionList->CurrentPartition;

#022

判断磁盘的大小。

#023 /* adjust disk size */

#024 if (DiskEntry->DiskSize >= 0x280000000ULL) /* 10 GB */

#025 {

#026 DiskSize = (DiskEntry->DiskSize + (1 << 29)) >> 30;

#027 DiskUnit = MUIGetString(STRING_GB);

#028 }

#029 else

#030 {

#031 DiskSize = (DiskEntry->DiskSize + (1 << 19)) >> 20;

#032 DiskUnit = MUIGetString(STRING_MB);

#033 }

#034

调整分区的大小。

#035 /* adjust partition size */

#036 if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */

#037 {

#038 PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30;

#039 PartUnit = MUIGetString(STRING_GB);

#040 }

#041 else

#042 {

#043 PartSize = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20;

#044 PartUnit = MUIGetString(STRING_MB);

#045 }

#046

设置分区文件系统的类型。

#047 /* adjust partition type */

#048 if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_12) ||

#049 (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_16) ||

#050 (PartEntry->PartInfo[0].PartitionType == PARTITION_HUGE) ||

#051 (PartEntry->PartInfo[0].PartitionType == PARTITION_XINT13))

#052 {

#053 PartType = "FAT";

#054 }

#055 else if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32) ||

#056 (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))

#057 {

#058 PartType = "FAT32";

#059 }

#060 else if (PartEntry->PartInfo[0].PartitionType == PARTITION_EXT2)

#061 {

#062 PartType = "EXT2";

#063 }

#064 else if (PartEntry->PartInfo[0].PartitionType == PARTITION_IFS)

#065 {

#066 PartType = "NTFS"; /* FIXME: Not quite correct! */

#067 }

#068 else if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)

#069 {

#070 PartType = MUIGetString(STRING_FORMATUNUSED);

#071 }

#072 else

#073 {

#074 PartType = MUIGetString(STRING_FORMATUNKNOWN);

#075 }

#076

#077 if (PartEntry->AutoCreate == TRUE)

#078 {

#079 CONSOLE_SetTextXY(6,8,MUIGetString(STRING_NEWPARTITION));

#080

#081 #if 0

#082 CONSOLE_PrintTextXY(8,10,"Partition %lu (%I64u %s) %s of",

#083 PartEntry->PartInfo[0].PartitionNumber,

#084 PartSize,

#085 PartUnit,

#086 PartType);

#087 #endif

#088

#089 CONSOLE_PrintTextXY(8,MUIGetString(STRING_HDINFOPARTZEROED),

#090 DiskEntry->DiskNumber,

#091 DiskSize,

#092 DiskUnit,

#093 DiskEntry->Port,

#094 DiskEntry->Bus,

#095 DiskEntry->Id,

#096 &DiskEntry->DriverName);

#097

#098 CONSOLE_SetTextXY(6,12,MUIGetString(STRING_PARTFORMAT));

#099

#100

#101 PartEntry->AutoCreate = FALSE;

#102 }

#103 else if (PartEntry->New == TRUE)

#104 {

#105 CONSOLE_SetTextXY(6,MUIGetString(STRING_NONFORMATTEDPART));

#106 CONSOLE_SetTextXY(6,MUIGetString(STRING_PARTFORMAT));

#107 }

#108 else

#109 {

#110 CONSOLE_SetTextXY(6,MUIGetString(STRING_INSTALLONPART));

#111

#112 if (PartType == NULL)

#113 {

#114 CONSOLE_PrintTextXY(8,

#115 MUIGetString(STRING_HDDINFOUNK4),

#116 (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,

#117 (PartEntry->DriveLetter == 0) ? '-' : ':',

#118 PartEntry->PartInfo[0].PartitionType,

#119 PartSize,

#120 PartUnit);

#121 }

#122 else

#123 {

#124 CONSOLE_PrintTextXY(8,

#125 "%c%c %s %I64u %s",

#126 (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,

#127 (PartEntry->DriveLetter == 0) ? '-' : ':',

#128 PartType,

#129 PartSize,

#130 PartUnit);

#131 }

#132

#133 CONSOLE_PrintTextXY(6,MUIGetString(STRING_HDINFOPARTEXISTS),

#134 DiskEntry->DiskNumber,

#135 DiskSize,

#136 DiskUnit,

#137 DiskEntry->Port,

#138 DiskEntry->Bus,

#139 DiskEntry->Id,

#140 &DiskEntry->DriverName);

#141 }

#142

#143 MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE);

#144

#145 if (FileSystemList == NULL)

#146 {

#147 FileSystemList = CreateFileSystemList (6,26,PartEntry->New,L"FAT");

#148 if (FileSystemList == NULL)

#149 {

#150 /* FIXME: show an error dialog */

#151 return QUIT_PAGE;

#152 }

#153

#154 /* FIXME: Add file systems to list */

#155 }

#156 DrawFileSystemList (FileSystemList);

#157

#158 if (RepairUpdateFlag)

#159 {

#160 return CHECK_FILE_SYSTEM_PAGE;

#161 //return SELECT_PARTITION_PAGE;

#162 }

#163

#164 if (IsUnattendedSetup)

#165 {

#166 if (UnattendFormatPartition)

#167 {

#168 return FORMAT_PARTITION_PAGE;

#169 }

#170

#171 return(CHECK_FILE_SYSTEM_PAGE);

#172 }

#173

键盘的事件响应。

#174 while (TRUE)

#175 {

#176 CONSOLE_ConInKey(Ir);

#177

#178 if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&

#179 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */

#180 {

#181 if (ConfirmQuit (Ir) == TRUE)

#182 {

#183 return QUIT_PAGE;

#184 }

#185

#186 break;

#187 }

#188 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&

#189 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */

#190 {

#191 return SELECT_PARTITION_PAGE;

#192 }

#193 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&

#194 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */

#195 {

#196 ScrollDownFileSystemList (FileSystemList);

#197 }

#198 else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&

#199 (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */

#200 {

#201 ScrollUpFileSystemList (FileSystemList);

#202 }

#203 else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */

#204 {

#205 if (!FileSystemList->Selected->FormatFunc)

#206 {

#207 return CHECK_FILE_SYSTEM_PAGE;

#208 }

#209 else

#210 {

#211 return FORMAT_PARTITION_PAGE;

#212 }

#213 }

#214 }

#215

#216 return SELECT_FILE_SYSTEM_PAGE;

#217 }

通过函数设置文件系统,然后就返回 FORMAT_PARTITION_PAGE ,就进入下一步格式化磁盘。 原文链接:https://www.f2er.com/react/308476.html

猜你在找的React相关文章