kernel32 file operations and wildcard filenames
Pouech Eric DMI AEI CAEN
pouech-eric at wanadoo.fr
Wed May 28 06:13:46 CDT 2003
> 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:
> DeleteFile: ERROR_FILE_NOT_FOUND (2)
> CopyFile: ERROR_BAD_PATHNAME (161)
> 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.
those functions are likely to be rewritten RSN (and DOSFS_GetFullName may even disappear)
So I'd suggest rather starting by writing test cases for those functions so we could use those tests when the rewrite is going to take place
More information about the wine-devel