reactos/lib/icmp
diff -u -r1.1 -r1.2
--- icmp_main.c 28 Sep 2004 19:07:56 -0000 1.1
+++ icmp_main.c 7 Dec 2004 22:32:28 -0000 1.2
@@ -135,34 +135,6 @@
return(answer);
}
-/* A private gettimeofday without the timezone parameter
- * to support building on Windows as well as Unix.
- */
-
-#ifndef __GNUC__
-#define EPOCHFILETIME (116444736000000000i64)
-#else
-#define EPOCHFILETIME (116444736000000000LL)
-#endif
-
-static int icmp_gettimeofday(struct timeval *tv)
-{
- FILETIME ft;
- LARGE_INTEGER li;
- __int64 t;
-
- GetSystemTimeAsFileTime(&ft);
- li.LowPart = ft.dwLowDateTime;
- li.HighPart = ft.dwHighDateTime;
- t = li.QuadPart; /* In 100-nanosecond intervals */
- t -= EPOCHFILETIME; /* Offset to the Epoch time */
- t /= 10; /* In microseconds */
- tv->tv_sec = (long)(t / 1000000);
- tv->tv_usec = (long)(t % 1000000);
-
- return 0;
-}
-
/*
* Exported Routines.
*/
@@ -235,7 +207,8 @@
int ip_header_len;
int maxlen;
fd_set fdr;
- struct timeval timeout,send_time,recv_time;
+ struct timeval timeout;
+ DWORD send_time,recv_time;
struct sockaddr_in addr;
int addrlen;
unsigned short id,seq,cksum;
@@ -338,7 +311,7 @@
}
#endif
- icmp_gettimeofday(&send_time);
+ send_time = GetTickCount();
res=sendto(icp->sid, reqbuf, reqsize, 0, (struct sockaddr*)&addr, sizeof(addr));
HeapFree(GetProcessHeap (), 0, reqbuf);
if (res<0) {
@@ -363,7 +336,7 @@
/* Get the reply */
ip_header_len=0; /* because gcc was complaining */
while ((res=select(icp->sid+1,&fdr,NULL,NULL,&timeout))>0) {
- icmp_gettimeofday(&recv_time);
+ recv_time = GetTickCount();
res=recvfrom(icp->sid, (char*)ip_header, maxlen, 0, (struct sockaddr*)&addr,&addrlen);
TRACE("received %d bytes from %s\n",res, inet_ntoa(addr.sin_addr));
ier->Status=IP_REQ_TIMED_OUT;
@@ -457,18 +430,16 @@
* Decrease the timeout so that we don't enter an endless loop even
* if we get flooded with ICMP packets that are not for us.
*/
- timeout.tv_sec=Timeout/1000-(recv_time.tv_sec-send_time.tv_sec);
- timeout.tv_usec=(Timeout % 1000)*1000+send_time.tv_usec-(recv_time.tv_usec-send_time.tv_usec);
- if (timeout.tv_usec<0) {
- timeout.tv_usec+=1000000;
- timeout.tv_sec--;
- }
+ int t = Timeout - (recv_time - send_time);
+ if (t < 0) t = 0;
+ timeout.tv_sec = t / 1000;
+ timeout.tv_usec = (t % 1000) * 1000;
continue;
} else {
/* This is a reply to our packet */
memcpy(&ier->Address,&ip_header->ip_src,sizeof(IPAddr));
/* Status is already set */
- ier->RoundTripTime=(recv_time.tv_sec-send_time.tv_sec)*1000+(recv_time.tv_usec-send_time.tv_usec)/1000;
+ ier->RoundTripTime= recv_time - send_time;
ier->DataSize=res-ip_header_len-ICMP_MINLEN;
ier->Reserved=0;
ier->Data=endbuf-ier->DataSize;
reactos/lib/icmp
diff -u -r1.1 -r1.2
--- winehq2ros.patch 28 Sep 2004 19:07:56 -0000 1.1
+++ winehq2ros.patch 7 Dec 2004 22:32:28 -0000 1.2
@@ -1,10 +1,10 @@
-Index: dlls/icmp/Makefile.in
+Index: Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/icmp/Makefile.in,v
retrieving revision 1.13
diff -u -r1.13 Makefile.in
---- dlls/icmp/Makefile.in 11 Oct 2003 01:09:19 -0000 1.13
-+++ dlls/icmp/Makefile.in 23 Sep 2004 02:56:40 -0000
+--- Makefile.in 11 Oct 2003 01:09:19 -0000 1.13
++++ Makefile.in 7 Dec 2004 22:39:27 -0000
@@ -4,6 +4,7 @@
VPATH = @srcdir@
MODULE = icmp.dll
@@ -13,80 +13,13 @@
C_SRCS = icmp_main.c
-Index: dlls/icmp/icmp_main.c
-===================================================================
-RCS file: /home/wine/wine/dlls/icmp/icmp_main.c,v
-retrieving revision 1.26
-diff -u -r1.26 icmp_main.c
---- dlls/icmp/icmp_main.c 12 Apr 2004 23:15:12 -0000 1.26
-+++ dlls/icmp/icmp_main.c 23 Sep 2004 03:53:26 -0000
-@@ -95,7 +95,6 @@
- #include "ip.h"
- #include "ip_icmp.h"
-
--
- WINE_DEFAULT_DEBUG_CHANNEL(icmp);
-
-
-@@ -136,7 +135,33 @@
- return(answer);
- }
-
-+/* A private gettimeofday without the timezone parameter
-+ * to support building on Windows as well as Unix.
-+ */
-+
-+#ifndef __GNUC__
-+#define EPOCHFILETIME (116444736000000000i64)
-+#else
-+#define EPOCHFILETIME (116444736000000000LL)
-+#endif
-
-+static int icmp_gettimeofday(struct timeval *tv)
-+{
-+ FILETIME ft;
-+ LARGE_INTEGER li;
-+ __int64 t;
-+
-+ GetSystemTimeAsFileTime(&ft);
-+ li.LowPart = ft.dwLowDateTime;
-+ li.HighPart = ft.dwHighDateTime;
-+ t = li.QuadPart; /* In 100-nanosecond intervals */
-+ t -= EPOCHFILETIME; /* Offset to the Epoch time */
-+ t /= 10; /* In microseconds */
-+ tv->tv_sec = (long)(t / 1000000);
-+ tv->tv_usec = (long)(t % 1000000);
-+
-+ return 0;
-+}
-
- /*
- * Exported Routines.
-@@ -313,7 +338,7 @@
- }
- #endif
-
-- gettimeofday(&send_time,NULL);
-+ icmp_gettimeofday(&send_time);
- res=sendto(icp->sid, reqbuf, reqsize, 0, (struct sockaddr*)&addr, sizeof(addr));
- HeapFree(GetProcessHeap (), 0, reqbuf);
- if (res<0) {
-@@ -338,7 +363,7 @@
- /* Get the reply */
- ip_header_len=0; /* because gcc was complaining */
- while ((res=select(icp->sid+1,&fdr,NULL,NULL,&timeout))>0) {
-- gettimeofday(&recv_time,NULL);
-+ icmp_gettimeofday(&recv_time);
- res=recvfrom(icp->sid, (char*)ip_header, maxlen, 0, (struct sockaddr*)&addr,&addrlen);
- TRACE("received %d bytes from %s\n",res, inet_ntoa(addr.sin_addr));
- ier->Status=IP_REQ_TIMED_OUT;
-Index: dlls/icmp/ip.h
+Index: ip.h
===================================================================
RCS file: /home/wine/wine/dlls/icmp/ip.h,v
retrieving revision 1.3
diff -u -r1.3 ip.h
---- dlls/icmp/ip.h 6 Jan 2004 22:08:34 -0000 1.3
-+++ dlls/icmp/ip.h 23 Sep 2004 03:43:22 -0000
+--- ip.h 6 Jan 2004 22:08:34 -0000 1.3
++++ ip.h 7 Dec 2004 22:39:27 -0000
@@ -39,6 +39,21 @@
*/
#define IPVERSION 4