Shoutbox

Get Variable pointer - 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: Get Variable pointer (/showthread.php?tid=63264)

Get Variable pointer by deAd on 07-14-2006 at 04:50 PM

How can I get the pointer to a variable? The variable is a string. :S


RE: Get Variable pointer by -dt- on 07-14-2006 at 05:33 PM

code:

var str = "moo goes the cow";
var strPtr = Interop.Allocate( (str.length *2) +2);
strPrt.WriteString(0,str);

Debug.Trace("The pointer is ..." + strPtr.DataPtr );


RE: Get Variable pointer by CookieRevised on 07-14-2006 at 08:26 PM

quote:
Originally posted by -dt-
code:

var str = "moo goes the cow";
var strPtr = Interop.Allocate( (str.length *2) +2);
strPrt.WriteString(0,str);

Debug.Trace("The pointer is ..." + strPtr.DataPtr );


for deAd: note that this does not give the pointer to the 'str' variable, but rather gives a pointer to another copy of that string.
RE: Get Variable pointer by Shondoit on 08-30-2006 at 12:05 AM

Maybe a weird question, but how could this be done for a function?
A function is not a string...

I was thinking of subclassing with JScript (Y) (Ultimate power8o|:P)


RE: Get Variable pointer by deAd on 08-30-2006 at 12:33 AM

How would you receive the events for subclassing?

And do you mean the function's memory address? nope, you have to be able to write what you want the pointer to in the DataBloc :/


RE: Get Variable pointer by Shondoit on 08-30-2006 at 12:47 AM

You can Hook the events with SetWindowLong, I'm not sure about the name...
I don't have the time to find the documentation now...

Any other way of getting a pointer?


RE: Get Variable pointer by deAd on 08-30-2006 at 01:12 AM

But when you hook the events, you won't be able to receive the events afaik without an external dll, and in that case you could just subclass in the dll.


RE: Get Variable pointer by CookieRevised on 08-30-2006 at 01:24 AM

quote:
Originally posted by deAd
But when you hook the events, you won't be able to receive the events afaik without an external dll
What that external DLL does or is used for is to execute a function at a given address (callback), nothing more. Hence why Shondoit asks if it is possible to get a pointer to a function in JScript.
So instead of giving an address for a function in that DLL, you give the address of a function in JScript....