CMCHTPC / DelphiDX12

DirectX 12 Headers for Delphi and FPC
92 stars 35 forks source link

Wrong translation of SAL Annotations #18

Open pyscripter opened 4 years ago

pyscripter commented 4 years ago

Windows header files have SAL annotations that make the indent of the code explicit. An example of such annotation is _Out_writesbytes. See the Annotating function parameters and return values topic. The SAL annotations should be ignored.

Example: In d2d1svg.h you have:

    STDMETHOD(GetAttributeValue)(
        _In_ PCWSTR name,
        D2D1_SVG_ATTRIBUTE_POD_TYPE type,
        _Out_writes_bytes_(valueSizeInBytes) void *value,
        UINT32 valueSizeInBytes 
        ) PURE;

This is translated as:

  function GetAttributeValue(Name: PWideChar; AType: TD2D1_SVG_ATTRIBUTE_POD_TYPE; out Value: PByte;
            valueSizeInBytes: UINT32): HResult; stdcall; overload;

This should be:

function GetAttributeValue(Name: PWideChar; AType: TD2D1_SVG_ATTRIBUTE_POD_TYPE; Value: Pointer;
            valueSizeInBytes: UINT32): HResult; stdcall; overload;

The above has been tested and it works.