Huw Davies (@huw) commented about dlls/advapi32/tests/registry.c:
+{
- WIN32_FIND_DATAA findfile;
- HANDLE search;
- char temppath_wildcard[MAX_PATH], tempfilepath[MAX_PATH];
- sprintf(temppath_wildcard, "%s*.tmp*", temppath);
- if((search = FindFirstFileA(temppath_wildcard, &findfile)) != INVALID_HANDLE_VALUE)
- {
do
{
int attempts = 0;
sprintf(tempfilepath, "%s%s", temppath, findfile.cFileName);
while (!DeleteFileA(tempfilepath) && attempts++ <= 10)
{
if (winetest_debug > 1)
printf("Failed at deleting %s attempt %d/10\n", tempfilepath, attempts);
Use `trace()` in tests. However I'm not convinced that this is particularly useful. It would be more interesting to add a test that `DeleteFile()` eventually succeeds, so that we'd notice if we weren't waiting long enough.
On that note, I think sleeping for 100ms would be better. On my Win 7 VM it typically succeeds on the 2nd attempt with a 100ms wait.