Cast both parts of a FILETIME to guint32, as I think DWORD is signed.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 26 Apr 2009 22:24:48 +0000 (22:24 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 26 Apr 2009 22:24:48 +0000 (22:24 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28166 f5534014-38df-0310-8fa8-9805f1628bb7

pcapio.c

index b8ff11a36b073770ef29e80b6594087230a14450..b11dad00ca641a30831318bdfca95e8fa022c07c 100644 (file)
--- a/pcapio.c
+++ b/pcapio.c
@@ -426,9 +426,13 @@ libpcap_write_interface_statistics_block(FILE *fp,
        /*
         * Current time, represented as 100-nanosecond intervals since
         * January 1, 1601, 00:00:00 UTC.
+        *
+        * I think DWORD might be signed, so cast both parts of "now"
+        * to guint32 so that the sign bit doesn't get treated specially.
         */
        GetSystemTimeAsFileTime(&now);
-       timestamp = ((guint64)now.dwHighDateTime) << 32 + now.dwLowDateTime;
+       timestamp = ((guint64)(guint32)now.dwHighDateTime) << 32 +
+           (guint32)now.dwLowDateTime;
 
        /*
         * Convert to same thing but as 1-microsecond, i.e. 1000-nanosecond,