Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-08

wrong definition of SHCreateStdEnumFmtEtc() in unit shlobl

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd

While implementing an OLE drag&drop source I stumbled over this:

shlobj.pp, Line 2444

  function SHCreateStdEnumFmtEtc(cfmt:UINT; afmt:array of TFORMATETC;
var ppenumFormatEtc:IEnumFORMATETC):HRESULT;StdCall;external
External_library name 'SHCreateStdEnumFmtEtc';

this must be wrong. I got nothing but crashes until I translated it myself as follows:

  function SHCreateStdEnumFmtEtc(cfmt:UINT; afmt: PFORMATETC; var
ppenumFormatEtc:IEnumFORMATETC):HRESULT;StdCall;external
External_library name 'SHCreateStdEnumFmtEtc';

and now my program works. Its the array of TFORMATETC, open arrays implicitly include a length parameter, don't they? If this should work with an open array then the first parameter (the count) would need to be removed, wouldn't it?

The original definition is:

HRESULT SHCreateStdEnumFmtEtc(
_In_ UINT cfmt,
const FORMATETC afmt[],
_Out_ IEnumFORMATETC **ppenumFormatEtc
);
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762148%28v=vs.85%29.aspx