From d1bb65a9987531658ad8e23f7de70bc2be8a1269 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Mon, 30 Jan 2017 16:07:44 -0800 Subject: [PATCH] tst: winfsp-tests: add --share-prefix option: - this accommodates network file systems that have mapped drives --- tst/winfsp-tests/winfsp-tests.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tst/winfsp-tests/winfsp-tests.c b/tst/winfsp-tests/winfsp-tests.c index c89ab10f..1c296089 100644 --- a/tst/winfsp-tests/winfsp-tests.c +++ b/tst/winfsp-tests/winfsp-tests.c @@ -295,6 +295,20 @@ int main(int argc, char *argv[]) WinFspNetTests = 0; } } + else if (0 == strncmp("--share-prefix=", a, sizeof "--share-prefix=" - 1)) + { + /* hack to allow name queries on network file systems with mapped drives */ + + WCHAR SharePrefixBuf[MAX_PATH]; + + if (0 != MultiByteToWideChar(CP_UTF8, 0, + a + sizeof "--share-prefix=" - 1, -1, SharePrefixBuf, MAX_PATH)) + { + rmarg(argv, argc, argi); + + OptSharePrefixLength = (ULONG)(wcslen(SharePrefixBuf) * sizeof(WCHAR)); + } + } else if (0 == strcmp("--no-traverse", a)) { if (LookupPrivilegeValueW(0, SE_CHANGE_NOTIFY_NAME, &OptNoTraverseLuid) &&