Access violation in IActiveScript.AddNamedItem Delphi 64 bit -


i'm in process of trying migrate apps 64 bit , have hit bit of problem active scripts. theres not lot of information out there managed track down fact there 64 bit version of iactivescriptparse interface , have modified guid defs reflect below

  scatid_activescript = '{f0b7a1a1-9847-11cf-8f20-00805f2cd064}';   scatid_activescriptparse = '{f0b7a1a2-9847-11cf-8f20-00805f2cd064}';   sid_iactivescript =        '{bb1a2ae1-a4f9-11cf-8f20-00805f2cd064}';   {$ifdef win64}     sid_iactivescriptparse =  '{c7ef7658-e1ee-480e-97ea-d52cb4d76d17}';     sid_iactivescriptparseprocedureold ='{21f57128-08c9-4638-ba12-22d15d88dc5c}';     sid_iactivescriptparseprocedure = '{c64713b6-e029-4cc5-9200-438b72890b6a}';     sid_iactivescripterror =  '{b21fb2a1-5b8f-4963-8c21-21450f84ed7f}';   {$else}     sid_iactivescriptparse =  '{bb1a2ae2-a4f9-11cf-8f20-00805f2cd064}';     sid_iactivescriptparseprocedureold ='{1cff0050-6fdd-11d0-9328-00a0c90dcaa9}';     sid_iactivescriptparseprocedure =   '{aa5b6a80-b834-11d0-932f-00a0c90dcaa9}';     sid_iactivescripterror =     '{eae1ba61-a4ed-11cf-8f20-00805f2cd064}';   {$endif}   sid_iactivescriptsite =        '{db01a1e3-a42b-11cf-8f20-00805f2cd064}';   sid_iactivescriptsitewindow =  '{d10f6761-83e9-11cf-8f20-00805f2cd064}';   sid_iactivescriptsiteinterruptpoll ='{539698a0-cdca-11cf-a5eb-00aa0047a063}';   sid_ibindeventhandler =  '{63cdbcb0-c1b1-11d0-9336-00a0c90dcaa9}';   sid_iactivescriptstats = '{b8da6310-e19b-11d0-933c-00a0c90dcaa9}'; 

this has fixed of problems, left nagging access violation error when try add apps com object script object using iactivescript.addnameditem eg

  scriptengine.addnameditem(pwidechar(aname), scriptitem_globalmembers+scriptitem_nocode+scriptitem_isvisible); 

other calls scriptengine seem function ok, 1 produces av error , functions correctly in 32 bit mode.

is there have missed in script interface updates?

update:- reme lebeau providing insight on this.

so problem occurs in iactivescriptsite.getiteminfo appears callback event happens when objects added script engine using iactivescript.addnameditem. iactivescriptsite implemented host , reason parameter definitions don't work in 64 bit mode.

here's original definition

function getiteminfo(   pstrname: lpcolestr;   dwreturnmask: dword;   out ppiunkitem: iunknown;   out ppti: itypeinfo): hresult; stdcall; 

and needs changed to

function getiteminfo(   pstrname: lpcolestr;   dwreturnmask: dword;   out ppiunkitem: pointer;   out ppti: pointer): hresult; stdcall; 

so guid changes described @ top , change function definition above go on both 64 , 32 bit.

also need change system.objauto

function getvarianttype(typeinfo: ptypeinfo): tvartype; ...     tkclass:       {$ifdef win32}       result := varinteger;       {$else}       result := varint64;       {$endif} 

Comments