Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fat Format in CE 6.0?

43 views
Skip to first unread message

tdacosta

unread,
Jun 13, 2007, 11:11:10 AM6/13/07
to
Previously I have been able to format FAT drives under CE using the following
code:

hVolume = CreateFile(TEXT("\\NORFlash\\VOL:"),
GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hVolume== INVALID_HANDLE_VALUE)
{
wprintf(L"Failed to open handle to NORFlash volume\r\n");
return FALSE;
}

DWORD cb = 0;
FMTVOLREQ fv;

// Format the drive.
ZeroMemory(&fv, sizeof(fv));
fv.fv_flags = FMTVOL_QUICK;
fv.fv_flags |=FMTVOL_16BIT_FAT;

retVal= DeviceIoControl(hVolume, IOCTL_DISK_FORMAT_VOLUME, &fv,
sizeof(fv), NULL, 0, &cb, NULL);
return retVal;


This no longer seems to work under 6.0, as I keep getting an error code of
0x57 (The parameter is incorrect) when I complete the DeviceIoControl call.
Is this method of formatting drives not available under 6.0?

Sachin Patel [MSFT]

unread,
Jun 13, 2007, 10:43:40 PM6/13/07
to
Yes, this IOCTL has been removed in 6.0. You can use the FormatVolume API:

http://msdn2.microsoft.com/en-us/library/aa918576.aspx

Sachin

--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2006 Microsoft Corporation. All rights
reserved.


"tdacosta" <tdac...@discussions.microsoft.com> wrote in message
news:94866E00-BB2D-417F...@microsoft.com...

tdacosta

unread,
Jun 13, 2007, 11:55:00 PM6/13/07
to
Hi Sachin,

Thanks for the reply, the FormatVolume is working fine. I did have to use
the Storage Manager functions to obtain a handle to the partition. Opening
the "\drive\vol:" using CreateFile did not yield a usable handle for
FormatVolume.

As for the DeviceIoControl that I was trying, it is still listed in the 6.0
documentation:

http://msdn2.microsoft.com/en-ca/library/aa914221.aspx

I hope the documentation gets fixed up with these sorts of changes.

...Tony

0 new messages