Y
Youraputz
Thanks for the reply, I've already switched my code over to use
FormatVolume(). All of this is in C#/CE6.0, but it is getting very
close. I'm now creating a Format_Params struct, filling the
approriate values, and just toying with the flags. Interestingly
enough if I use "Hard Disk\\VOL:" I get error 87 again, but if I just
use "DSK2:" it works fine.
FormatVolume(). All of this is in C#/CE6.0, but it is getting very
close. I'm now creating a Format_Params struct, filling the
approriate values, and just toying with the flags. Interestingly
enough if I use "Hard Disk\\VOL:" I get error 87 again, but if I just
use "DSK2:" it works fine.
And I should have said that, since you're using FAT, you should be using
FormatVolume(), not telling the disk driver to do a low-level format...
Paul T.
Actually I just found this post, which claims the IOCTL I'm trying to
use has been removed in 6.0.
I'm 99% certain that the "VOL:" text in the name is case sensitive and
*must* be all upper case (thank Paul Tobey for his pain last week in
finding
that during an unrelated issue).
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com
On May 29, 11:07 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
wrote:
87 == invalid parameter, so something you're sending it it doesn't
like.
Do
you have a working example in C? That's where I'd start.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com
I tried changing the nulls to IntPtr.Zero, and as for the escaped
char, sorry, I missed the @ before the string. Checking GetLatError
is returning 87.
I just wrote a version in C to remove any of the C# issues that may
exist. I still get 87 when I run this code, but here it is, I've
included wince600\public\common\oak\inc and wince600\public\common\sdk
\inc in the project. I also tried changing "storage card" to "hard
disk" and tried with a usb drive, same error 87.
#include <windows.h>
#include <diskio.h>
#include <winioctl.h>
#include <stdio.h>
void main(int argc, char *argv[])
{
HANDLE hDevice;
BOOL bResult;
DWORD junk;
hDevice = CreateFile(TEXT("\\Storage Card\\Vol:"), 0, FILE_SHARE_READ
| FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevice == INVALID_HANDLE_VALUE)
{
printf("Invalid Handle\n");
return;
}
bResult = DeviceIoControl(hDevice,IOCTL_DISK_FORMAT_VOLUME, NULL, 0,
NULL, 0, &junk, (LPOVERLAPPED)NULL);
if (bResult == false)
{
printf("Last Error: %d\n", GetLastError());
}
CloseHandle(hDevice);
return;
}