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