Reject wildcards in directory names

Alexandre Julliard julliard at winehq.org
Tue Nov 25 13:43:44 CST 2003


Shachar Shemesh <wine-devel at shemesh.biz> writes:

> 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.

It seems to be a way to detect NT/Win95, I suspect Win95 returns a
different error code in that case. Using GetVersion() would of course
have been too easy...

> 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.

Well, yes, that was the idea. The normal case is that the file doesn't
exist, and in that case we of course need to return the proper error
(also taking Windows version into account apparently...)

Anyway, I looked into your unicows exe, and I believe the problem is
that the home-made GetProcAddress that unicows.lib is using doesn't
support forwarded ordinals, so I'm afraid we'll need to export real
functions from unicows.dll.

-- 
Alexandre Julliard
julliard at winehq.com



More information about the wine-devel mailing list