sp; // reply data size reserved: word; data: pointer; // pointer to reply data buffer options: tipoptioninformation; // reply options end;
ticmpcreatefile = function: thandle; stdcall; ticmpclosehandle = function(icmphandle: thandle): boolean; stdcall; ticmpsendecho = function( icmphandle: thandle; destinationaddress: dword; requestdata: pointer; requestsize: word; requestoptions: pipoptioninformation; replybuffer: pointer; replysize: dword; timeout: dword ): dword; stdcall;
const size = 32; timeout = 1000; var wsadata: twsadata; address: dword; // address of host to contact hostname, hostip: string; // name and dotted ip of host to contact phe: phostent; // hostentry buffer for name lookup buffersize, npkts: integer; preqdata, pdata: pointer; pipe: picmpechoreply; // icmp echo reply buffer ipopt: tipoptioninformation; // ip options for packet to send const icmpdll = 'icmp.dll'; var hicmplib: hmodule; icmpcreatefile : ticmpcreatefile; icmpclosehandle: ticmpclosehandle; icmpsendecho: ticmpsendecho; hicmp: thandle; // handle for the icmp calls begin // initialise winsock result:=true; if wsastartup(2,wsadata) <> 0 then begin result:=false; halt; end; // register the icmp.dll stuff hicmplib := loadlibrary(icmpdll); if hicmplib <> null then begin @icmpcreatefile := getprocaddress(hicmplib, 'icmpcreatefile'); @icmpclosehandle:= getprocaddress(hicmplib, 'icmpclosehandle'); @icmpsendecho:= getprocaddress(hicmplib, 'icmpsendecho'); if (@icmpcreatefile = nil) or (@i |