From: Alex Henrie alexhenrie24@gmail.com
--- dlls/comctl32/tests/combo.c | 4 ++-- dlls/comctl32/tests/listbox.c | 9 ++++----- dlls/comctl32/tests/mru.c | 5 ++--- dlls/comctl32/tests/msg.h | 9 ++++----- dlls/comctl32/tests/pager.c | 10 +--------- dlls/comctl32/tests/rebar.c | 13 ++++++------- dlls/comctl32/tests/subclass.c | 7 +++---- dlls/comctl32/tests/taskdialog.c | 5 ++--- dlls/comctl32/tests/toolbar.c | 18 +++++++----------- 9 files changed, 31 insertions(+), 49 deletions(-)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 3eceeb55bd5..4a58b8763a4 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -161,7 +161,7 @@ static void test_comboex(void) *out_of_range_item = "Out of Range Item";
/* Allocate space for result */ - textBuffer = heap_alloc(MAX_CHARS); + textBuffer = malloc(MAX_CHARS);
/* Basic comboboxex test */ myHwnd = createComboEx(WS_BORDER | WS_VISIBLE | WS_CHILD | CBS_DROPDOWN); @@ -247,7 +247,7 @@ static void test_comboex(void)
/* Cleanup */ - heap_free(textBuffer); + free(textBuffer); DestroyWindow(myHwnd); }
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index cb311b1fc77..16c546852a1 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -27,7 +27,6 @@ #include "winnls.h" #include "commctrl.h"
-#include "wine/heap.h" #include "wine/test.h" #include "v6util.h" #include "msg.h" @@ -254,18 +253,18 @@ static void run_test(DWORD style, const struct listbox_test test) WCHAR *txtw; CHAR *txt;
- txt = heap_alloc_zero(size + 1); + txt = calloc(1, size + 1); resA = SendMessageA(hLB, LB_GETTEXT, i, (LPARAM)txt); ok(!strcmp(txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
- txtw = heap_alloc_zero((size + 1) * sizeof(*txtw)); + txtw = calloc(size + 1, sizeof(*txtw)); resW = SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw); ok(resA == resW, "Unexpected text length.\n"); WideCharToMultiByte(CP_ACP, 0, txtw, -1, txt, size, NULL, NULL); ok(!strcmp (txt, strings[i]), "Unexpected string for item %d, %s vs %s.\n", i, txt, strings[i]);
- heap_free(txtw); - heap_free(txt); + free(txtw); + free(txt); }
/* Confirm the count of items, and that an invalid delete does not remove anything */ diff --git a/dlls/comctl32/tests/mru.c b/dlls/comctl32/tests/mru.c index 472fb99bac3..a2caf5f078a 100644 --- a/dlls/comctl32/tests/mru.c +++ b/dlls/comctl32/tests/mru.c @@ -28,7 +28,6 @@ #include "commctrl.h" #include "shlwapi.h"
-#include "wine/heap.h" #include "wine/test.h"
/* Keys for testing MRU functions */ @@ -121,7 +120,7 @@ static LSTATUS mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey) if (dwMaxLen > ARRAY_SIZE(szNameBuf)) { /* Name too big: alloc a buffer for it */ - if (!(lpszName = heap_alloc(dwMaxLen * sizeof(CHAR)))) + if (!(lpszName = malloc(dwMaxLen * sizeof(CHAR)))) { ret = ERROR_NOT_ENOUGH_MEMORY; goto cleanup; @@ -156,7 +155,7 @@ static LSTATUS mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey) cleanup: /* Free buffer if allocated */ if (lpszName != szNameBuf) - heap_free(lpszName); + free(lpszName); if(lpszSubKey) RegCloseKey(hSubKey); return ret; diff --git a/dlls/comctl32/tests/msg.h b/dlls/comctl32/tests/msg.h index 16a8f6e92eb..76bf5450b2f 100644 --- a/dlls/comctl32/tests/msg.h +++ b/dlls/comctl32/tests/msg.h @@ -20,7 +20,6 @@
#include <assert.h> #include <windows.h> -#include "wine/heap.h" #include "wine/test.h"
/* undocumented SWP flags - from SDK 3.1 */ @@ -71,13 +70,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index, if (!msg_seq->sequence) { msg_seq->size = 10; - msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (*msg_seq->sequence)); + msg_seq->sequence = malloc(msg_seq->size * sizeof (*msg_seq->sequence)); }
if (msg_seq->count == msg_seq->size) { msg_seq->size *= 2; - msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (*msg_seq->sequence)); + msg_seq->sequence = realloc(msg_seq->sequence, msg_seq->size * sizeof (*msg_seq->sequence)); }
assert(msg_seq->sequence); @@ -89,7 +88,7 @@ static void add_message(struct msg_sequence **seq, int sequence_index, static inline void flush_sequence(struct msg_sequence **seg, int sequence_index) { struct msg_sequence *msg_seq = seg[sequence_index]; - heap_free(msg_seq->sequence); + free(msg_seq->sequence); msg_seq->sequence = NULL; msg_seq->count = msg_seq->size = 0; } @@ -394,5 +393,5 @@ static void init_msg_sequences(struct msg_sequence **seq, int n) int i;
for (i = 0; i < n; i++) - seq[i] = heap_alloc_zero(sizeof(*seq[i])); + seq[i] = calloc(1, sizeof(*seq[i])); } diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c index e783dcc95e2..9c9ceed2ee9 100644 --- a/dlls/comctl32/tests/pager.c +++ b/dlls/comctl32/tests/pager.c @@ -267,14 +267,6 @@ static const struct message set_pos_empty_seq[] = { { 0 } };
-static CHAR *heap_strdup(const CHAR *str) -{ - int len = lstrlenA(str) + 1; - CHAR *ret = heap_alloc(len * sizeof(CHAR)); - lstrcpyA(ret, str); - return ret; -} - static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; @@ -634,7 +626,7 @@ static void notify_generic_text_handler(CHAR **text, INT *text_max) /* 64bit Windows will try to free the text pointer even if it's application provided when handling * HDN_GETDISPINFOW. Deliberate leak here. */ else if(notify_test_info.unicode == HDN_GETDISPINFOW) - *text = heap_strdup(receive_data->write_pointer); + *text = strdup(receive_data->write_pointer); else *text = (char *)receive_data->write_pointer; if (text_max && receive_data->write_text_max != -1) *text_max = receive_data->write_text_max; diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c index c15b22aeca1..7cafa4ba52b 100644 --- a/dlls/comctl32/tests/rebar.c +++ b/dlls/comctl32/tests/rebar.c @@ -22,7 +22,6 @@ #include <windows.h> #include <commctrl.h>
-#include "wine/heap.h" #include "wine/test.h"
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST); @@ -215,9 +214,9 @@ static rbsize_result_t rbsize_init(int cleft, int ctop, int cright, int cbottom, SetRect(&ret.rcClient, cleft, ctop, cright, cbottom); ret.cyBarHeight = cyBarHeight; ret.nRows = 0; - ret.cyRowHeights = heap_alloc_zero(nRows * sizeof(int)); + ret.cyRowHeights = calloc(nRows, sizeof(int)); ret.nBands = 0; - ret.bands = heap_alloc_zero(nBands * sizeof(*ret.bands)); + ret.bands = calloc(nBands, sizeof(*ret.bands));
return ret; } @@ -241,7 +240,7 @@ static rbsize_result_t *rbsize_results;
static void rbsize_results_init(void) { - rbsize_results = heap_alloc(rbsize_results_num * sizeof(*rbsize_results)); + rbsize_results = malloc(rbsize_results_num * sizeof(*rbsize_results));
rbsize_results[0] = rbsize_init(0, 0, 672, 0, 0, 0, 0);
@@ -428,10 +427,10 @@ static void rbsize_results_free(void) int i;
for (i = 0; i < rbsize_results_num; i++) { - heap_free(rbsize_results[i].cyRowHeights); - heap_free(rbsize_results[i].bands); + free(rbsize_results[i].cyRowHeights); + free(rbsize_results[i].bands); } - heap_free(rbsize_results); + free(rbsize_results); rbsize_results = NULL; }
diff --git a/dlls/comctl32/tests/subclass.c b/dlls/comctl32/tests/subclass.c index bc3fc6f1d91..73e7288e8a2 100644 --- a/dlls/comctl32/tests/subclass.c +++ b/dlls/comctl32/tests/subclass.c @@ -26,7 +26,6 @@ #include "winuser.h" #include "commctrl.h"
-#include "wine/heap.h" #include "wine/test.h"
static BOOL (WINAPI *pGetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR *); @@ -124,12 +123,12 @@ static void add_message(const struct message *msg) if (!sequence) { sequence_size = 10; - sequence = heap_alloc( sequence_size * sizeof (struct message) ); + sequence = malloc(sequence_size * sizeof(struct message)); } if (sequence_cnt == sequence_size) { sequence_size *= 2; - sequence = heap_realloc( sequence, sequence_size * sizeof (struct message) ); + sequence = realloc(sequence, sequence_size * sizeof(struct message)); } assert(sequence);
@@ -141,7 +140,7 @@ static void add_message(const struct message *msg)
static void flush_sequence(void) { - heap_free(sequence); + free(sequence); sequence = NULL; sequence_cnt = sequence_size = 0; } diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c index 6a12b185639..ef60a5953bd 100644 --- a/dlls/comctl32/tests/taskdialog.c +++ b/dlls/comctl32/tests/taskdialog.c @@ -24,7 +24,6 @@ #include "winuser.h" #include "commctrl.h"
-#include "wine/heap.h" #include "wine/test.h" #include "v6util.h" #include "msg.h" @@ -404,7 +403,7 @@ static void run_test_(TASKDIALOGCONFIG *info, int expect_button, int expect_radi int i;
/* Allocate messages to test against, plus 2 implicit and 1 empty */ - msg_start = msg = heap_alloc_zero(sizeof(*msg) * (test_messages_len + 3)); + msg_start = msg = calloc(test_messages_len + 3, sizeof(*msg));
/* Always needed, thus made implicit */ init_test_message(TDN_DIALOG_CONSTRUCTED, 0, 0, msg++); @@ -425,7 +424,7 @@ static void run_test_(TASKDIALOGCONFIG *info, int expect_button, int expect_radi ok_(file, line)(ret_radio == expect_radio_button, "Wrong radio button. Expected %d, got %d\n", expect_radio_button, ret_radio);
- heap_free(msg_start); + free(msg_start); }
static const LONG_PTR test_ref_data = 123456; diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 7c886e1f88f..f2a69d869c1 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -226,7 +226,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam) if (save->iItem == -1) { save->cbData = save->cbData * 2 + 11 * sizeof(DWORD); - save->pData = heap_alloc( save->cbData ); + save->pData = malloc(save->cbData); save->pData[0] = 0xcafe; save->pCurrent = save->pData + 1; } @@ -301,10 +301,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam) restore->tbButton.dwData = restore->iItem;
if (restore->iItem == 0) - { - restore->tbButton.iString = (INT_PTR)heap_alloc_zero( 8 ); - strcpy( (char *)restore->tbButton.iString, "foo" ); - } + restore->tbButton.iString = (INT_PTR)strdup( "foo" ); else if (restore->iItem == 1) restore->tbButton.iString = 2; else @@ -332,8 +329,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam) { case 0: tb->tbButton.idCommand = 7; - alloced_str = heap_alloc_zero( 8 ); - strcpy( alloced_str, "foo" ); + alloced_str = strdup( "foo" ); tb->tbButton.iString = (INT_PTR)alloced_str; return 1; case 1: @@ -1077,7 +1073,7 @@ static tbsize_result_t init_tbsize_result(int nButtonsAlloc, int cleft, int ctop ret.szMin.cx = minx; ret.szMin.cy = miny; ret.nButtons = 0; - ret.prcButtons = heap_alloc_zero(nButtonsAlloc * sizeof(*ret.prcButtons)); + ret.prcButtons = calloc(nButtonsAlloc, sizeof(*ret.prcButtons));
return ret; } @@ -1099,7 +1095,7 @@ static void init_tbsize_results(void) { int fontheight = system_font_height(); int buttonwidth;
- tbsize_results = heap_alloc_zero(tbsize_results_num * sizeof(*tbsize_results)); + tbsize_results = calloc(tbsize_results_num, sizeof(*tbsize_results));
tbsize_results[0] = init_tbsize_result(5, 0, 0 ,672 ,26, 100 ,22); tbsize_addbutton(&tbsize_results[0], 0, 2, 23, 24); @@ -1357,8 +1353,8 @@ static void free_tbsize_results(void) { int i;
for (i = 0; i < tbsize_results_num; i++) - heap_free(tbsize_results[i].prcButtons); - heap_free(tbsize_results); + free(tbsize_results[i].prcButtons); + free(tbsize_results); tbsize_results = NULL; }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=139460
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
comctl32: 0750:pager: unhandled exception c0000005 at 77495DF8
=== w7u_el (32 bit report) ===
comctl32: 0a54:pager: unhandled exception c0000005 at 77395DF8
=== w8 (32 bit report) ===
comctl32: 0cb4:pager: unhandled exception c0000005 at 77A39927
=== w8adm (32 bit report) ===
comctl32: 0ad8:pager: unhandled exception c0000005 at 77B89927
=== w1064v1809 (32 bit report) ===
comctl32: 1dc8:pager: unhandled exception c0000005 at 77AB804C
=== w1064_tsign (32 bit report) ===
comctl32: 1ef8:pager: unhandled exception c0000005 at 77944145
=== w10pro64_en_AE_u8 (32 bit report) ===
comctl32: 12c4:pager: unhandled exception c0000005 at 77B04063
=== w7pro64 (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w864 (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w1064v1507 (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w1064v1809 (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w1064_2qxl (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w1064_adm (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w1064_tsign (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w10pro64 (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w10pro64_ar (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w10pro64_ja (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w10pro64_zh_CN (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w11pro64_amd (64 bit report) ===
Report validation errors: comctl32:pager crashed (c0000374)
=== w10pro64_en_AE_u8 (32 bit report) ===
comctl32: rebar.c:948: Test failed: expected 35 for 38 from line 989 rebar.c:948: Test failed: expected 40 for 43 from line 995 rebar.c:948: Test failed: expected 40 for 43 from line 1014
=== w7u_adm (32 bit report) ===
comctl32: toolbar: Timeout
=== w7u_el (32 bit report) ===
comctl32: toolbar: Timeout
=== w11pro64 (32 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000005)
=== w7pro64 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w864 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064v1507 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064v1809 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064_2qxl (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064_adm (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064_tsign (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64_ar (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64_ja (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64_zh_CN (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w11pro64_amd (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/pager.c:
/* 64bit Windows will try to free the text pointer even if it's application provided when handling * HDN_GETDISPINFOW. Deliberate leak here. */ else if(notify_test_info.unicode == HDN_GETDISPINFOW)
*text = heap_strdup(receive_data->write_pointer);
This crashes pager tests on 64-bit Windows. See https://testbot.winehq.org/JobDetails.pl?Key=139460&f3103=exe64.report#k...
On Thu Nov 2 06:01:18 2023 +0000, Zhiyi Zhang wrote:
This crashes pager tests on 64-bit Windows. See https://testbot.winehq.org/JobDetails.pl?Key=139460&f3103=exe64.report#k...
The TestBot Gitlab bridge is currently broken so make sure you check the TestBot results.