kernel32 file operations and wildcard filenames

Rolf Kalbermatter rolf.kalbermatter at
Wed May 28 02:59:45 CDT 2003

Having done some tests on kernel32.dll file functions I have come across a
problem with filenames containing wildcards.

Under Windows (2K) all functions such as DeleteFile, CopyFile, MoveFile,
CreateDirectory and such do return FALSE and normally set the last error
to ERROR_INVALID_NAME (123) if one of the filenames passed in contains a
wildcard (*?).

Wines kernel32 behaves somewhat different. Apart from returning different
last errors in most cases such as:

MoveFile: ERROR_FILE_NOT_FOUND (2) when source contains wildcards

which all wouldn't really be a to big issue, there is one thing which
seems not right at all to me:

    MoveFile with a valid existing source and a target with wildcards
    will create a file on disk containing wildcards in its name. This
    certainly can't be the intention!

So according to Win2K it would be probably useful to check in all those
functions for existence of wildcards in the input file paths and refuse
them properly.

I took a look at the kernel32 file.c functions and saw that they usually
all call DOSFS_GetFullName which is supposed to check for valid filenames
and such. Problem is this function is also used in many other places and
I can't get a good idea if those might need to accept wildcards in file

Is there anyone more familiar with the kernel32 implementation in Wine
who could maybe give me some insight if an according change to
DOSFS_GetFullName would be useful or rather cause possible regressions?

Otherwise the best thing to do would probably be to add explicit wildcard
tests to all those file function and refuse with an according last error
set. If I do not get any reactions this is probably what I will do as I'm
somewhat weary to change an internal low level function such as
DOSFS_GetFullName without some third party encouragement.

Rolf Kalbermatter

PS: Other differences I saw, where that Wines MoveFile explicitedly forbids
directories as source with ERROR_ACCESS_DENIED (5) whereas tests under W2K
show that MoveFile happily will rename directories on the same volume, inde-
pendant if they are empty or not.
CopyFile under W2K however will complain with above error ERROR_ACCESS_DENIED (5)
for directories as source. Maybe a possible mix up?

More information about the wine-devel mailing list