flat assembler
Message board for the users of flat assembler.
Index
> Windows > printf instead of API console func |
Author |
|
Tomasz Grysztar 26 Sep 2003, 10:39
Do you need that macro to be some interface for the "printf" function from CRT, or do you mean the whole procedure written in assembly, that will perform the task of "printf" function?
|
|||
26 Sep 2003, 10:39 |
|
HarryTuttle 26 Sep 2003, 11:15
the basic printf syntax which can simpy print a string %s or a digit %d and can be ended by \n makes me satisfied.
if I'll have to use another printf's option the simplest way will be to load it as module written i C. Am I wrong? but today I'll learn such exampe as "for" to understand how can I do anything ,because I know nothing about macros. _________________ Microsoft: brings power of yesterday to computers of today. |
|||
26 Sep 2003, 11:15 |
|
Eoin 26 Sep 2003, 17:27
To be honest I've only ever used sprintf, never the console version but I imagine the functionality is the same.
The printf functions are available in the crtdll.dll which comes with the versions of windows I'm aware of. So the simple solution is to write a macro which will call those functions. Basically all you need is a ccall or cinvoke macro. There are plenty of examples around but you say you wish to do this yourself. I'd recommend studying the stdcall and invoke macros you'll find in the Fasm examples and then try and convert them to cdecl. For extra info on calling conventions see http://www.codeproject.com/cpp/calling_conventions_demystified.asp Including strings among the parameters is possible thanks to the eqtype operator, again there are plenty of examples knocking around. |
|||
26 Sep 2003, 17:27 |
|
HarryTuttle 29 Sep 2003, 13:45
THX all of You ,I had no idea that crtdll.dll includes all I need.
API&DLL are powerful tools ,just I know the truth that without those tools I can't do any step forward. _________________ Microsoft: brings power of yesterday to computers of today. |
|||
29 Sep 2003, 13:45 |
|
Vortex 25 Oct 2003, 08:59
An example:
Code: format PE CONSOLE entry start include '%include%\win32a.inc' section '.data' data readable writeable msg db 'This is a printf example',0 format1 db '%s',0 section '.code' code readable executable start: cinvoke printf,format1,msg invoke ExitProcess,0 section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ crtdll,'crtdll.dll' import kernel32,\ ExitProcess,'ExitProcess' import crtdll,\ printf,'printf' _________________ Code it... That's all... |
|||
25 Oct 2003, 08:59 |
|
vid 27 Oct 2003, 05:58
What about using simple wsprintf from user32 (maybe kernel32)?
At has basic functionality |
|||
27 Oct 2003, 05:58 |
|
Eoin 27 Oct 2003, 15:02
The advantage with sprintf is that it handles floating points unlike wsprintf.
|
|||
27 Oct 2003, 15:02 |
|
HarryTuttle 27 Oct 2003, 15:27
but this is better and faster for W_9x only.
W_NT use UNICODE so there is w font in sprintf,it means wild-16bit characters intead of ASCII codes. W_NT always translate ASCII to UNICODE ! _________________ Microsoft: brings power of yesterday to computers of today. |
|||
27 Oct 2003, 15:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.