NTFS reparse points

  • Thread starter Stanislaw Findeisen
  • Start date
S

Stanislaw Findeisen

I want to create a reparse point on NTFS (any).

Here
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/reparse_points.asp)
I read: "reparse points are used to implement NTFS file system links".
Here
(http://msdn.microsoft.com/library/d.../en-us/fileio/fs/hard_links_and_junctions.asp)
I read: "Soft links are implemented through reparse points".

However I can't see FILE_ATTRIBUTE_REPARSE_POINT turned on in any file /
directory shortcuts I create. In fact the only attribute set in
shortcuts created using Windows Explorer is FILE_ATTRIBUTE_ARCHIVE. (I
am using GetFileAttributes() to examine this.)

The questions are:

(1) Why is that so?
(2) Does anybody have any idea (sample code?) on how to create a reparse
point (the simpler, the better) using Python?

I am using Windows 2000 Professional, Python 2.4 and Mark Hammond's
Python for Windows Extensions build 204.

Thank you.

+-------------------------------------------------------+
| When replying, please replace "my_initials" in the |
| From: address field with my initials - that is, "SF". |
+-------------------------------------------------------+
 
D

Duncan Booth

Stanislaw said:
(2) Does anybody have any idea (sample code?) on how to create a reparse
point (the simpler, the better) using Python?

The only sample code I've seen for creating reparse points is in c or c++
and its quite a messy operation. See
http://www.sysinternals.com/Utilities/Junction.html for some sample code.

The easy way to do it from Python is just to make sure you have a program
such as junction on your system then use os.system('junction "%s" "%s"' %
(directory, target))

Be careful if you start creating junctions: Windows explorer doesn't
understand them: if you try to delete a folder which is actually a junction
it first deletes all the files inside the folder so the original folder
ends up empty as well.
 
R

Roel Schroeven

Stanislaw said:
I want to create a reparse point on NTFS (any).

Here
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/reparse_points.asp)
I read: "reparse points are used to implement NTFS file system links".
Here
(http://msdn.microsoft.com/library/d.../en-us/fileio/fs/hard_links_and_junctions.asp)
I read: "Soft links are implemented through reparse points".

However I can't see FILE_ATTRIBUTE_REPARSE_POINT turned on in any file /
directory shortcuts I create. In fact the only attribute set in
shortcuts created using Windows Explorer is FILE_ATTRIBUTE_ARCHIVE. (I
am using GetFileAttributes() to examine this.)

The questions are:

(1) Why is that so?

Because shortcuts aren't reparse points. They're just small files that
contain some information about the file or directory they point to and
how to open it.
 
T

Tony Nelson

Stanislaw Findeisen said:
However I can't see FILE_ATTRIBUTE_REPARSE_POINT turned on in any file /
directory shortcuts I create. In fact the only attribute set in
shortcuts created using Windows Explorer is FILE_ATTRIBUTE_ARCHIVE. (I
am using GetFileAttributes() to examine this.)
...

Shortcuts are files with a .lnk extention. Reparse points are NTFS
directory data.
________________________________________________________________________
TonyN.:' *firstname*nlsnews@georgea*lastname*.com
' <http://www.georgeanelson.com/>
 
R

Roger Upole

You should be able to use win32file.DeviceIoControl with
winioctlcon.FSCTL_SET_REPARSE_POINT to do this.
(winioctlcon was added in build 205)
The hard part is going to be constructing the
REPARSE_GUID_DATA_BUFFER struct to pass in
as the buffer.

hth
Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top