idrassi / DirHash

Windows command line utility to compute hash of directories and files
BSD 3-Clause "New" or "Revised" License
111 stars 11 forks source link

DirHash does not support Windows long path names (over 260 characters). #10

Closed tERyceNzAchE closed 3 years ago

tERyceNzAchE commented 3 years ago

Windows 10, Version 1607 (and later) should not have any issues with long path names (with LongPathsEnabled set to 1).
DirHash should support path names longer than 260 characters.

Currently it will throw the following error: Error: Input directory/file path is too long. Maximum length is 260 characters

idrassi commented 3 years ago

Thanks for the report. This limitation comes from the use of PathXXX functions from Shlwapi.h which are useful for dealing with path values (PathCanonicalize, PathFindFileName, PathMatchSpec, PathFileExists and PathIsDirector).

There seem to be equivalent functions in Pathcch.h header that are compatible with long path names but they are supported only from Windows 8 with special flags for long path names available only from Windows 10 Version 1703. I will experiment with these APIs to learn more about these functions. Certainly, I will implement a compatibility layer to allow DirHash to continue running on Windows 7 where these functions don't exist.

idrassi commented 3 years ago

I have implemented Windows long path names support and I have published version 1.17 that contains it. Let me know if you encounter any issues.

bluelayer commented 3 years ago

sorry to interrupt but in this new version when I hang over DirHash executable, one ISO file with 4.52GiB I get Error: The given input file doesn't exist. works just fine in 1.16

PS: the file is windows 10_x64_h2 iso

idrassi commented 3 years ago

Indeed, I used a function in the new code (_stat) that is not compatible with files larger than 4GiB. I will implement a fix and publish a new version. Thank you for the verification!

idrassi commented 3 years ago

I have published version 1.18 with the fix. Can you please confirm that things are ok now? Thank you for your help.

bluelayer commented 3 years ago

perfect now

(you have a typo in DirHash.rc VALUE "FileDescription", "compute Hash of dorectories and files")

idrassi commented 3 years ago

Thank you for the confirmation and for the typo report