/* Delete Non-DOS Partition User Interface */ void Delete_N_DOS_Partition_Interface() { int input=0; Clear_Screen(0); Print_Centered(4,"Delete Non-DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); BlinkPrintAt(4,18,"WARNING!"); printf(" Data in the deleted Non-DOS Partition will be lost."); printAt(4,19,"What Non-DOS Partition do you want to delete..? "); flags.esc=FALSE; input=(int)Input(1,52,19,NUM,1,4,ESCR,-1,0,NULL,NULL); /* 4 needs changed to the max num of partitions */ if(flags.esc==FALSE) { Delete_Primary_Partition(input-1); Clear_Screen(0); Print_Centered(4,"Delete Non-DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); cprintAt(4,21,"Non-DOS Partition deleted"); printAt(4,24," "); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); } }
/* Delete Extended DOS Partition Interface */ void Delete_Extended_DOS_Partition_Interface() { int input=0; Partition_Table *pDrive = &part_table[flags.drive_number-0x80]; Clear_Screen(0); Print_Centered(4,"Delete Extended DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); BlinkPrintAt(4,18,"WARNING!"); printf(" Data in the deleted Extended DOS Partition will be lost."); printAt(4,19,"Do you wish to continue (Y/N).................? "); flags.esc=FALSE; input=(int)Input(1,52,19,YN,0,0,ESCR,0,0,NULL,NULL); if( (flags.esc==FALSE) && (input==TRUE) ) { Delete_Primary_Partition(int(pDrive->ptr_ext_part-pDrive->pri_part)); Clear_Extended_Partition_Table(flags.drive_number-128); Clear_Screen(0); Print_Centered(4,"Delete Extended DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); cprintAt(4,21,"Extended DOS Partition deleted"); printAt(4,24," "); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); } }
/* Delete Primary DOS Partition Interface */ void Delete_Primary_DOS_Partition_Interface() { int input=0; int partition_to_delete; Clear_Screen(0); Print_Centered(4,"Delete Primary DOS Partition",BOLD); Display_Primary_Partition_Information_SS(); BlinkPrintAt(4,19,"WARNING!"); printf(" Data in the deleted Primary DOS Partition will be lost."); printAt(4,20,"What primary partition do you want to delete..? "); flags.esc=FALSE; input=(int)Input(1,52,20,NUM,1,4,ESCR,-1,0,NULL,NULL); /* 4 needs changed to the max num of partitions */ if(flags.esc==FALSE) { partition_to_delete=input-1; printAt(4,22,"Are you sure (Y/N)..............................? "); flags.esc=FALSE; input=(int)Input(1,54,22,YN,0,0,ESCR,0,0,NULL,NULL); if( (input==TRUE) && (flags.esc==FALSE) ) { Delete_Primary_Partition(partition_to_delete); Clear_Screen(0); Print_Centered(4,"Delete Primary DOS Partition",BOLD); /* */ Display_Primary_Partition_Information_SS(); cprintAt(4,21,"Primary DOS Partition deleted"); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); } } }
/* List the Partition Types */ void List_Partition_Types() { int index=0; int row=4; int column=0; do { if( (index==0) || (index==64) || (index==128) || (index==192) ) { Clear_Screen(0); Print_Centered(1,"List Partition Types",BOLD); row=4; column=0; } if( row==20 ) { row=4; column += 20; } cprintAt(column,row,"%3d ",index); printf("%s",partition_lookup_table_buffer_long[index]); if( (index==63) || (index==127) || (index==191) || (index==255) ) { printAt(0,23,"Press ");cprintf("Any Key");printf(" to continue"); asm{ mov ah,7 int 0x21 } } row++; index++; }while(index<=255);
/* Get input from keyboard */ unsigned long Input(int size_of_field,int x_position,int y_position,int type ,int min_range,long max_range,int return_message,long default_value ,long maximum_possible_percentage,char optional_char_1[1],char optional_char_2[1]) { /* size_of_field: number of characters for the user to enter, if size of field is 0 then no input box is drawn on the screen. x_position, y_position: screen coordinates to place the input box type type of input--CHAR A single character as specified by min_range and max_range. min_range and max_range are the min. and max. ASCII values possible for this input field. The ASCII values in these 2 fields should be of capital characters only. If the user enters a lower case character it will be converted to uppercase. YN Either a yes or no. NUM A number as specified by min_range and max_range. NUMP A number or percentage within the limits of the size_of_field. ESC Waits for the ESC key only return_message ESCR Displays "Press Esc to return to FDISK Options" ESCE Displays "Press Esc to exit FDISK" ESCC Displays "Press Esc to continue" NONE Does not display a return message. default_value The default value that is displayed for input. This option only works with the NUM type or the YN type. Set this to -1 if it is not used. maximum_possible_percentage If type is NUMP, this is the maximum percentage possible. optional_char_1[1] and optional_char_2[1] 2 optional character fields for use with the NUM type when size_of_field==1 Also is used as two option number fields (converted to char value) when type==CHAR and a single digit numeric input is possible. In this case these two variables define a range. When type==YN this functions the same as with NUM type above. */ char input; char line_buffer[18]; unsigned long multiplier; int char_max_range; int default_value_preentered=FALSE; int index; int invalid_input=FALSE; int line_buffer_index=0; int proper_input_given=FALSE; int percent_entered=FALSE; int percent_just_entered=FALSE; unsigned long data_max_range=max_range; unsigned long data; /* Clear line buffer */ index=0; do { line_buffer[index]=0; index++; }while(index<10); /* Place appropriate text on the screen prior to obtaining input */ if(type!=ESC) { Position_Cursor(x_position,y_position); cprintf("["); index=0; do { cprintf(" "); index++; }while(index<size_of_field); cprintf("]"); } /* Display the return message */ if( (return_message==ESCR) || (return_message==ESCE) || (return_message==ESCC) ) { printAt(4,24," "); printAt(4,24,catgets(cat,4,1,"Press")); cprintf(" Esc "); printf(catgets(cat,4,2,"to")); printf(" "); } if(return_message==ESCR) printf(catgets(cat,4,3,"return to FDISK options")); if(return_message==ESCE) printf(catgets(cat,4,4,"exit FDISK")); if(return_message==ESCC) printf(catgets(cat,4,5,"continue")); /* Set the default value for NUM type, if applicable */ if( (default_value>=0) && (type==NUM) && (size_of_field==1) ) { Position_Cursor(x_position+1,y_position); printf("%d",default_value); line_buffer_index=0; line_buffer[0]=default_value+48; } /* Set the default value for NUMP type, if applicable */ if( (default_value>=0) && (type==NUMP) && (size_of_field>1) ) { ltoa(default_value,line_buffer,10); line_buffer_index=strlen(line_buffer); /* Display line_buffer */ index=line_buffer_index; do { Position_Cursor((x_position+size_of_field-line_buffer_index+index) ,y_position); index--; cprintf("%c",line_buffer[index]); }while(index>0); default_value_preentered=TRUE; } /* Set the default value for YN type, if applicable */ if( (default_value>=0) && (type==YN) && (size_of_field==1) ) { Position_Cursor(x_position+1,y_position); if(default_value==1) { printf("Y"); line_buffer_index=0; line_buffer[0]='Y'; data=TRUE; } if(default_value==0) { printf("N"); line_buffer_index=0; line_buffer[0]='N'; data=FALSE; } } do { if(type!=ESC) Position_Cursor((size_of_field+x_position),y_position); /* Obtain keypress from keyboard */ asm{ mov ah,7 int 0x21 mov BYTE PTR input,al } /* Zero the default value if type==NUMP, the enter, esc, or backspace key */ /* has not been pressed, and the default value is pre-entered. */ if( (default_value>=0) && (type==NUMP) && (size_of_field>1) && (input!=8) && (input!=13) && (input!=27) && (default_value_preentered==TRUE) ) { line_buffer_index=0; index=0; do { line_buffer[index]=0; index++; }while(index<10); default_value_preentered=FALSE; } /* Clear error messages from screen */ if(type!=YN) { printAt(4,22," "); } printAt(4,23," "); Position_Cursor(4,24); /* Esc key has been hit */ if(input==27) { flags.esc=TRUE; proper_input_given=TRUE; data=0; type=99; } /* Enter key has been hit */ if(input==13) { if( ( (type==CHAR) || (type==YN) ) && (line_buffer[0]!=0) && ( (data==TRUE) || (data==FALSE) || (data!=99) ) ) { proper_input_given=TRUE; type=99; } if( (type==NUMYN) && (line_buffer[0]!=0) ) { data=line_buffer[0]; proper_input_given=TRUE; type=99; } if( (type==CHARNUM) && (line_buffer[0]!=0) ) { proper_input_given=TRUE; data=line_buffer[0]; type=99; } if( (type==NUMCHAR) && (line_buffer[0]!=0) ) { proper_input_given=TRUE; data=line_buffer[0]; type=99; } if( (type==NUM) && (line_buffer[0]!=0) ) { proper_input_given=TRUE; /* Convert line_buffer to an unsigned integer in data */ data=0; index=strlen(line_buffer)-1; multiplier=1; do { data=data+((line_buffer[index]-48)*multiplier); index--; multiplier=multiplier*10; }while(index>=0); /* Make sure that data is <= max_range */ if(data>data_max_range) { data=0; proper_input_given=FALSE; cprintAt(4,22,catgets(cat,4,6,"Requested partition size exceeds the maximum available space")); /* Set input=0xff to avoid processing this time around */ input='\xff'; } else type=99; } if( (type==NUMP) && (line_buffer[0]!=0) ) { proper_input_given=TRUE; /* Convert line_buffer to an unsigned integer in data */ data=0; index=strlen(line_buffer)-1; if(percent_entered==TRUE) index--; multiplier=1; do { data=data+((line_buffer[index]-48)*multiplier); index--; multiplier=multiplier*10; }while(index>=0); if(percent_entered==TRUE) data=(data*data_max_range)/maximum_possible_percentage; /* Make sure that data is <= max_range */ if(data>data_max_range) { data=0; proper_input_given=FALSE; cprintAt(4,22,catgets(cat,4,6,"Requested partition size exceeds the maximum available space")); /* Set input=0xff to avoid processing this time around */ input='\xff'; } else type=99; } #ifdef DEBUG if( (debug.input_routine==TRUE) && (type==99) ) { Clear_Screen(NULL); printf("Input entered by user: %d",data); Pause(); } #endif } #ifdef DEBUG if(debug.input_routine==TRUE) { printAt(50,22," "); printAt(50,22,"Input: %d",input); } #endif /* Process the backspace key if type==CHARNUM. */ if( (type==CHARNUM) && (input==8) ) { type=NUM; input='\xff'; line_buffer[0]='0'; line_buffer_index=1; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } /* Process a legitimate entry if type==CHARNUM. */ if( (type==CHARNUM) && ( ((input-48)>=1) && ((input-48)<=max_range) ) ) { type=NUM; line_buffer[0]='0'; line_buffer_index=1; } if( (type==CHARNUM) && ( (input==optional_char_1[0]) || ( (input-32)==optional_char_1[0]) || (input==optional_char_2[0]) || ( (input-32)==optional_char_2[0]) ) ) { if(input>=97) input=input-32; line_buffer_index=1; line_buffer[0]=input; input='\xff'; type=CHARNUM; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } /* Process a legitimate entry if type==NUMYN. */ if( (type==NUMYN) && ( (input=='Y') || (input=='N') || (input=='y') || (input=='n') ) ) { type=YN; line_buffer[0]=' '; line_buffer_index=1; } /* Process a legitimate entry if type==NUMCHAR. */ if( (type==NUMCHAR) && (optional_char_1[0]!=NULL) && (optional_char_2[0]!=NULL) ) { char_max_range=atoi(optional_char_2); if( (input>='1') && (input<=(char_max_range+48)) ) { line_buffer_index=1; line_buffer[0]=input; type=NUMCHAR; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } if( (input<'1') || (input>(char_max_range+48)) ) { line_buffer_index=0; line_buffer[0]=0; type=CHAR; } } /* Process optional character fields. */ if( (type==NUM) && ( (optional_char_1[0]!=NULL) || (optional_char_2[0]!=NULL) ) ) { if( (input==optional_char_1[0]) || ( (input-32)==optional_char_1[0]) ) { if(input>=97) input=input-32; line_buffer_index=1; line_buffer[0]=input; input='\xff'; type=CHARNUM; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } if( (input==optional_char_2[0]) || ( (input-32)==optional_char_2[0]) ) { if(input>=97) input=input-32; line_buffer_index=1; line_buffer[0]=input; input='\xff'; type=CHARNUM; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } } if( (type==CHAR) && (optional_char_1[0]!=NULL) && (optional_char_2[0]!=NULL) ) { char_max_range=atoi(optional_char_2); if( (input>='1') && (input<=(char_max_range+48)) ) { line_buffer_index=1; line_buffer[0]=input; type=NUMCHAR; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } } if( ( (type==YN) || (type==NUMYN) ) && (optional_char_1[0]!=NULL) && (optional_char_2[0]!=NULL) ) { char_max_range=atoi(optional_char_2); if( (input>='1') && (input<=(char_max_range+48)) ) { line_buffer_index=1; line_buffer[0]=input; type=NUMYN; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } } if(type==CHAR) { /* Convert to upper case, if necessary. */ if(input>=97) input=input-32; if( (input>=min_range) && (input<=max_range) ) { line_buffer[0]=input; data=input; } else { proper_input_given=FALSE; line_buffer[0]=' '; data=99; Position_Cursor(4,23); cprintf("Invalid entry, please enter %c-",min_range); cprintf("%c.",max_range); } Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } /* Process the backspace key if type==NUMCHAR. */ if( (type==NUMCHAR) && (input==8) ) { type=CHAR; line_buffer[0]=' '; line_buffer_index=1; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } if(type==YN) { switch (input) { case 'Y': line_buffer[0]='Y'; data=TRUE; break; case 'y': line_buffer[0]='Y'; data=TRUE; break; case 'N': line_buffer[0]='N'; data=FALSE; break; case 'n': line_buffer[0]='N'; data=FALSE; break; default: proper_input_given=FALSE; line_buffer[0]=' '; data=99; cprintAt(4,23,catgets(cat,4,7,"Invalid entry, please enter Y-N.")); } Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } /* Process the backspace key if type==NUMYN. */ if( (type==NUMYN) && (input==8) ) { type=YN; line_buffer[0]=' '; line_buffer_index=1; Position_Cursor((x_position+1),y_position); cprintf("%c",line_buffer[0]); } if( (type==NUM) && (input!='\xff') ) { /* If the backspace key has not been hit. */ if(input!=8) { invalid_input=FALSE; if(size_of_field>1) { min_range=0; max_range=9; } if( (input>='0') && (input<='9') )input=input-48; else { if(input<10) input=11; } if( ( (size_of_field>1) && (input>max_range) ) || (input>9) ) { proper_input_given=FALSE; cprintAt(4,23,"Invalid entry, please enter %d-%d.",min_range,max_range); invalid_input=TRUE; } if( (size_of_field==1) && ( (input<min_range) || ( (input>max_range) && (input<10) ) ) ) { proper_input_given=FALSE; cprintAt(4,23,"%d is not a choice, please enter ",input); cprintf("%d-%d.",min_range,max_range); invalid_input=TRUE; } if( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field>1) ) { proper_input_given=FALSE; cprintAt(4,23,catgets(cat,4,8,"Invalid entry.")); invalid_input=TRUE; } if( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field==1) ) { line_buffer_index=0; } if(invalid_input==FALSE) { if( (line_buffer_index==1) && (line_buffer[0]=='0') ) { line_buffer[0]=0; line_buffer_index=0; } line_buffer[line_buffer_index]=(input+48); line_buffer_index++; } } else { /* If the backspace key has been hit */ line_buffer_index--; if(line_buffer_index<0) line_buffer_index=0; line_buffer[line_buffer_index]=0; if(line_buffer_index==0) { line_buffer[0]='0'; line_buffer_index=1; } } /* Clear text box before displaying line_buffer */ index=0; do { Position_Cursor((x_position+1+index),y_position); printf(" "); index++; }while(index<size_of_field); /* Display line_buffer */ index=line_buffer_index; do { Position_Cursor((x_position+size_of_field-line_buffer_index+index),y_position); index--; cprintf("%c",line_buffer[index]); }while(index>0); } if( (type==NUMP) && (input!='\xff') ) { /* If the backspace key has not been hit. */ if(input!=8) { invalid_input=FALSE; if(size_of_field>1) { min_range=0; max_range=9; } if( (input=='%') && (percent_entered==FALSE) ) { percent_entered=TRUE; percent_just_entered=TRUE; } if( (input>='0') && (input<='9') )input=input-48; else { if(input<10) input=11; } if( (percent_entered==FALSE) && (percent_just_entered==FALSE) && ( ( (size_of_field>1) && (input>max_range) ) || (input>9) ) ) { proper_input_given=FALSE; cprintAt(4,23,"Invalid entry, please enter %d-%d.",min_range,max_range); invalid_input=TRUE; } if( (percent_entered==FALSE) && (size_of_field==1) && ( (input<min_range) || ( (input>max_range) && (input<10) ) ) ) { proper_input_given=FALSE; cprintAt(4,23,"%d is not a choice, please enter ",input); cprintf("%d-%d.",min_range,max_range); invalid_input=TRUE; } if( ( (percent_entered==TRUE) && (percent_just_entered==FALSE) ) || ( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field>1) ) ) { proper_input_given=FALSE; cprintAt(4,23,catgets(cat,4,8,"Invalid entry.")); invalid_input=TRUE; } if( (invalid_input==FALSE) && (line_buffer_index==size_of_field) && (size_of_field==1) ) { line_buffer_index=0; } if(invalid_input==FALSE) { if( (line_buffer_index==1) && (line_buffer[0]=='0') ) { line_buffer[0]=0; line_buffer_index=0; } if(percent_just_entered==TRUE) { percent_just_entered=FALSE; line_buffer[line_buffer_index]='%'; line_buffer_index++; } else { line_buffer[line_buffer_index]=(input+48); line_buffer_index++; } } } else { /* If the backspace key has been hit */ line_buffer_index--; if(line_buffer_index<0) line_buffer_index=0; line_buffer[line_buffer_index]=0; if(line_buffer_index==0) { line_buffer[0]='0'; line_buffer_index=1; } if(percent_entered==TRUE) percent_entered=FALSE; } /* Clear text box before displaying line_buffer */ index=0; do { Position_Cursor((x_position+1+index),y_position); printf(" "); index++; }while(index<size_of_field); /* Display line_buffer */ index=line_buffer_index; do { Position_Cursor((x_position+size_of_field-line_buffer_index+index),y_position); index--; cprintf("%c",line_buffer[index]); }while(index>0); } #ifdef DEBUG if(debug.input_routine==TRUE) { printAt(60,23," "); printAt(60,24," "); printAt(50,23,"Line Buffer: %10s",line_buffer); printAt(50,24,"Line Buffer Index: %d",line_buffer_index); if(percent_entered==TRUE) { printAt(75,24,"P"); } else { printAt(75,24," "); } } #endif /* Place brackets back on screen as a precautionary measure. */ if(type!=ESC) { Position_Cursor(x_position,y_position); cprintf("["); Position_Cursor((x_position+size_of_field+1),y_position); cprintf("]"); } }while(proper_input_given==FALSE); return(data); }
/* Display Extended Partition Information Sub Screen */ void Display_Extended_Partition_Information_SS() { int column_index=0; int index; int print_index=4; unsigned long usage; Partition_Table *pDrive = &part_table[flags.drive_number-0x80]; Determine_Drive_Letters(); /* Check to see if there are any drives to display */ if( (brief_partition_table[(flags.drive_number-128)] [4]>0) || (brief_partition_table[(flags.drive_number-128)] [5]>0) ) { printAt(0,3,"Drv Volume Label Mbytes System Usage"); /* Display information for each Logical DOS Drive */ index=4; print_index=4; do { if(print_index>15) { column_index=41; print_index=4; printAt(41,3,"Drv Volume Label Mbytes System Usage"); } if(brief_partition_table[(flags.drive_number-128)] [index]>0) { if( IsRecognizedFatPartition(brief_partition_table[(flags.drive_number-128)] [index])) { /* Display drive letter */ cprintAt(column_index+0,print_index,"%c",drive_lettering_buffer[(flags.drive_number-128)] [index]); cprintAt(column_index+1,print_index,":"); /* Display volume label */ printAt(column_index+4,print_index,"%11s",pDrive->log_drive[index-4].vol_label); } else { if(flags.del_non_dos_log_drives==TRUE) { /* Display drive number */ cprintAt(column_index+0,print_index,"%c",drive_lettering_buffer[(flags.drive_number-128)] [index]); } } /* Display size in MB */ Position_Cursor((column_index+17),print_index); Print_UL(pDrive->log_drive[(index-4)].size_in_MB); /* Display file system type */ printAt(column_index+25,print_index,"%s", partition_lookup_table_buffer_short[pDrive->log_drive[(index-4)].num_type]); /* Display usage in % */ usage = Convert_To_Percentage(pDrive->log_drive[index-4].num_sect, pDrive->ext_part_num_sect); printAt(column_index+35,print_index,"%3d%%",usage); print_index++; } index++; }while(index<27); } else { cprintAt(4,10,"No logical drives defined"); } printAt(4,17,"Total Extended DOS Partition size is "); if( (flags.version==W95) || (flags.version==W95B) || (flags.version==W98) ) Print_UL_B(part_table[flags.drive_number-128].ext_part_size_in_MB); else cprintf("%4d",(part_table[flags.drive_number-128].ext_part_size_in_MB) ); printf(" Mbytes (1 Mbyte = 1048576 bytes)"); }
/* Returns a 0 if successful and a 1 if unsuccessful */ int Create_Logical_Drive_Interface() { long input=0; int drive_created=FALSE; int maximum_possible_percentage; int numeric_type; long maximum_partition_size_in_MB; Partition_Table *pDrive = &part_table[flags.drive_number-0x80]; Determine_Free_Space(); if(pDrive->ext_part_largest_free_space>=2) { do { if(flags.fprmt==TRUE) flags.fat32=TRUE; maximum_partition_size_in_MB = Max_Log_Part_Size_In_MB(); Clear_Screen(0); if(drive_created==TRUE) { cprintAt(4,22,"Logical DOS Drive created, drive letters changed or added"); } Print_Centered(1,"Create Logical DOS Drive in the Extended DOS Partition",BOLD); Display_Extended_Partition_Information_SS(); if('Z'==Determine_Drive_Letters()) { printAt(4,22," "); cprintAt(4,22,"Maximum number of Logical DOS Drives installed."); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); if(flags.fprmt==TRUE) flags.fat32=FALSE; return(1); } printAt(4,17,"Total Extended DOS Partition size is "); if( (flags.version==4) || (flags.version==5) || (flags.version==6) ) cprintf("%4d",pDrive->ext_part_size_in_MB); else Print_UL_B(pDrive->ext_part_size_in_MB); printf(" Mbytes (1 Mbyte = 1048576 bytes)"); printAt(4,18,"Maximum space available for partition is "); if( (flags.version==4) || (flags.version==5) || (flags.version==6) ) cprintf("%4d",maximum_partition_size_in_MB); else Print_UL_B(maximum_partition_size_in_MB); printf(" Mbytes "); maximum_possible_percentage = Convert_To_Percentage(maximum_partition_size_in_MB ,pDrive->ext_part_size_in_MB); cprintf("(%3d%%)",maximum_possible_percentage); printAt(4,20,"Enter logical drive size in Mbytes or percent of disk space (%)..."); flags.esc=FALSE; if( (flags.version==4) || (flags.version==5) || (flags.version==6) ) input=Input(4,70,20,NUMP,1,maximum_partition_size_in_MB,ESCR ,maximum_partition_size_in_MB,maximum_possible_percentage,NULL,NULL); else input=Input(6,70,20,NUMP,1,maximum_partition_size_in_MB,ESCR ,maximum_partition_size_in_MB,maximum_possible_percentage,NULL,NULL); if(flags.esc==TRUE) { if(flags.fprmt==TRUE) flags.fat32=FALSE; return(1); } if( (flags.fprmt==TRUE) && (input>=128) && (input<=2048) ) { printAt(4,21,"This drive is a FAT32 by default, switch to FAT16 (Y/N)? "); flags.fat32=!Input(1,61,21,YN,0,0,NONE,1,0,NULL,NULL); } numeric_type=6; numeric_type=Partition_Type_To_Create(input,numeric_type); Create_Logical_Drive(numeric_type,input); drive_created=TRUE; }while(pDrive->ext_part_largest_free_space>=2); } Clear_Screen(0); Print_Centered(1,"Create Logical DOS Drive in the Extended DOS Partition",BOLD); Display_Extended_Partition_Information_SS(); cprintAt(4,22,"All available space in the Extended DOS Partition"); cprintAt(4,23,"is assigned to logical drives."); Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL); if(flags.fprmt==TRUE) flags.fat32=FALSE; return(0); }
/* Display Primary Partition information Sub-screen */ void Display_Primary_Partition_Information_SS() { int cursor_offset=0; int index=0; char *type; unsigned long usage=0; Partition_Table *pDrive = &part_table[flags.drive_number-0x80]; Determine_Drive_Letters(); printAt(4,6,"Current fixed disk drive: "); cprintf("%d",(flags.drive_number-127)); if( (pDrive->pri_part[0].num_type>0) || (pDrive->pri_part[1].num_type>0) || (pDrive->pri_part[2].num_type>0) || (pDrive->pri_part[3].num_type>0) ) { if(flags.extended_options_flag==FALSE) { printAt(4,8,"Partition Status Type Volume Label Mbytes System Usage"); for (index=0; index < 4; index++) { if(pDrive->pri_part[index].num_type>0) { /* Drive Letter of Partition */ if( IsRecognizedFatPartition(pDrive->pri_part[index].num_type) ) { printAt(5,(cursor_offset+9),"%c:",drive_lettering_buffer[(flags.drive_number-128)] [index]); } /* Partition Number */ cprintAt(8,(cursor_offset+9),"%d",(index+1)); /* Status */ if(pDrive->pri_part[index].active_status>0) { printAt(18,(cursor_offset+9),"A"); } /* Type */ type = "Non-DOS"; if( IsRecognizedFatPartition(pDrive->pri_part[index].num_type) ) { type = "PRI DOS"; } else if(pDrive->pri_part[index].num_type==5) { type = "EXT DOS"; } else if( (pDrive->pri_part[index].num_type==0x0f) && ( flags.version==W95 || flags.version==W95B || flags.version==W98 ) ) { type = "EXT DOS"; } printAt(23,(cursor_offset+9),type); /* Volume Label */ printAt(33,(cursor_offset+9),"%11s",pDrive->pri_part[index].vol_label); /* Mbytes */ Position_Cursor(45,(cursor_offset+9)); Print_UL(pDrive->pri_part[index].size_in_MB); /* System */ printAt(54,(cursor_offset+9),"%s",partition_lookup_table_buffer_short[pDrive->pri_part[index].num_type]); /* Usage */ usage = Convert_To_Percentage(pDrive->pri_part[index].size_in_MB, pDrive->total_hard_disk_size_in_MB); printAt(65,(cursor_offset+9),"%3d%%",usage); cursor_offset++; } } /* while(index<4);*/ } else { printAt(4,8,"Partition Status Mbytes Description Usage Start Cyl End Cyl"); for (index=0; index < 4; index++) { if(pDrive->pri_part[index].num_type>0) { /* Drive Letter of Partition */ if (IsRecognizedFatPartition (pDrive->pri_part[index].num_type)) { printAt(5,(cursor_offset+9),"%c:",drive_lettering_buffer[flags.drive_number-128] [index]); } /* Partition Number */ cprintAt(8,(cursor_offset+9),"%d",index+1); /* Partition Type */ printAt(10,(cursor_offset+9),"%3d",pDrive->pri_part[index].num_type); /* Status */ if(pDrive->pri_part[index].active_status>0) { printAt(19,(cursor_offset+9),"A"); } /* Mbytes */ Position_Cursor(24,(cursor_offset+9)); Print_UL(pDrive->pri_part[index].size_in_MB); /* Description */ printAt(33,(cursor_offset+9),"%15s",partition_lookup_table_buffer_long[pDrive->pri_part[index].num_type]); /* Usage */ usage = Convert_To_Percentage(pDrive->pri_part[index].size_in_MB, pDrive->total_hard_disk_size_in_MB); printAt(51,(cursor_offset+9),"%3d%%",usage); /* Starting Cylinder */ printAt(59,(cursor_offset+9),"%4d",pDrive->pri_part[index].start_cyl); /* Ending Cylinder */ printAt(69,(cursor_offset+9),"%4d",pDrive->pri_part[index].end_cyl); cursor_offset++; } } /*while(index<4);*/ } } else { cprintAt(4,21,"No partitions defined"); } printAt(4,14,"Total disk space is "); if( (flags.version==W95) || (flags.version==W95B) || (flags.version==W98) ) Print_UL_B(pDrive->total_hard_disk_size_in_MB); else cprintf("%4d",pDrive->total_hard_disk_size_in_MB); printf(" Mbytes (1 Mbyte = 1048576 bytes)"); }