Zhiyi Zhang (@zhiyi) commented about dlls/user32/tests/monitor.c:
+ ok(!!event1, "OpenEventA failed, error %#lx\n", GetLastError()); + event2 = CreateEventW(NULL, FALSE, FALSE, L"test_ChangeDisplaySettingsEx_event2"); + ok(!!event2, "OpenEventA failed, error %#lx\n", GetLastError()); + + memset(&startup, 0, sizeof(startup)); + startup.cb = sizeof(startup); + startup.dwFlags = STARTF_USESHOWWINDOW; + startup.wShowWindow = SW_SHOWNORMAL; + + /* Test that if the most recent ChangeDisplaySettingsEx call had + * CDS_FULLSCREEN set, the the settings are restored when the caller + * process exits */ + + snprintf(buffer, sizeof(buffer), "%s monitor fullscreen %s %s %s", myARGV[0], devices[0].name, + "test_ChangeDisplaySettingsEx_event2", "test_ChangeDisplaySettingsEx_event0"); + res = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info0); Please introduce a helper that launches the child process. For example, test_child_process_ChangeDisplaySettingsEx(CHAR *adapter_name, DWORD flags). Then you can use the helper to launch processes and call ChangeDisplaySettingsEx() with or without CDS_FULLSCREEN for the specified GDI adapter name. You can also call the helper in a different order and test that the last call to ChangeDisplaySettingsEx() CDS_FULLSCREEN wins and the registry display settings should be restored in such order.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5060#note_62775