Alexandre Julliard wrote:

"Rolf Kalbermatter" <[EMAIL PROTECTED]> writes:



My tests show that RemoveDirectory just as CreateDirectory rejects all
paths which contain one of the wildcards ": * ? \" < > |" with error 123
completely independent where that character occurs (not just in the path
element which is created).
And as far as I can say DeleteFile just as much behaves also this way.
So should we attempt to be smarter than Windows in this case?



Yes, because under Unix you can actually create files that contain
wildcards, so it should be possible to access them. We just need to
prevent the Windows app itself from creating them.


How on earth can a discussion about wildcards be related to unicows???

It appears that applications using unicows will not work in NT mode on wine unless the attached patch is applied. Unicows' init calls "GetFileAttributesW" with "???.???". It expects, if it fails, to get error code 123 (ERROR_INVALID_NAME), otherwise it simply doesn't work. Wine returns 2 (ERROR_FILE_NOT_FOUND). For that horrible sin, the entire application misbehaves. It also misbehaves, in the same way, if GetFileAttributes succeeds for this file. I can't escape the feeling this was meant specifically as a trap for Wine. I am yet to find any other use for this test. Any other explanation will be greatly appretiated.

One possible workaround that may satisfy both Alexandre and unicows may be to put the wildcards checking code into the error part of the function. In other words, if we have not found such a file, return ERROR_INVALID_NAME if the name contains wildcards, and ERROR_FILE_NOT_FOUND if not. This way, if the file IS found, it will be handled correctly.

Personally, I don't like this workaround. It means that a perfectly legal file name is reported as illegal. I am, however, open to suggestions.

Shachar

--
Shachar Shemesh
Open Source integration & consulting
Home page & resume - http://www.shemesh.biz/

Index: files/dos_fs.c
===================================================================
RCS file: /home/sun/sources/cvs/wine/files/dos_fs.c,v
retrieving revision 1.142
diff -u -r1.142 dos_fs.c
--- files/dos_fs.c      15 Nov 2003 00:13:21 -0000      1.142
+++ files/dos_fs.c      25 Nov 2003 13:22:23 -0000
@@ -1047,6 +1047,12 @@
         return FALSE;
     }
 
+    if (strchrW(name, '?') || strchrW(name, '*'))
+    {
+        SetLastError(ERROR_INVALID_NAME);
+        return FALSE;
+    }
+
     if ((full->drive = DOSFS_GetPathDrive( &name )) == -1) return FALSE;
     flags = DRIVE_GetFlags( full->drive );
 

Reply via email to