Dmitry Timoshkov : windowscodecs: Fix handling of 8-byte IFD fields.

Alexandre Julliard julliard at winehq.org
Thu Jun 21 15:03:41 CDT 2012


Module: wine
Branch: master
Commit: 722cb46c052892b166bcf9d9f017b07124d05a16
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=722cb46c052892b166bcf9d9f017b07124d05a16

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Jun 21 11:20:46 2012 +0900

windowscodecs: Fix handling of 8-byte IFD fields.

---

 dlls/windowscodecs/metadatahandler.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c
index 5770e12..cf356de 100644
--- a/dlls/windowscodecs/metadatahandler.c
+++ b/dlls/windowscodecs/metadatahandler.c
@@ -649,7 +649,6 @@ HRESULT UnknownMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, vo
 #define SWAP_ULONG(x) do { if (!native_byte_order) (x) = RtlUlongByteSwap(x); } while(0)
 #define SWAP_ULONGLONG(x) do { if (!native_byte_order) (x) = RtlUlonglongByteSwap(x); } while(0)
 
-#include "pshpack2.h"
 struct IFD_entry
 {
     SHORT id;
@@ -658,13 +657,6 @@ struct IFD_entry
     LONG  value;
 };
 
-struct IFD_rational
-{
-    LONG numerator;
-    LONG denominator;
-};
-#include "poppack.h"
-
 #define IFD_BYTE 1
 #define IFD_ASCII 2
 #define IFD_SHORT 3
@@ -840,16 +832,24 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
     case IFD_DOUBLE:
         if (count == 1)
         {
-            struct IFD_rational rational;
+            ULONGLONG ull;
 
             pos.QuadPart = value;
             hr = IStream_Seek(input, pos, SEEK_SET, NULL);
             if (FAILED(hr)) return hr;
 
-            hr = IStream_Read(input, &rational, sizeof(rational), NULL);
+            hr = IStream_Read(input, &ull, sizeof(ull), NULL);
             if (FAILED(hr)) return hr;
-            item->value.u.uhVal.QuadPart = ((LONGLONG)rational.denominator << 32) | rational.numerator;
-            SWAP_ULONGLONG(item->value.u.uhVal.QuadPart);
+
+            item->value.u.uhVal.QuadPart = ull;
+
+            if (type == IFD_DOUBLE)
+                SWAP_ULONGLONG(item->value.u.uhVal.QuadPart);
+            else
+            {
+                SWAP_ULONG(item->value.u.uhVal.u.LowPart);
+                SWAP_ULONG(item->value.u.uhVal.u.HighPart);
+            }
             break;
         }
         FIXME("loading multiple rational fields is not implemented\n");




More information about the wine-cvs mailing list