format hard drive (why is this bad)

  • Thread starter Thread starter daben
  • Start date Start date
D

daben

Hi All

I have searched for a solution to this on all groups I can think of
but the best I see is the admonition that allowing for formatting a
hard drive w/ .Net framework is bad b/c someone may write some code
and what some other persons harddrive by hiding the code in some
application. I really don't see this as a problem, buyer beware and
such. I don't want to start a massive thread on the evils/goods of
this .. I just want to be able to format a removable (hard drive) so
that I can use it as a weekly backup target. Is there an API for this
(better yet a .Net framework class) that I am missing?

thanks
daben
 
Not supporting formatting code is irrelevent to that argument. Even without
a class to format a drive, a executable with the proper permssions(Win32 &
..NET) could still write their own code to do it or totally destroy the drive
anyway.

Anyway, I don't know of a .NET solution for formating, but there is source
code for a C version here:
http://www.systernals.com/ntw2k/source/fmifs.shtml You may be able to
convert that into a managed C++ assembly. If not(you don't have the
experiance in C++ or whatnot) and no one else replies with a better
solution, leave a post and I'll see if I can hack some kinda class up to
wrap the FormatEx function.
 
Daniel O'Connell said:
Not supporting formatting code is irrelevent to that argument. Even without
a class to format a drive, a executable with the proper permssions(Win32 &
.NET) could still write their own code to do it or totally destroy the drive
anyway.

Anyway, I don't know of a .NET solution for formating, but there is source
code for a C version here:
http://www.systernals.com/ntw2k/source/fmifs.shtml You may be able to
convert that into a managed C++ assembly. If not(you don't have the
experiance in C++ or whatnot) and no one else replies with a better
solution, leave a post and I'll see if I can hack some kinda class up to
wrap the FormatEx function.

Forgot to mention, that is assuming that the architecture is still the same
on 2k+ and you are only targetting NT based systems, otherwise I don't know
waht to tell you.
 
A workaround would be to start a new process of format.exe and pass it the
correct command parameters.
 
Or, when running W2K3, you could use the Management namespace classes (WMI wrappers) and the 'Win32_Volume' WMI class (check the WMI
sdk doc's on msdn for detaols).

Willy.
 
Back
Top