Board index » delphi » Direct reading of filenames?

Direct reading of filenames?

I would like to know how do I read filenames in directories directly
(without using dos interrupts)?

 

Re:Direct reading of filenames?


Quote
> I would like to know how do I read filenames in directories directly
> (without using dos interrupts)?

   FindFirst and FindNext is one way.  

Re:Direct reading of filenames?


JRS:  In article <7celvj$kk...@winter.news.rcn.net> of Sat, 13 Mar 1999
21:40:03 in news:comp.lang.asm.x86, Mike Copeland <mrc...@primenet.com>
wrote:
Quote
>> I would like to know how do I read filenames in directories directly
>> (without using dos interrupts)?

>   FindFirst and FindNext is one way.  

Unfortunately, that shows the dangers of injudicious cross-posting by a
thread initiator, Mike; I expect that response was written in the
newsgroup comp.lang.pascal.borland.

The TP/BP procedures FindFirst & FindNext undoubtedly call the
interrupts 21/4E & 21/4F.

Coding it directly without using 4E/4F will be a lengthy task, IMHO,
worthy of the guru-denizens of this group (clax).

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v4.00    MIME.
  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.

Re:Direct reading of filenames?


Quote
Mike Copeland wrote:
> > I would like to know how do I read filenames in directories directly
> > (without using dos interrupts)?

>    FindFirst and FindNext is one way.

Which are wrappers for DOS interrupts, so no go.

You could use an algorithm to convert cluster values to cylinder/head/sector
coordinates and use int 13h (an interrupt, but not a DOS interrupt) to read
all your data, and extract information as needed.  But what you'd be doing
then is essentially recreating what the DOS kernel does.  Which leads me to my
next question . . . why?

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:Direct reading of filenames?


Quote
Scott Earnest wrote in message <7cgdpk$lam...@winter.news.rcn.net>...
|Mike Copeland wrote:

|
|> > I would like to know how do I read filenames in directories directly
|> > (without using dos interrupts)?
|>
|>    FindFirst and FindNext is one way.
|
|Which are wrappers for DOS interrupts, so no go.
|
|You could use an algorithm to convert cluster values to cylinder/head/sector
|coordinates and use int 13h (an interrupt, but not a DOS interrupt) to read
|all your data, and extract information as needed.  But what you'd be doing
|then is essentially recreating what the DOS kernel does.  Which leads me to my
|next question . . . why?

Because it's fun to understand everything?

Re:Direct reading of filenames?


Quote
Dr John Stockton wrote:

> JRS:  In article <7celvj$kk...@winter.news.rcn.net> of Sat, 13 Mar 1999
> 21:40:03 in news:comp.lang.asm.x86, Mike Copeland <mrc...@primenet.com>
> wrote:
> >> I would like to know how do I read filenames in directories directly
> >> (without using dos interrupts)?

> >   FindFirst and FindNext is one way.

> Unfortunately, that shows the dangers of injudicious cross-posting by a
> thread initiator, Mike; I expect that response was written in the
> newsgroup comp.lang.pascal.borland.

> The TP/BP procedures FindFirst & FindNext undoubtedly call the
> interrupts 21/4E & 21/4F.

> Coding it directly without using 4E/4F will be a lengthy task, IMHO,
> worthy of the guru-denizens of this group (clax).

Sorry for crossposting, I didn't notice it.

But wouldn't it be nice to have a searcher which scans 10Gb HD within few
secs?;)

--
|  Algirdas 'Ze{*word*104}' Kepezinskas
|  E-Mail: cy...@vil.ktu.lt
|  ICQ 14187537
|  URL: http://www.botepidemic.com/fmods
+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*++*+*+*+*
|  If time is killing you
|                   kill some for time..

Re:Direct reading of filenames?


In article <7cebu9$1u...@winter.news.rcn.net>, N...@{*word*104}dude.com
says...

Quote

> I would like to know how do I read filenames in directories directly
> (without using dos interrupts)?

I posted a (rather long) description of how to go about this a while
back -- you might want to look on Deja News for it.  If you can't find
it there, send me some email, and I'll see if I have a copy around to
send; otherwise, I s'pose I could re-create it if necessary.

A _really_ quick summary might not hurt though:

If you want to do it without DOS interrupts AT ALL, you have to use
the BIOS.  You start by reading the disk's partition table to find
where the partition of interest starts.  You read the boot sector of
that partition to find the root directory and the FAT.  You then
search through the root directory to find the first part of the path
you're interested in.  The directory entry tells you the cluster
number of the beginning of the file/directory.  You use the FAT to
find the rest of the clusters that make up the file/directory.

A subdirectory is basically just a normal file, containing a specified
directory entry structure.  Using the BIOS, you can simply read the
sectors that make up a cluster, and you'll have as many directory
entry structures as fit in that amount of space (which can vary,
depending on the size of clusters involved).

IOW, to find something like "c:\this\that\other.txt", you start with
the partition table to find where the "C:" partition starts.  In the
root directory, you find an entry named "this".  That will tell you
where on the disk the directory file lives.  You read in those
sectors, and find an entry named "that".  Do the same again to find
"other.txt", which will really be formatted as "OTHER    TXT".  In
each case, the directory entry tells you the cluster number of the
start of the file/directory.  If you're using the BIOS, you'll have to
convert that to a sector number before you can feed it to the BIOS.

Re:Direct reading of filenames?


Good reply.  He asked how, not why or why not.  Sometimes the journey is the
real adventure.--Rob

Re:Direct reading of filenames?


Quote
wbinvd wrote:
> Scott Earnest wrote in message <7cgdpk$lam...@winter.news.rcn.net>...
> |Mike Copeland wrote:
> |
> |> > I would like to know how do I read filenames in directories directly
> |> > (without using dos interrupts)?
> |>
> |>    FindFirst and FindNext is one way.
> |
> |Which are wrappers for DOS interrupts, so no go.
> |
> |You could use an algorithm to convert cluster values to cylinder/head/sector
> |coordinates and use int 13h (an interrupt, but not a DOS interrupt) to read
> |all your data, and extract information as needed.  But what you'd be doing
> |then is essentially recreating what the DOS kernel does.  Which leads me to my
> |next question . . . why?

> Because it's fun to understand everything?

I can accept and appreciate that *if* that's the reason.  There are other
possible reasons, some of which might not be so good.  So, I still ask why,
and to what end?  The original question is rather inpsecific with regard to
necessity and/or application.

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:Direct reading of filenames?


setech@_ix.netcom.com says...

Quote
> Mike Copeland wrote:
> > > I would like to know how do I read filenames in directories directly
> > > (without using dos interrupts)?

> >    FindFirst and FindNext is one way.

> Which are wrappers for DOS interrupts, so no go.

> You could use an algorithm to convert cluster values to cylinder/head/sector
> coordinates and use int 13h (an interrupt, but not a DOS interrupt) to read
> all your data, and extract information as needed.  But what you'd be doing
> then is essentially recreating what the DOS kernel does.  Which leads me to my
> next question . . . why?

Why ask why?

It allows him to create a boot disk that can read a DOS disk without DOS.

Anyhow, I would recommend downloading FreeDOS, and looking through the
source code to see how they did it.

--
Paul Hsieh
q...@pobox.com

Re:Direct reading of filenames?


Quote
Scott Earnest wrote in message <7cj667$7f...@winter.news.rcn.net>...
>I can accept and appreciate that *if* that's the reason.  There are other
>possible reasons, some of which might not be so good.  So, I still ask why,
>and to what end?  The original question is rather inpsecific with regard to
>necessity and/or application.

Although I'm not the original poster, but I personally would be interested
in having something that can read long file name from disks without having
Win9x loaded on it :) How about that ?

<.sig is being worked on>

Other Threads