Hi,

I have read Mark Roddy's article on
http://www.wd-3.com/121503/luserland.htm.
He described as you can get the sector address (LBA) a file on a harddisk.

His sample code works for NTFS & FAT32 partions. With a small look in
the FAT spec and some adaptations the sample also works for FAT12/16.

The sample works on W2K & WXP for harddisks and all disks declared as
"Local Disk". For "Removable Disk" like a USB Mass Storage Device
this sample (API call DeviceIoControl/IOCTL_VOLUME_LOGICAL_TO_PHYSICAL)
does not work and system error 50 (not supported) does occur.
The same device declared as "Local Disk" everythink does work.

Is there are a workaround to get
DeviceIoControl/IOCTL_VOLUME_LOGICAL_TO_PHYSICAL
data also on "Removable Disks" or is there are another possibility to get
the
wanted information on another way?

All hints are very welcome.
TIA Alex

Re: Difference between Local Disk aund Removable Disk by Mark

Mark
Sat Feb 28 09:51:59 CST 2004

"Alex" <alex130671@nexgo.de> wrote in message
news:uyXWeMf$DHA.712@tk2msftngp13.phx.gbl...
> Hi,
>
> I have read Mark Roddy's article on
> http://www.wd-3.com/121503/luserland.htm.
> He described as you can get the sector address (LBA) a file on a harddisk.
>
> His sample code works for NTFS & FAT32 partions. With a small look in
> the FAT spec and some adaptations the sample also works for FAT12/16.
>
> The sample works on W2K & WXP for harddisks and all disks declared as
> "Local Disk". For "Removable Disk" like a USB Mass Storage Device
> this sample (API call DeviceIoControl/IOCTL_VOLUME_LOGICAL_TO_PHYSICAL)
> does not work and system error 50 (not supported) does occur.
> The same device declared as "Local Disk" everythink does work.
>
> Is there are a workaround to get
> DeviceIoControl/IOCTL_VOLUME_LOGICAL_TO_PHYSICAL
> data also on "Removable Disks" or is there are another possibility to get
> the
> wanted information on another way?
>

Curious. I'll look into it.

By the way, why would you run FAT.DOS on anything?

--

=====================
Mark Roddy
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
markr@hollistech.com




Re: Difference between Local Disk aund Removable Disk by Alex

Alex
Sat Feb 28 10:52:59 CST 2004

>
> By the way, why would you run FAT.DOS on anything?
>
We are producing a USB Mass Storage device with an additional
chip to have additional features. We need to set the sector address
of a special file stored on the flash disc into the additonal chip.
Normally the "standard" file system of a USB Mass Storage is FAT,
so we have to support all possible file systems ;-(
(at the moment FAT12/16/32/NTFS).



Re: Difference between Local Disk aund Removable Disk by Maxim

Maxim
Sat Feb 28 18:32:00 CST 2004

Surely. This IOCTL ends in FtDisk.sys, which is completely out of picture
for removable media devices.
Use IOCTL_DISK_GET_DRIVE_LAYOUT for them. Anyway a removable media can have
only 1 partition :-)

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


"Alex" <alex130671@nexgo.de> wrote in message
news:uyXWeMf$DHA.712@tk2msftngp13.phx.gbl...
> Hi,
>
> I have read Mark Roddy's article on
> http://www.wd-3.com/121503/luserland.htm.
> He described as you can get the sector address (LBA) a file on a harddisk.
>
> His sample code works for NTFS & FAT32 partions. With a small look in
> the FAT spec and some adaptations the sample also works for FAT12/16.
>
> The sample works on W2K & WXP for harddisks and all disks declared as
> "Local Disk". For "Removable Disk" like a USB Mass Storage Device
> this sample (API call DeviceIoControl/IOCTL_VOLUME_LOGICAL_TO_PHYSICAL)
> does not work and system error 50 (not supported) does occur.
> The same device declared as "Local Disk" everythink does work.
>
> Is there are a workaround to get
> DeviceIoControl/IOCTL_VOLUME_LOGICAL_TO_PHYSICAL
> data also on "Removable Disks" or is there are another possibility to get
> the
> wanted information on another way?
>
> All hints are very welcome.
> TIA Alex
>
>
>
>
>



Re: Difference between Local Disk aund Removable Disk by Maxim

Maxim
Sat Feb 28 18:32:52 CST 2004

> so we have to support all possible file systems ;-(
> (at the moment FAT12/16/32/NTFS).

Is it possible to have NTFS on removable media?

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



Re: Difference between Local Disk aund Removable Disk by George

George
Sat Feb 28 23:27:20 CST 2004

Alex,

Removable devices all have a single volume so you can calculate the physical
offset directly from the LCN:

physical offset = LCN * bytes_per_cluster + offset to start of first
cluster.

Hope this helps.

George.



Re: Difference between Local Disk aund Removable Disk by George

George
Sat Feb 28 23:35:55 CST 2004

Maxim,

> Is it possible to have NTFS on removable media? <

Not for a floppy drive. The default properties for removable USB drives
(e.g. thumbdrives) do not allow you to format the drive to NTFS. However,
this behavior may be changed by editing the properties for the device in
device manager. The caveat is that you have to stop the drive using the
Safely Remove Hardware applet before the drive can be removed. I remember
seeing somewhere that XP supported formatting DVD-RAM disks to NTFS. I
don't know if this has ever been extended to DVD-RW drives but it needs to
be.

Regards,

George.

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:u2itqsl$DHA.2448@TK2MSFTNGP12.phx.gbl...
>> so we have to support all possible file systems ;-(
>> (at the moment FAT12/16/32/NTFS).
>
> Is it possible to have NTFS on removable media?
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
>



Re: Difference between Local Disk aund Removable Disk by Alex

Alex
Mon Mar 01 02:25:31 CST 2004

Thanks to all. Problem is solved. The addtional information
are also very interessting.
Alex

"George M. Garner Jr." <gmgarner@erols.com> wrote in message
news:eReK4So$DHA.3284@TK2MSFTNGP09.phx.gbl...
> Alex,
>
> Removable devices all have a single volume so you can calculate the
physical
> offset directly from the LCN:
>
> physical offset = LCN * bytes_per_cluster + offset to start of first
> cluster.
>
> Hope this helps.
>
> George.
>
>



Re: Difference between Local Disk aund Removable Disk by Jeff

Jeff
Mon Mar 01 07:15:15 CST 2004


"George M. Garner Jr." <gmgarner@erols.com> wrote in message
news:uczdsXo$DHA.684@tk2msftngp13.phx.gbl...
> Not for a floppy drive. The default properties for removable USB drives
> (e.g. thumbdrives) do not allow you to format the drive to NTFS. However,
> this behavior may be changed by editing the properties for the device in
> device manager. The caveat is that you have to stop the drive using the
> Safely Remove Hardware applet before the drive can be removed.

You sure about that? When I bought a 256MB thumb drive about 6 months back,
the first thing I did was reformat it to NTFS on my laptop (which at the
time was running 2K Advanced Server). I don't recall having to do anything
special to reformat it.

As for the "Safely Remove Hardware" applet, on XP you can change that
through the Policies tab in Device Manager; basically the policy setting
enables/disables write caching.