-=-=-=-=-=-=-=-=-=-=-= Winsock 2 Bug (I think so) =-=-=-=-=-==-=-=-=-=

Program: Winsock 2.0 DLL (ws2_32.dll)
Version: 2.0 (of course)
Company: I dunno...

Bug Description:

	This is another bug which I discover when I was writing
IntHook2. We all know that the 'send' API only tells you which
socket to send the data to, but not the host name which is going
to receive the sent data... When it comes to web activity hooking,
the socket parameter is totally meaningless ( by looking at the
hSocket itself, you never know what host is connected to the socket).
(This bug, again occurs when calling 'send' offline).

	So, I tried to call getpeername and gethostbyname to retrieve
the host name and... tada! SoftIce roars: "General Protection Fault...",
next Windoze says: "An illegal operation has occured at xxxx:xxxxxxxx...".
The ugly message again... 

	After repeating the crash ( I crash my comp once again 
purposely! ), I found out the the crash occurs some where in the
vast sea of code when this is executed (says SoftIce):

	.
	.
	mov	eax,[esi]
	.
	.

	Anyway, I don't understand what the bulk of code was doing,
I just know that it always crashes my Windoze 98 at that instruction.

	Well, if we look up our beloved API reference, it says
that if the socket is not connected, getpeername should return 
SOCKET_ERROR, and WSAGetLastError will return WSAE_NOTCONN (WSA
Error - Not Connected ). So it looks like that Winsock 2 fails to
return the SOCKET_ERROR value...

	Let's hope that those people who maintain winsock will
correct this problem... Anyway, cheers to them, they make internet
programming much more easier than the DOS old days, where we have
to deal with modems, network cards and all those semi-god jobs...
In winsock, we don't care how the computer is connected to the 
internet/network.

Author: OCY
e-mail: chuonyuen_ooi@yahoo.com
homepage: http://www.geocities.com/chuonyuen_ooi/

