Jump to content
Tuts 4 You

Wsprintf


Fungus

Recommended Posts

Posted

I am wondering how to use wsprintf in asm... when I do

invoke wsprintf,bufOutput,concat,string1,string2

masm spits out some weird code...

bufOutput is a 400h byte buffer, concat is "%s%s" , and string1 and string2...

Posted

You need to use addresses. i.e.:

invoke wsprintf, addr bufOutput, addr concat, addr string1, addr string2

Or you could use :

invoke lstrcat, addr string1, addr string2

invoke lstrcpy, addr bufOutput, addr string 1

Hope that helps mate :)

Posted

also pay attention to the fact that its a c style api, NOT stdcall like 99.9% of the other windows api's, so YOU have to balance the stack after calling it... (add esp, (4* amount_of_parameters_passed)...

Posted

Actually by using the INVOKE directive, MASM should correctly handle the stack balancing (the wsprintf prototype in MASM32 uses the C calling convention).

But if you push the parameters manually and use CALL , then what evlncrn8 said applies.

Posted

Thanks guys, working nicely :)

Posted

After your last few questions I'm intrigued as to what you are coding :)

Posted
After your last few questions I'm intrigued as to what you are coding :)

you'll see soon :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...