Index: apitests/shlwapi/CMakeLists.txt =================================================================== --- apitests/shlwapi/CMakeLists.txt (revision 73543) +++ apitests/shlwapi/CMakeLists.txt (working copy) @@ -1,6 +1,8 @@ list(APPEND SOURCE PathIsUNC.c + PathIsUNCServer.c + PathIsUNCServerShare.c PathUnExpandEnvStrings.c testlist.c) Index: apitests/shlwapi/PathIsUNCServer.c =================================================================== --- apitests/shlwapi/PathIsUNCServer.c (revision 0) +++ apitests/shlwapi/PathIsUNCServer.c (working copy) @@ -0,0 +1,53 @@ +/* + * Copyright 2017 Jared Smudde + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773722(v=vs.85).aspx */ + +#include + +static BOOL (WINAPI *pPathIsUNCServer)(PCWSTR); + +#define CALL_ISUNCSERVER(exp, str) \ +do { \ + BOOL ret = pPathIsUNCServer((str)); \ + ok(ret == (exp), "Expected %s to be %d, was %d\n", wine_dbgstr_w((str)), (exp), ret); \ +} while (0) + +START_TEST(isuncpathserver) +{ + HMODULE hDll = LoadLibraryA("shlwapi.dll"); + + pPathIsUNCServer = (void*)GetProcAddress(hDll, "PathIsUNCServerW"); + if (!hDll || !pPathIsUNCServer) + { + skip("shlwapi.dll or export PathIsUNCServerW not found! Tests will be skipped\n"); + return; + } + + CALL_ISUNCSERVER(TRUE, L"\\\\server"); + CALL_ISUNCSERVER(TRUE, L"\\\\"); + CALL_ISUNCSERVER(FALSE, L"\\\\server\\folder"); + CALL_ISUNCSERVER(FALSE, L"reactos\\some\\folder"); + CALL_ISUNCSERVER(FALSE, L"////server//share"); + CALL_ISUNCSERVER(FALSE, L"c:\\path1"); + CALL_ISUNCSERVER(FALSE, (wchar_t*)NULL); + CALL_ISUNCSERVER(FALSE, L" "); + + /* The test shows TRUE on Windows 2003, but returns FALSE on Windows 7 */ + CALL_ISUNCSERVER(TRUE, L"\\\\?"); +} Index: apitests/shlwapi/PathIsUNCServerShare.c =================================================================== --- apitests/shlwapi/PathIsUNCServerShare.c (revision 0) +++ apitests/shlwapi/PathIsUNCServerShare.c (working copy) @@ -0,0 +1,51 @@ +/* + * Copyright 2017 Jared Smudde + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773723(v=vs.85).aspx */ + +#include + +static BOOL (WINAPI *pPathIsUNCServerShare)(PCWSTR); + +#define CALL_ISUNCSERVERSHARE(exp, str) \ +do { \ + BOOL ret = pPathIsUNCServerShare((str)); \ + ok(ret == (exp), "Expected %s to be %d, was %d\n", wine_dbgstr_w((str)), (exp), ret); \ +} while (0) + +START_TEST(isuncpathservershare) +{ + HMODULE hDll = LoadLibraryA("shlwapi.dll"); + + pPathIsUNCServerShare = (void*)GetProcAddress(hDll, "PathIsUNCServerShareW"); + if (!hDll || !pPathIsUNCServerShare) + { + skip("shlwapi.dll or export PathIsUNCServerShareW not found! Tests will be skipped\n"); + return; + } + + CALL_ISUNCSERVERSHARE(TRUE, L"\\\\server\\share"); + CALL_ISUNCSERVERSHARE(TRUE, L"\\\\reactos\\folder9"); + CALL_ISUNCSERVERSHARE(FALSE, L"\\\\"); + CALL_ISUNCSERVERSHARE(FALSE, L"reactos\\some\\folder"); + CALL_ISUNCSERVERSHARE(FALSE, L"////server//share"); + CALL_ISUNCSERVERSHARE(FALSE, L"c:\\path1"); + CALL_ISUNCSERVERSHARE(FALSE, (wchar_t*)NULL); + CALL_ISUNCSERVERSHARE(FALSE, L" "); + CALL_ISUNCSERVERSHARE(FALSE, L"\\\\?"); +} Index: apitests/shlwapi/testlist.c =================================================================== --- apitests/shlwapi/testlist.c (revision 73543) +++ apitests/shlwapi/testlist.c (working copy) @@ -2,11 +2,15 @@ #include extern void func_isuncpath(void); +extern void func_isuncpathserver(void); +extern void func_isuncpathservershare(void); extern void func_PathUnExpandEnvStrings(void); const struct test winetest_testlist[] = { { "PathIsUNC", func_isuncpath }, + { "PathIsUNCServer", func_isuncpathserver }, + { "PathIsUNCServerShare", func_isuncpathservershare }, { "PathUnExpandEnvStrings", func_PathUnExpandEnvStrings }, { 0, 0 } };