Stuck at FILE_ATTRIBUTE_REPARSE_POINT attribute
-
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
-
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
-
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
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
-
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
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.)