我正在尝试使用 masm32 创建一个“套接字”,但是 accept() 有问题,当代码尝试执行 accept() 时,ollydbg 向我显示访问冲突,我不知道出了什么问题,有人能告诉我吗请问我该如何解决?
.686
.model flat, stdcall
option casemap:none
extrn ExitProcess@4:PROC
extrn WSAStartup@8:PROC
extrn socket@12:PROC
extrn bind@12:PROC
extrn listen@8:PROC
extrn accept@12:PROC
WSADATA STRUCT 8
wVersion WORD ?
wHighVersion WORD ?
iMaxSocket WORD ?
iMaxUdpDg WORD ?
lpVendorInfo DWORD ?
szDescription SBYTE 257 dup (?)
szSystemStatus SBYTE 129 dup (?)
WSADATA ENDS
sockaddr STRUCT
sa_family WORD ?
sa_port WORD ?
sa_addr DWORD ?
BYTE 8 dup (?)
sockaddr ENDS
.const
address sockaddr<2, 0B922h, 00000000h>
sbuff BYTE 50 dup (0)
.data?
wsadata WSADATA <>
Socket DWORD ?
.code
Start proc
push ebp
mov ebp, esp
lea edx, wsadata
push edx
push 2h
call WSAStartup@8
push 0h
push 1h
push 2h
call socket@12
mov Socket, eax
push 16h
lea ecx, address
push ecx
push Socket
call bind@12
push 1h
push Socket
call listen@8
push 16h
lea ecx, address
push ecx
push Socket
call accept@12
mov eax, 0
call ExitProcess@4
mov esp, ebp
pop ebp
Start endp
END
问候