Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

@WINAPI with a void WINAPI?

May
12,795
158
In another thread, I mentioned
Code:
echo %@winapi[shell32.dll,SHChangeNotify,%@eval[0x8000000],%@eval[0x1000],0,0] > nul
for refreshing the desktop. It works with no apparent ill effects. The value of @WINAPI is 1975412412 but SHChangeNotify is of type void. I'm wondering what goes on inside TCC when I use @WINAPI with a function of void type. Is there a chance of corruption?
 
No. You're just going to have random values returned as the result.
I'm sure the value has little meaning, but I wouldn't call it random. It's the same in all TCCs back to v12. V11 hangs after that command.
 
It's simply whatever is on the stack at the time. It will vary depending on what was done previously. But it will always be meaningless.
It seems to always be 1975412412, regardless of what was done previously or TCC version. And that's what I meant ... popping something off the stack when you shouldn't ... no problem with that?
 
You're not popping anything off the stack, you're just referencing a value on the stack. If you tried to use it as a pointer, it would be bad. Otherwise, it's utterly meaningless.
OK, that's comforting. What would happen if you used @WINAPI with something like GetTickCount64()? Would you get only the low DWORD of the ULONGLONG return value?
 
Back
Top