user32: Respect the requested size of NONCLIENTMETRICSW structure.

This commit is contained in:
Dmitry Timoshkov 2011-10-11 14:10:17 +09:00 committed by Alexandre Julliard
parent d8ca697233
commit 9711cdbcab
1 changed files with 12 additions and 2 deletions

View File

@ -1582,11 +1582,21 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
{
LPNONCLIENTMETRICSW lpnm = pvParam;
if (!lpnm)
{
ret = FALSE;
break;
}
if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
if (lpnm && (lpnm->cbSize == sizeof(NONCLIENTMETRICSW) ||
lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth)))
if (lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
*lpnm = nonclient_metrics;
else if (lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth))
{
memcpy(lpnm, &nonclient_metrics, FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth));
lpnm->cbSize = FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth);
}
else
ret = FALSE;
break;