L
lussy
Unregistered / Unconfirmed
GUEST, unregistred user!
本人最近在写一个spi的过滤程序,出于对delphi的喜爱,我试着用delphi来实现,wspstartup已经转化成功,目前在转化wsprecv时遇到了一些问题,请各位大虾救命!
以下是部分的源程序,请各位指教,万分感谢!!!
procedure COMPLETION_ROUTINE(dwError:dword;cbTransferred:dword;lpOverlappedWSAOVERLAPPED;dwFlags:dword);stdcall;
begin
end;
function WSPRECV(s:Tsocket;var lpBuffers:Twsabuf;dwBufferCount:dword;var lpNumberOfBytesRecvd:dword;var lpFlags:dword;lpOverlappedWSAOVERLAPPED;lpCompletionRoutine:TWSAOVERLAPPED_COMPLETION_ROUTINE;lpThreadIdWSATHREADID;var lpErrno:integer):integer;pascal;
begin
issetcompletionroutine:=false;
if assigned(lpOverlapped) then
begin
if assigned(lpCompletionRoutine) then
begin
issetcompletionroutine:=true;
lpCompletionRoutine:=COMPLETION_ROUTINE; //该行代码加
//上后回调函数出错,哪位知道错在什么地方?
end;
end;
iret:=TWSPRECV(NextProcTable.LPWSPRecv)(s,lpBuffers,dwBufferCount,lpNumberOfBytesRecvd,lpFlags,lpOverlapped,lpCompletionRoutine,lpThreadId,lpErrno);
if (iret=socket_error) or (issetcompletionroutine=true) then
begin
result:=iret;
exit;
end;
result:=iret;
end;
以下是部分的源程序,请各位指教,万分感谢!!!
procedure COMPLETION_ROUTINE(dwError:dword;cbTransferred:dword;lpOverlappedWSAOVERLAPPED;dwFlags:dword);stdcall;
begin
end;
function WSPRECV(s:Tsocket;var lpBuffers:Twsabuf;dwBufferCount:dword;var lpNumberOfBytesRecvd:dword;var lpFlags:dword;lpOverlappedWSAOVERLAPPED;lpCompletionRoutine:TWSAOVERLAPPED_COMPLETION_ROUTINE;lpThreadIdWSATHREADID;var lpErrno:integer):integer;pascal;
begin
issetcompletionroutine:=false;
if assigned(lpOverlapped) then
begin
if assigned(lpCompletionRoutine) then
begin
issetcompletionroutine:=true;
lpCompletionRoutine:=COMPLETION_ROUTINE; //该行代码加
//上后回调函数出错,哪位知道错在什么地方?
end;
end;
iret:=TWSPRECV(NextProcTable.LPWSPRecv)(s,lpBuffers,dwBufferCount,lpNumberOfBytesRecvd,lpFlags,lpOverlapped,lpCompletionRoutine,lpThreadId,lpErrno);
if (iret=socket_error) or (issetcompletionroutine=true) then
begin
result:=iret;
exit;
end;
result:=iret;
end;