Laurent Vromman laurent@vromman.org writes:
elp = HeapAlloc( GetProcessHeap(), 0, size );
- lp = HeapAlloc( GetProcessHeap(), 0, sizeof(LOGPEN)); GetObjectW( dc->hPen, size, elp );
- obj_type = GetObjectType(dc->hPen);
- if(obj_type == OBJ_PEN) {
memcpy(lp, elp, sizeof(LOGPEN));
penStyle = lp->lopnStyle;
- }
- else if(obj_type == OBJ_EXTPEN) {
penStyle = elp->elpPenStyle;
- }
- else {
SetLastError(ERROR_CAN_NOT_COMPLETE);
return FALSE;
- }
There's no reason to make a copy of the structure, a typecast would work just as well. Also you are leaking memory here.