Suggestions regarding Removable Media Needed.

J

Jim Flanagan

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
 
P

Patrick Steele

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top