hi guys ... its me again .. you know i finally did it .. i did it under dos ... using that damn TC ...
you know after solving the problem under 32 bit systems .. i decided to have such a challenge with dos based compilers such as TC ... and i did it (i think so ..)
before i gave you the code ,,, i have an request to you .. would you do me a favor and test it and tell me if it works well?!!!
A quintillion of thanks:d
The code is as :
Code:
//in the name of god
#include <stdio.h>
#include <process.h>
#include <string.h>
#include <conio.h>
#include <dos.h>
int main(void)
{
int j,i,k,start,sector;
char buf[512],ch;
clrscr();
gotoxy(27,5);
printf("In the name of God\n");
gotoxy(22,7);
printf("A S.Hossein hasan pour Project\n\n");
printf (" This program will show you the information stored on sector 0 of your hard Drive.\n if you are ready press any key to continue ");
for (k=0;k<=4;k++){
//delay(50);
printf("."); }
getch();
sector =0;
if (absread (0, 1, sector, buf)!=0)
{
printf ("Error");
exit(1);
}
printf("Read Successful!\n");
// fptr=fopen("D:\temp.fds","w");
// for (i=0;i<=1;i++)
// {
printf("\n\n Begining Of the readind Infos from floppy disk\n\n\n");
printf("\a Phase One is now being started\n\n\n");
for(j=0;j<=2;j++)
printf("Assembly Jump COde is: %#02x \n\n",buf[j]);
printf("OEM IS: %7s\n\n",&buf[j]);
for(j=11;j<12;j++);
printf("Bytes per sector: %d\n\n",buf[j]);
for(j=13;j<14;j++);
printf("sector per cluster is : %d\n\n",buf[j]);
for(j=14;j<15;j++)
printf("number of reserved sectors : %d\n\n",buf[j]);
for(j=16;j<17;j++)
printf("fat count : %d\n\n",buf[j]);
printf("\a\aPhase 2:get ready for the next infos, when readly press enter\n\n\n\n\n");
getch();
delay(1000);
for(j=17;j<18;j++)
printf("Max root entry is: %d\n\n",buf[j]);
for(j=19;j<=20;j++)
printf("Total number of sectors in file system is: %d\n\n\n ", buf[j]);
for(j=21;j<22;j++)
printf("Media Typeis:%#x\n\n",buf[j]);
printf("According to Microsoft 0xf8 for fixed disk and 0xf0 for removable disk\n\n\n");
for(j=22;j<23;j++)
printf("Sectors allocated for each File allocation table is: %d\n\n ",buf[j]);
for(j=24;j<25;j++)
printf("Sectors per track is: %d\n\n",buf[j]);
for(j=26;j<27;j++)
printf("Number of head in storage device is: %d\n\n",buf[j]);
printf("Phase 3: this is going to be the third part, get ready and press Enter\a\a\a\n\n\n");
getch();
delay(1000);
// for(j=28;j<=31;j++)
//printf("Number of sectors before start of partition(Not applicable for floppy)%d\n ",buf[j]);
// for(j=32;j<=35;j++)
// printf(" Number of sectors in file system(32-bit value, not applicable for floppy).%d\n",buf[j]);
for(j=36;j<37;j++)
printf("BIOS INT13h drive numberis: %d\n\n",buf[j]);
for(j=38;j<39;j++)
printf("Extended boot signature is: %#x\n\n",buf[j]);
for(j=39;j<=42;j++)
printf("Volume Serial Numberis %d\n",buf[j]);
for(j=43;j<=53;j++)
printf("Volume label in ASCII %11s\n\n",buf[j]);
for(j=54;j<=61;j++);
printf("File System Type %c\n\n",buf[j]);
printf("\a\a\a\aPhase 4:Now get ready for the boot sector infos \n\n\n");
getch();
printf(" Boot Code, otherwise contains information to replace disk( in Assembly codes)\n\n");
for(j=65;j<=509;j++)
printf("%#x",buf[j]);
for(j=510;j<511;j++)
printf("\n\nSignature for File System is: %#x\n\n\n",buf[j]);
printf(" Programed By S. H Hasan Pour\n");
printf(" Date: November 12th 2007 equals to 20 Aban 1386");
getch();
return 0;
}