Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [quote=nnnik post_id=272313 time=1555076629 user_id=74]
- Adding +0 makes AHK treat var like a pointer and prevents AHK from interpreting said variable as a byref variable and numget the binary contents of its string buffer.
- The example seems to be written for AHK 32 bit. The DllCall passes along a float and a 64 bit integer bringing the total size of parameter to float = 32 + int64 = 64 which is 96.
- 96 bits equals 3 32 bit parameters.
- As the documentation states:
- [quote]If the function is declared as variadic, its final parameter is assigned the address of the first callback parameter which was not assigned to a script parameter.[/quote]
- That means the address in args points to the n-th parameter with args being the n-th parameter in the function definition.
- All methods have a hidden parameter named this - that means that args actually is the second parameter and not the first.
- Which is also the reason why it points to the second parameter passed along: Which appears to point to wParam.
- [/quote]
- Thanks for the reply.
- Understood something, but still having trouble understanding other stuff.
- Firstly I'd just like to say that I'm quite new to the concept of working with pointers.
- [quote]That means the address in args points to the n-th parameter with args being the n-th parameter in the function definition.[/quote]
- So this for example, don't quite understand it. Maybe that's because I don't really know what the docs mean by "script parameter".
- But about the systemwide hook example, I'm probably wrong as fuck, but here's what I got my brain thinking based off what you said:
- Since args actually points to the second parameter (as you said, but tbh I didn't quite yet understand why) we get the first parameter, nCode, by [i]going back[/i] (subtracting) A_PtrSize (not quite sure why we're going back A_PtrSize though).
- And then we get the second param, wParam, by just NumGetting from from offset 0, and third param by NumGetting from offset A_PtrSize.
- But what about in the docs example. We're getting the first param (10.5) without going back A_PtrSize, and then we're suddenly getting the second param (42) by adding A_PtrSize.
- Also, in the systemwide hook example, why is ParamCount set to 4?
- If we're counting amount of 4 byte parameters, wouldn't it it be 3 or 5 (Int+Ptr+UPtr (4+A_PtrSize+A_PtrSize))
- Lol, feels hopeless, maybe this is too deep magic for me.
- Highly appreciate if you can help me understand this :*)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement