Advertisement
Guest User

Untitled

a guest
Apr 12th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. [quote=nnnik post_id=272313 time=1555076629 user_id=74]
  2. 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.
  3.  
  4. 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.
  5. 96 bits equals 3 32 bit parameters.
  6.  
  7. As the documentation states:
  8. [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]
  9. That means the address in args points to the n-th parameter with args being the n-th parameter in the function definition.
  10. All methods have a hidden parameter named this - that means that args actually is the second parameter and not the first.
  11. Which is also the reason why it points to the second parameter passed along: Which appears to point to wParam.
  12. [/quote]
  13. Thanks for the reply.
  14. Understood something, but still having trouble understanding other stuff.
  15. Firstly I'd just like to say that I'm quite new to the concept of working with pointers.
  16.  
  17. [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]
  18. 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".
  19.  
  20. 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:
  21. 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).
  22. And then we get the second param, wParam, by just NumGetting from from offset 0, and third param by NumGetting from offset A_PtrSize.
  23.  
  24. 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.
  25.  
  26. Also, in the systemwide hook example, why is ParamCount set to 4?
  27. 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))
  28.  
  29.  
  30. Lol, feels hopeless, maybe this is too deep magic for me.
  31. Highly appreciate if you can help me understand this :*)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement