prevents WM_DISPLAYCHANGE message being sent when a call to ChangeDisplaySettingsEx fails due to the requested change to the display not occurring.
Reece Dunn
msclrhd at googlemail.com
Tue Mar 25 17:55:26 CDT 2008
On 24/03/2008, chris morgan <cmorgan at mail.leather-wallet.co.uk> wrote:
> test code run on windows nt4 sp6, messages checked using ms spk++:
>
> DEVMODE dev_mode;
> memset(&dev_mode,0,sizeof(DEVMODE));
> dev_mode.dmSize = sizeof(DEVMODE);
>
> // Get the current display settings
> if (!EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&dev_mode))
> {
> printf("Could not EnumDisplaySettings, giving up.\n");
> return 0;
> }
>
> // Call ChangeDisplaySettings with the current settings,
> // No WM_DISPLAYCHANGE message sent
> ChangeDisplaySettings(&dev_mode, 0);
>
> // Change something (that works)
> dev_mode.dmBitsPerPel = 32;
>
> // WM_DISPLAYCHANGE message sent
> ChangeDisplaySettings(&dev_mode, 0);
>
> // Change something to an impossible value
> dev_mode.dmBitsPerPel = 999;
>
> // No WM_DISPLAYCHANGE message sent
> ChangeDisplaySettings(&dev_mode, 0);
This should be incorporated into a conformance/regression test. That
way, this bug will not reappear and can also be verified as the
correct behaviour on different versions of Windows.
> + if (width == screen_width && height == screen_height)
> + {
> + return;
> + }
w.r.t. the implementation:
* ChangeDisplaySettings returns a long
(http://msdn2.microsoft.com/en-us/library/ms533260(VS.85).aspx), so
the correct value must be returned on error;
* the fix does not match the test cases (screen size vs colour depth).
In addition, your tests should:
* check that changing the screen resolution causes a
WM_DISPLAYCHANGE message to be sent;
* if there are no other tests, ChangeDisplaySettings should be
checked to see what happens with invalid arguments (for completeness);
* the return value is not checked for expected values (see
http://msdn2.microsoft.com/en-us/library/ms533260(VS.85).aspx);
* GetLastError() is not checked to see what it is set to (see other
tests for examples);
* restore the display settings back to what they were before the tests.
Thanks for improving Wine,
- Reece
More information about the wine-devel
mailing list