FASM CODE:
format MS COFF
include '%fasminc%\win32a.inc'
public _crypt
section '.text' code readable executable
proc _crypt, text:DWORD
lea eax,dword[text]
push eax
lop:
xor byte[eax],8
inc eax
cmp byte[eax],0
jnz lop
pop eax
ret
endp
C CODE:
#include <stdio.h>
int main() {
char *text="hello";
crypt(text);
puts(text);
system("Pause>nul");
return 0;
}
to build:
fasm crypt.asm
gcc -c prog.c
gcc prog.o crypt.obj -o prog.exe
What I'm trying to do is making a procedure in fasm to call from C to crypt texts. But it seems that I don't know how to get the address or something. Could you check this out for me, please?
Sometimes it gives me memory error and sometimes doesn't, but never works.
Thanks!