| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | [4/6] Fat |
>>> Part 4 of 6...
}
return 0;
}
int GetDpb(int drive)
{
union REGS inregs,outregs;struct SREGS sregs;
char FAR* p;
inregs.h.ah = 0x32;
inregs.h.dl = drive; /* 0 default drv,1 = A, 2 = B, etc.. */
intdosx(&inregs,&outregs,&sregs);
if(outregs.x.cflag) return 0;
if(outregs.h.al) return 0;
p = (char FAR*) MK_FP((unsigned)sregs.ds,(unsigned)outregs.x.bx);
printf("\nDPB Address = %p\n",p);
memcpy(&dpb,p,sizeof(struct DriveParamBlock));
return 1;
}
int GetBoot(int Gbdrive,int mode)
{
UCHAR *boot;int j,p = 0;
FILE *out;
if(Gbdrive != dpb.Driveno)
{
printf ("Drive mismatch !");
return 0;
}
boot = (UCHAR*)calloc(dpb.Bpersec,sizeof(UCHAR));
if(NULL == boot) {printf("\nNot enough memory");return 0;}
if(mode == FATSAVE)
{
sprintf(fname,"boot%c.dat\0",(dpb.Driveno + 'A'));
out = fopen(fname,"wb");
if(out == NULL) {perror("\nError opening file");return 0;}
printf("\n\n");
}
else fprintf(stream,"\n Boot Sector..");
if (AbsRead(dpb.Driveno,0,1 , boot) != 1)
{perror("\nDisk read error"); return 0;}
if(mode == FATSAVE || PrintFlag == 1)
{
printf("\rSector 0 Read OK....");
if(!PrintFlag)
for(j = 0; j < dpb.Bpersec;j++) p += fwrite(&boot[j],1,1,out);
else if(PrintFlag == 1) p = dpb.Bpersec;
printf("Written %03d bytes OK",p);
p = 0;
}
if(mode == FATSHOW)
{
ShowSector(0,boot);
}
free(boot);
if(mode == FATSAVE )
{
fclose(out);
printf("\nBoot saved OK to %s.",fname);
}
else
fprintf(stream,"\nEnd of boot sector.\n");
if(!PrintFlag && mode != FATSAVE)
{
printf("\nPress any key to go on..");
while(!GetKey());
printf("\rFat starts here.. ");
}
return 1;
}
int GetFat(int drive,int fatnum,int mode)
{
UCHAR *fat;
int startsector,endsector,i, j , p = 0;
FILE *out;
if(drive != dpb.Driveno)
{
printf ("Drive mismatch !");
return 0;
}
if(fatnum == 2 && dpb.NumFats == 1)
>>> Continued to next message...
___ Blue Wave/DOS v2.21
---
* Origin: Melbourne PC User Group BBS (3:632/309)SEEN-BY: 3/103 50/99 620/243 623/630 632/50 107 108 309 348 360 371 504 525 SEEN-BY: 632/530 533 562 633/371 634/388 396 635/301 502 503 544 728 639/252 SEEN-BY: 711/409 410 413 430 808 809 932 934 712/515 713/317 714/906 800/1 @PATH: 632/309 107 635/503 50/99 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.