Working the disk sectors directly from C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • glennanthonyb

    Working the disk sectors directly from C#

    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]

    #2
    Re: Working the disk sectors directly from C#

    On May 14, 11:29 am, "glennantho nyb" <glenn.csh...@y ahoo.co.ukwrote :
    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

    Comment

    • Ignacio Machin ( .NET/ C# MVP )

      #3
      Re: Working the disk sectors directly from C#

      On May 14, 6:29 am, "glennantho nyb" <glenn.csh...@y ahoo.co.ukwrote :
      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
      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

      Comment

      • Ignacio Machin ( .NET/ C# MVP )

        #4
        Re: Working the disk sectors directly from C#

        On May 14, 6:29 am, "glennantho nyb" <glenn.csh...@y ahoo.co.ukwrote :
        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
        of course, you can always call int 21 :)

        Comment

        • colin

          #5
          Re: Working the disk sectors directly from C#

          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 =^.^=

          "glennantho nyb" <glenn.csharp@y ahoo.co.ukwrote in message
          news:eLtTy1atIH A.4528@TK2MSFTN GP03.phx.gbl...
          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
          >
          >
          >

          Comment

          • Peter Duniho

            #6
            Re: Working the disk sectors directly from C#

            On Wed, 14 May 2008 03:29:50 -0700, glennanthonyb
            <glenn.csharp@y ahoo.co.ukwrote :
            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

            Comment

            • glennanthonyb

              #7
              Re: Working the disk sectors directly from C#

              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

              "Peter Duniho" <NpOeStPeAdM@nn owslpianmk.comw rote in message
              news:op.ua5lk31 l8jd0ej@petes-computer.local. ..
              On Wed, 14 May 2008 03:29:50 -0700, glennanthonyb
              <glenn.csharp@y ahoo.co.ukwrote :
              >
              >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

              Comment

              Working...