[Bug 29164] Swap buffers in GetAcceptExSockaddrs (WS2_async_accept).

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Nov 25 13:03:36 CST 2011


http://bugs.winehq.org/show_bug.cgi?id=29164

--- Comment #3 from acDev <admin at myac.msk.ru> 2011-11-25 13:03:36 CST ---
(In reply to comment #1)
> Sorry to bother, it may be obvious to you but can you elaborate a bit more
> about it? What program is affected and how did you reach that conclusion? I
> really would like to understand and others less experienced like me might find
> it helpful too.

My console IOCP server is used under windows (XP and later) and under wine
(1.3.12 and later).
I had to do specifically for the wine option in config file that allows you to
read remote_addr from different positions. 
Here is my code:

procedure TIOCPServer.ExtractAddresses(ChangeAddr: Boolean = False);
var
  PLoc, PRem: PSockAddrIn;
  LLoc, LRem: integer;
begin
  Server.FGetAcceptExSockaddrs(FRecvBuf, FAddrOffset, Addr_Buf_Len,
Addr_Buf_Len, PLoc, LLoc, PRem, LRem);
  FillChar(FLocalAddr,  SizeOf(FLocalAddr),  0);
  FillChar(FRemoteAddr, SizeOf(FRemoteAddr), 0);
  if ChangeAddr then begin  
    // this is for WINE only !!!
    if SizeOf(FLocalAddr)  = LRem then FLocalAddr  := PRem^; 
    if SizeOf(FRemoteAddr) = LLoc then FRemoteAddr := PLoc^;
  end else begin
    if SizeOf(FLocalAddr)  = LLoc then FLocalAddr  := PLoc^;
    if SizeOf(FRemoteAddr) = LRem then FRemoteAddr := PRem^;
  end;  
end;

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list