qedit: tests/mediadet.c test skips sometimes

Francois Gouget fgouget at free.fr
Sat Dec 20 04:16:43 CST 2008

On Sat, 20 Dec 2008, Rico Schüller wrote:
> I think I've found the problem ... it is in UINT WINAPI 
> GetTempFileNameW( LPCWSTR path, LPCWSTR prefix, UINT unique, LPWSTR 
> buffer ) in line UINT num = GetTickCount() & 0xffff; .
> On fast machines GetTickCount has the same value when it is called two 
> times in a short time.  Therefore it generates the same time and as a 
> result the same file, which isn't the case on windows. On windows it 
> looks like there is a number increasing each run by one, something like this
> static UINT num;
> num = num++ & 0xffff;
> should be the solution.
> To make the qedit test happy a Sleep(...) between the two calls should 
> be enough.

In either cases, shouldn't we worry about the filename being predictable 
with the security issues this implies? I know this very issue has 
generated a lot of security issues on Unix...

Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
In theory, theory and practice are the same, but in practice they're different.

More information about the wine-devel mailing list