I tried to make a "socket" with masm, I used Visual Studio 2012 because is the IDE for C/C++ and asm
I made a code with nasm and MinGW for 32 bits, but I tried to do the same code but this time for 64 bits with masm and it doesn't work.
Somebody can explian me how use a call in masm for 64 bits, because normally write something like this.
mov [dir], rax
call [dir]
and I can't use it in masm
this is my code, i hope somebody can explian me how use call, please.
extrn LoadLibraryA:PROC
extrn ExitProcess:PROC
extrn GetProcAddress:PROC
.data
wstart db 400 dup (0)
wsdll db 'ws2_32.dll',0
wsaddr dq ?
WStp db 'WSAStartup',0
wstaddr dq ?
soc db 'socket',0
socaddr dq ?
conn db 'connect',0
conaddr dq ?
sen db 'send',0
senaddr dq ?
sre db "hola mundo",0
error db "%d", 10,0
.code
Start proc
push rbp
mov rbp, rsp
mov rdx, offset[wsdll]
call LoadLibraryA
mov[wsaddr], rax
mov r8, offset[WStp]
mov r9, [wsaddr]
call GetProcAddress
mov[wstaddr], rax
push qword ptr[wstart]
push 2
call [wstaddr]
mov r8, offset[soc]
mov r9, offset[wsaddr]
call GetProcAddress
mov[wstaddr], rax
push 0
push 1
push 2
call [wstaddr]
mov[socaddr], rax
mov r8, offset[conn]
mov r9, offset[wsaddr]
call GetProcAddress
mov[conaddr], rax
push 16
xor rax, rax
mov rax, 0100007f5c110002h
push rax
push qword ptr[socaddr]
call [conaddr]
mov r8, offset[sen]
mov r9, offset[wsaddr]
call GetProcAddress
mov[senaddr], rax
push 0
push 512
mov rcx, offset [sre]
push rcx
push qword ptr[socaddr]
call [senaddr]
xor ecx, ecx
call ExitProcess
mov rsp, rbp
pop rbp
Start endp
End