Check structure size and fix return values in EM_GETCHARFORMAT.
This commit is contained in:
parent
521d067ba9
commit
af4009d2fd
|
@ -1076,14 +1076,19 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
}
|
}
|
||||||
case EM_GETCHARFORMAT:
|
case EM_GETCHARFORMAT:
|
||||||
{
|
{
|
||||||
CHARFORMAT2W tmp;
|
CHARFORMAT2W tmp, *dst = (CHARFORMAT2W *)lParam;
|
||||||
|
if (dst->cbSize != sizeof(CHARFORMATA) &&
|
||||||
|
dst->cbSize != sizeof(CHARFORMATW) &&
|
||||||
|
dst->cbSize != sizeof(CHARFORMAT2A) &&
|
||||||
|
dst->cbSize != sizeof(CHARFORMAT2W))
|
||||||
|
return 0;
|
||||||
tmp.cbSize = sizeof(tmp);
|
tmp.cbSize = sizeof(tmp);
|
||||||
if (!wParam)
|
if (!wParam)
|
||||||
ME_GetDefaultCharFormat(editor, &tmp);
|
ME_GetDefaultCharFormat(editor, &tmp);
|
||||||
else
|
else
|
||||||
ME_GetSelectionCharFormat(editor, &tmp);
|
ME_GetSelectionCharFormat(editor, &tmp);
|
||||||
ME_CopyToCFAny((CHARFORMAT2W *)lParam, &tmp);
|
ME_CopyToCFAny(dst, &tmp);
|
||||||
return 0;
|
return tmp.dwMask;
|
||||||
}
|
}
|
||||||
case EM_SETPARAFORMAT:
|
case EM_SETPARAFORMAT:
|
||||||
ME_SetSelectionParaFormat(editor, (PARAFORMAT2 *)lParam);
|
ME_SetSelectionParaFormat(editor, (PARAFORMAT2 *)lParam);
|
||||||
|
|
Loading…
Reference in New Issue