ReactOS 0.4.16-dev-1946-g52006dd
PathIsUNC.c
Go to the documentation of this file.
1/*
2 * Copyright 2017 Jared Smudde
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19/* Documentation: https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathisunca */
20
21#include <apitest.h>
22#include <shlwapi.h>
23
24#define DO_TEST(exp, str) \
25do { \
26 BOOL ret = PathIsUNCW((str)); \
27 ok(ret == (exp), "Expected %s to be %d, was %d\n", wine_dbgstr_w((str)), (exp), ret); \
28} while (0)
29
30START_TEST(isuncpath)
31{
32 DO_TEST(TRUE, L"\\\\path1\\path2");
33 DO_TEST(TRUE, L"\\\\path1");
34 DO_TEST(FALSE, L"reactos\\path4\\path5");
35 DO_TEST(TRUE, L"\\\\");
36 DO_TEST(TRUE, L"\\\\?\\UNC\\path1\\path2");
37 DO_TEST(TRUE, L"\\\\?\\UNC\\path1");
38 DO_TEST(TRUE, L"\\\\?\\UNC\\");
39 DO_TEST(FALSE, L"\\path1");
40 DO_TEST(FALSE, L"path1");
41 DO_TEST(FALSE, L"c:\\path1");
42
44 DO_TEST(FALSE, L"\\\\?\\c:\\path1");
45 else
46 DO_TEST(TRUE, L"\\\\?\\c:\\path1");
47
48 DO_TEST(TRUE, L"\\\\path1\\");
49 DO_TEST(FALSE, L"//");
50 DO_TEST(FALSE, L"////path1");
51 DO_TEST(FALSE, L"////path1//path2");
52 DO_TEST(FALSE, L"reactos//path3//path4");
53 DO_TEST(TRUE, L"\\\\reactos\\?");
54 DO_TEST(TRUE, L"\\\\reactos\\\\");
55 DO_TEST(FALSE, (wchar_t*)NULL);
56 DO_TEST(FALSE, L" ");
57
59 DO_TEST(FALSE, L"\\\\?\\");
60 else
61 DO_TEST(TRUE, L"\\\\?\\");
62}
#define DO_TEST(exp, str)
Definition: PathIsUNC.c:24
#define GetNTVersion()
Definition: apitest.h:17
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define L(x)
Definition: resources.c:13
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25