home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / install / fips / source / fipsspec.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-11  |  4.1 KB  |  116 lines

  1. /* 
  2.     FIPS - the First nondestructive Interactive Partition Splitting program 
  3.  
  4.     Module fipsspec.cpp 
  5.  
  6.     RCS - Header: 
  7.     $Header: c:/daten/fips/source/main/RCS/fipsspec.cpp 1.1 1994/05/25 22:19:55 schaefer Exp schaefer $ 
  8.  
  9.     Copyright (C) 1993 Arno Schaefer 
  10.  
  11.     This program is free software; you can redistribute it and/or modify 
  12.     it under the terms of the GNU General Public License as published by 
  13.     the Free Software Foundation; either version 2 of the License, or 
  14.     (at your option) any later version. 
  15.  
  16.     This program is distributed in the hope that it will be useful, 
  17.     but WITHOUT ANY WARRANTY; without even the implied warranty of 
  18.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  19.     GNU General Public License for more details. 
  20.  
  21.     You should have received a copy of the GNU General Public License 
  22.     along with this program; if not, write to the Free Software 
  23.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  24.  
  25.  
  26.     Report problems and direct all questions to: 
  27.  
  28.     schaefer@rbg.informatik.th-darmstadt.de 
  29. */ 
  30.  
  31. #include "fipsspec.h" 
  32. #include "global.h" 
  33. #include <dos.h> 
  34.  
  35. #define DISK_INT 0x13 
  36.  
  37. #define RESET_DISK 0 
  38. #define GET_DRIVE_PARAMS 8 
  39.  
  40. void fips_bpb::print (void) 
  41.     printx ("Bytes per sector: %u\n",bytes_per_sector); 
  42.     printx ("Sectors per cluster: %u\n",sectors_per_cluster); 
  43.     printx ("Reserved sectors: %u\n",reserved_sectors); 
  44.     printx ("Number of FATs: %u\n",no_of_fats); 
  45.     printx ("Number of rootdirectory entries: %u\n",no_of_rootdir_entries); 
  46.     printx ("Number of sectors (short): %u\n",no_of_sectors); 
  47.     printx ("Media descriptor byte: %02Xh\n",media_descriptor); 
  48.     printx ("Sectors per FAT: %u\n",sectors_per_fat); 
  49.     printx ("Sectors per track: %u\n",sectors_per_track); 
  50.     printx ("Drive heads: %u\n",drive_heads); 
  51.     printx ("Hidden sectors: %lu\n",hidden_sectors); 
  52.     printx ("Number of sectors (long): %lu\n",no_of_sectors_long); 
  53.     printx ("Physical drive number: %02Xh\n",phys_drive_no); 
  54.     printx ("Signature: %02Xh\n\n",signature); 
  55.  
  56. void fips_partition_table::print (void) 
  57.     printx ("     |        |     Start      |      |      End       | Start  |Number of|\n"); 
  58.     printx ("Part.|bootable|Head Cyl. Sector|System|Head Cyl. Sector| Sector |Sectors  |  MB\n"); 
  59.     printx ("-----+--------+----------------+------+----------------+--------+---------+----\n"); 
  60.     for (int i=0;i<4;i++) 
  61.     { 
  62.         printx ("%u    |    %s |%4u %4u   %4u|   %02Xh|%4u %4u   %4u|%8lu| %8lu|%4lu\n",i+1, 
  63.         partition_info[i].bootable ? "yes" : " no", 
  64.         partition_info[i].start_head,partition_info[i].start_cylinder,partition_info[i].start_sector, 
  65.         partition_info[i].system,partition_info[i].end_head,partition_info[i].end_cylinder,partition_info[i].end_sector, 
  66.         partition_info[i].start_sector_abs,partition_info[i].no_of_sectors_abs,partition_info[i].no_of_sectors_abs / 2048); 
  67.     } 
  68.  
  69. void fips_harddrive::get_geometry (void) 
  70.     union REGS regs; 
  71.  
  72.     regs.h.ah = GET_DRIVE_PARAMS; 
  73.     regs.h.dl = number; 
  74.     int86 (DISK_INT,®s,®s); 
  75.     if (global.debug_mode) 
  76.     { 
  77.         fprintf (global.debugfile,"\nRegisters after call to int 13h 08h (drive %02Xh):\n\n",number); 
  78.         hexwrite ((byte *) ®s,16,global.debugfile); 
  79.     } 
  80.     if ((errorcode = regs.h.ah) != 0) return; 
  81.     geometry.heads = (dword) regs.h.dh + 1; 
  82.     geometry.sectors = (dword) regs.h.cl & 0x3f; 
  83.     geometry.cylinders = ((dword) regs.h.ch | (((dword) regs.h.cl << 2) & 0x300)) + 1; 
  84.  
  85. void fips_harddrive::reset (void) 
  86.     union REGS regs; 
  87.  
  88.     regs.h.ah = RESET_DISK; 
  89.     regs.h.dl = number; 
  90.     int86 (DISK_INT,®s,®s); 
  91.     if (global.debug_mode) 
  92.     { 
  93.         fprintf (global.debugfile,"\nRegisters after call to int 13h 00h (drive %02Xh):\n\n",number); 
  94.         hexwrite ((byte *) ®s,16,global.debugfile); 
  95.     } 
  96.     errorcode = regs.h.ah; 
  97.  
  98. void fips_logdrive_info::put_debug_info (void) 
  99.     fprintf (global.debugfile,"Calculated Partition Characteristica:\n\n"); 
  100.     fprintf (global.debugfile,"Start of FAT 1: %lu\n",start_fat1); 
  101.     fprintf (global.debugfile,"Start of FAT 2: %lu\n",start_fat2); 
  102.     fprintf (global.debugfile,"Start of Rootdirectory: %lu\n",start_rootdir); 
  103.     fprintf (global.debugfile,"Start of Data: %lu\n",start_data); 
  104.     fprintf (global.debugfile,"Number of Clusters: %lu\n",no_of_clusters); 
  105.  
  106.