mscoree/tests: Avoid temporary directory name collisions.
commitc11e923422f40ab0ee5e512d81cb14c85faff6a5
authorFrancois Gouget <fgouget@codeweavers.com>
Sun, 19 Mar 2023 19:07:33 +0000 (19 20:07 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 20 Mar 2023 20:01:58 +0000 (20 21:01 +0100)
tree411aa673ebe49cdc03afc04d26f5a99506a2e401
parent19b799fd628a404ca8977cac7caf08fce2ebffaf
mscoree/tests: Avoid temporary directory name collisions.

test_loadpaths_execute() was sometimes getting ERROR_ALREADY_EXISTS when
creating its temporary directoryi. That was probably because
GetTempFileNameW() only uses the low 16-bits of the 'random' LUID which
goes over a wider range, potentially leading to collisions in the lower
16-bits.
Avoid AllocateLocallyUniqueId() entirely and add a helper function to
create a guaranteed new directory.
Also try to use the current directory first as it is assumed to have
been configured to ward off anti-virus programs (specifically
Microsoft Defender) which is especially important when writing
executables to that location. Only switch to the system's temporary
directory if the current directory is not a writable location.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54560
dlls/mscoree/tests/mscoree.c