From: Alex Henrie alexhenrie24@gmail.com
--- dlls/ole32/tests/clipboard.c | 28 ++++----- dlls/ole32/tests/compobj.c | 4 +- dlls/ole32/tests/marshal.c | 13 ++--- dlls/ole32/tests/moniker.c | 11 ++-- dlls/ole32/tests/ole2.c | 30 +++++----- dlls/ole32/tests/ole_server.c | 4 +- dlls/ole32/tests/propvariant.c | 6 +- dlls/ole32/tests/storage32.c | 12 ++-- dlls/ole32/tests/usrmarshal.c | 104 ++++++++++++++++----------------- 9 files changed, 105 insertions(+), 107 deletions(-)
diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c index c731a311674..50e4e8c27a3 100644 --- a/dlls/ole32/tests/clipboard.c +++ b/dlls/ole32/tests/clipboard.c @@ -138,8 +138,8 @@ static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface) ULONG ref = InterlockedDecrement(&This->ref);
if(!ref) { - HeapFree(GetProcessHeap(), 0, This->fmtetc); - HeapFree(GetProcessHeap(), 0, This); + free(This->fmtetc); + free(This); }
return ref; @@ -207,12 +207,12 @@ static HRESULT EnumFormatImpl_Create(FORMATETC *fmtetc, UINT fmtetc_cnt, IEnumFO { EnumFormatImpl *ret;
- ret = HeapAlloc(GetProcessHeap(), 0, sizeof(EnumFormatImpl)); + ret = malloc(sizeof(EnumFormatImpl)); ret->IEnumFORMATETC_iface.lpVtbl = &VT_EnumFormatImpl; ret->ref = 1; ret->cur = 0; ret->fmtetc_cnt = fmtetc_cnt; - ret->fmtetc = HeapAlloc(GetProcessHeap(), 0, fmtetc_cnt*sizeof(FORMATETC)); + ret->fmtetc = malloc(fmtetc_cnt * sizeof(FORMATETC)); memcpy(ret->fmtetc, fmtetc, fmtetc_cnt*sizeof(FORMATETC)); *lplpformatetc = &ret->IEnumFORMATETC_iface; return S_OK; @@ -248,8 +248,8 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface) int i; if(This->text) GlobalFree(This->text); for(i = 0; i < This->fmtetc_cnt; i++) - HeapFree(GetProcessHeap(), 0, This->fmtetc[i].ptd); - HeapFree(GetProcessHeap(), 0, This->fmtetc); + free(This->fmtetc[i].ptd); + free(This->fmtetc); if(This->stm) IStream_Release(This->stm); if(This->stg) IStorage_Release(This->stg); if(This->hmfp) { @@ -258,7 +258,7 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface) GlobalUnlock(This->hmfp); GlobalFree(This->hmfp); } - HeapFree(GetProcessHeap(), 0, This); + free(This); }
return ref; @@ -417,7 +417,7 @@ static HRESULT DataObjectImpl_CreateFromHGlobal(HGLOBAL text, LPDATAOBJECT *data { DataObjectImpl *obj;
- obj = HeapAlloc(GetProcessHeap(), 0, sizeof(DataObjectImpl)); + obj = malloc(sizeof(DataObjectImpl)); obj->IDataObject_iface.lpVtbl = &VT_DataObjectImpl; obj->ref = 1; obj->text = text; @@ -426,7 +426,7 @@ static HRESULT DataObjectImpl_CreateFromHGlobal(HGLOBAL text, LPDATAOBJECT *data obj->hmfp = NULL;
obj->fmtetc_cnt = 1; - obj->fmtetc = HeapAlloc(GetProcessHeap(), 0, obj->fmtetc_cnt*sizeof(FORMATETC)); + obj->fmtetc = malloc(obj->fmtetc_cnt * sizeof(FORMATETC)); InitFormatEtc(obj->fmtetc[0], CF_TEXT, TYMED_HGLOBAL);
*dataobj = &obj->IDataObject_iface; @@ -451,7 +451,7 @@ static HRESULT DataObjectImpl_CreateComplex(LPDATAOBJECT *lplpdataobj) ILockBytes *lbs; DEVMODEW dm;
- obj = HeapAlloc(GetProcessHeap(), 0, sizeof(DataObjectImpl)); + obj = malloc(sizeof(DataObjectImpl)); obj->IDataObject_iface.lpVtbl = &VT_DataObjectImpl; obj->ref = 1; obj->text = GlobalAlloc(GMEM_MOVEABLE, strlen(cmpl_text_data) + 1); @@ -468,7 +468,7 @@ static HRESULT DataObjectImpl_CreateComplex(LPDATAOBJECT *lplpdataobj)
obj->fmtetc_cnt = 9; /* zeroing here since FORMATETC has a hole in it, and it's confusing to have this uninitialised. */ - obj->fmtetc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, obj->fmtetc_cnt*sizeof(FORMATETC)); + obj->fmtetc = calloc(obj->fmtetc_cnt, sizeof(FORMATETC)); InitFormatEtc(obj->fmtetc[0], CF_TEXT, TYMED_HGLOBAL); InitFormatEtc(obj->fmtetc[1], cf_stream, TYMED_ISTREAM); InitFormatEtc(obj->fmtetc[2], cf_storage, TYMED_ISTORAGE); @@ -479,7 +479,7 @@ static HRESULT DataObjectImpl_CreateComplex(LPDATAOBJECT *lplpdataobj) dm.dmSize = sizeof(dm); dm.dmDriverExtra = 0; lstrcpyW(dm.dmDeviceName, device_name); - obj->fmtetc[3].ptd = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); + obj->fmtetc[3].ptd = malloc(FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); obj->fmtetc[3].ptd->tdSize = FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra; obj->fmtetc[3].ptd->tdDriverNameOffset = FIELD_OFFSET(DVTARGETDEVICE, tdData); obj->fmtetc[3].ptd->tdDeviceNameOffset = 0; @@ -1455,7 +1455,7 @@ static void test_flushed_getdata(void) dm.dmSize = sizeof(dm); dm.dmDriverExtra = 0; lstrcpyW(dm.dmDeviceName, device_name); - fmt.ptd = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); + fmt.ptd = malloc(FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra); fmt.ptd->tdSize = FIELD_OFFSET(DVTARGETDEVICE, tdData) + sizeof(device_name) + dm.dmSize + dm.dmDriverExtra; fmt.ptd->tdDriverNameOffset = FIELD_OFFSET(DVTARGETDEVICE, tdData); fmt.ptd->tdDeviceNameOffset = 0; @@ -1469,7 +1469,7 @@ static void test_flushed_getdata(void) ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed); if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
- HeapFree(GetProcessHeap(), 0, fmt.ptd); + free(fmt.ptd); }
/* CF_ENHMETAFILE format */ diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index 8467e86a66f..94b83024b91 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -2039,7 +2039,7 @@ static ULONG WINAPI Test_CallContext_Release(IUnknown *iface) Test_CallContext *This = impl_from_IUnknown(iface); ULONG refs = InterlockedDecrement(&This->refs); if (!refs) - HeapFree(GetProcessHeap(), 0, This); + free(This); return refs; }
@@ -2065,7 +2065,7 @@ static void test_CoGetCallContext(void)
CoInitialize(NULL);
- test_object = HeapAlloc(GetProcessHeap(), 0, sizeof(Test_CallContext)); + test_object = malloc(sizeof(Test_CallContext)); test_object->IUnknown_iface.lpVtbl = &TestCallContext_Vtbl; test_object->refs = 1;
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c index cbad8c46117..8f7d0b47684 100644 --- a/dlls/ole32/tests/marshal.c +++ b/dlls/ole32/tests/marshal.c @@ -33,7 +33,6 @@ #include "shobjidl.h"
#include "wine/test.h" -#include "wine/heap.h"
#define DEFINE_EXPECT(func) \ static BOOL expect_ ## func = FALSE, called_ ## func = FALSE @@ -465,7 +464,7 @@ static ULONG WINAPI RpcStubBuffer_Release(IRpcStubBuffer *iface) LONG ref = InterlockedDecrement(&This->ref); if(!ref) { IRpcStubBuffer_Release(This->buffer); - heap_free(This); + free(This); } return ref; } @@ -573,7 +572,7 @@ static ULONG WINAPI RpcProxyBuffer_Release(IRpcProxyBuffer *iface) LONG ref = InterlockedDecrement(&This->ref); if(!ref) { IRpcProxyBuffer_Release(This->buffer); - heap_free(This); + free(This); } return ref; } @@ -640,7 +639,7 @@ static HRESULT WINAPI PSFactoryBuffer_CreateProxy(IPSFactoryBuffer *iface, IUnkn HRESULT hr;
CHECK_EXPECT(CreateProxy); - proxy = heap_alloc(sizeof(*proxy)); + proxy = malloc(sizeof(*proxy)); proxy->IRpcProxyBuffer_iface.lpVtbl = &RpcProxyBufferVtbl; proxy->ref = 1;
@@ -662,7 +661,7 @@ static HRESULT WINAPI PSFactoryBuffer_CreateStub(IPSFactoryBuffer *iface, REFIID
ok(server == (IUnknown*)&Test_OleClientSite, "unexpected server %p\n", server);
- stub = heap_alloc(sizeof(*stub)); + stub = malloc(sizeof(*stub)); stub->IRpcStubBuffer_iface.lpVtbl = &RpcStubBufferVtbl; stub->ref = 1;
@@ -742,7 +741,7 @@ static DWORD CALLBACK host_object_proc(LPVOID p) DispatchMessageA(&msg); }
- HeapFree(GetProcessHeap(), 0, data); + free(data);
CoUninitialize();
@@ -754,7 +753,7 @@ static DWORD start_host_object2(struct host_object_data *object_data, HANDLE *th DWORD tid = 0; struct host_object_data *data;
- data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)); + data = malloc(sizeof(*data)); *data = *object_data; data->marshal_event = CreateEventA(NULL, FALSE, FALSE, NULL); *thread = CreateThread(NULL, 0, host_object_proc, data, 0, &tid); diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 9c583d27c47..bb43025c309 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -34,7 +34,6 @@ #include "initguid.h"
#include "wine/test.h" -#include "wine/heap.h"
#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) @@ -405,7 +404,7 @@ static ULONG WINAPI HeapUnknown_Release(IUnknown *iface) { HeapUnknown *This = impl_from_IUnknown(iface); ULONG refs = InterlockedDecrement((LONG*)&This->refs); - if (!refs) HeapFree(GetProcessHeap(), 0, This); + if (!refs) free(This); return refs; }
@@ -616,7 +615,7 @@ Moniker_Release(IMoniker* iface) ULONG refcount = InterlockedDecrement(&moniker->refcount);
if (!refcount) - heap_free(moniker); + free(moniker);
return refcount; } @@ -880,7 +879,7 @@ static struct test_moniker *create_test_moniker(void) { struct test_moniker *obj;
- obj = heap_alloc_zero(sizeof(*obj)); + obj = calloc(1, sizeof(*obj)); obj->IMoniker_iface.lpVtbl = &MonikerVtbl; obj->IROTData_iface.lpVtbl = &ROTDataVtbl; obj->IOleItemContainer_iface.lpVtbl = &test_item_container_vtbl; @@ -4392,7 +4391,7 @@ static void test_bind_context(void) hr = IBindCtx_RegisterObjectParam(pBindCtx, (WCHAR *)wszParamName, NULL); ok(hr == E_INVALIDARG, "IBindCtx_RegisterObjectParam should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
- unknown = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown)); + unknown = malloc(sizeof(*unknown)); unknown->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl; unknown->refs = 1; hr = IBindCtx_RegisterObjectParam(pBindCtx, (WCHAR *)wszParamName, &unknown->IUnknown_iface); @@ -4419,7 +4418,7 @@ static void test_bind_context(void) hr = IBindCtx_RevokeObjectBound(pBindCtx, NULL); ok(hr == E_INVALIDARG, "IBindCtx_RevokeObjectBound(NULL) should have return E_INVALIDARG instead of 0x%08lx\n", hr);
- unknown2 = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown)); + unknown2 = malloc(sizeof(*unknown)); unknown2->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl; unknown2->refs = 1; hr = IBindCtx_RegisterObjectBound(pBindCtx, &unknown2->IUnknown_iface); diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index 5c32ee6c142..fb683f932ff 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -3975,8 +3975,8 @@ static HRESULT stgmedium_cmp(const STGMEDIUM *med1, STGMEDIUM *med2) datasize2 = GetMetaFileBitsEx(mfpict2->hMF, 0, NULL); if (datasize1 == datasize2) { - data1 = HeapAlloc(GetProcessHeap(), 0, datasize1); - data2 = HeapAlloc(GetProcessHeap(), 0, datasize2); + data1 = malloc(datasize1); + data2 = malloc(datasize2); GetMetaFileBitsEx(mfpict1->hMF, datasize1, data1); GetMetaFileBitsEx(mfpict2->hMF, datasize2, data2); } @@ -3988,8 +3988,8 @@ static HRESULT stgmedium_cmp(const STGMEDIUM *med1, STGMEDIUM *med2) datasize2 = GetEnhMetaFileBits(med2->hEnhMetaFile, 0, NULL); if (datasize1 == datasize2) { - data1 = HeapAlloc(GetProcessHeap(), 0, datasize1); - data2 = HeapAlloc(GetProcessHeap(), 0, datasize2); + data1 = malloc(datasize1); + data2 = malloc(datasize2); GetEnhMetaFileBits(med1->hEnhMetaFile, datasize1, data1); GetEnhMetaFileBits(med2->hEnhMetaFile, datasize2, data2); } @@ -4021,15 +4021,15 @@ static HRESULT stgmedium_cmp(const STGMEDIUM *med1, STGMEDIUM *med2) } else if (med1->tymed == TYMED_MFPICT) { - HeapFree(GetProcessHeap(), 0, data1); - HeapFree(GetProcessHeap(), 0, data2); + free(data1); + free(data2); GlobalUnlock(med1->hMetaFilePict); GlobalUnlock(med2->hMetaFilePict); } else { - HeapFree(GetProcessHeap(), 0, data1); - HeapFree(GetProcessHeap(), 0, data2); + free(data1); + free(data2); }
return S_OK; @@ -4125,13 +4125,13 @@ static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *st if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS")) { data_size += sizeof(dib_inf); - data = HeapAlloc(GetProcessHeap(), 0, data_size); + data = malloc(data_size); memcpy(data, dib_inf, sizeof(dib_inf)); memcpy(data + sizeof(dib_inf), dib_white, sizeof(dib_white)); } else { - data = HeapAlloc(GetProcessHeap(), 0, data_size); + data = malloc(data_size); memcpy(data, dib_white, sizeof(dib_white)); } stg_def->stream[stm_idx].data = data; @@ -4142,14 +4142,14 @@ static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *st data_size = GetMetaFileBitsEx(mfpict->hMF, 0, NULL); if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS")) { - data = HeapAlloc(GetProcessHeap(), 0, data_size + sizeof(mf_rec)); + data = malloc(data_size + sizeof(mf_rec)); memcpy(data, mf_rec, sizeof(mf_rec)); GetMetaFileBitsEx(mfpict->hMF, data_size, data + sizeof(mf_rec)); data_size += sizeof(mf_rec); } else { - data = HeapAlloc(GetProcessHeap(), 0, data_size); + data = malloc(data_size); GetMetaFileBitsEx(mfpict->hMF, data_size, data); } GlobalUnlock(stg_med->hMetaFilePict); @@ -4160,7 +4160,7 @@ static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *st if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS")) { data_size = GetEnhMetaFileBits(stg_med->hEnhMetaFile, 0, NULL); - data = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) + sizeof(ENHMETAHEADER) + data_size); + data = malloc(sizeof(DWORD) + sizeof(ENHMETAHEADER) + data_size); *((DWORD *)data) = sizeof(ENHMETAHEADER); GetEnhMetaFileBits(stg_med->hEnhMetaFile, data_size, data + sizeof(DWORD) + sizeof(ENHMETAHEADER)); memcpy(data + sizeof(DWORD), data + sizeof(DWORD) + sizeof(ENHMETAHEADER), sizeof(ENHMETAHEADER)); @@ -4170,7 +4170,7 @@ static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *st { hdc = GetDC(NULL); data_size = GetWinMetaFileBits(stg_med->hEnhMetaFile, 0, NULL, MM_ANISOTROPIC, hdc); - data = HeapAlloc(GetProcessHeap(), 0, data_size); + data = malloc(data_size); GetWinMetaFileBits(stg_med->hEnhMetaFile, data_size, data, MM_ANISOTROPIC, hdc); ReleaseDC(NULL, hdc); } @@ -4389,7 +4389,7 @@ static void test_data_cache_save_data(void) IStorage_Release(doc); IOleCache2_Release(cache); for (i = 0; i < pdata->num_set; i++) - HeapFree(GetProcessHeap(), 0, (void *)pdata->stg_def.stream[i].data); + free((void *)pdata->stg_def.stream[i].data);
} } diff --git a/dlls/ole32/tests/ole_server.c b/dlls/ole32/tests/ole_server.c index 0e0473ad0f3..c8d3d3874e5 100644 --- a/dlls/ole32/tests/ole_server.c +++ b/dlls/ole32/tests/ole_server.c @@ -126,7 +126,7 @@ static ULONG WINAPI UnknownImpl_Release(IUnknown *iface) InterlockedDecrement(&obj_ref);
trace("server: unknown_Release: %p, ref %lu\n", iface, ref); - if (ref == 0) HeapFree(GetProcessHeap(), 0, This); + if (ref == 0) free(This); return ref; }
@@ -201,7 +201,7 @@ static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface,
if (punkouter) return CLASS_E_NOAGGREGATION;
- unknown = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown)); + unknown = malloc(sizeof(*unknown)); if (!unknown) return E_OUTOFMEMORY;
unknown->IUnknown_iface.lpVtbl = &UnknownImpl_Vtbl; diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c index fcf7bdb747e..01f27f400c1 100644 --- a/dlls/ole32/tests/propvariant.c +++ b/dlls/ole32/tests/propvariant.c @@ -610,7 +610,7 @@ static void test_varianttoproperty(void) return; }
- own_propvalue = HeapAlloc(GetProcessHeap(), 0, sizeof(SERIALIZEDPROPERTYVALUE) + 20); + own_propvalue = malloc(sizeof(SERIALIZEDPROPERTYVALUE) + 20);
PropVariantInit(&propvar);
@@ -626,7 +626,7 @@ static void test_varianttoproperty(void)
if (len == 0xdeadbeef) { - HeapFree(GetProcessHeap(), 0, own_propvalue); + free(own_propvalue); return; }
@@ -680,7 +680,7 @@ static void test_varianttoproperty(void)
SysFreeString(test_string_bstr);
- HeapFree(GetProcessHeap(), 0, own_propvalue); + free(own_propvalue); }
START_TEST(propvariant) diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index 1e588e1b93b..97809db539c 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -163,10 +163,10 @@ static HRESULT WINAPI TestLockBytes_SetSize(ILockBytes *iface, if (This->buffer_size < cb.QuadPart) { ULONG new_buffer_size = max(This->buffer_size * 2, cb.QuadPart); - BYTE* new_buffer = HeapAlloc(GetProcessHeap(), 0, new_buffer_size); + BYTE* new_buffer = malloc(new_buffer_size); if (!new_buffer) return E_OUTOFMEMORY; memcpy(new_buffer, This->contents, This->size); - HeapFree(GetProcessHeap(), 0, This->contents); + free(This->contents); This->contents = new_buffer; }
@@ -232,7 +232,7 @@ static const ILockBytesVtbl TestLockBytes_Vtbl = {
static void CreateTestLockBytes(TestLockBytes **This) { - *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**This)); + *This = calloc(1, sizeof(**This));
if (*This) { @@ -240,7 +240,7 @@ static void CreateTestLockBytes(TestLockBytes **This) (*This)->ref = 1; (*This)->size = 0; (*This)->buffer_size = 1024; - (*This)->contents = HeapAlloc(GetProcessHeap(), 0, (*This)->buffer_size); + (*This)->contents = malloc((*This)->buffer_size); } }
@@ -248,8 +248,8 @@ static void DeleteTestLockBytes(TestLockBytes *This) { ok(This->ILockBytes_iface.lpVtbl == &TestLockBytes_Vtbl, "test lock bytes %p deleted with incorrect vtable\n", This); ok(This->ref == 1, "test lock bytes %p deleted with %li references instead of 1\n", This, This->ref); - HeapFree(GetProcessHeap(), 0, This->contents); - HeapFree(GetProcessHeap(), 0, This); + free(This->contents); + free(This); }
static void test_hglobal_storage_stat(void) diff --git a/dlls/ole32/tests/usrmarshal.c b/dlls/ole32/tests/usrmarshal.c index 621b382730e..825e848a791 100644 --- a/dlls/ole32/tests/usrmarshal.c +++ b/dlls/ole32/tests/usrmarshal.c @@ -132,7 +132,7 @@ static DWORD CALLBACK host_object_proc(LPVOID p) DispatchMessageA(&msg); }
- HeapFree(GetProcessHeap(), 0, data); + free(data);
CoUninitialize();
@@ -143,7 +143,7 @@ static DWORD start_host_object2(IStream *stream, REFIID riid, IUnknown *object, { DWORD tid = 0; HANDLE marshal_event = CreateEventA(NULL, FALSE, FALSE, NULL); - struct host_object_data *data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)); + struct host_object_data *data = malloc(sizeof(*data));
data->stream = stream; data->iid = *riid; @@ -198,7 +198,7 @@ static void test_marshal_CLIPFORMAT(void) broken(size == 16 + sizeof(cf_marshaled)), /* win64 adds 4 extra (unused) bytes */ "CLIPFORMAT: Wrong size %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); memset( buffer, 0xcc, size ); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = CLIPFORMAT_UserMarshal(&umcb.Flags, buffer + 1, &cf); @@ -214,7 +214,7 @@ static void test_marshal_CLIPFORMAT(void) buffer_end = CLIPFORMAT_UserUnmarshal(&umcb.Flags, buffer + 1, &cf2); ok(buffer_end == buffer + 12 + sizeof(cf_marshaled), "got %p buffer %p\n", buffer_end, buffer); ok(cf == cf2, "CLIPFORMAT: Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); CLIPFORMAT_UserFree(&umcb.Flags, &cf2); @@ -235,7 +235,7 @@ static void test_marshal_HWND(void) size = HWND_UserSize(&umcb.Flags, 1, &hwnd); ok(size == 4 + sizeof(*wirehwnd), "Wrong size %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); buffer_end = HWND_UserMarshal(&umcb.Flags, buffer + 1, &hwnd); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); @@ -247,7 +247,7 @@ static void test_marshal_HWND(void) buffer_end = HWND_UserUnmarshal(&umcb.Flags, buffer + 1, &hwnd2); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); ok(hwnd == hwnd2, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); HWND_UserFree(&umcb.Flags, &hwnd2); @@ -271,7 +271,7 @@ static void test_marshal_HGLOBAL(void) /* native is poorly programmed and allocates 4/8 bytes more than it needs to * here - Wine doesn't have to emulate that */ ok((size == 8) || broken(size == 12) || broken(size == 16), "Size should be 8, instead of %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); HGLOBAL_UserMarshal(&umcb.Flags, buffer, &hglobal); wirehglobal = buffer; @@ -282,7 +282,7 @@ static void test_marshal_HGLOBAL(void) hglobal2 = NULL; HGLOBAL_UserUnmarshal(&umcb.Flags, buffer, &hglobal2); ok(hglobal2 == hglobal, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); HGLOBAL_UserFree(&umcb.Flags, &hglobal2);
@@ -306,7 +306,7 @@ static void test_marshal_HGLOBAL(void) broken(size == expected_size + 4) || broken(size == expected_size + 8), "%ld: got size %ld\n", block_size, size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); HGLOBAL_UserMarshal(&umcb.Flags, buffer, &hglobal); wirehglobal = buffer; @@ -327,7 +327,7 @@ static void test_marshal_HGLOBAL(void) hglobal2 = NULL; HGLOBAL_UserUnmarshal(&umcb.Flags, buffer, &hglobal2); ok(hglobal2 != NULL, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); HGLOBAL_UserFree(&umcb.Flags, &hglobal2); GlobalFree(hglobal); @@ -358,7 +358,7 @@ static void test_marshal_HENHMETAFILE(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); size = HENHMETAFILE_UserSize(&umcb.Flags, 1, &hemf); ok(size > 24, "size should be at least 24 bytes, not %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = HENHMETAFILE_UserMarshal(&umcb.Flags, buffer + 1, &hemf); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); @@ -379,7 +379,7 @@ static void test_marshal_HENHMETAFILE(void) buffer_end = HENHMETAFILE_UserUnmarshal(&umcb.Flags, buffer + 1, &hemf2); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); ok(hemf2 != NULL, "HENHMETAFILE didn't unmarshal\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); HENHMETAFILE_UserFree(&umcb.Flags, &hemf2); DeleteEnhMetaFile(hemf); @@ -390,7 +390,7 @@ static void test_marshal_HENHMETAFILE(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); size = HENHMETAFILE_UserSize(&umcb.Flags, 1, &hemf); ok(size == 12, "size should be 12 bytes, not %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = HENHMETAFILE_UserMarshal(&umcb.Flags, buffer + 1, &hemf); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); @@ -403,7 +403,7 @@ static void test_marshal_HENHMETAFILE(void) buffer_end = HENHMETAFILE_UserUnmarshal(&umcb.Flags, buffer + 1, &hemf2); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); ok(hemf2 == NULL, "NULL HENHMETAFILE didn't unmarshal\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); HENHMETAFILE_UserFree(&umcb.Flags, &hemf2); } @@ -432,7 +432,7 @@ static void test_marshal_HMETAFILE(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); size = HMETAFILE_UserSize(&umcb.Flags, 0, &hmf); ok(size > 20, "size should be at least 20 bytes, not %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); HMETAFILE_UserMarshal(&umcb.Flags, buffer, &hmf); wirehmf = buffer; @@ -452,7 +452,7 @@ static void test_marshal_HMETAFILE(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); HMETAFILE_UserUnmarshal(&umcb.Flags, buffer, &hmf2); ok(hmf2 != NULL, "HMETAFILE didn't unmarshal\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); HMETAFILE_UserFree(&umcb.Flags, &hmf2); DeleteMetaFile(hmf);
@@ -461,7 +461,7 @@ static void test_marshal_HMETAFILE(void)
size = HMETAFILE_UserSize(&umcb.Flags, 0, &hmf); ok(size == 8, "size should be 8 bytes, not %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); HMETAFILE_UserMarshal(&umcb.Flags, buffer, &hmf); wirehmf = buffer; @@ -473,7 +473,7 @@ static void test_marshal_HMETAFILE(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); HMETAFILE_UserUnmarshal(&umcb.Flags, buffer, &hmf2); ok(hmf2 == NULL, "NULL HMETAFILE didn't unmarshal\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); HMETAFILE_UserFree(&umcb.Flags, &hmf2); }
@@ -504,7 +504,7 @@ static void test_marshal_HMETAFILEPICT(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); size = HMETAFILEPICT_UserSize(&umcb.Flags, 1, &hmfp); ok(size > 24, "size should be at least 24 bytes, not %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = HMETAFILEPICT_UserMarshal(&umcb.Flags, buffer + 1, &hmfp); wirehmfp = buffer + 4; @@ -539,7 +539,7 @@ static void test_marshal_HMETAFILEPICT(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); HMETAFILEPICT_UserUnmarshal(&umcb.Flags, buffer + 1, &hmfp2); ok(hmfp2 != NULL, "HMETAFILEPICT didn't unmarshal\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); HMETAFILEPICT_UserFree(&umcb.Flags, &hmfp2); pmfp = GlobalLock(hmfp); @@ -553,7 +553,7 @@ static void test_marshal_HMETAFILEPICT(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); size = HMETAFILEPICT_UserSize(&umcb.Flags, 1, &hmfp); ok(size == 12, "size should be 12 bytes, not %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = HMETAFILEPICT_UserMarshal(&umcb.Flags, buffer + 1, &hmfp); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); @@ -568,7 +568,7 @@ static void test_marshal_HMETAFILEPICT(void) buffer_end = HMETAFILEPICT_UserUnmarshal(&umcb.Flags, buffer + 1, &hmfp2); ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer); ok(hmfp2 == NULL, "NULL HMETAFILE didn't unmarshal\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); HMETAFILEPICT_UserFree(&umcb.Flags, &hmfp2); } @@ -703,10 +703,10 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx, BOOL client, init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, umcb_ctx); size = WdtpInterfacePointer_UserSize(&umcb.Flags, ctx, 0, unk, &IID_IUnknown); ok(size == 0, "size should be 0 bytes, not %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, ctx, buffer, unk, &IID_IUnknown); ok(buffer_end == buffer, "buffer_end %p buffer %p\n", buffer_end, buffer); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
/* Now for a non-NULL pointer. The marshalled data are two size DWORDS and then the result of CoMarshalInterface called with the LOWORD of the ctx */ @@ -726,7 +726,7 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx, BOOL client, init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, umcb_ctx); size = WdtpInterfacePointer_UserSize(&umcb.Flags, ctx, 0, unk, &IID_IUnknown); ok(size >= marshal_size + 2 * sizeof(DWORD), "marshal size %lx got %lx\n", marshal_size, size); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, umcb_ctx); buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, ctx, buffer, unk, &IID_IUnknown); todo_wine @@ -758,7 +758,7 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx, BOOL client, ok(unk2 != NULL, "IUnknown object didn't unmarshal properly\n"); ok(Test_Unknown.refs == 2, "got %ld\n", Test_Unknown.refs); ok(Test_Unknown2.refs == 0, "got %ld\n", Test_Unknown2.refs); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC); IUnknown_Release(unk2); } @@ -808,7 +808,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); expect_size = WdtpInterfacePointer_UserSize(&umcb.Flags, umcb.Flags, 2 * sizeof(DWORD), unk, &IID_IUnknown); - expect_buffer = HeapAlloc(GetProcessHeap(), 0, expect_size); + expect_buffer = malloc(expect_size); *(DWORD*)expect_buffer = TYMED_NULL; *((DWORD*)expect_buffer + 1) = 0xdeadbeef; init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, expect_buffer, expect_size, MSHCTX_DIFFERENTMACHINE); @@ -822,7 +822,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) size = STGMEDIUM_UserSize(&umcb.Flags, 0, &med); ok(size == expect_size, "size %ld should be %ld bytes\n", size, expect_size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = STGMEDIUM_UserMarshal(&umcb.Flags, buffer, &med); ok(buffer_end - buffer == expect_buffer_end - expect_buffer, "buffer size mismatch\n"); @@ -846,7 +846,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) ok(med2.pUnkForRelease != NULL, "Incorrectly unmarshalled\n"); ok(Test_Unknown2.refs == 0, "got %ld\n", Test_Unknown2.refs);
- HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); STGMEDIUM_UserFree(&umcb.Flags, &med2);
@@ -860,7 +860,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
ok(Test_Unknown.refs == 1, "got %ld\n", Test_Unknown.refs);
- HeapFree(GetProcessHeap(), 0, expect_buffer); + free(expect_buffer);
/* TYMED_ISTREAM with pUnkForRelease */
@@ -871,7 +871,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) expect_size = WdtpInterfacePointer_UserSize(&umcb.Flags, umcb.Flags, 3 * sizeof(DWORD), (IUnknown*)stm, &IID_IStream); expect_size = WdtpInterfacePointer_UserSize(&umcb.Flags, umcb.Flags, expect_size, unk, &IID_IUnknown);
- expect_buffer = HeapAlloc(GetProcessHeap(), 0, expect_size); + expect_buffer = malloc(expect_size); /* There may be a hole between the two interfaces so init the buffer to something */ memset(expect_buffer, 0xcc, expect_size); *(DWORD*)expect_buffer = TYMED_ISTREAM; @@ -889,7 +889,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) size = STGMEDIUM_UserSize(&umcb.Flags, 0, &med); ok(size == expect_size, "size %ld should be %ld bytes\n", size, expect_size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); memset(buffer, 0xcc, size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = STGMEDIUM_UserMarshal(&umcb.Flags, buffer, &med); @@ -918,7 +918,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) ok(Test_Stream2.refs == 0, "got %ld\n", Test_Stream2.refs); ok(Test_Unknown2.refs == 0, "got %ld\n", Test_Unknown2.refs);
- HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); STGMEDIUM_UserFree(&umcb.Flags, &med2);
@@ -933,7 +933,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) ok(Test_Unknown.refs == 1, "got %ld\n", Test_Unknown.refs); ok(Test_Stream.refs == 1, "got %ld\n", Test_Stream.refs);
- HeapFree(GetProcessHeap(), 0, expect_buffer); + free(expect_buffer);
/* TYMED_ISTREAM = NULL with pUnkForRelease = NULL */
@@ -948,7 +948,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) size = STGMEDIUM_UserSize(&umcb.Flags, 0, &med); ok(size == expect_size, "size %ld should be %ld bytes\n", size, expect_size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); memset(buffer, 0xcc, size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE); buffer_end = STGMEDIUM_UserMarshal(&umcb.Flags, buffer, &med); @@ -976,7 +976,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out) ok(Test_Stream2.refs == 0, "got %ld\n", Test_Stream2.refs); ok(Test_Unknown2.refs == 1, "got %ld\n", Test_Unknown2.refs);
- HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE); STGMEDIUM_UserFree(&umcb.Flags, &med2); } @@ -1018,7 +1018,7 @@ static void test_marshal_SNB(void) size = SNB_UserSize(&umcb.Flags, 0, &snb); ok(size == 12, "Size should be 12, instead of %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); mbuf = SNB_UserMarshal(&umcb.Flags, buffer, &snb); ok(mbuf == buffer + size, "got %p, %p\n", mbuf, buffer + size); @@ -1033,14 +1033,14 @@ static void test_marshal_SNB(void) SNB_UserUnmarshal(&umcb.Flags, buffer, &snb2); ok(snb2 == NULL, "got %p\n", snb2);
- HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); SNB_UserFree(&umcb.Flags, &snb2);
/* block with actual data */
/* allocate source block, n+1 pointers first, then data */ - src = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR*)*3 + sizeof(str1W) + sizeof(str2W)); + src = malloc(sizeof(WCHAR*) * 3 + sizeof(str1W) + sizeof(str2W)); ptrW = (WCHAR**)src; dataW = *ptrW = (WCHAR*)(src + 3*sizeof(WCHAR*)); ptrW++; @@ -1056,7 +1056,7 @@ static void test_marshal_SNB(void) size = SNB_UserSize(&umcb.Flags, 0, &snb); ok(size == 38, "Size should be 38, instead of %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); SNB_UserMarshal(&umcb.Flags, buffer, &snb);
@@ -1084,14 +1084,14 @@ static void test_marshal_SNB(void) ptrW++; ok(*ptrW == NULL, "expected terminating NULL ptr, got %p, start %p\n", *ptrW, snb2);
- HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
g_expect_user_free = TRUE; SNB_UserFree(&umcb.Flags, &snb2); g_expect_user_free = FALSE;
- HeapFree(GetProcessHeap(), 0, src); + free(src); }
static void test_marshal_HDC(void) @@ -1108,7 +1108,7 @@ static void test_marshal_HDC(void) size = HDC_UserSize(&umcb.Flags, 1, &hdc); ok(size == 4 + sizeof(*wirehdc), "Wrong size %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); buffer_end = HDC_UserMarshal(&umcb.Flags, buffer + 1, &hdc); ok(buffer_end == buffer + 4 + sizeof(*wirehdc), "got %p buffer %p\n", buffer_end, buffer); @@ -1120,7 +1120,7 @@ static void test_marshal_HDC(void) buffer_end = HDC_UserUnmarshal(&umcb.Flags, buffer + 1, &hdc2); ok(buffer_end == buffer + 4 + sizeof(*wirehdc), "got %p buffer %p\n", buffer_end, buffer); ok(hdc == hdc2, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); HDC_UserFree(&umcb.Flags, &hdc2); @@ -1145,7 +1145,7 @@ static void test_marshal_HICON(void) size = HICON_UserSize(&umcb.Flags, 1, &hIcon); ok(size == 4 + sizeof(*wirehicon), "Wrong size %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); buffer_end = HICON_UserMarshal(&umcb.Flags, buffer + 1, &hIcon); ok(buffer_end == buffer + 4 + sizeof(*wirehicon), "got %p buffer %p\n", buffer_end, buffer); @@ -1157,7 +1157,7 @@ static void test_marshal_HICON(void) buffer_end = HICON_UserUnmarshal(&umcb.Flags, buffer + 1, &hIcon2); ok(buffer_end == buffer + 4 + sizeof(*wirehicon), "got %p buffer %p\n", buffer_end, buffer); ok(hIcon == hIcon2, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); HICON_UserFree(&umcb.Flags, &hIcon2); @@ -1186,7 +1186,7 @@ static void test_marshal_HBRUSH(void) size = HBRUSH_UserSize(&umcb.Flags, 1, &hBrush); ok(size == 4 + sizeof(*wirehbrush), "Wrong size %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); buffer_end = HBRUSH_UserMarshal(&umcb.Flags, buffer + 1, &hBrush); ok(buffer_end == buffer + 4 + sizeof(*wirehbrush), "got %p buffer %p\n", buffer_end, buffer); @@ -1198,7 +1198,7 @@ static void test_marshal_HBRUSH(void) buffer_end = HBRUSH_UserUnmarshal(&umcb.Flags, buffer + 1, &hBrush2); ok(buffer_end == buffer + 4 + sizeof(*wirehbrush), "got %p buffer %p\n", buffer_end, buffer); ok(hBrush == hBrush2, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); HBRUSH_UserFree(&umcb.Flags, &hBrush2); @@ -1227,7 +1227,7 @@ static void test_marshal_HBITMAP(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC); size = HBITMAP_UserSize(&umcb.Flags, 1, &hBitmap); ok(size == 0xc, "Wrong size %ld\n", size); - buffer = HeapAlloc(GetProcessHeap(), 0, size + 4); + buffer = malloc(size + 4); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_INPROC); buffer_end = HBITMAP_UserMarshal(&umcb.Flags, buffer + 1, &hBitmap); ok(buffer_end == buffer + 0xc, "HBITMAP_UserMarshal() returned wrong size %ld\n", (LONG)(buffer_end - buffer)); @@ -1237,7 +1237,7 @@ static void test_marshal_HBITMAP(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_INPROC); HBITMAP_UserUnmarshal(&umcb.Flags, buffer + 1, &hBitmap2); ok(hBitmap2 != NULL, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC); HBITMAP_UserFree(&umcb.Flags, &hBitmap2); @@ -1248,7 +1248,7 @@ static void test_marshal_HBITMAP(void) broken(size == 0x14 + header_size + bitmap_size), /* Windows adds 4 extra (unused) bytes */ "Wrong size %ld\n", size);
- buffer = HeapAlloc(GetProcessHeap(), 0, size + 4); + buffer = malloc(size + 4); init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); buffer_end = HBITMAP_UserMarshal(&umcb.Flags, buffer + 1, &hBitmap); ok(buffer_end == buffer + 0x10 + header_size + bitmap_size, "HBITMAP_UserMarshal() returned wrong size %ld\n", (LONG)(buffer_end - buffer)); @@ -1261,7 +1261,7 @@ static void test_marshal_HBITMAP(void) init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL); HBITMAP_UserUnmarshal(&umcb.Flags, buffer + 1, &hBitmap2); ok(hBitmap2 != NULL, "Didn't unmarshal properly\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL); HBITMAP_UserFree(&umcb.Flags, &hBitmap2);
Esme Povirk (@madewokherd) commented about dlls/ole32/tests/ole2.c:
{ hdc = GetDC(NULL); data_size = GetWinMetaFileBits(stg_med->hEnhMetaFile, 0, NULL, MM_ANISOTROPIC, hdc);
data = HeapAlloc(GetProcessHeap(), 0, data_size);
data = malloc(data_size);
I can't find all the corresponding `free` calls for the `malloc` calls in `get_stgdef`, I think `test_OleCreateStaticFromData` might be leaking the data.