Module: wine Branch: master Commit: 2803516d26496129226a5a93c91a788cf3f9f140 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2803516d26496129226a5a93c9...
Author: Rob Shearman robertshearman@gmail.com Date: Tue Feb 17 09:48:25 2009 +0000
ole32: Round the extected size in the marshal and moniker tests using the results of sizing a global, not a heap pointer.
The rounding isn't the same on Win9x, and the size being compared to is that of a global handle.
---
dlls/ole32/tests/marshal.c | 18 +++++++++--------- dlls/ole32/tests/moniker.c | 26 +++++++++++++------------- 2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c index 45e9950..8f6a7cc 100644 --- a/dlls/ole32/tests/marshal.c +++ b/dlls/ole32/tests/marshal.c @@ -2040,17 +2040,17 @@ static void test_WM_QUIT_handling(void) } }
-static SIZE_T round_heap_size(SIZE_T size) +static SIZE_T round_global_size(SIZE_T size) { - static SIZE_T heap_size_alignment = -1; - if (heap_size_alignment == -1) + static SIZE_T global_size_alignment = -1; + if (global_size_alignment == -1) { - void *p = HeapAlloc(GetProcessHeap(), 0, 1); - heap_size_alignment = HeapSize(GetProcessHeap(), 0, p); - HeapFree(GetProcessHeap(), 0, p); + void *p = GlobalAlloc(GMEM_FIXED, 1); + global_size_alignment = GlobalSize(p); + GlobalFree(p); }
- return ((size + heap_size_alignment - 1) & ~(heap_size_alignment - 1)); + return ((size + global_size_alignment - 1) & ~(global_size_alignment - 1)); }
static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *ptr, DWORD mshlflags) @@ -2069,9 +2069,9 @@ static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *
if (mshctx == MSHCTX_INPROC) { - DWORD expected_size = round_heap_size(3*sizeof(DWORD) + sizeof(GUID)); + DWORD expected_size = round_global_size(3*sizeof(DWORD) + sizeof(GUID)); ok(size == expected_size || - broken(size == round_heap_size(2*sizeof(DWORD))) /* Win9x & NT4 */, + broken(size == round_global_size(2*sizeof(DWORD))) /* Win9x & NT4 */, "size should have been %d instead of %d\n", expected_size, size);
ok(*(DWORD *)marshal_data == mshlflags, "expected 0x%x, but got 0x%x for mshctx\n", mshlflags, *(DWORD *)marshal_data); diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 3501aa7..413045a 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -82,17 +82,17 @@ static void UnlockModule(void) InterlockedDecrement(&cLocks); }
-static SIZE_T round_heap_size(SIZE_T size) +static SIZE_T round_global_size(SIZE_T size) { - static SIZE_T heap_size_alignment = -1; - if (heap_size_alignment == -1) + static SIZE_T global_size_alignment = -1; + if (global_size_alignment == -1) { - void *p = HeapAlloc(GetProcessHeap(), 0, 1); - heap_size_alignment = HeapSize(GetProcessHeap(), 0, p); - HeapFree(GetProcessHeap(), 0, p); + void *p = GlobalAlloc(GMEM_FIXED, 1); + global_size_alignment = GlobalSize(p); + GlobalFree(p); }
- return ((size + heap_size_alignment - 1) & ~(heap_size_alignment - 1)); + return ((size + global_size_alignment - 1) & ~(global_size_alignment - 1)); }
static HRESULT WINAPI Test_IClassFactory_QueryInterface( @@ -1220,12 +1220,12 @@ static void test_moniker( moniker_data = GlobalLock(hglobal);
/* first check we have the right amount of data */ - ok(moniker_size == round_heap_size(sizeof_expected_moniker_saved_data), + ok(moniker_size == round_global_size(sizeof_expected_moniker_saved_data), "%s: Size of saved data differs (expected %d, actual %d)\n", - testname, (DWORD)round_heap_size(sizeof_expected_moniker_saved_data), moniker_size); + testname, (DWORD)round_global_size(sizeof_expected_moniker_saved_data), moniker_size);
/* then do a byte-by-byte comparison */ - for (i = 0; i < min(moniker_size, round_heap_size(sizeof_expected_moniker_saved_data)); i++) + for (i = 0; i < min(moniker_size, round_global_size(sizeof_expected_moniker_saved_data)); i++) { if (expected_moniker_saved_data[i] != moniker_data[i]) { @@ -1266,14 +1266,14 @@ static void test_moniker( moniker_data = GlobalLock(hglobal);
/* first check we have the right amount of data */ - ok(moniker_size == round_heap_size(sizeof_expected_moniker_marshal_data), + ok(moniker_size == round_global_size(sizeof_expected_moniker_marshal_data), "%s: Size of marshaled data differs (expected %d, actual %d)\n", - testname, (DWORD)round_heap_size(sizeof_expected_moniker_marshal_data), moniker_size); + testname, (DWORD)round_global_size(sizeof_expected_moniker_marshal_data), moniker_size);
/* then do a byte-by-byte comparison */ if (expected_moniker_marshal_data) { - for (i = 0; i < min(moniker_size, round_heap_size(sizeof_expected_moniker_marshal_data)); i++) + for (i = 0; i < min(moniker_size, round_global_size(sizeof_expected_moniker_marshal_data)); i++) { if (expected_moniker_marshal_data[i] != moniker_data[i]) {