Jump to content
Tuts 4 You

Wsprintf


Fungus

Recommended Posts

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...

Link to comment

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 :)

Link to comment

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)...

Link to comment

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.

Link to comment

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...