Shoutbox

ReadInterfacePtr + WriteInterfacePtr (DataBloc) - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: ReadInterfacePtr + WriteInterfacePtr (DataBloc) (/showthread.php?tid=72586)

ReadInterfacePtr + WriteInterfacePtr (DataBloc) by deAd on 03-12-2007 at 04:31 PM

What can these be used for? (anything more specific than "writing or reading an interface pointer" :P)


RE: ReadInterfacePtr + WriteInterfacePtr (DataBloc) by matty on 03-12-2007 at 05:04 PM

There was a thread in the beta testing forum but there wasn't a definite answer.

quote:
Originally posted by Patchou
Well this is used to keep a pointer to any kind of ActiveX object and get it back as such as the interface returns an IDispatch pointer. This means that you can create; for example, a MediaPlayer object in a function, call AddRef() in it, write the pointer to a databloc and read it again in another function. JScript bqsic variables dont have IDispatch interfaces so you cant use that function with them.

Is really all we got out of Patchy Watchy.
RE: ReadInterfacePtr + WriteInterfacePtr (DataBloc) by deAd on 03-12-2007 at 05:08 PM

...nothing else :P?

I've called CoCreateInstance and gotten an interface pointer, and I can get another databloc from that which seems to have all the addresses to the functions in the object's virtual table, but I have no idea how to call them..

From what Patchou said in that quote this seems to be the wrong approach, as I have to use ReadDWORD because ReadInterfacePtr crashes it :P


RE: RE: ReadInterfacePtr + WriteInterfacePtr (DataBloc) by TheSteve on 03-14-2007 at 02:59 PM

quote:
Originally posted by deAd
I've called CoCreateInstance and gotten an interface pointer, and I can get another databloc from that which seems to have all the addresses to the functions in the object's virtual table, but I have no idea how to call them..

I would assume that ReadInterfacePtr is essentially a simple cast to a COM object as opposed to a DWORD.

In order to call the functions in the object's virtual table, you would need to know the parameters of the function you're trying to get, and then you'd have to manage to get JScript to let you call that function with those parameters.
RE: ReadInterfacePtr + WriteInterfacePtr (DataBloc) by Patchou on 03-15-2007 at 08:36 PM

WriteInterfacePtr simply writes the address of the IDispatch interface associated with the object, nothing more. It is your responsability to do thigns like AddRef and Release to make sure the object is not destroyed before the interface pointer is read back.

If you have a particular example of something you want to do, please post :)


RE: ReadInterfacePtr + WriteInterfacePtr (DataBloc) by Eljay on 03-15-2007 at 08:55 PM

quote:
Originally posted by Patchou
WriteInterfacePtr simply writes the address of the IDispatch interface associated with the object, nothing more. It is your responsability to do thigns like AddRef and Release to make sure the object is not destroyed before the interface pointer is read back.

If you have a particular example of something you want to do, please post :)

Is it possible to actually create a new IDispatch object (exposing IMessenger purely as an example) using JScript only (no dll) and then get a object for it so it's possible to do something like:
IMessenger.Signout();
I know you expose all the important stuff from IMessenger in the Messenger object but purely for example's sake...

Or is it just a case of not being able to create objects this way, and ReadInterfacePtr can only be used on objects which have been written to a DataBlock previously using WriteInterfacePtr.

Thanks for replying anyway though, even if you are still being rather vague, leaving me in my confused state... :P
RE: RE: ReadInterfacePtr + WriteInterfacePtr (DataBloc) by deAd on 03-15-2007 at 09:03 PM

quote:
Originally posted by EljayIs it possible to actually create a new IDispatch object (exposing IMessenger purely as an example) using JScript only (no dll) and then get a object for it so it's possible to do something like:
IMessenger.Signout();
That was exactly my question :P