Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erroneously reads long file names as unreadable. #87

Open
slaiyfer opened this issue Nov 30, 2023 · 1 comment
Open

Erroneously reads long file names as unreadable. #87

slaiyfer opened this issue Nov 30, 2023 · 1 comment

Comments

@slaiyfer
Copy link

It either writes the file into the md5 file as hashed but reads as unreadable upon checking or completely ignores it and just hashes less than the total amount of files in the folder. If I use another program, say Rapidcrc to hash the same files with no issues to force Hashcheck to read them and not ignore them, they will still turn out unrradable.

@carpediem-av
Copy link

carpediem-av commented Nov 28, 2024

My solution:
HashCheckCommon.c

HANDLE __fastcall OpenFileForReading( PCTSTR pszPath )
{
	if (StrCmpNW(pszPath, L"\\\\", 2) == 0) 
	{
		return(CreateFile(
			pszPath,
			GENERIC_READ,
			FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
			NULL,
			OPEN_EXISTING,
			FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
			NULL
		));
	}
	else
	{
		#define LONG_PATH_MAX 32767
		WCHAR longPathAwarePath[LONG_PATH_MAX];
		StrCpy(longPathAwarePath, L"\\\\?\\");
		StrCatN(longPathAwarePath, pszPath, LONG_PATH_MAX - 4);

		return(CreateFile(
			longPathAwarePath,
			GENERIC_READ,
			FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
			NULL,
			OPEN_EXISTING,
			FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
			NULL
		));
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants