⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userint2.c

📁 Fdisk 1.2.1 Freedos下硬盘分区软件
💻 C
📖 第 1 页 / 共 4 页
字号:

	  /* Display volume label */
	  printf(" %11s",pDrive->log_drive[index-4].vol_label);
	  }
	else printf("               ");

	/* Display size in MB */
	printf("  ");
	Print_UL(pDrive->log_drive[(index-4)].size_in_MB);

	/* Display file system type */
	printf("  %-8s",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);

	printf("  %3d%%",usage);

	printf("\n");
	}

      index++;
      }while(index<27);
    }
}

/* 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)");
}

/* Display Or Modify Logical Drive Information in the extended partition */
void Display_Or_Modify_Logical_Drive_Information()
{
  char char_number[1];

  int continue_loop;
  int index;
  int input;
  int input_ok;
  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  Beginning:

  Clear_Screen(NOEXTRAS);

  if(flags.extended_options_flag==FALSE)
   Print_Centered(1,"Display Logical DOS Drive Information",BOLD);
  else Print_Centered(1,"Display/Modify Logical DOS Drive Information",BOLD);

  Display_Extended_Partition_Information_SS();

  if(flags.extended_options_flag==FALSE)
   Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
  else
    {
    printAt(4,18,"Enter the character of the logical drive you want to modify.....?");

    Determine_Drive_Letters();

    continue_loop=TRUE;
    do
      {
      flags.esc=FALSE;

      if( (flags.del_non_dos_log_drives==TRUE) && (pDrive->num_of_non_dos_log_drives>0) )
        {
        if(pDrive->num_of_non_dos_log_drives>9) pDrive->num_of_non_dos_log_drives=9;
        itoa(pDrive->num_of_non_dos_log_drives,char_number,10);
        input=(int)Input(1,69,18,CHAR,68,90,ESCC,0,0,"1",char_number);
        }
      else input=(int)Input(1,69,18,CHAR,68,90,ESCC,0,0,NULL,NULL);

      if(flags.esc==FALSE)
        {
        /* Ensure that the entered character is legitimate. */
        index=4;
        do
          {
          if( (drive_lettering_buffer[(flags.drive_number-128)] [index]>0) && (drive_lettering_buffer[(flags.drive_number-128)] [index]==input) )
            {
            input=index-4;
            input_ok=TRUE;
            index=30; /* break out of the loop */
            }

            index++;
	  }while(index<=26);
        }

      if(input_ok==TRUE) continue_loop=FALSE;
      if(flags.esc==TRUE) continue_loop=FALSE;

      }while(continue_loop==TRUE);

    if( (input_ok==TRUE) && (flags.esc==FALSE) )
      {
      Modify_Extended_Partition_Information(input);
      goto Beginning;
      }
    }
}

/* Display/Modify Partition Information */
void Display_Partition_Information()
{
  int input;
  Partition_Table *pDrive = &part_table[flags.drive_number-0x80];

  Beginning:

  Clear_Screen(0);
  if(flags.extended_options_flag==FALSE)
   Print_Centered(4,"Display Partition Information",BOLD);
  else Print_Centered(4,"Display/Modify Partition Information",BOLD);

  Display_Primary_Partition_Information_SS();

  if(pDrive->num_of_log_drives>0)
    {
    printAt(4,17,"The Extended DOS Partition contains Logical DOS Drives.");
    printAt(4,18,"Do you want to display the logical drive information (Y/N)......?");

    if(flags.extended_options_flag==TRUE)
      {
      printAt(4,19,"  (Optional:  Type the number of the partition to modify.)");

      input=(int)Input(1,69,18,YN,0,0,ESCR,1,0,"1","4");

      if( ((input-48)>=1) && ((input-48)<=4) )
        {
        Modify_Primary_Partition_Information((input-48));
        goto Beginning;
        }
      }
    else input=(int)Input(1,69,18,YN,0,0,ESCR,1,0,NULL,NULL);

    if(input==TRUE)
      {
      Display_Or_Modify_Logical_Drive_Information();
      if(flags.extended_options_flag==TRUE) goto Beginning;
      }
    }
  else
    {
    if(flags.extended_options_flag==FALSE)
     Input(0,0,0,ESC,0,0,ESCC,0,0,NULL,NULL);
    else
     {
     printAt(4,18,"Enter the number of the partition you want to modify (1-4)......?");

     flags.esc=FALSE;
     input=(int)Input(1,69,18,NUM,1,4,ESCR,1,0,NULL,NULL);

     if(flags.esc==FALSE)
       {
       Modify_Primary_Partition_Information(input);
       goto Beginning;
       }
     }
    }
}

/* 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)");
}

/* Dump the partition tables from all drives to screen */
void Dump_Partition_Information()
{
  int index=0;
  //flags.extended_options_flag=TRUE;

  do
    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -