how to edit the fat-table from pascal 
Author Message
 how to edit the fat-table from pascal

Quote:

> Hi!

> How can I edit the fat-table from Pascal?

This is done using int 25h/26h to read and write logical sectors, with the
following assumptions:  1.) you understand the function and format of the FAT
tables, and 2.) you're willing to assume liablity for whatever may come of
your data if you attempt to edit it.

Which of course leads me to wonder for what purpose you'd want to do this.

Quote:
> Regards
> Jens Axelsen

--
Scott Earnest            | SPAM protection in effect. Remove  |





Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal
Hi!

How can I edit the fat-table from Pascal?

Regards
Jens Axelsen



Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal
Scott Earnest schrieb:

Quote:
> This is done using int 25h/26h to read and write logical sectors, with the
> following assumptions:  1.) you understand the function and format of the FAT
> tables, and 2.) you're willing to assume liablity for whatever may come of
> your data if you attempt to edit it.

> Which of course leads me to wonder for what purpose you'd want to do this.

ThunderByte anti-virus uses these interrupts to read the FAT avoiding DOS.
Maybe he would like to write such a program too? ;-)


Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal

Quote:

> Scott Earnest schrieb:

> > [...]
> > Which of course leads me to wonder for what purpose you'd want to do this.

> ThunderByte anti-virus uses these interrupts to read the FAT avoiding DOS.
> Maybe he would like to write such a program too? ;-)

<soapbox>
Anti-virus programs generally do not ever even look at the FAT -- there's no
need to as the tables contain no executable code.  They *will* however use int
25h to read logical sector 0 (boot sector); the MBR is outside the scope of
logical sectors and must be read via int 13h.

An anti-virus program is a complex undertaking for an individual -- anyone who
would attempt such a thing without an already strong knowledge of low-level
I/O such as a viral program would use is undertaking a fool's errand; it's
putting the cart before the horse.

Any software house working on such a thing should already have programming
resources and ideally would have no need to question about such a fundamental
part of the DOS system.

I'd have to guess at the curious amateur.  The FAT in its own right is not a
terribly informative beast.  The boot sector, the root directory, and the
subdirectories all work together to give the FAT table context.  There's no
point in looking into the FAT without needing to understand the other items as
well.

Do I personally discourage this sort of curiosity?  Absolutely not!  I think
it's good that someone would take the time to be interested in how the system
works.  BUT it's not simple work.  There are a number of complex data
structures, and code should be checked thoroughly -- int 25h and 26h both have
an odd quirk which requires attention and if isn't taken care of will most
likely hang the system (lending to frustration and possibly vaporized code if
the programmer doesn't think to save often).  This isn't simplified any when
you consider that these interrupt calls have forms for handling FAT12 and
FAT16 volumes, and the FAT structure in each is different (12-bit FAT entries
mean tht two entries are stored to every three bytes).

However, I have a problem with handing out information on this.  I'm not an
authorative source, and I have no desire to be treated as one and be liable
for either introducing errors into information or providing information that
another person would use improperly or incorrectly and cause damage.  The best
I can do is provide general hints.  Those who really want to learn and
understand will take it upon themselves to take the hints and start
researching to find all the necessary details from authorative sources with
proper disclaimers.  It's all easy to find by looking, and the vast majority
of it is completely free.
</soapbox>

One more useful hint to the person who started this thread:  Ralf Brown's
Interrupt List.  Current release is 59.  This reference should be easy to find
with just about any popular search engine.

--
Scott Earnest            | SPAM protection in effect. Remove  |





Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal
Scott Earnest schrieb:

Quote:
> <soapbox>
> Anti-virus programs generally do not ever even look at the FAT -- there's no
> need to as the tables contain no executable code.  They *will* however use int
> 25h to read logical sector 0 (boot sector); the MBR is outside the scope of
> logical sectors and must be read via int 13h.

Well, I guess ThunderByte wants to avoid calling Int 21h and its
FindFirst/FindNext functions because a virus could have hooked Int 21h and would
therefore be able to interfere with the scanning process. Especially directory
stealth viruses, like DIR-II. So it uses Int 25h to read and interpret the FAT.
There is a compatibility switch that makes TbScan use the standard Int 21h
functions.
Probably, Int 25h is also faster.

Quote:
> An anti-virus program is a complex undertaking for an individual -- anyone who
> would attempt such a thing without an already strong knowledge of low-level
> I/O such as a viral program would use is undertaking a fool's errand; it's
> putting the cart before the horse.

Sure. No larger program is an undertaking for a hobby programmer. Or has anybody
already written a 100 MB database on his own? :-)

Quote:
> I'd have to guess at the curious amateur.  The FAT in its own right is not a
> terribly informative beast.  The boot sector, the root directory, and the
> subdirectories all work together to give the FAT table context.  There's no
> point in looking into the FAT without needing to understand the other items as
> well.

The anti-virus professionals used to be curious amateurs too.

Quote:
> Do I personally discourage this sort of curiosity?  Absolutely not!  I think
> it's good that someone would take the time to be interested in how the system
> works.  BUT it's not simple work.  There are a number of complex data
> structures, and code should be checked thoroughly -- int 25h and 26h both have
> an odd quirk which requires attention and if isn't taken care of will most
> likely hang the system (lending to frustration and possibly vaporized code if
> the programmer doesn't think to save often).  This isn't simplified any when
> you consider that these interrupt calls have forms for handling FAT12 and
> FAT16 volumes, and the FAT structure in each is different (12-bit FAT entries
> mean tht two entries are stored to every three bytes).

Does it matter from whom he gets code? You would only provide him with
information, not with the request to thrash other people's hard disks.


Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal

03:09:40 in comp.lang.pascal.borland, Scott Earnest

Quote:

>One more useful hint to the person who started this thread:  Ralf Brown's
>Interrupt List.  Current release is 59.  This reference should be easy to find
>with just about any popular search engine.

Those who are omniscient in Pascal tend to forget the FAQs :=).

References in
Newsgroups: comp.lang.pascal.borland Subject: clpb Mini-FAQ V1.07
and TSFAQP, for a start.

--

  Web <URL: http://www.merlyn.demon.co.uk/> - TP/BP/&c. FAQqish topics & links.
  Timo's TurboPascal <A HREF="ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip">FAQ</A>.
  <A HREF="http://www.merlyn.demon.co.uk/clpb-faq.txt">Mini-FAQ</A> of c.l.p.b.



Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal
: > How can I edit the fat-table from Pascal?
:
: This is done using int 25h/26h to read and write logical sectors,
:
: Which of course leads me to wonder for what purpose you'd want to do this.
:
How a disk repair utility?  (Please?)
I'm tired of telling students with virus-damaged FAT tables that there
is nothing I can do.  There is no problem salvaging and rebuilding
damaged AmigaDOS disks.  Why can't I find the same utilities for MS-DOS?
 _
|/   |\/|                               //\MIGA



Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal
Well, I'm just doing this to get more knowledge on fat.

Could you write a tiny example?

Quote:


>> Hi!

>> How can I edit the fat-table from Pascal?

>This is done using int 25h/26h to read and write logical sectors, with the
>following assumptions:  1.) you understand the function and format of the
FAT
>tables, and 2.) you're willing to assume liablity for whatever may come of
>your data if you attempt to edit it.

>Which of course leads me to wonder for what purpose you'd want to do this.

>> Regards
>> Jens Axelsen

>--
>Scott Earnest            | SPAM protection in effect. Remove  |






Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal

Quote:

> Well, I'm just doing this to get more knowledge on fat.

The most suitable way for a beginner to get an understanding of FAT is to get
a reliable sector-level disk utility and examine the data structures on the
disk.  One that has a read-only mode is particularly good.  If you have Norton
Utilities 7, it comes with a DiskEdit program which is excellent for the job.
It also shows you the structure of the directory entry, indicating the first
FAT entry.  Once you've looked it over and figured out how the FAT tables
figure into the system, you can then decide if attempting to write code to
work with the FAT would be of any real use to you.

Quote:
> Could you write a tiny example?

No, I won't.  Please read my recent post on this thread to see why.  Also,
there's no such thing as *tiny* example in this context -- a fair amount of
code is required to do anything even slightly useful or informative.

--
Scott Earnest            | SPAM protection in effect. Remove  |





Wed, 18 Jun 1902 08:00:00 GMT  
 how to edit the fat-table from pascal

Quote:

> Those who are omniscient in Pascal tend to forget the FAQs :=).

Then there are some of us who put faith in the common-sense intelligence of
the reader to actually have sought out and read the FAQ.  :-)  OTOH, I suppose
if more people read the FAQs in the first place, we wouldn't be up to our
belly buttons in RTE200 questions.

Quote:

>   Web <URL: http://www.merlyn.demon.co.uk/> - TP/BP/&c. FAQqish topics & links.
>   Timo's TurboPascal <A HREF="ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip">FAQ</A>.
>   <A HREF="http://www.merlyn.demon.co.uk/clpb-faq.txt">Mini-FAQ</A> of c.l.p.b.

--
Scott Earnest            | SPAM protection in effect. Remove  |





Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Win95 FAT Table

2. PARADOX TABLE SORTING vs TABLE EDIT CONFLICT

3. I can't edit table where I join two table (SQL 6.5)

4. edit table in access table

5. Editing Ascii Tables Question?

6. Sometimes can't post table edits

7. How edit a sorted tables?

8. Paradox Table not in edit mode - a Philosophy

9. Referencing the table currently being edited

10. Table jumps outs edit mode newby

11. Two tables in EDIT/INSERT mode???

12. Editing Multiple Tables in a DBGrid

 

 
Powered by phpBB® Forum Software