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

Advanced compare plugin v57 #890

Open
check4game opened this issue Dec 14, 2024 · 0 comments
Open

Advanced compare plugin v57 #890

check4game opened this issue Dec 14, 2024 · 0 comments
Labels

Comments

@check4game
Copy link

check4game commented Dec 14, 2024

Far Manager version

3.0.6402.4055

OS version

10.0.19045.4170

Other software

No response

Steps to reproduce

сравнение директории на локальном диске с сетевым ресурсом или сравнение двух сетевых ресурсов

D:\folder1 и \\server\share\folder1
или
\\server\share\folder1 и \\server\share\folder2

для сетевого пути больше чем MAX_PATH, FindFirstFile возвращает ошибку 3

очевидно что использование UNC формата для сетевого пути, решает проблему, но это не удобно да и не всем очевидно

\\?\UNC\server\share\folder1

Expected behavior

No response

Actual behavior

Compare.cpp/class FileName/BuildName

const wchar_t* BuildName(const wchar_t *dir, const wchar_t *file)
{
int mlen = lstrlen(dir) + lstrlen(file) + 6;
if (mlen > bSize)
{
if (pBuff != tName) delete[] pBuff;
pBuff = new wchar_t[bSize = mlen+128];
}
if (mlen >= MAX_PATH && dir[0] != L'\\')
lstrcpy(pBuff, L"\\\\?\\");
else
*pBuff = L'\0';
FSF.AddEndSlash(lstrcat(pBuff, dir));
return lstrcat(pBuff, file);
}

код обрабатывает только вариант только для локальных путей

if (mlen >= MAX_PATH && dir[0] != L'\\')
lstrcpy(pBuff, L"\\\\?\\");
else
*pBuff = L'\0';

предлагается изменить код плагина

int mlen = lstrlen(dir) + lstrlen(file) + 6;

	int mlen = lstrlen(dir) + lstrlen(file) + 6 + 2; 

if (mlen >= MAX_PATH && dir[0] != L'\\')
lstrcpy(pBuff, L"\\\\?\\");
else
*pBuff = L'\0';

	*pBuff = L'\0';

	if (mlen >= MAX_PATH)
	{
		if (dir[0] != L'\\')
		{
			lstrcpy(pBuff, L"\\\\?\\");
		}
		else if (dir[1] == L'\\' && dir[2] != L'?' && dir[2] != L'.')
		{
			lstrcpy(pBuff, L"\\\\?\\UNC");
			dir++; // cut first slash
		}
	}
@check4game check4game added the bug label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant