From: Ezchdahal on
Hi,

I've been tasked with writing the front-end application to a storage array
product. One of the features is a setup wizard to initialize/partition/format
a new array. I've been looking into the problem and I'm having a hard time
figuring out how to get this done.

My expectation was that IOCTL_DISK_CREATE_DISK would initialize the disk for
me (I haven't got to partitioning or formatting yet). However, after the
DeviceIO call executes successfully nothing changes within the Disk
Management Snap-In. Shouldn't the disk entry now say "Initialized"? Either
the code or my expectations are incorrect =) Here's the code...

HANDLE hDevice;
BOOL bResult;
DWORD junk;

hDevice = CreateFile("\\\\.\\PhysicalDrive2",
FILE_ALL_ACCESS,
FILE_SHARE_READ |
FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);

if (hDevice != INVALID_HANDLE_VALUE)
{
CREATE_DISK cd;
cd.PartitionStyle = PARTITION_STYLE_MBR;
cd.Mbr.Signature = 0x28;

bResult = DeviceIoControl(hDevice,
IOCTL_DISK_CREATE_DISK,
&cd, sizeof(cd),
NULL, 0,
&junk,
(LPOVERLAPPED) NULL);

CloseHandle(hDevice);
}

Perhaps the signature field has something to do with the problem. It wasn't
clear what I should set it to. I tried 0 and 0x28.

Thanks for your help...
From: William DePalo [MVP VC++] on
"Ezchdahal" <Ezchdahal(a)discussions.microsoft.com> wrote in message
news:C0E50B96-F464-4033-AB84-0946AAD4BCDF(a)microsoft.com...
> My expectation was that IOCTL_DISK_CREATE_DISK would initialize the disk
> for
> me (I haven't got to partitioning or formatting yet). However, after the
> DeviceIO call executes successfully nothing changes within the Disk
> Management Snap-In. Shouldn't the disk entry now say "Initialized"? Either
> the code or my expectations are incorrect =) Here's the code...

If no one responds here, try posting again in the kernel group

microsoft.public.win32.programmer.kernel

Regards,
Will