| 07-31-2008, 10:23 PM | #1 |
Today i was a little curious about how C2I works. So i wrote a simple script to test a few things. Script Let alone C2I returns values in the dimension of x*10^8, the numbers seem to be completely random (asides from always being even numbers). Comparing two C2I on different functions reveals that they are always very close together, so the randomness of those values cant be proven. I tried changing the code inside the functions (the upper functin for instance) and noticed a change in the difference. Adding whitespaces, empty lines or comments changed nothing, only compiled statements led to a change. The change was always a factor of 8. Adding return adds 8. set i=0 led to a change of 16; the name of the variable had no effect on the change; changing the value form 0 to 1 also made no difference. Another interesting thing is the fact that using set i=func(), where func() only returns 0, led to the same total change. set i=i+1 added 48. I went on and added some calls. call I2S(123456) added 24 to the difference, calling a function with no parameters added 16. After that i declared a function between the compared ones and noticed a change of 24. Declaring a local without initializing it added 8 to the difference; initializing it added 24. I concluded that C2I returns the point in your RAM, where the function is declared, though i can't really back my claim up. I suggest someone also test this and reports about his findings. Deaod |
| 07-31-2008, 10:43 PM | #2 |
While we're on the subject, I2C can be used, with the correct integer, offset by a certain amount from the start of a function (from C2I), to jump to a line of code in a function. It can also jump to half way through a line, which may have varying results, from not accessing a variable (returning null), or crashing WC3. |
| 07-31-2008, 10:48 PM | #3 |
Using rb on code type deadly for map. |
| 07-31-2008, 10:50 PM | #4 | |
Quote:
So, if I start two instances of Warcraft III on the same computer, it is possible to cross-run functions (with the right integer value for the code, ofc)? :P |
| 07-31-2008, 10:51 PM | #5 |
On another note, C2I is an asynchronous function. Tested it just now with some friends. |
| 07-31-2008, 10:55 PM | #6 |
Themerion You will get access violation if you try this, memory of apps is protected by OS. |
| 07-31-2008, 10:56 PM | #7 |
Damn! |
