Modified IcmpCloseHandle and IcmpSendEchoRequest so that we don't

crash if the handle is INVALID_HANDLE_VALUE.
This commit is contained in:
Francois Gouget 1999-12-25 22:46:22 +00:00 committed by Alexandre Julliard
parent 9dd9743b60
commit cb9c964952
1 changed files with 11 additions and 0 deletions

View File

@ -182,6 +182,11 @@ HANDLE WINAPI IcmpCreateFile(VOID)
BOOL WINAPI IcmpCloseHandle(HANDLE IcmpHandle)
{
icmp_t* icp=(icmp_t*)IcmpHandle;
if (IcmpHandle==INVALID_HANDLE_VALUE) {
/* FIXME: in fact win98 seems to ignore the handle value !!! */
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
ISOCK_shutdown(icp->sid,2);
free(icp);
@ -217,6 +222,12 @@ DWORD WINAPI IcmpSendEcho(
unsigned short id,seq,cksum;
int res;
if (IcmpHandle==INVALID_HANDLE_VALUE) {
/* FIXME: in fact win98 seems to ignore the handle value !!! */
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
if (ReplySize<sizeof(ICMP_ECHO_REPLY)+ICMP_MINLEN) {
SetLastError(IP_BUF_TOO_SMALL);
return 0;