include: Add a padding WORD to ensure that wWeight is at the correct offset.

This is a bug in MS's C version of these structures.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-10-13 16:52:49 +01:00 committed by Alexandre Julliard
parent 9bce3e6113
commit f1ef14e023
2 changed files with 45 additions and 0 deletions

View File

@ -747,6 +747,7 @@ static void test_EM_SETCHARFORMAT(void)
{
HWND hwndRichEdit = new_richedit(NULL);
CHARFORMAT2A cf2;
CHARFORMAT2W cfW;
int rc = 0;
int tested_effects[] = {
CFE_BOLD,
@ -1196,6 +1197,48 @@ static void test_EM_SETCHARFORMAT(void)
ok((cf2.dwEffects & CFE_BOLD) == CFE_BOLD,
"%d, cf2.dwEffects == 0x%08x expected effect 0x%08x\n", i, cf2.dwEffects, CFE_BOLD);
/* show that wWeight is at the correct offset in CHARFORMAT2A */
memset(&cf2, 0, sizeof(cf2));
cf2.cbSize = sizeof(cf2);
cf2.dwMask = CFM_WEIGHT;
cf2.wWeight = 100;
SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
memset(&cf2, 0, sizeof(cf2));
cf2.cbSize = sizeof(cf2);
SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
ok(cf2.wWeight == 100, "got %d\n", cf2.wWeight);
memset(&cf2, 0, sizeof(cf2));
cf2.cbSize = sizeof(cf2);
cf2.dwMask = CFM_SPACING;
cf2.sSpacing = 10;
SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
memset(&cf2, 0, sizeof(cf2));
cf2.cbSize = sizeof(cf2);
SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
ok(cf2.sSpacing == 10, "got %d\n", cf2.sSpacing);
/* show that wWeight is at the correct offset in CHARFORMAT2W */
memset(&cfW, 0, sizeof(cfW));
cfW.cbSize = sizeof(cfW);
cfW.dwMask = CFM_WEIGHT;
cfW.wWeight = 100;
SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfW);
memset(&cfW, 0, sizeof(cfW));
cfW.cbSize = sizeof(cfW);
SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfW);
ok(cfW.wWeight == 100, "got %d\n", cfW.wWeight);
memset(&cfW, 0, sizeof(cfW));
cfW.cbSize = sizeof(cfW);
cfW.dwMask = CFM_SPACING;
cfW.sSpacing = 10;
SendMessageA(hwndRichEdit, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfW);
memset(&cfW, 0, sizeof(cfW));
cfW.cbSize = sizeof(cfW);
SendMessageA(hwndRichEdit, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfW);
ok(cfW.sSpacing == 10, "got %d\n", cfW.sSpacing);
DestroyWindow(hwndRichEdit);
}

View File

@ -287,6 +287,7 @@ typedef struct _charformat2a {
BYTE bCharSet;
BYTE bPitchAndFamily;
char szFaceName[LF_FACESIZE];
WORD pad; /* Not in MS's C version, but needed to ensure that wWeight is at the correct offset to match the C++ version */
WORD wWeight;
SHORT sSpacing;
COLORREF crBackColor;
@ -309,6 +310,7 @@ typedef struct _charformat2w {
BYTE bCharSet;
BYTE bPitchAndFamily;
WCHAR szFaceName[LF_FACESIZE];
WORD pad; /* Not in MS's C version, but needed to ensure that wWeight is at the correct offset to match the C++ version */
WORD wWeight;
SHORT sSpacing;
COLORREF crBackColor;