Discussion:
How to open a raw (non-native) disk volume ?
(too old to reply)
R.Wieser
2019-03-04 13:34:09 UTC
Permalink
Hello all,

Windows has IOCTL_DISK_GET_DRIVE_LAYOUT to retrieve all partitions of a
physical drive, but I've not been able to find how to open such partitions
for raw access (letting the OS handle the nitty-gritty as well as not
interfering with access to other volumes on the same drive).

Part of the problem is that non-native (like type 0x83, Linux) as well as
extended partitions (like type 5) do, ofcourse, not have drive letters or
other IDs assigned to them, so the \\.\ or \\?\ approach doesn't work.

I've also tried FindFirstVolume, but that one only returns recognised data
volumes ones (iow: neither of the above).

Has anyone an idea ?

Regards,
Rudy Wieser
JJ
2019-03-05 10:10:30 UTC
Permalink
Post by R.Wieser
Hello all,
Windows has IOCTL_DISK_GET_DRIVE_LAYOUT to retrieve all partitions of a
physical drive, but I've not been able to find how to open such partitions
for raw access (letting the OS handle the nitty-gritty as well as not
interfering with access to other volumes on the same drive).
Part of the problem is that non-native (like type 0x83, Linux) as well as
extended partitions (like type 5) do, ofcourse, not have drive letters or
other IDs assigned to them, so the \\.\ or \\?\ approach doesn't work.
I've also tried FindFirstVolume, but that one only returns recognised data
volumes ones (iow: neither of the above).
Has anyone an idea ?
Regards,
Rudy Wieser
You'll have to enumerate the volumes as devices via device manager
functions, in order to get the volume paths except for extended partitions.

https://stackoverflow.com/a/40217846/1510085

In Windows, a volume is a partition which is a direct container of a file
system. So, extended partitions are not considered as volumes.
R.Wieser
2019-03-06 19:09:10 UTC
Permalink
Hey JJ,
Post by JJ
You'll have to enumerate the volumes as devices via device
manager functions, in order to get the volume paths except
for extended partitions.
https://stackoverflow.com/a/40217846/1510085
Thanks for that. I'll try to implement (part of) it and see what comes out.
Post by JJ
In Windows, a volume is a partition which is a direct container
of a file system. So, extended partitions are not considered as
volumes.
My intention is to access them as raw sector-based do-hingies, but I guess I
should have seeen that coming. :-)

Regards,
Rudy Wieser
Uwe Sieber
2019-03-11 11:26:25 UTC
Permalink
Since Vista Windows crates for each partition a Win32
device like \\.\Harddisk3Partition1 where the first
number is the disk's device number and the second the
partition number. These devices are created even for
unknown partition types for which is no volume created.
Before Vista you have to open \\.\PhysicalDriveN and
keep track the partion's start and end yourself.

Uwe
Post by R.Wieser
Hello all,
Windows has IOCTL_DISK_GET_DRIVE_LAYOUT to retrieve all partitions of a
physical drive, but I've not been able to find how to open such partitions
for raw access (letting the OS handle the nitty-gritty as well as not
interfering with access to other volumes on the same drive).
Part of the problem is that non-native (like type 0x83, Linux) as well as
extended partitions (like type 5) do, ofcourse, not have drive letters or
other IDs assigned to them, so the \\.\ or \\?\ approach doesn't work.
I've also tried FindFirstVolume, but that one only returns recognised data
volumes ones (iow: neither of the above).
Has anyone an idea ?
Regards,
Rudy Wieser
R.Wieser
2019-03-11 13:42:12 UTC
Permalink
Uwe,
Since Vista Windows crates for each partition a Win32 device
Ah, they wised up I see. Alas, I'm using XPsp3 here (forgot to mention it,
sorry). And that also explains why QueryDosDevice did not return them.

Thanks for the heads-up.

Regards,
Rudy Wieser

Loading...