In d2d1svg.h (Direct2D) there is the following declaration of the ID2D1SvgElement interface:
/// <summary>
/// Sets an attribute of this element using a POD type. Returns an error if the
/// attribute name is not valid on this element. Returns an error if the attribute
/// cannot be expressed as the specified type.
/// </summary>
STDMETHOD(SetAttributeValue)(
_In_ PCWSTR name,
D2D1_SVG_ATTRIBUTE_POD_TYPE type,
_In_reads_bytes_(valueSizeInBytes) CONST void *value,
UINT32 valueSizeInBytes
) PURE;
D2D1_SVG_ATTRIBUTE_POD_TYPE = DWord;
I am translating this as
function SetAttributeValue(name: LPWSTR;
_type: D2D1_SVG_ATTRIBUTE_POD_TYPE;
value: Pointer;
valueSizeInBytes: UINT32): HResult; overload; stdcall;
But it crashes when it is used.
The assembly prolog of SetAttributeValue is
564711F0 6690 nop
564711F2 55 push ebp
564711F3 8BEC mov ebp,esp
564711F5 83EC14 sub esp,$14
564711F8 8B4508 mov eax,[ebp+$08]
564711FB 33C9 xor ecx,ecx
564711FD 53 push ebx
564711FE 56 push esi
564711FF 57 push edi
56471200 8D5808 lea ebx,[eax+$08]
56471203 85DB test ebx,ebx
56471205 6A08 push $08
56471207 0F44C1 cmovz eax,ecx
5647120A 8945F8 mov [ebp-$08],eax
5647120D 5A pop edx
Any idea what I am doing wrong?
Thanks!