flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved] sprintf did exist variant pointer to array ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1823
Roman 10 Jan 2021, 13:34
I know this.
cinvoke sprintf,str, "%s %d %s", "one", 2, "3"

But i need dynamic changed parameters !
And i search somthing like this:
Code:
pParams dd pTxt1,pInt1,pInt2
pTxt1 db 'one',0
pInt1 dd 2
pInt2 dd 3

cinvoke sprintf,str, "%s %d %d", pParams
    

I don`t want do loop:
for (i = 0; i<3; i++)
sprintf("%d ", pParams[i]);
Post 10 Jan 2021, 13:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20425
Location: In your JS exploiting you and your system
revolution 10 Jan 2021, 13:51
Read about vsprintf

BTW: This isn't Windows related, it is about the C runtime library.
Post 10 Jan 2021, 13:51
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1823
Roman 10 Jan 2021, 14:24
Thanks.
This is what i wanted.
Post 10 Jan 2021, 14:24
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 10 Jan 2021, 14:48
by the way why so exotic as sprintf?
why not user32.dll.wsprintfA? user32.dll.wsprintfW?
or with varargs user32.dll.wvsprintfA? user32.dll.wvsprintfW?
in user32.dll more faster variant
Post 10 Jan 2021, 14:48
View user's profile Send private message Send e-mail Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1823
Roman 10 Jan 2021, 18:50
wvsprintfA
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-wvsprintfa
The buffer that is to receive the formatted output. The maximum size of the buffer is 1,024 bytes.

Hm. Strange why only 1 024 bytes ?
Post 10 Jan 2021, 18:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20425
Location: In your JS exploiting you and your system
revolution 10 Jan 2021, 23:49
Roman wrote:
Hm. Strange why only 1 024 bytes ?
Ask MS, they decided it.
Post 10 Jan 2021, 23:49
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1660
Location: Toronto, Canada
AsmGuru62 11 Jan 2021, 04:32
Also, wsprintf() does not format floating point values, but sprintf() does.
Post 11 Jan 2021, 04:32
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.