[PATCH 2/3] oleaut32: BSTRs should have 8 byte alignment on 64 bits.

Huw Davies huw at codeweavers.com
Thu Jan 21 04:29:50 CST 2016


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/oleaut32/oleaut.c        | 3 +++
 dlls/oleaut32/tests/vartype.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c
index 8a22c2e..07db9ff 100644
--- a/dlls/oleaut32/oleaut.c
+++ b/dlls/oleaut32/oleaut.c
@@ -84,6 +84,9 @@ static CRITICAL_SECTION_DEBUG cs_bstr_cache_dbg =
 static CRITICAL_SECTION cs_bstr_cache = { &cs_bstr_cache_dbg, -1, 0, 0, 0, 0 };
 
 typedef struct {
+#ifdef _WIN64
+    DWORD pad;
+#endif
     DWORD size;
     union {
         char ptr[1];
diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c
index d905d37..f7df9c5 100644
--- a/dlls/oleaut32/tests/vartype.c
+++ b/dlls/oleaut32/tests/vartype.c
@@ -5398,9 +5398,12 @@ static void test_SysAllocString(void)
   if (str)
   {
     LPINTERNAL_BSTR bstr = Get(str);
+    DWORD_PTR p = (DWORD_PTR)str;
+    int align = sizeof(void *);
 
     ok (bstr->dwLen == 8, "Expected 8, got %d\n", bstr->dwLen);
     ok (!lstrcmpW(bstr->szString, szTest), "String different\n");
+    ok ((p & ~(align-1)) == p, "Not aligned to %d\n", align);
     SysFreeString(str);
   }
 }
-- 
2.7.0




More information about the wine-patches mailing list