The declaration TParseDisplayNameomits the calling convention. You must enable stdcall.
TParseDisplayName = function(pszPath: PWideChar; pbc: IBindCtx;
var pidl: PItemIDList; sfgaoIn: ULong; var psfgaoOut: ULong): HResult; stdcall;
If you do not specify a calling convention, the default calling convention is used. The default calling convention is register. This has different semantics for passing and clearing parameters, which leads to the type of runtime error you encountered. Almost all the functions of the Windows API are used stdcall.