Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Writing to FAT32 in dasd mode

4 views
Skip to first unread message

Allan

unread,
Dec 4, 2009, 5:01:09 PM12/4/09
to

Hey ho....

Trying to do some read and write in DASD mode using
DosOpen/DosRead/DosWrite.

A test app Opens, and Reads 1'st sector of partition, and Writes it back.
Works fine on FAT, HPFS and JFS

Trying on a FAT32 partition, DosWrite returns Error 5
Whats wrong with FAT32 ?

--
Allan.

It is better to close your mouth, and look like a fool,
than to open it, and remove all doubt.

Marcel Müller

unread,
Dec 4, 2009, 6:28:32 PM12/4/09
to
Allan wrote:
> Trying on a FAT32 partition, DosWrite returns Error 5

Access denied as far as I remember.

> Whats wrong with FAT32 ?

Maybe the first sector is virtualized for some reason.
Maybe you must detach the file system first.


Marcel

Allan

unread,
Dec 5, 2009, 7:20:26 AM12/5/09
to
On Fri, 4 Dec 2009 23:28:32 UTC, Marcel M�ller <news.5...@spamgourmet.com> wrote:

> Allan wrote:
> > Trying on a FAT32 partition, DosWrite returns Error 5
>
> Access denied as far as I remember.

Exactly.

> > Whats wrong with FAT32 ?
>
> Maybe the first sector is virtualized for some reason.
> Maybe you must detach the file system first.

I forgot to say, that I do lock the device first.
Anyway, doing exactly the same on FAT, HPFS and JFS works fine.

Doug Bissett

unread,
Dec 5, 2009, 3:04:28 PM12/5/09
to
On Sat, 5 Dec 2009 12:20:26 UTC, "Allan" <all...@warpspeed.dyndns.dk>
wrote:

> On Fri, 4 Dec 2009 23:28:32 UTC, Marcel M�ller <news.5...@spamgourmet.com> wrote:
>
> > Allan wrote:
> > > Trying on a FAT32 partition, DosWrite returns Error 5
> >
> > Access denied as far as I remember.
>
> Exactly.
>
> > > Whats wrong with FAT32 ?
> >
> > Maybe the first sector is virtualized for some reason.
> > Maybe you must detach the file system first.
>
> I forgot to say, that I do lock the device first.
> Anyway, doing exactly the same on FAT, HPFS and JFS works fine.

Have you tried it without cachef32.exe enabled? There are definitely
some problems with the FAT32 cache, and I find that I don't see those
problems when I don't use it. Not using it doesn't seem to make much
difference in performance either, in fact, it may actually be better
without it.

--
From the eComStation of Doug Bissett
dougb007 at telus dot net
(Please make the obvious changes, to e-mail me)

Lars Erdmann

unread,
Dec 5, 2009, 3:34:03 PM12/5/09
to
Allan schrieb:

> On Fri, 4 Dec 2009 23:28:32 UTC, Marcel M�ller <news.5...@spamgourmet.com> wrote:
>
>> Allan wrote:
>>> Trying on a FAT32 partition, DosWrite returns Error 5
>> Access denied as far as I remember.
>
> Exactly.
>
>>> Whats wrong with FAT32 ?
>> Maybe the first sector is virtualized for some reason.
>> Maybe you must detach the file system first.
>
> I forgot to say, that I do lock the device first.
> Anyway, doing exactly the same on FAT, HPFS and JFS works fine.
>
I remember that the handling of the logical/physical disk locking IOCTL
was wrong in FAT32 (somebody confused this with locking a removable
media in the drive which obviously is a completely different pair of
shoes). I fixed that for some version of FAT32 but introduced other
problems.
Then Ko Myung-Hun reverted to an older version of FAT32 while trying to
keep some of the changes (the working ones) I had made in order to
improve speed.
Maybe he then overlooked the fixes I had done in FS_IOCTL (FS entry
point for FS related IOCTL calls).
You should address this to Yahoo groups:
http://tech.groups.yahoo.com/group/fat32dev

or try to contact Ko directly (however, I don't have an email address).


Lars

Allan

unread,
Dec 5, 2009, 4:47:28 PM12/5/09
to
On Sat, 5 Dec 2009 20:34:03 UTC, Lars Erdmann <lars.e...@arcor.de> wrote:

> > I forgot to say, that I do lock the device first.
> > Anyway, doing exactly the same on FAT, HPFS and JFS works fine.
> >
> I remember that the handling of the logical/physical disk locking IOCTL
> was wrong in FAT32 (somebody confused this with locking a removable
> media in the drive which obviously is a completely different pair of
> shoes). I fixed that for some version of FAT32 but introduced other
> problems.

Yes, the IOCTL functions are even worse than DosWrite in DASD mode.
I tried that first - but while it read from the expected partition, it writes to
another one !

> Then Ko Myung-Hun reverted to an older version of FAT32 while trying to
> keep some of the changes (the working ones) I had made in order to
> improve speed.
> Maybe he then overlooked the fixes I had done in FS_IOCTL (FS entry
> point for FS related IOCTL calls).
> You should address this to Yahoo groups:
> http://tech.groups.yahoo.com/group/fat32dev

Hmm, I some time ago tried to subscribe to that, but was rejected :-)
I'll try again.

> or try to contact Ko directly (however, I don't have an email address).

I think it is in docs for FAT32.

Anyway, thx for the hints.

Lars Erdmann

unread,
Dec 6, 2009, 3:49:08 AM12/6/09
to
Hallo Allan,

If you are a programmer or just interested, EVERYBODY can have a look at
the FAT32 sources:
http://svn.netlabs.org/fat32/browser/trunk/src


> On Sat, 5 Dec 2009 20:34:03 UTC, Lars Erdmann <lars.e...@arcor.de> wrote:
>
>>> I forgot to say, that I do lock the device first.
>>> Anyway, doing exactly the same on FAT, HPFS and JFS works fine.
>>>
>> I remember that the handling of the logical/physical disk locking IOCTL
>> was wrong in FAT32 (somebody confused this with locking a removable
>> media in the drive which obviously is a completely different pair of
>> shoes). I fixed that for some version of FAT32 but introduced other
>> problems.
>
> Yes, the IOCTL functions are even worse than DosWrite in DASD mode.
> I tried that first - but while it read from the expected partition, it writes to
> another one !

If you want to see how IOCTL calls are handled, go here:
http://svn.netlabs.org/fat32/browser/trunk/src/fat32.c
and jump to routine "int far pascal FS_IOCTL"
Looking at the source, I think that we need to replace the call to
FSH_DOVOLIO2 with FSH_DEVIOCTL call because the later is explicitely
meant to execute logical disk IOCTL calls (category 08h calls).


If you want to see what DosWrite does, go here:
http://svn.netlabs.org/fat32/browser/trunk/src/ifsfile.c
and jump to routine "int far pascal FS_WRITE"
It handles all the different "facets": file access, sector based access,
access to complete partition.

>
>> Then Ko Myung-Hun reverted to an older version of FAT32 while trying to
>> keep some of the changes (the working ones) I had made in order to
>> improve speed.
>> Maybe he then overlooked the fixes I had done in FS_IOCTL (FS entry
>> point for FS related IOCTL calls).
>> You should address this to Yahoo groups:
>> http://tech.groups.yahoo.com/group/fat32dev

See above, as far as I can tell he kept my FS_IOCTL changes but maybe
the FSH helper call has to be replaced.

>
> Hmm, I some time ago tried to subscribe to that, but was rejected :-)
> I'll try again.

You have to have cookies enabled in order to access the Yahoo site (at
least for that site).


Can you publish a stripped down code sample here of what you are doing ?

Lars

Allan

unread,
Dec 6, 2009, 7:54:26 AM12/6/09
to
On Sun, 6 Dec 2009 08:49:08 UTC, Lars Erdmann <lars.e...@arcor.de> wrote:

> If you are a programmer or just interested, EVERYBODY can have a look at
> the FAT32 sources:
> http://svn.netlabs.org/fat32/browser/trunk/src

It is way beyond me to understand what goes on there :-)



> >> You should address this to Yahoo groups:
> >> http://tech.groups.yahoo.com/group/fat32dev
>

> > Hmm, I some time ago tried to subscribe to that, but was rejected :-)
> > I'll try again.
>
> You have to have cookies enabled in order to access the Yahoo site (at
> least for that site).

I'm subscribed to many groups @ Yahoo. It was the owner/moderator,
that rejected my subscription attempt last time. I'm trying again now :-)

> Can you publish a stripped down code sample here of what you are doing ?

Sure. It is however stripped out from other code, so a bit messy for
an example, but it shows the problem. (You just have to learn Pascal :-) )

The example reads the bootsector on any partition of your choice, and
writes it back again - in itself harmless. It works fine on FAT and HPFS partitions.
It works for IBM JFS partitions too - but it will Trap the system if using eCS JFS.IFS
driver (!).
On FAT32, it almost always returns error 5 for the writing operation; but
one test ended "successfully". It was my last partition on a 500GB disk,
but instead of writing same buffer back - it wiped the bootsector to F6.
I have no idea how that could happen - luckly it was an empty test partition.

So, be warned - full backups needed or DFSee to refix your bootsectors :-)

ftp://ftp.warpspeed.dk/osFree/RW-test.pas
ftp://ftp.warpspeed.dk/osFree/RW-test.exe

Lars Erdmann

unread,
Dec 6, 2009, 8:31:58 AM12/6/09
to
Hallo Allan,

>> Can you publish a stripped down code sample here of what you are doing ?
>
> Sure. It is however stripped out from other code, so a bit messy for
> an example, but it shows the problem. (You just have to learn Pascal :-) )
>
> The example reads the bootsector on any partition of your choice, and
> writes it back again - in itself harmless. It works fine on FAT and HPFS
> partitions.
> It works for IBM JFS partitions too - but it will Trap the system if using
> eCS JFS.IFS
> driver (!).
> On FAT32, it almost always returns error 5 for the writing operation; but
> one test ended "successfully". It was my last partition on a 500GB disk,
> but instead of writing same buffer back - it wiped the bootsector to F6.
> I have no idea how that could happen - luckly it was an empty test
> partition.
>
> So, be warned - full backups needed or DFSee to refix your bootsectors :-)
>
> ftp://ftp.warpspeed.dk/osFree/RW-test.pas
> ftp://ftp.warpspeed.dk/osFree/RW-test.exe

Last question: what version of FAT32 are you using ? I hope bldlevel.exe
invoked on FAT32.IFS will be able to tell you.


Lars

Allan

unread,
Dec 6, 2009, 9:01:43 AM12/6/09
to
On Sun, 6 Dec 2009 13:31:58 UTC, "Lars Erdmann" <lars.e...@arcor.de> wrote:

> Last question: what version of FAT32 are you using ? I hope bldlevel.exe
> invoked on FAT32.IFS will be able to tell you.

Nope, it doesn't have bldlevel info (put that on TODO)

But inside file:
FAT32.IFS version 0.9.13 Dec 07 2008

I tried it on some earlier version before upgrading to this,
with same result.

0 new messages