NTLinks + NTLinksMaker: NTFS links creation and information

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

Couly you please add one field (or multiple fields/units) to display all the file names of a hard linked file. I found one example here: http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

tbeu, thanks for idea, I've added such feature, please test it.

NTLinks 1.5.2.180 32/64

You can see all hardlinks in single string or get them one by one. Plugin allows to return first 10 items (with indexes 0-9), I think it is enough.
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

MVV wrote:I've added such feature, please test it.
Wow, that was quick! Thank you! Cannot test on WinXPSP3 :cry:
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
zeeko
Junior Member
Junior Member
Posts: 50
Joined: 2009-02-21, 19:57 UTC

Post by *zeeko »

MVV, thanks for the great feature.
It works on Windows7 (TC8B17a x64 and 7.56a).
Is it possible to have a custom separator for file names? LineFeed (\n) separator would be great for tooltips (each file name in the new row).
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

tbeu wrote:
MVV wrote:I've added such feature, please test it.
Wow, that was quick! Thank you! Cannot test on WinXPSP3 :cry:
Yes, unfortunately XP doesn't provide similar API, so this field doesn't work here (the only way to find hardlinks on XP is to copy file index and search all files with same index within whole drive). And I need to link theese functions dynamically to keep backward compatibility.
zeeko wrote:Is it possible to have a custom separator for file names? LineFeed (\n) separator would be great for tooltips (each file name in the new row).
I've tried "\n" and "\r\n" first of all, but TC replaces them with spaces and wraps long lines itself, it looks quite ugly. So I think comma is the best of the rest.

But you can use construction like [=ntlinks.HLNK_Paths.0]\n[=ntlinks.HLNK_Paths.1]\n[=ntlinks.HLNK_Paths.2]... to see any number of items on separate lines (if the field is empty, empty line will be shown).
zeeko
Junior Member
Junior Member
Posts: 50
Joined: 2009-02-21, 19:57 UTC

Post by *zeeko »

Thanks for the tip!
Is there a way to display the size of symbolic link target file?
tc.size displays 0 bytes for symbolic link size, and I can't find a way to display target file size in the tooltips.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think you can't. Symbolic links for files always have zero size, also their attributes may be outdated when you sync folders (therefore I don't use them). However hardlinks may have outdated dates too.
zeeko
Junior Member
Junior Member
Posts: 50
Joined: 2009-02-21, 19:57 UTC

Post by *zeeko »

I did some search how to get target file size. There is a flag in CreateFile function responsible for symlink processing. If dwFlagsAndAttributes param contains FILE_FLAG_OPEN_REPARSE_POINT value, functions GetFileSize, GetFileSizeEx, GetFileInformationByHandle, GetFileInformationByHandleEx,... return symbolic link size - 0 bytes. If file is open without FILE_FLAG_OPEN_REPARSE_POINT value, functions return target file size > 0 bytes. Could you please check this, and if it works, add another field with target file size?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I thought about it, but I was too lazy to add field with such ammount of units (tc.size provides 8 units - bytes, kbytes, Mbytes, Gbytes and floating ones). Maybe I'll add such field with only integral units.

Well, I found extra compact way to work with units (B, KB, MB, GB). :D

Code: Select all

filesize.QuadPart>>=10*UnitIndex;

NTLinks 1.5.2.190 32/64
+ new field to get real size of a file behind symlink
zeeko
Junior Member
Junior Member
Posts: 50
Joined: 2009-02-21, 19:57 UTC

Post by *zeeko »

Thanks!
It works, but only for x86.
wdx_NTLinks_1.5.2.190.zip contains an old version of NTLinks.wdx64, v1.5.2.160. :o
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Well, sorry. :)
I'm using only TCx86 usually (but I have 64-bit versions for tests), so didn't notice that.

Package is updated.


Added on Feb 06 2012:

New version is out, a pair of bugs was fixed.

NTLinks 1.5.3.200 32/64
* wrong real path for file symlinks
* full target was shown instead of relative one sometimes
zeeko
Junior Member
Junior Member
Posts: 50
Joined: 2009-02-21, 19:57 UTC

Post by *zeeko »

Is it possible to set HLNK_Count to zero if symlink/junction is not valid (RP_IsValid=No) ?
Or HLNK_Count=0 holds different information?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Theese are completely different things. Number of hardlinks is a number of folder entries, and it cannot be less than 1. Every reparse point is a separate file system object and it also has folder entry, it is not correct to mix hardlinks and reparse points.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Another pair of bugs fixed.

NTLinks 1.5.3.214 (changes since 1.5.3.200):
* improved junction detection if path starts with volume GUID
* ANSI to Unicode conversion bug in non-Unicode functions (introduced in 1.5.0.108)

NTLinks 1.5.3.214 32/64
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

Wow, symlink file target resolution works on XP too even though XP doesn't support file symlinks. That's very cool! Thank you for this update.

Edit: However, RP_IsValid returns Yes on XP for file symlinks. Shouldn't it return No instead (and still resolve the symlink, since your plugin can?)
Post Reply