In a Partition Boot Record for a FAT partition, the BPB_HiddSec field is
supposed to be a count of hidden sectors located just prior to the sector
containing the PBR itself. For the first partition on the drive, is this
count supposed to include the MBR?

Supposedly the exact answer is operating system specific. However, the
vendor of a card or other storage device can't always guess which operating
systems might be used by the end user. In at least one preformatted card
the count does include the MBR. I'm guessing that some devices (e.g. maybe
digital cameras) depend on having some hidden sectors there -- but do they
depend on the count including the MBR, I can't guess. Somehow I'm gaining
the impression that Windows ignores that field, but I don't see any
documentation saying that Windows ignores that field. Anyone know?

Re: BPB_HiddSec by David

David
Mon Mar 31 00:32:10 CDT 2008

Have you read fatgen103.doc? It describes the FAT file formats correctly,
AFAIK. I created a format program using it. Yes, it includes all sectors
preceeding the PBR (aka DOS boot record in the old days). That field in
extended partition records only includes the sectors from it, inclusive, to
the partition boot record. The extended partition entry in the previous
partition table has the sectors prior to that partition table.

Take a big drive and allocate 25% to a partition you install XP Pro on.
Then with disk manager add an extended partition of the remaining. Then
create three partitions in it, one at a time, and look at all the records
using WinHex. This will help. I use a 500GB drive for some of my systems.
I can then use the first and second partition to install XP into. I use one
an fully build it up. The other I keep up to date, but no real software
installed until the first one goes to crap. I can then when I switch change
the boot.ini file to default to the new one when needed. I then delete
'Documents and Settings', 'Program Files', and 'Windows' directories to
start over on it with the minimal install. I have to disconnect any other
drives during the installs so Windows will get drive assignments correct. I
like the first drive to have C:, D:, E:, and F: on it with CD/DVDs drive to
follow. Then any other drives have one partition per hard drive. I
currently have six drives in my main desktop with 8 externals connected via
1394a and eSata. Too many avi's. They get full in a hurry.


"Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
news:uvP3oaukIHA.1184@TK2MSFTNGP04.phx.gbl...
> In a Partition Boot Record for a FAT partition, the BPB_HiddSec field is
> supposed to be a count of hidden sectors located just prior to the sector
> containing the PBR itself. For the first partition on the drive, is this
> count supposed to include the MBR?
>
> Supposedly the exact answer is operating system specific. However, the
> vendor of a card or other storage device can't always guess which
> operating systems might be used by the end user. In at least one
> preformatted card the count does include the MBR. I'm guessing that some
> devices (e.g. maybe digital cameras) depend on having some hidden sectors
> there -- but do they depend on the count including the MBR, I can't guess.
> Somehow I'm gaining the impression that Windows ignores that field, but I
> don't see any documentation saying that Windows ignores that field.
> Anyone know?



Re: BPB_HiddSec by Norman

Norman
Mon Mar 31 01:18:11 CDT 2008

Yes I'm reading fatgen103.doc.

> Yes, it includes all sectors preceeding the PBR (aka DOS boot record in
> the old days).

OK then. At least one vendor pre-formats their memory cards correctly.
Windows 98 formats FAT32 partitions incorrectly. Tests of other Windows
versions are pending. The Linux mkdosfs command formats FAT32 partitions
incorrectly.

> extended partition records

I think I haven't gotten that far yet. My question this time around only
concerned the BPB_HiddSec field in a PBR, and I neglected to mention that
it's a primary partition (though that should be obvious since I asked if
that field counts the MBR).


"David Craig" <drivers@nowhere.us> wrote in message
news:elSrkCvkIHA.5280@TK2MSFTNGP02.phx.gbl...
> Have you read fatgen103.doc? It describes the FAT file formats correctly,
> AFAIK. I created a format program using it. Yes, it includes all sectors
> preceeding the PBR (aka DOS boot record in the old days). That field in
> extended partition records only includes the sectors from it, inclusive,
> to the partition boot record. The extended partition entry in the
> previous partition table has the sectors prior to that partition table.
>
> Take a big drive and allocate 25% to a partition you install XP Pro on.
> Then with disk manager add an extended partition of the remaining. Then
> create three partitions in it, one at a time, and look at all the records
> using WinHex. This will help. I use a 500GB drive for some of my
> systems. I can then use the first and second partition to install XP into.
> I use one an fully build it up. The other I keep up to date, but no real
> software installed until the first one goes to crap. I can then when I
> switch change the boot.ini file to default to the new one when needed. I
> then delete 'Documents and Settings', 'Program Files', and 'Windows'
> directories to start over on it with the minimal install. I have to
> disconnect any other drives during the installs so Windows will get drive
> assignments correct. I like the first drive to have C:, D:, E:, and F: on
> it with CD/DVDs drive to follow. Then any other drives have one partition
> per hard drive. I currently have six drives in my main desktop with 8
> externals connected via 1394a and eSata. Too many avi's. They get full
> in a hurry.
>
>
> "Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
> news:uvP3oaukIHA.1184@TK2MSFTNGP04.phx.gbl...
>> In a Partition Boot Record for a FAT partition, the BPB_HiddSec field is
>> supposed to be a count of hidden sectors located just prior to the sector
>> containing the PBR itself. For the first partition on the drive, is this
>> count supposed to include the MBR?
>>
>> Supposedly the exact answer is operating system specific. However, the
>> vendor of a card or other storage device can't always guess which
>> operating systems might be used by the end user. In at least one
>> preformatted card the count does include the MBR. I'm guessing that some
>> devices (e.g. maybe digital cameras) depend on having some hidden sectors
>> there -- but do they depend on the count including the MBR, I can't
>> guess. Somehow I'm gaining the impression that Windows ignores that
>> field, but I don't see any documentation saying that Windows ignores that
>> field. Anyone know?
>
>


Re: BPB_HiddSec by Maxim

Maxim
Mon Mar 31 01:32:13 CDT 2008

This value is only used by the boot sector boot code.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
news:uvP3oaukIHA.1184@TK2MSFTNGP04.phx.gbl...
> In a Partition Boot Record for a FAT partition, the BPB_HiddSec field is
> supposed to be a count of hidden sectors located just prior to the sector
> containing the PBR itself. For the first partition on the drive, is this
> count supposed to include the MBR?
>
> Supposedly the exact answer is operating system specific. However, the
> vendor of a card or other storage device can't always guess which operating
> systems might be used by the end user. In at least one preformatted card
> the count does include the MBR. I'm guessing that some devices (e.g. maybe
> digital cameras) depend on having some hidden sectors there -- but do they
> depend on the count including the MBR, I can't guess. Somehow I'm gaining
> the impression that Windows ignores that field, but I don't see any
> documentation saying that Windows ignores that field. Anyone know?
>


Re: BPB_HiddSec by Norman

Norman
Mon Mar 31 02:32:49 CDT 2008

OK. Does boot sector boot code expect that value to include the MBR in its
count?


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:O5oT2jvkIHA.1208@TK2MSFTNGP05.phx.gbl...
> This value is only used by the boot sector boot code.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
> news:uvP3oaukIHA.1184@TK2MSFTNGP04.phx.gbl...
>> In a Partition Boot Record for a FAT partition, the BPB_HiddSec field is
>> supposed to be a count of hidden sectors located just prior to the sector
>> containing the PBR itself. For the first partition on the drive, is this
>> count supposed to include the MBR?
>>
>> Supposedly the exact answer is operating system specific. However, the
>> vendor of a card or other storage device can't always guess which
>> operating
>> systems might be used by the end user. In at least one preformatted card
>> the count does include the MBR. I'm guessing that some devices (e.g.
>> maybe
>> digital cameras) depend on having some hidden sectors there -- but do
>> they
>> depend on the count including the MBR, I can't guess. Somehow I'm
>> gaining
>> the impression that Windows ignores that field, but I don't see any
>> documentation saying that Windows ignores that field. Anyone know?
>>
>


Re: BPB_HiddSec by Maxim

Maxim
Mon Mar 31 06:09:37 CDT 2008

The correct value for HiddenSectors (offset 0x1c in the boot sector) is
PARTITION_INFORMATION::HiddenSectors returned by IOCTL_DISK_GET_PARTITION_INFO.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
news:uqM7sFwkIHA.1184@TK2MSFTNGP04.phx.gbl...
> OK. Does boot sector boot code expect that value to include the MBR in its
> count?
>
>
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> news:O5oT2jvkIHA.1208@TK2MSFTNGP05.phx.gbl...
> > This value is only used by the boot sector boot code.
> >
> > --
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > maxim@storagecraft.com
> > http://www.storagecraft.com
> >
> > "Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
> > news:uvP3oaukIHA.1184@TK2MSFTNGP04.phx.gbl...
> >> In a Partition Boot Record for a FAT partition, the BPB_HiddSec field is
> >> supposed to be a count of hidden sectors located just prior to the sector
> >> containing the PBR itself. For the first partition on the drive, is this
> >> count supposed to include the MBR?
> >>
> >> Supposedly the exact answer is operating system specific. However, the
> >> vendor of a card or other storage device can't always guess which
> >> operating
> >> systems might be used by the end user. In at least one preformatted card
> >> the count does include the MBR. I'm guessing that some devices (e.g.
> >> maybe
> >> digital cameras) depend on having some hidden sectors there -- but do
> >> they
> >> depend on the count including the MBR, I can't guess. Somehow I'm
> >> gaining
> >> the impression that Windows ignores that field, but I don't see any
> >> documentation saying that Windows ignores that field. Anyone know?
> >>
> >
>


Re: BPB_HiddSec by Norman

Norman
Mon Mar 31 20:14:58 CDT 2008

Ummmm, OK, let's see. I'm going to write a PBR, so I'm computing the values
that need to go into the PBR, and I need to know how to compute the value
for HiddenSectors. I should call DeviceIoControl and ask
IOCTL_DISK_GET_PARTITION_INFO to tell me the correct value that I'm going to
write?

Was my question really so hard? Some vendors think the BPB_HiddSec field
counts the MBR along with other hidden sectors, some vendors think it does
not, Microsoft thinks it's operating system dependent, David Craig thinks
Windows 98 got it wrong .... Oh I see, yes my question really was so hard.
Please, does some guru know the answer?


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:uk3b2%23xkIHA.1212@TK2MSFTNGP05.phx.gbl...
> The correct value for HiddenSectors (offset 0x1c in the boot sector) is
> PARTITION_INFORMATION::HiddenSectors returned by
> IOCTL_DISK_GET_PARTITION_INFO.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
> news:uqM7sFwkIHA.1184@TK2MSFTNGP04.phx.gbl...
>> OK. Does boot sector boot code expect that value to include the MBR in
>> its
>> count?
>>
>>
>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>> news:O5oT2jvkIHA.1208@TK2MSFTNGP05.phx.gbl...
>> > This value is only used by the boot sector boot code.
>> >
>> > --
>> > Maxim Shatskih, Windows DDK MVP
>> > StorageCraft Corporation
>> > maxim@storagecraft.com
>> > http://www.storagecraft.com
>> >
>> > "Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
>> > news:uvP3oaukIHA.1184@TK2MSFTNGP04.phx.gbl...
>> >> In a Partition Boot Record for a FAT partition, the BPB_HiddSec field
>> >> is
>> >> supposed to be a count of hidden sectors located just prior to the
>> >> sector
>> >> containing the PBR itself. For the first partition on the drive, is
>> >> this
>> >> count supposed to include the MBR?
>> >>
>> >> Supposedly the exact answer is operating system specific. However,
>> >> the
>> >> vendor of a card or other storage device can't always guess which
>> >> operating
>> >> systems might be used by the end user. In at least one preformatted
>> >> card
>> >> the count does include the MBR. I'm guessing that some devices (e.g.
>> >> maybe
>> >> digital cameras) depend on having some hidden sectors there -- but do
>> >> they
>> >> depend on the count including the MBR, I can't guess. Somehow I'm
>> >> gaining
>> >> the impression that Windows ignores that field, but I don't see any
>> >> documentation saying that Windows ignores that field. Anyone know?
>> >>
>> >
>>
>


Re: BPB_HiddSec by Maxim

Maxim
Mon Mar 31 21:58:06 CDT 2008

> for HiddenSectors. I should call DeviceIoControl and ask
> IOCTL_DISK_GET_PARTITION_INFO to tell me the correct value that I'm going
>to
> write?

This is simplest.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: BPB_HiddSec by Norman

Norman
Tue Apr 01 00:08:25 CDT 2008

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:ed6z2Q6kIHA.1744@TK2MSFTNGP05.phx.gbl...
>> for HiddenSectors. I should call DeviceIoControl and ask
>> IOCTL_DISK_GET_PARTITION_INFO to tell me the correct value that I'm going
>> to write?
>
> This is simplest.

Thank you but I'm still trying to figure that out.

Maybe IOCTL_DISK_GET_PARTITION_INFO can work because I should rewrite the
MBR first, then call DeviceIoControl, IOCTL_DISK_GET_PARTITION_INFO will
read the new partition table from the MBR even though the partition isn't
ready yet, and then IOCTL_DISK_GET_PARTITION_INFO will tell me some of the
values to write into the BPB.

Maybe IOCTL_DISK_GET_PARTITION_INFO is more reliable than Disk
Administrator's command to rescan disks, because
IOCTL_DISK_GET_PARTITION_INFO reads the current MBR.

OK, but what do card vendors do? When they manufacture cards and preformat
the cards, surely they're not running Windows just to do the preformatting?

And as for why Windows 98 sets the value wrong, is it because
IOCTL_DISK_GET_PARTITION_INFO doesn't exist in Windows 98?


Re: BPB_HiddSec by David

David
Tue Apr 01 00:44:31 CDT 2008

First, you mention cards and I suspect may mean flash memory cards and not
mass storage devices such as hard drives or USB Flash Drives. Do you have
access to the private associations that support the various flash memory
card formats? I remember from a while back that SmartMedia had a SSFDC
Association that provided detail documentation for that media. It included
the information about block sizes and recommended logical formats to be used
to keep logical clusters aligned with the physical blocks that make up flash
memory. This keeps cluster writes from spanning multiple physical blocks to
reduce wear on the media since flash memory has a limited number of erase
cycles that can be used. It also documented how many 'extra' blocks were
present to allow them to replace worn blocks when required either due to
wear or manufacturing defects. Normally flash memory will be formatted with
only one partition since Windows doesn't support multiple partitions on
removable media.

The above information is considered confidential and normally only shared
with partners and others who pay to join such associations such as camera
makers. I don't know if this applies to any of the current flash memory
devices, but I would suspect it may apply to the current Toshiba xD Picture
card especially since it does not contain a controller, AFAIK, just as did
Toshiba's SmartMedia. Not having a controller means embedded controllers in
readers or in some cases drivers need to know about those contraints. I use
'reader' to include writers too, including the firmware in cameras.

The main question about reserved sectors in the MBR's partition table
includes sector zero. You can just add that value to the current sector
value (zero at the beginning of the drive) and read the partition boot
record where the BPB resides for FAT12/16/32. I do not know about the new
exFat format since it is new with Vista SP1 and Server 2008. It has never
been documented and may resemble NTFS more than traditional FAT since
transactions are supported on it. It just has the added feature of
supporting removable media as well as being usable in removable drives.
Just for the uninformed, a USB Floppy is both while the traditional floppy
is just removable media.

If you are consulting for a company involved in this business ask about any
documentation on the items mentioned. The SmartMedia docs had very specific
detailed layouts for each sector in the system areas beginning with sector
zero and all the way through the FATs.


"Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
news:O8ZstZ7kIHA.1208@TK2MSFTNGP03.phx.gbl...
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> news:ed6z2Q6kIHA.1744@TK2MSFTNGP05.phx.gbl...
>>> for HiddenSectors. I should call DeviceIoControl and ask
>>> IOCTL_DISK_GET_PARTITION_INFO to tell me the correct value that I'm
>>> going to write?
>>
>> This is simplest.
>
> Thank you but I'm still trying to figure that out.
>
> Maybe IOCTL_DISK_GET_PARTITION_INFO can work because I should rewrite the
> MBR first, then call DeviceIoControl, IOCTL_DISK_GET_PARTITION_INFO will
> read the new partition table from the MBR even though the partition isn't
> ready yet, and then IOCTL_DISK_GET_PARTITION_INFO will tell me some of the
> values to write into the BPB.
>
> Maybe IOCTL_DISK_GET_PARTITION_INFO is more reliable than Disk
> Administrator's command to rescan disks, because
> IOCTL_DISK_GET_PARTITION_INFO reads the current MBR.
>
> OK, but what do card vendors do? When they manufacture cards and
> preformat the cards, surely they're not running Windows just to do the
> preformatting?
>
> And as for why Windows 98 sets the value wrong, is it because
> IOCTL_DISK_GET_PARTITION_INFO doesn't exist in Windows 98?



Re: BPB_HiddSec by Norman

Norman
Tue Apr 01 01:41:32 CDT 2008

At present I am concerned with cards _and_ hard drives _and_ floppies. At
present I haven't noticed a difference between flash memory cards and USB
flash drives, so I guess you've warned me that I'd better find it, thank
you.

I don't have access to those associations. I can't use GPL'ed code so I
understand intuitively the importance of avoiding read-modify-write cycles
in flash memory but haven't read the details. Thank you for advising that
these specs might be available publicly without reading GPL'ed code.

For some reason I had expected flash cards to be unpartitioned, but the one
that I examined closely enough (so far) has a partition table and one
primary partition.

Regarding the main question, now I'm no longer certain if Windows 98
neglected to count the MBR. I was sure that I saw 3E 00 00 00 in that field
yesterday but now see 3F 00 00 00 (in little endian storage order). I'm
wondering if Windows XP fixed it when I assigned a drive letter to it in XP,
or if my eyes were defective yesterday.


"David Craig" <drivers@nowhere.us> wrote in message
news:OrEO2t7kIHA.3876@TK2MSFTNGP06.phx.gbl...
> First, you mention cards and I suspect may mean flash memory cards and not
> mass storage devices such as hard drives or USB Flash Drives. Do you have
> access to the private associations that support the various flash memory
> card formats? I remember from a while back that SmartMedia had a SSFDC
> Association that provided detail documentation for that media. It
> included the information about block sizes and recommended logical formats
> to be used to keep logical clusters aligned with the physical blocks that
> make up flash memory. This keeps cluster writes from spanning multiple
> physical blocks to reduce wear on the media since flash memory has a
> limited number of erase cycles that can be used. It also documented how
> many 'extra' blocks were present to allow them to replace worn blocks when
> required either due to wear or manufacturing defects. Normally flash
> memory will be formatted with only one partition since Windows doesn't
> support multiple partitions on removable media.
>
> The above information is considered confidential and normally only shared
> with partners and others who pay to join such associations such as camera
> makers. I don't know if this applies to any of the current flash memory
> devices, but I would suspect it may apply to the current Toshiba xD
> Picture card especially since it does not contain a controller, AFAIK,
> just as did Toshiba's SmartMedia. Not having a controller means embedded
> controllers in readers or in some cases drivers need to know about those
> contraints. I use 'reader' to include writers too, including the firmware
> in cameras.
>
> The main question about reserved sectors in the MBR's partition table
> includes sector zero. You can just add that value to the current sector
> value (zero at the beginning of the drive) and read the partition boot
> record where the BPB resides for FAT12/16/32. I do not know about the new
> exFat format since it is new with Vista SP1 and Server 2008. It has never
> been documented and may resemble NTFS more than traditional FAT since
> transactions are supported on it. It just has the added feature of
> supporting removable media as well as being usable in removable drives.
> Just for the uninformed, a USB Floppy is both while the traditional floppy
> is just removable media.
>
> If you are consulting for a company involved in this business ask about
> any documentation on the items mentioned. The SmartMedia docs had very
> specific detailed layouts for each sector in the system areas beginning
> with sector zero and all the way through the FATs.
>
>
> "Norman Diamond" <ndiamond@newsgroup.nospam> wrote in message
> news:O8ZstZ7kIHA.1208@TK2MSFTNGP03.phx.gbl...
>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>> news:ed6z2Q6kIHA.1744@TK2MSFTNGP05.phx.gbl...
>>>> for HiddenSectors. I should call DeviceIoControl and ask
>>>> IOCTL_DISK_GET_PARTITION_INFO to tell me the correct value that I'm
>>>> going to write?
>>>
>>> This is simplest.
>>
>> Thank you but I'm still trying to figure that out.
>>
>> Maybe IOCTL_DISK_GET_PARTITION_INFO can work because I should rewrite the
>> MBR first, then call DeviceIoControl, IOCTL_DISK_GET_PARTITION_INFO will
>> read the new partition table from the MBR even though the partition isn't
>> ready yet, and then IOCTL_DISK_GET_PARTITION_INFO will tell me some of
>> the values to write into the BPB.
>>
>> Maybe IOCTL_DISK_GET_PARTITION_INFO is more reliable than Disk
>> Administrator's command to rescan disks, because
>> IOCTL_DISK_GET_PARTITION_INFO reads the current MBR.
>>
>> OK, but what do card vendors do? When they manufacture cards and
>> preformat the cards, surely they're not running Windows just to do the
>> preformatting?
>>
>> And as for why Windows 98 sets the value wrong, is it because
>> IOCTL_DISK_GET_PARTITION_INFO doesn't exist in Windows 98?
>
>


Re: BPB_HiddSec by Maxim

Maxim
Tue Apr 01 02:03:25 CDT 2008

> MBR first, then call DeviceIoControl, IOCTL_DISK_GET_PARTITION_INFO will
> read the new partition table from the MBR even though the partition isn't
> ready yet

No. After writing MBR from your own code, call IOCTL_DISK_UPDATE_PROPERTIES so
the Disk driver will fetch the partition table off MBR.

> OK, but what do card vendors do? When they manufacture cards and preformat
> the cards, surely they're not running Windows just to do the preformatting?

Most cards are removable media and have no MBR.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: BPB_HiddSec by Maxim

Maxim
Tue Apr 01 02:24:18 CDT 2008

> For some reason I had expected flash cards to be unpartitioned, but the one
> that I examined closely enough (so far) has a partition table and one
> primary partition.

This is also legal.

About partitions and removable disks in Windows:

- Disk.sys reads the partition table using IoReadPartitionTable, and then
creates the partition device objects using the information from
IoReadPartitionTable.
- IoReadPartitionTable works like this: if there is a valid MBR - then it
returns the data from the MBR, otherwise, it returns 1 "fake" partition
describing the whole disk, this is how MBRless media (usually removable) works.

The above is the same for both removable and fixed media.

What is different is that:
- Disk.sys creates 1 and only 1 partition device object for the removable
media, for MBRless this is obvious, for MBR - this is the very first partition
in the MBR. The rest of the media can be used for some OEM data, like on IOMega
ZIPdrive.
- Disk.sys prohibits the use of FtDisk/VolMgr/DmIo on removable media, the
whole volume manager stack is out of picture for it.

Removable and fixed media differs by the bit in the SCSI INQUIRY data (for ATA,
it is emulated based on IDENTIFY data, or probably just plain always FALSE. The
CD/DVD drives connected by ATA are actually ATAPI - SCSI over ATA cable, and
have INQUIRY).

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: BPB_HiddSec by David

David
Tue Apr 01 11:15:23 CDT 2008

That last statement is wrong. Most flash memory contains a master boot
record with a single entry partition table. Only floppies normally use
media without a MBR.

Norman, floppies have fixed formats that are hardwired into format programs.
fatgen103.doc shows how that works.

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:%23HNlwe8kIHA.1744@TK2MSFTNGP05.phx.gbl...
>> MBR first, then call DeviceIoControl, IOCTL_DISK_GET_PARTITION_INFO will
>> read the new partition table from the MBR even though the partition isn't
>> ready yet
>
> No. After writing MBR from your own code, call
> IOCTL_DISK_UPDATE_PROPERTIES so
> the Disk driver will fetch the partition table off MBR.
>
>> OK, but what do card vendors do? When they manufacture cards and
>> preformat
>> the cards, surely they're not running Windows just to do the
>> preformatting?
>
> Most cards are removable media and have no MBR.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>



Re: BPB_HiddSec by Maxim

Maxim
Tue Apr 01 12:42:35 CDT 2008

> That last statement is wrong. Most flash memory contains a master boot
> record with a single entry partition table. Only floppies normally use
> media without a MBR.

Maybe. They are removable media anyway - fixed media USB flash sticks are rare
and usually old (2003 or so).

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: BPB_HiddSec by David

David
Tue Apr 01 13:39:37 CDT 2008

You have the terms mixed up. Removable media is floppies, flash memory
cards, and the old SyQuest drives that had cartridges with a hard disk
platter in them. Current USB flash drives are removable drives. The flash
memory readers that work using CF, xD Picture Card, Memory Stick, Secure
Digital, etc. may be both but my Dell notebook has a reader built into the
case that is not removable. I have others that are removable.

Removable drives are easy to support. Keep the system areas updated quickly
and if the drive disappears when dirty buffers are present, display the lost
data message. If you want speed, allow caching of system areas and the user
must ask to eject the drive - usually via the little icon in the tray.

Removable media is much more difficult. When the media is removed can a
media change be detected? The 360KB floppy drive could not. The 1.44MB and
1.2MB floppy drives had media change detection hardware. If the media is
removed, how should it be treated if it is reinserted if dirty buffers are
present in memory? How can the system know that the media is unchanged,
especially if system areas need to be rewritten because they are in the
dirty buffers waiting?

Having worked for Iomega, I know that operating systems from Microsoft have
never been very good at keeping the user from destroying their data.
However, in their defense, it is impossible to stop everyone from doing
anything that will result in data loss.

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:OzNoG$BlIHA.3512@TK2MSFTNGP03.phx.gbl...
>> That last statement is wrong. Most flash memory contains a master boot
>> record with a single entry partition table. Only floppies normally use
>> media without a MBR.
>
> Maybe. They are removable media anyway - fixed media USB flash sticks are
> rare
> and usually old (2003 or so).
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>



Re: BPB_HiddSec by Norman

Norman
Tue Apr 01 19:18:06 CDT 2008

> If you want speed, allow caching of system areas and the user must ask to
> eject the drive - usually via the little icon in the tray.

Fortunately Windows sometimes lets the user choose speed vs. safety.
Unfortunately Windows sometimes delivers neither. For USB hard disks and
memory devices I always ask Windows for permission, and if Windows refuses
several times in a row then I shut down Windows before detaching the device.
However, sometimes the event log contains reports that Windows broke an NTFS
partition anyway, after which sometimes Chkdsk adds log reports saying which
filenames it lost but sometimes it doesn't. (I do want to know which files
were corrupted so I can restore them from other copies of backups before all
copies get corrupted.)

> If the media is removed, how should it be treated if it is reinserted if
> dirty buffers are present in memory?

I wish the driver could always preserve the dirty buffers until the user
says otherwise. When the driver detects a surprise removal it would be nice
to put up a warning saying "if you don't want to lose your data then
reattach your device now".

> Having worked for Iomega, I know that operating systems from Microsoft
> have never been very good at keeping the user from destroying their data.

Having simply been a user, I know that operating systems from Microsoft have
never been very good at keeping Windows from destroying users' data. NT4
came closest.


"David Craig" <drivers@nowhere.us> wrote in message
news:uLOv9eClIHA.4744@TK2MSFTNGP06.phx.gbl...
> You have the terms mixed up. Removable media is floppies, flash memory
> cards, and the old SyQuest drives that had cartridges with a hard disk
> platter in them. Current USB flash drives are removable drives. The
> flash memory readers that work using CF, xD Picture Card, Memory Stick,
> Secure Digital, etc. may be both but my Dell notebook has a reader built
> into the case that is not removable. I have others that are removable.
>
> Removable drives are easy to support. Keep the system areas updated
> quickly and if the drive disappears when dirty buffers are present,
> display the lost data message. If you want speed, allow caching of system
> areas and the user must ask to eject the drive - usually via the little
> icon in the tray.
>
> Removable media is much more difficult. When the media is removed can a
> media change be detected? The 360KB floppy drive could not. The 1.44MB
> and 1.2MB floppy drives had media change detection hardware. If the media
> is removed, how should it be treated if it is reinserted if dirty buffers
> are present in memory? How can the system know that the media is
> unchanged, especially if system areas need to be rewritten because they
> are in the dirty buffers waiting?
>
> Having worked for Iomega, I know that operating systems from Microsoft
> have never been very good at keeping the user from destroying their data.
> However, in their defense, it is impossible to stop everyone from doing
> anything that will result in data loss.
>
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> news:OzNoG$BlIHA.3512@TK2MSFTNGP03.phx.gbl...
>>> That last statement is wrong. Most flash memory contains a master boot
>>> record with a single entry partition table. Only floppies normally use
>>> media without a MBR.
>>
>> Maybe. They are removable media anyway - fixed media USB flash sticks are
>> rare
>> and usually old (2003 or so).