Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Stuck at FILE_ATTRIBUTE_REPARSE_POINT attribute

Stuck at FILE_ATTRIBUTE_REPARSE_POINT attribute

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmindata-structureshelptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vishalgpt
    wrote on last edited by
    #1

    Hi to all, I am writing a program which will copy a directory tree and delete the source, every thing works as planned, but given that a reparse point could point anywhere (even network drives), one need to be careful when deleting recursively, it could end up deleting way more than on a target system. How to deal with this situation when dealing with FILE_ATTRIBUTE_REPARSE_POINT, whether it is a recursive copy routine or delete routine.

    Regards, Vishal

    L J 3 Replies Last reply
    0
    • V vishalgpt

      Hi to all, I am writing a program which will copy a directory tree and delete the source, every thing works as planned, but given that a reparse point could point anywhere (even network drives), one need to be careful when deleting recursively, it could end up deleting way more than on a target system. How to deal with this situation when dealing with FILE_ATTRIBUTE_REPARSE_POINT, whether it is a recursive copy routine or delete routine.

      Regards, Vishal

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It is not quite straightforward, you should review http://msdn.microsoft.com/en-us/library/windows/desktop/aa365503(v=vs.85).aspx[^].

      Veni, vidi, abiit domum

      1 Reply Last reply
      0
      • V vishalgpt

        Hi to all, I am writing a program which will copy a directory tree and delete the source, every thing works as planned, but given that a reparse point could point anywhere (even network drives), one need to be careful when deleting recursively, it could end up deleting way more than on a target system. How to deal with this situation when dealing with FILE_ATTRIBUTE_REPARSE_POINT, whether it is a recursive copy routine or delete routine.

        Regards, Vishal

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi, 1.) Call DeviceIoControl[^] with FSCTL_GET_REPARSE_POINT[^] and get a REPARSE_DATA_BUFFER[^]. 2.) Call IsReparseTagMicrosoft[^] and check that the the REPARSE_DATA_BUFFER.ReparseTag[^] member is IO_REPARSE_TAG_SYMBOLIC_LINK[^] or IO_REPARSE_TAG_MOUNT_POINT[^]. 3.) If so... begin copying the characters beginning at REPARSE_DATA_BUFFER.PrintNameOffset[^] and stop when you reach REPARSE_DATA_BUFFER.PrintNameLength[^]. 4.) Now that you have the target path calculate with text comparisons whether or not operating on the target would cause infinite recursion. If your input is not normalized then you can apply C14N by calling PathCanonicalize functio

        1 Reply Last reply
        0
        • V vishalgpt

          Hi to all, I am writing a program which will copy a directory tree and delete the source, every thing works as planned, but given that a reparse point could point anywhere (even network drives), one need to be careful when deleting recursively, it could end up deleting way more than on a target system. How to deal with this situation when dealing with FILE_ATTRIBUTE_REPARSE_POINT, whether it is a recursive copy routine or delete routine.

          Regards, Vishal

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          vishalgpt wrote:

          I am writing a program which will copy a directory tree and delete the source

          Do you have an actual business case for this?

          vishalgpt wrote:

          How to deal with this situation when dealing with FILE_ATTRIBUTE_REPARSE_POINT

          Depends on your business case but one very obvious and easy solution involves the following steps. - Stop - Report an error. Some more complex solutions would be to span the tree before starting and refuse to continue if any problems are found. Just curious what is your application going to do if the the files/directories are in use when you are deleting (which is probably much more likely than what you are asking.)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups