Right, this time im trying to put the struct COORD into writeconsoleoutput - but compiler doesnt like it. My form is probably wrong but i dont know the right way of doing this:
bsize COORD <>
bcoord COORD <>
...
invoke WriteConsoleOutput, hOutput, OFFSET charArray, bsize, bcoord, OFFSET rect
...
Compiler, of course, doesnt like this:
error A2114: INVOKE argument type mismatch : argument : 4
error A2114: INVOKE argument type mismatch : argument : 3
COORD is a DWORD in length, and i want to push the whole thing basically. I dont want it to pass the pointer(i think this function actually returns an error if you do).
I can do this...
mov eax, bsize
mov ebx, bcoord
...
invoke WriteConsoleOutput, hOutput, OFFSET charArray, eax, eax, OFFSET rect
...
But i dont really want to do it like that especially as i know it can be done another way. Can someone let me know how to do this without moving to eax and ebx first?
Thanks :U
The problem is that COORD isn't a dword, it's a structure. The structure might be 4 bytes long, but it's a structure containing a dword, not a dword.
And if it is only a DWORD, then why are you defining it as a structure? You could do a typedef instead :wink
Anyway, to fix your problem, you should be pushing the dword component of the structure, not the whole structure:
COORD struct
p DWORD ?
COORD ends
.
.
invoke WriteConsoleOutput, hOutput, OFFSET charArray, bsize.p, bcoord.p, OFFSET rect
.
.
Thats the point - i want to push the whole structure and im asking how to do that. Ive had this working fine already doing it without using a variable(struct), just a constant.
Isnt the an easier way that that sloggish way.
something like:
invoke WriteConsoleOutput, hOutput, OFFSET charArray,DWORD bsize,DWORD bcoord, OFFSET rect
? - actually im gonna try that just now - ^^ seems a sensible way of doing it if i were making a compiler...
SWEEEEET!!!!!!! i figured it out :bg
Basically, olly gave me an idea and it worked a treat - unfortunately its pretty long and i dont know if theres a shorter way of saying the same thing;
invoke WriteConsoleOutput, hOutput, OFFSET charArray, DWORD PTR [bsize],DWORD PTR [bcoord], OFFSET rect
^^ compiles and works great :U
If you want to push a whole structure, you have to push it one dword at a time - there is no shorter way to do it.
(If it was huge, you might consider adjusting esp and copying the memory into the space - but it's still one dword at a time.)