comctl32/rebar: Use proper structure size in tests and parameter checks.
This commit is contained in:
parent
aa9602db10
commit
9ee5f26570
|
@ -1699,11 +1699,11 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan
|
|||
if( (lprbbi->fMask & RBBIM_CHILDSIZE) &&
|
||||
( (lpBand->cxMinChild != lprbbi->cxMinChild) ||
|
||||
(lpBand->cyMinChild != lprbbi->cyMinChild ) ||
|
||||
( (lprbbi->cbSize >= sizeof (REBARBANDINFOA) && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) &&
|
||||
( (lprbbi->cbSize >= REBARBANDINFOA_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) &&
|
||||
( (lpBand->cyChild != lprbbi->cyChild ) ||
|
||||
(lpBand->cyMaxChild != lprbbi->cyMaxChild ) ||
|
||||
(lpBand->cyIntegral != lprbbi->cyIntegral ) ) ) ||
|
||||
( (lprbbi->cbSize < sizeof (REBARBANDINFOA)) &&
|
||||
( (lprbbi->cbSize < REBARBANDINFOA_V6_SIZE) &&
|
||||
( (lpBand->cyChild ||
|
||||
lpBand->cyMaxChild ||
|
||||
lpBand->cyIntegral ) ) ) ) )
|
||||
|
@ -1711,7 +1711,7 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan
|
|||
lpBand->cxMinChild = lprbbi->cxMinChild;
|
||||
lpBand->cyMinChild = lprbbi->cyMinChild;
|
||||
/* These fields where added in WIN32_IE == 0x400 and are set only for RBBS_VARIABLEHEIGHT bands */
|
||||
if (lprbbi->cbSize >= sizeof (REBARBANDINFOA) && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
|
||||
if (lprbbi->cbSize >= REBARBANDINFOA_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
|
||||
lpBand->cyMaxChild = lprbbi->cyMaxChild;
|
||||
lpBand->cyIntegral = lprbbi->cyIntegral;
|
||||
|
||||
|
@ -1747,7 +1747,7 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan
|
|||
}
|
||||
|
||||
/* check for additional data */
|
||||
if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
|
||||
if (lprbbi->cbSize >= REBARBANDINFOA_V6_SIZE) {
|
||||
if( (lprbbi->fMask & RBBIM_IDEALSIZE) &&
|
||||
( lpBand->cxIdeal != lprbbi->cxIdeal ) )
|
||||
{
|
||||
|
@ -2167,7 +2167,7 @@ REBAR_GetBandInfoT(const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL
|
|||
lprbbi->cyMinChild = lpBand->cyMinChild;
|
||||
/* to make tests pass we follow Windows behaviour and allow to read these fields only
|
||||
* for RBBS_VARIABLEHEIGHTS bands */
|
||||
if (lprbbi->cbSize >= sizeof (REBARBANDINFOA) && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
|
||||
if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
|
||||
lprbbi->cyChild = lpBand->cyChild;
|
||||
lprbbi->cyMaxChild = lpBand->cyMaxChild;
|
||||
lprbbi->cyIntegral = lpBand->cyIntegral;
|
||||
|
@ -2184,7 +2184,7 @@ REBAR_GetBandInfoT(const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL
|
|||
lprbbi->wID = lpBand->wID;
|
||||
|
||||
/* check for additional data */
|
||||
if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
|
||||
if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE) {
|
||||
if (lprbbi->fMask & RBBIM_IDEALSIZE)
|
||||
lprbbi->cxIdeal = lpBand->cxIdeal;
|
||||
|
||||
|
@ -2424,7 +2424,7 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnico
|
|||
REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand);
|
||||
|
||||
/* Make sure the defaults for these are correct */
|
||||
if (lprbbi->cbSize < sizeof (REBARBANDINFOA) || !(lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
|
||||
if (lprbbi->cbSize < REBARBANDINFOA_V6_SIZE || !(lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
|
||||
lpBand->cyChild = lpBand->cyMinChild;
|
||||
lpBand->cyMaxChild = 0x7fffffff;
|
||||
lpBand->cyIntegral = 0;
|
||||
|
|
|
@ -150,7 +150,7 @@ static void dump_sizes(HWND hRebar)
|
|||
for (i=0; i<count; i++)
|
||||
{
|
||||
REBARBANDINFO rbi;
|
||||
rbi.cbSize = sizeof(REBARBANDINFO);
|
||||
rbi.cbSize = REBARBANDINFOA_V6_SIZE;
|
||||
rbi.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_STYLE;
|
||||
ok(SendMessageA(hRebar, RB_GETBANDINFOA, i, (LPARAM)&rbi), "RB_GETBANDINFO failed\n");
|
||||
ok(SendMessageA(hRebar, RB_GETRECT, i, (LPARAM)&r), "RB_GETRECT failed\n");
|
||||
|
@ -313,7 +313,7 @@ static int rbsize_numtests = 0;
|
|||
ok(SendMessageA(hRebar, RB_GETRECT, i, (LPARAM)&rc) == 1, "RB_GETRECT\n"); \
|
||||
if (!(res->bands[i].fStyle & RBBS_HIDDEN)) \
|
||||
check_rect("band", rc, res->bands[i].rc); \
|
||||
rbi.cbSize = sizeof(REBARBANDINFO); \
|
||||
rbi.cbSize = REBARBANDINFOA_V6_SIZE; \
|
||||
rbi.fMask = RBBIM_STYLE | RBBIM_SIZE; \
|
||||
ok(SendMessageA(hRebar, RB_GETBANDINFO, i, (LPARAM)&rbi) == 1, "RB_GETBANDINFO\n"); \
|
||||
compare(rbi.fStyle, res->bands[i].fStyle, "%x"); \
|
||||
|
@ -329,11 +329,11 @@ static int rbsize_numtests = 0;
|
|||
static void add_band_w(HWND hRebar, LPCSTR lpszText, int cxMinChild, int cx, int cxIdeal)
|
||||
{
|
||||
CHAR buffer[MAX_PATH];
|
||||
REBARBANDINFO rbi;
|
||||
REBARBANDINFOA rbi;
|
||||
|
||||
if (lpszText != NULL)
|
||||
strcpy(buffer, lpszText);
|
||||
rbi.cbSize = sizeof(rbi);
|
||||
rbi.cbSize = REBARBANDINFOA_V6_SIZE;
|
||||
rbi.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_IDEALSIZE | RBBIM_TEXT;
|
||||
rbi.cx = cx;
|
||||
rbi.cxMinChild = cxMinChild;
|
||||
|
@ -353,7 +353,7 @@ static void layout_test(void)
|
|||
|
||||
rebuild_rebar(&hRebar);
|
||||
check_sizes();
|
||||
rbi.cbSize = sizeof(rbi);
|
||||
rbi.cbSize = REBARBANDINFOA_V6_SIZE;
|
||||
rbi.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD;
|
||||
rbi.cx = 200;
|
||||
rbi.cxMinChild = 100;
|
||||
|
@ -742,10 +742,10 @@ static void expect_band_content(UINT uBand, INT fStyle, COLORREF clrFore,
|
|||
INT cxHeader)
|
||||
{
|
||||
CHAR buf[MAX_PATH] = "abc";
|
||||
REBARBANDINFO rb;
|
||||
REBARBANDINFOA rb;
|
||||
|
||||
memset(&rb, 0xdd, sizeof(rb));
|
||||
rb.cbSize = sizeof(rb);
|
||||
rb.cbSize = REBARBANDINFOA_V6_SIZE;
|
||||
rb.fMask = RBBIM_BACKGROUND | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_COLORS
|
||||
| RBBIM_HEADERSIZE | RBBIM_ID | RBBIM_IDEALSIZE | RBBIM_IMAGE | RBBIM_LPARAM
|
||||
| RBBIM_SIZE | RBBIM_STYLE | RBBIM_TEXT;
|
||||
|
@ -779,7 +779,7 @@ static void bandinfo_test(void)
|
|||
CHAR szABCD[] = "ABCD";
|
||||
|
||||
rebuild_rebar(&hRebar);
|
||||
rb.cbSize = sizeof(REBARBANDINFO);
|
||||
rb.cbSize = REBARBANDINFOA_V6_SIZE;
|
||||
rb.fMask = 0;
|
||||
ok(SendMessageA(hRebar, RB_INSERTBANDA, 0, (LPARAM)&rb), "RB_INSERTBAND failed\n");
|
||||
expect_band_content(0, 0, 0, GetSysColor(COLOR_3DFACE), "", -1, NULL, 0, 0, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 0);
|
||||
|
@ -798,7 +798,7 @@ static void bandinfo_test(void)
|
|||
ok(SendMessageA(hRebar, RB_SETBANDINFOA, 0, (LPARAM)&rb), "RB_SETBANDINFO failed\n");
|
||||
expect_band_content(0, 0, 0, GetSysColor(COLOR_3DFACE), "ABC", -1, NULL, 15, 20, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 35);
|
||||
|
||||
rb.cbSize = sizeof(REBARBANDINFO);
|
||||
rb.cbSize = REBARBANDINFOA_V6_SIZE;
|
||||
rb.fMask = 0;
|
||||
ok(SendMessageA(hRebar, RB_INSERTBANDA, 1, (LPARAM)&rb), "RB_INSERTBAND failed\n");
|
||||
expect_band_content(1, 0, 0, GetSysColor(COLOR_3DFACE), "", -1, NULL, 0, 0, 0, NULL, 0, 0xdddddddd, 0xdddddddd, 0xdddddddd, 0, 0, 9);
|
||||
|
|
|
@ -2031,6 +2031,9 @@ typedef REBARBANDINFOW const *LPCREBARBANDINFOW;
|
|||
#define REBARBANDINFOA_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA, wID)
|
||||
#define REBARBANDINFOW_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW, wID)
|
||||
#define REBARBANDINFO_V3_SIZE CCSIZEOF_STRUCT(WINELIB_NAME_AW(REBARBANDINFO), wID)
|
||||
#define REBARBANDINFOA_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA, cxHeader)
|
||||
#define REBARBANDINFOW_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW, cxHeader)
|
||||
#define REBARBANDINFO_V6_SIZE CCSIZEOF_STRUCT(WINELIB_NAME_AW(REBARBANDINFO), cxHeader)
|
||||
|
||||
typedef struct tagNMREBARCHILDSIZE
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue