PATCH: Re: PathGetCharType/PathGetCharTypeA

Marcus Meissner marcus at jet.franken.de
Tue May 29 00:08:41 CDT 2001


On Mon, May 28, 2001 at 10:32:01PM -0600, Dax Kelson wrote:
> 
> I'm having a failure with a windows app.  The application starts, and it
> asks me to name my project and pick a directory to store it in.  When I do
> so, I get errors such as:
> 
> fixme:shell:PathGetCharTypeA d
> fixme:shell:PathGetCharTypeA f
> fixme:shell:PathGetCharTypeA d
> fixme:shell:PathGetCharTypeA t

> I'm a perl guy, but I'm learning C.  Maybe I'm naive, but fleshing out the
> Wine version of this function shouldn't be too hard it seems.  You'd have
> to go track down the rules.
 
> Can some point me in the right direction on fixing this up?  Can someone
> give me a quick hack to make my application work?

You just have to guess sometimes too ;)

I did a quick implementation of it, which might not be quite correct.

Ciao, Marcus

Changelog:
	First try at implementing PathGetCharType()

Index: include/shlwapi.h
===================================================================
RCS file: /home/wine/wine/include/shlwapi.h,v
retrieving revision 1.13
diff -u -r1.13 shlwapi.h
--- include/shlwapi.h	2001/02/12 01:29:08	1.13
+++ include/shlwapi.h	2001/05/29 06:08:36
@@ -8,6 +8,13 @@
 #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:
Index: dlls/shlwapi/path.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.6
diff -u -r1.6 path.c
--- dlls/shlwapi/path.c	2001/01/07 21:50:53	1.6
+++ dlls/shlwapi/path.c	2001/05/29 06:08:38
@@ -1617,8 +1617,23 @@
  */
 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 PathGetCharTypeW(WCHAR ch)
 {
-	FIXME("%c\n", ch);
-	return 0;
+	FIXME("%c, using ascii version\n", ch);
+	return PathGetCharTypeA(ch);
 }
 
 /*************************************************************************




More information about the wine-devel mailing list