File tree Expand file tree Collapse file tree
src/com/sun/jna/platform/win32
test/com/sun/jna/platform/win32 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Release 4.3.1 (Next release)
88Features
99--------
1010* [ #757 ] ( https://github.com/java-native-access/jna/issues/757 ) : Build android archive (AAR) - [ @matthiasblaesing ] ( https://github.com/matthiasblaesing ) .
11+ * [ #767 ] ( https://github.com/java-native-access/jna/pull/767 ) : Add Win32 API mapping for Shlwapi PathIsUNC - [ @ivanwick ] ( https://github.com/ivanwick ) .
1112
1213Bug Fixes
1314---------
Original file line number Diff line number Diff line change @@ -55,4 +55,15 @@ public interface Shlwapi extends StdCallLibrary {
5555 */
5656
5757 HRESULT StrRetToStr (PointerByReference pstr , Pointer pidl , PointerByReference ppszName );
58+
59+ /**
60+ * Determines if a path string is a valid Universal Naming Convention (UNC) path, as opposed to
61+ * a path based on a drive letter.
62+ *
63+ * @param path
64+ * A string containing the path to validate.
65+ *
66+ * @return TRUE if the string is a valid UNC path; otherwise, FALSE.
67+ */
68+ boolean PathIsUNC (String path );
5869}
Original file line number Diff line number Diff line change 1+ package com .sun .jna .platform .win32 ;
2+
3+ import junit .framework .TestCase ;
4+
5+ public class ShlwapiTest extends TestCase {
6+
7+ public static void main (String [] args ) {
8+ junit .textui .TestRunner .run (ShlwapiTest .class );
9+ }
10+
11+ public void testPathIsUNC () {
12+ assertEquals (true , Shlwapi .INSTANCE .PathIsUNC ("\\ \\ path1\\ path2" ));
13+ assertEquals (true , Shlwapi .INSTANCE .PathIsUNC ("\\ \\ path1" ));
14+ assertEquals (false , Shlwapi .INSTANCE .PathIsUNC ("acme\\ \\ path4\\ \\ path5" ));
15+ assertEquals (true , Shlwapi .INSTANCE .PathIsUNC ("\\ \\ " ));
16+ assertEquals (true , Shlwapi .INSTANCE .PathIsUNC ("\\ \\ ?\\ UNC\\ path1\\ path2" ));
17+ assertEquals (true , Shlwapi .INSTANCE .PathIsUNC ("\\ \\ ?\\ UNC\\ path1" ));
18+ assertEquals (true , Shlwapi .INSTANCE .PathIsUNC ("\\ \\ ?\\ UNC\\ " ));
19+ assertEquals (false , Shlwapi .INSTANCE .PathIsUNC ("\\ path1" ));
20+ assertEquals (false , Shlwapi .INSTANCE .PathIsUNC ("path1" ));
21+ assertEquals (false , Shlwapi .INSTANCE .PathIsUNC ("c:\\ path1" ));
22+ assertEquals (false , Shlwapi .INSTANCE .PathIsUNC ("\\ \\ ?\\ c:\\ path1" ));
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments