Open
Bug 599311
Opened 15 years ago
Updated 3 years ago
Failure of SystemParametersInfo is not tested
Categories
(Core :: Widget: Win32, defect)
Tracking
()
NEW
People
(Reporter: jmdesp, Unassigned)
Details
(Whiteboard: [patch in hand])
No description provided.
| Reporter | ||
Comment 1•15 years ago
|
||
The call to SystemParametersInfo here has two problems :
http://hg.mozilla.org/mozilla-central/file/tip/widget/src/windows/nsLookAndFeel.cpp#l456
456 HIGHCONTRAST contrastThemeInfo;
457 contrastThemeInfo.cbSize = sizeof(contrastThemeInfo);
458 ::SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &contrastThemeInfo, 0);
459
460 aMetric = ((contrastThemeInfo.dwFlags & HCF_HIGHCONTRASTON) != 0);
- The return status of SystemParametersInfo is not tested
- The second argument is set to zero, it should be the size of the contrastThemeInfo structure according to MSDN.
| Reporter | ||
Comment 2•15 years ago
|
||
Documentation for the fact the second argument should not be zero :
http://msdn.microsoft.com/en-us/library/ms724947(VS.85).aspx
SPI_GETHIGHCONTRAST Set the cbSize member of this structure and the uiParam parameter to sizeof(HIGHCONTRAST).
Proposed fix (by Xeno86, of the KernelEx http://kernelex.sourceforge.net/ project)
456 HIGHCONTRAST contrastThemeInfo;
457 contrastThemeInfo.cbSize = sizeof(contrastThemeInfo);
458 BOOL success = ::SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(contrastThemeInfo), &contrastThemeInfo, 0);
459
460 aMetric = (success && (contrastThemeInfo.dwFlags & HCF_HIGHCONTRASTON) != 0);
The code in it's current state apparently never fails on supported Microsoft OS, first because this call is always successful, second probably because the OS implementation directly uses the size in the structure, and not the one in the argument of the call.
The problem has been identified by the KernelEx project (a set of DLL that allows NT/2000/XP program to run under Windows 98/Me) because it's much easier to make the call fail there (Accessibility Pack is optional under Windows 9x).
Original report by xeno86 on mozilla.dev.builds :
http://groups.google.com/group/mozilla.dev.builds/msg/db0d3b7d07822680
Whiteboard: [patch in hand]
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•