summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/path/test/TestPathIsUNCEx.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:24:41 +0000
commita9bcc81f821d7c66f623779fa5147e728eb3c388 (patch)
tree98676963bcdd537ae5908a067a8eb110b93486a6 /winpr/libwinpr/path/test/TestPathIsUNCEx.c
parentInitial commit. (diff)
downloadfreerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.tar.xz
freerdp3-a9bcc81f821d7c66f623779fa5147e728eb3c388.zip
Adding upstream version 3.3.0+dfsg1.upstream/3.3.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--winpr/libwinpr/path/test/TestPathIsUNCEx.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/winpr/libwinpr/path/test/TestPathIsUNCEx.c b/winpr/libwinpr/path/test/TestPathIsUNCEx.c
new file mode 100644
index 0000000..4fdf4f7
--- /dev/null
+++ b/winpr/libwinpr/path/test/TestPathIsUNCEx.c
@@ -0,0 +1,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;
+}