Mike McCormack wrote:
ret->ref = 1; ret->cur = 0; ret->fmtetc_cnt = fmtetc_cnt;
- ret->fmtetc = HeapAlloc(GetProcessHeap(), 0, fmtetc_cnt*sizeof(FORMATETC));
- ret->fmtetc = GlobalAlloc(GMEM_ZEROINIT, fmtetc_cnt*sizeof(FORMATETC)); memcpy(ret->fmtetc, fmtetc, fmtetc_cnt*sizeof(FORMATETC)); *lplpformatetc = (LPENUMFORMATETC)ret; return S_OK;
Why use GMEM_ZEROINIT when you initialise all of the memory straight after the GlobalAlloc call?