blob: 4fdf4f7a247b1f447c3f1c8761ae7bffb9f9f7f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/path.h>
#include <winpr/tchar.h>
#include <winpr/winpr.h>
static const TCHAR testServer[] = _T("server\\share\\path\\file");
static const TCHAR testPathUNC[] = _T("\\\\server\\share\\path\\file");
static const TCHAR testPathNotUNC[] = _T("C:\\share\\path\\file");
int TestPathIsUNCEx(int argc, char* argv[])
{
BOOL status = 0;
LPCTSTR Server = NULL;
TCHAR Path[PATHCCH_MAX_CCH];
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
/* Path is UNC */
_tcscpy(Path, testPathUNC);
status = PathIsUNCEx(Path, &Server);
if (!status)
{
_tprintf(_T("PathIsUNCEx status: 0x%d\n"), status);
return -1;
}
if (_tcscmp(Server, testServer) != 0)
{
_tprintf(_T("Server Name Mismatch: Actual: %s, Expected: %s\n"), Server, testServer);
return -1;
}
/* Path is not UNC */
_tcscpy(Path, testPathNotUNC);
status = PathIsUNCEx(Path, &Server);
if (status)
{
_tprintf(_T("PathIsUNCEx status: 0x%08") _T(PRIX32) _T("\n"), status);
return -1;
}
return 0;
}
|