user32/tests: Use CRT allocation functions.

This commit is contained in:
Alex Henrie 2023-11-01 23:16:10 -06:00 committed by Alexandre Julliard
parent 1798540cb7
commit faae2162b8
7 changed files with 56 additions and 57 deletions

View file

@ -1531,10 +1531,10 @@ static void test_handles( HWND hwnd )
if (0) /* crashes on vista64 */ if (0) /* crashes on vista64 */
{ {
ptr = HeapAlloc( GetProcessHeap(), 0, 0 ); ptr = malloc( sizeof(void *) );
h = SetClipboardData( format_id2, ptr ); h = SetClipboardData( format_id2, ptr );
ok( !h, "got %p\n", h ); ok( !h, "got %p\n", h );
HeapFree( GetProcessHeap(), 0, ptr ); free( ptr );
} }
h = SetClipboardData( format_id2, empty_fixed ); h = SetClipboardData( format_id2, empty_fixed );
@ -1547,12 +1547,12 @@ static void test_handles( HWND hwnd )
ok( h == hmoveable, "got %p\n", h ); ok( h == hmoveable, "got %p\n", h );
ok( is_moveable( h ), "expected moveable mem %p\n", h ); ok( is_moveable( h ), "expected moveable mem %p\n", h );
ptr = HeapAlloc( GetProcessHeap(), 0, 37 ); ptr = malloc( 37 );
h = SetClipboardData( 0xdeadfade, ptr ); h = SetClipboardData( 0xdeadfade, ptr );
ok( h == ptr || !h, "got %p\n", h ); ok( h == ptr || !h, "got %p\n", h );
if (!h) /* heap blocks are rejected on >= win8 */ if (!h) /* heap blocks are rejected on >= win8 */
{ {
HeapFree( GetProcessHeap(), 0, ptr ); free( ptr );
ptr = NULL; ptr = NULL;
} }

View file

@ -608,7 +608,7 @@ static void do_test_copy_image(UINT type, UINT depth)
unsigned int i; unsigned int i;
/* Create a device-independent bitmap (DIB) */ /* Create a device-independent bitmap (DIB) */
info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); info = calloc(1, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biSize = sizeof(info->bmiHeader);
info->bmiHeader.biWidth = 2; info->bmiHeader.biWidth = 2;
info->bmiHeader.biHeight = 2; info->bmiHeader.biHeight = 2;
@ -748,7 +748,7 @@ static void do_test_copy_image(UINT type, UINT depth)
} }
} }
HeapFree(GetProcessHeap(), 0, info); free(info);
} }
static void test_initial_cursor(void) static void test_initial_cursor(void)
@ -994,7 +994,7 @@ static void test_CreateIcon(void)
/* test creating an icon from a DIB section */ /* test creating an icon from a DIB section */
bmpinfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(BITMAPINFO,bmiColors[256])); bmpinfo = calloc( 1, FIELD_OFFSET(BITMAPINFO,bmiColors[256]) );
bmpinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmpinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpinfo->bmiHeader.biWidth = 32; bmpinfo->bmiHeader.biWidth = 32;
bmpinfo->bmiHeader.biHeight = 32; bmpinfo->bmiHeader.biHeight = 32;
@ -1060,7 +1060,7 @@ static void test_CreateIcon(void)
DeleteObject(hbmMask); DeleteObject(hbmMask);
DeleteObject(hbmColor); DeleteObject(hbmColor);
HeapFree( GetProcessHeap(), 0, bmpinfo ); free(bmpinfo);
ReleaseDC(0, hdc); ReleaseDC(0, hdc);
} }
@ -1262,7 +1262,7 @@ static void create_ico_file(const char *filename, const test_icon_entries_t *tes
for(i=0; i<entry_cnt; i++) for(i=0; i<entry_cnt; i++)
icon_size += icon_bpp * test_icon_entries[i].width * test_icon_entries[i].height / 8; icon_size += icon_bpp * test_icon_entries[i].width * test_icon_entries[i].height / 8;
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, icon_size); buf = calloc(1, icon_size);
dir = (CURSORICONFILEDIR*)buf; dir = (CURSORICONFILEDIR*)buf;
dir->idReserved = 0; dir->idReserved = 0;
@ -1301,7 +1301,7 @@ static void create_ico_file(const char *filename, const test_icon_entries_t *tes
ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n"); ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n");
CloseHandle(file); CloseHandle(file);
HeapFree(GetProcessHeap(), 0, buf); free(buf);
} }
static void create_bitmap_file(const char *filename, const BITMAPINFO *bmi, const unsigned char *bits) static void create_bitmap_file(const char *filename, const BITMAPINFO *bmi, const unsigned char *bits)
@ -1584,7 +1584,7 @@ static void test_CreateIconFromResource(void)
#define CRSR_RES_SIZE (2*sizeof(INT16) + ICON_RES_SIZE) #define CRSR_RES_SIZE (2*sizeof(INT16) + ICON_RES_SIZE)
/* Set icon data. */ /* Set icon data. */
hotspot = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, CRSR_RES_SIZE); hotspot = calloc(1, CRSR_RES_SIZE);
/* Cursor resources have an extra hotspot, icon resources not. */ /* Cursor resources have an extra hotspot, icon resources not. */
hotspot[0] = 3; hotspot[0] = 3;
@ -1718,7 +1718,7 @@ static void test_CreateIconFromResource(void)
ok(handle != NULL, "Create icon failed, error %lu.\n", GetLastError()); ok(handle != NULL, "Create icon failed, error %lu.\n", GetLastError());
ok(handle != old_handle, "Expect a different handle.\n"); ok(handle != old_handle, "Expect a different handle.\n");
HeapFree(GetProcessHeap(), 0, hotspot); free(hotspot);
/* Get icon resource bits */ /* Get icon resource bits */
user32 = GetModuleHandleA("user32.dll"); user32 = GetModuleHandleA("user32.dll");
@ -1767,8 +1767,8 @@ static int check_cursor_data( HDC hdc, HCURSOR hCursor, void *data, int length)
ok(ret, "GetIconInfo() failed\n"); ok(ret, "GetIconInfo() failed\n");
if (!ret) return 0; if (!ret) return 0;
ret = 0; ret = 0;
info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] )); info = malloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] ));
ok(info != NULL, "HeapAlloc() failed\n"); ok(info != NULL, "malloc() failed\n");
if (!info) return 0; if (!info) return 0;
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@ -1782,8 +1782,8 @@ static int check_cursor_data( HDC hdc, HCURSOR hCursor, void *data, int length)
info->bmiHeader.biYPelsPerMeter = 0; info->bmiHeader.biYPelsPerMeter = 0;
info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biClrImportant = 0; info->bmiHeader.biClrImportant = 0;
image = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ); image = malloc( info->bmiHeader.biSizeImage );
ok(image != NULL, "HeapAlloc() failed\n"); ok(image != NULL, "malloc() failed\n");
if (!image) goto cleanup; if (!image) goto cleanup;
ret = GetDIBits( hdc, iinfo.hbmColor, 0, 32, image, info, DIB_RGB_COLORS ); ret = GetDIBits( hdc, iinfo.hbmColor, 0, 32, image, info, DIB_RGB_COLORS );
ok(ret, "GetDIBits() failed\n"); ok(ret, "GetDIBits() failed\n");
@ -1793,8 +1793,8 @@ static int check_cursor_data( HDC hdc, HCURSOR hCursor, void *data, int length)
ok(ret, "%04x: Expected 0x%lx, actually 0x%lx\n", i, ((COLORREF *)data)[i], ((COLORREF *)image)[i] ); ok(ret, "%04x: Expected 0x%lx, actually 0x%lx\n", i, ((COLORREF *)data)[i], ((COLORREF *)image)[i] );
} }
cleanup: cleanup:
HeapFree( GetProcessHeap(), 0, image ); free( image );
HeapFree( GetProcessHeap(), 0, info ); free( info );
return ret; return ret;
} }
@ -1847,7 +1847,7 @@ static void test_GetCursorFrameInfo(void)
#define CRSR_RES_SIZE (2*sizeof(INT16) + ICON_RES_SIZE) #define CRSR_RES_SIZE (2*sizeof(INT16) + ICON_RES_SIZE)
/* Set icon data. */ /* Set icon data. */
hotspot = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, CRSR_RES_SIZE); hotspot = calloc(1, CRSR_RES_SIZE);
/* Cursor resources have an extra hotspot, icon resources not. */ /* Cursor resources have an extra hotspot, icon resources not. */
hotspot[0] = 3; hotspot[0] = 3;
@ -2039,7 +2039,7 @@ static void test_GetCursorFrameInfo(void)
ret = DestroyCursor(h1); ret = DestroyCursor(h1);
ok(ret, "DestroyCursor() failed (error = %ld).\n", GetLastError()); ok(ret, "DestroyCursor() failed (error = %ld).\n", GetLastError());
HeapFree(GetProcessHeap(), 0, hotspot); free(hotspot);
cleanup: cleanup:
if(bmpOld) SelectObject(hdc, bmpOld); if(bmpOld) SelectObject(hdc, bmpOld);
if(bmp) DeleteObject(bmp); if(bmp) DeleteObject(bmp);
@ -2844,8 +2844,8 @@ static void test_monochrome_icon(void)
ULONG icon_size; ULONG icon_size;
BOOL monochrome, use_core_info; BOOL monochrome, use_core_info;
icon_data = HeapAlloc(GetProcessHeap(), 0, sizeof(CURSORICONFILEDIR) + sizeof(BITMAPINFOHEADER) + icon_data = malloc(sizeof(CURSORICONFILEDIR) + sizeof(BITMAPINFOHEADER) +
2 * sizeof(RGBQUAD) + sizeof(ULONG)); 2 * sizeof(RGBQUAD) + sizeof(ULONG));
for (monochrome = FALSE; monochrome <= TRUE; monochrome++) for (monochrome = FALSE; monochrome <= TRUE; monochrome++)
for (use_core_info = FALSE; use_core_info <= TRUE; use_core_info++) for (use_core_info = FALSE; use_core_info <= TRUE; use_core_info++)
@ -2945,7 +2945,7 @@ static void test_monochrome_icon(void)
DeleteFileA("icon.ico"); DeleteFileA("icon.ico");
} }
HeapFree(GetProcessHeap(), 0, icon_data); free(icon_data);
} }
static COLORREF get_color_from_bits(const unsigned char *bits, const BITMAPINFO *bmi, static COLORREF get_color_from_bits(const unsigned char *bits, const BITMAPINFO *bmi,
@ -2983,7 +2983,7 @@ static void compare_bitmap_bits_(unsigned int line, HDC hdc, HBITMAP bitmap, BIT
unsigned int row, column; unsigned int row, column;
int ret; int ret;
result_bits = HeapAlloc(GetProcessHeap(), 0, result_bits_size); result_bits = malloc(result_bits_size);
ret = GetDIBits(hdc, bitmap, 0, bmi->bmiHeader.biHeight, ret = GetDIBits(hdc, bitmap, 0, bmi->bmiHeader.biHeight,
result_bits, bmi, DIB_RGB_COLORS); result_bits, bmi, DIB_RGB_COLORS);
ok(ret == bmi->bmiHeader.biHeight, "Unexpected GetDIBits result %d, GetLastError() %lu.\n", ok(ret == bmi->bmiHeader.biHeight, "Unexpected GetDIBits result %d, GetLastError() %lu.\n",
@ -3002,7 +3002,7 @@ static void compare_bitmap_bits_(unsigned int line, HDC hdc, HBITMAP bitmap, BIT
"Colors do not match, got 0x%06lx, expected 0x%06lx, test_index %u, row %u, column %u.\n", "Colors do not match, got 0x%06lx, expected 0x%06lx, test_index %u, row %u, column %u.\n",
result, expected, test_index, row, column); result, expected, test_index, row, column);
} }
HeapFree(GetProcessHeap(), 0, result_bits); free(result_bits);
} }
static void test_Image_StretchMode(void) static void test_Image_StretchMode(void)
@ -3104,8 +3104,8 @@ static void test_Image_StretchMode(void)
HDC hdc; HDC hdc;
bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD); bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD);
bmi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bmi_size); bmi = calloc(1, bmi_size);
bmi_output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bmi_size); bmi_output = calloc(1, bmi_size);
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biPlanes = 1; bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biCompression = BI_RGB; bmi->bmiHeader.biCompression = BI_RGB;
@ -3154,8 +3154,8 @@ static void test_Image_StretchMode(void)
DeleteObject(bitmap); DeleteObject(bitmap);
} }
ReleaseDC(0, hdc); ReleaseDC(0, hdc);
HeapFree(GetProcessHeap(), 0, bmi_output); free(bmi_output);
HeapFree(GetProcessHeap(), 0, bmi); free(bmi);
} }
static void test_copy_image(void) static void test_copy_image(void)

View file

@ -776,8 +776,8 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
size = DdeGetData(hdata, NULL, 0, 0); size = DdeGetData(hdata, NULL, 0, 0);
ok(size == 17, "DdeGetData should have returned 17 not %ld\n", size); ok(size == 17, "DdeGetData should have returned 17 not %ld\n", size);
ptr = HeapAlloc(GetProcessHeap(), 0, size); ptr = malloc(size);
ok(ptr != NULL,"HeapAlloc should have returned ptr not NULL\n"); ok(ptr != NULL, "malloc should have returned ptr not NULL\n");
rsize = DdeGetData(hdata, (LPBYTE)ptr, size, 0); rsize = DdeGetData(hdata, (LPBYTE)ptr, size, 0);
ok(rsize == size, "DdeGetData did not return %ld bytes but %ld\n", size, rsize); ok(rsize == size, "DdeGetData did not return %ld bytes but %ld\n", size, rsize);
@ -785,7 +785,7 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
ok(size == 17, "Expected 17, got %ld\n", size); ok(size == 17, "Expected 17, got %ld\n", size);
ret = (HDDEDATA)DDE_FACK; ret = (HDDEDATA)DDE_FACK;
HeapFree(GetProcessHeap(), 0, ptr); free(ptr);
} }
return ret; return ret;
@ -2423,7 +2423,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
ok(size == 12, "Expected 12, got %ld, msg_index=%d\n", size, msg_index); ok(size == 12, "Expected 12, got %ld, msg_index=%d\n", size, msg_index);
size = DdeGetData(hdata, NULL, 0, 0); size = DdeGetData(hdata, NULL, 0, 0);
ok((buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size)) != NULL, "should not be null\n"); ok((buffer = calloc(1, size)) != NULL, "should not be null\n");
rsize = DdeGetData(hdata, buffer, size, 0); rsize = DdeGetData(hdata, buffer, size, 0);
ok(rsize == size, "Incorrect size returned, expected %ld got %ld, msg_index=%d\n", ok(rsize == size, "Incorrect size returned, expected %ld got %ld, msg_index=%d\n",
size, rsize, msg_index); size, rsize, msg_index);
@ -2543,7 +2543,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
ok( 0, "Invalid message %u\n", msg_index ); ok( 0, "Invalid message %u\n", msg_index );
break; break;
} }
HeapFree(GetProcessHeap(), 0, buffer); free(buffer);
return (HDDEDATA) DDE_FACK; return (HDDEDATA) DDE_FACK;
} }
case XTYP_DISCONNECT: case XTYP_DISCONNECT:

View file

@ -2029,7 +2029,7 @@ static void test_GetRawInputDeviceList(void)
(info.dwType != RIM_TYPEHID && sz == 0), (info.dwType != RIM_TYPEHID && sz == 0),
"Got wrong PPD size for type 0x%lx: %u\n", info.dwType, sz); "Got wrong PPD size for type 0x%lx: %u\n", info.dwType, sz);
ppd = HeapAlloc(GetProcessHeap(), 0, sz); ppd = malloc(sz);
ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_PREPARSEDDATA, ppd, &sz); ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_PREPARSEDDATA, ppd, &sz);
ok(ret == sz, "GetRawInputDeviceInfo gave wrong return: %u, should be %u\n", ret, sz); ok(ret == sz, "GetRawInputDeviceInfo gave wrong return: %u, should be %u\n", ret, sz);
@ -2056,7 +2056,7 @@ static void test_GetRawInputDeviceList(void)
HidD_FreePreparsedData(preparsed); HidD_FreePreparsedData(preparsed);
} }
HeapFree(GetProcessHeap(), 0, ppd); free(ppd);
CloseHandle(file); CloseHandle(file);
} }

View file

@ -178,18 +178,18 @@ check (DWORD style, const struct listbox_test test)
WCHAR *txtw; WCHAR *txtw;
int resA, resW; int resA, resW;
txt = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, size+1); txt = calloc(1, size + 1);
resA=SendMessageA(hLB, LB_GETTEXT, i, (LPARAM)txt); 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]); ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
txtw = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, 2*size+2); txtw = calloc(1, 2 * size + 2);
resW=SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw); resW=SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw);
ok(resA == resW, "Unexpected text length.\n"); ok(resA == resW, "Unexpected text length.\n");
WideCharToMultiByte( CP_ACP, 0, txtw, -1, txt, size, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, txtw, -1, txt, size, NULL, NULL );
ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]); ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
HeapFree (GetProcessHeap(), 0, txtw); free(txtw);
HeapFree (GetProcessHeap(), 0, txt); free(txt);
} }
/* Confirm the count of items, and that an invalid delete does not remove anything */ /* Confirm the count of items, and that an invalid delete does not remove anything */

View file

@ -34,7 +34,6 @@
#include "ddk/d3dkmthk.h" #include "ddk/d3dkmthk.h"
#include "setupapi.h" #include "setupapi.h"
#include "ntddvdeo.h" #include "ntddvdeo.h"
#include "wine/heap.h"
#include <stdio.h> #include <stdio.h>
DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1); DEFINE_DEVPROPKEY(DEVPROPKEY_MONITOR_GPU_LUID, 0xca085853, 0x16ce, 0x48aa, 0xb1, 0x14, 0xde, 0x9c, 0x72, 0x33, 0x42, 0x23, 1);
@ -496,7 +495,7 @@ static void test_ChangeDisplaySettingsEx(void)
/* Save the original mode for all devices so that they can be restored at the end of tests */ /* Save the original mode for all devices so that they can be restored at the end of tests */
device_count = 0; device_count = 0;
device_size = 2; device_size = 2;
devices = heap_calloc(device_size, sizeof(*devices)); devices = calloc(device_size, sizeof(*devices));
ok(devices != NULL, "Failed to allocate memory.\n"); ok(devices != NULL, "Failed to allocate memory.\n");
primary = 0; primary = 0;
@ -519,7 +518,7 @@ static void test_ChangeDisplaySettingsEx(void)
if (device_count >= device_size) if (device_count >= device_size)
{ {
device_size *= 2; device_size *= 2;
devices = heap_realloc(devices, device_size * sizeof(*devices)); devices = realloc(devices, device_size * sizeof(*devices));
ok(devices != NULL, "Failed to reallocate memory.\n"); ok(devices != NULL, "Failed to reallocate memory.\n");
} }
@ -1165,7 +1164,7 @@ static void test_ChangeDisplaySettingsEx(void)
for (device = 0; device < device_count; ++device) for (device = 0; device < device_count; ++device)
expect_dm(&devices[device].original_mode, devices[device].name, 0); expect_dm(&devices[device].original_mode, devices[device].name, 0);
heap_free(devices); free(devices);
} }
static void test_monitors(void) static void test_monitors(void)

View file

@ -2418,13 +2418,13 @@ static void add_message_(int line, const struct recvd_message *msg)
EnterCriticalSection( &sequence_cs ); EnterCriticalSection( &sequence_cs );
if (!sequence) if (!sequence)
{ {
sequence_size = 10; sequence_size = 10;
sequence = HeapAlloc( GetProcessHeap(), 0, sequence_size * sizeof(*sequence) ); sequence = malloc( sequence_size * sizeof(*sequence) );
} }
if (sequence_cnt == sequence_size) if (sequence_cnt == sequence_size)
{ {
sequence_size *= 2; sequence_size *= 2;
sequence = HeapReAlloc( GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence) ); sequence = realloc( sequence, sequence_size * sizeof(*sequence) );
} }
seq = &sequence[sequence_cnt++]; seq = &sequence[sequence_cnt++];
@ -2625,7 +2625,7 @@ static void flush_events(void)
static void flush_sequence(void) static void flush_sequence(void)
{ {
EnterCriticalSection( &sequence_cs ); EnterCriticalSection( &sequence_cs );
HeapFree(GetProcessHeap(), 0, sequence); free( sequence );
sequence = 0; sequence = 0;
sequence_cnt = sequence_size = 0; sequence_cnt = sequence_size = 0;
LeaveCriticalSection( &sequence_cs ); LeaveCriticalSection( &sequence_cs );
@ -8196,13 +8196,13 @@ void dump_region(HRGN hrgn)
return; return;
} }
if (!(size = GetRegionData( hrgn, 0, NULL ))) return; if (!(size = GetRegionData( hrgn, 0, NULL ))) return;
if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return; if (!(data = malloc( size ))) return;
GetRegionData( hrgn, size, data ); GetRegionData( hrgn, size, data );
printf("%ld rects:", data->rdh.nCount ); printf("%ld rects:", data->rdh.nCount );
for (i = 0, rect = (RECT *)data->Buffer; i < data->rdh.nCount; i++, rect++) for (i = 0, rect = (RECT *)data->Buffer; i < data->rdh.nCount; i++, rect++)
printf( " %s", wine_dbgstr_rect( rect )); printf( " %s", wine_dbgstr_rect( rect ));
printf("\n"); printf("\n");
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
#define check_update_rgn( hwnd, hrgn ) check_update_rgn_( __LINE__, hwnd, hrgn ) #define check_update_rgn( hwnd, hrgn ) check_update_rgn_( __LINE__, hwnd, hrgn )
@ -18043,9 +18043,9 @@ static void test_broadcast(void)
HWND hwnd; HWND hwnd;
HWND *hwnd_sub; HWND *hwnd_sub;
hwnd_sub = HeapAlloc( GetProcessHeap(), 0, ARRAY_SIZE(bcast_expect) * sizeof(*hwnd_sub) ); hwnd_sub = malloc(ARRAY_SIZE(bcast_expect) * sizeof(*hwnd_sub));
g_oldproc_sub = HeapAlloc( GetProcessHeap(), 0, ARRAY_SIZE(bcast_expect) * sizeof(*g_oldproc_sub) ); g_oldproc_sub = malloc(ARRAY_SIZE(bcast_expect) * sizeof(*g_oldproc_sub));
g_broadcast_sub_wparam = HeapAlloc( GetProcessHeap(), 0, ARRAY_SIZE(bcast_expect) * sizeof(*g_broadcast_sub_wparam) ); g_broadcast_sub_wparam = malloc(ARRAY_SIZE(bcast_expect) * sizeof(*g_broadcast_sub_wparam));
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, NULL); hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, NULL);
ok(hwnd != NULL, "got %p\n", hwnd); ok(hwnd != NULL, "got %p\n", hwnd);
@ -18147,9 +18147,9 @@ static void test_broadcast(void)
for (j = 0; j < ARRAY_SIZE(bcast_expect); j++) for (j = 0; j < ARRAY_SIZE(bcast_expect); j++)
DestroyWindow(hwnd_sub[j]); DestroyWindow(hwnd_sub[j]);
HeapFree(GetProcessHeap(), 0, g_broadcast_sub_wparam); free(g_broadcast_sub_wparam);
HeapFree(GetProcessHeap(), 0, g_oldproc_sub); free(g_oldproc_sub);
HeapFree(GetProcessHeap(), 0, hwnd_sub); free(hwnd_sub);
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }