Shared Read/Write and Hard Links on Windows

Most people don’t know, but Windows does support hard links, as long as you are using NTFS. It also supports shared read and write just like *nix, as long as you use the right APIs.

This Python script demonstrates the creation of a hard link, that the hard link and the original file actually point to the same place, and it also demonstrates that you can open the same file multiple times for reading and writing if you use the right flags.

The script actually uses a couple more features, like ‘FLAG_SEQUENTIAL_SCAN’, which can improve the process of reading a file by signaling to Windows that it shouldn’t try to load the whole file into the file cache.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s