U¿ytkownik "Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam
DOT com> napisa³ w wiadomo¶ci
I'm sure you'll get *some* exception, but which one isn't clear to me...and,
of course, there are multiple other things (full), that would also cause
exceptions.
Well sometimes you will get an exception and sometimes you won't even if
you
call write function and usb key is write protected. This is strange
behaviour - maybe it is some kind of buffered (cached) writing?
You might try, at least in CE 4.x and higher, getting the partition
information from the Storage Manager by calling GetParititionInfo. The
structure that is filled-in seems like it has a good spot to indicate if the
partition is read-only (PARTITION_ATTRIBUTE_READONLY). In this case, it
might even be more likely that the GetStoreInfo() call would return
STORAGE_DEVICE_FLAG_READONLY when the lock switch was on, but it might
return STORE_ATTRIBUTE_READONLY instead, too (!).
How can I call this functions, by using P/Invoke? I'm working on a smart
device project depending on Compact Framework library only . I don't use
Platform Builder or OpenNetCF. The usb key is a cheap no name device
manufactured in some slave labour factory in China.
Rgds
Matijaz