Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
80829db0
Commit
80829db0
authored
Feb 03, 2005
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 03, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement and test PathIsValidChar{A,W}.
parent
7c1cf8f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
207 additions
and
2 deletions
+207
-2
path.c
dlls/shlwapi/path.c
+108
-0
shlwapi.spec
dlls/shlwapi/shlwapi.spec
+2
-2
path.c
dlls/shlwapi/tests/path.c
+97
-0
No files found.
dlls/shlwapi/path.c
View file @
80829db0
...
...
@@ -4021,3 +4021,111 @@ HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR lpszFile, LPWSTR lpszPath, DWORD
return
S_OK
;
return
E_FAIL
;
}
#define PATH_CHAR_CLASS_LETTER 0x00000001
#define PATH_CHAR_CLASS_ASTERIX 0x00000002
#define PATH_CHAR_CLASS_DOT 0x00000004
#define PATH_CHAR_CLASS_BACKSLASH 0x00000008
#define PATH_CHAR_CLASS_COLON 0x00000010
#define PATH_CHAR_CLASS_SEMICOLON 0x00000020
#define PATH_CHAR_CLASS_COMMA 0x00000040
#define PATH_CHAR_CLASS_SPACE 0x00000080
#define PATH_CHAR_CLASS_OTHER_VALID 0x00000100
#define PATH_CHAR_CLASS_DOUBLEQUOTE 0x00000200
#define PATH_CHAR_CLASS_INVALID 0x00000000
#define PATH_CHAR_CLASS_ANY 0xffffffff
static
const
DWORD
SHELL_charclass
[]
=
{
/* 0x00 */
PATH_CHAR_CLASS_INVALID
,
/* 0x01 */
PATH_CHAR_CLASS_INVALID
,
/* 0x02 */
PATH_CHAR_CLASS_INVALID
,
/* 0x03 */
PATH_CHAR_CLASS_INVALID
,
/* 0x04 */
PATH_CHAR_CLASS_INVALID
,
/* 0x05 */
PATH_CHAR_CLASS_INVALID
,
/* 0x06 */
PATH_CHAR_CLASS_INVALID
,
/* 0x07 */
PATH_CHAR_CLASS_INVALID
,
/* 0x08 */
PATH_CHAR_CLASS_INVALID
,
/* 0x09 */
PATH_CHAR_CLASS_INVALID
,
/* 0x0a */
PATH_CHAR_CLASS_INVALID
,
/* 0x0b */
PATH_CHAR_CLASS_INVALID
,
/* 0x0c */
PATH_CHAR_CLASS_INVALID
,
/* 0x0d */
PATH_CHAR_CLASS_INVALID
,
/* 0x0e */
PATH_CHAR_CLASS_INVALID
,
/* 0x0f */
PATH_CHAR_CLASS_INVALID
,
/* 0x10 */
PATH_CHAR_CLASS_INVALID
,
/* 0x11 */
PATH_CHAR_CLASS_INVALID
,
/* 0x12 */
PATH_CHAR_CLASS_INVALID
,
/* 0x13 */
PATH_CHAR_CLASS_INVALID
,
/* 0x14 */
PATH_CHAR_CLASS_INVALID
,
/* 0x15 */
PATH_CHAR_CLASS_INVALID
,
/* 0x16 */
PATH_CHAR_CLASS_INVALID
,
/* 0x17 */
PATH_CHAR_CLASS_INVALID
,
/* 0x18 */
PATH_CHAR_CLASS_INVALID
,
/* 0x19 */
PATH_CHAR_CLASS_INVALID
,
/* 0x1a */
PATH_CHAR_CLASS_INVALID
,
/* 0x1b */
PATH_CHAR_CLASS_INVALID
,
/* 0x1c */
PATH_CHAR_CLASS_INVALID
,
/* 0x1d */
PATH_CHAR_CLASS_INVALID
,
/* 0x1e */
PATH_CHAR_CLASS_INVALID
,
/* 0x1f */
PATH_CHAR_CLASS_INVALID
,
/* ' ' */
PATH_CHAR_CLASS_SPACE
,
/* '!' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '"' */
PATH_CHAR_CLASS_DOUBLEQUOTE
,
/* '#' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '$' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '%' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '&' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '\'' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '(' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* ')' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '*' */
PATH_CHAR_CLASS_ASTERIX
,
/* '+' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* ',' */
PATH_CHAR_CLASS_COMMA
,
/* '-' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '.' */
PATH_CHAR_CLASS_DOT
,
/* '/' */
PATH_CHAR_CLASS_INVALID
,
/* '0' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '1' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '2' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '3' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '4' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '5' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '6' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '7' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '8' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '9' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* ':' */
PATH_CHAR_CLASS_COLON
,
/* ';' */
PATH_CHAR_CLASS_SEMICOLON
,
/* '<' */
PATH_CHAR_CLASS_INVALID
,
/* '=' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '>' */
PATH_CHAR_CLASS_INVALID
,
/* '?' */
PATH_CHAR_CLASS_LETTER
,
/* '@' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* 'A' */
PATH_CHAR_CLASS_ANY
,
/* 'B' */
PATH_CHAR_CLASS_ANY
,
/* 'C' */
PATH_CHAR_CLASS_ANY
,
/* 'D' */
PATH_CHAR_CLASS_ANY
,
/* 'E' */
PATH_CHAR_CLASS_ANY
,
/* 'F' */
PATH_CHAR_CLASS_ANY
,
/* 'G' */
PATH_CHAR_CLASS_ANY
,
/* 'H' */
PATH_CHAR_CLASS_ANY
,
/* 'I' */
PATH_CHAR_CLASS_ANY
,
/* 'J' */
PATH_CHAR_CLASS_ANY
,
/* 'K' */
PATH_CHAR_CLASS_ANY
,
/* 'L' */
PATH_CHAR_CLASS_ANY
,
/* 'M' */
PATH_CHAR_CLASS_ANY
,
/* 'N' */
PATH_CHAR_CLASS_ANY
,
/* 'O' */
PATH_CHAR_CLASS_ANY
,
/* 'P' */
PATH_CHAR_CLASS_ANY
,
/* 'Q' */
PATH_CHAR_CLASS_ANY
,
/* 'R' */
PATH_CHAR_CLASS_ANY
,
/* 'S' */
PATH_CHAR_CLASS_ANY
,
/* 'T' */
PATH_CHAR_CLASS_ANY
,
/* 'U' */
PATH_CHAR_CLASS_ANY
,
/* 'V' */
PATH_CHAR_CLASS_ANY
,
/* 'W' */
PATH_CHAR_CLASS_ANY
,
/* 'X' */
PATH_CHAR_CLASS_ANY
,
/* 'Y' */
PATH_CHAR_CLASS_ANY
,
/* 'Z' */
PATH_CHAR_CLASS_ANY
,
/* '[' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '\\' */
PATH_CHAR_CLASS_BACKSLASH
,
/* ']' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '^' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '_' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '`' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* 'a' */
PATH_CHAR_CLASS_ANY
,
/* 'b' */
PATH_CHAR_CLASS_ANY
,
/* 'c' */
PATH_CHAR_CLASS_ANY
,
/* 'd' */
PATH_CHAR_CLASS_ANY
,
/* 'e' */
PATH_CHAR_CLASS_ANY
,
/* 'f' */
PATH_CHAR_CLASS_ANY
,
/* 'g' */
PATH_CHAR_CLASS_ANY
,
/* 'h' */
PATH_CHAR_CLASS_ANY
,
/* 'i' */
PATH_CHAR_CLASS_ANY
,
/* 'j' */
PATH_CHAR_CLASS_ANY
,
/* 'k' */
PATH_CHAR_CLASS_ANY
,
/* 'l' */
PATH_CHAR_CLASS_ANY
,
/* 'm' */
PATH_CHAR_CLASS_ANY
,
/* 'n' */
PATH_CHAR_CLASS_ANY
,
/* 'o' */
PATH_CHAR_CLASS_ANY
,
/* 'p' */
PATH_CHAR_CLASS_ANY
,
/* 'q' */
PATH_CHAR_CLASS_ANY
,
/* 'r' */
PATH_CHAR_CLASS_ANY
,
/* 's' */
PATH_CHAR_CLASS_ANY
,
/* 't' */
PATH_CHAR_CLASS_ANY
,
/* 'u' */
PATH_CHAR_CLASS_ANY
,
/* 'v' */
PATH_CHAR_CLASS_ANY
,
/* 'w' */
PATH_CHAR_CLASS_ANY
,
/* 'x' */
PATH_CHAR_CLASS_ANY
,
/* 'y' */
PATH_CHAR_CLASS_ANY
,
/* 'z' */
PATH_CHAR_CLASS_ANY
,
/* '{' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '|' */
PATH_CHAR_CLASS_INVALID
,
/* '}' */
PATH_CHAR_CLASS_OTHER_VALID
,
/* '~' */
PATH_CHAR_CLASS_OTHER_VALID
};
/*************************************************************************
* @ [SHLWAPI.455]
*
* Check if an ASCII char is of a certain class
*/
BOOL
WINAPI
PathIsValidCharA
(
char
c
,
DWORD
class
)
{
if
((
unsigned
)
c
>
0x7e
)
return
class
&
PATH_CHAR_CLASS_OTHER_VALID
;
return
class
&
SHELL_charclass
[(
unsigned
)
c
];
}
/*************************************************************************
* @ [SHLWAPI.456]
*
* Check if a Unicode char is of a certain class
*/
BOOL
WINAPI
PathIsValidCharW
(
WCHAR
c
,
DWORD
class
)
{
if
(
c
>
0x7e
)
return
class
&
PATH_CHAR_CLASS_OTHER_VALID
;
return
class
&
SHELL_charclass
[
c
];
}
dlls/shlwapi/shlwapi.spec
View file @
80829db0
...
...
@@ -452,8 +452,8 @@
452 stub -noname CharUpperNoDBCSW
453 stub -noname CharLowerNoDBCSA
454 stub -noname CharLowerNoDBCSW
455 st
ub -noname PathIsValidCharA
456 st
ub -noname PathIsValidCharW
455 st
dcall -noname PathIsValidCharA(long long)
456 st
dcall -noname PathIsValidCharW(long long)
457 stub -noname GetLongPathNameWrapW
458 stub -noname GetLongPathNameWrapA
459 stdcall -noname SHExpandEnvironmentStringsA(str ptr long) kernel32.ExpandEnvironmentStringsA
...
...
dlls/shlwapi/tests/path.c
View file @
80829db0
...
...
@@ -606,6 +606,101 @@ static void test_PathIsUrl(void)
}
}
static
const
DWORD
SHELL_charclass
[]
=
{
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000000
,
0x00000080
,
0x00000100
,
0x00000200
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000002
,
0x00000100
,
0x00000040
,
0x00000100
,
0x00000004
,
0x00000000
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000010
,
0x00000020
,
0x00000000
,
0x00000100
,
0x00000000
,
0x00000001
,
0x00000100
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0x00000100
,
0x00000008
,
0x00000100
,
0x00000100
,
0x00000100
,
0x00000100
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0x00000100
,
0x00000000
,
0x00000100
,
0x00000100
};
BOOL
WINAPI
PathIsValidCharA
(
char
c
,
DWORD
class
);
BOOL
WINAPI
PathIsValidCharW
(
WCHAR
c
,
DWORD
class
);
static
void
test_PathIsValidCharA
(
void
)
{
BOOL
ret
;
unsigned
int
c
;
ret
=
PathIsValidCharA
(
0x7f
,
0
);
ok
(
!
ret
,
"PathIsValidCharA succeeded: 0x%08lx
\n
"
,
(
DWORD
)
ret
);
ret
=
PathIsValidCharA
(
0x7f
,
1
);
ok
(
!
ret
,
"PathIsValidCharA succeeded: 0x%08lx
\n
"
,
(
DWORD
)
ret
);
for
(
c
=
0
;
c
<
0x7f
;
c
++
)
{
ret
=
PathIsValidCharA
(
c
,
~
0U
);
ok
(
ret
==
SHELL_charclass
[
c
]
||
(
ret
==
1
&&
SHELL_charclass
[
c
]
==
0xffffffff
),
"PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x%08lx
\n
"
,
c
,
(
DWORD
)
ret
,
SHELL_charclass
[
c
]
);
}
for
(
c
=
0x7f
;
c
<=
0xff
;
c
++
)
{
ret
=
PathIsValidCharA
(
c
,
~
0U
);
ok
(
ret
==
0x00000100
,
"PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x00000100
\n
"
,
c
,
(
DWORD
)
ret
);
}
}
static
void
test_PathIsValidCharW
(
void
)
{
BOOL
ret
;
unsigned
int
c
;
ret
=
PathIsValidCharW
(
0x7f
,
0
);
ok
(
!
ret
,
"PathIsValidCharW succeeded: 0x%08lx
\n
"
,
(
DWORD
)
ret
);
ret
=
PathIsValidCharW
(
0x7f
,
1
);
ok
(
!
ret
,
"PathIsValidCharW succeeded: 0x%08lx
\n
"
,
(
DWORD
)
ret
);
for
(
c
=
0
;
c
<
0x7f
;
c
++
)
{
ret
=
PathIsValidCharW
(
c
,
~
0U
);
ok
(
ret
==
SHELL_charclass
[
c
]
||
(
ret
==
1
&&
SHELL_charclass
[
c
]
==
0xffffffff
),
"PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x%08lx
\n
"
,
c
,
(
DWORD
)
ret
,
SHELL_charclass
[
c
]
);
}
for
(
c
=
0x007f
;
c
<=
0xffff
;
c
++
)
{
ret
=
PathIsValidCharW
(
c
,
~
0U
);
ok
(
ret
==
0x00000100
,
"PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x00000100
\n
"
,
c
,
(
DWORD
)
ret
);
}
}
START_TEST
(
path
)
{
test_UrlHash
();
...
...
@@ -620,4 +715,6 @@ START_TEST(path)
test_PathSearchAndQualify
();
test_PathCreateFromUrl
();
test_PathIsUrl
();
test_PathIsValidCharA
();
test_PathIsValidCharW
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment