netapi32/tests: Rewrite UNC/HTTP conversion tests.

Windows 1709 changed the algorithm to be far more restrictive. Treat those
results as correct and older versions as broken.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-01-08 15:23:20 -06:00 committed by Alexandre Julliard
parent 10646ddb91
commit f9bc81c448
1 changed files with 112 additions and 266 deletions

View File

@ -356,129 +356,43 @@ static void run_localgroupgetinfo_tests(void)
static void test_DavGetHTTPFromUNCPath(void) static void test_DavGetHTTPFromUNCPath(void)
{ {
static const WCHAR path[] =
{0};
static const WCHAR path2[] =
{'c',':','\\',0};
static const WCHAR path3[] =
{'\\','\\','.','\\','c',':',0};
static const WCHAR path4[] =
{'\\','\\','.','\\','c',':','\\',0};
static const WCHAR path5[] =
{'\\','\\','.','\\','c',':','\\','n','o','s','u','c','h','p','a','t','h',0};
static const WCHAR path6[] =
{'\\','\\','n','o','s','u','c','h','s','e','r','v','e','r','\\','c',':','\\',0};
static const WCHAR path7[] =
{'\\','.','\\','c',':',0};
static const WCHAR path8[] =
{'\\','\\','.','\\','c',':','\\','\\',0};
static const WCHAR path9[] =
{'\\','\\','.','@','S','S','L','\\','c',':',0};
static const WCHAR path10[] =
{'\\','\\','.','@','s','s','l','\\','c',':',0};
static const WCHAR path11[] =
{'\\','\\','.','@','t','l','s','\\','c',':',0};
static const WCHAR path12[] =
{'\\','\\','.','@','S','S','L','@','4','4','3','\\','c',':',0};
static const WCHAR path13[] =
{'\\','\\','.','@','S','S','L','@','8','0','\\','c',':',0};
static const WCHAR path14[] =
{'\\','\\','.','@','8','0','\\','c',':',0};
static const WCHAR path15[] =
{'\\','\\','.','@','8','0','8','0','\\','c',':',0};
static const WCHAR path16[] =
{'\\','\\','\\','c',':',0};
static const WCHAR path17[] =
{'\\','\\',0};
static const WCHAR path18[] =
{'/','/','.','/','c',':',0};
static const WCHAR path19[] =
{'\\','\\','.','\\','c',':','/',0};
static const WCHAR path20[] =
{'\\','\\','.','\\','c',':','\\','\\','\\',0};
static const WCHAR path21[] =
{'\\','\\','.','\\','\\','c',':',0};
static const WCHAR path22[] =
{'\\','\\','.','\\','c',':','d','i','r',0};
static const WCHAR path23[] =
{'\\','\\','.',0};
static const WCHAR path24[] =
{'\\','\\','.','\\','d','i','r',0};
static const WCHAR path25[] =
{'\\','\\','.','\\','\\',0};
static const WCHAR path26[] =
{'\\','\\','.','\\','c',':','d','i','r','/',0};
static const WCHAR path27[] =
{'\\','\\','.','/','c',':',0};
static const WCHAR path28[] =
{'\\','\\','.','@','8','0','@','S','S','L','\\','c',':',0};
static const WCHAR result[] =
{'h','t','t','p',':','/','/','.','/','c',':',0};
static const WCHAR result2[] =
{'h','t','t','p',':','/','/','.','/','c',':','/','n','o','s','u','c','h','p','a','t','h',0};
static const WCHAR result3[] =
{'h','t','t','p',':','/','/','n','o','s','u','c','h','s','e','r','v','e','r','/','c',':',0};
static const WCHAR result4[] =
{'h','t','t','p',':','/','/','.','/','c',':','/',0};
static const WCHAR result5[] =
{'h','t','t','p','s',':','/','/','.','/','c',':',0};
static const WCHAR result6[] =
{'h','t','t','p','s',':','/','/','.',':','8','0','/','c',':',0};
static const WCHAR result7[] =
{'h','t','t','p',':','/','/','.',':','8','0','8','0','/','c',':',0};
static const WCHAR result8[] =
{'h','t','t','p',':','/','/','/','c',':',0};
static const WCHAR result9[] =
{'h','t','t','p',':','/','/','.','/','c',':','/','/',0};
static const WCHAR result10[] =
{'h','t','t','p',':','/','/','.','/','/','c',':',0};
static const WCHAR result11[] =
{'h','t','t','p',':','/','/','.','/','c',':','d','i','r',0};
static const WCHAR result12[] =
{'h','t','t','p',':','/','/','.',0};
static const WCHAR result13[] =
{'h','t','t','p',':','/','/','.','/','d','i','r',0};
static const WCHAR result14[] =
{'h','t','t','p',':','/','/','.','/',0};
static const struct static const struct
{ {
const WCHAR *path; const WCHAR *path;
DWORD size; DWORD ret;
DWORD ret;
const WCHAR *ret_path; const WCHAR *ret_path;
DWORD ret_size; DWORD broken_ret; /* < Win10 1709 */
int todo; BOOL todo;
} }
tests[] = tests[] =
{ {
{ path, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"", ERROR_BAD_NET_NAME, NULL, ERROR_INVALID_PARAMETER, TRUE},
{ path2, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"c:\\", ERROR_BAD_NET_NAME, NULL, ERROR_INVALID_PARAMETER, TRUE},
{ path3, MAX_PATH, ERROR_SUCCESS, result, 12 }, {L"\\\\", ERROR_BAD_NET_NAME, NULL, ERROR_INVALID_PARAMETER, TRUE},
{ path4, MAX_PATH, ERROR_SUCCESS, result, 12 }, {L"\\a\\b", ERROR_BAD_NET_NAME, NULL, ERROR_INVALID_PARAMETER, TRUE},
{ path5, MAX_PATH, ERROR_SUCCESS, result2, 23 }, {L"\\\\a", ERROR_SUCCESS, L"http://a"},
{ path6, MAX_PATH, ERROR_SUCCESS, result3, 23 }, {L"\\\\a\\", ERROR_SUCCESS, L"http://a"},
{ path7, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"\\\\a\\b", ERROR_SUCCESS, L"http://a/b"},
{ path8, MAX_PATH, ERROR_SUCCESS, result4, 13 }, {L"\\\\a\\b\\", ERROR_SUCCESS, L"http://a/b"},
{ path9, MAX_PATH, ERROR_SUCCESS, result5, 13 }, {L"\\\\a\\b\\c", ERROR_SUCCESS, L"http://a/b/c"},
{ path10, MAX_PATH, ERROR_SUCCESS, result5, 13 }, {L"\\\\a@SSL\\b", ERROR_SUCCESS, L"https://a/b"},
{ path11, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"\\\\a@ssl\\b", ERROR_SUCCESS, L"https://a/b"},
{ path12, MAX_PATH, ERROR_SUCCESS, result5, 13 }, {L"\\\\a@tls\\b", ERROR_INVALID_PARAMETER},
{ path13, MAX_PATH, ERROR_SUCCESS, result6, 16 }, {L"\\\\a@SSL@443\\b", ERROR_SUCCESS, L"https://a/b"},
{ path14, MAX_PATH, ERROR_SUCCESS, result, 12 }, {L"\\\\a@SSL@80\\b", ERROR_SUCCESS, L"https://a:80/b"},
{ path15, MAX_PATH, ERROR_SUCCESS, result7, 17 }, {L"\\\\a@80@SSL\\b", ERROR_INVALID_PARAMETER},
{ path16, MAX_PATH, ERROR_SUCCESS, result8, 11 }, {L"\\\\a@80\\b", ERROR_SUCCESS, L"http://a/b"},
{ path17, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"\\\\a@8080\\b", ERROR_SUCCESS, L"http://a:8080/b"},
{ path18, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"\\\\a\\b/", ERROR_SUCCESS, L"http://a/b"},
{ path19, MAX_PATH, ERROR_SUCCESS, result, 12 }, {L"\\\\a/b", ERROR_SUCCESS, L"http://a/b"},
{ path20, MAX_PATH, ERROR_SUCCESS, result9, 14 }, {L"\\\\a.\\b", ERROR_SUCCESS, L"http://a./b"},
{ path21, MAX_PATH, ERROR_SUCCESS, result10, 13 }, {L"\\\\.a\\b", ERROR_SUCCESS, L"http://.a/b"},
{ path22, MAX_PATH, ERROR_SUCCESS, result11, 15 }, {L"//a/b", ERROR_SUCCESS, L"http://a/b", ERROR_INVALID_PARAMETER, TRUE},
{ path23, MAX_PATH, ERROR_SUCCESS, result12, 9 }, {L"\\\\a\\\\", ERROR_BAD_NET_NAME, NULL, ERROR_SUCCESS, TRUE},
{ path24, MAX_PATH, ERROR_SUCCESS, result13, 13 }, {L"\\\\\\a\\", ERROR_BAD_NET_NAME, NULL, ERROR_SUCCESS, TRUE},
{ path25, MAX_PATH, ERROR_SUCCESS, result14, 10, 1 }, {L"\\\\a\\b\\\\", ERROR_BAD_NET_NAME, NULL, ERROR_SUCCESS, TRUE},
{ path26, MAX_PATH, ERROR_SUCCESS, result11, 15 }, {L"\\\\.\\a", ERROR_BAD_NET_NAME, NULL, ERROR_SUCCESS, TRUE},
{ path27, MAX_PATH, ERROR_SUCCESS, result, 12 }, {L"\\\\a\\b:", ERROR_BAD_NET_NAME, NULL, ERROR_SUCCESS, TRUE},
{ path28, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH },
}; };
WCHAR buf[MAX_PATH]; WCHAR buf[MAX_PATH];
DWORD i, ret, size; DWORD i, ret, size;
@ -489,162 +403,89 @@ static void test_DavGetHTTPFromUNCPath(void)
return; return;
} }
if (0) { /* crash */ if (0) /* crashes on Windows */
ret = pDavGetHTTPFromUNCPath( NULL, NULL, NULL ); {
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); ret = pDavGetHTTPFromUNCPath(NULL, NULL, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
size = 0;
ret = pDavGetHTTPFromUNCPath(L"", buf, &size);
ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
ret = pDavGetHTTPFromUNCPath(L"\\\\a\\b", buf, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
} }
ret = pDavGetHTTPFromUNCPath( path, buf, NULL ); ret = pDavGetHTTPFromUNCPath(L"", buf, NULL);
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
size = 0; size = 0;
ret = pDavGetHTTPFromUNCPath( path, NULL, &size ); ret = pDavGetHTTPFromUNCPath(L"", NULL, &size);
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_BAD_NET_NAME /* Win10 1709+ */, "got %u\n", ret);
if (0) { /* crash */
buf[0] = 0;
size = 0;
ret = pDavGetHTTPFromUNCPath( path, buf, &size );
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
ret = pDavGetHTTPFromUNCPath( path3, buf, NULL );
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
}
size = 0; size = 0;
ret = pDavGetHTTPFromUNCPath( path3, NULL, &size ); ret = pDavGetHTTPFromUNCPath(L"\\\\a\\b", NULL, &size);
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret ); ok(ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret);
buf[0] = 0; buf[0] = 0;
size = 0; size = 0;
ret = pDavGetHTTPFromUNCPath( path3, buf, &size ); ret = pDavGetHTTPFromUNCPath(L"\\\\a\\b", buf, &size);
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret ); ok(ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret);
ok( size == 12, "got %u\n", size ); ok(size == 11, "got %u\n", size);
for (i = 0; i < ARRAY_SIZE(tests); i++) for (i = 0; i < ARRAY_SIZE(tests); i++)
{ {
buf[0] = 0; buf[0] = 0;
size = tests[i].size; size = ARRAY_SIZE(buf);
ret = pDavGetHTTPFromUNCPath( tests[i].path, buf, &size ); ret = pDavGetHTTPFromUNCPath( tests[i].path, buf, &size );
if (tests[i].todo) todo_wine_if (tests[i].todo)
ok(ret == tests[i].ret || broken(ret == tests[i].broken_ret),
"%u: expected %u got %u\n", i, tests[i].ret, ret);
if (!ret)
{ {
ok( ret == tests[i].ret, "%u: expected %u got %u\n", i, tests[i].ret, ret );
todo_wine {
if (tests[i].ret_path) if (tests[i].ret_path)
{ ok(!wcscmp(buf, tests[i].ret_path), "%u: expected %s got %s\n",
ok( !lstrcmpW( buf, tests[i].ret_path ), "%u: expected %s got %s\n", i, wine_dbgstr_w(tests[i].ret_path), wine_dbgstr_w(buf));
i, wine_dbgstr_w(tests[i].ret_path), wine_dbgstr_w(buf) ); ok(size == wcslen(buf) + 1, "%u: got %u\n", i, size);
}
ok( size == tests[i].ret_size, "%u: expected %u got %u\n", i, tests[i].ret_size, size );
}
} }
else else
{ ok(size == ARRAY_SIZE(buf), "%u: wrong size %u\n", i, size);
ok( ret == tests[i].ret, "%u: expected %u got %u\n", i, tests[i].ret, ret );
if (tests[i].ret_path)
{
ok( !lstrcmpW( buf, tests[i].ret_path ), "%u: expected %s got %s\n",
i, wine_dbgstr_w(tests[i].ret_path), wine_dbgstr_w(buf) );
}
ok( size == tests[i].ret_size, "%u: expected %u got %u\n", i, tests[i].ret_size, size );
}
} }
} }
static void test_DavGetUNCFromHTTPPath(void) static void test_DavGetUNCFromHTTPPath(void)
{ {
static const WCHAR path[] =
{0};
static const WCHAR path2[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r','/','p','a','t','h',0};
static const WCHAR path3[] =
{'h','t','t','p','s',':','/','/','h','o','s','t','/','p','a','t','h',0};
static const WCHAR path4[] =
{'\\','\\','s','e','r','v','e','r',0};
static const WCHAR path5[] =
{'\\','\\','s','e','r','v','e','r','\\','p','a','t','h',0};
static const WCHAR path6[] =
{'\\','\\','h','t','t','p',':','/','/','s','e','r','v','e','r','/','p','a','t','h',0};
static const WCHAR path7[] =
{'h','t','t','p',':','/','/',0};
static const WCHAR path8[] =
{'h','t','t','p',':',0};
static const WCHAR path9[] =
{'h','t','t','p',0};
static const WCHAR path10[] =
{'h','t','t','p',':','s','e','r','v','e','r',0};
static const WCHAR path11[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r',':','8','0',0};
static const WCHAR path12[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r',':','8','1',0};
static const WCHAR path13[] =
{'h','t','t','p','s',':','/','/','s','e','r','v','e','r',':','8','0',0};
static const WCHAR path14[] =
{'H','T','T','P',':','/','/','s','e','r','v','e','r','/','p','a','t','h',0};
static const WCHAR path15[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r',':','6','5','5','3','7',0};
static const WCHAR path16[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r','/','p','a','t','h','/',0};
static const WCHAR path17[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r','/','p','a','t','h','/','/',0};
static const WCHAR path18[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r',':','/','p','a','t','h',0};
static const WCHAR path19[] =
{'h','t','t','p',':','/','/','s','e','r','v','e','r',0};
static const WCHAR path20[] =
{'h','t','t','p','s',':','/','/','s','e','r','v','e','r',':','4','4','3',0};
static const WCHAR path21[] =
{'h','t','t','p','s',':','/','/','s','e','r','v','e','r',':','8','0',0};
static const WCHAR result[] =
{'\\','\\','s','e','r','v','e','r','\\','D','a','v','W','W','W','R','o','o','t','\\','p','a','t','h',0};
static const WCHAR result2[] =
{'\\','\\','h','o','s','t','@','S','S','L','\\','D','a','v','W','W','W','R','o','o','t','\\',
'p','a','t','h',0};
static const WCHAR result3[] =
{'\\','\\','s','e','r','v','e','r','\\','D','a','v','W','W','W','R','o','o','t',0};
static const WCHAR result4[] =
{'\\','\\','s','e','r','v','e','r','@','8','1','\\','D','a','v','W','W','W','R','o','o','t',0};
static const WCHAR result5[] =
{'\\','\\','s','e','r','v','e','r','@','S','S','L','@','8','0','\\','D','a','v','W','W','W','R','o','o','t',0};
static const WCHAR result6[] =
{'\\','\\','s','e','r','v','e','r','@','6','5','5','3','7','\\','D','a','v','W','W','W','R','o','o','t',0};
static const WCHAR result7[] =
{'\\','\\','s','e','r','v','e','r','@','\\','D','a','v','W','W','W','R','o','o','t','\\','p','a','t','h',0};
static const WCHAR result8[] =
{'\\','\\','s','e','r','v','e','r','@','S','S','L','\\','D','a','v','W','W','W','R','o','o','t',0};
static const WCHAR result9[] =
{'\\','\\','s','e','r','v','e','r','@','S','S','L','@','8','0','\\','D','a','v','W','W','W','R','o','o','t',0};
static const struct static const struct
{ {
const WCHAR *path; const WCHAR *path;
DWORD size; DWORD ret;
DWORD ret;
const WCHAR *ret_path; const WCHAR *ret_path;
DWORD ret_size; DWORD broken_ret; /* < Win10 1709 */
BOOL todo;
} }
tests[] = tests[] =
{ {
{ path, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"", ERROR_INVALID_PARAMETER},
{ path2, MAX_PATH, ERROR_SUCCESS, result, 25 }, {L"http://server/path", ERROR_SUCCESS, L"\\\\server\\DavWWWRoot\\path"},
{ path3, MAX_PATH, ERROR_SUCCESS, result2, 27 }, {L"https://host/path", ERROR_SUCCESS, L"\\\\host@SSL\\DavWWWRoot\\path"},
{ path4, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"\\\\server", ERROR_INVALID_PARAMETER},
{ path5, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"\\\\server\\path", ERROR_INVALID_PARAMETER},
{ path6, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"\\\\http://server/path", ERROR_INVALID_PARAMETER},
{ path7, MAX_PATH, ERROR_BAD_NET_NAME, NULL, MAX_PATH }, {L"http://", ERROR_BAD_NETPATH, NULL, ERROR_BAD_NET_NAME, TRUE},
{ path8, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"http:", ERROR_BAD_NET_NAME, NULL, ERROR_INVALID_PARAMETER, TRUE},
{ path9, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"http", ERROR_INVALID_PARAMETER},
{ path10, MAX_PATH, ERROR_INVALID_PARAMETER, NULL, MAX_PATH }, {L"http:server", ERROR_BAD_NET_NAME, NULL, ERROR_INVALID_PARAMETER, TRUE},
{ path11, MAX_PATH, ERROR_SUCCESS, result3, 20 }, {L"http://server:80", ERROR_SUCCESS, L"\\\\server\\DavWWWRoot"},
{ path12, MAX_PATH, ERROR_SUCCESS, result4, 23 }, {L"http://server:81", ERROR_SUCCESS, L"\\\\server@81\\DavWWWRoot"},
{ path13, MAX_PATH, ERROR_SUCCESS, result5, 27 }, {L"https://server:80", ERROR_SUCCESS, L"\\\\server@SSL@80\\DavWWWRoot"},
{ path14, MAX_PATH, ERROR_SUCCESS, result, 25 }, {L"HTTP://server/path", ERROR_SUCCESS, L"\\\\server\\DavWWWRoot\\path"},
{ path15, MAX_PATH, ERROR_SUCCESS, result6, 26 }, {L"http://server:65537", ERROR_BAD_NETPATH, NULL, ERROR_SUCCESS, TRUE},
{ path16, MAX_PATH, ERROR_SUCCESS, result, 25 }, {L"http://server/path/", ERROR_SUCCESS, L"\\\\server\\DavWWWRoot\\path"},
{ path17, MAX_PATH, ERROR_BAD_NET_NAME, NULL, MAX_PATH }, {L"http://server/path//", ERROR_SUCCESS, L"\\\\server\\DavWWWRoot\\path", ERROR_BAD_NET_NAME, TRUE},
{ path18, MAX_PATH, ERROR_SUCCESS, result7, 26 }, {L"http://server:/path", ERROR_BAD_NETPATH, NULL, ERROR_SUCCESS, TRUE},
{ path19, MAX_PATH, ERROR_SUCCESS, result3, 20 }, {L"http://server", ERROR_SUCCESS, L"\\\\server\\DavWWWRoot"},
{ path20, MAX_PATH, ERROR_SUCCESS, result8, 24 }, {L"https://server:443", ERROR_SUCCESS, L"\\\\server@SSL\\DavWWWRoot"},
{ path21, MAX_PATH, ERROR_SUCCESS, result9, 27 },
}; };
WCHAR buf[MAX_PATH]; WCHAR buf[MAX_PATH];
DWORD i, ret, size; DWORD i, ret, size;
@ -655,52 +496,57 @@ static void test_DavGetUNCFromHTTPPath(void)
return; return;
} }
if (0) { /* crash */ if (0) /* crashes on Windows */
ret = pDavGetUNCFromHTTPPath( NULL, NULL, NULL ); {
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); ret = pDavGetUNCFromHTTPPath(NULL, NULL, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
ret = pDavGetUNCFromHTTPPath(L"http://server/path", buf, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
} }
ret = pDavGetUNCFromHTTPPath( path, buf, NULL );
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); ret = pDavGetUNCFromHTTPPath(L"", buf, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
size = 0; size = 0;
ret = pDavGetUNCFromHTTPPath( path, NULL, &size ); ret = pDavGetUNCFromHTTPPath(L"", NULL, &size);
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
buf[0] = 0; buf[0] = 0;
size = 0; size = 0;
ret = pDavGetUNCFromHTTPPath( path, buf, &size ); ret = pDavGetUNCFromHTTPPath(L"", buf, &size);
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret ); ok(ret == ERROR_INVALID_PARAMETER, "got %u\n", ret);
if (0) { /* crash */
ret = pDavGetUNCFromHTTPPath( path2, buf, NULL );
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
}
size = 0; size = 0;
ret = pDavGetUNCFromHTTPPath( path2, NULL, &size ); ret = pDavGetUNCFromHTTPPath(L"http://server/path", NULL, &size);
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret ); ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
buf[0] = 0; buf[0] = 0;
size = 0; size = 0;
ret = pDavGetUNCFromHTTPPath( path2, buf, &size ); ret = pDavGetUNCFromHTTPPath(L"http://server/path", buf, &size);
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret ); ok(ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret);
ok( size == 25, "got %u\n", size ); ok(size == 25, "got %u\n", size);
for (i = 0; i < ARRAY_SIZE(tests); i++) for (i = 0; i < ARRAY_SIZE(tests); i++)
{ {
buf[0] = 0; buf[0] = 0;
size = tests[i].size; size = ARRAY_SIZE(buf);
ret = pDavGetUNCFromHTTPPath( tests[i].path, buf, &size ); ret = pDavGetUNCFromHTTPPath( tests[i].path, buf, &size );
ok( ret == tests[i].ret, "%u: expected %u got %u\n", i, tests[i].ret, ret ); todo_wine_if (tests[i].todo)
if (tests[i].ret_path) ok(ret == tests[i].ret || broken(ret == tests[i].broken_ret),
"%u: expected %u got %u\n", i, tests[i].ret, ret);
if (!ret)
{ {
ok( !lstrcmpW( buf, tests[i].ret_path ), "%u: expected %s got %s\n", if (tests[i].ret_path)
i, wine_dbgstr_w(tests[i].ret_path), wine_dbgstr_w(buf) ); ok(!wcscmp(buf, tests[i].ret_path), "%u: expected %s got %s\n",
i, wine_dbgstr_w(tests[i].ret_path), wine_dbgstr_w(buf));
ok(size == wcslen(buf) + 1, "%u: got %u\n", i, size);
} }
ok( size == tests[i].ret_size, "%u: expected %u got %u\n", i, tests[i].ret_size, size ); else
ok(size == ARRAY_SIZE(buf), "%u: wrong size %u\n", i, size);
} }
} }
START_TEST(access) START_TEST(access)
{ {
HMODULE hnetapi32=LoadLibraryA("netapi32.dll"); HMODULE hnetapi32=LoadLibraryA("netapi32.dll");