Hottest Free Downloads - DownloadPipe.com Over 197,000 downloads! Bookmark Now!
DownloadPipe.com - New Downloads Every Minute
 SEARCH:
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

.NET CF: Format Storage Card?

 
Goto page Previous  1, 2
   PDA (Home) -> Pocket PC - Developer RSS
Next:  App Configuration File  
Author Message
Youraputz

External


Since: May 28, 2008
Posts: 6



(Msg. 16) Posted: Tue Jun 03, 2008 6:01 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: microsoft>public>pocketpc>developer, others (more info?)

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
>
> "Youraputz" <Yourap....DeleteThis@gmail.com> wrote in message
>
> news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;

}
Back to top
Login to vote
Youraputz

External


Since: May 28, 2008
Posts: 6



(Msg. 17) Posted: Tue Jun 03, 2008 6:43 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Actually I just found this post, which claims the IOCTL I'm trying to
use has been removed in 6.0.

http://groups.google.com/group/microsoft.public.windowsce.platbuilder/...wse_thr

On Jun 3, 9:30 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
wrote:
> 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
>
> "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> news:d7d191aa-1bde-4151-9c7f-2d9c18f2520d@w34g2000prm.googlegroups.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
>
> >> "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> >>news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;
>
> > }
Back to top
Login to vote
Paul G. Tobey [eMVP]

External


Since: Sep 29, 2006
Posts: 164



(Msg. 18) Posted: Tue Jun 03, 2008 7:56 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hmmm. That wouldn't work (to remove that IOCTL). I'd be rather surprised
if it didn't work. The VOL: token *does* have to be all uppercase, at least
in CE5. Give that a try.

Paul T.

"Youraputz" <Youraputz DeleteThis @gmail.com> wrote in message
news:aa64f548-1a79-4cc3-86b4-75f464a3bd31@p39g2000prm.googlegroups.com...
> Actually I just found this post, which claims the IOCTL I'm trying to
> use has been removed in 6.0.
>
> http://groups.google.com/group/microsoft.public.windowsce.platbuilder/...wse_thr
>
> On Jun 3, 9:30 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
> wrote:
>> 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
>>
>> "Youraputz" <Yourap... DeleteThis @gmail.com> wrote in message
>>
>> news:d7d191aa-1bde-4151-9c7f-2d9c18f2520d@w34g2000prm.googlegroups.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
>>
>> >> "Youraputz" <Yourap... DeleteThis @gmail.com> wrote in message
>>
>> >>news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;
>>
>> > }
>
Back to top
Login to vote
Paul G. Tobey [eMVP]

External


Since: Sep 29, 2006
Posts: 164



(Msg. 19) Posted: Tue Jun 03, 2008 7:57 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.

"Youraputz" <Youraputz RemoveThis @gmail.com> wrote in message
news:aa64f548-1a79-4cc3-86b4-75f464a3bd31@p39g2000prm.googlegroups.com...
> Actually I just found this post, which claims the IOCTL I'm trying to
> use has been removed in 6.0.
>
> http://groups.google.com/group/microsoft.public.windowsce.platbuilder/...wse_thr
>
> On Jun 3, 9:30 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
> wrote:
>> 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
>>
>> "Youraputz" <Yourap... RemoveThis @gmail.com> wrote in message
>>
>> news:d7d191aa-1bde-4151-9c7f-2d9c18f2520d@w34g2000prm.googlegroups.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
>>
>> >> "Youraputz" <Yourap... RemoveThis @gmail.com> wrote in message
>>
>> >>news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;
>>
>> > }
>
Back to top
Login to vote
Chris Tacke, eMVP

External


Since: Mar 19, 2008
Posts: 49



(Msg. 20) Posted: Tue Jun 03, 2008 8:30 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 community
http://community.OpenNETCF.com

"Youraputz" <Youraputz DeleteThis @gmail.com> wrote in message
news:d7d191aa-1bde-4151-9c7f-2d9c18f2520d@w34g2000prm.googlegroups.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
>>
>> "Youraputz" <Yourap... DeleteThis @gmail.com> wrote in message
>>
>> news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;
>
> }
Back to top
Login to vote
Youraputz

External


Since: May 28, 2008
Posts: 6



(Msg. 21) Posted: Tue Jun 03, 2008 9:03 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.

On Jun 3, 10:57 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:
> 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.
>
> "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> news:aa64f548-1a79-4cc3-86b4-75f464a3bd31@p39g2000prm.googlegroups.com...
>
> > Actually I just found this post, which claims the IOCTL I'm trying to
> > use has been removed in 6.0.
>
> >http://groups.google.com/group/microsoft.public.windowsce.platbuilder...
>
> > On Jun 3, 9:30 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
> > wrote:
> >> 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
>
> >> "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> >>news:d7d191aa-1bde-4151-9c7f-2d9c18f2520d@w34g2000prm.googlegroups.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
>
> >> >> "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> >> >>news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;
>
> >> > }
Back to top
Login to vote
gupta25

External


Since: Mar 27, 2008
Posts: 4



(Msg. 22) Posted: Wed Jun 04, 2008 9:44 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jun 3, 12:03 pm, Youraputz <Yourap....RemoveThis@gmail.com> wrote:
> 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.
>
> On Jun 3, 10:57 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
> no instrument no spam DOT com> wrote:
>
> > 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.
>
> > "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> >news:aa64f548-1a79-4cc3-86b4-75f464a3bd31@p39g2000prm.googlegroups.com...
>
> > > Actually I just found this post, which claims the IOCTL I'm trying to
> > > use has been removed in 6.0.
>
> > >http://groups.google.com/group/microsoft.public.windowsce.platbuilder...
>
> > > On Jun 3, 9:30 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
> > > wrote:
> > >> 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
>
> > >> "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> > >>news:d7d191aa-1bde-4151-9c7f-2d9c18f2520d@w34g2000prm.googlegroups.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
>
> > >> >> "Youraputz" <Yourap....RemoveThis@gmail.com> wrote in message
>
> > >> >>news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;
>
> > >> > }

How would you guarantee that "DSK2:" is SD card? There are device like
Symbol MC70 series which has multiple partitions.
Back to top
Login to vote
Youraputz

External


Since: May 28, 2008
Posts: 6



(Msg. 23) Posted: Mon Jun 09, 2008 6:01 am
Post subject: Re: .NET CF: Format Storage Card? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Well in general you can't, however in our device there is only 1
attached CF card, and the users have no access to it.

On Jun 4, 12:44 pm, gupta25 <gupt....DeleteThis@gmail.com> wrote:
> On Jun 3, 12:03 pm, Youraputz <Yourap....DeleteThis@gmail.com> wrote:
>
>
>
> > 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.
>
> > On Jun 3, 10:57 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
> > no instrument no spam DOT com> wrote:
>
> > > 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.
>
> > > "Youraputz" <Yourap....DeleteThis@gmail.com> wrote in message
>
> > >news:aa64f548-1a79-4cc3-86b4-75f464a3bd31@p39g2000prm.googlegroups.com...
>
> > > > Actually I just found this post, which claims the IOCTL I'm trying to
> > > > use has been removed in 6.0.
>
> > > >http://groups.google.com/group/microsoft.public.windowsce.platbuilder...
>
> > > > On Jun 3, 9:30 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
> > > > wrote:
> > > >> 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
>
> > > >> "Youraputz" <Yourap....DeleteThis@gmail.com> wrote in message
>
> > > >>news:d7d191aa-1bde-4151-9c7f-2d9c18f2520d@w34g2000prm.googlegroups.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
>
> > > >> >> "Youraputz" <Yourap....DeleteThis@gmail.com> wrote in message
>
> > > >> >>news:86bc5575-25c8-4501-af2b-053d05056e49@u12g2000prd.googlegroups.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;
>
> > > >> > }
>
> How would you guarantee that "DSK2:" is SD card? There are device like
> Symbol MC70 series which has multiple partitions.
Back to top
Login to vote
Stefan Gebhart

External


Since: Sep 15, 2009
Posts: 1



(Msg. 24) Posted: Tue Sep 15, 2009 2:08 am
Post subject: snippet please [Login to view extended thread Info.]
Archived from groups: microsoft>public>pocketpc>developer (more info?)

I'm also searching for a Solution for this Problem...
Would you be so kind and post your Code using the FormatVolume() ?



Posted as a reply to:

Re: .NET CF: Format Storage Card?

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.

On Jun 3, 10:57 am, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorials/aspnet/3d49fa0d-a120-4977-842a-6d...17b6d74
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Hard reset/ storage format WM5 - I try to use below coding to hard reset WM5 but it doesn't work. This coding functions as soft reset in WM5. Kindly pls help. [DllImport("Coredll.dll")] private static extern int KernelIoControl(int dwIoControlCode, IntPtr lpInBuf...

Name of storage card - I still want to get the name of the storage card with visual basic commands for the pocket pc Is this not possible to do with DirectoryInfo or so? Anyone simple code suggestions? Thanks, Hans

GetFullPath of storage card - How can I get the name of the Storage Card on the pocket PC? When I create a specific directory on the storage card and do GetFullpath("specific directory") I only get "\specific directory" as the path and not someting like "St...

how to run EXE from storage card - Hello All, I need some help here.I want to run an EXE with all paramenters from a storage card on windows Mobile device.I have EXE named HOPPER.EXE on storage card,but problem is,if i double click the exe it takes default parameters and..

Get Storage Card Free Space? - Hello How can I get the Free Space of a Storage Card in .NET? I tried to call GetDiskFreeSpaceEx with "\Storage Card" as path, but sometimes it is returning a negative value?! Thanks Rampf
       PDA (Home) -> Pocket PC - Developer All times are: Pacific Time (US & Canada) (change)
Goto page Previous  1, 2
Page 2 of 2

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows Forums
 Game Forums
 Linux Forums
 Mac Forums
  PDA Forums
 Mobile Forums
  Top  |  Store  |  RSS Feeds RSS  |  Data Feeds  |  Advertise  |  Submit  |  Bookmark  |  Newsletter  |  Contact