Markmail

Hi, Im in a process of building a program for an programing assignment, which requires to have low level access to HDD. I need my program to do the following:

-Read the hard drive bit by bit
-Acess boot sector to read information
-Read what's in the file header
-Read the file metafiles
-Read files in bits and l
-and perhaps read the alternative datasteam of a file

Is C# good for those kind of job how easy/hard is to program it with C#

My orignial plan was to do it in Java, but ppl said Java is not good for those kind job~~i thought i'd give C# a go~~

I've never done any programing in C#, but im alright with Java & C. How hard is it for me to program in C#


appreciate any advices

thanks in advance

Mark



Re: Visual C# General C# ANY GOOD?? for programs need low level access to HDD??

Matthew Watson

To be honest, C or C++ is a much better choice for that kind of thing.

You *could* do it with C#, but I think it might be a bit fiddly and annoying.





Re: Visual C# General C# ANY GOOD?? for programs need low level access to HDD??

James Curran

Neither C# nor Java would be good for such a task, since both were designed specifically to prevent you from doing exactly that. (actually, they were designed to prevent a virus author from doing that).




Re: Visual C# General C# ANY GOOD?? for programs need low level access to HDD??

Ryan Lamansky

The tricky part here is you need to dig deep into the Windows API to gain such low level access, and those APIs have not yet been mapped to the .NET Framework. Where in C++, you just need the proper headers, C# would first require you to convert enough of those header objects to C# objects and conver the API calls to DllImport P/Invoke calls.

If you manage to do all that, though, C# would be a much friendlier environment for processing and presentation of what you dig up Smile

-Ryan / Kardax





Re: Visual C# General C# ANY GOOD?? for programs need low level access to HDD??

Markmail

that's exactly the reason why im trying to write it in higher level language,

coz eventually I will need to display the drive content in a usable way to perform some analysis and detect alterative data stream....etc

so how hard/easy is it to convert those C or C++ headers and use those API calls





Re: Visual C# General C# ANY GOOD?? for programs need low level access to HDD??

Peter Ritchie

There's nothing stopping you from PInvoking all the functions you'd need to call in a "lower-level" language like C++.

It gets tedious declaring all the DllImports and the structures you might need; for that reason I suggest doing that in C++ and using C++ Interop to make wrappers that can be used by managed code (C++/CLI, C#, VB.Net, etc...).




Re: Visual C# General C# ANY GOOD?? for programs need low level access to HDD??

Jeroen Vos

Well, declaring the DllImports and structures only get tedious if they are not on http://www.pinvoke.net/. Which will be a great help if you do decide to write your program in C#.