Can you indicate which line the compiler is complaining about - as I don't have the rest of
Code:
pushad
//Move ZChatOutputAddress into eax
mov eax,ZChatOutputAddress
//Push 0xFFFFFFFF onto the stack
PUSH 0xFFFFFFFF
//Push 0 onto the stack
PUSH 0
//Push 2 onto the stack
PUSH 2
//Push szBuf onto the stack
PUSH dword ptr szBuf
//Call ZChatOutput
call eax
//Cleanup the stack by adding the size of bytes pushed on the stack
add esp,16
popad
Do you think your comments like "move ZChatOutputAddress into eax" actually adds anything useful?
Or "push 0xFFFFFFFF onto the stack" - where else would we be pushing it?
If someone doesn't at all understand assembly language, the effect/purpose of pushing something onto somehting else is pretty much lost anyways, so you are just telling people who don't know something they can't understand, and those who DO know something that is obvious from reading the assembler instructions anyways.
I'm 99% sure that you don't need to use pushad/popad around your call, unless ZChatOutput isn't a C function.
The call ZChatOutput comment is meaningfull to some extent, in case you have forgotten what eax was loaded with about 4 lines [not counting meaningless commments] above.
And of course, I still see ABSOLUTELY no reason why you are doing this in assembler rather than plain C or C++.
The above code can be written as:
Code:
...
void (__cdecl *func)(char *szBuf, int a, int b, int c); // I don't know what the three integer arguments are, so I just named them pointless names.
...
func = ZChatOutput;
func(szBuf, 2, 0, -1);
}
--
Mats