Maxim,
My apologies for a stupid post. IOCTL_DISK_SET_DRIVE_LAYOUT_EX is what I am
using. I somehow managed to get my brain twisted when I typed the post and
put GET_PARTITION_INFO instead. (Duh)
Anyway, IOCTL_DISK_SET_DRIVE_LAYOUT_EX is what I am using and the results do
not seem to show up in the disk manager.
Here is a snippet of the code.
HANDLE h = CreateFile (“\\.\PHYSICALDRIVE2”, GENERIC_WRITE |
GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE)
{
// display error
}
DWORD returned;
BYTE buffer[1024];
BOOL b = DeviceIoControl(h, // handle to device
IOCTL_DISK_GET_DRIVE_LAYOUT_EX, // dwIoControlCode
NULL, // lpInBuffer
0, // nInBufferSize
buffer, // output buffer
1024, // size of output buffer
&returned, // number of bytes returned
NULL); // OVERLAPPED structure
if (!b)
{
// display error
}
DRIVE_LAYOUT_INFORMATION_EX * li = (DRIVE_LAYOUT_INFORMATION_EX *)buffer;
li->PartitionEntry[0].RewritePartition = TRUE;
li->PartitionEntry[0].Mbr.PartitionType = PARTITION_UNIX; // so that NT
will not use it.
b = DeviceIoControl(h, // handle to device
IOCTL_DISK_SET_DRIVE_LAYOUT_EX, // dwIoControlCode
buffer, // lpInBuffer
returned, // nInBufferSize
NULL, // output buffer
0, // size of output buffer
&returned, // number of bytes returned
NULL); // OVERLAPPED structure
if (!b)
{
// display error
}
b = DeviceIoControl(h, // handle to device
IOCTL_DISK_UPDATE_PROPERTIES, // dwIoControlCode
NULL, // lpInBuffer
0, // nInBufferSize
NULL, // output buffer
0, // size of output buffer
&returned, // number of bytes returned
NULL); // OVERLAPPED structure
if (!b)
{
//display error
}
In this case, I am trying to turn an existing unformatted partition into a
UNIX partition. But no matter what I do, remove partitions, add partitions,
etc. the results never show up in the DiskManager.
Thanks,
Don
“Maxim S. Shatskih” wrote in message
news:xxxxx@ntfsd…
> IOCTL_DISK_SET_DRIVE_LAYOUT is the correct way.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> ----- Original Message -----
> From: “Don”
> Newsgroups: ntfsd
> To: “Windows File Systems Devs Interest List”
> Sent: Wednesday, May 26, 2004 10:15 PM
> Subject: [ntfsd] IOCTL_DISK_GET_PARTITION_INFO_EX and the DiskManager
>
>
> > Hi all,
> >
> > I have been attempting to use IOCTL_DISK_GET_PARTITION_INFO_EX and
> > IOCTL_DISK_SET_PARTITION_INFO_EX to create partitions on a disk. I am
having
> > strange results that I don’t understand, and I hope that someone can
help
> > me.
> >
> > I am running on Windows XP. If I use IOCTL_DISK_SET_PARTITION_INFO_EX to
> > create a partition on an empty disk, the call succeeds and everything
seems
> > to work OK. If I then use the GET call to read back the partition
> > information, it shows that my changes have been made. However, if I then
use
> > the DiskManager applet to look at the disk, the partition is not shown.
> >
> > Even after doing a reboot, the GET call shows the partition but the
> > DiskManager does not.
> >
> > This is a simple MBR disk.
> >
> > Can anyone tell me what I am doing wrong here? It is almost as if the
> > DiskManager is using some other set of information besides what is in
the
> > Partition Table?
> >
> > Also, when I use the GET call, it always returns an MBR disk, never a
GPT
> > disk. Is this to be expected on XP?
> >
> > Thanks,
> >
> > Don
> >
> >
> >
> > —
> > Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
> >
> > You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>