Modified IcmpCloseHandle and IcmpSendEchoRequest so that we don't
crash if the handle is INVALID_HANDLE_VALUE.
This commit is contained in:
parent
9dd9743b60
commit
cb9c964952
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue