On Sun, 16 Feb 2014, Zhenbo Li wrote: [...]
However, I can't understand the intention of previous code: All testcases are put into 'static filename_tests_t filename_tests[]', then they are tested via a while-loop. I think it is difficult to locate *which* testcase really fails.
Is re-factoring such code encouraged? If so, I'm glad to do it.
No. The goal of this test structure is to avoid lots of code duplication. To compensate with the line number being of little use, the failure message prints the full data on what was tested. For instance the first failure is:
shlexec.c:139: Test failed: ShellExecute(verb="", file="C:\Users\winetest\AppData\Local\Temp\wtD671.tmp\test file.noassoc") WaitForSingleObject returned 258
The verb is empty and the base filename 'test file.noassoc' so this corresponds to:
/* Test filenames with no association */ {NULL, "%s\test file.noassoc", 0x0, SE_ERR_NOASSOC},
It turns out I looked into this a bit and in fact all the 'returned 258' errors have the same cause: Windows 8 pops up a 'dialog' that asks whether to look for an app in the Microsoft Store to handle the unknown file extension.
shell_execute() has some code to deal with those which centers on:
HWND wnd = FindWindowA("#32770", "Windows");
That line is supposed to detect the dialog popped up by Windows, dismiss it and note to skip further tests that could trigger it.
The problem is that on Windows 8 the 'dialog' has changed: it's a window with no decoration that looks very much like the Metro apps. So it's too different and thus is not detected.
I tried to figure out what class or title that window has using Spy++ but any time I click outside it, it disappears.
That's where I got stuck. So if anyone wants to take over...