467,145 Members | 995 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

Suggestions regarding Removable Media Needed.

Hello -
I am in need of more help regarding an approach to accomplishing the
following:

We have a need to change the Volume serial numbers of a bunch of
preprogrammed IDE Solid State Drive modules. The modules have
been duplicated and thus the need to change the serial number
on each one. My approach is to use a USB to IDE adapter cable
and write a C# routine which will automate the writing of the serial
#. At this point, I have a routine written that works very well.
The routine calls a number of Win32 API functions (CreateFile, etc)
to accomplish this.

Now the problem... I need to know how to determine whether the Solid
State Drive has been write protected. How do I go about accomplishing
this? These modules have a small slide switch that can be used for
write protecting the module. I want to check to see whether this
module has been write protected before I attempt to change the serial
number. This way I can alert the operator to disable the write
protection. If I attempt to use the GetVolumeInfo function, it does
not work properly. I think what I need to do is to Unmount the drive
and then Mount the drive so that the operating system will read the
attributes correctly for a subsequent GetVolumeInfo call.

Do I have the right idea regarding a valid method? Either way, I need
some pointers as to how and accomplish this. My C# experience is a bit
on the newbie side, so keep that in mind with any suggestions.

Thanks for any advice that you can offer...
Jim
Aug 23 '07 #1
  • viewed: 1508
Share:
1 Reply
In article <46**********************@roadrunner.com>,
jf***@tampaCANTbaySTAND.rrSPAM.com says...
We have a need to change the Volume serial numbers of a bunch of
preprogrammed IDE Solid State Drive modules. The modules have
been duplicated and thus the need to change the serial number
on each one. My approach is to use a USB to IDE adapter cable
and write a C# routine which will automate the writing of the serial
#. At this point, I have a routine written that works very well.
The routine calls a number of Win32 API functions (CreateFile, etc)
to accomplish this.
I would think it might be easier to use WMI:

http://www.eggheadcafe.com/articles/20030511.asp
Now the problem... I need to know how to determine whether the Solid
State Drive has been write protected. How do I go about accomplishing
this? These modules have a small slide switch that can be used for
write protecting the module. I want to check to see whether this
module has been write protected before I attempt to change the serial
number. This way I can alert the operator to disable the write
protection. If I attempt to use the GetVolumeInfo function, it does
not work properly. I think what I need to do is to Unmount the drive
and then Mount the drive so that the operating system will read the
attributes correctly for a subsequent GetVolumeInfo call.
You should be able to try and create a dummy file (via the FileStream
class) and catch the associated exception that would be thrown when the
device is write protected (probably some type of IOException).

--
Patrick Steele (pa*****@mvps.org)
http://weblogs.asp.net/psteele
Aug 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Heiko Selber | last post: by
7 posts views Thread by glenn | last post: by
4 posts views Thread by Per Juul Larsen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.