flat assembler
Message board for the users of flat assembler.
Index
> Windows > How Can I use the C runtime library with FASM like memcpy? |
Author |
|
Walter 02 May 2014, 04:29
Here is one way:
Code: ;*************** ;*mikawawa.asm * ;*************** format pe console entry start include 'win32ax.inc' section '.data' data readable writeable strName1 db 'mikawawa',0 strName2 rb 32 section '.code' code readable executable start: cinvoke memcpy,strName2,strName1,3 cinvoke memcpy,strName2+3,strName1+3,6 cinvoke printf,'%s%c%c',strName2,0x0d,0x0a cinvoke strlen,strName2 cinvoke printf,'Length of string is: %d',eax invoke ExitProcess,0 section '.idata' import data readable library kernel32,'KERNEL32.DLL',\ msvcrt,'MSVCRT.DLL' import kernel32,\ ExitProcess,'ExitProcess' import msvcrt,\ memcpy,'memcpy',\ strlen,'strlen',\ printf,'printf' |
|||
02 May 2014, 04:29 |
|
mikawawa 02 May 2014, 05:06
Walter wrote: Here is one way: thank you very much, bro. I checked the FASM api directory and I didnt find the msvcrt.inc, so I thought I couldnt import the CRT functions directly. thanks again |
|||
02 May 2014, 05:06 |
|
mikawawa 02 May 2014, 05:18
BTW, in msdn there is a function called CopyMemory, but it is not imported from any library, if I want to use it with FASM, what should I do?
|
|||
02 May 2014, 05:18 |
|
revolution 02 May 2014, 06:03
mikawawa wrote: BTW, in msdn there is a function called CopyMemory, but it is not imported from any library, if I want to use it with FASM, what should I do? Code: rep movsb ;<--- copy memory |
|||
02 May 2014, 06:03 |
|
mikawawa 02 May 2014, 06:36
revolution wrote:
OK, I knew that. thanks all the same. |
|||
02 May 2014, 06:36 |
|
JohnFound 02 May 2014, 07:13
mikawawa wrote: OK, I knew that. thanks all the same. Using external functions is of course important, for example for interfacing with the OS, but it should not be overused. Try to make the simple tasks in assembly way. It will be simpler, smaller and more readable. As always, the balance is important. _________________ Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9 |
|||
02 May 2014, 07:13 |
|
AsmGuru62 02 May 2014, 14:20
I think CopyMemory is a macro... I may be wrong, however.
|
|||
02 May 2014, 14:20 |
|
revolution 02 May 2014, 14:25
AsmGuru62 wrote: I think CopyMemory is a macro... I may be wrong, however. http://msdn.microsoft.com/en-us/library/windows/desktop/aa366535%28v=vs.85%29.aspx |
|||
02 May 2014, 14:25 |
|
mikawawa 03 May 2014, 01:07
revolution wrote:
Oh, damn it! I didn't check it online, because I have a local msdn, although it is a little older, but I thought it might not be much more different. Well, seems I was totally wrong, thank you, bro. I really appreciate it! |
|||
03 May 2014, 01:07 |
|
revolution 03 May 2014, 01:26
mikawawa wrote: ... bro ... |
|||
03 May 2014, 01:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.