Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2008

Tip: Looking for answers? Try searching our database.

Working the disk sectors directly from C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
glennanthonyb - 14 May 2008 11:29 GMT
Hi

Is there a way of working with sectors directly in C#.  Any pointers, C# or
not, would be appreciated.

This is related to a previous post on file shredding in C#.

Thanks

Glenn
Jon Skeet [C# MVP] - 14 May 2008 11:39 GMT
> Is there a way of working with sectors directly in C#.  Any pointers, C# or
> not, would be appreciated.
>
> This is related to a previous post on file shredding in C#.

My gut feeling is that you'd have to identify the native APIs you want
to use, then wrap them using P/Invoke.

Jon
Ignacio Machin ( .NET/ C# MVP ) - 14 May 2008 14:57 GMT
> Hi
>
[quoted text clipped - 6 lines]
>
> Glenn

Hi,

NO.

You have to P/invoke . not only that but I don't know if there is any
API function that you can use for that.

You need to ask in unmanaged NG and apply the same from .NET
Ignacio Machin ( .NET/ C# MVP ) - 14 May 2008 14:57 GMT
> Hi
>
[quoted text clipped - 6 lines]
>
> Glenn

of course, you can always call int 21 :)
colin - 14 May 2008 15:07 GMT
you can open the disc in native/raw format just as if it was a normal file,
ofc this is risky if it has an atatched file system
its so long since I did it that ive forgoton the the filenames,
you have to use.

when I did it discs were <1gb i later tried my prgram on a 4gb drive and
realised I needed 64 bit version or drasticaly change it lol.
duno if this helps

ofc i dont know if your stil 'allowed' to do this especialy with vista.

there is also an internal sector relocation used by defraggers,
infact u can relocate 2 sectors from the dos cmd line if you realy wanted
to.

id love to move all the most used sectors and those used at boot time to
be in an optimal place, norton tools used to have this facility,
but they seemed to have droped that feature,
i havnt given them any buisiness since then.

Colin =^.^=

> Hi
>
[quoted text clipped - 6 lines]
>
> Glenn
Peter Duniho - 14 May 2008 18:01 GMT
> Is there a way of working with sectors directly in C#.  Any pointers, C#  
> or
> not, would be appreciated.

P/invoke is technically "from C#" when used in C#, so sure...you should be  
able to do it.  :)

That said, I'll reiterate part of my comment from the previous thread: are  
you sure you need to do this?  Your description of the level of "file  
shredding" you want didn't suggest any need to access the disk sectors  
directly.

Pete
glennanthonyb - 15 May 2008 08:24 GMT
If it was going to be simple, I'd give it a try, as it doesn't appear to be
straightforward, I'll stick with the original, much simpler, method.

Thanks for the advice

Glenn

>> Is there a way of working with sectors directly in C#.  Any pointers, C#
>> or
[quoted text clipped - 9 lines]
>
> Pete

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.