📄 userint2.c
字号:
flags.drive_number=index+128;
Display_CL_Partition_Table();
index++;
}while(index<=7);
}
/* 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);
}
/* Modify Extended Partition Information */
void Modify_Extended_Partition_Information(int logical_drive_number)
{
int finished=FALSE;
int input;
unsigned long usage;
Partition_Table *pDrive = &part_table[flags.drive_number-0x80];
do
{
Clear_Screen(0);
Print_Centered(4,"Display/Modify Logical Drive Information",BOLD);
Determine_Drive_Letters();
printAt(6,6,"Current fixed disk drive: ");
cprintf("%d",(flags.drive_number-127));
printAt(4,8,"Partition Mbytes Description Usage Start Cyl End Cyl");
/* Drive Letter of Partition */
if( IsRecognizedFatPartition(pDrive->log_drive[logical_drive_number].num_type))
{
cprintAt(5,9,"%c:",drive_lettering_buffer[(flags.drive_number-128)]
[(logical_drive_number+4)]);
}
/* Partition Number */
printAt(8,9,"%d",(logical_drive_number+1));
/* Partition Type */
printAt(10,9,"%3d",(pDrive->log_drive[logical_drive_number].num_type));
/* Mbytes */
Position_Cursor(24,9);
Print_UL(pDrive->log_drive[logical_drive_number].size_in_MB);
/* Description */
printAt(33,9,"%15s",partition_lookup_table_buffer_long
[pDrive->log_drive[logical_drive_number].num_type]);
/* Usage */
usage
= Convert_To_Percentage(
pDrive->log_drive[logical_drive_number].size_in_MB,
pDrive->ext_part_size_in_MB);
printAt(51,9,"%3d%%",usage);
/* Starting Cylinder */
printAt(59,9,"%4d",pDrive->log_drive[logical_drive_number].start_cyl);
/* Ending Cylinder */
printAt(69,9,"%4d",pDrive->log_drive[logical_drive_number].end_cyl);
printAt(4,12,"Choose one of the following:");
cprintAt(4,14,"1."); printf(" Change partition type");
cprintAt(4,15,"2."); printf(" List partition types");
cprintAt(44,14,"3.");printf(" Hide/Unhide partition");
/*
cprintAt(44,15,"4.");
printf(" Reserved for future use.");
*/
printAt(4,17,"Enter choice: ");
flags.esc=FALSE;
input=(int)Input(1,19,17,NUM,1,3,ESCC,-1,0,NULL,NULL);
if(flags.esc==TRUE)
{
input=99;
finished=TRUE;
}
if(input==1)
{
/* Change partition type */
printAt(4,19,"Enter new partition type (1-255)...................................");
flags.esc=FALSE;
input=(int)Input(3,71,19,NUM,1,255,ESCC,-1,0,NULL,NULL);
if(flags.esc==FALSE)
{
pDrive->log_drive[logical_drive_number].num_type=input;
pDrive->part_values_changed=TRUE;
flags.partitions_have_changed=TRUE;
input=99;
}
else input=99;
}
if(input==2)
{
List_Partition_Types();
}
if(input==3)
{
/* Hide/Unhide partition */
if(pDrive->log_drive[logical_drive_number].num_type<=31)
{
pDrive->log_drive[logical_drive_number].num_type ^= 16;
pDrive->part_values_changed=TRUE;
flags.partitions_have_changed=TRUE;
input=99;
}
}
if(input==4)
{
/* Reserved */
}
}while(finished==FALSE);
}
/* Modify Primary Partition Information */
void Modify_Primary_Partition_Information(int partition_number)
{
int finished=FALSE;
int input;
unsigned long usage;
Partition_Table *pDrive = &part_table[flags.drive_number-0x80];
partition_number--; /* Adjust partition number to start with 0. */
do
{
Clear_Screen(0);
Print_Centered(4,"Display/Modify Partition Information",BOLD);
Determine_Drive_Letters();
printAt(4,6,"Current fixed disk drive: ");
cprintf("%d",(flags.drive_number-127));
printAt(4,8,"Partition Status Mbytes Description Usage Start Cyl End Cyl");
/* Drive Letter of Partition */
if( IsRecognizedFatPartition(pDrive->pri_part[partition_number].num_type==1))
{
printAt(5,9,"%c:",drive_lettering_buffer[(flags.drive_number-128)] [partition_number]);
}
/* Partition Number */
cprintAt(8,9,"%d",(partition_number+1));
/* Partition Type */
printAt(10,9,"%3d",(pDrive->pri_part[partition_number].num_type));
/* Status */
if(pDrive->pri_part[partition_number].active_status>0)
{
printAt(19,9,"A");
}
/* Mbytes */
Position_Cursor(24,9);
Print_UL(pDrive->pri_part[partition_number].size_in_MB);
/* Description */
printAt(33,9,"%15s",partition_lookup_table_buffer_long[pDrive->pri_part[partition_number].num_type]);
/* Usage */
usage
= Convert_To_Percentage(
pDrive->pri_part[partition_number].size_in_MB,
pDrive->total_hard_disk_size_in_MB);
printAt(51,9,"%3d%%",usage);
/* Starting Cylinder */
printAt(59,9,"%4d",pDrive->pri_part[partition_number].start_cyl);
/* Ending Cylinder */
printAt(69,9,"%4d",pDrive->pri_part[partition_number].end_cyl);
printAt(4,12,"Choose one of the following:");
cprintAt(4,14,"1."); printf(" Change partition type");
cprintAt(4,15,"2."); printf(" List partition types");
cprintAt(44,14,"3.");printf(" Hide/Unhide partition");
cprintAt(44,15,"4.");printf(" Remove active status");
printAt(4,17,"Enter choice: ");
flags.esc=FALSE;
input=(int)Input(1,19,17,NUM,1,4,ESCC,-1,0,NULL,NULL);
if(flags.esc==TRUE)
{
input=99;
finished=TRUE;
}
if(input==1)
{
/* Change partition type */
printAt(4,19,"Enter new partition type (1-255)...................................");
flags.esc=FALSE;
input=(int)Input(3,71,19,NUM,1,255,ESCC,-1,0,NULL,NULL);
if(flags.esc==FALSE)
{
Modify_Partition_Type(partition_number,input);
input=99;
}
else input=99;
}
if(input==2)
{
List_Partition_Types();
}
if(input==3)
{
/* Hide/Unhide partition */
if(pDrive->pri_part[partition_number].num_type<=31 )
{
pDrive->pri_part[partition_number].num_type ^= 16;
pDrive->part_values_changed=TRUE;
flags.partitions_have_changed=TRUE;
input=99;
}
}
if(input==4)
{
/* Remove active status */
Clear_Active_Partition();
}
}while(finished==FALSE);
}
/* Set Active Partition Interface */
int Set_Active_Partition_Interface()
{
int index=0;
int input;
int available_partition_counter=0;
int first_available_partition_active=FALSE;
int only_active_partition_active=FALSE;
int partition_settable[4];
Partition_Table *pDrive = &part_table[flags.drive_number-0x80];
/* Check to see if other partitions that can be set active exist.*/
/* Also check to see what partitions are available to set active.*/
do
{
partition_settable[index]=FALSE;
if( (pDrive->pri_part[index].num_type==1)
|| (pDrive->pri_part[index].num_type==4)
|| (pDrive->pri_part[index].num_type==6)
|| ( ( (pDrive->pri_part[index].num_type==0x0b)
|| (pDrive->pri_part[index].num_type==0x0c) )
&& ( (flags.version==W95B) || (flags.version==W98) ) )
|| ( (pDrive->pri_part[index].num_type==0x0e)
&& ( (flags.version==W95) || (flags.version==W95B)
|| (flags.version==W98) ) )
&& (flags.set_any_pri_part_active==FALSE) )
{
available_partition_counter++;
if( (available_partition_counter==1)
&& (pDrive->pri_part[index].active_status==0x80) )first_available_partition_active=TRUE;
partition_settable[index]=TRUE;
}
if( (pDrive->pri_part[index].num_type>0)
&& (flags.set_any_pri_part_active==TRUE) )
{
available_partition_counter++;
if( (available_partition_counter==1)
&& (pDrive->pri_part[index].active_status==0x80) )
first_available_partition_active=TRUE;
partition_settable[index]=TRUE;
}
index++;
}while(index<=3);
if( (available_partition_counter==1) && (first_available_partition_active==TRUE) ) only_active_partition_active=TRUE;
Clear_Screen(0);
Print_Centered(4,"Set Active Partition",BOLD);
Display_Primary_Partition_Information_SS();
if(available_partition_counter==0)
{
cprintAt(4,22,"No partitions to make active.");
Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
}
if( (only_active_partition_active==FALSE) && (available_partition_counter>0) )
{
printAt(4,16,"Enter the number of the partition you want to make active...........: ");
for(;;)
{
flags.esc=FALSE;
input=(int)Input(1,70,16,NUM,1,4,ESCR,-1,0,NULL,NULL);
if(flags.esc==TRUE) return(1);
/* Ensure that input is valid. */
if(partition_settable[(input-1)]==TRUE)
break;
else
{
cprintAt(4,23,"%d is not a choice. Please enter a valid choice.",input);
}
}
Set_Active_Partition(input-1);
Clear_Screen(0);
Print_Centered(4,"Set Active Partition",BOLD);
/* */
Display_Primary_Partition_Information_SS();
Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
}
if(only_active_partition_active==TRUE)
{
cprintAt(4,22,"The only startable partition on Drive %d is already set active.",(flags.drive_number-127));
Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
}
return(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -