From 784fd59e4307072bb2fcef67d50d4fe29a5da79e Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Tue, 29 May 2001 20:51:53 +0000 Subject: [PATCH] First try at implementing PathGetCharType(). --- dlls/shlwapi/path.c | 23 +++++++++++++++++++---- include/shlwapi.h | 7 +++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c index 6f3599919cc..dac041a9d4d 100644 --- a/dlls/shlwapi/path.c +++ b/dlls/shlwapi/path.c @@ -1617,8 +1617,23 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR pszPath, UINT dx) */ UINT WINAPI PathGetCharTypeA(UCHAR ch) { - FIXME("%c\n", ch); - return 0; + UINT flags = 0; + + TRACE("%c\n", ch); + + /* We could use them in filenames, but this would confuse 'ls' */ + if (iscntrl(ch)) + return GCT_INVALID; + if ((ch == '*') || (ch=='?')) + return GCT_WILD; + if ((ch == '\\') || (ch=='/')) + return GCT_SEPARATOR; + flags = 0; + /* all normal characters, no lower case letters */ + if ((ch > ' ') && (ch < 0x7f) && !islower(ch)) + flags |= GCT_SHORTCHAR; + /* All other characters are valid in long filenames, even umlauts */ + return flags | GCT_LFNCHAR; } /************************************************************************* @@ -1626,8 +1641,8 @@ UINT WINAPI PathGetCharTypeA(UCHAR ch) */ UINT WINAPI PathGetCharTypeW(WCHAR ch) { - FIXME("%c\n", ch); - return 0; + FIXME("%c, using ascii version\n", ch); + return PathGetCharTypeA(ch); } /************************************************************************* diff --git a/include/shlwapi.h b/include/shlwapi.h index 64f5a57bc11..d8104d2b21b 100644 --- a/include/shlwapi.h +++ b/include/shlwapi.h @@ -8,6 +8,13 @@ extern "C" { #endif /* defined(__cplusplus) */ +/* Mask returned by GetPathCharType */ +#define GCT_INVALID 0x0000 +#define GCT_LFNCHAR 0x0001 +#define GCT_SHORTCHAR 0x0002 +#define GCT_WILD 0x0004 +#define GCT_SEPARATOR 0x0008 + /* * The URL_ defines were determined by trial and error. If they become * documented please check them and add the missing ones including: