Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

partit.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1991 Microsoft Corporation 00004 00005 Module Name: 00006 00007 partit.c 00008 00009 Abstract: 00010 00011 This module contains entry points to perform the 00012 'configure system partition' and 'create OS loader' 00013 options of the ARC installer. 00014 00015 Author: 00016 00017 Ted Miller (tedm) Nov-1991 00018 00019 Revision History: 00020 00021 --*/ 00022 00023 00024 #include "precomp.h" 00025 #pragma hdrstop 00026 00027 00028 PCHAR 00029 AlGetNextArcNamToken ( 00030 IN PCHAR TokenString, 00031 OUT PCHAR OutputToken, 00032 OUT PULONG UnitNumber 00033 ); 00034 00035 #define STATUS_ROW_TOP 13 00036 #define STATUS_ROW_BOTTOM 17 00037 00038 char NOMEMMSG[] = "Insufficient memory"; 00039 char NOCNFMSG[] = "Unable to determine disk configuration (ARC status = %u)"; 00040 char NOFMTMSG[] = "Format failed (ARC status = %u)"; 00041 char DSKFLMSG[] = "Disk is full"; 00042 char NOCREMSG[] = "Could not create partition (ARC status = %u)"; 00043 char NODELMSG[] = "Could not delete partition (ARC status = %u)"; 00044 char ALREAMSG[] = "Partition is already a system partition"; 00045 char NOFILMSG[] = "Unable to determine filesystem on partition (ARC status = %u)"; 00046 char NOENVMSG[] = "Error (ARC status = %u) determining environment"; 00047 char NOEVAMSG[] = "Could not add partition to environment (ARC status = %u)"; 00048 char NOEVDMSG[] = "Could not remove partition from environment (ARC status = %u)"; 00049 char NOSYSMSG[] = "No system partitions defined"; 00050 char NOPARMSG[] = "No partitions on this disk"; 00051 00052 char SYSPARTVAR[] = "SYSTEMPARTITION"; 00053 char OSLOADERVAR[] = "OSLOADER"; 00054 char OSLOADPARTVAR[] = "OSLOADPARTITION"; 00055 00056 #define MsgNoMem() AlStatusMsg(STATUS_ROW_TOP,STATUS_ROW_BOTTOM,TRUE,NOMEMMSG); 00057 00058 PCHAR SysPartMenu[] = { "Create System Partition", 00059 "Delete Partition", 00060 "Make Existing Partition into System Partition", 00061 "Exit" 00062 }; 00063 00064 #define SYSPARTMENU_CREATE 0 00065 #define SYSPARTMENU_DELETE 1 00066 #define SYSPARTMENU_ADD 2 00067 #define SYSPARTMENU_EXIT 3 00068 00069 #define MENU_ROW 4 00070 00071 char sprintfBuffer[256]; 00072 00073 BOOLEAN 00074 Confirm( 00075 PCHAR Warning 00076 ) 00077 { 00078 char c; 00079 ULONG Count; 00080 00081 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00082 AlPrint("%s%s (y/n)?",MSGMARGIN,Warning); 00083 ArcRead(ARC_CONSOLE_INPUT,&c,1,&Count); 00084 while((c != 'y') && (c != 'Y') && (c != 'n') && (c != 'N') && (c != ASCI_ESC)) { 00085 ArcRead(ARC_CONSOLE_INPUT,&c,1,&Count); 00086 } 00087 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00088 return((BOOLEAN)((c == 'y') || (c == 'Y'))); 00089 } 00090 00091 00092 VOID 00093 PrintErrorMsg( 00094 PCHAR FormatString, 00095 ... 00096 ) 00097 { 00098 va_list ArgList; 00099 00100 va_start(ArgList,FormatString); 00101 00102 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00103 vAlStatusMsg(STATUS_ROW_TOP,TRUE,FormatString,ArgList); 00104 00105 AlWaitKey(NULL); 00106 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00107 } 00108 00109 00110 VOID 00111 PrintMsg( 00112 PCHAR FormatString, 00113 ... 00114 ) 00115 { 00116 va_list ArgList; 00117 00118 va_start(ArgList,FormatString); 00119 00120 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00121 vAlStatusMsg(STATUS_ROW_TOP,FALSE,FormatString,ArgList); 00122 00123 AlWaitKey(NULL); 00124 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00125 } 00126 00127 00128 BOOLEAN 00129 IsBootSelectionPartition( 00130 PCHAR Variable, 00131 ULONG Disk, 00132 ULONG Partition, 00133 PULONG MatchNumber OPTIONAL 00134 ) 00135 { 00136 char text[256]; 00137 PCHAR Var = ArcGetEnvironmentVariable(Variable); 00138 00139 if (Var == NULL) { 00140 return(FALSE); 00141 } 00142 00143 sprintf(text,"%spartition(%u)",GetDiskName(Disk),Partition); 00144 return(AlFindNextMatchComponent(Var,text,0,MatchNumber)); 00145 } 00146 00147 00148 LONG 00149 ChooseDisk( 00150 VOID 00151 ) 00152 { 00153 ULONG DiskCount = GetDiskCount(); 00154 PVOID MenuID; 00155 LONG Disk; 00156 ULONG ChosenDisk; 00157 PCHAR DiskName,TempDiskName; 00158 ULONG UnitNumber,ScsiNumber,ScsiId,DiskNumber; 00159 CHAR Token[32]; 00160 00161 if (DiskCount == 1) { 00162 return(0); 00163 } 00164 00165 if (!AlNewMenu(&MenuID)) { 00166 MsgNoMem(); 00167 return(-1); 00168 } 00169 00170 for(Disk = DiskCount - 1; Disk >= 0; Disk--) { 00171 00172 DiskName = GetDiskName(Disk); 00173 00174 if ((strstr(DiskName, "scsi") != NULL) && 00175 (strstr(DiskName, "disk") != NULL) ) { 00176 00177 ScsiNumber = ScsiId = DiskNumber = 0; 00178 TempDiskName = DiskName; 00179 00180 while (TempDiskName != NULL) { 00181 TempDiskName = AlGetNextArcNamToken(TempDiskName, 00182 Token, 00183 &UnitNumber); 00184 00185 if (strcmp(Token,"scsi") == 0) { 00186 ScsiNumber = UnitNumber; 00187 } 00188 00189 if (strcmp(Token,"disk") == 0) { 00190 ScsiId = UnitNumber; 00191 } 00192 00193 if (strcmp(Token,"rdisk") == 0) { 00194 DiskNumber = UnitNumber; 00195 } 00196 } 00197 00198 sprintf(sprintfBuffer, 00199 "Scsi bus %d, Identifier %d, Disk %d (%s)", 00200 ScsiNumber, 00201 ScsiId, 00202 DiskNumber, 00203 GetDiskName(Disk)); 00204 } else { 00205 sprintf(sprintfBuffer,"Disk %d (%s)",Disk,GetDiskName(Disk)); 00206 } 00207 00208 00209 if (!AlAddMenuItem(MenuID,sprintfBuffer,Disk,0)) { 00210 MsgNoMem(); 00211 return(-1); 00212 } 00213 } 00214 00215 if (!AlDisplayMenu(MenuID,FALSE,0,&ChosenDisk,MENU_ROW,"Select Disk")) { 00216 return(-1); 00217 } else { 00218 return(ChosenDisk); 00219 } 00220 } 00221 00222 00223 BOOLEAN // true if partition was created 00224 DoPartitionCreate( 00225 OUT PULONG DiskNo, 00226 OUT PULONG PartitionNo 00227 ) 00228 { 00229 ULONG Disk,i; 00230 PREGION_DESCRIPTOR Regions; 00231 ULONG RegionCount,Choice; 00232 ULONG ChosenSize; 00233 ARC_STATUS status; 00234 BOOLEAN xAny,xP,xE,xL,PrimaryExists; 00235 PVOID MenuID; 00236 ULONG PartitionNumber; 00237 char PartitionPath[256]; 00238 00239 00240 if ((Disk = ChooseDisk()) == -1) { 00241 return(FALSE); 00242 } 00243 00244 if ((status = DoesAnyPrimaryExist(Disk,&PrimaryExists)) != ESUCCESS) { 00245 PrintErrorMsg(NOCNFMSG,status); 00246 return(FALSE); 00247 } 00248 00249 if ((status = IsAnyCreationAllowed(Disk, 00250 TRUE, 00251 &xAny, 00252 &xP, 00253 &xE, 00254 &xL 00255 ) 00256 ) 00257 != ESUCCESS) 00258 { 00259 PrintErrorMsg(NOCNFMSG,status); 00260 return(FALSE); 00261 } 00262 00263 // in order for a creation to be allowed there must be 00264 // - free space on the disk and a free mbr entry OR 00265 // - free space in an existing extended partition. 00266 00267 if (!xAny) { 00268 PrintErrorMsg(DSKFLMSG); 00269 return(FALSE); 00270 } 00271 00272 if ((status = GetFreeDiskRegions(Disk,&Regions,&RegionCount)) != ESUCCESS) { 00273 PrintErrorMsg(NOCNFMSG,status); 00274 return(FALSE); 00275 } 00276 00277 if (!AlNewMenu(&MenuID)) { 00278 MsgNoMem(); 00279 FreeRegionArray(Regions,RegionCount); 00280 return(FALSE); 00281 } 00282 00283 // Present the user with a list of the free spaces 00284 // on the disk (and within the extended partition, if it 00285 // exists). 00286 00287 if (RegionCount > 1) { 00288 00289 for(i=0; i<RegionCount; i++) { 00290 00291 sprintf(sprintfBuffer,"%u MB space",Regions[i].SizeMB); 00292 if (Regions[i].RegionType == REGION_LOGICAL) { 00293 strcat(sprintfBuffer," (in extended partition)"); 00294 } 00295 if (!AlAddMenuItem(MenuID,sprintfBuffer,i,0)) { 00296 MsgNoMem(); 00297 AlFreeMenu(MenuID); 00298 FreeRegionArray(Regions,RegionCount); 00299 return(FALSE); 00300 } 00301 } 00302 00303 if (!AlDisplayMenu(MenuID,FALSE,0,&Choice,MENU_ROW,"Available Free Spaces")) { 00304 // user escaped 00305 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00306 AlFreeMenu(MenuID); 00307 FreeRegionArray(Regions,RegionCount); 00308 return(FALSE); 00309 } 00310 } else { 00311 Choice = 0; 00312 } 00313 00314 AlFreeMenu(MenuID); 00315 00316 // now ask the user for the size of the partition to create in the chosen space. 00317 00318 do { 00319 AlClearStatusArea(STATUS_ROW_TOP,STATUS_ROW_BOTTOM); 00320 AlPrint("%sEnter size in MB (1-%u): ",MSGMARGIN,Regions[Choice].SizeMB); 00321 if (!AlGetString(sprintfBuffer,sizeof(sprintfBuffer))) { 00322 FreeRegionArray(Regions,RegionCount); 00323 return(FALSE); 00324 } 00325 ChosenSize = atoi(sprintfBuffer); 00326 if (!ChosenSize || (ChosenSize > Regions[Choice].SizeMB)) { 00327 PrintErrorMsg("Invalid size."); 00328 } else { 00329 break; 00330 } 00331 } while(1); 00332 00333 // The chosen space is either in the extended partition or not. 00334 // If it is, just create the requested partition. 00335 00336 if (Regions[Choice].RegionType == REGION_LOGICAL) { 00337 00338 status = CreatePartition(&Regions[Choice],ChosenSize,REGION_LOGICAL); 00339 PartitionNumber = Regions[Choice].PartitionNumber; 00340 00341 } else { 00342 00343 // The chosen space is not in an extended partition. 00344 // If there's already a primary and we can create 00345 // an extended partition, then first create an 00346 // extended partition spanning the entire space chosen 00347 // by the user, and then a logical volume within it of 00348 // size entered by the user. Otherwise [ie, there's no primary 00349 // or we're not allowed to create an extended partition] 00350 // create a primary of the size entered by the user. 00351 00352 00353 if (PrimaryExists && xE) { 00354 00355 // create extended partition first. 00356 status = CreatePartition(&Regions[Choice],Regions[Choice].SizeMB,REGION_EXTENDED); 00357 FreeRegionArray(Regions,RegionCount); 00358 00359 if ((status = GetFreeLogicalDiskRegions(Disk,&Regions,&RegionCount)) != ESUCCESS) { 00360 PrintErrorMsg(NOCNFMSG,status); 00361 return(FALSE); 00362 } 00363 // since we just created the extended partition, there will be one free 00364 // region in it. 00365 00366 status = CreatePartition(Regions,ChosenSize,REGION_LOGICAL); 00367 PartitionNumber = Regions[0].PartitionNumber; 00368 00369 } else { 00370 00371 status = CreatePartition(&Regions[Choice],ChosenSize,REGION_PRIMARY); 00372 PartitionNumber = Regions[Choice].PartitionNumber; 00373 } 00374 } 00375 FreeRegionArray(Regions,RegionCount); 00376 00377 if ( (status == ESUCCESS) 00378 && ((status = CommitPartitionChanges(Disk)) == ESUCCESS)) 00379 { 00380 PrintMsg("Partition successfully created."); 00381 00382 #if 0 00383 // 00384 // This is bogus since this routine is called in the code path where 00385 // the user is creating a system partition. 00386 // 00387 if (ArcGetEnvironmentVariable(SYSPARTVAR) == NULL) { 00388 if (Confirm("Do you want to make this the system partition")) { 00389 sprintf(PartitionPath,"%spartition(%u)",GetDiskName(Disk),PartitionNumber); 00390 if ((status = ArcSetEnvironmentVariable(SYSPARTVAR,PartitionPath)) != ESUCCESS) { 00391 PrintErrorMsg(NOEVAMSG,status); 00392 } 00393 } 00394 } 00395 #endif 00396 00397 *DiskNo = Disk; 00398 *PartitionNo = PartitionNumber; 00399 return(TRUE); 00400 00401 } else { 00402 PrintErrorMsg(NOCREMSG,status); 00403 return(FALSE); 00404 } 00405 } 00406 00407 00408 VOID 00409 DoPartitionDelete( 00410 VOID 00411 ) 00412 { 00413 BOOLEAN xAny,xPrimary,xExtended,xLogical; 00414 ARC_STATUS status; 00415 PVOID MenuID; 00416 ULONG i,RegionCount,Choice; 00417 ULONG MatchNumber,Index; 00418 LONG Disk; 00419 PREGION_DESCRIPTOR Regions; 00420 BOOLEAN err,Confirmation; 00421 00422 00423 if ((Disk = ChooseDisk()) == -1) { 00424 return; 00425 } 00426 00427 if ((status = DoesAnyPartitionExist(Disk,&xAny,&xPrimary,&xExtended,&xLogical)) != ESUCCESS) { 00428 PrintErrorMsg(NOCNFMSG,status); 00429 return; 00430 } 00431 00432 if (xAny) { 00433 00434 if (!AlNewMenu(&MenuID)) { 00435 MsgNoMem(); 00436 return; 00437 } 00438 00439 if ((status = GetUsedDiskRegions(Disk,&Regions,&RegionCount)) != ESUCCESS) { 00440 00441 PrintErrorMsg(NOCNFMSG,status); 00442 00443 } else { 00444 00445 err = FALSE; 00446 00447 for(i=0; i<RegionCount; i++) { 00448 00449 sprintf(sprintfBuffer,"%s%u MB ",Regions[i].RegionType == REGION_LOGICAL ? " " : "",Regions[i].SizeMB); 00450 strcat(sprintfBuffer,GetSysIDName(Regions[i].SysID)); 00451 strcat(sprintfBuffer,Regions[i].RegionType == REGION_LOGICAL ? " Logical Volume" : " Partition"); 00452 if (IsExtended(Regions[i].SysID) && xLogical) { 00453 strcat(sprintfBuffer,", also resulting in the deletion of:"); 00454 } 00455 00456 if (!AlAddMenuItem(MenuID,sprintfBuffer,i,0)) { 00457 MsgNoMem(); 00458 err = TRUE; 00459 break; 00460 } 00461 } 00462 00463 if (!err) { 00464 00465 if (AlDisplayMenu(MenuID,FALSE,0,&Choice,MENU_ROW,"Select Partition to Delete")) { 00466 00467 if (IsBootSelectionPartition(SYSPARTVAR,Disk,Regions[Choice].PartitionNumber,NULL)) { 00468 Confirmation = Confirm("The selected partition is (or contains) a system partition.\r\n Are you sure you want to delete it"); 00469 } else { 00470 if (IsBootSelectionPartition(OSLOADPARTVAR,Disk,Regions[Choice].PartitionNumber,NULL)) { 00471 Confirmation = Confirm("The selected partition contains an operating system.\r\n Are you sure you want to delete it"); 00472 } else { 00473 Confirmation = Confirm("Are you sure"); 00474 } 00475 } 00476 if (Confirmation) { 00477 if (((status = DeletePartition(&Regions[Choice])) != ESUCCESS) 00478 || ((status = CommitPartitionChanges(Disk)) != ESUCCESS)) 00479 { 00480 PrintErrorMsg(NODELMSG,status); 00481 } else { 00482 PrintMsg("Partition deleted successfully."); 00483 00484 sprintf(sprintfBuffer, 00485 "%spartition(%u)", 00486 GetDiskName(Disk), 00487 Regions[Choice].PartitionNumber 00488 ); 00489 00490 // 00491 // If there are any boot selections and the deleted partition 00492 // was used, ask if the associated boot selections should be 00493 // deleted. 00494 // 00495 00496 if (ArcGetEnvironmentVariable(OSLOADPARTVAR) != NULL) { 00497 if ((IsBootSelectionPartition(SYSPARTVAR,Disk,Regions[Choice].PartitionNumber,NULL) || 00498 IsBootSelectionPartition(OSLOADPARTVAR,Disk,Regions[Choice].PartitionNumber,NULL)) && 00499 Confirm("Do you want to delete the boot selection(s) associated\r\n with the deleted partition?")) { 00500 00501 while (IsBootSelectionPartition(SYSPARTVAR,Disk,Regions[Choice].PartitionNumber,&MatchNumber)) { 00502 for ( Index = 0 ; Index < MaximumBootVariable ; Index++ ) { 00503 JzDeleteVariableSegment(BootString[Index],MatchNumber); 00504 } 00505 } 00506 00507 while (IsBootSelectionPartition(OSLOADPARTVAR,Disk,Regions[Choice].PartitionNumber,&MatchNumber)) { 00508 for ( Index = 0 ; Index < MaximumBootVariable ; Index++ ) { 00509 JzDeleteVariableSegment(BootString[Index],MatchNumber); 00510 } 00511 } 00512 } 00513 00514 } else { 00515 00516 // 00517 // There are no boot selections but delete all segments 00518 // of the SystemPartition variable that pointed to the 00519 // deleted partition. 00520 // 00521 00522 while (IsBootSelectionPartition(SYSPARTVAR,Disk,Regions[Choice].PartitionNumber,&MatchNumber)) { 00523 JzDeleteVariableSegment(BootString[SystemPartitionVariable],MatchNumber); 00524 } 00525 } 00526 } 00527 } 00528 } 00529 } 00530 00531 FreeRegionArray(Regions,RegionCount); 00532 } 00533 AlFreeMenu(MenuID); 00534 00535 } else { 00536 PrintErrorMsg("No partitions on this disk"); 00537 } 00538 } 00539 00540 00541 VOID 00542 DoSystemPartitionCreate( 00543 VOID 00544 ) 00545 { 00546 ULONG DiskNo,PartitionNo; 00547 ARC_STATUS status; 00548 00549 if (DoPartitionCreate(&DiskNo,&PartitionNo)) { 00550 00551 sprintf(sprintfBuffer,"%spartition(%u)",GetDiskName(DiskNo),PartitionNo); 00552 00553 // add the partition to the SYSTEMPARTITION NVRAM environment variable 00554 00555 if ((status = AlAddSystemPartition(sprintfBuffer)) != ESUCCESS) { 00556 PrintErrorMsg(NOEVAMSG,status); 00557 return; 00558 } 00559 00560 AlStatusMsgNoWait(STATUS_ROW_TOP,STATUS_ROW_BOTTOM,FALSE,"Formatting %s",sprintfBuffer); 00561 status = FmtFatFormat(sprintfBuffer,GetHiddenSectorCount(DiskNo,PartitionNo)); 00562 if (status == ESUCCESS) { 00563 SetSysID(DiskNo,PartitionNo,SYSID_BIGFAT); 00564 PrintMsg("Partition formatted successfully."); 00565 } else { 00566 PrintErrorMsg(NOFMTMSG,status); 00567 } 00568 } 00569 } 00570 00571 00572 VOID 00573 DoMakePartitionSystemPartition( 00574 VOID 00575 ) 00576 { 00577 BOOLEAN f,IsFAT; 00578 ULONG Disk,i,Choice; 00579 PVOID MenuID; 00580 PREGION_DESCRIPTOR Regions; 00581 ULONG RegionCount; 00582 ARC_STATUS status; 00583 char PartitionPath[256]; 00584 ULONG PartitionNumber; 00585 00586 00587 // take an existing partition and add it to the 00588 // list of system partitions. Also make sure it's 00589 // formatted as FAT. 00590 00591 if ((Disk = ChooseDisk()) == -1) { 00592 return; 00593 } 00594 00595 status = GetUsedDiskRegions(Disk,&Regions,&RegionCount); 00596 if (status != ESUCCESS) { 00597 PrintErrorMsg(NOCNFMSG,status); 00598 return; 00599 } 00600 00601 if (!RegionCount) { 00602 FreeRegionArray(Regions,RegionCount); 00603 PrintErrorMsg(NOPARMSG); 00604 return; 00605 } 00606 00607 if (!AlNewMenu(&MenuID)) { 00608 FreeRegionArray(Regions,RegionCount); 00609 MsgNoMem(); 00610 return; 00611 } 00612 00613 for(i=0; i<RegionCount; i++) { 00614 if (!IsExtended(Regions[i].SysID)) { 00615 sprintf(sprintfBuffer, 00616 "Partition %u (%u MB %s)", 00617 Regions[i].PartitionNumber, 00618 Regions[i].SizeMB, 00619 GetSysIDName(Regions[i].SysID) 00620 ); 00621 if (!AlAddMenuItem(MenuID,sprintfBuffer,i,0)) { 00622 MsgNoMem(); 00623 AlFreeMenu(MenuID); 00624 FreeRegionArray(Regions,RegionCount); 00625 return; 00626 } 00627 } 00628 } 00629 00630 f = AlDisplayMenu(MenuID,FALSE,0,&Choice,MENU_ROW,"Choose Partition"); 00631 AlFreeMenu(MenuID); 00632 if (!f) { // user escaped 00633 FreeRegionArray(Regions,RegionCount); 00634 return; 00635 } 00636 00637 PartitionNumber = Regions[Choice].PartitionNumber; 00638 sprintf(PartitionPath,"%spartition(%u)",GetDiskName(Disk),PartitionNumber); 00639 00640 FreeRegionArray(Regions,RegionCount); 00641 00642 if(IsBootSelectionPartition(SYSPARTVAR,Disk,PartitionNumber,NULL)) { 00643 PrintErrorMsg(ALREAMSG); 00644 return; 00645 } 00646 00647 status = FmtIsFat(PartitionPath,&IsFAT); 00648 if (status != ESUCCESS) { 00649 PrintErrorMsg(NOFILMSG,status); 00650 return; 00651 } 00652 00653 if (!IsFAT) { 00654 if (Confirm("System partitions must be formatted with the FAT filesystem.\r\n Do you wish to format the chosen partition") 00655 && Confirm("All existing data will be lost. Are you sure")) 00656 { 00657 status = FmtFatFormat(PartitionPath,GetHiddenSectorCount(Disk,PartitionNumber)); 00658 if (status != ESUCCESS) { 00659 PrintErrorMsg(NOFMTMSG,status); 00660 return; 00661 } 00662 SetSysID(Disk,PartitionNumber,SYSID_BIGFAT); 00663 } else { 00664 return; 00665 } 00666 } 00667 00668 // 00669 // Add to list of system partitions. 00670 // 00671 if ((status = AlAddSystemPartition(PartitionPath)) == ESUCCESS) { 00672 PrintMsg("Partition added successfully."); 00673 } else { 00674 PrintErrorMsg(NOEVAMSG,status); 00675 } 00676 } 00677 00678 00679 00680 VOID 00681 ConfigureSystemPartitions( 00682 VOID 00683 ) 00684 { 00685 ULONG Choice=0,DiskCount=GetDiskCount(); 00686 PVOID MenuID; 00687 00688 if (!AlNewMenu(&MenuID)) { 00689 MsgNoMem(); 00690 return; 00691 } 00692 00693 if (!AlAddMenuItems(MenuID,SysPartMenu,sizeof(SysPartMenu)/sizeof(PCHAR))) { 00694 MsgNoMem(); 00695 AlFreeMenu(MenuID); 00696 return; 00697 } 00698 00699 while(1) { 00700 00701 if ((!AlDisplayMenu(MenuID,FALSE,Choice,&Choice,MENU_ROW,"Configure System Partitions")) 00702 || (Choice == SYSPARTMENU_EXIT)) 00703 { 00704 break; 00705 } 00706 00707 switch(Choice) { 00708 00709 case SYSPARTMENU_CREATE: 00710 // create system partition. 00711 DoSystemPartitionCreate(); 00712 break; 00713 00714 case SYSPARTMENU_DELETE: 00715 // delete partition 00716 DoPartitionDelete(); 00717 break; 00718 00719 case SYSPARTMENU_ADD: 00720 // make existing into a system partition 00721 DoMakePartitionSystemPartition(); 00722 break; 00723 } 00724 } 00725 00726 AlFreeMenu(MenuID); 00727 }

Generated on Sat May 15 19:41:08 2004 for test by doxygen 1.3.7